iptdevs-design-system 2.7.134 → 2.7.135

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.
@@ -2410,6 +2410,11 @@ class CommercialService extends IPTGeneralService {
2410
2410
  this.generateRequestParams(params);
2411
2411
  return this.http.post(serviceUrl, this.httpOptions);
2412
2412
  }
2413
+ getCodPricesByAgreementTypePayment(params) {
2414
+ let serviceUrl = this.SERVICE_URL + 'post/cod/prices/by/agreement/and/type/payment';
2415
+ this.generateRequestParams(params);
2416
+ return this.http.post(serviceUrl, this.httpOptions);
2417
+ }
2413
2418
  }
2414
2419
  CommercialService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: CommercialService, deps: [{ token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
2415
2420
  CommercialService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: CommercialService, providedIn: 'root' });
@@ -2853,6 +2858,9 @@ class CodFormStepOneComponent extends CodFormSteps {
2853
2858
  selectAcademicPlan(academic_plan) {
2854
2859
  if (academic_plan !== 'Plan') {
2855
2860
  this.codFormStepOne.controls['academic_plan'].setValue(academic_plan);
2861
+ this.codFormStepOne.controls['agreement_by_category'].setValue(null);
2862
+ this.codFormStepOne.controls['school_name'].setValue(null);
2863
+ this.codFormStepOne.controls['course_type'].setValue(null);
2856
2864
  this.getCourseType(academic_plan);
2857
2865
  this.getAgreementByPlan(academic_plan);
2858
2866
  }
@@ -3572,30 +3580,43 @@ class CodFormStepFourComponent extends CodFormSteps {
3572
3580
  else {
3573
3581
  agreementSelected = this.localStorageCOD.getCodFormData(1, 'agreement_by_category');
3574
3582
  }
3575
- this.commercialService.getCodPricesByAgreement(Number(agreementSelected)).subscribe({
3576
- next: (response) => {
3577
- if (response.data) {
3578
- const codPrices = response.data;
3579
- this.codPrices = codPrices;
3580
- if (this.codFormStepFour.controls['payment_method'].value === '1') {
3581
- const aux = this.codPrices.filter(codPrice => codPrice.agreement === Number(agreementSelected))[0];
3582
- // const aux = this.codPrices.filter(codPrice => codPrice.fee_number > 1)[0];
3583
- this.codFormStepFour.controls['quota_times'].setValue(aux.code);
3584
- this.codFormStepFour.controls['program_price'].setValue(aux.normal_price);
3585
- }
3586
- else {
3587
- if (this.codFormStepFour.controls['payment_method'].value === '2') {
3588
- // const aux = this.codPrices.filter(codPrice => codPrice.agreement === Number(agreementSelected))[0];
3589
- const aux = this.codPrices.filter(codPrice => codPrice.fee_number === 1)[0];
3590
- this.codFormStepFour.controls['quota_times'].setValue(aux.code);
3591
- this.codFormStepFour.controls['program_price'].setValue(aux.normal_price);
3592
- this.codFormStepFour.controls['total_price'].setValue(aux.enrollment);
3593
- }
3594
- }
3595
- }
3596
- },
3597
- error: (err) => console.log(err)
3598
- });
3583
+ if (this.codFormStepFour.controls['payment_method'].value === '1') {
3584
+ this.searchPriceByTypePayment(agreementSelected, 'cuotas');
3585
+ const aux = this.codPrices.filter(codPrice => codPrice.agreement === Number(agreementSelected))[0];
3586
+ this.codFormStepFour.controls['quota_times'].setValue(aux.code);
3587
+ this.codFormStepFour.controls['program_price'].setValue(aux.normal_price);
3588
+ }
3589
+ else {
3590
+ if (this.codFormStepFour.controls['payment_method'].value === '2') {
3591
+ this.searchPriceByTypePayment(agreementSelected, 'contado');
3592
+ const aux = this.codPrices.filter(codPrice => codPrice.fee_number === 1)[0];
3593
+ this.codFormStepFour.controls['quota_times'].setValue(aux.code);
3594
+ this.codFormStepFour.controls['program_price'].setValue(aux.normal_price);
3595
+ this.codFormStepFour.controls['total_price'].setValue(aux.enrollment);
3596
+ }
3597
+ }
3598
+ // this.commercialService.getCodPricesByAgreement(Number(agreementSelected)).subscribe({
3599
+ // next: (response: any) => {
3600
+ // if (response.data) {
3601
+ // const codPrices: CodPrices[] = response.data;
3602
+ // this.codPrices = codPrices;
3603
+ // if (this.codFormStepFour.controls['payment_method'].value === '1') {
3604
+ // const aux = this.codPrices.filter(codPrice => codPrice.agreement === Number(agreementSelected))[0];
3605
+ // this.codFormStepFour.controls['quota_times'].setValue(aux.code)
3606
+ // this.codFormStepFour.controls['program_price'].setValue(aux.normal_price)
3607
+ // }else {
3608
+ // if (this.codFormStepFour.controls['payment_method'].value === '2') {
3609
+ // // const aux = this.codPrices.filter(codPrice => codPrice.agreement === Number(agreementSelected))[0];
3610
+ // const aux = this.codPrices.filter(codPrice => codPrice.fee_number === 1)[0];
3611
+ // this.codFormStepFour.controls['quota_times'].setValue(aux.code);
3612
+ // this.codFormStepFour.controls['program_price'].setValue(aux.normal_price)
3613
+ // this.codFormStepFour.controls['total_price'].setValue(aux.enrollment);
3614
+ // }
3615
+ // }
3616
+ // }
3617
+ // },
3618
+ // error: (err) => console.log(err)
3619
+ // })
3599
3620
  }
3600
3621
  validateErrors() {
3601
3622
  this.codFormStepFour.valueChanges.subscribe(changes => {
@@ -3610,6 +3631,15 @@ class CodFormStepFourComponent extends CodFormSteps {
3610
3631
  }
3611
3632
  });
3612
3633
  }
3634
+ searchPriceByTypePayment(agreementSelected, type) {
3635
+ let request = {
3636
+ agreement: Number(agreementSelected),
3637
+ payment_method: 'contad'
3638
+ };
3639
+ this.commercialService.getCodPricesByAgreementTypePayment(request).subscribe((response) => {
3640
+ this.codPrices = response.data;
3641
+ });
3642
+ }
3613
3643
  initForm() {
3614
3644
  this.codFormStepFour = this.fb.group({
3615
3645
  program_price: [{ value: '', disabled: true }, [Validators.required]],
@@ -3727,7 +3757,6 @@ class CodFormStepFourComponent extends CodFormSteps {
3727
3757
  console.log(quotas);
3728
3758
  if (quotas !== 'Número de cuotas') {
3729
3759
  const codPrice = this.codPrices.filter(codPrice => codPrice.code === Number(quotas));
3730
- console.log(codPrice[0].code);
3731
3760
  this.codFormStepFour.controls['quota_times'].setValue(codPrice[0].code);
3732
3761
  this.codFormStepFour.controls['total_price'].setValue(codPrice[0].enrollment);
3733
3762
  this.codFormStepFour.controls['program_price'].setValue(codPrice[0].financed_price);