@eeplatform/nuxt-layer-common 1.7.29 → 1.7.31

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.
@@ -116,7 +116,7 @@
116
116
  </v-row>
117
117
  </v-col>
118
118
 
119
- <v-col cols="2" class="pb-0">
119
+ <v-col cols="3" class="pb-0">
120
120
  <v-row no-gutters>
121
121
  <InputLabel class="text-capitalize" title="Grade Level" required />
122
122
  <v-col cols="12">
@@ -167,6 +167,28 @@
167
167
  </v-row>
168
168
  </v-col>
169
169
 
170
+ <v-col
171
+ v-if="
172
+ enrollment.specialProgram && selectedProgram.majors.length
173
+ "
174
+ cols="12"
175
+ >
176
+ <v-row no-gutters>
177
+ <InputLabel
178
+ class="text-capitalize"
179
+ title="Major"
180
+ required
181
+ />
182
+ <v-col cols="12">
183
+ <v-autocomplete
184
+ v-model="enrollment.specialProgramMajor"
185
+ :rules="[requiredRule]"
186
+ :items="selectedProgram.majors"
187
+ ></v-autocomplete>
188
+ </v-col>
189
+ </v-row>
190
+ </v-col>
191
+
170
192
  <v-col
171
193
  v-if="enrollment.specialProgram && selectedProgram.gwa"
172
194
  cols="12"
@@ -385,12 +407,13 @@
385
407
  <v-col cols="2">
386
408
  <v-row no-gutters>
387
409
  <v-col cols="12">
388
- <InputLabel class="text-capitalize" title="Sex" />
410
+ <InputLabel class="text-capitalize" title="Sex" required />
389
411
  </v-col>
390
412
  <v-col cols="12">
391
413
  <v-select
392
414
  v-model="enrollment.learnerInfo.sex"
393
415
  :items="['Male', 'Female']"
416
+ :rules="[requiredRule]"
394
417
  placeholder="Select Sex"
395
418
  ></v-select>
396
419
  </v-col>
@@ -401,35 +424,42 @@
401
424
 
402
425
  <v-col cols="12" class="mt-4">
403
426
  <v-row>
404
- <v-col cols="4">
427
+ <v-col cols="3">
405
428
  <v-row no-gutters>
406
429
  <InputLabel
407
430
  class="text-capitalize"
408
- title="Place of Birth (Municipality/City)"
431
+ title="Place of Birth(Municipality/City)"
409
432
  required
410
433
  />
411
434
  <v-col cols="12">
412
- <v-autocomplete
413
- v-model="enrollment.learnerInfo.placeOfBirth"
435
+ <v-combobox
436
+ v-model="
437
+ enrollment.learnerInfo.placeOfBirth.cityMunicipality
438
+ "
414
439
  :rules="[requiredRule]"
415
- :items="citiesMunicipalities"
440
+ :items="birthCitiesMunicipalities"
416
441
  item-title="name"
417
- items-value="name"
442
+ item-value="code"
443
+ :return-object="false"
418
444
  :hide-no-data="false"
445
+ :loading="loadingBirthCityMun"
419
446
  >
420
447
  <template v-slot:no-data>
421
448
  <v-list-item>
422
449
  <v-list-item-title>
423
- No results matching "<strong>search</strong>". Press
424
- <kbd>enter</kbd> to create a new one
450
+ No results found. Press <kbd>enter</kbd> to search
425
451
  </v-list-item-title>
426
452
  </v-list-item>
427
453
  </template>
428
- </v-autocomplete>
454
+ </v-combobox>
429
455
  </v-col>
430
456
  </v-row>
431
457
  </v-col>
458
+ </v-row>
459
+ </v-col>
432
460
 
461
+ <v-col cols="12">
462
+ <v-row>
433
463
  <v-col cols="3">
434
464
  <v-row no-gutters>
435
465
  <InputLabel
@@ -458,14 +488,12 @@
458
488
  </v-col>
459
489
 
460
490
  <v-col cols="4">
461
- <v-row>
462
- <v-col cols="12" class="pb-0">
463
- <InputLabel
464
- class="text-capitalize"
465
- title="Indigenous People/Cultural Community"
466
- />
467
- </v-col>
468
- <v-col cols="9" class="pt-0">
491
+ <v-row no-gutters>
492
+ <InputLabel
493
+ class="text-capitalize"
494
+ title="Indigenous People/Cultural Community"
495
+ />
496
+ <v-col cols="12" class="pt-0">
469
497
  <v-combobox
470
498
  v-model="enrollment.learnerInfo.indigenousCommunity"
471
499
  :items="indigenousCommunitiesPhilippines"
@@ -483,21 +511,19 @@
483
511
  </v-col>
484
512
  </v-row>
485
513
  </v-col>
486
- </v-row>
487
- </v-col>
488
514
 
489
- <v-col cols="12">
490
- <v-row>
491
- <v-col cols="12" class="pb-0">
492
- <InputLabel
493
- class="text-capitalize"
494
- title="4Ps Household ID Number"
495
- />
496
- </v-col>
497
- <v-col cols="4" class="pt-0">
498
- <v-text-field
499
- v-model="enrollment.learnerInfo.fourPsHouseholdId"
500
- ></v-text-field>
515
+ <v-col cols="3">
516
+ <v-row no-gutters>
517
+ <InputLabel
518
+ class="text-capitalize"
519
+ title="4Ps Household ID Number"
520
+ />
521
+ <v-col cols="12" class="pt-0">
522
+ <v-text-field
523
+ v-model="enrollment.learnerInfo.fourPsHouseholdId"
524
+ ></v-text-field>
525
+ </v-col>
526
+ </v-row>
501
527
  </v-col>
502
528
  </v-row>
503
529
  </v-col>
@@ -665,66 +691,35 @@
665
691
 
666
692
  <v-col cols="12">
667
693
  <v-row>
668
- <v-col cols="3">
669
- <v-row no-gutters>
670
- <InputLabel class="text-capitalize" title="House No." />
671
- <v-col cols="12">
672
- <v-text-field
673
- v-model="enrollment.address.current.houseNumber"
674
- ></v-text-field>
675
- </v-col>
676
- </v-row>
677
- </v-col>
678
-
679
- <v-col cols="3">
680
- <v-row no-gutters>
681
- <InputLabel class="text-capitalize" title="Street" />
682
- <v-col cols="12">
683
- <v-text-field
684
- v-model="enrollment.address.current.streetName"
685
- ></v-text-field>
686
- </v-col>
687
- </v-row>
688
- </v-col>
689
-
690
694
  <v-col cols="3">
691
695
  <v-row no-gutters>
692
696
  <InputLabel
693
697
  class="text-capitalize"
694
- title="Barangay"
698
+ title="Country"
695
699
  required
696
700
  />
697
701
  <v-col cols="12">
698
702
  <v-text-field
699
- v-model="enrollment.address.current.barangay"
703
+ v-model="enrollment.address.current.country"
700
704
  :rules="[requiredRule]"
705
+ readonly
701
706
  ></v-text-field>
702
707
  </v-col>
703
708
  </v-row>
704
709
  </v-col>
705
- </v-row>
706
- </v-col>
707
710
 
708
- <v-col cols="12">
709
- <v-row>
710
711
  <v-col cols="3">
711
712
  <v-row no-gutters>
712
- <InputLabel
713
- class="text-capitalize"
714
- title="Province"
715
- required
716
- />
713
+ <InputLabel class="text-capitalize" title="Province" />
717
714
  <v-col cols="12">
718
715
  <v-combobox
719
716
  v-model="enrollment.address.current.province"
720
- :rules="[requiredRule]"
721
717
  :items="currentProvinces"
722
718
  item-title="name"
723
- item-value="name"
719
+ item-value="code"
724
720
  :return-object="false"
725
721
  :hide-no-data="false"
726
722
  :loading="loadingCurrentProvinces"
727
- @keydown.enter="getCurrentCityMun()"
728
723
  >
729
724
  <template v-slot:no-data>
730
725
  <v-list-item>
@@ -753,10 +748,9 @@
753
748
  :rules="[requiredRule]"
754
749
  :items="currentCitiesMunicipalities"
755
750
  item-title="name"
756
- item-value="name"
751
+ item-value="code"
757
752
  :return-object="false"
758
753
  :hide-no-data="false"
759
- :disabled="!enrollment.address.current.province"
760
754
  :loading="loadingCurrentCityMun"
761
755
  >
762
756
  <template v-slot:no-data>
@@ -773,34 +767,71 @@
773
767
  </v-row>
774
768
  </v-col>
775
769
 
770
+ <v-col cols="2">
771
+ <v-row no-gutters>
772
+ <InputLabel class="text-capitalize" title="Zip Code" />
773
+ <v-col cols="12">
774
+ <v-text-field
775
+ v-model="enrollment.address.current.zipCode"
776
+ ></v-text-field>
777
+ </v-col>
778
+ </v-row>
779
+ </v-col>
780
+ </v-row>
781
+ </v-col>
782
+
783
+ <v-col cols="12">
784
+ <v-row>
776
785
  <v-col cols="3">
777
786
  <v-row no-gutters>
778
787
  <InputLabel
779
788
  class="text-capitalize"
780
- title="Country"
789
+ title="Barangay"
781
790
  required
782
791
  />
783
792
  <v-col cols="12">
784
- <v-text-field
785
- v-model="enrollment.address.current.country"
793
+ <v-combobox
794
+ v-model="enrollment.address.current.barangay"
786
795
  :rules="[requiredRule]"
787
- readonly
796
+ :items="currentBarangays"
797
+ item-title="name"
798
+ item-value="code"
799
+ :return-object="false"
800
+ :hide-no-data="false"
801
+ :disabled="!enrollment.address.current.municipalityCity"
802
+ :loading="loadingCurrentBarangay"
803
+ >
804
+ <template v-slot:no-data>
805
+ <v-list-item>
806
+ <v-list-item-title>
807
+ No results matching "<strong>search</strong>".
808
+ Press
809
+ <kbd>enter</kbd> to create a new one
810
+ </v-list-item-title>
811
+ </v-list-item>
812
+ </template>
813
+ </v-combobox>
814
+ </v-col>
815
+ </v-row>
816
+ </v-col>
817
+
818
+ <v-col cols="3">
819
+ <v-row no-gutters>
820
+ <InputLabel class="text-capitalize" title="Street" />
821
+ <v-col cols="12">
822
+ <v-text-field
823
+ v-model="enrollment.address.current.streetName"
788
824
  ></v-text-field>
789
825
  </v-col>
790
826
  </v-row>
791
827
  </v-col>
792
828
 
793
- <v-col cols="2">
829
+ <v-col cols="3">
794
830
  <v-row no-gutters>
795
- <InputLabel
796
- class="text-capitalize"
797
- title="Zip Code"
798
- required
799
- />
831
+ <InputLabel class="text-capitalize" title="House No." />
800
832
  <v-col cols="12">
801
833
  <v-text-field
802
- v-model="enrollment.address.current.zipCode"
803
- :rules="[requiredRule]"
834
+ v-model="enrollment.address.current.houseNumber"
804
835
  ></v-text-field>
805
836
  </v-col>
806
837
  </v-row>
@@ -829,70 +860,37 @@
829
860
 
830
861
  <v-col cols="12">
831
862
  <v-row>
832
- <v-col cols="3">
833
- <v-row no-gutters>
834
- <InputLabel class="text-capitalize" title="House No." />
835
- <v-col cols="12">
836
- <v-text-field
837
- v-model="enrollment.address.permanent.houseNumber"
838
- :readonly="sameAsCurrentAddress"
839
- ></v-text-field>
840
- </v-col>
841
- </v-row>
842
- </v-col>
843
-
844
- <v-col cols="3">
845
- <v-row no-gutters>
846
- <InputLabel class="text-capitalize" title="Street" />
847
- <v-col cols="12">
848
- <v-text-field
849
- v-model="enrollment.address.permanent.streetName"
850
- :readonly="sameAsCurrentAddress"
851
- ></v-text-field>
852
- </v-col>
853
- </v-row>
854
- </v-col>
855
-
856
863
  <v-col cols="3">
857
864
  <v-row no-gutters>
858
865
  <InputLabel
859
866
  class="text-capitalize"
860
- title="Barangay"
867
+ title="Country"
861
868
  required
862
869
  />
863
870
  <v-col cols="12">
864
871
  <v-text-field
865
- v-model="enrollment.address.permanent.barangay"
872
+ v-model="enrollment.address.permanent.country"
866
873
  :rules="[requiredRule]"
867
874
  :readonly="sameAsCurrentAddress"
868
875
  ></v-text-field>
869
876
  </v-col>
870
877
  </v-row>
871
878
  </v-col>
872
- </v-row>
873
- </v-col>
874
879
 
875
- <v-col cols="12">
876
- <v-row>
877
880
  <v-col cols="3">
878
881
  <v-row no-gutters>
879
- <InputLabel
880
- class="text-capitalize"
881
- title="Province"
882
- required
883
- />
882
+ <InputLabel class="text-capitalize" title="Province" />
884
883
  <v-col cols="12">
885
884
  <v-combobox
886
885
  v-model="enrollment.address.permanent.province"
887
- :rules="[requiredRule]"
888
886
  :readonly="sameAsCurrentAddress"
889
887
  :items="permanentProvinces"
890
888
  item-title="name"
891
- item-value="name"
889
+ item-value="code"
892
890
  :return-object="false"
893
891
  :hide-no-data="false"
894
892
  :loading="loadingPermanentProvinces"
895
- @keydown.enter="getPermanentCityMun()"
893
+ :disabled="sameAsCurrentAddress"
896
894
  >
897
895
  <template v-slot:no-data>
898
896
  <v-list-item>
@@ -922,10 +920,10 @@
922
920
  :readonly="sameAsCurrentAddress"
923
921
  :items="permanentCitiesMunicipalities"
924
922
  item-title="name"
925
- item-value="name"
923
+ item-value="code"
926
924
  :return-object="false"
927
925
  :hide-no-data="false"
928
- :disabled="!enrollment.address.permanent.province"
926
+ :disabled="sameAsCurrentAddress"
929
927
  :loading="loadingPermanentCityMun"
930
928
  >
931
929
  <template v-slot:no-data>
@@ -942,34 +940,77 @@
942
940
  </v-row>
943
941
  </v-col>
944
942
 
943
+ <v-col cols="2">
944
+ <v-row no-gutters>
945
+ <InputLabel class="text-capitalize" title="Zip Code" />
946
+ <v-col cols="12">
947
+ <v-text-field
948
+ v-model="enrollment.address.permanent.zipCode"
949
+ :readonly="sameAsCurrentAddress"
950
+ ></v-text-field>
951
+ </v-col>
952
+ </v-row>
953
+ </v-col>
954
+ </v-row>
955
+ </v-col>
956
+
957
+ <v-col cols="12">
958
+ <v-row>
945
959
  <v-col cols="3">
946
960
  <v-row no-gutters>
947
961
  <InputLabel
948
962
  class="text-capitalize"
949
- title="Country"
963
+ title="Barangay"
950
964
  required
951
965
  />
952
966
  <v-col cols="12">
953
- <v-text-field
954
- v-model="enrollment.address.permanent.country"
967
+ <v-combobox
968
+ v-model="enrollment.address.permanent.barangay"
955
969
  :rules="[requiredRule]"
956
970
  :readonly="sameAsCurrentAddress"
971
+ :items="permanentBarangays"
972
+ item-title="name"
973
+ item-value="code"
974
+ :return-object="false"
975
+ :hide-no-data="false"
976
+ :disabled="
977
+ !enrollment.address.permanent.municipalityCity ||
978
+ sameAsCurrentAddress
979
+ "
980
+ :loading="loadingPermanentBarangay"
981
+ >
982
+ <template v-slot:no-data>
983
+ <v-list-item>
984
+ <v-list-item-title>
985
+ No results matching "<strong>search</strong>".
986
+ Press
987
+ <kbd>enter</kbd> to create a new one
988
+ </v-list-item-title>
989
+ </v-list-item>
990
+ </template>
991
+ </v-combobox>
992
+ </v-col>
993
+ </v-row>
994
+ </v-col>
995
+
996
+ <v-col cols="3">
997
+ <v-row no-gutters>
998
+ <InputLabel class="text-capitalize" title="Street" />
999
+ <v-col cols="12">
1000
+ <v-text-field
1001
+ v-model="enrollment.address.permanent.streetName"
1002
+ :readonly="sameAsCurrentAddress"
957
1003
  ></v-text-field>
958
1004
  </v-col>
959
1005
  </v-row>
960
1006
  </v-col>
961
1007
 
962
- <v-col cols="2">
1008
+ <v-col cols="3">
963
1009
  <v-row no-gutters>
964
- <InputLabel
965
- class="text-capitalize"
966
- title="Zip Code"
967
- required
968
- />
1010
+ <InputLabel class="text-capitalize" title="House No." />
969
1011
  <v-col cols="12">
970
1012
  <v-text-field
971
- v-model="enrollment.address.permanent.zipCode"
972
- :rules="[requiredRule]"
1013
+ v-model="enrollment.address.permanent.houseNumber"
973
1014
  :readonly="sameAsCurrentAddress"
974
1015
  ></v-text-field>
975
1016
  </v-col>
@@ -1332,21 +1373,21 @@
1332
1373
  </v-col>
1333
1374
  </v-row>
1334
1375
  </v-col>
1335
- </v-row>
1336
- </v-col>
1337
1376
 
1338
- <v-col cols="8">
1339
- <v-row no-gutters>
1340
- <InputLabel
1341
- class="text-capitalize"
1342
- title="Last School Attended"
1343
- :required="!isKindergarten"
1344
- />
1345
- <v-col cols="12">
1346
- <v-text-field
1347
- v-model="enrollment.returningLearnerInfo.lastSchoolAttended"
1348
- :rules="isKindergarten ? [] : [requiredRule]"
1349
- ></v-text-field>
1377
+ <v-col cols="6">
1378
+ <v-row no-gutters>
1379
+ <InputLabel
1380
+ class="text-capitalize"
1381
+ title="Last School Attended"
1382
+ :required="!isKindergarten"
1383
+ />
1384
+ <v-col cols="12">
1385
+ <v-text-field
1386
+ v-model="enrollment.returningLearnerInfo.lastSchoolAttended"
1387
+ :rules="isKindergarten ? [] : [requiredRule]"
1388
+ ></v-text-field>
1389
+ </v-col>
1390
+ </v-row>
1350
1391
  </v-col>
1351
1392
  </v-row>
1352
1393
  </v-col>
@@ -1609,43 +1650,73 @@ watchEffect(() => {
1609
1650
  });
1610
1651
 
1611
1652
  const currentCitiesMunicipalities = ref<Array<Record<string, any>>>([]);
1612
- const selectedCurrentProvince = computed(() => {
1613
- const province = currentProvinces.value.find(
1614
- (p) => p.name === enrollment.value.address.current.province
1615
- );
1616
1653
 
1617
- if (!province) {
1618
- return "";
1654
+ const loadingCurrentCityMun = ref(false);
1655
+
1656
+ const getCurrentCityMun = debounce(async () => {
1657
+ try {
1658
+ loadingCurrentCityMun.value = true;
1659
+ const res = await getAllPSGC({
1660
+ type: "City",
1661
+ prefix: enrollment.value.address.current.province
1662
+ ? enrollment.value.address.current.province.slice(0, 5)
1663
+ : "",
1664
+ limit: 1700,
1665
+ });
1666
+
1667
+ currentCitiesMunicipalities.value = res.items.map((i: any) => ({
1668
+ ...i,
1669
+ props: {
1670
+ subtitle: `${i.region}${i.province ? ` - ${i.province}` : ""}`,
1671
+ },
1672
+ }));
1673
+ } catch (error) {
1674
+ currentCitiesMunicipalities.value = [];
1675
+ } finally {
1676
+ loadingCurrentCityMun.value = false;
1677
+ }
1678
+ }, 500);
1679
+
1680
+ watch(
1681
+ () => enrollment.value.address.current.province,
1682
+ () => {
1683
+ getCurrentCityMun();
1619
1684
  }
1685
+ );
1686
+
1687
+ getCurrentCityMun();
1620
1688
 
1621
- return province.code;
1689
+ // Current Address - Barangays
1690
+ const currentBarangays = ref<Array<Record<string, any>>>([]);
1691
+ const selectedCurrentCityMun = computed(() => {
1692
+ return enrollment.value.address.current.municipalityCity || "";
1622
1693
  });
1623
1694
 
1624
- const loadingCurrentCityMun = ref(false);
1695
+ const loadingCurrentBarangay = ref(false);
1625
1696
 
1626
- const getCurrentCityMun = debounce(async () => {
1627
- if (!selectedCurrentProvince.value) {
1628
- currentCitiesMunicipalities.value = [];
1697
+ const getCurrentBarangays = debounce(async () => {
1698
+ if (!selectedCurrentCityMun.value) {
1699
+ currentBarangays.value = [];
1629
1700
  return;
1630
1701
  }
1631
1702
 
1632
1703
  try {
1633
- loadingCurrentCityMun.value = true;
1704
+ loadingCurrentBarangay.value = true;
1634
1705
  const res = await getAllPSGC({
1635
- type: "City",
1636
- prefix: selectedCurrentProvince.value.slice(0, 5),
1637
- limit: 2000,
1706
+ type: "Bgy",
1707
+ prefix: selectedCurrentCityMun.value.slice(0, 7),
1708
+ limit: 1000,
1638
1709
  });
1639
- currentCitiesMunicipalities.value = res.items;
1710
+ currentBarangays.value = res.items;
1640
1711
  } catch (error) {
1641
- currentCitiesMunicipalities.value = [];
1712
+ currentBarangays.value = [];
1642
1713
  } finally {
1643
- loadingCurrentCityMun.value = false;
1714
+ loadingCurrentBarangay.value = false;
1644
1715
  }
1645
1716
  }, 500);
1646
1717
 
1647
- watch(selectedCurrentProvince, () => {
1648
- getCurrentCityMun();
1718
+ watch(selectedCurrentCityMun, () => {
1719
+ getCurrentBarangays();
1649
1720
  });
1650
1721
 
1651
1722
  // Permanent Address - Province and City/Municipality
@@ -1670,46 +1741,310 @@ watchEffect(() => {
1670
1741
  });
1671
1742
 
1672
1743
  const permanentCitiesMunicipalities = ref<Array<Record<string, any>>>([]);
1673
- const selectedPermanentProvince = computed(() => {
1674
- const province = permanentProvinces.value.find(
1675
- (p) => p.name === enrollment.value.address.permanent.province
1676
- );
1677
1744
 
1678
- if (!province) {
1679
- return "";
1745
+ const loadingPermanentCityMun = ref(false);
1746
+
1747
+ const getPermanentCityMun = debounce(async () => {
1748
+ try {
1749
+ loadingPermanentCityMun.value = true;
1750
+ const res = await getAllPSGC({
1751
+ type: "City",
1752
+ prefix: enrollment.value.address.permanent.province
1753
+ ? enrollment.value.address.permanent.province.slice(0, 5)
1754
+ : "",
1755
+ limit: 1700,
1756
+ });
1757
+
1758
+ permanentCitiesMunicipalities.value = res.items.map((i: any) => ({
1759
+ ...i,
1760
+ props: {
1761
+ subtitle: `${i.region}${i.province ? ` - ${i.province}` : ""}`,
1762
+ },
1763
+ }));
1764
+ } catch (error) {
1765
+ permanentCitiesMunicipalities.value = [];
1766
+ } finally {
1767
+ loadingPermanentCityMun.value = false;
1768
+ }
1769
+ }, 500);
1770
+
1771
+ watch(
1772
+ () => enrollment.value.address.permanent.province,
1773
+ () => {
1774
+ getPermanentCityMun();
1680
1775
  }
1776
+ );
1777
+
1778
+ getPermanentCityMun();
1681
1779
 
1682
- return province.code;
1780
+ // Permanent Address - Barangays
1781
+ const permanentBarangays = ref<Array<Record<string, any>>>([]);
1782
+ const selectedPermanentCityMun = computed(() => {
1783
+ return enrollment.value.address.permanent.municipalityCity || "";
1683
1784
  });
1684
1785
 
1685
- const loadingPermanentCityMun = ref(false);
1786
+ const loadingPermanentBarangay = ref(false);
1686
1787
 
1687
- const getPermanentCityMun = debounce(async () => {
1688
- if (!selectedPermanentProvince.value) {
1689
- permanentCitiesMunicipalities.value = [];
1788
+ const getPermanentBarangays = debounce(async () => {
1789
+ if (!selectedPermanentCityMun.value) {
1790
+ permanentBarangays.value = [];
1690
1791
  return;
1691
1792
  }
1692
1793
 
1693
1794
  try {
1694
- loadingPermanentCityMun.value = true;
1795
+ loadingPermanentBarangay.value = true;
1695
1796
  const res = await getAllPSGC({
1696
- type: "City",
1697
- prefix: selectedPermanentProvince.value.slice(0, 5),
1698
- limit: 2000,
1797
+ type: "Bgy",
1798
+ prefix: selectedPermanentCityMun.value.slice(0, 7),
1799
+ limit: 1000,
1699
1800
  });
1700
- permanentCitiesMunicipalities.value = res.items;
1801
+ permanentBarangays.value = res.items;
1701
1802
  } catch (error) {
1702
- permanentCitiesMunicipalities.value = [];
1803
+ permanentBarangays.value = [];
1703
1804
  } finally {
1704
- loadingPermanentCityMun.value = false;
1805
+ loadingPermanentBarangay.value = false;
1705
1806
  }
1706
1807
  }, 500);
1707
1808
 
1708
- watch(selectedPermanentProvince, () => {
1709
- getPermanentCityMun();
1809
+ watch(selectedPermanentCityMun, () => {
1810
+ getPermanentBarangays();
1710
1811
  });
1711
1812
 
1712
- const { getAll } = useProgram();
1813
+ const birthCitiesMunicipalities = ref<Array<Record<string, any>>>([]);
1814
+
1815
+ const loadingBirthCityMun = ref(false);
1816
+
1817
+ const getBirthCityMun = debounce(async () => {
1818
+ try {
1819
+ loadingBirthCityMun.value = true;
1820
+ const res = await getAllPSGC({
1821
+ type: "City",
1822
+ limit: 1700,
1823
+ });
1824
+
1825
+ birthCitiesMunicipalities.value = res.items.map((i: any) => ({
1826
+ ...i,
1827
+ props: {
1828
+ subtitle: `${i.region}${i.province ? ` - ${i.province}` : ""}`,
1829
+ },
1830
+ }));
1831
+ } catch (error) {
1832
+ birthCitiesMunicipalities.value = [];
1833
+ } finally {
1834
+ loadingBirthCityMun.value = false;
1835
+ }
1836
+ }, 500);
1837
+
1838
+ getBirthCityMun();
1839
+
1840
+ // Auto-fill place of birth city/municipality name when selected
1841
+ watch(
1842
+ () => enrollment.value.learnerInfo.placeOfBirth.cityMunicipality,
1843
+ (cityMunCode) => {
1844
+ if (!cityMunCode) {
1845
+ enrollment.value.learnerInfo.placeOfBirth.cityMunicipalityName = "";
1846
+ return;
1847
+ }
1848
+
1849
+ const cityMun = birthCitiesMunicipalities.value.find(
1850
+ (c) => c.code === cityMunCode
1851
+ );
1852
+ if (cityMun) {
1853
+ enrollment.value.learnerInfo.placeOfBirth.cityMunicipalityName =
1854
+ cityMun.name;
1855
+ enrollment.value.learnerInfo.placeOfBirth.province = cityMun.province
1856
+ ? cityMun.code.slice(0, 5) + "00000"
1857
+ : "";
1858
+ enrollment.value.learnerInfo.placeOfBirth.provinceName =
1859
+ cityMun.province ?? "";
1860
+ enrollment.value.learnerInfo.placeOfBirth.region =
1861
+ cityMun.code.slice(0, 2) + "00000000";
1862
+ enrollment.value.learnerInfo.placeOfBirth.regionName = cityMun.region;
1863
+ }
1864
+ }
1865
+ );
1866
+
1867
+ // Auto-fill current address province name when province is selected
1868
+ watch(
1869
+ () => enrollment.value.address.current.province,
1870
+ (provinceCode) => {
1871
+ if (!provinceCode) {
1872
+ enrollment.value.address.current.provinceName = "";
1873
+ enrollment.value.address.current.municipalityCity = "";
1874
+ enrollment.value.address.current.municipalityCityName = "";
1875
+ enrollment.value.address.current.barangay = "";
1876
+ enrollment.value.address.current.barangayName = "";
1877
+ enrollment.value.address.current.streetName = "";
1878
+ enrollment.value.address.current.houseNumber = "";
1879
+ return;
1880
+ }
1881
+
1882
+ // Clear dependent fields when province changes
1883
+ enrollment.value.address.current.municipalityCity = "";
1884
+ enrollment.value.address.current.municipalityCityName = "";
1885
+ enrollment.value.address.current.barangay = "";
1886
+ enrollment.value.address.current.barangayName = "";
1887
+ enrollment.value.address.current.streetName = "";
1888
+ enrollment.value.address.current.houseNumber = "";
1889
+
1890
+ const province = currentProvinces.value.find(
1891
+ (p) => p.code === provinceCode
1892
+ );
1893
+ if (province) {
1894
+ enrollment.value.address.current.provinceName = province.name;
1895
+ }
1896
+ }
1897
+ );
1898
+
1899
+ // Auto-fill current address city/municipality, province, and region when selected
1900
+ watch(
1901
+ () => enrollment.value.address.current.municipalityCity,
1902
+ (cityMunCode) => {
1903
+ if (!cityMunCode) {
1904
+ enrollment.value.address.current.municipalityCityName = "";
1905
+ enrollment.value.address.current.barangay = "";
1906
+ enrollment.value.address.current.barangayName = "";
1907
+ enrollment.value.address.current.streetName = "";
1908
+ enrollment.value.address.current.houseNumber = "";
1909
+ return;
1910
+ }
1911
+
1912
+ // Clear dependent fields when city/municipality changes
1913
+ enrollment.value.address.current.barangay = "";
1914
+ enrollment.value.address.current.barangayName = "";
1915
+ enrollment.value.address.current.streetName = "";
1916
+ enrollment.value.address.current.houseNumber = "";
1917
+
1918
+ const cityMun = currentCitiesMunicipalities.value.find(
1919
+ (c) => c.code === cityMunCode
1920
+ );
1921
+ if (cityMun) {
1922
+ enrollment.value.address.current.municipalityCityName = cityMun.name;
1923
+ enrollment.value.address.current.province = cityMun.province
1924
+ ? cityMun.code.slice(0, 5) + "00000"
1925
+ : "";
1926
+ enrollment.value.address.current.provinceName = cityMun.province ?? "";
1927
+ enrollment.value.address.current.region =
1928
+ cityMun.code.slice(0, 2) + "00000000";
1929
+ enrollment.value.address.current.regionName = cityMun.region;
1930
+ }
1931
+ }
1932
+ );
1933
+
1934
+ // Auto-fill current address barangay name when selected
1935
+ watch(
1936
+ () => enrollment.value.address.current.barangay,
1937
+ (barangayCode) => {
1938
+ if (!barangayCode) {
1939
+ enrollment.value.address.current.barangayName = "";
1940
+ return;
1941
+ }
1942
+
1943
+ const barangay = currentBarangays.value.find(
1944
+ (b) => b.code === barangayCode
1945
+ );
1946
+ if (barangay) {
1947
+ enrollment.value.address.current.barangayName = barangay.name;
1948
+ }
1949
+ }
1950
+ );
1951
+
1952
+ // Auto-fill permanent address province name when province is selected
1953
+ watch(
1954
+ () => enrollment.value.address.permanent.province,
1955
+ (provinceCode) => {
1956
+ // Don't clear fields if permanent address is same as current address
1957
+ if (sameAsCurrentAddress.value) {
1958
+ return;
1959
+ }
1960
+
1961
+ if (!provinceCode) {
1962
+ enrollment.value.address.permanent.provinceName = "";
1963
+ enrollment.value.address.permanent.municipalityCity = "";
1964
+ enrollment.value.address.permanent.municipalityCityName = "";
1965
+ enrollment.value.address.permanent.barangay = "";
1966
+ enrollment.value.address.permanent.barangayName = "";
1967
+ enrollment.value.address.permanent.streetName = "";
1968
+ enrollment.value.address.permanent.houseNumber = "";
1969
+ return;
1970
+ }
1971
+
1972
+ // Clear dependent fields when province changes
1973
+ enrollment.value.address.permanent.municipalityCity = "";
1974
+ enrollment.value.address.permanent.municipalityCityName = "";
1975
+ enrollment.value.address.permanent.barangay = "";
1976
+ enrollment.value.address.permanent.barangayName = "";
1977
+ enrollment.value.address.permanent.streetName = "";
1978
+ enrollment.value.address.permanent.houseNumber = "";
1979
+
1980
+ const province = permanentProvinces.value.find(
1981
+ (p) => p.code === provinceCode
1982
+ );
1983
+ if (province) {
1984
+ enrollment.value.address.permanent.provinceName = province.name;
1985
+ }
1986
+ }
1987
+ );
1988
+
1989
+ // Auto-fill permanent address city/municipality, province, and region when selected
1990
+ watch(
1991
+ () => enrollment.value.address.permanent.municipalityCity,
1992
+ (cityMunCode) => {
1993
+ // Don't clear fields if permanent address is same as current address
1994
+ if (sameAsCurrentAddress.value) {
1995
+ return;
1996
+ }
1997
+
1998
+ if (!cityMunCode) {
1999
+ enrollment.value.address.permanent.municipalityCityName = "";
2000
+ enrollment.value.address.permanent.barangay = "";
2001
+ enrollment.value.address.permanent.barangayName = "";
2002
+ enrollment.value.address.permanent.streetName = "";
2003
+ enrollment.value.address.permanent.houseNumber = "";
2004
+ return;
2005
+ }
2006
+
2007
+ // Clear dependent fields when city/municipality changes
2008
+ enrollment.value.address.permanent.barangay = "";
2009
+ enrollment.value.address.permanent.barangayName = "";
2010
+ enrollment.value.address.permanent.streetName = "";
2011
+ enrollment.value.address.permanent.houseNumber = "";
2012
+
2013
+ const cityMun = permanentCitiesMunicipalities.value.find(
2014
+ (c) => c.code === cityMunCode
2015
+ );
2016
+ if (cityMun) {
2017
+ enrollment.value.address.permanent.municipalityCityName = cityMun.name;
2018
+ enrollment.value.address.permanent.province = cityMun.province
2019
+ ? cityMun.code.slice(0, 5) + "00000"
2020
+ : "";
2021
+ enrollment.value.address.permanent.provinceName = cityMun.province ?? "";
2022
+ enrollment.value.address.permanent.region =
2023
+ cityMun.code.slice(0, 2) + "00000000";
2024
+ enrollment.value.address.permanent.regionName = cityMun.region;
2025
+ }
2026
+ }
2027
+ );
2028
+
2029
+ // Auto-fill permanent address barangay name when selected
2030
+ watch(
2031
+ () => enrollment.value.address.permanent.barangay,
2032
+ (barangayCode) => {
2033
+ if (!barangayCode) {
2034
+ enrollment.value.address.permanent.barangayName = "";
2035
+ return;
2036
+ }
2037
+
2038
+ const barangay = permanentBarangays.value.find(
2039
+ (b) => b.code === barangayCode
2040
+ );
2041
+ if (barangay) {
2042
+ enrollment.value.address.permanent.barangayName = barangay.name;
2043
+ }
2044
+ }
2045
+ );
2046
+
2047
+ const { getAll: getSpecialPrograms } = useProgram();
1713
2048
 
1714
2049
  const programs = ref<Array<Record<string, any>>>([]);
1715
2050
 
@@ -1718,7 +2053,7 @@ const enrollmentSchool = computed(() => enrollment.value.school);
1718
2053
  const { data: getPrograms } = await useLazyAsyncData(
1719
2054
  `get-programs-as-options-enrollment-form-${enrollment.value.school}`,
1720
2055
  () =>
1721
- getAll({
2056
+ getSpecialPrograms({
1722
2057
  limit: 20,
1723
2058
  school: enrollment.value.school,
1724
2059
  }),
@@ -1756,19 +2091,11 @@ watchEffect(() => {
1756
2091
  });
1757
2092
 
1758
2093
  const hasSpecialProgram = computed(() => {
1759
- if (!programs.value.length) {
1760
- return false;
1761
- }
1762
-
1763
- const juniorHigh = ["grade-7", "grade-8", "grade-9", "grade-10"];
1764
-
1765
- const isJuniorHigh = juniorHigh.includes(enrollment.value.gradeLevel);
1766
-
1767
- if (isJuniorHigh && programs.value.length > 0) {
1768
- return true;
1769
- }
2094
+ const program = programs.value.filter((i) =>
2095
+ i.gradeLevels.includes(enrollment.value.gradeLevel)
2096
+ );
1770
2097
 
1771
- return false;
2098
+ return program.length > 0;
1772
2099
  });
1773
2100
 
1774
2101
  const schools = ref<TSchool[]>([]);
@@ -1871,7 +2198,9 @@ watch(selectedSchool, (val) => {
1871
2198
  watch(
1872
2199
  () => enrollment.value.gradeLevel,
1873
2200
  () => {
1874
- enrollment.value.returningLearnerInfo.lastGradeLevelCompleted = "";
2201
+ if (enrollment.value.returningLearnerInfo) {
2202
+ enrollment.value.returningLearnerInfo.lastGradeLevelCompleted = "";
2203
+ }
1875
2204
  }
1876
2205
  );
1877
2206
 
@@ -1953,11 +2282,16 @@ const allowedLastGradeLevels = computed(() => {
1953
2282
  const currentIndex = gradeOrder.indexOf(currentGrade);
1954
2283
  if (currentIndex === -1) return gradeLevels;
1955
2284
 
2285
+ // Special case for grade-1: include both kindergarten and kinder
2286
+ let startIndex;
2287
+ if (currentGrade === "grade-1") {
2288
+ startIndex = 0; // Include from kindergarten
2289
+ } else {
2290
+ startIndex = Math.max(0, currentIndex - 1);
2291
+ }
2292
+
1956
2293
  // Get grades that are equal to or one level below current grade
1957
- const allowedGrades = gradeOrder.slice(
1958
- Math.max(0, currentIndex - 1),
1959
- currentIndex + 1
1960
- );
2294
+ const allowedGrades = gradeOrder.slice(startIndex, currentIndex + 1);
1961
2295
 
1962
2296
  // Filter gradeLevels to only include allowed grades
1963
2297
  return gradeLevels.filter((level) => {
@@ -2064,7 +2398,12 @@ watch(enrollment, (val) => {
2064
2398
  enrollment.value.learnerInfo.lastName = "";
2065
2399
  enrollment.value.learnerInfo.extensionName = "";
2066
2400
  enrollment.value.learnerInfo.birthDate = "";
2067
- enrollment.value.learnerInfo.placeOfBirth = "";
2401
+ enrollment.value.learnerInfo.placeOfBirth.region = "";
2402
+ enrollment.value.learnerInfo.placeOfBirth.regionName = "";
2403
+ enrollment.value.learnerInfo.placeOfBirth.province = "";
2404
+ enrollment.value.learnerInfo.placeOfBirth.provinceName = "";
2405
+ enrollment.value.learnerInfo.placeOfBirth.cityMunicipality = "";
2406
+ enrollment.value.learnerInfo.placeOfBirth.cityMunicipalityName = "";
2068
2407
  enrollment.value.learnerInfo.sex = "";
2069
2408
  enrollment.value.learnerInfo.motherTongue = "";
2070
2409
  enrollment.value.learnerInfo.age = 0;
@@ -2088,16 +2427,26 @@ watch(enrollment, (val) => {
2088
2427
  enrollment.value.address.current.streetName = "";
2089
2428
  enrollment.value.address.current.sitio = "";
2090
2429
  enrollment.value.address.current.barangay = "";
2430
+ enrollment.value.address.current.barangayName = "";
2091
2431
  enrollment.value.address.current.municipalityCity = "";
2432
+ enrollment.value.address.current.municipalityCityName = "";
2092
2433
  enrollment.value.address.current.province = "";
2434
+ enrollment.value.address.current.provinceName = "";
2435
+ enrollment.value.address.current.region = "";
2436
+ enrollment.value.address.current.regionName = "";
2093
2437
  enrollment.value.address.current.country = "Philippines";
2094
2438
  enrollment.value.address.current.zipCode = "";
2095
2439
  enrollment.value.address.permanent.houseNumber = "";
2096
2440
  enrollment.value.address.permanent.streetName = "";
2097
2441
  enrollment.value.address.permanent.sitio = "";
2098
2442
  enrollment.value.address.permanent.barangay = "";
2443
+ enrollment.value.address.permanent.barangayName = "";
2099
2444
  enrollment.value.address.permanent.municipalityCity = "";
2445
+ enrollment.value.address.permanent.municipalityCityName = "";
2100
2446
  enrollment.value.address.permanent.province = "";
2447
+ enrollment.value.address.permanent.provinceName = "";
2448
+ enrollment.value.address.permanent.region = "";
2449
+ enrollment.value.address.permanent.regionName = "";
2101
2450
  enrollment.value.address.permanent.country = "Philippines";
2102
2451
  enrollment.value.address.permanent.zipCode = "";
2103
2452
  }
@@ -2113,10 +2462,20 @@ watchEffect(() => {
2113
2462
  enrollment.value.address.current.sitio;
2114
2463
  enrollment.value.address.permanent.barangay =
2115
2464
  enrollment.value.address.current.barangay;
2465
+ enrollment.value.address.permanent.barangayName =
2466
+ enrollment.value.address.current.barangayName;
2116
2467
  enrollment.value.address.permanent.municipalityCity =
2117
2468
  enrollment.value.address.current.municipalityCity;
2469
+ enrollment.value.address.permanent.municipalityCityName =
2470
+ enrollment.value.address.current.municipalityCityName;
2118
2471
  enrollment.value.address.permanent.province =
2119
2472
  enrollment.value.address.current.province;
2473
+ enrollment.value.address.permanent.provinceName =
2474
+ enrollment.value.address.current.provinceName;
2475
+ enrollment.value.address.permanent.region =
2476
+ enrollment.value.address.current.region;
2477
+ enrollment.value.address.permanent.regionName =
2478
+ enrollment.value.address.current.regionName;
2120
2479
  enrollment.value.address.permanent.country =
2121
2480
  enrollment.value.address.current.country || "Philippines";
2122
2481
  enrollment.value.address.permanent.zipCode =
@@ -2126,8 +2485,13 @@ watchEffect(() => {
2126
2485
  enrollment.value.address.permanent.streetName = "";
2127
2486
  enrollment.value.address.permanent.sitio = "";
2128
2487
  enrollment.value.address.permanent.barangay = "";
2488
+ enrollment.value.address.permanent.barangayName = "";
2129
2489
  enrollment.value.address.permanent.municipalityCity = "";
2490
+ enrollment.value.address.permanent.municipalityCityName = "";
2130
2491
  enrollment.value.address.permanent.province = "";
2492
+ enrollment.value.address.permanent.provinceName = "";
2493
+ enrollment.value.address.permanent.region = "";
2494
+ enrollment.value.address.permanent.regionName = "";
2131
2495
  enrollment.value.address.permanent.country = "Philippines";
2132
2496
  enrollment.value.address.permanent.zipCode = "";
2133
2497
  }