iptdevs-design-system 3.1.873 → 3.1.875
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 +96 -45
- package/fesm2015/iptdevs-design-system.mjs +100 -46
- package/fesm2015/iptdevs-design-system.mjs.map +1 -1
- package/fesm2020/iptdevs-design-system.mjs +96 -46
- 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';
|
|
@@ -3842,10 +3842,7 @@ class CodFormStepOneComponent extends CodFormSteps {
|
|
|
3842
3842
|
const planNumber = typeof plan === 'string' ? parseInt(plan) : plan;
|
|
3843
3843
|
if (this.parametersAll && this.parametersAll?.courseType) {
|
|
3844
3844
|
this.course_type = this.parametersAll.courseType.filter((course) => {
|
|
3845
|
-
|
|
3846
|
-
? parseInt(course.academic_plan)
|
|
3847
|
-
: course.academic_plan;
|
|
3848
|
-
return academicPlan === planNumber;
|
|
3845
|
+
return course.academic_plan === planNumber;
|
|
3849
3846
|
});
|
|
3850
3847
|
}
|
|
3851
3848
|
else {
|
|
@@ -3855,11 +3852,8 @@ class CodFormStepOneComponent extends CodFormSteps {
|
|
|
3855
3852
|
getAgreementByPlan(plan) {
|
|
3856
3853
|
const planNumber = typeof plan === 'string' ? parseInt(plan) : plan;
|
|
3857
3854
|
if (this.parametersAll && this.parametersAll?.agreement) {
|
|
3858
|
-
this.agreements = this.parametersAll.agreement.filter((
|
|
3859
|
-
|
|
3860
|
-
? parseInt(course.category)
|
|
3861
|
-
: course.category;
|
|
3862
|
-
return academicPlan === planNumber;
|
|
3855
|
+
this.agreements = this.parametersAll.agreement.filter((agreement) => {
|
|
3856
|
+
return agreement.category === planNumber;
|
|
3863
3857
|
});
|
|
3864
3858
|
}
|
|
3865
3859
|
else {
|
|
@@ -3911,54 +3905,110 @@ class CodFormStepOneComponent extends CodFormSteps {
|
|
|
3911
3905
|
this.codFormStepOne.controls['english_level'].setValue(null);
|
|
3912
3906
|
}
|
|
3913
3907
|
}
|
|
3908
|
+
// private validRequest(): boolean {
|
|
3909
|
+
// return (
|
|
3910
|
+
// this.codFormStepOne.controls['english_level'].value != '' &&
|
|
3911
|
+
// this.codFormStepOne.controls['agreement_by_category'].value != '' &&
|
|
3912
|
+
// this.codFormStepOne.controls['course_type'].value != ''
|
|
3913
|
+
// );
|
|
3914
|
+
// }
|
|
3914
3915
|
validRequest() {
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3916
|
+
const form = this.codFormStepOne;
|
|
3917
|
+
return !!(form.get('english_level')?.value &&
|
|
3918
|
+
form.get('agreement_by_category')?.value &&
|
|
3919
|
+
form.get('course_type')?.value);
|
|
3920
|
+
}
|
|
3921
|
+
// getAvailibleCourses() {
|
|
3922
|
+
// if (this.validRequest()) {
|
|
3923
|
+
// this.isLoading = true;
|
|
3924
|
+
// let request_availibleCourses: GetAvailibleCoursesRq = {
|
|
3925
|
+
// token: this.baseService.getUserToken(),
|
|
3926
|
+
// english_level: this.codFormStepOne.controls['english_level'].value,
|
|
3927
|
+
// agreement: this.codFormStepOne.controls['agreement_by_category'].value,
|
|
3928
|
+
// course_type: this.codFormStepOne.controls['course_type'].value,
|
|
3929
|
+
// };
|
|
3930
|
+
// this.courseService.getAvailableCoursesByLevAgreeCType(request_availibleCourses).subscribe((response) => {
|
|
3931
|
+
// if (response.data) {
|
|
3932
|
+
// this.availibleCourses = [];
|
|
3933
|
+
// let courses: any[] = response.data;
|
|
3934
|
+
// this.hasAvailableCourse = true;
|
|
3935
|
+
// courses.forEach(course => {
|
|
3936
|
+
// let scheduleParts = course.course_schedule[0].split(" ");
|
|
3937
|
+
// let startTime = scheduleParts[2];
|
|
3938
|
+
// this.availibleCourses.push({
|
|
3939
|
+
// code: course.code,
|
|
3940
|
+
// 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}`,
|
|
3941
|
+
// modality: course.course_modality.code
|
|
3942
|
+
// });
|
|
3943
|
+
// })
|
|
3944
|
+
// this.isLoading = false;
|
|
3945
|
+
// console.log("availibleCourses",this.availibleCourses);
|
|
3946
|
+
// console.log("Valores del formulario:", {
|
|
3947
|
+
// academic_plan: this.codFormStepOne.controls['academic_plan'].value,
|
|
3948
|
+
// course_type: this.codFormStepOne.controls['course_type'].value,
|
|
3949
|
+
// agreement_by_category: this.codFormStepOne.controls['agreement_by_category'].value,
|
|
3950
|
+
// english_level: this.codFormStepOne.controls['english_level'].value,
|
|
3951
|
+
// availible_courses: this.codFormStepOne.controls['availible_courses'].value,
|
|
3952
|
+
// course_modality: this.codFormStepOne.controls['course_modality'].value,
|
|
3953
|
+
// agreement: this.codFormStepOne.controls['agreement'].value,
|
|
3954
|
+
// });
|
|
3955
|
+
// } else {
|
|
3956
|
+
// this.hasAvailableCourse = false;
|
|
3957
|
+
// this.codFormStepOne.controls['availible_courses'].setValue("");
|
|
3958
|
+
// this.setValueStepFour();
|
|
3959
|
+
// this.isLoading = false;
|
|
3960
|
+
// }
|
|
3961
|
+
// });
|
|
3962
|
+
// }
|
|
3963
|
+
// }
|
|
3919
3964
|
getAvailibleCourses() {
|
|
3920
3965
|
if (this.validRequest()) {
|
|
3921
3966
|
this.isLoading = true;
|
|
3967
|
+
// Guarda los valores actuales antes de la llamada
|
|
3968
|
+
const currentValues = {
|
|
3969
|
+
academic_plan: this.codFormStepOne.get('academic_plan')?.value,
|
|
3970
|
+
course_type: this.codFormStepOne.get('course_type')?.value,
|
|
3971
|
+
agreement_by_category: this.codFormStepOne.get('agreement_by_category')?.value,
|
|
3972
|
+
english_level: this.codFormStepOne.get('english_level')?.value
|
|
3973
|
+
};
|
|
3974
|
+
console.log('Before request:', this.codFormStepOne.value);
|
|
3922
3975
|
let request_availibleCourses = {
|
|
3923
3976
|
token: this.baseService.getUserToken(),
|
|
3924
|
-
english_level:
|
|
3925
|
-
agreement:
|
|
3926
|
-
course_type:
|
|
3977
|
+
english_level: currentValues.english_level,
|
|
3978
|
+
agreement: currentValues.agreement_by_category,
|
|
3979
|
+
course_type: currentValues.course_type,
|
|
3927
3980
|
};
|
|
3928
|
-
this.courseService.getAvailableCoursesByLevAgreeCType(request_availibleCourses)
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3981
|
+
this.courseService.getAvailableCoursesByLevAgreeCType(request_availibleCourses)
|
|
3982
|
+
.pipe(finalize(() => this.isLoading = false))
|
|
3983
|
+
.subscribe({
|
|
3984
|
+
next: (response) => {
|
|
3985
|
+
if (response.data) {
|
|
3986
|
+
this.availibleCourses = response.data.map((course) => {
|
|
3987
|
+
let scheduleParts = course.course_schedule[0]?.split(" ") || [];
|
|
3988
|
+
let startTime = scheduleParts[2] || '';
|
|
3989
|
+
return {
|
|
3990
|
+
code: course.code,
|
|
3991
|
+
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}`,
|
|
3992
|
+
modality: course.course_modality?.code
|
|
3993
|
+
};
|
|
3940
3994
|
});
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
});
|
|
3953
|
-
}
|
|
3954
|
-
else {
|
|
3995
|
+
this.hasAvailableCourse = true;
|
|
3996
|
+
}
|
|
3997
|
+
else {
|
|
3998
|
+
this.hasAvailableCourse = false;
|
|
3999
|
+
this.codFormStepOne.get('availible_courses')?.setValue(null);
|
|
4000
|
+
this.setValueStepFour();
|
|
4001
|
+
}
|
|
4002
|
+
this.cdRef.detectChanges();
|
|
4003
|
+
},
|
|
4004
|
+
error: (err) => {
|
|
4005
|
+
console.error('Error loading courses:', err);
|
|
3955
4006
|
this.hasAvailableCourse = false;
|
|
3956
|
-
this.
|
|
3957
|
-
this.setValueStepFour();
|
|
3958
|
-
this.isLoading = false;
|
|
4007
|
+
this.cdRef.detectChanges();
|
|
3959
4008
|
}
|
|
3960
4009
|
});
|
|
3961
4010
|
}
|
|
4011
|
+
console.log('After response:', this.codFormStepOne.value);
|
|
3962
4012
|
}
|
|
3963
4013
|
setValueStepFour() {
|
|
3964
4014
|
this.setDataInLocalStorage(4, 'program_price', null);
|