Merge branch 'staging' of https://dev.sismedika.online/febio/aso into staging

This commit is contained in:
2024-01-30 14:26:47 +07:00
5 changed files with 25 additions and 26 deletions

View File

@@ -224,7 +224,8 @@ class RequestLogController extends Controller
DB::raw(' DB::raw('
(SELECT organizations.name FROM organizations WHERE organizations.id = request_logs.organization_id LIMIT 1) AS provider (SELECT organizations.name FROM organizations WHERE organizations.id = request_logs.organization_id LIMIT 1) AS provider
'), '),
'request_logs.submission_date') 'request_logs.submission_date',
'request_logs.approved_at')
->paginate($limit); ->paginate($limit);
return response()->json(Helper::paginateResources($results)); return response()->json(Helper::paginateResources($results));
} }
@@ -297,6 +298,7 @@ class RequestLogController extends Controller
END AS status END AS status
'), '),
'request_logs.submission_date', 'request_logs.submission_date',
'request_logs.approved_final_log_at',
'request_logs.discharge_date', 'request_logs.discharge_date',
DB::raw(' DB::raw('
(SELECT services.name FROM services WHERE services.code = request_logs.service_code LIMIT 1) AS service_type (SELECT services.name FROM services WHERE services.code = request_logs.service_code LIMIT 1) AS service_type

View File

@@ -38,15 +38,14 @@ export default function TableListFinalLog() {
const [data, setData] = useState([]); const [data, setData] = useState([]);
// Download LOG // Download LOG
async function handleDownloadLog(request_log_id: any, service_code:any, no_polis:any, full_name:any, provider:any) { async function handleDownloadLog(request_log_id: any, service_code:any, no_polis:any, full_name:any, provider:any, approved_fina_log_at:any) {
return axios return axios
.get(`download-final-log/${request_log_id}`, { .get(`download-final-log/${request_log_id}`, {
responseType: 'blob', responseType: 'blob',
}) })
.then((response) => { .then((response) => {
console.log(response);
// GL Akhir-010124-OP-00001234 Ratih-LinkSehat // GL Akhir-010124-OP-00001234 Ratih-LinkSehat
const namaFile = 'GL Akhir-'+provider+'-'+getFormattedToday()+'-'+service_code+'-'+no_polis+'-'+full_name+'-LinkSehat.pdf'; const namaFile = 'GL Akhir-'+provider+'-'+getFormattedDate(approved_fina_log_at)+'-'+service_code+'-'+no_polis+'-'+full_name+'-LinkSehat.pdf';
const url = URL.createObjectURL(response.data); const url = URL.createObjectURL(response.data);
const link = document.createElement('a'); const link = document.createElement('a');
link.href = url; link.href = url;
@@ -60,14 +59,13 @@ export default function TableListFinalLog() {
}); });
} }
function getFormattedToday() { function getFormattedDate(approved_fina_log_at:any) {
const today = new Date(); const approvedDate = new Date(approved_fina_log_at.replace(/-/g, '/')); // Mengatasi masalah format pada Safari
const day = String(approvedDate.getDate()).padStart(2, '0');
const day = String(today.getDate()).padStart(2, '0'); const month = String(approvedDate.getMonth() + 1).padStart(2, '0'); // Bulan dimulai dari 0 (Januari = 0)
const month = String(today.getMonth() + 1).padStart(2, '0'); // Bulan dimulai dari 0 (Januari = 0) const year = String(approvedDate.getFullYear()).substring(2, 4);
const year = String(today.getFullYear()).substring(2, 4);
return `${day}${month}${year}`;
return `${day}${month}${year}`;
} }
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
@@ -384,7 +382,7 @@ export default function TableListFinalLog() {
View View
</MenuItem> </MenuItem>
{obj.status === 'approved' ? ( {obj.status === 'approved' ? (
<MenuItem onClick={() => handleDownloadLog(obj.id, obj.service_code, obj.no_polis, obj.full_name, obj.provider)}> <MenuItem onClick={() => handleDownloadLog(obj.id, obj.service_code, obj.no_polis, obj.full_name, obj.provider, obj.approved_final_log_at)}>
<Iconify icon="eva:download-fill" /> <Iconify icon="eva:download-fill" />
Download Final LOG Download Final LOG
</MenuItem> </MenuItem>

View File

@@ -42,14 +42,14 @@ export default function TableList() {
const [data, setData] = useState([]); const [data, setData] = useState([]);
// Download LOG // Download LOG
async function handleDownloadLog(request_log_id: any, service_code:any, no_polis:any, full_name:any, provider:any) { async function handleDownloadLog(request_log_id: any, service_code:any, no_polis:any, full_name:any, provider:any, approved_at:any) {
return axios return axios
.get(`download-log/${request_log_id}`, { .get(`download-log/${request_log_id}`, {
responseType: 'blob', responseType: 'blob',
}) })
.then((response) => { .then((response) => {
// GL Awal-010124-OP-00001234 Ratih-LinkSehat // GL Awal-010124-OP-00001234 Ratih-LinkSehat
const namaFile = 'GL Awal-'+provider+'-'+getFormattedToday()+'-'+service_code+'-'+no_polis+'-'+full_name+'-LinkSehat.pdf'; const namaFile = 'GL Awal-'+provider+'-'+getFormattedDate(approved_at)+'-'+service_code+'-'+no_polis+'-'+full_name+'-LinkSehat.pdf';
const url = URL.createObjectURL(response.data); const url = URL.createObjectURL(response.data);
const link = document.createElement('a'); const link = document.createElement('a');
link.href = url; link.href = url;
@@ -63,15 +63,14 @@ export default function TableList() {
}); });
} }
function getFormattedToday() { function getFormattedDate(approved_at:any) {
const today = new Date(); const approvedDate = new Date(approved_at.replace(/-/g, '/')); // Mengatasi masalah format pada Safari
const day = String(approvedDate.getDate()).padStart(2, '0');
const day = String(today.getDate()).padStart(2, '0'); const month = String(approvedDate.getMonth() + 1).padStart(2, '0'); // Bulan dimulai dari 0 (Januari = 0)
const month = String(today.getMonth() + 1).padStart(2, '0'); // Bulan dimulai dari 0 (Januari = 0) const year = String(approvedDate.getFullYear()).substring(2, 4);
const year = String(today.getFullYear()).substring(2, 4);
return `${day}${month}${year}`; return `${day}${month}${year}`;
} }
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/* setting up for the table */ /* setting up for the table */
@@ -369,7 +368,7 @@ export default function TableList() {
View View
</MenuItem> </MenuItem>
{obj.status === 'approved' ? ( {obj.status === 'approved' ? (
<MenuItem onClick={() => handleDownloadLog(obj.id, obj.service_code, obj.no_polis, obj.full_name, obj.provider)}> <MenuItem onClick={() => handleDownloadLog(obj.id, obj.service_code, obj.no_polis, obj.full_name, obj.provider, obj.approved_at)}>
<Iconify icon="eva:download-fill" /> <Iconify icon="eva:download-fill" />
Download LOG Download LOG
</MenuItem> </MenuItem>

View File

@@ -292,7 +292,7 @@
<br><b>Offsite Medical Treatment</b> <br><b>Offsite Medical Treatment</b>
</div> </div>
<div class="corner-text-<?php echo now()->timestamp; ?> bottom-right-ttd-1-<?php echo now()->timestamp; ?> "> <div class="corner-text-<?php echo now()->timestamp; ?> bottom-right-ttd-1-<?php echo now()->timestamp; ?> ">
{{ \Carbon\Carbon::parse(now())->format('d M Y') }},<br> {{ \Carbon\Carbon::parse($request_logs->approved_final_log_at)->format('d M Y') }},<br>
Petugas Alarm Center Petugas Alarm Center
</div> </div>
<div class="corner-text-<?php echo now()->timestamp; ?> bottom-right-ttd-2-<?php echo now()->timestamp; ?> "> <div class="corner-text-<?php echo now()->timestamp; ?> bottom-right-ttd-2-<?php echo now()->timestamp; ?> ">

View File

@@ -465,7 +465,7 @@
<br><b>Offsite Medical Treatment</b> <br><b>Offsite Medical Treatment</b>
</div> </div>
<div class="corner-text-<?php echo now()->timestamp; ?> bottom-right-ttd-1-<?php echo now()->timestamp; ?> "> <div class="corner-text-<?php echo now()->timestamp; ?> bottom-right-ttd-1-<?php echo now()->timestamp; ?> ">
{{ \Carbon\Carbon::parse(now())->format('d M Y') }},<br> {{ \Carbon\Carbon::parse($request_logs->approved_at)->format('d M Y') }},<br>
Petugas Alarm Center Petugas Alarm Center
</div> </div>
<div class="corner-text-<?php echo now()->timestamp; ?> bottom-right-ttd-2-<?php echo now()->timestamp; ?> "> <div class="corner-text-<?php echo now()->timestamp; ?> bottom-right-ttd-2-<?php echo now()->timestamp; ?> ">