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.
Files changed (67) hide show
  1. package/dist/Dashboard-B2WY8-IU.js +1 -0
  2. package/dist/Dashboard-BzKx6Ox_.mjs +206 -0
  3. package/dist/Dashboard-DJS7P679.mjs +206 -0
  4. package/dist/Dashboard-NC2RHYE3.js +1 -0
  5. package/dist/EmailTemplateDetail-22mli8ZO.js +1 -0
  6. package/dist/EmailTemplateDetail-CfqeSysW.js +1 -0
  7. package/dist/EmailTemplateDetail-D5H-KPFi.mjs +443 -0
  8. package/dist/EmailTemplateDetail-DnEe1dJY.mjs +443 -0
  9. package/dist/EmailTemplateList-BBgctzKn.mjs +170 -0
  10. package/dist/EmailTemplateList-BSETyjvK.js +1 -0
  11. package/dist/EmailTemplateList-CEfrVodv.mjs +170 -0
  12. package/dist/EmailTemplateList-CpfPUX5H.js +1 -0
  13. package/dist/GalleryList-BKH6TE8o.js +1 -0
  14. package/dist/GalleryList-D1-lprY3.mjs +329 -0
  15. package/dist/GalleryList-D6Npg6OD.mjs +329 -0
  16. package/dist/GalleryList-DZDBNr1J.js +1 -0
  17. package/dist/Login-07zPaPX9.js +1 -0
  18. package/dist/Login-CSb85ENW.mjs +1697 -0
  19. package/dist/Login-C_elLcnh.mjs +1688 -0
  20. package/dist/Login-t8Cp9sZB.js +1 -0
  21. package/dist/NotificationList-D1ay6Hyf.mjs +3982 -0
  22. package/dist/NotificationList-DHjB1hHV.js +2 -0
  23. package/dist/NotificationList-DlWtyPB-.mjs +3982 -0
  24. package/dist/NotificationList-Dr8Yrfl7.js +2 -0
  25. package/dist/SkillList-CjP3DHVV.mjs +386 -0
  26. package/dist/SkillList-DED-BKhK.js +1 -0
  27. package/dist/SkillList-EMox2GtU.js +1 -0
  28. package/dist/SkillList-a-PCBXTS.mjs +386 -0
  29. package/dist/TeacherSelector-CT_LK5ps.js +1 -0
  30. package/dist/TeacherSelector-CYN1RV9H.js +1 -0
  31. package/dist/TeacherSelector-Ckdz4LDA.mjs +30 -0
  32. package/dist/TeacherSelector-TtFRSN6T.mjs +30 -0
  33. package/dist/TheContent-BLL5TnF0.js +1 -0
  34. package/dist/TheContent-C1z93b1T.mjs +38 -0
  35. package/dist/TheContent-CV2yUmwY.js +1 -0
  36. package/dist/TheContent-ClceIaDH.mjs +38 -0
  37. package/dist/UserContainer-BwVN8uDh.mjs +2902 -0
  38. package/dist/UserContainer-DKBxc6bM.js +5 -0
  39. package/dist/UserContainer-Dgajsjc2.js +5 -0
  40. package/dist/UserContainer-W5RhNyuY.mjs +2902 -0
  41. package/dist/UserDetail-B1OEfUkB.mjs +903 -0
  42. package/dist/UserDetail-CcAyPDXB.mjs +903 -0
  43. package/dist/UserDetail-D_54wIZ1.js +1 -0
  44. package/dist/UserDetail-EIVg7R4V.js +1 -0
  45. package/dist/UserList-BHBPOboi.js +7 -0
  46. package/dist/UserList-CuML6EN2.mjs +1261 -0
  47. package/dist/UserList-D7DcyFHI.js +7 -0
  48. package/dist/UserList-DPS62SYL.mjs +1254 -0
  49. package/dist/constants-CAl8i9EQ.mjs +286 -0
  50. package/dist/constants-CQviSc2u.js +1 -0
  51. package/dist/constants-DIXj0L_y.js +1 -0
  52. package/dist/constants-Jqu1Wphx.mjs +286 -0
  53. package/dist/index-7hA60HfM.mjs +19133 -0
  54. package/dist/index-9XtI-PeV.js +15 -0
  55. package/dist/index-C6cqi7Br.js +15 -0
  56. package/dist/index-DplP6JK1.mjs +19133 -0
  57. package/dist/index.js +1 -1
  58. package/dist/index.modern.js +1 -1
  59. package/dist/mailCategoryService-Bhcruih6.js +1 -0
  60. package/dist/mailCategoryService-CJQb-5oo.mjs +11 -0
  61. package/dist/mailCategoryService-CQdNPG8e.js +1 -0
  62. package/dist/mailCategoryService-D_DFc1LB.mjs +11 -0
  63. package/dist/userService-1_ugW9AK.js +1 -0
  64. package/dist/userService-C4VF2Wck.mjs +56 -0
  65. package/dist/userService-De8Jm8I4.js +1 -0
  66. package/dist/userService-OWU32PxA.mjs +56 -0
  67. package/package.json +1 -1
@@ -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-DplP6JK1.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-CJQb-5oo.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-C6cqi7Br.js"),_=require("date-fns"),m=require("react"),x=require("react-redux"),b=require("react-router-dom"),j=require("./mailCategoryService-CQdNPG8e.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;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("reactstrap"),F=require("react-redux"),x=require("react"),t=require("./index-C6cqi7Br.js"),v=require("formik"),E=require("yup"),D=require("react-i18next");function A(s){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const a in s)if(a!=="default"){const i=Object.getOwnPropertyDescriptor(s,a);Object.defineProperty(n,a,i.get?i:{enumerable:!0,get:()=>s[a]})}}return n.default=s,Object.freeze(n)}const b=A(E),G=b.object({name:b.string().required("Name is required")}),U=(s,n)=>{const{targetMedia:a,onConfirm:i}=s,r=a?.key?"Update":"Create",m=a?.key?"Rename":"Folder";return e.jsx(v.Formik,{initialValues:{name:a?.name},enableReinitialize:!0,validationSchema:G,onSubmit:(c,u)=>{i&&i(c),u.resetForm()},children:c=>{const{values:u,touched:g,errors:p,handleChange:y,handleBlur:C,handleSubmit:j}=c;return e.jsx(t.CommonModal,{header:m,confirmText:r,onConfirm:j,ref:n,children:e.jsx(l.Row,{children:e.jsxs(l.Col,{md:12,children:[e.jsx(l.Input,{name:"name",placeholder:`Enter your ${a?.key?"file":"folder"} name`,value:u.name,onChange:y,onBlur:C("question")}),g.name&&p.name&&e.jsx(t.ErrorHandler,{text:p.name})]})})})}})},R=x.forwardRef(U),S=({isLibrary:s,step:n,breadcumb:a,currentPrefix:i,targetMedia:r,handleSelectFile:m,handleCreateFolder:c,handleRenameFile:u,handleGoBack:g,handleDownloadMedia:p,handleDeleteMediaOrFolder:y,showErrorAlert:C})=>{const j=x.useRef(null),I=x.useRef(null),{t:O}=D.useTranslation(),f=()=>j?.current?.toggle(),_=()=>e.jsxs(l.Row,{className:"p-2 pl-3",style:{gap:"8px"},children:[!!n&&e.jsxs(l.Button,{className:"mr-2",color:"secondary",onClick:g,style:{width:"auto",display:"flex",gap:"4px"},children:[e.jsx(t.FaArrowLeft,{}),e.jsx(l.Label,{className:"ml-1 h6 m-0",children:"Go up"})]}),r&&!r.isFolder&&e.jsxs(l.Button,{className:"mr-2",color:"success",onClick:p,style:{width:"auto",display:"flex",gap:"4px"},children:[e.jsx(t.FaDownload,{}),e.jsx(l.Label,{className:"ml-1 h6 m-0",children:"Download"})]}),r&&!s&&e.jsxs(l.Button,{className:"mr-2",color:"danger",onClick:y,style:{width:"auto",display:"flex",gap:"4px"},children:[e.jsx(t.FaTrash,{}),e.jsx(l.Label,{className:"ml-1 h6 m-0",children:"Delete"})]}),r&&!s&&!r.isFolder&&e.jsxs(l.Button,{className:"mr-2",color:"primary",onClick:f,style:{width:"auto",display:"flex",gap:"4px"},children:[e.jsx(t.FaEdit,{}),e.jsx(l.Label,{className:"ml-1 h6 m-0",children:"Rename"})]}),!r&&!s&&e.jsxs(l.Button,{className:"mr-2",color:"success",onClick:f,style:{width:"auto",display:"flex",gap:"4px"},children:[e.jsx(t.FaFolderPlus,{}),e.jsx(l.Label,{className:"ml-1 h6 m-0",children:O("new_folder")})]}),!r&&!s&&e.jsxs(l.Button,{className:"mr-2",color:"info",onClick:()=>I?.current?.click(),style:{width:"auto",display:"flex",gap:"4px"},children:[e.jsx(t.FaFileUpload,{}),e.jsx(l.Label,{className:"ml-1 h6 m-0",children:O("upload")})]}),a&&e.jsx(l.Col,{className:"h-100 d-flex align-items-center",children:a})]});return e.jsxs("div",{children:[_(),e.jsx(R,{ref:j,targetMedia:r,onConfirm:async h=>{h.name!=""?r&&!r.isFolder?(f(),await u(h.name)):(f(),await c(i,h.name)):C("Name can't be empty")}}),e.jsx("input",{type:"file",id:"customMediaUpload",ref:I,style:{display:"none"},onChange:async h=>{const d=h?.target?.files[0];d&&await m({key:i,file:d})}})]})},B=x.memo(S),N={"media-wrapper":"_media-wrapper_1nc2k_6","media-image":"_media-image_1nc2k_11","media-image-selected":"_media-image-selected_1nc2k_17","media-title":"_media-title_1nc2k_21","filter-media-file":"_filter-media-file_1nc2k_30"};var o=(s=>(s[s.IMAGE=0]="IMAGE",s[s.VIDEO=1]="VIDEO",s[s.AUDIO=2]="AUDIO",s[s.DOC=3]="DOC",s[s.UNKNOW=4]="UNKNOW",s))(o||{});const q=["png","jpg","jpeg","gif"],M=["mp4","mp4v"],V=["txt","pdf","doc","docx","xls","csv"],L=["wav","mp3"],k=s=>{if(s){if(q.includes(s))return o.IMAGE;if(M.includes(s))return o.VIDEO;if(V.includes(s))return o.DOC;if(L.includes(s))return o.AUDIO}return o.UNKNOW},$=s=>{if(s.isFolder)return t.Images.FOLDER_IMAGE;const n=k(s.extension);return n===o.IMAGE?t.Images.PHOTO_IMAGE:n===o.VIDEO?t.Images.VIDEO_IMAGE:n===o.AUDIO?t.Images.AUDIO_IMAGE:n===o.DOC?t.Images.DOCS_IMAGE:t.Images.UNKNOW_IMAGE},T=({media:s,isTarget:n})=>{const a=$(s);return e.jsxs(l.Card,{className:`${n?N["media-image-selected"]:""} border-0 `,children:[e.jsx(l.CardImg,{className:`${N["media-image"]} p-1`,top:!0,width:"90%",src:t.getStaticFileUrl(a),alt:s.name}),e.jsx(l.CardBody,{className:"p-1",style:{height:45},children:e.jsx(l.CardTitle,{tag:"h6",className:N["media-title"],children:s.name})})]})},H=x.memo(T),P=[{value:o.IMAGE,label:"images"},{value:o.AUDIO,label:"audios"},{value:o.DOC,label:"docs"},{value:o.VIDEO,label:"videos"}],K=({changeFilters:s})=>{const[n,a]=x.useState(),{t:i}=D.useTranslation();return e.jsxs(l.Row,{className:`${N["filter-media-file"]}`,children:[e.jsx(l.Col,{sm:8,children:e.jsx(t.SearchBox,{initValue:"",onSearch:r=>s({searchString:r}),placeholder:i("type_something_to_search_by_file_name")})}),e.jsx(l.Col,{sm:4,children:e.jsx(t.CustomSelector,{value:n,isMulti:!0,options:P.map(r=>({...r,label:i(r.label)})),onChange:r=>{a(r);const m=r.map(c=>c.value);s({types:m})}})})]})},W=({height:s,isLibrary:n})=>{const{filters:a,mediaList:i,targetMedia:r,router:m,breadcrumb:c,changeFilters:u,handleOpenFolder:g,handleSelectMedia:p,handleSelectFile:y,handleCreateFolder:C,handleRenameFile:j,handleDownloadMedia:I,handleDeleteMediaOrFolder:O,handleGoBack:f,showErrorAlert:_}=t.useGalleryList(n),h=()=>i.map(d=>{const w=r?.key===d.key;return e.jsx(l.Col,{className:"p-2",xs:"auto",children:e.jsx("div",{onDoubleClick:()=>g(d),onClick:()=>p(d),className:N["media-wrapper"],children:e.jsx(H,{media:d,isTarget:w})})},d.key)});return e.jsxs(l.Card,{children:[e.jsxs(l.CardHeader,{children:[e.jsx(K,{changeFilters:u,filters:a}),e.jsx(B,{isLibrary:n,step:m.step,breadcumb:c,currentPrefix:a.prefix||"",targetMedia:r,handleSelectFile:y,handleCreateFolder:C,handleRenameFile:j,handleDownloadMedia:I,handleDeleteMediaOrFolder:O,handleGoBack:f,showErrorAlert:_})]}),e.jsx(l.CardBody,{style:{minHeight:s},children:e.jsx(l.Row,{className:"p-1",children:h()})})]})},z=({targetMedia:s})=>{if(!s||s?.isFolder)return e.jsx("div",{});const n=k(s.extension),a=t.getFileUrl(s.key||"");return e.jsxs(l.Card,{className:"position-sticky",children:[e.jsx(l.CardHeader,{children:s?.name||"Media name"}),n===o.IMAGE&&e.jsx(l.CardImg,{className:"p-2",src:a,loading:"lazy"}),n===o.VIDEO&&e.jsx("div",{className:"p-2",children:e.jsx("video",{id:s.key,width:"100%",height:"100%",controls:!0,children:e.jsx("source",{src:a})})}),n===o.AUDIO&&e.jsx("div",{className:"p-2",children:e.jsx("audio",{controls:!0,className:"w-100",children:e.jsx("source",{src:a})})}),e.jsxs(l.CardBody,{children:[e.jsx(l.CardTitle,{tag:"h6",children:"General Info"}),e.jsxs(l.CardText,{children:["File extension: ",s.extension?.toUpperCase()]})]})]})},Q=x.memo(z),J="media_gallery",X=({isLibrary:s})=>{const n=F.useSelector(i=>i.gallery.targetMedia),{t:a}=D.useTranslation();return e.jsxs("div",{className:"fadeIn animated",children:[!s&&e.jsx("h5",{className:"mb-2",children:a(J)}),e.jsxs(l.Row,{className:"mb-2",children:[e.jsx(l.Col,{md:8,children:e.jsx(W,{height:"100vh",isLibrary:s})}),e.jsx(l.Col,{md:4,children:e.jsx(Q,{targetMedia:n},n?.key)})]})]})};exports.default=X;
@@ -0,0 +1,329 @@
1
+ import { jsx as e, jsxs as s } from "react/jsx-runtime";
2
+ import { Row as k, Col as u, Input as R, Button as y, Label as g, Card as E, CardImg as S, CardBody as w, CardTitle as M, CardHeader as B, CardText as j } from "reactstrap";
3
+ import { useSelector as q } from "react-redux";
4
+ import { forwardRef as H, memo as v, useRef as U, useState as K } from "react";
5
+ import { a0 as W, E as L, ar as z, as as P, at as T, au as Q, av as J, aw as X, ax as C, h as Y, a2 as Z, $ as ee, ay as le, m as ae } from "./index-DplP6JK1.mjs";
6
+ import { Formik as ne } from "formik";
7
+ import * as b from "yup";
8
+ import { useTranslation as A } from "react-i18next";
9
+ const re = b.object({
10
+ name: b.string().required("Name is required")
11
+ }), se = (l, n) => {
12
+ const { targetMedia: r, onConfirm: i } = l, a = r?.key ? "Update" : "Create", d = r?.key ? "Rename" : "Folder";
13
+ return /* @__PURE__ */ e(
14
+ ne,
15
+ {
16
+ initialValues: { name: r?.name },
17
+ enableReinitialize: !0,
18
+ validationSchema: re,
19
+ onSubmit: (o, m) => {
20
+ i && i(o), m.resetForm();
21
+ },
22
+ children: (o) => {
23
+ const {
24
+ values: m,
25
+ touched: I,
26
+ errors: p,
27
+ handleChange: D,
28
+ handleBlur: O,
29
+ handleSubmit: f
30
+ } = o;
31
+ return /* @__PURE__ */ e(
32
+ W,
33
+ {
34
+ header: d,
35
+ confirmText: a,
36
+ onConfirm: f,
37
+ ref: n,
38
+ children: /* @__PURE__ */ e(k, { children: /* @__PURE__ */ s(u, { md: 12, children: [
39
+ /* @__PURE__ */ e(
40
+ R,
41
+ {
42
+ name: "name",
43
+ placeholder: `Enter your ${r?.key ? "file" : "folder"} name`,
44
+ value: m.name,
45
+ onChange: D,
46
+ onBlur: O("question")
47
+ }
48
+ ),
49
+ I.name && p.name && /* @__PURE__ */ e(
50
+ L,
51
+ {
52
+ text: p.name
53
+ }
54
+ )
55
+ ] }) })
56
+ }
57
+ );
58
+ }
59
+ }
60
+ );
61
+ }, te = H(se), ie = ({
62
+ isLibrary: l,
63
+ step: n,
64
+ breadcumb: r,
65
+ currentPrefix: i,
66
+ targetMedia: a,
67
+ handleSelectFile: d,
68
+ handleCreateFolder: o,
69
+ handleRenameFile: m,
70
+ handleGoBack: I,
71
+ handleDownloadMedia: p,
72
+ handleDeleteMediaOrFolder: D,
73
+ showErrorAlert: O
74
+ }) => {
75
+ const f = U(null), x = U(null), { t: F } = A(), N = () => f?.current?.toggle();
76
+ return /* @__PURE__ */ s("div", { children: [
77
+ /* @__PURE__ */ s(k, { className: "p-2 pl-3", style: { gap: "8px" }, children: [
78
+ !!n && /* @__PURE__ */ s(
79
+ y,
80
+ {
81
+ className: "mr-2",
82
+ color: "secondary",
83
+ onClick: I,
84
+ style: { width: "auto", display: "flex", gap: "4px" },
85
+ children: [
86
+ /* @__PURE__ */ e(z, {}),
87
+ /* @__PURE__ */ e(g, { className: "ml-1 h6 m-0", children: "Go up" })
88
+ ]
89
+ }
90
+ ),
91
+ a && !a.isFolder && /* @__PURE__ */ s(
92
+ y,
93
+ {
94
+ className: "mr-2",
95
+ color: "success",
96
+ onClick: p,
97
+ style: { width: "auto", display: "flex", gap: "4px" },
98
+ children: [
99
+ /* @__PURE__ */ e(P, {}),
100
+ /* @__PURE__ */ e(g, { className: "ml-1 h6 m-0", children: "Download" })
101
+ ]
102
+ }
103
+ ),
104
+ a && !l && /* @__PURE__ */ s(
105
+ y,
106
+ {
107
+ className: "mr-2",
108
+ color: "danger",
109
+ onClick: D,
110
+ style: { width: "auto", display: "flex", gap: "4px" },
111
+ children: [
112
+ /* @__PURE__ */ e(T, {}),
113
+ /* @__PURE__ */ e(g, { className: "ml-1 h6 m-0", children: "Delete" })
114
+ ]
115
+ }
116
+ ),
117
+ a && !l && !a.isFolder && /* @__PURE__ */ s(y, { className: "mr-2", color: "primary", onClick: N, style: { width: "auto", display: "flex", gap: "4px" }, children: [
118
+ /* @__PURE__ */ e(Q, {}),
119
+ /* @__PURE__ */ e(g, { className: "ml-1 h6 m-0", children: "Rename" })
120
+ ] }),
121
+ !a && !l && /* @__PURE__ */ s(y, { className: "mr-2", color: "success", onClick: N, style: { width: "auto", display: "flex", gap: "4px" }, children: [
122
+ /* @__PURE__ */ e(J, {}),
123
+ /* @__PURE__ */ e(g, { className: "ml-1 h6 m-0", children: F("new_folder") })
124
+ ] }),
125
+ !a && !l && /* @__PURE__ */ s(
126
+ y,
127
+ {
128
+ className: "mr-2",
129
+ color: "info",
130
+ onClick: () => x?.current?.click(),
131
+ style: { width: "auto", display: "flex", gap: "4px" },
132
+ children: [
133
+ /* @__PURE__ */ e(X, {}),
134
+ /* @__PURE__ */ e(g, { className: "ml-1 h6 m-0", children: F("upload") })
135
+ ]
136
+ }
137
+ ),
138
+ r && /* @__PURE__ */ e(u, { className: "h-100 d-flex align-items-center", children: r })
139
+ ] }),
140
+ /* @__PURE__ */ e(
141
+ te,
142
+ {
143
+ ref: f,
144
+ targetMedia: a,
145
+ onConfirm: async (h) => {
146
+ h.name != "" ? a && !a.isFolder ? (N(), await m(h.name)) : (N(), await o(i, h.name)) : O("Name can't be empty");
147
+ }
148
+ }
149
+ ),
150
+ /* @__PURE__ */ e(
151
+ "input",
152
+ {
153
+ type: "file",
154
+ id: "customMediaUpload",
155
+ ref: x,
156
+ style: { display: "none" },
157
+ onChange: async (h) => {
158
+ const c = h?.target?.files[0];
159
+ c && await d({ key: i, file: c });
160
+ }
161
+ }
162
+ )
163
+ ] });
164
+ }, oe = v(ie), _ = {
165
+ "media-wrapper": "_media-wrapper_1nc2k_6",
166
+ "media-image": "_media-image_1nc2k_11",
167
+ "media-image-selected": "_media-image-selected_1nc2k_17",
168
+ "media-title": "_media-title_1nc2k_21",
169
+ "filter-media-file": "_filter-media-file_1nc2k_30"
170
+ };
171
+ var t = /* @__PURE__ */ ((l) => (l[l.IMAGE = 0] = "IMAGE", l[l.VIDEO = 1] = "VIDEO", l[l.AUDIO = 2] = "AUDIO", l[l.DOC = 3] = "DOC", l[l.UNKNOW = 4] = "UNKNOW", l))(t || {});
172
+ const ce = ["png", "jpg", "jpeg", "gif"], de = ["mp4", "mp4v"], me = ["txt", "pdf", "doc", "docx", "xls", "csv"], he = ["wav", "mp3"], V = (l) => {
173
+ if (l) {
174
+ if (ce.includes(l)) return t.IMAGE;
175
+ if (de.includes(l)) return t.VIDEO;
176
+ if (me.includes(l)) return t.DOC;
177
+ if (he.includes(l)) return t.AUDIO;
178
+ }
179
+ return t.UNKNOW;
180
+ }, ue = (l) => {
181
+ if (l.isFolder) return C.FOLDER_IMAGE;
182
+ const n = V(l.extension);
183
+ return n === t.IMAGE ? C.PHOTO_IMAGE : n === t.VIDEO ? C.VIDEO_IMAGE : n === t.AUDIO ? C.AUDIO_IMAGE : n === t.DOC ? C.DOCS_IMAGE : C.UNKNOW_IMAGE;
184
+ }, pe = ({ media: l, isTarget: n }) => {
185
+ const r = ue(l);
186
+ return /* @__PURE__ */ s(E, { className: `${n ? _["media-image-selected"] : ""} border-0 `, children: [
187
+ /* @__PURE__ */ e(
188
+ S,
189
+ {
190
+ className: `${_["media-image"]} p-1`,
191
+ top: !0,
192
+ width: "90%",
193
+ src: Y(r),
194
+ alt: l.name
195
+ }
196
+ ),
197
+ /* @__PURE__ */ e(w, { className: "p-1", style: { height: 45 }, children: /* @__PURE__ */ e(M, { tag: "h6", className: _["media-title"], children: l.name }) })
198
+ ] });
199
+ }, fe = v(pe), Ne = [
200
+ { value: t.IMAGE, label: "images" },
201
+ { value: t.AUDIO, label: "audios" },
202
+ { value: t.DOC, label: "docs" },
203
+ { value: t.VIDEO, label: "videos" }
204
+ ], ye = ({
205
+ changeFilters: l
206
+ // filters
207
+ }) => {
208
+ const [n, r] = K(), { t: i } = A();
209
+ return /* @__PURE__ */ s(k, { className: `${_["filter-media-file"]}`, children: [
210
+ /* @__PURE__ */ e(u, { sm: 8, children: /* @__PURE__ */ e(
211
+ Z,
212
+ {
213
+ initValue: "",
214
+ onSearch: (a) => l({
215
+ searchString: a
216
+ }),
217
+ placeholder: i("type_something_to_search_by_file_name")
218
+ }
219
+ ) }),
220
+ /* @__PURE__ */ e(u, { sm: 4, children: /* @__PURE__ */ e(
221
+ ee,
222
+ {
223
+ value: n,
224
+ isMulti: !0,
225
+ options: Ne.map((a) => ({ ...a, label: i(a.label) })),
226
+ onChange: (a) => {
227
+ r(a);
228
+ const d = a.map((o) => o.value);
229
+ l({ types: d });
230
+ }
231
+ }
232
+ ) })
233
+ ] });
234
+ }, ge = ({ height: l, isLibrary: n }) => {
235
+ const {
236
+ filters: r,
237
+ mediaList: i,
238
+ targetMedia: a,
239
+ router: d,
240
+ breadcrumb: o,
241
+ changeFilters: m,
242
+ handleOpenFolder: I,
243
+ handleSelectMedia: p,
244
+ handleSelectFile: D,
245
+ handleCreateFolder: O,
246
+ handleRenameFile: f,
247
+ handleDownloadMedia: x,
248
+ handleDeleteMediaOrFolder: F,
249
+ handleGoBack: N,
250
+ showErrorAlert: G
251
+ } = le(n), h = () => i.map((c) => {
252
+ const $ = a?.key === c.key;
253
+ return /* @__PURE__ */ e(u, { className: "p-2", xs: "auto", children: /* @__PURE__ */ e(
254
+ "div",
255
+ {
256
+ onDoubleClick: () => I(c),
257
+ onClick: () => p(c),
258
+ className: _["media-wrapper"],
259
+ children: /* @__PURE__ */ e(fe, { media: c, isTarget: $ })
260
+ }
261
+ ) }, c.key);
262
+ });
263
+ return /* @__PURE__ */ s(E, { children: [
264
+ /* @__PURE__ */ s(B, { children: [
265
+ /* @__PURE__ */ e(ye, { changeFilters: m, filters: r }),
266
+ /* @__PURE__ */ e(
267
+ oe,
268
+ {
269
+ isLibrary: n,
270
+ step: d.step,
271
+ breadcumb: o,
272
+ currentPrefix: r.prefix || "",
273
+ targetMedia: a,
274
+ handleSelectFile: D,
275
+ handleCreateFolder: O,
276
+ handleRenameFile: f,
277
+ handleDownloadMedia: x,
278
+ handleDeleteMediaOrFolder: F,
279
+ handleGoBack: N,
280
+ showErrorAlert: G
281
+ }
282
+ )
283
+ ] }),
284
+ /* @__PURE__ */ e(w, { style: { minHeight: l }, children: /* @__PURE__ */ e(k, { className: "p-1", children: h() }) })
285
+ ] });
286
+ }, Ce = ({ targetMedia: l }) => {
287
+ if (!l || l?.isFolder) return /* @__PURE__ */ e("div", {});
288
+ const n = V(l.extension), r = ae(l.key || "");
289
+ return /* @__PURE__ */ s(E, { className: "position-sticky", children: [
290
+ /* @__PURE__ */ e(B, { children: l?.name || "Media name" }),
291
+ n === t.IMAGE && /* @__PURE__ */ e(S, { className: "p-2", src: r, loading: "lazy" }),
292
+ n === t.VIDEO && /* @__PURE__ */ e("div", { className: "p-2", children: /* @__PURE__ */ e(
293
+ "video",
294
+ {
295
+ id: l.key,
296
+ width: "100%",
297
+ height: "100%",
298
+ controls: !0,
299
+ children: /* @__PURE__ */ e("source", { src: r })
300
+ }
301
+ ) }),
302
+ n === t.AUDIO && /* @__PURE__ */ e("div", { className: "p-2", children: /* @__PURE__ */ e("audio", { controls: !0, className: "w-100", children: /* @__PURE__ */ e("source", { src: r }) }) }),
303
+ /* @__PURE__ */ s(w, { children: [
304
+ /* @__PURE__ */ e(M, { tag: "h6", children: "General Info" }),
305
+ /* @__PURE__ */ s(j, { children: [
306
+ "File extension: ",
307
+ l.extension?.toUpperCase()
308
+ ] })
309
+ ] })
310
+ ] });
311
+ }, Ie = v(Ce), De = "media_gallery", ve = ({ isLibrary: l }) => {
312
+ const n = q((i) => i.gallery.targetMedia), { t: r } = A();
313
+ return /* @__PURE__ */ s("div", { className: "fadeIn animated", children: [
314
+ !l && /* @__PURE__ */ e("h5", { className: "mb-2", children: r(De) }),
315
+ /* @__PURE__ */ s(k, { className: "mb-2", children: [
316
+ /* @__PURE__ */ e(u, { md: 8, children: /* @__PURE__ */ e(ge, { height: "100vh", isLibrary: l }) }),
317
+ /* @__PURE__ */ e(u, { md: 4, children: /* @__PURE__ */ e(
318
+ Ie,
319
+ {
320
+ targetMedia: n
321
+ },
322
+ n?.key
323
+ ) })
324
+ ] })
325
+ ] });
326
+ };
327
+ export {
328
+ ve as default
329
+ };