Datatables enhacements to support products (#1641)

Co-authored-by: Jose Alberto Hernandez <alberto@MacBook-Pro.local>
This commit is contained in:
José Alberto Hernández
2023-01-13 02:07:51 -06:00
committed by GitHub
co-authored by Jose Alberto Hernandez
parent 08a327fdbf
commit f330e91aa4
161 changed files with 2985 additions and 4971 deletions
@@ -72,6 +72,16 @@
<td mat-cell *matCellDef="let column"> {{ column.columnDisplayType }} </td>
</ng-container>
<ng-container matColumnDef="length">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Length </th>
<td mat-cell *matCellDef="let column"> {{ column.columnLength }} </td>
</ng-container>
<ng-container matColumnDef="code">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Code </th>
<td mat-cell *matCellDef="let column"> {{ column.columnCode }} </td>
</ng-container>
<ng-container matColumnDef="mandatory">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Mandatory </th>
<td mat-cell *matCellDef="let column" class="left">
@@ -82,14 +92,24 @@
</td>
</ng-container>
<ng-container matColumnDef="length">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Length </th>
<td mat-cell *matCellDef="let column"> {{ column.columnLength }} </td>
<ng-container matColumnDef="unique">
<th mat-header-cell *matHeaderCellDef mat-sort-header class="center"> Unique </th>
<td mat-cell *matCellDef="let column">
<fa-icon *ngIf="column.isColumnUnique" icon="check-circle" size="lg" class="column-mandatory"
matTooltip="Yes" matTooltipPosition="right"></fa-icon>
<fa-icon *ngIf="!column.isColumnUnique" icon="times-circle" size="lg" class="not-column-mandatory"
matTooltip="No" unique="right"></fa-icon>
</td>
</ng-container>
<ng-container matColumnDef="code">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Code </th>
<td mat-cell *matCellDef="let column"> {{ column.columnCode }} </td>
<ng-container matColumnDef="indexed">
<th mat-header-cell *matHeaderCellDef mat-sort-header class="center"> Indexed </th>
<td mat-cell *matCellDef="let column">
<fa-icon *ngIf="column.isColumnIndexed" icon="check-circle" size="lg" class="column-mandatory"
matTooltip="Yes" matTooltipPosition="right"></fa-icon>
<fa-icon *ngIf="!column.isColumnIndexed" icon="times-circle" size="lg" class="not-column-mandatory"
matTooltip="No" matTooltipPosition="right"></fa-icon>
</td>
</ng-container>
<ng-container matColumnDef="actions">
@@ -54,7 +54,7 @@ export class CreateDataTableComponent implements OnInit, AfterViewInit {
isColumnIndexed: undefined
};
/** Columns to be displayed in columns table. */
displayedColumns: string[] = ['name', 'type', 'mandatory', 'length', 'code', 'actions'];
displayedColumns: string[] = ['name', 'type', 'length', 'code', 'mandatory', 'unique', 'indexed', 'actions'];
/** Data source for columns table. */
dataSource: MatTableDataSource<any>;
/** Paginator for columns table. */
@@ -127,6 +127,7 @@ export class CreateDataTableComponent implements OnInit, AfterViewInit {
addColumn() {
this.dataForDialog.columnName = undefined;
this.dataForDialog.columnDisplayType = undefined;
this.dataForDialog.isColumnNullable = undefined;
this.dataForDialog.columnLength = undefined;
this.dataForDialog.columnCode = undefined;
this.dataForDialog.isColumnUnique = undefined;
@@ -159,13 +160,14 @@ export class CreateDataTableComponent implements OnInit, AfterViewInit {
* @param {any} column Column.
*/
editColumn(column: any) {
this.dataForDialog.columnName = column.name;
this.dataForDialog.columnDisplayType = column.type;
this.dataForDialog.columnLength = column.length;
this.dataForDialog.columnCode = column.code;
this.dataForDialog.isColumnUnique = column.unique;
this.dataForDialog.isColumnIndexed = column.indexed;
this.dataForDialog.type = 'new';
this.dataForDialog.columnName = column.columnName;
this.dataForDialog.columnDisplayType = column.columnDisplayType;
this.dataForDialog.isColumnNullable = !column.isColumnNullable;
this.dataForDialog.isColumnUnique = column.isColumnUnique;
this.dataForDialog.isColumnIndexed = column.isColumnIndexed;
this.dataForDialog.columnLength = column.columnLength;
this.dataForDialog.columnCode = column.columnCode;
this.dataForDialog.type = column.type;
const editColumnDialogRef = this.dialog.open(ColumnDialogComponent, {
data: this.dataForDialog,
height: '450px',
+26
View File
@@ -691,4 +691,30 @@ export class SystemService {
return this.http.put('/externalevents/configuration', payload);
}
/** Datatable Entries for Entities */
getEntityDatatables(appTable: string) {
const httpParams = new HttpParams().set('apptable', appTable);
return this.http.get(`/datatables`, { params: httpParams });
}
getEntityDatatable(entityId: string, datatableName: string) {
const httpParams = new HttpParams().set('genericResultSet', 'true');
return this.http.get(`/datatables/${datatableName}/${entityId}`, { params: httpParams });
}
addEntityDatatableEntry(entityId: string, datatableName: string, data: any) {
const httpParams = new HttpParams().set('genericResultSet', 'true');
return this.http.post(`/datatables/${datatableName}/${entityId}`, data, { params: httpParams });
}
editEntityDatatableEntry(entityId: string, datatableName: string, data: any) {
const httpParams = new HttpParams().set('genericResultSet', 'true');
return this.http.put(`/datatables/${datatableName}/${entityId}`, data, { params: httpParams });
}
deleteDatatableContent(entityId: string, datatableName: string) {
const httpParams = new HttpParams().set('genericResultSet', 'true');
return this.http.delete(`/datatables/${datatableName}/${entityId}`, { params: httpParams });
}
}