integrasi plant section
This commit is contained in:
@@ -1,27 +1,39 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Button, Col, Row, Space, Input, ConfigProvider, Card } from 'antd';
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined, SearchOutlined, EyeOutlined } from '@ant-design/icons';
|
||||
import {
|
||||
PlusOutlined,
|
||||
EditOutlined,
|
||||
DeleteOutlined,
|
||||
SearchOutlined,
|
||||
EyeOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import TableList from '../../../../components/Global/TableList';
|
||||
|
||||
const ListPlantSection = ({
|
||||
setActionMode,
|
||||
handleEdit,
|
||||
const ListPlantSection = ({
|
||||
setActionMode,
|
||||
handleEdit,
|
||||
handleDelete,
|
||||
handlePreview,
|
||||
getAllPlantSection
|
||||
getAllPlantSection,
|
||||
refreshList,
|
||||
}) => {
|
||||
const [searchValue, setSearchValue] = useState('');
|
||||
const [formDataFilter, setFormDataFilter] = useState({ search: '' });
|
||||
const [formDataFilter, setFormDataFilter] = useState({ criteria: '' });
|
||||
const [trigerFilter, setTrigerFilter] = useState(false);
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: 'No',
|
||||
dataIndex: 'key',
|
||||
key: 'key',
|
||||
width: '5%',
|
||||
dataIndex: 'sub_section_id',
|
||||
key: 'sub_section_id',
|
||||
width: '10%',
|
||||
render: (text, record, index) => index + 1,
|
||||
},
|
||||
{
|
||||
title: 'Nama Sub Section',
|
||||
dataIndex: 'sub_section_name',
|
||||
key: 'sub_section_name',
|
||||
},
|
||||
{
|
||||
title: 'Kode Plant',
|
||||
dataIndex: 'kode_plant',
|
||||
@@ -45,24 +57,41 @@ const ListPlantSection = ({
|
||||
{
|
||||
title: 'Aksi',
|
||||
key: 'action',
|
||||
width: '15%',
|
||||
render: (_, record) => (
|
||||
<Space size="middle">
|
||||
<Button type="text" style={{ borderColor: '#1890ff' }} icon={<EyeOutlined style={{ color: '#1890ff' }} />} onClick={() => handlePreview(record)} />
|
||||
<Button type="text" style={{ borderColor: '#faad14' }} icon={<EditOutlined style={{ color: '#faad14' }} />} onClick={() => handleEdit(record)} />
|
||||
<Button type="text" danger style={{ borderColor: 'red' }} icon={<DeleteOutlined />} onClick={() => handleDelete(record)} />
|
||||
<Button
|
||||
type="text"
|
||||
style={{ borderColor: '#1890ff' }}
|
||||
icon={<EyeOutlined style={{ color: '#1890ff' }} />}
|
||||
onClick={() => handlePreview(record)}
|
||||
/>
|
||||
<Button
|
||||
type="text"
|
||||
style={{ borderColor: '#faad14' }}
|
||||
icon={<EditOutlined style={{ color: '#faad14' }} />}
|
||||
onClick={() => handleEdit(record)}
|
||||
/>
|
||||
<Button
|
||||
type="text"
|
||||
danger
|
||||
style={{ borderColor: 'red' }}
|
||||
icon={<DeleteOutlined />}
|
||||
onClick={() => handleDelete(record)}
|
||||
/>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
const handleSearch = () => {
|
||||
setFormDataFilter({ search: searchValue });
|
||||
setFormDataFilter({ criteria: searchValue });
|
||||
setTrigerFilter((prev) => !prev);
|
||||
};
|
||||
|
||||
const handleSearchClear = () => {
|
||||
setSearchValue('');
|
||||
setFormDataFilter({ search: '' });
|
||||
setFormDataFilter({ criteria: '' });
|
||||
setTrigerFilter((prev) => !prev);
|
||||
};
|
||||
|
||||
@@ -71,7 +100,7 @@ const ListPlantSection = ({
|
||||
<Row justify="space-between" align="middle" gutter={[8, 8]}>
|
||||
<Col xs={24} sm={24} md={12} lg={12}>
|
||||
<Input.Search
|
||||
placeholder="Cari berdasarkan kode, nama, atau lokasi..."
|
||||
placeholder="Cari berdasarkan nama sub section..."
|
||||
value={searchValue}
|
||||
onChange={(e) => {
|
||||
const value = e.target.value;
|
||||
@@ -130,10 +159,11 @@ const ListPlantSection = ({
|
||||
queryParams={formDataFilter}
|
||||
columns={columns}
|
||||
triger={trigerFilter}
|
||||
refreshList={refreshList}
|
||||
/>
|
||||
</Col>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
export default ListPlantSection;
|
||||
export default ListPlantSection;
|
||||
|
||||
Reference in New Issue
Block a user