ensure flag is set before adding a timer

This commit is contained in:
proddy
2024-07-06 19:26:38 +02:00
parent 5eb56c3243
commit 05cd1ef686

View File

@@ -159,7 +159,7 @@ const SchedulerDialog = ({
</DialogTitle> </DialogTitle>
<DialogContent dividers> <DialogContent dividers>
<Box display="flex" flexWrap="wrap" mb={1}> <Box display="flex" flexWrap="wrap" mb={1}>
<Box flexGrow={1}> <Box>
<ToggleButtonGroup <ToggleButtonGroup
size="small" size="small"
color="secondary" color="secondary"
@@ -191,7 +191,7 @@ const SchedulerDialog = ({
</ToggleButton> </ToggleButton>
</ToggleButtonGroup> </ToggleButtonGroup>
</Box> </Box>
<Box flexWrap="nowrap" whiteSpace="nowrap"> <Box sx={{ '& button, & a, & .MuiCard-root': { ml: 1 } }}>
{isTimer ? ( {isTimer ? (
<Button <Button
size="large" size="large"
@@ -217,8 +217,6 @@ const SchedulerDialog = ({
{showFlag(editItem, ScheduleFlag.SCHEDULE_TIMER)} {showFlag(editItem, ScheduleFlag.SCHEDULE_TIMER)}
</Button> </Button>
)} )}
</Box>
<Box>
{isOnChange ? ( {isOnChange ? (
<Button <Button
size="large" size="large"
@@ -247,8 +245,6 @@ const SchedulerDialog = ({
{showFlag(editItem, ScheduleFlag.SCHEDULE_ONCHANGE)} {showFlag(editItem, ScheduleFlag.SCHEDULE_ONCHANGE)}
</Button> </Button>
)} )}
</Box>
<Box>
{isCondition ? ( {isCondition ? (
<Button <Button
size="large" size="large"
@@ -279,6 +275,8 @@ const SchedulerDialog = ({
)} )}
</Box> </Box>
</Box> </Box>
{editItem.flags !== 0 && (
<>
<Grid container> <Grid container>
<BlockFormControlLabel <BlockFormControlLabel
control={ control={
@@ -297,7 +295,9 @@ const SchedulerDialog = ({
name="time" name="time"
label={isCondition ? 'Condition' : 'On Change Value'} label={isCondition ? 'Condition' : 'On Change Value'}
fullWidth fullWidth
value={editItem.time == '00:00' ? (editItem.time = '') : editItem.time} value={
editItem.time == '00:00' ? (editItem.time = '') : editItem.time
}
margin="normal" margin="normal"
onChange={updateFormValue} onChange={updateFormValue}
/> />
@@ -315,7 +315,9 @@ const SchedulerDialog = ({
/> />
{isTimer && ( {isTimer && (
<Box color="warning.main" ml={2} mt={4}> <Box color="warning.main" ml={2} mt={4}>
<Typography variant="body2">{LL.SCHEDULER_HELP_2()}</Typography> <Typography variant="body2">
{LL.SCHEDULER_HELP_2()}
</Typography>
</Box> </Box>
)} )}
</> </>
@@ -348,6 +350,8 @@ const SchedulerDialog = ({
margin="normal" margin="normal"
onChange={updateFormValue} onChange={updateFormValue}
/> />
</>
)}
</DialogContent> </DialogContent>
<DialogActions> <DialogActions>
{!creating && ( {!creating && (