mario-core 2.0.102-release → 2.0.103-release
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/Dashboard-B2WY8-IU.js +1 -0
- package/dist/Dashboard-BzKx6Ox_.mjs +206 -0
- package/dist/Dashboard-DJS7P679.mjs +206 -0
- package/dist/Dashboard-NC2RHYE3.js +1 -0
- package/dist/EmailTemplateDetail-22mli8ZO.js +1 -0
- package/dist/EmailTemplateDetail-CfqeSysW.js +1 -0
- package/dist/EmailTemplateDetail-D5H-KPFi.mjs +443 -0
- package/dist/EmailTemplateDetail-DnEe1dJY.mjs +443 -0
- package/dist/EmailTemplateList-BBgctzKn.mjs +170 -0
- package/dist/EmailTemplateList-BSETyjvK.js +1 -0
- package/dist/EmailTemplateList-CEfrVodv.mjs +170 -0
- package/dist/EmailTemplateList-CpfPUX5H.js +1 -0
- package/dist/GalleryList-BKH6TE8o.js +1 -0
- package/dist/GalleryList-D1-lprY3.mjs +329 -0
- package/dist/GalleryList-D6Npg6OD.mjs +329 -0
- package/dist/GalleryList-DZDBNr1J.js +1 -0
- package/dist/Login-07zPaPX9.js +1 -0
- package/dist/Login-CSb85ENW.mjs +1697 -0
- package/dist/Login-C_elLcnh.mjs +1688 -0
- package/dist/Login-t8Cp9sZB.js +1 -0
- package/dist/NotificationList-D1ay6Hyf.mjs +3982 -0
- package/dist/NotificationList-DHjB1hHV.js +2 -0
- package/dist/NotificationList-DlWtyPB-.mjs +3982 -0
- package/dist/NotificationList-Dr8Yrfl7.js +2 -0
- package/dist/SkillList-CjP3DHVV.mjs +386 -0
- package/dist/SkillList-DED-BKhK.js +1 -0
- package/dist/SkillList-EMox2GtU.js +1 -0
- package/dist/SkillList-a-PCBXTS.mjs +386 -0
- package/dist/TeacherSelector-CT_LK5ps.js +1 -0
- package/dist/TeacherSelector-CYN1RV9H.js +1 -0
- package/dist/TeacherSelector-Ckdz4LDA.mjs +30 -0
- package/dist/TeacherSelector-TtFRSN6T.mjs +30 -0
- package/dist/TheContent-BLL5TnF0.js +1 -0
- package/dist/TheContent-C1z93b1T.mjs +38 -0
- package/dist/TheContent-CV2yUmwY.js +1 -0
- package/dist/TheContent-ClceIaDH.mjs +38 -0
- package/dist/UserContainer-BwVN8uDh.mjs +2902 -0
- package/dist/UserContainer-DKBxc6bM.js +5 -0
- package/dist/UserContainer-Dgajsjc2.js +5 -0
- package/dist/UserContainer-W5RhNyuY.mjs +2902 -0
- package/dist/UserDetail-B1OEfUkB.mjs +903 -0
- package/dist/UserDetail-CcAyPDXB.mjs +903 -0
- package/dist/UserDetail-D_54wIZ1.js +1 -0
- package/dist/UserDetail-EIVg7R4V.js +1 -0
- package/dist/UserList-BHBPOboi.js +7 -0
- package/dist/UserList-CuML6EN2.mjs +1261 -0
- package/dist/UserList-D7DcyFHI.js +7 -0
- package/dist/UserList-DPS62SYL.mjs +1254 -0
- package/dist/constants-CAl8i9EQ.mjs +286 -0
- package/dist/constants-CQviSc2u.js +1 -0
- package/dist/constants-DIXj0L_y.js +1 -0
- package/dist/constants-Jqu1Wphx.mjs +286 -0
- package/dist/index-7hA60HfM.mjs +19133 -0
- package/dist/index-9XtI-PeV.js +15 -0
- package/dist/index-C6cqi7Br.js +15 -0
- package/dist/index-DplP6JK1.mjs +19133 -0
- package/dist/index.js +1 -1
- package/dist/index.modern.js +1 -1
- package/dist/mailCategoryService-Bhcruih6.js +1 -0
- package/dist/mailCategoryService-CJQb-5oo.mjs +11 -0
- package/dist/mailCategoryService-CQdNPG8e.js +1 -0
- package/dist/mailCategoryService-D_DFc1LB.mjs +11 -0
- package/dist/userService-1_ugW9AK.js +1 -0
- package/dist/userService-C4VF2Wck.mjs +56 -0
- package/dist/userService-De8Jm8I4.js +1 -0
- package/dist/userService-OWU32PxA.mjs +56 -0
- package/package.json +1 -1
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
import { jsx as e, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { Table as Y, Row as D, Col as h, Input as K, FormGroup as J, Label as G, Button as ee } from "reactstrap";
|
|
3
|
+
import { useNavigate as te, useParams as ae } from "react-router-dom";
|
|
4
|
+
import { Editor as se } from "@tinymce/tinymce-react";
|
|
5
|
+
import { Formik as ne } from "formik";
|
|
6
|
+
import { V as ie, L as le, b as C, c as k, W as oe, X as ce, Y as P, E as U, Z as re, _ as me } from "./index-7hA60HfM.mjs";
|
|
7
|
+
import { useTranslation as W } from "react-i18next";
|
|
8
|
+
import { useEffect as $, Fragment as de, useState as w, useCallback as z } from "react";
|
|
9
|
+
import ue from "react-select";
|
|
10
|
+
import { useDispatch as X, useSelector as Z } from "react-redux";
|
|
11
|
+
import { a as he, b as pe, u as fe, c as ge, d as ye } from "./mailCategoryService-D_DFc1LB.mjs";
|
|
12
|
+
import * as R from "yup";
|
|
13
|
+
const be = ({ onClick: s }) => /* @__PURE__ */ e("div", { className: "d-inline text-center cursor-pointer hover-opacity", title: "Delete", onClick: s, children: /* @__PURE__ */ e(ie, {}) }), H = [
|
|
14
|
+
{ label: "$USER_FIRST_NAME$", meaning: "user_first_name" },
|
|
15
|
+
{ label: "$USER_LAST_NAME$", meaning: "user_last_name" },
|
|
16
|
+
{ label: "$PASSWORD$", meaning: "password" },
|
|
17
|
+
{ label: "$USER_NAME$", meaning: "user_name" },
|
|
18
|
+
{ label: "$USER_EMAIL$", meaning: "user_email" },
|
|
19
|
+
{ label: "$MESSAGE$", meaning: "message" },
|
|
20
|
+
{ label: "$DOMAIN$", meaning: "domain" }
|
|
21
|
+
], Ee = ({
|
|
22
|
+
onClick: s,
|
|
23
|
+
isResetPasswordTemplate: n
|
|
24
|
+
}) => {
|
|
25
|
+
const { t: i } = W();
|
|
26
|
+
let b = n ? [...H, { label: "$RESET_LINK$", meaning: "Reset link" }] : H;
|
|
27
|
+
return /* @__PURE__ */ c(Y, { bordered: !0, hover: !0, striped: !0, responsive: !0, size: "sm", children: [
|
|
28
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ c("tr", { children: [
|
|
29
|
+
/* @__PURE__ */ e("th", { className: "align-top", children: i("params") }),
|
|
30
|
+
/* @__PURE__ */ e("th", { className: "align-top", children: i("meaning") }),
|
|
31
|
+
/* @__PURE__ */ e("th", {})
|
|
32
|
+
] }) }),
|
|
33
|
+
/* @__PURE__ */ e("tbody", { children: b.map((d) => /* @__PURE__ */ c("tr", { children: [
|
|
34
|
+
/* @__PURE__ */ e("td", { className: "align-middle", children: d.label }),
|
|
35
|
+
/* @__PURE__ */ e("td", { className: "align-middle", children: i(d.meaning) }),
|
|
36
|
+
/* @__PURE__ */ e("td", { className: "text-center align-middle", children: /* @__PURE__ */ e(be, { onClick: () => s(d) }) })
|
|
37
|
+
] }, d.label)) })
|
|
38
|
+
] });
|
|
39
|
+
}, Ie = (s) => {
|
|
40
|
+
const n = X(), i = Z(
|
|
41
|
+
(o) => o.mailCategory.mailCategoryList
|
|
42
|
+
);
|
|
43
|
+
$(() => {
|
|
44
|
+
b();
|
|
45
|
+
}, []);
|
|
46
|
+
const b = async () => {
|
|
47
|
+
try {
|
|
48
|
+
const o = await he();
|
|
49
|
+
n(le(o.data.items));
|
|
50
|
+
} catch (o) {
|
|
51
|
+
console.error(o);
|
|
52
|
+
}
|
|
53
|
+
}, { id: d } = s, I = i.map((o) => ({
|
|
54
|
+
id: o.id,
|
|
55
|
+
value: o.id,
|
|
56
|
+
label: o.name
|
|
57
|
+
})), T = d && I.find((o) => o.value === d) || null;
|
|
58
|
+
return /* @__PURE__ */ e(ue, { options: I, value: T, ...s });
|
|
59
|
+
}, O = ({ label: s, onRemove: n }) => /* @__PURE__ */ c(de, { children: [
|
|
60
|
+
/* @__PURE__ */ e("span", { className: "mr-2", children: s }),
|
|
61
|
+
/* @__PURE__ */ e(
|
|
62
|
+
"i",
|
|
63
|
+
{
|
|
64
|
+
className: "fa fa-times text-danger cursor-pointer hover-opacity",
|
|
65
|
+
onClick: n
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
] }), _e = {
|
|
69
|
+
id: 0,
|
|
70
|
+
subject: "",
|
|
71
|
+
categoryId: 0,
|
|
72
|
+
body: "",
|
|
73
|
+
attachments: [],
|
|
74
|
+
isDisabled: !1
|
|
75
|
+
}, Ce = "/admin/email-template", Te = "Email template detail", ve = 4194304, Se = (s) => {
|
|
76
|
+
let n;
|
|
77
|
+
const i = X(), b = te(), [d, I] = w(_e), [T, o] = w(!1), M = async () => {
|
|
78
|
+
localStorage.setItem(window.location.href, "true"), o(!0);
|
|
79
|
+
}, [p, x] = w([]), [u, L] = w([]), [j, F] = w("");
|
|
80
|
+
$(() => {
|
|
81
|
+
s && v();
|
|
82
|
+
}, [s]);
|
|
83
|
+
const v = z(async () => {
|
|
84
|
+
i(C(!0));
|
|
85
|
+
try {
|
|
86
|
+
const t = await pe(s);
|
|
87
|
+
I({
|
|
88
|
+
id: t.data.id,
|
|
89
|
+
subject: t.data.subject,
|
|
90
|
+
categoryId: t.data.category.id,
|
|
91
|
+
body: t.data.body,
|
|
92
|
+
attachments: t.data.attachments || [],
|
|
93
|
+
isDisabled: t.data.isDisabled
|
|
94
|
+
}), document.title = t.data.subject, n && n.editor.execCommand(
|
|
95
|
+
"mceSetContent",
|
|
96
|
+
!1,
|
|
97
|
+
t.data.body
|
|
98
|
+
);
|
|
99
|
+
} catch (t) {
|
|
100
|
+
i(
|
|
101
|
+
k({
|
|
102
|
+
type: "danger",
|
|
103
|
+
message: t.response?.data?.title || t.message
|
|
104
|
+
})
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
i(C(!1));
|
|
108
|
+
}, [s]), E = async () => {
|
|
109
|
+
i(C(!0));
|
|
110
|
+
try {
|
|
111
|
+
const a = (await ye()).data;
|
|
112
|
+
a && F(a.key);
|
|
113
|
+
} catch (t) {
|
|
114
|
+
i(
|
|
115
|
+
k({
|
|
116
|
+
type: "danger",
|
|
117
|
+
message: t.response?.data?.title || "Get key failed"
|
|
118
|
+
})
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
i(C(!1));
|
|
122
|
+
}, f = (t) => n = t, S = (t) => {
|
|
123
|
+
n && n.editor.execCommand(
|
|
124
|
+
"mceInsertContent",
|
|
125
|
+
!1,
|
|
126
|
+
` ${t.label}`
|
|
127
|
+
);
|
|
128
|
+
}, g = z(() => {
|
|
129
|
+
b(Ce);
|
|
130
|
+
}, []), _ = z(
|
|
131
|
+
async (t) => {
|
|
132
|
+
i(C(!0));
|
|
133
|
+
try {
|
|
134
|
+
if (u && u.length) {
|
|
135
|
+
const m = (await l()).map((r) => ({
|
|
136
|
+
key: r.data.key,
|
|
137
|
+
name: r.data.name
|
|
138
|
+
}));
|
|
139
|
+
t.attachments = [...t.attachments, ...m];
|
|
140
|
+
}
|
|
141
|
+
await (s ? fe : ge)(t), i(
|
|
142
|
+
k({
|
|
143
|
+
type: "success",
|
|
144
|
+
message: `${s ? "Update" : "Create"} template successfully`
|
|
145
|
+
})
|
|
146
|
+
), g();
|
|
147
|
+
} catch (a) {
|
|
148
|
+
i(
|
|
149
|
+
k({
|
|
150
|
+
type: "danger",
|
|
151
|
+
message: a.response?.data?.title || a.message
|
|
152
|
+
})
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
i(C(!1));
|
|
156
|
+
},
|
|
157
|
+
[s, u]
|
|
158
|
+
), B = () => {
|
|
159
|
+
const t = document.getElementsByClassName("input-attachment"), a = document.createElement("input");
|
|
160
|
+
document.getElementById("email-detail")?.append(a), a.className = "input-attachment", a.id = `inputAttachment-${t.length + 1}`, a.type = "file", a.style.display = "none", a.setAttribute("multiple", "multiple"), a.addEventListener("change", A), a.click();
|
|
161
|
+
}, A = () => {
|
|
162
|
+
const t = [];
|
|
163
|
+
let a = 0;
|
|
164
|
+
const y = document.getElementsByClassName("input-attachment");
|
|
165
|
+
for (const m of y)
|
|
166
|
+
for (const r of m.files)
|
|
167
|
+
a += r.size, a > ve && (i(
|
|
168
|
+
k({
|
|
169
|
+
type: "danger",
|
|
170
|
+
message: "Max attachment size is 4MB"
|
|
171
|
+
})
|
|
172
|
+
), a -= r.size, m.remove());
|
|
173
|
+
for (const m of y)
|
|
174
|
+
for (const r of m.files) {
|
|
175
|
+
const { name: N } = r;
|
|
176
|
+
!p.includes(r) && !t.some((Q) => Q.name === N) && t.push({ name: N, inputId: m.id });
|
|
177
|
+
}
|
|
178
|
+
L(t);
|
|
179
|
+
}, q = (t, a) => {
|
|
180
|
+
if (u.filter((y) => y.inputId === t).length === 1) {
|
|
181
|
+
document.getElementById(t)?.remove();
|
|
182
|
+
let m = u.filter(
|
|
183
|
+
(r) => r.inputId === t
|
|
184
|
+
);
|
|
185
|
+
u.filter(
|
|
186
|
+
(r) => r.inputId !== m.inputId
|
|
187
|
+
), p.push(m), x([...p]), L([...u]);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
x([...p, a]);
|
|
191
|
+
};
|
|
192
|
+
$(() => {
|
|
193
|
+
A();
|
|
194
|
+
}, [p]);
|
|
195
|
+
const l = async () => {
|
|
196
|
+
const t = document.getElementsByClassName("input-attachment"), a = [];
|
|
197
|
+
for (const y of t)
|
|
198
|
+
for (const m of y.files) {
|
|
199
|
+
const { name: r } = m, N = new FormData();
|
|
200
|
+
N.append("file", m, r), a.push(oe(N));
|
|
201
|
+
}
|
|
202
|
+
return Promise.all(a);
|
|
203
|
+
};
|
|
204
|
+
return $(() => {
|
|
205
|
+
document.title = Te, E(), o(!1), localStorage.getItem(window.location.href) && localStorage.removeItem(window.location.href);
|
|
206
|
+
}, []), {
|
|
207
|
+
emailTemplateDetail: d,
|
|
208
|
+
setEditorRef: f,
|
|
209
|
+
addParams: S,
|
|
210
|
+
backToList: g,
|
|
211
|
+
confirmData: _,
|
|
212
|
+
edited: T,
|
|
213
|
+
setEdited: o,
|
|
214
|
+
setEditedTrue: M,
|
|
215
|
+
onAttachFile: B,
|
|
216
|
+
updateAttachment: A,
|
|
217
|
+
fileUpload: u,
|
|
218
|
+
removeAttachment: q,
|
|
219
|
+
tinyMCEKey: j
|
|
220
|
+
};
|
|
221
|
+
}, Ae = R.object({
|
|
222
|
+
subject: R.string().required("Template subject is required"),
|
|
223
|
+
categoryId: R.number().required("Template category is required").test(
|
|
224
|
+
"test category id",
|
|
225
|
+
"Template category is required",
|
|
226
|
+
(s) => s >= 1
|
|
227
|
+
),
|
|
228
|
+
comment: R.string(),
|
|
229
|
+
body: R.string().required("Template body is required")
|
|
230
|
+
}), V = {
|
|
231
|
+
"detail-header": "_detail-header_oasq7_1",
|
|
232
|
+
"form-check-disabled": "_form-check-disabled_oasq7_8",
|
|
233
|
+
"active-status": "_active-status_oasq7_14"
|
|
234
|
+
}, Ne = "create_email_template", De = "edit_email_template", Pe = () => {
|
|
235
|
+
const { id: s } = ae(), { t: n } = W(), {
|
|
236
|
+
emailTemplateDetail: i,
|
|
237
|
+
setEditorRef: b,
|
|
238
|
+
addParams: d,
|
|
239
|
+
backToList: I,
|
|
240
|
+
confirmData: T,
|
|
241
|
+
edited: o,
|
|
242
|
+
setEdited: M,
|
|
243
|
+
setEditedTrue: p,
|
|
244
|
+
onAttachFile: x,
|
|
245
|
+
fileUpload: u,
|
|
246
|
+
removeAttachment: L
|
|
247
|
+
} = Se(parseInt(s || "0")), j = n(s ? De : Ne), F = n(s ? "update" : "create"), v = Z(
|
|
248
|
+
(E) => E.mailCategory.mailCategoryList
|
|
249
|
+
);
|
|
250
|
+
return /* @__PURE__ */ e(
|
|
251
|
+
ne,
|
|
252
|
+
{
|
|
253
|
+
initialValues: i,
|
|
254
|
+
enableReinitialize: !0,
|
|
255
|
+
validationSchema: Ae,
|
|
256
|
+
onSubmit: (E) => {
|
|
257
|
+
T(E), M(!1), localStorage.getItem(window.location.href) && localStorage.removeItem(window.location.href);
|
|
258
|
+
},
|
|
259
|
+
children: (E) => {
|
|
260
|
+
const {
|
|
261
|
+
values: f,
|
|
262
|
+
touched: S,
|
|
263
|
+
errors: g,
|
|
264
|
+
setFieldValue: _,
|
|
265
|
+
handleChange: B,
|
|
266
|
+
handleBlur: A,
|
|
267
|
+
handleSubmit: q
|
|
268
|
+
} = E;
|
|
269
|
+
return /* @__PURE__ */ c(
|
|
270
|
+
"div",
|
|
271
|
+
{
|
|
272
|
+
className: "animated fadeIn detail-buttons-padding",
|
|
273
|
+
id: "email-detail",
|
|
274
|
+
children: [
|
|
275
|
+
/* @__PURE__ */ e(ce, { when: o }),
|
|
276
|
+
/* @__PURE__ */ e(
|
|
277
|
+
"h5",
|
|
278
|
+
{
|
|
279
|
+
className: "mb-2",
|
|
280
|
+
style: { textTransform: "capitalize" },
|
|
281
|
+
children: j
|
|
282
|
+
}
|
|
283
|
+
),
|
|
284
|
+
/* @__PURE__ */ c(D, { className: "my-2", children: [
|
|
285
|
+
/* @__PURE__ */ c(h, { md: 8, children: [
|
|
286
|
+
/* @__PURE__ */ e(P, { text: n("mail_subject") }),
|
|
287
|
+
/* @__PURE__ */ c("div", { className: `${V["detail-header"]}`, children: [
|
|
288
|
+
/* @__PURE__ */ e(
|
|
289
|
+
K,
|
|
290
|
+
{
|
|
291
|
+
placeholder: n("mail_subject_nm"),
|
|
292
|
+
name: "subject",
|
|
293
|
+
value: f.subject,
|
|
294
|
+
onChange: (l) => {
|
|
295
|
+
B(l), p();
|
|
296
|
+
},
|
|
297
|
+
onBlur: A("subject"),
|
|
298
|
+
className: "selector-input"
|
|
299
|
+
}
|
|
300
|
+
),
|
|
301
|
+
/* @__PURE__ */ c(J, { check: !0, className: `${V["form-check-disabled"]}`, children: [
|
|
302
|
+
/* @__PURE__ */ e(
|
|
303
|
+
K,
|
|
304
|
+
{
|
|
305
|
+
type: "checkbox",
|
|
306
|
+
id: "disable-checkbox",
|
|
307
|
+
checked: !f.isDisabled,
|
|
308
|
+
onChange: () => {
|
|
309
|
+
_(
|
|
310
|
+
"isDisabled",
|
|
311
|
+
!f.isDisabled
|
|
312
|
+
);
|
|
313
|
+
},
|
|
314
|
+
className: ` ${V["active-status"]}`
|
|
315
|
+
}
|
|
316
|
+
),
|
|
317
|
+
/* @__PURE__ */ e(G, { check: !0, for: "di-default-checkbox", children: n("enabled") })
|
|
318
|
+
] })
|
|
319
|
+
] }),
|
|
320
|
+
S.subject && g.subject && /* @__PURE__ */ e(U, { text: g.subject })
|
|
321
|
+
] }),
|
|
322
|
+
/* @__PURE__ */ c(h, { md: 4, children: [
|
|
323
|
+
/* @__PURE__ */ e(P, { text: n("category") }),
|
|
324
|
+
/* @__PURE__ */ e(
|
|
325
|
+
Ie,
|
|
326
|
+
{
|
|
327
|
+
onChange: (l) => {
|
|
328
|
+
_("categoryId", l.value), p();
|
|
329
|
+
},
|
|
330
|
+
id: f.categoryId
|
|
331
|
+
}
|
|
332
|
+
),
|
|
333
|
+
S.categoryId && g.categoryId && /* @__PURE__ */ e(U, { text: g.categoryId })
|
|
334
|
+
] })
|
|
335
|
+
] }),
|
|
336
|
+
/* @__PURE__ */ c(D, { className: "mb-2", children: [
|
|
337
|
+
/* @__PURE__ */ e(h, { md: 8, children: /* @__PURE__ */ c(D, { children: [
|
|
338
|
+
/* @__PURE__ */ c(h, { md: 12, className: "mb-2", children: [
|
|
339
|
+
/* @__PURE__ */ e(P, { text: n("mail_body") }),
|
|
340
|
+
(i.body || !s) && /* @__PURE__ */ e(
|
|
341
|
+
se,
|
|
342
|
+
{
|
|
343
|
+
tinymceScriptSrc: "/tinymce/tinymce.min.js",
|
|
344
|
+
ref: (l) => b(l),
|
|
345
|
+
initialValue: i.body,
|
|
346
|
+
init: re.email,
|
|
347
|
+
onEditorChange: (l) => {
|
|
348
|
+
_(
|
|
349
|
+
"body",
|
|
350
|
+
l
|
|
351
|
+
), p();
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
),
|
|
355
|
+
S.body && g.body && /* @__PURE__ */ e(U, { text: g.body })
|
|
356
|
+
] }),
|
|
357
|
+
/* @__PURE__ */ e(h, { md: 12, children: /* @__PURE__ */ c(D, { children: [
|
|
358
|
+
/* @__PURE__ */ e(h, { md: 3, children: /* @__PURE__ */ e(
|
|
359
|
+
ee,
|
|
360
|
+
{
|
|
361
|
+
color: "link",
|
|
362
|
+
size: "sm",
|
|
363
|
+
className: "pl-0",
|
|
364
|
+
onClick: x,
|
|
365
|
+
children: n("add_attachment")
|
|
366
|
+
}
|
|
367
|
+
) }),
|
|
368
|
+
/* @__PURE__ */ e(h, { md: 12, children: /* @__PURE__ */ c(D, { children: [
|
|
369
|
+
f.attachments.map(
|
|
370
|
+
(l) => /* @__PURE__ */ e(
|
|
371
|
+
h,
|
|
372
|
+
{
|
|
373
|
+
md: 2,
|
|
374
|
+
children: /* @__PURE__ */ e(
|
|
375
|
+
O,
|
|
376
|
+
{
|
|
377
|
+
label: l.name,
|
|
378
|
+
onRemove: () => _(
|
|
379
|
+
"attachments",
|
|
380
|
+
f.attachments.filter(
|
|
381
|
+
(t) => t.name !== l.name
|
|
382
|
+
)
|
|
383
|
+
)
|
|
384
|
+
}
|
|
385
|
+
)
|
|
386
|
+
},
|
|
387
|
+
l.key
|
|
388
|
+
)
|
|
389
|
+
),
|
|
390
|
+
u.map(
|
|
391
|
+
(l, t) => /* @__PURE__ */ e(
|
|
392
|
+
h,
|
|
393
|
+
{
|
|
394
|
+
md: 2,
|
|
395
|
+
className: "d-flex align-items-center",
|
|
396
|
+
children: /* @__PURE__ */ e(
|
|
397
|
+
O,
|
|
398
|
+
{
|
|
399
|
+
label: l.name,
|
|
400
|
+
onRemove: () => L(
|
|
401
|
+
l.inputId,
|
|
402
|
+
l.name
|
|
403
|
+
)
|
|
404
|
+
}
|
|
405
|
+
)
|
|
406
|
+
},
|
|
407
|
+
t
|
|
408
|
+
)
|
|
409
|
+
)
|
|
410
|
+
] }) })
|
|
411
|
+
] }) })
|
|
412
|
+
] }) }),
|
|
413
|
+
/* @__PURE__ */ c(h, { md: 4, children: [
|
|
414
|
+
/* @__PURE__ */ e(G, { children: n("mail_params") }),
|
|
415
|
+
/* @__PURE__ */ e(
|
|
416
|
+
Ee,
|
|
417
|
+
{
|
|
418
|
+
onClick: (l) => d(l),
|
|
419
|
+
isResetPasswordTemplate: f.categoryId == (v && v.length > 0 && v.filter(
|
|
420
|
+
(l) => l.name == "Reset password"
|
|
421
|
+
)[0].id)
|
|
422
|
+
}
|
|
423
|
+
)
|
|
424
|
+
] })
|
|
425
|
+
] }),
|
|
426
|
+
/* @__PURE__ */ e(
|
|
427
|
+
me,
|
|
428
|
+
{
|
|
429
|
+
confirmText: F,
|
|
430
|
+
onConfirm: q,
|
|
431
|
+
onCancel: I
|
|
432
|
+
}
|
|
433
|
+
)
|
|
434
|
+
]
|
|
435
|
+
}
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
);
|
|
440
|
+
};
|
|
441
|
+
export {
|
|
442
|
+
Pe as default
|
|
443
|
+
};
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Row as f, Col as c, Table as _ } from "reactstrap";
|
|
3
|
+
import { J as D, b as g, K as I, L as A, c as y, O as R, P as w, Q as x, R as P, S as k, T as M, U as j } from "./index-7hA60HfM.mjs";
|
|
4
|
+
import { format as S } from "date-fns";
|
|
5
|
+
import { useCallback as T, useEffect as N } from "react";
|
|
6
|
+
import { useSelector as L, useDispatch as U } from "react-redux";
|
|
7
|
+
import { useNavigate as z } from "react-router-dom";
|
|
8
|
+
import { g as B, a as F, r as $ } from "./mailCategoryService-D_DFc1LB.mjs";
|
|
9
|
+
import { useTranslation as E } from "react-i18next";
|
|
10
|
+
const O = "/admin/email-template", J = "/admin/create-email-template", K = "Email template list", Q = () => {
|
|
11
|
+
const n = z(), { t: o } = E(), u = L(
|
|
12
|
+
(s) => s.emailTemplate.emailTemplateList
|
|
13
|
+
), d = L(
|
|
14
|
+
(s) => s.emailTemplate.totalItems
|
|
15
|
+
), r = L(
|
|
16
|
+
(s) => s.mailCategory.mailCategoryList
|
|
17
|
+
), { filters: i, changeFilters: h } = D(), t = U(), p = T(async () => {
|
|
18
|
+
t(g(!0));
|
|
19
|
+
try {
|
|
20
|
+
const s = await B(i), { items: m, totalItems: C } = s.data;
|
|
21
|
+
if (t(
|
|
22
|
+
I({ emailTemplateList: m, totalItems: C })
|
|
23
|
+
), r && r.length == 0) {
|
|
24
|
+
const v = await F();
|
|
25
|
+
t(A(v.data.items));
|
|
26
|
+
}
|
|
27
|
+
} catch (s) {
|
|
28
|
+
t(
|
|
29
|
+
y({
|
|
30
|
+
type: "danger",
|
|
31
|
+
message: s.response?.data?.title || s.message
|
|
32
|
+
})
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
t(g(!1));
|
|
36
|
+
}, [t, i]), a = T(
|
|
37
|
+
(s) => {
|
|
38
|
+
t(g(!0));
|
|
39
|
+
try {
|
|
40
|
+
t(
|
|
41
|
+
R({
|
|
42
|
+
isOpen: !0,
|
|
43
|
+
type: "warning",
|
|
44
|
+
message: o("do_you_want_to_remove_this_email_template"),
|
|
45
|
+
onConfirm: async () => {
|
|
46
|
+
await $(s), t(
|
|
47
|
+
y({
|
|
48
|
+
type: "success",
|
|
49
|
+
message: "Remove template successfully"
|
|
50
|
+
})
|
|
51
|
+
), h({ currentPage: 1 });
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
);
|
|
55
|
+
} catch (m) {
|
|
56
|
+
t(
|
|
57
|
+
y({
|
|
58
|
+
type: "danger",
|
|
59
|
+
message: m.response?.data?.title || m.message
|
|
60
|
+
})
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
t(g(!1));
|
|
64
|
+
},
|
|
65
|
+
[i]
|
|
66
|
+
), b = T((s) => {
|
|
67
|
+
const m = s ? `${O}/${s}` : J;
|
|
68
|
+
n(m);
|
|
69
|
+
}, []);
|
|
70
|
+
return N(() => {
|
|
71
|
+
document.title = K;
|
|
72
|
+
}, []), N(() => {
|
|
73
|
+
p();
|
|
74
|
+
}, [i]), {
|
|
75
|
+
emailTemplateList: u,
|
|
76
|
+
totalItems: d,
|
|
77
|
+
filters: i,
|
|
78
|
+
changeFilters: h,
|
|
79
|
+
getData: p,
|
|
80
|
+
removeData: a,
|
|
81
|
+
goToDetail: b,
|
|
82
|
+
mailCategoryList: r
|
|
83
|
+
};
|
|
84
|
+
}, q = "email_template", ae = () => {
|
|
85
|
+
const {
|
|
86
|
+
emailTemplateList: n,
|
|
87
|
+
totalItems: o,
|
|
88
|
+
filters: u,
|
|
89
|
+
changeFilters: d,
|
|
90
|
+
removeData: r,
|
|
91
|
+
goToDetail: i,
|
|
92
|
+
mailCategoryList: h
|
|
93
|
+
} = Q(), { t } = E(), p = (a) => {
|
|
94
|
+
r(a);
|
|
95
|
+
};
|
|
96
|
+
return /* @__PURE__ */ l("div", { className: "fadeIn animated", children: [
|
|
97
|
+
/* @__PURE__ */ e("h5", { className: "mb-2", children: t(q) }),
|
|
98
|
+
/* @__PURE__ */ l(f, { className: "my-2", children: [
|
|
99
|
+
/* @__PURE__ */ e(c, { md: 4, children: /* @__PURE__ */ e(
|
|
100
|
+
w,
|
|
101
|
+
{
|
|
102
|
+
text: t("create_template"),
|
|
103
|
+
onClick: () => i()
|
|
104
|
+
}
|
|
105
|
+
) }),
|
|
106
|
+
/* @__PURE__ */ l(
|
|
107
|
+
c,
|
|
108
|
+
{
|
|
109
|
+
md: 4,
|
|
110
|
+
className: "d-flex align-items-center justify-content-end",
|
|
111
|
+
children: [
|
|
112
|
+
t("total_of_templates"),
|
|
113
|
+
": ",
|
|
114
|
+
o
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
] }),
|
|
119
|
+
/* @__PURE__ */ l(f, { className: "mb-2", children: [
|
|
120
|
+
/* @__PURE__ */ l(c, { md: 8, children: [
|
|
121
|
+
n && n.length > 0 ? /* @__PURE__ */ l(_, { bordered: !0, hover: !0, striped: !0, responsive: !0, size: "sm", children: [
|
|
122
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ l("tr", { children: [
|
|
123
|
+
/* @__PURE__ */ e("th", { className: "align-top", children: t("template_name") }),
|
|
124
|
+
/* @__PURE__ */ e("th", { className: "align-top", children: t("category_name") }),
|
|
125
|
+
/* @__PURE__ */ e("th", { className: "align-top", children: t("created_date") }),
|
|
126
|
+
/* @__PURE__ */ e("th", { className: "align-top", children: t("status") }),
|
|
127
|
+
/* @__PURE__ */ e("th", { className: "text-center", children: t("action") })
|
|
128
|
+
] }) }),
|
|
129
|
+
/* @__PURE__ */ e("tbody", { children: n.map((a) => /* @__PURE__ */ l("tr", { children: [
|
|
130
|
+
/* @__PURE__ */ e("td", { className: "align-middle", children: /* @__PURE__ */ e(
|
|
131
|
+
x,
|
|
132
|
+
{
|
|
133
|
+
label: a.subject,
|
|
134
|
+
onClick: () => i(a.id)
|
|
135
|
+
}
|
|
136
|
+
) }),
|
|
137
|
+
/* @__PURE__ */ e("td", { className: "align-middle", children: a.category.name }),
|
|
138
|
+
/* @__PURE__ */ e("td", { className: "align-middle", children: S(
|
|
139
|
+
new Date(a.createdAt),
|
|
140
|
+
P
|
|
141
|
+
) }),
|
|
142
|
+
/* @__PURE__ */ e("td", { className: "align-middle", children: a.isDisabled ? t("disabled") : t("enabled") }),
|
|
143
|
+
/* @__PURE__ */ e("td", { className: "text-center align-middle", children: /* @__PURE__ */ e(
|
|
144
|
+
k,
|
|
145
|
+
{
|
|
146
|
+
onClick: () => p(a.id)
|
|
147
|
+
}
|
|
148
|
+
) })
|
|
149
|
+
] }, a.id)) })
|
|
150
|
+
] }) : /* @__PURE__ */ e(M, { label: t("template") }),
|
|
151
|
+
/* @__PURE__ */ e(f, { className: "mt-2", children: /* @__PURE__ */ e(c, { md: 12, children: /* @__PURE__ */ e(
|
|
152
|
+
j,
|
|
153
|
+
{
|
|
154
|
+
filters: u,
|
|
155
|
+
totalRecordCount: o,
|
|
156
|
+
changePageSize: (a) => d({ pageSize: a }),
|
|
157
|
+
changePage: (a) => d({ currentPage: a })
|
|
158
|
+
}
|
|
159
|
+
) }) })
|
|
160
|
+
] }),
|
|
161
|
+
/* @__PURE__ */ e(c, { md: 4, children: /* @__PURE__ */ l(_, { bordered: !0, hover: !0, striped: !0, responsive: !0, size: "sm", children: [
|
|
162
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("th", { className: "align-top", children: t("category_name") }) }) }),
|
|
163
|
+
/* @__PURE__ */ e("tbody", { children: h.map((a) => /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { className: "align-middle", children: a.name }) }, a.id)) })
|
|
164
|
+
] }) })
|
|
165
|
+
] })
|
|
166
|
+
] });
|
|
167
|
+
};
|
|
168
|
+
export {
|
|
169
|
+
ae as default
|
|
170
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("reactstrap"),a=require("./index-9XtI-PeV.js"),_=require("date-fns"),m=require("react"),x=require("react-redux"),b=require("react-router-dom"),j=require("./mailCategoryService-Bhcruih6.js"),y=require("react-i18next"),N="/admin/email-template",f="/admin/create-email-template",E="Email template list",v=()=>{const c=b.useNavigate(),{t:d}=y.useTranslation(),p=x.useSelector(l=>l.emailTemplate.emailTemplateList),u=x.useSelector(l=>l.emailTemplate.totalItems),o=x.useSelector(l=>l.mailCategory.mailCategoryList),{filters:n,changeFilters:h}=a.useFilters(),t=x.useDispatch(),g=m.useCallback(async()=>{t(a.setLoading(!0));try{const l=await j.get(n),{items:r,totalItems:L}=l.data;if(t(a.setEmailTemplateList({emailTemplateList:r,totalItems:L})),o&&o.length==0){const C=await j.get$1();t(a.setMailCategory(C.data.items))}}catch(l){t(a.setAlert({type:"danger",message:l.response?.data?.title||l.message}))}t(a.setLoading(!1))},[t,n]),s=m.useCallback(l=>{t(a.setLoading(!0));try{t(a.setModal({isOpen:!0,type:"warning",message:d("do_you_want_to_remove_this_email_template"),onConfirm:async()=>{await j.remove(l),t(a.setAlert({type:"success",message:"Remove template successfully"})),h({currentPage:1})}}))}catch(r){t(a.setAlert({type:"danger",message:r.response?.data?.title||r.message}))}t(a.setLoading(!1))},[n]),T=m.useCallback(l=>{const r=l?`${N}/${l}`:f;c(r)},[]);return m.useEffect(()=>{document.title=E},[]),m.useEffect(()=>{g()},[n]),{emailTemplateList:p,totalItems:u,filters:n,changeFilters:h,getData:g,removeData:s,goToDetail:T,mailCategoryList:o}},R="email_template",D=()=>{const{emailTemplateList:c,totalItems:d,filters:p,changeFilters:u,removeData:o,goToDetail:n,mailCategoryList:h}=v(),{t}=y.useTranslation(),g=s=>{o(s)};return e.jsxs("div",{className:"fadeIn animated",children:[e.jsx("h5",{className:"mb-2",children:t(R)}),e.jsxs(i.Row,{className:"my-2",children:[e.jsx(i.Col,{md:4,children:e.jsx(a.AddButton,{text:t("create_template"),onClick:()=>n()})}),e.jsxs(i.Col,{md:4,className:"d-flex align-items-center justify-content-end",children:[t("total_of_templates"),": ",d]})]}),e.jsxs(i.Row,{className:"mb-2",children:[e.jsxs(i.Col,{md:8,children:[c&&c.length>0?e.jsxs(i.Table,{bordered:!0,hover:!0,striped:!0,responsive:!0,size:"sm",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"align-top",children:t("template_name")}),e.jsx("th",{className:"align-top",children:t("category_name")}),e.jsx("th",{className:"align-top",children:t("created_date")}),e.jsx("th",{className:"align-top",children:t("status")}),e.jsx("th",{className:"text-center",children:t("action")})]})}),e.jsx("tbody",{children:c.map(s=>e.jsxs("tr",{children:[e.jsx("td",{className:"align-middle",children:e.jsx(a.LinkEditButton,{label:s.subject,onClick:()=>n(s.id)})}),e.jsx("td",{className:"align-middle",children:s.category.name}),e.jsx("td",{className:"align-middle",children:_.format(new Date(s.createdAt),a.DATE_RESULT)}),e.jsx("td",{className:"align-middle",children:s.isDisabled?t("disabled"):t("enabled")}),e.jsx("td",{className:"text-center align-middle",children:e.jsx(a.DeleteButtonIcon,{onClick:()=>g(s.id)})})]},s.id))})]}):e.jsx(a.EmptyDataAlert,{label:t("template")}),e.jsx(i.Row,{className:"mt-2",children:e.jsx(i.Col,{md:12,children:e.jsx(a.CustomPagination,{filters:p,totalRecordCount:d,changePageSize:s=>u({pageSize:s}),changePage:s=>u({currentPage:s})})})})]}),e.jsx(i.Col,{md:4,children:e.jsxs(i.Table,{bordered:!0,hover:!0,striped:!0,responsive:!0,size:"sm",children:[e.jsx("thead",{children:e.jsx("tr",{children:e.jsx("th",{className:"align-top",children:t("category_name")})})}),e.jsx("tbody",{children:h.map(s=>e.jsx("tr",{children:e.jsx("td",{className:"align-middle",children:s.name})},s.id))})]})})]})]})};exports.default=D;
|