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' });
@@ -4611,8 +4616,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImpor
4611
4616
  type: Output
4612
4617
  }] } });
4613
4618
 
4614
- class CalculateQuotesService {
4619
+ class CalculateQuotesService$1 {
4615
4620
  constructor() {
4621
+ this.specialCourseTypes = [3, 4, 5, 6, 7, 8, 15, 21, 24, 25, 26, 30, 33]; //tecnicas
4616
4622
  this.monthsDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
4617
4623
  }
4618
4624
  calculateQuotes(params) {
@@ -4620,51 +4626,80 @@ class CalculateQuotesService {
4620
4626
  let index = 1; // Indicador de cant. de cuotas
4621
4627
  let dateJs = new Date(params.date);
4622
4628
  let isEndMonth = false;
4623
- dateJs.setMilliseconds(dateJs.getMilliseconds() + (1000 * 3600 * 24));
4624
- isEndMonth = this.monthsDays[dateJs.getMonth()] === dateJs.getDate();
4625
- if (dateJs.getDay() === 0) {
4626
- Swal.fire({
4627
- title: 'Fecha inválida',
4628
- text: 'Debe seleccionar un día de la semana diferente al domingo',
4629
- icon: 'error'
4630
- });
4629
+ const isSpecialCourseType = this.specialCourseTypes.includes(Number(params.courseType));
4630
+ if (!isSpecialCourseType) {
4631
+ // Non-special case: add one day and check for Sunday
4632
+ dateJs.setMilliseconds(dateJs.getMilliseconds() + (1000 * 3600 * 24));
4633
+ isEndMonth = this.monthsDays[dateJs.getMonth()] === dateJs.getDate();
4634
+ if (dateJs.getDay() === 0) {
4635
+ Swal.fire({
4636
+ title: 'Fecha inválida',
4637
+ text: 'Debe seleccionar un día de la semana diferente al domingo',
4638
+ icon: 'error'
4639
+ });
4640
+ return [];
4641
+ }
4631
4642
  }
4632
- else {
4633
- let enrollment = [
4634
- index,
4635
- Intl.NumberFormat('en-US', {
4636
- style: 'currency',
4637
- currency: 'USD',
4638
- minimumFractionDigits: 0
4639
- }).format(Math.round(parseFloat(params.totalPrice.toString()))),
4640
- this.getStringDate(dateJs)
4641
- ];
4642
- let quota = [
4643
+ // Enrollment
4644
+ let enrollment = [
4645
+ index,
4646
+ Intl.NumberFormat('en-US', {
4647
+ style: 'currency',
4648
+ currency: 'USD',
4649
+ minimumFractionDigits: 0
4650
+ }).format(Math.round(parseFloat(params.totalPrice.toString()))),
4651
+ this.getStringDate(dateJs)
4652
+ ];
4653
+ // First quota
4654
+ let firstQuotaDate = isSpecialCourseType ? new Date(params.date) : dateJs;
4655
+ if (isSpecialCourseType) {
4656
+ firstQuotaDate.setMonth(firstQuotaDate.getMonth() + 1);
4657
+ // Adjust if day exceeds max days in month
4658
+ const maxDays = this.monthsDays[firstQuotaDate.getMonth()];
4659
+ if (firstQuotaDate.getDate() > maxDays) {
4660
+ firstQuotaDate.setDate(maxDays);
4661
+ }
4662
+ }
4663
+ let quota = [
4664
+ index,
4665
+ Intl.NumberFormat('en-US', {
4666
+ style: 'currency',
4667
+ currency: 'USD',
4668
+ minimumFractionDigits: 0
4669
+ }).format(Math.round(parseFloat(params.quotaValues.toString()))),
4670
+ this.getStringDate(firstQuotaDate)
4671
+ ];
4672
+ dataFinancing.push(enrollment);
4673
+ dataFinancing.push(quota);
4674
+ while (index < params.quotaTimes) {
4675
+ index = index + 1;
4676
+ let newJsDate;
4677
+ if (isSpecialCourseType) {
4678
+ // Special case: add (index) months from params.date
4679
+ newJsDate = new Date(params.date);
4680
+ newJsDate.setMonth(newJsDate.getMonth() + index);
4681
+ // Adjust if day exceeds max days in month
4682
+ const maxDays = this.monthsDays[newJsDate.getMonth()];
4683
+ if (newJsDate.getDate() > maxDays) {
4684
+ newJsDate.setDate(maxDays);
4685
+ }
4686
+ }
4687
+ else {
4688
+ // Non-special case: use existing logic
4689
+ const nextDates = this.setPlusOneMonth(dateJs, isEndMonth);
4690
+ newJsDate = nextDates[nextDates.length - 1];
4691
+ dateJs = nextDates[0];
4692
+ }
4693
+ let row = [
4643
4694
  index,
4644
4695
  Intl.NumberFormat('en-US', {
4645
4696
  style: 'currency',
4646
4697
  currency: 'USD',
4647
4698
  minimumFractionDigits: 0
4648
4699
  }).format(Math.round(parseFloat(params.quotaValues.toString()))),
4649
- this.getStringDate(dateJs)
4700
+ this.getStringDate(newJsDate)
4650
4701
  ];
4651
- dataFinancing.push(enrollment);
4652
- dataFinancing.push(quota);
4653
- while (index < params.quotaTimes) {
4654
- index = index + 1;
4655
- let newJsDate = this.setPlusOneMonth(dateJs, isEndMonth);
4656
- let row = [
4657
- index,
4658
- Intl.NumberFormat('en-US', {
4659
- style: 'currency',
4660
- currency: 'USD',
4661
- minimumFractionDigits: 0
4662
- }).format(Math.round(parseFloat(params.quotaValues.toString()))),
4663
- this.getStringDate(newJsDate[newJsDate.length - 1])
4664
- ];
4665
- dataFinancing.push(row);
4666
- dateJs = newJsDate[0];
4667
- }
4702
+ dataFinancing.push(row);
4668
4703
  }
4669
4704
  return dataFinancing;
4670
4705
  }
@@ -4675,32 +4710,22 @@ class CalculateQuotesService {
4675
4710
  let plusMonthDate = new Date(originDate.getFullYear(), originDate.getMonth() + 1, day);
4676
4711
  response.push(new Date(originDate.getFullYear(), originDate.getMonth() + 1, day));
4677
4712
  while (plusMonthDate.getDay() === 0) {
4678
- plusMonthDate.setMilliseconds(originDate.getMilliseconds() - oneDayMilis);
4713
+ plusMonthDate.setMilliseconds(plusMonthDate.getMilliseconds() - oneDayMilis);
4679
4714
  }
4680
4715
  response.push(plusMonthDate);
4681
4716
  return response;
4682
4717
  }
4683
- // setPlusOneMonth2(originDate: Date, isEndMonth: boolean): Date[] {
4684
- // let response: Date[] = [];
4685
- // let oneDayMilis = 1000 * 3600 * 24;
4686
- // let day = isEndMonth ? this.monthsDays[(originDate.getMonth() + 1) % 12] : originDate.getDate();
4687
- // let plusMonthDate: Date = new Date(originDate.getFullYear(), originDate.getMonth() + 1, day);
4688
- // while (plusMonthDate.getDay() === 0) {
4689
- // plusMonthDate.setMilliseconds(plusMonthDate.getMilliseconds() - oneDayMilis);
4690
- // }
4691
- // response.push(plusMonthDate);
4692
- // response.push(new Date(originDate.getFullYear(), originDate.getMonth() + 1, day + 1));
4693
- // return response;
4694
- // }
4695
4718
  getStringDate(originDate) {
4696
4719
  let month = originDate.getMonth() + 1;
4697
- let stringMonth = month < 10 ? '0' + month : month;
4698
- return originDate.getFullYear() + '-' + stringMonth + '-' + originDate.getDate();
4720
+ let stringMonth = month < 10 ? '0' + month : month.toString();
4721
+ let day = originDate.getDate();
4722
+ let stringDay = day < 10 ? '0' + day : day.toString();
4723
+ return originDate.getFullYear() + '-' + stringMonth + '-' + stringDay;
4699
4724
  }
4700
4725
  }
4701
- CalculateQuotesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: CalculateQuotesService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4702
- CalculateQuotesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: CalculateQuotesService, providedIn: 'root' });
4703
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: CalculateQuotesService, decorators: [{
4726
+ CalculateQuotesService$1.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: CalculateQuotesService$1, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4727
+ CalculateQuotesService$1.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: CalculateQuotesService$1, providedIn: 'root' });
4728
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: CalculateQuotesService$1, decorators: [{
4704
4729
  type: Injectable,
4705
4730
  args: [{
4706
4731
  providedIn: 'root'
@@ -4962,8 +4987,12 @@ class CodFormStepFourComponent extends CodFormSteps {
4962
4987
  quotaValues: Number(this.codFormStepFour.controls['quota_price'].value),
4963
4988
  quotaTimes: Number(this.codFormStepFour.controls['fee_number'].value),
4964
4989
  totalPrice: this.codFormStepFour.controls['total_price'].value,
4990
+ courseType: Number(this.localStorageCOD.getCodFormData(1, 'course_type')),
4991
+ englishLevel: Number(this.localStorageCOD.getCodFormData(1, 'english_level')),
4965
4992
  };
4993
+ console.log("params", params);
4966
4994
  this.dataFinancing = this.calculateQuotesService.calculateQuotes(params);
4995
+ console.log("dataFinancing", this.dataFinancing);
4967
4996
  this.isFinancing = true;
4968
4997
  this.financingData.emit(this.dataFinancing);
4969
4998
  }
@@ -5105,12 +5134,12 @@ class CodFormStepFourComponent extends CodFormSteps {
5105
5134
  // this.codFormStepFour.controls['quota_times'].setValue(this.initialData.cod_payment.lenght == 1 ? 1 : this.initialData.cod_price.fee_number);
5106
5135
  }
5107
5136
  }
5108
- 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 });
5137
+ 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 });
5109
5138
  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"] }] });
5110
5139
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: CodFormStepFourComponent, decorators: [{
5111
5140
  type: Component,
5112
5141
  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"] }]
5113
- }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: CalculateQuotesService }, { type: CodFormControls }, { type: CommercialService }, { type: BaseService }]; }, propDecorators: { isEditCod: [{
5142
+ }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: CalculateQuotesService$1 }, { type: CodFormControls }, { type: CommercialService }, { type: BaseService }]; }, propDecorators: { isEditCod: [{
5114
5143
  type: Input
5115
5144
  }], initialData: [{
5116
5145
  type: Input
@@ -7782,6 +7811,102 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImpor
7782
7811
  type: Input
7783
7812
  }] } });
7784
7813
 
7814
+ class CalculateQuotesService {
7815
+ constructor() {
7816
+ this.monthsDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
7817
+ }
7818
+ calculateQuotes(params) {
7819
+ let dataFinancing = [];
7820
+ let index = 1; // Indicador de cant. de cuotas
7821
+ let dateJs = new Date(params.date);
7822
+ let isEndMonth = false;
7823
+ dateJs.setMilliseconds(dateJs.getMilliseconds() + (1000 * 3600 * 24));
7824
+ isEndMonth = this.monthsDays[dateJs.getMonth()] === dateJs.getDate();
7825
+ if (dateJs.getDay() === 0) {
7826
+ Swal.fire({
7827
+ title: 'Fecha inválida',
7828
+ text: 'Debe seleccionar un día de la semana diferente al domingo',
7829
+ icon: 'error'
7830
+ });
7831
+ }
7832
+ else {
7833
+ let enrollment = [
7834
+ index,
7835
+ Intl.NumberFormat('en-US', {
7836
+ style: 'currency',
7837
+ currency: 'USD',
7838
+ minimumFractionDigits: 0
7839
+ }).format(Math.round(parseFloat(params.totalPrice.toString()))),
7840
+ this.getStringDate(dateJs)
7841
+ ];
7842
+ let quota = [
7843
+ index,
7844
+ Intl.NumberFormat('en-US', {
7845
+ style: 'currency',
7846
+ currency: 'USD',
7847
+ minimumFractionDigits: 0
7848
+ }).format(Math.round(parseFloat(params.quotaValues.toString()))),
7849
+ this.getStringDate(dateJs)
7850
+ ];
7851
+ dataFinancing.push(enrollment);
7852
+ dataFinancing.push(quota);
7853
+ while (index < params.quotaTimes) {
7854
+ index = index + 1;
7855
+ let newJsDate = this.setPlusOneMonth(dateJs, isEndMonth);
7856
+ let row = [
7857
+ index,
7858
+ Intl.NumberFormat('en-US', {
7859
+ style: 'currency',
7860
+ currency: 'USD',
7861
+ minimumFractionDigits: 0
7862
+ }).format(Math.round(parseFloat(params.quotaValues.toString()))),
7863
+ this.getStringDate(newJsDate[newJsDate.length - 1])
7864
+ ];
7865
+ dataFinancing.push(row);
7866
+ dateJs = newJsDate[0];
7867
+ }
7868
+ }
7869
+ return dataFinancing;
7870
+ }
7871
+ setPlusOneMonth(originDate, isEndMonth) {
7872
+ let response = [];
7873
+ let oneDayMilis = 1000 * 3600 * 24;
7874
+ let day = isEndMonth ? this.monthsDays[(originDate.getMonth() + 1) % 12] : originDate.getDate();
7875
+ let plusMonthDate = new Date(originDate.getFullYear(), originDate.getMonth() + 1, day);
7876
+ response.push(new Date(originDate.getFullYear(), originDate.getMonth() + 1, day));
7877
+ while (plusMonthDate.getDay() === 0) {
7878
+ plusMonthDate.setMilliseconds(originDate.getMilliseconds() - oneDayMilis);
7879
+ }
7880
+ response.push(plusMonthDate);
7881
+ return response;
7882
+ }
7883
+ // setPlusOneMonth2(originDate: Date, isEndMonth: boolean): Date[] {
7884
+ // let response: Date[] = [];
7885
+ // let oneDayMilis = 1000 * 3600 * 24;
7886
+ // let day = isEndMonth ? this.monthsDays[(originDate.getMonth() + 1) % 12] : originDate.getDate();
7887
+ // let plusMonthDate: Date = new Date(originDate.getFullYear(), originDate.getMonth() + 1, day);
7888
+ // while (plusMonthDate.getDay() === 0) {
7889
+ // plusMonthDate.setMilliseconds(plusMonthDate.getMilliseconds() - oneDayMilis);
7890
+ // }
7891
+ // response.push(plusMonthDate);
7892
+ // response.push(new Date(originDate.getFullYear(), originDate.getMonth() + 1, day + 1));
7893
+ // return response;
7894
+ // }
7895
+ getStringDate(originDate) {
7896
+ let month = originDate.getMonth() + 1;
7897
+ let stringMonth = month < 10 ? '0' + month : month;
7898
+ return originDate.getFullYear() + '-' + stringMonth + '-' + originDate.getDate();
7899
+ }
7900
+ }
7901
+ CalculateQuotesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: CalculateQuotesService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
7902
+ CalculateQuotesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: CalculateQuotesService, providedIn: 'root' });
7903
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: CalculateQuotesService, decorators: [{
7904
+ type: Injectable,
7905
+ args: [{
7906
+ providedIn: 'root'
7907
+ }]
7908
+ }], ctorParameters: function () { return []; } });
7909
+
7785
7910
  class CodSelfFormStepThreeComponent extends CodSelfManagedSteps {
7786
7911
  constructor(fb, messageService, commercialService, baseService, codFormControls, calculateQuotesService) {
7787
7912
  super();
@@ -8771,5 +8896,5 @@ class AnnouncementUserRs {
8771
8896
  * Generated bundle index. Do not edit.
8772
8897
  */
8773
8898
 
8774
- 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 };
8899
+ 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 };
8775
8900
  //# sourceMappingURL=iptdevs-design-system.mjs.map