catchup-library-web 1.0.2 → 1.0.3
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/dist/index.d.mts +240 -2
- package/dist/index.d.ts +240 -2
- package/dist/index.js +2263 -0
- package/dist/index.mjs +2203 -0
- package/package.json +1 -1
- package/src/components/boxes/SelectionBox.tsx +41 -0
- package/src/components/boxes/SelectionCheckbox.tsx +66 -0
- package/src/index.ts +13 -0
- package/src/properties/BoxProperties.ts +12 -0
- package/src/properties/GroupProperties.ts +1 -1
- package/src/utilization/AuthorizationUtilization.ts +15 -0
- package/src/utilization/CategoryUtilization.ts +314 -0
- package/src/utilization/DateUtilization.ts +85 -0
- package/src/utilization/FunctionUtilization.ts +50 -0
- package/src/utilization/GamificationUtilization.ts +495 -0
- package/src/utilization/IndividualModelUtilization.ts +48 -0
- package/src/utilization/ManagementUtilization.ts +1201 -0
- package/src/utilization/NotificationUtilization.ts +59 -0
- package/src/utilization/ReportUtilization.ts +42 -0
- package/src/utilization/TokenUtilization.ts +39 -0
package/package.json
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { SelectionBoxProps } from "../../properties/BoxProperties";
|
|
2
|
+
|
|
3
|
+
const SelectionBox = ({
|
|
4
|
+
optionList,
|
|
5
|
+
selectedId,
|
|
6
|
+
handleSelectOnClick,
|
|
7
|
+
}: SelectionBoxProps) => {
|
|
8
|
+
return (
|
|
9
|
+
<div className="flex flex-row items-center gap-x-4 gap-y-2 flex-wrap text-center">
|
|
10
|
+
{optionList.map((option: any, index: number) => (
|
|
11
|
+
<div
|
|
12
|
+
key={index}
|
|
13
|
+
className={`${
|
|
14
|
+
option.id === selectedId
|
|
15
|
+
? "border-catchup-blue-400"
|
|
16
|
+
: "border-catchup-gray-100 hover:border-catchup-blue-500"
|
|
17
|
+
} border-2 rounded-catchup-xlarge py-3 px-8 cursor-pointer duration-300 transition-all`}
|
|
18
|
+
onClick={() => {
|
|
19
|
+
handleSelectOnClick(option.id);
|
|
20
|
+
}}
|
|
21
|
+
>
|
|
22
|
+
<div
|
|
23
|
+
className={`flex flex-row items-center gap-x-1 ${
|
|
24
|
+
option.id === selectedId ? "opacity-100" : "opacity-50"
|
|
25
|
+
}`}
|
|
26
|
+
>
|
|
27
|
+
<div>{option.icon}</div>
|
|
28
|
+
<div className="flex-1 flex flex-col items-center">
|
|
29
|
+
<p>{option.text}</p>
|
|
30
|
+
{option.subText ? (
|
|
31
|
+
<p className="text-md">({option.subText})</p>
|
|
32
|
+
) : null}
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
))}
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default SelectionBox;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { SelectionCheckboxBoxProps } from "../../properties/BoxProperties";
|
|
2
|
+
import BaseImage from "../images/BaseImage";
|
|
3
|
+
|
|
4
|
+
const SelectionCheckbox = ({
|
|
5
|
+
optionList,
|
|
6
|
+
selectedIdList,
|
|
7
|
+
handleSelectOnClick,
|
|
8
|
+
handleRemoveOnClick,
|
|
9
|
+
}: SelectionCheckboxBoxProps) => {
|
|
10
|
+
return (
|
|
11
|
+
<div className="flex flex-row items-center gap-x-4 gap-y-2 flex-wrap text-center">
|
|
12
|
+
{optionList.map((option: any, index: number) => (
|
|
13
|
+
<div
|
|
14
|
+
key={index}
|
|
15
|
+
className={`${
|
|
16
|
+
selectedIdList.findIndex(
|
|
17
|
+
(selectedId: any) => selectedId === option.id
|
|
18
|
+
) > -1
|
|
19
|
+
? "border-catchup-blue-400"
|
|
20
|
+
: "border-catchup-gray-100 hover:border-catchup-blue-500"
|
|
21
|
+
} border-2 rounded-catchup-xlarge py-3 px-6 cursor-pointer duration-300 transition-all`}
|
|
22
|
+
onClick={() => {
|
|
23
|
+
if (
|
|
24
|
+
selectedIdList.findIndex(
|
|
25
|
+
(selectedId: any) => selectedId === option.id
|
|
26
|
+
) === -1
|
|
27
|
+
) {
|
|
28
|
+
handleSelectOnClick(option.id);
|
|
29
|
+
} else {
|
|
30
|
+
handleRemoveOnClick(option.id);
|
|
31
|
+
}
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
<div
|
|
35
|
+
className={`flex flex-row items-center gap-x-1 ${
|
|
36
|
+
selectedIdList.findIndex(
|
|
37
|
+
(selectedId: any) => selectedId === option.id
|
|
38
|
+
) > -1
|
|
39
|
+
? "opacity-100"
|
|
40
|
+
: "opacity-50"
|
|
41
|
+
}`}
|
|
42
|
+
>
|
|
43
|
+
<div>
|
|
44
|
+
<BaseImage
|
|
45
|
+
src={
|
|
46
|
+
selectedIdList.findIndex(
|
|
47
|
+
(selectedId: any) => selectedId === option.id
|
|
48
|
+
) > -1
|
|
49
|
+
? "/icons/checkbox.png"
|
|
50
|
+
: "/icons/checkbox-empty.png"
|
|
51
|
+
}
|
|
52
|
+
alt="checkbox"
|
|
53
|
+
size="small"
|
|
54
|
+
/>
|
|
55
|
+
</div>
|
|
56
|
+
<div className="flex-1">
|
|
57
|
+
<p>{option.text}</p>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
))}
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export default SelectionCheckbox;
|
package/src/index.ts
CHANGED
|
@@ -27,8 +27,21 @@ export { default as InputGroup } from "./components/groups/InputGroup";
|
|
|
27
27
|
|
|
28
28
|
export { default as useScreenSize } from "./hooks/useScreenSize";
|
|
29
29
|
|
|
30
|
+
export { default as SelectionBox } from "./components/boxes/SelectionBox";
|
|
31
|
+
export { default as SelectionCheckbox } from "./components/boxes/SelectionCheckbox";
|
|
32
|
+
|
|
30
33
|
export { default as i18n } from "./language/i18n";
|
|
31
34
|
|
|
32
35
|
export * from "./utilization/AppUtilization";
|
|
36
|
+
export * from "./utilization/AuthorizationUtilization";
|
|
33
37
|
export * from "./utilization/CatchtivityUtilization";
|
|
38
|
+
export * from "./utilization/CategoryUtilization";
|
|
39
|
+
export * from "./utilization/DateUtilization";
|
|
40
|
+
export * from "./utilization/FunctionUtilization";
|
|
41
|
+
export * from "./utilization/GamificationUtilization";
|
|
42
|
+
export * from "./utilization/IndividualModelUtilization";
|
|
43
|
+
export * from "./utilization/ManagementUtilization";
|
|
44
|
+
export * from "./utilization/NotificationUtilization";
|
|
45
|
+
export * from "./utilization/ReportUtilization";
|
|
34
46
|
export * from "./utilization/StorageUtilization";
|
|
47
|
+
export * from "./utilization/TokenUtilization";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface SelectionBoxProps {
|
|
2
|
+
optionList: any;
|
|
3
|
+
selectedId: any;
|
|
4
|
+
handleSelectOnClick: (e: any) => void;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface SelectionCheckboxBoxProps {
|
|
8
|
+
optionList: any;
|
|
9
|
+
selectedIdList: any;
|
|
10
|
+
handleSelectOnClick: (e: any) => void;
|
|
11
|
+
handleRemoveOnClick: (e: any) => void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const parseJwt = (token: string) => {
|
|
2
|
+
var base64Url = token.split(".")[1];
|
|
3
|
+
var base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
4
|
+
var jsonPayload = decodeURIComponent(
|
|
5
|
+
window
|
|
6
|
+
.atob(base64)
|
|
7
|
+
.split("")
|
|
8
|
+
.map(function (c) {
|
|
9
|
+
return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
|
|
10
|
+
})
|
|
11
|
+
.join("")
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
return JSON.parse(jsonPayload);
|
|
15
|
+
};
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import i18n from "../language/i18n";
|
|
2
|
+
import { filterGradeLevelOptionList } from "./ManagementUtilization";
|
|
3
|
+
|
|
4
|
+
export const retrieveCategoryVersionCodeOptionList = () => {
|
|
5
|
+
return [
|
|
6
|
+
{
|
|
7
|
+
value: "MEB-IO-MAT-2024",
|
|
8
|
+
text: i18n.t("MEB-IO-MAT-2024"),
|
|
9
|
+
type: "MATHEMATICS",
|
|
10
|
+
availableLevelList: [5],
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
value: "MEB-IO-MAT-2018",
|
|
14
|
+
text: i18n.t("MEB-IO-MAT-2018"),
|
|
15
|
+
type: "MATHEMATICS",
|
|
16
|
+
availableLevelList: [4, 6, 7, 8],
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
value: "MEB-IO-TUR-2024",
|
|
20
|
+
text: i18n.t("MEB-IO-TUR-2024"),
|
|
21
|
+
type: "TURKISH",
|
|
22
|
+
availableLevelList: [5],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: "MEB-IO-TUR-2019",
|
|
26
|
+
text: i18n.t("MEB-IO-TUR-2019"),
|
|
27
|
+
type: "TURKISH",
|
|
28
|
+
availableLevelList: [4, 6, 7, 8],
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
value: "MEB-IO-HAY-2018",
|
|
32
|
+
text: i18n.t("MEB-IO-HAY-2018"),
|
|
33
|
+
type: "LIFE_STUDIES",
|
|
34
|
+
availableLevelList: [3],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
value: "MEB-IO-TRAF-2018",
|
|
38
|
+
text: i18n.t("MEB-IO-TRAF-2018"),
|
|
39
|
+
type: "TRAFFIC_SAFETY",
|
|
40
|
+
availableLevelList: [4],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
value: "MEB-IO-FEN-2024",
|
|
44
|
+
text: i18n.t("MEB-IO-FEN-2024"),
|
|
45
|
+
type: "SCIENCE",
|
|
46
|
+
availableLevelList: [5],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
value: "MEB-IO-SCI-2018",
|
|
50
|
+
text: i18n.t("MEB-IO-SCI-2018"),
|
|
51
|
+
type: "SCIENCE",
|
|
52
|
+
availableLevelList: [4, 6, 7, 8],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
value: "MEB-IO-SOS-2024",
|
|
56
|
+
text: i18n.t("MEB-IO-SOS-2024"),
|
|
57
|
+
type: "SOCIAL_STUDIES",
|
|
58
|
+
availableLevelList: [5],
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
value: "MEB-IO-SOS-2018",
|
|
62
|
+
text: i18n.t("MEB-IO-SOS-2018"),
|
|
63
|
+
type: "SOCIAL_STUDIES",
|
|
64
|
+
availableLevelList: [4, 6, 7],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
value: "MEB-IO-ITA-2018",
|
|
68
|
+
text: i18n.t("MEB-IO-ITA-2018"),
|
|
69
|
+
type: "SOCIAL_STUDIES",
|
|
70
|
+
availableLevelList: [8],
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
value: "MEB-IO-ENG-2018",
|
|
74
|
+
text: i18n.t("MEB-IO-ENG-2018"),
|
|
75
|
+
type: "ENGLISH",
|
|
76
|
+
availableLevelList: [4, 5, 6, 7, 8],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
value: "MEB-AL-MAT-2024",
|
|
80
|
+
text: i18n.t("MEB-AL-MAT-2024"),
|
|
81
|
+
type: "MATHEMATICS",
|
|
82
|
+
availableLevelList: [9],
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
value: "MEB-AL-MAT-2018",
|
|
86
|
+
text: i18n.t("MEB-AL-MAT-2018"),
|
|
87
|
+
type: "MATHEMATICS",
|
|
88
|
+
availableLevelList: [10, 11, 12],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
value: "MEB-AL-FİZ-2024",
|
|
92
|
+
text: i18n.t("MEB-AL-FİZ-2024"),
|
|
93
|
+
type: "PHYSICS",
|
|
94
|
+
availableLevelList: [9],
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
value: "MEB-AL-FIZ-2018",
|
|
98
|
+
text: i18n.t("MEB-AL-FIZ-2018"),
|
|
99
|
+
type: "PHYSICS",
|
|
100
|
+
availableLevelList: [10, 11, 12],
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
value: "MEB-AL-BİY-2024",
|
|
104
|
+
text: i18n.t("MEB-AL-BİY-2024"),
|
|
105
|
+
type: "BIOLOGY",
|
|
106
|
+
availableLevelList: [9],
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
value: "MEB-AL-BIO-2018",
|
|
110
|
+
text: i18n.t("MEB-AL-BIO-2018"),
|
|
111
|
+
type: "BIOLOGY",
|
|
112
|
+
availableLevelList: [10, 11, 12],
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
value: "MEB-AL-KİM-2024",
|
|
116
|
+
text: i18n.t("MEB-AL-KİM-2024"),
|
|
117
|
+
type: "CHEMISTRY",
|
|
118
|
+
availableLevelList: [9],
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
value: "MEB-AL-KIM-2018",
|
|
122
|
+
text: i18n.t("MEB-AL-KIM-2018"),
|
|
123
|
+
type: "CHEMISTRY",
|
|
124
|
+
availableLevelList: [10, 11, 12],
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
value: "MEB-AL-TAR-2024",
|
|
128
|
+
text: i18n.t("MEB-AL-TAR-2024"),
|
|
129
|
+
type: "HISTORY",
|
|
130
|
+
availableLevelList: [9],
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
value: "MEB-AL-TAR-2018",
|
|
134
|
+
text: i18n.t("MEB-AL-TAR-2018"),
|
|
135
|
+
type: "HISTORY",
|
|
136
|
+
availableLevelList: [10, 11],
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
value: "MEB-AL-ITA-2018",
|
|
140
|
+
text: i18n.t("MEB-AL-ITA-2018"),
|
|
141
|
+
type: "HISTORY",
|
|
142
|
+
availableLevelList: [12],
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
value: "MEB-AL-COĞ-2024",
|
|
146
|
+
text: i18n.t("MEB-AL-COĞ-2024"),
|
|
147
|
+
type: "GEOGRAPHY",
|
|
148
|
+
availableLevelList: [9],
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
value: "MEB-AL-COĞ-2018",
|
|
152
|
+
text: i18n.t("MEB-AL-COĞ-2018"),
|
|
153
|
+
type: "GEOGRAPHY",
|
|
154
|
+
availableLevelList: [10, 11, 12],
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
value: "MEB-IO-DKAB-2018",
|
|
158
|
+
text: i18n.t("MEB-IO-DKAB-2018"),
|
|
159
|
+
type: "CULTURE_AND_RELIGION_KNOWLEDGE",
|
|
160
|
+
availableLevelList: [4, 5, 6, 7, 8],
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
value: "MEB-AL-DKAB-2018",
|
|
164
|
+
text: i18n.t("MEB-AL-DKAB-2018"),
|
|
165
|
+
type: "CULTURE_AND_RELIGION_KNOWLEDGE",
|
|
166
|
+
availableLevelList: [9, 10, 11, 12],
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
value: "MEB-AL-FEL-2018",
|
|
170
|
+
text: i18n.t("MEB-AL-FEL-2018"),
|
|
171
|
+
type: "PHILOSOPHY",
|
|
172
|
+
availableLevelList: [10, 11],
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
value: "MEB-AL-TDE-2024",
|
|
176
|
+
text: i18n.t("MEB-AL-TDE-2024"),
|
|
177
|
+
type: "LITERATURE",
|
|
178
|
+
availableLevelList: [9],
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
value: "MEB-AL-LIT-2018",
|
|
182
|
+
text: i18n.t("MEB-AL-LIT-2018"),
|
|
183
|
+
type: "LITERATURE",
|
|
184
|
+
availableLevelList: [10, 11, 12],
|
|
185
|
+
},
|
|
186
|
+
// {
|
|
187
|
+
// value: "CEFR-STANDARDS-A1",
|
|
188
|
+
// text: i18n.t("CEFR-STANDARDS-A1"),
|
|
189
|
+
// type: "ENGLISH",
|
|
190
|
+
// availableLevelList: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
|
|
191
|
+
// },
|
|
192
|
+
// {
|
|
193
|
+
// value: "CEFR-STANDARDS-A2",
|
|
194
|
+
// text: i18n.t("CEFR-STANDARDS-A2"),
|
|
195
|
+
// type: "ENGLISH",
|
|
196
|
+
// availableLevelList: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
|
|
197
|
+
// },
|
|
198
|
+
// {
|
|
199
|
+
// value: "CEFR-STANDARDS-B1",
|
|
200
|
+
// text: i18n.t("CEFR-STANDARDS-B1"),
|
|
201
|
+
// type: "ENGLISH",
|
|
202
|
+
// availableLevelList: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
|
|
203
|
+
// },
|
|
204
|
+
// {
|
|
205
|
+
// value: "CEFR-STANDARDS-B2",
|
|
206
|
+
// text: i18n.t("CEFR-STANDARDS-B2"),
|
|
207
|
+
// type: "ENGLISH",
|
|
208
|
+
// availableLevelList: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
|
|
209
|
+
// },
|
|
210
|
+
{
|
|
211
|
+
value: "GENERAL-CULTURE",
|
|
212
|
+
text: i18n.t("GENERAL-CULTURE"),
|
|
213
|
+
type: "GENERAL_CULTURE",
|
|
214
|
+
availableLevelList: [8, 12],
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
value: "SPE-TYT-TUR-2024",
|
|
218
|
+
text: i18n.t("SPE-TYT-TUR-2024"),
|
|
219
|
+
type: "TURKISH",
|
|
220
|
+
availableLevelList: [12],
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
value: "SPE-LGS-TUR-2024",
|
|
224
|
+
text: i18n.t("SPE-LGS-TUR-2024"),
|
|
225
|
+
type: "TURKISH",
|
|
226
|
+
availableLevelList: [8],
|
|
227
|
+
},
|
|
228
|
+
];
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
export const filterCategoryVersionCodeOptionList = (
|
|
232
|
+
categoryVersionCodeOptionList: any,
|
|
233
|
+
coterieType: string,
|
|
234
|
+
level: any
|
|
235
|
+
) => {
|
|
236
|
+
if (coterieType && coterieType === "DEFAULT_OPTION") return [];
|
|
237
|
+
if (level && level === "DEFAULT_OPTION") return [];
|
|
238
|
+
let currentCategoryVersionCodeOptionList = categoryVersionCodeOptionList;
|
|
239
|
+
if (coterieType !== "MANAGEMENT") {
|
|
240
|
+
currentCategoryVersionCodeOptionList =
|
|
241
|
+
currentCategoryVersionCodeOptionList.filter(
|
|
242
|
+
(categoryVersionCode: any) => categoryVersionCode.type === coterieType
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
if (level) {
|
|
246
|
+
currentCategoryVersionCodeOptionList =
|
|
247
|
+
currentCategoryVersionCodeOptionList.filter((categoryVersionCode: any) =>
|
|
248
|
+
categoryVersionCode.availableLevelList.includes(level)
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return currentCategoryVersionCodeOptionList;
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
export const filterCategoryVersionCodeOptionListByGradeDTO = (
|
|
256
|
+
categoryVersionCodeOptionList: any,
|
|
257
|
+
coterieType: string,
|
|
258
|
+
gradeDTO: any
|
|
259
|
+
) => {
|
|
260
|
+
if (coterieType && coterieType === "DEFAULT_OPTION") return [];
|
|
261
|
+
|
|
262
|
+
let currentCategoryVersionCodeOptionList = categoryVersionCodeOptionList;
|
|
263
|
+
|
|
264
|
+
if (coterieType !== "MANAGEMENT") {
|
|
265
|
+
currentCategoryVersionCodeOptionList =
|
|
266
|
+
currentCategoryVersionCodeOptionList.filter(
|
|
267
|
+
(categoryVersionCode: any) => categoryVersionCode.type === coterieType
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
if (gradeDTO) {
|
|
271
|
+
currentCategoryVersionCodeOptionList =
|
|
272
|
+
currentCategoryVersionCodeOptionList.filter(
|
|
273
|
+
(categoryVersionCodeOption: any) =>
|
|
274
|
+
categoryVersionCodeOption.availableLevelList.includes(gradeDTO.level)
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return currentCategoryVersionCodeOptionList;
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
export const filterCategoryVersionCodeOptionListByInstitutionDTO = (
|
|
282
|
+
categoryVersionCodeOptionList: any,
|
|
283
|
+
coterieType: string,
|
|
284
|
+
institutionDTO: any
|
|
285
|
+
) => {
|
|
286
|
+
if (coterieType && coterieType === "DEFAULT_OPTION") return [];
|
|
287
|
+
|
|
288
|
+
let currentCategoryVersionCodeOptionList = categoryVersionCodeOptionList;
|
|
289
|
+
|
|
290
|
+
if (coterieType !== "MANAGEMENT") {
|
|
291
|
+
currentCategoryVersionCodeOptionList =
|
|
292
|
+
currentCategoryVersionCodeOptionList.filter(
|
|
293
|
+
(categoryVersionCodeOption: any) =>
|
|
294
|
+
categoryVersionCodeOption.type === coterieType
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
if (institutionDTO) {
|
|
298
|
+
const gradeLevelList = filterGradeLevelOptionList(institutionDTO, null).map(
|
|
299
|
+
(option) => option.value
|
|
300
|
+
);
|
|
301
|
+
currentCategoryVersionCodeOptionList =
|
|
302
|
+
currentCategoryVersionCodeOptionList.filter(
|
|
303
|
+
(categoryVersionCodeOption: any) => {
|
|
304
|
+
return (
|
|
305
|
+
gradeLevelList.find((gradeLevel) =>
|
|
306
|
+
categoryVersionCodeOption.availableLevelList.includes(gradeLevel)
|
|
307
|
+
) !== undefined
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
return currentCategoryVersionCodeOptionList;
|
|
314
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import i18n from "../language/i18n";
|
|
2
|
+
|
|
3
|
+
export const ONE_HOUR = 3600000;
|
|
4
|
+
export const ONE_DAY = 86400000;
|
|
5
|
+
export const ONE_WEEK = 604800000;
|
|
6
|
+
export const ONE_MONTH = 2419200000;
|
|
7
|
+
export const THREE_MONTHS = 7257600000;
|
|
8
|
+
|
|
9
|
+
export const retrieveMonthNameByIndex = (index: number) => {
|
|
10
|
+
if (index === 0) {
|
|
11
|
+
return i18n.t("january");
|
|
12
|
+
} else if (index === 1) {
|
|
13
|
+
return i18n.t("february");
|
|
14
|
+
} else if (index === 2) {
|
|
15
|
+
return i18n.t("march");
|
|
16
|
+
} else if (index === 3) {
|
|
17
|
+
return i18n.t("april");
|
|
18
|
+
} else if (index === 4) {
|
|
19
|
+
return i18n.t("may");
|
|
20
|
+
} else if (index === 5) {
|
|
21
|
+
return i18n.t("june");
|
|
22
|
+
} else if (index === 6) {
|
|
23
|
+
return i18n.t("july");
|
|
24
|
+
} else if (index === 7) {
|
|
25
|
+
return i18n.t("august");
|
|
26
|
+
} else if (index === 8) {
|
|
27
|
+
return i18n.t("september");
|
|
28
|
+
} else if (index === 9) {
|
|
29
|
+
return i18n.t("october");
|
|
30
|
+
} else if (index === 10) {
|
|
31
|
+
return i18n.t("november");
|
|
32
|
+
} else if (index === 11) {
|
|
33
|
+
return i18n.t("december");
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const retrieveDateIntervalOptionList = () => {
|
|
38
|
+
return [
|
|
39
|
+
{
|
|
40
|
+
value: "LAST_DAY",
|
|
41
|
+
text: i18n.t("last_day"),
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
value: "LAST_WEEK",
|
|
45
|
+
text: i18n.t("last_week"),
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
value: "LAST_MONTH",
|
|
49
|
+
text: i18n.t("last_month"),
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
value: "LAST_THREE_MONTHS",
|
|
53
|
+
text: i18n.t("last_three_months"),
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const constructWeekName = (beginDate: any, endDate: any) => {
|
|
59
|
+
let currentEndDate;
|
|
60
|
+
if (endDate) {
|
|
61
|
+
currentEndDate = endDate;
|
|
62
|
+
} else {
|
|
63
|
+
currentEndDate = new Date(beginDate);
|
|
64
|
+
currentEndDate.setDate(beginDate.getDate() + 4);
|
|
65
|
+
}
|
|
66
|
+
if (beginDate.getFullYear() !== currentEndDate.getFullYear()) {
|
|
67
|
+
return `${beginDate.getDate()} ${retrieveMonthNameByIndex(
|
|
68
|
+
beginDate.getMonth()
|
|
69
|
+
)} ${beginDate.getFullYear()} - ${currentEndDate.getDate()} ${retrieveMonthNameByIndex(
|
|
70
|
+
currentEndDate.getMonth()
|
|
71
|
+
)} ${currentEndDate.getFullYear()}`;
|
|
72
|
+
} else {
|
|
73
|
+
if (beginDate.getMonth() !== currentEndDate.getMonth()) {
|
|
74
|
+
return `${beginDate.getDate()} ${retrieveMonthNameByIndex(
|
|
75
|
+
beginDate.getMonth()
|
|
76
|
+
)} - ${currentEndDate.getDate()} ${retrieveMonthNameByIndex(
|
|
77
|
+
currentEndDate.getMonth()
|
|
78
|
+
)} ${currentEndDate.getFullYear()}`;
|
|
79
|
+
} else {
|
|
80
|
+
return `${beginDate.getDate()} - ${currentEndDate.getDate()} ${retrieveMonthNameByIndex(
|
|
81
|
+
currentEndDate.getMonth()
|
|
82
|
+
)} ${currentEndDate.getFullYear()}`;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export const calculateLevenshteinDistance = (s: any, t: any) => {
|
|
2
|
+
if (!s.length) return t.length;
|
|
3
|
+
if (!t.length) return s.length;
|
|
4
|
+
const arr = [];
|
|
5
|
+
for (let i = 0; i <= t.length; i++) {
|
|
6
|
+
arr[i] = [i];
|
|
7
|
+
for (let j = 1; j <= s.length; j++) {
|
|
8
|
+
arr[i][j] =
|
|
9
|
+
i === 0
|
|
10
|
+
? j
|
|
11
|
+
: Math.min(
|
|
12
|
+
arr[i - 1][j] + 1,
|
|
13
|
+
arr[i][j - 1] + 1,
|
|
14
|
+
arr[i - 1][j - 1] + (s[j - 1] === t[i - 1] ? 0 : 1)
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return arr[t.length][s.length];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const convertTurkishCharactersToEnglish = (text: string) => {
|
|
22
|
+
return text
|
|
23
|
+
.replaceAll("Ğ", "g")
|
|
24
|
+
.replaceAll("Ü", "u")
|
|
25
|
+
.replaceAll("Ş", "s")
|
|
26
|
+
.replaceAll("I", "i")
|
|
27
|
+
.replaceAll("İ", "i")
|
|
28
|
+
.replaceAll("Ö", "o")
|
|
29
|
+
.replaceAll("Ç", "c")
|
|
30
|
+
.replaceAll("ğ", "g")
|
|
31
|
+
.replaceAll("ü", "u")
|
|
32
|
+
.replaceAll("ş", "s")
|
|
33
|
+
.replaceAll("ı", "i")
|
|
34
|
+
.replaceAll("ö", "o")
|
|
35
|
+
.replaceAll("ç", "c");
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export function convertToBase64(arrayBuffer: any) {
|
|
39
|
+
return new Promise((resolve, reject) => {
|
|
40
|
+
const blob = new Blob([arrayBuffer], { type: "image/png" });
|
|
41
|
+
const reader = new FileReader();
|
|
42
|
+
reader.onloadend = () => {
|
|
43
|
+
const base64data =
|
|
44
|
+
typeof reader.result === "string" ? reader.result.split(",")[1] : null; // Remove "data:image/png;base64," part
|
|
45
|
+
resolve(base64data);
|
|
46
|
+
};
|
|
47
|
+
reader.onerror = reject;
|
|
48
|
+
reader.readAsDataURL(blob);
|
|
49
|
+
});
|
|
50
|
+
}
|