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>
|
||||
</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">
|
||||
<table mat-table [dataSource]="dataSource" matSort>
|
||||
<ng-container matColumnDef="applicationName">
|
||||
@ -112,7 +119,8 @@
|
||||
<td mat-cell *matCellDef="let item">
|
||||
<button mat-icon-button color="primary" (click)="editCarnet(item)"
|
||||
*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>
|
||||
</button>
|
||||
</td>
|
||||
|
||||
@ -40,6 +40,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
.table-actions {
|
||||
display: flex;
|
||||
justify-content: end;
|
||||
|
||||
button {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.table-container {
|
||||
position: relative;
|
||||
overflow: auto;
|
||||
|
||||
@ -15,6 +15,7 @@ import { CommonService } from '../core/services/common/common.service';
|
||||
import { NotificationService } from '../core/services/common/notification.service';
|
||||
import { NavigationService } from '../core/services/common/navigation.service';
|
||||
import { MatRadioChange } from '@angular/material/radio';
|
||||
import * as XLSX from 'xlsx';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
@ -105,6 +106,40 @@ export class HomeComponent {
|
||||
}
|
||||
|
||||
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 {
|
||||
|
||||
@ -21,8 +21,12 @@
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<div class="forgot-password">
|
||||
<a href="#" routerLink="/forgot-password" class="forgot-link">Forgot your password?</a>
|
||||
<div class="additional-options">
|
||||
<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>
|
||||
|
||||
<button mat-raised-button color="primary" type="submit" [disabled]="!loginForm.valid">
|
||||
|
||||
@ -29,11 +29,11 @@
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.forgot-password {
|
||||
.additional-options {
|
||||
text-align: right;
|
||||
margin-top: -1rem;
|
||||
|
||||
.forgot-link {
|
||||
.additional-options-link {
|
||||
color: #666;
|
||||
text-decoration: none;
|
||||
font-size: 0.875rem;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user