feat: add collect_for_each flow type to bot-config UI

- Dropdown option '🌧 Registro por ítem' in both PHP-rendered cards
  and the addFlowCard() JS template
- Fields panel: endpoint lista, endpoint upload, campo ID, campo nombre,
  encabezado, pregunta por ítem, mensaje de éxito
- flowTabChange() now shows/hides ftg-foreach panel
- Save handler in index.php parses all flow_fe_* POST fields and
  builds the collect_for_each config object

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-06-29 10:40:15 -05:00
co-authored by Claude Sonnet 4.6
parent b45f0fbe51
commit fb61a6e027
2 changed files with 74 additions and 18 deletions
+16
View File
@@ -414,6 +414,13 @@ $routes = [
$flowSfGroups = $_POST['flow_sf_meta_group']?? [];
$flowSfFnames = $_POST['flow_sf_filename'] ?? [];
$flowSfCaps = $_POST['flow_sf_caption'] ?? [];
$flowFeSrcEps = $_POST['flow_fe_src_ep'] ?? [];
$flowFeUpEps = $_POST['flow_fe_up_ep'] ?? [];
$flowFeValFlds = $_POST['flow_fe_val_field'] ?? [];
$flowFeLblFlds = $_POST['flow_fe_lbl_field'] ?? [];
$flowFeHeaders = $_POST['flow_fe_header'] ?? [];
$flowFeQs = $_POST['flow_fe_question'] ?? [];
$flowFeSucTxts = $_POST['flow_fe_success'] ?? [];
$flows = [];
foreach ($flowKeys as $i => $fk) {
@@ -465,6 +472,15 @@ $routes = [
$f['meta_group'] = trim($flowSfGroups[$i] ?? '');
$f['filename'] = trim($flowSfFnames[$i] ?? '');
$f['caption'] = trim($flowSfCaps[$i] ?? '');
} elseif ($ftype === 'collect_for_each') {
$f['source_endpoint_key'] = trim($flowFeSrcEps[$i] ?? '');
$f['endpoint_key'] = trim($flowFeUpEps[$i] ?? '');
$f['value_field'] = trim($flowFeValFlds[$i] ?? 'id');
$f['label_field'] = trim($flowFeLblFlds[$i] ?? 'nombre');
$f['header'] = trim($flowFeHeaders[$i] ?? '');
$f['question'] = trim($flowFeQs[$i] ?? '');
$f['success_text'] = trim($flowFeSucTxts[$i] ?? '');
}
$flows[$fk] = $f;