@fluxhub/fluxhub-lib 19.0.233 → 19.0.235

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,469 @@ 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
+ // Stessa regola del pannello: senza un ruolo abilitato sull'attivita'
27833
+ // non si chiude. Il servizio non si fida del chiamante — chi deve agire
27834
+ // per conto del sistema lo dichiara con `force`.
27835
+ if (!opts.force && Number(task.can_close || 0) <= 0)
27836
+ return of({
27837
+ ok: false,
27838
+ task: task,
27839
+ msg: "Nessun ruolo abilitato su questa attivita'",
27840
+ });
27841
+ return this.claim_task(id_applicativo, id_documento, task, step, opts.username).pipe(switchMap((claim) => {
27842
+ if (!claim.ok)
27843
+ return of({
27844
+ ok: false,
27845
+ task: task,
27846
+ owner: claim.owner,
27847
+ msg: "Attivita' presa in carico da " + (claim.owner || '?'),
27848
+ });
27849
+ return this.close_task(id_applicativo, id_documento, task, opts.nota_task == null ? null : opts.nota_task, opts.username).pipe(switchMap((closed) => {
27850
+ if (!closed)
27851
+ return of({
27852
+ ok: false,
27853
+ task: task,
27854
+ msg: "Chiusura dell'attivita' non riuscita",
27855
+ });
27856
+ return this.after_close(id_applicativo, id_documento, step, task, opts);
27857
+ }));
27858
+ }));
27859
+ }));
27860
+ }));
27861
+ }
27862
+ /**
27863
+ * Dopo la chiusura: se restano task obbligatori aperti si notifica soltanto lo
27864
+ * sblocco dei dipendenti; se non ne restano si avanza (l'avanzamento ricalcola
27865
+ * da se' lettori e notifiche dello step di arrivo, quindi TASK_CLOSED sarebbe
27866
+ * rumore su uno step che stiamo lasciando).
27867
+ */
27868
+ after_close(id_applicativo, id_documento, step, task, opts) {
27869
+ return this.load_step_tasks(id_applicativo, id_documento, step, opts.username).pipe(switchMap((tasks) => {
27870
+ const open = this.required_tasks_open(tasks);
27871
+ if (open.length > 0 || opts.proceed === false)
27872
+ return this.notify_task_closed(id_applicativo, id_documento, task.uiid, opts.username).pipe(map(() => ({ ok: true, task: task })));
27873
+ return this.proceed_from_task(id_applicativo, id_documento, {
27874
+ ...opts,
27875
+ skip_tasks_check: true,
27876
+ }).pipe(map((pr) => ({ ok: true, task: task, proceed: pr })));
27877
+ }));
27878
+ }
27879
+ 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
27880
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: WkfService, providedIn: "root" });
27415
27881
  }
27416
27882
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: WkfService, decorators: [{
@@ -27418,7 +27884,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
27418
27884
  args: [{
27419
27885
  providedIn: "root",
27420
27886
  }]
27421
- }], ctorParameters: () => [{ type: i1$1.HttpClient }, { type: AppService }, { type: i3$1.ToastrService }, { type: UtilityService }] });
27887
+ }], ctorParameters: () => [{ type: i1$1.HttpClient }, { type: AppService }, { type: i3$1.ToastrService }, { type: UtilityService }, { type: QueryService }, { type: FileService }] });
27422
27888
 
27423
27889
  class win_assegna_a {
27424
27890
  dialogRef;
@@ -32368,6 +32834,58 @@ class FHWorkflowForm {
32368
32834
  * il dialog del motore va mostrato.
32369
32835
  */
32370
32836
  advance_confirmed = false;
32837
+ /**
32838
+ * Deroga attiva sull'avanzamento in corso: il livello dello step corrente si
32839
+ * risolve per solo step, senza pretendere che l'utente collegato sia uno dei
32840
+ * suoi attori. Acceso da `proceed_from_task()`, consumato a fine avanzamento.
32841
+ */
32842
+ proceed_ignore_actors = false;
32843
+ /**
32844
+ * Consente l'avanzamento automatico dello step a task tutti chiusi anche a chi
32845
+ * NON e' autore del documento (b_edit=false).
32846
+ *
32847
+ * Di default resta spento: il comportamento storico e' che avanzi solo un autore
32848
+ * dello step, e i portali gia' in produzione non devono cambiare da soli. Va
32849
+ * acceso nel form della pratica quando gli esecutori dei task NON coincidono con
32850
+ * gli attori dello step (caso tipico: task assegnati a variabili di flusso mentre
32851
+ * lo step e' di un altro ruolo), altrimenti la pratica resta ferma con tutte le
32852
+ * attivita' concluse in attesa che passi di li' un autore.
32853
+ */
32854
+ allow_proceed_from_task = false;
32855
+ /**
32856
+ * Avanzamento di step innescato dalla conclusione delle attivita': e' il procedi
32857
+ * classico (stesse transizioni, destinatari, notifiche e log) senza il vincolo
32858
+ * che chi lo esegue sia agganciato allo step corrente.
32859
+ *
32860
+ * @param salva_prima false (default) NON salva il form prima di avanzare. Chi
32861
+ * arriva qui non e' autore del documento: i suoi campi sono in sola lettura e
32862
+ * alcuni potrebbero non essere nemmeno renderizzati, quindi un salvataggio
32863
+ * scriverebbe valori che non ha mai visto. Si va dritti al ricarico del
32864
+ * documento, che e' cio' che innesca l'avanzamento (`doApprova`).
32865
+ *
32866
+ * Fuori dal form della pratica l'equivalente e' `WkfService.proceed_from_task()`.
32867
+ */
32868
+ proceed_from_task(salva_prima = false) {
32869
+ if (this.b_saving) {
32870
+ UtilityService.dlog('[TASK] proceed_from_task(): STOP, b_saving=true');
32871
+ return;
32872
+ }
32873
+ this.proceed_ignore_actors = true;
32874
+ if (salva_prima) {
32875
+ this.procedi();
32876
+ return;
32877
+ }
32878
+ this.oper = 'procedi';
32879
+ this.btnprocedi = true;
32880
+ if (!this.ck_field('proceed')) {
32881
+ UtilityService.dlog("[TASK] proceed_from_task(): STOP, ck_field('proceed')=false");
32882
+ this.btnprocedi = false;
32883
+ this.proceed_ignore_actors = false;
32884
+ return;
32885
+ }
32886
+ UtilityService.dlog('[TASK] proceed_from_task(): ok, load_document()');
32887
+ this.load_document();
32888
+ }
32371
32889
  /**
32372
32890
  * Validazione applicativa alla chiusura di un task.
32373
32891
  * La libreria non conosce i campi della pratica: il componente concreto fa
@@ -32619,6 +33137,24 @@ class FHWorkflowForm {
32619
33137
  }
32620
33138
  }
32621
33139
  }
33140
+ // Avanzamento innescato dalla chiusura dei task (proceed_from_task): il
33141
+ // livello corrente si prende PER SOLO STEP. Su uno step in modalita' task
33142
+ // chi conclude l'ultima attivita' obbligatoria spesso non e' un attore
33143
+ // dello step -- i ruoli dei task sono un altro insieme -- e senza questa
33144
+ // deroga l'avanzamento morirebbe sul [0x002] qui sotto.
33145
+ // Fallback puro: scatta solo dove prima si andava in errore.
33146
+ if (this.clevel == null && this.proceed_ignore_actors)
33147
+ for (let i = 0; i < this.livs.length; i++)
33148
+ if (this.livs[i].step == liv) {
33149
+ if (this.c_canale == '' ||
33150
+ this.livs[i].context == '' ||
33151
+ this.c_canale == this.livs[i].context) {
33152
+ this.clevel = this.livs[i];
33153
+ break;
33154
+ }
33155
+ if (this.clevel == null)
33156
+ this.clevel = this.livs[i];
33157
+ }
32622
33158
  }
32623
33159
  this.clevel = this.check_n_levels(this.clevel);
32624
33160
  if (this.clevel == null || this.clevel == '') {
@@ -32664,6 +33200,8 @@ class FHWorkflowForm {
32664
33200
  if (this.clevel == null) {
32665
33201
  UtilityService.dlog('[WKF] doApprova(): STOP, clevel NULL: nessun livello dello step corrente combacia con l utente');
32666
33202
  }
33203
+ // Deroga consumata: vale per il singolo avanzamento che l'ha accesa.
33204
+ this.proceed_ignore_actors = false;
32667
33205
  this.calcolanextandjump();
32668
33206
  }
32669
33207
  wkf_rule_before(transazioni, step, context, oper) {
@@ -34564,19 +35102,28 @@ class FHWorkflowForm {
34564
35102
  // per un avanzamento futuro (magari il recupero all'apertura).
34565
35103
  const confermato = this.advance_confirmed;
34566
35104
  this.advance_confirmed = false;
35105
+ // `allow_proceed_from_task` (opt-in del form) sostituisce il requisito
35106
+ // "chi avanza deve essere autore dello step": senza, una pratica i cui task
35107
+ // sono di ruoli diversi da quelli dello step resta ferma a task tutti chiusi.
35108
+ const puo_avanzare = this.b_edit || this.allow_proceed_from_task;
34567
35109
  if (this.step_mode == 'T' &&
34568
35110
  this.tasks_all_done &&
34569
- this.b_edit &&
35111
+ puo_avanzare &&
34570
35112
  !this.b_saving) {
34571
35113
  UtilityService.dlog('[TASK] -> avanzamento automatico', {
34572
35114
  gia_confermato_dall_utente: confermato,
35115
+ da_non_autore: !this.b_edit,
34573
35116
  });
34574
35117
  this.auto_advance = confermato;
34575
- this.procedi();
35118
+ if (this.b_edit)
35119
+ this.procedi();
35120
+ else
35121
+ this.proceed_from_task();
34576
35122
  }
34577
35123
  else if (this.step_mode == 'T' && this.tasks_all_done) {
34578
35124
  UtilityService.dlog('[TASK] tutti i task chiusi ma NON avanzo', {
34579
35125
  b_edit: this.b_edit,
35126
+ allow_proceed_from_task: this.allow_proceed_from_task,
34580
35127
  b_saving: this.b_saving,
34581
35128
  });
34582
35129
  }
@@ -35800,6 +36347,19 @@ class FHWorkflowTasksPanel {
35800
36347
  dt_agg;
35801
36348
  /** Abilita il rilascio forzato dei lock altrui (passare `is_Supervisor`). */
35802
36349
  is_supervisor = false;
36350
+ /**
36351
+ * Attivita' che NON si chiudono da qui perche' le gestisce un altro applicativo
36352
+ * (es. il task "ATTESA SCHEDA TECNICA" chiuso dalla scheda tecnica). Su queste
36353
+ * righe non compaiono i pulsanti di presa in carico e chiusura: al loro posto
36354
+ * viene mostrata l'indicazione configurata.
36355
+ *
36356
+ * [ext_tasks]="[{check_key:'50_ATTESA_SCHEDA_TEC', label:'Step avanzabile da scheda tecnica'}]"
36357
+ *
36358
+ * `check_key` e' la chiave di validazione del task (wkf2_config_step_tasks).
36359
+ * Il pulsante RIAPRI resta disponibile a task chiuso: e' la valvola di sicurezza
36360
+ * se l'applicativo esterno lo ha concluso per errore.
36361
+ */
36362
+ ext_tasks = [];
35803
36363
  title = 'Attività dello step';
35804
36364
  claim_label = 'PRENDI IN CARICO';
35805
36365
  release_label = 'Rilascia la presa in carico';
@@ -35827,15 +36387,18 @@ class FHWorkflowTasksPanel {
35827
36387
  progressPct = 0;
35828
36388
  /** Riferimento all'array task dell'ultimo ricalcolo. `load_step_tasks()` lo rimpiazza. */
35829
36389
  _lastTasksRef = null;
36390
+ /** Idem per `ext_tasks`: se cambia l'input vanno ricalcolate le indicazioni. */
36391
+ _lastExtRef = null;
35830
36392
  constructor(dialog, toastr) {
35831
36393
  this.dialog = dialog;
35832
36394
  this.toastr = toastr;
35833
36395
  }
35834
36396
  ngDoCheck() {
35835
36397
  const tasks = this.dt_agg?.step_tasks || null;
35836
- if (tasks === this._lastTasksRef)
36398
+ if (tasks === this._lastTasksRef && this.ext_tasks === this._lastExtRef)
35837
36399
  return; // confronto per riferimento: O(1)
35838
36400
  this._lastTasksRef = tasks;
36401
+ this._lastExtRef = this.ext_tasks;
35839
36402
  this.rebuild();
35840
36403
  }
35841
36404
  rebuild() {
@@ -35850,6 +36413,9 @@ class FHWorkflowTasksPanel {
35850
36413
  : '';
35851
36414
  t._data_txt = this.fmtDate(t.data_chiusura);
35852
36415
  t._presa_txt = this.fmtDate(t.data_presa);
36416
+ const ext = (this.ext_tasks || []).find((e) => !!e && !!t.check_key && e.check_key === t.check_key);
36417
+ t._ext_label = ext ? ext.label : '';
36418
+ t._ext_icon = ext && ext.icon ? ext.icon : 'open_in_new';
35853
36419
  }
35854
36420
  this.tasks = tasks;
35855
36421
  const req = tasks.filter((t) => t.required === 1);
@@ -35953,7 +36519,7 @@ class FHWorkflowTasksPanel {
35953
36519
  });
35954
36520
  }
35955
36521
  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: `
36522
+ 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
36523
  <div class="fh-tasks" *ngIf="dt_agg && dt_agg.step_mode === 'T'">
35958
36524
  <div class="fh-tasks-head">
35959
36525
  <span class="material-symbols-outlined">checklist</span>
@@ -36011,10 +36577,17 @@ class FHWorkflowTasksPanel {
36011
36577
  <div class="fh-task-note" *ngIf="t.nota">{{ t.nota }}</div>
36012
36578
  </div>
36013
36579
 
36580
+ <!-- Attivita' gestita da un altro applicativo: nessun pulsante, solo
36581
+ l'indicazione di dove si chiude (vedi input ext_tasks). -->
36582
+ <span class="fh-task-ext" *ngIf="t._ext_label && t.stato !== 1">
36583
+ <span class="material-symbols-outlined fh-lock-ico">{{ t._ext_icon }}</span>
36584
+ {{ t._ext_label }}
36585
+ </span>
36586
+
36014
36587
  <!-- Libero: si prende in carico. Chi vince la corsa lo decide il DB. -->
36015
36588
  <button
36016
36589
  mat-stroked-button
36017
- *ngIf="t.stato !== 1 && !t.preso_da"
36590
+ *ngIf="!t._ext_label && t.stato !== 1 && !t.preso_da"
36018
36591
  [disabled]="!t.can_close || t.locked || dt_agg.b_saving"
36019
36592
  [matTooltip]="t._tooltip"
36020
36593
  (click)="onClaim(t)"
@@ -36026,7 +36599,7 @@ class FHWorkflowTasksPanel {
36026
36599
  <button
36027
36600
  mat-flat-button
36028
36601
  color="primary"
36029
- *ngIf="t.stato !== 1 && t.mine === 1"
36602
+ *ngIf="!t._ext_label && t.stato !== 1 && t.mine === 1"
36030
36603
  [disabled]="dt_agg.b_saving"
36031
36604
  (click)="onClose(t)"
36032
36605
  >
@@ -36034,7 +36607,7 @@ class FHWorkflowTasksPanel {
36034
36607
  </button>
36035
36608
  <button
36036
36609
  mat-icon-button
36037
- *ngIf="t.stato !== 1 && t.mine === 1"
36610
+ *ngIf="!t._ext_label && t.stato !== 1 && t.mine === 1"
36038
36611
  [matTooltip]="release_label"
36039
36612
  (click)="onRelease(t, false)"
36040
36613
  >
@@ -36065,7 +36638,7 @@ class FHWorkflowTasksPanel {
36065
36638
  </div>
36066
36639
  </div>
36067
36640
  </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"] }] });
36641
+ `, 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
36642
  }
36070
36643
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FHWorkflowTasksPanel, decorators: [{
36071
36644
  type: Component,
@@ -36134,10 +36707,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
36134
36707
  <div class="fh-task-note" *ngIf="t.nota">{{ t.nota }}</div>
36135
36708
  </div>
36136
36709
 
36710
+ <!-- Attivita' gestita da un altro applicativo: nessun pulsante, solo
36711
+ l'indicazione di dove si chiude (vedi input ext_tasks). -->
36712
+ <span class="fh-task-ext" *ngIf="t._ext_label && t.stato !== 1">
36713
+ <span class="material-symbols-outlined fh-lock-ico">{{ t._ext_icon }}</span>
36714
+ {{ t._ext_label }}
36715
+ </span>
36716
+
36137
36717
  <!-- Libero: si prende in carico. Chi vince la corsa lo decide il DB. -->
36138
36718
  <button
36139
36719
  mat-stroked-button
36140
- *ngIf="t.stato !== 1 && !t.preso_da"
36720
+ *ngIf="!t._ext_label && t.stato !== 1 && !t.preso_da"
36141
36721
  [disabled]="!t.can_close || t.locked || dt_agg.b_saving"
36142
36722
  [matTooltip]="t._tooltip"
36143
36723
  (click)="onClaim(t)"
@@ -36149,7 +36729,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
36149
36729
  <button
36150
36730
  mat-flat-button
36151
36731
  color="primary"
36152
- *ngIf="t.stato !== 1 && t.mine === 1"
36732
+ *ngIf="!t._ext_label && t.stato !== 1 && t.mine === 1"
36153
36733
  [disabled]="dt_agg.b_saving"
36154
36734
  (click)="onClose(t)"
36155
36735
  >
@@ -36157,7 +36737,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
36157
36737
  </button>
36158
36738
  <button
36159
36739
  mat-icon-button
36160
- *ngIf="t.stato !== 1 && t.mine === 1"
36740
+ *ngIf="!t._ext_label && t.stato !== 1 && t.mine === 1"
36161
36741
  [matTooltip]="release_label"
36162
36742
  (click)="onRelease(t, false)"
36163
36743
  >
@@ -36188,13 +36768,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
36188
36768
  </div>
36189
36769
  </div>
36190
36770
  </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"] }]
36771
+ `, 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
36772
  }], ctorParameters: () => [{ type: i1$2.MatDialog }, { type: i3$1.ToastrService, decorators: [{
36193
36773
  type: Optional
36194
36774
  }] }], propDecorators: { dt_agg: [{
36195
36775
  type: Input
36196
36776
  }], is_supervisor: [{
36197
36777
  type: Input
36778
+ }], ext_tasks: [{
36779
+ type: Input
36198
36780
  }], title: [{
36199
36781
  type: Input
36200
36782
  }], claim_label: [{