This commit is contained in:
ivan-sim
2024-10-17 14:08:14 +07:00
parent 5cb26d9553
commit 81a47bfb07
5 changed files with 62 additions and 12 deletions

View File

@@ -65,6 +65,15 @@ class ApotekController extends Controller
'tx_prescription_orders.nIDApotek', 'tx_prescription_orders.nIDApotek',
'tx_prescription_orders.sStatus as status', 'tx_prescription_orders.sStatus as status',
'tx_prescription_orders.sStatus', 'tx_prescription_orders.sStatus',
DB::raw('
CASE
WHEN TIMESTAMPDIFF(HOUR, tx_prescriptions.dTanggalResep, NOW()) > 72 THEN ""
WHEN TIMESTAMPDIFF(HOUR, tx_prescriptions.dTanggalResep, NOW()) > 1 AND tx_prescription_orders.sStatus = "waiting_pharmacy" THEN "1"
WHEN TIMESTAMPDIFF(HOUR, tx_prescriptions.dTanggalResep, NOW()) > 2 AND tx_prescription_orders.sStatus = "order_prepared" THEN "2"
WHEN TIMESTAMPDIFF(HOUR, tx_prescriptions.dTanggalResep, NOW()) > 3 AND tx_prescription_orders.sStatus = "ready" THEN "3"
ELSE ""
END AS alert
'),
DB::raw(' DB::raw('
CASE CASE
WHEN tx_prescription_orders.sStatus = "waiting_pharmacy" THEN "Diterima" WHEN tx_prescription_orders.sStatus = "waiting_pharmacy" THEN "Diterima"
@@ -234,6 +243,14 @@ class ApotekController extends Controller
$item->apotek = $organizations->get($item->nIDApotek, '-'); // Default to 'Unknown' if not found $item->apotek = $organizations->get($item->nIDApotek, '-'); // Default to 'Unknown' if not found
return $item; return $item;
}); });
$apotek_phone = DB::connection('mysql')->table('organizations')
->leftJoin('addresses', 'addresses.id','=', 'organizations.main_address_id')
->whereIn('organizations.id', $apotekIds)
->pluck('addresses.phone', 'organizations.id');
$results->getCollection()->transform(function ($item) use ($apotek_phone) {
$item->phone_apotek = $apotek_phone->get($item->nIDApotek, '-'); // Default to 'Unknown' if not found
return $item;
});
// Transform results to include allergies // Transform results to include allergies
$results->getCollection()->transform(function ($item) use ($organizations) { $results->getCollection()->transform(function ($item) use ($organizations) {
// Get the allergies for each user // Get the allergies for each user

View File

@@ -28,7 +28,8 @@ import {
Divider, Divider,
IconButton, IconButton,
Modal, Modal,
CircularProgress CircularProgress,
Container, Alert, AlertTitle
} from '@mui/material'; } from '@mui/material';
import { Dialog, DialogTitle, DialogContent, DialogActions } from '@mui/material'; import { Dialog, DialogTitle, DialogContent, DialogActions } from '@mui/material';
@@ -339,6 +340,16 @@ const allowedStatusesForCSLMS = ['waiting_pharmacy', 'order_prepared', 'ready',
return ( return (
// <Card> // <Card>
<Grid container> <Grid container>
{/* Check if any row has an alert and display a warning message */}
{rows.some(row => row.alert) && (
<Grid item xs={12} paddingX="24px" paddingY="20px">
<Alert severity="error">
<AlertTitle>{localeData.txtAttention}</AlertTitle>
{localeData.txtAttentionInfo}
</Alert>
</Grid>
)}
{/* Field 1 */} {/* Field 1 */}
<Grid item xs={12} paddingX="24px" paddingY="20px"> <Grid item xs={12} paddingX="24px" paddingY="20px">
<Grid container spacing={2}> <Grid container spacing={2}>
@@ -530,6 +541,7 @@ const allowedStatusesForCSLMS = ['waiting_pharmacy', 'order_prepared', 'ready',
{/* Table */} {/* Table */}
<TableContainer component={Paper}> <TableContainer component={Paper}>
<TableContent aria-label="collapsible table" size="small"> <TableContent aria-label="collapsible table" size="small">
{/* Table Header */} {/* Table Header */}
<EnhancedTableHead /> <EnhancedTableHead />
{/* End Table Header */} {/* End Table Header */}
@@ -544,7 +556,10 @@ const allowedStatusesForCSLMS = ['waiting_pharmacy', 'order_prepared', 'ready',
) : rows && rows.length >= 1 ? ( ) : rows && rows.length >= 1 ? (
rows.map((row, rowIndex) => ( rows.map((row, rowIndex) => (
<> <>
<TableRow key={rowIndex}> <TableRow
key={rowIndex}
style={{ backgroundColor: row.alert ? '#fff3cd' : '#fff'}}
>
{!selected.useSelected ? ( {!selected.useSelected ? (
'' ''
): (selected.useSelected && row.check_status === 'approved' && !row.check_claim ? ( ): (selected.useSelected && row.check_status === 'approved' && !row.check_claim ? (
@@ -651,6 +666,11 @@ const allowedStatusesForCSLMS = ['waiting_pharmacy', 'order_prepared', 'ready',
<TableCell colSpan={7}> <TableCell colSpan={7}>
<Collapse in={openRowId === row.id} timeout="auto" unmountOnExit> <Collapse in={openRowId === row.id} timeout="auto" unmountOnExit>
<Card sx={{padding:2}}> <Card sx={{padding:2}}>
<Stack direction="row" alignItems="center" justifyContent="right">
<IconButton sx={{ color: 'black' }} onClick={() => setOpenRowId(null)}>
<CloseIcon />
</IconButton>
</Stack>
{/* Icon inside a Box for spacing and alignment */} {/* Icon inside a Box for spacing and alignment */}
<Stack direction="row" padding={2} justifyContent="space-between" alignItems="center"> <Stack direction="row" padding={2} justifyContent="space-between" alignItems="center">
<Stack direction="row"> <Stack direction="row">
@@ -922,9 +942,9 @@ const allowedStatusesForCSLMS = ['waiting_pharmacy', 'order_prepared', 'ready',
<Box sx={{ display: 'flex', justifyContent: 'space-between', padding: '20px', maxWidth: '1200px', margin: '0 auto' }}> <Box sx={{ display: 'flex', justifyContent: 'space-between', padding: '20px', maxWidth: '1200px', margin: '0 auto' }}>
{/* Close Button on the Left */} {/* Close Button on the Left */}
<Button variant="outlined" color="inherit" onClick={() => setOpenRowId(null)}> {/* <Button variant="outlined" color="inherit" onClick={() => setOpenRowId(null)}>
{localeData.txtButtonClose} {localeData.txtButtonClose}
</Button> </Button> */}
{/* Accept Button on the Right */} {/* Accept Button on the Right */}
{/* {row.button_accept && formattedRoleName === 'admin-apotek' && allowedStatusesForApotek.includes(row.sStatus) ? ( {/* {row.button_accept && formattedRoleName === 'admin-apotek' && allowedStatusesForApotek.includes(row.sStatus) ? (
<Button variant="contained" color="primary" onClick={() => setDialogIDRow(row.id === dialogIDRow ? null : row.id)}> <Button variant="contained" color="primary" onClick={() => setDialogIDRow(row.id === dialogIDRow ? null : row.id)}>

View File

@@ -83,6 +83,7 @@
"txtPrescriptionDate" : "Date", "txtPrescriptionDate" : "Date",
"txtPrescriptionPatient" : "Patient", "txtPrescriptionPatient" : "Patient",
"txtPrescriptionPharmacy" : "Pharmacy", "txtPrescriptionPharmacy" : "Pharmacy",
"txtPrescriptionPharmacyPhone" : "Pharmacy Phone",
"txtPrescriptionDetail" : "Detail", "txtPrescriptionDetail" : "Detail",
"txtPrescriptionDownload" : "Download Prescription", "txtPrescriptionDownload" : "Download Prescription",
"txtProviderDoctorInformation" : "Provider & Doctor Information", "txtProviderDoctorInformation" : "Provider & Doctor Information",
@@ -135,6 +136,9 @@
"txtFindingDriver": "Finding a driver...", "txtFindingDriver": "Finding a driver...",
"txtDriverFound": "The drivers been grabbed with the ID", "txtDriverFound": "The drivers been grabbed with the ID",
"txtButtonClose": "Close", "txtButtonClose": "Close",
"txtLabelFailed": "Failed" "txtLabelFailed": "Failed",
"txtAttention": "Attention",
"txtAttentionInfo": "There are pending orders that require approval."
} }

View File

@@ -83,6 +83,7 @@
"txtPrescriptionDate" : "Tanggal", "txtPrescriptionDate" : "Tanggal",
"txtPrescriptionPatient" : "Pasien", "txtPrescriptionPatient" : "Pasien",
"txtPrescriptionPharmacy" : "Apotek", "txtPrescriptionPharmacy" : "Apotek",
"txtPrescriptionPharmacyPhone" : "No. HP Apotek",
"txtPrescriptionDetail" : "Detail", "txtPrescriptionDetail" : "Detail",
"txtPrescriptionDownload" : "Download Resep", "txtPrescriptionDownload" : "Download Resep",
"txtProviderDoctorInformation" : "Informasi Provider & Dokter", "txtProviderDoctorInformation" : "Informasi Provider & Dokter",
@@ -135,5 +136,7 @@
"txtFindingDriver" : "Sedang mencari driver...", "txtFindingDriver" : "Sedang mencari driver...",
"txtDriverFound" : "Driver sudah didapat dengan ID", "txtDriverFound" : "Driver sudah didapat dengan ID",
"txtButtonClose": "Tutup", "txtButtonClose": "Tutup",
"txtLabelFailed": "Gagal Pengiriman" "txtLabelFailed": "Gagal Pengiriman",
"txtAttention": "Perhatian",
"txtAttentionInfo": "Terdapat pesanan pending mohon untuk segera di approve."
} }

View File

@@ -289,6 +289,12 @@ export default function TableList() {
label: localeData.txtPrescriptionPharmacy, label: localeData.txtPrescriptionPharmacy,
isSort: true, isSort: true,
}, },
{
id: 'phone_apotek',
align: 'center',
label: localeData.txtPrescriptionPharmacyPhone,
isSort: true,
},
{ {
id: 'status', id: 'status',
align: 'center', align: 'center',
@@ -402,7 +408,7 @@ export default function TableList() {
action: action:
<TableMoreMenu actions={ <TableMoreMenu actions={
<> <>
<MenuItem onClick={() => setOpenRowId(obj.id === openRowId ? null : obj.id)}> <MenuItem onClick={() => setOpenRowId(obj.id)}>
<Iconify icon="eva:eye-fill" /> <Iconify icon="eva:eye-fill" />
{localeData.txtPrescriptionDetail} {localeData.txtPrescriptionDetail}
</MenuItem> </MenuItem>