From 4d81b0d97e4c074d9a7dff9bd331813ab21a50c2 Mon Sep 17 00:00:00 2001 From: Cyril Joseph Date: Mon, 14 Jul 2025 09:51:12 -0300 Subject: [PATCH] preparer contact updates --- src/app/core/models/preparer/contact.ts | 2 +- .../core/services/preparer/contact.service.ts | 2 -- .../preparer/contacts/contacts.component.html | 32 ++++++++----------- .../preparer/contacts/contacts.component.ts | 14 ++++---- 4 files changed, 21 insertions(+), 29 deletions(-) diff --git a/src/app/core/models/preparer/contact.ts b/src/app/core/models/preparer/contact.ts index 3787659..26ad242 100644 --- a/src/app/core/models/preparer/contact.ts +++ b/src/app/core/models/preparer/contact.ts @@ -2,7 +2,7 @@ export interface Contact { clientContactId: number; spid: number clientid: number; - locationid: number; + locationid?: number; defaultContact: boolean; firstName: string; lastName: string; diff --git a/src/app/core/services/preparer/contact.service.ts b/src/app/core/services/preparer/contact.service.ts index 856b780..245616e 100644 --- a/src/app/core/services/preparer/contact.service.ts +++ b/src/app/core/services/preparer/contact.service.ts @@ -26,7 +26,6 @@ export class ContactService { clientContactId: contact.CLIENTCONTACTID, spid: contact.SPID, clientid: contact.CLIENTID, - locationid: contact.LOCATIONID, defaultContact: contact.DEFCONTACTFLAG === 'Y', firstName: contact.FIRSTNAME, lastName: contact.LASTNAME, @@ -71,7 +70,6 @@ export class ContactService { const contact = { P_SPID: this.userService.getUserSpid(), P_CLIENTCONTACTID: spContactId, - P_LOCATIONID: data.locationid, P_FIRSTNAME: data.firstName, P_LASTNAME: data.lastName, P_MIDDLEINITIAL: data.middleInitial, diff --git a/src/app/preparer/contacts/contacts.component.html b/src/app/preparer/contacts/contacts.component.html index 782e1b0..d64365c 100644 --- a/src/app/preparer/contacts/contacts.component.html +++ b/src/app/preparer/contacts/contacts.component.html @@ -15,12 +15,6 @@ - - - - - - @@ -117,6 +111,20 @@

{{ isEditing ? 'Edit Contact' : 'Add New Contact' }}

+
+ + Location + + + {{ location.name }} + + + + Location is required + + +
+
First Name @@ -164,18 +172,6 @@ Maximum 100 characters allowed - - - Location - - - {{ location.name }} - - - - Location is required - -
diff --git a/src/app/preparer/contacts/contacts.component.ts b/src/app/preparer/contacts/contacts.component.ts index db7dc6b..961009c 100644 --- a/src/app/preparer/contacts/contacts.component.ts +++ b/src/app/preparer/contacts/contacts.component.ts @@ -29,7 +29,7 @@ export class ContactsComponent { @ViewChild(MatPaginator) paginator!: MatPaginator; @ViewChild(MatSort) sort!: MatSort; - displayedColumns: string[] = ['location', 'firstName', 'lastName', 'title', 'phone', 'mobile', 'email', 'defaultContact', 'actions']; + displayedColumns: string[] = ['firstName', 'lastName', 'title', 'phone', 'mobile', 'email', 'defaultContact', 'actions']; dataSource = new MatTableDataSource(); contactForm: FormGroup; contactLoginForm: FormGroup; @@ -74,7 +74,7 @@ export class ContactsComponent { mobile: ['', [Validators.required, Validators.pattern(/^[0-9]{10,15}$/)]], fax: ['', [Validators.pattern(/^[0-9]{10,15}$/)]], email: ['', [Validators.required, Validators.email, Validators.maxLength(100)]], - location: ['', [Validators.required]], + locationid: [''], defaultContact: [false] }); @@ -134,6 +134,7 @@ export class ContactsComponent { this.currentContactId = null; this.contactForm.reset(); // this.contactForm.patchValue({ defaultContact: false }); + this.contactForm.get('locationid')?.setValidators([Validators.required]); } editContact(contact: Contact): void { @@ -150,7 +151,7 @@ export class ContactsComponent { mobile: contact.mobile, fax: contact.fax, email: contact.email, - location: contact.locationid, + //location: contact.locationid, // defaultContact: contact.defaultContact }); @@ -158,6 +159,8 @@ export class ContactsComponent { this.contactReadOnlyFields.lastChangedBy = contact.lastUpdatedBy ?? contact.createdBy; this.contactReadOnlyFields.isInactive = contact.isInactive; this.contactReadOnlyFields.inactivatedDate = contact.inactivatedDate; + + this.contactForm.get('locationid')?.setValidators([]); } saveContact(): void { @@ -258,11 +261,6 @@ export class ContactsComponent { }); } - getLocationLabel(value: number): string { - const location = this.locations.find(l => l.locationid === value); - return location ? location.name : ''; - } - createLogin(contact: Contact): void { this.showForm = false; this.showLoginForm = true;
Location Name{{ getLocationLabel(contact.locationid) }} First Name