register, forgot password and home page updates
This commit is contained in:
parent
f3864cb5ae
commit
5185cb375d
@ -49,6 +49,13 @@
|
|||||||
<mat-spinner diameter="50"></mat-spinner>
|
<mat-spinner diameter="50"></mat-spinner>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="table-actions">
|
||||||
|
<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>
|
||||||
|
|
||||||
<div class="table-container mat-elevation-z8" *ngIf="showTable">
|
<div class="table-container mat-elevation-z8" *ngIf="showTable">
|
||||||
<table mat-table [dataSource]="dataSource" matSort>
|
<table mat-table [dataSource]="dataSource" matSort>
|
||||||
<ng-container matColumnDef="applicationName">
|
<ng-container matColumnDef="applicationName">
|
||||||
@ -112,7 +119,8 @@
|
|||||||
<td mat-cell *matCellDef="let item">
|
<td mat-cell *matCellDef="let item">
|
||||||
<button mat-icon-button color="primary" (click)="editCarnet(item)"
|
<button mat-icon-button color="primary" (click)="editCarnet(item)"
|
||||||
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Not Submitted'"
|
*ngIf="getCarnetStatusLabel(item.carnetStatus) === 'Not Submitted'"
|
||||||
[hidden]="getCarnetStatusLabel(item.carnetStatus) !== 'Not Submitted'" matTooltip="Edit">
|
[hidden]="getCarnetStatusLabel(item.carnetStatus) !== 'Not Submitted'"
|
||||||
|
matTooltip="Edit">
|
||||||
<mat-icon>edit</mat-icon>
|
<mat-icon>edit</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@ -40,6 +40,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.table-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: end;
|
||||||
|
|
||||||
|
button {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.table-container {
|
.table-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import { CommonService } from '../core/services/common/common.service';
|
|||||||
import { NotificationService } from '../core/services/common/notification.service';
|
import { NotificationService } from '../core/services/common/notification.service';
|
||||||
import { NavigationService } from '../core/services/common/navigation.service';
|
import { NavigationService } from '../core/services/common/navigation.service';
|
||||||
import { MatRadioChange } from '@angular/material/radio';
|
import { MatRadioChange } from '@angular/material/radio';
|
||||||
|
import * as XLSX from 'xlsx';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-home',
|
selector: 'app-home',
|
||||||
@ -105,6 +106,40 @@ export class HomeComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
exportData() {
|
exportData() {
|
||||||
|
try {
|
||||||
|
// Prepare worksheet data
|
||||||
|
const worksheetData = this.prepareDownloadData();
|
||||||
|
|
||||||
|
// Create workbook and worksheet
|
||||||
|
const workbook = XLSX.utils.book_new();
|
||||||
|
const worksheet = XLSX.utils.json_to_sheet(worksheetData);
|
||||||
|
|
||||||
|
// Add worksheet to workbook
|
||||||
|
XLSX.utils.book_append_sheet(workbook, worksheet, 'Carnet Data');
|
||||||
|
|
||||||
|
// Generate Excel file
|
||||||
|
const fileName = `carnet_data_${new Date().toISOString()}.xlsx`;
|
||||||
|
XLSX.writeFile(workbook, fileName);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error downloading goods items:', error);
|
||||||
|
this.notificationService.showError('Failed to download Excel file');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
prepareDownloadData(): any[] {
|
||||||
|
return this.dataSource.data.map(item => ({
|
||||||
|
'Application Name': item.applicationName,
|
||||||
|
'Holder Name': item.holderName,
|
||||||
|
'Carnet Number': item.carnetNumber,
|
||||||
|
'US Sets': item.usSets,
|
||||||
|
'Foreign Sets': item.foreignSets,
|
||||||
|
'Transit Sets': item.transitSets,
|
||||||
|
'Carnet Value': item.carnetValue,
|
||||||
|
'Issue Date': item.issueDate ? new Date(item.issueDate).toLocaleDateString() : '',
|
||||||
|
'Expiry Date': item.expiryDate ? new Date(item.expiryDate).toLocaleDateString() : '',
|
||||||
|
'Order Type': item.orderType,
|
||||||
|
'Carnet Status': this.getCarnetStatusLabel(item.carnetStatus)
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
getCarnetStatusLabel(value: string): string {
|
getCarnetStatusLabel(value: string): string {
|
||||||
|
|||||||
@ -21,8 +21,12 @@
|
|||||||
</mat-error>
|
</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<div class="forgot-password">
|
<div class="additional-options">
|
||||||
<a href="#" routerLink="/forgot-password" class="forgot-link">Forgot your password?</a>
|
<a href="#" routerLink="/forgot-password" class="additional-options-link">Forgot your password?</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="additional-options">
|
||||||
|
<a href="#" routerLink="/register" class="additional-options-link">New User? Register</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button mat-raised-button color="primary" type="submit" [disabled]="!loginForm.valid">
|
<button mat-raised-button color="primary" type="submit" [disabled]="!loginForm.valid">
|
||||||
|
|||||||
@ -29,11 +29,11 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.forgot-password {
|
.additional-options {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
margin-top: -1rem;
|
margin-top: -1rem;
|
||||||
|
|
||||||
.forgot-link {
|
.additional-options-link {
|
||||||
color: #666;
|
color: #666;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-size: 0.875rem;
|
font-size: 0.875rem;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user