Merge remote-tracking branch 'origin/master' into feature/client-portal
This commit is contained in:
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Internal\Http\Controllers\Api\Linksehat;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\OLDLMS\Appointment;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Modules\Internal\Transformers\LinksehatPaymentResource;
|
||||
|
||||
class PaymentController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @return Renderable
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
// return $request->toArray();
|
||||
$appointments = Appointment::query()
|
||||
->where('sPaymentStatus', 'settlement')
|
||||
->with(['healthCare', 'healthCare.commission', 'detail', 'user', 'doctor', 'doctor.user']);
|
||||
|
||||
if ($request->has('search')) {
|
||||
$appointments->where(function ($query) use ($request) {
|
||||
$query->where('nID', $request->search)
|
||||
->orWhere('sBookingCode', $request->search)
|
||||
->orWhereHas('detail', function (Builder $detail) use ($request) {
|
||||
$detail->where('sPaymentDetails', 'LIKE', '%' . $request->search . "%");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (($request->has('appointment_start') || $request->has('appointment_end'))
|
||||
&& !empty($request->appointment_start)
|
||||
&& !empty($request->appointment_end)
|
||||
) {
|
||||
$appointments = $appointments->whereHas('detail', function (Builder $detail) use ($request) {
|
||||
|
||||
// Appointment Start
|
||||
// if ($request->has('appointment_start')) {
|
||||
$detail->where('dTanggalAppointment', '>=', $request->appointment_start);
|
||||
// } else {
|
||||
// $detail->where('dTanggalAppointment', '>', now()->format('Y-m-d'));
|
||||
// }
|
||||
|
||||
// if ($request->has('appointment_end')) {
|
||||
$detail->where('dTanggalAppointment', '<=', $request->appointment_end);
|
||||
// } else {
|
||||
// $detail->where('dTanggalAppointment', '<', now()->addDay(1)->format('Y-m-d'));
|
||||
// }
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
if ($request->has('payment_status') && $request->payment_status != 'semua') {
|
||||
$appointments->where('sPaymentStatus', $request->payment_status);
|
||||
}
|
||||
|
||||
if ($request->has('healthcare_id') && !empty($request->healthcare_id)) {
|
||||
$appointments->where('nIDHealthCare', $request->healthcare_id);
|
||||
}
|
||||
|
||||
$appointments = $appointments->orderBy('dUpdateOn', 'DESC')
|
||||
->paginate();
|
||||
|
||||
return Helper::responseJson(Helper::paginateResources(LinksehatPaymentResource::collection($appointments)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @return Renderable
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('internal::create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param Request $request
|
||||
* @return Renderable
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
* @param int $id
|
||||
* @return Renderable
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('internal::show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param int $id
|
||||
* @return Renderable
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
return view('internal::edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param Request $request
|
||||
* @param int $id
|
||||
* @return Renderable
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param int $id
|
||||
* @return Renderable
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Modules\Internal\Http\Controllers\Api;
|
||||
|
||||
use App\Models\Icd;
|
||||
use App\Models\OLDLMS\Healthcare;
|
||||
use App\Models\Organization;
|
||||
use App\Models\Practitioner;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
@@ -61,6 +62,14 @@ class OptionController extends Controller
|
||||
|
||||
return $healthcares;
|
||||
break;
|
||||
case 'linksehat-healthcares':
|
||||
$healthcares = Healthcare::query()
|
||||
->where('sHealthCare', 'LIKE', '%'.$request->search.'%')
|
||||
->limit('10')
|
||||
->get();
|
||||
|
||||
return $healthcares;
|
||||
break;
|
||||
|
||||
default:
|
||||
# code...
|
||||
|
||||
Reference in New Issue
Block a user