catchup-library-web 1.0.2 → 1.0.4

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.
Files changed (32) hide show
  1. package/dist/index.d.mts +305 -2
  2. package/dist/index.d.ts +305 -2
  3. package/dist/index.js +2768 -334
  4. package/dist/index.mjs +2657 -292
  5. package/package.json +1 -1
  6. package/src/components/boxes/SelectionBox.tsx +41 -0
  7. package/src/components/boxes/SelectionCheckbox.tsx +66 -0
  8. package/src/components/labels/ActivityTemplateLabel.tsx +15 -0
  9. package/src/components/labels/BrandLabel.tsx +19 -0
  10. package/src/components/labels/CoterieLabel.tsx +11 -0
  11. package/src/components/labels/GradeLabel.tsx +11 -0
  12. package/src/components/labels/OutcomeLabel.tsx +15 -0
  13. package/src/components/labels/PersonalLabel.tsx +23 -0
  14. package/src/components/labels/PublishingHouseLabel.tsx +23 -0
  15. package/src/components/modals/BaseModal.tsx +56 -0
  16. package/src/components/tabs/SelectionTab.tsx +45 -0
  17. package/src/index.ts +25 -0
  18. package/src/properties/BoxProperties.ts +12 -0
  19. package/src/properties/GroupProperties.ts +1 -1
  20. package/src/properties/LabelProperties.ts +33 -0
  21. package/src/properties/ModalProperties.ts +8 -0
  22. package/src/properties/TabProperties.ts +9 -0
  23. package/src/utilization/AuthorizationUtilization.ts +15 -0
  24. package/src/utilization/CategoryUtilization.ts +314 -0
  25. package/src/utilization/DateUtilization.ts +85 -0
  26. package/src/utilization/FunctionUtilization.ts +50 -0
  27. package/src/utilization/GamificationUtilization.ts +495 -0
  28. package/src/utilization/IndividualModelUtilization.ts +48 -0
  29. package/src/utilization/ManagementUtilization.ts +1201 -0
  30. package/src/utilization/NotificationUtilization.ts +59 -0
  31. package/src/utilization/ReportUtilization.ts +42 -0
  32. package/src/utilization/TokenUtilization.ts +39 -0
@@ -0,0 +1,1201 @@
1
+ import i18n from "../language/i18n";
2
+
3
+ export const retrieveBrandDTOByUserProfileOptionList = (userProfile: any) => {
4
+ const brandDTOOptionList = [];
5
+ if (userProfile) {
6
+ for (const branchDTO of userProfile.branchDTOList) {
7
+ const currentBrand =
8
+ branchDTO.gradeDTO.seasonDTO.institutionDTO.campusDTO.brandDTO;
9
+ if (
10
+ brandDTOOptionList.findIndex(
11
+ (brandDTOOption) => brandDTOOption.value === currentBrand.id
12
+ ) === -1
13
+ ) {
14
+ brandDTOOptionList.push({
15
+ value: currentBrand.id,
16
+ fullValue: currentBrand,
17
+ text: currentBrand.name,
18
+ });
19
+ }
20
+ }
21
+ for (const gradeDTO of userProfile.gradeDTOList) {
22
+ const currentBrand = gradeDTO.seasonDTO.institutionDTO.campusDTO.brandDTO;
23
+ if (
24
+ brandDTOOptionList.findIndex(
25
+ (brandDTOOption) => brandDTOOption.value === currentBrand.id
26
+ ) === -1
27
+ ) {
28
+ brandDTOOptionList.push({
29
+ value: currentBrand.id,
30
+ fullValue: currentBrand,
31
+ text: currentBrand.name,
32
+ });
33
+ }
34
+ }
35
+ for (const seasonDTO of userProfile.seasonDTOList) {
36
+ const currentBrand = seasonDTO.institutionDTO.campusDTO.brandDTO;
37
+ if (
38
+ brandDTOOptionList.findIndex(
39
+ (brandDTOOption) => brandDTOOption.value === currentBrand.id
40
+ ) === -1
41
+ ) {
42
+ brandDTOOptionList.push({
43
+ value: currentBrand.id,
44
+ fullValue: currentBrand,
45
+ text: currentBrand.name,
46
+ });
47
+ }
48
+ }
49
+ for (const institutionDTO of userProfile.institutionDTOList) {
50
+ const currentBrand = institutionDTO.campusDTO.brandDTO;
51
+ if (
52
+ brandDTOOptionList.findIndex(
53
+ (brandDTOOption) => brandDTOOption.value === currentBrand.id
54
+ ) === -1
55
+ ) {
56
+ brandDTOOptionList.push({
57
+ value: currentBrand.id,
58
+ fullValue: currentBrand,
59
+ text: currentBrand.name,
60
+ });
61
+ }
62
+ }
63
+ for (const campusDTO of userProfile.campusDTOList) {
64
+ const currentBrand = campusDTO.brandDTO;
65
+ if (
66
+ brandDTOOptionList.findIndex(
67
+ (brandDTOOption) => brandDTOOption.value === currentBrand.id
68
+ ) === -1
69
+ ) {
70
+ brandDTOOptionList.push({
71
+ value: currentBrand.id,
72
+ fullValue: currentBrand,
73
+ text: currentBrand.name,
74
+ });
75
+ }
76
+ }
77
+ for (const brandDTO of userProfile.brandDTOList) {
78
+ const currentBrand = brandDTO;
79
+ if (
80
+ brandDTOOptionList.findIndex(
81
+ (brandDTOOption) => brandDTOOption.value === currentBrand.id
82
+ ) === -1
83
+ ) {
84
+ brandDTOOptionList.push({
85
+ value: currentBrand.id,
86
+ fullValue: currentBrand,
87
+ text: currentBrand.name,
88
+ });
89
+ }
90
+ }
91
+ }
92
+
93
+ return brandDTOOptionList;
94
+ };
95
+
96
+ export const retrieveBrandDTOOptionList = (brandDTOList: any) => {
97
+ return brandDTOList.map((brandDTO: any) => ({
98
+ value: brandDTO.id,
99
+ text: brandDTO.name,
100
+ fullValue: brandDTO,
101
+ }));
102
+ };
103
+
104
+ export const retrieveCampusDTOOptionList = (campusDTOList: any) => {
105
+ return campusDTOList.map((campusDTO: any) => ({
106
+ value: campusDTO.id,
107
+ text: `${campusDTO.name} (${campusDTO.brandDTO.name})`,
108
+ fullValue: campusDTO,
109
+ }));
110
+ };
111
+
112
+ export const retrieveInstitutionDTOOptionList = (institutionDTOList: any) => {
113
+ return institutionDTOList.map((institutionDTO: any) => ({
114
+ value: institutionDTO.id,
115
+ text: `${institutionDTO.name} (${institutionDTO.campusDTO.name} - ${institutionDTO.campusDTO.brandDTO.name})`,
116
+ fullValue: institutionDTO,
117
+ }));
118
+ };
119
+
120
+ export const retrieveSeasonDTOOptionList = (seasonDTOList: any) => {
121
+ return seasonDTOList.map((seasonDTO: any) => ({
122
+ value: seasonDTO.id,
123
+ text: `${seasonDTO.name} (${seasonDTO.institutionDTO.name})`,
124
+ fullValue: seasonDTO,
125
+ // text: `${seasonDTO.name} (${seasonDTO.institutionDTO.name} - ${seasonDTO.institutionDTO.campusDTO.name}/${seasonDTO.institutionDTO.campusDTO.brandDTO.name})`,
126
+ }));
127
+ };
128
+
129
+ export const retrieveGradeDTOOptionList = (gradeDTOList: any) => {
130
+ return gradeDTOList.map((gradeDTO: any) => ({
131
+ value: gradeDTO.id,
132
+ text: `${gradeDTO.name} (${gradeDTO.seasonDTO.name} - ${gradeDTO.seasonDTO.institutionDTO.name})`,
133
+ fullValue: gradeDTO,
134
+ // text: `${gradeDTO.name} (${gradeDTO.seasonDTO.name} ${gradeDTO.seasonDTO.institutionDTO.name} - ${gradeDTO.seasonDTO.institutionDTO.campusDTO.name}/${gradeDTO.seasonDTO.institutionDTO.campusDTO.brandDTO.name})`,
135
+ }));
136
+ };
137
+
138
+ export const retrieveBranchDTOOptionList = (branchDTOList: any) => {
139
+ return branchDTOList.map((branchDTO: any) => ({
140
+ value: branchDTO.id,
141
+ text: `${branchDTO.name} (${branchDTO.gradeDTO.name} - ${branchDTO.gradeDTO.seasonDTO.name}/${branchDTO.gradeDTO.seasonDTO.institutionDTO.name})`,
142
+ fullValue: branchDTO,
143
+ // text: `${branchDTO.name} (${branchDTO.gradeDTO.name} - ${branchDTO.gradeDTO.seasonDTO.name}/${branchDTO.gradeDTO.seasonDTO.institutionDTO.name}/${branchDTO.gradeDTO.seasonDTO.institutionDTO.campusDTO.name}/${branchDTO.gradeDTO.seasonDTO.institutionDTO.campusDTO.brandDTO.name})`,
144
+ }));
145
+ };
146
+
147
+ export const retrieveCampusDTOByUserProfileOptionList = (
148
+ userProfile: any,
149
+ selectedBrandId: any
150
+ ) => {
151
+ const campusDTOOptionList = [];
152
+ if (userProfile) {
153
+ if (selectedBrandId) {
154
+ for (const branchDTO of userProfile.branchDTOList) {
155
+ const currentCampus =
156
+ branchDTO.gradeDTO.seasonDTO.institutionDTO.campusDTO;
157
+ if (
158
+ campusDTOOptionList.findIndex(
159
+ (campusDTOOption) => campusDTOOption.value === currentCampus.id
160
+ ) === -1 &&
161
+ currentCampus.brandDTO.id === parseFloat(selectedBrandId)
162
+ ) {
163
+ campusDTOOptionList.push({
164
+ value: currentCampus.id,
165
+ fullValue: currentCampus,
166
+ text: currentCampus.name,
167
+ });
168
+ }
169
+ }
170
+ for (const gradeDTO of userProfile.gradeDTOList) {
171
+ const currentCampus = gradeDTO.seasonDTO.institutionDTO.campusDTO;
172
+ if (
173
+ campusDTOOptionList.findIndex(
174
+ (campusDTOOption) => campusDTOOption.value === currentCampus.id
175
+ ) === -1 &&
176
+ currentCampus.brandDTO.id === parseFloat(selectedBrandId)
177
+ ) {
178
+ campusDTOOptionList.push({
179
+ value: currentCampus.id,
180
+ fullValue: currentCampus,
181
+ text: currentCampus.name,
182
+ });
183
+ }
184
+ }
185
+ for (const seasonDTO of userProfile.seasonDTOList) {
186
+ const currentCampus = seasonDTO.institutionDTO.campusDTO;
187
+ if (
188
+ campusDTOOptionList.findIndex(
189
+ (campusDTOOption) => campusDTOOption.value === currentCampus.id
190
+ ) === -1 &&
191
+ currentCampus.brandDTO.id === parseFloat(selectedBrandId)
192
+ ) {
193
+ campusDTOOptionList.push({
194
+ value: currentCampus.id,
195
+ fullValue: currentCampus,
196
+ text: currentCampus.name,
197
+ });
198
+ }
199
+ }
200
+ for (const institutionDTO of userProfile.institutionDTOList) {
201
+ const currentCampus = institutionDTO.campusDTO;
202
+ if (
203
+ campusDTOOptionList.findIndex(
204
+ (campusDTOOption) => campusDTOOption.value === currentCampus.id
205
+ ) === -1 &&
206
+ currentCampus.brandDTO.id === parseFloat(selectedBrandId)
207
+ ) {
208
+ campusDTOOptionList.push({
209
+ value: currentCampus.id,
210
+ fullValue: currentCampus,
211
+ text: currentCampus.name,
212
+ });
213
+ }
214
+ }
215
+ for (const campusDTO of userProfile.campusDTOList) {
216
+ const currentCampus = campusDTO;
217
+ if (
218
+ campusDTOOptionList.findIndex(
219
+ (campusDTOOption) => campusDTOOption.value === currentCampus.id
220
+ ) === -1 &&
221
+ currentCampus.brandDTO.id === parseFloat(selectedBrandId)
222
+ ) {
223
+ campusDTOOptionList.push({
224
+ value: currentCampus.id,
225
+ fullValue: currentCampus,
226
+ text: currentCampus.name,
227
+ });
228
+ }
229
+ }
230
+ return campusDTOOptionList;
231
+ }
232
+ }
233
+
234
+ return [];
235
+ };
236
+
237
+ export const retrieveInstitutionDTOByUserProfileOptionList = (
238
+ userProfile: any,
239
+ selectedBrandId: any,
240
+ selectedCampusId: any
241
+ ) => {
242
+ const institutionDTOOptionList = [];
243
+ if (userProfile) {
244
+ if (selectedCampusId) {
245
+ for (const branchDTO of userProfile.branchDTOList) {
246
+ const currentInstitution = branchDTO.gradeDTO.seasonDTO.institutionDTO;
247
+ if (
248
+ institutionDTOOptionList.findIndex(
249
+ (institutionDTOOption) =>
250
+ institutionDTOOption.value === currentInstitution.id
251
+ ) === -1 &&
252
+ currentInstitution.campusDTO.brandDTO.id ===
253
+ parseFloat(selectedBrandId) &&
254
+ currentInstitution.campusDTO.id === parseFloat(selectedCampusId)
255
+ ) {
256
+ institutionDTOOptionList.push({
257
+ value: currentInstitution.id,
258
+ fullValue: currentInstitution,
259
+ text: currentInstitution.name,
260
+ });
261
+ }
262
+ }
263
+ for (const gradeDTO of userProfile.gradeDTOList) {
264
+ const currentInstitution = gradeDTO.seasonDTO.institutionDTO;
265
+ if (
266
+ institutionDTOOptionList.findIndex(
267
+ (institutionDTOOption) =>
268
+ institutionDTOOption.value === currentInstitution.id
269
+ ) === -1 &&
270
+ currentInstitution.campusDTO.brandDTO.id ===
271
+ parseFloat(selectedBrandId) &&
272
+ currentInstitution.campusDTO.id === parseFloat(selectedCampusId)
273
+ ) {
274
+ institutionDTOOptionList.push({
275
+ value: currentInstitution.id,
276
+ fullValue: currentInstitution,
277
+ text: currentInstitution.name,
278
+ });
279
+ }
280
+ }
281
+ for (const seasonDTO of userProfile.seasonDTOList) {
282
+ const currentInstitution = seasonDTO.institutionDTO;
283
+ if (
284
+ institutionDTOOptionList.findIndex(
285
+ (institutionDTOOption) =>
286
+ institutionDTOOption.value === currentInstitution.id
287
+ ) === -1 &&
288
+ currentInstitution.campusDTO.brandDTO.id ===
289
+ parseFloat(selectedBrandId) &&
290
+ currentInstitution.campusDTO.id === parseFloat(selectedCampusId)
291
+ ) {
292
+ institutionDTOOptionList.push({
293
+ value: currentInstitution.id,
294
+ fullValue: currentInstitution,
295
+ text: currentInstitution.name,
296
+ });
297
+ }
298
+ }
299
+ for (const institutionDTO of userProfile.institutionDTOList) {
300
+ const currentInstitution = institutionDTO;
301
+ if (
302
+ institutionDTOOptionList.findIndex(
303
+ (institutionDTOOption) =>
304
+ institutionDTOOption.value === currentInstitution.id
305
+ ) === -1 &&
306
+ currentInstitution.campusDTO.brandDTO.id ===
307
+ parseFloat(selectedBrandId) &&
308
+ currentInstitution.campusDTO.id === parseFloat(selectedCampusId)
309
+ ) {
310
+ institutionDTOOptionList.push({
311
+ value: currentInstitution.id,
312
+ fullValue: currentInstitution,
313
+ text: currentInstitution.name,
314
+ });
315
+ }
316
+ }
317
+ }
318
+ }
319
+ return institutionDTOOptionList;
320
+ };
321
+
322
+ export const retrieveSeasonDTOByUserProfileOptionList = (
323
+ userProfile: any,
324
+ selectedBrandId: any,
325
+ selectedInstitutionId: any
326
+ ) => {
327
+ const seasonDTOOptionList = [];
328
+ if (userProfile) {
329
+ if (selectedInstitutionId) {
330
+ for (const branchDTO of userProfile.branchDTOList) {
331
+ const currentSeason = branchDTO.gradeDTO.seasonDTO;
332
+ if (
333
+ seasonDTOOptionList.findIndex(
334
+ (seasonDTOOption) => seasonDTOOption.value === currentSeason.id
335
+ ) === -1 &&
336
+ currentSeason.institutionDTO.campusDTO.brandDTO.id ===
337
+ parseFloat(selectedBrandId) &&
338
+ currentSeason.institutionDTO.id === parseFloat(selectedInstitutionId)
339
+ ) {
340
+ seasonDTOOptionList.push({
341
+ value: currentSeason.id,
342
+ fullValue: currentSeason,
343
+ text: currentSeason.name,
344
+ });
345
+ }
346
+ }
347
+ for (const gradeDTO of userProfile.gradeDTOList) {
348
+ const currentSeason = gradeDTO.seasonDTO;
349
+ if (
350
+ seasonDTOOptionList.findIndex(
351
+ (seasonDTOOption) => seasonDTOOption.value === currentSeason.id
352
+ ) === -1 &&
353
+ currentSeason.institutionDTO.campusDTO.brandDTO.id ===
354
+ parseFloat(selectedBrandId) &&
355
+ currentSeason.institutionDTO.id === parseFloat(selectedInstitutionId)
356
+ ) {
357
+ seasonDTOOptionList.push({
358
+ value: currentSeason.id,
359
+ fullValue: currentSeason,
360
+ text: currentSeason.name,
361
+ });
362
+ }
363
+ }
364
+ for (const seasonDTO of userProfile.seasonDTOList) {
365
+ const currentSeason = seasonDTO;
366
+ if (
367
+ seasonDTOOptionList.findIndex(
368
+ (seasonDTOOption) => seasonDTOOption.value === currentSeason.id
369
+ ) === -1 &&
370
+ currentSeason.institutionDTO.campusDTO.brandDTO.id ===
371
+ parseFloat(selectedBrandId) &&
372
+ currentSeason.institutionDTO.id === parseFloat(selectedInstitutionId)
373
+ ) {
374
+ seasonDTOOptionList.push({
375
+ value: currentSeason.id,
376
+ fullValue: currentSeason,
377
+ text: currentSeason.name,
378
+ });
379
+ }
380
+ }
381
+ }
382
+ }
383
+ return seasonDTOOptionList;
384
+ };
385
+
386
+ export const retrieveGradeDTOByUserProfileOptionList = (
387
+ userProfile: any,
388
+ selectedBrandId: any,
389
+ selectedSeasonId: any
390
+ ) => {
391
+ const gradeDTOOptionList = [];
392
+ if (userProfile) {
393
+ if (selectedSeasonId) {
394
+ for (const branchDTO of userProfile.branchDTOList) {
395
+ const currentGrade = branchDTO.gradeDTO;
396
+ if (
397
+ gradeDTOOptionList.findIndex(
398
+ (gradeDTOOption) => gradeDTOOption.value === currentGrade.id
399
+ ) === -1 &&
400
+ currentGrade.seasonDTO.institutionDTO.campusDTO.brandDTO.id ===
401
+ parseFloat(selectedBrandId) &&
402
+ currentGrade.seasonDTO.id === parseFloat(selectedSeasonId)
403
+ ) {
404
+ gradeDTOOptionList.push({
405
+ value: currentGrade.id,
406
+ fullValue: currentGrade,
407
+ text: currentGrade.name,
408
+ });
409
+ }
410
+ }
411
+ for (const gradeDTO of userProfile.gradeDTOList) {
412
+ const currentGrade = gradeDTO;
413
+ if (
414
+ gradeDTOOptionList.findIndex(
415
+ (gradeDTOOption) => gradeDTOOption.value === currentGrade.id
416
+ ) === -1 &&
417
+ currentGrade.seasonDTO.institutionDTO.campusDTO.brandDTO.id ===
418
+ parseFloat(selectedBrandId) &&
419
+ currentGrade.seasonDTO.id === parseFloat(selectedSeasonId)
420
+ ) {
421
+ gradeDTOOptionList.push({
422
+ value: currentGrade.id,
423
+ fullValue: currentGrade,
424
+ text: currentGrade.name,
425
+ });
426
+ }
427
+ }
428
+ }
429
+ }
430
+ return gradeDTOOptionList;
431
+ };
432
+
433
+ export const retrieveBranchDTOByUserProfileOptionList = (
434
+ userProfile: any,
435
+ selectedBrandId: any,
436
+ selectedGradeId: any
437
+ ) => {
438
+ const branchDTOOptionList = [];
439
+ if (userProfile) {
440
+ if (selectedGradeId) {
441
+ for (const branchDTO of userProfile.branchDTOList) {
442
+ const currentBranch = branchDTO;
443
+ if (
444
+ branchDTOOptionList.findIndex(
445
+ (branchDTOOption) => branchDTOOption.value === currentBranch.id
446
+ ) === -1 &&
447
+ currentBranch.gradeDTO.seasonDTO.institutionDTO.campusDTO.brandDTO
448
+ .id === parseFloat(selectedBrandId) &&
449
+ currentBranch.gradeDTO.id === parseFloat(selectedGradeId)
450
+ ) {
451
+ branchDTOOptionList.push({
452
+ value: currentBranch.id,
453
+ fullValue: currentBranch,
454
+ text: currentBranch.name,
455
+ });
456
+ }
457
+ }
458
+ }
459
+ }
460
+ return branchDTOOptionList;
461
+ };
462
+
463
+ export const retrieveExternalRegistrationDTOOptionList = (
464
+ externalRegistrationDTOList: any
465
+ ) => {
466
+ return externalRegistrationDTOList.map((externalRegistrationDTO: any) => ({
467
+ value: externalRegistrationDTO.id,
468
+ text: externalRegistrationDTO.name,
469
+ fullValue: externalRegistrationDTO,
470
+ // text: `${seasonDTO.name} (${seasonDTO.institutionDTO.name} - ${seasonDTO.institutionDTO.campusDTO.name}/${seasonDTO.institutionDTO.campusDTO.brandDTO.name})`,
471
+ }));
472
+ };
473
+
474
+ export const retrieveGenderOptionList = () => {
475
+ return [
476
+ {
477
+ value: "MALE",
478
+ text: i18n.t("MALE"),
479
+ },
480
+ {
481
+ value: "FEMALE",
482
+ text: i18n.t("FEMALE"),
483
+ },
484
+ {
485
+ value: "NOT_GIVEN",
486
+ text: i18n.t("NOT_GIVEN"),
487
+ },
488
+ ];
489
+ };
490
+
491
+ export const retrieveEnableOptionList = () => {
492
+ return [
493
+ {
494
+ value: true,
495
+ text: i18n.t("yes"),
496
+ },
497
+ {
498
+ value: false,
499
+ text: i18n.t("no"),
500
+ },
501
+ ];
502
+ };
503
+
504
+ export const retrieveUserRoleOptionList = () => {
505
+ return [
506
+ {
507
+ value: "STAFF",
508
+ text: i18n.t("STAFF"),
509
+ },
510
+ {
511
+ value: "LEARNER",
512
+ text: i18n.t("LEARNER"),
513
+ },
514
+ {
515
+ value: "PARENT",
516
+ text: i18n.t("PARENT"),
517
+ },
518
+ {
519
+ value: "INDIVIDUAL",
520
+ text: i18n.t("INDIVIDUAL"),
521
+ },
522
+ {
523
+ value: "CONTENT_CREATOR",
524
+ text: i18n.t("CONTENT_CREATOR"),
525
+ },
526
+ ];
527
+ };
528
+
529
+ export const filterUserRoleOptionList = (
530
+ accountType: any,
531
+ userProfileRole: any
532
+ ) => {
533
+ if (accountType === "GENIXO") {
534
+ return retrieveUserRoleOptionList().filter(
535
+ (userRoleOption) =>
536
+ userRoleOption.value === "STAFF" ||
537
+ userRoleOption.value === "LEARNER" ||
538
+ userRoleOption.value === "CONTENT_CREATOR"
539
+ );
540
+ } else {
541
+ if (userProfileRole === "STAFF") {
542
+ return retrieveUserRoleOptionList().filter(
543
+ (userRoleOption) =>
544
+ userRoleOption.value === "STAFF" || userRoleOption.value === "LEARNER"
545
+ );
546
+ } else if (userProfileRole === "INDIVIDUAL") {
547
+ return retrieveUserRoleOptionList().filter(
548
+ (userRoleOption) => userRoleOption.value === "LEARNER"
549
+ );
550
+ }
551
+ }
552
+
553
+ return [];
554
+ };
555
+
556
+ export const retrieveDefaultUserRoleOptionList = () => {
557
+ return [
558
+ {
559
+ value: "BASIC",
560
+ text: i18n.t("BASIC"),
561
+ },
562
+ {
563
+ value: "LEARNER",
564
+ text: i18n.t("LEARNER"),
565
+ },
566
+ {
567
+ value: "STAFF_WRITER",
568
+ text: i18n.t("STAFF_WRITER"),
569
+ },
570
+ {
571
+ value: "STAFF_TEACHER",
572
+ text: i18n.t("STAFF_TEACHER"),
573
+ },
574
+ {
575
+ value: "STAFF_COTERIE_MANAGER",
576
+ text: i18n.t("STAFF_COTERIE_MANAGER"),
577
+ },
578
+ {
579
+ value: "STAFF_INSTITUTION_MANAGER",
580
+ text: i18n.t("STAFF_INSTITUTION_MANAGER"),
581
+ },
582
+ {
583
+ value: "STAFF_INSTITUTION_ASSISTANT_MANAGER",
584
+ text: i18n.t("STAFF_INSTITUTION_ASSISTANT_MANAGER"),
585
+ },
586
+ {
587
+ value: "STAFF_CAMPUS_MANAGER",
588
+ text: i18n.t("STAFF_CAMPUS_MANAGER"),
589
+ },
590
+ {
591
+ value: "STAFF_BRAND_MANAGER",
592
+ text: i18n.t("STAFF_BRAND_MANAGER"),
593
+ },
594
+ {
595
+ value: "STAFF_INFORMATION_TECHNOLOGY",
596
+ text: i18n.t("STAFF_INFORMATION_TECHNOLOGY"),
597
+ },
598
+ {
599
+ value: "INDIVIDUAL",
600
+ text: i18n.t("INDIVIDUAL"),
601
+ },
602
+ {
603
+ value: "CONTENT_CREATOR",
604
+ text: i18n.t("CONTENT_CREATOR"),
605
+ },
606
+ ];
607
+ };
608
+
609
+ export const retrieveCountryCodeOptionList = () => {
610
+ return [
611
+ {
612
+ value: "TR",
613
+ text: i18n.t("TR"),
614
+ parent: "TURKEY",
615
+ },
616
+ // {
617
+ // value: "US",
618
+ // text: i18n.t("US"),
619
+ // parent: "UNITED_STATES",
620
+ // },
621
+ // {
622
+ // value: "DE",
623
+ // text: i18n.t("DE"),
624
+ // parent: "GERMANY",
625
+ // },
626
+ ];
627
+ };
628
+
629
+ export const retrieveCountryNameOptionList = () => {
630
+ return [
631
+ {
632
+ value: "TURKEY",
633
+ text: i18n.t("TURKEY"),
634
+ },
635
+ // {
636
+ // value: "UNITED_STATES",
637
+ // text: i18n.t("UNITED_STATES"),
638
+ // },
639
+ // {
640
+ // value: "GERMANY",
641
+ // text: i18n.t("GERMANY"),
642
+ // },
643
+ ];
644
+ };
645
+
646
+ export const retrieveProvinceNameOptionList = () => {
647
+ return [
648
+ // { parent: "TURKEY", value: "ADANA", text: "Adana", code: "01" },
649
+ // { parent: "TURKEY", value: "ADIYAMAN", text: "Adıyaman", code: "02" },
650
+ // { parent: "TURKEY", value: "AFYON", text: "Afyon", code: "03" },
651
+ // { parent: "TURKEY", value: "AGRI", text: "Ağrı", code: "04" },
652
+ // { parent: "TURKEY", value: "AMASYA", text: "Amasya", code: "05" },
653
+ { parent: "TURKEY", value: "ANKARA", text: "Ankara", code: "06" },
654
+ { parent: "TURKEY", value: "ANTALYA", text: "Antalya", code: "07" },
655
+ // { parent: "TURKEY", value: "ARTVIN", text: "Artvin", code: "08" },
656
+ // { parent: "TURKEY", value: "AYDIN", text: "Aydın", code: "09" },
657
+ // { parent: "TURKEY", value: "BALIKESIR", text: "Balıkesir", code: "10" },
658
+ // { parent: "TURKEY", value: "BILECIK", text: "Bilecik", code: "11" },
659
+ // { parent: "TURKEY", value: "BINGOL", text: "Bingöl", code: "12" },
660
+ // { parent: "TURKEY", value: "BITLIS", text: "Bitlis", code: "13" },
661
+ // { parent: "TURKEY", value: "BOLU", text: "Bolu", code: "14" },
662
+ // { parent: "TURKEY", value: "BURDUR", text: "Burdur", code: "15" },
663
+ // { parent: "TURKEY", value: "BURSA", text: "Bursa", code: "16" },
664
+ // { parent: "TURKEY", value: "CANAKKALE", text: "Çanakkale", code: "17" },
665
+ // { parent: "TURKEY", value: "CANKIRI", text: "Çankırı", code: "18" },
666
+ // { parent: "TURKEY", value: "CORUM", text: "Çorum", code: "19" },
667
+ // { parent: "TURKEY", value: "DENIZLI", text: "Denizli", code: "20" },
668
+ // { parent: "TURKEY", value: "DIYARBAKIR", text: "Diyarbakır", code: "21" },
669
+ // { parent: "TURKEY", value: "EDIRNE", text: "Edirne", code: "22" },
670
+ // { parent: "TURKEY", value: "ELAZIG", text: "Elazığ", code: "23" },
671
+ // { parent: "TURKEY", value: "ERZINCAN", text: "Erzincan", code: "24" },
672
+ // { parent: "TURKEY", value: "ERZURUM", text: "Erzurum", code: "25" },
673
+ { parent: "TURKEY", value: "ESKISEHIR", text: "Eskişehir", code: "26" },
674
+ { parent: "TURKEY", value: "GAZIANTEP", text: "Gaziantep", code: "27" },
675
+ // { parent: "TURKEY", value: "GIRESUN", text: "Giresun", code: "28" },
676
+ // { parent: "TURKEY", value: "GUMUSHANE", text: "Gümüşhane", code: "29" },
677
+ // { parent: "TURKEY", value: "HAKKARI", text: "Hakkari", code: "30" },
678
+ // { parent: "TURKEY", value: "HATAY", text: "Hatay", code: "31" },
679
+ // { parent: "TURKEY", value: "ISPARTA", text: "Isparta", code: "32" },
680
+ { parent: "TURKEY", value: "MERSIN", text: "Mersin", code: "33" },
681
+ { parent: "TURKEY", value: "ISTANBUL", text: "İstanbul", code: "34" },
682
+ { parent: "TURKEY", value: "IZMIR", text: "İzmir", code: "35" },
683
+ // { parent: "TURKEY", value: "KARS", text: "Kars", code: "36" },
684
+ // { parent: "TURKEY", value: "KASTAMONU", text: "Kastamonu", code: "37" },
685
+ // { parent: "TURKEY", value: "KAYSERI", text: "Kayseri", code: "38" },
686
+ // { parent: "TURKEY", value: "KIRKLARELI", text: "Kırklareli", code: "39" },
687
+ // { parent: "TURKEY", value: "KIRSEHIR", text: "Kırşehir", code: "40" },
688
+ // { parent: "TURKEY", value: "KOCAELI", text: "Kocaeli", code: "41" },
689
+ // { parent: "TURKEY", value: "KONYA", text: "Konya", code: "42" },
690
+ // { parent: "TURKEY", value: "KUTAHYA", text: "Kütahya", code: "43" },
691
+ // { parent: "TURKEY", value: "MALATYA", text: "Malatya", code: "44" },
692
+ // { parent: "TURKEY", value: "MANISA", text: "Manisa", code: "45" },
693
+ // {
694
+ // parent: "TURKEY",
695
+ // value: "KAHRAMANMARAS",
696
+ // text: "Kahramanmaraş",
697
+ // code: "46",
698
+ // },
699
+ // { parent: "TURKEY", value: "MARDIN", text: "Mardin", code: "47" },
700
+ // { parent: "TURKEY", value: "MUGLA", text: "Muğla", code: "48" },
701
+ // { parent: "TURKEY", value: "MUS", text: "Muş", code: "49" },
702
+ // { parent: "TURKEY", value: "NEVSEHIR", text: "Nevşehir", code: "50" },
703
+ // { parent: "TURKEY", value: "NIGDE", text: "Niğde", code: "51" },
704
+ // { parent: "TURKEY", value: "ORDU", text: "Ordu", code: "52" },
705
+ // { parent: "TURKEY", value: "RIZE", text: "Rize", code: "53" },
706
+ // { parent: "TURKEY", value: "SAKARYA", text: "Sakarya", code: "54" },
707
+ // { parent: "TURKEY", value: "SAMSUN", text: "Samsun", code: "55" },
708
+ // { parent: "TURKEY", value: "SIIRT", text: "Siirt", code: "56" },
709
+ // { parent: "TURKEY", value: "SINOP", text: "Sinop", code: "57" },
710
+ // { parent: "TURKEY", value: "SIVAS", text: "Sivas", code: "58" },
711
+ // { parent: "TURKEY", value: "TEKIRDAG", text: "Tekirdağ", code: "59" },
712
+ // { parent: "TURKEY", value: "TOKAT", text: "Tokat", code: "60" },
713
+ // { parent: "TURKEY", value: "TRABZON", text: "Trabzon", code: "61" },
714
+ // { parent: "TURKEY", value: "TUNCELI", text: "Tunceli", code: "62" },
715
+ // { parent: "TURKEY", value: "SANLIURFA", text: "Şanlıurfa", code: "63" },
716
+ // { parent: "TURKEY", value: "USAK", text: "Uşak", code: "64" },
717
+ // { parent: "TURKEY", value: "VAN", text: "Van", code: "65" },
718
+ // { parent: "TURKEY", value: "YOZGAT", text: "Yozgat", code: "66" },
719
+ // { parent: "TURKEY", value: "ZONGULDAK", text: "Zonguldak", code: "67" },
720
+ // { parent: "TURKEY", value: "AKSARAY", text: "Aksaray", code: "68" },
721
+ // { parent: "TURKEY", value: "BAYBURT", text: "Bayburt", code: "69" },
722
+ // { parent: "TURKEY", value: "KARAMAN", text: "Karaman", code: "70" },
723
+ // { parent: "TURKEY", value: "KIRIKKALE", text: "Kırıkkale", code: "71" },
724
+ // { parent: "TURKEY", value: "BATMAN", text: "Batman", code: "72" },
725
+ // { parent: "TURKEY", value: "SIRNAK", text: "Şırnak", code: "73" },
726
+ // { parent: "TURKEY", value: "BARTIN", text: "Bartın", code: "74" },
727
+ // { parent: "TURKEY", value: "ARDAHAN", text: "Ardahan", code: "75" },
728
+ // { parent: "TURKEY", value: "IGDIR", text: "Iğdır", code: "76" },
729
+ // { parent: "TURKEY", value: "YALOVA", text: "Yalova", code: "77" },
730
+ // { parent: "TURKEY", value: "KARABUK", text: "Karabük", code: "78" },
731
+ // { parent: "TURKEY", value: "KILIS", text: "Kilis", code: "79" },
732
+ // { parent: "TURKEY", value: "OSMANIYE", text: "Osmaniye", code: "80" },
733
+ // { parent: "TURKEY", value: "Düzce", text: "Düzce", code: "81" },
734
+ ];
735
+ };
736
+
737
+ export const retrievePhoneNumberAreaCodeList = () => {
738
+ return [
739
+ {
740
+ parent: "UNITED_STATES",
741
+ value: "+1",
742
+ text: "+1",
743
+ },
744
+ {
745
+ parent: "GERMANY",
746
+ value: "+49",
747
+ text: "+49",
748
+ },
749
+ {
750
+ parent: "TURKEY",
751
+ value: "+90",
752
+ text: "+90",
753
+ },
754
+ ];
755
+ };
756
+
757
+ export const retrieveInstitutionTypeOptionList = () => {
758
+ return [
759
+ {
760
+ value: "WEST_PRIMARY",
761
+ text: i18n.t("WEST_PRIMARY"),
762
+ },
763
+ {
764
+ value: "EAST_PRIMARY",
765
+ text: i18n.t("EAST_PRIMARY"),
766
+ },
767
+ {
768
+ value: "EAST_SECONDARY",
769
+ text: i18n.t("EAST_SECONDARY"),
770
+ },
771
+ {
772
+ value: "HIGH_SCHOOL",
773
+ text: i18n.t("HIGH_SCHOOL"),
774
+ },
775
+ {
776
+ value: "COLLEGE",
777
+ text: i18n.t("COLLEGE"),
778
+ },
779
+ {
780
+ value: "PRIVATE_TRAINING",
781
+ text: i18n.t("PRIVATE_TRAINING"),
782
+ },
783
+ {
784
+ value: "PRIVATE_LESSON",
785
+ text: i18n.t("PRIVATE_LESSON"),
786
+ },
787
+ {
788
+ value: "COURSE",
789
+ text: i18n.t("COURSE"),
790
+ },
791
+ {
792
+ value: "COMPANY",
793
+ text: i18n.t("COMPANY"),
794
+ },
795
+ {
796
+ value: "ORGANIZATION",
797
+ text: i18n.t("ORGANIZATION"),
798
+ },
799
+ ];
800
+ };
801
+
802
+ export const retrieveGradeLevelOptionList = () => {
803
+ return [
804
+ {
805
+ value: 0,
806
+ text: i18n.t("other"),
807
+ },
808
+ {
809
+ value: 1,
810
+ text: i18n.t("1"),
811
+ },
812
+ {
813
+ value: 2,
814
+ text: i18n.t("2"),
815
+ },
816
+ {
817
+ value: 3,
818
+ text: i18n.t("3"),
819
+ },
820
+ {
821
+ value: 4,
822
+ text: i18n.t("4"),
823
+ },
824
+ {
825
+ value: 5,
826
+ text: i18n.t("5"),
827
+ },
828
+ {
829
+ value: 6,
830
+ text: i18n.t("6"),
831
+ },
832
+ {
833
+ value: 7,
834
+ text: i18n.t("7"),
835
+ },
836
+ {
837
+ value: 8,
838
+ text: i18n.t("8"),
839
+ },
840
+ {
841
+ value: 9,
842
+ text: i18n.t("9"),
843
+ },
844
+ {
845
+ value: 10,
846
+ text: i18n.t("10"),
847
+ },
848
+ {
849
+ value: 11,
850
+ text: i18n.t("11"),
851
+ },
852
+ {
853
+ value: 12,
854
+ text: i18n.t("12"),
855
+ },
856
+ ];
857
+ };
858
+
859
+ export const constructUserProfileQueryParams = (
860
+ userProfile: any,
861
+ userProfileBrand: any
862
+ ) => {
863
+ let queryParams: any;
864
+ if (userProfile.branchDTOList.length > 0) {
865
+ queryParams = {
866
+ ...queryParams,
867
+ branchIdList: userProfile.branchDTOList.map(
868
+ (branchDTO: any) => branchDTO.id
869
+ ),
870
+ };
871
+ } else if (userProfile.gradeDTOList.length > 0) {
872
+ queryParams = {
873
+ ...queryParams,
874
+ gradeIdList: userProfile.gradeDTOList.map((gradeDTO: any) => gradeDTO.id),
875
+ };
876
+ } else if (userProfile.seasonDTOList.length > 0) {
877
+ queryParams = {
878
+ ...queryParams,
879
+ seasonIdList: userProfile.seasonDTOList.map(
880
+ (seasonDTO: any) => seasonDTO.id
881
+ ),
882
+ };
883
+ } else if (userProfile.institutionDTOList.length > 0) {
884
+ queryParams = {
885
+ ...queryParams,
886
+ institutionIdList: userProfile.institutionDTOList.map(
887
+ (institutionDTO: any) => institutionDTO.id
888
+ ),
889
+ };
890
+ } else if (userProfile.campusDTOList.length > 0) {
891
+ queryParams = {
892
+ ...queryParams,
893
+ campusIdList: userProfile.campusDTOList.map(
894
+ (campusDTO: any) => campusDTO.id
895
+ ),
896
+ };
897
+ } else if (userProfile.brandDTOList.length > 0) {
898
+ queryParams = {
899
+ ...queryParams,
900
+ brandIdList: [userProfileBrand.id],
901
+ };
902
+ }
903
+ queryParams.deleted = false;
904
+ return queryParams;
905
+ };
906
+
907
+ export const retrieveCoterieTypeOptionList = () => {
908
+ return [
909
+ {
910
+ text: i18n.t("MANAGEMENT"),
911
+ value: "MANAGEMENT",
912
+ includes: [
913
+ "WEST_PRIMARY",
914
+ "EAST_PRIMARY",
915
+ "EAST_SECONDARY",
916
+ "COLLEGE",
917
+ "HIGH_SCHOOL",
918
+ "COURSE",
919
+ ],
920
+ },
921
+ {
922
+ text: i18n.t("TURKISH"),
923
+ value: "TURKISH",
924
+ includes: [
925
+ "WEST_PRIMARY",
926
+ "EAST_PRIMARY",
927
+ "EAST_SECONDARY",
928
+ "COLLEGE",
929
+ "HIGH_SCHOOL",
930
+ "COURSE",
931
+ ],
932
+ },
933
+ {
934
+ text: i18n.t("HISTORY"),
935
+ value: "HISTORY",
936
+ includes: ["COLLEGE", "HIGH_SCHOOL", "COURSE"],
937
+ },
938
+ {
939
+ text: i18n.t("MATHEMATICS"),
940
+ value: "MATHEMATICS",
941
+ includes: [
942
+ "WEST_PRIMARY",
943
+ "EAST_PRIMARY",
944
+ "EAST_SECONDARY",
945
+ "COLLEGE",
946
+ "HIGH_SCHOOL",
947
+ "COURSE",
948
+ ],
949
+ },
950
+ {
951
+ text: i18n.t("BIOLOGY"),
952
+ value: "BIOLOGY",
953
+ includes: ["COLLEGE", "HIGH_SCHOOL", "COURSE"],
954
+ },
955
+ {
956
+ text: i18n.t("LITERATURE"),
957
+ value: "LITERATURE",
958
+ includes: ["COLLEGE", "HIGH_SCHOOL", "COURSE"],
959
+ },
960
+ {
961
+ text: i18n.t("GEOGRAPHY"),
962
+ value: "GEOGRAPHY",
963
+ includes: ["COLLEGE", "HIGH_SCHOOL", "COURSE"],
964
+ },
965
+ {
966
+ text: i18n.t("ENGLISH"),
967
+ value: "ENGLISH",
968
+ includes: [
969
+ "WEST_PRIMARY",
970
+ "EAST_PRIMARY",
971
+ "EAST_SECONDARY",
972
+ "COLLEGE",
973
+ "HIGH_SCHOOL",
974
+ "COURSE",
975
+ ],
976
+ },
977
+ {
978
+ text: i18n.t("PHYSICS"),
979
+ value: "PHYSICS",
980
+ includes: ["COLLEGE", "HIGH_SCHOOL", "COURSE"],
981
+ },
982
+ {
983
+ text: i18n.t("CHEMISTRY"),
984
+ value: "CHEMISTRY",
985
+ includes: ["COLLEGE", "HIGH_SCHOOL", "COURSE"],
986
+ },
987
+ {
988
+ text: i18n.t("PHILOSOPHY"),
989
+ value: "PHILOSOPHY",
990
+ includes: ["COLLEGE", "HIGH_SCHOOL", "COURSE"],
991
+ },
992
+ {
993
+ text: i18n.t("PHYSICAL_EDUCATION"),
994
+ value: "PHYSICAL_EDUCATION",
995
+ includes: [
996
+ "WEST_PRIMARY",
997
+ "EAST_PRIMARY",
998
+ "EAST_SECONDARY",
999
+ "COLLEGE",
1000
+ "HIGH_SCHOOL",
1001
+ "COURSE",
1002
+ ],
1003
+ },
1004
+ {
1005
+ text: i18n.t("SOCIAL_STUDIES"),
1006
+ value: "SOCIAL_STUDIES",
1007
+ includes: [
1008
+ "WEST_PRIMARY",
1009
+ "EAST_PRIMARY",
1010
+ "EAST_SECONDARY",
1011
+ "COLLEGE",
1012
+ "COURSE",
1013
+ ],
1014
+ },
1015
+ {
1016
+ text: i18n.t("SCIENCE"),
1017
+ value: "SCIENCE",
1018
+ includes: [
1019
+ "WEST_PRIMARY",
1020
+ "EAST_PRIMARY",
1021
+ "EAST_SECONDARY",
1022
+ "COLLEGE",
1023
+ "COURSE",
1024
+ ],
1025
+ },
1026
+ {
1027
+ text: i18n.t("LIFE_STUDIES"),
1028
+ value: "LIFE_STUDIES",
1029
+ includes: ["WEST_PRIMARY", "EAST_PRIMARY", "COLLEGE", "COURSE"],
1030
+ },
1031
+ {
1032
+ text: i18n.t("CULTURE_AND_RELIGION_KNOWLEDGE"),
1033
+ value: "CULTURE_AND_RELIGION_KNOWLEDGE",
1034
+ includes: [
1035
+ "WEST_PRIMARY",
1036
+ "EAST_PRIMARY",
1037
+ "EAST_SECONDARY",
1038
+ "COLLEGE",
1039
+ "HIGH_SCHOOL",
1040
+ "COURSE",
1041
+ ],
1042
+ },
1043
+ {
1044
+ text: i18n.t("TRAFFIC_SAFETY"),
1045
+ value: "TRAFFIC_SAFETY",
1046
+ includes: ["WEST_PRIMARY", "EAST_PRIMARY", "COLLEGE", "COURSE"],
1047
+ },
1048
+ {
1049
+ text: i18n.t("GENERAL_CULTURE"),
1050
+ value: "GENERAL_CULTURE",
1051
+ includes: [
1052
+ "WEST_PRIMARY",
1053
+ "EAST_PRIMARY",
1054
+ "EAST_SECONDARY",
1055
+ "COLLEGE",
1056
+ "HIGH_SCHOOL",
1057
+ "COURSE",
1058
+ ],
1059
+ },
1060
+ ];
1061
+ };
1062
+
1063
+ export const retrieveUserAuthorityGeneralOptionList = () => {
1064
+ return [
1065
+ { text: i18n.t("all"), value: "" },
1066
+ { text: i18n.t("user"), value: "USER" },
1067
+ { text: i18n.t("activity"), value: "ACTIVITY" },
1068
+ { text: i18n.t("catchtivity"), value: "CATCHTIVITY" },
1069
+ { text: i18n.t("catchxam"), value: "CATCHXAM" },
1070
+ { text: i18n.t("label"), value: "LABEL" },
1071
+ { text: i18n.t("announcement"), value: "NOTIFICATION" },
1072
+ { text: i18n.t("report"), value: "REPORT" },
1073
+ { text: i18n.t("category"), value: "CATEGORY" },
1074
+ { text: i18n.t("library"), value: "STORAGE_FILE" },
1075
+ { text: i18n.t("brand"), value: "BRAND" },
1076
+ { text: i18n.t("region"), value: "REGION" },
1077
+ { text: i18n.t("campus"), value: "CAMPUS" },
1078
+ { text: i18n.t("institution"), value: "INSTITUTION" },
1079
+ { text: i18n.t("season"), value: "SEASON" },
1080
+ { text: i18n.t("grade"), value: "GRADE" },
1081
+ { text: i18n.t("branch"), value: "BRANCH" },
1082
+ { text: i18n.t("plan"), value: "PLAN" },
1083
+ { text: i18n.t("standard_exam"), value: "STANDARD_EXAM" },
1084
+ { text: i18n.t("etude"), value: "ETUDE" },
1085
+ ];
1086
+ };
1087
+
1088
+ export const filterGradeLevelOptionList = (
1089
+ institutionDTO: any,
1090
+ gradeDTO: any
1091
+ ) => {
1092
+ if (gradeDTO) {
1093
+ return retrieveGradeLevelOptionList().filter(
1094
+ (gradeLevel: any) => parseFloat(gradeLevel.value) === gradeDTO.level
1095
+ );
1096
+ }
1097
+ if (institutionDTO) {
1098
+ const { type } = institutionDTO;
1099
+ if (type === "WEST_PRIMARY") {
1100
+ return retrieveGradeLevelOptionList().filter(
1101
+ (gradeLevel: any) => parseFloat(gradeLevel.value) <= 8
1102
+ );
1103
+ } else if (type === "EAST_PRIMARY") {
1104
+ return retrieveGradeLevelOptionList().filter(
1105
+ (gradeLevel: any) => parseFloat(gradeLevel.value) <= 4
1106
+ );
1107
+ } else if (type === "EAST_SECONDARY") {
1108
+ return retrieveGradeLevelOptionList().filter(
1109
+ (gradeLevel: any) =>
1110
+ parseFloat(gradeLevel.value) > 4 && parseFloat(gradeLevel.value) <= 8
1111
+ );
1112
+ } else if (type === "HIGH_SCHOOL") {
1113
+ return retrieveGradeLevelOptionList().filter(
1114
+ (gradeLevel: any) => parseFloat(gradeLevel.value) > 8
1115
+ );
1116
+ } else if (
1117
+ type === "COLLEGE" ||
1118
+ type === "PRIVATE_TRAINING" ||
1119
+ type === "PRIVATE_LESSON" ||
1120
+ type === "COURSE"
1121
+ ) {
1122
+ return retrieveGradeLevelOptionList();
1123
+ } else {
1124
+ return [];
1125
+ }
1126
+ }
1127
+ return retrieveGradeLevelOptionList();
1128
+ };
1129
+
1130
+ export const filterCoterieTypeOptionList = (
1131
+ userInformation: any,
1132
+ userProfile: any,
1133
+ userProfileInstitution: any
1134
+ ) => {
1135
+ if (userInformation.accountType === "GENIXO") {
1136
+ return retrieveCoterieTypeOptionList().sort((a, b) =>
1137
+ a.text.localeCompare(b.text)
1138
+ );
1139
+ }
1140
+ if (userProfile.role === "STAFF" || userProfile.role === "CONTENT_CREATOR") {
1141
+ if (userProfile.coterieType === "MANAGEMENT") {
1142
+ if (userProfileInstitution) {
1143
+ return retrieveCoterieTypeOptionList()
1144
+ .filter((coterieTypeOption) =>
1145
+ coterieTypeOption.includes.includes(userProfileInstitution.type)
1146
+ )
1147
+ .sort((a, b) => a.text.localeCompare(b.text));
1148
+ } else {
1149
+ return retrieveCoterieTypeOptionList().sort((a, b) =>
1150
+ a.text.localeCompare(b.text)
1151
+ );
1152
+ }
1153
+ } else {
1154
+ return retrieveCoterieTypeOptionList()
1155
+ .filter(
1156
+ (coterieTypeOption) =>
1157
+ coterieTypeOption.value === userProfile.coterieType
1158
+ )
1159
+ .sort((a, b) => a.text.localeCompare(b.text));
1160
+ }
1161
+ } else if (userProfile.role === "INDIVIDUAL") {
1162
+ const individualCoterieTypeOptionList: any = [];
1163
+ const coterieTypeOptionList = retrieveCoterieTypeOptionList();
1164
+ userProfile.coterieTypeList.forEach((coterieType: any) => {
1165
+ const foundCoterieTypeOption = coterieTypeOptionList.find(
1166
+ (coterieTypeOption) => coterieTypeOption.value === coterieType
1167
+ );
1168
+ if (foundCoterieTypeOption) {
1169
+ individualCoterieTypeOptionList.push(foundCoterieTypeOption);
1170
+ }
1171
+ });
1172
+ return individualCoterieTypeOptionList;
1173
+ }
1174
+ return [];
1175
+ };
1176
+
1177
+ export const findAISettingsFromCurrentProfile = (
1178
+ userProfileBrand: any,
1179
+ userProfileCampus: any,
1180
+ userProfileInstitution: any
1181
+ ) => {
1182
+ if (userProfileInstitution) {
1183
+ const { institutionSettingsDTO } = userProfileInstitution;
1184
+ const { institutionAISettingsDTO } = institutionSettingsDTO;
1185
+ return institutionAISettingsDTO;
1186
+ // const { canConvertActivityTemplate } = institutionAISettingsDTO;
1187
+ // if (!canConvertActivityTemplate) return false;
1188
+ } else {
1189
+ if (userProfileCampus) {
1190
+ const { campusSettingsDTO } = userProfileCampus;
1191
+ const { campusAISettingsDTO } = campusSettingsDTO;
1192
+ return campusAISettingsDTO;
1193
+ } else {
1194
+ if (userProfileBrand) {
1195
+ const { brandSettingsDTO } = userProfileBrand;
1196
+ const { brandAISettingsDTO } = brandSettingsDTO;
1197
+ return brandAISettingsDTO;
1198
+ }
1199
+ }
1200
+ }
1201
+ };