iptdevs-design-system 3.1.971 → 3.1.973

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.
@@ -1882,21 +1882,27 @@ class updateUserFormComponent {
1882
1882
  this.parametersLoaded = false;
1883
1883
  // userUpdated = false;
1884
1884
  this.initialFormValue = [];
1885
+ this.pendingInit = false;
1885
1886
  this.isStudent = false;
1886
1887
  this.justifyOptions = [];
1887
1888
  this.initForm();
1888
1889
  }
1889
1890
  ngOnInit() {
1890
1891
  this.getParameters();
1891
- this.trackIdTypeChanges();
1892
+ // this.trackIdTypeChanges();
1892
1893
  }
1893
1894
  ngOnChanges(changes) {
1894
1895
  if (changes['visibleModal'] && changes['visibleModal'].currentValue) {
1895
1896
  // console.log("entro a getParameters por visible modal, donde el change es:", changes['visibleModal']);
1896
- this.initializeForm();
1897
- this.setJustifyOptions();
1898
- this.trackIdTypeChanges();
1899
- this.cdr.detectChanges();
1897
+ if (this.parametersLoaded) {
1898
+ this.initializeForm();
1899
+ this.setJustifyOptions();
1900
+ this.trackIdTypeChanges();
1901
+ this.cdr.detectChanges();
1902
+ }
1903
+ else {
1904
+ this.pendingInit = true;
1905
+ }
1900
1906
  }
1901
1907
  }
1902
1908
  ngOnDestroy() {
@@ -1935,7 +1941,9 @@ class updateUserFormComponent {
1935
1941
  this.parametersLoaded = true;
1936
1942
  this.setParameters();
1937
1943
  this.initializeForm();
1944
+ this.trackIdTypeChanges();
1938
1945
  this.cdr.detectChanges();
1946
+ this.pendingInit = false;
1939
1947
  },
1940
1948
  error: (err) => {
1941
1949
  console.error('Error fetching parameters:', err);
@@ -1950,10 +1958,6 @@ class updateUserFormComponent {
1950
1958
  this.civilStatus = this.parametersAll?.civilStatus;
1951
1959
  this.states = this.parametersAll?.State;
1952
1960
  this.cities = this.parametersAll?.city;
1953
- // this.genders = [
1954
- // { code: 1, name: 'Masculino' },
1955
- // { code: 2, name: 'Femenino' }
1956
- // ];
1957
1961
  if (this.parametersAll && this.parametersAll.gender) {
1958
1962
  // Transformar gender en un arreglo de { code, name }
1959
1963
  this.genders = this.parametersAll.gender.map((gender) => ({
@@ -2116,10 +2120,10 @@ class updateUserFormComponent {
2116
2120
  parent_email: this.DataStudent.cods?.parent?.email || ''
2117
2121
  });
2118
2122
  }
2123
+ this.updateIdCardValidators(this.DataStudent.id_card_type);
2119
2124
  this.updateUserForm.reset();
2120
2125
  this.updateUserForm.patchValue(formValue);
2121
2126
  this.initialFormValue = { ...this.updateUserForm.value };
2122
- this.updateIdCardValidators(this.DataStudent.id_card_type);
2123
2127
  if (formValue.country) {
2124
2128
  // console.log("en populateForm se envio dato para setearse country");
2125
2129
  this.countries = this.parametersAll?.country;
@@ -2133,7 +2137,7 @@ class updateUserFormComponent {
2133
2137
  }
2134
2138
  if (formValue.id_card_type) {
2135
2139
  this.idTypes = this.parametersAll?.TypeIdCardByCountryCol;
2136
- this.selectGender(this.DataStudent.id_card_type);
2140
+ this.selectIdType('id_card_type', this.DataStudent.id_card_type);
2137
2141
  }
2138
2142
  if (formValue.phone_indicative) {
2139
2143
  this.indicatives = this.parametersAll?.indicatives;
@@ -2168,6 +2172,9 @@ class updateUserFormComponent {
2168
2172
  this.closeModalIS.emit(false);
2169
2173
  }
2170
2174
  trackIdTypeChanges() {
2175
+ if (this.idTypeSubscription) {
2176
+ this.idTypeSubscription.unsubscribe(); // Unsub old sub before new one (safe for recreation)
2177
+ }
2171
2178
  this.idTypeSubscription = this.updateUserForm.get('id_card_type')?.valueChanges.subscribe(value => {
2172
2179
  this.updateIdCardValidators(value);
2173
2180
  });