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';
|
|
@@ -3784,23 +3784,32 @@ class CodFormStepOneComponent extends CodFormSteps {
|
|
|
3784
3784
|
course_modality: [''],
|
|
3785
3785
|
});
|
|
3786
3786
|
}
|
|
3787
|
+
// setValuesByLocalStorage() {
|
|
3788
|
+
// const academicPlan = this.codFormStepOne.controls['academic_plan'].value || null;
|
|
3789
|
+
// if (!academicPlan) return;
|
|
3790
|
+
// this.selectAcademicPlan(academicPlan);
|
|
3791
|
+
// const agreementByCategory = this.codFormStepOne.controls['agreement_by_category'].value || null;
|
|
3792
|
+
// if (!agreementByCategory) return;
|
|
3793
|
+
// this.getAvailibleCourses();
|
|
3794
|
+
// const englishLevel = this.codFormStepOne.controls['english_level'].value || null;
|
|
3795
|
+
// if (!englishLevel) return;
|
|
3796
|
+
// this.getAvailibleCourses();
|
|
3797
|
+
// const courseModality = this.codFormStepOne.controls['course_modality'].value || null;
|
|
3798
|
+
// if (!courseModality) return;
|
|
3799
|
+
// this.getAvailibleCourses();
|
|
3800
|
+
// }
|
|
3787
3801
|
setValuesByLocalStorage() {
|
|
3788
|
-
const academicPlan = this.codFormStepOne.controls['academic_plan'].value
|
|
3789
|
-
if (
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
const agreementByCategory = this.codFormStepOne.controls['agreement_by_category'].value
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
this.getAvailibleCourses();
|
|
3800
|
-
const courseModality = this.codFormStepOne.controls['course_modality'].value || null;
|
|
3801
|
-
if (!courseModality)
|
|
3802
|
-
return;
|
|
3803
|
-
this.getAvailibleCourses();
|
|
3802
|
+
const academicPlan = this.codFormStepOne.controls['academic_plan'].value;
|
|
3803
|
+
if (academicPlan) {
|
|
3804
|
+
this.selectAcademicPlan(academicPlan);
|
|
3805
|
+
}
|
|
3806
|
+
const agreementByCategory = this.codFormStepOne.controls['agreement_by_category'].value;
|
|
3807
|
+
const englishLevel = this.codFormStepOne.controls['english_level'].value;
|
|
3808
|
+
const courseModality = this.codFormStepOne.controls['course_modality'].value;
|
|
3809
|
+
if (agreementByCategory && englishLevel && courseModality) {
|
|
3810
|
+
console.log("se llama getAvailibleCourses desde setValuesByLocalStorage");
|
|
3811
|
+
this.getAvailibleCourses();
|
|
3812
|
+
}
|
|
3804
3813
|
}
|
|
3805
3814
|
sendForm() {
|
|
3806
3815
|
this.codFormStepOne.markAsTouched();
|
|
@@ -3872,7 +3881,7 @@ class CodFormStepOneComponent extends CodFormSteps {
|
|
|
3872
3881
|
this.codFormStepOne.controls['course_modality'].setValue(null);
|
|
3873
3882
|
this.codFormStepOne.controls['agreement_by_category'].setValue(agreementByCategories);
|
|
3874
3883
|
this.communicatorService.setCurrentAgreement(agreementByCategories);
|
|
3875
|
-
this.getAvailibleCourses();
|
|
3884
|
+
// this.getAvailibleCourses();
|
|
3876
3885
|
}
|
|
3877
3886
|
else {
|
|
3878
3887
|
this.codFormStepOne.controls['agreement_by_category'].setValue(null);
|
|
@@ -3902,44 +3911,110 @@ class CodFormStepOneComponent extends CodFormSteps {
|
|
|
3902
3911
|
this.codFormStepOne.controls['english_level'].setValue(null);
|
|
3903
3912
|
}
|
|
3904
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
|
+
// }
|
|
3905
3921
|
validRequest() {
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
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
|
+
// }
|
|
3910
3970
|
getAvailibleCourses() {
|
|
3911
3971
|
if (this.validRequest()) {
|
|
3912
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);
|
|
3913
3981
|
let request_availibleCourses = {
|
|
3914
3982
|
token: this.baseService.getUserToken(),
|
|
3915
|
-
english_level:
|
|
3916
|
-
agreement:
|
|
3917
|
-
course_type:
|
|
3983
|
+
english_level: currentValues.english_level,
|
|
3984
|
+
agreement: currentValues.agreement_by_category,
|
|
3985
|
+
course_type: currentValues.course_type,
|
|
3918
3986
|
};
|
|
3919
|
-
this.courseService.getAvailableCoursesByLevAgreeCType(request_availibleCourses)
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
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
|
+
};
|
|
3931
4000
|
});
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
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);
|
|
3936
4012
|
this.hasAvailableCourse = false;
|
|
3937
|
-
this.
|
|
3938
|
-
this.setValueStepFour();
|
|
3939
|
-
this.isLoading = false;
|
|
4013
|
+
this.cdRef.detectChanges();
|
|
3940
4014
|
}
|
|
3941
4015
|
});
|
|
3942
4016
|
}
|
|
4017
|
+
console.log('After response:', this.codFormStepOne.value);
|
|
3943
4018
|
}
|
|
3944
4019
|
setValueStepFour() {
|
|
3945
4020
|
this.setDataInLocalStorage(4, 'program_price', null);
|