iptdevs-design-system 3.1.873 → 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 +93 -36
- package/fesm2015/iptdevs-design-system.mjs +97 -37
- package/fesm2015/iptdevs-design-system.mjs.map +1 -1
- package/fesm2020/iptdevs-design-system.mjs +93 -37
- 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';
|
|
@@ -3911,54 +3911,110 @@ class CodFormStepOneComponent extends CodFormSteps {
|
|
|
3911
3911
|
this.codFormStepOne.controls['english_level'].setValue(null);
|
|
3912
3912
|
}
|
|
3913
3913
|
}
|
|
3914
|
+
// private validRequest(): boolean {
|
|
3915
|
+
// return (
|
|
3916
|
+
// this.codFormStepOne.controls['english_level'].value != '' &&
|
|
3917
|
+
// this.codFormStepOne.controls['agreement_by_category'].value != '' &&
|
|
3918
|
+
// this.codFormStepOne.controls['course_type'].value != ''
|
|
3919
|
+
// );
|
|
3920
|
+
// }
|
|
3914
3921
|
validRequest() {
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3922
|
+
const form = this.codFormStepOne;
|
|
3923
|
+
return !!(form.get('english_level')?.value &&
|
|
3924
|
+
form.get('agreement_by_category')?.value &&
|
|
3925
|
+
form.get('course_type')?.value);
|
|
3926
|
+
}
|
|
3927
|
+
// getAvailibleCourses() {
|
|
3928
|
+
// if (this.validRequest()) {
|
|
3929
|
+
// this.isLoading = true;
|
|
3930
|
+
// let request_availibleCourses: GetAvailibleCoursesRq = {
|
|
3931
|
+
// token: this.baseService.getUserToken(),
|
|
3932
|
+
// english_level: this.codFormStepOne.controls['english_level'].value,
|
|
3933
|
+
// agreement: this.codFormStepOne.controls['agreement_by_category'].value,
|
|
3934
|
+
// course_type: this.codFormStepOne.controls['course_type'].value,
|
|
3935
|
+
// };
|
|
3936
|
+
// this.courseService.getAvailableCoursesByLevAgreeCType(request_availibleCourses).subscribe((response) => {
|
|
3937
|
+
// if (response.data) {
|
|
3938
|
+
// this.availibleCourses = [];
|
|
3939
|
+
// let courses: any[] = response.data;
|
|
3940
|
+
// this.hasAvailableCourse = true;
|
|
3941
|
+
// courses.forEach(course => {
|
|
3942
|
+
// let scheduleParts = course.course_schedule[0].split(" ");
|
|
3943
|
+
// let startTime = scheduleParts[2];
|
|
3944
|
+
// this.availibleCourses.push({
|
|
3945
|
+
// code: course.code,
|
|
3946
|
+
// 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}`,
|
|
3947
|
+
// modality: course.course_modality.code
|
|
3948
|
+
// });
|
|
3949
|
+
// })
|
|
3950
|
+
// this.isLoading = false;
|
|
3951
|
+
// console.log("availibleCourses",this.availibleCourses);
|
|
3952
|
+
// console.log("Valores del formulario:", {
|
|
3953
|
+
// academic_plan: this.codFormStepOne.controls['academic_plan'].value,
|
|
3954
|
+
// course_type: this.codFormStepOne.controls['course_type'].value,
|
|
3955
|
+
// agreement_by_category: this.codFormStepOne.controls['agreement_by_category'].value,
|
|
3956
|
+
// english_level: this.codFormStepOne.controls['english_level'].value,
|
|
3957
|
+
// availible_courses: this.codFormStepOne.controls['availible_courses'].value,
|
|
3958
|
+
// course_modality: this.codFormStepOne.controls['course_modality'].value,
|
|
3959
|
+
// agreement: this.codFormStepOne.controls['agreement'].value,
|
|
3960
|
+
// });
|
|
3961
|
+
// } else {
|
|
3962
|
+
// this.hasAvailableCourse = false;
|
|
3963
|
+
// this.codFormStepOne.controls['availible_courses'].setValue("");
|
|
3964
|
+
// this.setValueStepFour();
|
|
3965
|
+
// this.isLoading = false;
|
|
3966
|
+
// }
|
|
3967
|
+
// });
|
|
3968
|
+
// }
|
|
3969
|
+
// }
|
|
3919
3970
|
getAvailibleCourses() {
|
|
3920
3971
|
if (this.validRequest()) {
|
|
3921
3972
|
this.isLoading = true;
|
|
3973
|
+
// Guarda los valores actuales antes de la llamada
|
|
3974
|
+
const currentValues = {
|
|
3975
|
+
academic_plan: this.codFormStepOne.get('academic_plan')?.value,
|
|
3976
|
+
course_type: this.codFormStepOne.get('course_type')?.value,
|
|
3977
|
+
agreement_by_category: this.codFormStepOne.get('agreement_by_category')?.value,
|
|
3978
|
+
english_level: this.codFormStepOne.get('english_level')?.value
|
|
3979
|
+
};
|
|
3980
|
+
console.log('Before request:', this.codFormStepOne.value);
|
|
3922
3981
|
let request_availibleCourses = {
|
|
3923
3982
|
token: this.baseService.getUserToken(),
|
|
3924
|
-
english_level:
|
|
3925
|
-
agreement:
|
|
3926
|
-
course_type:
|
|
3983
|
+
english_level: currentValues.english_level,
|
|
3984
|
+
agreement: currentValues.agreement_by_category,
|
|
3985
|
+
course_type: currentValues.course_type,
|
|
3927
3986
|
};
|
|
3928
|
-
this.courseService.getAvailableCoursesByLevAgreeCType(request_availibleCourses)
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3987
|
+
this.courseService.getAvailableCoursesByLevAgreeCType(request_availibleCourses)
|
|
3988
|
+
.pipe(finalize(() => this.isLoading = false))
|
|
3989
|
+
.subscribe({
|
|
3990
|
+
next: (response) => {
|
|
3991
|
+
if (response.data) {
|
|
3992
|
+
this.availibleCourses = response.data.map((course) => {
|
|
3993
|
+
let scheduleParts = course.course_schedule[0]?.split(" ") || [];
|
|
3994
|
+
let startTime = scheduleParts[2] || '';
|
|
3995
|
+
return {
|
|
3996
|
+
code: course.code,
|
|
3997
|
+
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}`,
|
|
3998
|
+
modality: course.course_modality?.code
|
|
3999
|
+
};
|
|
3940
4000
|
});
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
});
|
|
3953
|
-
}
|
|
3954
|
-
else {
|
|
4001
|
+
this.hasAvailableCourse = true;
|
|
4002
|
+
}
|
|
4003
|
+
else {
|
|
4004
|
+
this.hasAvailableCourse = false;
|
|
4005
|
+
this.codFormStepOne.get('availible_courses')?.setValue(null);
|
|
4006
|
+
this.setValueStepFour();
|
|
4007
|
+
}
|
|
4008
|
+
this.cdRef.detectChanges();
|
|
4009
|
+
},
|
|
4010
|
+
error: (err) => {
|
|
4011
|
+
console.error('Error loading courses:', err);
|
|
3955
4012
|
this.hasAvailableCourse = false;
|
|
3956
|
-
this.
|
|
3957
|
-
this.setValueStepFour();
|
|
3958
|
-
this.isLoading = false;
|
|
4013
|
+
this.cdRef.detectChanges();
|
|
3959
4014
|
}
|
|
3960
4015
|
});
|
|
3961
4016
|
}
|
|
4017
|
+
console.log('After response:', this.codFormStepOne.value);
|
|
3962
4018
|
}
|
|
3963
4019
|
setValueStepFour() {
|
|
3964
4020
|
this.setDataInLocalStorage(4, 'program_price', null);
|