@iobroker/adapter-react-v5 7.2.4 → 7.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/build/AdminConnection.d.ts +1 -0
- package/build/AdminConnection.js +2 -0
- package/build/AdminConnection.js.map +1 -0
- package/{src/Components/404.tsx → build/Components/404.js} +14 -39
- package/build/Components/404.js.map +1 -0
- package/{Components → build/Components}/ColorPicker.d.ts +2 -2
- package/{Components → build/Components}/ColorPicker.js +50 -65
- package/build/Components/ColorPicker.js.map +1 -0
- package/{Components → build/Components}/ComplexCron.d.ts +2 -2
- package/{Components → build/Components}/ComplexCron.js +43 -71
- package/build/Components/ComplexCron.js.map +1 -0
- package/{Components → build/Components}/CopyToClipboard.d.ts +1 -2
- package/{src/Components/CopyToClipboard.tsx → build/Components/CopyToClipboard.js} +20 -38
- package/build/Components/CopyToClipboard.js.map +1 -0
- package/{Components → build/Components}/CustomModal.d.ts +3 -3
- package/build/Components/CustomModal.js +60 -0
- package/build/Components/CustomModal.js.map +1 -0
- package/{Components → build/Components}/FileBrowser.d.ts +2 -2
- package/{Components → build/Components}/FileBrowser.js +229 -236
- package/build/Components/FileBrowser.js.map +1 -0
- package/build/Components/FileViewer.d.ts +48 -0
- package/build/Components/FileViewer.js +277 -0
- package/build/Components/FileViewer.js.map +1 -0
- package/{Components → build/Components}/Icon.d.ts +1 -1
- package/build/Components/Icon.js +140 -0
- package/build/Components/Icon.js.map +1 -0
- package/{Components → build/Components}/IconPicker.d.ts +2 -2
- package/build/Components/IconPicker.js +73 -0
- package/build/Components/IconPicker.js.map +1 -0
- package/{Components → build/Components}/IconSelector.d.ts +3 -3
- package/{Components → build/Components}/IconSelector.js +29 -57
- package/build/Components/IconSelector.js.map +1 -0
- package/{Components → build/Components}/Image.d.ts +2 -2
- package/{Components → build/Components}/Image.js +16 -22
- package/build/Components/Image.js.map +1 -0
- package/{Components → build/Components}/Loader.d.ts +2 -2
- package/{Components → build/Components}/Loader.js +15 -40
- package/build/Components/Loader.js.map +1 -0
- package/{Components → build/Components}/Loaders/MV.d.ts +2 -2
- package/build/Components/Loaders/MV.js +61 -0
- package/build/Components/Loaders/MV.js.map +1 -0
- package/{Components → build/Components}/Loaders/PT.d.ts +2 -2
- package/{Components → build/Components}/Loaders/PT.js +10 -35
- package/build/Components/Loaders/PT.js.map +1 -0
- package/{Components → build/Components}/Loaders/Vendor.d.ts +2 -2
- package/build/Components/Loaders/Vendor.js +52 -0
- package/build/Components/Loaders/Vendor.js.map +1 -0
- package/{Components → build/Components}/Logo.d.ts +2 -2
- package/build/Components/Logo.js +108 -0
- package/build/Components/Logo.js.map +1 -0
- package/{Components → build/Components}/MDUtils.d.ts +1 -2
- package/{Components → build/Components}/MDUtils.js +4 -9
- package/build/Components/MDUtils.js.map +1 -0
- package/{Components → build/Components}/ObjectBrowser.d.ts +4 -4
- package/{Components → build/Components}/ObjectBrowser.js +1152 -1116
- package/build/Components/ObjectBrowser.js.map +1 -0
- package/{Components → build/Components}/Router.d.ts +1 -2
- package/{Components → build/Components}/Router.js +6 -7
- package/build/Components/Router.js.map +1 -0
- package/{Components → build/Components}/SaveCloseButtons.d.ts +2 -2
- package/build/Components/SaveCloseButtons.js +65 -0
- package/build/Components/SaveCloseButtons.js.map +1 -0
- package/{Components → build/Components}/Schedule.d.ts +2 -2
- package/{Components → build/Components}/Schedule.js +242 -257
- package/build/Components/Schedule.js.map +1 -0
- package/{Components → build/Components}/SelectWithIcon.d.ts +2 -2
- package/build/Components/SelectWithIcon.js +135 -0
- package/build/Components/SelectWithIcon.js.map +1 -0
- package/build/Components/SimpleCron/cronText.js +15 -0
- package/build/Components/SimpleCron/cronText.js.map +1 -0
- package/{Components → build/Components}/SimpleCron/index.d.ts +2 -2
- package/{Components → build/Components}/SimpleCron/index.js +55 -58
- package/build/Components/SimpleCron/index.js.map +1 -0
- package/{Components → build/Components}/TabContainer.d.ts +2 -2
- package/build/Components/TabContainer.js +23 -0
- package/build/Components/TabContainer.js.map +1 -0
- package/{Components → build/Components}/TabContent.d.ts +3 -2
- package/build/Components/TabContent.js +20 -0
- package/build/Components/TabContent.js.map +1 -0
- package/build/Components/TabHeader.d.ts +6 -0
- package/build/Components/TabHeader.js +6 -0
- package/build/Components/TabHeader.js.map +1 -0
- package/{Components → build/Components}/TableResize.d.ts +2 -2
- package/{src/Components/TableResize.tsx → build/Components/TableResize.js} +64 -134
- package/build/Components/TableResize.js.map +1 -0
- package/{Components → build/Components}/TextWithIcon.d.ts +2 -2
- package/{src/Components/TextWithIcon.tsx → build/Components/TextWithIcon.js} +30 -75
- package/build/Components/TextWithIcon.js.map +1 -0
- package/{Components → build/Components}/ToggleThemeMenu.d.ts +1 -1
- package/build/Components/ToggleThemeMenu.js +13 -0
- package/build/Components/ToggleThemeMenu.js.map +1 -0
- package/{Components → build/Components}/TreeTable.d.ts +3 -3
- package/{Components → build/Components}/TreeTable.js +87 -99
- package/build/Components/TreeTable.js.map +1 -0
- package/{Components → build/Components}/UploadImage.d.ts +2 -2
- package/{Components → build/Components}/UploadImage.js +46 -69
- package/build/Components/UploadImage.js.map +1 -0
- package/{Components → build/Components}/Utils.d.ts +2 -2
- package/{Components → build/Components}/Utils.js +47 -60
- package/build/Components/Utils.js.map +1 -0
- package/build/Components/withWidth.d.ts +2 -0
- package/build/Components/withWidth.js +22 -0
- package/build/Components/withWidth.js.map +1 -0
- package/build/Connection.d.ts +1 -0
- package/build/Connection.js +2 -0
- package/build/Connection.js.map +1 -0
- package/{Dialogs → build/Dialogs}/ComplexCron.d.ts +2 -2
- package/build/Dialogs/ComplexCron.js +85 -0
- package/build/Dialogs/ComplexCron.js.map +1 -0
- package/{Dialogs → build/Dialogs}/Confirm.d.ts +2 -2
- package/build/Dialogs/Confirm.js +83 -0
- package/build/Dialogs/Confirm.js.map +1 -0
- package/{Dialogs → build/Dialogs}/Cron.d.ts +2 -2
- package/build/Dialogs/Cron.js +72 -0
- package/build/Dialogs/Cron.js.map +1 -0
- package/{Dialogs → build/Dialogs}/Error.d.ts +2 -2
- package/build/Dialogs/Error.js +27 -0
- package/build/Dialogs/Error.js.map +1 -0
- package/{Dialogs → build/Dialogs}/Message.d.ts +2 -2
- package/build/Dialogs/Message.js +29 -0
- package/build/Dialogs/Message.js.map +1 -0
- package/{Dialogs → build/Dialogs}/SelectFile.d.ts +2 -2
- package/build/Dialogs/SelectFile.js +116 -0
- package/build/Dialogs/SelectFile.js.map +1 -0
- package/{Dialogs → build/Dialogs}/SelectID.d.ts +3 -3
- package/{Dialogs → build/Dialogs}/SelectID.js +28 -53
- package/build/Dialogs/SelectID.js.map +1 -0
- package/{Dialogs → build/Dialogs}/SimpleCron.d.ts +2 -2
- package/build/Dialogs/SimpleCron.js +46 -0
- package/build/Dialogs/SimpleCron.js.map +1 -0
- package/build/Dialogs/TextInput.d.ts +2 -0
- package/build/Dialogs/TextInput.js +31 -0
- package/build/Dialogs/TextInput.js.map +1 -0
- package/{GenericApp.d.ts → build/GenericApp.d.ts} +2 -3
- package/{GenericApp.js → build/GenericApp.js} +162 -176
- package/build/GenericApp.js.map +1 -0
- package/{LegacyConnection.d.ts → build/LegacyConnection.d.ts} +69 -4
- package/{LegacyConnection.js → build/LegacyConnection.js} +106 -99
- package/build/LegacyConnection.js.map +1 -0
- package/{Prompt.d.ts → build/Prompt.d.ts} +1 -1
- package/{Prompt.js → build/Prompt.js} +3 -4
- package/build/Prompt.js.map +1 -0
- package/build/Theme.d.ts +5 -0
- package/{Theme.js → build/Theme.js} +37 -32
- package/build/Theme.js.map +1 -0
- package/build/assets/devices/parseNames.d.ts +0 -0
- package/build/assets/devices/parseNames.js +35 -0
- package/build/assets/devices/parseNames.js.map +1 -0
- package/build/assets/rooms/parseNames.d.ts +0 -0
- package/build/assets/rooms/parseNames.js +35 -0
- package/build/assets/rooms/parseNames.js.map +1 -0
- package/build/dictionary.d.ts +1 -0
- package/build/dictionary.js +25 -0
- package/build/dictionary.js.map +1 -0
- package/build/i18n/de.json +449 -0
- package/build/i18n/en.json +449 -0
- package/build/i18n/es.json +449 -0
- package/build/i18n/fr.json +449 -0
- package/build/i18n/it.json +449 -0
- package/build/i18n/nl.json +449 -0
- package/build/i18n/pl.json +449 -0
- package/build/i18n/pt.json +449 -0
- package/build/i18n/ru.json +449 -0
- package/build/i18n/uk.json +449 -0
- package/build/i18n/zh-cn.json +449 -0
- package/{i18n.d.ts → build/i18n.d.ts} +2 -2
- package/{i18n.js → build/i18n.js} +9 -11
- package/build/i18n.js.map +1 -0
- package/build/icons/IconAdapter.d.ts +3 -0
- package/build/icons/IconAdapter.js +6 -0
- package/build/icons/IconAdapter.js.map +1 -0
- package/build/icons/IconAlias.d.ts +3 -0
- package/build/icons/IconAlias.js +6 -0
- package/build/icons/IconAlias.js.map +1 -0
- package/build/icons/IconChannel.d.ts +3 -0
- package/build/icons/IconChannel.js +9 -0
- package/build/icons/IconChannel.js.map +1 -0
- package/build/icons/IconClearFilter.d.ts +3 -0
- package/build/icons/IconClearFilter.js +7 -0
- package/build/icons/IconClearFilter.js.map +1 -0
- package/build/icons/IconClosed.d.ts +3 -0
- package/build/icons/IconClosed.js +6 -0
- package/build/icons/IconClosed.js.map +1 -0
- package/build/icons/IconCopy.d.ts +3 -0
- package/build/icons/IconCopy.js +5 -0
- package/build/icons/IconCopy.js.map +1 -0
- package/build/icons/IconDevice.d.ts +3 -0
- package/build/icons/IconDevice.js +15 -0
- package/build/icons/IconDevice.js.map +1 -0
- package/build/icons/IconDocument.d.ts +3 -0
- package/build/icons/IconDocument.js +6 -0
- package/build/icons/IconDocument.js.map +1 -0
- package/build/icons/IconDocumentReadOnly.d.ts +3 -0
- package/build/icons/IconDocumentReadOnly.js +7 -0
- package/build/icons/IconDocumentReadOnly.js.map +1 -0
- package/build/icons/IconExpert.d.ts +3 -0
- package/build/icons/IconExpert.js +6 -0
- package/build/icons/IconExpert.js.map +1 -0
- package/build/icons/IconFx.d.ts +3 -0
- package/build/icons/IconFx.js +5 -0
- package/build/icons/IconFx.js.map +1 -0
- package/build/icons/IconInstance.d.ts +3 -0
- package/build/icons/IconInstance.js +6 -0
- package/build/icons/IconInstance.js.map +1 -0
- package/build/icons/IconLogout.d.ts +3 -0
- package/build/icons/IconLogout.js +6 -0
- package/build/icons/IconLogout.js.map +1 -0
- package/build/icons/IconNoIcon.d.ts +3 -0
- package/build/icons/IconNoIcon.js +5 -0
- package/build/icons/IconNoIcon.js.map +1 -0
- package/build/icons/IconOpen.d.ts +3 -0
- package/build/icons/IconOpen.js +6 -0
- package/build/icons/IconOpen.js.map +1 -0
- package/{icons → build/icons}/IconProps.d.ts +1 -1
- package/build/icons/IconProps.js +2 -0
- package/build/icons/IconProps.js.map +1 -0
- package/build/icons/IconState.d.ts +3 -0
- package/build/icons/IconState.js +6 -0
- package/build/icons/IconState.js.map +1 -0
- package/build/index.d.ts +67 -0
- package/build/index.js +67 -0
- package/build/index.js.map +1 -0
- package/{types.d.ts → build/types.d.ts} +1 -1
- package/package.json +84 -48
- package/AdminConnection.d.ts +0 -2
- package/AdminConnection.js +0 -4
- package/Components/404.js +0 -101
- package/Components/CopyToClipboard.js +0 -163
- package/Components/CustomModal.js +0 -88
- package/Components/FileViewer.d.ts +0 -10
- package/Components/FileViewer.js +0 -305
- package/Components/Icon.js +0 -148
- package/Components/IconPicker.js +0 -98
- package/Components/Loaders/MV.js +0 -66
- package/Components/Loaders/Vendor.js +0 -77
- package/Components/Logo.js +0 -117
- package/Components/SaveCloseButtons.js +0 -69
- package/Components/SelectWithIcon.js +0 -168
- package/Components/SimpleCron/cronText.js +0 -19
- package/Components/TabContainer.js +0 -25
- package/Components/TabContent.js +0 -21
- package/Components/TabHeader.d.ts +0 -6
- package/Components/TabHeader.js +0 -11
- package/Components/TableResize.js +0 -226
- package/Components/TextWithIcon.js +0 -119
- package/Components/ToggleThemeMenu.js +0 -18
- package/Components/withWidth.d.ts +0 -3
- package/Components/withWidth.js +0 -27
- package/Connection.d.ts +0 -3
- package/Connection.js +0 -8
- package/Dialogs/ComplexCron.js +0 -90
- package/Dialogs/Confirm.js +0 -111
- package/Dialogs/Cron.js +0 -100
- package/Dialogs/Error.js +0 -55
- package/Dialogs/Message.js +0 -57
- package/Dialogs/SelectFile.js +0 -119
- package/Dialogs/SimpleCron.js +0 -51
- package/Dialogs/TextInput.d.ts +0 -3
- package/Dialogs/TextInput.js +0 -35
- package/Theme.d.ts +0 -6
- package/i18n/de.json +0 -449
- package/i18n/en.json +0 -449
- package/i18n/es.json +0 -449
- package/i18n/fr.json +0 -449
- package/i18n/it.json +0 -449
- package/i18n/nl.json +0 -449
- package/i18n/pl.json +0 -449
- package/i18n/pt.json +0 -449
- package/i18n/ru.json +0 -449
- package/i18n/uk.json +0 -449
- package/i18n/zh-cn.json +0 -449
- package/icons/IconAdapter.d.ts +0 -4
- package/icons/IconAdapter.js +0 -10
- package/icons/IconAlias.d.ts +0 -4
- package/icons/IconAlias.js +0 -10
- package/icons/IconChannel.d.ts +0 -4
- package/icons/IconChannel.js +0 -13
- package/icons/IconClearFilter.d.ts +0 -4
- package/icons/IconClearFilter.js +0 -11
- package/icons/IconClosed.d.ts +0 -4
- package/icons/IconClosed.js +0 -10
- package/icons/IconCopy.d.ts +0 -4
- package/icons/IconCopy.js +0 -9
- package/icons/IconDevice.d.ts +0 -4
- package/icons/IconDevice.js +0 -19
- package/icons/IconDocument.d.ts +0 -4
- package/icons/IconDocument.js +0 -10
- package/icons/IconDocumentReadOnly.d.ts +0 -4
- package/icons/IconDocumentReadOnly.js +0 -11
- package/icons/IconExpert.d.ts +0 -4
- package/icons/IconExpert.js +0 -10
- package/icons/IconFx.d.ts +0 -4
- package/icons/IconFx.js +0 -9
- package/icons/IconInstance.d.ts +0 -4
- package/icons/IconInstance.js +0 -10
- package/icons/IconLogout.d.ts +0 -4
- package/icons/IconLogout.js +0 -10
- package/icons/IconNoIcon.d.ts +0 -4
- package/icons/IconNoIcon.js +0 -9
- package/icons/IconOpen.d.ts +0 -4
- package/icons/IconOpen.js +0 -10
- package/icons/IconProps.js +0 -2
- package/icons/IconState.d.ts +0 -4
- package/icons/IconState.js +0 -10
- package/index.d.ts +0 -128
- package/index.js +0 -215
- package/src/AdminConnection.tsx +0 -3
- package/src/Components/ColorPicker.tsx +0 -343
- package/src/Components/ComplexCron.tsx +0 -561
- package/src/Components/CustomModal.tsx +0 -170
- package/src/Components/FileBrowser.tsx +0 -2560
- package/src/Components/FileViewer.tsx +0 -412
- package/src/Components/Icon.tsx +0 -238
- package/src/Components/IconPicker.tsx +0 -165
- package/src/Components/IconSelector.tsx +0 -2220
- package/src/Components/Image.tsx +0 -193
- package/src/Components/Loader.tsx +0 -328
- package/src/Components/Logo.tsx +0 -176
- package/src/Components/MDUtils.tsx +0 -104
- package/src/Components/ObjectBrowser.tsx +0 -8947
- package/src/Components/Router.tsx +0 -90
- package/src/Components/SaveCloseButtons.tsx +0 -117
- package/src/Components/Schedule.tsx +0 -1998
- package/src/Components/SelectWithIcon.tsx +0 -239
- package/src/Components/TabContainer.tsx +0 -57
- package/src/Components/TabContent.tsx +0 -38
- package/src/Components/TabHeader.tsx +0 -20
- package/src/Components/ToggleThemeMenu.tsx +0 -52
- package/src/Components/TreeTable.tsx +0 -1002
- package/src/Components/UploadImage.tsx +0 -643
- package/src/Components/Utils.tsx +0 -1802
- package/src/Components/loader.css +0 -231
- package/src/Components/withWidth.tsx +0 -32
- package/src/Connection.tsx +0 -5
- package/src/Dialogs/ComplexCron.tsx +0 -163
- package/src/Dialogs/Confirm.tsx +0 -185
- package/src/Dialogs/Cron.tsx +0 -192
- package/src/Dialogs/Error.tsx +0 -67
- package/src/Dialogs/Message.tsx +0 -73
- package/src/Dialogs/SelectFile.tsx +0 -280
- package/src/Dialogs/SelectID.tsx +0 -310
- package/src/Dialogs/SimpleCron.tsx +0 -101
- package/src/Dialogs/TextInput.tsx +0 -99
- package/src/GenericApp.tsx +0 -1076
- package/src/LegacyConnection.tsx +0 -3720
- package/src/Prompt.tsx +0 -22
- package/src/Theme.tsx +0 -472
- package/src/icons/IconAdapter.tsx +0 -22
- package/src/icons/IconAlias.tsx +0 -22
- package/src/icons/IconChannel.tsx +0 -60
- package/src/icons/IconClearFilter.tsx +0 -24
- package/src/icons/IconClosed.tsx +0 -22
- package/src/icons/IconCopy.tsx +0 -21
- package/src/icons/IconDevice.tsx +0 -126
- package/src/icons/IconDocument.tsx +0 -22
- package/src/icons/IconDocumentReadOnly.tsx +0 -27
- package/src/icons/IconExpert.tsx +0 -26
- package/src/icons/IconFx.tsx +0 -38
- package/src/icons/IconInstance.tsx +0 -22
- package/src/icons/IconLogout.tsx +0 -32
- package/src/icons/IconNoIcon.tsx +0 -21
- package/src/icons/IconOpen.tsx +0 -22
- package/src/icons/IconProps.tsx +0 -16
- package/src/icons/IconState.tsx +0 -38
- package/src/index.css +0 -56
- /package/{Components → build/Components}/404.d.ts +0 -0
- /package/{Components → build/Components}/SimpleCron/cronText.d.ts +0 -0
- /package/{assets → build/assets}/devices.json +0 -0
- /package/{assets → build/assets}/lamp_ceiling.svg +0 -0
- /package/{assets → build/assets}/lamp_table.svg +0 -0
- /package/{assets → build/assets}/no_icon.svg +0 -0
- /package/{assets → build/assets}/rooms.json +0 -0
- /package/{index.css → build/index.css} +0 -0
- /package/{tasks.js → tasksExample.js} +0 -0
|
@@ -1,1998 +0,0 @@
|
|
|
1
|
-
import React, { Component, type JSX } from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
Input,
|
|
5
|
-
Radio,
|
|
6
|
-
FormControlLabel,
|
|
7
|
-
FormGroup,
|
|
8
|
-
Checkbox,
|
|
9
|
-
MenuItem,
|
|
10
|
-
Select,
|
|
11
|
-
TextField,
|
|
12
|
-
Box,
|
|
13
|
-
type Theme,
|
|
14
|
-
} from '@mui/material';
|
|
15
|
-
|
|
16
|
-
import I18n from '../i18n';
|
|
17
|
-
import type { IobTheme } from '../types';
|
|
18
|
-
import Utils from './Utils';
|
|
19
|
-
|
|
20
|
-
const styles: Record<string, any> = {
|
|
21
|
-
hr: {
|
|
22
|
-
border: 0,
|
|
23
|
-
borderTop: '1px solid gray',
|
|
24
|
-
},
|
|
25
|
-
scrollWindow: {
|
|
26
|
-
width: '100%',
|
|
27
|
-
overflow: 'auto',
|
|
28
|
-
height: 'calc(100% - 22px)',
|
|
29
|
-
},
|
|
30
|
-
rowDiv: {
|
|
31
|
-
width: '100%',
|
|
32
|
-
},
|
|
33
|
-
modeDiv: {
|
|
34
|
-
width: 200,
|
|
35
|
-
display: 'inline-block',
|
|
36
|
-
verticalAlign: 'top',
|
|
37
|
-
},
|
|
38
|
-
settingsDiv: {
|
|
39
|
-
display: 'inline-block',
|
|
40
|
-
verticalAlign: 'top',
|
|
41
|
-
},
|
|
42
|
-
inputTime: {
|
|
43
|
-
width: 90,
|
|
44
|
-
marginTop: 0,
|
|
45
|
-
marginLeft: 5,
|
|
46
|
-
},
|
|
47
|
-
inputDate: {
|
|
48
|
-
width: 140,
|
|
49
|
-
marginTop: 0,
|
|
50
|
-
marginLeft: 5,
|
|
51
|
-
},
|
|
52
|
-
inputEvery: {
|
|
53
|
-
width: 40,
|
|
54
|
-
marginLeft: 5,
|
|
55
|
-
marginRight: 5,
|
|
56
|
-
},
|
|
57
|
-
inputRadio: {
|
|
58
|
-
padding: '4px 12px',
|
|
59
|
-
verticalAlign: 'top',
|
|
60
|
-
},
|
|
61
|
-
inputGroup: {
|
|
62
|
-
maxWidth: 400,
|
|
63
|
-
display: 'inline-block',
|
|
64
|
-
},
|
|
65
|
-
inputGroupElement: {
|
|
66
|
-
width: 120,
|
|
67
|
-
},
|
|
68
|
-
inputDateDay: {
|
|
69
|
-
width: 60,
|
|
70
|
-
},
|
|
71
|
-
inputDateDayCheck: {
|
|
72
|
-
padding: 4,
|
|
73
|
-
},
|
|
74
|
-
inputSmallCheck: {
|
|
75
|
-
padding: 0,
|
|
76
|
-
},
|
|
77
|
-
rowOnce: {},
|
|
78
|
-
rowDays: (theme: IobTheme) => ({
|
|
79
|
-
background: theme.palette.mode !== 'dark' ? '#ddeaff' : '#4b5057',
|
|
80
|
-
}),
|
|
81
|
-
rowDows: (theme: IobTheme) => ({
|
|
82
|
-
background: theme.palette.mode !== 'dark' ? '#DDFFDD' : '#52646c',
|
|
83
|
-
}),
|
|
84
|
-
rowDates: (theme: IobTheme) => ({
|
|
85
|
-
background: theme.palette.mode !== 'dark' ? '#DDDDFF' : '#747a86',
|
|
86
|
-
}),
|
|
87
|
-
rowWeeks: (theme: IobTheme) => ({
|
|
88
|
-
background: theme.palette.mode !== 'dark' ? '#DDDDFF' : '#717680',
|
|
89
|
-
}),
|
|
90
|
-
rowMonths: (theme: IobTheme) => ({
|
|
91
|
-
background: theme.palette.mode !== 'dark' ? '#DDFFFF' : '#1f5557',
|
|
92
|
-
}),
|
|
93
|
-
rowMonthsDates: (theme: IobTheme) => ({
|
|
94
|
-
background: theme.palette.mode !== 'dark' ? '#EEFFFF' : '#3c5737',
|
|
95
|
-
maxWidth: 600,
|
|
96
|
-
}),
|
|
97
|
-
rowYears: (theme: IobTheme) => ({
|
|
98
|
-
background: theme.palette.mode !== 'dark' ? '#fbffdd' : '#574b33',
|
|
99
|
-
}),
|
|
100
|
-
rowDaysDows: (theme: IobTheme) => ({
|
|
101
|
-
background: theme.palette.mode !== 'dark' ? '#EEEAFF' : '#573544',
|
|
102
|
-
pl: '10px',
|
|
103
|
-
pb: '10px',
|
|
104
|
-
}),
|
|
105
|
-
rowDowsDows: (theme: IobTheme) => ({
|
|
106
|
-
background: theme.palette.mode !== 'dark' ? '#EEFFEE' : '#3d4c54',
|
|
107
|
-
pl: '10px',
|
|
108
|
-
pb: '10px',
|
|
109
|
-
}),
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
const WEEKDAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
|
|
113
|
-
const MONTHS = [
|
|
114
|
-
'January',
|
|
115
|
-
'February',
|
|
116
|
-
'March',
|
|
117
|
-
'April',
|
|
118
|
-
'May',
|
|
119
|
-
'June',
|
|
120
|
-
'July',
|
|
121
|
-
'August',
|
|
122
|
-
'September',
|
|
123
|
-
'October',
|
|
124
|
-
'November',
|
|
125
|
-
'December',
|
|
126
|
-
];
|
|
127
|
-
const PERIODS = {
|
|
128
|
-
minutes: 'minutes',
|
|
129
|
-
hours: 'hours',
|
|
130
|
-
};
|
|
131
|
-
const ASTRO = [
|
|
132
|
-
'sunrise',
|
|
133
|
-
'sunriseEnd',
|
|
134
|
-
'goldenHourEnd',
|
|
135
|
-
'solarNoon',
|
|
136
|
-
'goldenHour',
|
|
137
|
-
'sunsetStart',
|
|
138
|
-
'sunset',
|
|
139
|
-
'dusk',
|
|
140
|
-
'nauticalDusk',
|
|
141
|
-
'night',
|
|
142
|
-
'nightEnd',
|
|
143
|
-
'nauticalDawn',
|
|
144
|
-
'dawn',
|
|
145
|
-
'nadir',
|
|
146
|
-
];
|
|
147
|
-
|
|
148
|
-
function padding(num: number): string {
|
|
149
|
-
if (num < 10) {
|
|
150
|
-
return `0${num}`;
|
|
151
|
-
}
|
|
152
|
-
return `${num}`;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
interface ScheduleConfig {
|
|
156
|
-
time: {
|
|
157
|
-
exactTime: boolean;
|
|
158
|
-
start: string;
|
|
159
|
-
end: string;
|
|
160
|
-
mode: string;
|
|
161
|
-
interval: number;
|
|
162
|
-
};
|
|
163
|
-
period: {
|
|
164
|
-
once: string;
|
|
165
|
-
days: number;
|
|
166
|
-
dows: string;
|
|
167
|
-
dates: string;
|
|
168
|
-
weeks: number;
|
|
169
|
-
months: string | number;
|
|
170
|
-
years: number;
|
|
171
|
-
yearMonth: number;
|
|
172
|
-
yearDate: number;
|
|
173
|
-
};
|
|
174
|
-
valid: {
|
|
175
|
-
from: string;
|
|
176
|
-
to?: string;
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// interface TextTimeProps {
|
|
181
|
-
// inputRef: React.RefObject<HTMLInputElement>;
|
|
182
|
-
// placeholder?: string;
|
|
183
|
-
// }
|
|
184
|
-
|
|
185
|
-
// function TextTime(props: TextTimeProps) {
|
|
186
|
-
// const { inputRef, ...other } = props;
|
|
187
|
-
//
|
|
188
|
-
// return <MaskedInput
|
|
189
|
-
// {...other}
|
|
190
|
-
// ref={inputRef}
|
|
191
|
-
// mask={[/[0-2]/, /[0-9]/, ':', /[0-5]/, /[0-9]/]}
|
|
192
|
-
// placeholderChar={props.placeholder || '00:00'}
|
|
193
|
-
// showMask
|
|
194
|
-
// />;
|
|
195
|
-
// }
|
|
196
|
-
|
|
197
|
-
// function TextDate(props: TextTimeProps) {
|
|
198
|
-
// const { inputRef, ...other } = props;
|
|
199
|
-
//
|
|
200
|
-
// return <MaskedInput
|
|
201
|
-
// {...other}
|
|
202
|
-
// ref={inputRef}
|
|
203
|
-
// mask={[/[0-3]/, /[0-9]/, '.', /[0-1]/, /[0-9]/, '.', '2', '0', /[0-9]/, /[0-9]/]}
|
|
204
|
-
// placeholderChar={props.placeholder || '01.01.2020'}
|
|
205
|
-
// showMask
|
|
206
|
-
// />;
|
|
207
|
-
// }
|
|
208
|
-
|
|
209
|
-
const DEFAULT: ScheduleConfig = {
|
|
210
|
-
time: {
|
|
211
|
-
exactTime: false,
|
|
212
|
-
|
|
213
|
-
start: '00:00',
|
|
214
|
-
end: '23:59',
|
|
215
|
-
|
|
216
|
-
mode: 'hours',
|
|
217
|
-
interval: 1,
|
|
218
|
-
},
|
|
219
|
-
period: {
|
|
220
|
-
once: '',
|
|
221
|
-
days: 1,
|
|
222
|
-
dows: '',
|
|
223
|
-
dates: '',
|
|
224
|
-
weeks: 0,
|
|
225
|
-
months: '',
|
|
226
|
-
|
|
227
|
-
years: 0,
|
|
228
|
-
yearMonth: 0,
|
|
229
|
-
yearDate: 0,
|
|
230
|
-
},
|
|
231
|
-
valid: {
|
|
232
|
-
from: '',
|
|
233
|
-
to: '',
|
|
234
|
-
},
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
function string2USdate(date: string): string {
|
|
238
|
-
const parts = date.split('.');
|
|
239
|
-
if (parts.length === 3) {
|
|
240
|
-
return `${parts[2]}-${parts[1]}-${parts[0]}`;
|
|
241
|
-
}
|
|
242
|
-
return '';
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
interface ScheduleProps {
|
|
246
|
-
schedule: string | ScheduleConfig;
|
|
247
|
-
onChange: (schedule: string, desc?: string) => void;
|
|
248
|
-
theme: IobTheme;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
interface ScheduleState {
|
|
252
|
-
schedule: ScheduleConfig;
|
|
253
|
-
desc: string;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
class Schedule extends Component<ScheduleProps, ScheduleState> {
|
|
257
|
-
private readonly refFrom: React.RefObject<HTMLInputElement>;
|
|
258
|
-
|
|
259
|
-
private readonly refTo: React.RefObject<HTMLInputElement>;
|
|
260
|
-
|
|
261
|
-
private readonly refOnce: React.RefObject<HTMLInputElement>;
|
|
262
|
-
|
|
263
|
-
private timerOnce: ReturnType<typeof setTimeout> | null = null;
|
|
264
|
-
|
|
265
|
-
private timerFrom: ReturnType<typeof setTimeout> | null = null;
|
|
266
|
-
|
|
267
|
-
private timerTo: ReturnType<typeof setTimeout> | null = null;
|
|
268
|
-
|
|
269
|
-
constructor(props: ScheduleProps) {
|
|
270
|
-
super(props);
|
|
271
|
-
let schedule: ScheduleConfig | undefined;
|
|
272
|
-
if (this.props.schedule && typeof this.props.schedule === 'string' && this.props.schedule[0] === '{') {
|
|
273
|
-
try {
|
|
274
|
-
schedule = JSON.parse(this.props.schedule);
|
|
275
|
-
} catch {
|
|
276
|
-
// ignore
|
|
277
|
-
}
|
|
278
|
-
} else if (typeof this.props.schedule === 'object') {
|
|
279
|
-
schedule = this.props.schedule;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
if (!schedule || !Object.keys(schedule).length) {
|
|
283
|
-
setTimeout(() => this.onChange(this.state.schedule, true), 200);
|
|
284
|
-
schedule = DEFAULT;
|
|
285
|
-
}
|
|
286
|
-
schedule = { ...DEFAULT, ...schedule };
|
|
287
|
-
schedule.valid.from = schedule.valid.from || Schedule.now2string();
|
|
288
|
-
|
|
289
|
-
this.refFrom = React.createRef();
|
|
290
|
-
this.refTo = React.createRef();
|
|
291
|
-
this.refOnce = React.createRef();
|
|
292
|
-
|
|
293
|
-
this.state = {
|
|
294
|
-
schedule,
|
|
295
|
-
desc: Schedule.state2text(schedule),
|
|
296
|
-
};
|
|
297
|
-
|
|
298
|
-
if (JSON.stringify(schedule) !== this.props.schedule) {
|
|
299
|
-
setTimeout(() => this.props.onChange && this.props.onChange(JSON.stringify(schedule)), 100);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
onChange(schedule: ScheduleConfig, force?: boolean): void {
|
|
304
|
-
const isDiff = JSON.stringify(schedule) !== JSON.stringify(this.state.schedule);
|
|
305
|
-
if (force || isDiff) {
|
|
306
|
-
isDiff && this.setState({ schedule, desc: Schedule.state2text(schedule) });
|
|
307
|
-
const copy = JSON.parse(JSON.stringify(schedule));
|
|
308
|
-
if (copy.period.once) {
|
|
309
|
-
const once = copy.period.once;
|
|
310
|
-
delete copy.period;
|
|
311
|
-
copy.period = { once };
|
|
312
|
-
delete copy.valid;
|
|
313
|
-
} else if (copy.period.days) {
|
|
314
|
-
const days = copy.period.days;
|
|
315
|
-
const daysOfWeek = copy.period.dows;
|
|
316
|
-
delete copy.period;
|
|
317
|
-
copy.period = { days };
|
|
318
|
-
if (daysOfWeek && daysOfWeek !== '[]') {
|
|
319
|
-
copy.period.dows = daysOfWeek;
|
|
320
|
-
}
|
|
321
|
-
} else if (copy.period.weeks) {
|
|
322
|
-
const weeks = copy.period.weeks;
|
|
323
|
-
const daysOfWeek = copy.period.dows;
|
|
324
|
-
delete copy.period;
|
|
325
|
-
copy.period = { weeks };
|
|
326
|
-
if (daysOfWeek && daysOfWeek !== '[]') {
|
|
327
|
-
copy.period.dows = daysOfWeek;
|
|
328
|
-
}
|
|
329
|
-
} else if (copy.period.months) {
|
|
330
|
-
const months = copy.period.months;
|
|
331
|
-
const dates = copy.period.dates;
|
|
332
|
-
delete copy.period;
|
|
333
|
-
copy.period = { months };
|
|
334
|
-
if (dates && dates !== '[]') {
|
|
335
|
-
copy.period.dates = dates;
|
|
336
|
-
}
|
|
337
|
-
} else if (copy.period.years) {
|
|
338
|
-
const years = copy.period.years;
|
|
339
|
-
const yearMonth = copy.period.yearMonth;
|
|
340
|
-
const yearDate = copy.period.yearDate;
|
|
341
|
-
delete copy.period;
|
|
342
|
-
copy.period = { years, yearDate };
|
|
343
|
-
if (yearMonth) {
|
|
344
|
-
copy.period.yearMonth = yearMonth;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
if (copy.time.exactTime) {
|
|
349
|
-
delete copy.time.end;
|
|
350
|
-
delete copy.time.mode;
|
|
351
|
-
delete copy.time.interval;
|
|
352
|
-
} else {
|
|
353
|
-
delete copy.time.exactTime;
|
|
354
|
-
}
|
|
355
|
-
if (copy.valid) {
|
|
356
|
-
if (!copy.valid.to) {
|
|
357
|
-
delete copy.valid.to;
|
|
358
|
-
}
|
|
359
|
-
if (
|
|
360
|
-
copy.period.days === 1 ||
|
|
361
|
-
copy.period.weeks === 1 ||
|
|
362
|
-
copy.period.months === 1 ||
|
|
363
|
-
copy.period.years === 1
|
|
364
|
-
) {
|
|
365
|
-
const from = Schedule.string2date(copy.valid.from);
|
|
366
|
-
const today = new Date();
|
|
367
|
-
today.setHours(0);
|
|
368
|
-
today.setMinutes(0);
|
|
369
|
-
today.setSeconds(0);
|
|
370
|
-
today.setMilliseconds(0);
|
|
371
|
-
if (from <= today) {
|
|
372
|
-
delete copy.valid.from;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
if (!copy.valid.from && !copy.valid.to) {
|
|
376
|
-
delete copy.valid;
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
this.props.onChange && this.props.onChange(JSON.stringify(copy), Schedule.state2text(schedule));
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
static state2text(schedule: string | ScheduleConfig): string {
|
|
385
|
-
if (typeof schedule === 'string') {
|
|
386
|
-
try {
|
|
387
|
-
schedule = JSON.parse(schedule) as ScheduleConfig;
|
|
388
|
-
} catch {
|
|
389
|
-
return '';
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
const desc = [];
|
|
394
|
-
const validFrom = Schedule.string2date(schedule.valid.from);
|
|
395
|
-
if (schedule.period.once) {
|
|
396
|
-
// once
|
|
397
|
-
const once = Schedule.string2date(schedule.period.once);
|
|
398
|
-
const now = new Date();
|
|
399
|
-
now.setMilliseconds(0);
|
|
400
|
-
now.setSeconds(0);
|
|
401
|
-
now.setMinutes(0);
|
|
402
|
-
now.setHours(0);
|
|
403
|
-
|
|
404
|
-
//
|
|
405
|
-
if (once < now) {
|
|
406
|
-
// will be not executed anymore, because start is in the past
|
|
407
|
-
return I18n.t('sch_desc_onceInPast');
|
|
408
|
-
}
|
|
409
|
-
// only once
|
|
410
|
-
desc.push(I18n.t('sch_desc_once_on', schedule.period.once));
|
|
411
|
-
} else if (schedule.period.days) {
|
|
412
|
-
if (schedule.period.days === 1) {
|
|
413
|
-
if (schedule.period.dows) {
|
|
414
|
-
const daysOfWeek = JSON.parse(schedule.period.dows);
|
|
415
|
-
if (daysOfWeek.length === 2 && daysOfWeek[0] === 0 && daysOfWeek[1] === 6) {
|
|
416
|
-
// on weekends
|
|
417
|
-
desc.push(I18n.t('sch_desc_onWeekends'));
|
|
418
|
-
} else if (
|
|
419
|
-
daysOfWeek.length === 5 &&
|
|
420
|
-
daysOfWeek[0] === 1 &&
|
|
421
|
-
daysOfWeek[1] === 2 &&
|
|
422
|
-
daysOfWeek[2] === 3 &&
|
|
423
|
-
daysOfWeek[3] === 4 &&
|
|
424
|
-
daysOfWeek[4] === 5
|
|
425
|
-
) {
|
|
426
|
-
// on workdays
|
|
427
|
-
desc.push(I18n.t('sch_desc_onWorkdays'));
|
|
428
|
-
} else {
|
|
429
|
-
const tDows = daysOfWeek.map((day: number) => I18n.t(WEEKDAYS[day]));
|
|
430
|
-
if (tDows.length === 1) {
|
|
431
|
-
// on Monday
|
|
432
|
-
desc.push(I18n.t('sch_desc_onWeekday', tDows[0]));
|
|
433
|
-
} else if (tDows.length === 7) {
|
|
434
|
-
// on every day
|
|
435
|
-
desc.push(I18n.t('sch_desc_everyDay'));
|
|
436
|
-
} else {
|
|
437
|
-
const last = tDows.pop();
|
|
438
|
-
// on Monday and Sunday
|
|
439
|
-
desc.push(I18n.t('sch_desc_onWeekdays', tDows.join(', '), last));
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
} else {
|
|
443
|
-
desc.push(I18n.t('sch_desc_everyDay'));
|
|
444
|
-
}
|
|
445
|
-
} else {
|
|
446
|
-
desc.push(I18n.t('sch_desc_everyNDay', schedule.period.days.toString()));
|
|
447
|
-
}
|
|
448
|
-
} else if (schedule.period.weeks) {
|
|
449
|
-
if (schedule.period.weeks === 1) {
|
|
450
|
-
desc.push(I18n.t('sch_desc_everyWeek'));
|
|
451
|
-
} else {
|
|
452
|
-
desc.push(I18n.t('sch_desc_everyNWeeks', schedule.period.weeks.toString()));
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
if (schedule.period.dows) {
|
|
456
|
-
const daysOfWeek = JSON.parse(schedule.period.dows);
|
|
457
|
-
if (daysOfWeek.length === 2 && daysOfWeek[0] === 0 && daysOfWeek[1] === 6) {
|
|
458
|
-
// on weekends
|
|
459
|
-
desc.push(I18n.t('sch_desc_onWeekends'));
|
|
460
|
-
} else if (
|
|
461
|
-
daysOfWeek.length === 5 &&
|
|
462
|
-
daysOfWeek[0] === 1 &&
|
|
463
|
-
daysOfWeek[1] === 2 &&
|
|
464
|
-
daysOfWeek[2] === 3 &&
|
|
465
|
-
daysOfWeek[3] === 4 &&
|
|
466
|
-
daysOfWeek[4] === 5
|
|
467
|
-
) {
|
|
468
|
-
// on workdays
|
|
469
|
-
desc.push(I18n.t('sch_desc_onWorkdays'));
|
|
470
|
-
} else {
|
|
471
|
-
const tDows = daysOfWeek.map((day: number) => I18n.t(WEEKDAYS[day]));
|
|
472
|
-
if (tDows.length === 1) {
|
|
473
|
-
// on Monday
|
|
474
|
-
desc.push(I18n.t('sch_desc_onWeekday', tDows[0]));
|
|
475
|
-
} else if (tDows.length === 7) {
|
|
476
|
-
// on every day
|
|
477
|
-
desc.push(I18n.t('sch_desc_everyDay'));
|
|
478
|
-
} else {
|
|
479
|
-
const last = tDows.pop();
|
|
480
|
-
// on Monday and Sunday
|
|
481
|
-
desc.push(I18n.t('sch_desc_onWeekdays', tDows.join(', '), last));
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
} else {
|
|
485
|
-
return I18n.t('sch_desc_never');
|
|
486
|
-
}
|
|
487
|
-
} else if (schedule.period.months) {
|
|
488
|
-
if (schedule.period.dates) {
|
|
489
|
-
const dates = JSON.parse(schedule.period.dates);
|
|
490
|
-
if (dates.length === 1) {
|
|
491
|
-
// in 1 of month
|
|
492
|
-
desc.push(I18n.t('sch_desc_onDate', dates[0]));
|
|
493
|
-
} else if (dates.length === 31) {
|
|
494
|
-
desc.push(I18n.t('sch_desc_onEveryDate'));
|
|
495
|
-
} else if (!dates.length) {
|
|
496
|
-
return I18n.t('sch_desc_never');
|
|
497
|
-
} else {
|
|
498
|
-
const last = dates.pop();
|
|
499
|
-
// in 1 and 4 of month
|
|
500
|
-
desc.push(I18n.t('sch_desc_onDates', dates.join(', '), last));
|
|
501
|
-
}
|
|
502
|
-
} else {
|
|
503
|
-
desc.push(I18n.t('sch_desc_onEveryDate'));
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
if (schedule.period.months === 1) {
|
|
507
|
-
desc.push(I18n.t('sch_desc_everyMonth'));
|
|
508
|
-
} else if (typeof schedule.period.months === 'number') {
|
|
509
|
-
desc.push(I18n.t('sch_desc_everyNMonths', schedule.period.months.toString()));
|
|
510
|
-
} else {
|
|
511
|
-
const months = JSON.parse(schedule.period.months);
|
|
512
|
-
const tMonths = months.map((month: number) => I18n.t(MONTHS[month - 1]));
|
|
513
|
-
if (!tMonths.length) {
|
|
514
|
-
// in January
|
|
515
|
-
return I18n.t('sch_desc_never');
|
|
516
|
-
}
|
|
517
|
-
if (tMonths.length === 1) {
|
|
518
|
-
// in January
|
|
519
|
-
desc.push(I18n.t('sch_desc_onMonth', tMonths[0]));
|
|
520
|
-
} else if (tMonths.length === 12) {
|
|
521
|
-
// every month
|
|
522
|
-
desc.push(I18n.t('sch_desc_everyMonth'));
|
|
523
|
-
} else {
|
|
524
|
-
const last = tMonths.pop();
|
|
525
|
-
// in January and May
|
|
526
|
-
desc.push(I18n.t('sch_desc_onMonths', tMonths.join(', '), last));
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
} else if (schedule.period.years) {
|
|
530
|
-
if (schedule.period.years === 1) {
|
|
531
|
-
desc.push(I18n.t('sch_desc_everyYear'));
|
|
532
|
-
} else {
|
|
533
|
-
desc.push(I18n.t('sch_desc_everyNYears', schedule.period.years.toString()));
|
|
534
|
-
}
|
|
535
|
-
desc.push(
|
|
536
|
-
I18n.t(
|
|
537
|
-
'sch_desc_onDate',
|
|
538
|
-
schedule.period.yearDate.toString(),
|
|
539
|
-
schedule.period.yearMonth
|
|
540
|
-
? I18n.t(MONTHS[schedule.period.yearMonth - 1])
|
|
541
|
-
: I18n.t('sch_desc_everyMonth'),
|
|
542
|
-
),
|
|
543
|
-
);
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
// time
|
|
547
|
-
if (schedule.time.exactTime) {
|
|
548
|
-
if (ASTRO.includes(schedule.time.start)) {
|
|
549
|
-
// at sunset
|
|
550
|
-
desc.push(I18n.t('sch_desc_atTime', I18n.t(`sch_astro_${schedule.time.start}`)));
|
|
551
|
-
} else {
|
|
552
|
-
// at HH:MM
|
|
553
|
-
desc.push(I18n.t('sch_desc_atTime', schedule.time.start));
|
|
554
|
-
}
|
|
555
|
-
} else {
|
|
556
|
-
if (schedule.time.mode === PERIODS.minutes) {
|
|
557
|
-
if (schedule.time.interval === 1) {
|
|
558
|
-
// every minute
|
|
559
|
-
desc.push(I18n.t('sch_desc_everyMinute'));
|
|
560
|
-
} else {
|
|
561
|
-
// every N minute
|
|
562
|
-
desc.push(I18n.t('sch_desc_everyNMinutes', schedule.time.interval.toString()));
|
|
563
|
-
}
|
|
564
|
-
} else if (schedule.time.interval === 1) {
|
|
565
|
-
// every minute
|
|
566
|
-
desc.push(I18n.t('sch_desc_everyHour'));
|
|
567
|
-
} else {
|
|
568
|
-
// every N minute
|
|
569
|
-
desc.push(I18n.t('sch_desc_everyNHours', schedule.time.interval.toString()));
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
const start =
|
|
573
|
-
ASTRO.indexOf(schedule.time.start) !== -1
|
|
574
|
-
? I18n.t(`sch_astro_${schedule.time.start}`)
|
|
575
|
-
: schedule.time.start;
|
|
576
|
-
const end =
|
|
577
|
-
ASTRO.indexOf(schedule.time.end) !== -1 ? I18n.t(`sch_astro_${schedule.time.end}`) : schedule.time.end;
|
|
578
|
-
if (start !== '00:00' || (end !== '24:00' && end !== '23:59')) {
|
|
579
|
-
// from HH:mm to HH:mm
|
|
580
|
-
desc.push(I18n.t('sch_desc_intervalFromTo', start, end));
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
if (!schedule.period.once) {
|
|
585
|
-
// valid
|
|
586
|
-
if (validFrom.getTime() > Date.now() && schedule.valid.to) {
|
|
587
|
-
// from XXX to XXXX
|
|
588
|
-
desc.push(I18n.t('sch_desc_validFromTo', schedule.valid.from, schedule.valid.to));
|
|
589
|
-
} else if (validFrom.getTime() > Date.now()) {
|
|
590
|
-
// from XXXX
|
|
591
|
-
desc.push(I18n.t('sch_desc_validFrom', schedule.valid.from));
|
|
592
|
-
} else if (schedule.valid.to) {
|
|
593
|
-
// till XXXX
|
|
594
|
-
desc.push(I18n.t('sch_desc_validTo', schedule.valid.to));
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
return desc.join(' ');
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
getTimePeriodElements(): JSX.Element {
|
|
601
|
-
const schedule = this.state.schedule;
|
|
602
|
-
let wholeDay = false;
|
|
603
|
-
let day = false;
|
|
604
|
-
let night = false;
|
|
605
|
-
let fromTo = true;
|
|
606
|
-
if (schedule.time.start === '00:00' && schedule.time.end === '24:00') {
|
|
607
|
-
wholeDay = true;
|
|
608
|
-
fromTo = false;
|
|
609
|
-
} else if (schedule.time.start === 'sunrise') {
|
|
610
|
-
day = true;
|
|
611
|
-
fromTo = false;
|
|
612
|
-
} else if (schedule.time.start === 'sunset') {
|
|
613
|
-
night = true;
|
|
614
|
-
fromTo = false;
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
return (
|
|
618
|
-
<div
|
|
619
|
-
key="timePeriod"
|
|
620
|
-
style={styles.rowDiv}
|
|
621
|
-
>
|
|
622
|
-
<div style={styles.modeDiv}>
|
|
623
|
-
<FormControlLabel
|
|
624
|
-
control={
|
|
625
|
-
<Radio
|
|
626
|
-
style={styles.inputRadio}
|
|
627
|
-
checked={!schedule.time.exactTime}
|
|
628
|
-
onClick={() => {
|
|
629
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
630
|
-
_schedule.time.exactTime = false;
|
|
631
|
-
this.onChange(_schedule);
|
|
632
|
-
}}
|
|
633
|
-
/>
|
|
634
|
-
}
|
|
635
|
-
label={I18n.t('sch_intervalTime')}
|
|
636
|
-
/>
|
|
637
|
-
</div>
|
|
638
|
-
<div style={styles.settingsDiv}>
|
|
639
|
-
<div style={styles.settingsDiv}>
|
|
640
|
-
{!schedule.time.exactTime && (
|
|
641
|
-
<div>
|
|
642
|
-
<div>
|
|
643
|
-
<FormControlLabel
|
|
644
|
-
control={
|
|
645
|
-
<Radio
|
|
646
|
-
style={styles.inputRadio}
|
|
647
|
-
checked={!!fromTo}
|
|
648
|
-
onClick={() => {
|
|
649
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
650
|
-
_schedule.time.start = '00:00';
|
|
651
|
-
_schedule.time.end = '23:59';
|
|
652
|
-
this.onChange(_schedule);
|
|
653
|
-
}}
|
|
654
|
-
/>
|
|
655
|
-
}
|
|
656
|
-
label={!fromTo ? I18n.t('sch_fromTo') : ''}
|
|
657
|
-
/>
|
|
658
|
-
{fromTo && [
|
|
659
|
-
<TextField
|
|
660
|
-
variant="standard"
|
|
661
|
-
style={{ ...styles.inputTime, marginRight: 10 }}
|
|
662
|
-
key="exactTimeFrom"
|
|
663
|
-
type="time"
|
|
664
|
-
sx={(theme: Theme) => ({
|
|
665
|
-
'& input[type="time"]::-webkit-calendar-picker-indicator': {
|
|
666
|
-
filter: theme.palette.mode === 'dark' ? 'invert(80%)' : undefined,
|
|
667
|
-
},
|
|
668
|
-
})}
|
|
669
|
-
value={this.state.schedule.time.start}
|
|
670
|
-
// InputProps={{inputComponent: TextTime}}
|
|
671
|
-
onChange={e => {
|
|
672
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
673
|
-
_schedule.time.start = e.target.value;
|
|
674
|
-
this.onChange(_schedule);
|
|
675
|
-
}}
|
|
676
|
-
slotProps={{
|
|
677
|
-
inputLabel: { shrink: true },
|
|
678
|
-
}}
|
|
679
|
-
label={I18n.t('sch_from')}
|
|
680
|
-
margin="normal"
|
|
681
|
-
/>,
|
|
682
|
-
<TextField
|
|
683
|
-
variant="standard"
|
|
684
|
-
style={styles.inputTime}
|
|
685
|
-
key="exactTimeTo"
|
|
686
|
-
type="time"
|
|
687
|
-
sx={(theme: Theme) => ({
|
|
688
|
-
'& input[type="time"]::-webkit-calendar-picker-indicator': {
|
|
689
|
-
filter: theme.palette.mode === 'dark' ? 'invert(80%)' : undefined,
|
|
690
|
-
},
|
|
691
|
-
})}
|
|
692
|
-
value={this.state.schedule.time.end}
|
|
693
|
-
// InputProps={{inputComponent: TextTime}}
|
|
694
|
-
onChange={e => {
|
|
695
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
696
|
-
_schedule.time.end = e.target.value;
|
|
697
|
-
this.onChange(_schedule);
|
|
698
|
-
}}
|
|
699
|
-
slotProps={{
|
|
700
|
-
inputLabel: { shrink: true },
|
|
701
|
-
}}
|
|
702
|
-
label={I18n.t('sch_to')}
|
|
703
|
-
margin="normal"
|
|
704
|
-
/>,
|
|
705
|
-
]}
|
|
706
|
-
</div>
|
|
707
|
-
</div>
|
|
708
|
-
)}
|
|
709
|
-
|
|
710
|
-
{!schedule.time.exactTime && (
|
|
711
|
-
<div>
|
|
712
|
-
<FormControlLabel
|
|
713
|
-
control={
|
|
714
|
-
<Radio
|
|
715
|
-
style={styles.inputRadio}
|
|
716
|
-
checked={!!wholeDay}
|
|
717
|
-
onClick={() => {
|
|
718
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
719
|
-
_schedule.time.start = '00:00';
|
|
720
|
-
_schedule.time.end = '24:00';
|
|
721
|
-
this.onChange(_schedule);
|
|
722
|
-
}}
|
|
723
|
-
/>
|
|
724
|
-
}
|
|
725
|
-
label={I18n.t('sch_wholeDay')}
|
|
726
|
-
/>
|
|
727
|
-
</div>
|
|
728
|
-
)}
|
|
729
|
-
|
|
730
|
-
{!schedule.time.exactTime && (
|
|
731
|
-
<div>
|
|
732
|
-
<FormControlLabel
|
|
733
|
-
control={
|
|
734
|
-
<Radio
|
|
735
|
-
style={styles.inputRadio}
|
|
736
|
-
checked={!!day}
|
|
737
|
-
onClick={() => {
|
|
738
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
739
|
-
_schedule.time.start = 'sunrise';
|
|
740
|
-
_schedule.time.end = 'sunset';
|
|
741
|
-
this.onChange(_schedule);
|
|
742
|
-
}}
|
|
743
|
-
/>
|
|
744
|
-
}
|
|
745
|
-
label={I18n.t('sch_astroDay')}
|
|
746
|
-
/>
|
|
747
|
-
</div>
|
|
748
|
-
)}
|
|
749
|
-
|
|
750
|
-
{!schedule.time.exactTime && (
|
|
751
|
-
<div>
|
|
752
|
-
<FormControlLabel
|
|
753
|
-
control={
|
|
754
|
-
<Radio
|
|
755
|
-
style={styles.inputRadio}
|
|
756
|
-
checked={!!night}
|
|
757
|
-
onClick={() => {
|
|
758
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
759
|
-
_schedule.time.start = 'sunset';
|
|
760
|
-
_schedule.time.end = 'sunrise';
|
|
761
|
-
this.onChange(_schedule);
|
|
762
|
-
}}
|
|
763
|
-
/>
|
|
764
|
-
}
|
|
765
|
-
label={I18n.t('sch_astroNight')}
|
|
766
|
-
/>
|
|
767
|
-
</div>
|
|
768
|
-
)}
|
|
769
|
-
</div>
|
|
770
|
-
{!schedule.time.exactTime && this.getPeriodSettingsMinutes(fromTo)}
|
|
771
|
-
</div>
|
|
772
|
-
</div>
|
|
773
|
-
);
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
getTimeExactElements(): JSX.Element {
|
|
777
|
-
const isAstro = ASTRO.includes(this.state.schedule.time.start);
|
|
778
|
-
|
|
779
|
-
return (
|
|
780
|
-
<div
|
|
781
|
-
key="timeExact"
|
|
782
|
-
style={styles.rowDiv}
|
|
783
|
-
>
|
|
784
|
-
<div style={styles.modeDiv}>
|
|
785
|
-
<FormControlLabel
|
|
786
|
-
control={
|
|
787
|
-
<Radio
|
|
788
|
-
style={styles.inputRadio}
|
|
789
|
-
checked={!!this.state.schedule.time.exactTime}
|
|
790
|
-
onClick={() => {
|
|
791
|
-
const schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
792
|
-
schedule.time.exactTime = true;
|
|
793
|
-
this.onChange(schedule);
|
|
794
|
-
}}
|
|
795
|
-
/>
|
|
796
|
-
}
|
|
797
|
-
label={I18n.t('sch_exactTime')}
|
|
798
|
-
/>
|
|
799
|
-
</div>
|
|
800
|
-
{this.state.schedule.time.exactTime && (
|
|
801
|
-
<Select
|
|
802
|
-
variant="standard"
|
|
803
|
-
value={isAstro ? this.state.schedule.time.start : '00:00'}
|
|
804
|
-
onChange={e => {
|
|
805
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
806
|
-
_schedule.time.start = e.target.value;
|
|
807
|
-
this.onChange(_schedule);
|
|
808
|
-
}}
|
|
809
|
-
>
|
|
810
|
-
<MenuItem
|
|
811
|
-
key="specific"
|
|
812
|
-
value="00:00"
|
|
813
|
-
>
|
|
814
|
-
{I18n.t('sch_specificTime')}
|
|
815
|
-
</MenuItem>
|
|
816
|
-
{ASTRO.map(event => (
|
|
817
|
-
<MenuItem
|
|
818
|
-
key={event}
|
|
819
|
-
value={event}
|
|
820
|
-
>
|
|
821
|
-
{I18n.t(`sch_astro_${event}`)}
|
|
822
|
-
</MenuItem>
|
|
823
|
-
))}
|
|
824
|
-
</Select>
|
|
825
|
-
)}
|
|
826
|
-
{this.state.schedule.time.exactTime && !isAstro && (
|
|
827
|
-
<div style={styles.settingsDiv}>
|
|
828
|
-
<TextField
|
|
829
|
-
variant="standard"
|
|
830
|
-
style={styles.inputTime}
|
|
831
|
-
key="exactTimeValue"
|
|
832
|
-
value={this.state.schedule.time.start}
|
|
833
|
-
type="time"
|
|
834
|
-
sx={(theme: Theme) => ({
|
|
835
|
-
'& input[type="time"]::-webkit-calendar-picker-indicator': {
|
|
836
|
-
filter: theme.palette.mode === 'dark' ? 'invert(80%)' : undefined,
|
|
837
|
-
},
|
|
838
|
-
})}
|
|
839
|
-
onChange={e => {
|
|
840
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
841
|
-
_schedule.time.start = e.target.value;
|
|
842
|
-
this.onChange(_schedule);
|
|
843
|
-
}}
|
|
844
|
-
slotProps={{
|
|
845
|
-
inputLabel: { shrink: true },
|
|
846
|
-
}}
|
|
847
|
-
margin="normal"
|
|
848
|
-
/>
|
|
849
|
-
</div>
|
|
850
|
-
)}
|
|
851
|
-
</div>
|
|
852
|
-
);
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
static getDivider(): JSX.Element {
|
|
856
|
-
return <hr style={styles.hr} />;
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
getPeriodModes(): JSX.Element[] {
|
|
860
|
-
const schedule = this.state.schedule;
|
|
861
|
-
const isOnce =
|
|
862
|
-
!schedule.period.dows &&
|
|
863
|
-
!schedule.period.months &&
|
|
864
|
-
!schedule.period.dates &&
|
|
865
|
-
!schedule.period.years &&
|
|
866
|
-
!schedule.period.days &&
|
|
867
|
-
!schedule.period.weeks;
|
|
868
|
-
if (isOnce && !schedule.period.once) {
|
|
869
|
-
schedule.period.once = Schedule.now2string(true);
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
return [
|
|
873
|
-
// ----- once ---
|
|
874
|
-
<div
|
|
875
|
-
key="once"
|
|
876
|
-
style={{ ...styles.rowDiv, ...styles.rowOnce }}
|
|
877
|
-
>
|
|
878
|
-
<div style={styles.modeDiv}>
|
|
879
|
-
<FormControlLabel
|
|
880
|
-
control={
|
|
881
|
-
<Radio
|
|
882
|
-
style={styles.inputRadio}
|
|
883
|
-
checked={!!isOnce}
|
|
884
|
-
onClick={() => {
|
|
885
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
886
|
-
_schedule.period.once = _schedule.period.once || Schedule.now2string(true);
|
|
887
|
-
_schedule.period.dows = '';
|
|
888
|
-
_schedule.period.months = '';
|
|
889
|
-
_schedule.period.dates = '';
|
|
890
|
-
_schedule.period.years = 0;
|
|
891
|
-
_schedule.period.yearDate = 0;
|
|
892
|
-
_schedule.period.yearMonth = 0;
|
|
893
|
-
_schedule.period.weeks = 0;
|
|
894
|
-
_schedule.period.days = 0;
|
|
895
|
-
this.onChange(_schedule);
|
|
896
|
-
}}
|
|
897
|
-
/>
|
|
898
|
-
}
|
|
899
|
-
label={I18n.t('sch_periodOnce')}
|
|
900
|
-
/>
|
|
901
|
-
</div>
|
|
902
|
-
{isOnce && (
|
|
903
|
-
<div style={styles.settingsDiv}>
|
|
904
|
-
<TextField
|
|
905
|
-
variant="standard"
|
|
906
|
-
style={styles.inputDate}
|
|
907
|
-
type="date"
|
|
908
|
-
ref={this.refOnce}
|
|
909
|
-
key="exactDateAt"
|
|
910
|
-
defaultValue={string2USdate(schedule.period.once)}
|
|
911
|
-
// InputProps={{inputComponent: TextTime}}
|
|
912
|
-
onChange={e => {
|
|
913
|
-
this.timerOnce && clearTimeout(this.timerOnce);
|
|
914
|
-
this.timerOnce = null;
|
|
915
|
-
|
|
916
|
-
if (this.refOnce.current) {
|
|
917
|
-
this.refOnce.current.style.background = '#ff000030';
|
|
918
|
-
}
|
|
919
|
-
this.timerOnce = setTimeout(
|
|
920
|
-
value => {
|
|
921
|
-
this.timerOnce = null;
|
|
922
|
-
if (this.refOnce.current) {
|
|
923
|
-
this.refOnce.current.style.background = '';
|
|
924
|
-
}
|
|
925
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
926
|
-
const date = Schedule.string2date(value);
|
|
927
|
-
if (date.toString() !== 'Invalid Date') {
|
|
928
|
-
_schedule.period.once = `${padding(date.getDate())}.${padding(date.getMonth() + 1)}.${date.getFullYear()}`;
|
|
929
|
-
this.onChange(_schedule);
|
|
930
|
-
}
|
|
931
|
-
},
|
|
932
|
-
1500,
|
|
933
|
-
e.target.value,
|
|
934
|
-
);
|
|
935
|
-
}}
|
|
936
|
-
slotProps={{
|
|
937
|
-
inputLabel: { shrink: true },
|
|
938
|
-
}}
|
|
939
|
-
label={I18n.t('sch_at')}
|
|
940
|
-
margin="normal"
|
|
941
|
-
/>
|
|
942
|
-
</div>
|
|
943
|
-
)}
|
|
944
|
-
</div>,
|
|
945
|
-
|
|
946
|
-
// ----- days ---
|
|
947
|
-
<Box
|
|
948
|
-
component="div"
|
|
949
|
-
key="days"
|
|
950
|
-
sx={Utils.getStyle(this.props.theme, styles.rowDiv, styles.rowDays)}
|
|
951
|
-
>
|
|
952
|
-
<div style={styles.modeDiv}>
|
|
953
|
-
<FormControlLabel
|
|
954
|
-
control={
|
|
955
|
-
<Radio
|
|
956
|
-
style={styles.inputRadio}
|
|
957
|
-
checked={!!schedule.period.days}
|
|
958
|
-
onClick={() => {
|
|
959
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
960
|
-
_schedule.period.days = 1;
|
|
961
|
-
_schedule.period.dows = '';
|
|
962
|
-
_schedule.period.months = '';
|
|
963
|
-
_schedule.period.dates = '';
|
|
964
|
-
_schedule.period.years = 0;
|
|
965
|
-
_schedule.period.yearDate = 0;
|
|
966
|
-
_schedule.period.yearMonth = 0;
|
|
967
|
-
_schedule.period.weeks = 0;
|
|
968
|
-
_schedule.period.once = '';
|
|
969
|
-
this.onChange(_schedule);
|
|
970
|
-
}}
|
|
971
|
-
/>
|
|
972
|
-
}
|
|
973
|
-
label={I18n.t('sch_periodDaily')}
|
|
974
|
-
/>
|
|
975
|
-
</div>
|
|
976
|
-
<div style={styles.settingsDiv}>
|
|
977
|
-
{this.getPeriodSettingsDaily()}
|
|
978
|
-
{schedule.period.days ? this.getPeriodSettingsWeekdays() : null}
|
|
979
|
-
</div>
|
|
980
|
-
</Box>,
|
|
981
|
-
|
|
982
|
-
// ----- days of weeks ---
|
|
983
|
-
/*
|
|
984
|
-
!schedule.period.days && (
|
|
985
|
-
<div key="dows" style={styles.rowDiv + ' ' + styles.rowDows}>
|
|
986
|
-
<div style={styles.modeDiv}>
|
|
987
|
-
<FormControlLabel control={<Radio style={styles.inputRadio} checked={!!schedule.period.dows} onClick={() => {
|
|
988
|
-
const schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
989
|
-
schedule.period.dows = schedule.period.dows ? '' : '[0,1,2,3,4,5,6]';
|
|
990
|
-
this.onChange(schedule);
|
|
991
|
-
}}/>}
|
|
992
|
-
label={I18n.t('sch_periodWeekdays')} />
|
|
993
|
-
</div>
|
|
994
|
-
<div style={styles.settingsDiv}>
|
|
995
|
-
{this.getPeriodSettingsWeekdays()}
|
|
996
|
-
</div>
|
|
997
|
-
</div>,
|
|
998
|
-
*/
|
|
999
|
-
// ----- weeks ---
|
|
1000
|
-
<Box
|
|
1001
|
-
component="div"
|
|
1002
|
-
key="weeks"
|
|
1003
|
-
sx={Utils.getStyle(this.props.theme, styles.rowDiv, styles.rowDows)}
|
|
1004
|
-
>
|
|
1005
|
-
<div style={styles.modeDiv}>
|
|
1006
|
-
<FormControlLabel
|
|
1007
|
-
control={
|
|
1008
|
-
<Radio
|
|
1009
|
-
style={styles.inputRadio}
|
|
1010
|
-
checked={!!schedule.period.weeks}
|
|
1011
|
-
onClick={() => {
|
|
1012
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1013
|
-
_schedule.period.weeks = schedule.period.weeks ? 0 : 1;
|
|
1014
|
-
_schedule.period.dows = schedule.period.dows || '[0]';
|
|
1015
|
-
_schedule.period.months = '';
|
|
1016
|
-
_schedule.period.dates = '';
|
|
1017
|
-
_schedule.period.years = 0;
|
|
1018
|
-
_schedule.period.yearDate = 0;
|
|
1019
|
-
_schedule.period.yearMonth = 0;
|
|
1020
|
-
_schedule.period.days = 0;
|
|
1021
|
-
_schedule.period.once = '';
|
|
1022
|
-
this.onChange(_schedule);
|
|
1023
|
-
}}
|
|
1024
|
-
/>
|
|
1025
|
-
}
|
|
1026
|
-
label={I18n.t('sch_periodWeekly')}
|
|
1027
|
-
/>
|
|
1028
|
-
</div>
|
|
1029
|
-
<Box
|
|
1030
|
-
component="div"
|
|
1031
|
-
style={styles.settingsDiv}
|
|
1032
|
-
>
|
|
1033
|
-
<div style={styles.settingsDiv}>{this.getPeriodSettingsWeekly()}</div>
|
|
1034
|
-
<Box
|
|
1035
|
-
component="div"
|
|
1036
|
-
sx={Utils.getStyle(this.props.theme, styles.settingsDiv, styles.rowDowsDows)}
|
|
1037
|
-
>
|
|
1038
|
-
{this.state.schedule.period.weeks ? this.getPeriodSettingsWeekdays() : null}
|
|
1039
|
-
</Box>
|
|
1040
|
-
</Box>
|
|
1041
|
-
</Box>,
|
|
1042
|
-
|
|
1043
|
-
// ----- months ---
|
|
1044
|
-
<Box
|
|
1045
|
-
component="div"
|
|
1046
|
-
key="months"
|
|
1047
|
-
sx={Utils.getStyle(this.props.theme, styles.rowDiv, styles.rowMonths)}
|
|
1048
|
-
>
|
|
1049
|
-
<div style={styles.modeDiv}>
|
|
1050
|
-
<FormControlLabel
|
|
1051
|
-
control={
|
|
1052
|
-
<Radio
|
|
1053
|
-
style={styles.inputRadio}
|
|
1054
|
-
checked={!!schedule.period.months}
|
|
1055
|
-
onClick={() => {
|
|
1056
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1057
|
-
_schedule.period.months = 1;
|
|
1058
|
-
_schedule.period.dows = '';
|
|
1059
|
-
_schedule.period.dates = '';
|
|
1060
|
-
_schedule.period.years = 0;
|
|
1061
|
-
_schedule.period.yearDate = 0;
|
|
1062
|
-
_schedule.period.yearMonth = 0;
|
|
1063
|
-
_schedule.period.weeks = 0;
|
|
1064
|
-
_schedule.period.days = 0;
|
|
1065
|
-
_schedule.period.once = '';
|
|
1066
|
-
this.onChange(_schedule);
|
|
1067
|
-
}}
|
|
1068
|
-
/>
|
|
1069
|
-
}
|
|
1070
|
-
label={I18n.t('sch_periodMonthly')}
|
|
1071
|
-
/>
|
|
1072
|
-
</div>
|
|
1073
|
-
<div style={styles.settingsDiv}>
|
|
1074
|
-
{this.getPeriodSettingsMonthly()}
|
|
1075
|
-
{schedule.period.months ? (
|
|
1076
|
-
<Box>
|
|
1077
|
-
<Box
|
|
1078
|
-
component="div"
|
|
1079
|
-
sx={Utils.getStyle(this.props.theme, styles.settingsDiv, styles.rowMonthsDates)}
|
|
1080
|
-
>
|
|
1081
|
-
<FormControlLabel
|
|
1082
|
-
control={
|
|
1083
|
-
<Checkbox
|
|
1084
|
-
style={styles.inputRadio}
|
|
1085
|
-
checked={!!schedule.period.dates}
|
|
1086
|
-
onClick={() => {
|
|
1087
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1088
|
-
_schedule.period.months = _schedule.period.months || 1;
|
|
1089
|
-
const dates = [];
|
|
1090
|
-
for (let i = 1; i <= 31; i++) {
|
|
1091
|
-
dates.push(i);
|
|
1092
|
-
}
|
|
1093
|
-
_schedule.period.dates =
|
|
1094
|
-
_schedule.period.dates || JSON.stringify(dates);
|
|
1095
|
-
_schedule.period.dows = '';
|
|
1096
|
-
_schedule.period.years = 0;
|
|
1097
|
-
_schedule.period.yearDate = 0;
|
|
1098
|
-
_schedule.period.yearMonth = 0;
|
|
1099
|
-
_schedule.period.weeks = 0;
|
|
1100
|
-
_schedule.period.days = 0;
|
|
1101
|
-
_schedule.period.once = '';
|
|
1102
|
-
|
|
1103
|
-
this.onChange(_schedule);
|
|
1104
|
-
}}
|
|
1105
|
-
/>
|
|
1106
|
-
}
|
|
1107
|
-
label={I18n.t('sch_periodDates')}
|
|
1108
|
-
/>
|
|
1109
|
-
</Box>
|
|
1110
|
-
<Box
|
|
1111
|
-
component="div"
|
|
1112
|
-
sx={Utils.getStyle(this.props.theme, styles.settingsDiv, styles.rowMonthsDates)}
|
|
1113
|
-
>
|
|
1114
|
-
{this.getPeriodSettingsDates()}
|
|
1115
|
-
</Box>
|
|
1116
|
-
</Box>
|
|
1117
|
-
) : null}
|
|
1118
|
-
</div>
|
|
1119
|
-
</Box>,
|
|
1120
|
-
|
|
1121
|
-
// ----- years ---
|
|
1122
|
-
<Box
|
|
1123
|
-
component="div"
|
|
1124
|
-
key="years"
|
|
1125
|
-
sx={Utils.getStyle(this.props.theme, styles.rowDiv, styles.rowYears)}
|
|
1126
|
-
>
|
|
1127
|
-
<div style={styles.modeDiv}>
|
|
1128
|
-
<FormControlLabel
|
|
1129
|
-
control={
|
|
1130
|
-
<Radio
|
|
1131
|
-
style={styles.inputRadio}
|
|
1132
|
-
checked={!!schedule.period.years}
|
|
1133
|
-
onClick={() => {
|
|
1134
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1135
|
-
_schedule.period.years = 1;
|
|
1136
|
-
_schedule.period.yearDate = 1;
|
|
1137
|
-
_schedule.period.yearMonth = 1;
|
|
1138
|
-
_schedule.period.dows = '';
|
|
1139
|
-
_schedule.period.months = 0;
|
|
1140
|
-
_schedule.period.dates = '';
|
|
1141
|
-
_schedule.period.weeks = 0;
|
|
1142
|
-
_schedule.period.days = 0;
|
|
1143
|
-
_schedule.period.once = '';
|
|
1144
|
-
this.onChange(_schedule);
|
|
1145
|
-
}}
|
|
1146
|
-
/>
|
|
1147
|
-
}
|
|
1148
|
-
label={I18n.t('sch_periodYearly')}
|
|
1149
|
-
/>
|
|
1150
|
-
</div>
|
|
1151
|
-
<div style={styles.settingsDiv}>
|
|
1152
|
-
<div style={styles.settingsDiv}>{this.getPeriodSettingsYearly()}</div>
|
|
1153
|
-
{!!schedule.period.years && (
|
|
1154
|
-
<div style={styles.settingsDiv}>
|
|
1155
|
-
<span>{I18n.t('sch_on')}</span>
|
|
1156
|
-
<Input
|
|
1157
|
-
key="input"
|
|
1158
|
-
value={this.state.schedule.period.yearDate}
|
|
1159
|
-
style={styles.inputEvery}
|
|
1160
|
-
type="number"
|
|
1161
|
-
inputProps={{ min: 1, max: 31 }}
|
|
1162
|
-
onChange={e => {
|
|
1163
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1164
|
-
_schedule.period.yearDate = parseInt(e.target.value, 10);
|
|
1165
|
-
if (_schedule.period.yearDate < 1) {
|
|
1166
|
-
_schedule.period.yearDate = 31;
|
|
1167
|
-
}
|
|
1168
|
-
if (_schedule.period.yearDate > 31) {
|
|
1169
|
-
_schedule.period.yearDate = 1;
|
|
1170
|
-
}
|
|
1171
|
-
this.onChange(_schedule);
|
|
1172
|
-
}}
|
|
1173
|
-
/>
|
|
1174
|
-
<Select
|
|
1175
|
-
variant="standard"
|
|
1176
|
-
value={schedule.period.yearMonth}
|
|
1177
|
-
onChange={e => {
|
|
1178
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1179
|
-
_schedule.period.yearMonth = e.target.value;
|
|
1180
|
-
this.onChange(_schedule);
|
|
1181
|
-
}}
|
|
1182
|
-
>
|
|
1183
|
-
<MenuItem
|
|
1184
|
-
key="every"
|
|
1185
|
-
value={0}
|
|
1186
|
-
>
|
|
1187
|
-
{I18n.t('sch_yearEveryMonth')}
|
|
1188
|
-
</MenuItem>
|
|
1189
|
-
{MONTHS.map((month, i) => (
|
|
1190
|
-
<MenuItem
|
|
1191
|
-
key={month}
|
|
1192
|
-
value={i + 1}
|
|
1193
|
-
>
|
|
1194
|
-
{I18n.t(month)}
|
|
1195
|
-
</MenuItem>
|
|
1196
|
-
))}
|
|
1197
|
-
</Select>
|
|
1198
|
-
</div>
|
|
1199
|
-
)}
|
|
1200
|
-
</div>
|
|
1201
|
-
</Box>,
|
|
1202
|
-
];
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
getPeriodSettingsMinutes(fromTo: boolean): JSX.Element {
|
|
1206
|
-
return (
|
|
1207
|
-
<div style={{ display: 'inline-block', marginTop: fromTo ? 15 : 'inherit' }}>
|
|
1208
|
-
<label style={{ marginLeft: 4, marginRight: 4 }}>{I18n.t('sch_every')}</label>
|
|
1209
|
-
<Input
|
|
1210
|
-
value={this.state.schedule.time.interval}
|
|
1211
|
-
style={{
|
|
1212
|
-
...styles.inputEvery,
|
|
1213
|
-
verticalAlign: 'bottom',
|
|
1214
|
-
}}
|
|
1215
|
-
type="number"
|
|
1216
|
-
inputProps={{ min: 1 }}
|
|
1217
|
-
onChange={e => {
|
|
1218
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1219
|
-
_schedule.time.interval = parseInt(e.target.value, 10);
|
|
1220
|
-
this.onChange(_schedule);
|
|
1221
|
-
}}
|
|
1222
|
-
/>
|
|
1223
|
-
<Select
|
|
1224
|
-
variant="standard"
|
|
1225
|
-
value={this.state.schedule.time.mode}
|
|
1226
|
-
onChange={e => {
|
|
1227
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1228
|
-
_schedule.time.mode = e.target.value;
|
|
1229
|
-
this.onChange(_schedule);
|
|
1230
|
-
}}
|
|
1231
|
-
>
|
|
1232
|
-
<MenuItem value={PERIODS.minutes}>{I18n.t('sch_periodMinutes')}</MenuItem>
|
|
1233
|
-
<MenuItem value={PERIODS.hours}>{I18n.t('sch_periodHours')}</MenuItem>
|
|
1234
|
-
</Select>
|
|
1235
|
-
</div>
|
|
1236
|
-
);
|
|
1237
|
-
}
|
|
1238
|
-
|
|
1239
|
-
getPeriodSettingsWeekdays(): JSX.Element[] {
|
|
1240
|
-
// || this.state.schedule.period.dows === '[1, 2, 3, 4, 5]' || this.state.schedule.period.dows === '[0, 6]'
|
|
1241
|
-
const schedule = this.state.schedule;
|
|
1242
|
-
const isSpecific =
|
|
1243
|
-
schedule.period.dows && schedule.period.dows !== '[1, 2, 3, 4, 5]' && schedule.period.dows !== '[0, 6]';
|
|
1244
|
-
return [
|
|
1245
|
-
<div key="workdays">
|
|
1246
|
-
<FormControlLabel
|
|
1247
|
-
control={
|
|
1248
|
-
<Radio
|
|
1249
|
-
style={styles.inputRadio}
|
|
1250
|
-
checked={schedule.period.dows === '[1, 2, 3, 4, 5]'}
|
|
1251
|
-
onClick={() => {
|
|
1252
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1253
|
-
_schedule.period.dows = '[1, 2, 3, 4, 5]';
|
|
1254
|
-
if (_schedule.period.days) {
|
|
1255
|
-
_schedule.period.days = 1;
|
|
1256
|
-
}
|
|
1257
|
-
this.onChange(_schedule);
|
|
1258
|
-
}}
|
|
1259
|
-
/>
|
|
1260
|
-
}
|
|
1261
|
-
label={I18n.t('sch_periodWorkdays')}
|
|
1262
|
-
/>
|
|
1263
|
-
</div>,
|
|
1264
|
-
|
|
1265
|
-
<div key="weekend">
|
|
1266
|
-
<FormControlLabel
|
|
1267
|
-
control={
|
|
1268
|
-
<Radio
|
|
1269
|
-
style={styles.inputRadio}
|
|
1270
|
-
checked={schedule.period.dows === '[0, 6]'}
|
|
1271
|
-
onClick={() => {
|
|
1272
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1273
|
-
_schedule.period.dows = '[0, 6]';
|
|
1274
|
-
if (_schedule.period.days) {
|
|
1275
|
-
_schedule.period.days = 1;
|
|
1276
|
-
}
|
|
1277
|
-
this.onChange(_schedule);
|
|
1278
|
-
}}
|
|
1279
|
-
/>
|
|
1280
|
-
}
|
|
1281
|
-
label={I18n.t('sch_periodWeekend')}
|
|
1282
|
-
/>
|
|
1283
|
-
</div>,
|
|
1284
|
-
|
|
1285
|
-
<div
|
|
1286
|
-
key="specific"
|
|
1287
|
-
style={{ verticalAlign: 'top' }}
|
|
1288
|
-
>
|
|
1289
|
-
<FormControlLabel
|
|
1290
|
-
style={{ verticalAlign: 'top' }}
|
|
1291
|
-
control={
|
|
1292
|
-
<Radio
|
|
1293
|
-
style={styles.inputRadio}
|
|
1294
|
-
checked={!!isSpecific}
|
|
1295
|
-
onClick={() => {
|
|
1296
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1297
|
-
_schedule.period.dows = '[0, 1, 2, 3, 4, 5, 6]';
|
|
1298
|
-
if (_schedule.period.days) {
|
|
1299
|
-
_schedule.period.days = 1;
|
|
1300
|
-
}
|
|
1301
|
-
this.onChange(_schedule);
|
|
1302
|
-
}}
|
|
1303
|
-
/>
|
|
1304
|
-
}
|
|
1305
|
-
label={I18n.t('sch_periodWeekdays')}
|
|
1306
|
-
/>
|
|
1307
|
-
{isSpecific && (schedule.period.days === 1 || schedule.period.weeks) && (
|
|
1308
|
-
<FormGroup
|
|
1309
|
-
row
|
|
1310
|
-
style={{ ...styles.inputGroup, width: 150 }}
|
|
1311
|
-
>
|
|
1312
|
-
{[1, 2, 3, 4, 5, 6, 0].map(i => (
|
|
1313
|
-
<FormControlLabel
|
|
1314
|
-
key={`specific_${i}`}
|
|
1315
|
-
style={styles.inputGroupElement}
|
|
1316
|
-
control={
|
|
1317
|
-
<Checkbox
|
|
1318
|
-
style={styles.inputSmallCheck}
|
|
1319
|
-
checked={schedule.period.dows.includes(i.toString())}
|
|
1320
|
-
onChange={e => {
|
|
1321
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1322
|
-
let daysOfWeek: number[];
|
|
1323
|
-
try {
|
|
1324
|
-
daysOfWeek = JSON.parse(_schedule.period.dows);
|
|
1325
|
-
} catch {
|
|
1326
|
-
daysOfWeek = [];
|
|
1327
|
-
}
|
|
1328
|
-
if (e.target.checked && !daysOfWeek.includes(i)) {
|
|
1329
|
-
daysOfWeek.push(i);
|
|
1330
|
-
} else if (!e.target.checked && daysOfWeek.includes(i)) {
|
|
1331
|
-
daysOfWeek.splice(daysOfWeek.indexOf(i), 1);
|
|
1332
|
-
}
|
|
1333
|
-
daysOfWeek.sort((a: number, b: number) => a - b);
|
|
1334
|
-
_schedule.period.dows = JSON.stringify(daysOfWeek);
|
|
1335
|
-
if (_schedule.period.days) {
|
|
1336
|
-
_schedule.period.days = 1;
|
|
1337
|
-
}
|
|
1338
|
-
this.onChange(_schedule);
|
|
1339
|
-
}}
|
|
1340
|
-
/>
|
|
1341
|
-
}
|
|
1342
|
-
label={I18n.t(WEEKDAYS[i])}
|
|
1343
|
-
/>
|
|
1344
|
-
))}
|
|
1345
|
-
</FormGroup>
|
|
1346
|
-
)}
|
|
1347
|
-
</div>,
|
|
1348
|
-
];
|
|
1349
|
-
}
|
|
1350
|
-
|
|
1351
|
-
getPeriodSettingsDaily(): JSX.Element[] | null {
|
|
1352
|
-
if (!this.state.schedule.period.days) {
|
|
1353
|
-
return null;
|
|
1354
|
-
}
|
|
1355
|
-
const schedule = this.state.schedule;
|
|
1356
|
-
return [
|
|
1357
|
-
<div key="every_day">
|
|
1358
|
-
<FormControlLabel
|
|
1359
|
-
control={
|
|
1360
|
-
<Radio
|
|
1361
|
-
style={styles.inputRadio}
|
|
1362
|
-
checked={schedule.period.days === 1 && !schedule.period.dows}
|
|
1363
|
-
onClick={() => {
|
|
1364
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1365
|
-
_schedule.period.days = 1;
|
|
1366
|
-
_schedule.period.dows = '';
|
|
1367
|
-
this.onChange(_schedule);
|
|
1368
|
-
}}
|
|
1369
|
-
/>
|
|
1370
|
-
}
|
|
1371
|
-
label={I18n.t('sch_periodEveryDay')}
|
|
1372
|
-
/>
|
|
1373
|
-
</div>,
|
|
1374
|
-
<div key="everyN_day">
|
|
1375
|
-
<FormControlLabel
|
|
1376
|
-
control={
|
|
1377
|
-
<Radio
|
|
1378
|
-
style={styles.inputRadio}
|
|
1379
|
-
checked={schedule.period.days > 1}
|
|
1380
|
-
onClick={() => {
|
|
1381
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1382
|
-
_schedule.period.days = 2;
|
|
1383
|
-
_schedule.period.dows = '';
|
|
1384
|
-
this.onChange(_schedule);
|
|
1385
|
-
}}
|
|
1386
|
-
/>
|
|
1387
|
-
}
|
|
1388
|
-
label={I18n.t('sch_periodEvery')}
|
|
1389
|
-
/>
|
|
1390
|
-
{schedule.period.days > 1 && [
|
|
1391
|
-
<Input
|
|
1392
|
-
key="input"
|
|
1393
|
-
value={this.state.schedule.period.days}
|
|
1394
|
-
style={styles.inputEvery}
|
|
1395
|
-
type="number"
|
|
1396
|
-
inputProps={{ min: 2 }}
|
|
1397
|
-
onChange={e => {
|
|
1398
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1399
|
-
_schedule.period.days = parseInt(e.target.value, 10);
|
|
1400
|
-
_schedule.period.dows = '';
|
|
1401
|
-
this.onChange(_schedule);
|
|
1402
|
-
}}
|
|
1403
|
-
/>,
|
|
1404
|
-
<span
|
|
1405
|
-
key="span"
|
|
1406
|
-
style={{ paddingRight: 10 }}
|
|
1407
|
-
>
|
|
1408
|
-
{I18n.t('sch_periodDay')}
|
|
1409
|
-
</span>,
|
|
1410
|
-
]}
|
|
1411
|
-
</div>,
|
|
1412
|
-
];
|
|
1413
|
-
}
|
|
1414
|
-
|
|
1415
|
-
getPeriodSettingsWeekly(): JSX.Element[] | null {
|
|
1416
|
-
if (!this.state.schedule.period.weeks) {
|
|
1417
|
-
return null;
|
|
1418
|
-
}
|
|
1419
|
-
const schedule = this.state.schedule;
|
|
1420
|
-
return [
|
|
1421
|
-
<div
|
|
1422
|
-
key="radios"
|
|
1423
|
-
style={{ display: 'inline-block', verticalAlign: 'top' }}
|
|
1424
|
-
>
|
|
1425
|
-
<div>
|
|
1426
|
-
<FormControlLabel
|
|
1427
|
-
control={
|
|
1428
|
-
<Radio
|
|
1429
|
-
style={styles.inputRadio}
|
|
1430
|
-
checked={schedule.period.weeks === 1}
|
|
1431
|
-
onClick={() => {
|
|
1432
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1433
|
-
_schedule.period.weeks = 1;
|
|
1434
|
-
this.onChange(_schedule);
|
|
1435
|
-
}}
|
|
1436
|
-
/>
|
|
1437
|
-
}
|
|
1438
|
-
label={I18n.t('sch_periodEveryWeek')}
|
|
1439
|
-
/>
|
|
1440
|
-
</div>
|
|
1441
|
-
<div>
|
|
1442
|
-
<FormControlLabel
|
|
1443
|
-
control={
|
|
1444
|
-
<Radio
|
|
1445
|
-
style={styles.inputRadio}
|
|
1446
|
-
checked={schedule.period.weeks > 1}
|
|
1447
|
-
onClick={() => {
|
|
1448
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1449
|
-
_schedule.period.weeks = 2;
|
|
1450
|
-
this.onChange(_schedule);
|
|
1451
|
-
}}
|
|
1452
|
-
/>
|
|
1453
|
-
}
|
|
1454
|
-
label={I18n.t('sch_periodEvery')}
|
|
1455
|
-
/>
|
|
1456
|
-
{schedule.period.weeks > 1 && [
|
|
1457
|
-
<Input
|
|
1458
|
-
key="input"
|
|
1459
|
-
value={this.state.schedule.period.weeks}
|
|
1460
|
-
style={styles.inputEvery}
|
|
1461
|
-
type="number"
|
|
1462
|
-
inputProps={{ min: 2 }}
|
|
1463
|
-
onChange={e => {
|
|
1464
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1465
|
-
_schedule.period.weeks = parseInt(e.target.value, 10);
|
|
1466
|
-
this.onChange(_schedule);
|
|
1467
|
-
}}
|
|
1468
|
-
/>,
|
|
1469
|
-
<span key="text">{I18n.t('sch_periodWeek')}</span>,
|
|
1470
|
-
]}
|
|
1471
|
-
</div>
|
|
1472
|
-
</div>,
|
|
1473
|
-
];
|
|
1474
|
-
}
|
|
1475
|
-
|
|
1476
|
-
getPeriodSettingsDates(): JSX.Element | null {
|
|
1477
|
-
if (!this.state.schedule.period.dates) {
|
|
1478
|
-
return null;
|
|
1479
|
-
}
|
|
1480
|
-
const schedule = this.state.schedule;
|
|
1481
|
-
|
|
1482
|
-
const dates = [];
|
|
1483
|
-
for (let i = 1; i <= 31; i++) {
|
|
1484
|
-
dates.push(i);
|
|
1485
|
-
}
|
|
1486
|
-
|
|
1487
|
-
const parsedDates = JSON.parse(schedule.period.dates);
|
|
1488
|
-
|
|
1489
|
-
return (
|
|
1490
|
-
<FormGroup
|
|
1491
|
-
row
|
|
1492
|
-
style={{ ...styles.inputGroup, maxWidth: 620 }}
|
|
1493
|
-
>
|
|
1494
|
-
<FormControlLabel
|
|
1495
|
-
style={styles.inputDateDay}
|
|
1496
|
-
control={
|
|
1497
|
-
<Checkbox
|
|
1498
|
-
style={styles.inputDateDayCheck}
|
|
1499
|
-
checked={parsedDates.length === 31}
|
|
1500
|
-
onChange={() => {
|
|
1501
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1502
|
-
const _dates = [];
|
|
1503
|
-
for (let i = 1; i <= 31; i++) {
|
|
1504
|
-
_dates.push(i);
|
|
1505
|
-
}
|
|
1506
|
-
_schedule.period.dates = JSON.stringify(_dates);
|
|
1507
|
-
this.onChange(_schedule);
|
|
1508
|
-
}}
|
|
1509
|
-
/>
|
|
1510
|
-
}
|
|
1511
|
-
label={I18n.t('sch_all')}
|
|
1512
|
-
/>
|
|
1513
|
-
<FormControlLabel
|
|
1514
|
-
style={styles.inputDateDay}
|
|
1515
|
-
control={
|
|
1516
|
-
<Checkbox
|
|
1517
|
-
style={styles.inputDateDayCheck}
|
|
1518
|
-
checked={!parsedDates.length}
|
|
1519
|
-
onChange={() => {
|
|
1520
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1521
|
-
_schedule.period.dates = '[]';
|
|
1522
|
-
this.onChange(_schedule);
|
|
1523
|
-
}}
|
|
1524
|
-
/>
|
|
1525
|
-
}
|
|
1526
|
-
label={I18n.t('sch_no_one')}
|
|
1527
|
-
/>
|
|
1528
|
-
{parsedDates.length !== 31 && !!parsedDates.length && (
|
|
1529
|
-
<FormControlLabel
|
|
1530
|
-
style={styles.inputDateDay}
|
|
1531
|
-
control={
|
|
1532
|
-
<Checkbox
|
|
1533
|
-
style={styles.inputDateDayCheck}
|
|
1534
|
-
checked={false}
|
|
1535
|
-
onChange={() => {
|
|
1536
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1537
|
-
const result = [];
|
|
1538
|
-
const _parsedDates = JSON.parse(_schedule.period.dates);
|
|
1539
|
-
for (let i = 1; i <= 31; i++) {
|
|
1540
|
-
if (!_parsedDates.includes(i)) {
|
|
1541
|
-
result.push(i);
|
|
1542
|
-
}
|
|
1543
|
-
}
|
|
1544
|
-
result.sort((a, b) => a - b);
|
|
1545
|
-
_schedule.period.dates = JSON.stringify(result);
|
|
1546
|
-
this.onChange(_schedule);
|
|
1547
|
-
}}
|
|
1548
|
-
/>
|
|
1549
|
-
}
|
|
1550
|
-
label={I18n.t('sch_invert')}
|
|
1551
|
-
/>
|
|
1552
|
-
)}
|
|
1553
|
-
<div />
|
|
1554
|
-
{dates.map(i => (
|
|
1555
|
-
<FormControlLabel
|
|
1556
|
-
key={`date_${i}`}
|
|
1557
|
-
style={
|
|
1558
|
-
!i
|
|
1559
|
-
? {
|
|
1560
|
-
...styles.inputDateDay,
|
|
1561
|
-
opacity: 0,
|
|
1562
|
-
cursor: 'default',
|
|
1563
|
-
userSelect: 'none',
|
|
1564
|
-
pointerEvents: 'none',
|
|
1565
|
-
}
|
|
1566
|
-
: styles.inputDateDay
|
|
1567
|
-
}
|
|
1568
|
-
control={
|
|
1569
|
-
<Checkbox
|
|
1570
|
-
style={styles.inputDateDayCheck}
|
|
1571
|
-
checked={JSON.parse(schedule.period.dates).includes(i)}
|
|
1572
|
-
onChange={e => {
|
|
1573
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1574
|
-
let _dates;
|
|
1575
|
-
try {
|
|
1576
|
-
_dates = JSON.parse(_schedule.period.dates);
|
|
1577
|
-
} catch {
|
|
1578
|
-
_dates = [];
|
|
1579
|
-
}
|
|
1580
|
-
if (e.target.checked && !_dates.includes(i)) {
|
|
1581
|
-
_dates.push(i);
|
|
1582
|
-
} else if (!e.target.checked && _dates.includes(i)) {
|
|
1583
|
-
_dates.splice(_dates.indexOf(i), 1);
|
|
1584
|
-
}
|
|
1585
|
-
_dates.sort((a: number, b: number) => a - b);
|
|
1586
|
-
_schedule.period.dates = JSON.stringify(_dates);
|
|
1587
|
-
this.onChange(_schedule);
|
|
1588
|
-
}}
|
|
1589
|
-
/>
|
|
1590
|
-
}
|
|
1591
|
-
label={
|
|
1592
|
-
i < 10
|
|
1593
|
-
? [
|
|
1594
|
-
<span
|
|
1595
|
-
key="0"
|
|
1596
|
-
style={{ opacity: 0 }}
|
|
1597
|
-
>
|
|
1598
|
-
0
|
|
1599
|
-
</span>,
|
|
1600
|
-
<span key="num">{i}</span>,
|
|
1601
|
-
]
|
|
1602
|
-
: i
|
|
1603
|
-
}
|
|
1604
|
-
/>
|
|
1605
|
-
))}
|
|
1606
|
-
</FormGroup>
|
|
1607
|
-
);
|
|
1608
|
-
}
|
|
1609
|
-
|
|
1610
|
-
getPeriodSettingsMonthly(): JSX.Element[] | null {
|
|
1611
|
-
if (!this.state.schedule.period.months) {
|
|
1612
|
-
return null;
|
|
1613
|
-
}
|
|
1614
|
-
const schedule = this.state.schedule;
|
|
1615
|
-
const parsedMonths = typeof schedule.period.months === 'string' ? JSON.parse(schedule.period.months) : [];
|
|
1616
|
-
|
|
1617
|
-
return [
|
|
1618
|
-
<div key="every">
|
|
1619
|
-
<FormControlLabel
|
|
1620
|
-
control={
|
|
1621
|
-
<Radio
|
|
1622
|
-
style={styles.inputRadio}
|
|
1623
|
-
checked={typeof schedule.period.months === 'number' && schedule.period.months === 1}
|
|
1624
|
-
onClick={() => {
|
|
1625
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1626
|
-
_schedule.period.months = 1;
|
|
1627
|
-
this.onChange(schedule);
|
|
1628
|
-
}}
|
|
1629
|
-
/>
|
|
1630
|
-
}
|
|
1631
|
-
label={I18n.t('sch_periodEveryMonth')}
|
|
1632
|
-
/>
|
|
1633
|
-
</div>,
|
|
1634
|
-
<div key="everyN">
|
|
1635
|
-
<FormControlLabel
|
|
1636
|
-
control={
|
|
1637
|
-
<Radio
|
|
1638
|
-
style={styles.inputRadio}
|
|
1639
|
-
checked={typeof schedule.period.months === 'number' && schedule.period.months > 1}
|
|
1640
|
-
onClick={() => {
|
|
1641
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1642
|
-
_schedule.period.months = 2;
|
|
1643
|
-
this.onChange(_schedule);
|
|
1644
|
-
}}
|
|
1645
|
-
/>
|
|
1646
|
-
}
|
|
1647
|
-
label={I18n.t('sch_periodEvery')}
|
|
1648
|
-
/>
|
|
1649
|
-
{typeof schedule.period.months === 'number' &&
|
|
1650
|
-
schedule.period.months > 1 && [
|
|
1651
|
-
<Input
|
|
1652
|
-
key="input"
|
|
1653
|
-
value={schedule.period.months}
|
|
1654
|
-
style={styles.inputEvery}
|
|
1655
|
-
type="number"
|
|
1656
|
-
inputProps={{ min: 2 }}
|
|
1657
|
-
onChange={e => {
|
|
1658
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1659
|
-
_schedule.period.months = parseInt(e.target.value, 10);
|
|
1660
|
-
if (_schedule.period.months < 1) {
|
|
1661
|
-
_schedule.period.months = 1;
|
|
1662
|
-
}
|
|
1663
|
-
this.onChange(_schedule);
|
|
1664
|
-
}}
|
|
1665
|
-
/>,
|
|
1666
|
-
<span key="text">{I18n.t('sch_periodMonth')}</span>,
|
|
1667
|
-
]}
|
|
1668
|
-
</div>,
|
|
1669
|
-
<div
|
|
1670
|
-
key="specific"
|
|
1671
|
-
style={{ verticalAlign: 'top' }}
|
|
1672
|
-
>
|
|
1673
|
-
<FormControlLabel
|
|
1674
|
-
style={{ verticalAlign: 'top' }}
|
|
1675
|
-
control={
|
|
1676
|
-
<Radio
|
|
1677
|
-
style={styles.inputRadio}
|
|
1678
|
-
checked={typeof schedule.period.months === 'string'}
|
|
1679
|
-
onClick={() => {
|
|
1680
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1681
|
-
_schedule.period.months = '[1,2,3,4,5,6,7,8,9,10,11,12]';
|
|
1682
|
-
this.onChange(_schedule);
|
|
1683
|
-
}}
|
|
1684
|
-
/>
|
|
1685
|
-
}
|
|
1686
|
-
label={I18n.t('sch_periodSpecificMonths')}
|
|
1687
|
-
/>
|
|
1688
|
-
{typeof schedule.period.months === 'string' && (
|
|
1689
|
-
<FormGroup
|
|
1690
|
-
row
|
|
1691
|
-
style={styles.inputGroup}
|
|
1692
|
-
>
|
|
1693
|
-
<FormControlLabel
|
|
1694
|
-
style={styles.inputDateDay}
|
|
1695
|
-
control={
|
|
1696
|
-
<Checkbox
|
|
1697
|
-
style={styles.inputDateDayCheck}
|
|
1698
|
-
checked={parsedMonths.length === 12}
|
|
1699
|
-
onChange={() => {
|
|
1700
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1701
|
-
const months = [];
|
|
1702
|
-
for (let i = 1; i <= 12; i++) {
|
|
1703
|
-
months.push(i);
|
|
1704
|
-
}
|
|
1705
|
-
_schedule.period.months = JSON.stringify(months);
|
|
1706
|
-
this.onChange(_schedule);
|
|
1707
|
-
}}
|
|
1708
|
-
/>
|
|
1709
|
-
}
|
|
1710
|
-
label={I18n.t('sch_all')}
|
|
1711
|
-
/>
|
|
1712
|
-
<FormControlLabel
|
|
1713
|
-
style={styles.inputDateDay}
|
|
1714
|
-
control={
|
|
1715
|
-
<Checkbox
|
|
1716
|
-
style={styles.inputDateDayCheck}
|
|
1717
|
-
checked={!parsedMonths.length}
|
|
1718
|
-
onChange={() => {
|
|
1719
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1720
|
-
_schedule.period.months = '[]';
|
|
1721
|
-
this.onChange(_schedule);
|
|
1722
|
-
}}
|
|
1723
|
-
/>
|
|
1724
|
-
}
|
|
1725
|
-
label={I18n.t('sch_no_one')}
|
|
1726
|
-
/>
|
|
1727
|
-
{parsedMonths.length !== 12 && !!parsedMonths.length && (
|
|
1728
|
-
<FormControlLabel
|
|
1729
|
-
style={styles.inputDateDay}
|
|
1730
|
-
control={
|
|
1731
|
-
<Checkbox
|
|
1732
|
-
style={styles.inputDateDayCheck}
|
|
1733
|
-
checked={false}
|
|
1734
|
-
onChange={() => {
|
|
1735
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1736
|
-
const result = [];
|
|
1737
|
-
const _parsedMonths = JSON.parse(_schedule.period.months);
|
|
1738
|
-
for (let i = 1; i <= 12; i++) {
|
|
1739
|
-
if (!_parsedMonths.includes(i)) {
|
|
1740
|
-
result.push(i);
|
|
1741
|
-
}
|
|
1742
|
-
}
|
|
1743
|
-
result.sort((a, b) => a - b);
|
|
1744
|
-
_schedule.period.months = JSON.stringify(result);
|
|
1745
|
-
this.onChange(_schedule);
|
|
1746
|
-
}}
|
|
1747
|
-
/>
|
|
1748
|
-
}
|
|
1749
|
-
label={I18n.t('sch_invert')}
|
|
1750
|
-
/>
|
|
1751
|
-
)}
|
|
1752
|
-
<div />
|
|
1753
|
-
{MONTHS.map((month, i) => (
|
|
1754
|
-
<FormControlLabel
|
|
1755
|
-
key={`month_${i}`}
|
|
1756
|
-
style={styles.inputGroupElement}
|
|
1757
|
-
control={
|
|
1758
|
-
<Checkbox
|
|
1759
|
-
style={styles.inputSmallCheck}
|
|
1760
|
-
checked={
|
|
1761
|
-
typeof schedule.period.months === 'string'
|
|
1762
|
-
? JSON.parse(schedule.period.months).includes(i + 1)
|
|
1763
|
-
: schedule.period.months === i
|
|
1764
|
-
}
|
|
1765
|
-
onChange={e => {
|
|
1766
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1767
|
-
let months;
|
|
1768
|
-
try {
|
|
1769
|
-
months = JSON.parse(_schedule.period.months);
|
|
1770
|
-
} catch {
|
|
1771
|
-
months = [];
|
|
1772
|
-
}
|
|
1773
|
-
if (e.target.checked && !months.includes(i + 1)) {
|
|
1774
|
-
months.push(i + 1);
|
|
1775
|
-
} else if (!e.target.checked && months.includes(i + 1)) {
|
|
1776
|
-
months.splice(months.indexOf(i + 1), 1);
|
|
1777
|
-
}
|
|
1778
|
-
months.sort((a: number, b: number) => a - b);
|
|
1779
|
-
_schedule.period.months = JSON.stringify(months);
|
|
1780
|
-
this.onChange(_schedule);
|
|
1781
|
-
}}
|
|
1782
|
-
/>
|
|
1783
|
-
}
|
|
1784
|
-
label={I18n.t(month)}
|
|
1785
|
-
/>
|
|
1786
|
-
))}
|
|
1787
|
-
</FormGroup>
|
|
1788
|
-
)}
|
|
1789
|
-
</div>,
|
|
1790
|
-
];
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
|
-
getPeriodSettingsYearly(): JSX.Element[] | null {
|
|
1794
|
-
if (!this.state.schedule.period.years) {
|
|
1795
|
-
return null;
|
|
1796
|
-
}
|
|
1797
|
-
const schedule = this.state.schedule;
|
|
1798
|
-
return [
|
|
1799
|
-
<div key="year">
|
|
1800
|
-
<FormControlLabel
|
|
1801
|
-
control={
|
|
1802
|
-
<Radio
|
|
1803
|
-
style={styles.inputRadio}
|
|
1804
|
-
checked={schedule.period.years === 1}
|
|
1805
|
-
onClick={() => {
|
|
1806
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1807
|
-
_schedule.period.years = 1;
|
|
1808
|
-
this.onChange(_schedule);
|
|
1809
|
-
}}
|
|
1810
|
-
/>
|
|
1811
|
-
}
|
|
1812
|
-
label={I18n.t('sch_periodEveryYear')}
|
|
1813
|
-
/>
|
|
1814
|
-
</div>,
|
|
1815
|
-
<div key="every">
|
|
1816
|
-
<FormControlLabel
|
|
1817
|
-
control={
|
|
1818
|
-
<Radio
|
|
1819
|
-
style={styles.inputRadio}
|
|
1820
|
-
checked={schedule.period.years > 1}
|
|
1821
|
-
onClick={() => {
|
|
1822
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1823
|
-
_schedule.period.years = 2;
|
|
1824
|
-
this.onChange(_schedule);
|
|
1825
|
-
}}
|
|
1826
|
-
/>
|
|
1827
|
-
}
|
|
1828
|
-
label={I18n.t('sch_periodEvery')}
|
|
1829
|
-
/>
|
|
1830
|
-
{schedule.period.years > 1 && [
|
|
1831
|
-
<Input
|
|
1832
|
-
key="input"
|
|
1833
|
-
value={this.state.schedule.period.years}
|
|
1834
|
-
style={styles.inputEvery}
|
|
1835
|
-
type="number"
|
|
1836
|
-
inputProps={{ min: 2 }}
|
|
1837
|
-
onChange={e => {
|
|
1838
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1839
|
-
_schedule.period.years = parseInt(e.target.value, 10);
|
|
1840
|
-
if (_schedule.period.years < 1) {
|
|
1841
|
-
_schedule.period.years = 1;
|
|
1842
|
-
}
|
|
1843
|
-
this.onChange(_schedule);
|
|
1844
|
-
}}
|
|
1845
|
-
/>,
|
|
1846
|
-
<span key="text">{I18n.t('sch_periodYear')}</span>,
|
|
1847
|
-
]}
|
|
1848
|
-
</div>,
|
|
1849
|
-
];
|
|
1850
|
-
}
|
|
1851
|
-
|
|
1852
|
-
static now2string(isEnd?: boolean): string {
|
|
1853
|
-
const d = new Date();
|
|
1854
|
-
d.setHours(0);
|
|
1855
|
-
d.setMinutes(0);
|
|
1856
|
-
d.setSeconds(0);
|
|
1857
|
-
d.setMilliseconds(0);
|
|
1858
|
-
if (isEnd) {
|
|
1859
|
-
d.setDate(d.getDate() + 2);
|
|
1860
|
-
d.setMilliseconds(d.getMilliseconds() - 1);
|
|
1861
|
-
}
|
|
1862
|
-
|
|
1863
|
-
return `${padding(d.getDate())}.${padding(d.getMonth() + 1)}.${padding(d.getFullYear())}`;
|
|
1864
|
-
}
|
|
1865
|
-
|
|
1866
|
-
static string2date(str: string): Date {
|
|
1867
|
-
let parts = str.split('.'); // 31.12.2019
|
|
1868
|
-
if (parts.length === 1) {
|
|
1869
|
-
parts = str.split('-'); // 2018-12-31
|
|
1870
|
-
return new Date(parseInt(parts[0], 10), parseInt(parts[1], 10) - 1, parseInt(parts[2], 10));
|
|
1871
|
-
}
|
|
1872
|
-
return new Date(parseInt(parts[2], 10), parseInt(parts[1], 10) - 1, parseInt(parts[0], 10));
|
|
1873
|
-
}
|
|
1874
|
-
|
|
1875
|
-
getValidSettings(): JSX.Element {
|
|
1876
|
-
const schedule = this.state.schedule;
|
|
1877
|
-
// ----- from ---
|
|
1878
|
-
return (
|
|
1879
|
-
<div style={styles.rowDiv}>
|
|
1880
|
-
<div style={{ ...styles.modeDiv, verticalAlign: 'middle' }}>
|
|
1881
|
-
<span style={{ fontWeight: 'bold', paddingRight: 10 }}>{I18n.t('sch_valid')}</span>
|
|
1882
|
-
<span>{I18n.t('sch_validFrom')}</span>
|
|
1883
|
-
</div>
|
|
1884
|
-
<div style={styles.settingsDiv}>
|
|
1885
|
-
<TextField
|
|
1886
|
-
variant="standard"
|
|
1887
|
-
style={{ ...styles.inputDate, marginRight: 10 }}
|
|
1888
|
-
key="exactTimeFrom"
|
|
1889
|
-
inputRef={this.refFrom}
|
|
1890
|
-
defaultValue={string2USdate(schedule.valid.from)}
|
|
1891
|
-
type="date"
|
|
1892
|
-
// inputComponent={TextDate}
|
|
1893
|
-
onChange={e => {
|
|
1894
|
-
this.timerFrom && clearTimeout(this.timerFrom);
|
|
1895
|
-
|
|
1896
|
-
if (this.refFrom.current) {
|
|
1897
|
-
this.refFrom.current.style.background = '#ff000030';
|
|
1898
|
-
}
|
|
1899
|
-
|
|
1900
|
-
this.timerFrom = setTimeout(
|
|
1901
|
-
value => {
|
|
1902
|
-
this.timerFrom = null;
|
|
1903
|
-
if (this.refFrom.current) {
|
|
1904
|
-
this.refFrom.current.style.background = '';
|
|
1905
|
-
}
|
|
1906
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1907
|
-
const date = Schedule.string2date(value);
|
|
1908
|
-
if (date.toString() !== 'Invalid Date') {
|
|
1909
|
-
_schedule.valid.from = `${padding(date.getDate())}.${padding(date.getMonth() + 1)}.${date.getFullYear()}`;
|
|
1910
|
-
this.onChange(_schedule);
|
|
1911
|
-
}
|
|
1912
|
-
},
|
|
1913
|
-
1500,
|
|
1914
|
-
e.target.value,
|
|
1915
|
-
);
|
|
1916
|
-
}}
|
|
1917
|
-
slotProps={{
|
|
1918
|
-
inputLabel: { shrink: true },
|
|
1919
|
-
}}
|
|
1920
|
-
margin="normal"
|
|
1921
|
-
/>
|
|
1922
|
-
<FormControlLabel
|
|
1923
|
-
control={
|
|
1924
|
-
<Checkbox
|
|
1925
|
-
style={styles.inputRadio}
|
|
1926
|
-
checked={!!schedule.valid.to}
|
|
1927
|
-
onClick={() => {
|
|
1928
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1929
|
-
_schedule.valid.to = _schedule.valid.to ? '' : Schedule.now2string(true);
|
|
1930
|
-
this.onChange(_schedule);
|
|
1931
|
-
}}
|
|
1932
|
-
/>
|
|
1933
|
-
}
|
|
1934
|
-
label={I18n.t('sch_validTo')}
|
|
1935
|
-
/>
|
|
1936
|
-
{!!schedule.valid.to && (
|
|
1937
|
-
<TextField
|
|
1938
|
-
variant="standard"
|
|
1939
|
-
inputRef={this.refTo}
|
|
1940
|
-
style={{ ...styles.inputDate, marginRight: 10 }}
|
|
1941
|
-
key="exactTimeFrom"
|
|
1942
|
-
type="date"
|
|
1943
|
-
defaultValue={string2USdate(schedule.valid.to)}
|
|
1944
|
-
// inputComponent={TextDate}
|
|
1945
|
-
onChange={e => {
|
|
1946
|
-
this.timerTo && clearTimeout(this.timerTo);
|
|
1947
|
-
|
|
1948
|
-
if (this.refTo.current) {
|
|
1949
|
-
this.refTo.current.style.background = '#ff000030';
|
|
1950
|
-
}
|
|
1951
|
-
this.timerTo = setTimeout(
|
|
1952
|
-
value => {
|
|
1953
|
-
this.timerTo = null;
|
|
1954
|
-
if (this.refTo.current) {
|
|
1955
|
-
this.refTo.current.style.background = '';
|
|
1956
|
-
}
|
|
1957
|
-
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
1958
|
-
const date = Schedule.string2date(value);
|
|
1959
|
-
if (date.toString() !== 'Invalid Date') {
|
|
1960
|
-
_schedule.valid.to = `${padding(date.getDate())}.${padding(date.getMonth() + 1)}.${date.getFullYear()}`;
|
|
1961
|
-
this.onChange(_schedule);
|
|
1962
|
-
}
|
|
1963
|
-
},
|
|
1964
|
-
1500,
|
|
1965
|
-
e.target.value,
|
|
1966
|
-
);
|
|
1967
|
-
}}
|
|
1968
|
-
slotProps={{
|
|
1969
|
-
inputLabel: { shrink: true },
|
|
1970
|
-
}}
|
|
1971
|
-
margin="normal"
|
|
1972
|
-
/>
|
|
1973
|
-
)}
|
|
1974
|
-
</div>
|
|
1975
|
-
</div>
|
|
1976
|
-
);
|
|
1977
|
-
}
|
|
1978
|
-
|
|
1979
|
-
render(): JSX.Element {
|
|
1980
|
-
return (
|
|
1981
|
-
<div style={{ height: 'calc(100% - 48px)', width: '100%', overflow: 'hidden' }}>
|
|
1982
|
-
<div>{this.state.desc}</div>
|
|
1983
|
-
<div style={styles.scrollWindow}>
|
|
1984
|
-
<h5>{I18n.t('sch_time')}</h5>
|
|
1985
|
-
{this.getTimePeriodElements()}
|
|
1986
|
-
{this.getTimeExactElements()}
|
|
1987
|
-
{Schedule.getDivider()}
|
|
1988
|
-
<h5>{I18n.t('sch_period')}</h5>
|
|
1989
|
-
{this.getPeriodModes()}
|
|
1990
|
-
{!this.state.schedule.period.once && Schedule.getDivider()}
|
|
1991
|
-
{!this.state.schedule.period.once && this.getValidSettings()}
|
|
1992
|
-
</div>
|
|
1993
|
-
</div>
|
|
1994
|
-
);
|
|
1995
|
-
}
|
|
1996
|
-
}
|
|
1997
|
-
|
|
1998
|
-
export default Schedule;
|