feedback updates
This commit is contained in:
parent
8163b02f34
commit
4c77415c14
@ -5,7 +5,7 @@ export interface SecurityDeposit {
|
|||||||
specialCommodity: string;
|
specialCommodity: string;
|
||||||
specialCountry: string;
|
specialCountry: string;
|
||||||
rate: number;
|
rate: number;
|
||||||
rateInPercentage: number;
|
rateType: string;
|
||||||
effectiveDate: Date;
|
effectiveDate: Date;
|
||||||
spid: number;
|
spid: number;
|
||||||
dateCreated?: Date | null;
|
dateCreated?: Date | null;
|
||||||
|
|||||||
@ -3,6 +3,7 @@ export interface BasicDetail {
|
|||||||
spid: number;
|
spid: number;
|
||||||
name: string;
|
name: string;
|
||||||
lookupCode: string;
|
lookupCode: string;
|
||||||
|
address?: string;
|
||||||
address1: string;
|
address1: string;
|
||||||
address2?: string | null;
|
address2?: string | null;
|
||||||
city: string;
|
city: string;
|
||||||
|
|||||||
@ -30,7 +30,7 @@ export class SecurityDepositService {
|
|||||||
specialCommodity: item.SPCLCOMMODITY,
|
specialCommodity: item.SPCLCOMMODITY,
|
||||||
specialCountry: item.SPCLCOUNTRY,
|
specialCountry: item.SPCLCOUNTRY,
|
||||||
rate: item.RATE,
|
rate: item.RATE,
|
||||||
rateInPercentage: item.RATE_PCT,
|
rateType: item.RATE_PCT,
|
||||||
effectiveDate: item.EFFDATE,
|
effectiveDate: item.EFFDATE,
|
||||||
spid: item.SPID,
|
spid: item.SPID,
|
||||||
createdBy: item.CREATEDBY || null,
|
createdBy: item.CREATEDBY || null,
|
||||||
@ -49,7 +49,7 @@ export class SecurityDepositService {
|
|||||||
P_SPCLCOMMODITY: data.specialCommodity,
|
P_SPCLCOMMODITY: data.specialCommodity,
|
||||||
P_SPCLCOUNTRY: data.specialCountry,
|
P_SPCLCOUNTRY: data.specialCountry,
|
||||||
P_RATE: data.rate,
|
P_RATE: data.rate,
|
||||||
P_PCT_VALUE: data.rateInPercentage.toString(),
|
P_PCT_VALUE: data.rateType,
|
||||||
P_USERID: this.userService.getUser()
|
P_USERID: this.userService.getUser()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ export class SecurityDepositService {
|
|||||||
P_BONDRATESETUPID: id,
|
P_BONDRATESETUPID: id,
|
||||||
P_EFFDATE: this.commonService.formatUSDate(data.effectiveDate),
|
P_EFFDATE: this.commonService.formatUSDate(data.effectiveDate),
|
||||||
P_RATE: data.rate,
|
P_RATE: data.rate,
|
||||||
P_PCT_VALUE: data.rateInPercentage.toString(),
|
P_PCT_VALUE: data.rateType,
|
||||||
P_USERID: this.userService.getUser()
|
P_USERID: this.userService.getUser()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,7 @@ export class ClientService {
|
|||||||
spid: basicDetails.SPID,
|
spid: basicDetails.SPID,
|
||||||
name: basicDetails.PREPARERNAME,
|
name: basicDetails.PREPARERNAME,
|
||||||
lookupCode: basicDetails.LOOKUPCODE,
|
lookupCode: basicDetails.LOOKUPCODE,
|
||||||
|
address: this.getAddressLabel(basicDetails.ADDRESS1, basicDetails.ADDRESS2),
|
||||||
address1: basicDetails.ADDRESS1,
|
address1: basicDetails.ADDRESS1,
|
||||||
address2: basicDetails.ADDRESS2,
|
address2: basicDetails.ADDRESS2,
|
||||||
city: basicDetails.CITY,
|
city: basicDetails.CITY,
|
||||||
@ -44,4 +45,12 @@ export class ClientService {
|
|||||||
// inactivatedDate: basicDetails.INACTIVEDATE || null
|
// inactivatedDate: basicDetails.INACTIVEDATE || null
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getAddressLabel(address1: string, address2?: string): string {
|
||||||
|
let addressLabel = address1;
|
||||||
|
if (address2) {
|
||||||
|
addressLabel += `, ${address2}`;
|
||||||
|
}
|
||||||
|
return addressLabel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -98,4 +98,7 @@ export class ContactService {
|
|||||||
return this.http.post(`${this.apiUrl}/${this.apiDb}/CreateSPLogins`, contact);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,14 +44,14 @@
|
|||||||
|
|
||||||
<!-- Rate Column -->
|
<!-- Rate Column -->
|
||||||
<ng-container matColumnDef="rate">
|
<ng-container matColumnDef="rate">
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>Rate</th>
|
<th mat-header-cell *matHeaderCellDef mat-sort-header>Rate/Value</th>
|
||||||
<td mat-cell *matCellDef="let deposit">{{ deposit.rate | currency }}</td>
|
<td mat-cell *matCellDef="let deposit">{{ deposit.rate }}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- Rate In Percentage Column -->
|
<!-- Rate Type Column -->
|
||||||
<ng-container matColumnDef="rateInPercentage">
|
<ng-container matColumnDef="rateType">
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>Rate In Percentage</th>
|
<th mat-header-cell *matHeaderCellDef mat-sort-header>Rate In % or $</th>
|
||||||
<td mat-cell *matCellDef="let deposit">{{ deposit.rateInPercentage/100 | percent }}</td>
|
<td mat-cell *matCellDef="let deposit">{{ deposit.rateType }}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- Effective Date Column -->
|
<!-- Effective Date Column -->
|
||||||
@ -142,9 +142,9 @@
|
|||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<mat-form-field appearance="outline">
|
<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">
|
<input matInput type="number" formControlName="rate" required min="0" step="1">
|
||||||
<span class="dollar-prefix" matPrefix>$ </span>
|
<!-- <span class="dollar-prefix" matPrefix>$ </span> -->
|
||||||
<mat-error *ngIf="depositForm.get('rate')?.errors?.['required']">
|
<mat-error *ngIf="depositForm.get('rate')?.errors?.['required']">
|
||||||
Rate is required
|
Rate is required
|
||||||
</mat-error>
|
</mat-error>
|
||||||
@ -154,14 +154,10 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<mat-label>Rate %</mat-label>
|
<mat-label>Rate in % or $</mat-label>
|
||||||
<input matInput type="number" formControlName="rateInPercentage" required min="0" step="1">
|
<input matInput formControlName="rateType" required>
|
||||||
<span class="percent-suffix" matSuffix>% </span>
|
<mat-error *ngIf="depositForm.get('rateType')?.errors?.['required']">
|
||||||
<mat-error *ngIf="depositForm.get('rateInPercentage')?.errors?.['required']">
|
Rate in % or $ is required
|
||||||
Rate % is required
|
|
||||||
</mat-error>
|
|
||||||
<mat-error *ngIf="depositForm.get('rateInPercentage')?.errors?.['min']">
|
|
||||||
Rate % must be positive
|
|
||||||
</mat-error>
|
</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
|
|||||||
@ -28,10 +28,10 @@ export class SecurityDepositComponent implements OnInit {
|
|||||||
set paginator(value: MatPaginator) {
|
set paginator(value: MatPaginator) {
|
||||||
this.dataSource.paginator = value;
|
this.dataSource.paginator = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewChild(MatSort) sort!: MatSort;
|
@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>();
|
dataSource = new MatTableDataSource<any>();
|
||||||
depositForm: FormGroup;
|
depositForm: FormGroup;
|
||||||
isEditing = false;
|
isEditing = false;
|
||||||
@ -73,7 +73,7 @@ export class SecurityDepositComponent implements OnInit {
|
|||||||
specialCommodity: [''],
|
specialCommodity: [''],
|
||||||
specialCountry: [''],
|
specialCountry: [''],
|
||||||
rate: [0, [Validators.required, Validators.min(0)]],
|
rate: [0, [Validators.required, Validators.min(0)]],
|
||||||
rateInPercentage: [0, [Validators.required, Validators.min(0)]],
|
rateType: ['', [Validators.required]],
|
||||||
effectiveDate: ['', Validators.required]
|
effectiveDate: ['', Validators.required]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -159,7 +159,7 @@ export class SecurityDepositComponent implements OnInit {
|
|||||||
uscibMember: 'N',
|
uscibMember: 'N',
|
||||||
specialCountry: '',
|
specialCountry: '',
|
||||||
});
|
});
|
||||||
this.depositForm.patchValue({ rate: 0, rateInPercentage: 0 });
|
this.depositForm.patchValue({ rate: 0 });
|
||||||
|
|
||||||
this.depositForm.get('holderType')?.enable();
|
this.depositForm.get('holderType')?.enable();
|
||||||
this.depositForm.get('uscibMember')?.enable();
|
this.depositForm.get('uscibMember')?.enable();
|
||||||
@ -177,7 +177,7 @@ export class SecurityDepositComponent implements OnInit {
|
|||||||
specialCommodity: deposit.specialCommodity,
|
specialCommodity: deposit.specialCommodity,
|
||||||
specialCountry: deposit.specialCountry,
|
specialCountry: deposit.specialCountry,
|
||||||
rate: deposit.rate,
|
rate: deposit.rate,
|
||||||
rateInPercentage: deposit.rateInPercentage,
|
rateType: deposit.rateType,
|
||||||
effectiveDate: deposit.effectiveDate
|
effectiveDate: deposit.effectiveDate
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -139,7 +139,7 @@
|
|||||||
<mat-form-field appearance="outline" class="revenue-location">
|
<mat-form-field appearance="outline" class="revenue-location">
|
||||||
<mat-label>Revenue Location</mat-label>
|
<mat-label>Revenue Location</mat-label>
|
||||||
<mat-select formControlName="revenueLocation" required>
|
<mat-select formControlName="revenueLocation" required>
|
||||||
<mat-option *ngFor="let state of states" [value]="state.value">
|
<mat-option *ngFor="let state of usStates" [value]="state.value">
|
||||||
{{ state.name }}
|
{{ state.name }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
|
|||||||
@ -34,6 +34,7 @@ export class BasicDetailsComponent implements OnInit, OnDestroy {
|
|||||||
countries: Country[] = [];
|
countries: Country[] = [];
|
||||||
regions: Region[] = [];
|
regions: Region[] = [];
|
||||||
states: State[] = [];
|
states: State[] = [];
|
||||||
|
usStates: State[] = [];
|
||||||
industryTypes: IndustryType[] = [];
|
industryTypes: IndustryType[] = [];
|
||||||
|
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
@ -114,6 +115,7 @@ export class BasicDetailsComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
this.loadRegions();
|
this.loadRegions();
|
||||||
this.loadIndustryTypes();
|
this.loadIndustryTypes();
|
||||||
|
this.loadUSStates();
|
||||||
}
|
}
|
||||||
|
|
||||||
loadRegions(): void {
|
loadRegions(): void {
|
||||||
@ -152,7 +154,21 @@ export class BasicDetailsComponent implements OnInit, OnDestroy {
|
|||||||
next: (states) => {
|
next: (states) => {
|
||||||
this.states = states;
|
this.states = states;
|
||||||
this.updateStateControl('state', country);
|
this.updateStateControl('state', country);
|
||||||
this.updateStateControl('revenueLocation', country);
|
},
|
||||||
|
error: (error) => {
|
||||||
|
console.error('Failed to load states', error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
loadUSStates(): void {
|
||||||
|
this.isLoading = true;
|
||||||
|
this.commonService.getStates('US')
|
||||||
|
.pipe(takeUntil(this.destroy$),
|
||||||
|
finalize(() => this.isLoading = false))
|
||||||
|
.subscribe({
|
||||||
|
next: (states) => {
|
||||||
|
this.usStates = states;
|
||||||
},
|
},
|
||||||
error: (error) => {
|
error: (error) => {
|
||||||
console.error('Failed to load states', error);
|
console.error('Failed to load states', error);
|
||||||
@ -197,7 +213,6 @@ export class BasicDetailsComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
onCountryChange(country: string): void {
|
onCountryChange(country: string): void {
|
||||||
this.basicDetailsForm.get('state')?.reset();
|
this.basicDetailsForm.get('state')?.reset();
|
||||||
this.basicDetailsForm.get('revenueLocation')?.reset();
|
|
||||||
|
|
||||||
if (country) {
|
if (country) {
|
||||||
this.loadStates(country);
|
this.loadStates(country);
|
||||||
|
|||||||
@ -21,6 +21,12 @@
|
|||||||
<td mat-cell *matCellDef="let contact">{{ contact.firstName }}</td>
|
<td mat-cell *matCellDef="let contact">{{ contact.firstName }}</td>
|
||||||
</ng-container>
|
</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 -->
|
<!-- Last Name Column -->
|
||||||
<ng-container matColumnDef="lastName">
|
<ng-container matColumnDef="lastName">
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>Last Name</th>
|
<th mat-header-cell *matHeaderCellDef mat-sort-header>Last Name</th>
|
||||||
@ -45,6 +51,12 @@
|
|||||||
<td mat-cell *matCellDef="let contact">{{ contact.mobile | phone }}</td>
|
<td mat-cell *matCellDef="let contact">{{ contact.mobile | phone }}</td>
|
||||||
</ng-container>
|
</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 -->
|
<!-- Email Column -->
|
||||||
<ng-container matColumnDef="email">
|
<ng-container matColumnDef="email">
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>Email</th>
|
<th mat-header-cell *matHeaderCellDef mat-sort-header>Email</th>
|
||||||
@ -117,7 +129,7 @@
|
|||||||
<mat-label>Location</mat-label>
|
<mat-label>Location</mat-label>
|
||||||
<mat-select formControlName="locationid" required>
|
<mat-select formControlName="locationid" required>
|
||||||
<mat-option *ngFor="let location of locations" [value]="location.locationid">
|
<mat-option *ngFor="let location of locations" [value]="location.locationid">
|
||||||
{{ location.name }}
|
{{ getLocationLabel(location) }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
<mat-error *ngIf="contactForm.get('locationid')?.errors?.['required']">
|
<mat-error *ngIf="contactForm.get('locationid')?.errors?.['required']">
|
||||||
|
|||||||
@ -34,7 +34,7 @@ export class ContactsComponent {
|
|||||||
|
|
||||||
@ViewChild(MatSort) sort!: MatSort;
|
@ViewChild(MatSort) sort!: MatSort;
|
||||||
|
|
||||||
displayedColumns: string[] = ['firstName', 'lastName', 'title', 'phone', 'mobile', 'email', 'defaultContact', 'actions'];
|
displayedColumns: string[] = ['firstName', 'middleInitial', 'lastName', 'title', 'phone', 'mobile', 'fax', 'email', 'defaultContact', 'actions'];
|
||||||
dataSource = new MatTableDataSource<any>();
|
dataSource = new MatTableDataSource<any>();
|
||||||
contactForm: FormGroup;
|
contactForm: FormGroup;
|
||||||
// contactLoginForm: FormGroup;
|
// contactLoginForm: FormGroup;
|
||||||
@ -334,4 +334,24 @@ export class ContactsComponent {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getLocationLabel(location: Location): string {
|
||||||
|
let locationLabel = location.name;
|
||||||
|
if (location.address1) {
|
||||||
|
locationLabel += `, ${location.address1}`;
|
||||||
|
}
|
||||||
|
if (location.address2) {
|
||||||
|
locationLabel += `, ${location.address2}`;
|
||||||
|
}
|
||||||
|
if (location.city) {
|
||||||
|
locationLabel += `, ${location.city}`;
|
||||||
|
}
|
||||||
|
if (location.state) {
|
||||||
|
locationLabel += `, ${location.state}`;
|
||||||
|
}
|
||||||
|
if (location.zip) {
|
||||||
|
locationLabel += `, ${location.zip}`;
|
||||||
|
}
|
||||||
|
return locationLabel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
<!-- Address1 Column -->
|
<!-- Address1 Column -->
|
||||||
<ng-container matColumnDef="address">
|
<ng-container matColumnDef="address">
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>Address</th>
|
<th mat-header-cell *matHeaderCellDef mat-sort-header>Address</th>
|
||||||
<td mat-cell *matCellDef="let location">{{ getAddressLabel(location.address1, location.address2) }}</td>
|
<td mat-cell *matCellDef="let location">{{ location.address }}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- City Column -->
|
<!-- City Column -->
|
||||||
@ -41,6 +41,12 @@
|
|||||||
<td mat-cell *matCellDef="let location">{{ getCountryLabel(location.country) }}</td>
|
<td mat-cell *matCellDef="let location">{{ getCountryLabel(location.country) }}</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
<!-- Zip Column -->
|
||||||
|
<ng-container matColumnDef="zip">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header>Zip Code</th>
|
||||||
|
<td mat-cell *matCellDef="let location">{{ location.zip }}</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
<!-- Actions Column -->
|
<!-- Actions Column -->
|
||||||
<ng-container matColumnDef="actions">
|
<ng-container matColumnDef="actions">
|
||||||
<th mat-header-cell *matHeaderCellDef>Actions</th>
|
<th mat-header-cell *matHeaderCellDef>Actions</th>
|
||||||
|
|||||||
@ -32,7 +32,7 @@ export class LocationComponent {
|
|||||||
|
|
||||||
@ViewChild(MatSort) sort!: MatSort;
|
@ViewChild(MatSort) sort!: MatSort;
|
||||||
|
|
||||||
displayedColumns: string[] = ['name', 'address', 'city', 'state', 'country', 'actions'];
|
displayedColumns: string[] = ['name', 'address', 'city', 'state', 'country', 'zip', 'actions'];
|
||||||
dataSource = new MatTableDataSource<any>();
|
dataSource = new MatTableDataSource<any>();
|
||||||
locationForm: FormGroup;
|
locationForm: FormGroup;
|
||||||
isEditing = false;
|
isEditing = false;
|
||||||
@ -254,14 +254,6 @@ export class LocationComponent {
|
|||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
|
|
||||||
getAddressLabel(address1: string, address2?: string): string {
|
|
||||||
let addressLabel = address1;
|
|
||||||
if (address2) {
|
|
||||||
addressLabel += `, ${address2}`;
|
|
||||||
}
|
|
||||||
return addressLabel;
|
|
||||||
}
|
|
||||||
|
|
||||||
getCountryLabel(value: string): string {
|
getCountryLabel(value: string): string {
|
||||||
const country = this.countries.find(c => c.value === value);
|
const country = this.countries.find(c => c.value === value);
|
||||||
return country ? country.name : value;
|
return country ? country.name : value;
|
||||||
|
|||||||
@ -72,7 +72,7 @@
|
|||||||
<!-- Address Column -->
|
<!-- Address Column -->
|
||||||
<ng-container matColumnDef="address">
|
<ng-container matColumnDef="address">
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>Address</th>
|
<th mat-header-cell *matHeaderCellDef mat-sort-header>Address</th>
|
||||||
<td mat-cell *matCellDef="let client">{{ getAddressLabel(client.address1, client.address2)}}
|
<td mat-cell *matCellDef="let client">{{ client.address}}
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
|||||||
@ -124,12 +124,4 @@ export class ManagePreparerComponent implements OnInit, OnDestroy, AfterViewInit
|
|||||||
onEdit(clientid: number): void {
|
onEdit(clientid: number): void {
|
||||||
this.navigationService.navigate(['preparer', clientid]);
|
this.navigationService.navigate(['preparer', clientid]);
|
||||||
}
|
}
|
||||||
|
|
||||||
getAddressLabel(address1: string, address2?: string): string {
|
|
||||||
let addressLabel = address1;
|
|
||||||
if (address2) {
|
|
||||||
addressLabel += `, ${address2}`;
|
|
||||||
}
|
|
||||||
return addressLabel;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -25,6 +25,12 @@
|
|||||||
<td mat-cell *matCellDef="let contact">{{ contact.firstName }}</td>
|
<td mat-cell *matCellDef="let contact">{{ contact.firstName }}</td>
|
||||||
</ng-container>
|
</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 -->
|
<!-- Last Name Column -->
|
||||||
<ng-container matColumnDef="lastName">
|
<ng-container matColumnDef="lastName">
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>Last Name</th>
|
<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>
|
<td mat-cell *matCellDef="let contact">{{ contact.phone | phone }}</td>
|
||||||
</ng-container>
|
</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 -->
|
<!-- Email Column -->
|
||||||
<ng-container matColumnDef="email">
|
<ng-container matColumnDef="email">
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>Email</th>
|
<th mat-header-cell *matHeaderCellDef mat-sort-header>Email</th>
|
||||||
@ -76,10 +94,11 @@
|
|||||||
matTooltip="Delete">
|
matTooltip="Delete">
|
||||||
<mat-icon>delete</mat-icon>
|
<mat-icon>delete</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<!-- <button mat-icon-button (click)="setDefaultContact(contact.contactId)"
|
<button mat-icon-button (click)="setDefaultContact(contact.spContactId)"
|
||||||
[color]="contact.defaultContact ? 'primary' : ''" matTooltip="Set as default">
|
*ngIf="!contact.defaultContact || !contact.isInactive"
|
||||||
|
[hidden]="contact.defaultContact || contact.isInactive" matTooltip="Set as default contact">
|
||||||
<mat-icon>star</mat-icon>
|
<mat-icon>star</mat-icon>
|
||||||
</button> -->
|
</button>
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ export class ContactsComponent implements OnInit {
|
|||||||
|
|
||||||
@ViewChild(MatSort) sort!: MatSort;
|
@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>();
|
dataSource = new MatTableDataSource<any>();
|
||||||
contactForm: FormGroup;
|
contactForm: FormGroup;
|
||||||
isEditing = false;
|
isEditing = false;
|
||||||
@ -253,16 +253,32 @@ export class ContactsComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// setDefaultContact(contactId: string): void {
|
setDefaultContact(contactId: string): void {
|
||||||
// this.contactService.setDefaultServiceProviderContact(this.spid, contactId).subscribe({
|
|
||||||
// next: () => {
|
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
|
||||||
// this.notificationService.showSuccess('Default contact updated successfully');
|
width: '450px',
|
||||||
// this.loadContacts();
|
data: {
|
||||||
// },
|
title: 'Confirm Default Contact',
|
||||||
// error: (error) => {
|
message: 'Are you sure you want to set this contact as default contact?',
|
||||||
// this.notificationService.showError('Failed to set default contact');
|
confirmText: 'Yes',
|
||||||
// console.error('Error setting default contact:', error);
|
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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user