diff --git a/src/components/Global/AppInput.jsx b/src/components/Global/AppInput.jsx
new file mode 100644
index 0000000..620d0bd
--- /dev/null
+++ b/src/components/Global/AppInput.jsx
@@ -0,0 +1,52 @@
+import { Input } from "antd";
+import { useEffect, useState, useRef } from "react";
+
+const InputNumber = ({
+ name,
+ value = 0,
+ onChange,
+ ...props
+}) => {
+ const [inputValue, setInputValue] = useState(
+ value !== null && value !== undefined ? value.toString() : ''
+ );
+
+ useEffect(() => {
+ const newValue = value !== null && value !== undefined ? value.toString() : '';
+ setInputValue(newValue);
+ }, [value]);
+
+ const handleChange = (e) => {
+ const rawValue = e.target.value;
+ if (/^\d*$/.test(rawValue)) {
+ setInputValue(rawValue);
+ const numValue = rawValue === '' ? 0 : parseInt(rawValue, 10);
+
+ // Kirim event object sintetis yang konsisten dengan handler biasa
+ onChange?.({
+ target: {
+ name: name,
+ value: numValue
+ }
+ });
+ }
+ };
+
+ const handleFocus = (e) => {
+ // Pilih semua teks saat fokus (opsional)
+ e.target.select();
+ };
+
+ return (
+
+ );
+};
+
+export { InputNumber };
diff --git a/src/pages/master/device/component/DetailDevice.jsx b/src/pages/master/device/component/DetailDevice.jsx
index 3bd9c35..8ba0c7b 100644
--- a/src/pages/master/device/component/DetailDevice.jsx
+++ b/src/pages/master/device/component/DetailDevice.jsx
@@ -1,9 +1,21 @@
import React, { useEffect, useState } from 'react';
-import { Modal, Input, Divider, Typography, Switch, Button, ConfigProvider, Select } from 'antd';
+import {
+ Modal,
+ Input,
+ Divider,
+ Typography,
+ Switch,
+ Button,
+ ConfigProvider,
+ Select,
+ DatePicker,
+} from 'antd';
import { NotifAlert, NotifOk } from '../../../../components/Global/ToastNotif';
import { createDevice, updateDevice } from '../../../../api/master-device';
import { getAllBrands } from '../../../../api/master-brand';
import { validateRun } from '../../../../Utils/validate';
+import { toApiDateFormatter } from '../../../../components/Global/Formatter';
+import dayjs from 'dayjs';
const { Text } = Typography;
const { TextArea } = Input;
@@ -23,6 +35,7 @@ const DetailDevice = (props) => {
device_location: '',
device_description: '',
ip_address: '',
+ reminder_at: null,
listen_channel: '',
};
@@ -67,8 +80,12 @@ const DetailDevice = (props) => {
ip_address: formData.ip_address,
brand_id: formData.brand_id,
listen_channel: formData.listen_channel,
+ listen_channel_reminder: formData.listen_channel_reminder,
+ reminder_at: formData.reminder_at,
};
+ console.log(payload);
+
const response = formData.device_id
? await updateDevice(formData.device_id, payload)
: await createDevice(payload);
@@ -128,6 +145,13 @@ const DetailDevice = (props) => {
});
};
+ const handleDateChange = (field, value) => {
+ setFormData({
+ ...formData,
+ [field]: value,
+ });
+ };
+
// Fungsi untuk mengambil daftar brand
const fetchBrands = async () => {
setLoadingBrands(true);
@@ -169,8 +193,8 @@ const DetailDevice = (props) => {
props.actionMode === 'add'
? 'Tambah'
: props.actionMode === 'preview'
- ? 'Preview'
- : 'Edit'
+ ? 'Preview'
+ : 'Edit'
} Device`}
open={props.showModal}
// open={true}
@@ -218,9 +242,10 @@ const DetailDevice = (props) => {
,
]}
>
+