update data
This commit is contained in:
@@ -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,8 @@ 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 = $liveChat->doctor->user->full_name ? $liveChat->doctor->user->detail->sTitlePrefix . ' ' . $liveChat->doctor->user->full_name . ' ' . $liveChat->doctor->user->detail->sTitleSuffix : '-' ;
|
||||
$recordType = 'P';
|
||||
if ($nIDUser){
|
||||
$recordType = 'D';
|
||||
@@ -147,7 +149,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 ?? '-');
|
||||
|
||||
@@ -18,14 +18,16 @@ class LivechatResource extends JsonResource
|
||||
{
|
||||
$livechat = [
|
||||
'id' => $this->nID,
|
||||
'doctor_name' => isset($this->doctor->user->sFirstName) ? $this->doctor->user->sFirstName . ' ' . $this->doctor->user->sLastName : null,
|
||||
'doctor_name' => isset($this->doctor->user->sFirstName) ? $this->doctor->user->detail->sTitlePrefix . ' ' . $this->doctor->user->sFirstName . ' ' . $this->doctor->user->sLastName . ' ' . $this->doctor->user->detail->sTitleSuffix : null,
|
||||
'pasien_name' => isset($this->user->sFirstName) ? $this->user->sFirstName . ' ' . $this->user->sLastName : null,
|
||||
'pasien_phone' => isset($this->user->sPhone) ? $this->user->sPhone : '-',
|
||||
'pasien_email' => isset($this->user->sEmail) ? $this->user->sEmail : '-',
|
||||
'speciality' => $this->doctor->speciality->sKeterangan ?? null,
|
||||
'health_care' => $this->healthCare->sHealthCare ?? null,
|
||||
'date_appointment' => Carbon::parse($this->appointment->appointmentDetail->dTanggalAppointment)->format('d-m-Y')
|
||||
. ' ' . $this->appointment->appointmentDetail->tTimeAppointment ?? null,
|
||||
'date_appointment' => $this->appointment !== null ?
|
||||
Carbon::parse($this->appointment->appointmentDetail->dTanggalAppointment)->format('d-m-Y')
|
||||
. ' ' . $this->appointment->appointmentDetail->tTimeAppointment :
|
||||
null,
|
||||
'status_appointment' => $this->appointment->paymentStatus ?? null,
|
||||
'date_created' => Carbon::parse($this->dRequestTime)->format('d-m-Y') ?? null,
|
||||
'time_request' => Carbon::parse($this->dRequestTime)->format('H:i:s') ?? null,
|
||||
@@ -51,7 +53,8 @@ class LivechatResource extends JsonResource
|
||||
$livechat['duration'] = $data_duration;
|
||||
|
||||
$payment_detail = null;
|
||||
if ($this->appointment->appointmentDetail->sPaymentDetails != null) {
|
||||
|
||||
if ($this->appointment !== null && $this->appointment->appointmentDetail->sPaymentDetails !== null) {
|
||||
$payment_detail = [
|
||||
'payment_type' => $this->appointment->appointmentDetail->sPaymentDetails['payment_type'],
|
||||
'transaction_time' => $this->appointment->appointmentDetail->sPaymentDetails['transaction_time'],
|
||||
|
||||
Reference in New Issue
Block a user