prepare basic and contact updates

This commit is contained in:
Cyril Joseph 2025-07-29 07:23:31 -03:00
parent 94334c8804
commit 7c6a9996bc
5 changed files with 22 additions and 20 deletions

View File

@ -1,4 +1,4 @@
export interface ContactLogin { export interface ContactLogin {
clientContactId: number; clientContactId: number;
password: string; //password: string;
} }

View File

@ -89,7 +89,7 @@ export class ContactService {
P_SPID: this.userService.getUserSpid(), P_SPID: this.userService.getUserSpid(),
P_CLIENTCONTACTID: data.clientContactId, P_CLIENTCONTACTID: data.clientContactId,
P_ENABLEPASSWORDPOLICY: 'Y', P_ENABLEPASSWORDPOLICY: 'Y',
P_PASSWORD: data.password, //P_PASSWORD: data.password,
P_USERID: this.userService.getUser() P_USERID: this.userService.getUser()
} }

View File

@ -69,6 +69,8 @@ export class BasicDetailsComponent implements OnInit, OnDestroy {
console.error('Error loading basic details:', error); console.error('Error loading basic details:', error);
} }
}); });
} else {
this.loadStates('US');
} }
} }
@ -85,7 +87,7 @@ export class BasicDetailsComponent implements OnInit, OnDestroy {
address2: ['', Validators.maxLength(100)], address2: ['', Validators.maxLength(100)],
city: ['', [Validators.required, Validators.maxLength(50)]], city: ['', [Validators.required, Validators.maxLength(50)]],
state: ['', Validators.required], state: ['', Validators.required],
country: ['', Validators.required], country: ['US', Validators.required],
zip: ['', [Validators.required, ZipCodeValidator('country')]], zip: ['', [Validators.required, ZipCodeValidator('country')]],
carnetIssuingRegion: ['', Validators.required], carnetIssuingRegion: ['', Validators.required],
revenueLocation: ['', Validators.required], revenueLocation: ['', Validators.required],

View File

@ -279,12 +279,12 @@
<!-- Contact Login Form --> <!-- Contact Login Form -->
<div class="form-container" *ngIf="showLoginForm"> <div class="form-container" *ngIf="showLoginForm">
<form [formGroup]="contactLoginForm" (ngSubmit)="saveLogin()"> <!-- <form [formGroup]="contactLoginForm" (ngSubmit)="saveLogin()"> -->
<div class="form-header"> <div class="form-header">
<h3>Create Login</h3> <h3>Create Login</h3>
</div> </div>
<div *ngIf="isEditing" class="readonly-section bottom-divider"> <div *ngIf="isEditing" class="readonly-section">
<div class="readonly-fields"> <div class="readonly-fields">
<div class="field-column"> <div class="field-column">
<!-- Email --> <!-- Email -->
@ -297,7 +297,7 @@
</div> </div>
</div> </div>
</div> </div>
<!--
<div class="form-row"> <div class="form-row">
<mat-form-field appearance="outline"> <mat-form-field appearance="outline">
<mat-label>Password</mat-label> <mat-label>Password</mat-label>
@ -307,14 +307,14 @@
Password is required Password is required
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
</div> </div> -->
<div class="form-actions"> <div class="form-actions">
<button mat-raised-button color="primary" type="submit" [disabled]="contactLoginForm.invalid"> <button mat-raised-button color="primary" type="button" (click)="saveLogin()">
Save Create
</button> </button>
<button mat-button type="button" (click)="cancelEdit()">Cancel</button> <button mat-button type="button" (click)="cancelEdit()">Cancel</button>
</div> </div>
</form> <!-- </form> -->
</div> </div>
</div> </div>

View File

@ -32,7 +32,7 @@ export class ContactsComponent {
displayedColumns: string[] = ['firstName', 'lastName', 'title', 'phone', 'mobile', 'email', 'defaultContact', 'actions']; displayedColumns: string[] = ['firstName', 'lastName', 'title', 'phone', 'mobile', 'email', 'defaultContact', 'actions'];
dataSource = new MatTableDataSource<any>(); dataSource = new MatTableDataSource<any>();
contactForm: FormGroup; contactForm: FormGroup;
contactLoginForm: FormGroup; // contactLoginForm: FormGroup;
isEditing = false; isEditing = false;
currentContactId: number | null = null; currentContactId: number | null = null;
isLoading = false; isLoading = false;
@ -79,9 +79,9 @@ export class ContactsComponent {
defaultContact: [false] defaultContact: [false]
}); });
this.contactLoginForm = this.fb.group({ // this.contactLoginForm = this.fb.group({
password: ['', [Validators.required]] // password: ['', [Validators.required]]
}); // });
} }
ngOnInit(): void { ngOnInit(): void {
@ -278,14 +278,14 @@ export class ContactsComponent {
} }
saveLogin(): void { saveLogin(): void {
if (this.contactLoginForm.invalid) { // if (this.contactLoginForm.invalid) {
this.contactLoginForm.markAllAsTouched(); // this.contactLoginForm.markAllAsTouched();
return; // return;
} // }
const contactLoginData: ContactLogin = { const contactLoginData: ContactLogin = {
clientContactId: this.currentContactId!, clientContactId: this.currentContactId!,
password: this.contactLoginForm.value.password // password: this.contactLoginForm.value.password
}; };
this.contactService.createContactLogin(contactLoginData).subscribe({ this.contactService.createContactLogin(contactLoginData).subscribe({
@ -308,7 +308,7 @@ export class ContactsComponent {
this.isEditing = false; this.isEditing = false;
this.currentContactId = null; this.currentContactId = null;
this.contactForm.reset(); this.contactForm.reset();
this.contactLoginForm.reset(); // this.contactLoginForm.reset();
} }
// setDefaultContact(contactId: string): void { // setDefaultContact(contactId: string): void {