Skip to content

Commit

Permalink
Issue #473
Browse files Browse the repository at this point in the history
- Aggiunto "Scarica avviso" quando non ancora pagata
- Aggiunto "Stampa ricevuta" quando pagata o riconciliata
  • Loading branch information
atatarelli committed Mar 17, 2022
1 parent 5f414fb commit 67bfbd2
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 10 deletions.
19 changes: 15 additions & 4 deletions wars/web-console/src/main/angular/console/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,18 @@ export class AppComponent implements OnInit, AfterContentChecked, IModalDialog,
a.push({ label: 'Scarica resoconto', type: UtilService.EXPORT_INCASSO });
break;
case UtilService.URL_PENDENZE+UtilService.URL_DETTAGLIO:
if(rsc.data.info && UtilService.USER_ACL.hasPendenze) {
if(rsc.data.info['stato'] == this.us.getKeyByValue(UtilService.STATI_PENDENZE, UtilService.STATI_PENDENZE.NON_ESEGUITA)) {
if (rsc.data.info && UtilService.USER_ACL.hasPendenze) {
if (rsc.data.info['stato'] === this.us.getKeyByValue(UtilService.STATI_PENDENZE, UtilService.STATI_PENDENZE.NON_ESEGUITA)) {
a.push({ label: 'Annulla pendenza', type: UtilService.PENDENZA });
a.push({ label: 'Scarica avviso', type: UtilService.SCARICA_AVVISO });
}
if(rsc.data.info['stato'] == this.us.getKeyByValue(UtilService.STATI_PENDENZE, UtilService.STATI_PENDENZE.ANNULLATA)) {
if (rsc.data.info['stato'] === this.us.getKeyByValue(UtilService.STATI_PENDENZE, UtilService.STATI_PENDENZE.ANNULLATA)) {
a.push({ label: 'Ripristina pendenza', type: UtilService.PENDENZA });
}
if ((rsc.data.info['stato'] === this.us.getKeyByValue(UtilService.STATI_PENDENZE, UtilService.STATI_PENDENZE.ESEGUITA)) ||
(rsc.data.info['stato'] === this.us.getKeyByValue(UtilService.STATI_PENDENZE, UtilService.STATI_PENDENZE.INCASSATA))) {
a.push({ label: 'Stampa ricevuta', type: UtilService.STAMPA_RICEVUTA });
}
}
a.push({ label: 'Scarica resoconto', type: UtilService.EXPORT_PENDENZA });
break;
Expand Down Expand Up @@ -355,7 +360,7 @@ export class AppComponent implements OnInit, AfterContentChecked, IModalDialog,
case 'Rendicontazioni e Incassi':
UtilService.USER_ACL.hasRendiIncassi = (acl.autorizzazioni.indexOf(UtilService._CODE.SCRITTURA) !== -1);
this._sideNavSetup.terMenu.push({ link: UtilService.URL_RENDICONTAZIONI, name: UtilService.TXT_RENDICONTAZIONI, xhttp: false, icon: false, sort: 0 });
// this._sideNavSetup.terMenu.push({ link: UtilService.URL_INCASSI, name: UtilService.TXT_INCASSI, xhttp: false, icon: false, sort: 1 });
// this._sideNavSetup.terMenu.push({ link: UtilService.URL_INCASSI, name: UtilService.TXT_INCASSI, xhttp: false, icon: false, sort: 1 });
this._sideNavSetup.menu.push({ link: UtilService.URL_INCASSI, name: UtilService.TXT_INCASSI, xhttp: false, icon: false, sort: 3 });
this._sideNavSetup.terMenu.push({ link: UtilService.URL_RISCOSSIONI, name: UtilService.TXT_RISCOSSIONI, xhttp: false, icon: false, sort: 1 });
break;
Expand Down Expand Up @@ -495,6 +500,12 @@ export class AppComponent implements OnInit, AfterContentChecked, IModalDialog,
case UtilService.EXPORT_TRACCIATO_ESITO:
(_componentRef)?_componentRef.instance.exportData(event.target.type):null;
break;
case UtilService.SCARICA_AVVISO:
(_componentRef) ? _componentRef.instance.scaricaAvviso(event.target.type) : null;
break;
case UtilService.STAMPA_RICEVUTA:
(_componentRef) ? _componentRef.instance.stampaRicevuta(event.target.type) : null;
break;
case UtilService.ESCLUDI_NOTIFICA:
(_componentRef)?_componentRef.instance.esclusioneNotifiche():null;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ import { NewStandardCollapse } from '../../../../classes/view/new-standard-colla
import { TwoColsCollapse } from '../../../../classes/view/two-cols-collapse';
import { HttpResponse } from '@angular/common/http';

declare let JSZip: any;
declare let FileSaver: any;

@Component({
selector: 'link-pendenze',
templateUrl: './pendenze-view.component.html',
Expand Down Expand Up @@ -577,4 +574,44 @@ export class PendenzeViewComponent implements IModalDialog, IExport, OnInit {
this.us.generateStructuredZip(dataCalls, structure, 'Pendenza_' + this.json.idA2A + '_' + this.json.idPendenza);
}, 500);
}

scaricaAvviso() {
const url = UtilService.URL_AVVISI + '/' + UtilService.EncodeURIComponent(this.json.dominio.idDominio) + '/' + UtilService.EncodeURIComponent(this.json.numeroAvviso);
const name = this.json.dominio.idDominio + '_' + this.json.numeroAvviso;

this.gps.pdf(url).subscribe(
(response) => {
this.gps.updateSpinner(false);
this.us.savePdf(response.body, name);
},
(error) => {
this.gps.updateSpinner(false);
this.us.onError(error);
}
);
}

stampaRicevuta() {
const item = this.tentativi.find((el) => {
return el.jsonP.stato === 'RT_ACCETTATA_PA';
});
if (item) {
const ref: any = UtilService.ExportMapLoopCfg(item.jsonP);
const url = '/rpp/' + UtilService.EncodeURIComponent(ref.iddRT) + '/' + UtilService.EncodeURIComponent(ref.iuvRT) + '/' + UtilService.EncodeURIComponent(ref.ccpRT) + '/rt';
const name = `Rt_${ref.iuvRT}_${ref.ccpRT}`;

this.gps.pdf(url).subscribe(
(response) => {
this.gps.updateSpinner(false);
this.us.savePdf(response.body, name);
},
(error) => {
this.gps.updateSpinner(false);
this.us.onError(error);
}
);
} else {
this.us.alert('Nessuan ricevuta trovata');
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -264,4 +264,21 @@ export class GovpayService {
});
}

pdf(path: string) {
this.updateSpinner(true);
const url = UtilService.RootByTOA() + path;
let headers = new HttpHeaders();
headers = headers.set('Content-Type', 'application/pdf');
headers = headers.set('Accept', 'application/pdf');
let method: any;
if (UtilService.TIMEOUT === false) {
method = this.http.get(url, { headers: headers, observe: 'response', responseType: 'blob' });
} else {
method = this.http.get(url, { headers: headers, observe: 'response', responseType: 'blob' }).timeout(UtilService.TIMEOUT);
}

return method.map((response) => {
return response;
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,8 @@ export class UtilService {
public static EXPORT_TRACCIATO_AVVISI: string = 'esporta_tracciato_avvisi';
public static ESCLUDI_NOTIFICA: string = 'escludi_notifica';
public static VISTA_COMPLETA_EVENTO_JSON: string = 'vista_completa_evento_json';
public static SCARICA_AVVISO: string = 'scarica_avviso';
public static STAMPA_RICEVUTA: string = 'stampa_ricevuta';

// CONNETTORI
public static CONNETTORI: SimpleListItem[] = [
Expand Down Expand Up @@ -1406,7 +1408,7 @@ export class UtilService {
}

filterEmptyFolders(zip: any) {
const folders = Object.values((zip.files || {})).reduce((files, element) => {
const folders = Object.values((zip.files || {})).reduce((files: any, element: any) => {
if (element.dir && !files[element.name]) {
files[element.name] = 0;
}
Expand Down Expand Up @@ -1438,6 +1440,17 @@ export class UtilService {
this.setCsv({});
}.bind(this));
}

/**
* Save Pdf
* @param {blob} pdfData
* @param {string} pdfName
*/
savePdf(pdfData: any, pdfName: string) {
const blob = new Blob([pdfData], { type: 'application/pdf' });
FileSaver(blob, pdfName + '.pdf');
}

// Fine export

/**
Expand Down Expand Up @@ -1478,7 +1491,6 @@ export class UtilService {
}
}


protected __loopFilesStructure(data: any, structure: any, folderIndex: number, index: number, zip: any) {
const folders = structure['folders'];
const names = structure['names'];
Expand Down Expand Up @@ -1802,7 +1814,7 @@ export class UtilService {
return UtilService.MAP_ACL(acl);
}

public static MAP_ACL(acl: string): string {
public static MAP_ACL(acl: string): string {
let map = acl;
switch(acl) {
case 'Anagrafica Creditore':
Expand Down

0 comments on commit 67bfbd2

Please sign in to comment.