From a7af974108495f7d52f51b17a91584ef414e7ca4 Mon Sep 17 00:00:00 2001 From: Iqbal Rizqi Kurniawan Date: Thu, 9 Oct 2025 16:43:03 +0700 Subject: [PATCH] add status management with list and detail views, including routing and mock data --- src/App.jsx | 2 + src/layout/LayoutMenu.jsx | 5 + src/pages/history/report/IndexReport.jsx | 94 +++++++++- .../brandDevice/component/ListBrandDevice.jsx | 6 +- .../component/ListPlantSection.jsx | 6 +- src/pages/master/status/IndexStatus.jsx | 167 ++++++++++++++++++ .../master/status/component/DetailStatus.jsx | 160 +++++++++++++++++ .../master/status/component/ListStatus.jsx | 114 ++++++++++++ src/pages/master/tag/component/ListTag.jsx | 5 +- 9 files changed, 548 insertions(+), 11 deletions(-) create mode 100644 src/pages/master/status/IndexStatus.jsx create mode 100644 src/pages/master/status/component/DetailStatus.jsx create mode 100644 src/pages/master/status/component/ListStatus.jsx diff --git a/src/App.jsx b/src/App.jsx index 79a229f..c7de63d 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -15,6 +15,7 @@ import IndexTag from './pages/master/tag/IndexTag'; import IndexBrandDevice from './pages/master/brandDevice/IndexBrandDevice'; import IndexErrorCode from './pages/master/errorCode/IndexErrorCode'; import IndexPlantSection from './pages/master/plantSection/IndexPlantSection'; +import IndexStatus from './pages/master/status/IndexStatus'; // History import IndexTrending from './pages/history/trending/IndexTrending'; @@ -54,6 +55,7 @@ const App = () => { } /> } /> } /> + } /> }> diff --git a/src/layout/LayoutMenu.jsx b/src/layout/LayoutMenu.jsx index 382a1dc..9124704 100644 --- a/src/layout/LayoutMenu.jsx +++ b/src/layout/LayoutMenu.jsx @@ -66,6 +66,11 @@ const allItems = [ icon: , label: Error Code, }, + { + key: 'master-status', + icon: , + label: Status, + }, ], }, { diff --git a/src/pages/history/report/IndexReport.jsx b/src/pages/history/report/IndexReport.jsx index 44c3b7a..4a64fcc 100644 --- a/src/pages/history/report/IndexReport.jsx +++ b/src/pages/history/report/IndexReport.jsx @@ -1,13 +1,46 @@ -import React, { memo, useEffect } from 'react'; +import React, { memo, useEffect, useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { useBreadcrumb } from '../../../layout/LayoutBreadcrumb'; -import { Typography } from 'antd'; +import { Typography, Table } from 'antd'; const { Text } = Typography; +// Mock Data +const initialData = [ + { + key: '1', + plantSubSection: 'Section A', + device: 'Device 1', + errorCode: 'E-101', + status: 'Warning', + }, + { + key: '2', + plantSubSection: 'Section B', + device: 'Device 2', + errorCode: 'E-102', + status: 'Alarm', + }, + { + key: '3', + plantSubSection: 'Section C', + device: 'Device 3', + errorCode: 'E-103', + status: 'Done', + }, + { + key: '4', + plantSubSection: 'Section A', + device: 'Device 4', + errorCode: 'E-104', + status: 'Warning', + }, +]; + const IndexReport = memo(function IndexReport() { const navigate = useNavigate(); const { setBreadcrumbItems } = useBreadcrumb(); + const [data, setData] = useState(initialData); useEffect(() => { const token = localStorage.getItem('token'); @@ -21,9 +54,62 @@ const IndexReport = memo(function IndexReport() { } }, []); + const getTitleStyle = (statusName) => { + let backgroundColor; + switch (statusName.toLowerCase()) { + case 'done': + backgroundColor = '#52c41a'; // green + break; + case 'warning': + backgroundColor = '#faad14'; // orange + break; + case 'alarm': + backgroundColor = '#f5222d'; // red + break; + case 'critical': + backgroundColor = '#000000'; // black + break; + default: + backgroundColor = 'transparent'; + } + return { + backgroundColor, + color: '#fff', + padding: '2px 8px', + borderRadius: '4px', + display: 'inline-block' + }; + }; + + const columns = [ + { + title: 'Plant Sub Section', + dataIndex: 'plantSubSection', + key: 'plantSubSection', + }, + { + title: 'Device', + dataIndex: 'device', + key: 'device', + }, + { + title: 'Error Code', + dataIndex: 'errorCode', + key: 'errorCode', + }, + { + title: 'Status', + dataIndex: 'status', + key: 'status', + render: (status) => ( + {status} + ), + }, + ]; + return ( -
-

Report Page

+
+ ); }); diff --git a/src/pages/master/brandDevice/component/ListBrandDevice.jsx b/src/pages/master/brandDevice/component/ListBrandDevice.jsx index b015d6c..c765714 100644 --- a/src/pages/master/brandDevice/component/ListBrandDevice.jsx +++ b/src/pages/master/brandDevice/component/ListBrandDevice.jsx @@ -45,9 +45,9 @@ const ListBrandDevice = ({ key: 'action', render: (_, record) => ( - + + + + + + ) + } + > + +
+ Status Code} + rules={[{ required: true, message: 'Silakan masukkan kode status!' }]} + > + + + Status Name} + rules={[{ required: true, message: 'Silakan masukkan nama status!' }]} + > + + + Description} + rules={[{ required: true, message: 'Silakan masukkan deskripsi!' }]} + > +