api detail appointment
This commit is contained in:
@@ -70,9 +70,7 @@ class AppointmentController extends Controller
|
||||
{
|
||||
$appointment = Appointment::query()->with(['appointmentParticipants', 'organization'])->find($id);
|
||||
|
||||
return new AppointmentDetailResource($appointment);
|
||||
|
||||
return response()->json($appointment);
|
||||
return Helper::responseJson(new AppointmentDetailResource($appointment));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Modules\Linksehat\Transformers\Appointment;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Person;
|
||||
use App\Models\PractitionerRole;
|
||||
use Carbon\Carbon;
|
||||
@@ -25,7 +26,8 @@ class AppointmentDetailResource extends JsonResource
|
||||
}
|
||||
}
|
||||
|
||||
$queryPatient = Person::query()->find($patiendId);
|
||||
$queryPatient = Person::query()
|
||||
->find($patiendId);
|
||||
|
||||
$patient = [
|
||||
'id' => $queryPatient->id,
|
||||
@@ -34,7 +36,18 @@ class AppointmentDetailResource extends JsonResource
|
||||
'phone' => $queryPatient->phone,
|
||||
];
|
||||
|
||||
$queryDoctor = PractitionerRole::query()->with(['practitioner.person', 'speciality'])->where('practitioner_id', $doctorId)->first();
|
||||
$queryDoctor = PractitionerRole::query()
|
||||
->with(['practitioner.person', 'speciality', 'practices.prices'])
|
||||
->where('practitioner_id', $doctorId)
|
||||
->first();
|
||||
|
||||
foreach ($queryDoctor->practices as $qPractice) {
|
||||
foreach ($qPractice->prices as $qPrice) {
|
||||
if (strtolower($qPractice->service_code) == strtolower($this->appointment_type)) {
|
||||
$price = $qPrice->price_net;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$doctor = [
|
||||
'id' => $doctorId,
|
||||
@@ -54,6 +67,7 @@ class AppointmentDetailResource extends JsonResource
|
||||
'address' => $this->organization->currentAddress->text,
|
||||
],
|
||||
'patient' => $patient,
|
||||
'price' => Helper::currencyIdrFormat($price)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user