diff --git a/src/components/Global/TableList.jsx b/src/components/Global/TableList.jsx
index a44ed8c..5a47021 100644
--- a/src/components/Global/TableList.jsx
+++ b/src/components/Global/TableList.jsx
@@ -20,6 +20,7 @@ const TableList = memo(function TableList({
fieldColor,
firstLoad = true,
columnDynamic = false,
+ cardComponent, // New prop for custom card component
}) {
const [gridLoading, setGridLoading] = useState(false);
@@ -142,6 +143,9 @@ const TableList = memo(function TableList({
const isMobile = !screens.md; // kalau kurang dari md (768px) dianggap mobile
+ // Use the custom card component if provided, otherwise default to CardList
+ const CardViewComponent = cardComponent || CardList;
+
return (
{(isMobile && mobile) || viewMode === 'card' ? (
-
[
{
@@ -265,6 +266,7 @@ const ListSparepart = memo(function ListSparepart(props) {
queryParams={formDataFilter}
columns={columns(showPreviewModal, showEditModal, showDeleteDialog)}
triger={trigerFilter}
+ cardComponent={SparepartCardList} // Pass the custom component here
/>
diff --git a/src/pages/master/sparepart/component/SparepartCardList.jsx b/src/pages/master/sparepart/component/SparepartCardList.jsx
new file mode 100644
index 0000000..550a760
--- /dev/null
+++ b/src/pages/master/sparepart/component/SparepartCardList.jsx
@@ -0,0 +1,122 @@
+import React from 'react';
+import { Card, Button, Row, Col, Typography, Divider, Tag } from 'antd';
+import { EditOutlined, DeleteOutlined } from '@ant-design/icons';
+
+const { Text, Title } = Typography;
+
+const SparepartCardList = ({
+ data,
+ header,
+ showPreviewModal, // Keep prop in case it's needed elsewhere, but icon is removed
+ showEditModal,
+ showDeleteDialog,
+ fieldColor,
+ cardColor
+}) => {
+ return (
+
+ {data.map((item) => (
+
+
+
+
+
+ {item.sparepart_item_type && (
+
+ {item.sparepart_item_type}
+
+ )}
+
+
![{item[header]}]({item.image_url)
+
+
+
+
+
+
+ {showEditModal && (
+ }
+ key="edit"
+ onClick={() => showEditModal(item)}
+ size="small"
+ />
+ )}
+ {showDeleteDialog && (
+ }
+ key="delete"
+ onClick={() => showDeleteDialog(item)}
+ size="small"
+ danger
+ />
+ )}
+
+
+ {item[header]}
+
+
+ Available: {item.sparepart_stok || '0'}
+
+
+
+
+
+ Last updated: {item.updated_at || 'N/A'}
+
+
+
+
+
+
+ ))}
+
+ );
+};
+
+export default SparepartCardList;
\ No newline at end of file