aboutsummaryrefslogtreecommitdiff
path: root/modern/src/settings/NotificationPage.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-26 07:09:39 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-26 07:09:39 -0700
commit5f7a71c53255e9103530d4489bdaad44efe5a0e8 (patch)
treec75bcfa69bd7a8224e45f7a04c9bb76c8804f539 /modern/src/settings/NotificationPage.js
parent468ed8b75c45b3d713449ced8466bab22227cb9f (diff)
downloadtrackermap-web-5f7a71c53255e9103530d4489bdaad44efe5a0e8.tar.gz
trackermap-web-5f7a71c53255e9103530d4489bdaad44efe5a0e8.tar.bz2
trackermap-web-5f7a71c53255e9103530d4489bdaad44efe5a0e8.zip
Fix missing fields
Diffstat (limited to 'modern/src/settings/NotificationPage.js')
-rw-r--r--modern/src/settings/NotificationPage.js105
1 files changed, 61 insertions, 44 deletions
diff --git a/modern/src/settings/NotificationPage.js b/modern/src/settings/NotificationPage.js
index 6784671e..4aa318ae 100644
--- a/modern/src/settings/NotificationPage.js
+++ b/modern/src/settings/NotificationPage.js
@@ -49,54 +49,71 @@ const NotificationPage = () => {
breadcrumbs={['settingsTitle', 'sharedNotification']}
>
{item && (
- <Accordion defaultExpanded>
- <AccordionSummary expandIcon={<ExpandMoreIcon />}>
- <Typography variant="subtitle1">
- {t('sharedRequired')}
- </Typography>
- </AccordionSummary>
- <AccordionDetails className={classes.details}>
- <SelectField
- value={item.type}
- emptyValue={null}
- onChange={(e) => setItem({ ...item, type: e.target.value })}
- endpoint="/api/notifications/types"
- keyGetter={(it) => it.type}
- titleGetter={(it) => t(prefixString('event', it.type))}
- label={t('sharedType')}
- />
- <SelectField
- multiple
- value={item.notificators ? item.notificators.split(/[, ]+/) : []}
- onChange={(e) => setItem({ ...item, notificators: e.target.value.join() })}
- endpoint="/api/notifications/notificators"
- keyGetter={(it) => it.type}
- titleGetter={(it) => t(prefixString('notificator', it.type))}
- label={t('notificationNotificators')}
- />
- {item.type === 'alarm' && (
+ <>
+ <Accordion defaultExpanded>
+ <AccordionSummary expandIcon={<ExpandMoreIcon />}>
+ <Typography variant="subtitle1">
+ {t('sharedRequired')}
+ </Typography>
+ </AccordionSummary>
+ <AccordionDetails className={classes.details}>
+ <SelectField
+ value={item.type}
+ emptyValue={null}
+ onChange={(e) => setItem({ ...item, type: e.target.value })}
+ endpoint="/api/notifications/types"
+ keyGetter={(it) => it.type}
+ titleGetter={(it) => t(prefixString('event', it.type))}
+ label={t('sharedType')}
+ />
<SelectField
multiple
- value={item.attributes && item.attributes.alarms ? item.attributes.alarms.split(/[, ]+/) : []}
- onChange={(e) => setItem({ ...item, attributes: { ...item.attributes, alarms: e.target.value.join() } })}
- data={alarms}
- keyGetter={(it) => it.key}
- label={t('sharedAlarms')}
+ value={item.notificators ? item.notificators.split(/[, ]+/) : []}
+ onChange={(e) => setItem({ ...item, notificators: e.target.value.join() })}
+ endpoint="/api/notifications/notificators"
+ keyGetter={(it) => it.type}
+ titleGetter={(it) => t(prefixString('notificator', it.type))}
+ label={t('notificationNotificators')}
/>
- )}
- <FormGroup>
- <FormControlLabel
- control={(
- <Checkbox
- checked={item.always}
- onChange={(event) => setItem({ ...item, always: event.target.checked })}
- />
- )}
- label={t('notificationAlways')}
+ {item.type === 'alarm' && (
+ <SelectField
+ multiple
+ value={item.attributes && item.attributes.alarms ? item.attributes.alarms.split(/[, ]+/) : []}
+ onChange={(e) => setItem({ ...item, attributes: { ...item.attributes, alarms: e.target.value.join() } })}
+ data={alarms}
+ keyGetter={(it) => it.key}
+ label={t('sharedAlarms')}
+ />
+ )}
+ <FormGroup>
+ <FormControlLabel
+ control={(
+ <Checkbox
+ checked={item.always}
+ onChange={(event) => setItem({ ...item, always: event.target.checked })}
+ />
+ )}
+ label={t('notificationAlways')}
+ />
+ </FormGroup>
+ </AccordionDetails>
+ </Accordion>
+ <Accordion>
+ <AccordionSummary expandIcon={<ExpandMoreIcon />}>
+ <Typography variant="subtitle1">
+ {t('sharedExtra')}
+ </Typography>
+ </AccordionSummary>
+ <AccordionDetails className={classes.details}>
+ <SelectField
+ value={item.calendarId || 0}
+ onChange={(event) => setItem({ ...item, calendarId: Number(event.target.value) })}
+ endpoint="/api/calendars"
+ label={t('sharedCalendar')}
/>
- </FormGroup>
- </AccordionDetails>
- </Accordion>
+ </AccordionDetails>
+ </Accordion>
+ </>
)}
</EditItemView>
);