trithuc-mvc-react 2.8.1 → 2.8.3
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.
|
@@ -288,16 +288,16 @@ const DataTable = ({ multipleActions = [], page, setPage = () => {}, disableEdit
|
|
|
288
288
|
</Table>
|
|
289
289
|
</TableContainer>
|
|
290
290
|
|
|
291
|
-
<
|
|
291
|
+
<Grid2 container>
|
|
292
292
|
{!hasTabpanel && (
|
|
293
|
-
<
|
|
293
|
+
<Grid2 item alignSelf={"center"} sx={{ pl: 2 }}>
|
|
294
294
|
<Typography variant="body1">
|
|
295
295
|
Tổng số lượng: <span>{total}</span>
|
|
296
296
|
</Typography>
|
|
297
297
|
</Grid>
|
|
298
298
|
)}
|
|
299
299
|
|
|
300
|
-
<
|
|
300
|
+
<Grid2 item xs>
|
|
301
301
|
<TablePaginationCustom
|
|
302
302
|
count={total}
|
|
303
303
|
rowsPerPage={rowsPerPage}
|
|
@@ -289,16 +289,16 @@ const DataTableSM = ({ multipleActions = [], page, setPage = () => {}, disableEd
|
|
|
289
289
|
</Table>
|
|
290
290
|
</TableContainer>
|
|
291
291
|
|
|
292
|
-
<
|
|
292
|
+
<Grid2 container>
|
|
293
293
|
{!hasTabpanel && (
|
|
294
|
-
<
|
|
294
|
+
<Grid2 item alignSelf={"center"} sx={{ pl: 2 }}>
|
|
295
295
|
<Typography variant="body1">
|
|
296
296
|
Tổng số lượng: <span>{total}</span>
|
|
297
297
|
</Typography>
|
|
298
298
|
</Grid>
|
|
299
299
|
)}
|
|
300
300
|
|
|
301
|
-
<
|
|
301
|
+
<Grid2 item xs>
|
|
302
302
|
<TablePaginationCustom
|
|
303
303
|
count={total}
|
|
304
304
|
rowsPerPage={rowsPerPage}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { Box,
|
|
1
|
+
import { Box, useMediaQuery, useTheme } from "@mui/material";
|
|
2
2
|
import { FormProvider, useForm } from "react-hook-form";
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
|
|
6
|
-
import { useEffect } from "react";
|
|
7
6
|
import moment from "moment/moment";
|
|
7
|
+
import { useEffect } from "react";
|
|
8
8
|
|
|
9
|
+
import { URL_APPLICATION, URL_APPLICATION_API } from "@/constants";
|
|
10
|
+
import { yupResolver } from "@hookform/resolvers/yup";
|
|
9
11
|
import { useMutation, useQueryClient } from "react-query";
|
|
10
|
-
import { saveDataToTable } from "../../api";
|
|
11
12
|
import { toast } from "react-toastify";
|
|
12
|
-
import {
|
|
13
|
+
import { saveDataToTable } from "../../api";
|
|
13
14
|
import FormField from "./FormField";
|
|
14
|
-
import {
|
|
15
|
-
import { yupResolver } from "@hookform/resolvers/yup";
|
|
15
|
+
import { useDataTable } from "./hooks";
|
|
16
16
|
EditorForm.propTypes = {
|
|
17
17
|
fields: PropTypes.array
|
|
18
18
|
};
|
|
@@ -96,7 +96,7 @@ function EditorForm({ fields, submitRef }) {
|
|
|
96
96
|
if (status) {
|
|
97
97
|
if (URL_APPLICATION_API) {
|
|
98
98
|
toast.success(message);
|
|
99
|
-
}else{
|
|
99
|
+
} else {
|
|
100
100
|
toast.success(Id == 0 ? "Thêm thành công!" : "Cập nhật thành công!");
|
|
101
101
|
}
|
|
102
102
|
queryClient.invalidateQueries(tableName);
|
|
@@ -166,7 +166,7 @@ function EditorForm({ fields, submitRef }) {
|
|
|
166
166
|
return (
|
|
167
167
|
<FormProvider {...methods}>
|
|
168
168
|
<Box component={"form"} onSubmit={methods.handleSubmit(onSubmit, onValid)}>
|
|
169
|
-
<
|
|
169
|
+
<Grid2 container spacing={2}>
|
|
170
170
|
{fields.map(
|
|
171
171
|
({
|
|
172
172
|
field,
|
|
@@ -185,7 +185,7 @@ function EditorForm({ fields, submitRef }) {
|
|
|
185
185
|
...rest
|
|
186
186
|
}) => {
|
|
187
187
|
return (
|
|
188
|
-
<
|
|
188
|
+
<Grid2 item md={size?.md} xs={size?.xs} sm={size?.sm} key={field}>
|
|
189
189
|
<FormField
|
|
190
190
|
type={type}
|
|
191
191
|
label={label}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Accordion, AccordionSummary, Box, Slider, Typography } from "@mui/material";
|
|
1
|
+
import { Accordion, AccordionSummary, Box, Grid2, Slider, Typography } from "@mui/material";
|
|
2
2
|
import { useFormContext } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
import { FilterElement } from "./FilterElement";
|
|
@@ -30,7 +30,7 @@ export const FilterGod = ({ filters, elementSize = "small", setPage = () => {} }
|
|
|
30
30
|
<Typography variant="h6">Tìm kiếm</Typography>
|
|
31
31
|
</AccordionSummary>
|
|
32
32
|
<AccordionDetails>
|
|
33
|
-
<
|
|
33
|
+
<Grid2 container spacing={1}>
|
|
34
34
|
{filters.map(({ field, size, ...rest }) => {
|
|
35
35
|
if (rest.type === "date-range") {
|
|
36
36
|
let label = ["Từ ngày", "Đến ngày"];
|
|
@@ -39,7 +39,7 @@ export const FilterGod = ({ filters, elementSize = "small", setPage = () => {} }
|
|
|
39
39
|
label = field.label;
|
|
40
40
|
}
|
|
41
41
|
return (
|
|
42
|
-
<
|
|
42
|
+
<Grid2 key={field.toString()} md={size?.md} xs={size?.xs} sm={size?.sm}>
|
|
43
43
|
<DateRangePicker
|
|
44
44
|
label={label}
|
|
45
45
|
onChange={(value) => {
|
|
@@ -59,7 +59,7 @@ export const FilterGod = ({ filters, elementSize = "small", setPage = () => {} }
|
|
|
59
59
|
|
|
60
60
|
if (rest.type === "slider-range") {
|
|
61
61
|
return (
|
|
62
|
-
<
|
|
62
|
+
<Grid2 key={field.toString()} md={size?.md} xs={size?.xs} sm={size?.sm}>
|
|
63
63
|
<Slider
|
|
64
64
|
onChange={(e, value) => {
|
|
65
65
|
setDataSearch({
|
|
@@ -80,7 +80,7 @@ export const FilterGod = ({ filters, elementSize = "small", setPage = () => {} }
|
|
|
80
80
|
);
|
|
81
81
|
}
|
|
82
82
|
return (
|
|
83
|
-
<
|
|
83
|
+
<Grid2 key={field} md={size?.md} xs={size?.xs} sm={size?.sm}>
|
|
84
84
|
<FilterElement name={field} {...rest} setPage={setPage} />
|
|
85
85
|
</Grid>
|
|
86
86
|
);
|