@fluxhub/fluxhub-lib 19.0.222 → 19.0.223

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32289,6 +32289,20 @@ class FHWorkflowForm {
32289
32289
  step_tasks = [];
32290
32290
  tasks_all_done = false;
32291
32291
  b_tasks_loading = false;
32292
+ /**
32293
+ * Editabilita' dei campi legati a un task, indicizzata per `check_key`.
32294
+ *
32295
+ * <FHTextInput [enabled]="task_edit['100_ATTESA_ACCONTO']" ...>
32296
+ *
32297
+ * E' una MAPPA e non un metodo perche' i template la interrogano a ogni change
32298
+ * detection: un metodo verrebbe rieseguito ogni volta (vedi la regola sui getter
32299
+ * dinamici). Viene ricalcolata da `load_step_tasks()`, cioe' all'apertura del documento
32300
+ * e dopo ogni presa in carico, chiusura o riapertura: esattamente gli eventi che possono
32301
+ * cambiare la risposta.
32302
+ *
32303
+ * Chiave assente = false (nessun task con quella `check_key` nello step corrente).
32304
+ */
32305
+ task_edit = {};
32292
32306
  /**
32293
32307
  * Avanzamento innescato dalla chiusura dell'ultimo task, non da un click su Procedi.
32294
32308
  *
@@ -34463,6 +34477,7 @@ class FHWorkflowForm {
34463
34477
  return;
34464
34478
  this.step_tasks = (data.result_data || []).map((t) => ({
34465
34479
  ...t,
34480
+ step: Number(t.step || 0),
34466
34481
  stato: Number(t.stato || 0),
34467
34482
  required: Number(t.required || 0),
34468
34483
  note_required: Number(t.note_required || 0),
@@ -34471,6 +34486,7 @@ class FHWorkflowForm {
34471
34486
  mine: Number(t.mine || 0),
34472
34487
  }));
34473
34488
  this.recompute_tasks_done();
34489
+ this.recompute_task_edit();
34474
34490
  // I portali che denormalizzano lo stato dei task in colonne proprie si
34475
34491
  // riallineano qui: apertura documento, presa in carico, chiusura, riapertura.
34476
34492
  this.after_task_change();
@@ -34520,6 +34536,45 @@ class FHWorkflowForm {
34520
34536
  },
34521
34537
  });
34522
34538
  }
34539
+ /**
34540
+ * Un campo legato a questo task e' editabile adesso, da questo utente?
34541
+ *
34542
+ * Vero solo se TUTTE queste condizioni reggono:
34543
+ * - lo step corrente e' in modalita' task;
34544
+ * - esiste un task con quella `check_key` E APPARTIENE ALLO STEP CORRENTE: due step
34545
+ * diversi possono avere task con la stessa chiave, e la lista in memoria potrebbe
34546
+ * essere di uno step gia' lasciato (l'avanzamento e' asincrono);
34547
+ * - il task e' ANCORA APERTO (chiuso = dati congelati; per correggere si riapre);
34548
+ * - il task e' PRESO IN CARICO DA TE (`mine`): chi non l'ha preso non tocca i campi,
34549
+ * nemmeno se ha il ruolo giusto -- e' il senso della presa in carico;
34550
+ * - il task non e' BLOCCATO da una dipendenza ancora aperta;
34551
+ * - il documento non e' in uno stato finale (>= 900).
34552
+ *
34553
+ * Non richiede `b_edit`: l'autore dello step e l'esecutore di un task possono essere
34554
+ * persone diverse. E' la presa in carico a dare il diritto di scrittura sui campi
34555
+ * di quel task.
34556
+ */
34557
+ task_editable(check_key) {
34558
+ if (this.step_mode != 'T' || !check_key)
34559
+ return false;
34560
+ const stato = Number(this.m_obj?.stato);
34561
+ if (!isNaN(stato) && stato >= 900)
34562
+ return false;
34563
+ const t = this.step_tasks.find((x) => x.check_key === check_key && Number(x.step) === stato);
34564
+ if (t == null)
34565
+ return false;
34566
+ return t.stato == 0 && Number(t.mine || 0) == 1 && !t.locked;
34567
+ }
34568
+ /** Ricostruisce la mappa `task_edit` (una entry per ogni task con `check_key`). */
34569
+ recompute_task_edit() {
34570
+ const m = {};
34571
+ for (const t of this.step_tasks) {
34572
+ if (!t.check_key)
34573
+ continue;
34574
+ m[t.check_key] = this.task_editable(t.check_key);
34575
+ }
34576
+ this.task_edit = m;
34577
+ }
34523
34578
  /** Tutti i task OBBLIGATORI chiusi? I facoltativi non bloccano l'avanzamento. */
34524
34579
  recompute_tasks_done() {
34525
34580
  const req = this.step_tasks.filter((t) => t.required == 1);
@@ -34776,6 +34831,7 @@ class FHWorkflowForm {
34776
34831
  else {
34777
34832
  this.step_tasks = [];
34778
34833
  this.tasks_all_done = false;
34834
+ this.task_edit = {};
34779
34835
  }
34780
34836
  }
34781
34837
  });