diff --git a/client/public/assets/images/orders/location.jpg b/client/public/assets/images/orders/location.jpg new file mode 100644 index 0000000..914c12d Binary files /dev/null and b/client/public/assets/images/orders/location.jpg differ diff --git a/client/public/assets/images/orders/order-complete.jpg b/client/public/assets/images/orders/order-complete.jpg new file mode 100644 index 0000000..21e968e Binary files /dev/null and b/client/public/assets/images/orders/order-complete.jpg differ diff --git a/client/public/assets/images/orders/order-loading.jpg b/client/public/assets/images/orders/order-loading.jpg new file mode 100644 index 0000000..d39a463 Binary files /dev/null and b/client/public/assets/images/orders/order-loading.jpg differ diff --git a/client/public/assets/images/orders/preview.jpg b/client/public/assets/images/orders/preview.jpg new file mode 100644 index 0000000..43c182a Binary files /dev/null and b/client/public/assets/images/orders/preview.jpg differ diff --git a/client/public/assets/images/orders/product.jpg b/client/public/assets/images/orders/product.jpg new file mode 100644 index 0000000..122ee77 Binary files /dev/null and b/client/public/assets/images/orders/product.jpg differ diff --git a/client/src/sections/orders/order-card.jsx b/client/src/sections/orders/order-card.jsx index 3317061..94fc221 100644 --- a/client/src/sections/orders/order-card.jsx +++ b/client/src/sections/orders/order-card.jsx @@ -140,13 +140,15 @@ export default function OrderCard({ order, onCancelOrder, onChangeOrderStatus }) - - + - {status !== 'Cancelled' && user === 'Patient' && ( + {status !== 'Cancelled' && user === 'Patient' && status != 'Delivered' && ( - @@ -159,7 +161,7 @@ export default function OrderCard({ order, onCancelOrder, onChangeOrderStatus }) )} {status !== 'Cancelled' && user === 'Pharmacist' && ( - )} @@ -174,15 +176,47 @@ export default function OrderCard({ order, onCancelOrder, onChangeOrderStatus }) aria-labelledby="order-details-modal" aria-describedby="order-details-description" > - + Choose the new status - - - - + + + + diff --git a/client/src/sections/report/general-report.jsx b/client/src/sections/report/general-report.jsx index 29eefa0..8796d6f 100644 --- a/client/src/sections/report/general-report.jsx +++ b/client/src/sections/report/general-report.jsx @@ -1,7 +1,18 @@ import React, { useState, useEffect } from 'react'; import { DataGrid } from '@mui/x-data-grid'; import axios from 'axios'; -import { Typography, FormControl, InputLabel, Select, MenuItem, Stack, TextField, InputAdornment, IconButton, Alert } from '@mui/material'; +import { + Typography, + FormControl, + InputLabel, + Select, + MenuItem, + Stack, + TextField, + InputAdornment, + IconButton, + Alert +} from '@mui/material'; import TodayIcon from '@mui/icons-material/Today'; import ClearIcon from '@mui/icons-material/Clear'; @@ -12,10 +23,32 @@ const columns = [ ]; const months = [ - 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' + 'January', + 'February', + 'March', + 'April', + 'May', + 'June', + 'July', + 'August', + 'September', + 'October', + 'November', + 'December' ]; const monthMap = { - January: 1, February: 2, March: 3, April: 4, May: 5, June: 6, July: 7, August: 8, September: 9, October: 10, November: 11, December: 12 + January: 1, + February: 2, + March: 3, + April: 4, + May: 5, + June: 6, + July: 7, + August: 8, + September: 9, + October: 10, + November: 11, + December: 12 }; export default function GeneralReport() { @@ -23,6 +56,7 @@ export default function GeneralReport() { const [rows, setRows] = useState([]); const [selectedMonth, setSelectedMonth] = useState(''); const [selectedDate, setSelectedDate] = useState(null); + const [loading, setLoading] = useState(false); const handleMonthChange = (event) => { setSelectedMonth(event.target.value); @@ -45,6 +79,7 @@ export default function GeneralReport() { useEffect(() => { const fetchData = async () => { try { + setLoading(true); let report; if (selectedDate) { const month = selectedDate.getMonth() + 1; @@ -72,6 +107,8 @@ export default function GeneralReport() { setRows(rowsArray); } catch (error) { setError(error); + } finally { + setLoading(false); } }; @@ -85,71 +122,73 @@ export default function GeneralReport() { An error occurred while fetching data. )} + {loading && ( + + Loading.. + + )} + {!loading && ( + <> + + + Select Month + + - - - Select Month - - - - - - - ), - endAdornment: selectedDate && ( - - - - - - ) - }} - /> - + + + + ), + endAdornment: selectedDate && ( + + + + + + ) + }} + /> + -
- -
-
- - Total - -
-
- Total Sales: - {`$${rows.reduce((total, row) => total + row.totalSales, 0)}`} +
+
-
- Total Items Saled: - {rows.reduce((total, row) => total + row.totalItemsSaled, 0)} +
+ + Total + +
+
+ Total Sales: + {`$${rows.reduce((total, row) => total + row.totalSales, 0)}`} +
+
+ Total Items Saled: + {rows.reduce((total, row) => total + row.totalItemsSaled, 0)} +
+
-
-
- + + )}
); }