Merge remote-tracking branch 'origin/staging' into origin/production
This commit is contained in:
@@ -71,8 +71,8 @@ class ApotekController extends Controller
|
|||||||
WHEN tx_prescription_orders.sStatus = "order_prepared" THEN "Siap Diambil"
|
WHEN tx_prescription_orders.sStatus = "order_prepared" THEN "Siap Diambil"
|
||||||
WHEN tx_prescription_orders.sStatus = "ready" THEN "Cari Kurir"
|
WHEN tx_prescription_orders.sStatus = "ready" THEN "Cari Kurir"
|
||||||
WHEN tx_prescription_orders.sStatus = "failed" THEN "Cari Kurir"
|
WHEN tx_prescription_orders.sStatus = "failed" THEN "Cari Kurir"
|
||||||
WHEN tx_prescription_orders.sStatus = "waiting_for_courir" THEN "Kurir Sudah Ambil Pesanan"
|
WHEN tx_prescription_orders.sStatus = "waiting_for_courir" THEN "Pesanan Diambil"
|
||||||
WHEN tx_prescription_orders.sStatus = "package_picked_up" THEN "Sedang diantar ke Alamat Tujuan"
|
WHEN tx_prescription_orders.sStatus = "package_picked_up" THEN "Sedang Diantar"
|
||||||
WHEN tx_prescription_orders.sStatus = "package_on_delivery" THEN "Selesai"
|
WHEN tx_prescription_orders.sStatus = "package_on_delivery" THEN "Selesai"
|
||||||
ELSE ""
|
ELSE ""
|
||||||
END AS button_accept'),
|
END AS button_accept'),
|
||||||
@@ -189,7 +189,7 @@ class ApotekController extends Controller
|
|||||||
'),
|
'),
|
||||||
'tx_prescription_orders.sAddress AS alamat_penerima',
|
'tx_prescription_orders.sAddress AS alamat_penerima',
|
||||||
'tx_prescription_orders.sDeliveryMethod AS pengiriman',
|
'tx_prescription_orders.sDeliveryMethod AS pengiriman',
|
||||||
'tx_prescription_orders.sDeliveryPrice AS total_kirim',
|
'tx_prescription_orders.nTotalPrice AS total_kirim',
|
||||||
'tx_prescriptions.sNoRefProvider AS noref_dokter',
|
'tx_prescriptions.sNoRefProvider AS noref_dokter',
|
||||||
DB::raw('DATE_ADD(tx_prescriptions.dTanggalResep, INTERVAL 1 DAY) as valid_tanggal'),
|
DB::raw('DATE_ADD(tx_prescriptions.dTanggalResep, INTERVAL 1 DAY) as valid_tanggal'),
|
||||||
'tx_prescriptions.sNomorPenjamin AS nomor_penjamin',
|
'tx_prescriptions.sNomorPenjamin AS nomor_penjamin',
|
||||||
@@ -479,7 +479,12 @@ class ApotekController extends Controller
|
|||||||
$apotek = DB::connection('mysql')->table('organizations')
|
$apotek = DB::connection('mysql')->table('organizations')
|
||||||
->leftJoin('addresses', 'addresses.id', '=', 'organizations.main_address_id')
|
->leftJoin('addresses', 'addresses.id', '=', 'organizations.main_address_id')
|
||||||
->where('organizations.id', '=', $prescriptions->nIDApotek)
|
->where('organizations.id', '=', $prescriptions->nIDApotek)
|
||||||
->select('organizations.name as nama_apotek', 'addresses.text as alamat_apotek', 'addresses.lat', 'addresses.lng')
|
->select('organizations.name as nama_apotek',
|
||||||
|
'addresses.text as alamat_apotek',
|
||||||
|
'addresses.lat',
|
||||||
|
'addresses.lng',
|
||||||
|
'organizations.phone',
|
||||||
|
'organizations.email')
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
// Fetch patient (pasien) data
|
// Fetch patient (pasien) data
|
||||||
@@ -500,6 +505,7 @@ class ApotekController extends Controller
|
|||||||
'tm_users.sPhone as phone',
|
'tm_users.sPhone as phone',
|
||||||
'tm_users_detail.sLatitude as latitude',
|
'tm_users_detail.sLatitude as latitude',
|
||||||
'tm_users_detail.sLongitude as longitude',
|
'tm_users_detail.sLongitude as longitude',
|
||||||
|
'tm_users_detail.sAlamatMap',
|
||||||
DB::raw('(SELECT tm_provinsi.sProvinsi FROM tm_provinsi WHERE tm_provinsi.nID = tm_users_detail.nIDProvinsi LIMIT 1) AS provinsi'),
|
DB::raw('(SELECT tm_provinsi.sProvinsi FROM tm_provinsi WHERE tm_provinsi.nID = tm_users_detail.nIDProvinsi LIMIT 1) AS provinsi'),
|
||||||
DB::raw('(SELECT tm_kota.sKota FROM tm_kota WHERE tm_kota.nID = tm_users_detail.nIDKota LIMIT 1) AS kota'),
|
DB::raw('(SELECT tm_kota.sKota FROM tm_kota WHERE tm_kota.nID = tm_users_detail.nIDKota LIMIT 1) AS kota'),
|
||||||
DB::raw('(SELECT tm_kecamatan.sKecamatan FROM tm_kecamatan WHERE tm_kecamatan.nID = tm_users_detail.nIDKecamatan LIMIT 1) AS kecamatan'),
|
DB::raw('(SELECT tm_kecamatan.sKecamatan FROM tm_kecamatan WHERE tm_kecamatan.nID = tm_users_detail.nIDKecamatan LIMIT 1) AS kecamatan'),
|
||||||
@@ -542,7 +548,7 @@ class ApotekController extends Controller
|
|||||||
]
|
]
|
||||||
],
|
],
|
||||||
"destination" => [
|
"destination" => [
|
||||||
"address" => "{$pasien->provinsi}, {$pasien->kota}, {$pasien->kecamatan}, {$pasien->kelurahan}, {$pasien->kode_pos}",
|
"address" => $pasien->sAlamatMap,
|
||||||
"coordinates" => [
|
"coordinates" => [
|
||||||
"latitude" => (float)$pasien->latitude,
|
"latitude" => (float)$pasien->latitude,
|
||||||
"longitude" => (float)$pasien->longitude
|
"longitude" => (float)$pasien->longitude
|
||||||
@@ -556,10 +562,10 @@ class ApotekController extends Controller
|
|||||||
"smsEnabled" => true
|
"smsEnabled" => true
|
||||||
],
|
],
|
||||||
"sender" => [
|
"sender" => [
|
||||||
"firstName" => env('SENDER_NAME_GRAB'),
|
"firstName" => $apotek->nama_apotek,
|
||||||
"companyName" => env('SENDER_COMPANY_NAME_GRAB'),
|
"companyName" => $apotek->nama_apotek,
|
||||||
"email" => env('SENDER_EMAIL_GRAB'),
|
"email" => $apotek->email,
|
||||||
"phone" => env('SENDER_PHONE_GRAB'),
|
"phone" => $apotek->phone,
|
||||||
"smsEnabled" => true
|
"smsEnabled" => true
|
||||||
],
|
],
|
||||||
"schedule" => $grabHelper->getScheduleTimes()
|
"schedule" => $grabHelper->getScheduleTimes()
|
||||||
|
|||||||
@@ -93,6 +93,8 @@ class PermissionTableSeeder extends Seeder
|
|||||||
'file-billing-client-portal',
|
'file-billing-client-portal',
|
||||||
'file-diagnosis-client-portal',
|
'file-diagnosis-client-portal',
|
||||||
'file-pendukung-medis-client-portal',
|
'file-pendukung-medis-client-portal',
|
||||||
|
'export-alarm-center-client-portal',
|
||||||
|
'filter-alarm-center-client-portal',
|
||||||
'benefit-client-portal',
|
'benefit-client-portal',
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -19,12 +19,21 @@ import { enqueueSnackbar } from 'notistack';
|
|||||||
import Label from '../../components/Label';
|
import Label from '../../components/Label';
|
||||||
import { Stack } from '@mui/material';
|
import { Stack } from '@mui/material';
|
||||||
import { Download } from '@mui/icons-material';
|
import { Download } from '@mui/icons-material';
|
||||||
|
import useAuth from '../../hooks/useAuth';
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
export default function List() {
|
export default function List() {
|
||||||
|
const {user} = useAuth();
|
||||||
|
const checkIfNameExists = (name) => {
|
||||||
|
return user.user.permissions.some(item => item.name === name);
|
||||||
|
};
|
||||||
|
const exportLog = 'export-alarm-center-client-portal';
|
||||||
|
const filterLog = 'filter-alarm-center-client-portal';
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const viewExportCheck = checkIfNameExists(exportLog);
|
||||||
|
const viewFilterCheck = checkIfNameExists(filterLog);
|
||||||
const { corporateValue } = useContext(UserCurrentCorporateContext);
|
const { corporateValue } = useContext(UserCurrentCorporateContext);
|
||||||
|
|
||||||
const [data, setData] = useState([]);
|
const [data, setData] = useState([]);
|
||||||
@@ -168,7 +177,7 @@ export default function List() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const filterStartDate = {
|
const filterStartDate = {
|
||||||
useFilter: true,
|
useFilter: viewFilterCheck ? true : false,
|
||||||
startDate: startDateValue,
|
startDate: startDateValue,
|
||||||
setStartDate: setStartDateValue,
|
setStartDate: setStartDateValue,
|
||||||
handleStartDateChange: handleStartDateChanges,
|
handleStartDateChange: handleStartDateChanges,
|
||||||
@@ -190,7 +199,7 @@ export default function List() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const filterEndDate = {
|
const filterEndDate = {
|
||||||
useFilter: true,
|
useFilter: viewFilterCheck ? true : false,
|
||||||
endDate: endDateValue,
|
endDate: endDateValue,
|
||||||
setEndDate: setEndDateValue,
|
setEndDate: setEndDateValue,
|
||||||
handleEndDateChange: handleEndDateChanges,
|
handleEndDateChange: handleEndDateChanges,
|
||||||
@@ -225,7 +234,7 @@ export default function List() {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
const exportReport = {
|
const exportReport = {
|
||||||
useExport: true,
|
useExport: viewExportCheck ? true : false,
|
||||||
startDate: startDateValue,
|
startDate: startDateValue,
|
||||||
endDate: endDateValue,
|
endDate: endDateValue,
|
||||||
status: statusValue,
|
status: statusValue,
|
||||||
|
|||||||
@@ -94,6 +94,8 @@ export default function Table<T>({
|
|||||||
selected,
|
selected,
|
||||||
openRowId, // Receive the currently opened row ID
|
openRowId, // Receive the currently opened row ID
|
||||||
setOpenRowId, // Receive the function to set the opened row ID
|
setOpenRowId, // Receive the function to set the opened row ID
|
||||||
|
dialogIDRow,
|
||||||
|
setDialogIDRow,
|
||||||
reloadData,
|
reloadData,
|
||||||
}: TableListProps<T>) {
|
}: TableListProps<T>) {
|
||||||
/* ------------------------------- handle sort ------------------------------ */
|
/* ------------------------------- handle sort ------------------------------ */
|
||||||
@@ -249,7 +251,7 @@ const allowedStatusesForCSLMS = ['waiting_pharmacy', 'order_prepared', 'ready',
|
|||||||
|
|
||||||
|
|
||||||
const [openDialogStatus, setOpenDialogStatus] = useState(false);
|
const [openDialogStatus, setOpenDialogStatus] = useState(false);
|
||||||
const [dialogIDRow, setDialogIDRow] = useState<number | null>(null);
|
// const [dialogIDRow, setDialogIDRow] = useState<number | null>(null);
|
||||||
const [dialogIDRowDriver, setDialogIDRowDriver] = useState<number | null>(null);
|
const [dialogIDRowDriver, setDialogIDRowDriver] = useState<number | null>(null);
|
||||||
const [txtStatusDriver, setTxtStatusDriver] = useState('');
|
const [txtStatusDriver, setTxtStatusDriver] = useState('');
|
||||||
const [txtIDDriver, setTxtIDDriver] = useState('');
|
const [txtIDDriver, setTxtIDDriver] = useState('');
|
||||||
@@ -269,7 +271,7 @@ const allowedStatusesForCSLMS = ['waiting_pharmacy', 'order_prepared', 'ready',
|
|||||||
const handleClickKonfirmasi = (row: any) => {
|
const handleClickKonfirmasi = (row: any) => {
|
||||||
setTxtStatusDriver('');
|
setTxtStatusDriver('');
|
||||||
setTxtIDDriver('');
|
setTxtIDDriver('');
|
||||||
if(row.sStatus === 'ready' || row.sStatus === 'failed')
|
if(row.sStatus === 'order_prepared' || row.sStatus === 'ready' || row.sStatus === 'failed')
|
||||||
{
|
{
|
||||||
//close
|
//close
|
||||||
setDialogIDRow(row.id === dialogIDRow ? null : row.id);
|
setDialogIDRow(row.id === dialogIDRow ? null : row.id);
|
||||||
@@ -311,6 +313,8 @@ const allowedStatusesForCSLMS = ['waiting_pharmacy', 'order_prepared', 'ready',
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const putPrescriptionOrders = (row: any) => {
|
const putPrescriptionOrders = (row: any) => {
|
||||||
|
//close
|
||||||
|
setDialogIDRow(row.id === dialogIDRow ? null : row.id);
|
||||||
setIsDisabled(true); // Disable button after clicking
|
setIsDisabled(true); // Disable button after clicking
|
||||||
const updateData = {
|
const updateData = {
|
||||||
sStatus: row.sStatus
|
sStatus: row.sStatus
|
||||||
@@ -319,7 +323,6 @@ const allowedStatusesForCSLMS = ['waiting_pharmacy', 'order_prepared', 'ready',
|
|||||||
.put(`/put-prescription-orders/${row.nID_orders}`, updateData)
|
.put(`/put-prescription-orders/${row.nID_orders}`, updateData)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
enqueueSnackbar(response?.data?.meta?.message, { variant: 'success' });
|
enqueueSnackbar(response?.data?.meta?.message, { variant: 'success' });
|
||||||
setDialogIDRow(row.id === dialogIDRow ? null : row.id);
|
|
||||||
setIsDisabled(false); // Re-enable the button after success
|
setIsDisabled(false); // Re-enable the button after success
|
||||||
|
|
||||||
// Call reloadData to refresh the table
|
// Call reloadData to refresh the table
|
||||||
@@ -565,11 +568,87 @@ const allowedStatusesForCSLMS = ['waiting_pharmacy', 'order_prepared', 'ready',
|
|||||||
</TableCell>
|
</TableCell>
|
||||||
))}
|
))}
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
{/* Dialog Update Status */}
|
||||||
|
<Dialog open={dialogIDRow === row.id} fullWidth={true}>
|
||||||
|
<DialogTitle sx={{ backgroundColor: '#19BBBB', color: '#FFF', padding: 2 }}>
|
||||||
|
<Stack direction="row" alignItems="center" justifyContent="space-between">
|
||||||
|
<Stack direction="row" alignItems='center' spacing={1}>
|
||||||
|
<Typography variant="h6">{localeData.txtConfirmation}</Typography>
|
||||||
|
</Stack>
|
||||||
|
<IconButton sx={{ color: '#FFF' }} onClick={() => setDialogIDRow(row.id === dialogIDRow ? null : row.id)}>
|
||||||
|
<CloseIcon />
|
||||||
|
</IconButton>
|
||||||
|
</Stack>
|
||||||
|
</DialogTitle>
|
||||||
|
<DialogContent>
|
||||||
|
<Stack spacing={2} padding={2}>
|
||||||
|
<Typography variant='body1'>{localeData.txtDialogConfirmation}</Typography>
|
||||||
|
<Card sx={{padding:2}} >
|
||||||
|
<Stack direction='row' spacing={2}>
|
||||||
|
<Typography variant='subtitle2' sx={{color: '#919EAB', width: '50%'}}>{localeData.txtNomorResep}</Typography>
|
||||||
|
<Typography variant='subtitle2' sx={{width: '50%'}}>{row.no_resep}</Typography>
|
||||||
|
</Stack>
|
||||||
|
<Stack direction='row' spacing={2}>
|
||||||
|
<Typography variant='subtitle2' sx={{color: '#919EAB', width: '50%'}}>{localeData.txtTanggalTerbitResep}</Typography>
|
||||||
|
<Typography variant='subtitle2' sx={{width: '50%'}}>{row.tanggal}</Typography>
|
||||||
|
</Stack>
|
||||||
|
</Card>
|
||||||
|
</Stack>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<Button sx={{backgroundColor: '#19BBBB'}} variant="contained" onClick={() => handleClickKonfirmasi(row)} disabled={isDisabled}>{localeData.txtOK}</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</Dialog>
|
||||||
|
{/* Modal for fullscreen display */}
|
||||||
|
<Modal open={dialogIDRowDriver === row.id} onClose={() => handleClose(row)}>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
height: '100vh',
|
||||||
|
// backgroundColor: 'rgba(0, 0, 0, 0.8)', // semi-transparent background
|
||||||
|
color: '#fff',
|
||||||
|
textAlign: 'center',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{loading ? (
|
||||||
|
<>
|
||||||
|
<CircularProgress color="inherit" />
|
||||||
|
<Typography variant="h6" sx={{ mt: 2 }}>
|
||||||
|
{localeData.txtFindingDriver}
|
||||||
|
</Typography>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<Typography variant="h4">Info!</Typography>
|
||||||
|
<Typography variant="h6" sx={{ mt: 2 }}>
|
||||||
|
{txtIDDriver ? (
|
||||||
|
`${localeData.txtDriverFound} ${txtIDDriver} status ${txtStatusDriver}.`
|
||||||
|
) : (
|
||||||
|
// You can add an alternative UI or message here, or leave it empty
|
||||||
|
`Failed to get driver, please check the message info.`
|
||||||
|
)}
|
||||||
|
|
||||||
|
|
||||||
|
</Typography>
|
||||||
|
<Button
|
||||||
|
sx={{ mt: 4, backgroundColor: '#19BBBB' }}
|
||||||
|
variant="contained"
|
||||||
|
onClick={() => handleClose(row)}
|
||||||
|
>
|
||||||
|
{localeData.txtOK}
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
|
</Modal>
|
||||||
{/* COLLAPSIBLE ROW */}
|
{/* COLLAPSIBLE ROW */}
|
||||||
<TableRow
|
<TableRow
|
||||||
sx={{ cursor: 'pointer' }} // Use pointer cursor always, or conditionally based on your preference
|
sx={{ cursor: 'pointer' }} // Use pointer cursor always, or conditionally based on your preference
|
||||||
>
|
>
|
||||||
<TableCell colSpan={6}>
|
<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}}>
|
||||||
{/* Icon inside a Box for spacing and alignment */}
|
{/* Icon inside a Box for spacing and alignment */}
|
||||||
@@ -724,12 +803,17 @@ const allowedStatusesForCSLMS = ['waiting_pharmacy', 'order_prepared', 'ready',
|
|||||||
<Grid item xs={6}>
|
<Grid item xs={6}>
|
||||||
<Typography variant="body2"><strong>{row.pengiriman}</strong></Typography>
|
<Typography variant="body2"><strong>{row.pengiriman}</strong></Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={6}>
|
{formattedRoleName === 'cs-lms' ? (
|
||||||
<Typography variant="body2">{localeData.txtTotal} :</Typography>
|
<>
|
||||||
</Grid>
|
<Grid item xs={6}>
|
||||||
<Grid item xs={6}>
|
<Typography variant="body2">{localeData.txtTotal} :</Typography>
|
||||||
<Typography variant="body2"><strong>{row.total_kirim}</strong></Typography>
|
</Grid>
|
||||||
</Grid>
|
<Grid item xs={6}>
|
||||||
|
<Typography variant="body2"><strong>{row.total_kirim}</strong></Typography>
|
||||||
|
</Grid>
|
||||||
|
</>
|
||||||
|
):''}
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
@@ -842,7 +926,7 @@ const allowedStatusesForCSLMS = ['waiting_pharmacy', 'order_prepared', 'ready',
|
|||||||
{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)}>
|
||||||
{row.button_accept}
|
{row.button_accept}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -851,87 +935,13 @@ const allowedStatusesForCSLMS = ['waiting_pharmacy', 'order_prepared', 'ready',
|
|||||||
<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)}>
|
||||||
{row.button_accept}
|
{row.button_accept}
|
||||||
</Button>
|
</Button>
|
||||||
) : ''}
|
) : ''} */}
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{/* Dialog Update Status */}
|
{/* Dialog Update Status confirmation */}
|
||||||
<Dialog open={dialogIDRow === row.id} fullWidth={true}>
|
|
||||||
<DialogTitle sx={{ backgroundColor: '#19BBBB', color: '#FFF', padding: 2 }}>
|
|
||||||
<Stack direction="row" alignItems="center" justifyContent="space-between">
|
|
||||||
<Stack direction="row" alignItems='center' spacing={1}>
|
|
||||||
<Typography variant="h6">{localeData.txtConfirmation}</Typography>
|
|
||||||
</Stack>
|
|
||||||
<IconButton sx={{ color: '#FFF' }} onClick={() => setDialogIDRow(row.id === dialogIDRow ? null : row.id)}>
|
|
||||||
<CloseIcon />
|
|
||||||
</IconButton>
|
|
||||||
</Stack>
|
|
||||||
</DialogTitle>
|
|
||||||
<DialogContent>
|
|
||||||
<Stack spacing={2} padding={2}>
|
|
||||||
<Typography variant='body1'>{localeData.txtDialogConfirmation}</Typography>
|
|
||||||
<Card sx={{padding:2}} >
|
|
||||||
<Stack direction='row' spacing={2}>
|
|
||||||
<Typography variant='subtitle2' sx={{color: '#919EAB', width: '50%'}}>{localeData.txtNomorResep}</Typography>
|
|
||||||
<Typography variant='subtitle2' sx={{width: '50%'}}>{row.no_resep}</Typography>
|
|
||||||
</Stack>
|
|
||||||
<Stack direction='row' spacing={2}>
|
|
||||||
<Typography variant='subtitle2' sx={{color: '#919EAB', width: '50%'}}>{localeData.txtTanggalTerbitResep}</Typography>
|
|
||||||
<Typography variant='subtitle2' sx={{width: '50%'}}>{row.tanggal}</Typography>
|
|
||||||
</Stack>
|
|
||||||
</Card>
|
|
||||||
</Stack>
|
|
||||||
</DialogContent>
|
|
||||||
<DialogActions>
|
|
||||||
<Button sx={{backgroundColor: '#19BBBB'}} variant="contained" onClick={() => handleClickKonfirmasi(row)} disabled={isDisabled}>{localeData.txtOK}</Button>
|
|
||||||
</DialogActions>
|
|
||||||
</Dialog>
|
|
||||||
{/* Modal for fullscreen display */}
|
|
||||||
<Modal open={dialogIDRowDriver === row.id} onClose={() => handleClose(row)}>
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
display: 'flex',
|
|
||||||
flexDirection: 'column',
|
|
||||||
justifyContent: 'center',
|
|
||||||
alignItems: 'center',
|
|
||||||
height: '100vh',
|
|
||||||
// backgroundColor: 'rgba(0, 0, 0, 0.8)', // semi-transparent background
|
|
||||||
color: '#fff',
|
|
||||||
textAlign: 'center',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{loading ? (
|
|
||||||
<>
|
|
||||||
<CircularProgress color="inherit" />
|
|
||||||
<Typography variant="h6" sx={{ mt: 2 }}>
|
|
||||||
{localeData.txtFindingDriver}
|
|
||||||
</Typography>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<Typography variant="h4">Info!</Typography>
|
|
||||||
<Typography variant="h6" sx={{ mt: 2 }}>
|
|
||||||
{txtIDDriver ? (
|
|
||||||
`${localeData.txtDriverFound} ${txtIDDriver} status ${txtStatusDriver}.`
|
|
||||||
) : (
|
|
||||||
// You can add an alternative UI or message here, or leave it empty
|
|
||||||
`Failed to get driver, please check the message info.`
|
|
||||||
)}
|
|
||||||
|
|
||||||
|
|
||||||
</Typography>
|
|
||||||
<Button
|
|
||||||
sx={{ mt: 4, backgroundColor: '#19BBBB' }}
|
|
||||||
variant="contained"
|
|
||||||
onClick={() => handleClose(row)}
|
|
||||||
>
|
|
||||||
{localeData.txtOK}
|
|
||||||
</Button>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</Box>
|
|
||||||
</Modal>
|
|
||||||
</Card>
|
</Card>
|
||||||
</Collapse>
|
</Collapse>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
|||||||
@@ -125,11 +125,11 @@
|
|||||||
"txtTinggi" : "Tinggi / Berat",
|
"txtTinggi" : "Tinggi / Berat",
|
||||||
"txtLabelNew": "Baru",
|
"txtLabelNew": "Baru",
|
||||||
"txtLabelAccepted": "Diterima Apotek",
|
"txtLabelAccepted": "Diterima Apotek",
|
||||||
"txtLabelReady": "Pesanan Siap Diambil",
|
"txtLabelReady": "Siap Diambil",
|
||||||
"txtLabelWaitingCourir": "Menunggu Kurir",
|
"txtLabelWaitingCourir": "Menunggu Kurir",
|
||||||
"txtLabelPackagePickedUp": "Paket Sudah Diambil",
|
"txtLabelPackagePickedUp": "Sudah Diambil",
|
||||||
"txtLabelPackageOnDelivery": "Sedang Diantar ke Alamat Tujuan",
|
"txtLabelPackageOnDelivery": "Sedang Diantar",
|
||||||
"txtLabelPackageDelivered": "Sudah diterima Pasien",
|
"txtLabelPackageDelivered": "Diterima Pasien",
|
||||||
"txtLabelWaitingForPayment": "Menunggu Pembayaran",
|
"txtLabelWaitingForPayment": "Menunggu Pembayaran",
|
||||||
"txtOK": "Ya",
|
"txtOK": "Ya",
|
||||||
"txtFindingDriver" : "Sedang mencari driver...",
|
"txtFindingDriver" : "Sedang mencari driver...",
|
||||||
|
|||||||
@@ -30,11 +30,18 @@ import MuiDialog from '@/components/MuiDialog';
|
|||||||
import DialogMember from '@/sections/dashboard/DialogMember';
|
import DialogMember from '@/sections/dashboard/DialogMember';
|
||||||
import DialogClaimSubmit from '@/sections/dashboard/DialogClaimSubmit';
|
import DialogClaimSubmit from '@/sections/dashboard/DialogClaimSubmit';
|
||||||
import { fPostFormat } from '@/utils/formatTime';
|
import { fPostFormat } from '@/utils/formatTime';
|
||||||
|
import useAuth from '@/hooks/useAuth';
|
||||||
|
|
||||||
export default function TableList() {
|
export default function TableList() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { localeData }: any = useContext(LanguageContext);
|
const { localeData }: any = useContext(LanguageContext);
|
||||||
|
|
||||||
|
const {user} = useAuth();
|
||||||
|
const formattedRoleName = user?.role.name;
|
||||||
|
// List of statuses for 'apotek'
|
||||||
|
const allowedStatusesForApotek = ['waiting_pharmacy', 'order_prepared'];
|
||||||
|
const allowedStatusesForCSLMS = ['waiting_pharmacy', 'order_prepared', 'ready', 'waiting_for_courir', 'package_picked_up', 'package_on_delivery', 'failed'];
|
||||||
|
|
||||||
const [data, setData] = useState([]);
|
const [data, setData] = useState([]);
|
||||||
|
|
||||||
// Download Resep
|
// Download Resep
|
||||||
@@ -288,6 +295,13 @@ export default function TableList() {
|
|||||||
label: localeData.txtStatus,
|
label: localeData.txtStatus,
|
||||||
isSort: true,
|
isSort: true,
|
||||||
},
|
},
|
||||||
|
// Conditionally include button_accept if the role is 'admin-apotek'
|
||||||
|
...(formattedRoleName === 'admin-apotek' ? [{
|
||||||
|
id: 'button_accept',
|
||||||
|
align: 'left',
|
||||||
|
label: localeData.txtConfirmation,
|
||||||
|
isSort: false,
|
||||||
|
}] : []),
|
||||||
{
|
{
|
||||||
id: 'action',
|
id: 'action',
|
||||||
align: 'right',
|
align: 'right',
|
||||||
@@ -301,6 +315,7 @@ export default function TableList() {
|
|||||||
getData();
|
getData();
|
||||||
}, [appliedParams, searchParams, order, orderBy, setSearchParams]);
|
}, [appliedParams, searchParams, order, orderBy, setSearchParams]);
|
||||||
const [openRowId, setOpenRowId] = useState<number | null>(null);
|
const [openRowId, setOpenRowId] = useState<number | null>(null);
|
||||||
|
const [dialogIDRow, setDialogIDRow] = useState<number | null>(null);
|
||||||
function getData()
|
function getData()
|
||||||
{
|
{
|
||||||
(async () => {
|
(async () => {
|
||||||
@@ -372,6 +387,18 @@ export default function TableList() {
|
|||||||
{obj.valid_tanggal ? fDateTime(obj.valid_tanggal) : ''}
|
{obj.valid_tanggal ? fDateTime(obj.valid_tanggal) : ''}
|
||||||
</Label>
|
</Label>
|
||||||
,
|
,
|
||||||
|
...(formattedRoleName === 'admin-apotek' && obj.button_accept && {
|
||||||
|
button_accept: (
|
||||||
|
<Button
|
||||||
|
variant="contained"
|
||||||
|
color="primary"
|
||||||
|
style={{ width: 'auto', padding: '0px 4px'}}
|
||||||
|
onClick={() => setDialogIDRow(obj.id)}
|
||||||
|
>
|
||||||
|
{obj.button_accept}
|
||||||
|
</Button>
|
||||||
|
),
|
||||||
|
}),
|
||||||
action:
|
action:
|
||||||
<TableMoreMenu actions={
|
<TableMoreMenu actions={
|
||||||
<>
|
<>
|
||||||
@@ -433,6 +460,8 @@ export default function TableList() {
|
|||||||
// filterEndDate={filterEndDate}
|
// filterEndDate={filterEndDate}
|
||||||
openRowId={openRowId} // Pass the currently opened row ID
|
openRowId={openRowId} // Pass the currently opened row ID
|
||||||
setOpenRowId={setOpenRowId} // Pass the function to set the opened row ID
|
setOpenRowId={setOpenRowId} // Pass the function to set the opened row ID
|
||||||
|
dialogIDRow={dialogIDRow}
|
||||||
|
setDialogIDRow={setDialogIDRow}
|
||||||
reloadData={getData}
|
reloadData={getData}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
|
|||||||
Reference in New Issue
Block a user