@fluxhub/fluxhub-lib 19.0.233 → 19.0.234

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.
@@ -10,7 +10,7 @@ import { AES } from 'crypto-ts';
10
10
  import * as i1 from '@angular/platform-browser';
11
11
  import * as i3 from '@ngx-translate/core';
12
12
  import { TranslateModule } from '@ngx-translate/core';
13
- import { Observable, Subject, forkJoin, throwError, BehaviorSubject, of } from 'rxjs';
13
+ import { Observable, Subject, forkJoin, of, throwError, BehaviorSubject } from 'rxjs';
14
14
  import * as i5$1 from '@angular/forms';
15
15
  import { NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms';
16
16
  import * as i5 from '@angular/common';
@@ -27329,12 +27329,16 @@ class WkfService {
27329
27329
  app_s;
27330
27330
  toastr;
27331
27331
  uti_s;
27332
+ q_s;
27333
+ f_s;
27332
27334
  headers;
27333
- constructor(http, app_s, toastr, uti_s) {
27335
+ constructor(http, app_s, toastr, uti_s, q_s, f_s) {
27334
27336
  this.http = http;
27335
27337
  this.app_s = app_s;
27336
27338
  this.toastr = toastr;
27337
27339
  this.uti_s = uti_s;
27340
+ this.q_s = q_s;
27341
+ this.f_s = f_s;
27338
27342
  this.url = this.app_s.API_ENDPOINT + this.app_s.WKF_ENDPOINT;
27339
27343
  }
27340
27344
  url = null;
@@ -27410,7 +27414,460 @@ class WkfService {
27410
27414
  throw err;
27411
27415
  }));
27412
27416
  }
27413
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: WkfService, deps: [{ token: i1$1.HttpClient }, { token: AppService }, { token: i3$1.ToastrService }, { token: UtilityService }], target: i0.ɵɵFactoryTarget.Injectable });
27417
+ // ===========================================================================
27418
+ // MOTORE WORKFLOW HEADLESS
27419
+ // ---------------------------------------------------------------------------
27420
+ // Le stesse operazioni che FHWorkflowForm esegue dentro il form della pratica
27421
+ // (lettura livelli, chiusura task, avanzamento di step) rese disponibili a
27422
+ // QUALSIASI componente: servono quando l'attivita' che fa avanzare il flusso
27423
+ // vive in un altro applicativo — es. una scheda tecnica che chiude il task
27424
+ // "ATTESA SCHEDA TECNICA" del flusso operativo.
27425
+ //
27426
+ // Sono metodi NUOVI: il percorso del form non passa di qui e non cambia
27427
+ // comportamento. Le query usate sono le stesse del motore.
27428
+ // ===========================================================================
27429
+ /** doQuery sul canale query standard (NON l'endpoint wkf di questo service). */
27430
+ q(sql, values, types) {
27431
+ const p = new QParam();
27432
+ p.sql = sql;
27433
+ p.values = values;
27434
+ p.types = types;
27435
+ return this.q_s.doQuery(p);
27436
+ }
27437
+ rows(r) {
27438
+ return r != null && r.result_msg == 'OK' && r.result_data != null
27439
+ ? r.result_data
27440
+ : [];
27441
+ }
27442
+ /**
27443
+ * I bit(1) di MySQL possono arrivare come true/false, 1/0 oppure come i byte
27444
+ * grezzi 0x01 / 0x00 a seconda del driver: qui vengono normalizzati tutti.
27445
+ */
27446
+ is_true(v) {
27447
+ if (v == null)
27448
+ return false;
27449
+ if (typeof v === 'boolean')
27450
+ return v;
27451
+ if (typeof v === 'number')
27452
+ return v != 0;
27453
+ const s = '' + v;
27454
+ if (s === String.fromCharCode(0))
27455
+ return false;
27456
+ if (s === String.fromCharCode(1))
27457
+ return true;
27458
+ const t = s.trim().toLowerCase();
27459
+ return t === '1' || t === 'true';
27460
+ }
27461
+ cur_user(opts) {
27462
+ return (opts && opts.username) || this.app_s.user || '';
27463
+ }
27464
+ dev_mode() {
27465
+ return this.app_s.dev_mode != null && this.app_s.dev_mode == '1';
27466
+ }
27467
+ // --- Letture -------------------------------------------------------------
27468
+ /**
27469
+ * Testata del documento di workflow (stato, canale, creatore, codice, oggetto).
27470
+ * Headless non abbiamo la vista applicativa del form: leggiamo `wkf_documents`.
27471
+ */
27472
+ load_wkf_document(id_applicativo, id_documento) {
27473
+ return this.q('SELECT_WKF_DOC_HEADER', [id_applicativo, id_documento], ['string', 'string']).pipe(map((r) => {
27474
+ const a = this.rows(r);
27475
+ return a.length > 0 ? a[0] : null;
27476
+ }));
27477
+ }
27478
+ /**
27479
+ * Livelli del workflow con le variabili speciali gia' risolte sul documento.
27480
+ *
27481
+ * Replica di quello che il form fa al load: `SELECT_WLIVELLIV2_2` da' i livelli
27482
+ * di configurazione (dove `value` puo' essere un ruolo o una variabile `*XXX`),
27483
+ * `SELECT_WKF_VARIABILES_V2` da' i valori delle variabili sul documento. I
27484
+ * livelli con una variabile non risolvibile vengono scartati, esattamente come
27485
+ * nel form: un livello senza utente non e' un destinatario valido.
27486
+ */
27487
+ load_wkf_levels(id_applicativo, id_documento, doc) {
27488
+ return forkJoin({
27489
+ liv: this.q('SELECT_WLIVELLIV2_2', [id_applicativo], ['string']),
27490
+ vars: this.q('SELECT_WKF_VARIABILES_V2', [id_documento], ['string']),
27491
+ }).pipe(map((res) => this.resolve_levels(this.rows(res.liv), this.rows(res.vars), doc)));
27492
+ }
27493
+ /**
27494
+ * Risoluzione delle variabili speciali sui livelli.
27495
+ *
27496
+ * NB: a differenza del form NON persiste la variabile REQUESTER mancante — un
27497
+ * avanzamento headless non deve scrivere configurazione di nascosto. La sintetizza
27498
+ * solo in memoria, dal creatore del documento.
27499
+ */
27500
+ resolve_levels(levels, vars, doc) {
27501
+ const v_list = (vars || []).slice();
27502
+ const stato = doc != null ? doc.stato : null;
27503
+ levels.forEach((v) => {
27504
+ if (v.username == null)
27505
+ v.username = 'SYSTEM';
27506
+ });
27507
+ v_list.push({
27508
+ k: '*CURRENT_USER',
27509
+ v: this.app_s.user,
27510
+ nc: this.app_s.user_surname + ' ' + this.app_s.user_name,
27511
+ });
27512
+ if (!v_list.some((v) => v.k === '*REQUESTER') && doc && doc.creatore)
27513
+ v_list.push({ k: '*REQUESTER', v: doc.creatore, nc: doc.creatore });
27514
+ if (stato == null || Number(stato) <= 10)
27515
+ v_list.push({
27516
+ k: '*ALLUSERS',
27517
+ v: this.app_s.user,
27518
+ nc: this.app_s.user_surname + ' ' + this.app_s.user_name,
27519
+ });
27520
+ else {
27521
+ const req = v_list.find((v) => ('' + v.k).split('CREATOR').join('REQUESTER') == '*REQUESTER');
27522
+ if (req != null)
27523
+ v_list.push({ k: '*ALLUSERS', v: req.v, nc: req.nc });
27524
+ }
27525
+ if (!v_list.some((v) => v.k === '*CREATOR')) {
27526
+ const req = v_list.find((v) => v.k === '*REQUESTER');
27527
+ if (req != null)
27528
+ v_list.push({ k: '*CREATOR', v: req.v, nc: req.nc });
27529
+ }
27530
+ levels.forEach((v) => {
27531
+ if (('' + v.value).indexOf('*') == 0) {
27532
+ v.context = doc != null ? doc.canale : '';
27533
+ v.description = '';
27534
+ v.name = '';
27535
+ v_list.forEach((v1) => {
27536
+ if (v.value == v1.k) {
27537
+ v.username = v1.v;
27538
+ v.nc = v1.nc;
27539
+ v.ncx = v1.nc;
27540
+ v.sost = true;
27541
+ }
27542
+ });
27543
+ }
27544
+ });
27545
+ return levels.filter((v) => v.value == '*SYSTEM' || ('' + v.value).indexOf('*') != 0 || v.sost);
27546
+ }
27547
+ /** Transizioni in uscita da uno step, in ordine di configurazione (`ord`). */
27548
+ load_wkf_transitions(id_applicativo, step_o) {
27549
+ return this.q('SELECT_TRANSAZIONI_FROM_LVL', [id_applicativo, step_o], ['string', 'int']).pipe(map((r) => this.rows(r)));
27550
+ }
27551
+ /** Attivita' (task) di uno step con lo stato sul documento. */
27552
+ load_step_tasks(id_applicativo, id_documento, step, username) {
27553
+ return this.q('SELECT_WKF_STEP_TASKS', [id_applicativo, id_documento, step, this.cur_user({ username })], ['string', 'string', 'int', 'string']).pipe(map((r) => this.rows(r)));
27554
+ }
27555
+ /** Task obbligatori dello step ancora aperti. */
27556
+ required_tasks_open(tasks) {
27557
+ return (tasks || []).filter((t) => Number(t.required || 0) == 1 && Number(t.stato || 0) != 1);
27558
+ }
27559
+ // --- Task ----------------------------------------------------------------
27560
+ /**
27561
+ * Presa in carico atomica: materializza la riga, tenta l'UPDATE condizionato su
27562
+ * `preso_da IS NULL`, poi rilegge il proprietario. Chi ha vinto la corsa lo
27563
+ * decide il DB, non il frontend.
27564
+ */
27565
+ claim_task(id_applicativo, id_documento, task, step, username) {
27566
+ const me = this.cur_user({ username });
27567
+ return this.q('INSERT_IGNORE_WKF_DOC_TASK', [id_applicativo, id_documento, task.uiid, step], ['string', 'string', 'string', 'int']).pipe(switchMap(() => this.q('CLAIM_WKF_DOC_TASK', [id_applicativo, id_documento, task.uiid, me], ['string', 'string', 'string', 'string'])), switchMap(() => this.q('SELECT_WKF_DOC_TASK_OWNER', [id_applicativo, id_documento, task.uiid], ['string', 'string', 'string'])), map((r) => {
27568
+ const a = this.rows(r);
27569
+ const owner = a.length > 0 ? a[0].preso_da || '' : '';
27570
+ return { ok: owner === me, owner: owner, task: task };
27571
+ }));
27572
+ }
27573
+ /**
27574
+ * Chiude un task gia' preso in carico. L'UPDATE porta `preso_da` nella WHERE:
27575
+ * se nel frattempo la presa in carico e' stata forzata via, la chiusura non passa.
27576
+ */
27577
+ close_task(id_applicativo, id_documento, task, nota, username) {
27578
+ return this.q('CLOSE_WKF_DOC_TASK', [
27579
+ id_applicativo,
27580
+ id_documento,
27581
+ task.uiid,
27582
+ this.cur_user({ username }),
27583
+ nota == null ? null : nota,
27584
+ ], ['string', 'string', 'string', 'string', 'string']).pipe(map((r) => r != null && r.result_msg == 'OK'));
27585
+ }
27586
+ /** Riapre un task chiuso, azzerando anche la presa in carico. */
27587
+ reopen_task(id_applicativo, id_documento, task) {
27588
+ return this.q('REOPEN_WKF_DOC_TASK', [id_applicativo, id_documento, task.uiid], ['string', 'string', 'string']).pipe(map((r) => r != null && r.result_msg == 'OK'));
27589
+ }
27590
+ /**
27591
+ * Segnala a exec_wkf la chiusura di un task: sblocco dei task dipendenti,
27592
+ * lettori e notifiche. La chiusura resta un UPDATE del frontend (serve l'esito
27593
+ * sincrono della corsa), qui passa solo l'evento.
27594
+ */
27595
+ notify_task_closed(id_applicativo, id_documento, uiid_task, username) {
27596
+ const uiid_op = this.uti_s.newGuid();
27597
+ return this.q('INSERT_WKF_OP', [
27598
+ uiid_op,
27599
+ JSON.stringify({
27600
+ op_type: 'TASK_CLOSED',
27601
+ uiid_task: uiid_task,
27602
+ id_applicazione: id_applicativo,
27603
+ id_documento: id_documento,
27604
+ username: this.cur_user({ username }),
27605
+ dev_mode: this.dev_mode() ? 1 : 0,
27606
+ }),
27607
+ ], ['string', 'string']).pipe(switchMap(() => this.run_exec_app('exec_wkf', uiid_op)));
27608
+ }
27609
+ // --- Avanzamento ---------------------------------------------------------
27610
+ /**
27611
+ * Avanzamento di step innescato dalla chiusura dei task: e' l'avanza classico
27612
+ * SENZA il vincolo che chi lo esegue sia agganciato allo step corrente.
27613
+ *
27614
+ * Nel form l'avanzamento richiede che l'utente compaia tra i livelli dello step
27615
+ * corrente (`doApprova` cerca il `clevel` che combacia con lui) e che sia autore
27616
+ * del documento (`b_edit`). Su uno step in modalita' task le due cose spesso non
27617
+ * coincidono: gli esecutori dei task sono LETTORI del documento, non autori, e i
27618
+ * ruoli dei task sono diversi da quelli dello step. Qui il livello corrente si
27619
+ * prende per solo step: chi ha chiuso l'ultimo task obbligatorio fa avanzare la
27620
+ * pratica, chiunque sia.
27621
+ *
27622
+ * Cosa NON fa (e va tenuto presente):
27623
+ * - non esegue `ck_after()` del form: le validazioni applicative legate
27624
+ * all'avanzamento vanno spostate su `ck_task()` del task che chiude lo step;
27625
+ * - non gestisce l'assegnazione manuale (`manual_assignment`/`pre_assegna_man`),
27626
+ * che richiede un dialog: in quel caso si ferma con MANUAL_ASSIGNMENT;
27627
+ * - con piu' transizioni in uscita non sceglie da solo se non glielo si dice
27628
+ * (`step_d` o `auto_forward`).
27629
+ */
27630
+ proceed_from_task(id_applicativo, id_documento, opts = {}) {
27631
+ return this.load_wkf_document(id_applicativo, id_documento).pipe(switchMap((doc) => {
27632
+ if (doc == null)
27633
+ return of({ ok: false, reason: 'NO_DOC' });
27634
+ const step_o = Number(doc.stato || 0);
27635
+ if (step_o >= 900)
27636
+ return of({
27637
+ ok: false,
27638
+ reason: 'CLOSED',
27639
+ step_o: step_o,
27640
+ });
27641
+ const tasks$ = opts.skip_tasks_check
27642
+ ? of([])
27643
+ : this.load_step_tasks(id_applicativo, id_documento, step_o, opts.username);
27644
+ return tasks$.pipe(switchMap((tasks) => {
27645
+ const open = this.required_tasks_open(tasks);
27646
+ if (!opts.skip_tasks_check && open.length > 0)
27647
+ return of({
27648
+ ok: false,
27649
+ reason: 'TASKS_OPEN',
27650
+ step_o: step_o,
27651
+ msg: open.map((t) => t.title).join(', '),
27652
+ });
27653
+ return this.do_proceed(id_applicativo, id_documento, doc, step_o, opts);
27654
+ }));
27655
+ }));
27656
+ }
27657
+ do_proceed(id_applicativo, id_documento, doc, step_o, opts) {
27658
+ return forkJoin({
27659
+ livs: this.load_wkf_levels(id_applicativo, id_documento, doc),
27660
+ trans: this.load_wkf_transitions(id_applicativo, step_o),
27661
+ }).pipe(switchMap((r) => {
27662
+ const livs = r.livs || [];
27663
+ const trans = r.trans || [];
27664
+ if (livs.length == 0)
27665
+ return of({ ok: false, reason: 'NO_LEVELS', step_o });
27666
+ // Livello corrente: per SOLO STEP, senza cercare l'utente collegato.
27667
+ // Serve il `context` per la scelta dei destinatari sullo step di arrivo.
27668
+ const clevel = livs.find((l) => Number(l.step) === step_o &&
27669
+ (doc.canale == null || doc.canale === '' || l.context === doc.canale)) || livs.find((l) => Number(l.step) === step_o);
27670
+ if (clevel == null)
27671
+ return of({
27672
+ ok: false,
27673
+ reason: 'NO_CURRENT_LEVEL',
27674
+ step_o,
27675
+ });
27676
+ const t = this.pick_transition(trans, step_o, opts);
27677
+ if (t == null)
27678
+ return of({
27679
+ ok: false,
27680
+ reason: trans.length == 0 ? 'NO_TRANSITION' : 'MULTIPLE_TRANSITIONS',
27681
+ step_o,
27682
+ transizioni: trans,
27683
+ });
27684
+ if (this.is_true(t.manual_assignment) || this.is_true(t.pre_assegna_man))
27685
+ return of({
27686
+ ok: false,
27687
+ reason: 'MANUAL_ASSIGNMENT',
27688
+ step_o,
27689
+ step_d: Number(t.step_d),
27690
+ msg: t.description,
27691
+ });
27692
+ const dest = this.build_recipients(livs, clevel, Number(t.step_d), doc, t);
27693
+ if (dest.length == 0)
27694
+ return of({
27695
+ ok: false,
27696
+ reason: 'NO_RECIPIENTS',
27697
+ step_o,
27698
+ step_d: Number(t.step_d),
27699
+ });
27700
+ return this.exec_wkf_op(id_applicativo, id_documento, doc, t, dest, opts).pipe(map(() => ({
27701
+ ok: true,
27702
+ reason: 'OK',
27703
+ step_o,
27704
+ step_d: Number(t.step_d),
27705
+ destinatari: dest,
27706
+ })));
27707
+ }));
27708
+ }
27709
+ /**
27710
+ * Scelta della transizione: esplicita (`step_d`), unica, oppure — con
27711
+ * `auto_forward` — la prima IN AVANTI in ordine di configurazione. Gli step
27712
+ * terminali/laterali (annullamento, sospensione...) non vengono mai scelti da
27713
+ * soli: sono decisioni di un operatore, non conseguenze di un task chiuso.
27714
+ */
27715
+ pick_transition(trans, step_o, opts) {
27716
+ if (trans.length == 0)
27717
+ return null;
27718
+ if (opts.step_d != null)
27719
+ return trans.find((x) => Number(x.step_d) === Number(opts.step_d)) || null;
27720
+ if (trans.length == 1)
27721
+ return trans[0];
27722
+ if (!opts.auto_forward)
27723
+ return null;
27724
+ const fwd = trans.filter((x) => Number(x.step_d) > step_o && Number(x.step_d) < 900);
27725
+ return fwd.length > 0 ? fwd[0] : null;
27726
+ }
27727
+ /**
27728
+ * Destinatari dello step di arrivo. Stessa logica del form (`calcola_destinari`):
27729
+ * livelli dello step di destinazione filtrati per canale, poi le restrizioni su
27730
+ * creatore (step iniziali), `default_value` e `pre_assegna_req`.
27731
+ */
27732
+ build_recipients(livs, clevel, step_d, doc, t) {
27733
+ const of_step = livs.filter((l) => Number(l.step) === step_d);
27734
+ let arr = [];
27735
+ if (clevel.context == null || clevel.context === '') {
27736
+ arr = of_step.slice();
27737
+ }
27738
+ else {
27739
+ const b_canale = of_step.some((l) => l.context !== '');
27740
+ arr = of_step.filter((l) => clevel.context === l.context || !b_canale || l.context === '*SYSTEM');
27741
+ }
27742
+ if (arr.length == 0)
27743
+ return arr;
27744
+ // Step iniziali: se il creatore e' tra i destinatari, la pratica torna a lui.
27745
+ if (step_d <= 10 && doc != null && doc.creatore) {
27746
+ const only_creator = arr.filter((v) => v.username == doc.creatore);
27747
+ if (only_creator.length > 0)
27748
+ arr = only_creator;
27749
+ }
27750
+ if (this.is_true(t.pre_assegna_req) && doc != null && doc.creatore) {
27751
+ const att = arr.filter((v) => v.username == doc.creatore);
27752
+ if (att.length > 0)
27753
+ arr = att;
27754
+ }
27755
+ const with_default = arr.filter((v) => Number(v.default_value || 0) == 1);
27756
+ if (with_default.length > 0)
27757
+ arr = with_default;
27758
+ arr.forEach((v) => {
27759
+ if (v.nc == null)
27760
+ v.nc = ('' + v.value).split('*').join('');
27761
+ });
27762
+ return arr;
27763
+ }
27764
+ /** Accoda l'operazione di avanzamento e lancia exec_wkf (o create_ver). */
27765
+ exec_wkf_op(id_applicativo, id_documento, doc, t, dest, opts) {
27766
+ const uiid_op = this.uti_s.newGuid();
27767
+ const crea_ver = this.is_true(t.create_ver);
27768
+ const clean = (s) => ('' + (s == null ? '' : s)).split('"').join('_doppiap_');
27769
+ const payload = crea_ver
27770
+ ? {
27771
+ transizione: {
27772
+ uiid_wkf: t.uiid_wkf,
27773
+ uiid: t.uiid,
27774
+ step_d: t.step_d,
27775
+ step_o: t.step_o,
27776
+ },
27777
+ commento: opts.nota || '',
27778
+ id_applicazione: id_applicativo,
27779
+ id_documento: id_documento,
27780
+ username: this.cur_user(opts),
27781
+ }
27782
+ : {
27783
+ transizione: t,
27784
+ destinatari: dest,
27785
+ commento: opts.nota || '',
27786
+ assegnati_paralleli: JSON.parse(JSON.stringify(dest)),
27787
+ id_applicazione: id_applicativo,
27788
+ id_documento: id_documento,
27789
+ username: this.cur_user(opts),
27790
+ title: clean(opts.title != null ? opts.title : doc.codice),
27791
+ descri: clean(opts.descri != null ? opts.descri : doc.oggetto),
27792
+ dev_mode: this.dev_mode() ? 1 : 0,
27793
+ };
27794
+ return this.q('INSERT_WKF_OP', [uiid_op, JSON.stringify(payload)], ['string', 'string']).pipe(switchMap(() => this.run_exec_app(crea_ver ? 'create_ver' : 'exec_wkf', uiid_op)));
27795
+ }
27796
+ run_exec_app(p1, uiid_op) {
27797
+ const fs = new FSInput();
27798
+ fs.command = 'exec_app';
27799
+ fs.p1 = p1;
27800
+ fs.p2 = uiid_op;
27801
+ return this.f_s.doQuery(fs);
27802
+ }
27803
+ // --- Operazione completa -------------------------------------------------
27804
+ /**
27805
+ * Chiude un task dello step corrente identificato dalla sua `check_key` e, se
27806
+ * era l'ultimo obbligatorio, fa avanzare lo step. E' il metodo pensato per gli
27807
+ * applicativi esterni al flusso: una sola chiamata, esito parlante.
27808
+ *
27809
+ * La presa in carico viene fatta qui: fuori dal pannello non ha senso chiedere
27810
+ * all'utente di prendere in carico un'attivita' che sta gia' eseguendo.
27811
+ */
27812
+ complete_task(id_applicativo, id_documento, check_key, opts = {}) {
27813
+ return this.load_wkf_document(id_applicativo, id_documento).pipe(switchMap((doc) => {
27814
+ if (doc == null)
27815
+ return of({ ok: false, msg: 'Documento non trovato' });
27816
+ const step = Number(doc.stato || 0);
27817
+ return this.load_step_tasks(id_applicativo, id_documento, step, opts.username).pipe(switchMap((tasks) => {
27818
+ const task = tasks.find((x) => x.check_key === check_key);
27819
+ if (task == null)
27820
+ return of({
27821
+ ok: false,
27822
+ msg: "L'attivita' non e' prevista nello step corrente",
27823
+ });
27824
+ if (Number(task.stato || 0) == 1)
27825
+ return of({ ok: false, task: task, msg: "Attivita' gia' conclusa" });
27826
+ if (Number(task.locked || 0) > 0)
27827
+ return of({
27828
+ ok: false,
27829
+ task: task,
27830
+ msg: "Attivita' bloccata da una dipendenza aperta",
27831
+ });
27832
+ return this.claim_task(id_applicativo, id_documento, task, step, opts.username).pipe(switchMap((claim) => {
27833
+ if (!claim.ok)
27834
+ return of({
27835
+ ok: false,
27836
+ task: task,
27837
+ owner: claim.owner,
27838
+ msg: "Attivita' presa in carico da " + (claim.owner || '?'),
27839
+ });
27840
+ return this.close_task(id_applicativo, id_documento, task, opts.nota_task == null ? null : opts.nota_task, opts.username).pipe(switchMap((closed) => {
27841
+ if (!closed)
27842
+ return of({
27843
+ ok: false,
27844
+ task: task,
27845
+ msg: "Chiusura dell'attivita' non riuscita",
27846
+ });
27847
+ return this.after_close(id_applicativo, id_documento, step, task, opts);
27848
+ }));
27849
+ }));
27850
+ }));
27851
+ }));
27852
+ }
27853
+ /**
27854
+ * Dopo la chiusura: se restano task obbligatori aperti si notifica soltanto lo
27855
+ * sblocco dei dipendenti; se non ne restano si avanza (l'avanzamento ricalcola
27856
+ * da se' lettori e notifiche dello step di arrivo, quindi TASK_CLOSED sarebbe
27857
+ * rumore su uno step che stiamo lasciando).
27858
+ */
27859
+ after_close(id_applicativo, id_documento, step, task, opts) {
27860
+ return this.load_step_tasks(id_applicativo, id_documento, step, opts.username).pipe(switchMap((tasks) => {
27861
+ const open = this.required_tasks_open(tasks);
27862
+ if (open.length > 0 || opts.proceed === false)
27863
+ return this.notify_task_closed(id_applicativo, id_documento, task.uiid, opts.username).pipe(map(() => ({ ok: true, task: task })));
27864
+ return this.proceed_from_task(id_applicativo, id_documento, {
27865
+ ...opts,
27866
+ skip_tasks_check: true,
27867
+ }).pipe(map((pr) => ({ ok: true, task: task, proceed: pr })));
27868
+ }));
27869
+ }
27870
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: WkfService, deps: [{ token: i1$1.HttpClient }, { token: AppService }, { token: i3$1.ToastrService }, { token: UtilityService }, { token: QueryService }, { token: FileService }], target: i0.ɵɵFactoryTarget.Injectable });
27414
27871
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: WkfService, providedIn: "root" });
27415
27872
  }
27416
27873
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: WkfService, decorators: [{
@@ -27418,7 +27875,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
27418
27875
  args: [{
27419
27876
  providedIn: "root",
27420
27877
  }]
27421
- }], ctorParameters: () => [{ type: i1$1.HttpClient }, { type: AppService }, { type: i3$1.ToastrService }, { type: UtilityService }] });
27878
+ }], ctorParameters: () => [{ type: i1$1.HttpClient }, { type: AppService }, { type: i3$1.ToastrService }, { type: UtilityService }, { type: QueryService }, { type: FileService }] });
27422
27879
 
27423
27880
  class win_assegna_a {
27424
27881
  dialogRef;
@@ -32368,6 +32825,58 @@ class FHWorkflowForm {
32368
32825
  * il dialog del motore va mostrato.
32369
32826
  */
32370
32827
  advance_confirmed = false;
32828
+ /**
32829
+ * Deroga attiva sull'avanzamento in corso: il livello dello step corrente si
32830
+ * risolve per solo step, senza pretendere che l'utente collegato sia uno dei
32831
+ * suoi attori. Acceso da `proceed_from_task()`, consumato a fine avanzamento.
32832
+ */
32833
+ proceed_ignore_actors = false;
32834
+ /**
32835
+ * Consente l'avanzamento automatico dello step a task tutti chiusi anche a chi
32836
+ * NON e' autore del documento (b_edit=false).
32837
+ *
32838
+ * Di default resta spento: il comportamento storico e' che avanzi solo un autore
32839
+ * dello step, e i portali gia' in produzione non devono cambiare da soli. Va
32840
+ * acceso nel form della pratica quando gli esecutori dei task NON coincidono con
32841
+ * gli attori dello step (caso tipico: task assegnati a variabili di flusso mentre
32842
+ * lo step e' di un altro ruolo), altrimenti la pratica resta ferma con tutte le
32843
+ * attivita' concluse in attesa che passi di li' un autore.
32844
+ */
32845
+ allow_proceed_from_task = false;
32846
+ /**
32847
+ * Avanzamento di step innescato dalla conclusione delle attivita': e' il procedi
32848
+ * classico (stesse transizioni, destinatari, notifiche e log) senza il vincolo
32849
+ * che chi lo esegue sia agganciato allo step corrente.
32850
+ *
32851
+ * @param salva_prima false (default) NON salva il form prima di avanzare. Chi
32852
+ * arriva qui non e' autore del documento: i suoi campi sono in sola lettura e
32853
+ * alcuni potrebbero non essere nemmeno renderizzati, quindi un salvataggio
32854
+ * scriverebbe valori che non ha mai visto. Si va dritti al ricarico del
32855
+ * documento, che e' cio' che innesca l'avanzamento (`doApprova`).
32856
+ *
32857
+ * Fuori dal form della pratica l'equivalente e' `WkfService.proceed_from_task()`.
32858
+ */
32859
+ proceed_from_task(salva_prima = false) {
32860
+ if (this.b_saving) {
32861
+ UtilityService.dlog('[TASK] proceed_from_task(): STOP, b_saving=true');
32862
+ return;
32863
+ }
32864
+ this.proceed_ignore_actors = true;
32865
+ if (salva_prima) {
32866
+ this.procedi();
32867
+ return;
32868
+ }
32869
+ this.oper = 'procedi';
32870
+ this.btnprocedi = true;
32871
+ if (!this.ck_field('proceed')) {
32872
+ UtilityService.dlog("[TASK] proceed_from_task(): STOP, ck_field('proceed')=false");
32873
+ this.btnprocedi = false;
32874
+ this.proceed_ignore_actors = false;
32875
+ return;
32876
+ }
32877
+ UtilityService.dlog('[TASK] proceed_from_task(): ok, load_document()');
32878
+ this.load_document();
32879
+ }
32371
32880
  /**
32372
32881
  * Validazione applicativa alla chiusura di un task.
32373
32882
  * La libreria non conosce i campi della pratica: il componente concreto fa
@@ -32619,6 +33128,24 @@ class FHWorkflowForm {
32619
33128
  }
32620
33129
  }
32621
33130
  }
33131
+ // Avanzamento innescato dalla chiusura dei task (proceed_from_task): il
33132
+ // livello corrente si prende PER SOLO STEP. Su uno step in modalita' task
33133
+ // chi conclude l'ultima attivita' obbligatoria spesso non e' un attore
33134
+ // dello step -- i ruoli dei task sono un altro insieme -- e senza questa
33135
+ // deroga l'avanzamento morirebbe sul [0x002] qui sotto.
33136
+ // Fallback puro: scatta solo dove prima si andava in errore.
33137
+ if (this.clevel == null && this.proceed_ignore_actors)
33138
+ for (let i = 0; i < this.livs.length; i++)
33139
+ if (this.livs[i].step == liv) {
33140
+ if (this.c_canale == '' ||
33141
+ this.livs[i].context == '' ||
33142
+ this.c_canale == this.livs[i].context) {
33143
+ this.clevel = this.livs[i];
33144
+ break;
33145
+ }
33146
+ if (this.clevel == null)
33147
+ this.clevel = this.livs[i];
33148
+ }
32622
33149
  }
32623
33150
  this.clevel = this.check_n_levels(this.clevel);
32624
33151
  if (this.clevel == null || this.clevel == '') {
@@ -32664,6 +33191,8 @@ class FHWorkflowForm {
32664
33191
  if (this.clevel == null) {
32665
33192
  UtilityService.dlog('[WKF] doApprova(): STOP, clevel NULL: nessun livello dello step corrente combacia con l utente');
32666
33193
  }
33194
+ // Deroga consumata: vale per il singolo avanzamento che l'ha accesa.
33195
+ this.proceed_ignore_actors = false;
32667
33196
  this.calcolanextandjump();
32668
33197
  }
32669
33198
  wkf_rule_before(transazioni, step, context, oper) {
@@ -34564,19 +35093,28 @@ class FHWorkflowForm {
34564
35093
  // per un avanzamento futuro (magari il recupero all'apertura).
34565
35094
  const confermato = this.advance_confirmed;
34566
35095
  this.advance_confirmed = false;
35096
+ // `allow_proceed_from_task` (opt-in del form) sostituisce il requisito
35097
+ // "chi avanza deve essere autore dello step": senza, una pratica i cui task
35098
+ // sono di ruoli diversi da quelli dello step resta ferma a task tutti chiusi.
35099
+ const puo_avanzare = this.b_edit || this.allow_proceed_from_task;
34567
35100
  if (this.step_mode == 'T' &&
34568
35101
  this.tasks_all_done &&
34569
- this.b_edit &&
35102
+ puo_avanzare &&
34570
35103
  !this.b_saving) {
34571
35104
  UtilityService.dlog('[TASK] -> avanzamento automatico', {
34572
35105
  gia_confermato_dall_utente: confermato,
35106
+ da_non_autore: !this.b_edit,
34573
35107
  });
34574
35108
  this.auto_advance = confermato;
34575
- this.procedi();
35109
+ if (this.b_edit)
35110
+ this.procedi();
35111
+ else
35112
+ this.proceed_from_task();
34576
35113
  }
34577
35114
  else if (this.step_mode == 'T' && this.tasks_all_done) {
34578
35115
  UtilityService.dlog('[TASK] tutti i task chiusi ma NON avanzo', {
34579
35116
  b_edit: this.b_edit,
35117
+ allow_proceed_from_task: this.allow_proceed_from_task,
34580
35118
  b_saving: this.b_saving,
34581
35119
  });
34582
35120
  }
@@ -35800,6 +36338,19 @@ class FHWorkflowTasksPanel {
35800
36338
  dt_agg;
35801
36339
  /** Abilita il rilascio forzato dei lock altrui (passare `is_Supervisor`). */
35802
36340
  is_supervisor = false;
36341
+ /**
36342
+ * Attivita' che NON si chiudono da qui perche' le gestisce un altro applicativo
36343
+ * (es. il task "ATTESA SCHEDA TECNICA" chiuso dalla scheda tecnica). Su queste
36344
+ * righe non compaiono i pulsanti di presa in carico e chiusura: al loro posto
36345
+ * viene mostrata l'indicazione configurata.
36346
+ *
36347
+ * [ext_tasks]="[{check_key:'50_ATTESA_SCHEDA_TEC', label:'Step avanzabile da scheda tecnica'}]"
36348
+ *
36349
+ * `check_key` e' la chiave di validazione del task (wkf2_config_step_tasks).
36350
+ * Il pulsante RIAPRI resta disponibile a task chiuso: e' la valvola di sicurezza
36351
+ * se l'applicativo esterno lo ha concluso per errore.
36352
+ */
36353
+ ext_tasks = [];
35803
36354
  title = 'Attività dello step';
35804
36355
  claim_label = 'PRENDI IN CARICO';
35805
36356
  release_label = 'Rilascia la presa in carico';
@@ -35827,15 +36378,18 @@ class FHWorkflowTasksPanel {
35827
36378
  progressPct = 0;
35828
36379
  /** Riferimento all'array task dell'ultimo ricalcolo. `load_step_tasks()` lo rimpiazza. */
35829
36380
  _lastTasksRef = null;
36381
+ /** Idem per `ext_tasks`: se cambia l'input vanno ricalcolate le indicazioni. */
36382
+ _lastExtRef = null;
35830
36383
  constructor(dialog, toastr) {
35831
36384
  this.dialog = dialog;
35832
36385
  this.toastr = toastr;
35833
36386
  }
35834
36387
  ngDoCheck() {
35835
36388
  const tasks = this.dt_agg?.step_tasks || null;
35836
- if (tasks === this._lastTasksRef)
36389
+ if (tasks === this._lastTasksRef && this.ext_tasks === this._lastExtRef)
35837
36390
  return; // confronto per riferimento: O(1)
35838
36391
  this._lastTasksRef = tasks;
36392
+ this._lastExtRef = this.ext_tasks;
35839
36393
  this.rebuild();
35840
36394
  }
35841
36395
  rebuild() {
@@ -35850,6 +36404,9 @@ class FHWorkflowTasksPanel {
35850
36404
  : '';
35851
36405
  t._data_txt = this.fmtDate(t.data_chiusura);
35852
36406
  t._presa_txt = this.fmtDate(t.data_presa);
36407
+ const ext = (this.ext_tasks || []).find((e) => !!e && !!t.check_key && e.check_key === t.check_key);
36408
+ t._ext_label = ext ? ext.label : '';
36409
+ t._ext_icon = ext && ext.icon ? ext.icon : 'open_in_new';
35853
36410
  }
35854
36411
  this.tasks = tasks;
35855
36412
  const req = tasks.filter((t) => t.required === 1);
@@ -35953,7 +36510,7 @@ class FHWorkflowTasksPanel {
35953
36510
  });
35954
36511
  }
35955
36512
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FHWorkflowTasksPanel, deps: [{ token: i1$2.MatDialog }, { token: i3$1.ToastrService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
35956
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: FHWorkflowTasksPanel, isStandalone: true, selector: "FHWorkflowTasksPanel", inputs: { dt_agg: "dt_agg", is_supervisor: "is_supervisor", title: "title", claim_label: "claim_label", release_label: "release_label", force_release_label: "force_release_label", in_charge_label: "in_charge_label", in_charge_you_label: "in_charge_you_label", claim_lost_label: "claim_lost_label", close_label: "close_label", reopen_label: "reopen_label", optional_label: "optional_label", closed_by_label: "closed_by_label", empty_label: "empty_label", no_role_label: "no_role_label", after_label: "after_label", locked_label: "locked_label", reopen_confirm: "reopen_confirm", note_label: "note_label", last_task_title: "last_task_title", last_task_confirm: "last_task_confirm" }, ngImport: i0, template: `
36513
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: FHWorkflowTasksPanel, isStandalone: true, selector: "FHWorkflowTasksPanel", inputs: { dt_agg: "dt_agg", is_supervisor: "is_supervisor", ext_tasks: "ext_tasks", title: "title", claim_label: "claim_label", release_label: "release_label", force_release_label: "force_release_label", in_charge_label: "in_charge_label", in_charge_you_label: "in_charge_you_label", claim_lost_label: "claim_lost_label", close_label: "close_label", reopen_label: "reopen_label", optional_label: "optional_label", closed_by_label: "closed_by_label", empty_label: "empty_label", no_role_label: "no_role_label", after_label: "after_label", locked_label: "locked_label", reopen_confirm: "reopen_confirm", note_label: "note_label", last_task_title: "last_task_title", last_task_confirm: "last_task_confirm" }, ngImport: i0, template: `
35957
36514
  <div class="fh-tasks" *ngIf="dt_agg && dt_agg.step_mode === 'T'">
35958
36515
  <div class="fh-tasks-head">
35959
36516
  <span class="material-symbols-outlined">checklist</span>
@@ -36011,10 +36568,17 @@ class FHWorkflowTasksPanel {
36011
36568
  <div class="fh-task-note" *ngIf="t.nota">{{ t.nota }}</div>
36012
36569
  </div>
36013
36570
 
36571
+ <!-- Attivita' gestita da un altro applicativo: nessun pulsante, solo
36572
+ l'indicazione di dove si chiude (vedi input ext_tasks). -->
36573
+ <span class="fh-task-ext" *ngIf="t._ext_label && t.stato !== 1">
36574
+ <span class="material-symbols-outlined fh-lock-ico">{{ t._ext_icon }}</span>
36575
+ {{ t._ext_label }}
36576
+ </span>
36577
+
36014
36578
  <!-- Libero: si prende in carico. Chi vince la corsa lo decide il DB. -->
36015
36579
  <button
36016
36580
  mat-stroked-button
36017
- *ngIf="t.stato !== 1 && !t.preso_da"
36581
+ *ngIf="!t._ext_label && t.stato !== 1 && !t.preso_da"
36018
36582
  [disabled]="!t.can_close || t.locked || dt_agg.b_saving"
36019
36583
  [matTooltip]="t._tooltip"
36020
36584
  (click)="onClaim(t)"
@@ -36026,7 +36590,7 @@ class FHWorkflowTasksPanel {
36026
36590
  <button
36027
36591
  mat-flat-button
36028
36592
  color="primary"
36029
- *ngIf="t.stato !== 1 && t.mine === 1"
36593
+ *ngIf="!t._ext_label && t.stato !== 1 && t.mine === 1"
36030
36594
  [disabled]="dt_agg.b_saving"
36031
36595
  (click)="onClose(t)"
36032
36596
  >
@@ -36034,7 +36598,7 @@ class FHWorkflowTasksPanel {
36034
36598
  </button>
36035
36599
  <button
36036
36600
  mat-icon-button
36037
- *ngIf="t.stato !== 1 && t.mine === 1"
36601
+ *ngIf="!t._ext_label && t.stato !== 1 && t.mine === 1"
36038
36602
  [matTooltip]="release_label"
36039
36603
  (click)="onRelease(t, false)"
36040
36604
  >
@@ -36065,7 +36629,7 @@ class FHWorkflowTasksPanel {
36065
36629
  </div>
36066
36630
  </div>
36067
36631
  </div>
36068
- `, isInline: true, styles: [".fh-tasks{border:1px solid rgba(0,0,0,.12);border-radius:8px;padding:10px 14px 6px;margin:8px 0;background:#fff}.fh-tasks-head{display:flex;align-items:center;gap:10px;margin-bottom:8px}.fh-tasks-title{font-weight:600}.fh-tasks-progress{font-size:12px;color:#6b6363;margin-left:auto}.fh-tasks-bar{width:120px;height:6px;border-radius:4px;background:#00000014;overflow:hidden}.fh-tasks-bar-fill{height:100%;background:#4caf50;transition:width .2s ease}.fh-tasks-empty{color:#6b6363;font-size:13px;padding:6px 0 10px}.fh-lane{margin-bottom:6px}.fh-task-dep{color:#6b6363;font-style:italic}.fh-task{display:flex;align-items:center;gap:10px;padding:6px 4px;border-top:1px solid rgba(0,0,0,.06)}.fh-task-done .fh-task-title{text-decoration:line-through;color:#6b6363}.fh-task-ico{color:#b0bec5}.fh-task-ico.done{color:#4caf50}.fh-task-ico.locked{color:#90a4ae}.fh-task-body{flex:1 1 auto;min-width:0}.fh-task-title{font-size:14px}.fh-task-opt{font-size:10px;font-weight:600;color:#6b6363;border:1px solid rgba(0,0,0,.18);border-radius:10px;padding:0 6px;margin-left:6px}.fh-task-meta{font-size:11px;color:#6b6363}.fh-task-lock{color:#e65100;font-weight:600}.fh-lock-ico{font-size:13px;vertical-align:text-bottom}.fh-task-note{font-size:12px;color:#455a64;font-style:italic;margin-top:2px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i9$1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i9$1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i8.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i9.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }] });
36632
+ `, isInline: true, styles: [".fh-tasks{border:1px solid rgba(0,0,0,.12);border-radius:8px;padding:10px 14px 6px;margin:8px 0;background:#fff}.fh-tasks-head{display:flex;align-items:center;gap:10px;margin-bottom:8px}.fh-tasks-title{font-weight:600}.fh-tasks-progress{font-size:12px;color:#6b6363;margin-left:auto}.fh-tasks-bar{width:120px;height:6px;border-radius:4px;background:#00000014;overflow:hidden}.fh-tasks-bar-fill{height:100%;background:#4caf50;transition:width .2s ease}.fh-tasks-empty{color:#6b6363;font-size:13px;padding:6px 0 10px}.fh-lane{margin-bottom:6px}.fh-task-dep{color:#6b6363;font-style:italic}.fh-task{display:flex;align-items:center;gap:10px;padding:6px 4px;border-top:1px solid rgba(0,0,0,.06)}.fh-task-done .fh-task-title{text-decoration:line-through;color:#6b6363}.fh-task-ico{color:#b0bec5}.fh-task-ico.done{color:#4caf50}.fh-task-ico.locked{color:#90a4ae}.fh-task-body{flex:1 1 auto;min-width:0}.fh-task-title{font-size:14px}.fh-task-opt{font-size:10px;font-weight:600;color:#6b6363;border:1px solid rgba(0,0,0,.18);border-radius:10px;padding:0 6px;margin-left:6px}.fh-task-meta{font-size:11px;color:#6b6363}.fh-task-lock{color:#e65100;font-weight:600}.fh-lock-ico{font-size:13px;vertical-align:text-bottom}.fh-task-note{font-size:12px;color:#455a64;font-style:italic;margin-top:2px}.fh-task-ext{flex:0 0 auto;display:inline-flex;align-items:center;gap:4px;font-size:12px;font-style:italic;color:#6b6363;border:1px dashed rgba(0,0,0,.18);border-radius:14px;padding:4px 10px;white-space:nowrap}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i9$1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: i9$1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i8.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i9.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }] });
36069
36633
  }
36070
36634
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FHWorkflowTasksPanel, decorators: [{
36071
36635
  type: Component,
@@ -36134,10 +36698,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
36134
36698
  <div class="fh-task-note" *ngIf="t.nota">{{ t.nota }}</div>
36135
36699
  </div>
36136
36700
 
36701
+ <!-- Attivita' gestita da un altro applicativo: nessun pulsante, solo
36702
+ l'indicazione di dove si chiude (vedi input ext_tasks). -->
36703
+ <span class="fh-task-ext" *ngIf="t._ext_label && t.stato !== 1">
36704
+ <span class="material-symbols-outlined fh-lock-ico">{{ t._ext_icon }}</span>
36705
+ {{ t._ext_label }}
36706
+ </span>
36707
+
36137
36708
  <!-- Libero: si prende in carico. Chi vince la corsa lo decide il DB. -->
36138
36709
  <button
36139
36710
  mat-stroked-button
36140
- *ngIf="t.stato !== 1 && !t.preso_da"
36711
+ *ngIf="!t._ext_label && t.stato !== 1 && !t.preso_da"
36141
36712
  [disabled]="!t.can_close || t.locked || dt_agg.b_saving"
36142
36713
  [matTooltip]="t._tooltip"
36143
36714
  (click)="onClaim(t)"
@@ -36149,7 +36720,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
36149
36720
  <button
36150
36721
  mat-flat-button
36151
36722
  color="primary"
36152
- *ngIf="t.stato !== 1 && t.mine === 1"
36723
+ *ngIf="!t._ext_label && t.stato !== 1 && t.mine === 1"
36153
36724
  [disabled]="dt_agg.b_saving"
36154
36725
  (click)="onClose(t)"
36155
36726
  >
@@ -36157,7 +36728,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
36157
36728
  </button>
36158
36729
  <button
36159
36730
  mat-icon-button
36160
- *ngIf="t.stato !== 1 && t.mine === 1"
36731
+ *ngIf="!t._ext_label && t.stato !== 1 && t.mine === 1"
36161
36732
  [matTooltip]="release_label"
36162
36733
  (click)="onRelease(t, false)"
36163
36734
  >
@@ -36188,13 +36759,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
36188
36759
  </div>
36189
36760
  </div>
36190
36761
  </div>
36191
- `, styles: [".fh-tasks{border:1px solid rgba(0,0,0,.12);border-radius:8px;padding:10px 14px 6px;margin:8px 0;background:#fff}.fh-tasks-head{display:flex;align-items:center;gap:10px;margin-bottom:8px}.fh-tasks-title{font-weight:600}.fh-tasks-progress{font-size:12px;color:#6b6363;margin-left:auto}.fh-tasks-bar{width:120px;height:6px;border-radius:4px;background:#00000014;overflow:hidden}.fh-tasks-bar-fill{height:100%;background:#4caf50;transition:width .2s ease}.fh-tasks-empty{color:#6b6363;font-size:13px;padding:6px 0 10px}.fh-lane{margin-bottom:6px}.fh-task-dep{color:#6b6363;font-style:italic}.fh-task{display:flex;align-items:center;gap:10px;padding:6px 4px;border-top:1px solid rgba(0,0,0,.06)}.fh-task-done .fh-task-title{text-decoration:line-through;color:#6b6363}.fh-task-ico{color:#b0bec5}.fh-task-ico.done{color:#4caf50}.fh-task-ico.locked{color:#90a4ae}.fh-task-body{flex:1 1 auto;min-width:0}.fh-task-title{font-size:14px}.fh-task-opt{font-size:10px;font-weight:600;color:#6b6363;border:1px solid rgba(0,0,0,.18);border-radius:10px;padding:0 6px;margin-left:6px}.fh-task-meta{font-size:11px;color:#6b6363}.fh-task-lock{color:#e65100;font-weight:600}.fh-lock-ico{font-size:13px;vertical-align:text-bottom}.fh-task-note{font-size:12px;color:#455a64;font-style:italic;margin-top:2px}\n"] }]
36762
+ `, styles: [".fh-tasks{border:1px solid rgba(0,0,0,.12);border-radius:8px;padding:10px 14px 6px;margin:8px 0;background:#fff}.fh-tasks-head{display:flex;align-items:center;gap:10px;margin-bottom:8px}.fh-tasks-title{font-weight:600}.fh-tasks-progress{font-size:12px;color:#6b6363;margin-left:auto}.fh-tasks-bar{width:120px;height:6px;border-radius:4px;background:#00000014;overflow:hidden}.fh-tasks-bar-fill{height:100%;background:#4caf50;transition:width .2s ease}.fh-tasks-empty{color:#6b6363;font-size:13px;padding:6px 0 10px}.fh-lane{margin-bottom:6px}.fh-task-dep{color:#6b6363;font-style:italic}.fh-task{display:flex;align-items:center;gap:10px;padding:6px 4px;border-top:1px solid rgba(0,0,0,.06)}.fh-task-done .fh-task-title{text-decoration:line-through;color:#6b6363}.fh-task-ico{color:#b0bec5}.fh-task-ico.done{color:#4caf50}.fh-task-ico.locked{color:#90a4ae}.fh-task-body{flex:1 1 auto;min-width:0}.fh-task-title{font-size:14px}.fh-task-opt{font-size:10px;font-weight:600;color:#6b6363;border:1px solid rgba(0,0,0,.18);border-radius:10px;padding:0 6px;margin-left:6px}.fh-task-meta{font-size:11px;color:#6b6363}.fh-task-lock{color:#e65100;font-weight:600}.fh-lock-ico{font-size:13px;vertical-align:text-bottom}.fh-task-note{font-size:12px;color:#455a64;font-style:italic;margin-top:2px}.fh-task-ext{flex:0 0 auto;display:inline-flex;align-items:center;gap:4px;font-size:12px;font-style:italic;color:#6b6363;border:1px dashed rgba(0,0,0,.18);border-radius:14px;padding:4px 10px;white-space:nowrap}\n"] }]
36192
36763
  }], ctorParameters: () => [{ type: i1$2.MatDialog }, { type: i3$1.ToastrService, decorators: [{
36193
36764
  type: Optional
36194
36765
  }] }], propDecorators: { dt_agg: [{
36195
36766
  type: Input
36196
36767
  }], is_supervisor: [{
36197
36768
  type: Input
36769
+ }], ext_tasks: [{
36770
+ type: Input
36198
36771
  }], title: [{
36199
36772
  type: Input
36200
36773
  }], claim_label: [{