feedback updates

This commit is contained in:
Cyril Joseph 2025-07-18 17:22:17 -03:00
parent e4e4679bd5
commit 377b062ace
18 changed files with 106 additions and 101 deletions

View File

@ -30,9 +30,9 @@
<p>{{getContactLabel()}}</p>
</div>
<div class="presaved-address-actions">
<button type="button" mat-icon-button color="primary" matTooltip="Edit">
<!-- <button type="button" mat-icon-button color="primary" matTooltip="Edit">
<mat-icon>edit</mat-icon>
</button>
</button> -->
<button type="button" mat-icon-button color="primary" (click)="selectContact()"
matTooltip="Change contact">
<mat-icon>compare_arrows</mat-icon>

View File

@ -76,6 +76,11 @@
margin-top: 8px;
}
}
.delivery-estimate {
color: #28a745;
font-weight: 500;
}
}
@media (max-width: 768px) {

View File

@ -14,7 +14,7 @@ import { finalize, forkJoin, map, Subject, switchMap, takeUntil, throwError } fr
import { DeliveryType } from '../../core/models/delivery-type';
import { DeliveryMethod } from '../../core/models/delivery-method';
import { PaymentType } from '../../core/models/payment-type';
import { format, addDays, isAfter, isWeekend } from 'date-fns';
import { format, addDays, isAfter, isWeekend, addBusinessDays } from 'date-fns';
import { MatDialog } from '@angular/material/dialog';
import { ShippingContact } from '../../core/models/carnet/shipping-contact';
import { ShippingAddress } from '../../core/models/carnet/shipping-address';
@ -518,36 +518,42 @@ export class ShippingComponent {
let deliveryDate: Date;
let message = 'Estimated delivery: ';
const isAfterCutoff = isAfter(now, cutoffTime);
const isWeekendDay = isWeekend(now);
switch (deliveryType) {
case 'SAME':
if (isAfter(now, cutoffTime)) {
// After cutoff time, deliver next business day
deliveryDate = addDays(now, 1);
while (isWeekend(deliveryDate)) {
deliveryDate = addDays(deliveryDate, 1);
}
if (isAfterCutoff || isWeekendDay) {
deliveryDate = addBusinessDays(now, 1);
message += format(deliveryDate, 'EEEE, MMMM do, yyyy');
} else {
message += 'Today by end of day';
message += format(now, 'EEEE, MMMM do, yyyy');
}
break;
case 'STD':
// Standard is 3 business days
deliveryDate = addDays(now, daysToDelivery);
while (isWeekend(deliveryDate)) {
deliveryDate = addDays(deliveryDate, 1);
if (isAfterCutoff || isWeekendDay) {
// If after cutoff or weekend, add 4 business days
deliveryDate = addBusinessDays(now, daysToDelivery);
} else {
// Before cutoff on weekday, add 3 business days
deliveryDate = addBusinessDays(now, daysToDelivery - 1);
}
message += format(deliveryDate, 'EEEE, MMMM do, yyyy');
break;
case 'NBD':
// Next business day for pickup
deliveryDate = addDays(now, daysToDelivery);
while (isWeekend(deliveryDate)) {
deliveryDate = addDays(deliveryDate, 1);
if (isAfterCutoff || isWeekendDay) {
// If after cutoff or weekend, add 2 business days
deliveryDate = addBusinessDays(now, daysToDelivery);
} else {
// Before cutoff on weekday, add 1 business day
deliveryDate = addBusinessDays(now, daysToDelivery);
}
message += format(deliveryDate, 'EEEE, MMMM do, yyyy');
break;

View File

@ -17,10 +17,4 @@
[userPreferences]="userPreferences"></app-contacts>
</mat-step>
</mat-stepper>
<div class="additional-actions" *ngIf="currentApplicationDetails">
<button mat-raised-button color="accent" (click)="goBackToCarnetApplication()">
<mat-icon>chevron_left</mat-icon> Back to application
</button>
</div>
</div>

View File

@ -1,3 +0,0 @@
.additional-actions {
margin: 12px 0;
}

View File

@ -1,4 +1,4 @@
import { Component, inject } from '@angular/core';
import { Component } from '@angular/core';
import { AngularMaterialModule } from '../../shared/module/angular-material.module';
import { CommonModule } from '@angular/common';
import { ReactiveFormsModule } from '@angular/forms';
@ -10,8 +10,6 @@ import { MatInputModule } from '@angular/material/input';
import { ContactsComponent } from '../contacts/contacts.component';
import { UserPreferences } from '../../core/models/user-preference';
import { UserPreferencesService } from '../../core/services/user-preference.service';
import { NavigationService } from '../../core/services/common/navigation.service';
import { StorageService } from '../../core/services/common/storage.service';
@Component({
selector: 'app-add-holder',
@ -34,21 +32,16 @@ export class AddHolderComponent {
isEditMode = false;
holderid: number = 0;
userPreferences: UserPreferences;
currentApplicationDetails: { headerid: number, applicationName: string } | null = null;
stepsCompleted = {
holderDetails: false,
holderContacts: false
};
private navigationService = inject(NavigationService);
private storageService = inject(StorageService);
constructor(
userPrefenceService: UserPreferencesService
) {
this.userPreferences = userPrefenceService.getPreferences();
this.currentApplicationDetails = this.storageService.get<{ headerid: number, applicationName: string }>('currentapplication')
}
onStepChange(event: StepperSelectionEvent): void {
@ -59,16 +52,4 @@ export class AddHolderComponent {
this.holderid = holderid;
this.stepsCompleted.holderDetails = true;
}
goBackToCarnetApplication(): void {
this.storageService.removeItem('currentapplication')
this.navigationService.navigate(["edit-carnet", this.currentApplicationDetails?.headerid],
{
state: { isEditMode: true },
queryParams: {
applicationname: this.currentApplicationDetails?.applicationName,
return: 'holder'
}
})
}
}

View File

@ -42,8 +42,7 @@
Maximum 20 characters allowed
</mat-error>
</mat-form-field>
</div>
<div class="form-row">
<mat-radio-group formControlName="holderType" class="radio-group">
<mat-label>Holder Type </mat-label>
<mat-radio-button value="CORP">Corporation</mat-radio-button>
@ -58,9 +57,6 @@
<mat-radio-button [value]="true">Yes</mat-radio-button>
<mat-radio-button [value]="false">No</mat-radio-button>
</mat-radio-group>
</div>
<div class="form-row">
<mat-radio-group formControlName="govAgency" class="radio-group">
<mat-label>Are you belong to Government Agency ?</mat-label>
<mat-radio-button [value]="true">Yes</mat-radio-button>
@ -147,6 +143,10 @@
</mat-form-field>
</div>
<div class="form-actions">
<button mat-raised-button color="accent" *ngIf="currentApplicationDetails" type="button"
(click)="goBackToCarnetApplication()">
<mat-icon>chevron_left</mat-icon> Back to application
</button>
<button mat-raised-button color="primary" type="submit"
[disabled]="basicDetailsForm.invalid || !basicDetailsForm.dirty">
{{ isEditMode ? 'Update' : 'Save' }}

View File

@ -27,7 +27,7 @@
.details-form {
display: flex;
flex-direction: column;
gap: 16px;
gap: 8px;
}
.form-row {
@ -60,7 +60,9 @@
grid-column: span 1;
}
mat-radio-group {
.mat-mdc-radio-group {
padding-bottom: 12px;
mat-label {
color: var(--mat-sys-on-surface);
font-family: var(--mat-sys-body-medium-font);

View File

@ -12,6 +12,8 @@ import { Subject, takeUntil } from 'rxjs';
import { Country } from '../../core/models/country';
import { BasicDetailService } from '../../core/services/holder/basic-detail.service';
import { BasicDetail } from '../../core/models/holder/basic-detail';
import { StorageService } from '../../core/services/common/storage.service';
import { NavigationService } from '../../core/services/common/navigation.service';
@Component({
selector: 'app-basic-detail',
@ -25,12 +27,13 @@ export class BasicDetailComponent implements OnInit, OnDestroy {
@Input() holderid: number = 0;
@Output() holderIdCreated = new EventEmitter<number>();
@Output() holderName = new EventEmitter<string>();
// @Output() holderName = new EventEmitter<string>();
basicDetailsForm: FormGroup;
countries: Country[] = [];
regions: Region[] = [];
states: State[] = [];
currentApplicationDetails: { headerid: number, applicationName: string } | null = null;
isLoading = false;
countriesHasStates = ['US', 'CA', 'MX'];
@ -42,9 +45,12 @@ export class BasicDetailComponent implements OnInit, OnDestroy {
private notificationService = inject(NotificationService);
private commonService = inject(CommonService);
private errorHandler = inject(ApiErrorHandlerService);
private storageService = inject(StorageService);
private navigationService = inject(NavigationService);
constructor() {
this.basicDetailsForm = this.createForm();
this.currentApplicationDetails = this.storageService.get<{ headerid: number, applicationName: string }>('currentapplication')
}
createForm(): FormGroup {
@ -72,7 +78,7 @@ export class BasicDetailComponent implements OnInit, OnDestroy {
this.basicDetailService.getBasicDetailByHolderId(this.holderid).subscribe({
next: (basicDetail: BasicDetail) => {
this.patchFormData(basicDetail);
this.holderName.emit(basicDetail.holderName);
// this.holderName.emit(basicDetail.holderName);
this.isLoading = false;
},
error: (error: any) => {
@ -120,9 +126,9 @@ export class BasicDetailComponent implements OnInit, OnDestroy {
this.holderIdCreated.emit(basicData.HOLDERID);
}
if (this.isEditMode) {
this.holderName.emit(basicDetailData.holderName);
}
// if (this.isEditMode) {
// this.holderName.emit(basicDetailData.holderName);
// }
},
error: (error: any) => {
let errorMessage = this.errorHandler.handleApiError(error, `Failed to ${this.isEditMode ? 'update' : 'add'} basic details`);
@ -201,4 +207,16 @@ export class BasicDetailComponent implements OnInit, OnDestroy {
}
});
}
goBackToCarnetApplication(): void {
this.storageService.removeItem('currentapplication')
this.navigationService.navigate(["edit-carnet", this.currentApplicationDetails?.headerid],
{
state: { isEditMode: true },
queryParams: {
applicationname: this.currentApplicationDetails?.applicationName,
return: 'holder'
}
})
}
}

View File

@ -7,6 +7,11 @@
<button mat-raised-button color="primary" (click)="addNewContact()">
<mat-icon>add</mat-icon> Add New Contact
</button>
<button mat-raised-button color="accent" *ngIf="currentApplicationDetails" type="button"
(click)="goBackToCarnetApplication()">
<mat-icon>chevron_left</mat-icon> Back to application
</button>
</div>
<div class="table-container mat-elevation-z8">

View File

@ -15,6 +15,7 @@
button {
float: right;
margin-left: 16px;
}
}

View File

@ -14,6 +14,8 @@ import { Contact } from '../../core/models/holder/contact';
import { CustomPaginator } from '../../shared/custom-paginator';
import { MatDialog } from '@angular/material/dialog';
import { ConfirmDialogComponent } from '../../shared/components/confirm-dialog/confirm-dialog.component';
import { NavigationService } from '../../core/services/common/navigation.service';
import { StorageService } from '../../core/services/common/storage.service';
@Component({
selector: 'app-contacts',
@ -42,6 +44,7 @@ export class ContactsComponent {
showForm = false;
showInactiveContacts = false;
contacts: Contact[] = [];
currentApplicationDetails: { headerid: number, applicationName: string } | null = null;
contactReadOnlyFields: any = {
lastChangedDate: null,
@ -55,6 +58,8 @@ export class ContactsComponent {
private contactService = inject(ContactService);
private notificationService = inject(NotificationService);
private errorHandler = inject(ApiErrorHandlerService);
private navigationService = inject(NavigationService);
private storageService = inject(StorageService);
constructor() {
this.contactForm = this.fb.group({
@ -67,6 +72,8 @@ export class ContactsComponent {
fax: ['', [Validators.pattern(/^[0-9]{10,15}$/)]],
email: ['', [Validators.required, Validators.email, Validators.maxLength(100)]],
});
this.currentApplicationDetails = this.storageService.get<{ headerid: number, applicationName: string }>('currentapplication')
}
ngOnInit(): void {
@ -229,4 +236,16 @@ export class ContactsComponent {
}
});
}
goBackToCarnetApplication(): void {
this.storageService.removeItem('currentapplication')
this.navigationService.navigate(["edit-carnet", this.currentApplicationDetails?.headerid],
{
state: { isEditMode: true },
queryParams: {
applicationname: this.currentApplicationDetails?.applicationName,
return: 'holder'
}
})
}
}

View File

@ -1,4 +1,4 @@
<h2 *ngIf="this.holderName" class="page-header">Manage {{this.holderName}}</h2>
<!-- <h2 *ngIf="this.holderName" class="page-header">Manage {{this.holderName}}</h2> -->
<div class="holder-action-buttons">
<button mat-button (click)="accordion().openAll()">Expand All</button>
@ -9,8 +9,7 @@
<mat-expansion-panel-header>
<mat-panel-title> Basic Details </mat-panel-title>
</mat-expansion-panel-header>
<app-basic-detail [holderid]="holderid" [isEditMode]="isEditMode"
(holderName)="onHolderNameUpdate($event)"></app-basic-detail>
<app-basic-detail [holderid]="holderid" [isEditMode]="isEditMode"></app-basic-detail>
</mat-expansion-panel>
<mat-expansion-panel>
@ -22,9 +21,3 @@
[isEditMode]="isEditMode"></app-contacts>
</mat-expansion-panel>
</mat-accordion>
<div class="additional-actions" *ngIf="currentApplicationDetails">
<button mat-raised-button color="accent" (click)="goBackToCarnetApplication()">
<mat-icon>chevron_left</mat-icon> Back to application
</button>
</div>

View File

@ -1,17 +1,13 @@
.page-header {
margin: 0.5rem 0px;
color: var(--mat-sys-primary);
font-weight: 500;
}
// .page-header {
// margin: 0.5rem 0px;
// color: var(--mat-sys-primary);
// font-weight: 500;
// }
.holder-action-buttons {
padding-bottom: 20px;
}
.additional-actions {
margin: 12px 0;
}
.holder-headers-align .mat-expansion-panel-header-description {
justify-content: space-between;
align-items: center;

View File

@ -7,8 +7,6 @@ import { ActivatedRoute } from '@angular/router';
import { UserPreferencesService } from '../../core/services/user-preference.service';
import { BasicDetailComponent } from '../basic-details/basic-details.component';
import { ContactsComponent } from '../contacts/contacts.component';
import { StorageService } from '../../core/services/common/storage.service';
import { NavigationService } from '../../core/services/common/navigation.service';
@Component({
selector: 'app-edit-holder',
@ -20,19 +18,15 @@ export class EditHolderComponent {
accordion = viewChild.required(MatAccordion);
isEditMode = true;
holderid = 0;
holderName: string | null = null;
//holderName: string | null = null;
userPreferences: UserPreferences;
currentApplicationDetails: { headerid: number, applicationName: string } | null = null;
private route = inject(ActivatedRoute);
private navigationService = inject(NavigationService);
private storageService = inject(StorageService);
constructor(userPrefenceService: UserPreferencesService) {
this.userPreferences = userPrefenceService.getPreferences();
this.currentApplicationDetails = this.storageService.get<{ headerid: number, applicationName: string }>('currentapplication')
afterNextRender(() => {
// Open all panels
this.accordion().openAll();
});
}
@ -42,19 +36,7 @@ export class EditHolderComponent {
this.holderid = idParam ? parseInt(idParam, 10) : 0;
}
onHolderNameUpdate(event: string): void {
this.holderName = event;
}
goBackToCarnetApplication(): void {
this.storageService.removeItem('currentapplication')
this.navigationService.navigate(["edit-carnet", this.currentApplicationDetails?.headerid],
{
state: { isEditMode: true },
queryParams: {
applicationname: this.currentApplicationDetails?.applicationName,
return: 'holder'
}
})
}
// onHolderNameUpdate(event: string): void {
// this.holderName = event;
// }
}

View File

@ -99,7 +99,8 @@
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"
[ngClass]="{'selected-holder': selectedHolderId === row.holderid}"></tr>
<tr matNoDataRow *matNoDataRow>
<td [attr.colspan]="displayedColumns.length" class="no-data-message">

View File

@ -63,6 +63,11 @@
justify-content: center;
}
.selected-holder {
color: #28a745;
font-weight: 500;
}
.actions-icons {
display: flex;
}

View File

@ -2,7 +2,7 @@
@use '@angular/material' as mat;
html {
@include mat.theme((density: -4));
@include mat.theme((density: -5));
}
html,