Skip to content

Commit

Permalink
Enhancement - APP - Posibilidad de cambiar títulos en los filtros (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
jortilles authored Jun 6, 2024
1 parent fb001dc commit 6739447
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


<ng-template #filterTemplate>
<p-card [header]="header1">
<p-card >
<div class="grid">
<div class="col-12">
<div class="grid">
Expand Down Expand Up @@ -76,27 +76,35 @@

<div class="grid">

<div class="col-4">
<div class="col-3">
<p-dropdown id="selectFilerTable" [options]="targetTables" [(ngModel)]="targetTable"
filter="true" optionLabel="label" [style]="{'width': '100%'}"
i18n-placeholder="@@placeholderTables" placeholder="Entidades"
(onChange)="getColumnsByTable()" (onChange)="resetSelectedValues()" appendTo="body">
</p-dropdown>
</div>

<div class="col-4">
<div class="col-3">
<p-dropdown id="selectFilterColumn" [options]="targetCols" [(ngModel)]="targetCol"
filter="true" optionLabel="label" [style]="{'width': '100%'}"
i18n-placeholder="@@placeholderColumns" placeholder="Atributos"
(onChange)="loadGlobalFiltersData()" (onChange)="resetSelectedValues()" appendTo="body">
</p-dropdown>
</div>

<div class="col-4">
<div class="col-3" >
<input class = "d-flex justify-content-center" type="text" pInputText id="aliasName"
[style]="{'vertical-align' : 'bottom', width: '100%' }"
*ngIf="targetCol" [(ngModel)]="aliasValue" placeholder="Alias del filtro (opcional)"
i18n-placeholder="@@aliasValuePh"
/>
</div>

<div class="col-3">
<p-multiSelect id="selectFilterValue" class='eda-filter-multiselect'
*ngIf=" targetCol && targetCol.value.column_type !== 'date'" [options]="targetValues"
[(ngModel)]="selectedValues" [virtualScroll]="true" itemSize="30" display="chip"
[style]="{'vertical-align' : 'bottom', 'margin-left' : '15px', width: '100%' }"
[style]="{'vertical-align' : 'bottom', width: '100%' }"
[panelStyle]="{minWidth:'15em'}" maxSelectedLabels="1" defaultLabel="Valor por defecto" appendTo="body">
</p-multiSelect>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export class DashboardFilterDialogComponent extends EdaDialogAbstract {
public selectedRange : string = null;
public selectedFilter: any;
public datePickerConfigs: any = {};
public aliasValue : string = "";

// Global filters vars
public filtersList: Array<{ table, column, panelList, data, selectedItems, selectedRange, id, isGlobal, applyToAll, visible }> = [];
Expand Down Expand Up @@ -183,6 +184,10 @@ export class DashboardFilterDialogComponent extends EdaDialogAbstract {
return this.alertService.addWarning($localize`:@@mandatoryFields:Recuerde rellenar los campos obligatorios`);
}

if (this.aliasValue != "") {
this.targetCol.label = this.aliasValue;
}

this.filtersList.push({
id: this.fileUtils.generateUUID(),
table: this.targetTable,
Expand All @@ -205,6 +210,9 @@ export class DashboardFilterDialogComponent extends EdaDialogAbstract {
this.onClose(EdaDialogCloseEvent.NEW, response);
} else {
if (this.selectedFilter) {
if (this.aliasValue != "") {
this.targetCol.label = this.aliasValue;
}
this.selectedFilter.table = this.targetTable;
this.selectedFilter.column = this.targetCol;
this.selectedFilter.panelList = this.panelstoFilter.map(p => p.id);
Expand Down Expand Up @@ -248,6 +256,8 @@ export class DashboardFilterDialogComponent extends EdaDialogAbstract {
panel: '',
filters: []
};
//Recupero el alias value para restaurarlo a la hora de editarlo.
this.aliasValue = this.params.filter.column.label;
this.dashboardService.executeQuery(
this.queryBuilderService.normalQuery([this.targetCol.value], params)
).subscribe(
Expand Down Expand Up @@ -304,6 +314,7 @@ export class DashboardFilterDialogComponent extends EdaDialogAbstract {
}

public onEditFilter(filter: any): void {

this.targetTable = filter.table;
this.getColumnsByTable();
this.targetCol = this.targetCols.find((col) => col.value?.column_name === filter.column.value?.column_name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,30 @@
<div class="col-9">
<p-card *ngIf="formReady && !globalFilter.isdeleted" [header]="header3" id="anywhereClick">
<div class="row">
<div class="col-4">
<div class="col-3">
<p-dropdown id="selectFilerTable" [options]="tables"
[(ngModel)]="globalFilter.selectedTable" filter="true"
optionLabel="display_name.default" [style]="{'width': '100%'}"
i18n-placeholder="@@placeholderTables" placeholder="Entidades"
(onChange)="onChangeSelectedTable()" appendTo="body">
</p-dropdown>
</div>
<div class="col-4">
<div class="col-3">
<p-dropdown id="selectFilterColumn" [options]="columns"
[(ngModel)]="globalFilter.selectedColumn" filter="true"
optionLabel="display_name.default" [style]="{'width': '100%'}"
i18n-placeholder="@@placeholderColumns" placeholder="Atributos"
(onChange)="onChangeSelectedColumn()" appendTo="body">
</p-dropdown>
</div>
<div class="col-4">
<div class="col-3" >
<input class = "d-flex justify-content-center" type="text" pInputText id="aliasName"
[style]="{'vertical-align' : 'bottom', width: '100%' }"
[(ngModel)]="aliasValue"
placeholder="Alias del filtro (opcional)"
i18n-placeholder="@@aliasValuePh">
</div>
<div class="col-3">
<p-multiSelect id="selectFilterValue" class='eda-filter-multiselect'
*ngIf="globalFilter.selectedColumn?.column_type !== 'date'" [options]="columnValues"
[(ngModel)]="globalFilter.selectedItems" [virtualScroll]="true" itemSize="30"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class GlobalFilterDialogComponent implements OnInit, OnDestroy {
public greendot: string = $localize`:@@greendot:Paneles filtrados`;
public reddot: string = $localize`:@@reddot:Paneles no relacionados`;
public unselecteddot: string = $localize`:@@unselecteddot:Paneles no filtrados`;
public aliasValuePh : string = $localize`:@@aliasValuePh: Alias del filtro (opcional)`;

public tables: any[] = [];
public selectedTable: any;
Expand All @@ -53,6 +54,7 @@ export class GlobalFilterDialogComponent implements OnInit, OnDestroy {

public formReady: boolean = false;
public datePickerConfigs: any = {};
public aliasValue: string = "";

constructor(
private globalFilterService: GlobalFiltersService,
Expand Down Expand Up @@ -98,11 +100,13 @@ export class GlobalFilterDialogComponent implements OnInit, OnDestroy {
this.globalFilter.selectedTable = _.cloneDeep(this.tables.find((table) => table.table_name == tableName));

const columnName = this.globalFilter.selectedColumn.column_name;
// Recupero el display name que le haya podido poner.
const display_name_alias = this.globalFilter.selectedColumn.display_name.default;
this.globalFilter.selectedColumn = _.cloneDeep(this.globalFilter.selectedTable.columns.find((col: any) => col.column_name == columnName));

this.getColumnsByTable();
this.loadColumnValues();
this.findPanelPathTables();
this.aliasValue = display_name_alias;
}

this.formReady = true;
Expand Down Expand Up @@ -363,7 +367,7 @@ export class GlobalFilterDialogComponent implements OnInit, OnDestroy {

private validateGlobalFilter(): boolean {
let valid = true;

if (this.aliasValue != "") this.globalFilter.selectedColumn.display_name.default = this.aliasValue;
const availablePanels = this.filteredPanels.map((p) => p.id);

if (!this.globalFilter.isdeleted) {
Expand Down
5 changes: 4 additions & 1 deletion eda/eda_app/src/locale/messages.ca.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -4299,7 +4299,10 @@
<source>VALORES NULOS O VACÍOS (null or = '')</source>
<target>VALORS NULS O BUITS (null or = '')</target>
</trans-unit>

<trans-unit id="aliasValuePh">
<source>Alias del filtro (opcional)</source>
<target>Alias del filtre (opcional)</target>
</trans-unit>
</body>
</file>
</xliff>
5 changes: 4 additions & 1 deletion eda/eda_app/src/locale/messages.en.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -4273,7 +4273,10 @@
<source>VALORES NULOS O VACÍOS (null or = '')</source>
<target>NULL OR EMPTY VALUES (null or = '')</target>
</trans-unit>

<trans-unit id="aliasValuePh">
<source>Alias del filtro (opcional)</source>
<target>Filter alias (optional)</target>
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions eda/eda_app/src/locale/messages.es.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -4301,6 +4301,11 @@
<source>VALORES NULOS O VACÍOS (null or = '')</source>
<target>VALORES NULOS O VACÍOS (null or = '')</target>
</trans-unit>

<trans-unit id="aliasValuePh">
<source>Alias del filtro (opcional)</source>
<target>Alias del filtro (opcional)</target>
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions eda/eda_app/src/locale/messages.gl.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -4302,6 +4302,11 @@
<source>VALORES NULOS O VACÍOS (null or = '')</source>
<target>VALORES NULOS OU BALEIROS (null or = '')</target>
</trans-unit>

<trans-unit id="aliasValuePh">
<source>Alias del filtro (opcional)</source>
<target>Filtrar alias (opcional)</target>
</trans-unit>
</body>
</file>
</xliff>
5 changes: 4 additions & 1 deletion eda/eda_app/src/locale/messages.pl.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -3926,7 +3926,10 @@ Login<x id="CLOSE_BOLD_TEXT" ctype="x-b" equiv-text="&lt;/b&gt;"/>
<target>WARTOŚCI NULL LUB PUSTE (null or = '')</target>
</trans-unit>


<trans-unit id="aliasValuePh">
<source>Alias del filtro (opcional)</source>
<target>Alias ​​filtra (opcjonalnie)</target>
</trans-unit>
</body>
</file>
</xliff>

0 comments on commit 6739447

Please sign in to comment.