progress history report

This commit is contained in:
2025-10-27 10:28:42 +07:00
parent 5a8e2dee2f
commit 39d8be10cc
6 changed files with 344 additions and 169 deletions

View File

@@ -57,22 +57,28 @@ const CardList = ({
}
style={getCardStyle(fieldColor ? item[fieldColor] : cardColor)}
actions={[
<EyeOutlined
showPreviewModal && (
<EyeOutlined
style={{ color: '#1890ff' }}
key="preview"
onClick={() => showPreviewModal(item)}
/>,
<EditOutlined
/>
),
showEditModal && (
<EditOutlined
style={{ color: '#faad14' }}
key="edit"
onClick={() => showEditModal(item)}
/>,
<DeleteOutlined
/>
),
showDeleteDialog && (
<DeleteOutlined
style={{ color: '#ff1818' }}
key="delete"
onClick={() => showDeleteDialog(item)}
/>,
]}
/>
),
].filter(Boolean)} // <== Hapus elemen yang undefined
>
<div style={{ textAlign: 'left' }}>
{column.map((itemCard, index) => (

View File

@@ -1,6 +1,6 @@
import React, { memo, useState, useEffect, useRef } from 'react';
import { Table, Pagination, Row, Col, Card, Grid, Button, Typography, Tag, Segmented } from 'antd';
import { AppstoreOutlined, TableOutlined } from '@ant-design/icons';
import { MacCommandOutlined, TableOutlined } from '@ant-design/icons';
import CardList from './CardList';
const { Text } = Typography;
@@ -18,6 +18,7 @@ const TableList = memo(function TableList({
showDeleteDialog,
cardColor,
fieldColor,
firstLoad = true,
}) {
const [gridLoading, setGridLoading] = useState(false);
@@ -30,12 +31,19 @@ const TableList = memo(function TableList({
total_page: 1,
});
const [viewMode, setViewMode] = useState('list');
const [viewMode, setViewMode] = useState('table');
const { useBreakpoint } = Grid;
const [renderCount, setRenderCount] = useState(firstLoad ? 1 : 0);
useEffect(() => {
filter(1, pagination.current_limit);
if (renderCount < 1) {
setRenderCount(renderCount + 1);
return;
} else {
filter(1, pagination.current_limit);
}
}, [triger]);
const filter = async (currentPage, pageSize) => {
@@ -90,8 +98,8 @@ const TableList = memo(function TableList({
<div>
<Segmented
options={[
{ value: 'card', icon: <AppstoreOutlined /> },
{ value: 'table', icon: <TableOutlined /> },
{ value: 'card', icon: <MacCommandOutlined /> },
]}
value={viewMode}
onChange={setViewMode}
@@ -116,6 +124,7 @@ const TableList = memo(function TableList({
pagination={false}
loading={gridLoading}
scroll={{ y: 520 }}
size="small"
/>
</Row>
)}