import React, { useState } from 'react'; import { GenericModal } from "../atoms/GenericModal"; import { MenuItem, TextField, Typography, Box } from "@mui/material"; import { Dropdown } from "../atoms/DropdownMui"; import Button from "@mui/material/Button"; import { modalStyle } from "./AddWhereCondModal"; interface ScheduleSettingsProps { isOpen: boolean; handleStart: (settings: ScheduleSettings) => void; handleClose: () => void; } export interface ScheduleSettings { runEvery: number; runEveryUnit: string; startFrom: string; atTime: string; timezone: string; } export const ScheduleSettingsModal = ({ isOpen, handleStart, handleClose }: ScheduleSettingsProps) => { const [settings, setSettings] = useState({ runEvery: 1, runEveryUnit: 'hours', startFrom: 'Monday', atTime: '00:00', timezone: 'UTC' }); const handleChange = (field: keyof ScheduleSettings, value: string | number) => { setSettings(prev => ({ ...prev, [field]: value })); }; const textStyle = { width: '150px', height: '50px', marginRight: '10px', }; const dropDownStyle = { marginTop: '2px', width: '150px', height: '59px', marginRight: '10px', }; return ( *': { marginBottom: '20px' }, }}> Schedule Settings Run once every handleChange('runEvery', parseInt(e.target.value))} sx={textStyle} /> handleChange('runEveryUnit', e.target.value)} sx={dropDownStyle} > minutes hours days weeks months Start from handleChange('startFrom', e.target.value)} sx={dropDownStyle} > Monday Tuesday Wednesday Thursday Friday Saturday Sunday At around handleChange('atTime', e.target.value)} sx={textStyle} /> Timezone handleChange('timezone', e.target.value)} sx={dropDownStyle} > UTC America/New_York Europe/London Asia/Tokyo Asia/Kolkata ); } export default ScheduleSettingsModal;