diff --git a/.env.example b/.env.example index 914aa0c..8532108 100644 --- a/.env.example +++ b/.env.example @@ -3,4 +3,8 @@ VITE_API_SERVER=http://localhost:9530/api VITE_MQTT_SERVER=ws://localhost:1884 VITE_MQTT_USERNAME= VITE_MQTT_PASSWORD= -VITE_KEY_SESSION=PetekRombonganPetekMorekMorakMarek \ No newline at end of file +VITE_KEY_SESSION=PetekRombonganPetekMorekMorakMarek + +# VITE_WHATSAPP_URL=http://192.168.1.10:9531/qrview +VITE_WHATSAPP_URL=http://localhost:9531/qrview +# VITE_WHATSAPP_URL=https://117.102.231.130:9531/qrview \ No newline at end of file diff --git a/package.json b/package.json index e942371..4882112 100644 --- a/package.json +++ b/package.json @@ -1,48 +1,48 @@ { - "name": "antd-vite-react-sypiu", - "homepage": "/dashboard/home", - "private": true, - "version": "1.0.0", - "type": "module", - "scripts": { - "dev": "vite", - "build": "vite build", - "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0", - "preview": "vite preview" - }, - "dependencies": { - "@ant-design/icons": "^6.0.0", - "@nivo/line": "^0.88.0", - "@nivo/pie": "^0.88.0", - "antd": "^5.15.2", - "axios": "^1.8.4", - "browser-image-compression": "^2.0.2", - "crypto-js": "^4.2.0", - "dayjs": "^1.11.13", - "exceljs": "^4.4.0", - "file-saver": "^2.0.5", - "html2canvas": "^1.4.1", - "jspdf": "^3.0.4", - "jspdf-autotable": "^5.0.2", - "mqtt": "^5.14.0", - "qrcode": "^1.5.4", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "react-icons": "^4.11.0", - "react-router-dom": "^6.22.3", - "react-svg": "^16.3.0", - "recharts": "^3.6.0", - "sweetalert2": "^11.17.2" - }, - "devDependencies": { - "@types/react": "^18.2.64", - "@types/react-dom": "^18.2.21", - "@vitejs/plugin-react": "^4.2.1", - "eslint": "^8.57.0", - "eslint-plugin-react": "^7.34.0", - "eslint-plugin-react-hooks": "^4.6.0", - "eslint-plugin-react-refresh": "^0.4.5", - "vite": "^5.1.6" - }, - "packageManager": "pnpm@10.2.1+sha512.398035c7bd696d0ba0b10a688ed558285329d27ea994804a52bad9167d8e3a72bcb993f9699585d3ca25779ac64949ef422757a6c31102c12ab932e5cbe5cc92" + "name": "antd-vite-react-call-of-duty", + "homepage": "/dashboard/home", + "private": true, + "version": "1.0.0", + "type": "module", + "scripts": { + "dev": "vite --host 0.0.0.0 --port 8592", + "build": "vite build", + "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0", + "preview": "vite preview" + }, + "dependencies": { + "@ant-design/icons": "^6.0.0", + "@nivo/line": "^0.88.0", + "@nivo/pie": "^0.88.0", + "antd": "^5.15.2", + "axios": "^1.8.4", + "browser-image-compression": "^2.0.2", + "crypto-js": "^4.2.0", + "dayjs": "^1.11.13", + "exceljs": "^4.4.0", + "file-saver": "^2.0.5", + "html2canvas": "^1.4.1", + "jspdf": "^3.0.4", + "jspdf-autotable": "^5.0.2", + "mqtt": "^5.14.0", + "qrcode": "^1.5.4", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-icons": "^4.11.0", + "react-router-dom": "^6.22.3", + "react-svg": "^16.3.0", + "recharts": "^3.6.0", + "sweetalert2": "^11.17.2" + }, + "devDependencies": { + "@types/react": "^18.2.64", + "@types/react-dom": "^18.2.21", + "@vitejs/plugin-react": "^4.2.1", + "eslint": "^8.57.0", + "eslint-plugin-react": "^7.34.0", + "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-react-refresh": "^0.4.5", + "vite": "^5.1.6" + }, + "packageManager": "pnpm@10.2.1+sha512.398035c7bd696d0ba0b10a688ed558285329d27ea994804a52bad9167d8e3a72bcb993f9699585d3ca25779ac64949ef422757a6c31102c12ab932e5cbe5cc92" } diff --git a/src/App.jsx b/src/App.jsx index b0fbd5f..8ffcfc9 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -36,6 +36,7 @@ import IndexNotification from './pages/notification/IndexNotification'; import IndexRole from './pages/role/IndexRole'; import IndexUser from './pages/user/IndexUser'; import IndexContact from './pages/contact/IndexContact'; +import IndexWhatsAppControl from './pages/whatsAppControl/IndexWhatsAppControl'; import DetailNotificationTab from './pages/notificationDetail/IndexNotificationDetail'; import IndexVerificationSparepart from './pages/verificationSparepart/IndexVerificationSparepart'; @@ -144,6 +145,10 @@ const App = () => { } /> + }> + } /> + + }> } /> diff --git a/src/api/whatsapp-control.jsx b/src/api/whatsapp-control.jsx new file mode 100644 index 0000000..ae72673 --- /dev/null +++ b/src/api/whatsapp-control.jsx @@ -0,0 +1,12 @@ +import { SendRequest } from '../components/Global/ApiRequest'; + +const resetWA = async () => { + const response = await SendRequest({ + method: 'post', + prefix: `notifikasi-wa/restart-wa`, + }); + + return response.data; +}; + +export { resetWA }; diff --git a/src/assets/svg/air_dryer_A_rev.svg b/src/assets/svg/air_dryer_A_rev.svg index 757cf04..e852408 100644 --- a/src/assets/svg/air_dryer_A_rev.svg +++ b/src/assets/svg/air_dryer_A_rev.svg @@ -186,7 +186,7 @@ Alarm Info - ####.## + ####.## H RT or LT Dry @@ -217,14 +217,9 @@ REGEN - DRYING - - REGEN - DRYING - AIR DRYER UNIT A (01-CL-10532-A) ####.## ####.## @@ -237,11 +232,16 @@ ####.## ####.## ## - - - + + + + + + + + \ No newline at end of file diff --git a/src/assets/svg/air_dryer_B_rev.svg b/src/assets/svg/air_dryer_B_rev.svg index 5f84a33..564c3fa 100644 --- a/src/assets/svg/air_dryer_B_rev.svg +++ b/src/assets/svg/air_dryer_B_rev.svg @@ -186,7 +186,7 @@ Alarm Info - ####.## + ####.## H RT or LT Dry @@ -217,13 +217,9 @@ REGEN - DRYING - REGEN - DRYING - AIR DRYER UNIT B (01-CL-10535-B) ####.## ####.## @@ -236,12 +232,16 @@ ####.## ####.## ## - + - - - + + + + + + + \ No newline at end of file diff --git a/src/assets/svg/air_dryer_C_rev.svg b/src/assets/svg/air_dryer_C_rev.svg index 4b320ba..7431663 100644 --- a/src/assets/svg/air_dryer_C_rev.svg +++ b/src/assets/svg/air_dryer_C_rev.svg @@ -186,7 +186,7 @@ Alarm Info - ####.## + ####.## H RT or LT Dry @@ -217,13 +217,9 @@ REGEN - DRYING - REGEN - DRYING - AIR DRYER UNIT C (01-CL-10539-C) ####.## ####.## @@ -236,12 +232,16 @@ ####.## ####.## ## - + - - - + + + + + + + \ No newline at end of file diff --git a/src/assets/svg/compressorA_rev.svg b/src/assets/svg/compressorA_rev.svg index 820787a..d986b13 100644 --- a/src/assets/svg/compressorA_rev.svg +++ b/src/assets/svg/compressorA_rev.svg @@ -3,34 +3,34 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + - + - - + + @@ -39,16 +39,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -93,7 +93,7 @@ - + @@ -138,7 +138,7 @@ - + @@ -147,7 +147,7 @@ - + @@ -192,8 +192,8 @@ - - + + @@ -203,8 +203,8 @@ - - + + @@ -249,7 +249,7 @@ - + @@ -258,7 +258,7 @@ - + @@ -303,7 +303,7 @@ - + @@ -312,7 +312,7 @@ - + @@ -321,7 +321,7 @@ - + @@ -332,7 +332,7 @@ - + @@ -343,7 +343,7 @@ - + @@ -352,7 +352,7 @@ - + @@ -397,7 +397,7 @@ - + @@ -442,7 +442,7 @@ - + @@ -451,17 +451,17 @@ - - TH5 - - - - - - - - - + + TH5 + + + + + + + + + @@ -506,7 +506,7 @@ - + @@ -515,7 +515,7 @@ - + @@ -524,7 +524,7 @@ - + @@ -569,9 +569,9 @@ - - - + + + @@ -580,7 +580,7 @@ - + @@ -625,14 +625,14 @@ - - - - - - - - + + + + + + + + @@ -641,11 +641,11 @@ - - - - - + + + + + @@ -690,7 +690,7 @@ - + @@ -699,21 +699,21 @@ - - TH2 - - PS1 - - - - - - - - - - - + + TH2 + + PS1 + + + + + + + + + + + @@ -722,7 +722,7 @@ - + @@ -767,7 +767,7 @@ - + @@ -776,9 +776,9 @@ - - - + + + @@ -787,7 +787,7 @@ - + @@ -832,7 +832,7 @@ - + @@ -841,7 +841,7 @@ - + @@ -886,7 +886,7 @@ - + @@ -925,29 +925,29 @@ - - - - - COMMUNICATION - - - - - - - - - - - + + + + + COMMUNICATION + + + + + + + + + + + - + @@ -956,7 +956,7 @@ - + @@ -1001,7 +1001,7 @@ - + @@ -1010,7 +1010,7 @@ - + @@ -1055,8 +1055,8 @@ - - + + @@ -1065,42 +1065,42 @@ - - - + + + - - - - - - - - TH3 - - TH4 - - - - - - + + + + + + + + TH3 + + TH4 + + + + + + - - - - - - - + + + + + + + @@ -1109,7 +1109,7 @@ - + @@ -1154,8 +1154,8 @@ - - + + @@ -1164,7 +1164,7 @@ - + @@ -1209,7 +1209,7 @@ - + @@ -1254,7 +1254,7 @@ - + @@ -1299,7 +1299,7 @@ - + @@ -1308,7 +1308,7 @@ - + @@ -1353,7 +1353,7 @@ - + @@ -1398,7 +1398,7 @@ - + @@ -1407,7 +1407,7 @@ - + @@ -1452,7 +1452,7 @@ - + @@ -1497,7 +1497,7 @@ - + @@ -1506,7 +1506,7 @@ - + @@ -1551,7 +1551,7 @@ - + @@ -1596,7 +1596,7 @@ - + @@ -1605,7 +1605,7 @@ - + @@ -1650,7 +1650,7 @@ - + @@ -1659,7 +1659,7 @@ - + @@ -1704,7 +1704,7 @@ - + @@ -1713,28 +1713,28 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + @@ -1743,8 +1743,8 @@ - - + + @@ -1753,59 +1753,59 @@ - - - - - + + + + + - + - + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - 63SV - - - - + + + + + + + + + + + + + + + + + + 63SV + + + + @@ -1814,168 +1814,165 @@ - - - - - - + + + + + + - + - + - + - - + + - - PS4 - - + + PS4 + + - - - START/STOP - - - - UNLOAD/LOAD - - - - SHUTDOWN - - - - REMOTE STATUS - - - - ALARM - - - + + + START/STOP + + + + UNLOAD/LOAD + + + + SHUTDOWN + + + + REMOTE STATUS + + + + ALARM + + + - + - - - - - CAPACITY CONTROL - - - - - - - - - - - - - ######### - CURRENT - LOAD RATIO - LOAD NUMBER - 2nd Discharge Temp. - 2nd Suction Temp. - Interstage Press. - 1st Discharge Temp. - Oil Pressure - Oil Temp. - Motor Vibration - Gearbox Vibration - - - - - - - - - - - - - Run Hour - Total Load Time - Reminder Maint. - - - - - - Next Maint.Timing - 5 YEAR - - COMPRESSOR UNIT - A - #### - H - #### - A - % - H - - - - - OVERHOUL - Next Maint.Timing - #### - #### - #### - #### - °C - °C - MPa - °C - °C - MPa - mm/s - mm/s - - PS2 - + 2nd Discharge Temp. + 2nd Suction Temp. + Interstage Press. + 1st Discharge Temp. + Oil Pressure + Oil Temp. + Motor Vibration + Gearbox Vibration + COMPRESSOR UNIT - A + °C + °C + MPa + °C + °C + MPa + mm/s + mm/s + + PS2 + - Discharge Air Press. - MPa - + Discharge Air Press. + MPa + - 2nd Discharge Press. - MPa - #### - #### - #### - #### - #### - #### - #### - #### - #### - #### - Plant Air Reciever + 2nd Discharge Press. + MPa + #### + #### + #### + #### + #### + #### + #### + #### + #### + #### + Plant Air Reciever + + + + + CAPACITY CONTROL + + + + + + + + + + + + + ######### + CURRENT + LOAD RATIO + LOAD NUMBER + + + + + + + + + + + + + Run Hour + Total Load Time + Reminder Maint. + #### + H + #### + A + % + H + + + + + #### + Next Maint.Timing + #### + #### + #### + #### + + + + + \ No newline at end of file diff --git a/src/assets/svg/compressorB_rev.svg b/src/assets/svg/compressorB_rev.svg index 9b7867d..dededfd 100644 --- a/src/assets/svg/compressorB_rev.svg +++ b/src/assets/svg/compressorB_rev.svg @@ -3,34 +3,34 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + - + - - + + @@ -39,16 +39,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -93,7 +93,7 @@ - + @@ -138,7 +138,7 @@ - + @@ -147,7 +147,7 @@ - + @@ -192,8 +192,8 @@ - - + + @@ -203,8 +203,8 @@ - - + + @@ -249,7 +249,7 @@ - + @@ -258,7 +258,7 @@ - + @@ -303,7 +303,7 @@ - + @@ -312,7 +312,7 @@ - + @@ -321,7 +321,7 @@ - + @@ -332,7 +332,7 @@ - + @@ -343,7 +343,7 @@ - + @@ -352,7 +352,7 @@ - + @@ -397,7 +397,7 @@ - + @@ -442,7 +442,7 @@ - + @@ -451,17 +451,17 @@ - - TH5 - - - - - - - - - + + TH5 + + + + + + + + + @@ -506,7 +506,7 @@ - + @@ -515,7 +515,7 @@ - + @@ -524,7 +524,7 @@ - + @@ -569,9 +569,9 @@ - - - + + + @@ -580,7 +580,7 @@ - + @@ -625,14 +625,14 @@ - - - - - - - - + + + + + + + + @@ -641,11 +641,11 @@ - - - - - + + + + + @@ -690,7 +690,7 @@ - + @@ -699,21 +699,21 @@ - - TH2 - - PS1 - - - - - - - - - - - + + TH2 + + PS1 + + + + + + + + + + + @@ -722,7 +722,7 @@ - + @@ -767,7 +767,7 @@ - + @@ -776,9 +776,9 @@ - - - + + + @@ -787,7 +787,7 @@ - + @@ -832,7 +832,7 @@ - + @@ -841,7 +841,7 @@ - + @@ -886,7 +886,7 @@ - + @@ -925,29 +925,29 @@ - - - - - COMMUNICATION - - - - - - - - - - - + + + + + COMMUNICATION + + + + + + + + + + + - + @@ -956,7 +956,7 @@ - + @@ -1001,7 +1001,7 @@ - + @@ -1010,7 +1010,7 @@ - + @@ -1055,8 +1055,8 @@ - - + + @@ -1065,42 +1065,42 @@ - - - + + + - - - - - - - - TH3 - - TH4 - - - - - - + + + + + + + + TH3 + + TH4 + + + + + + - - - - - - - + + + + + + + @@ -1109,7 +1109,7 @@ - + @@ -1154,8 +1154,8 @@ - - + + @@ -1164,7 +1164,7 @@ - + @@ -1209,7 +1209,7 @@ - + @@ -1254,7 +1254,7 @@ - + @@ -1299,7 +1299,7 @@ - + @@ -1308,7 +1308,7 @@ - + @@ -1353,7 +1353,7 @@ - + @@ -1398,7 +1398,7 @@ - + @@ -1407,7 +1407,7 @@ - + @@ -1452,7 +1452,7 @@ - + @@ -1497,7 +1497,7 @@ - + @@ -1506,7 +1506,7 @@ - + @@ -1551,7 +1551,7 @@ - + @@ -1596,7 +1596,7 @@ - + @@ -1605,7 +1605,7 @@ - + @@ -1650,7 +1650,7 @@ - + @@ -1659,7 +1659,7 @@ - + @@ -1704,7 +1704,7 @@ - + @@ -1713,28 +1713,28 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + @@ -1743,8 +1743,8 @@ - - + + @@ -1753,59 +1753,59 @@ - - - - - + + + + + - + - + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - 63SV - - - - + + + + + + + + + + + + + + + + + + 63SV + + + + @@ -1814,170 +1814,165 @@ - - - - - - + + + + + + - + - + - + - - + + - - PS4 - - + + PS4 + + - - - START/STOP - - - - UNLOAD/LOAD - - - - SHUTDOWN - - - - REMOTE STATUS - - - - ALARM - - - + + + START/STOP + + + + UNLOAD/LOAD + + + + SHUTDOWN + + + + REMOTE STATUS + + + + ALARM + + + - + - + - CAPACITY CONTROL - + CAPACITY CONTROL + - + - + - ######### - CURRENT - LOAD RATIO - LOAD NUMBER - 2nd Discharge Temp. - 2nd Suction Temp. - Interstage Press. - 1st Discharge Temp. - Oil Pressure - Oil Temp. - Motor Vibration - Gearbox Vibration - + ######### + CURRENT + LOAD RATIO + LOAD NUMBER + 2nd Discharge Temp. + 2nd Suction Temp. + Interstage Press. + 1st Discharge Temp. + Oil Pressure + Oil Temp. + Motor Vibration + Gearbox Vibration + - + - + - Run Hour - Total Load Time - Reminder Maint. - - - - - - Next Maint.Timing - 5 YEAR + Run Hour + Total Load Time + Reminder Maint. + COMPRESSOR UNIT - B + #### + H + #### + A + % + H + + + - COMPRESSOR UNIT - B - #### - H - #### - A - % - H - - - - - - OVERHOUL - Next Maint.Timing - - #### - #### - #### - #### - °C - °C - MPa - °C - °C - MPa - mm/s - mm/s - - PS2 - + #### + Next Maint.Timing + #### + #### + #### + #### + °C + °C + MPa + °C + °C + MPa + mm/s + mm/s + + PS2 + - Discharge Air Press. - MPa - + Discharge Air Press. + MPa + - 2nd Discharge Press. - MPa - #### - #### - #### - #### - #### - #### - #### - #### - #### - #### - Plant Air Reciever + 2nd Discharge Press. + MPa + #### + #### + #### + #### + #### + #### + #### + #### + #### + #### + Plant Air Reciever + + + + + \ No newline at end of file diff --git a/src/assets/svg/compressorC_rev.svg b/src/assets/svg/compressorC_rev.svg index 5c84fd2..a6b9f49 100644 --- a/src/assets/svg/compressorC_rev.svg +++ b/src/assets/svg/compressorC_rev.svg @@ -3,34 +3,34 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + - + - - + + @@ -39,16 +39,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -93,7 +93,7 @@ - + @@ -138,7 +138,7 @@ - + @@ -147,7 +147,7 @@ - + @@ -192,8 +192,8 @@ - - + + @@ -203,8 +203,8 @@ - - + + @@ -249,7 +249,7 @@ - + @@ -258,7 +258,7 @@ - + @@ -303,7 +303,7 @@ - + @@ -312,7 +312,7 @@ - + @@ -321,7 +321,7 @@ - + @@ -332,7 +332,7 @@ - + @@ -343,7 +343,7 @@ - + @@ -352,7 +352,7 @@ - + @@ -397,7 +397,7 @@ - + @@ -442,7 +442,7 @@ - + @@ -451,17 +451,17 @@ - - TH5 - - - - - - - - - + + TH5 + + + + + + + + + @@ -506,7 +506,7 @@ - + @@ -515,7 +515,7 @@ - + @@ -524,7 +524,7 @@ - + @@ -569,9 +569,9 @@ - - - + + + @@ -580,7 +580,7 @@ - + @@ -625,14 +625,14 @@ - - - - - - - - + + + + + + + + @@ -641,11 +641,11 @@ - - - - - + + + + + @@ -690,7 +690,7 @@ - + @@ -699,21 +699,21 @@ - - TH2 - - PS1 - - - - - - - - - - - + + TH2 + + PS1 + + + + + + + + + + + @@ -722,7 +722,7 @@ - + @@ -767,7 +767,7 @@ - + @@ -776,9 +776,9 @@ - - - + + + @@ -787,7 +787,7 @@ - + @@ -832,7 +832,7 @@ - + @@ -841,7 +841,7 @@ - + @@ -886,7 +886,7 @@ - + @@ -925,29 +925,29 @@ - - - - - COMMUNICATION - - - - - - - - - - - + + + + + COMMUNICATION + + + + + + + + + + + - + @@ -956,7 +956,7 @@ - + @@ -1001,7 +1001,7 @@ - + @@ -1010,7 +1010,7 @@ - + @@ -1055,8 +1055,8 @@ - - + + @@ -1065,42 +1065,42 @@ - - - + + + - - - - - - - - TH3 - - TH4 - - - - - - + + + + + + + + TH3 + + TH4 + + + + + + - - - - - - - + + + + + + + @@ -1109,7 +1109,7 @@ - + @@ -1154,8 +1154,8 @@ - - + + @@ -1164,7 +1164,7 @@ - + @@ -1209,7 +1209,7 @@ - + @@ -1254,7 +1254,7 @@ - + @@ -1299,7 +1299,7 @@ - + @@ -1308,7 +1308,7 @@ - + @@ -1353,7 +1353,7 @@ - + @@ -1398,7 +1398,7 @@ - + @@ -1407,7 +1407,7 @@ - + @@ -1452,7 +1452,7 @@ - + @@ -1497,7 +1497,7 @@ - + @@ -1506,7 +1506,7 @@ - + @@ -1551,7 +1551,7 @@ - + @@ -1596,7 +1596,7 @@ - + @@ -1605,7 +1605,7 @@ - + @@ -1650,7 +1650,7 @@ - + @@ -1659,7 +1659,7 @@ - + @@ -1704,7 +1704,7 @@ - + @@ -1713,28 +1713,28 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + @@ -1743,8 +1743,8 @@ - - + + @@ -1753,59 +1753,59 @@ - - - - - + + + + + - + - + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - 63SV - - - - + + + + + + + + + + + + + + + + + + 63SV + + + + @@ -1814,170 +1814,165 @@ - - - - - - + + + + + + - + - + - + - - + + - - PS4 - - + + PS4 + + - - - START/STOP - - - - UNLOAD/LOAD - - - - SHUTDOWN - - - - REMOTE STATUS - - - - ALARM - - - + + + START/STOP + + + + UNLOAD/LOAD + + + + SHUTDOWN + + + + REMOTE STATUS + + + + ALARM + + + - + - - - - - CAPACITY CONTROL - - - - - - - - - - - - - ######### - CURRENT - LOAD RATIO - LOAD NUMBER - 2nd Discharge Temp. - 2nd Suction Temp. - Interstage Press. - 1st Discharge Temp. - Oil Pressure - Oil Temp. - Motor Vibration - Gearbox Vibration - - - - - - - - - - - - - Run Hour - Total Load Time - Reminder Maint. - - - - - - Next Maint.Timing - 5 YEAR - - COMPRESSOR UNIT - C - #### - H - #### - A - % - H - - - - - - OVERHOUL - Next Maint.Timing - - #### - #### - #### - #### - °C - °C - MPa - °C - °C - MPa - mm/s - mm/s - - PS2 - + 2nd Discharge Temp. + 2nd Suction Temp. + Interstage Press. + 1st Discharge Temp. + Oil Pressure + Oil Temp. + Motor Vibration + Gearbox Vibration + COMPRESSOR UNIT - C + °C + °C + MPa + °C + °C + MPa + mm/s + mm/s + + PS2 + - Discharge Air Press. - MPa - + Discharge Air Press. + MPa + - 2nd Discharge Press. - MPa - #### - #### - #### - #### - #### - #### - #### - #### - #### - #### - Plant Air Reciever + 2nd Discharge Press. + MPa + #### + #### + #### + #### + #### + #### + #### + #### + #### + #### + Plant Air Reciever + + + + + CAPACITY CONTROL + + + + + + + + + + + + + ######### + CURRENT + LOAD RATIO + LOAD NUMBER + + + + + + + + + + + + + Run Hour + Total Load Time + Reminder Maint. + #### + H + #### + A + % + H + + + + + #### + Next Maint.Timing + #### + #### + #### + #### + + + + + \ No newline at end of file diff --git a/src/components/Global/MqttConnection.jsx b/src/components/Global/MqttConnection.jsx index e2be3aa..daff95b 100644 --- a/src/components/Global/MqttConnection.jsx +++ b/src/components/Global/MqttConnection.jsx @@ -74,27 +74,78 @@ const listenMessage = (callback) => { }); }; +const colorIds = ['c_1023', 'c_2023', 'c_2023']; +const StatusColor = (el, num) => { + switch (num) { + case 1: + el.style.fill = 'orange'; + break; + case 2: + el.style.fill = 'rgb(7,250,14)'; + break; + default: + el.style.fill = 'rgb(216,216,216)'; + } +}; + +const dryerIds = ['c_4018', 'c_4021', 'c_5018', 'c_5021', 'c_6018', 'c_6021']; +const handleBoolean = (svg, el, value) => { + if (!dryerIds.includes(el.id)) { + el.style.display = value ? '' : 'none'; + return; + } + + const i = dryerIds.indexOf(el.id); + const id1 = dryerIds[i - (i % 2)]; + const id2 = dryerIds[i - (i % 2) + 1]; + + const el1 = svg.getElementById(id1); + const el2 = svg.getElementById(id2); + + if (!el1 || !el2) return; + + el1.style.fill = value ? 'rgb(216,216,216)' : 'yellow'; + el2.style.fill = value ? 'yellow' : 'rgb(216,216,216)'; +}; + +const handleNumber = (el, value) => { + const num = Number(value); + + if (colorIds.includes(el.id)) { + StatusColor(el, num); + } else { + el.textContent = num.toFixed(2); + } +}; + +const handleOther = (el, value) => { + el.textContent = value; +}; + const setValSvg = (listenTopic, svg) => { client.on('message', (topic, message) => { - // console.log(topic ,' = ', listenTopic); if (topic === listenTopic) { const objChanel = JSON.parse(message); Object.entries(objChanel).forEach(([key, value]) => { - // console.log(key, value); const el = svg.getElementById(key); - if (el) { - if (value === true) { - el.style.display = ''; // sembunyikan - } else if (value === false) { - el.style.display = 'none'; - } else if (!isNaN(value)) { - el.textContent = Number(value ?? 0.0).toFixed(2); - } else { - el.textContent = value; - } + + if (!el) return; + // else if (el.id === 'c_2014' || el.id === 'c_2024') { + // el.setAttribute('text-anchor', 'middle'); + // el.setAttribute('x', '10%'); + // } + + if (typeof value === 'boolean') { + handleBoolean(svg, el, value); + } else if (!isNaN(value)) { + handleNumber(el, value); + } else { + handleOther(el, value); } }); + const target = svg.querySelector('text[x="225.25"][y="537.752"]'); + if (target) target.remove(); } }); }; diff --git a/src/layout/LayoutMenu.jsx b/src/layout/LayoutMenu.jsx index 607bc2f..b523c66 100644 --- a/src/layout/LayoutMenu.jsx +++ b/src/layout/LayoutMenu.jsx @@ -7,6 +7,7 @@ import { DatabaseOutlined, SettingOutlined, UserOutlined, + GlobalOutlined, AntDesignOutlined, ShoppingCartOutlined, ShoppingOutlined, @@ -36,6 +37,14 @@ import { } from '@ant-design/icons'; const { Text } = Typography; +const host = window.location.hostname; + +const isLocal = + host === '127.0.0.1' || + host === 'localhost' || + host.startsWith('192.168.') || + host.startsWith('10.') || + host.startsWith('172.'); const allItems = [ { @@ -225,6 +234,19 @@ const allItems = [ ), }, + ...(isLocal + ? [ + { + key: 'whatsapp-control', + icon: , + label: ( + + WhatsApp Control + + ), + }, + ] + : []), // { // key: 'jadwal-shift', // icon: , @@ -250,6 +272,7 @@ const LayoutMenu = () => { if (pathname === '/dashboard/home') return 'home'; if (pathname === '/user') return 'user'; if (pathname === '/role') return 'role'; + if (pathname === '/whatsapp-control') return 'whatsapp-control'; if (pathname === '/notification') return 'notification'; if (pathname === '/jadwal-shift') return 'jadwal-shift'; if (pathname === '/contact') return 'contact'; diff --git a/src/pages/master/brandDevice/component/ListErrorCode.jsx b/src/pages/master/brandDevice/component/ListErrorCode.jsx index 6fbba65..207eac7 100644 --- a/src/pages/master/brandDevice/component/ListErrorCode.jsx +++ b/src/pages/master/brandDevice/component/ListErrorCode.jsx @@ -1,6 +1,12 @@ import React, { useState, useEffect, useMemo } from 'react'; import { Card, Input, Button, Row, Col, Empty } from 'antd'; -import { PlusOutlined, SearchOutlined, DeleteOutlined, LeftOutlined, RightOutlined } from '@ant-design/icons'; +import { + PlusOutlined, + SearchOutlined, + DeleteOutlined, + LeftOutlined, + RightOutlined, +} from '@ant-design/icons'; import { getErrorCodesByBrandId, deleteErrorCode } from '../../../../api/master-brand'; import { NotifAlert, NotifOk, NotifConfirmDialog } from '../../../../components/Global/ToastNotif'; @@ -16,7 +22,7 @@ const ListErrorCode = ({ onSearch, onSearchClear, isReadOnly = false, - errorCodes: propErrorCodes = null + errorCodes: propErrorCodes = null, }) => { const [errorCodes, setErrorCodes] = useState([]); const [loading, setLoading] = useState(false); @@ -52,12 +58,12 @@ const ListErrorCode = ({ if (response && response.statusCode === 200) { const apiErrorData = response.data || []; const allErrorCodes = [ - ...apiErrorData.map(ec => ({ + ...apiErrorData.map((ec) => ({ ...ec, tempId: `existing_${ec.error_code_id}`, - status: 'existing' + status: 'existing', })), - ...tempErrorCodes.filter(ec => ec.status !== 'deleted') + ...tempErrorCodes.filter((ec) => ec.status !== 'deleted'), ]; setErrorCodes(allErrorCodes); @@ -82,11 +88,9 @@ const ListErrorCode = ({ useEffect(() => { if (isReadOnly && propErrorCodes) { - setErrorCodes(propErrorCodes); setLoading(false); } else { - fetchErrorCodes(); } }, [brandId, queryParams, tempErrorCodes, trigerFilter, isReadOnly, propErrorCodes]); @@ -126,20 +130,19 @@ const ListErrorCode = ({ title: 'Hapus Error Code', message: `Apakah Anda yakin ingin menghapus error code ${item.error_code}?`, onConfirm: () => performDelete(item), - onCancel: () => { }, - confirmButtonText: 'Hapus' + onCancel: () => {}, + confirmButtonText: 'Hapus', }); } }; const performDelete = async (item) => { try { - if (!item.error_code_id || item.error_code_id === 'undefined') { NotifAlert({ icon: 'error', title: 'Error', - message: 'Error code ID tidak valid' + message: 'Error code ID tidak valid', }); return; } @@ -148,7 +151,7 @@ const ListErrorCode = ({ NotifAlert({ icon: 'error', title: 'Error', - message: 'Brand ID tidak valid' + message: 'Brand ID tidak valid', }); return; } @@ -159,21 +162,21 @@ const ListErrorCode = ({ NotifOk({ icon: 'success', title: 'Berhasil', - message: 'Error code berhasil dihapus' + message: 'Error code berhasil dihapus', }); fetchErrorCodes(); } else { NotifAlert({ icon: 'error', title: 'Gagal', - message: 'Gagal menghapus error code' + message: 'Gagal menghapus error code', }); } } catch (error) { NotifAlert({ icon: 'error', title: 'Error', - message: 'Terjadi kesalahan saat menghapus error code' + message: 'Terjadi kesalahan saat menghapus error code', }); } }; @@ -181,8 +184,8 @@ const ListErrorCode = ({ return ( Search @@ -217,19 +220,18 @@ const ListErrorCode = ({ }} /> -
+
{errorCodes.length === 0 ? ( - + ) : (
{errorCodes.map((item) => ( @@ -240,13 +242,25 @@ const ListErrorCode = ({ padding: '8px 12px', borderRadius: '6px', marginBottom: '4px', - border: selectedErrorCode?.tempId === item.tempId ? '2px solid #23A55A' : '1px solid #d9d9d9', - backgroundColor: selectedErrorCode?.tempId === item.tempId ? '#f6ffed' : '#fff', - transition: 'all 0.2s ease' + border: + selectedErrorCode?.tempId === item.tempId + ? '2px solid #23A55A' + : '1px solid #d9d9d9', + backgroundColor: + selectedErrorCode?.tempId === item.tempId + ? '#f6ffed' + : '#fff', + transition: 'all 0.2s ease', }} onClick={() => onErrorCodeSelect(item)} > -
+
{item.error_code} @@ -266,7 +280,7 @@ const ListErrorCode = ({ padding: '2px 6px', height: '24px', fontSize: '11px', - border: '1px solid #ff4d4f' + border: '1px solid #ff4d4f', }} /> )} @@ -292,9 +306,15 @@ const ListErrorCode = ({ onClick={handlePrevious} disabled={pagination.current_page <= 1} size="small" + > + - - {pagination.current_page} / {pagination.total_page} + >
@@ -312,4 +331,4 @@ const ListErrorCode = ({ ); }; -export default ListErrorCode; \ No newline at end of file +export default ListErrorCode; diff --git a/src/pages/whatsAppControl/IndexWhatsAppControl.jsx b/src/pages/whatsAppControl/IndexWhatsAppControl.jsx new file mode 100644 index 0000000..69657f7 --- /dev/null +++ b/src/pages/whatsAppControl/IndexWhatsAppControl.jsx @@ -0,0 +1,85 @@ +import React, { useState, useEffect, memo } from 'react'; +import { useNavigate } from 'react-router-dom'; +import { Button, Typography } from 'antd'; +import { resetWA } from '../../api/whatsapp-control'; +import { useBreadcrumb } from '../../layout/LayoutBreadcrumb'; +import { ReloadOutlined } from '@ant-design/icons'; + +const { Text } = Typography; + +const IndexWhatsAppControl = memo(function IndexWhatsAppControl() { + const navigate = useNavigate(); + const { setBreadcrumbItems } = useBreadcrumb(); + + const [isPlaying, setIsPlaying] = useState(true); + + const url = import.meta.env.VITE_WHATSAPP_URL; + + const handleReset = async () => { + setIsPlaying(false); + await resetWA(); + setIsPlaying(true); + }; + + useEffect(() => { + const token = localStorage.getItem('token'); + + if (token) { + setBreadcrumbItems([ + { + title: ( + + • WhatsApp Control Panel + + ), + }, + ]); + } else { + navigate('/signin'); + } + }, []); + + return ( +
+
+ +
+ +
+ {isPlaying ? ( +