trithuc-mvc-react 1.6.2 → 1.6.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.
|
@@ -2,7 +2,7 @@ import { Checkbox, TableRow, TableCell, TableHead as MuiTableHead, useTheme, use
|
|
|
2
2
|
import { useDataTable, usePermission } from "./hooks";
|
|
3
3
|
export function TableHead({ numSelected, rowCount, onSelectAllClick, headLabel }) {
|
|
4
4
|
const { canEdit } = usePermission();
|
|
5
|
-
const { disableStatus } = useDataTable();
|
|
5
|
+
const { disableStatus,disableCellThaoTac } = useDataTable();
|
|
6
6
|
const theme = useTheme();
|
|
7
7
|
const downXl = useMediaQuery(theme.breakpoints.down("xl"));
|
|
8
8
|
return (
|
|
@@ -23,7 +23,7 @@ export function TableHead({ numSelected, rowCount, onSelectAllClick, headLabel }
|
|
|
23
23
|
</TableCell>
|
|
24
24
|
))}
|
|
25
25
|
{!disableStatus && canEdit && <TableCell sx={{ textAlign: "center" }}>Kích hoạt</TableCell>}
|
|
26
|
-
<TableCell sx={{ minWidth: "136px", textAlign: "center" }}>Thao tác</TableCell>
|
|
26
|
+
{!disableCellThaoTac && <TableCell sx={{ minWidth: "136px", textAlign: "center" }}>Thao tác</TableCell>}
|
|
27
27
|
</TableRow>
|
|
28
28
|
</MuiTableHead>
|
|
29
29
|
);
|
|
@@ -9,7 +9,7 @@ import MoreMenu from "../MoreMenu";
|
|
|
9
9
|
import { useMemo } from "react";
|
|
10
10
|
|
|
11
11
|
export const TableRowRender = ({ index, row, selected, onSelect, onChangeStatus, onDelete, onEdit }) => {
|
|
12
|
-
const { selectedField, columns, statusKey, disableStatus, tableActions } = useDataTable();
|
|
12
|
+
const { selectedField, columns, statusKey, disableStatus, tableActions,disableCellThaoTac } = useDataTable();
|
|
13
13
|
const { canEdit, canDelete, canView, canAction } = usePermission();
|
|
14
14
|
|
|
15
15
|
const { tableActionsOnTable, tableActionsOnMoreMenu } = useMemo(() => {
|
|
@@ -68,7 +68,7 @@ export const TableRowRender = ({ index, row, selected, onSelect, onChangeStatus,
|
|
|
68
68
|
</TableCell>
|
|
69
69
|
)}
|
|
70
70
|
|
|
71
|
-
<TableCell align="center">
|
|
71
|
+
{!disableCellThaoTac && <TableCell align="center">
|
|
72
72
|
{canEdit && (
|
|
73
73
|
<Tooltip title="Chỉnh sửa">
|
|
74
74
|
<IconButton onClick={() => onEdit(row)}>
|
|
@@ -101,7 +101,7 @@ export const TableRowRender = ({ index, row, selected, onSelect, onChangeStatus,
|
|
|
101
101
|
))}
|
|
102
102
|
|
|
103
103
|
{<MoreMenu actions={tableActionsOnMoreMenu} data={row} />}
|
|
104
|
-
</TableCell>
|
|
104
|
+
</TableCell>}
|
|
105
105
|
</TableRow>
|
|
106
106
|
);
|
|
107
107
|
};
|
|
@@ -32,6 +32,8 @@ DataManagement.propTypes = {
|
|
|
32
32
|
editorFields: PropTypes.array,
|
|
33
33
|
validationSchema: PropTypes.object,
|
|
34
34
|
disableStatus: PropTypes.bool,
|
|
35
|
+
disableAdd: PropTypes.bool,
|
|
36
|
+
disableCellThaoTac: PropTypes.bool,
|
|
35
37
|
statusKey: PropTypes.string,
|
|
36
38
|
tableActions: PropTypes.array,
|
|
37
39
|
disableEditor: PropTypes.bool,
|
|
@@ -50,6 +52,8 @@ function DataManagement({
|
|
|
50
52
|
validationSchema = {},
|
|
51
53
|
statusKey = "Status",
|
|
52
54
|
disableStatus = false,
|
|
55
|
+
disableAdd = false,
|
|
56
|
+
disableCellThaoTac = false,
|
|
53
57
|
tableActions = [],
|
|
54
58
|
disableEditor = false,
|
|
55
59
|
onAddClick = () => {},
|
|
@@ -107,7 +111,8 @@ function DataManagement({
|
|
|
107
111
|
validationSchema,
|
|
108
112
|
statusKey,
|
|
109
113
|
disableStatus,
|
|
110
|
-
|
|
114
|
+
disableCellThaoTac,
|
|
115
|
+
disableAdd,
|
|
111
116
|
tableActions
|
|
112
117
|
};
|
|
113
118
|
}, [tableName, selectedField, columns, selectedEditItem, dataSearch, setDataSearch, validationSchema, tableActions]);
|
|
@@ -119,7 +124,6 @@ function DataManagement({
|
|
|
119
124
|
}, [Permission, setPermission]);
|
|
120
125
|
const methods = useForm({ defaultValues: {} });
|
|
121
126
|
const { reset, setValue } = methods;
|
|
122
|
-
|
|
123
127
|
return (
|
|
124
128
|
<>
|
|
125
129
|
<DataTableContext.Provider value={values}>
|
|
@@ -148,20 +152,22 @@ function DataManagement({
|
|
|
148
152
|
|
|
149
153
|
<ExportExcelButton tableName={tableName} data={dataSearch} size={elementSize} />
|
|
150
154
|
{(!Permission || Permission.Create) && (
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
155
|
+
(!disableAdd) && (
|
|
156
|
+
<Button
|
|
157
|
+
size={elementSize}
|
|
158
|
+
variant="contained"
|
|
159
|
+
startIcon={<Add />}
|
|
160
|
+
onClick={(e) => {
|
|
161
|
+
if (!disableEditor) {
|
|
162
|
+
setOpenEditorDialog(true);
|
|
163
|
+
setSelectedEditItem(null);
|
|
164
|
+
}
|
|
165
|
+
onAddClick(e);
|
|
166
|
+
}}
|
|
167
|
+
>
|
|
168
|
+
Thêm
|
|
169
|
+
</Button>
|
|
170
|
+
)
|
|
165
171
|
)}
|
|
166
172
|
</Stack>
|
|
167
173
|
</Stack>
|
|
@@ -20,7 +20,8 @@ import {
|
|
|
20
20
|
ListItemText,
|
|
21
21
|
ListItemSecondaryAction,
|
|
22
22
|
IconButton,
|
|
23
|
-
Avatar
|
|
23
|
+
Avatar,
|
|
24
|
+
Link
|
|
24
25
|
} from "@mui/material";
|
|
25
26
|
// utils
|
|
26
27
|
import { bytesToSize, fData } from "../../../utils";
|
|
@@ -31,6 +32,7 @@ import FileUploadOutlinedIcon from "@mui/icons-material/FileUploadOutlined";
|
|
|
31
32
|
// import { UploadIllustration } from '../../assets';
|
|
32
33
|
|
|
33
34
|
// ----------------------------------------------------------------------
|
|
35
|
+
let URL_APPLICATION = document.querySelector("#URL_APPLICATION").value;
|
|
34
36
|
|
|
35
37
|
const DropZoneStyle = styled("div")(({ theme }) => ({
|
|
36
38
|
outline: "none",
|
|
@@ -204,12 +206,14 @@ export default function UploadMultiFile({ error, showPreview = false, files, onR
|
|
|
204
206
|
{/* <Icon icon={fileFill} width={28} height={28} /> */}
|
|
205
207
|
<TextSnippetOutlinedIcon color="info" />
|
|
206
208
|
</ListItemIcon>
|
|
207
|
-
<
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
209
|
+
<Link href={URL_APPLICATION + file?.urlFile}>
|
|
210
|
+
<ListItemText
|
|
211
|
+
primary={isString(file) ? file : name}
|
|
212
|
+
secondary={isString(file) ? "" : size}
|
|
213
|
+
primaryTypographyProps={{ variant: "subtitle2" }}
|
|
214
|
+
secondaryTypographyProps={{ variant: "caption" }}
|
|
215
|
+
/>
|
|
216
|
+
</Link>
|
|
213
217
|
<ListItemSecondaryAction>
|
|
214
218
|
<IconButton edge="end" size="small" onClick={() => onRemove(file)}>
|
|
215
219
|
<CloseIcon />
|