iptdevs-design-system 3.1.872 → 3.1.874
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.
- package/esm2020/lib/cod/steps/cod-form-step-one/cod-form-step-one.component.mjs +119 -43
- package/fesm2015/iptdevs-design-system.mjs +123 -44
- package/fesm2015/iptdevs-design-system.mjs.map +1 -1
- package/fesm2020/iptdevs-design-system.mjs +119 -44
- package/fesm2020/iptdevs-design-system.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -28,7 +28,7 @@ import * as i4 from 'primeng/skeleton';
|
|
|
28
28
|
import { SkeletonModule } from 'primeng/skeleton';
|
|
29
29
|
import * as i6$1 from 'primeng/button';
|
|
30
30
|
import { ButtonModule } from 'primeng/button';
|
|
31
|
-
import { BehaviorSubject, map } from 'rxjs';
|
|
31
|
+
import { BehaviorSubject, finalize, map } from 'rxjs';
|
|
32
32
|
import * as i11 from 'primeng/table';
|
|
33
33
|
import { TableModule } from 'primeng/table';
|
|
34
34
|
import * as i5$1 from '@angular/material/checkbox';
|
|
@@ -3790,23 +3790,32 @@ class CodFormStepOneComponent extends CodFormSteps {
|
|
|
3790
3790
|
course_modality: [''],
|
|
3791
3791
|
});
|
|
3792
3792
|
}
|
|
3793
|
+
// setValuesByLocalStorage() {
|
|
3794
|
+
// const academicPlan = this.codFormStepOne.controls['academic_plan'].value || null;
|
|
3795
|
+
// if (!academicPlan) return;
|
|
3796
|
+
// this.selectAcademicPlan(academicPlan);
|
|
3797
|
+
// const agreementByCategory = this.codFormStepOne.controls['agreement_by_category'].value || null;
|
|
3798
|
+
// if (!agreementByCategory) return;
|
|
3799
|
+
// this.getAvailibleCourses();
|
|
3800
|
+
// const englishLevel = this.codFormStepOne.controls['english_level'].value || null;
|
|
3801
|
+
// if (!englishLevel) return;
|
|
3802
|
+
// this.getAvailibleCourses();
|
|
3803
|
+
// const courseModality = this.codFormStepOne.controls['course_modality'].value || null;
|
|
3804
|
+
// if (!courseModality) return;
|
|
3805
|
+
// this.getAvailibleCourses();
|
|
3806
|
+
// }
|
|
3793
3807
|
setValuesByLocalStorage() {
|
|
3794
|
-
const academicPlan = this.codFormStepOne.controls['academic_plan'].value
|
|
3795
|
-
if (
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
const agreementByCategory = this.codFormStepOne.controls['agreement_by_category'].value
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
this.getAvailibleCourses();
|
|
3806
|
-
const courseModality = this.codFormStepOne.controls['course_modality'].value || null;
|
|
3807
|
-
if (!courseModality)
|
|
3808
|
-
return;
|
|
3809
|
-
this.getAvailibleCourses();
|
|
3808
|
+
const academicPlan = this.codFormStepOne.controls['academic_plan'].value;
|
|
3809
|
+
if (academicPlan) {
|
|
3810
|
+
this.selectAcademicPlan(academicPlan);
|
|
3811
|
+
}
|
|
3812
|
+
const agreementByCategory = this.codFormStepOne.controls['agreement_by_category'].value;
|
|
3813
|
+
const englishLevel = this.codFormStepOne.controls['english_level'].value;
|
|
3814
|
+
const courseModality = this.codFormStepOne.controls['course_modality'].value;
|
|
3815
|
+
if (agreementByCategory && englishLevel && courseModality) {
|
|
3816
|
+
console.log("se llama getAvailibleCourses desde setValuesByLocalStorage");
|
|
3817
|
+
this.getAvailibleCourses();
|
|
3818
|
+
}
|
|
3810
3819
|
}
|
|
3811
3820
|
sendForm() {
|
|
3812
3821
|
this.codFormStepOne.markAsTouched();
|
|
@@ -3880,7 +3889,7 @@ class CodFormStepOneComponent extends CodFormSteps {
|
|
|
3880
3889
|
this.codFormStepOne.controls['course_modality'].setValue(null);
|
|
3881
3890
|
this.codFormStepOne.controls['agreement_by_category'].setValue(agreementByCategories);
|
|
3882
3891
|
this.communicatorService.setCurrentAgreement(agreementByCategories);
|
|
3883
|
-
this.getAvailibleCourses();
|
|
3892
|
+
// this.getAvailibleCourses();
|
|
3884
3893
|
}
|
|
3885
3894
|
else {
|
|
3886
3895
|
this.codFormStepOne.controls['agreement_by_category'].setValue(null);
|
|
@@ -3910,44 +3919,114 @@ class CodFormStepOneComponent extends CodFormSteps {
|
|
|
3910
3919
|
this.codFormStepOne.controls['english_level'].setValue(null);
|
|
3911
3920
|
}
|
|
3912
3921
|
}
|
|
3922
|
+
// private validRequest(): boolean {
|
|
3923
|
+
// return (
|
|
3924
|
+
// this.codFormStepOne.controls['english_level'].value != '' &&
|
|
3925
|
+
// this.codFormStepOne.controls['agreement_by_category'].value != '' &&
|
|
3926
|
+
// this.codFormStepOne.controls['course_type'].value != ''
|
|
3927
|
+
// );
|
|
3928
|
+
// }
|
|
3913
3929
|
validRequest() {
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3930
|
+
var _a, _b, _c;
|
|
3931
|
+
const form = this.codFormStepOne;
|
|
3932
|
+
return !!(((_a = form.get('english_level')) === null || _a === void 0 ? void 0 : _a.value) &&
|
|
3933
|
+
((_b = form.get('agreement_by_category')) === null || _b === void 0 ? void 0 : _b.value) &&
|
|
3934
|
+
((_c = form.get('course_type')) === null || _c === void 0 ? void 0 : _c.value));
|
|
3935
|
+
}
|
|
3936
|
+
// getAvailibleCourses() {
|
|
3937
|
+
// if (this.validRequest()) {
|
|
3938
|
+
// this.isLoading = true;
|
|
3939
|
+
// let request_availibleCourses: GetAvailibleCoursesRq = {
|
|
3940
|
+
// token: this.baseService.getUserToken(),
|
|
3941
|
+
// english_level: this.codFormStepOne.controls['english_level'].value,
|
|
3942
|
+
// agreement: this.codFormStepOne.controls['agreement_by_category'].value,
|
|
3943
|
+
// course_type: this.codFormStepOne.controls['course_type'].value,
|
|
3944
|
+
// };
|
|
3945
|
+
// this.courseService.getAvailableCoursesByLevAgreeCType(request_availibleCourses).subscribe((response) => {
|
|
3946
|
+
// if (response.data) {
|
|
3947
|
+
// this.availibleCourses = [];
|
|
3948
|
+
// let courses: any[] = response.data;
|
|
3949
|
+
// this.hasAvailableCourse = true;
|
|
3950
|
+
// courses.forEach(course => {
|
|
3951
|
+
// let scheduleParts = course.course_schedule[0].split(" ");
|
|
3952
|
+
// let startTime = scheduleParts[2];
|
|
3953
|
+
// this.availibleCourses.push({
|
|
3954
|
+
// code: course.code,
|
|
3955
|
+
// name: `${course.code} Curso ${course.course_modality.name === 'Presencial' ? 'Presencial' : 'Virtual'} - Teacher ${course.teacher} - Fecha de inicio: ${course.to_start}, Hora de inicio: ${startTime}, Cupos disp: ${course.available_capacity}`,
|
|
3956
|
+
// modality: course.course_modality.code
|
|
3957
|
+
// });
|
|
3958
|
+
// })
|
|
3959
|
+
// this.isLoading = false;
|
|
3960
|
+
// console.log("availibleCourses",this.availibleCourses);
|
|
3961
|
+
// console.log("Valores del formulario:", {
|
|
3962
|
+
// academic_plan: this.codFormStepOne.controls['academic_plan'].value,
|
|
3963
|
+
// course_type: this.codFormStepOne.controls['course_type'].value,
|
|
3964
|
+
// agreement_by_category: this.codFormStepOne.controls['agreement_by_category'].value,
|
|
3965
|
+
// english_level: this.codFormStepOne.controls['english_level'].value,
|
|
3966
|
+
// availible_courses: this.codFormStepOne.controls['availible_courses'].value,
|
|
3967
|
+
// course_modality: this.codFormStepOne.controls['course_modality'].value,
|
|
3968
|
+
// agreement: this.codFormStepOne.controls['agreement'].value,
|
|
3969
|
+
// });
|
|
3970
|
+
// } else {
|
|
3971
|
+
// this.hasAvailableCourse = false;
|
|
3972
|
+
// this.codFormStepOne.controls['availible_courses'].setValue("");
|
|
3973
|
+
// this.setValueStepFour();
|
|
3974
|
+
// this.isLoading = false;
|
|
3975
|
+
// }
|
|
3976
|
+
// });
|
|
3977
|
+
// }
|
|
3978
|
+
// }
|
|
3918
3979
|
getAvailibleCourses() {
|
|
3980
|
+
var _a, _b, _c, _d;
|
|
3919
3981
|
if (this.validRequest()) {
|
|
3920
3982
|
this.isLoading = true;
|
|
3983
|
+
// Guarda los valores actuales antes de la llamada
|
|
3984
|
+
const currentValues = {
|
|
3985
|
+
academic_plan: (_a = this.codFormStepOne.get('academic_plan')) === null || _a === void 0 ? void 0 : _a.value,
|
|
3986
|
+
course_type: (_b = this.codFormStepOne.get('course_type')) === null || _b === void 0 ? void 0 : _b.value,
|
|
3987
|
+
agreement_by_category: (_c = this.codFormStepOne.get('agreement_by_category')) === null || _c === void 0 ? void 0 : _c.value,
|
|
3988
|
+
english_level: (_d = this.codFormStepOne.get('english_level')) === null || _d === void 0 ? void 0 : _d.value
|
|
3989
|
+
};
|
|
3990
|
+
console.log('Before request:', this.codFormStepOne.value);
|
|
3921
3991
|
let request_availibleCourses = {
|
|
3922
3992
|
token: this.baseService.getUserToken(),
|
|
3923
|
-
english_level:
|
|
3924
|
-
agreement:
|
|
3925
|
-
course_type:
|
|
3993
|
+
english_level: currentValues.english_level,
|
|
3994
|
+
agreement: currentValues.agreement_by_category,
|
|
3995
|
+
course_type: currentValues.course_type,
|
|
3926
3996
|
};
|
|
3927
|
-
this.courseService.getAvailableCoursesByLevAgreeCType(request_availibleCourses)
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3997
|
+
this.courseService.getAvailableCoursesByLevAgreeCType(request_availibleCourses)
|
|
3998
|
+
.pipe(finalize(() => this.isLoading = false))
|
|
3999
|
+
.subscribe({
|
|
4000
|
+
next: (response) => {
|
|
4001
|
+
var _a;
|
|
4002
|
+
if (response.data) {
|
|
4003
|
+
this.availibleCourses = response.data.map((course) => {
|
|
4004
|
+
var _a, _b, _c;
|
|
4005
|
+
let scheduleParts = ((_a = course.course_schedule[0]) === null || _a === void 0 ? void 0 : _a.split(" ")) || [];
|
|
4006
|
+
let startTime = scheduleParts[2] || '';
|
|
4007
|
+
return {
|
|
4008
|
+
code: course.code,
|
|
4009
|
+
name: `${course.code} Curso ${((_b = course.course_modality) === null || _b === void 0 ? void 0 : _b.name) === 'Presencial' ? 'Presencial' : 'Virtual'} - Teacher ${course.teacher} - Fecha de inicio: ${course.to_start}, Hora de inicio: ${startTime}, Cupos disp: ${course.available_capacity}`,
|
|
4010
|
+
modality: (_c = course.course_modality) === null || _c === void 0 ? void 0 : _c.code
|
|
4011
|
+
};
|
|
3939
4012
|
});
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
4013
|
+
this.hasAvailableCourse = true;
|
|
4014
|
+
}
|
|
4015
|
+
else {
|
|
4016
|
+
this.hasAvailableCourse = false;
|
|
4017
|
+
(_a = this.codFormStepOne.get('availible_courses')) === null || _a === void 0 ? void 0 : _a.setValue(null);
|
|
4018
|
+
this.setValueStepFour();
|
|
4019
|
+
}
|
|
4020
|
+
this.cdRef.detectChanges();
|
|
4021
|
+
},
|
|
4022
|
+
error: (err) => {
|
|
4023
|
+
console.error('Error loading courses:', err);
|
|
3944
4024
|
this.hasAvailableCourse = false;
|
|
3945
|
-
this.
|
|
3946
|
-
this.setValueStepFour();
|
|
3947
|
-
this.isLoading = false;
|
|
4025
|
+
this.cdRef.detectChanges();
|
|
3948
4026
|
}
|
|
3949
4027
|
});
|
|
3950
4028
|
}
|
|
4029
|
+
console.log('After response:', this.codFormStepOne.value);
|
|
3951
4030
|
}
|
|
3952
4031
|
setValueStepFour() {
|
|
3953
4032
|
this.setDataInLocalStorage(4, 'program_price', null);
|