mirror of
https://gitlab.com/omair-personal/exchange.git
synced 2026-08-21 13:34:24 +00:00
updated approvebankslip booking not found
updated update status upon userbankslip approved updated update status upon userbankslip rejected updated supplier index to display value and label for input select updated supplierBooking frontend completed booking accept and reject integration
This commit is contained in:
@@ -489,14 +489,16 @@ class BookingController extends Controller
|
||||
|
||||
public function approveBankSlip(Request $request, $book_id)
|
||||
{
|
||||
if (!$booking = Booking::where('user_id',Auth::user()->id)->where('id',$book_id)->first())
|
||||
$booking = Booking::where('id',$book_id)->first();
|
||||
|
||||
if (!$booking)
|
||||
{
|
||||
return response()->json(['message'=>'Access denied'], 200);
|
||||
return response()->json(['message'=>'Booking not found'], 400);
|
||||
}
|
||||
|
||||
if(!$userBankSlip = UserBankSlip::where('booking_id',$booking->id)->first())
|
||||
{
|
||||
return response()->json(['message'=>'Access denied'], 200);
|
||||
return response()->json(['message'=>'User bankslip not found'], 400);
|
||||
}
|
||||
|
||||
// Rejected bankslip cannot be approve again
|
||||
@@ -508,12 +510,19 @@ class BookingController extends Controller
|
||||
$userBankSlip->is_approve = 1;
|
||||
$userBankSlip->estimated_arrival_time = $request->input('estimated_arrival_time');
|
||||
$userBankSlip->save();
|
||||
|
||||
// update booking status
|
||||
$booking->status = 4;
|
||||
$booking->admin_status = 3;
|
||||
$booking->save();
|
||||
|
||||
return response()->json(['message'=>'Success'],200);
|
||||
}
|
||||
|
||||
public function rejectBankSlip(Request $request, $book_id)
|
||||
{
|
||||
if (!$booking = Booking::where('user_id',Auth::user()->id)->where('id',$book_id)->first())
|
||||
$booking = Booking::where('id',$book_id)->first();
|
||||
if (!$booking)
|
||||
{
|
||||
return response()->json(['message'=>'Access denied'], 200);
|
||||
}
|
||||
@@ -533,6 +542,12 @@ class BookingController extends Controller
|
||||
$userBankSlip->reject_reason = $request->reject_reason;
|
||||
$userBankSlip->save();
|
||||
|
||||
// TODO : reject user bankinslip
|
||||
// update booking status
|
||||
$booking->status = 0;
|
||||
$booking->admin_status = 0;
|
||||
$booking->save();
|
||||
|
||||
return response()->json(['message'=>'Success'],200);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user