feedback updates

This commit is contained in:
Cyril Joseph 2025-11-11 23:32:42 -04:00
parent 251b9f8644
commit 76d78c5869
7 changed files with 75 additions and 41 deletions

View File

@ -5,7 +5,7 @@ export interface SecurityDeposit {
specialCommodity: string;
specialCountry: string;
rate: number;
rateInPercentage: number;
rateType: string;
effectiveDate: Date;
spid: number;
dateCreated?: Date | null;

View File

@ -30,7 +30,7 @@ export class SecurityDepositService {
specialCommodity: item.SPCLCOMMODITY,
specialCountry: item.SPCLCOUNTRY,
rate: item.RATE,
rateInPercentage: item.RATE_PCT,
rateType: item.RATE_PCT,
effectiveDate: item.EFFDATE,
spid: item.SPID,
createdBy: item.CREATEDBY || null,
@ -49,7 +49,7 @@ export class SecurityDepositService {
P_SPCLCOMMODITY: data.specialCommodity,
P_SPCLCOUNTRY: data.specialCountry,
P_RATE: data.rate,
P_PCT_VALUE: data.rateInPercentage.toString(),
P_PCT_VALUE: data.rateType,
P_USERID: this.userService.getUser()
}
@ -62,7 +62,7 @@ export class SecurityDepositService {
P_BONDRATESETUPID: id,
P_EFFDATE: this.commonService.formatUSDate(data.effectiveDate),
P_RATE: data.rate,
P_PCT_VALUE: data.rateInPercentage.toString(),
P_PCT_VALUE: data.rateType,
P_USERID: this.userService.getUser()
}

View File

@ -98,4 +98,7 @@ export class ContactService {
return this.http.post(`${this.apiUrl}/${this.apiDb}/CreateSPLogins`, contact);
}
setDefaultContact(spContactId: string): Observable<any> {
return this.http.patch(`${this.apiUrl}/${this.apiDb}/SetSPDefaultContact/${spContactId}`, null);
}
}

View File

@ -44,14 +44,14 @@
<!-- Rate Column -->
<ng-container matColumnDef="rate">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Rate</th>
<td mat-cell *matCellDef="let deposit">{{ deposit.rate | currency }}</td>
<th mat-header-cell *matHeaderCellDef mat-sort-header>Rate/Value</th>
<td mat-cell *matCellDef="let deposit">{{ deposit.rate }}</td>
</ng-container>
<!-- Rate In Percentage Column -->
<ng-container matColumnDef="rateInPercentage">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Rate In Percentage</th>
<td mat-cell *matCellDef="let deposit">{{ deposit.rateInPercentage/100 | percent }}</td>
<!-- Rate Type Column -->
<ng-container matColumnDef="rateType">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Rate In % or $</th>
<td mat-cell *matCellDef="let deposit">{{ deposit.rateType }}</td>
</ng-container>
<!-- Effective Date Column -->
@ -142,9 +142,9 @@
<div class="form-row">
<mat-form-field appearance="outline">
<mat-label>Rate</mat-label>
<mat-label>Rate / Value</mat-label>
<input matInput type="number" formControlName="rate" required min="0" step="1">
<span class="dollar-prefix" matPrefix>$&nbsp;</span>
<!-- <span class="dollar-prefix" matPrefix>$&nbsp;</span> -->
<mat-error *ngIf="depositForm.get('rate')?.errors?.['required']">
Rate is required
</mat-error>
@ -154,14 +154,10 @@
</mat-form-field>
<mat-form-field appearance="outline">
<mat-label>Rate %</mat-label>
<input matInput type="number" formControlName="rateInPercentage" required min="0" step="1">
<span class="percent-suffix" matSuffix>%&nbsp;</span>
<mat-error *ngIf="depositForm.get('rateInPercentage')?.errors?.['required']">
Rate % is required
</mat-error>
<mat-error *ngIf="depositForm.get('rateInPercentage')?.errors?.['min']">
Rate % must be positive
<mat-label>Rate in % or $</mat-label>
<input matInput formControlName="rateType" required>
<mat-error *ngIf="depositForm.get('rateType')?.errors?.['required']">
Rate in % or $ is required
</mat-error>
</mat-form-field>

View File

@ -31,7 +31,7 @@ export class SecurityDepositComponent implements OnInit {
@ViewChild(MatSort) sort!: MatSort;
displayedColumns: string[] = ['holderType', 'uscibMember', 'specialCommodity', 'specialCountry', 'rate', 'rateInPercentage', 'effectiveDate', 'actions'];
displayedColumns: string[] = ['holderType', 'uscibMember', 'specialCommodity', 'specialCountry', 'rate', 'rateType', 'effectiveDate', 'actions'];
dataSource = new MatTableDataSource<any>();
depositForm: FormGroup;
isEditing = false;
@ -73,7 +73,7 @@ export class SecurityDepositComponent implements OnInit {
specialCommodity: [''],
specialCountry: [''],
rate: [0, [Validators.required, Validators.min(0)]],
rateInPercentage: [0, [Validators.required, Validators.min(0)]],
rateType: ['', [Validators.required]],
effectiveDate: ['', Validators.required]
});
}
@ -159,7 +159,7 @@ export class SecurityDepositComponent implements OnInit {
uscibMember: 'N',
specialCountry: '',
});
this.depositForm.patchValue({ rate: 0, rateInPercentage: 0 });
this.depositForm.patchValue({ rate: 0 });
this.depositForm.get('holderType')?.enable();
this.depositForm.get('uscibMember')?.enable();
@ -177,7 +177,7 @@ export class SecurityDepositComponent implements OnInit {
specialCommodity: deposit.specialCommodity,
specialCountry: deposit.specialCountry,
rate: deposit.rate,
rateInPercentage: deposit.rateInPercentage,
rateType: deposit.rateType,
effectiveDate: deposit.effectiveDate
});

View File

@ -25,6 +25,12 @@
<td mat-cell *matCellDef="let contact">{{ contact.firstName }}</td>
</ng-container>
<!-- Middle Initial Column -->
<ng-container matColumnDef="middleInitial">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Middle Initial</th>
<td mat-cell *matCellDef="let contact">{{ contact.middleInitial }}</td>
</ng-container>
<!-- Last Name Column -->
<ng-container matColumnDef="lastName">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Last Name</th>
@ -43,6 +49,18 @@
<td mat-cell *matCellDef="let contact">{{ contact.phone | phone }}</td>
</ng-container>
<!-- Mobile Column -->
<ng-container matColumnDef="mobile">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Mobile</th>
<td mat-cell *matCellDef="let contact">{{ contact.mobile }}</td>
</ng-container>
<!-- Fax Column -->
<ng-container matColumnDef="fax">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Fax</th>
<td mat-cell *matCellDef="let contact">{{ contact.fax }}</td>
</ng-container>
<!-- Email Column -->
<ng-container matColumnDef="email">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Email</th>
@ -76,10 +94,11 @@
matTooltip="Delete">
<mat-icon>delete</mat-icon>
</button>
<!-- <button mat-icon-button (click)="setDefaultContact(contact.contactId)"
[color]="contact.defaultContact ? 'primary' : ''" matTooltip="Set as default">
<button mat-icon-button (click)="setDefaultContact(contact.spContactId)"
*ngIf="!contact.defaultContact || !contact.isInactive"
[hidden]="contact.defaultContact || contact.isInactive" matTooltip="Set as default contact">
<mat-icon>star</mat-icon>
</button> -->
</button>
</td>
</ng-container>

View File

@ -32,7 +32,7 @@ export class ContactsComponent implements OnInit {
@ViewChild(MatSort) sort!: MatSort;
displayedColumns: string[] = ['firstName', 'lastName', 'title', 'phone', 'email', 'defaultContact', 'actions'];
displayedColumns: string[] = ['firstName', 'middleInitial', 'lastName', 'title', 'phone', 'mobile', 'fax', 'email', 'defaultContact', 'actions'];
dataSource = new MatTableDataSource<any>();
contactForm: FormGroup;
isEditing = false;
@ -253,16 +253,32 @@ export class ContactsComponent implements OnInit {
});
}
// setDefaultContact(contactId: string): void {
// this.contactService.setDefaultServiceProviderContact(this.spid, contactId).subscribe({
// next: () => {
// this.notificationService.showSuccess('Default contact updated successfully');
// this.loadContacts();
// },
// error: (error) => {
// this.notificationService.showError('Failed to set default contact');
// console.error('Error setting default contact:', error);
// }
// });
// }
setDefaultContact(contactId: string): void {
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
width: '450px',
data: {
title: 'Confirm Default Contact',
message: 'Are you sure you want to set this contact as default contact?',
confirmText: 'Yes',
cancelText: 'Cancel'
}
});
dialogRef.afterClosed().subscribe(result => {
if (result) {
this.contactService.setDefaultContact(contactId).subscribe({
next: () => {
this.notificationService.showSuccess('Default contact updated successfully');
this.loadContacts();
},
error: (error) => {
let errorMessage = this.errorHandler.handleApiError(error, 'Failed to set default contact');
this.notificationService.showError(errorMessage);
console.error('Error setting default contact:', error);
}
});
}
});
}
}