trithuc-mvc-react 2.9.7 → 2.9.8
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.
|
@@ -6,6 +6,7 @@ import { useDataTable } from "./hooks";
|
|
|
6
6
|
|
|
7
7
|
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
|
8
8
|
import AccordionDetails from "@mui/material/AccordionDetails";
|
|
9
|
+
import moment from "moment";
|
|
9
10
|
import { DateRangePicker } from "../date";
|
|
10
11
|
|
|
11
12
|
export const FilterGod = ({ filters, elementSize = "small", setPage = () => {} }) => {
|
|
@@ -43,15 +44,22 @@ export const FilterGod = ({ filters, elementSize = "small", setPage = () => {} }
|
|
|
43
44
|
<DateRangePicker
|
|
44
45
|
label={label}
|
|
45
46
|
onChange={(value) => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
const [fromDate, toDate] = value || []; // Destructure value để đảm bảo xử lý null/undefined
|
|
48
|
+
const formattedFromDate = fromDate ? moment(fromDate).format("YYYY-MM-DD HH:mm:ss.SSS") : null;
|
|
49
|
+
const formattedToDate = toDate ? moment(toDate).format("YYYY-MM-DD HH:mm:ss.SSS") : null;
|
|
50
|
+
|
|
51
|
+
// Kiểm tra nếu field hợp lệ trước khi cập nhật
|
|
52
|
+
if (field?.[0] && field?.[1]) {
|
|
53
|
+
setDataSearch({
|
|
54
|
+
...dataSearch,
|
|
55
|
+
[field[0]]: formattedFromDate,
|
|
56
|
+
[field[1]]: formattedToDate
|
|
57
|
+
});
|
|
58
|
+
setPage(0);
|
|
59
|
+
}
|
|
52
60
|
}}
|
|
53
61
|
size={elementSize}
|
|
54
|
-
value={[dataSearch?.[field[0]], dataSearch?.[field[1]]]}
|
|
62
|
+
value={[dataSearch?.[field?.[0]] || null, dataSearch?.[field?.[1]] || null]}
|
|
55
63
|
/>
|
|
56
64
|
</Grid>
|
|
57
65
|
);
|
|
@@ -26,7 +26,7 @@ DataManagement.propTypes = {
|
|
|
26
26
|
selectedField: PropTypes.string,
|
|
27
27
|
filters: PropTypes.arrayOf(
|
|
28
28
|
PropTypes.shape({
|
|
29
|
-
field: PropTypes.string,
|
|
29
|
+
field: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]).isRequired,
|
|
30
30
|
label: PropTypes.string,
|
|
31
31
|
placeHolder: PropTypes.string,
|
|
32
32
|
type: PropTypes.oneOf([
|
|
@@ -39,12 +39,13 @@ DataManagement.propTypes = {
|
|
|
39
39
|
"radio",
|
|
40
40
|
"switch",
|
|
41
41
|
"search",
|
|
42
|
+
"select",
|
|
43
|
+
"date-range",
|
|
42
44
|
"default"
|
|
43
45
|
]),
|
|
44
|
-
onChangeAfter: PropTypes.func
|
|
45
|
-
filters: PropTypes.array
|
|
46
|
+
onChangeAfter: PropTypes.func
|
|
46
47
|
})
|
|
47
|
-
),
|
|
48
|
+
).isRequired,
|
|
48
49
|
editorFields: PropTypes.array,
|
|
49
50
|
validationSchema: PropTypes.object,
|
|
50
51
|
disableStatus: PropTypes.bool,
|
package/hooks/usePermission.js
CHANGED
|
@@ -17,7 +17,6 @@ const usePermission = (tableName) => {
|
|
|
17
17
|
if (permission) {
|
|
18
18
|
if (permission.TrangThaiXuLy !== undefined && permission.ObjTrangThai) {
|
|
19
19
|
const status = permission.ObjTrangThai.find((t) => t.StatusId === permission.TrangThaiXuLy) || {};
|
|
20
|
-
|
|
21
20
|
return {
|
|
22
21
|
canEdit: status.Edit ?? false,
|
|
23
22
|
canDelete: status.Delete ?? false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trithuc-mvc-react",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.8",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"@mui/icons-material": "^5.15.12",
|
|
39
39
|
"@mui/lab": "^5.0.0-alpha.142",
|
|
40
40
|
"@mui/material": "^5.15.12",
|
|
41
|
-
"@mui/x-date-pickers": "^
|
|
41
|
+
"@mui/x-date-pickers": "^6.10.2",
|
|
42
42
|
"@mui/x-tree-view": "^7.22.1",
|
|
43
|
+
"material-ui-confirm": "^3.0.9",
|
|
43
44
|
"react": ">=16",
|
|
44
45
|
"react-dom": ">=16",
|
|
46
|
+
"react-hook-form": "^7.45.2",
|
|
45
47
|
"react-query": "^3.39.3",
|
|
46
|
-
"react-toastify": "^10.0.6"
|
|
47
|
-
"material-ui-confirm": "^3.0.9",
|
|
48
|
-
"react-hook-form": "^7.45.2"
|
|
48
|
+
"react-toastify": "^10.0.6"
|
|
49
49
|
}
|
|
50
50
|
}
|