diff options
author | Anton Tananaev <anton@traccar.org> | 2022-07-22 17:32:07 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-07-22 17:32:07 -0700 |
commit | f9f5ea547e61b6ff527149fa5814851240d2c967 (patch) | |
tree | e2902f69760c2c2c4837752ef81f44883b231be1 /modern/src/settings/DevicePage.js | |
parent | 98cb21230d938ac04f53a4425e5d3eae9cfdbfda (diff) | |
download | trackermap-web-f9f5ea547e61b6ff527149fa5814851240d2c967.tar.gz trackermap-web-f9f5ea547e61b6ff527149fa5814851240d2c967.tar.bz2 trackermap-web-f9f5ea547e61b6ff527149fa5814851240d2c967.zip |
Add device expiration (fix #85)
Diffstat (limited to 'modern/src/settings/DevicePage.js')
-rw-r--r-- | modern/src/settings/DevicePage.js | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/modern/src/settings/DevicePage.js b/modern/src/settings/DevicePage.js index b54c7c81..49f765a7 100644 --- a/modern/src/settings/DevicePage.js +++ b/modern/src/settings/DevicePage.js @@ -1,6 +1,5 @@ import React, { useState } from 'react'; -import TextField from '@mui/material/TextField'; - +import moment from 'moment'; import { Accordion, AccordionSummary, @@ -8,6 +7,7 @@ import { Typography, FormControlLabel, Checkbox, + TextField, } from '@mui/material'; import makeStyles from '@mui/styles/makeStyles'; import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; @@ -132,12 +132,18 @@ const DevicePage = () => { }))} label={t('deviceCategory')} /> - {admin && ( - <FormControlLabel - control={<Checkbox checked={item.disabled} onChange={(event) => setItem({ ...item, disabled: event.target.checked })} />} - label={t('sharedDisabled')} - /> - )} + <TextField + label={t('userExpirationTime')} + type="date" + value={(item.expirationTime && moment(item.expirationTime).locale('en').format(moment.HTML5_FMT.DATE)) || '2099-01-01'} + onChange={(e) => setItem({ ...item, expirationTime: moment(e.target.value, moment.HTML5_FMT.DATE).format() })} + disabled={!admin} + /> + <FormControlLabel + control={<Checkbox checked={item.disabled} onChange={(event) => setItem({ ...item, disabled: event.target.checked })} />} + label={t('sharedDisabled')} + disabled={!admin} + /> </AccordionDetails> </Accordion> {item.id && ( |