iptdevs-design-system 3.2.8 → 3.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1952,7 +1952,6 @@ class updateUserFormComponent {
1952
1952
  this.updateUserForm.get('status')?.disable({ emitEvent: false });
1953
1953
  }
1954
1954
  else {
1955
- // Lista reducida para otros roles
1956
1955
  this.justifyOptions = [
1957
1956
  { name: 'Activo', code: 1 },
1958
1957
  { name: 'Removido', code: 4 }
@@ -2056,7 +2055,6 @@ class updateUserFormComponent {
2056
2055
  }
2057
2056
  initializeForm() {
2058
2057
  this.showParentSection = !!this.DataStudent?.cods?.parent?.code;
2059
- // this.showEmailIpt = !!this.DataStudent?.email_ipt && this.DataStudent.email_ipt !== false;
2060
2058
  this.checkRoleForAdditionalFields(this.DataStudent.role);
2061
2059
  this.initForm();
2062
2060
  this.populateForm();
@@ -2182,9 +2180,7 @@ class updateUserFormComponent {
2182
2180
  country: this.DataStudent.city?.country,
2183
2181
  state: this.DataStudent.city?.state,
2184
2182
  city: this.DataStudent.city?.code,
2185
- // role: this.transformRole(this.DataStudent.role) || '',
2186
2183
  role: this.canEditRole ? this.DataStudent.role : this.transformRole(this.DataStudent.role) || '',
2187
- // service_hour: this.DataStudent.service_hour || 0,
2188
2184
  changePassword: false,
2189
2185
  password: '',
2190
2186
  re_password: '',
@@ -2198,9 +2194,6 @@ class updateUserFormComponent {
2198
2194
  else {
2199
2195
  formValue.service_hour = this.DataStudent.service_hour || 0;
2200
2196
  }
2201
- // if (this.showEmailIpt) {
2202
- // formValue.email_ipt = this.DataStudent.email_ipt || '';
2203
- // }
2204
2197
  if (this.showParentSection) {
2205
2198
  Object.assign(formValue, {
2206
2199
  parent_name: this.DataStudent.cods?.parent?.name || '',
@@ -2401,7 +2394,6 @@ class updateUserFormComponent {
2401
2394
  selectRole(role) {
2402
2395
  if (role !== null) {
2403
2396
  this.updateUserForm.get('role')?.setValue(role);
2404
- // Verificar si se deben mostrar los campos adicionales
2405
2397
  const previousShowEmailIptAndServiceHour = this.showEmailIptAndServiceHour;
2406
2398
  this.checkRoleForAdditionalFields(role);
2407
2399
  // Si showEmailIptAndServiceHour cambió, actualizar los validadores
@@ -2411,20 +2403,23 @@ class updateUserFormComponent {
2411
2403
  if (this.showEmailIptAndServiceHour) {
2412
2404
  // Agregar campos y validadores si no estaban presentes
2413
2405
  if (!emailIptControl) {
2414
- this.updateUserForm.addControl('email_ipt', this.fb.control('', [Validators.required, Validators.email, Validators.maxLength(250)]));
2406
+ const emailIptValue = this.DataStudent.email_ipt || '';
2407
+ this.updateUserForm.addControl('email_ipt', this.fb.control(emailIptValue, [Validators.required, Validators.email, Validators.maxLength(250)]));
2415
2408
  }
2416
2409
  else {
2417
2410
  emailIptControl.setValidators([Validators.required, Validators.email, Validators.maxLength(250)]);
2411
+ emailIptControl.setValue(this.DataStudent.email_ipt || '');
2418
2412
  }
2419
2413
  if (!serviceHourControl) {
2420
- this.updateUserForm.addControl('service_hour', this.fb.control('', [Validators.required, Validators.pattern(/^[0-9]+$/), Validators.min(0), Validators.max(44)]));
2414
+ const serviceHourValue = this.DataStudent.service_hour != null ? this.DataStudent.service_hour : 0; // Usa 0 como fallback
2415
+ this.updateUserForm.addControl('service_hour', this.fb.control(serviceHourValue, [Validators.required, Validators.pattern(/^[0-9]+$/), Validators.min(0), Validators.max(44)]));
2421
2416
  }
2422
2417
  else {
2423
2418
  serviceHourControl.setValidators([Validators.required, Validators.pattern(/^[0-9]+$/), Validators.min(0), Validators.max(44)]);
2419
+ serviceHourControl.setValue(this.DataStudent.service_hour != null ? this.DataStudent.service_hour : 0);
2424
2420
  }
2425
2421
  }
2426
2422
  else {
2427
- // Remover validadores si los campos no son necesarios
2428
2423
  if (emailIptControl) {
2429
2424
  emailIptControl.clearValidators();
2430
2425
  emailIptControl.setValue('');
@@ -2434,7 +2429,6 @@ class updateUserFormComponent {
2434
2429
  serviceHourControl.setValue(0);
2435
2430
  }
2436
2431
  }
2437
- // Actualizar la validez de los controles
2438
2432
  emailIptControl?.updateValueAndValidity();
2439
2433
  serviceHourControl?.updateValueAndValidity();
2440
2434
  }
@@ -2509,7 +2503,6 @@ class updateUserFormComponent {
2509
2503
  originalValue = this.DataStudent.email || '';
2510
2504
  break;
2511
2505
  case 'email_ipt':
2512
- // originalValue = this.DataStudent.email_ipt || '';
2513
2506
  originalValue = this.showEmailIptAndServiceHour ? (this.DataStudent.email_ipt || '') : '';
2514
2507
  break;
2515
2508
  case 'gender':
@@ -2537,11 +2530,9 @@ class updateUserFormComponent {
2537
2530
  originalValue = this.DataStudent.city?.code || '';
2538
2531
  break;
2539
2532
  case 'role':
2540
- // originalValue = this.transformRole(this.DataStudent.role) || '';
2541
2533
  originalValue = this.canEditRole ? this.DataStudent.role : this.transformRole(this.DataStudent.role) || '';
2542
2534
  break;
2543
2535
  case 'service_hour':
2544
- // originalValue = this.DataStudent.service_hour || '' ;
2545
2536
  originalValue = this.showEmailIptAndServiceHour ? (this.DataStudent.service_hour || 0) : 0;
2546
2537
  break;
2547
2538
  case 'status':
@@ -2590,11 +2581,6 @@ class updateUserFormComponent {
2590
2581
  this.updateUserForm.hasError('mismatch') ||
2591
2582
  !this.hasFormChanged()) {
2592
2583
  this.updateUserForm.markAllAsTouched();
2593
- console.log('Validation failed:', {
2594
- invalid: this.updateUserForm.invalid,
2595
- mismatch: this.updateUserForm.hasError('mismatch'),
2596
- hasChanges: this.hasFormChanged()
2597
- });
2598
2584
  return;
2599
2585
  }
2600
2586
  this.showConfirmSection = true;
@@ -2686,11 +2672,6 @@ class updateUserFormComponent {
2686
2672
  this.updateUserForm.hasError('mismatch') ||
2687
2673
  !this.hasFormChanged()) {
2688
2674
  this.updateUserForm.markAllAsTouched();
2689
- console.log('Validation failed:', {
2690
- invalid: this.updateUserForm.invalid,
2691
- mismatch: this.updateUserForm.hasError('mismatch'),
2692
- hasChanges: this.hasFormChanged()
2693
- });
2694
2675
  return;
2695
2676
  }
2696
2677
  this.confirmForm.reset();