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.
- package/esm2020/lib/components/forms/update-user-form/update-user-form.component.mjs +7 -26
- package/fesm2015/iptdevs-design-system.mjs +6 -25
- package/fesm2015/iptdevs-design-system.mjs.map +1 -1
- package/fesm2020/iptdevs-design-system.mjs +6 -25
- package/fesm2020/iptdevs-design-system.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1955,7 +1955,6 @@ class updateUserFormComponent {
|
|
|
1955
1955
|
(_b = this.updateUserForm.get('status')) === null || _b === void 0 ? void 0 : _b.disable({ emitEvent: false });
|
|
1956
1956
|
}
|
|
1957
1957
|
else {
|
|
1958
|
-
// Lista reducida para otros roles
|
|
1959
1958
|
this.justifyOptions = [
|
|
1960
1959
|
{ name: 'Activo', code: 1 },
|
|
1961
1960
|
{ name: 'Removido', code: 4 }
|
|
@@ -2061,7 +2060,6 @@ class updateUserFormComponent {
|
|
|
2061
2060
|
initializeForm() {
|
|
2062
2061
|
var _a, _b, _c;
|
|
2063
2062
|
this.showParentSection = !!((_c = (_b = (_a = this.DataStudent) === null || _a === void 0 ? void 0 : _a.cods) === null || _b === void 0 ? void 0 : _b.parent) === null || _c === void 0 ? void 0 : _c.code);
|
|
2064
|
-
// this.showEmailIpt = !!this.DataStudent?.email_ipt && this.DataStudent.email_ipt !== false;
|
|
2065
2063
|
this.checkRoleForAdditionalFields(this.DataStudent.role);
|
|
2066
2064
|
this.initForm();
|
|
2067
2065
|
this.populateForm();
|
|
@@ -2190,9 +2188,7 @@ class updateUserFormComponent {
|
|
|
2190
2188
|
country: (_a = this.DataStudent.city) === null || _a === void 0 ? void 0 : _a.country,
|
|
2191
2189
|
state: (_b = this.DataStudent.city) === null || _b === void 0 ? void 0 : _b.state,
|
|
2192
2190
|
city: (_c = this.DataStudent.city) === null || _c === void 0 ? void 0 : _c.code,
|
|
2193
|
-
// role: this.transformRole(this.DataStudent.role) || '',
|
|
2194
2191
|
role: this.canEditRole ? this.DataStudent.role : this.transformRole(this.DataStudent.role) || '',
|
|
2195
|
-
// service_hour: this.DataStudent.service_hour || 0,
|
|
2196
2192
|
changePassword: false,
|
|
2197
2193
|
password: '',
|
|
2198
2194
|
re_password: '',
|
|
@@ -2206,9 +2202,6 @@ class updateUserFormComponent {
|
|
|
2206
2202
|
else {
|
|
2207
2203
|
formValue.service_hour = this.DataStudent.service_hour || 0;
|
|
2208
2204
|
}
|
|
2209
|
-
// if (this.showEmailIpt) {
|
|
2210
|
-
// formValue.email_ipt = this.DataStudent.email_ipt || '';
|
|
2211
|
-
// }
|
|
2212
2205
|
if (this.showParentSection) {
|
|
2213
2206
|
Object.assign(formValue, {
|
|
2214
2207
|
parent_name: ((_e = (_d = this.DataStudent.cods) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.name) || '',
|
|
@@ -2416,7 +2409,6 @@ class updateUserFormComponent {
|
|
|
2416
2409
|
var _a, _b;
|
|
2417
2410
|
if (role !== null) {
|
|
2418
2411
|
(_a = this.updateUserForm.get('role')) === null || _a === void 0 ? void 0 : _a.setValue(role);
|
|
2419
|
-
// Verificar si se deben mostrar los campos adicionales
|
|
2420
2412
|
const previousShowEmailIptAndServiceHour = this.showEmailIptAndServiceHour;
|
|
2421
2413
|
this.checkRoleForAdditionalFields(role);
|
|
2422
2414
|
// Si showEmailIptAndServiceHour cambió, actualizar los validadores
|
|
@@ -2426,20 +2418,23 @@ class updateUserFormComponent {
|
|
|
2426
2418
|
if (this.showEmailIptAndServiceHour) {
|
|
2427
2419
|
// Agregar campos y validadores si no estaban presentes
|
|
2428
2420
|
if (!emailIptControl) {
|
|
2429
|
-
this.
|
|
2421
|
+
const emailIptValue = this.DataStudent.email_ipt || '';
|
|
2422
|
+
this.updateUserForm.addControl('email_ipt', this.fb.control(emailIptValue, [Validators.required, Validators.email, Validators.maxLength(250)]));
|
|
2430
2423
|
}
|
|
2431
2424
|
else {
|
|
2432
2425
|
emailIptControl.setValidators([Validators.required, Validators.email, Validators.maxLength(250)]);
|
|
2426
|
+
emailIptControl.setValue(this.DataStudent.email_ipt || '');
|
|
2433
2427
|
}
|
|
2434
2428
|
if (!serviceHourControl) {
|
|
2435
|
-
this.
|
|
2429
|
+
const serviceHourValue = this.DataStudent.service_hour != null ? this.DataStudent.service_hour : 0; // Usa 0 como fallback
|
|
2430
|
+
this.updateUserForm.addControl('service_hour', this.fb.control(serviceHourValue, [Validators.required, Validators.pattern(/^[0-9]+$/), Validators.min(0), Validators.max(44)]));
|
|
2436
2431
|
}
|
|
2437
2432
|
else {
|
|
2438
2433
|
serviceHourControl.setValidators([Validators.required, Validators.pattern(/^[0-9]+$/), Validators.min(0), Validators.max(44)]);
|
|
2434
|
+
serviceHourControl.setValue(this.DataStudent.service_hour != null ? this.DataStudent.service_hour : 0);
|
|
2439
2435
|
}
|
|
2440
2436
|
}
|
|
2441
2437
|
else {
|
|
2442
|
-
// Remover validadores si los campos no son necesarios
|
|
2443
2438
|
if (emailIptControl) {
|
|
2444
2439
|
emailIptControl.clearValidators();
|
|
2445
2440
|
emailIptControl.setValue('');
|
|
@@ -2449,7 +2444,6 @@ class updateUserFormComponent {
|
|
|
2449
2444
|
serviceHourControl.setValue(0);
|
|
2450
2445
|
}
|
|
2451
2446
|
}
|
|
2452
|
-
// Actualizar la validez de los controles
|
|
2453
2447
|
emailIptControl === null || emailIptControl === void 0 ? void 0 : emailIptControl.updateValueAndValidity();
|
|
2454
2448
|
serviceHourControl === null || serviceHourControl === void 0 ? void 0 : serviceHourControl.updateValueAndValidity();
|
|
2455
2449
|
}
|
|
@@ -2525,7 +2519,6 @@ class updateUserFormComponent {
|
|
|
2525
2519
|
originalValue = this.DataStudent.email || '';
|
|
2526
2520
|
break;
|
|
2527
2521
|
case 'email_ipt':
|
|
2528
|
-
// originalValue = this.DataStudent.email_ipt || '';
|
|
2529
2522
|
originalValue = this.showEmailIptAndServiceHour ? (this.DataStudent.email_ipt || '') : '';
|
|
2530
2523
|
break;
|
|
2531
2524
|
case 'gender':
|
|
@@ -2553,11 +2546,9 @@ class updateUserFormComponent {
|
|
|
2553
2546
|
originalValue = ((_c = this.DataStudent.city) === null || _c === void 0 ? void 0 : _c.code) || '';
|
|
2554
2547
|
break;
|
|
2555
2548
|
case 'role':
|
|
2556
|
-
// originalValue = this.transformRole(this.DataStudent.role) || '';
|
|
2557
2549
|
originalValue = this.canEditRole ? this.DataStudent.role : this.transformRole(this.DataStudent.role) || '';
|
|
2558
2550
|
break;
|
|
2559
2551
|
case 'service_hour':
|
|
2560
|
-
// originalValue = this.DataStudent.service_hour || '' ;
|
|
2561
2552
|
originalValue = this.showEmailIptAndServiceHour ? (this.DataStudent.service_hour || 0) : 0;
|
|
2562
2553
|
break;
|
|
2563
2554
|
case 'status':
|
|
@@ -2606,11 +2597,6 @@ class updateUserFormComponent {
|
|
|
2606
2597
|
this.updateUserForm.hasError('mismatch') ||
|
|
2607
2598
|
!this.hasFormChanged()) {
|
|
2608
2599
|
this.updateUserForm.markAllAsTouched();
|
|
2609
|
-
console.log('Validation failed:', {
|
|
2610
|
-
invalid: this.updateUserForm.invalid,
|
|
2611
|
-
mismatch: this.updateUserForm.hasError('mismatch'),
|
|
2612
|
-
hasChanges: this.hasFormChanged()
|
|
2613
|
-
});
|
|
2614
2600
|
return;
|
|
2615
2601
|
}
|
|
2616
2602
|
this.showConfirmSection = true;
|
|
@@ -2687,11 +2673,6 @@ class updateUserFormComponent {
|
|
|
2687
2673
|
this.updateUserForm.hasError('mismatch') ||
|
|
2688
2674
|
!this.hasFormChanged()) {
|
|
2689
2675
|
this.updateUserForm.markAllAsTouched();
|
|
2690
|
-
console.log('Validation failed:', {
|
|
2691
|
-
invalid: this.updateUserForm.invalid,
|
|
2692
|
-
mismatch: this.updateUserForm.hasError('mismatch'),
|
|
2693
|
-
hasChanges: this.hasFormChanged()
|
|
2694
|
-
});
|
|
2695
2676
|
return;
|
|
2696
2677
|
}
|
|
2697
2678
|
this.confirmForm.reset();
|