aboutsummaryrefslogtreecommitdiff
path: root/modern/src/EditItemView.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-05-02 17:13:33 -0700
committerAnton Tananaev <anton@traccar.org>2022-05-02 17:13:33 -0700
commitf52be84522da7f8e1c2b19d3484250e275252799 (patch)
treef13316af299e5f1665cbb0e9d73a5f9ffc04d961 /modern/src/EditItemView.js
parent3a8a11c5d101c30cabf727f6a27a892e9bc4c99a (diff)
downloadtrackermap-web-f52be84522da7f8e1c2b19d3484250e275252799.tar.gz
trackermap-web-f52be84522da7f8e1c2b19d3484250e275252799.tar.bz2
trackermap-web-f52be84522da7f8e1c2b19d3484250e275252799.zip
Implement model validation
Diffstat (limited to 'modern/src/EditItemView.js')
-rw-r--r--modern/src/EditItemView.js17
1 files changed, 14 insertions, 3 deletions
diff --git a/modern/src/EditItemView.js b/modern/src/EditItemView.js
index e1aea2a9..5ffdd9b5 100644
--- a/modern/src/EditItemView.js
+++ b/modern/src/EditItemView.js
@@ -23,7 +23,7 @@ const useStyles = makeStyles((theme) => ({
}));
const EditItemView = ({
- children, endpoint, item, setItem,
+ children, endpoint, item, setItem, validate,
}) => {
const history = useHistory();
const classes = useStyles();
@@ -65,10 +65,21 @@ const EditItemView = ({
{children}
<FormControl fullWidth margin="normal">
<div className={classes.buttons}>
- <Button type="button" color="primary" variant="outlined" onClick={() => history.goBack()}>
+ <Button
+ type="button"
+ color="primary"
+ variant="outlined"
+ onClick={() => history.goBack()}
+ >
{t('sharedCancel')}
</Button>
- <Button type="button" color="primary" variant="contained" onClick={handleSave}>
+ <Button
+ type="button"
+ color="primary"
+ variant="contained"
+ onClick={handleSave}
+ disabled={!validate()}
+ >
{t('sharedSave')}
</Button>
</div>