import React, { memo, useState, useEffect } from 'react'; import { Space, Tag, ConfigProvider, Button, Row, Col, Card, Input } from 'antd'; import { PlusOutlined, EditOutlined, DeleteOutlined, EyeOutlined, SearchOutlined, } from '@ant-design/icons'; import { NotifAlert, NotifConfirmDialog } from '../../../../components/Global/ToastNotif'; import { useNavigate } from 'react-router-dom'; import TableList from '../../../../components/Global/TableList'; import { getAllUnit, deleteUnit } from '../../../../api/master-unit'; const columns = (showPreviewModal, showEditModal, showDeleteDialog) => [ { title: 'No', key: 'no', width: '5%', align: 'center', render: (_, __, index) => index + 1, }, { title: 'Unit Code', dataIndex: 'unit_code', key: 'unit_code', width: '20%', }, { title: 'Name', dataIndex: 'unit_name', key: 'unit_name', width: '20%', }, { title: 'Description', dataIndex: 'unit_description', key: 'unit_description', width: '25%', render: (text) => text || '-', }, { title: 'Status', dataIndex: 'is_active', key: 'is_active', width: '10%', align: 'center', render: (_, { is_active }) => { const color = is_active ? 'green' : 'red'; const text = is_active ? 'Active' : 'Inactive'; return ( {text} ); }, }, { title: 'Aksi', key: 'aksi', align: 'center', width: '20%', render: (_, record) => ( } size="large" /> ); }); export default ListUnit;