diff --git a/src/locales/en-US/master/master-thing-en.ts b/src/locales/en-US/master/master-thing-en.ts index 886df79..6d3fca8 100644 --- a/src/locales/en-US/master/master-thing-en.ts +++ b/src/locales/en-US/master/master-thing-en.ts @@ -8,8 +8,8 @@ export default { 'master.devices.title': 'Devices', 'master.devices.name': 'Name', 'master.devices.name.tip': 'The device name', - 'master.devices.external_id': 'External ID', - 'master.devices.external_id.tip': 'The external identifier', + 'master.devices.external_id': 'Hardware ID', + 'master.devices.external_id.tip': 'The hardware identifier', 'master.devices.type': 'Type', 'master.devices.type.tip': 'The device type', 'master.devices.online': 'Online', diff --git a/src/locales/vi-VN/master/master-thing-vi.ts b/src/locales/vi-VN/master/master-thing-vi.ts index 13acb7d..61c7e53 100644 --- a/src/locales/vi-VN/master/master-thing-vi.ts +++ b/src/locales/vi-VN/master/master-thing-vi.ts @@ -8,7 +8,7 @@ export default { 'master.devices.title': 'Quản lý thiết bị', 'master.devices.name': 'Tên', 'master.devices.name.tip': 'Tên thiết bị', - 'master.devices.external_id': 'External ID', + 'master.devices.external_id': 'Hardware ID', 'master.devices.external_id.tip': 'Mã định danh bên ngoài', 'master.devices.type': 'Loại', 'master.devices.type.tip': 'Loại thiết bị', diff --git a/src/pages/Manager/Device/Camera/components/CameraFormModal.tsx b/src/pages/Manager/Device/Camera/components/CameraFormModal.tsx new file mode 100644 index 0000000..80cd2b1 --- /dev/null +++ b/src/pages/Manager/Device/Camera/components/CameraFormModal.tsx @@ -0,0 +1,174 @@ +import { + Button, + Col, + Form, + Input, + InputNumber, + Modal, + Row, + Select, +} from 'antd'; + +// Camera types +const CAMERA_TYPES = [ + { label: 'HIKVISION', value: 'HIKVISION' }, + { label: 'DAHUA', value: 'DAHUA' }, + { label: 'GENERIC', value: 'GENERIC' }, +]; + +interface CameraFormValues { + name: string; + type: string; + account: string; + password: string; + ipAddress: string; + rtspPort: number; + httpPort: number; + stream: number; + channel: number; +} + +interface CameraFormModalProps { + open: boolean; + onCancel: () => void; + onSubmit: (values: CameraFormValues) => void; +} + +const CameraFormModal: React.FC = ({ + open, + onCancel, + onSubmit, +}) => { + const [form] = Form.useForm(); + + const handleSubmit = async () => { + try { + const values = await form.validateFields(); + onSubmit(values); + form.resetFields(); + } catch (error) { + console.error('Validation failed:', error); + } + }; + + const handleCancel = () => { + form.resetFields(); + onCancel(); + }; + + return ( + + Hủy + , + , + ]} + width={500} + > +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ ); +}; + +export default CameraFormModal; diff --git a/src/pages/Manager/Device/Camera/components/CameraTable.tsx b/src/pages/Manager/Device/Camera/components/CameraTable.tsx new file mode 100644 index 0000000..f67682e --- /dev/null +++ b/src/pages/Manager/Device/Camera/components/CameraTable.tsx @@ -0,0 +1,106 @@ +import { + DeleteOutlined, + EditOutlined, + PlusOutlined, + ReloadOutlined, +} from '@ant-design/icons'; +import { Button, Card, Checkbox, Space, Table, theme } from 'antd'; + +interface CameraTableProps { + cameraData: MasterModel.Camera[] | null; + onCreateCamera: () => void; + onReload?: () => void; + loading?: boolean; +} + +const CameraTable: React.FC = ({ + cameraData, + onCreateCamera, + onReload, + loading = false, +}) => { + const { token } = theme.useToken(); + + const handleReload = () => { + console.log('Reload cameras'); + onReload?.(); + }; + + const handleDelete = () => { + console.log('Delete selected cameras'); + // TODO: Implement delete functionality + }; + + const handleEdit = (camera: MasterModel.Camera) => { + console.log('Edit camera:', camera); + // TODO: Implement edit functionality + }; + + const columns = [ + { + title: '', + dataIndex: 'checkbox', + width: 50, + render: () => , + }, + { + title: 'Tên', + dataIndex: 'name', + key: 'name', + render: (text: string) => ( + {text || '-'} + ), + }, + { + title: 'Loại', + dataIndex: 'cate_id', + key: 'cate_id', + render: (text: string) => text || '-', + }, + { + title: 'Địa chỉ IP', + dataIndex: 'ip', + key: 'ip', + render: (text: string) => text || '-', + }, + { + title: 'Thao tác', + key: 'action', + render: (_: any, record: MasterModel.Camera) => ( + +