iptdevs-design-system 3.1.670 → 3.1.672

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.
@@ -7210,6 +7210,7 @@ class CodSelfFormStepThreeComponent extends CodSelfManagedSteps {
7210
7210
  this.feeResponse = false;
7211
7211
  this.thereArePlans = false;
7212
7212
  this.isFinancing = false;
7213
+ this.dataFinancingMaster = [];
7213
7214
  this.dataFinancing = [];
7214
7215
  this.selectedRow = null;
7215
7216
  this.errorMessage = 'Faltan campos por llenar.';
@@ -7376,30 +7377,30 @@ class CodSelfFormStepThreeComponent extends CodSelfManagedSteps {
7376
7377
  quotaTimes: Number(this.codSelfFormStepThree.controls['fee_number'].value),
7377
7378
  totalPrice: this.codSelfFormStepThree.controls['total_price'].value,
7378
7379
  };
7379
- this.dataFinancing = this.calculateQuotesService.calculateQuotes(params);
7380
- if (this.dataFinancing.length > 1) {
7381
- const enrollmentValue = this.dataFinancing[0][1];
7382
- const firstQuotaValue = this.dataFinancing[1][1];
7380
+ this.dataFinancingMaster = this.calculateQuotesService.calculateQuotes(params);
7381
+ if (this.dataFinancingMaster.length > 1) {
7382
+ const enrollmentValue = this.dataFinancingMaster[0][1];
7383
+ const firstQuotaValue = this.dataFinancingMaster[1][1];
7383
7384
  this.totalInitialPaymentSpan = parseFloat(enrollmentValue.replace(/[^\d.-]/g, '')) + parseFloat(firstQuotaValue.replace(/[^\d.-]/g, ''));
7384
7385
  console.log('linea, 237', this.totalInitialPaymentSpan);
7385
- const enrollmentValueTwo = parseFloat(this.dataFinancing[0][1].replace(/[^\d.-]/g, ''));
7386
- const firstQuotaValueTwo = parseFloat(this.dataFinancing[1][1].replace(/[^\d.-]/g, ''));
7386
+ const enrollmentValueTwo = parseFloat(this.dataFinancingMaster[0][1].replace(/[^\d.-]/g, ''));
7387
+ const firstQuotaValueTwo = parseFloat(this.dataFinancingMaster[1][1].replace(/[^\d.-]/g, ''));
7387
7388
  this.totalInitialPayment = enrollmentValueTwo + firstQuotaValueTwo;
7388
7389
  console.log('linea, 246', this.totalInitialPayment);
7389
7390
  const totalInitialPaymentInteger = Math.round(this.totalInitialPayment);
7390
7391
  const formattedTotalInitialPayment = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD', minimumFractionDigits: 0 }).format(totalInitialPaymentInteger);
7391
7392
  console.log('linea, 246', formattedTotalInitialPayment);
7392
7393
  const combinedRecord = [
7393
- this.dataFinancing[0][0],
7394
+ this.dataFinancingMaster[0][0],
7394
7395
  formattedTotalInitialPayment,
7395
- this.dataFinancing[0][2] // Mantener la fecha del primer registro
7396
+ this.dataFinancingMaster[0][2] // Mantener la fecha del primer registro
7396
7397
  ];
7397
7398
  console.log('linea, 253', combinedRecord);
7398
- this.dataFinancing = [combinedRecord, ...this.dataFinancing.slice(2)];
7399
+ this.dataFinancing = [combinedRecord, ...this.dataFinancingMaster.slice(2)];
7399
7400
  console.log('inea, 255', this.dataFinancing);
7400
7401
  }
7401
7402
  this.isFinancing = true;
7402
- this.financingData.emit(this.dataFinancing);
7403
+ this.financingData.emit(this.dataFinancingMaster);
7403
7404
  this.isLoadingSelectLevels = false;
7404
7405
  }
7405
7406
  // calculateNewQuotes() {
@@ -7644,6 +7645,7 @@ class CodSelfManagedComponent {
7644
7645
  this.currentStep = 0;
7645
7646
  this.loaderMessage = '';
7646
7647
  this.isLoading = false;
7648
+ this.formSteps = 4;
7647
7649
  this.codCreationSubscription = null;
7648
7650
  this.countInitialStep = 0;
7649
7651
  this.items = [
@@ -7698,8 +7700,34 @@ class CodSelfManagedComponent {
7698
7700
  return;
7699
7701
  }
7700
7702
  const totalData = [];
7701
- if (action === 'create')
7702
- this.createCOD(totalData);
7703
+ this.subscription = this.codSelfManagedFormControls.getControlValues().subscribe((controls) => {
7704
+ for (let i = 1; i <= this.formSteps; i++) {
7705
+ let controlsByStep = controls[i - 1];
7706
+ controlsByStep.forEach(control => {
7707
+ let value = this.localStorageCodSelfManaged.getCodFormData(i, control.name);
7708
+ totalData.push({
7709
+ control: control.name,
7710
+ isRequired: control.required,
7711
+ value,
7712
+ description: control.description
7713
+ });
7714
+ });
7715
+ }
7716
+ // Validar errores
7717
+ for (let i = 0; i < totalData.length; i++) {
7718
+ const element = totalData[i];
7719
+ if (!element.value && element.isRequired) {
7720
+ Swal.fire({
7721
+ title: 'Error Form Action Validate Error',
7722
+ text: `Revisar el campo: "${element.description}"`,
7723
+ icon: 'error'
7724
+ });
7725
+ break;
7726
+ }
7727
+ }
7728
+ if (action === 'create')
7729
+ this.createCOD(totalData);
7730
+ });
7703
7731
  this.subscription?.unsubscribe();
7704
7732
  }
7705
7733
  createCOD(totalData) {