diff --git a/src/pages/master/device/component/DetailDevice.jsx b/src/pages/master/device/component/DetailDevice.jsx index 5550d4b..1a1902e 100644 --- a/src/pages/master/device/component/DetailDevice.jsx +++ b/src/pages/master/device/component/DetailDevice.jsx @@ -35,8 +35,11 @@ const DetailDevice = (props) => { device_location: '', device_description: '', ip_address: '', - reminder_at: null, listen_channel: null, + reminder_at: null, + reminder_at_monthly: null, + start_date: null, + end_date: null, }; const [formData, setFormData] = useState(defaultData); @@ -82,6 +85,9 @@ const DetailDevice = (props) => { listen_channel: formData.listen_channel, listen_channel_reminder: formData.listen_channel_reminder, reminder_at: formData.reminder_at, + reminder_at_monthly: formData.reminder_at_monthly, + start_date: formData.start_date, + end_date: formData.end_date, }; console.log(payload); @@ -174,10 +180,18 @@ const DetailDevice = (props) => { const [period, setPeriod] = useState({ period: undefined, - start_date: null, - end_date: null, }); + useEffect(() => { + if (period.period !== 'custom') { + setFormData((prev) => ({ + ...prev, + start_date: null, + end_date: null, + })); + } + }, [period.period]); + const handleMonthly = (field, value) => { setPeriod((prev) => ({ ...prev, @@ -446,24 +460,23 @@ const DetailDevice = (props) => {