Merge remote-tracking branch 'origin/staging' into origin/production

This commit is contained in:
Server D3 Linksehat
2024-12-05 16:11:15 +07:00
14 changed files with 114 additions and 19 deletions

View File

@@ -52,9 +52,12 @@ class ApotekController extends Controller
});
})
->when($request->input('status'), function ($query, $status) {
$query->where(function ($query) use ($status) {
$query->where('tx_prescription_orders.sStatus', '=', $status);
});
// Apply the filter if 'status' has a value
if ($status !== 'all') {
$query->where(function ($query) use ($status) {
$query->where('tx_prescription_orders.sStatus', '=', $status);
});
}
})
->select(
'tx_prescriptions.nID as id',
@@ -65,6 +68,15 @@ class ApotekController extends Controller
'tx_prescription_orders.nIDApotek',
'tx_prescription_orders.sStatus as status',
'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('
CASE
WHEN tx_prescription_orders.sStatus = "waiting_pharmacy" THEN "Diterima"
@@ -234,6 +246,14 @@ class ApotekController extends Controller
$item->apotek = $organizations->get($item->nIDApotek, '-'); // Default to 'Unknown' if not found
return $item;
});
$apotek_phone = DB::connection('mysql')->table('organizations')
// ->leftJoin('addresses', 'addresses.id','=', 'organizations.main_address_id')
->whereIn('organizations.id', $apotekIds)
->pluck('organizations.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
$results->getCollection()->transform(function ($item) use ($organizations) {
// Get the allergies for each user
@@ -378,26 +398,26 @@ class ApotekController extends Controller
'dUpdateOn' => date('Y-m-d H:i:s'),
]);
// Insert the log
// Insert the log
$prescriptionOrder = DB::connection('oldlms')
->table('tx_prescription_orders')
->where('tx_prescription_orders.nID', '=', $id)
->join('tx_delivery_orders', 'tx_delivery_orders.nIDPrescriptionOrder', '=', 'tx_prescription_orders.nID')
->select('tx_prescription_orders.*', 'tx_delivery_orders.*', 'tx_delivery_orders.nID as nIDDelivery') // Add specific columns you want to select
->first();
if ($prescriptionOrder) {
$createdBy = $prescriptionOrder->sCreateBy;
$nIDPrescription = $prescriptionOrder->nIDPrescription;
$nIDDeliveryOrder = $prescriptionOrder->nIDDelivery;
// Insert data into the tx_delivery_log table
DB::connection('oldlms')->table('tx_delivery_log')->insert([
'sStatus' => $prescriptionOrder->sDeliveryStatus,
'sStatusPrescription' => $status,
'nIDDeliveryOrder' => $nIDDeliveryOrder,
'nIDPrescription' => $nIDPrescription,
'dCreatedOn' => now(),
'dCreatedOn' => now(),
]);
}
@@ -697,5 +717,5 @@ class ApotekController extends Controller
$uuidV5 = Uuid::uuid5($namespace, $id_prescription_order);
return $uuidV5->toString();
}
}

View File

@@ -307,6 +307,10 @@ class RequestLogController extends Controller
$requestLog->reason = $request->reason;
}
if (!empty($request->type_of_member)){
$requestLog->type_of_member = $request->type_of_member;
}
if ($request->status){
$requestLog->status = $request->status;
$requestLog->approved_by = auth()->user()->id;

View File

@@ -126,6 +126,7 @@ class RequestLogShowResource extends JsonResource
'code' => $requestLog['code'],
'code_claim' => $claimCode,
'member_id' => $requestLog['member']['member_id'],
'type_of_member' => $requestLog['type_of_member'],
'corporate_id' => $corporateId,
'policy_number' =>$policyNumber->code ? $policyNumber->code : '-',
'name' => $requestLog['member']['name'],

View File

@@ -51,6 +51,7 @@ class RequestLog extends Model
'approved_final_log_at',
'created_final_at',
'created_final_by',
'type_of_member'
];
protected $hidden = [

View File

@@ -16,7 +16,7 @@ class ApotekMandiriInhealtSeeder extends Seeder
*/
public function run()
{
$file_path = resource_path('files/data-apotik-layanan-pharmacy-delivery.xlsx');
$file_path = resource_path('files/data-apotik-layanan-pharmacy-delivery-update.xlsx');
$reader = ReaderEntityFactory::createReaderFromFile($file_path);
$reader->open($file_path);

View File

@@ -111,6 +111,10 @@ export default function DialogConfirmation({requestLog, setOpenDialog, openDialo
<Typography variant='subtitle2' sx={style1} gutterBottom>Member ID</Typography>
<Typography variant='subtitle2' sx={style2} gutterBottom>{requestLog?.member_id}</Typography>
</Stack>
<Stack direction='row' spacing={2} sx={marginBottom1}>
<Typography variant='subtitle2' sx={style1} gutterBottom>Member Of Type</Typography>
<Typography variant='subtitle2' sx={style2} gutterBottom>{requestLog?.type_of_member}</Typography>
</Stack>
<Stack direction='row' spacing={2} sx={marginBottom1}>
<Typography variant='subtitle2' sx={style1} gutterBottom>Policy Number</Typography>
<Typography variant='subtitle2' sx={style2} gutterBottom>{requestLog?.policy_number}</Typography>

View File

@@ -200,6 +200,10 @@ export default function Detail() {
<Typography variant='subtitle2' sx={style1} gutterBottom>Member ID</Typography>
<Typography variant='subtitle2' sx={style2} gutterBottom>{requestLog?.member_id}</Typography>
</Stack>
<Stack direction='row' spacing={2} sx={marginBottom1}>
<Typography variant='subtitle2' sx={style1} gutterBottom>Type Of Member</Typography>
<Typography variant='subtitle2' sx={style2} gutterBottom>{requestLog?.type_of_member}</Typography>
</Stack>
<Stack direction='row' spacing={2} sx={marginBottom1}>
<Typography variant='subtitle2' sx={style1} gutterBottom>Policy Number</Typography>
<Typography variant='subtitle2' sx={style2} gutterBottom>{requestLog?.policy_number}</Typography>

View File

@@ -1,7 +1,7 @@
import MuiDialog from "@/components/MuiDialog";
import { Button, Card, Checkbox, DialogActions, Grid, TextField, TextareaAutosize, Typography } from "@mui/material";
import { Paper } from "@mui/material";
import { Stack } from '@mui/material';
import { Stack, Select, MenuItem } from '@mui/material';
import React, { useEffect, useState } from 'react';
import { DetailRequestLogType } from "../Model/Types";
import { fDateTimesecond, toTitleCase } from "@/utils/formatTime";
@@ -28,6 +28,7 @@ export default function DialogConfirmation({requestLog, setOpenDialog, openDialo
keterangan: '',
hak_kamar_pasien: '',
penempatan_kamar: '',
type_of_member: ''
});
useEffect(() => {
@@ -90,6 +91,7 @@ export default function DialogConfirmation({requestLog, setOpenDialog, openDialo
keterangan: '',
hak_kamar_pasien: '',
penempatan_kamar: '',
type_of_member: ''
});
};
@@ -123,6 +125,10 @@ export default function DialogConfirmation({requestLog, setOpenDialog, openDialo
<Typography variant='subtitle2' sx={style1} gutterBottom>Member ID</Typography>
<Typography variant='subtitle2' sx={style2} gutterBottom>{requestLog?.member_id}</Typography>
</Stack>
<Stack direction='row' spacing={2} sx={marginBottom1}>
<Typography variant='subtitle2' sx={style1} gutterBottom>Type of Member</Typography>
<Typography variant='subtitle2' sx={style2} gutterBottom>{requestLog?.type_of_member}</Typography>
</Stack>
<Stack direction='row' spacing={2} sx={marginBottom1}>
<Typography variant='subtitle2' sx={style1} gutterBottom>Policy Number</Typography>
<Typography variant='subtitle2' sx={style2} gutterBottom>{requestLog?.policy_number}</Typography>
@@ -183,6 +189,22 @@ export default function DialogConfirmation({requestLog, setOpenDialog, openDialo
onChange={(e) => handleChange('hak_kamar_pasien', e.target.value)}
/>
</Stack>
<Stack direction='row' spacing={2} sx={marginBottom2}>
<Typography variant='subtitle2' sx={style1} gutterBottom>Type Of Member</Typography>
<Select
fullWidth
value={formData.type_of_member}
onChange={(e) => handleChange('type_of_member', e.target.value)}
variant="outlined"
displayEmpty
>
<MenuItem value="" disabled>
Type Member
</MenuItem>
<MenuItem value="OMT">OMT</MenuItem>
<MenuItem value="Non OMT">Non OMT</MenuItem>
</Select>
</Stack>
<Stack direction='row' spacing={2} sx={marginBottom2}>
<Typography variant='subtitle2' sx={style1} gutterBottom>Penempatan Kamar</Typography>
<TextField

View File

@@ -116,6 +116,10 @@ export default function Detail() {
<Typography variant='subtitle2' sx={style1} gutterBottom>Member ID</Typography>
<Typography variant='subtitle2' sx={style2} gutterBottom>{requestLog?.member_id}</Typography>
</Stack>
<Stack direction='row' spacing={2} sx={marginBottom1}>
<Typography variant='subtitle2' sx={style1} gutterBottom>Type Of Member</Typography>
<Typography variant='subtitle2' sx={style2} gutterBottom>{requestLog?.type_of_member}</Typography>
</Stack>
<Stack direction='row' spacing={2} sx={marginBottom1}>
<Typography variant='subtitle2' sx={style1} gutterBottom>Policy Number</Typography>
<Typography variant='subtitle2' sx={style2} gutterBottom>{requestLog?.policy_number}</Typography>

View File

@@ -13,7 +13,7 @@ export default function BaseTablePagination({
<Box>
<TablePagination
component="div"
rowsPerPageOptions={[10, 25]}
rowsPerPageOptions={[10, 25, 50, 100]}
count={count}
page={page}
onPageChange={onPageChange}

View File

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

View File

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

View File

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

View File

@@ -289,6 +289,13 @@ export default function TableList() {
label: localeData.txtPrescriptionPharmacy,
isSort: true,
},
// Conditionally include button_accept if the role is 'admin-apotek'
...(formattedRoleName === 'cs-lms' ? [{
id: 'phone_apotek',
align: 'center',
label: localeData.txtPrescriptionPharmacyPhone,
isSort: false,
}] : []),
{
id: 'status',
align: 'center',
@@ -329,7 +336,8 @@ export default function TableList() {
: Object.fromEntries([...searchParams.entries(), ['order', order], ['orderBy', orderBy]]);
const response = await axios.get(`/get-prescription-orders`, {
params: { ...parameters, type: 'prescription-orders' },
params: { ...parameters, search:searchText, order: order,
orderBy: orderBy, status:statusValue, type: 'prescription-orders' },
});
setDataTableData(response.data);
setData(
@@ -402,7 +410,7 @@ export default function TableList() {
action:
<TableMoreMenu actions={
<>
<MenuItem onClick={() => setOpenRowId(obj.id === openRowId ? null : obj.id)}>
<MenuItem onClick={() => setOpenRowId(obj.id)}>
<Iconify icon="eva:eye-fill" />
{localeData.txtPrescriptionDetail}
</MenuItem>