From 5f7a71c53255e9103530d4489bdaad44efe5a0e8 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 26 Jun 2022 07:09:39 -0700 Subject: Fix missing fields --- modern/src/settings/GeofencePage.js | 21 +++++++ modern/src/settings/NotificationPage.js | 105 +++++++++++++++++++------------- 2 files changed, 82 insertions(+), 44 deletions(-) (limited to 'modern') diff --git a/modern/src/settings/GeofencePage.js b/modern/src/settings/GeofencePage.js index f372adb6..d7d1c50c 100644 --- a/modern/src/settings/GeofencePage.js +++ b/modern/src/settings/GeofencePage.js @@ -11,6 +11,7 @@ import EditAttributesView from './components/EditAttributesView'; import { useTranslation } from '../common/components/LocalizationProvider'; import useGeofenceAttributes from '../common/attributes/useGeofenceAttributes'; import SettingsMenu from './components/SettingsMenu'; +import SelectField from '../common/components/SelectField'; const useStyles = makeStyles((theme) => ({ details: { @@ -56,6 +57,26 @@ const GeofencePage = () => { /> + + }> + + {t('sharedExtra')} + + + + setItem({ ...item, description: event.target.value })} + label={t('sharedDescription')} + /> + setItem({ ...item, calendarId: Number(event.target.value) })} + endpoint="/api/calendars" + label={t('sharedCalendar')} + /> + + }> 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 && ( - - }> - - {t('sharedRequired')} - - - - setItem({ ...item, type: e.target.value })} - endpoint="/api/notifications/types" - keyGetter={(it) => it.type} - titleGetter={(it) => t(prefixString('event', it.type))} - label={t('sharedType')} - /> - 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' && ( + <> + + }> + + {t('sharedRequired')} + + + + setItem({ ...item, type: e.target.value })} + endpoint="/api/notifications/types" + keyGetter={(it) => it.type} + titleGetter={(it) => t(prefixString('event', it.type))} + label={t('sharedType')} + /> 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')} /> - )} - - setItem({ ...item, always: event.target.checked })} - /> - )} - label={t('notificationAlways')} + {item.type === 'alarm' && ( + setItem({ ...item, attributes: { ...item.attributes, alarms: e.target.value.join() } })} + data={alarms} + keyGetter={(it) => it.key} + label={t('sharedAlarms')} + /> + )} + + setItem({ ...item, always: event.target.checked })} + /> + )} + label={t('notificationAlways')} + /> + + + + + }> + + {t('sharedExtra')} + + + + setItem({ ...item, calendarId: Number(event.target.value) })} + endpoint="/api/calendars" + label={t('sharedCalendar')} /> - - - + + + )} ); -- cgit v1.2.3