import React, { memo, useState, useEffect } from 'react'; import { Button, Col, Row, Input, ConfigProvider, Card, Tag, Table, Space } from 'antd'; import { PlusOutlined, EditOutlined, DeleteOutlined, SearchOutlined, EyeOutlined, SyncOutlined, } from '@ant-design/icons'; import { NotifConfirmDialog } from '../../../../components/Global/ToastNotif'; import { useNavigate } from 'react-router-dom'; const ListShift = (props) => { const [searchValue, setSearchValue] = useState(''); const navigate = useNavigate(); useEffect(() => { const token = localStorage.getItem('token'); if (!token) { navigate('/signin'); } }, [navigate]); const handleSearch = (value) => { // This will be handled by the parent component if server-side search is needed console.log('Search value:', value); }; const handleSearchClear = () => { setSearchValue(''); // This will be handled by the parent component if server-side search is needed }; const showPreviewModal = (record) => { props.setSelectedData(record); props.setActionMode('preview'); }; const showEditModal = (record) => { props.setSelectedData(record); props.setActionMode('edit'); }; const showAddModal = () => { props.setSelectedData(null); props.setActionMode('add'); }; const showDeleteDialog = (record) => { NotifConfirmDialog({ icon: 'question', title: 'Konfirmasi', message: `Apakah anda yakin ingin menghapus data shift "${record.nama_shift}"?`, onConfirm: () => props.onDelete(record.id), }); }; const columns = [ { title: 'No', key: 'no', width: '5%', align: 'center', render: (_, __, index) => index + 1, }, { title: 'Nama Shift', dataIndex: 'nama_shift', key: 'nama_shift', }, { title: 'Jam Shift', dataIndex: 'jam_shift', key: 'jam_shift', }, { title: 'Status', dataIndex: 'status', key: 'status', align: 'center', render: (status) => ( {status ? 'Active' : 'Inactive'} ), }, { title: 'Aksi', key: 'action', align: 'center', width: '15%', render: (_, record) => ( } size="large" /> ); }; export default memo(ListShift);