mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-23 06:14:12 +00:00
Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/exchange into admin_Completed_Order
This commit is contained in:
@@ -25,11 +25,13 @@ class BookingController extends Controller
|
||||
$user = Auth::user();
|
||||
$bookings = Booking::select('user_id', 'id', 'created_at', 'status', 'rate', 'term', 'amount', 'bia', 'verification_status')
|
||||
->where('user_id', Auth::user()->id)
|
||||
->where('status', '=', '6')
|
||||
->orwhere('status', '=', '4')
|
||||
->orwhere('status', '=', '3')
|
||||
->orwhere('status', '=', '2')
|
||||
->orwhere('status', '=', '1')
|
||||
->where(function ($query) {
|
||||
$query->where('status', '=', '6')
|
||||
->orwhere('status', '=', '4')
|
||||
->orwhere('status', '=', '3')
|
||||
->orwhere('status', '=', '2')
|
||||
->orwhere('status', '=', '1');
|
||||
})
|
||||
->orderby('updated_at','desc')
|
||||
->paginate(10);
|
||||
|
||||
@@ -159,14 +161,13 @@ class BookingController extends Controller
|
||||
public function adminIndex(){
|
||||
$user = Auth::user();
|
||||
$bookings = Booking::select('user_id', 'id', 'created_at', 'admin_status', 'rate', 'term', 'amount', 'bia', 'verification_status')
|
||||
|
||||
->where('admin_status', '=', '5')
|
||||
->orwhere('admin_status', '=', '4')
|
||||
->orwhere('admin_status', '=', '3')
|
||||
->orwhere('admin_status', '=', '2')
|
||||
->orwhere('admin_status', '=', '1')
|
||||
->orderby('updated_at','desc')
|
||||
->paginate(10);
|
||||
->where('admin_status', '=', '5')
|
||||
->orwhere('admin_status', '=', '4')
|
||||
->orwhere('admin_status', '=', '3')
|
||||
->orwhere('admin_status', '=', '2')
|
||||
->orwhere('admin_status', '=', '1')
|
||||
->orderby('updated_at','desc')
|
||||
->paginate(10);
|
||||
|
||||
// reformat to fit frontend structure
|
||||
foreach ($bookings as $booking) {
|
||||
@@ -469,7 +470,8 @@ class BookingController extends Controller
|
||||
if ($amount >= 10000 && ($term == 'x2_cash' || $term == 'x2_cheque' || $term == 'x2_ba')) {
|
||||
$svcharge = 0;
|
||||
} else {
|
||||
$svcharge = 20.00;
|
||||
//$svcharge = 20.00;
|
||||
$svcharge = 0; // UPDATE ON : 15-8-2018 from PM
|
||||
}
|
||||
|
||||
$subtotal = round(($amount + $svcharge) / $rate, 2);
|
||||
@@ -638,16 +640,9 @@ class BookingController extends Controller
|
||||
$booking->admin_status = 2;
|
||||
$booking->save();
|
||||
|
||||
// Add notification message to admin
|
||||
$adminNotification = new Notification;
|
||||
$adminNotification->detail = "A bankslip is uploaded for booking " . $booking->id;
|
||||
$adminNotification->link = "/booking/" . $booking->id . "/verification";
|
||||
$adminNotification->user_id = User::withRole('admin')->first()->id;
|
||||
$adminNotification->save();
|
||||
|
||||
$user_bankslip->transfer_amount = $request->input('transfer_amount');
|
||||
$user_bankslip->save();
|
||||
return response()->json($adminNotification,200);
|
||||
return response()->json(["success"=>true],200);
|
||||
}
|
||||
|
||||
public function uploadPurchaseOrder(Request $request, $id)
|
||||
@@ -796,7 +791,8 @@ class BookingController extends Controller
|
||||
if ($amount >= 10000 && ($term == 'x2_cash' || $term == 'x2_cheque' || $term == 'x2_ba')) {
|
||||
$svcharge = 0;
|
||||
} else {
|
||||
$svcharge = 20.00;
|
||||
//$svcharge = 20.00;
|
||||
$svcharge = 0; // UPDATE ON : 15-8-2018 from PM
|
||||
}
|
||||
|
||||
$subtotal = round(($amount + $svcharge) / $rate,2);
|
||||
@@ -868,21 +864,13 @@ class BookingController extends Controller
|
||||
$booking->status = 4;
|
||||
if($booking->term !== "x1_ba" || $booking->term !== "x2_cheque"){
|
||||
$booking->admin_status = 3;
|
||||
// Add notification message to user
|
||||
$userNotification = new Notification;
|
||||
$userNotification->detail = "Your bankslip for booking " . $booking->id . " is approved.";
|
||||
$userNotification->link = "/booking/" . $booking->id . "/transfer";
|
||||
$userNotification->user_id = $booking->user_id;
|
||||
$userNotification->save();
|
||||
// TODO : Add notification message to user
|
||||
|
||||
}
|
||||
else{
|
||||
$booking->admin_status = 5;
|
||||
// Add notification message to user
|
||||
$userNotification = new Notification;
|
||||
$userNotification->detail = "Your bankslip for booking " . $booking->id . " is approved.";
|
||||
$userNotification->link = "/booking/" . $booking->id . "/supplier";
|
||||
$userNotification->user_id = $booking->user_id;
|
||||
$userNotification->save();
|
||||
// TODO : Add notification message to user
|
||||
|
||||
}
|
||||
$booking->save();
|
||||
|
||||
@@ -981,11 +969,11 @@ class BookingController extends Controller
|
||||
$booking->admin_status = 5; // upload china bankslip
|
||||
|
||||
if($booking->save()){
|
||||
$userNotification = new Notification;
|
||||
$userNotification->detail = "Supplier booking report for booking " . $booking->id . " is completed.";
|
||||
$userNotification->link = "/booking/" . $booking->id . "/transfer";
|
||||
$userNotification->user_id = $booking->user_id;
|
||||
$userNotification->save();
|
||||
// $userNotification = new Notification;
|
||||
// $userNotification->detail = "Supplier booking report for booking " . $booking->id . " is completed.";
|
||||
// $userNotification->link = "/booking/" . $booking->id . "/transfer";
|
||||
// $userNotification->user_id = $booking->user_id;
|
||||
// $userNotification->save();
|
||||
return response()->json(['message'=>"Success"],200);
|
||||
}
|
||||
}
|
||||
@@ -1002,12 +990,6 @@ class BookingController extends Controller
|
||||
$booking->admin_status = 6; // upload invoice
|
||||
$booking->save();
|
||||
|
||||
$adminNotification = new Notification;
|
||||
$adminNotification->detail = "Purchase Order for booking " . $booking->id . " is uploaded.";
|
||||
$adminNotification->link = "/booking/" . $booking->id . "/upload-invoice";
|
||||
$adminNotification->user_id = User::withRole('admin')->first()->id;
|
||||
$adminNotification->save();
|
||||
|
||||
return response()->json($purchase_order,200);
|
||||
}
|
||||
|
||||
@@ -1025,11 +1007,6 @@ class BookingController extends Controller
|
||||
$booking->admin_status = 7; // completed
|
||||
|
||||
if($booking->save()){
|
||||
$adminNotification = new Notification;
|
||||
$adminNotification->detail = "Invoice for booking " . $booking->id . " is uploaded.";
|
||||
$adminNotification->link = "/booking/" . $booking->id . "/complete";
|
||||
$adminNotification->user_id = $booking->user_id;
|
||||
$adminNotification->save();
|
||||
return response()->json(['message'=>"Success"],200);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user