Skip to content

Commit

Permalink
Riconciliazioni: nuova visualizzazione dei "Pagamenti riconciliati"
Browse files Browse the repository at this point in the history
  • Loading branch information
atatarelli committed Nov 17, 2021
1 parent e98e35e commit 91aba83
Show file tree
Hide file tree
Showing 12 changed files with 351 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { StandardViewComponent } from '../elements/item-view/views/standard-view
import { CronoViewComponent } from '../elements/item-view/views/crono-view/crono-view.component';
import { CronoCodeViewComponent } from '../elements/item-view/views/crono-code-view/crono-code-view.component';
import { KeyValueViewComponent } from '../elements/item-view/views/key-value-view/key-value-view.component';
import { KeyJsonViewComponent } from '../elements/item-view/views/key-json-view/key-json-view.component';
import { TwoColsViewComponent } from '../elements/item-view/views/two-cols-view/two-cols-view.component';
import { TwoColsCollapseViewComponent } from '../elements/item-view/views/two-cols-collapse-view/two-cols-collapse-view.component';

Expand Down Expand Up @@ -45,6 +46,7 @@ import { RendicontazioniViewComponent } from '../elements/detail-view/views/rend
import { IncassiViewComponent } from '../elements/detail-view/views/incassi-view/incassi-view.component';
import { IncassoViewComponent } from '../elements/detail-view/views/dialog-view/dialog-views/incasso-view/incasso-view.component';
import { StandardCollapseViewComponent } from '../elements/item-view/views/standard-collapse-view/standard-collapse-view.component';
import { NewStandardCollapseViewComponent } from '../elements/item-view/views/new-standard-collapse-view/new-standard-collapse-view.component';
import { RuoloViewComponent } from '../elements/detail-view/views/dialog-view/dialog-views/ruolo-view/ruolo-view.component';
import { TracciatiViewComponent } from '../elements/detail-view/views/tracciati-view/tracciati-view.component';
import { TracciatoViewComponent } from '../elements/detail-view/views/dialog-view/dialog-views/tracciato-view/tracciato-view.component';
Expand Down Expand Up @@ -83,6 +85,7 @@ export class EntryPointList {
OperatoriViewComponent,
StandardViewComponent,
StandardCollapseViewComponent,
NewStandardCollapseViewComponent,
RiepilogoViewComponent,
StazioneViewComponent,
IncassoViewComponent,
Expand All @@ -105,6 +108,7 @@ export class EntryPointList {
CronoViewComponent,
CronoCodeViewComponent,
KeyValueViewComponent,
KeyJsonViewComponent,
TwoColsViewComponent,
TwoColsCollapseViewComponent,
InputViewComponent,
Expand Down Expand Up @@ -180,6 +184,9 @@ export class EntryPointList {
case UtilService.STANDARD_COLLAPSE:
_type = StandardCollapseViewComponent;
break;
case UtilService.NEW_STANDARD_COLLAPSE:
_type = NewStandardCollapseViewComponent;
break;
case UtilService.TWO_COLS:
_type = TwoColsViewComponent;
break;
Expand All @@ -189,6 +196,9 @@ export class EntryPointList {
case UtilService.KEY_VALUE:
_type = KeyValueViewComponent;
break;
case UtilService.KEY_JSON:
_type = KeyJsonViewComponent;
break;
//Dialog views
case UtilService.SCHEDA_PENDENZA:
_type = SchedaPendenzaViewComponent;
Expand Down Expand Up @@ -357,6 +367,9 @@ export class EntryPointList {
case 'StandardCollapseViewComponent':
_name = UtilService.STANDARD_COLLAPSE;
break;
case 'NewStandardCollapseViewComponent':
_name = UtilService.NEW_STANDARD_COLLAPSE;
break;
case 'TwoColsViewComponent':
_name = UtilService.TWO_COLS;
break;
Expand All @@ -366,6 +379,9 @@ export class EntryPointList {
case 'KeyValueViewComponent':
_name = UtilService.KEY_VALUE;
break;
case 'KeyJsonViewComponent':
_name = UtilService.KEY_JSON;
break;
//Dialog views
case 'StazioneViewComponent':
_name = UtilService.STAZIONE;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
export class DatoEx {

label: string = '';
value: any = null;
type: string = '';

constructor (_data?: any) {
if(_data) {
for (let key in _data) {
if(this.hasOwnProperty(key)) {
this[key] = _data[key];
}
}
}
}

/**
* datoToString
* @param {string} separator: default ': '
* @returns {string}
*/
datoToString(separator: string = ': '): string {
return this.label + separator + this.value;
}

/**
* arraysToString
* @param {string[]} labels
* @param {string[]} values
* @param {string} separator: default ' '
* @returns {string}
*/
public static arraysToString(labels: string[], values: string[], separator: string = ' '): string {
let sst = [];
labels.forEach((s, i) => {
sst.push(s + ': ' + values[i]);
});

return sst.join(separator);
}

/**
* concatStrings
* @param {string[]} labels
* @param {string} separator: default ' '
* @returns {string}
*/
public static concatStrings(labels: string[], separator: string = ' '): string {
let sst = [];
labels.forEach((s) => {
if(s) {
sst.push(s);
}
});

return sst.join(separator);
}

/**
* Array of strings to Dato object (label only)
* @param {string[]} labels
* @param {string[]} values
* @param {string} separator
* @returns {Dato}
* @private
*/
public static arraysToDato(labels: string[], values: string[], separator: string = ' '): DatoEx {
let sst = [];
labels.forEach((s, i) => {
sst.push(s+': '+ values[i]);
});

return new DatoEx({ label: sst.join(separator), value: '' });
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Standard } from './standard';

export class NewStandardCollapse extends Standard {

motivo: string = null;
elenco: any[] = null;

item: any = null;

constructor (_data?: any) {

super(_data);

if(_data) {
for (let key in _data) {
if(this.hasOwnProperty(key)) {
(_data[key] !== null && _data[key] !== undefined)?this[key] = _data[key]:null;
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Riepilogo } from '../../../../classes/view/riepilogo';
import { Parameters } from '../../../../classes/parameters';
import { Standard } from '../../../../classes/view/standard';
import { StandardCollapse } from '../../../../classes/view/standard-collapse';
import { NewStandardCollapse } from '../../../../classes/view/new-standard-collapse';
import { IExport } from '../../../../classes/interfaces/IExport';
import { isNullOrUndefined } from 'util';

Expand Down Expand Up @@ -86,18 +87,19 @@ export class IncassiViewComponent implements IModalDialog, IExport, AfterViewIni
let p = new Parameters();
p.jsonP = item;
p.model = this._mapNewItemByType(item, UtilService.URL_RISCOSSIONI);
p.type = UtilService.STANDARD_COLLAPSE;
p.type = UtilService.NEW_STANDARD_COLLAPSE;
return p;
}, this);
}

protected _mapNewItemByType(item: any, type: string): Standard {
let _stdC = new StandardCollapse();
let _stdC = new NewStandardCollapse();
switch(type) {
case UtilService.URL_RISCOSSIONI:
_stdC.titolo = new Dato({ value: item.vocePendenza.pendenza.causale });
_stdC.sottotitolo = new Dato({ label: Voce.IUV+': ', value: item.iuv });
_stdC.importo = this.us.currencyFormat(item.importo);
_stdC.item = item;
_stdC.elenco = [];
if (item.vocePendenza && item.vocePendenza.idVocePendenza) {
_stdC.elenco.push({ label: Voce.ID_VOCE_PENDENZA, value: item.vocePendenza.idVocePendenza });
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<div class="container">
<div class="row lh-130 regular-16 mb-2 break-all">
<div class="col-12 col-sm-4 color-gray lh-130 mb-2 mb-sm-0">{{info.label?info.label + ':':info.label}}</div>
<ng-container [ngSwitch]="info.type">
<div class="col-12 col-sm-8 quote" *ngSwitchCase="'quote'">
<table class="table table-bordered table-sm">
<thead>
<tr>
<th class="text-truncate" *ngFor="let key of quoteKeys">{{ quoteLabel[key] }}</th>
</tr>
</thead>
<tr *ngFor="let item of info.value" >
<td *ngFor="let key of quoteKeys">{{ item[key] }}</td>
</tr>
</table>
</div>
<div class="col-12 col-sm-8" *ngSwitchDefault>
<!-- <mat-expansion-panel class="mat-elevation-z0 px-0 py-0">
<mat-expansion-panel-header><mat-panel-title><mat-icon>visibility</mat-icon></mat-panel-title></mat-expansion-panel-header> -->
<div class="contenuto-json border"><div><pre>{{ info.value | json }}</pre></div></div>
<!-- </mat-expansion-panel> -->
</div>
</ng-container>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
:host ::ng-deep {

.table-sm {
font-size: 14px;
}

.contenuto-json {
height: 250px;
overflow: auto;
padding: 5px;
}

.mat-expansion-panel-header {
padding: 0;
height: 18px !important;
}

.mat-expansion-panel-body {
padding: 0 0 16px;
margin-top: 16px;
}

.mat-expansion-panel-header:not([aria-disabled='true']):hover {
background-color: transparent !important;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
import { DatoEx } from '../../../../classes/view/dato-ex';

@Component({
selector: 'link-key-json-view',
templateUrl: './key-json-view.component.html',
styleUrls: ['./key-json-view.component.scss']
})
export class KeyJsonViewComponent implements OnInit, OnChanges {

@Input('info') info: DatoEx = new DatoEx();

quoteKeys: any[] = [];

// quoteOrder = ['capitolo', 'annoEsercizio', 'importo', 'titolo', 'accertamento', 'tipologia', 'categoria', 'articolo'];
quoteOrder = ['titolo', 'tipologia', 'categoria', 'capitolo', 'articolo', 'accertamento', 'annoEsercizio', 'importo'];
quoteLabel = {
capitolo: 'Capitolo',
annoEsercizio: 'Anno esercizio',
importo: 'Importo',
titolo: 'Titolo',
accertamento: 'Accertamento',
tipologia: 'Tipologia',
categoria: 'Categoria',
articolo: 'Articolo',
proprietaCustom: 'Proprieta custom'
};

constructor() { }

ngOnInit() {
}

ngOnChanges(changes: SimpleChanges) {
if (changes.info && changes.info.currentValue) {
this.prepareData();
}
}

prepareData() {
if ((this.info.type == 'quote') && this.info.value && this.info.value[0]) {
this.quoteKeys = Object.keys(this.info.value[0]);
const sorted = this.quoteKeys.sort((a, b) => this.quoteOrder.indexOf(a) - this.quoteOrder.indexOf(b));
this.quoteKeys = sorted;
}
}

// protected _setLabelStyle() {
// let _trunc: boolean = true;
// if(this.info && this.info.value && this.info.value.indexOf(' ') != -1) {
// _trunc = false;
// }
// return {
// 'text-truncate': _trunc,
// 'color-gray': true,
// 'my-0': true
// }
// }

// protected _tooltip(): string {
// if(this.info) {
// return this.info.label+': '+this.info.value;
// }
// return null;
// }

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div class="d-block">
<link-standard-view [info]="info" [dataRef]="dataRef" (click)="_collapse()" class="pointer"></link-standard-view>
<p class="mt-4" *ngIf="_expanded && info.motivo">{{info.motivo}}</p>
<div class="content-collapse mt-4" *ngIf="_expanded" @slideDownUp>
<ng-container *ngFor="let item of _elenco">
<link-key-value-view class="d-block link-key-value-fill-mat-card" [info]="item" *ngIf="item.type == 'string'"></link-key-value-view>
<link-key-json-view class="d-block link-key-value-fill-mat-card" [info]="item" *ngIf="item.type != 'string'"></link-key-json-view>
</ng-container>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@import '~@angular/material/theming';
@import '../../../../../styles/variables.scss';

p {
margin: 0;
}

.pointer {
cursor: pointer;
}

.content-collapse {
background-color: #ffffff;
margin-left: -20px;
margin-right: -20px;
padding-left: 20px;
padding-right: 20px;
}
Loading

0 comments on commit 91aba83

Please sign in to comment.