trithuc-mvc-react 1.6.8 → 1.6.9
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.
|
@@ -74,7 +74,7 @@ function ViewDetailDialog({ open, onClose = () => { }, fields = [] }) {
|
|
|
74
74
|
return (
|
|
75
75
|
<Dialog open={open} onClose={onClose} maxWidth="md" fullWidth={true} scroll={'body'}>
|
|
76
76
|
<DialogTitle>
|
|
77
|
-
Xem
|
|
77
|
+
Xem chi tiết
|
|
78
78
|
<IconButton
|
|
79
79
|
aria-label="close"
|
|
80
80
|
onClick={onClose}
|
|
@@ -5,7 +5,7 @@ import { FormHelperText, Typography } from "@mui/material/index";
|
|
|
5
5
|
import bytesToSize from "@/utils/bytesToSize";
|
|
6
6
|
import { Controller, useFormContext } from "react-hook-form";
|
|
7
7
|
|
|
8
|
-
const RhfUploadAvatar = ({ name }) => {
|
|
8
|
+
const RhfUploadAvatar = ({ name, disabled }) => {
|
|
9
9
|
const { control, setValue } = useFormContext();
|
|
10
10
|
const handleDrop = useCallback(
|
|
11
11
|
async (acceptedFiles) => {
|
|
@@ -35,7 +35,7 @@ const RhfUploadAvatar = ({ name }) => {
|
|
|
35
35
|
accept="image/*"
|
|
36
36
|
file={value}
|
|
37
37
|
maxSize={3145728}
|
|
38
|
-
onDrop={handleDrop}
|
|
38
|
+
onDrop={!disabled ? handleDrop : () => { }}
|
|
39
39
|
error={Boolean(error)}
|
|
40
40
|
helperText={error?.message}
|
|
41
41
|
caption={
|
|
@@ -5,7 +5,7 @@ import UploadMultiFile from "trithuc-mvc-react/components/DataManagement/upload/
|
|
|
5
5
|
import { useCallback, useState } from "react";
|
|
6
6
|
import { saveFilesToServer } from "@/utils";
|
|
7
7
|
|
|
8
|
-
const UploadMultipleFile = ({ name, label }) => {
|
|
8
|
+
const UploadMultipleFile = ({ name, label, disabled }) => {
|
|
9
9
|
const { control, getValues, setValue } = useFormContext();
|
|
10
10
|
const [isLoadingUpfile, setIsLoadingUpfile] = useState(false);
|
|
11
11
|
|
|
@@ -37,12 +37,13 @@ const UploadMultipleFile = ({ name, label }) => {
|
|
|
37
37
|
<>
|
|
38
38
|
|
|
39
39
|
<UploadMultiFile
|
|
40
|
+
disabled={disabled}
|
|
40
41
|
maxSize={3145728}
|
|
41
42
|
accept="*"
|
|
42
43
|
files={field.value}
|
|
43
|
-
onDrop={handleDrop}
|
|
44
|
-
onRemove={handleRemove}
|
|
45
|
-
onRemoveAll={handleRemoveAll}
|
|
44
|
+
onDrop={!disabled ? handleDrop : () => { }} // disabled lúc ở model view thì ko được chọn ảnh
|
|
45
|
+
onRemove={!disabled ?handleRemove : () => { }}
|
|
46
|
+
onRemoveAll={!disabled? handleRemoveAll: () => { }}
|
|
46
47
|
error={Boolean(error)}
|
|
47
48
|
/>
|
|
48
49
|
{isLoadingUpfile && <LinearProgress />}
|
|
@@ -57,4 +58,4 @@ const UploadMultipleFile = ({ name, label }) => {
|
|
|
57
58
|
/>
|
|
58
59
|
);
|
|
59
60
|
};
|
|
60
|
-
export default UploadMultipleFile
|
|
61
|
+
export default UploadMultipleFile;
|