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

This commit is contained in:
Linksehat Staging Server
2023-09-10 07:22:43 +07:00
2 changed files with 32 additions and 9 deletions

View File

@@ -26,9 +26,9 @@ class LivechatController extends Controller
$startDate = $request->startDate;
$endDate = $request->endDate;
$livechat = Livechat::with('doctor.user', 'doctor.speciality', 'appointment.appointmentDetail', 'healthCare')
->where('nIDAppointment', '!=', null)
->where('nIDAppointment', '!=', '');
$livechat = Livechat::with('doctor.user', 'doctor.speciality', 'appointment.appointmentDetail', 'healthCare');
// ->where('nIDAppointment', '!=', null)
// ->where('nIDAppointment', '!=', '');
if ($startDate) {
@@ -74,6 +74,7 @@ class LivechatController extends Controller
$query->where('dCreateOn', '<=', $endDate);
}
})
->orderBy('nID', 'desc')
->get(['nID', 'nIDUser', 'nIDDokter', 'nIDHealthCare', 'nIDAppointment', 'sStatus', 'sMediaDokter', 'sMedia', 'dCreateOn']);
$headers = [
@@ -116,7 +117,26 @@ class LivechatController extends Controller
$phone = $liveChat->user->sPhone ?? '-';
$status = $liveChat->sStatus;
$nIDUser = $liveChat->user->nIDUser ?? 0; // Principal or Dependent
$paymentMethod = $liveChat->appointment ? Helper::sPaymentMethod($liveChat->appointment->sPaymentMethod) : 'Belum ada Pembayaran';
$paymentMethod = $liveChat->appointment ? Helper::sPaymentMethod($liveChat->appointment->sPaymentMethod) : 'N/A';
$fullNameDoctor = '-';
if ($liveChat->doctor->user !== null) {
$fullNameDoctor = '';
if ($liveChat->doctor->user->detail !== null) {
if ($liveChat->doctor->user->detail->sTitlePrefix !== null) {
$fullNameDoctor .= $liveChat->doctor->user->detail->sTitlePrefix . ' ';
}
if ($liveChat->doctor->user->full_name !== null) {
$fullNameDoctor .= $liveChat->doctor->user->full_name . ' ';
}
if ($liveChat->doctor->user->detail->sTitleSuffix !== null) {
$fullNameDoctor .= $liveChat->doctor->user->detail->sTitleSuffix;
}
}
}
$recordType = 'P';
if ($nIDUser){
$recordType = 'D';
@@ -147,7 +167,7 @@ class LivechatController extends Controller
$sheet->setCellValue('D' . $startFrom, Carbon::parse($liveChat->dCreateOn)->format('H:m:i'));
// $sheet->setCellValue('D' . $startFrom, Carbon::parse($liveChat->dRequestTime)->format('H:i:s'));
$sheet->setCellValue('E' . $startFrom, $liveChat->healthCare->sHealthCare ?? '-');
$sheet->setCellValue('F' . $startFrom, $liveChat->doctor->user->full_name ?? '-');
$sheet->setCellValue('F' . $startFrom, $fullNameDoctor);
$sheet->setCellValue('G' . $startFrom, $liveChat->doctor->speciality->sSpesialis ?? '-');
$sheet->setCellValue('H' . $startFrom, $liveChat->sMedia ?? '-');
$sheet->setCellValue('I' . $startFrom, $liveChat->sMediaDokter ?? '-');