aq-fe-framework 0.1.155 → 0.1.156
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/apiFactory.ts +46 -0
- package/dist/api/baseAxios.ts +22 -0
- package/dist/app/admin/(core)/core12196/page.tsx +13 -0
- package/dist/app/admin/(core)/core16209/page.tsx +13 -0
- package/dist/app/admin/(core)/core18256/page.tsx +12 -0
- package/dist/app/admin/(core)/core26965/page.tsx +13 -0
- package/dist/app/admin/(core)/core27311/page.tsx +13 -0
- package/dist/app/admin/(core)/core38677/page.tsx +13 -0
- package/dist/app/admin/(core)/core40207/page.tsx +13 -0
- package/dist/app/admin/(core)/core60524/page.tsx +11 -0
- package/dist/app/admin/(core)/core64229/page.tsx +12 -0
- package/dist/app/admin/(core)/core71678/page.tsx +11 -0
- package/dist/app/admin/(core)/core76318/page.tsx +13 -0
- package/dist/app/admin/(core)/core83092/page.tsx +13 -0
- package/dist/app/admin/[...slug]/page.tsx +7 -0
- package/dist/app/admin/error.tsx +42 -0
- package/dist/app/admin/layout.tsx +21 -0
- package/dist/app/admin/test/page.tsx +44 -0
- package/dist/app/auth/login/page.tsx +14 -0
- package/dist/app/globals.css +59 -0
- package/dist/app/layout.tsx +39 -0
- package/dist/app/page.tsx +18 -0
- package/dist/{chunk-PAHZ57DT.mjs → chunk-JLT4BL7I.mjs} +1 -1
- package/dist/components/Aceternity/BoxesBackground/MyBoxes.tsx +66 -0
- package/dist/components/Aceternity/BoxesBackground/MyBoxesBackground.tsx +31 -0
- package/dist/components/ActionIcons/ActionIcon/MyActionIcon.tsx +47 -0
- package/dist/components/ActionIcons/ActionIconCRUD/MyActionIconDelete.tsx +81 -0
- package/dist/components/ActionIcons/ActionIconCRUD/MyActionIconUpdate.tsx +68 -0
- package/dist/components/ActionIcons/ActionIconCheck/MyActionIconCheck.tsx +50 -0
- package/dist/components/ActionIcons/ActionIconDownloadPDF/MyActionIconDownloadPDF.tsx +13 -0
- package/dist/components/ActionIcons/ActionIconModal/MyActionIconModal.tsx +113 -0
- package/dist/components/ActionIcons/ActionIconUpload/MyActionIconUpload.tsx +19 -0
- package/dist/components/ActionIcons/ActionIconViewPdf/MyActionIconViewPDF.tsx +63 -0
- package/dist/components/ActionIcons/SwitchTheme/MySwitchTheme.tsx +36 -0
- package/dist/components/AppSpotlight/MyAppSpotlight.tsx +112 -0
- package/dist/components/Buttons/Anchor/MyAnchorViewPDF.tsx +46 -0
- package/dist/components/Buttons/Button/MyButton.tsx +90 -0
- package/dist/components/Buttons/ButtonCRUD/AQButtonCreateByImportFile.tsx +81 -0
- package/dist/components/Buttons/ButtonCRUD/AQButtonExportData.tsx +75 -0
- package/dist/components/Buttons/ButtonCRUD/MyButtonCreate.tsx +68 -0
- package/dist/components/Buttons/ButtonImport/MyButtonImport.tsx +29 -0
- package/dist/components/Buttons/ButtonImport/SelectFieldModal.tsx +100 -0
- package/dist/components/Buttons/ButtonImport/SelectFileModal.tsx +81 -0
- package/dist/components/Buttons/ButtonImport/useS_ButtonImport.ts +196 -0
- package/dist/components/Buttons/ButtonModal/AQSelectTableByOpenModal.tsx +71 -0
- package/dist/components/Buttons/ButtonModal/MyButtonModal.tsx +117 -0
- package/dist/components/Buttons/ButtonPrintPDF/MyButtonPrintPDF.tsx +37 -0
- package/dist/components/Buttons/ButtonPrintPDFTable/MyButtonPrintTablePDF.tsx +174 -0
- package/dist/components/Buttons/ButtonRouterBack/MyButtonRouterBack.tsx +29 -0
- package/dist/components/Buttons/ButtonViewPDF/MyButtonViewPDF.tsx +121 -0
- package/dist/components/Calendar/MyCalendar.tsx +118 -0
- package/dist/components/CenterFull/MyCenterFull.tsx +10 -0
- package/dist/components/Checkbox/MyCheckbox.tsx +9 -0
- package/dist/components/Combobox/Select/MySelect.tsx +12 -0
- package/dist/components/DataDisplay/Card/AQCard.tsx +49 -0
- package/dist/components/DataDisplay/CardInformation/MyCardInformation.tsx +77 -0
- package/dist/components/DataDisplay/DataTable/MyDataTable.tsx +184 -0
- package/dist/components/DataDisplay/IconText/MyIconText.tsx +17 -0
- package/dist/components/DataDisplay/KeyLabel/MyKeyLabel.tsx +15 -0
- package/dist/components/DataDisplay/NumberFormatter/MyNumberFormatter.tsx +9 -0
- package/dist/components/DataDisplay/StatCard/AQStatCard1.tsx +68 -0
- package/dist/components/FaviconSetter/FaviconSetter.tsx +33 -0
- package/dist/components/Inputs/DateInput/MyDateInput.tsx +11 -0
- package/dist/components/Inputs/Fieldset/MyFieldset.tsx +32 -0
- package/dist/components/Inputs/FileInput/MyFileInput.tsx +12 -0
- package/dist/components/Inputs/NumberInput/MyNumberInput.tsx +12 -0
- package/dist/components/Inputs/TextArea/MyTextArea.tsx +11 -0
- package/dist/components/Inputs/TextEditor/MyTextEditor.tsx +191 -0
- package/dist/components/Inputs/TextInput/MyTextInput.tsx +30 -0
- package/dist/components/Layouts/BasicAppShell/BasicAppShell.tsx +357 -0
- package/dist/components/Layouts/BasicAppShell/css.module.css +62 -0
- package/dist/components/Layouts/BasicAppShell/useS_BasicAppShell.ts +64 -0
- package/dist/components/Layouts/Container/MyContainer.tsx +16 -0
- package/dist/components/Layouts/FlexColumn/MyFlexColumn.tsx +14 -0
- package/dist/components/Layouts/FlexEnd/MyFlexEnd.tsx +14 -0
- package/dist/components/Layouts/FlexRow/MyFlexRow.tsx +14 -0
- package/dist/components/Layouts/HeaderMegaMenu/HeaderMegaMenu.tsx +147 -0
- package/dist/components/Layouts/HeaderMegaMenu/HeaderMegaMenuStore.ts +19 -0
- package/dist/components/Layouts/HeaderMegaMenu/css.module.css +50 -0
- package/dist/components/Layouts/HtmlWrapper/MyHtmlWrapper.tsx +29 -0
- package/dist/components/Layouts/PageContent/MyPageContent.tsx +67 -0
- package/dist/components/Layouts/Tab/MyTab.tsx +33 -0
- package/dist/components/Loaders/MyCardioLoader.tsx +12 -0
- package/dist/components/RESTAPIComponents/DataTableSelect/MyDataTableSelect.tsx +61 -0
- package/dist/components/RESTAPIComponents/SelectAPIGet/MySelectAPIGet.tsx +37 -0
- package/dist/components/ScheduleX/MyScheduleX.tsx +58 -0
- package/dist/components/Skeletons/SkeletonTable/MySkeletonTable.tsx +9 -0
- package/dist/components/index.mjs +1 -1
- package/dist/components/index.ts +62 -0
- package/dist/constants/array/daysOfWeek.ts +9 -0
- package/dist/constants/enum/ENUM_EMAILCONFIG.ts +6 -0
- package/dist/constants/enum/global.ts +26 -0
- package/dist/constants/object/color.ts +5 -0
- package/dist/constants/object/documentTypes.ts +8 -0
- package/dist/{components/index.css → css.module-4ICLUKPO.module.css} +29 -16
- package/dist/css.module-P45UW6UZ.module.css +4 -0
- package/dist/data/menuData.ts +31 -0
- package/dist/hooks/custom-hooks/useC_MutationAction.tsx +36 -0
- package/dist/hooks/index.ts +2 -0
- package/dist/hooks/query/AQ/useQ_AQ_GetAQModule.ts +14 -0
- package/dist/interfaces/EmailConfig.ts +10 -0
- package/dist/interfaces/IAQModule.ts +21 -0
- package/dist/interfaces/base.ts +9 -0
- package/dist/interfaces/global-interface/IAQSSO.ts +15 -0
- package/dist/interfaces/global-interface/IAQSyncData.ts +9 -0
- package/dist/interfaces/global-interface/IAcademicYear.ts +12 -0
- package/dist/interfaces/global-interface/IChangePassWord.ts +8 -0
- package/dist/interfaces/global-interface/IComplaintProccess.ts +9 -0
- package/dist/interfaces/global-interface/ICreateAccount.ts +24 -0
- package/dist/interfaces/global-interface/IDocument.ts +25 -0
- package/dist/interfaces/global-interface/IDocumentAttribute.ts +12 -0
- package/dist/interfaces/global-interface/IEvent.ts +30 -0
- package/dist/interfaces/global-interface/IEventComplaint.ts +20 -0
- package/dist/interfaces/global-interface/IEventFillter.ts +14 -0
- package/dist/interfaces/global-interface/IFile.ts +8 -0
- package/dist/interfaces/global-interface/IImportStudentPaticipation.ts +8 -0
- package/dist/interfaces/global-interface/IPagePermission.ts +12 -0
- package/dist/interfaces/global-interface/IRolePermission.ts +7 -0
- package/dist/interfaces/global-interface/ISRMUserinfo.ts +35 -0
- package/dist/interfaces/global-interface/IScientificProfileProjectUser.ts +15 -0
- package/dist/interfaces/global-interface/IScientificProfileResearchGroup.ts +15 -0
- package/dist/interfaces/global-interface/IScientificProfileResearchGroupUser.ts +14 -0
- package/dist/interfaces/global-interface/IScientificProfileResearchProject.ts +21 -0
- package/dist/interfaces/global-interface/ISignIn.ts +7 -0
- package/dist/interfaces/global-interface/ISystemCatalogAcademicYear.ts +15 -0
- package/dist/interfaces/global-interface/ISystemCatalogDomainCategory.ts +11 -0
- package/dist/interfaces/global-interface/ISystemCatalogProjectLevelCategory.ts +11 -0
- package/dist/interfaces/global-interface/ISystemCatalogProjectTypeCategory.ts +11 -0
- package/dist/interfaces/global-interface/ISystemCatalogRoleActivity.ts +11 -0
- package/dist/interfaces/global-interface/ISystemCatalogTaskCategory.ts +11 -0
- package/dist/interfaces/global-interface/ISystemManagementAcademicHistory.ts +31 -0
- package/dist/interfaces/global-interface/ISystemManagementProfessionalWorkHistory.ts +14 -0
- package/dist/interfaces/global-interface/ISystemManagementPublishedScientificWork.ts +14 -0
- package/dist/interfaces/global-interface/ISystemManagementRoleGroup.ts +12 -0
- package/dist/interfaces/global-interface/ISystemManagementRoleGroupMenuPermission.ts +18 -0
- package/dist/interfaces/global-interface/ISystemManagementScientificResearchProject.ts +16 -0
- package/dist/interfaces/global-interface/ISystemManagementUserMenuPermission.ts +18 -0
- package/dist/interfaces/global-interface/IUpdateAccount.ts +15 -0
- package/dist/interfaces/global-interface/IUser.ts +21 -0
- package/dist/interfaces/global-interface/IUserPermission.ts +7 -0
- package/dist/lib/utils.ts +6 -0
- package/dist/modules-features/admin/core/MainDashboard/BarChart_CourseStatus.tsx +87 -0
- package/dist/modules-features/admin/core/MainDashboard/BarChart_ExamStatus.tsx +65 -0
- package/dist/modules-features/admin/core/MainDashboard/BarChart_RevenueByAcademicYear.tsx +82 -0
- package/dist/modules-features/admin/core/MainDashboard/BarChart_StudentStatusIn30Days.tsx +67 -0
- package/dist/modules-features/admin/core/MainDashboard/HBarChart_CourseDropOutPercentage.tsx +77 -0
- package/dist/modules-features/admin/core/MainDashboard/HBarChart_CourseProgressPercentage.tsx +77 -0
- package/dist/modules-features/admin/core/MainDashboard/LineChart_RevenueIn12Months.tsx +78 -0
- package/dist/modules-features/admin/core/MainDashboard/LineChart_TotalRevenueByDiscountIn3Months.tsx +69 -0
- package/dist/modules-features/admin/core/MainDashboard/LineChart_TotalRevenueByVoucherIn3Months.tsx +69 -0
- package/dist/modules-features/admin/core/MainDashboard/LineChart_TotalStudentIn12Months.tsx +64 -0
- package/dist/modules-features/admin/core/MainDashboard/ViewDiscountStat.tsx +311 -0
- package/dist/modules-features/admin/core/MainDashboard/ViewVoucherStat.tsx +311 -0
- package/dist/modules-features/admin/core/core12196/F_core12196.tsx +20 -0
- package/dist/modules-features/admin/core/core12196/F_core12196_Create.tsx +101 -0
- package/dist/modules-features/admin/core/core12196/F_core12196_Delete.tsx +19 -0
- package/dist/modules-features/admin/core/core12196/F_core12196_Read.tsx +165 -0
- package/dist/modules-features/admin/core/core12196/F_core12196_Update.tsx +112 -0
- package/dist/modules-features/admin/core/core16209/F_core16209.tsx +108 -0
- package/dist/modules-features/admin/core/core16209/F_core16209_Create.tsx +112 -0
- package/dist/modules-features/admin/core/core16209/F_core16209_Delete.tsx +17 -0
- package/dist/modules-features/admin/core/core16209/F_core16209_Update.tsx +114 -0
- package/dist/modules-features/admin/core/core18256/F_core18256.tsx +29 -0
- package/dist/modules-features/admin/core/core18256/F_core18256_Create.tsx +34 -0
- package/dist/modules-features/admin/core/core18256/F_core18256_Delete.tsx +14 -0
- package/dist/modules-features/admin/core/core18256/F_core18256_Read.tsx +59 -0
- package/dist/modules-features/admin/core/core18256/F_core18256_Select.tsx +40 -0
- package/dist/modules-features/admin/core/core18256/F_core18256_Update.tsx +22 -0
- package/dist/modules-features/admin/core/core26965/F_core26965.tsx +17 -0
- package/dist/modules-features/admin/core/core26965/F_core26965_Create.tsx +106 -0
- package/dist/modules-features/admin/core/core26965/F_core26965_Delete.tsx +19 -0
- package/dist/modules-features/admin/core/core26965/F_core26965_Read.tsx +165 -0
- package/dist/modules-features/admin/core/core26965/F_core26965_Update.tsx +112 -0
- package/dist/modules-features/admin/core/core27311/F_core27311.tsx +21 -0
- package/dist/modules-features/admin/core/core27311/F_core27311_Create.tsx +109 -0
- package/dist/modules-features/admin/core/core27311/F_core27311_Delete.tsx +19 -0
- package/dist/modules-features/admin/core/core27311/F_core27311_Read.tsx +165 -0
- package/dist/modules-features/admin/core/core27311/F_core27311_Update.tsx +113 -0
- package/dist/modules-features/admin/core/core35923/F_core35923.tsx +46 -0
- package/dist/modules-features/admin/core/core38677/F_core38677.tsx +28 -0
- package/dist/modules-features/admin/core/core38677/F_core38677_ReadUser.tsx +79 -0
- package/dist/modules-features/admin/core/core38677/F_core38677_Save.tsx +52 -0
- package/dist/modules-features/admin/core/core38677/F_core38677_ViewMenuPermissions.tsx +264 -0
- package/dist/modules-features/admin/core/core40207/F_core40207.tsx +9 -0
- package/dist/modules-features/admin/core/core40207/F_core40207_Create.tsx +81 -0
- package/dist/modules-features/admin/core/core40207/F_core40207_Delete.tsx +17 -0
- package/dist/modules-features/admin/core/core40207/F_core40207_Read.tsx +98 -0
- package/dist/modules-features/admin/core/core40207/F_core40207_Update.tsx +83 -0
- package/dist/modules-features/admin/core/core47643/F_core47643.tsx +10 -0
- package/dist/modules-features/admin/core/core47643/F_core47643_Delete.tsx +13 -0
- package/dist/modules-features/admin/core/core47643/F_core47643_Form.tsx +34 -0
- package/dist/modules-features/admin/core/core47643/F_core47643_Read.tsx +57 -0
- package/dist/modules-features/admin/core/core60524/F_core60524.tsx +13 -0
- package/dist/modules-features/admin/core/core60524/F_core60524_Form.tsx +111 -0
- package/dist/modules-features/admin/core/core60524/F_core60524_Save.tsx +56 -0
- package/dist/modules-features/admin/core/core60524/useS_core60524.ts +16 -0
- package/dist/modules-features/admin/core/core64229/F_core64229.tsx +7 -0
- package/dist/modules-features/admin/core/core64229/F_core64229_Delete.tsx +21 -0
- package/dist/modules-features/admin/core/core64229/F_core64229_Form.tsx +95 -0
- package/dist/modules-features/admin/core/core64229/F_core64229_Read.tsx +67 -0
- package/dist/modules-features/admin/core/core71678/F_core71678.tsx +8 -0
- package/dist/modules-features/admin/core/core71678/F_core71678_ChangePermission.tsx +117 -0
- package/dist/modules-features/admin/core/core71678/F_core71678_Create.tsx +61 -0
- package/dist/modules-features/admin/core/core71678/F_core71678_Delete.tsx +16 -0
- package/dist/modules-features/admin/core/core71678/F_core71678_Read.tsx +92 -0
- package/dist/modules-features/admin/core/core71678/F_core71678_Update.tsx +49 -0
- package/dist/modules-features/admin/core/core76318/F_core76318.tsx +9 -0
- package/dist/modules-features/admin/core/core76318/F_core76318_Create.tsx +89 -0
- package/dist/modules-features/admin/core/core76318/F_core76318_Delete.tsx +17 -0
- package/dist/modules-features/admin/core/core76318/F_core76318_Read.tsx +104 -0
- package/dist/modules-features/admin/core/core76318/F_core76318_Update.tsx +89 -0
- package/dist/modules-features/admin/core/core83092/F_core83092.tsx +27 -0
- package/dist/modules-features/admin/core/core83092/F_core83092_ReadUser.tsx +85 -0
- package/dist/modules-features/admin/core/core83092/F_core83092_Save.tsx +52 -0
- package/dist/modules-features/admin/core/core83092/F_core83092_ViewMenuPermissions.tsx +263 -0
- package/dist/modules-features/admin/core/core83092/useS_core83092.tsx +70 -0
- package/dist/modules-features/authenticate/F_authenticate_Login/F_authenticate_Login.tsx +154 -0
- package/dist/modules-features/authenticate/F_authenticate_Login/css.module.css +4 -0
- package/dist/modules-features/authenticate/F_authenticate_Logout.tsx +22 -0
- package/dist/modules-features/authenticate/F_authenticate_SplashPage.tsx +21 -0
- package/dist/modules-features/authenticate/useS_authenticate.ts +23 -0
- package/dist/modules-features/index.mjs +2 -2
- package/dist/modules-features/index.ts +79 -0
- package/dist/providers/MyMantineProvider.tsx +140 -0
- package/dist/providers/MyReactQueryProvider.tsx +24 -0
- package/dist/providers/Provider.tsx +13 -0
- package/dist/providers/mantine.module.css +21 -0
- package/dist/stores/CreateGenericStore.ts +23 -0
- package/dist/stores/index.ts +1 -0
- package/dist/types/types.ts +16 -0
- package/dist/utils/index.ts +9 -0
- package/dist/utils/utils_converter.ts +39 -0
- package/dist/utils/utils_currency.ts +5 -0
- package/dist/utils/utils_date.ts +34 -0
- package/dist/utils/utils_excel.ts +128 -0
- package/dist/utils/utils_file.ts +61 -0
- package/dist/utils/utils_notification.ts +46 -0
- package/dist/utils/utils_pdf.ts +21 -0
- package/dist/utils/utils_time.ts +15 -0
- package/dist/utils/utils_validateForm.ts +9 -0
- package/package.json +1 -1
- package/dist/modules-features/index.css +0 -100
@@ -0,0 +1,264 @@
|
|
1
|
+
'use client'
|
2
|
+
import baseAxios from "@/api/baseAxios";
|
3
|
+
import { MyCenterFull } from "@/components/CenterFull/MyCenterFull";
|
4
|
+
import { groupToTwoLevels, I_BasicAppShell_LinkItem, utils_layout_getItemsWithoutLinks } from "@/components/Layouts/BasicAppShell/BasicAppShell";
|
5
|
+
import { MyFlexRow } from "@/components/Layouts/FlexRow/MyFlexRow";
|
6
|
+
import { OBJECT_COlORS } from "@/constants/object/color";
|
7
|
+
import { menuData } from "@/data/menuData";
|
8
|
+
import { Checkbox, Flex, ScrollArea, Table, Text } from "@mantine/core";
|
9
|
+
import { IconEdit, IconEyeUp, IconFileExport, IconPlus, IconPrinter, IconTrash } from "@tabler/icons-react";
|
10
|
+
import { useQuery } from "@tanstack/react-query";
|
11
|
+
import React, { useEffect, useState } from "react";
|
12
|
+
import { I_core83092_RolePermission, useS_core83092, utils_core83092_mergePage } from "../core83092/useS_core83092";
|
13
|
+
|
14
|
+
const title = "Danh sách chức năng"
|
15
|
+
export function F_core38677_ViewMenuPermissions({ menuData }: { menuData: I_BasicAppShell_LinkItem[] }) {
|
16
|
+
const store = useS_core83092()
|
17
|
+
const query = useGetUserPermission()
|
18
|
+
const list = useState<I_BasicAppShell_LinkItem[]>([])
|
19
|
+
useEffect(() => {
|
20
|
+
list[1](groupToTwoLevels(menuData))
|
21
|
+
}, [])
|
22
|
+
|
23
|
+
useEffect(() => {
|
24
|
+
if (!query.data) return
|
25
|
+
store.setProperty("rolePermissions", query.data)
|
26
|
+
|
27
|
+
}, [query.data])
|
28
|
+
if (list[0]?.length == 0) return "Đang tải..."
|
29
|
+
return (
|
30
|
+
<ScrollArea.Autosize h={'70vh'} >
|
31
|
+
<Table>
|
32
|
+
<Table.Thead
|
33
|
+
bg={"light-dark(var(--mantine-color-white), var(--mantine-color-dark-8))"}
|
34
|
+
style={{
|
35
|
+
position: 'sticky',
|
36
|
+
top: 0, zIndex: 1,
|
37
|
+
boxShadow: '0px 4px 6px rgba(0, 0, 0, 0.1)',
|
38
|
+
border: '1px solid var(--mantine-color-gray-4)',
|
39
|
+
}}>
|
40
|
+
<Table.Tr>
|
41
|
+
<Table.Th>{title}</Table.Th>
|
42
|
+
<Table.Th >
|
43
|
+
<Flex gap={3} direction={"column"} justify={"center"} align={"center"}>
|
44
|
+
<Checkbox checked={store.isAllPermission("isRead")} onChange={(e) => {
|
45
|
+
store.toogleAllPermissionWithType("isRead", e.target.checked)
|
46
|
+
}}></Checkbox>
|
47
|
+
<MyFlexRow gap={3}>Xem<IconEyeUp color={"gray"} /></MyFlexRow>
|
48
|
+
</Flex>
|
49
|
+
</Table.Th>
|
50
|
+
<Table.Th >
|
51
|
+
<Flex gap={3} direction={"column"} justify={"center"} align={"center"}>
|
52
|
+
<Checkbox checked={store.isAllPermission("isCreate")} onChange={(e) => {
|
53
|
+
store.toogleAllPermissionWithType("isCreate", e.target.checked)
|
54
|
+
}}></Checkbox>
|
55
|
+
<MyFlexRow gap={3}>Thêm<IconPlus color={"blue"} /></MyFlexRow>
|
56
|
+
</Flex>
|
57
|
+
</Table.Th>
|
58
|
+
<Table.Th >
|
59
|
+
<Flex gap={3} direction={"column"} justify={"center"} align={"center"}>
|
60
|
+
<Checkbox checked={store.isAllPermission("isUpdate")} onChange={(e) => {
|
61
|
+
store.toogleAllPermissionWithType("isUpdate", e.target.checked)
|
62
|
+
}}></Checkbox>
|
63
|
+
<MyFlexRow gap={3}>Sửa<IconEdit color={"var(--mantine-color-yellow-8)"} /></MyFlexRow>
|
64
|
+
</Flex>
|
65
|
+
</Table.Th>
|
66
|
+
<Table.Th >
|
67
|
+
<Flex gap={3} direction={"column"} justify={"center"} align={"center"}>
|
68
|
+
<Checkbox checked={store.isAllPermission("isDelete")} onChange={(e) => {
|
69
|
+
store.toogleAllPermissionWithType("isDelete", e.target.checked)
|
70
|
+
}}></Checkbox>
|
71
|
+
<MyFlexRow gap={3}>Xóa<IconTrash color={"var(--mantine-color-red-8)"} /></MyFlexRow>
|
72
|
+
</Flex>
|
73
|
+
</Table.Th>
|
74
|
+
<Table.Th >
|
75
|
+
<Flex gap={3} direction={"column"} justify={"center"} align={"center"}>
|
76
|
+
<Checkbox checked={store.isAllPermission("isPrint")} onChange={(e) => {
|
77
|
+
store.toogleAllPermissionWithType("isPrint", e.target.checked)
|
78
|
+
}}></Checkbox>
|
79
|
+
<MyFlexRow gap={3}>In<IconPrinter color={"var(--mantine-color-cyan-8)"} /></MyFlexRow>
|
80
|
+
</Flex>
|
81
|
+
</Table.Th>
|
82
|
+
<Table.Th >
|
83
|
+
<Flex gap={3} direction={"column"} justify={"center"} align={"center"}>
|
84
|
+
<Checkbox checked={store.isAllPermission("isExport")} onChange={(e) => {
|
85
|
+
store.toogleAllPermissionWithType("isExport", e.target.checked)
|
86
|
+
}}></Checkbox>
|
87
|
+
<MyFlexRow gap={3}>Xuất<IconFileExport color={"var(--mantine-color-green-8)"} /></MyFlexRow>
|
88
|
+
</Flex>
|
89
|
+
</Table.Th>
|
90
|
+
</Table.Tr>
|
91
|
+
</Table.Thead>
|
92
|
+
<Table.Tbody bg={"light-dark(var(--mantine-color-white), var(--mantine-color-dark-8))"}>
|
93
|
+
{list[0]?.map((item, idx) => {
|
94
|
+
if (item.links == undefined) return (
|
95
|
+
<Table.Tr key={idx}>
|
96
|
+
<Table.Td>{item.label}</Table.Td>
|
97
|
+
<Table.Td >
|
98
|
+
<MyCenterFull>
|
99
|
+
<Checkbox />
|
100
|
+
</MyCenterFull>
|
101
|
+
</Table.Td>
|
102
|
+
<Table.Td>
|
103
|
+
<MyCenterFull>
|
104
|
+
<Checkbox />
|
105
|
+
</MyCenterFull>
|
106
|
+
</Table.Td>
|
107
|
+
<Table.Td>
|
108
|
+
<MyCenterFull>
|
109
|
+
<Checkbox />
|
110
|
+
</MyCenterFull>
|
111
|
+
</Table.Td>
|
112
|
+
<Table.Td>
|
113
|
+
<MyCenterFull>
|
114
|
+
<Checkbox />
|
115
|
+
</MyCenterFull>
|
116
|
+
</Table.Td>
|
117
|
+
<Table.Td>
|
118
|
+
<MyCenterFull>
|
119
|
+
<Checkbox />
|
120
|
+
</MyCenterFull>
|
121
|
+
</Table.Td>
|
122
|
+
<Table.Td>
|
123
|
+
<MyCenterFull>
|
124
|
+
<Checkbox />
|
125
|
+
</MyCenterFull>
|
126
|
+
</Table.Td>
|
127
|
+
</Table.Tr>
|
128
|
+
)
|
129
|
+
|
130
|
+
return (
|
131
|
+
<React.Fragment key={idx}>
|
132
|
+
<Table.Tr key={item.label}>
|
133
|
+
<Table.Td
|
134
|
+
colSpan={7}
|
135
|
+
bg={OBJECT_COlORS.mantineBackgroundBlueLight}>
|
136
|
+
<Text fs={"oblique"} size="sm" fw={"bold"}>
|
137
|
+
{item.label}
|
138
|
+
</Text>
|
139
|
+
</Table.Td>
|
140
|
+
</Table.Tr>
|
141
|
+
{item.links.map((item, idx) =>
|
142
|
+
<Table.Tr key={idx}>
|
143
|
+
<Table.Td>{item.label}</Table.Td>
|
144
|
+
<Table.Td >
|
145
|
+
<MyCenterFull>
|
146
|
+
<Checkbox
|
147
|
+
checked={store.findByPageId(item.pageId!)?.isRead || false}
|
148
|
+
onChange={(e) => {
|
149
|
+
store.updatePermission(item.pageId!, {
|
150
|
+
isRead: e.target.checked
|
151
|
+
})
|
152
|
+
}}
|
153
|
+
/>
|
154
|
+
</MyCenterFull>
|
155
|
+
</Table.Td>
|
156
|
+
<Table.Td>
|
157
|
+
<MyCenterFull>
|
158
|
+
<Checkbox
|
159
|
+
checked={store.findByPageId(item.pageId!)?.isCreate || false}
|
160
|
+
onChange={(e) => {
|
161
|
+
store.updatePermission(item.pageId!, {
|
162
|
+
isCreate: e.target.checked
|
163
|
+
})
|
164
|
+
}}
|
165
|
+
/>
|
166
|
+
</MyCenterFull>
|
167
|
+
</Table.Td>
|
168
|
+
<Table.Td>
|
169
|
+
<MyCenterFull>
|
170
|
+
<Checkbox
|
171
|
+
checked={store.findByPageId(item.pageId!)?.isUpdate || false}
|
172
|
+
onChange={(e) => {
|
173
|
+
store.updatePermission(item.pageId!, {
|
174
|
+
isUpdate: e.target.checked
|
175
|
+
})
|
176
|
+
}}
|
177
|
+
/>
|
178
|
+
</MyCenterFull>
|
179
|
+
</Table.Td>
|
180
|
+
<Table.Td>
|
181
|
+
<MyCenterFull>
|
182
|
+
<Checkbox
|
183
|
+
checked={store.findByPageId(item.pageId!)?.isDelete || false}
|
184
|
+
onChange={(e) => {
|
185
|
+
store.updatePermission(item.pageId!, {
|
186
|
+
isDelete: e.target.checked
|
187
|
+
})
|
188
|
+
}}
|
189
|
+
/>
|
190
|
+
</MyCenterFull>
|
191
|
+
</Table.Td>
|
192
|
+
<Table.Td>
|
193
|
+
<MyCenterFull>
|
194
|
+
<Checkbox
|
195
|
+
checked={store.findByPageId(item.pageId!)?.isPrint || false}
|
196
|
+
onChange={(e) => {
|
197
|
+
store.updatePermission(item.pageId!, {
|
198
|
+
isPrint: e.target.checked
|
199
|
+
})
|
200
|
+
}}
|
201
|
+
/>
|
202
|
+
</MyCenterFull>
|
203
|
+
</Table.Td>
|
204
|
+
<Table.Td>
|
205
|
+
<MyCenterFull>
|
206
|
+
<Checkbox
|
207
|
+
checked={store.findByPageId(item.pageId!)?.isExport || false}
|
208
|
+
onChange={(e) => {
|
209
|
+
store.updatePermission(item.pageId!, {
|
210
|
+
isExport: e.target.checked
|
211
|
+
})
|
212
|
+
}}
|
213
|
+
/>
|
214
|
+
</MyCenterFull>
|
215
|
+
</Table.Td>
|
216
|
+
</Table.Tr>
|
217
|
+
)}
|
218
|
+
</React.Fragment>
|
219
|
+
)
|
220
|
+
})}
|
221
|
+
</Table.Tbody>
|
222
|
+
</Table>
|
223
|
+
</ScrollArea.Autosize>
|
224
|
+
)
|
225
|
+
}
|
226
|
+
|
227
|
+
function useGetUserPermission() {
|
228
|
+
const store = useS_core83092()
|
229
|
+
const query = useQuery<I_core83092_RolePermission[]>({
|
230
|
+
queryKey: ['F_7p4mh9d75x_AuthorizationTable', store.state.roleId],
|
231
|
+
queryFn: async () => {
|
232
|
+
const result = await baseAxios.get('/Role/GetRolePermission?roleId=' + store.state.roleId)
|
233
|
+
const menudataFinal = utils_layout_getItemsWithoutLinks(menuData)
|
234
|
+
if (result.data.data.length == 0) {
|
235
|
+
const final = menudataFinal.map((item) => ({
|
236
|
+
pageId: item.pageId,
|
237
|
+
isRead: false,
|
238
|
+
isCreate: false,
|
239
|
+
isUpdate: false,
|
240
|
+
isDelete: false,
|
241
|
+
isExport: false,
|
242
|
+
isPrint: false,
|
243
|
+
}) as I_core83092_RolePermission)
|
244
|
+
return final.filter(item => item.pageId != undefined)
|
245
|
+
}
|
246
|
+
const menuDataFromAPI = result.data.data
|
247
|
+
const mergedArray = utils_core83092_mergePage(menudataFinal, menuDataFromAPI).map(item => ({
|
248
|
+
pageId: item.pageId,
|
249
|
+
isCreate: item.isCreate || false,
|
250
|
+
isRead: item.isRead || false,
|
251
|
+
isUpdate: item.isUpdate || false || false,
|
252
|
+
isDelete: item.isDelete,
|
253
|
+
isPrint: item.isPrint || false,
|
254
|
+
isExport: item.isExport || false
|
255
|
+
}) as I_core83092_RolePermission).filter(item => item.pageId != undefined)
|
256
|
+
return mergedArray
|
257
|
+
},
|
258
|
+
enabled: store.state.roleId != 0,
|
259
|
+
refetchOnWindowFocus: false
|
260
|
+
})
|
261
|
+
return query
|
262
|
+
}
|
263
|
+
|
264
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { MyPageContent } from "@/components";
|
2
|
+
import { F_core40207_Read } from "./F_core40207_Read";
|
3
|
+
import { OBJECT_DOCUMENT_TYPES } from "@/constants/object/documentTypes";
|
4
|
+
|
5
|
+
export function F_core40207({ GuidelineTypeId }: { GuidelineTypeId: number }) {
|
6
|
+
return (
|
7
|
+
<F_core40207_Read GuidelineTypeId={GuidelineTypeId} />
|
8
|
+
)
|
9
|
+
}
|
@@ -0,0 +1,81 @@
|
|
1
|
+
"use client";
|
2
|
+
import baseAxios from "@/api/baseAxios";
|
3
|
+
import { MyButtonCreate, MyTextInput } from "@/components";
|
4
|
+
import { OBJECT_DOCUMENT_TYPES } from "@/constants/object/documentTypes";
|
5
|
+
import { utils_file_fileToAQDocumentType } from "@/utils/utils_file";
|
6
|
+
import { FileInput } from "@mantine/core";
|
7
|
+
import { useForm } from "@mantine/form";
|
8
|
+
|
9
|
+
interface IDocument {
|
10
|
+
path?: string;
|
11
|
+
orderBy?: number;
|
12
|
+
documentType?: number;
|
13
|
+
promulgateDate?: Date;
|
14
|
+
decisionCode?: string;
|
15
|
+
departmentName?: string;
|
16
|
+
description?: string;
|
17
|
+
startDate?: Date;
|
18
|
+
endDate?: Date;
|
19
|
+
conclusion?: string;
|
20
|
+
note?: string;
|
21
|
+
documentAttributeId?: number;
|
22
|
+
documentAttributeName?: string;
|
23
|
+
isCycleCheck?: boolean;
|
24
|
+
meetingDate?: Date;
|
25
|
+
fileDetail?: {
|
26
|
+
fileBase64String?: string;
|
27
|
+
fileExtension?: string;
|
28
|
+
fileName?: string;
|
29
|
+
};
|
30
|
+
id?: number;
|
31
|
+
code?: string;
|
32
|
+
name?: string;
|
33
|
+
concurrencyStamp?: string;
|
34
|
+
isEnabled?: boolean;
|
35
|
+
ngayChinhSua?: Date;
|
36
|
+
nguoiChinhSua?: string;
|
37
|
+
}
|
38
|
+
interface I extends IDocument {
|
39
|
+
file?: File;
|
40
|
+
}
|
41
|
+
|
42
|
+
export function F_core40207_Create({ GuidelineTypeId }: { GuidelineTypeId: number }) {
|
43
|
+
const form = useForm<I>({
|
44
|
+
mode: "uncontrolled",
|
45
|
+
validate: {
|
46
|
+
code: (value) => (value ? null : "Không được để trống"),
|
47
|
+
name: (value) => (value ? null : "Không được để trống"),
|
48
|
+
file: (value) => (value ? null : "Không được để trống"),
|
49
|
+
},
|
50
|
+
});
|
51
|
+
return (
|
52
|
+
<MyButtonCreate
|
53
|
+
objectName="văn bản"
|
54
|
+
form={form}
|
55
|
+
onSubmit={async (values) => {
|
56
|
+
return await baseAxios.post("/Document/create", {
|
57
|
+
...values,
|
58
|
+
DocumentType: GuidelineTypeId, //1.4 Thông tin xây dựng, cải tiến, bảo trì hệ thống
|
59
|
+
fileDetail: await utils_file_fileToAQDocumentType(values.file!),
|
60
|
+
});
|
61
|
+
}}
|
62
|
+
>
|
63
|
+
<MyTextInput
|
64
|
+
withAsterisk
|
65
|
+
label="Mã tài liệu"
|
66
|
+
{...form.getInputProps("code")}
|
67
|
+
/>
|
68
|
+
<MyTextInput
|
69
|
+
withAsterisk
|
70
|
+
label="Tên tài liệu"
|
71
|
+
{...form.getInputProps("name")}
|
72
|
+
/>
|
73
|
+
<FileInput
|
74
|
+
withAsterisk
|
75
|
+
label="Tài liệu"
|
76
|
+
placeholder="Tải lên tài liệu"
|
77
|
+
{...form.getInputProps("file")}
|
78
|
+
/>
|
79
|
+
</MyButtonCreate>
|
80
|
+
);
|
81
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import baseAxios from "@/api/baseAxios";
|
2
|
+
import { MyActionIconDelete } from "@/components/ActionIcons/ActionIconCRUD/MyActionIconDelete";
|
3
|
+
|
4
|
+
export function F_core40207_Delete({
|
5
|
+
id,
|
6
|
+
contextData,
|
7
|
+
}: {
|
8
|
+
id: number;
|
9
|
+
contextData: string;
|
10
|
+
}) {
|
11
|
+
return (
|
12
|
+
<MyActionIconDelete
|
13
|
+
contextData={contextData}
|
14
|
+
onSubmit={() => baseAxios.post("/Document/delete", { id: id })}
|
15
|
+
/>
|
16
|
+
);
|
17
|
+
}
|
@@ -0,0 +1,98 @@
|
|
1
|
+
"use client";
|
2
|
+
import baseAxios from "@/api/baseAxios";
|
3
|
+
import { MyButtonViewPDF } from "@/components/Buttons/ButtonViewPDF/MyButtonViewPDF";
|
4
|
+
import { MyCenterFull } from "@/components/CenterFull/MyCenterFull";
|
5
|
+
import { MyDataTable } from "@/components/DataDisplay/DataTable/MyDataTable";
|
6
|
+
import { OBJECT_DOCUMENT_TYPES } from "@/constants/object/documentTypes";
|
7
|
+
import { useQuery } from "@tanstack/react-query";
|
8
|
+
import { MRT_ColumnDef } from "mantine-react-table";
|
9
|
+
import { useMemo } from "react";
|
10
|
+
import { F_core40207_Create } from "./F_core40207_Create";
|
11
|
+
import { F_core40207_Delete } from "./F_core40207_Delete";
|
12
|
+
import { F_core40207_Update } from "./F_core40207_Update";
|
13
|
+
|
14
|
+
interface I {
|
15
|
+
path?: string;
|
16
|
+
orderBy?: number;
|
17
|
+
documentType?: number;
|
18
|
+
promulgateDate?: Date;
|
19
|
+
decisionCode?: string;
|
20
|
+
departmentName?: string;
|
21
|
+
description?: string;
|
22
|
+
startDate?: Date;
|
23
|
+
endDate?: Date;
|
24
|
+
conclusion?: string;
|
25
|
+
note?: string;
|
26
|
+
documentAttributeId?: number;
|
27
|
+
documentAttributeName?: string;
|
28
|
+
isCycleCheck?: boolean;
|
29
|
+
meetingDate?: Date;
|
30
|
+
fileDetail?: {
|
31
|
+
fileBase64String?: string;
|
32
|
+
fileExtension?: string;
|
33
|
+
fileName?: string;
|
34
|
+
};
|
35
|
+
id?: number;
|
36
|
+
code?: string;
|
37
|
+
name?: string;
|
38
|
+
concurrencyStamp?: string;
|
39
|
+
isEnabled?: boolean;
|
40
|
+
ngayChinhSua?: Date;
|
41
|
+
nguoiChinhSua?: string;
|
42
|
+
}
|
43
|
+
|
44
|
+
export function F_core40207_Read({ GuidelineTypeId }: { GuidelineTypeId: number }) {
|
45
|
+
const query = useQuery<I[]>({
|
46
|
+
queryKey: ["F_core40207_Read"],
|
47
|
+
queryFn: async () => {
|
48
|
+
const result = await baseAxios.get(
|
49
|
+
`/Document/GetByType?documentType=${GuidelineTypeId}`
|
50
|
+
);
|
51
|
+
return result.data?.data || [];
|
52
|
+
},
|
53
|
+
});
|
54
|
+
const columns = useMemo<MRT_ColumnDef<I>[]>(
|
55
|
+
() => [
|
56
|
+
{
|
57
|
+
header: "Mã tài liệu",
|
58
|
+
accessorKey: "code",
|
59
|
+
},
|
60
|
+
{
|
61
|
+
header: "Tên tài liệu",
|
62
|
+
accessorKey: "name",
|
63
|
+
},
|
64
|
+
{
|
65
|
+
header: "File",
|
66
|
+
accessorFn: (row) => {
|
67
|
+
return (
|
68
|
+
<MyCenterFull>
|
69
|
+
<MyButtonViewPDF id={row.id} />
|
70
|
+
</MyCenterFull>
|
71
|
+
);
|
72
|
+
},
|
73
|
+
},
|
74
|
+
],
|
75
|
+
[]
|
76
|
+
);
|
77
|
+
|
78
|
+
if (query.isLoading) return "Loading...";
|
79
|
+
if (query.isError) return "có lỗi xảy ra!";
|
80
|
+
return (
|
81
|
+
<MyDataTable
|
82
|
+
columns={columns}
|
83
|
+
data={query.data!}
|
84
|
+
renderTopToolbarCustomActions={() => <F_core40207_Create GuidelineTypeId={GuidelineTypeId} />}
|
85
|
+
renderRowActions={({ row }) => {
|
86
|
+
return (
|
87
|
+
<MyCenterFull>
|
88
|
+
<F_core40207_Update values={row.original} />
|
89
|
+
<F_core40207_Delete
|
90
|
+
id={row.original.id!}
|
91
|
+
contextData={row.original.code!}
|
92
|
+
/>
|
93
|
+
</MyCenterFull>
|
94
|
+
);
|
95
|
+
}}
|
96
|
+
/>
|
97
|
+
);
|
98
|
+
}
|
@@ -0,0 +1,83 @@
|
|
1
|
+
import baseAxios from "@/api/baseAxios";
|
2
|
+
import { MyActionIconUpdate } from "@/components/ActionIcons/ActionIconCRUD/MyActionIconUpdate";
|
3
|
+
import { MyTextInput } from "@/components/Inputs/TextInput/MyTextInput";
|
4
|
+
import { utils_file_fileToAQDocumentType } from "@/utils/utils_file";
|
5
|
+
import { FileInput } from "@mantine/core";
|
6
|
+
import { useForm } from "@mantine/form";
|
7
|
+
interface IDocument {
|
8
|
+
path?: string;
|
9
|
+
orderBy?: number;
|
10
|
+
documentType?: number;
|
11
|
+
promulgateDate?: Date;
|
12
|
+
decisionCode?: string;
|
13
|
+
departmentName?: string;
|
14
|
+
description?: string;
|
15
|
+
startDate?: Date;
|
16
|
+
endDate?: Date;
|
17
|
+
conclusion?: string;
|
18
|
+
note?: string;
|
19
|
+
documentAttributeId?: number;
|
20
|
+
documentAttributeName?: string;
|
21
|
+
isCycleCheck?: boolean;
|
22
|
+
meetingDate?: Date;
|
23
|
+
fileDetail?: {
|
24
|
+
fileBase64String?: string;
|
25
|
+
fileExtension?: string;
|
26
|
+
fileName?: string;
|
27
|
+
};
|
28
|
+
id?: number;
|
29
|
+
code?: string;
|
30
|
+
name?: string;
|
31
|
+
concurrencyStamp?: string;
|
32
|
+
isEnabled?: boolean;
|
33
|
+
ngayChinhSua?: Date;
|
34
|
+
nguoiChinhSua?: string;
|
35
|
+
}
|
36
|
+
interface I extends IDocument {
|
37
|
+
file?: File;
|
38
|
+
}
|
39
|
+
export function F_core40207_Update({ values }: { values: I }) {
|
40
|
+
const form = useForm<I>({
|
41
|
+
mode: "uncontrolled",
|
42
|
+
initialValues: {
|
43
|
+
...values,
|
44
|
+
file: new File(
|
45
|
+
[],
|
46
|
+
values.path?.split("/")[values.path.split("/").length - 1]!
|
47
|
+
),
|
48
|
+
},
|
49
|
+
validate: {
|
50
|
+
code: (value) => (value ? null : "Không được để trống"),
|
51
|
+
name: (value) => (value ? null : "Không được để trống"),
|
52
|
+
file: (value) => (value ? null : "Không được để trống"),
|
53
|
+
},
|
54
|
+
});
|
55
|
+
return (
|
56
|
+
<MyActionIconUpdate
|
57
|
+
form={form}
|
58
|
+
onSubmit={async (values) => {
|
59
|
+
return await baseAxios.post("/Document/Update", {
|
60
|
+
...values,
|
61
|
+
fileDetail: await utils_file_fileToAQDocumentType(values.file!),
|
62
|
+
});
|
63
|
+
}}
|
64
|
+
>
|
65
|
+
<MyTextInput
|
66
|
+
withAsterisk
|
67
|
+
label="Mã tài liệu"
|
68
|
+
{...form.getInputProps("code")}
|
69
|
+
/>
|
70
|
+
<MyTextInput
|
71
|
+
withAsterisk
|
72
|
+
label="Tên tài liệu"
|
73
|
+
{...form.getInputProps("name")}
|
74
|
+
/>
|
75
|
+
<FileInput
|
76
|
+
withAsterisk
|
77
|
+
label="Tài liệu"
|
78
|
+
placeholder="Tải lên tài liệu"
|
79
|
+
{...form.getInputProps("file")}
|
80
|
+
/>
|
81
|
+
</MyActionIconUpdate>
|
82
|
+
);
|
83
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import baseAxios from '@/api/baseAxios'
|
2
|
+
import { MyActionIconDelete } from '@/components/ActionIcons/ActionIconCRUD/MyActionIconDelete'
|
3
|
+
import { IBaseEntity } from '@/interfaces/base'
|
4
|
+
|
5
|
+
const ENDPOINT = "/Role/Delete"
|
6
|
+
export function F_core47643_Delete({ values }: { values: IBaseEntity }) {
|
7
|
+
return (
|
8
|
+
<MyActionIconDelete
|
9
|
+
contextData={values.code}
|
10
|
+
onSubmit={() => baseAxios.post(ENDPOINT, { id: values.id })}
|
11
|
+
/>
|
12
|
+
)
|
13
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import baseAxios from "@/api/baseAxios";
|
2
|
+
import { MyActionIconUpdate } from "@/components/ActionIcons/ActionIconCRUD/MyActionIconUpdate";
|
3
|
+
import { MyButtonCreate } from "@/components/Buttons/ButtonCRUD/MyButtonCreate";
|
4
|
+
import { MyTextInput } from "@/components/Inputs/TextInput/MyTextInput";
|
5
|
+
import { useForm } from "@mantine/form";
|
6
|
+
|
7
|
+
interface I {
|
8
|
+
id?: number
|
9
|
+
code?: string,
|
10
|
+
name?: string
|
11
|
+
}
|
12
|
+
export function F_core47643_Form({ values }: { values?: I }) {
|
13
|
+
const form = useForm<I>({
|
14
|
+
mode: "uncontrolled",
|
15
|
+
initialValues: values
|
16
|
+
})
|
17
|
+
|
18
|
+
if (values) return (
|
19
|
+
<MyActionIconUpdate form={form} onSubmit={async () => {
|
20
|
+
return await baseAxios.post("/Role/Update", form.getValues())
|
21
|
+
}}>
|
22
|
+
<MyTextInput readOnly variant="filled" label="Mã" {...form.getInputProps("code")} />
|
23
|
+
<MyTextInput label="Quyền" {...form.getInputProps("name")} />
|
24
|
+
</MyActionIconUpdate>
|
25
|
+
)
|
26
|
+
return (
|
27
|
+
<MyButtonCreate form={form} onSubmit={async () => {
|
28
|
+
return await baseAxios.post("/Role/Create", form.getValues())
|
29
|
+
}}>
|
30
|
+
<MyTextInput label="Mã" {...form.getInputProps("code")} />
|
31
|
+
<MyTextInput label="Quyền" {...form.getInputProps("name")} />
|
32
|
+
</MyButtonCreate>
|
33
|
+
)
|
34
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import baseAxios from "@/api/baseAxios"
|
2
|
+
import { MyCenterFull } from "@/components/CenterFull/MyCenterFull"
|
3
|
+
import { MyDataTable } from "@/components/DataDisplay/DataTable/MyDataTable"
|
4
|
+
|
5
|
+
import { Group } from "@mantine/core"
|
6
|
+
import { useQuery } from "@tanstack/react-query"
|
7
|
+
import { MRT_ColumnDef } from "mantine-react-table"
|
8
|
+
import { useMemo } from "react"
|
9
|
+
import { F_core47643_Delete } from "./F_core47643_Delete"
|
10
|
+
import { F_core47643_Form } from "./F_core47643_Form"
|
11
|
+
import { IBaseEntity } from "@/interfaces/base"
|
12
|
+
|
13
|
+
interface I extends IBaseEntity { }
|
14
|
+
|
15
|
+
export function F_core47643_Read() {
|
16
|
+
const query = useQ_core47643_GetAdminRole()
|
17
|
+
const columns = useMemo<MRT_ColumnDef<I>[]>(() => [
|
18
|
+
{
|
19
|
+
header: "Mã",
|
20
|
+
accessorKey: "code"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
header: "Quyền",
|
24
|
+
accessorKey: "name"
|
25
|
+
}
|
26
|
+
], [])
|
27
|
+
if (query.isLoading) return "Đang tải dữ liệu..."
|
28
|
+
if (query.isError) return "Có lỗi xảy ra!"
|
29
|
+
return (
|
30
|
+
<MyDataTable
|
31
|
+
data={query.data!}
|
32
|
+
columns={columns}
|
33
|
+
renderTopToolbarCustomActions={() => (
|
34
|
+
<Group>
|
35
|
+
<F_core47643_Form />
|
36
|
+
</Group>
|
37
|
+
)}
|
38
|
+
renderRowActions={({ row }) => (
|
39
|
+
<MyCenterFull>
|
40
|
+
<F_core47643_Form values={row.original} />
|
41
|
+
<F_core47643_Delete values={row.original} />
|
42
|
+
</MyCenterFull>
|
43
|
+
)}
|
44
|
+
/>
|
45
|
+
)
|
46
|
+
}
|
47
|
+
|
48
|
+
function useQ_core47643_GetAdminRole() {
|
49
|
+
const query = useQuery({
|
50
|
+
queryKey: ["useQ_core47643_GetAdminRole"],
|
51
|
+
queryFn: async () => {
|
52
|
+
const res = await baseAxios.get("/Role/GetAdminRole")
|
53
|
+
return res.data.data
|
54
|
+
}
|
55
|
+
})
|
56
|
+
return query
|
57
|
+
}
|