From 5185cb375d8c7d17e6c634942f933918e29c7624 Mon Sep 17 00:00:00 2001 From: Cyril Joseph Date: Thu, 10 Jul 2025 22:40:56 -0300 Subject: [PATCH] register, forgot password and home page updates --- src/app/home/home.component.html | 10 ++++++++- src/app/home/home.component.scss | 9 ++++++++ src/app/home/home.component.ts | 35 ++++++++++++++++++++++++++++++ src/app/login/login.component.html | 8 +++++-- src/app/login/login.component.scss | 4 ++-- 5 files changed, 61 insertions(+), 5 deletions(-) diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html index 2fa942e..90acb7e 100644 --- a/src/app/home/home.component.html +++ b/src/app/home/home.component.html @@ -49,6 +49,13 @@ +
+ +
+
@@ -112,7 +119,8 @@ diff --git a/src/app/home/home.component.scss b/src/app/home/home.component.scss index f64f9df..48a842b 100644 --- a/src/app/home/home.component.scss +++ b/src/app/home/home.component.scss @@ -40,6 +40,15 @@ } } + .table-actions { + display: flex; + justify-content: end; + + button { + margin-bottom: 16px; + } + } + .table-container { position: relative; overflow: auto; diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts index b33b2ee..be98861 100644 --- a/src/app/home/home.component.ts +++ b/src/app/home/home.component.ts @@ -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 { diff --git a/src/app/login/login.component.html b/src/app/login/login.component.html index b1d61ca..3edc5da 100644 --- a/src/app/login/login.component.html +++ b/src/app/login/login.component.html @@ -21,8 +21,12 @@ -
- Forgot your password? + + +