iptdevs-design-system 3.1.508 → 3.1.510

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.
@@ -6631,19 +6631,15 @@ class CodSelfFormStepTwoComponent extends CodSelfManagedSteps {
6631
6631
  this.visible = false;
6632
6632
  this.messageInfo = 'Busca un plan deacuerdo a tu disponibilidad';
6633
6633
  this.initForm();
6634
- this.minDate = new Date();
6635
- this.codSelfFormStepTwo.controls['schedule'].setValue("");
6636
6634
  }
6637
6635
  ngOnInit() {
6638
6636
  this.startLocalStorageWork();
6637
+ this.valuesInitialSchedule();
6639
6638
  }
6640
6639
  ngOnChanges() {
6641
6640
  // this.initForm();
6642
6641
  // this.startLocalStorageWork();
6643
6642
  }
6644
- ngOnDestroy() {
6645
- this.codSelfFormStepTwo.controls['schedule'].setValue("");
6646
- }
6647
6643
  initForm() {
6648
6644
  this.codSelfFormStepTwo = this.fb.group({
6649
6645
  schedule: ['', [Validators.required]],
@@ -6656,6 +6652,18 @@ class CodSelfFormStepTwoComponent extends CodSelfManagedSteps {
6656
6652
  // course_modality: ['', [Validators.required],],
6657
6653
  });
6658
6654
  }
6655
+ valuesInitialSchedule() {
6656
+ const scheduleValue = localStorage.getItem('COD SELF - step2(schedule)');
6657
+ // Verifica si hay un valor en el localStorage
6658
+ if (scheduleValue && scheduleValue.trim() != '') {
6659
+ // Si hay un valor en el localStorage, establece el valor del FormControl
6660
+ this.codSelfFormStepTwo.controls['schedule'].setValue(new Date(scheduleValue));
6661
+ }
6662
+ else {
6663
+ // Si no hay un valor en el localStorage, o si es null o vacío, establece un valor predeterminado
6664
+ this.codSelfFormStepTwo.controls['schedule'].setValue(new Date());
6665
+ }
6666
+ }
6659
6667
  back() {
6660
6668
  // Movernos al paso anterior
6661
6669
  this.completed.emit(0);
@@ -6710,14 +6718,8 @@ class CodSelfFormStepTwoComponent extends CodSelfManagedSteps {
6710
6718
  }
6711
6719
  }
6712
6720
  onDateChange(event) {
6713
- if (event instanceof Date) {
6714
- // Convierte la fecha a una cadena ISO 8601 y guárdala en el localStorage
6715
- localStorage.setItem('COD SELF - step2(schedule)', event.toISOString());
6716
- console.log(event);
6717
- }
6718
- else {
6719
- console.error('Error: El evento no es una instancia de Date.');
6720
- }
6721
+ // Convierte la fecha a una cadena ISO 8601 y guárdala en el localStorage
6722
+ localStorage.setItem('COD SELF - step2(schedule)', event.toISOString());
6721
6723
  }
6722
6724
  onReject() {
6723
6725
  this.messageService.clear('confirm');