@materialui-reactjs/admin 2.0.0 → 2.0.1
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/CHANGELOG.md +30 -0
- package/README.md +4 -1
- package/dist/Common-DFahMuQE.cjs +11 -0
- package/dist/{Common-1GAoFU4L.js → Common-_PK8HLKN.js} +22 -16
- package/dist/HeaderUpdate-Dirxjmxs.cjs +1 -0
- package/dist/{HeaderUpdate-UXncZcAD.js → HeaderUpdate-drlnuHI8.js} +24 -25
- package/dist/{UDragFile-BqGt1-gK.js → UDragFile-D8wOZ1Ut.js} +2 -2
- package/dist/UDragFile-Db0sK4M7.cjs +1 -0
- package/dist/{Validator-aKlMgoxl.js → Validator-D2zwZeov.js} +73 -50
- package/dist/Validator-DBxl8wtE.cjs +1 -0
- package/dist/ckeditor/ckeditor.d.ts +3 -0
- package/dist/ckeditor/plugins/elfinder.d.ts +11 -0
- package/dist/ckeditor/plugins/fullscreen.d.ts +15 -0
- package/dist/ckeditor/plugins/pdffinder.d.ts +18 -0
- package/dist/ckeditor/types.d.ts +37 -0
- package/dist/{common-DVWX6AUQ.js → common-CEZp8xpQ.js} +14 -3
- package/dist/common-ivDX6gGq.cjs +1 -0
- package/dist/components/echarts/index.cjs +1 -1
- package/dist/components/echarts/index.js +1 -1
- package/dist/components/form/AsxhUImages.d.ts +2 -1
- package/dist/components/form/BoxAddRow.d.ts +2 -1
- package/dist/components/form/CusForm.d.ts +19 -6
- package/dist/components/form/Editor.d.ts +2 -1
- package/dist/components/form/EfImage.d.ts +2 -1
- package/dist/components/form/EfImages.d.ts +2 -1
- package/dist/components/form/PImage.d.ts +2 -1
- package/dist/components/form/SelectAddRowBoxAdvanced.d.ts +13 -4
- package/dist/components/form/SelectBox.d.ts +20 -7
- package/dist/components/form/UDragFile.d.ts +2 -1
- package/dist/components/form/UFile.d.ts +2 -1
- package/dist/components/form/UFiles.d.ts +9 -2
- package/dist/components/form/UImages.d.ts +2 -1
- package/dist/components/form/index.cjs +1 -1
- package/dist/components/form/index.js +2 -2
- package/dist/components/meta/CardTable.d.ts +4 -2
- package/dist/components/meta/CardTable.types.d.ts +11 -5
- package/dist/components/meta/CusTooltip.d.ts +7 -1
- package/dist/components/meta/Head.d.ts +10 -1
- package/dist/components/meta/HeaderDetail.d.ts +2 -1
- package/dist/components/meta/ScrollTable.d.ts +7 -3
- package/dist/components/meta/SearchBox.d.ts +2 -1
- package/dist/components/meta/SortableItem.d.ts +11 -1
- package/dist/components/meta/index.cjs +1 -1
- package/dist/components/meta/index.js +2 -2
- package/dist/components/sidebar/index.cjs +1 -1
- package/dist/components/sidebar/index.js +1 -1
- package/dist/components/single/List.d.ts +15 -4
- package/dist/components/single/Update.d.ts +2 -1
- package/dist/components/single/UpdateTableDetail.d.ts +2 -1
- package/dist/components/single/index.cjs +1 -1
- package/dist/components/single/index.js +1 -1
- package/dist/components/top-navbar/index.cjs +1 -1
- package/dist/components/top-navbar/index.js +28 -28
- package/dist/echarts-Bi3uwLbg.cjs +1 -0
- package/dist/{echarts-CRmndsxC.js → echarts-CTzMqeR5.js} +4 -4
- package/dist/form-heyswTRq.js +3897 -0
- package/dist/form-sgtop6li.cjs +49 -0
- package/dist/hook/common.d.ts +22 -0
- package/dist/hook/detail.cjs +1 -1
- package/dist/hook/detail.js +1 -1
- package/dist/hook/fields.cjs +1 -1
- package/dist/hook/fields.js +1 -1
- package/dist/hook/index.cjs +1 -1
- package/dist/hook/index.d.ts +4 -3
- package/dist/hook/index.js +10 -10
- package/dist/hook/update.cjs +1 -1
- package/dist/hook/update.d.ts +2 -2
- package/dist/hook/update.js +10 -7
- package/dist/index.cjs +1 -1
- package/dist/index.js +11 -11
- package/dist/meta-BANk9kHW.cjs +1 -0
- package/dist/meta-CheDAmMh.js +745 -0
- package/dist/sidebar-CfQAYWi-.cjs +1 -0
- package/dist/{sidebar-CVORMKBY.js → sidebar-CzRmfvhi.js} +3 -3
- package/dist/{single-CqD5cgNi.js → single-BsJ7TYJi.js} +240 -252
- package/dist/single-C2WPEjhk.cjs +1 -0
- package/dist/utils/Common.d.ts +100 -27
- package/dist/utils/Env.d.ts +1 -1
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.js +49 -40
- package/package.json +1 -1
- package/dist/Common-BBYXssMH.cjs +0 -11
- package/dist/HeaderUpdate-DIwc8EAA.cjs +0 -1
- package/dist/UDragFile-oJ05zNLR.cjs +0 -1
- package/dist/Validator-BcydBvOg.cjs +0 -1
- package/dist/common-CHDJQ2Ca.cjs +0 -1
- package/dist/echarts-Dla22xas.cjs +0 -1
- package/dist/form-BNAbGCXe.js +0 -45955
- package/dist/form-DUL_O4IY.cjs +0 -65
- package/dist/meta-CXHXSPbq.cjs +0 -1
- package/dist/meta-Dhll5zt9.js +0 -764
- package/dist/sidebar-G5Ody16K.cjs +0 -1
- package/dist/single-CsUaxEjQ.cjs +0 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { t as e } from "./Env-SHztUA3s.js";
|
|
2
|
-
import {
|
|
3
|
-
import { n as
|
|
4
|
-
import { t as
|
|
5
|
-
import { t as
|
|
6
|
-
import { a as
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import { Fragment as
|
|
10
|
-
import { Form as
|
|
11
|
-
import { Helmet as
|
|
2
|
+
import { C as t, S as n, a as r, b as i, d as a, n as o, s, x as c, y as l } from "./Common-_PK8HLKN.js";
|
|
3
|
+
import { n as u, o as d, r as f, t as p } from "./Validator-D2zwZeov.js";
|
|
4
|
+
import { t as m } from "./UDragFile-D8wOZ1Ut.js";
|
|
5
|
+
import { t as h } from "./SpinnerLoader-CyhOQC6d.js";
|
|
6
|
+
import { a as g, c as _, d as v, i as y, l as b, n as x, o as S, r as C, s as w, t as T, u as E } from "./HeaderUpdate-drlnuHI8.js";
|
|
7
|
+
import { r as D } from "./common-CEZp8xpQ.js";
|
|
8
|
+
import O, { createRef as k } from "react";
|
|
9
|
+
import { Fragment as A, jsx as j, jsxs as M } from "react/jsx-runtime";
|
|
10
|
+
import { Form as N, Link as P } from "react-router-dom";
|
|
11
|
+
import { Helmet as F } from "react-helmet-async";
|
|
12
12
|
//#region src/utils/Group.ts
|
|
13
|
-
var
|
|
13
|
+
var I = (e, t, n, r, i, a) => {
|
|
14
14
|
if (!a) return !1;
|
|
15
15
|
if (a === 1) return !0;
|
|
16
16
|
if (!Array.isArray(e)) return !1;
|
|
17
17
|
for (let o of e) if (o) {
|
|
18
18
|
if (o.module === t && o.controller === n && o.action === r && Number(o.code) === Number(i)) return o.status !== 0 && !!o.isPer;
|
|
19
|
-
if (Array.isArray(o.subs) && o.subs.length > 0 &&
|
|
19
|
+
if (Array.isArray(o.subs) && o.subs.length > 0 && I(o.subs, t, n, r, i, a)) return !0;
|
|
20
20
|
}
|
|
21
21
|
return !1;
|
|
22
|
-
},
|
|
22
|
+
}, L = class extends O.Component {
|
|
23
23
|
effectRan = !1;
|
|
24
24
|
module = "admins";
|
|
25
25
|
controller = "";
|
|
@@ -56,13 +56,13 @@ var P = (e, t, n, r, i, a) => {
|
|
|
56
56
|
fluid = !1;
|
|
57
57
|
isBackUri = !0;
|
|
58
58
|
debug = !1;
|
|
59
|
-
renderForm = () => /* @__PURE__ */
|
|
59
|
+
renderForm = () => /* @__PURE__ */ j(A, {});
|
|
60
60
|
syncPermissionsAndState = async () => {
|
|
61
|
-
let { menuData: e, user: t } = this.props, n = { isDetail:
|
|
61
|
+
let { menuData: e, user: t } = this.props, n = { isDetail: I(e, this.module, this.controller, "detail", 0, t.groupId) };
|
|
62
62
|
this.setState(n, async () => {
|
|
63
|
-
let e =
|
|
63
|
+
let e = a();
|
|
64
64
|
if (e && n.isDetail) {
|
|
65
|
-
let t = await
|
|
65
|
+
let t = await o(this.getDataUrl + "/" + e, {}, "GET", "application/json", !1), n = t ? t.data : void 0;
|
|
66
66
|
this.setState({
|
|
67
67
|
item: n || !1,
|
|
68
68
|
formValue: n ? JSON.parse(JSON.stringify(n)) : {}
|
|
@@ -77,7 +77,7 @@ var P = (e, t, n, r, i, a) => {
|
|
|
77
77
|
if (this.effectRan) return;
|
|
78
78
|
this.effectRan = !0, this.props.user?.groupId && await this.syncPermissionsAndState();
|
|
79
79
|
} catch (e) {
|
|
80
|
-
e
|
|
80
|
+
s(e) === "invalid_404" && this.props.navigate(this.cUri), c(s(e));
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
componentDidMount() {
|
|
@@ -85,7 +85,7 @@ var P = (e, t, n, r, i, a) => {
|
|
|
85
85
|
}
|
|
86
86
|
componentDidMountAfter = async () => {};
|
|
87
87
|
renderHeaderDetail() {
|
|
88
|
-
return /* @__PURE__ */
|
|
88
|
+
return /* @__PURE__ */ j(C, {
|
|
89
89
|
adminUri: this.ADMIN_URI,
|
|
90
90
|
title: this.title,
|
|
91
91
|
cUri: this.cUri
|
|
@@ -93,7 +93,7 @@ var P = (e, t, n, r, i, a) => {
|
|
|
93
93
|
}
|
|
94
94
|
handleChange = async (e) => {
|
|
95
95
|
e.preventDefault();
|
|
96
|
-
let t =
|
|
96
|
+
let t = D(e);
|
|
97
97
|
this.debug && console.log("handleChange:", e.target.name, e.target.value), this.setState((e) => ({ formValue: {
|
|
98
98
|
...e.formValue,
|
|
99
99
|
...t
|
|
@@ -101,15 +101,15 @@ var P = (e, t, n, r, i, a) => {
|
|
|
101
101
|
};
|
|
102
102
|
render() {
|
|
103
103
|
let { isDetail: e, item: t } = this.state;
|
|
104
|
-
return e ? t === !1 ? /* @__PURE__ */
|
|
104
|
+
return e ? t === !1 ? /* @__PURE__ */ j(y, {
|
|
105
105
|
cUriTitle: this.title,
|
|
106
106
|
cUri: this.cUri,
|
|
107
107
|
title: this.title + " | Chi tiết"
|
|
108
|
-
}) : /* @__PURE__ */ A
|
|
108
|
+
}) : /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(F, { children: /* @__PURE__ */ j("title", { children: this.title }) }), /* @__PURE__ */ M("div", {
|
|
109
109
|
className: `mb-3 ${this.fluid ? "container-fluid" : "container"}`,
|
|
110
|
-
children: [this.renderHeaderDetail(), /* @__PURE__ */
|
|
110
|
+
children: [this.renderHeaderDetail(), /* @__PURE__ */ j("div", {
|
|
111
111
|
className: "position-relative",
|
|
112
|
-
children: /* @__PURE__ */
|
|
112
|
+
children: /* @__PURE__ */ j(h, {
|
|
113
113
|
loading: !t,
|
|
114
114
|
style: {
|
|
115
115
|
minHeight: 200,
|
|
@@ -118,26 +118,14 @@ var P = (e, t, n, r, i, a) => {
|
|
|
118
118
|
children: this.renderForm()
|
|
119
119
|
})
|
|
120
120
|
})]
|
|
121
|
-
})] }) : /* @__PURE__ */
|
|
121
|
+
})] }) : /* @__PURE__ */ j(g, {
|
|
122
122
|
cUriTitle: this.title,
|
|
123
123
|
cUri: this.cUri,
|
|
124
124
|
title: this.title + " | Chi tiết",
|
|
125
125
|
fluid: this.fluid
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
|
-
}
|
|
129
|
-
//#endregion
|
|
130
|
-
//#region src/hook/common.ts
|
|
131
|
-
function I(e) {
|
|
132
|
-
if (!e) return;
|
|
133
|
-
let t = e.id;
|
|
134
|
-
if (t == null || t === "") return;
|
|
135
|
-
let n = Number(t);
|
|
136
|
-
return Number.isNaN(n) ? void 0 : n;
|
|
137
|
-
}
|
|
138
|
-
//#endregion
|
|
139
|
-
//#region src/components/single/Fields.tsx
|
|
140
|
-
var L = class extends E.Component {
|
|
128
|
+
}, R = class extends O.Component {
|
|
141
129
|
effectRan = !1;
|
|
142
130
|
module = "admins";
|
|
143
131
|
controller = "";
|
|
@@ -177,27 +165,27 @@ var L = class extends E.Component {
|
|
|
177
165
|
fluid = !1;
|
|
178
166
|
isBackUri = !1;
|
|
179
167
|
debug = !1;
|
|
180
|
-
renderForm = () => /* @__PURE__ */
|
|
181
|
-
renderAfterForm = () => /* @__PURE__ */
|
|
168
|
+
renderForm = () => /* @__PURE__ */ j(A, {});
|
|
169
|
+
renderAfterForm = () => /* @__PURE__ */ j(A, {});
|
|
182
170
|
handleChange = async (e) => {
|
|
183
171
|
e.preventDefault();
|
|
184
|
-
let t =
|
|
172
|
+
let t = D(e);
|
|
185
173
|
this.debug && console.log("handleChange:", e.target.name, e.target.value), this.setState((e) => ({ formValue: {
|
|
186
174
|
...e.formValue,
|
|
187
175
|
...t
|
|
188
176
|
} }));
|
|
189
177
|
};
|
|
190
178
|
syncPermissionsAndState = async () => {
|
|
191
|
-
let { menuData: e, user: t } = this.props, n = { isDetail:
|
|
179
|
+
let { menuData: e, user: t } = this.props, n = { isDetail: I(e, this.module, this.controller, "detail", 0, t.groupId) };
|
|
192
180
|
this.setState(n, async () => {
|
|
193
181
|
try {
|
|
194
|
-
let e = await
|
|
182
|
+
let e = await o(this.getDataUrl, { table: this.table }, "GET", "application/json", !1), t = e ? e.data : void 0;
|
|
195
183
|
this.setState({
|
|
196
184
|
item: t || !1,
|
|
197
185
|
formValue: t ? { ...t } : {}
|
|
198
|
-
}), new
|
|
186
|
+
}), new p("#fieldUpdate").run();
|
|
199
187
|
} catch (e) {
|
|
200
|
-
e
|
|
188
|
+
s(e) === "invalid_404" && this.props.navigate(this.cUri), c(s(e));
|
|
201
189
|
}
|
|
202
190
|
});
|
|
203
191
|
};
|
|
@@ -206,7 +194,7 @@ var L = class extends E.Component {
|
|
|
206
194
|
if (this.effectRan) return;
|
|
207
195
|
this.effectRan = !0, this.props.user?.groupId && (await this.syncPermissionsAndState(), await this.componentDidMountAfter());
|
|
208
196
|
} catch (e) {
|
|
209
|
-
e
|
|
197
|
+
s(e) === "invalid_404" && this.props.navigate(this.cUri), c(s(e));
|
|
210
198
|
}
|
|
211
199
|
}
|
|
212
200
|
componentDidMount() {
|
|
@@ -215,13 +203,13 @@ var L = class extends E.Component {
|
|
|
215
203
|
componentDidMountAfter = async () => {};
|
|
216
204
|
handleSubmit = async (e) => {
|
|
217
205
|
e.preventDefault();
|
|
218
|
-
let { formValue:
|
|
219
|
-
if (!
|
|
220
|
-
|
|
206
|
+
let { formValue: r } = this.state, i = new p("#fieldUpdate");
|
|
207
|
+
if (!i.hasErrors() && !i.isIncomplete()) {
|
|
208
|
+
t("#fieldUpdate", !0);
|
|
221
209
|
try {
|
|
222
|
-
|
|
223
|
-
let e = await
|
|
224
|
-
if (
|
|
210
|
+
r.table ||= this.table;
|
|
211
|
+
let e = await o(this.editUrl, r, "POST", this.ctype);
|
|
212
|
+
if (n("Cập nhật thành công", "top-end", !0), e.data.id) {
|
|
225
213
|
if (this.isBackUri) return this.props.navigate(this.cUri);
|
|
226
214
|
this.props.navigate(this.cUri + "/fields"), this.setState({
|
|
227
215
|
item: { ...e.data },
|
|
@@ -231,33 +219,33 @@ var L = class extends E.Component {
|
|
|
231
219
|
});
|
|
232
220
|
}
|
|
233
221
|
} catch (e) {
|
|
234
|
-
c(e
|
|
222
|
+
c(s(e));
|
|
235
223
|
} finally {
|
|
236
|
-
|
|
224
|
+
t("#fieldUpdate", !1);
|
|
237
225
|
}
|
|
238
226
|
}
|
|
239
227
|
};
|
|
240
228
|
afterSubmit = async (e) => {};
|
|
241
229
|
renderHeaderUpdate() {
|
|
242
|
-
return /* @__PURE__ */
|
|
230
|
+
return /* @__PURE__ */ j(T, {
|
|
243
231
|
adminUri: this.ADMIN_URI,
|
|
244
232
|
title: this.title,
|
|
245
233
|
cUri: this.cUri,
|
|
246
|
-
itemId:
|
|
234
|
+
itemId: d(this.state.item)
|
|
247
235
|
});
|
|
248
236
|
}
|
|
249
237
|
render() {
|
|
250
238
|
let { isDetail: e, item: t } = this.state;
|
|
251
|
-
return e === !1 ? /* @__PURE__ */
|
|
239
|
+
return e === !1 ? /* @__PURE__ */ j(g, {
|
|
252
240
|
cUriTitle: this.title,
|
|
253
241
|
cUri: this.cUri,
|
|
254
242
|
title: this.title,
|
|
255
243
|
fluid: this.fluid
|
|
256
|
-
}) : /* @__PURE__ */ A
|
|
257
|
-
/* @__PURE__ */
|
|
258
|
-
/* @__PURE__ */
|
|
244
|
+
}) : /* @__PURE__ */ M(A, { children: [
|
|
245
|
+
/* @__PURE__ */ j(F, { children: /* @__PURE__ */ M("title", { children: [this.title, " | Tùy chỉnh dữ liệu"] }) }),
|
|
246
|
+
/* @__PURE__ */ j("div", {
|
|
259
247
|
className: `position-relative mb-3 ${this.fluid ? "container-fluid" : "container"}`,
|
|
260
|
-
children: /* @__PURE__ */
|
|
248
|
+
children: /* @__PURE__ */ j(N, {
|
|
261
249
|
id: "fieldUpdate",
|
|
262
250
|
className: "position-relative",
|
|
263
251
|
method: "post",
|
|
@@ -265,7 +253,7 @@ var L = class extends E.Component {
|
|
|
265
253
|
"data-toggle": "validator",
|
|
266
254
|
role: "form",
|
|
267
255
|
onSubmit: this.handleSubmit,
|
|
268
|
-
children: /* @__PURE__ */
|
|
256
|
+
children: /* @__PURE__ */ M(h, {
|
|
269
257
|
loading: !t,
|
|
270
258
|
style: {
|
|
271
259
|
minHeight: 200,
|
|
@@ -278,7 +266,7 @@ var L = class extends E.Component {
|
|
|
278
266
|
this.renderAfterForm()
|
|
279
267
|
] });
|
|
280
268
|
}
|
|
281
|
-
},
|
|
269
|
+
}, z = class extends O.Component {
|
|
282
270
|
module = "admins";
|
|
283
271
|
controller = "";
|
|
284
272
|
state = {
|
|
@@ -329,18 +317,18 @@ var L = class extends E.Component {
|
|
|
329
317
|
};
|
|
330
318
|
syncPermissionsAndState = () => {
|
|
331
319
|
let { menuData: e, user: t } = this.props, n = {
|
|
332
|
-
isCre:
|
|
333
|
-
isEdit:
|
|
320
|
+
isCre: I(e, this.module, this.controller, "update", 0, t.groupId),
|
|
321
|
+
isEdit: I(e, this.module, this.controller, "update", 1, t.groupId)
|
|
334
322
|
};
|
|
335
323
|
this.setState(n, async () => {
|
|
336
|
-
new
|
|
324
|
+
new p("#itemImport").run();
|
|
337
325
|
});
|
|
338
326
|
};
|
|
339
327
|
async initDidMount() {
|
|
340
328
|
try {
|
|
341
329
|
this.props.user?.groupId && (this.syncPermissionsAndState(), this.componentDidMountAfter());
|
|
342
330
|
} catch (e) {
|
|
343
|
-
e
|
|
331
|
+
s(e) === "invalid_404" && this.props.navigate(this.cUri), c(s(e));
|
|
344
332
|
}
|
|
345
333
|
}
|
|
346
334
|
componentDidMount() {
|
|
@@ -349,39 +337,39 @@ var L = class extends E.Component {
|
|
|
349
337
|
componentDidMountAfter = async () => {};
|
|
350
338
|
handleSubmit = async (e) => {
|
|
351
339
|
e.preventDefault();
|
|
352
|
-
let { formValue:
|
|
353
|
-
if (!
|
|
354
|
-
|
|
340
|
+
let { formValue: r } = this.state, i = new p("#itemImport");
|
|
341
|
+
if (!i.hasErrors() && !i.isIncomplete()) {
|
|
342
|
+
t("#itemImport", !0);
|
|
355
343
|
try {
|
|
356
|
-
let e = await
|
|
357
|
-
e.data?.error?.length ? e.data.error && this.setState({ error: Object.fromEntries(e.data.error.map((e, t) => [t, e])) }) : (this.props.navigate(this.cUri),
|
|
344
|
+
let e = await o(this.importUrl, r, "POST", this.ctype);
|
|
345
|
+
e.data?.error?.length ? Array.isArray(e.data?.error) && e.data.error.length && this.setState({ error: Object.fromEntries(e.data.error.map((e, t) => [t, e])) }) : (this.props.navigate(this.cUri), n("Import thành công", "top-end", !0));
|
|
358
346
|
} catch (e) {
|
|
359
|
-
c(e
|
|
347
|
+
c(s(e));
|
|
360
348
|
} finally {
|
|
361
|
-
|
|
349
|
+
t("#itemImport", !1);
|
|
362
350
|
}
|
|
363
351
|
}
|
|
364
352
|
};
|
|
365
|
-
renderForm = () => /* @__PURE__ */
|
|
353
|
+
renderForm = () => /* @__PURE__ */ j(A, { children: /* @__PURE__ */ j(m, {
|
|
366
354
|
onChange: this.handleChange,
|
|
367
355
|
label: "Import excel",
|
|
368
356
|
name: "importfile",
|
|
369
357
|
ext: ".xlsx,.xls"
|
|
370
358
|
}) });
|
|
371
359
|
render() {
|
|
372
|
-
let { isCre: e, isEdit:
|
|
373
|
-
return e === !1 &&
|
|
360
|
+
let { isCre: e, isEdit: t } = this.state;
|
|
361
|
+
return e === !1 && t === !1 ? /* @__PURE__ */ j(g, {
|
|
374
362
|
cUriTitle: this.title,
|
|
375
363
|
cUri: this.cUri,
|
|
376
364
|
title: this.title + " | Import",
|
|
377
365
|
fluid: this.fluid
|
|
378
|
-
}) : /* @__PURE__ */ A
|
|
366
|
+
}) : /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(F, { children: /* @__PURE__ */ M("title", { children: [
|
|
379
367
|
this.title,
|
|
380
368
|
" | ",
|
|
381
369
|
"Import"
|
|
382
|
-
] }) }), /* @__PURE__ */
|
|
370
|
+
] }) }), /* @__PURE__ */ j("div", {
|
|
383
371
|
className: `mb-3 ${this.fluid ? "container-fluid" : "container"}`,
|
|
384
|
-
children: /* @__PURE__ */
|
|
372
|
+
children: /* @__PURE__ */ M(N, {
|
|
385
373
|
id: "itemImport",
|
|
386
374
|
className: "position-relative",
|
|
387
375
|
action: this.importUrl,
|
|
@@ -390,71 +378,71 @@ var L = class extends E.Component {
|
|
|
390
378
|
"data-toggle": "validator",
|
|
391
379
|
role: "form",
|
|
392
380
|
onSubmit: this.handleSubmit,
|
|
393
|
-
children: [/* @__PURE__ */
|
|
381
|
+
children: [/* @__PURE__ */ M("div", {
|
|
394
382
|
className: "navbar navbar-main navbar-expand-lg px-0 shadow-none border-radius-xl py-3",
|
|
395
|
-
children: [/* @__PURE__ */
|
|
383
|
+
children: [/* @__PURE__ */ j("nav", {
|
|
396
384
|
"aria-label": "breadcrumb",
|
|
397
|
-
children: /* @__PURE__ */
|
|
385
|
+
children: /* @__PURE__ */ M("ol", {
|
|
398
386
|
className: "breadcrumb bg-transparent m-0 p-0",
|
|
399
387
|
children: [
|
|
400
|
-
/* @__PURE__ */
|
|
388
|
+
/* @__PURE__ */ j("li", {
|
|
401
389
|
className: "breadcrumb-item",
|
|
402
|
-
children: /* @__PURE__ */
|
|
390
|
+
children: /* @__PURE__ */ j(P, {
|
|
403
391
|
className: "text-white",
|
|
404
392
|
to: this.ADMIN_URI || "/",
|
|
405
|
-
children: /* @__PURE__ */
|
|
393
|
+
children: /* @__PURE__ */ j("i", { className: "fal fa-home" })
|
|
406
394
|
})
|
|
407
395
|
}),
|
|
408
|
-
/* @__PURE__ */
|
|
396
|
+
/* @__PURE__ */ j("li", {
|
|
409
397
|
className: "breadcrumb-item",
|
|
410
|
-
children: /* @__PURE__ */
|
|
398
|
+
children: /* @__PURE__ */ j(P, {
|
|
411
399
|
className: "text-white",
|
|
412
400
|
to: this.cUri,
|
|
413
401
|
children: this.title
|
|
414
402
|
})
|
|
415
403
|
}),
|
|
416
|
-
/* @__PURE__ */
|
|
404
|
+
/* @__PURE__ */ j("li", {
|
|
417
405
|
className: "breadcrumb-item text-white active",
|
|
418
406
|
"aria-current": "page",
|
|
419
407
|
children: "Import"
|
|
420
408
|
})
|
|
421
409
|
]
|
|
422
410
|
})
|
|
423
|
-
}), /* @__PURE__ */
|
|
411
|
+
}), /* @__PURE__ */ M("div", {
|
|
424
412
|
className: "ms-auto",
|
|
425
|
-
children: [/* @__PURE__ */
|
|
413
|
+
children: [/* @__PURE__ */ j(P, {
|
|
426
414
|
target: "_blank",
|
|
427
415
|
to: this.API_URL + "/importfile/" + this.importFile,
|
|
428
416
|
className: "btn btn-sm btn-icon btn-info me-2",
|
|
429
417
|
title: "Tải xuống biểu mẫu",
|
|
430
|
-
children: /* @__PURE__ */
|
|
418
|
+
children: /* @__PURE__ */ j("i", {
|
|
431
419
|
className: "material-icons text-white position-relative text-lg",
|
|
432
420
|
children: "file_download"
|
|
433
421
|
})
|
|
434
|
-
}), /* @__PURE__ */
|
|
422
|
+
}), /* @__PURE__ */ j(P, {
|
|
435
423
|
to: this.cUri,
|
|
436
424
|
className: "btn btn-sm btn-icon btn-secondary",
|
|
437
425
|
title: "Trở lại",
|
|
438
|
-
children: /* @__PURE__ */
|
|
426
|
+
children: /* @__PURE__ */ j("i", {
|
|
439
427
|
className: "material-icons text-white position-relative text-lg",
|
|
440
428
|
children: "reply"
|
|
441
429
|
})
|
|
442
430
|
})]
|
|
443
431
|
})]
|
|
444
|
-
}), /* @__PURE__ */
|
|
432
|
+
}), /* @__PURE__ */ j("div", {
|
|
445
433
|
className: "card",
|
|
446
|
-
children: /* @__PURE__ */
|
|
434
|
+
children: /* @__PURE__ */ j("div", {
|
|
447
435
|
className: "card-body pb-0",
|
|
448
|
-
children: /* @__PURE__ */
|
|
436
|
+
children: /* @__PURE__ */ j("div", {
|
|
449
437
|
className: "row justify-content-center",
|
|
450
|
-
children: /* @__PURE__ */
|
|
438
|
+
children: /* @__PURE__ */ M("div", {
|
|
451
439
|
className: "col-md-8 pt-5 pb-4",
|
|
452
440
|
children: [
|
|
453
|
-
/* @__PURE__ */
|
|
441
|
+
/* @__PURE__ */ j("div", { dangerouslySetInnerHTML: { __html: l(this.state.error) } }),
|
|
454
442
|
this.renderForm(),
|
|
455
|
-
/* @__PURE__ */
|
|
443
|
+
/* @__PURE__ */ j("div", {
|
|
456
444
|
className: "w-100 d-flex",
|
|
457
|
-
children: /* @__PURE__ */
|
|
445
|
+
children: /* @__PURE__ */ j("button", {
|
|
458
446
|
title: "Import",
|
|
459
447
|
type: "submit",
|
|
460
448
|
className: "btn btn-success mb-4 mx-auto",
|
|
@@ -469,7 +457,7 @@ var L = class extends E.Component {
|
|
|
469
457
|
})
|
|
470
458
|
})] });
|
|
471
459
|
}
|
|
472
|
-
},
|
|
460
|
+
}, B = class extends O.Component {
|
|
473
461
|
effectRan = !1;
|
|
474
462
|
fluid = !1;
|
|
475
463
|
module = "admins";
|
|
@@ -536,14 +524,14 @@ var L = class extends E.Component {
|
|
|
536
524
|
handleChange = async (e) => {
|
|
537
525
|
try {
|
|
538
526
|
e.preventDefault();
|
|
539
|
-
let { name: t } = e.target,
|
|
527
|
+
let { name: t } = e.target, n = await b(e, this.state.data.filter || {});
|
|
540
528
|
if (t === "pageLen") {
|
|
541
|
-
await this.setFilter(
|
|
542
|
-
let e =
|
|
529
|
+
await this.setFilter(n);
|
|
530
|
+
let e = n ? r(n) : "";
|
|
543
531
|
this.props.navigate(`${this.cUri}?${e}`, { replace: !0 }), await this.fetchData();
|
|
544
532
|
} else this.setState((e) => ({ data: {
|
|
545
533
|
...e.data,
|
|
546
|
-
filter:
|
|
534
|
+
filter: n
|
|
547
535
|
} }));
|
|
548
536
|
} catch (e) {
|
|
549
537
|
console.log(e);
|
|
@@ -552,7 +540,7 @@ var L = class extends E.Component {
|
|
|
552
540
|
handleSearchForm = async (e) => {
|
|
553
541
|
try {
|
|
554
542
|
e.preventDefault();
|
|
555
|
-
let t = await
|
|
543
|
+
let t = await _(this.state.data.filter || {}, this.cUri, this.props.navigate);
|
|
556
544
|
await this.setFilter(t), await this.fetchData();
|
|
557
545
|
} catch (e) {
|
|
558
546
|
console.log(e);
|
|
@@ -561,52 +549,52 @@ var L = class extends E.Component {
|
|
|
561
549
|
handleClickPage = async (e) => {
|
|
562
550
|
try {
|
|
563
551
|
e.preventDefault();
|
|
564
|
-
let t = await
|
|
552
|
+
let t = await w(e, this.state.data.filter || {}, this.cUri, this.props.navigate);
|
|
565
553
|
await this.setFilter(t), await this.fetchData();
|
|
566
554
|
} catch (e) {
|
|
567
|
-
c(e
|
|
555
|
+
c(s(e));
|
|
568
556
|
}
|
|
569
557
|
};
|
|
570
558
|
handleDeleteOne = async (e) => {
|
|
571
|
-
|
|
559
|
+
i().then(async () => {
|
|
572
560
|
try {
|
|
573
|
-
await
|
|
561
|
+
await o(`${this.deleteUrl}/${e}`, {}, "DELETE"), n("Xoá thành công!", "top-end", !0), await this.fetchData();
|
|
574
562
|
} catch (e) {
|
|
575
|
-
c(e
|
|
563
|
+
c(s(e));
|
|
576
564
|
}
|
|
577
565
|
});
|
|
578
566
|
};
|
|
579
567
|
handleDelete = async () => {
|
|
580
|
-
this.state.selectedIds.length ?
|
|
568
|
+
this.state.selectedIds.length ? i().then(async () => {
|
|
581
569
|
try {
|
|
582
|
-
await
|
|
570
|
+
await o(this.deleteUrl, { selected: this.state.selectedIds }, "POST"), n("Xoá thành công!", "top-end", !0), await this.fetchData();
|
|
583
571
|
} catch (e) {
|
|
584
|
-
c(e
|
|
572
|
+
c(s(e));
|
|
585
573
|
}
|
|
586
574
|
}) : c("Vui lòng chọn thông tin");
|
|
587
575
|
};
|
|
588
576
|
handleCopy = async () => {
|
|
589
|
-
this.state.selectedIds.length ?
|
|
577
|
+
this.state.selectedIds.length ? i().then(async () => {
|
|
590
578
|
try {
|
|
591
|
-
await
|
|
579
|
+
await o(this.copyUrl, { selected: this.state.selectedIds }, "POST"), n("Sao chép thành công!", "top-end", !0), await this.fetchData();
|
|
592
580
|
} catch (e) {
|
|
593
|
-
c(e
|
|
581
|
+
c(s(e));
|
|
594
582
|
}
|
|
595
583
|
}) : c("Vui lòng chọn thông tin");
|
|
596
584
|
};
|
|
597
585
|
handleExport = async () => {
|
|
598
586
|
try {
|
|
599
|
-
let { data: e } = this.state, t =
|
|
587
|
+
let { data: e } = this.state, t = r(e.filter || {});
|
|
600
588
|
this.exportUrl && (window.location.href = this.exportUrl + `?${t}`);
|
|
601
589
|
} catch (e) {
|
|
602
|
-
c(e
|
|
590
|
+
c(s(e));
|
|
603
591
|
}
|
|
604
592
|
};
|
|
605
593
|
handleSelectOne = (e, t) => {
|
|
606
|
-
this.setState((n) => ({ selectedIds: t ? [.../* @__PURE__ */ new Set([...n.selectedIds, e])] : n.selectedIds.filter((t) => t !== e) }));
|
|
594
|
+
this.setState((n) => ({ selectedIds: t ? [.../* @__PURE__ */ new Set([...Array.isArray(n.selectedIds) ? n.selectedIds : [], e])] : (n.selectedIds ?? []).filter((t) => t !== e) }));
|
|
607
595
|
};
|
|
608
596
|
handleSelectAll = (e, t = []) => {
|
|
609
|
-
this.setState({ selectedIds: e ? this.state.data
|
|
597
|
+
this.setState({ selectedIds: e ? (this.state.data?.items ?? []).map((e) => e.id).filter((e) => typeof e == "number").filter((e) => !t.includes(e)) : [] });
|
|
610
598
|
};
|
|
611
599
|
setFilter(e) {
|
|
612
600
|
return new Promise((t) => {
|
|
@@ -618,7 +606,7 @@ var L = class extends E.Component {
|
|
|
618
606
|
}
|
|
619
607
|
fetchData = async () => {
|
|
620
608
|
try {
|
|
621
|
-
let e = await
|
|
609
|
+
let e = await S(this.state.data.filter || {}, this.getDataUrl);
|
|
622
610
|
if (!e || !("items" in e)) return;
|
|
623
611
|
this.setState({
|
|
624
612
|
data: {
|
|
@@ -628,7 +616,7 @@ var L = class extends E.Component {
|
|
|
628
616
|
selectedIds: []
|
|
629
617
|
});
|
|
630
618
|
} catch (e) {
|
|
631
|
-
console.error(e
|
|
619
|
+
console.error(s(e));
|
|
632
620
|
}
|
|
633
621
|
};
|
|
634
622
|
syncGetField = async () => ({
|
|
@@ -637,12 +625,12 @@ var L = class extends E.Component {
|
|
|
637
625
|
});
|
|
638
626
|
syncPermissionsAndState = async () => {
|
|
639
627
|
let { menuData: e, user: t } = this.props, n = {
|
|
640
|
-
isCre: this.activeMethod.includes("cre") ?
|
|
641
|
-
isEdit: this.activeMethod.includes("edit") ?
|
|
642
|
-
isDel: this.activeMethod.includes("del") ?
|
|
643
|
-
isDelOne: this.activeMethod.includes("delone") ?
|
|
644
|
-
isIndex: this.activeMethod.includes("ind") ?
|
|
645
|
-
isDetail: this.activeMethod.includes("det") ?
|
|
628
|
+
isCre: this.activeMethod.includes("cre") ? I(e, this.module, this.controller, "update", 0, t.groupId) : !1,
|
|
629
|
+
isEdit: this.activeMethod.includes("edit") ? I(e, this.module, this.controller, "update", 1, t.groupId) : !1,
|
|
630
|
+
isDel: this.activeMethod.includes("del") ? I(e, this.module, this.controller, "delete", 0, t.groupId) : !1,
|
|
631
|
+
isDelOne: this.activeMethod.includes("delone") ? I(e, this.module, this.controller, "delete", 1, t.groupId) : !1,
|
|
632
|
+
isIndex: this.activeMethod.includes("ind") ? I(e, this.module, this.controller, "index", 0, t.groupId) : !1,
|
|
633
|
+
isDetail: this.activeMethod.includes("det") ? I(e, this.module, this.controller, "detail", 0, t.groupId) : !1,
|
|
646
634
|
isImport: !!this.activeMethod.includes("imp"),
|
|
647
635
|
isExport: !!this.activeMethod.includes("exp"),
|
|
648
636
|
isCopy: !!this.activeMethod.includes("cpy")
|
|
@@ -672,7 +660,7 @@ var L = class extends E.Component {
|
|
|
672
660
|
};
|
|
673
661
|
await this.setFilter(n), this.props.user?.groupId && await this.syncPermissionsAndState();
|
|
674
662
|
} catch (e) {
|
|
675
|
-
c(e
|
|
663
|
+
c(s(e));
|
|
676
664
|
}
|
|
677
665
|
}
|
|
678
666
|
componentDidMount() {
|
|
@@ -680,7 +668,7 @@ var L = class extends E.Component {
|
|
|
680
668
|
}
|
|
681
669
|
componentDidMountAfter = async () => {};
|
|
682
670
|
renderHeaderIndex() {
|
|
683
|
-
return /* @__PURE__ */
|
|
671
|
+
return /* @__PURE__ */ j(x, {
|
|
684
672
|
adminUri: this.ADMIN_URI,
|
|
685
673
|
title: this.title,
|
|
686
674
|
cUri: this.cUri,
|
|
@@ -695,41 +683,41 @@ var L = class extends E.Component {
|
|
|
695
683
|
onDelete: this.handleDelete
|
|
696
684
|
});
|
|
697
685
|
}
|
|
698
|
-
renderTable = () => /* @__PURE__ */
|
|
699
|
-
renderSearch = () => /* @__PURE__ */
|
|
686
|
+
renderTable = () => /* @__PURE__ */ j(A, {});
|
|
687
|
+
renderSearch = () => /* @__PURE__ */ j(A, {});
|
|
700
688
|
render() {
|
|
701
689
|
let { isIndex: e, data: t, loading: n } = this.state;
|
|
702
|
-
return e === !1 ? /* @__PURE__ */
|
|
690
|
+
return e === !1 ? /* @__PURE__ */ j(g, {
|
|
703
691
|
cUriTitle: this.title,
|
|
704
692
|
cUri: this.cUri,
|
|
705
693
|
title: this.title,
|
|
706
694
|
fluid: this.fluid
|
|
707
|
-
}) : /* @__PURE__ */ A
|
|
695
|
+
}) : /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(F, { children: /* @__PURE__ */ j("title", { children: this.title }) }), /* @__PURE__ */ j(h, {
|
|
708
696
|
loading: n,
|
|
709
|
-
children: e && /* @__PURE__ */
|
|
697
|
+
children: e && /* @__PURE__ */ M("div", {
|
|
710
698
|
className: `mb-3 ${this.fluid ? "container-fluid" : "container"}`,
|
|
711
|
-
children: [this.renderHeaderIndex(), /* @__PURE__ */
|
|
699
|
+
children: [this.renderHeaderIndex(), /* @__PURE__ */ j("div", {
|
|
712
700
|
className: "card position-relative",
|
|
713
|
-
children: /* @__PURE__ */
|
|
701
|
+
children: /* @__PURE__ */ j("div", {
|
|
714
702
|
className: "card-body",
|
|
715
703
|
style: { minHeight: "200px" },
|
|
716
|
-
children: /* @__PURE__ */
|
|
704
|
+
children: /* @__PURE__ */ M("div", {
|
|
717
705
|
className: "searchForm",
|
|
718
706
|
children: [
|
|
719
|
-
/* @__PURE__ */
|
|
707
|
+
/* @__PURE__ */ j("form", {
|
|
720
708
|
onSubmit: this.handleSearchForm,
|
|
721
709
|
children: this.renderSearch()
|
|
722
710
|
}),
|
|
723
|
-
t
|
|
711
|
+
t?.items?.length ? /* @__PURE__ */ j(E, {
|
|
724
712
|
data: t,
|
|
725
713
|
onChange: this.handleChange,
|
|
726
714
|
onClickPage: this.handleClickPage
|
|
727
715
|
}) : "",
|
|
728
|
-
/* @__PURE__ */
|
|
716
|
+
/* @__PURE__ */ j("div", {
|
|
729
717
|
className: "table-responsive mt-2",
|
|
730
718
|
children: this.renderTable()
|
|
731
719
|
}),
|
|
732
|
-
t
|
|
720
|
+
t?.items?.length ? /* @__PURE__ */ j(E, {
|
|
733
721
|
data: t,
|
|
734
722
|
onChange: this.handleChange,
|
|
735
723
|
onClickPage: this.handleClickPage
|
|
@@ -741,78 +729,78 @@ var L = class extends E.Component {
|
|
|
741
729
|
})
|
|
742
730
|
})] });
|
|
743
731
|
}
|
|
744
|
-
},
|
|
732
|
+
}, V = ({ adminUri: e, cUri: t, title: n, itemId: r, isSave: i = !0, titleAction: a }) => /* @__PURE__ */ M("div", {
|
|
745
733
|
className: "navbar navbar-main navbar-expand-lg px-0 shadow-none border-radius-xl py-3",
|
|
746
|
-
children: [/* @__PURE__ */
|
|
734
|
+
children: [/* @__PURE__ */ j("nav", {
|
|
747
735
|
"aria-label": "breadcrumb",
|
|
748
|
-
children: /* @__PURE__ */
|
|
736
|
+
children: /* @__PURE__ */ M("ol", {
|
|
749
737
|
className: "breadcrumb bg-transparent m-0 p-0",
|
|
750
738
|
children: [
|
|
751
|
-
/* @__PURE__ */
|
|
739
|
+
/* @__PURE__ */ j("li", {
|
|
752
740
|
className: "breadcrumb-item",
|
|
753
|
-
children: /* @__PURE__ */
|
|
741
|
+
children: /* @__PURE__ */ j(P, {
|
|
754
742
|
className: "text-white",
|
|
755
743
|
to: e || "/",
|
|
756
|
-
children: /* @__PURE__ */
|
|
744
|
+
children: /* @__PURE__ */ j("i", { className: "fal fa-home" })
|
|
757
745
|
})
|
|
758
746
|
}),
|
|
759
|
-
/* @__PURE__ */
|
|
747
|
+
/* @__PURE__ */ j("li", {
|
|
760
748
|
className: "breadcrumb-item",
|
|
761
|
-
children: /* @__PURE__ */
|
|
749
|
+
children: /* @__PURE__ */ j(P, {
|
|
762
750
|
className: "text-white",
|
|
763
751
|
to: t,
|
|
764
752
|
children: n
|
|
765
753
|
})
|
|
766
754
|
}),
|
|
767
|
-
/* @__PURE__ */
|
|
755
|
+
/* @__PURE__ */ j("li", {
|
|
768
756
|
className: "breadcrumb-item text-white active",
|
|
769
757
|
"aria-current": "page",
|
|
770
758
|
children: a ?? (r ? "Chỉnh sửa" : "Thêm mới")
|
|
771
759
|
})
|
|
772
760
|
]
|
|
773
761
|
})
|
|
774
|
-
}), /* @__PURE__ */
|
|
762
|
+
}), /* @__PURE__ */ M("div", {
|
|
775
763
|
className: "ms-auto",
|
|
776
|
-
children: [i && /* @__PURE__ */
|
|
764
|
+
children: [i && /* @__PURE__ */ j(v, {
|
|
777
765
|
title: "Lưu lại",
|
|
778
|
-
children: /* @__PURE__ */
|
|
766
|
+
children: /* @__PURE__ */ j("button", {
|
|
779
767
|
type: "submit",
|
|
780
768
|
className: "btn btn-sm btn-icon btn-success me-1",
|
|
781
|
-
children: /* @__PURE__ */
|
|
769
|
+
children: /* @__PURE__ */ j("i", {
|
|
782
770
|
className: "material-icons text-white position-relative text-lg",
|
|
783
771
|
children: "save"
|
|
784
772
|
})
|
|
785
773
|
})
|
|
786
|
-
}), /* @__PURE__ */
|
|
774
|
+
}), /* @__PURE__ */ j(v, {
|
|
787
775
|
title: "Trở lại",
|
|
788
|
-
children: /* @__PURE__ */
|
|
776
|
+
children: /* @__PURE__ */ j(P, {
|
|
789
777
|
to: t,
|
|
790
778
|
className: "btn btn-sm btn-icon btn-secondary",
|
|
791
|
-
children: /* @__PURE__ */
|
|
779
|
+
children: /* @__PURE__ */ j("i", {
|
|
792
780
|
className: "material-icons text-white position-relative text-lg",
|
|
793
781
|
children: "reply"
|
|
794
782
|
})
|
|
795
783
|
})
|
|
796
784
|
})]
|
|
797
785
|
})]
|
|
798
|
-
}),
|
|
786
|
+
}), H = ({ title: e = "", cUri: t = "", fluid: n = !1, cUriTitle: r = "" }) => /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(F, { children: /* @__PURE__ */ j("title", { children: e || "Truy cập không được phép" }) }), /* @__PURE__ */ M("div", {
|
|
799
787
|
className: `${n ? "container-fluid" : "container"}`,
|
|
800
|
-
children: [/* @__PURE__ */
|
|
788
|
+
children: [/* @__PURE__ */ j("div", {
|
|
801
789
|
className: "navbar navbar-main navbar-expand-lg px-0 shadow-none border-radius-xl py-3",
|
|
802
|
-
children: /* @__PURE__ */
|
|
790
|
+
children: /* @__PURE__ */ j("nav", {
|
|
803
791
|
"aria-label": "breadcrumb",
|
|
804
|
-
children: /* @__PURE__ */
|
|
792
|
+
children: /* @__PURE__ */ M("ol", {
|
|
805
793
|
className: "breadcrumb bg-transparent m-0 p-0",
|
|
806
|
-
children: [/* @__PURE__ */
|
|
794
|
+
children: [/* @__PURE__ */ j("li", {
|
|
807
795
|
className: "breadcrumb-item",
|
|
808
|
-
children: /* @__PURE__ */
|
|
796
|
+
children: /* @__PURE__ */ j(P, {
|
|
809
797
|
className: "text-white",
|
|
810
798
|
to: "/",
|
|
811
|
-
children: /* @__PURE__ */
|
|
799
|
+
children: /* @__PURE__ */ j("i", { className: "fal fa-home" })
|
|
812
800
|
})
|
|
813
|
-
}), /* @__PURE__ */
|
|
801
|
+
}), /* @__PURE__ */ j("li", {
|
|
814
802
|
className: "breadcrumb-item",
|
|
815
|
-
children: /* @__PURE__ */
|
|
803
|
+
children: /* @__PURE__ */ j(P, {
|
|
816
804
|
className: "text-white",
|
|
817
805
|
to: t,
|
|
818
806
|
children: r
|
|
@@ -820,25 +808,25 @@ var L = class extends E.Component {
|
|
|
820
808
|
})]
|
|
821
809
|
})
|
|
822
810
|
})
|
|
823
|
-
}), /* @__PURE__ */
|
|
811
|
+
}), /* @__PURE__ */ j("div", {
|
|
824
812
|
style: { minHeight: "50vh" },
|
|
825
813
|
className: "d-flex align-items-center",
|
|
826
|
-
children: /* @__PURE__ */
|
|
814
|
+
children: /* @__PURE__ */ M("div", {
|
|
827
815
|
className: "m-auto text-center",
|
|
828
816
|
children: [
|
|
829
|
-
/* @__PURE__ */
|
|
817
|
+
/* @__PURE__ */ j("h1", {
|
|
830
818
|
className: "display-1 text-bolder text-white",
|
|
831
819
|
children: "403"
|
|
832
820
|
}),
|
|
833
|
-
/* @__PURE__ */
|
|
821
|
+
/* @__PURE__ */ j("h2", {
|
|
834
822
|
className: "text-white",
|
|
835
823
|
children: "Truy cập không được phép"
|
|
836
824
|
}),
|
|
837
|
-
/* @__PURE__ */
|
|
825
|
+
/* @__PURE__ */ j("p", {
|
|
838
826
|
className: "lead text-white",
|
|
839
827
|
children: "Xin lỗi, bạn không có quyền truy cập vào trang này."
|
|
840
828
|
}),
|
|
841
|
-
/* @__PURE__ */
|
|
829
|
+
/* @__PURE__ */ j(P, {
|
|
842
830
|
to: "/",
|
|
843
831
|
className: "btn btn-outline-white mt-4",
|
|
844
832
|
children: "trang chủ"
|
|
@@ -846,24 +834,24 @@ var L = class extends E.Component {
|
|
|
846
834
|
]
|
|
847
835
|
})
|
|
848
836
|
})]
|
|
849
|
-
})] }),
|
|
837
|
+
})] }), U = ({ title: e = "", cUri: t = "", fluid: n = !1, cUriTitle: r = "" }) => /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(F, { children: /* @__PURE__ */ j("title", { children: e || "Không tìm thấy dữ liệu" }) }), /* @__PURE__ */ M("div", {
|
|
850
838
|
className: `${n ? "container-fluid" : "container"}`,
|
|
851
|
-
children: [/* @__PURE__ */
|
|
839
|
+
children: [/* @__PURE__ */ j("div", {
|
|
852
840
|
className: "navbar navbar-main navbar-expand-lg px-0 shadow-none border-radius-xl py-3",
|
|
853
|
-
children: /* @__PURE__ */
|
|
841
|
+
children: /* @__PURE__ */ j("nav", {
|
|
854
842
|
"aria-label": "breadcrumb",
|
|
855
|
-
children: /* @__PURE__ */
|
|
843
|
+
children: /* @__PURE__ */ M("ol", {
|
|
856
844
|
className: "breadcrumb bg-transparent m-0 p-0",
|
|
857
|
-
children: [/* @__PURE__ */
|
|
845
|
+
children: [/* @__PURE__ */ j("li", {
|
|
858
846
|
className: "breadcrumb-item",
|
|
859
|
-
children: /* @__PURE__ */
|
|
847
|
+
children: /* @__PURE__ */ j(P, {
|
|
860
848
|
className: "text-white",
|
|
861
849
|
to: "/",
|
|
862
|
-
children: /* @__PURE__ */
|
|
850
|
+
children: /* @__PURE__ */ j("i", { className: "fal fa-home" })
|
|
863
851
|
})
|
|
864
|
-
}), /* @__PURE__ */
|
|
852
|
+
}), /* @__PURE__ */ j("li", {
|
|
865
853
|
className: "breadcrumb-item",
|
|
866
|
-
children: /* @__PURE__ */
|
|
854
|
+
children: /* @__PURE__ */ j(P, {
|
|
867
855
|
className: "text-white",
|
|
868
856
|
to: t,
|
|
869
857
|
children: r
|
|
@@ -871,25 +859,25 @@ var L = class extends E.Component {
|
|
|
871
859
|
})]
|
|
872
860
|
})
|
|
873
861
|
})
|
|
874
|
-
}), /* @__PURE__ */
|
|
862
|
+
}), /* @__PURE__ */ j("div", {
|
|
875
863
|
style: { minHeight: "50vh" },
|
|
876
864
|
className: "d-flex align-items-center",
|
|
877
|
-
children: /* @__PURE__ */
|
|
865
|
+
children: /* @__PURE__ */ M("div", {
|
|
878
866
|
className: "m-auto text-center",
|
|
879
867
|
children: [
|
|
880
|
-
/* @__PURE__ */
|
|
868
|
+
/* @__PURE__ */ j("h1", {
|
|
881
869
|
className: "display-1 text-bolder text-white",
|
|
882
870
|
children: "404"
|
|
883
871
|
}),
|
|
884
|
-
/* @__PURE__ */
|
|
872
|
+
/* @__PURE__ */ j("h2", {
|
|
885
873
|
className: "text-white",
|
|
886
874
|
children: "Không tìm thấy dữ liệu"
|
|
887
875
|
}),
|
|
888
|
-
/* @__PURE__ */
|
|
876
|
+
/* @__PURE__ */ j("p", {
|
|
889
877
|
className: "lead text-white",
|
|
890
878
|
children: "Xin lỗi, dữ liệu của bạn không được tìm thấy"
|
|
891
879
|
}),
|
|
892
|
-
/* @__PURE__ */
|
|
880
|
+
/* @__PURE__ */ j(P, {
|
|
893
881
|
to: "/",
|
|
894
882
|
className: "btn btn-outline-white mt-4",
|
|
895
883
|
children: "trang chủ"
|
|
@@ -897,7 +885,7 @@ var L = class extends E.Component {
|
|
|
897
885
|
]
|
|
898
886
|
})
|
|
899
887
|
})]
|
|
900
|
-
})] }),
|
|
888
|
+
})] }), W = class extends O.Component {
|
|
901
889
|
effectRan = !1;
|
|
902
890
|
module = "admins";
|
|
903
891
|
controller = "";
|
|
@@ -941,34 +929,34 @@ var L = class extends E.Component {
|
|
|
941
929
|
isBackUri = !0;
|
|
942
930
|
debug = !1;
|
|
943
931
|
constructor(e) {
|
|
944
|
-
super(e), this.formRef =
|
|
932
|
+
super(e), this.formRef = O.createRef();
|
|
945
933
|
}
|
|
946
|
-
renderForm = () => /* @__PURE__ */
|
|
947
|
-
renderAfterForm = () => /* @__PURE__ */
|
|
934
|
+
renderForm = () => /* @__PURE__ */ j(A, {});
|
|
935
|
+
renderAfterForm = () => /* @__PURE__ */ j(A, {});
|
|
948
936
|
handleChange = (e) => {
|
|
949
937
|
e.preventDefault();
|
|
950
|
-
let t =
|
|
951
|
-
this.setState((e) => ({ formValue:
|
|
938
|
+
let t = f(e);
|
|
939
|
+
this.setState((e) => ({ formValue: u(e.formValue, t) }));
|
|
952
940
|
};
|
|
953
941
|
syncPermissionsAndState = async () => {
|
|
954
942
|
let { menuData: e, user: t } = this.props, n = {
|
|
955
|
-
isCre:
|
|
956
|
-
isEdit:
|
|
957
|
-
isDetail:
|
|
943
|
+
isCre: I(e, this.module, this.controller, "update", 0, t.groupId),
|
|
944
|
+
isEdit: I(e, this.module, this.controller, "update", 1, t.groupId),
|
|
945
|
+
isDetail: I(e, this.module, this.controller, "detail", 0, t.groupId)
|
|
958
946
|
};
|
|
959
947
|
this.setState(n, async () => {
|
|
960
|
-
let e =
|
|
948
|
+
let e = a();
|
|
961
949
|
if (e && n.isEdit) {
|
|
962
|
-
let t = await
|
|
950
|
+
let t = await o(this.getDataUrl + "/" + e, {}, "GET", "application/json", !1), n = t ? t.data : void 0;
|
|
963
951
|
this.setState({
|
|
964
952
|
item: n || !1,
|
|
965
953
|
formValue: n ? JSON.parse(JSON.stringify(n)) : {}
|
|
966
954
|
}, async () => {
|
|
967
|
-
this.setState({ loading: !1 }), await this.componentDidMountAfter(), this.formRef.current && new
|
|
955
|
+
this.setState({ loading: !1 }), await this.componentDidMountAfter(), this.formRef.current && new p(this.formRef.current).run();
|
|
968
956
|
});
|
|
969
957
|
} else {
|
|
970
958
|
if (this.setState({ loading: !1 }), await this.componentDidMountAfter(), !this.formRef.current) return;
|
|
971
|
-
new
|
|
959
|
+
new p(this.formRef.current).run();
|
|
972
960
|
}
|
|
973
961
|
});
|
|
974
962
|
};
|
|
@@ -977,7 +965,7 @@ var L = class extends E.Component {
|
|
|
977
965
|
if (this.effectRan) return;
|
|
978
966
|
this.effectRan = !0, this.props.user?.groupId && await this.syncPermissionsAndState();
|
|
979
967
|
} catch (e) {
|
|
980
|
-
e
|
|
968
|
+
s(e) === "invalid_404" && this.props.navigate(this.cUri), c(s(e));
|
|
981
969
|
}
|
|
982
970
|
}
|
|
983
971
|
componentDidMount = () => {
|
|
@@ -989,12 +977,12 @@ var L = class extends E.Component {
|
|
|
989
977
|
});
|
|
990
978
|
handleSubmit = async (e) => {
|
|
991
979
|
e.preventDefault();
|
|
992
|
-
let { item: t, formValue:
|
|
993
|
-
!
|
|
980
|
+
let { item: t, formValue: r } = this.state, i = d(t), a = new p(this.formRef.current);
|
|
981
|
+
!a.hasErrors() && !a.isIncomplete() && this.formRef.current && this.beforeSubmit().then(async () => {
|
|
994
982
|
this.setState({ loading: !0 });
|
|
995
983
|
try {
|
|
996
|
-
let e = i ? this.editUrl + "/" + i : this.createUrl, t = await
|
|
997
|
-
if (
|
|
984
|
+
let e = i ? this.editUrl + "/" + i : this.createUrl, t = await o(e, r, "POST", this.ctype);
|
|
985
|
+
if (n(i ? "Cập nhật thành công" : "Thêm mới thành công", "top-end", !0), t?.data?.id) {
|
|
998
986
|
if (this.isBackUri) return this.props.navigate(this.cUri);
|
|
999
987
|
this.props.navigate(this.cUri + "/edit/" + Number(t.data.id)), this.setState({
|
|
1000
988
|
item: { ...t.data },
|
|
@@ -1004,7 +992,7 @@ var L = class extends E.Component {
|
|
|
1004
992
|
});
|
|
1005
993
|
}
|
|
1006
994
|
} catch (e) {
|
|
1007
|
-
c(e
|
|
995
|
+
c(s(e));
|
|
1008
996
|
} finally {
|
|
1009
997
|
this.setState({ loading: !1 });
|
|
1010
998
|
}
|
|
@@ -1012,33 +1000,33 @@ var L = class extends E.Component {
|
|
|
1012
1000
|
};
|
|
1013
1001
|
afterSubmit = async (e) => {};
|
|
1014
1002
|
renderHeaderUpdate() {
|
|
1015
|
-
return /* @__PURE__ */
|
|
1003
|
+
return /* @__PURE__ */ j(V, {
|
|
1016
1004
|
adminUri: this.ADMIN_URI,
|
|
1017
1005
|
title: this.title,
|
|
1018
1006
|
cUri: this.cUri,
|
|
1019
|
-
itemId:
|
|
1007
|
+
itemId: d(this.state.item)
|
|
1020
1008
|
});
|
|
1021
1009
|
}
|
|
1022
1010
|
render() {
|
|
1023
|
-
let e =
|
|
1024
|
-
return
|
|
1011
|
+
let e = a(), { isCre: t, isEdit: n, isDetail: r, item: i } = this.state;
|
|
1012
|
+
return t === !1 && n === !1 && r === !1 || t === !1 && e == null || (n === !1 || r === !1) && e ? /* @__PURE__ */ j(H, {
|
|
1025
1013
|
cUriTitle: this.title,
|
|
1026
1014
|
cUri: this.cUri,
|
|
1027
1015
|
title: this.title + " | " + (e ? "Chỉnh sửa" : "Thêm mới"),
|
|
1028
1016
|
fluid: this.fluid
|
|
1029
|
-
}) : e &&
|
|
1017
|
+
}) : e && i === !1 ? /* @__PURE__ */ j(U, {
|
|
1030
1018
|
cUriTitle: this.title,
|
|
1031
1019
|
cUri: this.cUri,
|
|
1032
1020
|
title: this.title + " | " + (e ? "Chỉnh sửa" : "Thêm mới")
|
|
1033
|
-
}) : /* @__PURE__ */ A
|
|
1021
|
+
}) : /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(F, { children: /* @__PURE__ */ M("title", { children: [
|
|
1034
1022
|
this.title,
|
|
1035
1023
|
" | ",
|
|
1036
|
-
|
|
1037
|
-
] }) }), /* @__PURE__ */
|
|
1024
|
+
d(i) ? "Chỉnh sửa" : "Thêm mới"
|
|
1025
|
+
] }) }), /* @__PURE__ */ M("div", {
|
|
1038
1026
|
className: `mb-3 ${this.fluid ? "container-fluid" : "container"}`,
|
|
1039
1027
|
children: [
|
|
1040
|
-
/* @__PURE__ */
|
|
1041
|
-
/* @__PURE__ */
|
|
1028
|
+
/* @__PURE__ */ j("div", { dangerouslySetInnerHTML: { __html: l(this.state.error) } }),
|
|
1029
|
+
/* @__PURE__ */ j(N, {
|
|
1042
1030
|
ref: this.formRef,
|
|
1043
1031
|
className: "position-relative",
|
|
1044
1032
|
method: "post",
|
|
@@ -1046,7 +1034,7 @@ var L = class extends E.Component {
|
|
|
1046
1034
|
"data-toggle": "validator",
|
|
1047
1035
|
role: "form",
|
|
1048
1036
|
onSubmit: this.handleSubmit,
|
|
1049
|
-
children: /* @__PURE__ */
|
|
1037
|
+
children: /* @__PURE__ */ M(h, {
|
|
1050
1038
|
loading: !!this.state.loading,
|
|
1051
1039
|
style: {
|
|
1052
1040
|
minHeight: 200,
|
|
@@ -1059,40 +1047,40 @@ var L = class extends E.Component {
|
|
|
1059
1047
|
]
|
|
1060
1048
|
})] });
|
|
1061
1049
|
}
|
|
1062
|
-
},
|
|
1050
|
+
}, G = class extends W {
|
|
1063
1051
|
urlUpdateDetail = "";
|
|
1064
1052
|
render() {
|
|
1065
|
-
let e =
|
|
1066
|
-
if (
|
|
1053
|
+
let e = a(), { isCre: t, isEdit: n, isDetail: r, item: i } = this.state;
|
|
1054
|
+
if (t === !1 && n === !1 && r === !1 || t === !1 && e == null || (n === !1 || r === !1) && e) return /* @__PURE__ */ j(H, {
|
|
1067
1055
|
cUriTitle: this.title,
|
|
1068
1056
|
cUri: this.cUri,
|
|
1069
1057
|
title: this.title + " | " + (e ? "Chỉnh sửa" : "Thêm mới"),
|
|
1070
1058
|
fluid: this.fluid
|
|
1071
1059
|
});
|
|
1072
|
-
if (e &&
|
|
1060
|
+
if (e && i === !1) return /* @__PURE__ */ j(U, {
|
|
1073
1061
|
cUriTitle: this.title,
|
|
1074
1062
|
cUri: this.cUri,
|
|
1075
1063
|
title: this.title + " | " + (e ? "Chỉnh sửa" : "Thêm mới")
|
|
1076
1064
|
});
|
|
1077
|
-
let
|
|
1078
|
-
return /* @__PURE__ */ A
|
|
1065
|
+
let o = d(i);
|
|
1066
|
+
return /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(F, { children: /* @__PURE__ */ M("title", { children: [
|
|
1079
1067
|
this.title,
|
|
1080
1068
|
" | ",
|
|
1081
|
-
|
|
1082
|
-
] }) }), /* @__PURE__ */
|
|
1069
|
+
o ? "Chỉnh sửa" : "Thêm mới"
|
|
1070
|
+
] }) }), /* @__PURE__ */ M("div", {
|
|
1083
1071
|
className: `mb-3 ${this.fluid ? "container-fluid" : "container"}`,
|
|
1084
1072
|
children: [
|
|
1085
|
-
/* @__PURE__ */
|
|
1073
|
+
/* @__PURE__ */ j(V, {
|
|
1086
1074
|
adminUri: this.ADMIN_URI,
|
|
1087
1075
|
title: this.title,
|
|
1088
1076
|
cUri: this.cUri,
|
|
1089
1077
|
isSave: !1,
|
|
1090
|
-
itemId:
|
|
1078
|
+
itemId: o
|
|
1091
1079
|
}),
|
|
1092
|
-
/* @__PURE__ */
|
|
1093
|
-
/* @__PURE__ */
|
|
1080
|
+
/* @__PURE__ */ j("div", { dangerouslySetInnerHTML: { __html: l(this.state.error) } }),
|
|
1081
|
+
/* @__PURE__ */ j("div", {
|
|
1094
1082
|
className: "position-relative",
|
|
1095
|
-
children: /* @__PURE__ */
|
|
1083
|
+
children: /* @__PURE__ */ j(h, {
|
|
1096
1084
|
loading: !!this.state.loading,
|
|
1097
1085
|
style: {
|
|
1098
1086
|
minHeight: 200,
|
|
@@ -1104,19 +1092,19 @@ var L = class extends E.Component {
|
|
|
1104
1092
|
]
|
|
1105
1093
|
})] });
|
|
1106
1094
|
}
|
|
1107
|
-
handleDetailSubmit = async (e,
|
|
1095
|
+
handleDetailSubmit = async (e, r) => {
|
|
1108
1096
|
try {
|
|
1109
|
-
let
|
|
1110
|
-
|
|
1111
|
-
itemid:
|
|
1097
|
+
let i = d(this.state.item);
|
|
1098
|
+
i && e?.length && (t(r, !0), await o(this.urlUpdateDetail, {
|
|
1099
|
+
itemid: i,
|
|
1112
1100
|
details: e
|
|
1113
|
-
}),
|
|
1101
|
+
}), t(r, !1), n("Thêm tài sản thành công", "top-end", !0), await this.editDetailAfter(i), this.props.navigate(this.cUri + "/edit/" + i));
|
|
1114
1102
|
} catch (e) {
|
|
1115
|
-
c(e
|
|
1103
|
+
c(s(e)), t(r, !1);
|
|
1116
1104
|
}
|
|
1117
1105
|
};
|
|
1118
1106
|
editDetailAfter = async (e) => {};
|
|
1119
|
-
},
|
|
1107
|
+
}, K = class extends W {
|
|
1120
1108
|
urlGetDeTableList = "";
|
|
1121
1109
|
urlGetDeTable = "";
|
|
1122
1110
|
urlCreDeTable = "";
|
|
@@ -1125,52 +1113,52 @@ var L = class extends E.Component {
|
|
|
1125
1113
|
modalRef;
|
|
1126
1114
|
isBackUri = !1;
|
|
1127
1115
|
constructor(e) {
|
|
1128
|
-
super(e), this.modalRef =
|
|
1116
|
+
super(e), this.modalRef = k();
|
|
1129
1117
|
}
|
|
1130
1118
|
async fetchDataDetails() {
|
|
1131
1119
|
return {};
|
|
1132
1120
|
}
|
|
1133
1121
|
render() {
|
|
1134
|
-
let e =
|
|
1135
|
-
if (t === !1 && n === !1 && r === !1 || t === !1 && e == null || (n === !1 || r === !1) && e) return /* @__PURE__ */
|
|
1122
|
+
let e = a(), { isCre: t, isEdit: n, isDetail: r, item: i } = this.state;
|
|
1123
|
+
if (t === !1 && n === !1 && r === !1 || t === !1 && e == null || (n === !1 || r === !1) && e) return /* @__PURE__ */ j(H, {
|
|
1136
1124
|
cUriTitle: this.title,
|
|
1137
1125
|
cUri: this.cUri,
|
|
1138
1126
|
title: this.title + " | " + (e ? "Chỉnh sửa" : "Thêm mới"),
|
|
1139
1127
|
fluid: this.fluid
|
|
1140
1128
|
});
|
|
1141
|
-
if (e &&
|
|
1129
|
+
if (e && i === !1) return /* @__PURE__ */ j(U, {
|
|
1142
1130
|
cUriTitle: this.title,
|
|
1143
1131
|
cUri: this.cUri,
|
|
1144
1132
|
title: this.title + " | " + (e ? "Chỉnh sửa" : "Thêm mới")
|
|
1145
1133
|
});
|
|
1146
|
-
let o =
|
|
1147
|
-
return /* @__PURE__ */ A
|
|
1134
|
+
let o = d(i);
|
|
1135
|
+
return /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(F, { children: /* @__PURE__ */ M("title", { children: [
|
|
1148
1136
|
this.title,
|
|
1149
1137
|
" | ",
|
|
1150
1138
|
o ? "Chỉnh sửa" : "Thêm mới"
|
|
1151
|
-
] }) }), /* @__PURE__ */
|
|
1139
|
+
] }) }), /* @__PURE__ */ M("div", {
|
|
1152
1140
|
className: `mb-3 ${this.fluid ? "container-fluid" : "container"}`,
|
|
1153
1141
|
children: [
|
|
1154
|
-
/* @__PURE__ */
|
|
1142
|
+
/* @__PURE__ */ j(V, {
|
|
1155
1143
|
adminUri: this.ADMIN_URI,
|
|
1156
1144
|
title: this.title,
|
|
1157
1145
|
cUri: this.cUri,
|
|
1158
1146
|
isSave: !1,
|
|
1159
1147
|
itemId: o
|
|
1160
1148
|
}),
|
|
1161
|
-
|
|
1149
|
+
i ? this.renderDeTable() : null,
|
|
1162
1150
|
this.renderForm()
|
|
1163
1151
|
]
|
|
1164
1152
|
})] });
|
|
1165
1153
|
}
|
|
1166
1154
|
renderDeTable() {
|
|
1167
|
-
return /* @__PURE__ */
|
|
1155
|
+
return /* @__PURE__ */ j(A, {});
|
|
1168
1156
|
}
|
|
1169
|
-
renderModalDeBody = (e, t) => /* @__PURE__ */
|
|
1157
|
+
renderModalDeBody = (e, t) => /* @__PURE__ */ j(A, {});
|
|
1170
1158
|
handleDetailSubmit = async (e) => {
|
|
1171
1159
|
e.preventDefault();
|
|
1172
1160
|
};
|
|
1173
1161
|
editDetailAfter = async (e) => {};
|
|
1174
1162
|
};
|
|
1175
1163
|
//#endregion
|
|
1176
|
-
export {
|
|
1164
|
+
export { z as a, B as i, G as n, R as o, W as r, L as s, K as t };
|