@materialui-reactjs/admin 1.0.4

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 (131) hide show
  1. package/README.md +453 -0
  2. package/dist/assets/css/SpinnerLoader.css +1 -0
  3. package/dist/assets/css/form.css +1 -0
  4. package/dist/assets/css/index.css +1 -0
  5. package/dist/assets/css/meta.css +1 -0
  6. package/dist/chunks/Common-C_ZhT4L6.js +217 -0
  7. package/dist/chunks/Env-DRXhvUcb.js +16 -0
  8. package/dist/chunks/HeaderUpdate-lrSYWsKp.js +474 -0
  9. package/dist/chunks/SortableItem-B4-Zsso3.js +31 -0
  10. package/dist/chunks/SpinnerLoader-h8RDIarB.js +21 -0
  11. package/dist/chunks/UDragFile-CAiSfTsp.js +92 -0
  12. package/dist/chunks/Validator-DjZz2bJs.js +203 -0
  13. package/dist/chunks/echarts-CRmndsxC.js +322 -0
  14. package/dist/chunks/form-C8gzkYMW.js +45843 -0
  15. package/dist/chunks/loader-BUiOnhOH.js +1 -0
  16. package/dist/chunks/meta-k8MmuQjS.js +758 -0
  17. package/dist/chunks/sidebar-Dj4Xr9du.js +84 -0
  18. package/dist/chunks/single-DyPwG6ZR.js +1082 -0
  19. package/dist/chunks/top-navbar-FBw88y_o.js +78 -0
  20. package/dist/components/echarts/BarChart.d.ts +11 -0
  21. package/dist/components/echarts/LineChart.d.ts +10 -0
  22. package/dist/components/echarts/MultiBarChart.d.ts +14 -0
  23. package/dist/components/echarts/MultiLineChart.d.ts +14 -0
  24. package/dist/components/echarts/PieChart.d.ts +12 -0
  25. package/dist/components/echarts/index.d.ts +5 -0
  26. package/dist/components/echarts/index.js +2 -0
  27. package/dist/components/form/AdvancedMultiSelect.d.ts +16 -0
  28. package/dist/components/form/AsxhUImages.d.ts +15 -0
  29. package/dist/components/form/BoxAddRow.d.ts +26 -0
  30. package/dist/components/form/CheckTreeBox.d.ts +18 -0
  31. package/dist/components/form/CusForm.d.ts +105 -0
  32. package/dist/components/form/DateInput.d.ts +14 -0
  33. package/dist/components/form/DateTimeInput.d.ts +11 -0
  34. package/dist/components/form/Editor.d.ts +12 -0
  35. package/dist/components/form/EfFile.d.ts +15 -0
  36. package/dist/components/form/EfImage.d.ts +15 -0
  37. package/dist/components/form/EfImages.d.ts +14 -0
  38. package/dist/components/form/PImage.d.ts +15 -0
  39. package/dist/components/form/SelectAddRowBox.d.ts +17 -0
  40. package/dist/components/form/SelectAddRowBoxAdvanced.d.ts +16 -0
  41. package/dist/components/form/SelectBox.d.ts +32 -0
  42. package/dist/components/form/UDragFile.d.ts +13 -0
  43. package/dist/components/form/UFile.d.ts +15 -0
  44. package/dist/components/form/UFiles.d.ts +15 -0
  45. package/dist/components/form/UImages.d.ts +15 -0
  46. package/dist/components/form/index.d.ts +19 -0
  47. package/dist/components/form/index.js +3 -0
  48. package/dist/components/loader/SpinnerLoader.d.ts +8 -0
  49. package/dist/components/loader/index.d.ts +1 -0
  50. package/dist/components/loader/index.js +3 -0
  51. package/dist/components/meta/BtnGroup.d.ts +8 -0
  52. package/dist/components/meta/CardTable.d.ts +37 -0
  53. package/dist/components/meta/CusTooltip.d.ts +7 -0
  54. package/dist/components/meta/ElfinderModal.d.ts +10 -0
  55. package/dist/components/meta/Error403.d.ts +8 -0
  56. package/dist/components/meta/Error404.d.ts +8 -0
  57. package/dist/components/meta/Head.d.ts +1 -0
  58. package/dist/components/meta/HeaderDetail.d.ts +9 -0
  59. package/dist/components/meta/HeaderIndex.d.ts +17 -0
  60. package/dist/components/meta/HeaderUpdate.d.ts +9 -0
  61. package/dist/components/meta/ModalForm.d.ts +18 -0
  62. package/dist/components/meta/Navtabs.d.ts +12 -0
  63. package/dist/components/meta/PDFEmbed.d.ts +11 -0
  64. package/dist/components/meta/Pagination.d.ts +7 -0
  65. package/dist/components/meta/Pdfviewer.d.ts +0 -0
  66. package/dist/components/meta/ScrollTable.d.ts +16 -0
  67. package/dist/components/meta/SearchBox.d.ts +9 -0
  68. package/dist/components/meta/SortableItem.d.ts +1 -0
  69. package/dist/components/meta/index.d.ts +17 -0
  70. package/dist/components/meta/index.js +4 -0
  71. package/dist/components/sidebar/Sidebar.d.ts +3 -0
  72. package/dist/components/sidebar/Sidebar.types.d.ts +25 -0
  73. package/dist/components/sidebar/Sidebar.utils.d.ts +2 -0
  74. package/dist/components/sidebar/SidebarItem.d.ts +10 -0
  75. package/dist/components/sidebar/index.d.ts +2 -0
  76. package/dist/components/sidebar/index.js +2 -0
  77. package/dist/components/single/Detail.d.ts +25 -0
  78. package/dist/components/single/Fields.d.ts +31 -0
  79. package/dist/components/single/Import.d.ts +24 -0
  80. package/dist/components/single/List.d.ts +44 -0
  81. package/dist/components/single/Update.d.ts +33 -0
  82. package/dist/components/single/UpdateDetail.d.ts +7 -0
  83. package/dist/components/single/UpdateTableDetail.d.ts +18 -0
  84. package/dist/components/single/index.d.ts +7 -0
  85. package/dist/components/single/index.js +2 -0
  86. package/dist/components/top-navbar/TopNavbar.d.ts +6 -0
  87. package/dist/components/top-navbar/index.d.ts +1 -0
  88. package/dist/components/top-navbar/index.js +2 -0
  89. package/dist/fontawesome/css/all.css +8 -0
  90. package/dist/fontawesome/css/all.min.css +1 -0
  91. package/dist/fontawesome/webfonts/fa-brands-400.ttf +0 -0
  92. package/dist/fontawesome/webfonts/fa-brands-400.woff2 +0 -0
  93. package/dist/fontawesome/webfonts/fa-duotone-900.ttf +0 -0
  94. package/dist/fontawesome/webfonts/fa-duotone-900.woff2 +0 -0
  95. package/dist/fontawesome/webfonts/fa-light-300.ttf +0 -0
  96. package/dist/fontawesome/webfonts/fa-light-300.woff2 +0 -0
  97. package/dist/fontawesome/webfonts/fa-regular-400.ttf +0 -0
  98. package/dist/fontawesome/webfonts/fa-regular-400.woff2 +0 -0
  99. package/dist/fontawesome/webfonts/fa-sharp-light-300.ttf +0 -0
  100. package/dist/fontawesome/webfonts/fa-sharp-light-300.woff2 +0 -0
  101. package/dist/fontawesome/webfonts/fa-sharp-regular-400.ttf +0 -0
  102. package/dist/fontawesome/webfonts/fa-sharp-regular-400.woff2 +0 -0
  103. package/dist/fontawesome/webfonts/fa-sharp-solid-900.ttf +0 -0
  104. package/dist/fontawesome/webfonts/fa-sharp-solid-900.woff2 +0 -0
  105. package/dist/fontawesome/webfonts/fa-solid-900.ttf +0 -0
  106. package/dist/fontawesome/webfonts/fa-solid-900.woff2 +0 -0
  107. package/dist/fontawesome/webfonts/fa-thin-100.ttf +0 -0
  108. package/dist/fontawesome/webfonts/fa-thin-100.woff2 +0 -0
  109. package/dist/fontawesome/webfonts/fa-v4compatibility.ttf +0 -0
  110. package/dist/fontawesome/webfonts/fa-v4compatibility.woff2 +0 -0
  111. package/dist/hook/detail.d.ts +14 -0
  112. package/dist/hook/detail.js +12 -0
  113. package/dist/hook/fields.d.ts +14 -0
  114. package/dist/hook/fields.js +12 -0
  115. package/dist/hook/import.d.ts +15 -0
  116. package/dist/hook/import.js +0 -0
  117. package/dist/hook/index.d.ts +61 -0
  118. package/dist/hook/index.js +41 -0
  119. package/dist/hook/update.d.ts +24 -0
  120. package/dist/hook/update.js +29 -0
  121. package/dist/index.d.ts +7 -0
  122. package/dist/index.js +11 -0
  123. package/dist/utils/Common.d.ts +136 -0
  124. package/dist/utils/CusRoute.d.ts +7 -0
  125. package/dist/utils/Env.d.ts +2 -0
  126. package/dist/utils/Group.d.ts +1 -0
  127. package/dist/utils/Validator.d.ts +53 -0
  128. package/dist/utils/index.d.ts +5 -0
  129. package/dist/utils/index.js +671 -0
  130. package/package.json +171 -0
  131. package/scripts/postinstall.cjs +80 -0
@@ -0,0 +1,1082 @@
1
+ import { n as e } from "./Env-DRXhvUcb.js";
2
+ import { _ as t, b as n, c as r, g as i, i as a, t as o, v as s, y as c } from "./Common-C_ZhT4L6.js";
3
+ import { n as l, t as u } from "./Validator-DjZz2bJs.js";
4
+ import { t as d } from "./UDragFile-CAiSfTsp.js";
5
+ import { t as f } from "./SpinnerLoader-h8RDIarB.js";
6
+ import { a as p, c as m, d as h, i as g, l as _, n as v, o as y, r as b, s as x, t as S, u as C } from "./HeaderUpdate-lrSYWsKp.js";
7
+ import w, { createRef as T } from "react";
8
+ import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
9
+ import { Form as k, Link as A } from "react-router-dom";
10
+ import { Helmet as j } from "react-helmet-async";
11
+ //#region src/hook/detail.ts
12
+ var M = (e, t) => {
13
+ e.preventDefault();
14
+ let { name: n, type: r, value: i } = e.target;
15
+ if (r === "file") {
16
+ let r = e.target.files;
17
+ t[n] = r ? r[0] : null;
18
+ } else t[n] = i;
19
+ return t;
20
+ }, N = (e, t, n, r, i, a) => {
21
+ if (!a) return !1;
22
+ if (a == 1) return !0;
23
+ for (let o of e) {
24
+ if (o.module == t && o.controller == n && o.action == r && o.code == i && o.status !== 1) return o.isPer;
25
+ if (o.subs && o.subs.length > 0 && !N(o.subs, t, n, r, i, a)) return !1;
26
+ }
27
+ return !0;
28
+ }, { API_URL: P, ADMIN_URI: F } = await e(), I = class extends w.Component {
29
+ effectRan = !1;
30
+ module = "admins";
31
+ controller = "";
32
+ state = {
33
+ data: { filter: {} },
34
+ formValue: void 0,
35
+ item: void 0,
36
+ isDetail: void 0
37
+ };
38
+ title = "";
39
+ cUri = "";
40
+ cLink = F + this.cUri;
41
+ API_URL = P;
42
+ ADMIN_URI = F;
43
+ getDataUrl = "";
44
+ ctype = "application/json";
45
+ fluid = !1;
46
+ isBackUri = !0;
47
+ renderForm = () => /* @__PURE__ */ D(E, {});
48
+ syncPermissionsAndState = async () => {
49
+ let { menuData: e, user: t } = this.props, n = { isDetail: N(e, this.module, this.controller, "detail", 0, t.groupId) };
50
+ this.setState(n, async () => {
51
+ let e = r();
52
+ if (e && n.isDetail) {
53
+ let t = (await o(this.getDataUrl + "/" + e, {}, "GET", "application/json", !1))?.data;
54
+ this.setState({
55
+ item: t || !1,
56
+ formValue: t ? JSON.parse(JSON.stringify(t)) : {}
57
+ }, async () => {
58
+ await this.componentDidMountAfter();
59
+ });
60
+ }
61
+ });
62
+ };
63
+ async initDidMount() {
64
+ try {
65
+ if (this.effectRan) return;
66
+ this.effectRan = !0, this.props.user?.groupId && await this.syncPermissionsAndState();
67
+ } catch (e) {
68
+ e.message == "invalid_404" && this.props.navigate(this.cUri), s(e.message);
69
+ }
70
+ }
71
+ componentDidMount() {
72
+ this.initDidMount();
73
+ }
74
+ componentDidMountAfter = async () => {};
75
+ renderHeaderDetail() {
76
+ return /* @__PURE__ */ D(b, {
77
+ adminUri: this.ADMIN_URI,
78
+ title: this.title,
79
+ cUri: this.cUri
80
+ });
81
+ }
82
+ handleChange = async (e) => {
83
+ e.preventDefault();
84
+ let t = await M(e, { ...this.state.formValue });
85
+ this.setState((e) => ({ formValue: {
86
+ ...e.formValue,
87
+ ...t
88
+ } }));
89
+ };
90
+ render() {
91
+ let { isDetail: e, item: t } = this.state;
92
+ return e ? t === !1 ? /* @__PURE__ */ D(g, {
93
+ cUriTitle: this.title,
94
+ cUri: this.cUri,
95
+ title: this.title + " | Chi tiết"
96
+ }) : /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(j, { children: /* @__PURE__ */ D("title", { children: this.title }) }), /* @__PURE__ */ O("div", {
97
+ className: `mb-3 ${this.fluid ? "container-fluid" : "container"}`,
98
+ children: [this.renderHeaderDetail(), /* @__PURE__ */ D("div", {
99
+ className: "position-relative",
100
+ children: /* @__PURE__ */ D(f, {
101
+ loading: !t,
102
+ style: {
103
+ minHeight: 200,
104
+ marginTop: 20
105
+ },
106
+ children: this.renderForm()
107
+ })
108
+ })]
109
+ })] }) : /* @__PURE__ */ D(p, {
110
+ cUriTitle: this.title,
111
+ cUri: this.cUri,
112
+ title: this.title + " | Chi tiết",
113
+ fluid: this.fluid
114
+ });
115
+ }
116
+ }, L = (e, t) => {
117
+ e.preventDefault();
118
+ let { name: n, type: r, value: i } = e.target;
119
+ if (r === "file") {
120
+ let r = e.target.files;
121
+ t[n] = r ? r[0] : null;
122
+ } else t[n] = i;
123
+ return t;
124
+ }, { API_URL: R, ADMIN_URI: z } = await e(), B = class extends w.Component {
125
+ effectRan = !1;
126
+ module = "admins";
127
+ controller = "";
128
+ table = "";
129
+ state = {
130
+ formValue: {},
131
+ item: void 0,
132
+ isField: !1,
133
+ isDetail: !1
134
+ };
135
+ title = "";
136
+ cUri = "";
137
+ cLink = z + this.cUri;
138
+ API_URL = R;
139
+ ADMIN_URI = z;
140
+ getDataUrl = "";
141
+ editUrl = "";
142
+ createUrl = "";
143
+ ctype = "application/json";
144
+ fluid = !1;
145
+ isBackUri = !1;
146
+ renderForm = () => /* @__PURE__ */ D(E, {});
147
+ renderAfterForm = () => /* @__PURE__ */ D(E, {});
148
+ handleChange = async (e) => {
149
+ e.preventDefault();
150
+ let t = await L(e, { ...this.state.formValue });
151
+ this.setState((e) => ({ formValue: {
152
+ ...e.formValue,
153
+ ...t
154
+ } }));
155
+ };
156
+ syncPermissionsAndState = async () => {
157
+ let { menuData: e, user: t } = this.props, n = { isDetail: N(e, this.module, this.controller, "detail", 0, t.groupId) };
158
+ this.setState(n, async () => {
159
+ let e = (await o(this.getDataUrl, { table: this.table }, "GET", "application/json", !1))?.data;
160
+ this.setState({
161
+ item: e || !1,
162
+ formValue: e ? { ...e } : {}
163
+ }), new u("#fieldUpdate").run();
164
+ });
165
+ };
166
+ async initDidMount() {
167
+ try {
168
+ if (this.effectRan) return;
169
+ this.effectRan = !0, this.props.user?.groupId && (await this.syncPermissionsAndState(), await this.componentDidMountAfter());
170
+ } catch (e) {
171
+ e.message == "invalid_404" && this.props.navigate(this.cUri), s(e.message);
172
+ }
173
+ }
174
+ componentDidMount() {
175
+ this.initDidMount();
176
+ }
177
+ componentDidMountAfter = async () => {};
178
+ handleSubmit = async (e) => {
179
+ e.preventDefault();
180
+ let { formValue: t } = this.state, r = new u("#fieldUpdate");
181
+ if (!r.hasErrors() && !r.isIncomplete()) {
182
+ n("#fieldUpdate", !0);
183
+ try {
184
+ t.table ||= this.table;
185
+ let e = await o(this.editUrl, t, "POST", this.ctype);
186
+ if (c("Cập nhật thành công", "top-end", !0), e?.data?.id) {
187
+ if (this.isBackUri) return this.props.navigate(this.cUri);
188
+ this.props.navigate(this.cUri + "/fields"), this.setState({
189
+ item: { ...e.data },
190
+ formValue: { ...e.data }
191
+ }, async () => {
192
+ await this.afterSubmit(e.data);
193
+ });
194
+ }
195
+ } catch (e) {
196
+ s(e.message);
197
+ } finally {
198
+ n("#fieldUpdate", !1);
199
+ }
200
+ }
201
+ };
202
+ afterSubmit = async (e) => {};
203
+ renderHeaderUpdate() {
204
+ return /* @__PURE__ */ D(S, {
205
+ adminUri: this.ADMIN_URI,
206
+ title: this.title,
207
+ cUri: this.cUri,
208
+ itemId: this.state.item?.id
209
+ });
210
+ }
211
+ render() {
212
+ let { isDetail: e, item: t } = this.state;
213
+ return e === !1 ? /* @__PURE__ */ D(p, {
214
+ cUriTitle: this.title,
215
+ cUri: this.cUri,
216
+ title: this.title,
217
+ fluid: this.fluid
218
+ }) : /* @__PURE__ */ O(E, { children: [
219
+ /* @__PURE__ */ D(j, { children: /* @__PURE__ */ O("title", { children: [this.title, " | Tùy chỉnh dữ liệu"] }) }),
220
+ /* @__PURE__ */ D("div", {
221
+ className: `position-relative mb-3 ${this.fluid ? "container-fluid" : "container"}`,
222
+ children: /* @__PURE__ */ D(k, {
223
+ id: "fieldUpdate",
224
+ className: "position-relative",
225
+ method: "post",
226
+ encType: "multipart/form-data",
227
+ "data-toggle": "validator",
228
+ role: "form",
229
+ onSubmit: this.handleSubmit,
230
+ children: /* @__PURE__ */ O(f, {
231
+ loading: !t,
232
+ style: {
233
+ minHeight: 200,
234
+ marginTop: 20
235
+ },
236
+ children: [this.renderHeaderUpdate(), this.renderForm()]
237
+ })
238
+ })
239
+ }),
240
+ this.renderAfterForm()
241
+ ] });
242
+ }
243
+ }, { API_URL: V, ADMIN_URI: H } = await e(), U = class extends w.Component {
244
+ module = "admins";
245
+ controller = "";
246
+ state = {
247
+ formValue: {},
248
+ error: {},
249
+ isCre: !1,
250
+ isEdit: !1
251
+ };
252
+ title = "";
253
+ cUri = "";
254
+ cLink = H + this.cUri;
255
+ API_URL = V;
256
+ ADMIN_URI = H;
257
+ importUrl = "";
258
+ importFile = "assetorigin.xlsx";
259
+ ctype = "multipart/form-data";
260
+ fluid = !1;
261
+ handleChange = async (e) => {
262
+ e.preventDefault();
263
+ let { name: t, type: n, value: r } = e.target;
264
+ if (n === "file") {
265
+ let n = e.target.files;
266
+ this.setState((e) => ({ formValue: {
267
+ ...e.formValue,
268
+ [t]: n ? n[0] : null
269
+ } }));
270
+ } else this.setState((e) => ({ formValue: {
271
+ ...e.formValue,
272
+ [t]: r
273
+ } }));
274
+ };
275
+ syncPermissionsAndState = () => {
276
+ let { menuData: e, user: t } = this.props, n = {
277
+ isCre: N(e, this.module, this.controller, "update", 0, t.groupId),
278
+ isEdit: N(e, this.module, this.controller, "update", 1, t.groupId)
279
+ };
280
+ this.setState(n, async () => {
281
+ new u("#itemImport").run();
282
+ });
283
+ };
284
+ async initDidMount() {
285
+ try {
286
+ this.props.user?.groupId && (this.syncPermissionsAndState(), this.componentDidMountAfter());
287
+ } catch (e) {
288
+ e.message == "invalid_404" && this.props.navigate(this.cUri), s(e.message);
289
+ }
290
+ }
291
+ componentDidMount() {
292
+ this.initDidMount();
293
+ }
294
+ componentDidMountAfter = async () => {};
295
+ handleSubmit = async (e) => {
296
+ e.preventDefault();
297
+ let { formValue: t } = this.state, r = new u("#itemImport");
298
+ if (!r.hasErrors() && !r.isIncomplete()) {
299
+ n("#itemImport", !0);
300
+ try {
301
+ let e = await o(this.importUrl, t, "POST", this.ctype);
302
+ 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), c("Import thành công", "top-end", !0));
303
+ } catch (e) {
304
+ s(e.message);
305
+ } finally {
306
+ n("#itemImport", !1);
307
+ }
308
+ }
309
+ };
310
+ renderForm = () => /* @__PURE__ */ D(E, { children: /* @__PURE__ */ D(d, {
311
+ onChange: this.handleChange,
312
+ label: "Import excel",
313
+ name: "importfile",
314
+ ext: ".xlsx,.xls"
315
+ }) });
316
+ render() {
317
+ let { isCre: e, isEdit: t } = this.state;
318
+ return e === !1 && t === !1 ? /* @__PURE__ */ D(p, {
319
+ cUriTitle: this.title,
320
+ cUri: this.cUri,
321
+ title: this.title + " | Import",
322
+ fluid: this.fluid
323
+ }) : /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(j, { children: /* @__PURE__ */ O("title", { children: [
324
+ this.title,
325
+ " | ",
326
+ "Import"
327
+ ] }) }), /* @__PURE__ */ D("div", {
328
+ className: `mb-3 ${this.fluid ? "container-fluid" : "container"}`,
329
+ children: /* @__PURE__ */ O(k, {
330
+ id: "itemImport",
331
+ className: "position-relative",
332
+ action: this.importUrl,
333
+ method: "post",
334
+ encType: "multipart/form-data",
335
+ "data-toggle": "validator",
336
+ role: "form",
337
+ onSubmit: this.handleSubmit,
338
+ children: [/* @__PURE__ */ O("div", {
339
+ className: "navbar navbar-main navbar-expand-lg px-0 shadow-none border-radius-xl py-3",
340
+ children: [/* @__PURE__ */ D("nav", {
341
+ "aria-label": "breadcrumb",
342
+ children: /* @__PURE__ */ O("ol", {
343
+ className: "breadcrumb bg-transparent m-0 p-0",
344
+ children: [
345
+ /* @__PURE__ */ D("li", {
346
+ className: "breadcrumb-item",
347
+ children: /* @__PURE__ */ D(A, {
348
+ className: "text-white",
349
+ to: this.ADMIN_URI || "/",
350
+ children: /* @__PURE__ */ D("i", { className: "fal fa-home" })
351
+ })
352
+ }),
353
+ /* @__PURE__ */ D("li", {
354
+ className: "breadcrumb-item",
355
+ children: /* @__PURE__ */ D(A, {
356
+ className: "text-white",
357
+ to: this.cUri,
358
+ children: this.title
359
+ })
360
+ }),
361
+ /* @__PURE__ */ D("li", {
362
+ className: "breadcrumb-item text-white active",
363
+ "aria-current": "page",
364
+ children: "Import"
365
+ })
366
+ ]
367
+ })
368
+ }), /* @__PURE__ */ O("div", {
369
+ className: "ms-auto",
370
+ children: [/* @__PURE__ */ D(A, {
371
+ target: "_blank",
372
+ to: this.API_URL + "/importfile/" + this.importFile,
373
+ className: "btn btn-sm btn-icon btn-info me-2",
374
+ title: "Tải xuống biểu mẫu",
375
+ children: /* @__PURE__ */ D("i", {
376
+ className: "material-icons text-white position-relative text-lg",
377
+ children: "file_download"
378
+ })
379
+ }), /* @__PURE__ */ D(A, {
380
+ to: this.cUri,
381
+ className: "btn btn-sm btn-icon btn-secondary",
382
+ title: "Trở lại",
383
+ children: /* @__PURE__ */ D("i", {
384
+ className: "material-icons text-white position-relative text-lg",
385
+ children: "reply"
386
+ })
387
+ })]
388
+ })]
389
+ }), /* @__PURE__ */ D("div", {
390
+ className: "card",
391
+ children: /* @__PURE__ */ D("div", {
392
+ className: "card-body pb-0",
393
+ children: /* @__PURE__ */ D("div", {
394
+ className: "row justify-content-center",
395
+ children: /* @__PURE__ */ O("div", {
396
+ className: "col-md-8 pt-5 pb-4",
397
+ children: [
398
+ /* @__PURE__ */ D("div", { dangerouslySetInnerHTML: { __html: i(this.state.error) } }),
399
+ this.renderForm(),
400
+ /* @__PURE__ */ D("div", {
401
+ className: "w-100 d-flex",
402
+ children: /* @__PURE__ */ D("button", {
403
+ title: "Import",
404
+ type: "submit",
405
+ className: "btn btn-success mb-4 mx-auto",
406
+ children: "Import"
407
+ })
408
+ })
409
+ ]
410
+ })
411
+ })
412
+ })
413
+ })]
414
+ })
415
+ })] });
416
+ }
417
+ }, { API_URL: W, ADMIN_URI: G } = await e(), K = class extends w.Component {
418
+ effectRan = !1;
419
+ fluid = !1;
420
+ module = "admins";
421
+ controller = "";
422
+ table = "";
423
+ hasField = !1;
424
+ state = {
425
+ loading: !0,
426
+ data: {
427
+ items: [],
428
+ page: 1,
429
+ filter: {},
430
+ length: 10,
431
+ pageTotal: 0,
432
+ recordTotal: 0
433
+ },
434
+ isDel: void 0,
435
+ isCre: void 0,
436
+ isEdit: void 0,
437
+ isDelOne: void 0,
438
+ isDetail: void 0,
439
+ isIndex: void 0,
440
+ isImport: void 0,
441
+ isExport: void 0,
442
+ isCopy: void 0,
443
+ selectedIds: [],
444
+ ftfield: [],
445
+ tbfield: []
446
+ };
447
+ activeMethod = [
448
+ "ind",
449
+ "det",
450
+ "cre",
451
+ "edit",
452
+ "delone",
453
+ "del"
454
+ ];
455
+ cUri = "";
456
+ cLink = G + this.cUri;
457
+ API_URL = W;
458
+ ADMIN_URI = G;
459
+ getDataUrl = "";
460
+ deleteUrl = "";
461
+ copyUrl = "";
462
+ exportUrl = "";
463
+ title = "";
464
+ handleChange = async (e) => {
465
+ try {
466
+ e.preventDefault();
467
+ let { name: t } = e.target, n = await x(e, this.state.data.filter || {});
468
+ if (t === "pageLen") {
469
+ await this.setFilter(n);
470
+ let e = n ? a(n) : "";
471
+ this.props.navigate(`${this.cUri}?${e}`, { replace: !0 }), await this.fetchData();
472
+ } else this.setState((e) => ({ data: {
473
+ ...e.data,
474
+ filter: n
475
+ } }));
476
+ } catch (e) {
477
+ console.log(e);
478
+ }
479
+ };
480
+ handleSearchForm = async (e) => {
481
+ try {
482
+ e.preventDefault();
483
+ let t = await _(this.state.data.filter || {}, this.cUri, this.props.navigate);
484
+ await this.setFilter(t), await this.fetchData();
485
+ } catch (e) {
486
+ console.log(e);
487
+ }
488
+ };
489
+ handleClickPage = async (e) => {
490
+ try {
491
+ e.preventDefault();
492
+ let t = await m(e, this.state.data.filter || {}, this.cUri, this.props.navigate);
493
+ await this.setFilter(t), await this.fetchData();
494
+ } catch (e) {
495
+ s(e.message);
496
+ }
497
+ };
498
+ handleDeleteOne = async (e) => {
499
+ t().then(async () => {
500
+ try {
501
+ await o(`${this.deleteUrl}/${e}`, {}, "GET"), c("Xoá thành công!", "top-end", !0), await this.fetchData();
502
+ } catch (e) {
503
+ s(e.message);
504
+ }
505
+ });
506
+ };
507
+ handleDelete = async () => {
508
+ this.state.selectedIds.length ? t().then(async () => {
509
+ try {
510
+ await o(this.deleteUrl, { selected: this.state.selectedIds }, "POST"), c("Xoá thành công!", "top-end", !0), await this.fetchData();
511
+ } catch (e) {
512
+ s(e.message);
513
+ }
514
+ }) : s("Vui lòng chọn thông tin");
515
+ };
516
+ handleCopy = async () => {
517
+ this.state.selectedIds.length ? t().then(async () => {
518
+ try {
519
+ await o(this.copyUrl, { selected: this.state.selectedIds }, "POST"), c("Sao chép thành công!", "top-end", !0), await this.fetchData();
520
+ } catch (e) {
521
+ s(e.message);
522
+ }
523
+ }) : s("Vui lòng chọn thông tin");
524
+ };
525
+ handleExport = async () => {
526
+ try {
527
+ let { data: e } = this.state, t = a(e.filter || {});
528
+ this.exportUrl && (window.location.href = this.exportUrl + `?${t}`);
529
+ } catch (e) {
530
+ s(e.message);
531
+ }
532
+ };
533
+ handleSelectOne = (e, t) => {
534
+ this.setState((n) => ({ selectedIds: t ? [.../* @__PURE__ */ new Set([...n.selectedIds, e])] : n.selectedIds.filter((t) => t !== e) }));
535
+ };
536
+ handleSelectAll = (e, t = []) => {
537
+ this.setState({ selectedIds: e ? this.state.data.items.map((e) => e.id).filter((e) => e !== void 0 && !t.includes(e)) : [] });
538
+ };
539
+ setFilter(e) {
540
+ return new Promise((t) => {
541
+ this.setState((t) => ({ data: {
542
+ ...t.data,
543
+ filter: e
544
+ } }), t);
545
+ });
546
+ }
547
+ fetchData = async () => {
548
+ try {
549
+ let e = await y(this.state.data.filter || {}, this.getDataUrl);
550
+ if (!e || !("items" in e)) return;
551
+ this.setState({
552
+ data: {
553
+ ...e,
554
+ filter: e.filter ?? this.state.data.filter
555
+ },
556
+ selectedIds: []
557
+ });
558
+ } catch (e) {
559
+ console.error(e.message);
560
+ }
561
+ };
562
+ syncGetField = async () => ({
563
+ userfield: {},
564
+ tablefield: {}
565
+ });
566
+ syncPermissionsAndState = async () => {
567
+ let { menuData: e, user: t } = this.props, n = {
568
+ isCre: this.activeMethod.includes("cre") ? N(e, this.module, this.controller, "update", 0, t.groupId) : !1,
569
+ isEdit: this.activeMethod.includes("edit") ? N(e, this.module, this.controller, "update", 1, t.groupId) : !1,
570
+ isDel: this.activeMethod.includes("del") ? N(e, this.module, this.controller, "delete", 0, t.groupId) : !1,
571
+ isDelOne: this.activeMethod.includes("delone") ? N(e, this.module, this.controller, "delete", 1, t.groupId) : !1,
572
+ isIndex: this.activeMethod.includes("ind") ? N(e, this.module, this.controller, "index", 0, t.groupId) : !1,
573
+ isDetail: this.activeMethod.includes("det") ? N(e, this.module, this.controller, "detail", 0, t.groupId) : !1,
574
+ isImport: !!this.activeMethod.includes("imp"),
575
+ isExport: !!this.activeMethod.includes("exp"),
576
+ isCopy: !!this.activeMethod.includes("cpy")
577
+ };
578
+ this.setState(n, async () => {
579
+ if (n.isIndex) {
580
+ if (this.hasField) {
581
+ let { userfield: e, tablefield: t } = await this.syncGetField(), n = e?.data?.ftfield || t?.data?.deft || [], r = e?.data?.tbfield || t?.data?.detb || [];
582
+ this.setState((e) => ({
583
+ ...e,
584
+ ftfield: n,
585
+ tbfield: r
586
+ }));
587
+ }
588
+ await this.fetchData(), this.setState({ loading: !1 }), await this.componentDidMountAfter();
589
+ }
590
+ });
591
+ };
592
+ async initDidMount() {
593
+ try {
594
+ if (this.effectRan) return;
595
+ this.effectRan = !0;
596
+ let e = new URLSearchParams(window.location.search), t = Object.fromEntries(e.entries()), n = {
597
+ ...this.state.data.filter || {},
598
+ page: 1,
599
+ ...t
600
+ };
601
+ await this.setFilter(n), this.props.user?.groupId && await this.syncPermissionsAndState();
602
+ } catch (e) {
603
+ s(e.message);
604
+ }
605
+ }
606
+ componentDidMount() {
607
+ this.initDidMount();
608
+ }
609
+ componentDidMountAfter = async () => {};
610
+ renderHeaderIndex() {
611
+ return /* @__PURE__ */ D(v, {
612
+ adminUri: this.ADMIN_URI,
613
+ title: this.title,
614
+ cUri: this.cUri,
615
+ isExp: this.state.isExport,
616
+ isImp: this.state.isImport,
617
+ isCre: this.state.isCre,
618
+ isDel: this.state.isDel,
619
+ isCpy: this.state.isCopy,
620
+ isField: this.hasField,
621
+ onExport: this.handleExport,
622
+ onCopy: this.handleCopy,
623
+ onDelete: this.handleDelete
624
+ });
625
+ }
626
+ renderTable = () => /* @__PURE__ */ D(E, {});
627
+ renderSearch = () => /* @__PURE__ */ D(E, {});
628
+ render() {
629
+ let { isIndex: e, data: t, loading: n } = this.state;
630
+ return e === !1 ? /* @__PURE__ */ D(p, {
631
+ cUriTitle: this.title,
632
+ cUri: this.cUri,
633
+ title: this.title,
634
+ fluid: this.fluid
635
+ }) : /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(j, { children: /* @__PURE__ */ D("title", { children: this.title }) }), /* @__PURE__ */ D(f, {
636
+ loading: n,
637
+ children: e && /* @__PURE__ */ O("div", {
638
+ className: `mb-3 ${this.fluid ? "container-fluid" : "container"}`,
639
+ children: [this.renderHeaderIndex(), /* @__PURE__ */ D("div", {
640
+ className: "card position-relative",
641
+ children: /* @__PURE__ */ D("div", {
642
+ className: "card-body",
643
+ style: { minHeight: "200px" },
644
+ children: /* @__PURE__ */ O("div", {
645
+ className: "searchForm",
646
+ children: [
647
+ /* @__PURE__ */ D("form", {
648
+ onSubmit: this.handleSearchForm,
649
+ children: this.renderSearch()
650
+ }),
651
+ t.items.length ? /* @__PURE__ */ D(C, {
652
+ data: t,
653
+ onChange: this.handleChange,
654
+ onClickPage: this.handleClickPage
655
+ }) : "",
656
+ /* @__PURE__ */ D("div", {
657
+ className: "table-responsive mt-2",
658
+ children: this.renderTable()
659
+ }),
660
+ t.items.length ? /* @__PURE__ */ D(C, {
661
+ data: t,
662
+ onChange: this.handleChange,
663
+ onClickPage: this.handleClickPage
664
+ }) : ""
665
+ ]
666
+ })
667
+ })
668
+ })]
669
+ })
670
+ })] });
671
+ }
672
+ }, q = ({ adminUri: e, cUri: t, title: n, itemId: r, isSave: i = !0, titleAction: a }) => /* @__PURE__ */ O("div", {
673
+ className: "navbar navbar-main navbar-expand-lg px-0 shadow-none border-radius-xl py-3",
674
+ children: [/* @__PURE__ */ D("nav", {
675
+ "aria-label": "breadcrumb",
676
+ children: /* @__PURE__ */ O("ol", {
677
+ className: "breadcrumb bg-transparent m-0 p-0",
678
+ children: [
679
+ /* @__PURE__ */ D("li", {
680
+ className: "breadcrumb-item",
681
+ children: /* @__PURE__ */ D(A, {
682
+ className: "text-white",
683
+ to: e || "/",
684
+ children: /* @__PURE__ */ D("i", { className: "fal fa-home" })
685
+ })
686
+ }),
687
+ /* @__PURE__ */ D("li", {
688
+ className: "breadcrumb-item",
689
+ children: /* @__PURE__ */ D(A, {
690
+ className: "text-white",
691
+ to: t,
692
+ children: n
693
+ })
694
+ }),
695
+ /* @__PURE__ */ D("li", {
696
+ className: "breadcrumb-item text-white active",
697
+ "aria-current": "page",
698
+ children: a ?? (r ? "Chỉnh sửa" : "Thêm mới")
699
+ })
700
+ ]
701
+ })
702
+ }), /* @__PURE__ */ O("div", {
703
+ className: "ms-auto",
704
+ children: [i && /* @__PURE__ */ D(h, {
705
+ title: "Lưu lại",
706
+ children: /* @__PURE__ */ D("button", {
707
+ type: "submit",
708
+ className: "btn btn-sm btn-icon btn-success me-1",
709
+ children: /* @__PURE__ */ D("i", {
710
+ className: "material-icons text-white position-relative text-lg",
711
+ children: "save"
712
+ })
713
+ })
714
+ }), /* @__PURE__ */ D(h, {
715
+ title: "Trở lại",
716
+ children: /* @__PURE__ */ D(A, {
717
+ to: t,
718
+ className: "btn btn-sm btn-icon btn-secondary",
719
+ children: /* @__PURE__ */ D("i", {
720
+ className: "material-icons text-white position-relative text-lg",
721
+ children: "reply"
722
+ })
723
+ })
724
+ })]
725
+ })]
726
+ }), J = ({ title: e = "", cUri: t = "", fluid: n = !1, cUriTitle: r = "" }) => /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(j, { children: /* @__PURE__ */ D("title", { children: e || "Truy cập không được phép" }) }), /* @__PURE__ */ O("div", {
727
+ className: `${n ? "container-fluid" : "container"}`,
728
+ children: [/* @__PURE__ */ D("div", {
729
+ className: "navbar navbar-main navbar-expand-lg px-0 shadow-none border-radius-xl py-3",
730
+ children: /* @__PURE__ */ D("nav", {
731
+ "aria-label": "breadcrumb",
732
+ children: /* @__PURE__ */ O("ol", {
733
+ className: "breadcrumb bg-transparent m-0 p-0",
734
+ children: [/* @__PURE__ */ D("li", {
735
+ className: "breadcrumb-item",
736
+ children: /* @__PURE__ */ D(A, {
737
+ className: "text-white",
738
+ to: "/",
739
+ children: /* @__PURE__ */ D("i", { className: "fal fa-home" })
740
+ })
741
+ }), /* @__PURE__ */ D("li", {
742
+ className: "breadcrumb-item",
743
+ children: /* @__PURE__ */ D(A, {
744
+ className: "text-white",
745
+ to: t,
746
+ children: r
747
+ })
748
+ })]
749
+ })
750
+ })
751
+ }), /* @__PURE__ */ D("div", {
752
+ style: { minHeight: "50vh" },
753
+ className: "d-flex align-items-center",
754
+ children: /* @__PURE__ */ O("div", {
755
+ className: "m-auto text-center",
756
+ children: [
757
+ /* @__PURE__ */ D("h1", {
758
+ className: "display-1 text-bolder text-white",
759
+ children: "403"
760
+ }),
761
+ /* @__PURE__ */ D("h2", {
762
+ className: "text-white",
763
+ children: "Truy cập không được phép"
764
+ }),
765
+ /* @__PURE__ */ D("p", {
766
+ className: "lead text-white",
767
+ children: "Xin lỗi, bạn không có quyền truy cập vào trang này."
768
+ }),
769
+ /* @__PURE__ */ D(A, {
770
+ to: "/",
771
+ className: "btn btn-outline-white mt-4",
772
+ children: "trang chủ"
773
+ })
774
+ ]
775
+ })
776
+ })]
777
+ })] }), Y = ({ title: e = "", cUri: t = "", fluid: n = !1, cUriTitle: r = "" }) => /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(j, { children: /* @__PURE__ */ D("title", { children: e || "Không tìm thấy dữ liệu" }) }), /* @__PURE__ */ O("div", {
778
+ className: `${n ? "container-fluid" : "container"}`,
779
+ children: [/* @__PURE__ */ D("div", {
780
+ className: "navbar navbar-main navbar-expand-lg px-0 shadow-none border-radius-xl py-3",
781
+ children: /* @__PURE__ */ D("nav", {
782
+ "aria-label": "breadcrumb",
783
+ children: /* @__PURE__ */ O("ol", {
784
+ className: "breadcrumb bg-transparent m-0 p-0",
785
+ children: [/* @__PURE__ */ D("li", {
786
+ className: "breadcrumb-item",
787
+ children: /* @__PURE__ */ D(A, {
788
+ className: "text-white",
789
+ to: "/",
790
+ children: /* @__PURE__ */ D("i", { className: "fal fa-home" })
791
+ })
792
+ }), /* @__PURE__ */ D("li", {
793
+ className: "breadcrumb-item",
794
+ children: /* @__PURE__ */ D(A, {
795
+ className: "text-white",
796
+ to: t,
797
+ children: r
798
+ })
799
+ })]
800
+ })
801
+ })
802
+ }), /* @__PURE__ */ D("div", {
803
+ style: { minHeight: "50vh" },
804
+ className: "d-flex align-items-center",
805
+ children: /* @__PURE__ */ O("div", {
806
+ className: "m-auto text-center",
807
+ children: [
808
+ /* @__PURE__ */ D("h1", {
809
+ className: "display-1 text-bolder text-white",
810
+ children: "404"
811
+ }),
812
+ /* @__PURE__ */ D("h2", {
813
+ className: "text-white",
814
+ children: "Không tìm thấy dữ liệu"
815
+ }),
816
+ /* @__PURE__ */ D("p", {
817
+ className: "lead text-white",
818
+ children: "Xin lỗi, dữ liệu của bạn không được tìm thấy"
819
+ }),
820
+ /* @__PURE__ */ D(A, {
821
+ to: "/",
822
+ className: "btn btn-outline-white mt-4",
823
+ children: "trang chủ"
824
+ })
825
+ ]
826
+ })
827
+ })]
828
+ })] }), { API_URL: X, ADMIN_URI: Z } = await e(), Q = class extends w.Component {
829
+ effectRan = !1;
830
+ module = "admins";
831
+ controller = "";
832
+ state = {
833
+ formValue: {},
834
+ error: {},
835
+ loading: !0,
836
+ item: void 0,
837
+ isCre: void 0,
838
+ isEdit: void 0,
839
+ isDetail: void 0
840
+ };
841
+ title = "";
842
+ cUri = "";
843
+ cLink = Z + this.cUri;
844
+ API_URL = X;
845
+ ADMIN_URI = Z;
846
+ getDataUrl = "";
847
+ editUrl = "";
848
+ createUrl = "";
849
+ ctype = "application/json";
850
+ formRef;
851
+ fluid = !1;
852
+ isBackUri = !0;
853
+ constructor(e) {
854
+ super(e), this.formRef = w.createRef();
855
+ }
856
+ renderForm = () => /* @__PURE__ */ D(E, {});
857
+ renderAfterForm = () => /* @__PURE__ */ D(E, {});
858
+ handleChange = async (e) => {
859
+ e.preventDefault();
860
+ let t = await l(e, { ...this.state.formValue });
861
+ this.setState((e) => ({ formValue: {
862
+ ...e.formValue,
863
+ ...t
864
+ } }));
865
+ };
866
+ syncPermissionsAndState = async () => {
867
+ let { menuData: e, user: t } = this.props, n = {
868
+ isCre: N(e, this.module, this.controller, "update", 0, t.groupId),
869
+ isEdit: N(e, this.module, this.controller, "update", 1, t.groupId),
870
+ isDetail: N(e, this.module, this.controller, "detail", 0, t.groupId)
871
+ };
872
+ this.setState(n, async () => {
873
+ let e = r();
874
+ if (e && n.isEdit) {
875
+ let t = (await o(this.getDataUrl + "/" + e, {}, "GET", "application/json", !1))?.data;
876
+ this.setState({
877
+ item: t || !1,
878
+ formValue: t ? JSON.parse(JSON.stringify(t)) : {}
879
+ }, async () => {
880
+ this.setState({ loading: !1 }), await this.componentDidMountAfter(), this.formRef.current && new u(this.formRef.current).run();
881
+ });
882
+ } else {
883
+ if (this.setState({ loading: !1 }), await this.componentDidMountAfter(), !this.formRef.current) return;
884
+ new u(this.formRef.current).run();
885
+ }
886
+ });
887
+ };
888
+ async initDidMount() {
889
+ try {
890
+ if (this.effectRan) return;
891
+ this.effectRan = !0, this.props.user?.groupId && await this.syncPermissionsAndState();
892
+ } catch (e) {
893
+ e.message == "invalid_404" && this.props.navigate(this.cUri), s(e.message);
894
+ }
895
+ }
896
+ componentDidMount = () => {
897
+ this.initDidMount();
898
+ };
899
+ componentDidMountAfter = async () => {};
900
+ beforeSubmit = () => new Promise((e) => {
901
+ e(!0);
902
+ });
903
+ handleSubmit = async (e) => {
904
+ e.preventDefault();
905
+ let { item: t, formValue: n } = this.state, r = Number(t?.id), i = new u(this.formRef.current);
906
+ !i.hasErrors() && !i.isIncomplete() && this.formRef.current && this.beforeSubmit().then(async () => {
907
+ this.setState({ loading: !0 });
908
+ try {
909
+ let e = r ? this.editUrl + "/" + r : this.createUrl, t = await o(e, n, "POST", this.ctype);
910
+ if (c(r ? "Cập nhật thành công" : "Thêm mới thành công", "top-end", !0), t?.data?.id) {
911
+ if (this.isBackUri) return this.props.navigate(this.cUri);
912
+ this.props.navigate(this.cUri + "/edit/" + Number(t.data.id)), this.setState({
913
+ item: { ...t.data },
914
+ formValue: { ...t.data }
915
+ }, async () => {
916
+ await this.afterSubmit(t.data);
917
+ });
918
+ }
919
+ } catch (e) {
920
+ s(e.message);
921
+ } finally {
922
+ this.setState({ loading: !1 });
923
+ }
924
+ });
925
+ };
926
+ afterSubmit = async (e) => {};
927
+ renderHeaderUpdate() {
928
+ return /* @__PURE__ */ D(q, {
929
+ adminUri: this.ADMIN_URI,
930
+ title: this.title,
931
+ cUri: this.cUri,
932
+ itemId: this.state.item?.id
933
+ });
934
+ }
935
+ render() {
936
+ let e = r(), { isCre: t, isEdit: n, isDetail: a, item: o } = this.state;
937
+ return t === !1 && n === !1 && a === !1 || t === !1 && e === 0 || (n === !1 || a === !1) && e ? /* @__PURE__ */ D(J, {
938
+ cUriTitle: this.title,
939
+ cUri: this.cUri,
940
+ title: this.title + " | " + (e ? "Chỉnh sửa" : "Thêm mới"),
941
+ fluid: this.fluid
942
+ }) : e && o === !1 ? /* @__PURE__ */ D(Y, {
943
+ cUriTitle: this.title,
944
+ cUri: this.cUri,
945
+ title: this.title + " | " + (e ? "Chỉnh sửa" : "Thêm mới")
946
+ }) : /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(j, { children: /* @__PURE__ */ O("title", { children: [
947
+ this.title,
948
+ " | ",
949
+ o?.id ? "Chỉnh sửa" : "Thêm mới"
950
+ ] }) }), /* @__PURE__ */ O("div", {
951
+ className: `mb-3 ${this.fluid ? "container-fluid" : "container"}`,
952
+ children: [
953
+ /* @__PURE__ */ D("div", { dangerouslySetInnerHTML: { __html: i(this.state.error) } }),
954
+ /* @__PURE__ */ D(k, {
955
+ ref: this.formRef,
956
+ className: "position-relative",
957
+ method: "post",
958
+ encType: "multipart/form-data",
959
+ "data-toggle": "validator",
960
+ role: "form",
961
+ onSubmit: this.handleSubmit,
962
+ children: /* @__PURE__ */ O(f, {
963
+ loading: !!this.state.loading,
964
+ style: {
965
+ minHeight: 200,
966
+ marginTop: 20
967
+ },
968
+ children: [this.renderHeaderUpdate(), this.renderForm()]
969
+ })
970
+ }),
971
+ this.renderAfterForm()
972
+ ]
973
+ })] });
974
+ }
975
+ }, $ = class extends Q {
976
+ urlUpdateDetail = "";
977
+ render() {
978
+ let e = r(), { isCre: t, isEdit: n, isDetail: a, item: o } = this.state;
979
+ return t === !1 && n === !1 && a === !1 || t === !1 && e === 0 || (n === !1 || a === !1) && e ? /* @__PURE__ */ D(J, {
980
+ cUriTitle: this.title,
981
+ cUri: this.cUri,
982
+ title: this.title + " | " + (e ? "Chỉnh sửa" : "Thêm mới"),
983
+ fluid: this.fluid
984
+ }) : e && o === !1 ? /* @__PURE__ */ D(Y, {
985
+ cUriTitle: this.title,
986
+ cUri: this.cUri,
987
+ title: this.title + " | " + (e ? "Chỉnh sửa" : "Thêm mới")
988
+ }) : (e && o || !e) && /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(j, { children: /* @__PURE__ */ O("title", { children: [
989
+ this.title,
990
+ " | ",
991
+ o?.id ? "Chỉnh sửa" : "Thêm mới"
992
+ ] }) }), /* @__PURE__ */ O("div", {
993
+ className: `mb-3 ${this.fluid ? "container-fluid" : "container"}`,
994
+ children: [
995
+ /* @__PURE__ */ D(q, {
996
+ adminUri: this.ADMIN_URI,
997
+ title: this.title,
998
+ cUri: this.cUri,
999
+ isSave: !1,
1000
+ itemId: o?.id
1001
+ }),
1002
+ /* @__PURE__ */ D("div", { dangerouslySetInnerHTML: { __html: i(this.state.error) } }),
1003
+ /* @__PURE__ */ D("div", {
1004
+ className: "position-relative",
1005
+ children: /* @__PURE__ */ D(f, {
1006
+ loading: !!this.state.loading,
1007
+ style: {
1008
+ minHeight: 200,
1009
+ marginTop: 0
1010
+ },
1011
+ children: this.renderForm()
1012
+ })
1013
+ })
1014
+ ]
1015
+ })] });
1016
+ }
1017
+ handleDetailSubmit = async (e, t) => {
1018
+ try {
1019
+ if (this.state.item?.id && e?.length) {
1020
+ let r = {};
1021
+ r.itemid = this.state.item?.id, r.details = e, n(t, !0), await o(this.urlUpdateDetail, r), n(t, !1), c("Thêm tài sản thành công", "top-end", !0), await this.editDetailAfter(this.state.item?.id), this.props.navigate(this.cUri + "/edit/" + this.state.item?.id);
1022
+ }
1023
+ } catch (e) {
1024
+ s(e.message), n(t, !1);
1025
+ }
1026
+ };
1027
+ editDetailAfter = async (e) => {};
1028
+ }, ee = class extends Q {
1029
+ urlGetDeTableList = "";
1030
+ urlGetDeTable = "";
1031
+ urlCreDeTable = "";
1032
+ urlEditDeTable = "";
1033
+ urlDelDeTable = "";
1034
+ modalRef;
1035
+ isBackUri = !1;
1036
+ constructor(e) {
1037
+ super(e), this.modalRef = T();
1038
+ }
1039
+ async fetchDataDetails() {
1040
+ return {};
1041
+ }
1042
+ render() {
1043
+ let e = r(), { isCre: t, isEdit: n, isDetail: i, item: a } = this.state;
1044
+ return t === !1 && n === !1 && i === !1 || t === !1 && e === 0 || (n === !1 || i === !1) && e ? /* @__PURE__ */ D(J, {
1045
+ cUriTitle: this.title,
1046
+ cUri: this.cUri,
1047
+ title: this.title + " | " + (e ? "Chỉnh sửa" : "Thêm mới"),
1048
+ fluid: this.fluid
1049
+ }) : e && a === !1 ? /* @__PURE__ */ D(Y, {
1050
+ cUriTitle: this.title,
1051
+ cUri: this.cUri,
1052
+ title: this.title + " | " + (e ? "Chỉnh sửa" : "Thêm mới")
1053
+ }) : (e && a || !e) && /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(j, { children: /* @__PURE__ */ O("title", { children: [
1054
+ this.title,
1055
+ " | ",
1056
+ a?.id ? "Chỉnh sửa" : "Thêm mới"
1057
+ ] }) }), /* @__PURE__ */ O("div", {
1058
+ className: `mb-3 ${this.fluid ? "container-fluid" : "container"}`,
1059
+ children: [
1060
+ /* @__PURE__ */ D(q, {
1061
+ adminUri: this.ADMIN_URI,
1062
+ title: this.title,
1063
+ cUri: this.cUri,
1064
+ isSave: !1,
1065
+ itemId: this.state?.item?.id
1066
+ }),
1067
+ a && this.renderDeTable(),
1068
+ this.renderForm()
1069
+ ]
1070
+ })] });
1071
+ }
1072
+ renderDeTable() {
1073
+ return /* @__PURE__ */ D(E, {});
1074
+ }
1075
+ renderModalDeBody = (e, t) => /* @__PURE__ */ D(E, {});
1076
+ handleDetailSubmit = async (e) => {
1077
+ e.preventDefault();
1078
+ };
1079
+ editDetailAfter = async (e) => {};
1080
+ };
1081
+ //#endregion
1082
+ export { U as a, K as i, $ as n, B as o, Q as r, I as s, ee as t };