service-provider-app/src/app/home/home.component.html

211 lines
12 KiB
HTML
Raw Normal View History

2025-06-06 07:38:11 -03:00
<div class="dashboard-container">
<div class="content">
<div class="quick-actions">
<!-- <button mat-raised-button color="accent" routerLink="/add-service-provider">
<mat-icon>add</mat-icon> Add New Service Provider
</button> -->
</div>
<!-- Chart Section -->
<div class="chart-section">
<app-chart [chartData]="carnetData" [carnetStatuses]="carnetStatuses"
(carnetStatusData)="onCarnetStatusClick($event)"></app-chart>
2025-06-06 07:38:11 -03:00
</div>
<!-- Carnet Details Section -->
<div class="carnet-details-section">
<div class="loading-shade" *ngIf="isLoading">
<mat-spinner diameter="50"></mat-spinner>
</div>
<div class="table-actions">
2026-01-12 21:56:49 -04:00
<div class="filter-controls" *ngIf="dataSource.data.length > 0">
<!-- Column Selection Dropdown -->
<mat-form-field appearance="outline" class="filter-field">
<mat-label>Filter By</mat-label>
<mat-select [(value)]="selectedColumn" (selectionChange)="onColumnChange()">
<mat-option value=""></mat-option>
<mat-option *ngFor="let column of filterableColumns" [value]="column.value">
{{column.displayName}}
</mat-option>
</mat-select>
</mat-form-field>
<!-- Search Input -->
<mat-form-field appearance="outline" class="filter-field">
<mat-label>Search Value</mat-label>
<input matInput [(ngModel)]="filterValue" (keyup)="applyFilter()"
placeholder="Enter search term...">
<mat-icon matSuffix>search</mat-icon>
</mat-form-field>
<!-- Clear Filter Button -->
<button mat-raised-button type="button" (click)="clearFilter()"
[disabled]="!selectedColumn && !filterValue">
<mat-icon>clear_all</mat-icon>
Clear Filter
</button>
</div>
<button mat-raised-button color="accent" (click)="exportData()" *ngIf="dataSource.data.length > 0"
matTooltip="Export to Excel" [disabled]="dataSource.data.length === 0">
<mat-icon>download</mat-icon> Export
</button>
</div>
2025-06-06 07:38:11 -03:00
<div class="table-container mat-elevation-z8" *ngIf="showTable">
<table mat-table [dataSource]="dataSource" matSort>
<ng-container matColumnDef="applicationName">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Application Name</th>
<td mat-cell *matCellDef="let item">{{ item.applicationName }}</td>
</ng-container>
<ng-container matColumnDef="holderName">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Holder Name</th>
<td mat-cell *matCellDef="let item">{{ item.holderName }}</td>
</ng-container>
<ng-container matColumnDef="carnetNumber">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Carnet Number</th>
<td mat-cell *matCellDef="let item">{{ item.carnetNumber }}</td>
</ng-container>
<ng-container matColumnDef="usSets">
<th mat-header-cell *matHeaderCellDef mat-sort-header>US Sets</th>
<td mat-cell *matCellDef="let item">{{ item.usSets }}</td>
</ng-container>
<ng-container matColumnDef="foreignSets">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Foregin Sets</th>
<td mat-cell *matCellDef="let item">{{ item.foreignSets }}</td>
</ng-container>
<ng-container matColumnDef="transitSets">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Transit Sets</th>
<td mat-cell *matCellDef="let item">{{ item.transitSets }}</td>
</ng-container>
<ng-container matColumnDef="carnetValue">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Carnet Value</th>
2025-07-28 20:08:21 -03:00
<td mat-cell *matCellDef="let item">{{ item.carnetValue | currency}}</td>
2025-06-06 07:38:11 -03:00
</ng-container>
<ng-container matColumnDef="issueDate">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Issue Date</th>
<td mat-cell *matCellDef="let item">{{ item.issueDate |
date:'mediumDate':'UTC' }}</td>
</ng-container>
<ng-container matColumnDef="expiryDate">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Expiry Date</th>
<td mat-cell *matCellDef="let item">{{ item.expiryDate |
date:'mediumDate':'UTC' }}</td>
</ng-container>
<ng-container matColumnDef="orderType">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Order Type</th>
<td mat-cell *matCellDef="let item">{{ item.orderType }}</td>
</ng-container>
<ng-container matColumnDef="carnetStatus">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Carnet Status</th>
<td mat-cell *matCellDef="let item">{{ getCarnetStatusLabel(item.carnetStatus) }}</td>
</ng-container>
2025-08-02 23:24:17 -03:00
<ng-container matColumnDef="actions">
<th mat-header-cell *matHeaderCellDef>Actions</th>
<td mat-cell *matCellDef="let item">
<div class="action-buttons">
2025-08-21 06:37:56 -03:00
<!-- <button mat-icon-button color="primary" (click)="processCarnet(item)"
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Submitted'"
[hidden]="getCarnetStatusLabel(item.carnetStatus) !== 'Submitted'"
matTooltip="Process">
<mat-icon>pending_actions</mat-icon>
2025-08-21 06:37:56 -03:00
</button> -->
2025-08-10 20:34:41 -03:00
<button matIconButton [matMenuTriggerFor]="carnetActions">
<mat-icon>more_horiz</mat-icon>
</button>
<mat-menu #carnetActions="matMenu">
2025-08-21 06:37:56 -03:00
<button mat-menu-item (click)="processCarnet(item)"
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Submitted'"
[hidden]="getCarnetStatusLabel(item.carnetStatus) !== 'Submitted'">
<mat-icon>pending_actions</mat-icon>
<span>Process</span>
</button>
2025-08-10 20:34:41 -03:00
<button mat-menu-item (click)="viewCarnet(item)">
<mat-icon>article</mat-icon>
2025-08-15 22:33:05 -03:00
<span>View</span>
2025-08-10 20:34:41 -03:00
</button>
<button mat-menu-item (click)="resetClient(item.headerid)"
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Submitted'"
[hidden]="getCarnetStatusLabel(item.carnetStatus) !== 'Submitted'">
<mat-icon>assignment_return</mat-icon>
2025-08-15 22:33:05 -03:00
<span>Reset</span>
2025-08-10 20:34:41 -03:00
</button>
<button mat-menu-item (click)="deleteCarnet(item.headerid)" *ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Submitted' ||
getCarnetStatusLabel(item.carnetStatus) === 'Not Submitted'">
<mat-icon>delete</mat-icon>
2025-08-15 22:33:05 -03:00
<span>Delete</span>
2025-08-10 20:34:41 -03:00
</button>
2025-08-21 06:37:56 -03:00
<button mat-menu-item (click)="printGeneralList(item.headerid)"
*ngIf="item.printGLStatus === 'PRINTGL'">
2025-08-10 20:34:41 -03:00
<mat-icon>print</mat-icon>
2025-08-15 22:33:05 -03:00
<span>Print GL</span>
2025-08-10 20:34:41 -03:00
</button>
2025-08-19 10:33:03 -03:00
<button mat-menu-item (click)="printCarnet(item.headerid, item.carnetNumber)"
2025-08-10 20:34:41 -03:00
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Valid'">
<mat-icon>print</mat-icon>
2025-08-15 22:33:05 -03:00
<span>Print</span>
2025-08-10 20:34:41 -03:00
</button>
<button mat-menu-item (click)="voidCarnet(item.headerid)"
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Valid'">
<mat-icon>delete_forever</mat-icon>
2025-08-15 22:33:05 -03:00
<span>Void</span>
2025-08-10 20:34:41 -03:00
</button>
</mat-menu>
<!-- <button mat-icon-button color="primary" (click)="viewCarnet(item)" matTooltip="View">
<mat-icon>article</mat-icon>
</button>
2025-08-04 21:39:43 -03:00
<button mat-icon-button color="primary" (click)="resetClient(item.headerid)"
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Submitted'"
[hidden]="getCarnetStatusLabel(item.carnetStatus) !== 'Submitted'"
matTooltip="Reset to Client">
<mat-icon>assignment_return</mat-icon>
</button>
2025-08-07 22:27:57 -03:00
<button mat-icon-button color="primary" (click)="deleteCarnet(item.headerid)" *ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Submitted' ||
getCarnetStatusLabel(item.carnetStatus) === 'Not Submitted'" matTooltip="Delete">
<mat-icon>delete</mat-icon>
</button>
2025-08-07 22:27:57 -03:00
<button mat-icon-button color="primary" (click)="printGeneralList(item.headerid)"
matTooltip="Print General List">
<mat-icon>print</mat-icon>
</button>
2025-08-04 21:39:43 -03:00
<button mat-icon-button color="primary" (click)="printCarnet(item.headerid)"
2025-08-07 22:27:57 -03:00
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Valid'" matTooltip="Print">
<mat-icon>print</mat-icon>
</button>
2025-08-07 22:27:57 -03:00
<button mat-icon-button color="primary" (click)="voidCarnet(item.headerid)"
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Valid'" matTooltip="Void">
<mat-icon>delete_forever</mat-icon>
2025-08-10 20:34:41 -03:00
</button> -->
</div>
2025-08-02 23:24:17 -03:00
</td>
</ng-container>
2025-06-06 07:38:11 -03:00
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
<tr matNoDataRow *matNoDataRow>
<td [colSpan]="displayedColumns.length" class="no-data-message">
<mat-icon>info</mat-icon>
<span>No data available</span>
</td>
</tr>
</table>
2025-07-28 20:08:21 -03:00
<mat-paginator *ngIf="dataSource.data.length > userPreferences.pageSize!"
[length]="dataSource.data.length" [pageSizeOptions]="[userPreferences.pageSize!]"
2025-06-06 07:38:11 -03:00
[hidePageSize]="true" showFirstLastButtons></mat-paginator>
</div>
</div>
</div>
</div>