mario-core 2.0.29-stage → 2.0.30-stage
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-CAVqjjrG.js +1 -0
- package/dist/Dashboard-CVuORIyI.mjs +206 -0
- package/dist/EmailTemplateDetail-4dZI64Lb.js +1 -0
- package/dist/EmailTemplateDetail-vgrt9Pc9.mjs +417 -0
- package/dist/EmailTemplateList-CQOTf2JO.js +1 -0
- package/dist/EmailTemplateList-DeRmqQu7.mjs +168 -0
- package/dist/GalleryList-281mYtjV.js +1 -0
- package/dist/GalleryList-DApnipUR.mjs +329 -0
- package/dist/Login-BtxbkYUD.mjs +1380 -0
- package/dist/Login-DI08njjn.js +1 -0
- package/dist/NotificationList-BBR15Uee.js +2 -0
- package/dist/NotificationList-CtKVU5sk.mjs +3969 -0
- package/dist/SkillList-BrZ7cFXD.js +1 -0
- package/dist/SkillList-kjFrnyCm.mjs +386 -0
- package/dist/TeacherSelector-CIQLA9-V.mjs +30 -0
- package/dist/TeacherSelector-CXp3FGPB.js +1 -0
- package/dist/TheContent-BiIwM7H3.mjs +38 -0
- package/dist/TheContent-ChWbI-Jj.js +1 -0
- package/dist/UserContainer-DBm4esW-.js +5 -0
- package/dist/UserContainer-DnEm99qO.mjs +2770 -0
- package/dist/UserDetail-CHczUfZD.js +1 -0
- package/dist/UserDetail-L5oSAQS6.mjs +902 -0
- package/dist/UserList-BRp375RY.mjs +1171 -0
- package/dist/UserList-S2JLYMNu.js +5 -0
- package/dist/constants-BClbHAF2.js +1 -0
- package/dist/constants-DcEi8Wtj.mjs +320 -0
- package/dist/index-CQarmA1u.mjs +17757 -0
- package/dist/index-_LVJdhk_.js +15 -0
- package/dist/index.js +1 -1
- package/dist/index.modern.js +1 -1
- package/dist/mailCategoryService-CCQCUudB.mjs +11 -0
- package/dist/mailCategoryService-DDsrRt_u.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("react"),p=require("react-redux"),n=require("reactstrap"),s=require("./index-_LVJdhk_.js"),g=require("react-router-dom"),j=()=>e.jsxs("div",{className:`${s.styles["content-quote"]}`,children:[e.jsxs("div",{className:`${s.styles["title-quote"]} d-block`,children:[e.jsx("p",{children:"Powerful"}),e.jsx("p",{children:"Personalized"}),e.jsx("p",{children:"Learning"})]}),e.jsxs("div",{className:`${s.styles["descriptions-quote"]} d-block`,children:[e.jsx("p",{children:"Focus on what matters most to you and"}),e.jsx("p",{children:"make learning meaningful."})]})]}),x=({srcIcon:t,content:a})=>e.jsxs("div",{className:`${s.styles["content-icon"]}`,children:[e.jsx("div",{className:`${s.styles["title-icon"]}`,children:e.jsx("img",{src:s.getStaticFileUrl(t),alt:"icon"})}),e.jsx("div",{className:`${s.styles["descriptions-icon"]}`,dangerouslySetInnerHTML:{__html:a}})]},a),v=[{scrIcon:"/images/ChatsTeardrop.svg",content:"<p>Understand yourself better through <span>helpful feedback</span>.</p>"},{scrIcon:"/images/Student.svg",content:"<p>Create, explore, and share exciting <span>personalized</span> learning journeys.</p>"},{scrIcon:"/images/Confetti.svg",content:"<p>Set, monitor, and achieve <span>your goals</span>.</p>"}],y=({})=>e.jsxs(n.Row,{className:`${s.styles["page-not-login"]}`,children:[e.jsx(n.Col,{md:12,children:e.jsx(j,{})}),e.jsx(n.Col,{md:12,className:`${s.styles["box-content-home-page"]} d-flex align-items-center`,children:v.map(t=>e.jsx(x,{srcIcon:t.scrIcon,content:t.content},t.scrIcon))})]});function N(t){return s.GenIcon({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M32 96v64h448V96H32zm0 128v64h448v-64H32zm0 128v64h448v-64H32z"}}]})(t)}const b=1e4,f=({data:t,duration:a=b})=>{const[i,o]=c.useState(t.length),r=c.useRef(null),d=c.useCallback(l=>l===i?`${s.styles.active} ${s.styles.show}`:"",[i]),h=c.useCallback(l=>i===0&&l===t.length-1||l===i-1?s.styles.behind:"",[i,t.length]),u=c.useCallback(()=>{r&&r.current&&clearInterval(r.current),r.current=setInterval(()=>{o(l=>l>=t.length-1?0:l+1)},a)},[a,t.length]);return c.useEffect(()=>(u(),()=>{r&&r.current&&clearInterval(r.current)}),[t.length,a]),e.jsx("div",{className:`${s.styles["bg-animate"]} position-absolute`,children:t.map((l,m)=>e.jsx("img",{alt:`Image ${m+1}`,className:`${h(m)} ${d(m)}`,src:s.getStaticFileUrl(l)},m))})},I="/admin/users/user-list",$="/home",k="/home",C="Dashboard",T="Mario Education",S=["images/landing-page.jpg","images/landing-page2.jpg","images/landing-page3.jpg"],E=({version:t})=>{const[a,i]=c.useState(!1),o=p.useSelector(d=>d.common.user),r=()=>i(!a);return c.useEffect(()=>{o?document.title=C:document.title=T},[o]),e.jsxs("div",{className:`${s.styles.login} ${s.styles["red-background"]} position-relative`,children:[e.jsx("span",{className:`${s.styles["version-prod"]}`,children:`v ${t}`}),e.jsx(f,{data:S}),e.jsxs("div",{className:`${s.styles["login-content"]}`,children:[e.jsxs(n.Navbar,{light:!0,expand:"md",children:[e.jsx(n.NavbarBrand,{href:"/",className:`${s.styles["logo-home"]}`,children:e.jsx("img",{src:s.getStaticFileUrl("/images/logo-white.svg"),alt:"mario"})}),e.jsx(N,{onClick:r,className:`${s.styles["hide-in-desktop"]} ${s.styles["hamburger-menu"]}`}),e.jsxs(n.Collapse,{isOpen:a,navbar:!0,className:`${s.styles["collapse-box"]}`,children:[e.jsxs(n.Nav,{className:`${s.styles["nav-home"]} d-md-flex w-100 justify-content-center mr-auto`,navbar:!0,children:[e.jsx(n.NavItem,{children:e.jsx(n.NavLink,{className:`${s.styles["learn-more"]} align-self-md-center`,href:"https://marioframework.com/software",target:"blank",children:"Learn More"})}),e.jsx(n.NavItem,{children:e.jsx(n.NavLink,{className:`${s.styles["learn-more"]} align-self-md-center`,href:"mailto: Info@marioeducation.com",target:"blank",children:"Contact"})}),e.jsx(n.NavItem,{children:e.jsx(n.NavLink,{className:`${s.styles["learn-more"]} align-self-md-center`,href:"/privacy-policy",target:"blank",children:"Privacy Policy"})})]}),e.jsx("div",{className:`${s.styles["hide-in-mobile"]} d-flex justify-content-end`,children:o?e.jsx(g.Link,{to:o.roles.includes("Admin")?I:o.roles.includes("Teacher")?$:k,className:`${s.styles["btn-trans-border"]}`,children:"Dashboard"}):e.jsx(g.Link,{to:"/login",className:`${s.styles["btn-trans-border"]}`,children:"Login"})})]})]}),e.jsx("div",{className:"",children:e.jsx(y,{})}),e.jsx("div",{className:`${s.styles["digital-privacy-icon"]}`,children:e.jsx("a",{href:"https://cert.privo.com/#/companies/marioFrameworkLlc",target:"blank",children:e.jsx("img",{src:s.getStaticFileUrl("/images/STUDENT.png"),alt:"icon"})})})]})]})};exports.default=E;
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as N, useRef as I, useCallback as h, useEffect as f } from "react";
|
|
3
|
+
import { useSelector as k } from "react-redux";
|
|
4
|
+
import { Row as T, Col as u, Navbar as C, NavbarBrand as y, Collapse as E, Nav as A, NavItem as g, NavLink as p } from "reactstrap";
|
|
5
|
+
import { s as n, h as m, G as H } from "./index-CQarmA1u.mjs";
|
|
6
|
+
import { Link as v } from "react-router-dom";
|
|
7
|
+
const M = () => /* @__PURE__ */ a("div", { className: `${n["content-quote"]}`, children: [
|
|
8
|
+
/* @__PURE__ */ a("div", { className: `${n["title-quote"]} d-block`, children: [
|
|
9
|
+
/* @__PURE__ */ e("p", { children: "Powerful" }),
|
|
10
|
+
/* @__PURE__ */ e("p", { children: "Personalized" }),
|
|
11
|
+
/* @__PURE__ */ e("p", { children: "Learning" })
|
|
12
|
+
] }),
|
|
13
|
+
/* @__PURE__ */ a(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
className: `${n["descriptions-quote"]} d-block`,
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ e("p", { children: "Focus on what matters most to you and" }),
|
|
19
|
+
/* @__PURE__ */ e("p", { children: "make learning meaningful." })
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
)
|
|
23
|
+
] }), w = ({ srcIcon: r, content: t }) => /* @__PURE__ */ a("div", { className: `${n["content-icon"]}`, children: [
|
|
24
|
+
/* @__PURE__ */ e("div", { className: `${n["title-icon"]}`, children: /* @__PURE__ */ e("img", { src: m(r), alt: "icon" }) }),
|
|
25
|
+
/* @__PURE__ */ e(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
className: `${n["descriptions-icon"]}`,
|
|
29
|
+
dangerouslySetInnerHTML: { __html: t }
|
|
30
|
+
}
|
|
31
|
+
)
|
|
32
|
+
] }, t), D = [
|
|
33
|
+
{
|
|
34
|
+
scrIcon: "/images/ChatsTeardrop.svg",
|
|
35
|
+
content: "<p>Understand yourself better through <span>helpful feedback</span>.</p>"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
scrIcon: "/images/Student.svg",
|
|
39
|
+
content: "<p>Create, explore, and share exciting <span>personalized</span> learning journeys.</p>"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
scrIcon: "/images/Confetti.svg",
|
|
43
|
+
content: "<p>Set, monitor, and achieve <span>your goals</span>.</p>"
|
|
44
|
+
}
|
|
45
|
+
], L = ({}) => /* @__PURE__ */ a(T, { className: `${n["page-not-login"]}`, children: [
|
|
46
|
+
/* @__PURE__ */ e(u, { md: 12, children: /* @__PURE__ */ e(M, {}) }),
|
|
47
|
+
/* @__PURE__ */ e(u, { md: 12, className: `${n["box-content-home-page"]} d-flex align-items-center`, children: D.map((r) => /* @__PURE__ */ e(
|
|
48
|
+
w,
|
|
49
|
+
{
|
|
50
|
+
srcIcon: r.scrIcon,
|
|
51
|
+
content: r.content
|
|
52
|
+
},
|
|
53
|
+
r.scrIcon
|
|
54
|
+
)) })
|
|
55
|
+
] });
|
|
56
|
+
function O(r) {
|
|
57
|
+
return H({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M32 96v64h448V96H32zm0 128v64h448v-64H32zm0 128v64h448v-64H32z" } }] })(r);
|
|
58
|
+
}
|
|
59
|
+
const S = 1e4, _ = ({
|
|
60
|
+
data: r,
|
|
61
|
+
duration: t = S
|
|
62
|
+
}) => {
|
|
63
|
+
const [o, l] = N(r.length), s = I(null), d = h((c) => c === o ? `${n.active} ${n.show}` : "", [o]), $ = h((c) => o === 0 && c === r.length - 1 || c === o - 1 ? n.behind : "", [o, r.length]), b = h(() => {
|
|
64
|
+
s && s.current && clearInterval(s.current), s.current = setInterval(() => {
|
|
65
|
+
l((c) => c >= r.length - 1 ? 0 : c + 1);
|
|
66
|
+
}, t);
|
|
67
|
+
}, [t, r.length]);
|
|
68
|
+
return f(() => (b(), () => {
|
|
69
|
+
s && s.current && clearInterval(s.current);
|
|
70
|
+
}), [r.length, t]), /* @__PURE__ */ e("div", { className: `${n["bg-animate"]} position-absolute`, children: r.map((c, i) => /* @__PURE__ */ e(
|
|
71
|
+
"img",
|
|
72
|
+
{
|
|
73
|
+
alt: `Image ${i + 1}`,
|
|
74
|
+
className: `${$(i)} ${d(i)}`,
|
|
75
|
+
src: m(c)
|
|
76
|
+
},
|
|
77
|
+
i
|
|
78
|
+
)) });
|
|
79
|
+
}, j = "/admin/users/user-list", x = "/home", B = "/home", R = "Dashboard", U = "Mario Education", z = [
|
|
80
|
+
"images/landing-page.jpg",
|
|
81
|
+
"images/landing-page2.jpg",
|
|
82
|
+
"images/landing-page3.jpg"
|
|
83
|
+
], J = ({ version: r }) => {
|
|
84
|
+
const [t, o] = N(!1), l = k((d) => d.common.user), s = () => o(!t);
|
|
85
|
+
return f(() => {
|
|
86
|
+
l ? document.title = R : document.title = U;
|
|
87
|
+
}, [l]), /* @__PURE__ */ a(
|
|
88
|
+
"div",
|
|
89
|
+
{
|
|
90
|
+
className: `${n.login} ${n["red-background"]} position-relative`,
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ e(
|
|
93
|
+
"span",
|
|
94
|
+
{
|
|
95
|
+
className: `${n["version-prod"]}`,
|
|
96
|
+
children: `v ${r}`
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
/* @__PURE__ */ e(_, { data: z }),
|
|
100
|
+
/* @__PURE__ */ a("div", { className: `${n["login-content"]}`, children: [
|
|
101
|
+
/* @__PURE__ */ a(C, { light: !0, expand: "md", children: [
|
|
102
|
+
/* @__PURE__ */ e(y, { href: "/", className: `${n["logo-home"]}`, children: /* @__PURE__ */ e(
|
|
103
|
+
"img",
|
|
104
|
+
{
|
|
105
|
+
src: m("/images/logo-white.svg"),
|
|
106
|
+
alt: "mario"
|
|
107
|
+
}
|
|
108
|
+
) }),
|
|
109
|
+
/* @__PURE__ */ e(
|
|
110
|
+
O,
|
|
111
|
+
{
|
|
112
|
+
onClick: s,
|
|
113
|
+
className: `${n["hide-in-desktop"]} ${n["hamburger-menu"]}`
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
/* @__PURE__ */ a(
|
|
117
|
+
E,
|
|
118
|
+
{
|
|
119
|
+
isOpen: t,
|
|
120
|
+
navbar: !0,
|
|
121
|
+
className: `${n["collapse-box"]}`,
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ a(
|
|
124
|
+
A,
|
|
125
|
+
{
|
|
126
|
+
className: `${n["nav-home"]} d-md-flex w-100 justify-content-center mr-auto`,
|
|
127
|
+
navbar: !0,
|
|
128
|
+
children: [
|
|
129
|
+
/* @__PURE__ */ e(g, { children: /* @__PURE__ */ e(
|
|
130
|
+
p,
|
|
131
|
+
{
|
|
132
|
+
className: `${n["learn-more"]} align-self-md-center`,
|
|
133
|
+
href: "https://marioframework.com/software",
|
|
134
|
+
target: "blank",
|
|
135
|
+
children: "Learn More"
|
|
136
|
+
}
|
|
137
|
+
) }),
|
|
138
|
+
/* @__PURE__ */ e(g, { children: /* @__PURE__ */ e(
|
|
139
|
+
p,
|
|
140
|
+
{
|
|
141
|
+
className: `${n["learn-more"]} align-self-md-center`,
|
|
142
|
+
href: "mailto: Info@marioeducation.com",
|
|
143
|
+
target: "blank",
|
|
144
|
+
children: "Contact"
|
|
145
|
+
}
|
|
146
|
+
) }),
|
|
147
|
+
/* @__PURE__ */ e(g, { children: /* @__PURE__ */ e(
|
|
148
|
+
p,
|
|
149
|
+
{
|
|
150
|
+
className: `${n["learn-more"]} align-self-md-center`,
|
|
151
|
+
href: "/privacy-policy",
|
|
152
|
+
target: "blank",
|
|
153
|
+
children: "Privacy Policy"
|
|
154
|
+
}
|
|
155
|
+
) })
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
/* @__PURE__ */ e(
|
|
160
|
+
"div",
|
|
161
|
+
{
|
|
162
|
+
className: `${n["hide-in-mobile"]} d-flex justify-content-end`,
|
|
163
|
+
children: l ? /* @__PURE__ */ e(
|
|
164
|
+
v,
|
|
165
|
+
{
|
|
166
|
+
to: l.roles.includes("Admin") ? j : l.roles.includes("Teacher") ? x : B,
|
|
167
|
+
className: `${n["btn-trans-border"]}`,
|
|
168
|
+
children: "Dashboard"
|
|
169
|
+
}
|
|
170
|
+
) : /* @__PURE__ */ e(
|
|
171
|
+
v,
|
|
172
|
+
{
|
|
173
|
+
to: "/login",
|
|
174
|
+
className: `${n["btn-trans-border"]}`,
|
|
175
|
+
children: "Login"
|
|
176
|
+
}
|
|
177
|
+
)
|
|
178
|
+
}
|
|
179
|
+
)
|
|
180
|
+
]
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
] }),
|
|
184
|
+
/* @__PURE__ */ e("div", { className: "", children: /* @__PURE__ */ e(L, {}) }),
|
|
185
|
+
/* @__PURE__ */ e("div", { className: `${n["digital-privacy-icon"]}`, children: /* @__PURE__ */ e(
|
|
186
|
+
"a",
|
|
187
|
+
{
|
|
188
|
+
href: "https://cert.privo.com/#/companies/marioFrameworkLlc",
|
|
189
|
+
target: "blank",
|
|
190
|
+
children: /* @__PURE__ */ e(
|
|
191
|
+
"img",
|
|
192
|
+
{
|
|
193
|
+
src: m("/images/STUDENT.png"),
|
|
194
|
+
alt: "icon"
|
|
195
|
+
}
|
|
196
|
+
)
|
|
197
|
+
}
|
|
198
|
+
) })
|
|
199
|
+
] })
|
|
200
|
+
]
|
|
201
|
+
}
|
|
202
|
+
);
|
|
203
|
+
};
|
|
204
|
+
export {
|
|
205
|
+
J as default
|
|
206
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("reactstrap"),B=require("react-router-dom"),O=require("@tinymce/tinymce-react"),H=require("formik"),l=require("./index-_LVJdhk_.js"),U=require("react-i18next"),u=require("react"),K=require("react-select"),N=require("react-redux"),v=require("./mailCategoryService-DDsrRt_u.js"),V=require("yup");function G(a){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const n in a)if(n!=="default"){const p=Object.getOwnPropertyDescriptor(a,n);Object.defineProperty(s,n,p.get?p:{enumerable:!0,get:()=>a[n]})}}return s.default=a,Object.freeze(s)}const A=G(V),Q=({onClick:a})=>e.jsx("div",{className:"d-inline text-center cursor-pointer hover-opacity",title:"Delete",onClick:a,children:e.jsx(l.FaPlus,{})}),F=[{label:"$USER_FIRST_NAME$",meaning:"user_first_name"},{label:"$USER_LAST_NAME$",meaning:"user_last_name"},{label:"$PASSWORD$",meaning:"password"},{label:"$USER_NAME$",meaning:"user_name"},{label:"$USER_EMAIL$",meaning:"user_email"},{label:"$MESSAGE$",meaning:"message"},{label:"$DOMAIN$",meaning:"domain"}],W=({onClick:a,isResetPasswordTemplate:s})=>{const{t:n}=U.useTranslation();let p=s?[...F,{label:"$RESET_LINK$",meaning:"Reset link"}]:F;return e.jsxs(r.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:n("params")}),e.jsx("th",{className:"align-top",children:n("meaning")}),e.jsx("th",{})]})}),e.jsx("tbody",{children:p.map(h=>e.jsxs("tr",{children:[e.jsx("td",{className:"align-middle",children:h.label}),e.jsx("td",{className:"align-middle",children:n(h.meaning)}),e.jsx("td",{className:"text-center align-middle",children:e.jsx(Q,{onClick:()=>a(h)})})]},h.label))})]})},X=a=>{const s=N.useDispatch(),n=N.useSelector(c=>c.mailCategory.mailCategoryList);u.useEffect(()=>{p()},[]);const p=async()=>{try{const c=await v.get$1();s(l.setMailCategory(c.data.items))}catch(c){console.error(c)}},{id:h}=a,E=n.map(c=>({id:c.id,value:c.id,label:c.name})),C=h&&E.find(c=>c.value===h)||null;return e.jsx(K,{options:E,value:C,...a})},P=({label:a,onRemove:s})=>e.jsxs(u.Fragment,{children:[e.jsx("span",{className:"mr-2",children:a}),e.jsx("i",{className:"fa fa-times text-danger cursor-pointer hover-opacity",onClick:s})]}),Z={id:0,subject:"",categoryId:0,body:"",attachments:[]},J="/admin/email-template",Y="Email template detail",ee=4194304,te=a=>{let s;const n=N.useDispatch(),p=B.useNavigate(),[h,E]=u.useState(Z),[C,c]=u.useState(!1),D=async()=>{localStorage.setItem(window.location.href,"true"),c(!0)},[y,w]=u.useState([]),[g,L]=u.useState([]),[M,q]=u.useState("");u.useEffect(()=>{a&&I()},[a]);const I=u.useCallback(async()=>{n(l.setLoading(!0));try{const t=await v.getById(a);E({id:t.data.id,subject:t.data.subject,categoryId:t.data.category.id,body:t.data.body,attachments:t.data.attachments||[]}),document.title=t.data.subject,s&&s.editor.execCommand("mceSetContent",!1,t.data.body)}catch(t){n(l.setAlert({type:"danger",message:t.response?.data?.title||t.message}))}n(l.setLoading(!1))},[a]),x=async()=>{n(l.setLoading(!0));try{const i=(await v.getTinyMCEKeyApi()).data;i&&q(i.key)}catch(t){n(l.setAlert({type:"danger",message:t.response?.data?.title||"Get key failed"}))}n(l.setLoading(!1))},b=t=>s=t,S=t=>{s&&s.editor.execCommand("mceInsertContent",!1,` ${t.label}`)},f=u.useCallback(()=>{p(J)},[]),T=u.useCallback(async t=>{n(l.setLoading(!0));try{if(g&&g.length){const m=(await o()).map(d=>({key:d.data.key,name:d.data.name}));t.attachments=[...t.attachments,...m]}await(a?v.update:v.create)(t),n(l.setAlert({type:"success",message:`${a?"Update":"Create"} template successfully`})),f()}catch(i){n(l.setAlert({type:"danger",message:i.response?.data?.title||i.message}))}n(l.setLoading(!1))},[a,g]),k=()=>{const t=document.getElementsByClassName("input-attachment"),i=document.createElement("input");document.getElementById("email-detail")?.append(i),i.className="input-attachment",i.id=`inputAttachment-${t.length+1}`,i.type="file",i.style.display="none",i.setAttribute("multiple","multiple"),i.addEventListener("change",R),i.click()},R=()=>{const t=[];let i=0;const j=document.getElementsByClassName("input-attachment");for(const m of j)for(const d of m.files)i+=d.size,i>ee&&(n(l.setAlert({type:"danger",message:"Max attachment size is 4MB"})),i-=d.size,m.remove());for(const m of j)for(const d of m.files){const{name:_}=d;!y.includes(d)&&!t.some(z=>z.name===_)&&t.push({name:_,inputId:m.id})}L(t)},$=(t,i)=>{if(g.filter(j=>j.inputId===t).length===1){document.getElementById(t)?.remove();let m=g.filter(d=>d.inputId===t);g.filter(d=>d.inputId!==m.inputId),y.push(m),w([...y]),L([...g]);return}w([...y,i])};u.useEffect(()=>{R()},[y]);const o=async()=>{const t=document.getElementsByClassName("input-attachment"),i=[];for(const j of t)for(const m of j.files){const{name:d}=m,_=new FormData;_.append("file",m,d),i.push(l.systemEmailUpload(_))}return Promise.all(i)};return u.useEffect(()=>{document.title=Y,x(),c(!1),localStorage.getItem(window.location.href)&&localStorage.removeItem(window.location.href)},[]),{emailTemplateDetail:h,setEditorRef:b,addParams:S,backToList:f,confirmData:T,edited:C,setEdited:c,setEditedTrue:D,onAttachFile:k,updateAttachment:R,fileUpload:g,removeAttachment:$,tinyMCEKey:M}},ae=A.object({subject:A.string().required("Template subject is required"),categoryId:A.number().required("Template category is required").test("test category id","Template category is required",a=>a>=1),comment:A.string(),body:A.string().required("Template body is required")}),se="create_email_template",ne="edit_email_template",ie=()=>{const{id:a}=B.useParams(),{t:s}=U.useTranslation(),{emailTemplateDetail:n,setEditorRef:p,addParams:h,backToList:E,confirmData:C,edited:c,setEdited:D,setEditedTrue:y,onAttachFile:w,fileUpload:g,removeAttachment:L}=te(parseInt(a||"0")),M=s(a?ne:se),q=s(a?"update":"create"),I=N.useSelector(x=>x.mailCategory.mailCategoryList);return e.jsx(H.Formik,{initialValues:n,enableReinitialize:!0,validationSchema:ae,onSubmit:x=>{C(x),D(!1),localStorage.getItem(window.location.href)&&localStorage.removeItem(window.location.href)},children:x=>{const{values:b,touched:S,errors:f,setFieldValue:T,handleChange:k,handleBlur:R,handleSubmit:$}=x;return e.jsxs("div",{className:"animated fadeIn detail-buttons-padding",id:"email-detail",children:[e.jsx(l.QuitPrompt,{when:c}),e.jsx("h5",{className:"mb-2",style:{textTransform:"capitalize"},children:M}),e.jsxs(r.Row,{className:"my-2",children:[e.jsxs(r.Col,{md:8,children:[e.jsx(l.RequiredLabel,{text:s("mail_subject")}),e.jsx(r.Input,{placeholder:s("mail_subject_nm"),name:"subject",value:b.subject,onChange:o=>{k(o),y()},onBlur:R("subject"),className:"selector-input"}),S.subject&&f.subject&&e.jsx(l.ErrorHandler,{text:f.subject})]}),e.jsxs(r.Col,{md:4,children:[e.jsx(l.RequiredLabel,{text:s("category")}),e.jsx(X,{onChange:o=>{T("categoryId",o.value),y()},id:b.categoryId}),S.categoryId&&f.categoryId&&e.jsx(l.ErrorHandler,{text:f.categoryId})]})]}),e.jsxs(r.Row,{className:"mb-2",children:[e.jsx(r.Col,{md:8,children:e.jsxs(r.Row,{children:[e.jsxs(r.Col,{md:12,className:"mb-2",children:[e.jsx(l.RequiredLabel,{text:s("mail_body")}),(n.body||!a)&&e.jsx(O.Editor,{tinymceScriptSrc:"/tinymce/tinymce.min.js",ref:o=>p(o),initialValue:n.body,init:l.editorConfig.email,onEditorChange:o=>{T("body",o),y()}}),S.body&&f.body&&e.jsx(l.ErrorHandler,{text:f.body})]}),e.jsx(r.Col,{md:12,children:e.jsxs(r.Row,{children:[e.jsx(r.Col,{md:3,children:e.jsx(r.Button,{color:"link",size:"sm",className:"pl-0",onClick:w,children:s("add_attachment")})}),e.jsx(r.Col,{md:12,children:e.jsxs(r.Row,{children:[b.attachments.map(o=>e.jsx(r.Col,{md:2,children:e.jsx(P,{label:o.name,onRemove:()=>T("attachments",b.attachments.filter(t=>t.name!==o.name))})},o.key)),g.map((o,t)=>e.jsx(r.Col,{md:2,className:"d-flex align-items-center",children:e.jsx(P,{label:o.name,onRemove:()=>L(o.inputId,o.name)})},t))]})})]})})]})}),e.jsxs(r.Col,{md:4,children:[e.jsx(r.Label,{children:s("mail_params")}),e.jsx(W,{onClick:o=>h(o),isResetPasswordTemplate:b.categoryId==(I&&I.length>0&&I.filter(o=>o.name=="Reset password")[0].id)})]})]}),e.jsx(l.DetailActionButtons,{confirmText:q,onConfirm:$,onCancel:E})]})}})};exports.default=ie;
|
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
import { jsx as e, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { Table as Q, Row as R, Col as p, Input as X, Button as Z, Label as J } from "reactstrap";
|
|
3
|
+
import { useNavigate as Y, useParams as ee } from "react-router-dom";
|
|
4
|
+
import { Editor as te } from "@tinymce/tinymce-react";
|
|
5
|
+
import { Formik as ae } from "formik";
|
|
6
|
+
import { R as ne, H as se, b as C, c as w, S as ie, T as le, U, E as q, V as oe, W as re } from "./index-CQarmA1u.mjs";
|
|
7
|
+
import { useTranslation as H } from "react-i18next";
|
|
8
|
+
import { useEffect as j, Fragment as ce, useState as D, useCallback as z } from "react";
|
|
9
|
+
import me from "react-select";
|
|
10
|
+
import { useDispatch as G, useSelector as O } from "react-redux";
|
|
11
|
+
import { a as de, b as ue, u as pe, c as he, d as ge } from "./mailCategoryService-CCQCUudB.mjs";
|
|
12
|
+
import * as L from "yup";
|
|
13
|
+
const ye = ({ onClick: n }) => /* @__PURE__ */ e("div", { className: "d-inline text-center cursor-pointer hover-opacity", title: "Delete", onClick: n, children: /* @__PURE__ */ e(ne, {}) }), V = [
|
|
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
|
+
], fe = ({
|
|
22
|
+
onClick: n,
|
|
23
|
+
isResetPasswordTemplate: s
|
|
24
|
+
}) => {
|
|
25
|
+
const { t: i } = H();
|
|
26
|
+
let f = s ? [...V, { label: "$RESET_LINK$", meaning: "Reset link" }] : V;
|
|
27
|
+
return /* @__PURE__ */ c(Q, { 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: f.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(ye, { onClick: () => n(d) }) })
|
|
37
|
+
] }, d.label)) })
|
|
38
|
+
] });
|
|
39
|
+
}, be = (n) => {
|
|
40
|
+
const s = G(), i = O(
|
|
41
|
+
(o) => o.mailCategory.mailCategoryList
|
|
42
|
+
);
|
|
43
|
+
j(() => {
|
|
44
|
+
f();
|
|
45
|
+
}, []);
|
|
46
|
+
const f = async () => {
|
|
47
|
+
try {
|
|
48
|
+
const o = await de();
|
|
49
|
+
s(se(o.data.items));
|
|
50
|
+
} catch (o) {
|
|
51
|
+
console.error(o);
|
|
52
|
+
}
|
|
53
|
+
}, { id: d } = n, 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(me, { options: I, value: T, ...n });
|
|
59
|
+
}, K = ({ label: n, onRemove: s }) => /* @__PURE__ */ c(ce, { children: [
|
|
60
|
+
/* @__PURE__ */ e("span", { className: "mr-2", children: n }),
|
|
61
|
+
/* @__PURE__ */ e(
|
|
62
|
+
"i",
|
|
63
|
+
{
|
|
64
|
+
className: "fa fa-times text-danger cursor-pointer hover-opacity",
|
|
65
|
+
onClick: s
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
] }), Ee = {
|
|
69
|
+
id: 0,
|
|
70
|
+
subject: "",
|
|
71
|
+
categoryId: 0,
|
|
72
|
+
body: "",
|
|
73
|
+
attachments: []
|
|
74
|
+
}, Ie = "/admin/email-template", Ce = "Email template detail", Te = 4194304, Se = (n) => {
|
|
75
|
+
let s;
|
|
76
|
+
const i = G(), f = Y(), [d, I] = D(Ee), [T, o] = D(!1), $ = async () => {
|
|
77
|
+
localStorage.setItem(window.location.href, "true"), o(!0);
|
|
78
|
+
}, [h, M] = D([]), [u, x] = D([]), [k, F] = D("");
|
|
79
|
+
j(() => {
|
|
80
|
+
n && S();
|
|
81
|
+
}, [n]);
|
|
82
|
+
const S = z(async () => {
|
|
83
|
+
i(C(!0));
|
|
84
|
+
try {
|
|
85
|
+
const t = await ue(n);
|
|
86
|
+
I({
|
|
87
|
+
id: t.data.id,
|
|
88
|
+
subject: t.data.subject,
|
|
89
|
+
categoryId: t.data.category.id,
|
|
90
|
+
body: t.data.body,
|
|
91
|
+
attachments: t.data.attachments || []
|
|
92
|
+
}), document.title = t.data.subject, s && s.editor.execCommand(
|
|
93
|
+
"mceSetContent",
|
|
94
|
+
!1,
|
|
95
|
+
t.data.body
|
|
96
|
+
);
|
|
97
|
+
} catch (t) {
|
|
98
|
+
i(
|
|
99
|
+
w({
|
|
100
|
+
type: "danger",
|
|
101
|
+
message: t.response?.data?.title || t.message
|
|
102
|
+
})
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
i(C(!1));
|
|
106
|
+
}, [n]), b = async () => {
|
|
107
|
+
i(C(!0));
|
|
108
|
+
try {
|
|
109
|
+
const a = (await ge()).data;
|
|
110
|
+
a && F(a.key);
|
|
111
|
+
} catch (t) {
|
|
112
|
+
i(
|
|
113
|
+
w({
|
|
114
|
+
type: "danger",
|
|
115
|
+
message: t.response?.data?.title || "Get key failed"
|
|
116
|
+
})
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
i(C(!1));
|
|
120
|
+
}, E = (t) => s = t, _ = (t) => {
|
|
121
|
+
s && s.editor.execCommand(
|
|
122
|
+
"mceInsertContent",
|
|
123
|
+
!1,
|
|
124
|
+
` ${t.label}`
|
|
125
|
+
);
|
|
126
|
+
}, g = z(() => {
|
|
127
|
+
f(Ie);
|
|
128
|
+
}, []), A = z(
|
|
129
|
+
async (t) => {
|
|
130
|
+
i(C(!0));
|
|
131
|
+
try {
|
|
132
|
+
if (u && u.length) {
|
|
133
|
+
const m = (await l()).map((r) => ({
|
|
134
|
+
key: r.data.key,
|
|
135
|
+
name: r.data.name
|
|
136
|
+
}));
|
|
137
|
+
t.attachments = [...t.attachments, ...m];
|
|
138
|
+
}
|
|
139
|
+
await (n ? pe : he)(t), i(
|
|
140
|
+
w({
|
|
141
|
+
type: "success",
|
|
142
|
+
message: `${n ? "Update" : "Create"} template successfully`
|
|
143
|
+
})
|
|
144
|
+
), g();
|
|
145
|
+
} catch (a) {
|
|
146
|
+
i(
|
|
147
|
+
w({
|
|
148
|
+
type: "danger",
|
|
149
|
+
message: a.response?.data?.title || a.message
|
|
150
|
+
})
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
i(C(!1));
|
|
154
|
+
},
|
|
155
|
+
[n, u]
|
|
156
|
+
), B = () => {
|
|
157
|
+
const t = document.getElementsByClassName("input-attachment"), a = document.createElement("input");
|
|
158
|
+
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", v), a.click();
|
|
159
|
+
}, v = () => {
|
|
160
|
+
const t = [];
|
|
161
|
+
let a = 0;
|
|
162
|
+
const y = document.getElementsByClassName("input-attachment");
|
|
163
|
+
for (const m of y)
|
|
164
|
+
for (const r of m.files)
|
|
165
|
+
a += r.size, a > Te && (i(
|
|
166
|
+
w({
|
|
167
|
+
type: "danger",
|
|
168
|
+
message: "Max attachment size is 4MB"
|
|
169
|
+
})
|
|
170
|
+
), a -= r.size, m.remove());
|
|
171
|
+
for (const m of y)
|
|
172
|
+
for (const r of m.files) {
|
|
173
|
+
const { name: N } = r;
|
|
174
|
+
!h.includes(r) && !t.some((W) => W.name === N) && t.push({ name: N, inputId: m.id });
|
|
175
|
+
}
|
|
176
|
+
x(t);
|
|
177
|
+
}, P = (t, a) => {
|
|
178
|
+
if (u.filter((y) => y.inputId === t).length === 1) {
|
|
179
|
+
document.getElementById(t)?.remove();
|
|
180
|
+
let m = u.filter(
|
|
181
|
+
(r) => r.inputId === t
|
|
182
|
+
);
|
|
183
|
+
u.filter(
|
|
184
|
+
(r) => r.inputId !== m.inputId
|
|
185
|
+
), h.push(m), M([...h]), x([...u]);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
M([...h, a]);
|
|
189
|
+
};
|
|
190
|
+
j(() => {
|
|
191
|
+
v();
|
|
192
|
+
}, [h]);
|
|
193
|
+
const l = async () => {
|
|
194
|
+
const t = document.getElementsByClassName("input-attachment"), a = [];
|
|
195
|
+
for (const y of t)
|
|
196
|
+
for (const m of y.files) {
|
|
197
|
+
const { name: r } = m, N = new FormData();
|
|
198
|
+
N.append("file", m, r), a.push(ie(N));
|
|
199
|
+
}
|
|
200
|
+
return Promise.all(a);
|
|
201
|
+
};
|
|
202
|
+
return j(() => {
|
|
203
|
+
document.title = Ce, b(), o(!1), localStorage.getItem(window.location.href) && localStorage.removeItem(window.location.href);
|
|
204
|
+
}, []), {
|
|
205
|
+
emailTemplateDetail: d,
|
|
206
|
+
setEditorRef: E,
|
|
207
|
+
addParams: _,
|
|
208
|
+
backToList: g,
|
|
209
|
+
confirmData: A,
|
|
210
|
+
edited: T,
|
|
211
|
+
setEdited: o,
|
|
212
|
+
setEditedTrue: $,
|
|
213
|
+
onAttachFile: B,
|
|
214
|
+
updateAttachment: v,
|
|
215
|
+
fileUpload: u,
|
|
216
|
+
removeAttachment: P,
|
|
217
|
+
tinyMCEKey: k
|
|
218
|
+
};
|
|
219
|
+
}, _e = L.object({
|
|
220
|
+
subject: L.string().required("Template subject is required"),
|
|
221
|
+
categoryId: L.number().required("Template category is required").test(
|
|
222
|
+
"test category id",
|
|
223
|
+
"Template category is required",
|
|
224
|
+
(n) => n >= 1
|
|
225
|
+
),
|
|
226
|
+
comment: L.string(),
|
|
227
|
+
body: L.string().required("Template body is required")
|
|
228
|
+
}), Ae = "create_email_template", ve = "edit_email_template", Be = () => {
|
|
229
|
+
const { id: n } = ee(), { t: s } = H(), {
|
|
230
|
+
emailTemplateDetail: i,
|
|
231
|
+
setEditorRef: f,
|
|
232
|
+
addParams: d,
|
|
233
|
+
backToList: I,
|
|
234
|
+
confirmData: T,
|
|
235
|
+
edited: o,
|
|
236
|
+
setEdited: $,
|
|
237
|
+
setEditedTrue: h,
|
|
238
|
+
onAttachFile: M,
|
|
239
|
+
fileUpload: u,
|
|
240
|
+
removeAttachment: x
|
|
241
|
+
} = Se(parseInt(n || "0")), k = s(n ? ve : Ae), F = s(n ? "update" : "create"), S = O(
|
|
242
|
+
(b) => b.mailCategory.mailCategoryList
|
|
243
|
+
);
|
|
244
|
+
return /* @__PURE__ */ e(
|
|
245
|
+
ae,
|
|
246
|
+
{
|
|
247
|
+
initialValues: i,
|
|
248
|
+
enableReinitialize: !0,
|
|
249
|
+
validationSchema: _e,
|
|
250
|
+
onSubmit: (b) => {
|
|
251
|
+
T(b), $(!1), localStorage.getItem(window.location.href) && localStorage.removeItem(window.location.href);
|
|
252
|
+
},
|
|
253
|
+
children: (b) => {
|
|
254
|
+
const {
|
|
255
|
+
values: E,
|
|
256
|
+
touched: _,
|
|
257
|
+
errors: g,
|
|
258
|
+
setFieldValue: A,
|
|
259
|
+
handleChange: B,
|
|
260
|
+
handleBlur: v,
|
|
261
|
+
handleSubmit: P
|
|
262
|
+
} = b;
|
|
263
|
+
return /* @__PURE__ */ c(
|
|
264
|
+
"div",
|
|
265
|
+
{
|
|
266
|
+
className: "animated fadeIn detail-buttons-padding",
|
|
267
|
+
id: "email-detail",
|
|
268
|
+
children: [
|
|
269
|
+
/* @__PURE__ */ e(le, { when: o }),
|
|
270
|
+
/* @__PURE__ */ e(
|
|
271
|
+
"h5",
|
|
272
|
+
{
|
|
273
|
+
className: "mb-2",
|
|
274
|
+
style: { textTransform: "capitalize" },
|
|
275
|
+
children: k
|
|
276
|
+
}
|
|
277
|
+
),
|
|
278
|
+
/* @__PURE__ */ c(R, { className: "my-2", children: [
|
|
279
|
+
/* @__PURE__ */ c(p, { md: 8, children: [
|
|
280
|
+
/* @__PURE__ */ e(U, { text: s("mail_subject") }),
|
|
281
|
+
/* @__PURE__ */ e(
|
|
282
|
+
X,
|
|
283
|
+
{
|
|
284
|
+
placeholder: s("mail_subject_nm"),
|
|
285
|
+
name: "subject",
|
|
286
|
+
value: E.subject,
|
|
287
|
+
onChange: (l) => {
|
|
288
|
+
B(l), h();
|
|
289
|
+
},
|
|
290
|
+
onBlur: v("subject"),
|
|
291
|
+
className: "selector-input"
|
|
292
|
+
}
|
|
293
|
+
),
|
|
294
|
+
_.subject && g.subject && /* @__PURE__ */ e(q, { text: g.subject })
|
|
295
|
+
] }),
|
|
296
|
+
/* @__PURE__ */ c(p, { md: 4, children: [
|
|
297
|
+
/* @__PURE__ */ e(U, { text: s("category") }),
|
|
298
|
+
/* @__PURE__ */ e(
|
|
299
|
+
be,
|
|
300
|
+
{
|
|
301
|
+
onChange: (l) => {
|
|
302
|
+
A("categoryId", l.value), h();
|
|
303
|
+
},
|
|
304
|
+
id: E.categoryId
|
|
305
|
+
}
|
|
306
|
+
),
|
|
307
|
+
_.categoryId && g.categoryId && /* @__PURE__ */ e(q, { text: g.categoryId })
|
|
308
|
+
] })
|
|
309
|
+
] }),
|
|
310
|
+
/* @__PURE__ */ c(R, { className: "mb-2", children: [
|
|
311
|
+
/* @__PURE__ */ e(p, { md: 8, children: /* @__PURE__ */ c(R, { children: [
|
|
312
|
+
/* @__PURE__ */ c(p, { md: 12, className: "mb-2", children: [
|
|
313
|
+
/* @__PURE__ */ e(U, { text: s("mail_body") }),
|
|
314
|
+
(i.body || !n) && /* @__PURE__ */ e(
|
|
315
|
+
te,
|
|
316
|
+
{
|
|
317
|
+
tinymceScriptSrc: "/tinymce/tinymce.min.js",
|
|
318
|
+
ref: (l) => f(l),
|
|
319
|
+
initialValue: i.body,
|
|
320
|
+
init: oe.email,
|
|
321
|
+
onEditorChange: (l) => {
|
|
322
|
+
A(
|
|
323
|
+
"body",
|
|
324
|
+
l
|
|
325
|
+
), h();
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
),
|
|
329
|
+
_.body && g.body && /* @__PURE__ */ e(q, { text: g.body })
|
|
330
|
+
] }),
|
|
331
|
+
/* @__PURE__ */ e(p, { md: 12, children: /* @__PURE__ */ c(R, { children: [
|
|
332
|
+
/* @__PURE__ */ e(p, { md: 3, children: /* @__PURE__ */ e(
|
|
333
|
+
Z,
|
|
334
|
+
{
|
|
335
|
+
color: "link",
|
|
336
|
+
size: "sm",
|
|
337
|
+
className: "pl-0",
|
|
338
|
+
onClick: M,
|
|
339
|
+
children: s("add_attachment")
|
|
340
|
+
}
|
|
341
|
+
) }),
|
|
342
|
+
/* @__PURE__ */ e(p, { md: 12, children: /* @__PURE__ */ c(R, { children: [
|
|
343
|
+
E.attachments.map(
|
|
344
|
+
(l) => /* @__PURE__ */ e(
|
|
345
|
+
p,
|
|
346
|
+
{
|
|
347
|
+
md: 2,
|
|
348
|
+
children: /* @__PURE__ */ e(
|
|
349
|
+
K,
|
|
350
|
+
{
|
|
351
|
+
label: l.name,
|
|
352
|
+
onRemove: () => A(
|
|
353
|
+
"attachments",
|
|
354
|
+
E.attachments.filter(
|
|
355
|
+
(t) => t.name !== l.name
|
|
356
|
+
)
|
|
357
|
+
)
|
|
358
|
+
}
|
|
359
|
+
)
|
|
360
|
+
},
|
|
361
|
+
l.key
|
|
362
|
+
)
|
|
363
|
+
),
|
|
364
|
+
u.map(
|
|
365
|
+
(l, t) => /* @__PURE__ */ e(
|
|
366
|
+
p,
|
|
367
|
+
{
|
|
368
|
+
md: 2,
|
|
369
|
+
className: "d-flex align-items-center",
|
|
370
|
+
children: /* @__PURE__ */ e(
|
|
371
|
+
K,
|
|
372
|
+
{
|
|
373
|
+
label: l.name,
|
|
374
|
+
onRemove: () => x(
|
|
375
|
+
l.inputId,
|
|
376
|
+
l.name
|
|
377
|
+
)
|
|
378
|
+
}
|
|
379
|
+
)
|
|
380
|
+
},
|
|
381
|
+
t
|
|
382
|
+
)
|
|
383
|
+
)
|
|
384
|
+
] }) })
|
|
385
|
+
] }) })
|
|
386
|
+
] }) }),
|
|
387
|
+
/* @__PURE__ */ c(p, { md: 4, children: [
|
|
388
|
+
/* @__PURE__ */ e(J, { children: s("mail_params") }),
|
|
389
|
+
/* @__PURE__ */ e(
|
|
390
|
+
fe,
|
|
391
|
+
{
|
|
392
|
+
onClick: (l) => d(l),
|
|
393
|
+
isResetPasswordTemplate: E.categoryId == (S && S.length > 0 && S.filter(
|
|
394
|
+
(l) => l.name == "Reset password"
|
|
395
|
+
)[0].id)
|
|
396
|
+
}
|
|
397
|
+
)
|
|
398
|
+
] })
|
|
399
|
+
] }),
|
|
400
|
+
/* @__PURE__ */ e(
|
|
401
|
+
re,
|
|
402
|
+
{
|
|
403
|
+
confirmText: F,
|
|
404
|
+
onConfirm: P,
|
|
405
|
+
onCancel: I
|
|
406
|
+
}
|
|
407
|
+
)
|
|
408
|
+
]
|
|
409
|
+
}
|
|
410
|
+
);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
);
|
|
414
|
+
};
|
|
415
|
+
export {
|
|
416
|
+
Be as default
|
|
417
|
+
};
|
|
@@ -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-_LVJdhk_.js"),_=require("date-fns"),m=require("react"),x=require("react-redux"),f=require("react-router-dom"),j=require("./mailCategoryService-DDsrRt_u.js"),y=require("react-i18next"),E="/admin/email-template",N="/admin/create-email-template",b="Email template list",v=()=>{const c=f.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?`${E}/${l}`:N;c(r)},[]);return m.useEffect(()=>{document.title=b},[]),m.useEffect(()=>{g()},[n]),{emailTemplateList:p,totalItems:u,filters:n,changeFilters:h,getData:g,removeData:s,goToDetail:T,mailCategoryList:o}},R="email_template",A=()=>{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:"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:"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=A;
|