iptdevs-design-system 3.1.909 → 3.1.911

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.
@@ -957,6 +957,11 @@ class UserService extends IPTGeneralService {
957
957
  this.generateRequestParams(params);
958
958
  return this.http.post(serviceUrl, this.httpOptions);
959
959
  }
960
+ getUsersFromDepartments(params) {
961
+ let serviceUrl = this.SERVICE_URL + 'get/users/from/departments';
962
+ this.generateRequestParams(params);
963
+ return this.http.post(serviceUrl, this.httpOptions);
964
+ }
960
965
  }
961
966
  UserService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: UserService, deps: [{ token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
962
967
  UserService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: UserService, providedIn: 'root' });
@@ -4629,8 +4634,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImpor
4629
4634
  type: Output
4630
4635
  }] } });
4631
4636
 
4632
- class CalculateQuotesService {
4637
+ class CalculateQuotesService$1 {
4633
4638
  constructor() {
4639
+ this.specialCourseTypes = [3, 4, 5, 6, 7, 8, 15, 21, 24, 25, 26, 30, 33]; //tecnicas
4634
4640
  this.monthsDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
4635
4641
  }
4636
4642
  calculateQuotes(params) {
@@ -4638,51 +4644,80 @@ class CalculateQuotesService {
4638
4644
  let index = 1; // Indicador de cant. de cuotas
4639
4645
  let dateJs = new Date(params.date);
4640
4646
  let isEndMonth = false;
4641
- dateJs.setMilliseconds(dateJs.getMilliseconds() + (1000 * 3600 * 24));
4642
- isEndMonth = this.monthsDays[dateJs.getMonth()] === dateJs.getDate();
4643
- if (dateJs.getDay() === 0) {
4644
- Swal.fire({
4645
- title: 'Fecha inválida',
4646
- text: 'Debe seleccionar un día de la semana diferente al domingo',
4647
- icon: 'error'
4648
- });
4647
+ const isSpecialCourseType = this.specialCourseTypes.includes(Number(params.courseType));
4648
+ if (!isSpecialCourseType) {
4649
+ // Non-special case: add one day and check for Sunday
4650
+ dateJs.setMilliseconds(dateJs.getMilliseconds() + (1000 * 3600 * 24));
4651
+ isEndMonth = this.monthsDays[dateJs.getMonth()] === dateJs.getDate();
4652
+ if (dateJs.getDay() === 0) {
4653
+ Swal.fire({
4654
+ title: 'Fecha inválida',
4655
+ text: 'Debe seleccionar un día de la semana diferente al domingo',
4656
+ icon: 'error'
4657
+ });
4658
+ return [];
4659
+ }
4649
4660
  }
4650
- else {
4651
- let enrollment = [
4652
- index,
4653
- Intl.NumberFormat('en-US', {
4654
- style: 'currency',
4655
- currency: 'USD',
4656
- minimumFractionDigits: 0
4657
- }).format(Math.round(parseFloat(params.totalPrice.toString()))),
4658
- this.getStringDate(dateJs)
4659
- ];
4660
- let quota = [
4661
+ // Enrollment
4662
+ let enrollment = [
4663
+ index,
4664
+ Intl.NumberFormat('en-US', {
4665
+ style: 'currency',
4666
+ currency: 'USD',
4667
+ minimumFractionDigits: 0
4668
+ }).format(Math.round(parseFloat(params.totalPrice.toString()))),
4669
+ this.getStringDate(dateJs)
4670
+ ];
4671
+ // First quota
4672
+ let firstQuotaDate = isSpecialCourseType ? new Date(params.date) : dateJs;
4673
+ if (isSpecialCourseType) {
4674
+ firstQuotaDate.setMonth(firstQuotaDate.getMonth() + 1);
4675
+ // Adjust if day exceeds max days in month
4676
+ const maxDays = this.monthsDays[firstQuotaDate.getMonth()];
4677
+ if (firstQuotaDate.getDate() > maxDays) {
4678
+ firstQuotaDate.setDate(maxDays);
4679
+ }
4680
+ }
4681
+ let quota = [
4682
+ index,
4683
+ Intl.NumberFormat('en-US', {
4684
+ style: 'currency',
4685
+ currency: 'USD',
4686
+ minimumFractionDigits: 0
4687
+ }).format(Math.round(parseFloat(params.quotaValues.toString()))),
4688
+ this.getStringDate(firstQuotaDate)
4689
+ ];
4690
+ dataFinancing.push(enrollment);
4691
+ dataFinancing.push(quota);
4692
+ while (index < params.quotaTimes) {
4693
+ index = index + 1;
4694
+ let newJsDate;
4695
+ if (isSpecialCourseType) {
4696
+ // Special case: add (index) months from params.date
4697
+ newJsDate = new Date(params.date);
4698
+ newJsDate.setMonth(newJsDate.getMonth() + index);
4699
+ // Adjust if day exceeds max days in month
4700
+ const maxDays = this.monthsDays[newJsDate.getMonth()];
4701
+ if (newJsDate.getDate() > maxDays) {
4702
+ newJsDate.setDate(maxDays);
4703
+ }
4704
+ }
4705
+ else {
4706
+ // Non-special case: use existing logic
4707
+ const nextDates = this.setPlusOneMonth(dateJs, isEndMonth);
4708
+ newJsDate = nextDates[nextDates.length - 1];
4709
+ dateJs = nextDates[0];
4710
+ }
4711
+ let row = [
4661
4712
  index,
4662
4713
  Intl.NumberFormat('en-US', {
4663
4714
  style: 'currency',
4664
4715
  currency: 'USD',
4665
4716
  minimumFractionDigits: 0
4666
4717
  }).format(Math.round(parseFloat(params.quotaValues.toString()))),
4667
- this.getStringDate(dateJs)
4718
+ this.getStringDate(newJsDate)
4668
4719
  ];
4669
- dataFinancing.push(enrollment);
4670
- dataFinancing.push(quota);
4671
- while (index < params.quotaTimes) {
4672
- index = index + 1;
4673
- let newJsDate = this.setPlusOneMonth(dateJs, isEndMonth);
4674
- let row = [
4675
- index,
4676
- Intl.NumberFormat('en-US', {
4677
- style: 'currency',
4678
- currency: 'USD',
4679
- minimumFractionDigits: 0
4680
- }).format(Math.round(parseFloat(params.quotaValues.toString()))),
4681
- this.getStringDate(newJsDate[newJsDate.length - 1])
4682
- ];
4683
- dataFinancing.push(row);
4684
- dateJs = newJsDate[0];
4685
- }
4720
+ dataFinancing.push(row);
4686
4721
  }
4687
4722
  return dataFinancing;
4688
4723
  }
@@ -4693,32 +4728,22 @@ class CalculateQuotesService {
4693
4728
  let plusMonthDate = new Date(originDate.getFullYear(), originDate.getMonth() + 1, day);
4694
4729
  response.push(new Date(originDate.getFullYear(), originDate.getMonth() + 1, day));
4695
4730
  while (plusMonthDate.getDay() === 0) {
4696
- plusMonthDate.setMilliseconds(originDate.getMilliseconds() - oneDayMilis);
4731
+ plusMonthDate.setMilliseconds(plusMonthDate.getMilliseconds() - oneDayMilis);
4697
4732
  }
4698
4733
  response.push(plusMonthDate);
4699
4734
  return response;
4700
4735
  }
4701
- // setPlusOneMonth2(originDate: Date, isEndMonth: boolean): Date[] {
4702
- // let response: Date[] = [];
4703
- // let oneDayMilis = 1000 * 3600 * 24;
4704
- // let day = isEndMonth ? this.monthsDays[(originDate.getMonth() + 1) % 12] : originDate.getDate();
4705
- // let plusMonthDate: Date = new Date(originDate.getFullYear(), originDate.getMonth() + 1, day);
4706
- // while (plusMonthDate.getDay() === 0) {
4707
- // plusMonthDate.setMilliseconds(plusMonthDate.getMilliseconds() - oneDayMilis);
4708
- // }
4709
- // response.push(plusMonthDate);
4710
- // response.push(new Date(originDate.getFullYear(), originDate.getMonth() + 1, day + 1));
4711
- // return response;
4712
- // }
4713
4736
  getStringDate(originDate) {
4714
4737
  let month = originDate.getMonth() + 1;
4715
- let stringMonth = month < 10 ? '0' + month : month;
4716
- return originDate.getFullYear() + '-' + stringMonth + '-' + originDate.getDate();
4738
+ let stringMonth = month < 10 ? '0' + month : month.toString();
4739
+ let day = originDate.getDate();
4740
+ let stringDay = day < 10 ? '0' + day : day.toString();
4741
+ return originDate.getFullYear() + '-' + stringMonth + '-' + stringDay;
4717
4742
  }
4718
4743
  }
4719
- CalculateQuotesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: CalculateQuotesService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4720
- CalculateQuotesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: CalculateQuotesService, providedIn: 'root' });
4721
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: CalculateQuotesService, decorators: [{
4744
+ CalculateQuotesService$1.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: CalculateQuotesService$1, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4745
+ CalculateQuotesService$1.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: CalculateQuotesService$1, providedIn: 'root' });
4746
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: CalculateQuotesService$1, decorators: [{
4722
4747
  type: Injectable,
4723
4748
  args: [{
4724
4749
  providedIn: 'root'
@@ -4980,8 +5005,12 @@ class CodFormStepFourComponent extends CodFormSteps {
4980
5005
  quotaValues: Number(this.codFormStepFour.controls['quota_price'].value),
4981
5006
  quotaTimes: Number(this.codFormStepFour.controls['fee_number'].value),
4982
5007
  totalPrice: this.codFormStepFour.controls['total_price'].value,
5008
+ courseType: Number(this.localStorageCOD.getCodFormData(1, 'course_type')),
5009
+ englishLevel: Number(this.localStorageCOD.getCodFormData(1, 'english_level')),
4983
5010
  };
5011
+ console.log("params", params);
4984
5012
  this.dataFinancing = this.calculateQuotesService.calculateQuotes(params);
5013
+ console.log("dataFinancing", this.dataFinancing);
4985
5014
  this.isFinancing = true;
4986
5015
  this.financingData.emit(this.dataFinancing);
4987
5016
  }
@@ -5125,12 +5154,12 @@ class CodFormStepFourComponent extends CodFormSteps {
5125
5154
  // this.codFormStepFour.controls['quota_times'].setValue(this.initialData.cod_payment.lenght == 1 ? 1 : this.initialData.cod_price.fee_number);
5126
5155
  }
5127
5156
  }
5128
- CodFormStepFourComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: CodFormStepFourComponent, deps: [{ token: i1$1.FormBuilder }, { token: CalculateQuotesService }, { token: CodFormControls }, { token: CommercialService }, { token: BaseService }], target: i0.ɵɵFactoryTarget.Component });
5157
+ CodFormStepFourComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: CodFormStepFourComponent, deps: [{ token: i1$1.FormBuilder }, { token: CalculateQuotesService$1 }, { token: CodFormControls }, { token: CommercialService }, { token: BaseService }], target: i0.ɵɵFactoryTarget.Component });
5129
5158
  CodFormStepFourComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.7", type: CodFormStepFourComponent, selector: "app-cod-form-step-four", inputs: { isEditCod: "isEditCod", initialData: "initialData", isRenovation: "isRenovation" }, outputs: { changeStepEvent: "changeStepEvent", financingData: "financingData" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<div *ngIf=\"isSemestral\" class=\"m-1 p-2 border-round-lg bg-blue-500 text-white\">\n <strong>Nota: </strong>\n El tipo de curso seleccionado fue semestral, por lo tanto el estudiante debe pagar matr\u00EDcula y primera cuota (M&M)\n</div>\n\n<form autocomplete=\"off\" [formGroup]=\"codFormStepFour\" class=\"grid mt-2\">\n\n <div class=\"col-12\">\n <ipt-select\n [initialValue]=\"codFormStepFour.controls['payment_method'].value\"\n [control]=\"codFormStepFour.controls['payment_method']\"\n (eventSelect)=\"selectPaymentMethod($event)\"\n [data]=\"paymentMethods\"\n [defaultText]=\"'M\u00E9todo de pago'\"\n [disabledSel]=\"isDisabledSel\"\n ></ipt-select>\n <ipt-loader *ngIf=\"feeResponse\"></ipt-loader>\n\n <div class=\"col-12\" *ngIf=\"thereArePlans\">\n <p-table\n [value]=\"dataPrices\"\n [tableStyle]=\"{'min-width': '100%'}\"\n [rowHover]=\"true\"\n >\n <ng-template pTemplate=\"caption\">\n <div class=\"flex align-items-center\">\n Seleccion de niveles a cancelar.\n </div>\n </ng-template>\n <ng-template pTemplate=\"header\">\n <tr>\n <th class=\"bg-blue-200 text-center font-medium pt-2 pb-2\">Cancelar</th>\n <th class=\"bg-blue-200 text-center font-medium pt-2 pb-2\">Cuotas</th>\n <th class=\"bg-blue-200 text-center font-medium pt-2 pb-2\">Admin</th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-data>\n <tr>\n <td class=\"text-center\">{{ data.paid_level }} Nivel(es)</td>\n <td class=\"text-center\">{{ data.fee_number }}</td>\n <td class=\"pt-2 pb-2 text-center\">\n <button\n pButton\n pRipple\n icon=\"pi pi-money-bill\"\n class=\"p-button-sm p-button-rounded\"\n (click)=\"selectLevels(data)\"\n\n ></button>\n </td>\n </tr>\n </ng-template>\n </p-table>\n </div>\n\n <!-- [initialValue]=\"codFormStepFour.controls['quota_times'].value\" -->\n <!-- <ipt-select *ngIf=\"isFinanced();\"\n [initialValue]=\"'1'\"\n [control]=\"codFormStepFour.controls['quota_times']\"\n (eventSelect)=\"selectQuotas($event)\"\n [defaultText]=\"'N\u00FAmero de cuotas'\"\n [data]=\"codPrices\"\n ></ipt-select> -->\n </div>\n\n <div class=\"col-12\">\n <ipt-input\n [inputType]=\"'text'\"\n [placeHolder]=\"'Monto total de la matr\u00EDcula'\"\n [control]=\"codFormStepFour.controls['total_price']\"\n [withPipe]=\"true\"\n ></ipt-input>\n </div>\n\n <div class=\"col-12\">\n <ipt-input\n [withPipe]=\"true\"\n [inputType]=\"'text'\"\n [control]=\"codFormStepFour.controls['program_price']\"\n [placeHolder]=\"'Valor total del programa'\"\n ></ipt-input>\n </div>\n\n <div class=\"col-12\">\n <ipt-input\n onfocus=\"(this.type='date')\"\n [inputType]=\"'date'\"\n [control]=\"codFormStepFour.controls['payment_date']\"\n [placeHolder]=\"'Fecha de pago'\"\n ></ipt-input>\n </div>\n\n <!-- Tabla de financiaci\u00F3n -->\n <div *ngIf=\"isFinancing && isRenovation === false\" class=\"container_tablet\">\n <div class=\"col-12\" *ngIf=\"isFinancing\">\n <p-table\n [value]=\"dataFinancing\"\n [tableStyle]=\"{'min-width': '100%'}\"\n [rowHover]=\"true\"\n >\n <ng-template pTemplate=\"caption\">\n <div class=\"flex align-items-center\">\n C\u00E1lculo de cuotas\n <button pButton class=\"p-button-sm ml-auto\" label=\"Nuevo c\u00E1lculo\" (click)=\"calculateNewQuotes()\" [disabled]=\"isDisabledSel\" lab icon=\"pi pi-replay\"></button>\n </div>\n </ng-template>\n <ng-template pTemplate=\"header\">\n <tr>\n <th>#</th>\n <th>Valor</th>\n <th>Fecha</th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-data>\n <tr>\n <td>{{ data[0] }}</td>\n <td>{{ data[1] }}</td>\n <td>{{ data[2] }}</td>\n </tr>\n </ng-template>\n </p-table>\n </div>\n </div>\n <!-- ---------------------- -->\n\n</form>\n\n<div class=\"flex mt-3 align-items-center gap-3\">\n <span *ngIf=\"codFormStepFour.invalid && codFormStepFour.touched\" class=\"text-red-500 font-bold text-center mt-1 py-2 bg-red-100 w-full border-round-xl\">{{ errorMessage }}</span>\n <div class=\"flex ml-auto gap-2\">\n <button *ngIf=\"codFormStepFour.controls['payment_method'].value === '1'\" [disabled]=\"isFinancing || codFormStepFour.controls['payment_method'].value !== '1'\"type=\"submit\" class=\"ml-auto p-button-sm p-button-secondary\" (click)=\"showTable()\" pButton label=\"Calcular cuotas\" icon=\"pi pi-sliders-h\"></button>\n <button [disabled]=\"!isFinancing && codFormStepFour.controls['payment_method'].value === '1'\" type=\"submit\" [class]=\"isEditCod ? 'ml-auto yellow-300 p-button-sm' : 'ml-auto p-button-sm'\" (click)=\"sendForm()\" pButton label=\"Siguiente\" icon=\"pi pi-arrow-right\"></button>\n </div>\n</div>\n", styles: [".yellow-300{background-color:var(--yellow-500)!important;color:#fff}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "component", type: InputComponent, selector: "ipt-input", inputs: ["inputType", "placeHolder", "validateText", "withPipe", "list", "iconUrl", "control", "prefix", "thousands", "decimal", "disabledSel"], outputs: ["dateSelected"] }, { kind: "component", type: LoaderComponent, selector: "ipt-loader", inputs: ["message", "isDialog"] }, { kind: "component", type: SelectComponent, selector: "ipt-select", inputs: ["isRequired", "data", "defaultText", "selectCode", "disabledSel", "initialValue", "label", "control"], outputs: ["eventSelect"] }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i11.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "groupRowsByOrder", "responsiveLayout", "breakpoint", "virtualRowHeight", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "selectAll"], outputs: ["selectAllChange", "selectionChange", "contextMenuSelectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i6$1.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }] });
5130
5159
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: CodFormStepFourComponent, decorators: [{
5131
5160
  type: Component,
5132
5161
  args: [{ selector: 'app-cod-form-step-four', template: "<div *ngIf=\"isSemestral\" class=\"m-1 p-2 border-round-lg bg-blue-500 text-white\">\n <strong>Nota: </strong>\n El tipo de curso seleccionado fue semestral, por lo tanto el estudiante debe pagar matr\u00EDcula y primera cuota (M&M)\n</div>\n\n<form autocomplete=\"off\" [formGroup]=\"codFormStepFour\" class=\"grid mt-2\">\n\n <div class=\"col-12\">\n <ipt-select\n [initialValue]=\"codFormStepFour.controls['payment_method'].value\"\n [control]=\"codFormStepFour.controls['payment_method']\"\n (eventSelect)=\"selectPaymentMethod($event)\"\n [data]=\"paymentMethods\"\n [defaultText]=\"'M\u00E9todo de pago'\"\n [disabledSel]=\"isDisabledSel\"\n ></ipt-select>\n <ipt-loader *ngIf=\"feeResponse\"></ipt-loader>\n\n <div class=\"col-12\" *ngIf=\"thereArePlans\">\n <p-table\n [value]=\"dataPrices\"\n [tableStyle]=\"{'min-width': '100%'}\"\n [rowHover]=\"true\"\n >\n <ng-template pTemplate=\"caption\">\n <div class=\"flex align-items-center\">\n Seleccion de niveles a cancelar.\n </div>\n </ng-template>\n <ng-template pTemplate=\"header\">\n <tr>\n <th class=\"bg-blue-200 text-center font-medium pt-2 pb-2\">Cancelar</th>\n <th class=\"bg-blue-200 text-center font-medium pt-2 pb-2\">Cuotas</th>\n <th class=\"bg-blue-200 text-center font-medium pt-2 pb-2\">Admin</th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-data>\n <tr>\n <td class=\"text-center\">{{ data.paid_level }} Nivel(es)</td>\n <td class=\"text-center\">{{ data.fee_number }}</td>\n <td class=\"pt-2 pb-2 text-center\">\n <button\n pButton\n pRipple\n icon=\"pi pi-money-bill\"\n class=\"p-button-sm p-button-rounded\"\n (click)=\"selectLevels(data)\"\n\n ></button>\n </td>\n </tr>\n </ng-template>\n </p-table>\n </div>\n\n <!-- [initialValue]=\"codFormStepFour.controls['quota_times'].value\" -->\n <!-- <ipt-select *ngIf=\"isFinanced();\"\n [initialValue]=\"'1'\"\n [control]=\"codFormStepFour.controls['quota_times']\"\n (eventSelect)=\"selectQuotas($event)\"\n [defaultText]=\"'N\u00FAmero de cuotas'\"\n [data]=\"codPrices\"\n ></ipt-select> -->\n </div>\n\n <div class=\"col-12\">\n <ipt-input\n [inputType]=\"'text'\"\n [placeHolder]=\"'Monto total de la matr\u00EDcula'\"\n [control]=\"codFormStepFour.controls['total_price']\"\n [withPipe]=\"true\"\n ></ipt-input>\n </div>\n\n <div class=\"col-12\">\n <ipt-input\n [withPipe]=\"true\"\n [inputType]=\"'text'\"\n [control]=\"codFormStepFour.controls['program_price']\"\n [placeHolder]=\"'Valor total del programa'\"\n ></ipt-input>\n </div>\n\n <div class=\"col-12\">\n <ipt-input\n onfocus=\"(this.type='date')\"\n [inputType]=\"'date'\"\n [control]=\"codFormStepFour.controls['payment_date']\"\n [placeHolder]=\"'Fecha de pago'\"\n ></ipt-input>\n </div>\n\n <!-- Tabla de financiaci\u00F3n -->\n <div *ngIf=\"isFinancing && isRenovation === false\" class=\"container_tablet\">\n <div class=\"col-12\" *ngIf=\"isFinancing\">\n <p-table\n [value]=\"dataFinancing\"\n [tableStyle]=\"{'min-width': '100%'}\"\n [rowHover]=\"true\"\n >\n <ng-template pTemplate=\"caption\">\n <div class=\"flex align-items-center\">\n C\u00E1lculo de cuotas\n <button pButton class=\"p-button-sm ml-auto\" label=\"Nuevo c\u00E1lculo\" (click)=\"calculateNewQuotes()\" [disabled]=\"isDisabledSel\" lab icon=\"pi pi-replay\"></button>\n </div>\n </ng-template>\n <ng-template pTemplate=\"header\">\n <tr>\n <th>#</th>\n <th>Valor</th>\n <th>Fecha</th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-data>\n <tr>\n <td>{{ data[0] }}</td>\n <td>{{ data[1] }}</td>\n <td>{{ data[2] }}</td>\n </tr>\n </ng-template>\n </p-table>\n </div>\n </div>\n <!-- ---------------------- -->\n\n</form>\n\n<div class=\"flex mt-3 align-items-center gap-3\">\n <span *ngIf=\"codFormStepFour.invalid && codFormStepFour.touched\" class=\"text-red-500 font-bold text-center mt-1 py-2 bg-red-100 w-full border-round-xl\">{{ errorMessage }}</span>\n <div class=\"flex ml-auto gap-2\">\n <button *ngIf=\"codFormStepFour.controls['payment_method'].value === '1'\" [disabled]=\"isFinancing || codFormStepFour.controls['payment_method'].value !== '1'\"type=\"submit\" class=\"ml-auto p-button-sm p-button-secondary\" (click)=\"showTable()\" pButton label=\"Calcular cuotas\" icon=\"pi pi-sliders-h\"></button>\n <button [disabled]=\"!isFinancing && codFormStepFour.controls['payment_method'].value === '1'\" type=\"submit\" [class]=\"isEditCod ? 'ml-auto yellow-300 p-button-sm' : 'ml-auto p-button-sm'\" (click)=\"sendForm()\" pButton label=\"Siguiente\" icon=\"pi pi-arrow-right\"></button>\n </div>\n</div>\n", styles: [".yellow-300{background-color:var(--yellow-500)!important;color:#fff}\n"] }]
5133
- }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: CalculateQuotesService }, { type: CodFormControls }, { type: CommercialService }, { type: BaseService }]; }, propDecorators: { isEditCod: [{
5162
+ }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: CalculateQuotesService$1 }, { type: CodFormControls }, { type: CommercialService }, { type: BaseService }]; }, propDecorators: { isEditCod: [{
5134
5163
  type: Input
5135
5164
  }], initialData: [{
5136
5165
  type: Input
@@ -7807,6 +7836,102 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImpor
7807
7836
  type: Input
7808
7837
  }] } });
7809
7838
 
7839
+ class CalculateQuotesService {
7840
+ constructor() {
7841
+ this.monthsDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
7842
+ }
7843
+ calculateQuotes(params) {
7844
+ let dataFinancing = [];
7845
+ let index = 1; // Indicador de cant. de cuotas
7846
+ let dateJs = new Date(params.date);
7847
+ let isEndMonth = false;
7848
+ dateJs.setMilliseconds(dateJs.getMilliseconds() + (1000 * 3600 * 24));
7849
+ isEndMonth = this.monthsDays[dateJs.getMonth()] === dateJs.getDate();
7850
+ if (dateJs.getDay() === 0) {
7851
+ Swal.fire({
7852
+ title: 'Fecha inválida',
7853
+ text: 'Debe seleccionar un día de la semana diferente al domingo',
7854
+ icon: 'error'
7855
+ });
7856
+ }
7857
+ else {
7858
+ let enrollment = [
7859
+ index,
7860
+ Intl.NumberFormat('en-US', {
7861
+ style: 'currency',
7862
+ currency: 'USD',
7863
+ minimumFractionDigits: 0
7864
+ }).format(Math.round(parseFloat(params.totalPrice.toString()))),
7865
+ this.getStringDate(dateJs)
7866
+ ];
7867
+ let quota = [
7868
+ index,
7869
+ Intl.NumberFormat('en-US', {
7870
+ style: 'currency',
7871
+ currency: 'USD',
7872
+ minimumFractionDigits: 0
7873
+ }).format(Math.round(parseFloat(params.quotaValues.toString()))),
7874
+ this.getStringDate(dateJs)
7875
+ ];
7876
+ dataFinancing.push(enrollment);
7877
+ dataFinancing.push(quota);
7878
+ while (index < params.quotaTimes) {
7879
+ index = index + 1;
7880
+ let newJsDate = this.setPlusOneMonth(dateJs, isEndMonth);
7881
+ let row = [
7882
+ index,
7883
+ Intl.NumberFormat('en-US', {
7884
+ style: 'currency',
7885
+ currency: 'USD',
7886
+ minimumFractionDigits: 0
7887
+ }).format(Math.round(parseFloat(params.quotaValues.toString()))),
7888
+ this.getStringDate(newJsDate[newJsDate.length - 1])
7889
+ ];
7890
+ dataFinancing.push(row);
7891
+ dateJs = newJsDate[0];
7892
+ }
7893
+ }
7894
+ return dataFinancing;
7895
+ }
7896
+ setPlusOneMonth(originDate, isEndMonth) {
7897
+ let response = [];
7898
+ let oneDayMilis = 1000 * 3600 * 24;
7899
+ let day = isEndMonth ? this.monthsDays[(originDate.getMonth() + 1) % 12] : originDate.getDate();
7900
+ let plusMonthDate = new Date(originDate.getFullYear(), originDate.getMonth() + 1, day);
7901
+ response.push(new Date(originDate.getFullYear(), originDate.getMonth() + 1, day));
7902
+ while (plusMonthDate.getDay() === 0) {
7903
+ plusMonthDate.setMilliseconds(originDate.getMilliseconds() - oneDayMilis);
7904
+ }
7905
+ response.push(plusMonthDate);
7906
+ return response;
7907
+ }
7908
+ // setPlusOneMonth2(originDate: Date, isEndMonth: boolean): Date[] {
7909
+ // let response: Date[] = [];
7910
+ // let oneDayMilis = 1000 * 3600 * 24;
7911
+ // let day = isEndMonth ? this.monthsDays[(originDate.getMonth() + 1) % 12] : originDate.getDate();
7912
+ // let plusMonthDate: Date = new Date(originDate.getFullYear(), originDate.getMonth() + 1, day);
7913
+ // while (plusMonthDate.getDay() === 0) {
7914
+ // plusMonthDate.setMilliseconds(plusMonthDate.getMilliseconds() - oneDayMilis);
7915
+ // }
7916
+ // response.push(plusMonthDate);
7917
+ // response.push(new Date(originDate.getFullYear(), originDate.getMonth() + 1, day + 1));
7918
+ // return response;
7919
+ // }
7920
+ getStringDate(originDate) {
7921
+ let month = originDate.getMonth() + 1;
7922
+ let stringMonth = month < 10 ? '0' + month : month;
7923
+ return originDate.getFullYear() + '-' + stringMonth + '-' + originDate.getDate();
7924
+ }
7925
+ }
7926
+ CalculateQuotesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: CalculateQuotesService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
7927
+ CalculateQuotesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: CalculateQuotesService, providedIn: 'root' });
7928
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: CalculateQuotesService, decorators: [{
7929
+ type: Injectable,
7930
+ args: [{
7931
+ providedIn: 'root'
7932
+ }]
7933
+ }], ctorParameters: function () { return []; } });
7934
+
7810
7935
  class CodSelfFormStepThreeComponent extends CodSelfManagedSteps {
7811
7936
  constructor(fb, messageService, commercialService, baseService, codFormControls, calculateQuotesService) {
7812
7937
  super();
@@ -8802,5 +8927,5 @@ class AnnouncementUserRs {
8802
8927
  * Generated bundle index. Do not edit.
8803
8928
  */
8804
8929
 
8805
- export { AcademicService, ActivityService, AnnouncementService, AnnouncementUserRs, AsideButtonComponent, AttendanceService, BaseService, BudgetService, ButtonComponent, CalculateQuotesService, CalendarService, CardCourseComponent, CardSelectCourseComponent, CertificateService, CheckboxComponent, ClassroomService, CodDocumentsSectionComponent, CodFormComponent, CodFormControls, CodFormStepFiveComponent, CodFormStepFourComponent, CodFormStepOneComponent, CodFormStepThreeComponent, CodFormStepTwoComponent, CodFormSteps, CodModule, CodSelfFormStepFourComponent, CodSelfFormStepOneComponent, CodSelfFormStepThreeComponent, CodSelfFormStepTwoComponent, CodSelfManagedComponent, CodSelfManagedControls, CodSelfManagedSteps, CommercialService, CommunicatorService, ComponentsModule, CopiesService, CoreModule, CourseService, CreateUserFormComponent, DatalistComponent, DesignSystemModule, EpaycoService, IUnitNameClubRs, IUserEktRs, IUserFullDataRs, InputComponent, LevelButtonComponent, LevelTextComponent, LoaderComponent, LocalStorageCODService, LocalStorageCodSelfMaganedService, LoginFormComponent, MarketingService, NotesService, ParameterService, PlacementService, QuestionTypeComponent, RadioComponent, RedirectGuard, ScheduleFormatPipe, ScheduleTimeFormatPipe, SelectComponent, Session, SidenavComponent, StorageService, StudentService, SwitchService, TestService, TextLinkComponent, TypeLevelPipe, UserEktService, UserLoginRs, UserRs, UserService, codSelfManagedModule, validateCoupunts };
8930
+ export { AcademicService, ActivityService, AnnouncementService, AnnouncementUserRs, AsideButtonComponent, AttendanceService, BaseService, BudgetService, ButtonComponent, CalculateQuotesService$1 as CalculateQuotesService, CalendarService, CardCourseComponent, CardSelectCourseComponent, CertificateService, CheckboxComponent, ClassroomService, CodDocumentsSectionComponent, CodFormComponent, CodFormControls, CodFormStepFiveComponent, CodFormStepFourComponent, CodFormStepOneComponent, CodFormStepThreeComponent, CodFormStepTwoComponent, CodFormSteps, CodModule, CodSelfFormStepFourComponent, CodSelfFormStepOneComponent, CodSelfFormStepThreeComponent, CodSelfFormStepTwoComponent, CodSelfManagedComponent, CodSelfManagedControls, CodSelfManagedSteps, CommercialService, CommunicatorService, ComponentsModule, CopiesService, CoreModule, CourseService, CreateUserFormComponent, DatalistComponent, DesignSystemModule, EpaycoService, IUnitNameClubRs, IUserEktRs, IUserFullDataRs, InputComponent, LevelButtonComponent, LevelTextComponent, LoaderComponent, LocalStorageCODService, LocalStorageCodSelfMaganedService, LoginFormComponent, MarketingService, NotesService, ParameterService, PlacementService, QuestionTypeComponent, RadioComponent, RedirectGuard, ScheduleFormatPipe, ScheduleTimeFormatPipe, SelectComponent, Session, SidenavComponent, StorageService, StudentService, SwitchService, TestService, TextLinkComponent, TypeLevelPipe, UserEktService, UserLoginRs, UserRs, UserService, codSelfManagedModule, validateCoupunts };
8806
8931
  //# sourceMappingURL=iptdevs-design-system.mjs.map