fix installation date is not ediable issue
This commit is contained in:
parent
795e77d304
commit
c21f222f86
|
|
@ -366,6 +366,16 @@ function InformationSodistorehome(props: InformationSodistorehomeProps) {
|
|||
const handleSubmit = () => {
|
||||
setLoading(true);
|
||||
setError(false);
|
||||
if (canEdit && installationDateChecklistId !== null) {
|
||||
axiosConfig
|
||||
.put('/UpdateChecklistItem', null, {
|
||||
params: {
|
||||
checklistItemId: installationDateChecklistId,
|
||||
doneAt: installationDate ?? ''
|
||||
}
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
updateInstallation(formValues, props.type);
|
||||
};
|
||||
|
||||
|
|
@ -405,6 +415,7 @@ function InformationSodistorehome(props: InformationSodistorehomeProps) {
|
|||
const [networkProviders, setNetworkProviders] = useState<string[]>([]);
|
||||
const [loadingProviders, setLoadingProviders] = useState(false);
|
||||
const [installationDate, setInstallationDate] = useState<string>('');
|
||||
const [installationDateChecklistId, setInstallationDateChecklistId] = useState<number | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
setLoadingProviders(true);
|
||||
|
|
@ -427,9 +438,13 @@ function InformationSodistorehome(props: InformationSodistorehomeProps) {
|
|||
(i: { stepNumber?: number }) => i.stepNumber === 10
|
||||
);
|
||||
setInstallationDate(step10?.doneAt ?? '');
|
||||
setInstallationDateChecklistId(step10?.id ?? null);
|
||||
}
|
||||
})
|
||||
.catch(() => setInstallationDate(''));
|
||||
.catch(() => {
|
||||
setInstallationDate('');
|
||||
setInstallationDateChecklistId(null);
|
||||
});
|
||||
}, [props.values.id]);
|
||||
|
||||
return (
|
||||
|
|
@ -879,10 +894,11 @@ function InformationSodistorehome(props: InformationSodistorehomeProps) {
|
|||
label={<FormattedMessage id="installationDate" defaultMessage="Installation Date" />}
|
||||
type="date"
|
||||
value={installationDate}
|
||||
onChange={(e) => setInstallationDate(e.target.value)}
|
||||
variant="outlined"
|
||||
fullWidth
|
||||
InputLabelProps={{ shrink: true }}
|
||||
inputProps={{ readOnly: true }}
|
||||
inputProps={{ readOnly: !canEdit }}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue