mario-education 2.0.40-release → 2.0.41-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/AgGridComponents-DDk8se4v.cjs +1 -0
- package/dist/AgGridComponents-kqFYvysF.js +84 -0
- package/dist/QuestionBankContainer-CufZ2ovg.cjs +1 -0
- package/dist/QuestionBankContainer-DULJZI_O.js +59 -0
- package/dist/QuestionBankList-BksfBJOE.js +304 -0
- package/dist/QuestionBankList-Cq31dqeX.cjs +1 -0
- package/dist/SurveyQuestionContainer-DVd_H04K.js +3651 -0
- package/dist/SurveyQuestionContainer-f6Fn2kql.cjs +4 -0
- package/dist/WeeklyQuest-DvXwfo7-.cjs +1 -0
- package/dist/WeeklyQuest-qhYU9JKl.js +293 -0
- package/dist/index.js +1 -1
- package/dist/index.modern.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),r=require("mario-core"),l=require("./constants-Dx5hVWbo.cjs"),a=require("@mui/material"),c=()=>t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("g",{opacity:"0.4",children:t.jsx("path",{d:"M5 19H6.098L16.7962 8.302L15.698 7.20375L5 17.902V19ZM4 20V17.4808L17.1807 4.2865C17.2832 4.19517 17.3963 4.12458 17.52 4.07475C17.6438 4.02492 17.7729 4 17.9072 4C18.0416 4 18.1717 4.02117 18.2977 4.0635C18.4236 4.10583 18.5397 4.18208 18.6462 4.29225L19.7135 5.3655C19.8237 5.47183 19.899 5.5885 19.9395 5.7155C19.9798 5.84267 20 5.96975 20 6.09675C20 6.23225 19.9772 6.36192 19.9315 6.48575C19.8858 6.60942 19.8132 6.7225 19.7135 6.825L6.51925 20H4ZM16.2375 7.7625L15.698 7.20375L16.7962 8.302L16.2375 7.7625Z",fill:"#242424"})})}),u={root:{padding:0,"&.Mui-checked":{color:"#3f51b5 !important"}}},d={whiteSpace:"normal",overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",lineHeight:"1.5em",maxHeight:"3em"},x=e=>t.jsx("div",{style:d,children:r.getTextFromHTML(e?.data?.text)||"No text"}),h=e=>t.jsx("div",{children:r.getTextFromHTML(e?.data?.title)||"No title"}),v=e=>{const n=l.weeklyQuestChallenge.find(s=>s.data===e?.data?.challenge);return n?t.jsx("div",{children:r.getTextFromHTML(n?.label)}):t.jsx("div",{children:"No challenge"})},C=e=>{const n=l.weeklyQuestSource.find(s=>s.data===e?.data?.source);return n?t.jsx("div",{children:r.getTextFromHTML(n?.label)}):t.jsx("div",{children:"No source"})},j=e=>{const n=l.weeklyQuestRequest.find(s=>s.data===e?.data?.request);return n?t.jsx("div",{children:r.getTextFromHTML(n?.label)}):t.jsx("div",{children:"No request"})},y=e=>t.jsx(a.Checkbox,{color:"primary",disabled:!0,checked:e?.data?.status,sx:u.root}),T=({params:e,edit:n,remove:s})=>{const i=e?.data?.isDefaultQuestion&&!e?.data?.isDefaultClassReflection&&!e?.data?.isDefaultSurvey?!e?.data?.isInCluster:!(e?.data?.isDefaultQuestion||e?.data?.isDefaultQuestionGeneralClass);return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[t.jsx(r.EditButtonIcon,{className:"delete-icon-pale",onClick:()=>n(e?.data?.id)}),i&&t.jsx("span",{className:"mx-2"}),i&&t.jsx(r.DeleteButtonIcon,{className:"delete-icon-pale",onClick:()=>s(e?.data?.id)})]})},f=({params:e,edit:n,remove:s})=>{const i=e?.data?.isDefaultQuestion&&!e?.data?.isDefaultClassReflection&&!e?.data?.isDefaultSurvey?!e?.data?.isInCluster:!(e?.data?.isDefaultQuestion||e?.data?.isDefaultQuestionGeneralClass);return t.jsxs("div",{children:[t.jsx("div",{className:"d-inline text-center cursor-pointer hover-opacity",title:"Edit",onClick:()=>n(e?.data?.id),children:t.jsx(c,{})}),i&&t.jsx("span",{className:"mx-2"}),i&&t.jsx(r.DeleteButtonIcon,{className:"delete-icon-pale",onClick:()=>s(e?.data?.id)})]})},Q=e=>t.jsx("div",{style:d,children:e?.data?.category?.name}),g=e=>{const n=r.QUESTION_TYPES_OPTIONS.find(s=>s.value===e?.data?.type);return n?t.jsx("div",{children:n.label}):t.jsx("div",{children:e?.data?.type})},k=e=>t.jsx("div",{children:e?.data?.userForQuestion}),b=e=>{const n=r.QUESTION_TYPES_OPTIONS.find(s=>s.value===e?.data?.type);return n?t.jsx("div",{style:d,children:n.label}):t.jsx("div",{style:d,children:e?.data?.type})};exports.renderActions=T;exports.renderActionsCustom=f;exports.renderCategory=Q;exports.renderQuestActive=y;exports.renderQuestChallenge=v;exports.renderQuestRequest=j;exports.renderQuestSource=C;exports.renderQuestText=h;exports.renderQuestionText=x;exports.renderType=g;exports.renderTypeSurvey=b;exports.renderUserQuestion=k;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { jsx as t, jsxs as r } from "react/jsx-runtime";
|
|
2
|
+
import { getTextFromHTML as s, QUESTION_TYPES_OPTIONS as d, EditButtonIcon as u, DeleteButtonIcon as o } from "mario-core";
|
|
3
|
+
import { w as h, a as f, b as v } from "./constants-DnLmXiRl.js";
|
|
4
|
+
import { Checkbox as C } from "@mui/material";
|
|
5
|
+
const x = () => /* @__PURE__ */ t("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ t("g", { opacity: "0.4", children: /* @__PURE__ */ t("path", { d: "M5 19H6.098L16.7962 8.302L15.698 7.20375L5 17.902V19ZM4 20V17.4808L17.1807 4.2865C17.2832 4.19517 17.3963 4.12458 17.52 4.07475C17.6438 4.02492 17.7729 4 17.9072 4C18.0416 4 18.1717 4.02117 18.2977 4.0635C18.4236 4.10583 18.5397 4.18208 18.6462 4.29225L19.7135 5.3655C19.8237 5.47183 19.899 5.5885 19.9395 5.7155C19.9798 5.84267 20 5.96975 20 6.09675C20 6.23225 19.9772 6.36192 19.9315 6.48575C19.8858 6.60942 19.8132 6.7225 19.7135 6.825L6.51925 20H4ZM16.2375 7.7625L15.698 7.20375L16.7962 8.302L16.2375 7.7625Z", fill: "#242424" }) }) }), y = {
|
|
6
|
+
root: {
|
|
7
|
+
padding: 0,
|
|
8
|
+
"&.Mui-checked": {
|
|
9
|
+
color: "#3f51b5 !important"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}, l = {
|
|
13
|
+
whiteSpace: "normal",
|
|
14
|
+
overflow: "hidden",
|
|
15
|
+
textOverflow: "ellipsis",
|
|
16
|
+
display: "-webkit-box",
|
|
17
|
+
WebkitLineClamp: 2,
|
|
18
|
+
WebkitBoxOrient: "vertical",
|
|
19
|
+
lineHeight: "1.5em",
|
|
20
|
+
maxHeight: "3em"
|
|
21
|
+
}, p = (e) => /* @__PURE__ */ t("div", { style: l, children: s(e?.data?.text) || "No text" }), w = (e) => /* @__PURE__ */ t("div", { children: s(e?.data?.title) || "No title" }), D = (e) => {
|
|
22
|
+
const n = h.find((i) => i.data === e?.data?.challenge);
|
|
23
|
+
return n ? /* @__PURE__ */ t("div", { children: s(n?.label) }) : /* @__PURE__ */ t("div", { children: "No challenge" });
|
|
24
|
+
}, N = (e) => {
|
|
25
|
+
const n = f.find((i) => i.data === e?.data?.source);
|
|
26
|
+
return n ? /* @__PURE__ */ t("div", { children: s(n?.label) }) : /* @__PURE__ */ t("div", { children: "No source" });
|
|
27
|
+
}, T = (e) => {
|
|
28
|
+
const n = v.find((i) => i.data === e?.data?.request);
|
|
29
|
+
return n ? /* @__PURE__ */ t("div", { children: s(n?.label) }) : /* @__PURE__ */ t("div", { children: "No request" });
|
|
30
|
+
}, m = (e) => /* @__PURE__ */ t(
|
|
31
|
+
C,
|
|
32
|
+
{
|
|
33
|
+
color: "primary",
|
|
34
|
+
disabled: !0,
|
|
35
|
+
checked: e?.data?.status,
|
|
36
|
+
sx: y.root
|
|
37
|
+
}
|
|
38
|
+
), I = ({ params: e, edit: n, remove: i }) => {
|
|
39
|
+
const a = e?.data?.isDefaultQuestion && !e?.data?.isDefaultClassReflection && !e?.data?.isDefaultSurvey ? !e?.data?.isInCluster : !(e?.data?.isDefaultQuestion || e?.data?.isDefaultQuestionGeneralClass);
|
|
40
|
+
return /* @__PURE__ */ r("div", { style: { display: "flex", alignItems: "center", gap: "5px" }, children: [
|
|
41
|
+
/* @__PURE__ */ t(u, { className: "delete-icon-pale", onClick: () => n(e?.data?.id) }),
|
|
42
|
+
a && /* @__PURE__ */ t("span", { className: "mx-2" }),
|
|
43
|
+
a && /* @__PURE__ */ t(o, { className: "delete-icon-pale", onClick: () => i(e?.data?.id) })
|
|
44
|
+
] });
|
|
45
|
+
}, L = ({ params: e, edit: n, remove: i }) => {
|
|
46
|
+
const a = e?.data?.isDefaultQuestion && !e?.data?.isDefaultClassReflection && !e?.data?.isDefaultSurvey ? !e?.data?.isInCluster : !(e?.data?.isDefaultQuestion || e?.data?.isDefaultQuestionGeneralClass);
|
|
47
|
+
return /* @__PURE__ */ r("div", { children: [
|
|
48
|
+
/* @__PURE__ */ t(
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
className: "d-inline text-center cursor-pointer hover-opacity",
|
|
52
|
+
title: "Edit",
|
|
53
|
+
onClick: () => n(e?.data?.id),
|
|
54
|
+
children: /* @__PURE__ */ t(x, {})
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
a && /* @__PURE__ */ t("span", { className: "mx-2" }),
|
|
58
|
+
a && /* @__PURE__ */ t(o, { className: "delete-icon-pale", onClick: () => i(e?.data?.id) })
|
|
59
|
+
] });
|
|
60
|
+
}, S = (e) => /* @__PURE__ */ t("div", { style: l, children: e?.data?.category?.name }), H = (e) => {
|
|
61
|
+
const n = d.find(
|
|
62
|
+
(i) => i.value === e?.data?.type
|
|
63
|
+
);
|
|
64
|
+
return n ? /* @__PURE__ */ t("div", { children: n.label }) : /* @__PURE__ */ t("div", { children: e?.data?.type });
|
|
65
|
+
}, M = (e) => /* @__PURE__ */ t("div", { children: e?.data?.userForQuestion }), O = (e) => {
|
|
66
|
+
const n = d.find(
|
|
67
|
+
(i) => i.value === e?.data?.type
|
|
68
|
+
);
|
|
69
|
+
return n ? /* @__PURE__ */ t("div", { style: l, children: n.label }) : /* @__PURE__ */ t("div", { style: l, children: e?.data?.type });
|
|
70
|
+
};
|
|
71
|
+
export {
|
|
72
|
+
H as a,
|
|
73
|
+
S as b,
|
|
74
|
+
I as c,
|
|
75
|
+
M as d,
|
|
76
|
+
O as e,
|
|
77
|
+
L as f,
|
|
78
|
+
w as g,
|
|
79
|
+
D as h,
|
|
80
|
+
N as i,
|
|
81
|
+
T as j,
|
|
82
|
+
m as k,
|
|
83
|
+
p as r
|
|
84
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("mario-core"),t=require("./QuestionBankList-Cq31dqeX.cjs"),n=[{path:"/admin/question/default-question-list",title:"check_in_and_1_1_questions",component:()=>e.jsx(t.default,{isDefaultQuestion:!0,isDefaultClassReflection:!1,isDefaultSurvey:!1})},{path:"/admin/question/wellbeing-list",title:"wellbeing_questions",component:()=>e.jsx(t.default,{isDefaultQuestion:!1,isDefaultClassReflection:!1,isDefaultSurvey:!1,isWellbeingQuestion:!0})},{path:"/admin/question/class-reflection-list",title:"class_reflection_question",component:()=>e.jsx(t.default,{isDefaultQuestion:!0,isDefaultClassReflection:!0})},{path:"/admin/question/conference-list",title:"conference_question",component:()=>e.jsx(t.default,{isDefaultQuestion:!1,isDefaultClassReflection:!1,isDefaultConference:!0})}],l="question_bank",u=()=>{const{t:i}=s.useTranslation();return e.jsx(s.CustomTab,{title:i(l),tabs:n})};exports.default=u;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation as i, CustomTab as n } from "mario-core";
|
|
3
|
+
import t from "./QuestionBankList-BksfBJOE.js";
|
|
4
|
+
const l = [
|
|
5
|
+
{
|
|
6
|
+
path: "/admin/question/default-question-list",
|
|
7
|
+
title: "check_in_and_1_1_questions",
|
|
8
|
+
component: () => /* @__PURE__ */ e(
|
|
9
|
+
t,
|
|
10
|
+
{
|
|
11
|
+
isDefaultQuestion: !0,
|
|
12
|
+
isDefaultClassReflection: !1,
|
|
13
|
+
isDefaultSurvey: !1
|
|
14
|
+
}
|
|
15
|
+
)
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
path: "/admin/question/wellbeing-list",
|
|
19
|
+
title: "wellbeing_questions",
|
|
20
|
+
component: () => /* @__PURE__ */ e(
|
|
21
|
+
t,
|
|
22
|
+
{
|
|
23
|
+
isDefaultQuestion: !1,
|
|
24
|
+
isDefaultClassReflection: !1,
|
|
25
|
+
isDefaultSurvey: !1,
|
|
26
|
+
isWellbeingQuestion: !0
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
path: "/admin/question/class-reflection-list",
|
|
32
|
+
title: "class_reflection_question",
|
|
33
|
+
component: () => /* @__PURE__ */ e(
|
|
34
|
+
t,
|
|
35
|
+
{
|
|
36
|
+
isDefaultQuestion: !0,
|
|
37
|
+
isDefaultClassReflection: !0
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
path: "/admin/question/conference-list",
|
|
43
|
+
title: "conference_question",
|
|
44
|
+
component: () => /* @__PURE__ */ e(
|
|
45
|
+
t,
|
|
46
|
+
{
|
|
47
|
+
isDefaultQuestion: !1,
|
|
48
|
+
isDefaultClassReflection: !1,
|
|
49
|
+
isDefaultConference: !0
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
], o = "question_bank", c = () => {
|
|
54
|
+
const { t: s } = i();
|
|
55
|
+
return /* @__PURE__ */ e(n, { title: s(o), tabs: l });
|
|
56
|
+
};
|
|
57
|
+
export {
|
|
58
|
+
c as default
|
|
59
|
+
};
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { jsxs as y, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as M, useEffect as Q, useState as $, useCallback as O, useMemo as B } from "react";
|
|
3
|
+
import { Row as b, Col as v } from "reactstrap";
|
|
4
|
+
import { AgGridReact as U } from "@ag-grid-community/react";
|
|
5
|
+
import { MasterDetailModule as G } from "@ag-grid-enterprise/master-detail";
|
|
6
|
+
import { ClientSideRowModelModule as j } from "@ag-grid-community/client-side-row-model";
|
|
7
|
+
import { useTranslation as F, setLoading as p, setQuestionList as z, setAlert as w, setModal as H, SearchBoxContainer as J, CustomPagination as V } from "mario-core";
|
|
8
|
+
import { useSelector as E, useDispatch as Y } from "react-redux";
|
|
9
|
+
import { useNavigate as K } from "react-router-dom";
|
|
10
|
+
import { T as _ } from "./constants-DnLmXiRl.js";
|
|
11
|
+
import { Q as W } from "./QuestionPreview-DCOioiUM.js";
|
|
12
|
+
import { g as X, u as Z, r as ee } from "./questionService-QOYcahgr.js";
|
|
13
|
+
import { r as te, a as re, b as se, c as ne, d as oe } from "./AgGridComponents-kqFYvysF.js";
|
|
14
|
+
import { C as ae } from "./CheckboxCustom-CRZWuCKp.js";
|
|
15
|
+
const ie = "/admin/question-bank", ce = "/admin/create-question", de = "Question list", le = (l, a, C, m, R) => {
|
|
16
|
+
const q = K(), { t: o } = F(), S = E(
|
|
17
|
+
(e) => e.questionBank.questionList
|
|
18
|
+
), I = E(
|
|
19
|
+
(e) => e.questionBank.totalItems
|
|
20
|
+
), i = M(), f = (e) => i.current = e, N = () => i && i.current && i.current.sizeColumnsToFit();
|
|
21
|
+
Q(() => {
|
|
22
|
+
N();
|
|
23
|
+
}, [S]);
|
|
24
|
+
const x = {
|
|
25
|
+
currentPage: 1,
|
|
26
|
+
pageSize: 10,
|
|
27
|
+
searchString: "",
|
|
28
|
+
isDefaultQuestion: l,
|
|
29
|
+
isDefaultClassReflection: a,
|
|
30
|
+
isWellbeingQuestion: R,
|
|
31
|
+
isDefaultConference: C ?? void 0,
|
|
32
|
+
isDefaultSurvey: m ?? void 0,
|
|
33
|
+
sortBy: m ? "0" : "",
|
|
34
|
+
isDescending: !1,
|
|
35
|
+
isIntervention: !1
|
|
36
|
+
}, [n, D] = $(x), d = (e) => {
|
|
37
|
+
const s = {
|
|
38
|
+
...n,
|
|
39
|
+
...e
|
|
40
|
+
};
|
|
41
|
+
s.searchString && (s.currentPage = 1), D(s);
|
|
42
|
+
}, L = () => {
|
|
43
|
+
d({ isIntervention: !n.isIntervention });
|
|
44
|
+
}, t = Y(), r = O(async () => {
|
|
45
|
+
t(p(!0));
|
|
46
|
+
try {
|
|
47
|
+
let e = n;
|
|
48
|
+
a && !l && delete e.isDefaultQuestion;
|
|
49
|
+
const s = await X(n), { items: h, totalItems: A } = s.data;
|
|
50
|
+
t(z({ questionList: h, totalItems: A }));
|
|
51
|
+
} catch (e) {
|
|
52
|
+
t(
|
|
53
|
+
w({
|
|
54
|
+
type: "danger",
|
|
55
|
+
message: e.response?.data?.title || "Get questions failed"
|
|
56
|
+
})
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
t(p(!1));
|
|
60
|
+
}, [t, n]), u = O(
|
|
61
|
+
async (e, s) => {
|
|
62
|
+
t(p(!0));
|
|
63
|
+
try {
|
|
64
|
+
await Z(e, s), t(
|
|
65
|
+
w({
|
|
66
|
+
type: "success",
|
|
67
|
+
message: "update order successfully"
|
|
68
|
+
})
|
|
69
|
+
);
|
|
70
|
+
} catch (h) {
|
|
71
|
+
t(
|
|
72
|
+
w({
|
|
73
|
+
type: "danger",
|
|
74
|
+
message: h.response?.data?.title || "Get questions failed"
|
|
75
|
+
})
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
t(p(!1));
|
|
79
|
+
},
|
|
80
|
+
[t, n]
|
|
81
|
+
), g = O(
|
|
82
|
+
(e) => {
|
|
83
|
+
t(p(!0)), t(
|
|
84
|
+
H({
|
|
85
|
+
isOpen: !0,
|
|
86
|
+
type: "warning",
|
|
87
|
+
message: o("do_you_want_to_remove_this_question"),
|
|
88
|
+
onConfirm: async () => {
|
|
89
|
+
try {
|
|
90
|
+
await ee(e), r(), t(
|
|
91
|
+
w({
|
|
92
|
+
type: "success",
|
|
93
|
+
message: "Remove question successfully"
|
|
94
|
+
})
|
|
95
|
+
);
|
|
96
|
+
} catch (s) {
|
|
97
|
+
t(
|
|
98
|
+
w({
|
|
99
|
+
type: "danger",
|
|
100
|
+
message: s.response?.data?.title || "Remove question failed"
|
|
101
|
+
})
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
})
|
|
106
|
+
), t(p(!1));
|
|
107
|
+
},
|
|
108
|
+
[n]
|
|
109
|
+
), T = O((e) => {
|
|
110
|
+
let s = _.Default;
|
|
111
|
+
l && !a ? s = _.OneToOne : a ? s = _.ClassReflection : C ? s = _.Conference : R && (s = _.Wellbeing);
|
|
112
|
+
const h = e ? `${ie}/${e}` : ce;
|
|
113
|
+
q(`${h}?type=${s}`);
|
|
114
|
+
}, []);
|
|
115
|
+
Q(() => {
|
|
116
|
+
document.title = de;
|
|
117
|
+
}, []), Q(() => {
|
|
118
|
+
r();
|
|
119
|
+
}, [n]);
|
|
120
|
+
const k = (e) => {
|
|
121
|
+
d(
|
|
122
|
+
n.sortBy == e ? { isDescending: !n.isDescending } : { sortOrder: !1, sortBy: e }
|
|
123
|
+
);
|
|
124
|
+
}, P = [
|
|
125
|
+
{
|
|
126
|
+
headerName: "",
|
|
127
|
+
cellRenderer: "agGroupCellRenderer",
|
|
128
|
+
width: 20
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
headerName: o("question_text"),
|
|
132
|
+
sortingOrder: ["asc", "desc"],
|
|
133
|
+
cellRenderer: (e) => te(e)
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
headerName: o("question_type"),
|
|
137
|
+
sortingOrder: ["asc", "desc"],
|
|
138
|
+
cellRenderer: (e) => re(e)
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
headerName: o("category"),
|
|
142
|
+
sortingOrder: ["asc", "desc"],
|
|
143
|
+
cellRenderer: (e) => se(e)
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
width: 80,
|
|
147
|
+
headerComponentParams: {
|
|
148
|
+
template: `<div class="text-center w-100">${o("actions")}</div>`
|
|
149
|
+
},
|
|
150
|
+
cellStyle: { textAlign: "center" },
|
|
151
|
+
cellRenderer: (e) => ne({
|
|
152
|
+
params: e,
|
|
153
|
+
edit: T,
|
|
154
|
+
remove: g
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
];
|
|
158
|
+
return {
|
|
159
|
+
gridOptions: {
|
|
160
|
+
columnDefs: l && !a ? [
|
|
161
|
+
...P,
|
|
162
|
+
{
|
|
163
|
+
rowDrag: !0,
|
|
164
|
+
onRowDragMove: () => {
|
|
165
|
+
console.log("run");
|
|
166
|
+
},
|
|
167
|
+
headerComponentParams: {
|
|
168
|
+
template: `<div class="text-center w-100">${o("order")}</div>`
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
] : a ? [
|
|
172
|
+
...P,
|
|
173
|
+
{
|
|
174
|
+
cellRenderer: (e) => oe(e),
|
|
175
|
+
headerComponentParams: {
|
|
176
|
+
template: `<div class="text-center w-100">${o("user_for")}</div>`
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
rowDrag: !0,
|
|
181
|
+
headerComponentParams: {
|
|
182
|
+
template: `<div class="text-center w-100">${o("order")}</div>`
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
] : P,
|
|
186
|
+
detailCellRenderer: "preview",
|
|
187
|
+
defaultColDef: {
|
|
188
|
+
resizable: !0
|
|
189
|
+
},
|
|
190
|
+
components: { preview: W },
|
|
191
|
+
localeText: { noRowsToShow: o("no_question_to_display") }
|
|
192
|
+
},
|
|
193
|
+
setRef: f,
|
|
194
|
+
questionList: S,
|
|
195
|
+
totalItems: I,
|
|
196
|
+
filters: n,
|
|
197
|
+
changeFilters: d,
|
|
198
|
+
getData: r,
|
|
199
|
+
removeData: g,
|
|
200
|
+
goToDetail: T,
|
|
201
|
+
updateOrderQuestions: u,
|
|
202
|
+
onToggleIntervention: L,
|
|
203
|
+
handleSortFilter: k
|
|
204
|
+
};
|
|
205
|
+
}, Oe = ({
|
|
206
|
+
isDefaultQuestion: l = !1,
|
|
207
|
+
isDefaultClassReflection: a,
|
|
208
|
+
isDefaultConference: C,
|
|
209
|
+
isDefaultSurvey: m,
|
|
210
|
+
isWellbeingQuestion: R
|
|
211
|
+
}) => {
|
|
212
|
+
const {
|
|
213
|
+
totalItems: q,
|
|
214
|
+
gridOptions: o,
|
|
215
|
+
setRef: S,
|
|
216
|
+
goToDetail: I,
|
|
217
|
+
filters: i,
|
|
218
|
+
changeFilters: f,
|
|
219
|
+
updateOrderQuestions: N,
|
|
220
|
+
onToggleIntervention: x,
|
|
221
|
+
handleSortFilter: n,
|
|
222
|
+
questionList: D
|
|
223
|
+
} = le(l, a, C, m, R), { t: d } = F(), L = B(() => ({
|
|
224
|
+
sortable: !0
|
|
225
|
+
}), []), t = (r) => {
|
|
226
|
+
const u = r.node.parent.childrenAfterFilter.map(
|
|
227
|
+
(g, T) => ({
|
|
228
|
+
id: g.data.id,
|
|
229
|
+
orderDrag: ++T
|
|
230
|
+
})
|
|
231
|
+
);
|
|
232
|
+
N(u, a);
|
|
233
|
+
};
|
|
234
|
+
return /* @__PURE__ */ y("div", { className: "animated fadeIn", children: [
|
|
235
|
+
/* @__PURE__ */ y(b, { className: "my-2", children: [
|
|
236
|
+
/* @__PURE__ */ c(v, { md: 8, children: /* @__PURE__ */ c(
|
|
237
|
+
J,
|
|
238
|
+
{
|
|
239
|
+
text: d("create_question"),
|
|
240
|
+
onClick: () => I(),
|
|
241
|
+
initValue: i.searchString,
|
|
242
|
+
onSearch: (r) => f({ searchString: r }),
|
|
243
|
+
placeholder: d("type_something_to_search_question")
|
|
244
|
+
}
|
|
245
|
+
) }),
|
|
246
|
+
m && /* @__PURE__ */ y(v, { md: 2, className: "d-flex align-items-center justify-content-center", children: [
|
|
247
|
+
/* @__PURE__ */ c(ae, { isActive: i.isIntervention ?? !1, onClick: x }),
|
|
248
|
+
/* @__PURE__ */ c("p", { className: "m-0 ml-2", children: d("is_intervention") })
|
|
249
|
+
] }),
|
|
250
|
+
/* @__PURE__ */ y(
|
|
251
|
+
v,
|
|
252
|
+
{
|
|
253
|
+
md: l || a || m ? 2 : 4,
|
|
254
|
+
className: "d-flex align-items-center justify-content-end",
|
|
255
|
+
children: [
|
|
256
|
+
d("total_of_questions"),
|
|
257
|
+
": ",
|
|
258
|
+
q
|
|
259
|
+
]
|
|
260
|
+
}
|
|
261
|
+
)
|
|
262
|
+
] }),
|
|
263
|
+
/* @__PURE__ */ y(b, { className: "mb-2", children: [
|
|
264
|
+
/* @__PURE__ */ c(v, { md: 12, className: "mb-2", children: /* @__PURE__ */ c("div", { className: "ag-theme-balham w-100", children: /* @__PURE__ */ c(
|
|
265
|
+
U,
|
|
266
|
+
{
|
|
267
|
+
rowData: D,
|
|
268
|
+
defaultColDef: L,
|
|
269
|
+
sortingOrder: ["desc", "asc"],
|
|
270
|
+
domLayout: "autoHeight",
|
|
271
|
+
gridOptions: o,
|
|
272
|
+
masterDetail: !0,
|
|
273
|
+
onGridReady: (r) => {
|
|
274
|
+
S(r.api);
|
|
275
|
+
},
|
|
276
|
+
rowDragManaged: !0,
|
|
277
|
+
animateRows: !0,
|
|
278
|
+
modules: [
|
|
279
|
+
G,
|
|
280
|
+
j
|
|
281
|
+
],
|
|
282
|
+
onRowDragEnd: t,
|
|
283
|
+
onSortChanged: (r) => {
|
|
284
|
+
const u = r.api.getColumnState().filter((g) => g.sort != null);
|
|
285
|
+
u.length > 0 && n(u[0].colId);
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
JSON.stringify(i)
|
|
289
|
+
) }) }),
|
|
290
|
+
/* @__PURE__ */ c(v, { md: 12, children: /* @__PURE__ */ c(
|
|
291
|
+
V,
|
|
292
|
+
{
|
|
293
|
+
filters: i,
|
|
294
|
+
totalRecordCount: q,
|
|
295
|
+
changePageSize: (r) => f({ pageSize: r }),
|
|
296
|
+
changePage: (r) => f({ currentPage: r })
|
|
297
|
+
}
|
|
298
|
+
) })
|
|
299
|
+
] })
|
|
300
|
+
] });
|
|
301
|
+
};
|
|
302
|
+
export {
|
|
303
|
+
Oe as default
|
|
304
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),l=require("react"),g=require("reactstrap"),Q=require("@ag-grid-community/react"),A=require("@ag-grid-enterprise/master-detail"),k=require("@ag-grid-community/client-side-row-model"),s=require("mario-core"),L=require("react-redux"),M=require("react-router-dom"),y=require("./constants-Dx5hVWbo.cjs"),U=require("./QuestionPreview--k6K3X2k.cjs"),P=require("./questionService-C9Wqbu1q.cjs"),C=require("./AgGridComponents-DDk8se4v.cjs"),F=require("./CheckboxCustom-ZjvBGVzS.cjs"),$="/admin/question-bank",B="/admin/create-question",G="Question list",Y=(m,c,w,h,x)=>{const S=M.useNavigate(),{t:i}=s.useTranslation(),T=L.useSelector(e=>e.questionBank.questionList),R=L.useSelector(e=>e.questionBank.totalItems),d=l.useRef(),q=e=>d.current=e,O=()=>d&&d.current&&d.current.sizeColumnsToFit();l.useEffect(()=>{O()},[T]);const I={currentPage:1,pageSize:10,searchString:"",isDefaultQuestion:m,isDefaultClassReflection:c,isWellbeingQuestion:x,isDefaultConference:w??void 0,isDefaultSurvey:h??void 0,sortBy:h?"0":"",isDescending:!1,isIntervention:!1},[a,N]=l.useState(I),u=e=>{const n={...a,...e};n.searchString&&(n.currentPage=1),N(n)},E=()=>{u({isIntervention:!a.isIntervention})},t=L.useDispatch(),r=l.useCallback(async()=>{t(s.setLoading(!0));try{let e=a;c&&!m&&delete e.isDefaultQuestion;const n=await P.get(a),{items:v,totalItems:D}=n.data;t(s.setQuestionList({questionList:v,totalItems:D}))}catch(e){t(s.setAlert({type:"danger",message:e.response?.data?.title||"Get questions failed"}))}t(s.setLoading(!1))},[t,a]),p=l.useCallback(async(e,n)=>{t(s.setLoading(!0));try{await P.updateOrderDragQuestions(e,n),t(s.setAlert({type:"success",message:"update order successfully"}))}catch(v){t(s.setAlert({type:"danger",message:v.response?.data?.title||"Get questions failed"}))}t(s.setLoading(!1))},[t,a]),f=l.useCallback(e=>{t(s.setLoading(!0)),t(s.setModal({isOpen:!0,type:"warning",message:i("do_you_want_to_remove_this_question"),onConfirm:async()=>{try{await P.remove(e),r(),t(s.setAlert({type:"success",message:"Remove question successfully"}))}catch(n){t(s.setAlert({type:"danger",message:n.response?.data?.title||"Remove question failed"}))}}})),t(s.setLoading(!1))},[a]),_=l.useCallback(e=>{let n=y.TYPE_QUESTION.Default;m&&!c?n=y.TYPE_QUESTION.OneToOne:c?n=y.TYPE_QUESTION.ClassReflection:w?n=y.TYPE_QUESTION.Conference:x&&(n=y.TYPE_QUESTION.Wellbeing);const v=e?`${$}/${e}`:B;S(`${v}?type=${n}`)},[]);l.useEffect(()=>{document.title=G},[]),l.useEffect(()=>{r()},[a]);const b=e=>{u(a.sortBy==e?{isDescending:!a.isDescending}:{sortOrder:!1,sortBy:e})},j=[{headerName:"",cellRenderer:"agGroupCellRenderer",width:20},{headerName:i("question_text"),sortingOrder:["asc","desc"],cellRenderer:e=>C.renderQuestionText(e)},{headerName:i("question_type"),sortingOrder:["asc","desc"],cellRenderer:e=>C.renderType(e)},{headerName:i("category"),sortingOrder:["asc","desc"],cellRenderer:e=>C.renderCategory(e)},{width:80,headerComponentParams:{template:`<div class="text-center w-100">${i("actions")}</div>`},cellStyle:{textAlign:"center"},cellRenderer:e=>C.renderActions({params:e,edit:_,remove:f})}];return{gridOptions:{columnDefs:m&&!c?[...j,{rowDrag:!0,onRowDragMove:()=>{console.log("run")},headerComponentParams:{template:`<div class="text-center w-100">${i("order")}</div>`}}]:c?[...j,{cellRenderer:e=>C.renderUserQuestion(e),headerComponentParams:{template:`<div class="text-center w-100">${i("user_for")}</div>`}},{rowDrag:!0,headerComponentParams:{template:`<div class="text-center w-100">${i("order")}</div>`}}]:j,detailCellRenderer:"preview",defaultColDef:{resizable:!0},components:{preview:U.QuestionPreview},localeText:{noRowsToShow:i("no_question_to_display")}},setRef:q,questionList:T,totalItems:R,filters:a,changeFilters:u,getData:r,removeData:f,goToDetail:_,updateOrderQuestions:p,onToggleIntervention:E,handleSortFilter:b}},z=({isDefaultQuestion:m=!1,isDefaultClassReflection:c,isDefaultConference:w,isDefaultSurvey:h,isWellbeingQuestion:x})=>{const{totalItems:S,gridOptions:i,setRef:T,goToDetail:R,filters:d,changeFilters:q,updateOrderQuestions:O,onToggleIntervention:I,handleSortFilter:a,questionList:N}=Y(m,c,w,h,x),{t:u}=s.useTranslation(),E=l.useMemo(()=>({sortable:!0}),[]),t=r=>{const p=r.node.parent.childrenAfterFilter.map((f,_)=>({id:f.data.id,orderDrag:++_}));O(p,c)};return o.jsxs("div",{className:"animated fadeIn",children:[o.jsxs(g.Row,{className:"my-2",children:[o.jsx(g.Col,{md:8,children:o.jsx(s.SearchBoxContainer,{text:u("create_question"),onClick:()=>R(),initValue:d.searchString,onSearch:r=>q({searchString:r}),placeholder:u("type_something_to_search_question")})}),h&&o.jsxs(g.Col,{md:2,className:"d-flex align-items-center justify-content-center",children:[o.jsx(F.CheckboxCustom,{isActive:d.isIntervention??!1,onClick:I}),o.jsx("p",{className:"m-0 ml-2",children:u("is_intervention")})]}),o.jsxs(g.Col,{md:m||c||h?2:4,className:"d-flex align-items-center justify-content-end",children:[u("total_of_questions"),": ",S]})]}),o.jsxs(g.Row,{className:"mb-2",children:[o.jsx(g.Col,{md:12,className:"mb-2",children:o.jsx("div",{className:"ag-theme-balham w-100",children:o.jsx(Q.AgGridReact,{rowData:N,defaultColDef:E,sortingOrder:["desc","asc"],domLayout:"autoHeight",gridOptions:i,masterDetail:!0,onGridReady:r=>{T(r.api)},rowDragManaged:!0,animateRows:!0,modules:[A.MasterDetailModule,k.ClientSideRowModelModule],onRowDragEnd:t,onSortChanged:r=>{const p=r.api.getColumnState().filter(f=>f.sort!=null);p.length>0&&a(p[0].colId)}},JSON.stringify(d))})}),o.jsx(g.Col,{md:12,children:o.jsx(s.CustomPagination,{filters:d,totalRecordCount:S,changePageSize:r=>q({pageSize:r}),changePage:r=>q({currentPage:r})})})]})]})};exports.default=z;
|