mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-21 13:24:27 +00:00
Fix conflit
This commit is contained in:
@@ -21,7 +21,6 @@ class BookingController extends Controller
|
||||
{
|
||||
|
||||
public function index(){
|
||||
return 123;
|
||||
$user = Auth::user();
|
||||
$bookings = Booking::select('user_id', 'id', 'created_at', 'status', 'rate', 'term', 'amount', 'bia', 'verification_status')
|
||||
->where('user_id', $user->id)
|
||||
@@ -78,74 +77,73 @@ class BookingController extends Controller
|
||||
}
|
||||
|
||||
public function adminIndex(){
|
||||
return 123;
|
||||
// $user = Auth::user();
|
||||
// $bookings = Booking::select('user_id', 'id', 'created_at', 'admin_status', 'rate', 'term', 'amount', 'bia', 'verification_status')
|
||||
// ->orderby('updated_at','desc')
|
||||
// ->get();
|
||||
$user = Auth::user();
|
||||
$bookings = Booking::select('user_id', 'id', 'created_at', 'admin_status', 'rate', 'term', 'amount', 'bia', 'verification_status')
|
||||
->orderby('updated_at','desc')
|
||||
->get();
|
||||
|
||||
// // reformat to fit frontend structure
|
||||
// foreach ($bookings as $booking) {
|
||||
// // set timeout
|
||||
// $date1 = new DateTime($booking->created_at);
|
||||
// $date2 = new DateTime();
|
||||
// $time_in_seconds = SettingCredit::orderby('updated_at','desc')->first()->time_limit;
|
||||
// $difference_in_seconds = ($date1->format('U') + $time_in_seconds) - ($date2->format('U'));
|
||||
// $booking->timeout = $difference_in_seconds;
|
||||
// reformat to fit frontend structure
|
||||
foreach ($bookings as $booking) {
|
||||
// set timeout
|
||||
$date1 = new DateTime($booking->created_at);
|
||||
$date2 = new DateTime();
|
||||
$time_in_seconds = SettingCredit::orderby('updated_at','desc')->first()->time_limit;
|
||||
$difference_in_seconds = ($date1->format('U') + $time_in_seconds) - ($date2->format('U'));
|
||||
$booking->timeout = $difference_in_seconds;
|
||||
|
||||
// // TODO : you can make it better
|
||||
// if($difference_in_seconds < 0 ){
|
||||
// $booking->timeout = 0;
|
||||
// }
|
||||
// TODO : you can make it better
|
||||
if($difference_in_seconds < 0 ){
|
||||
$booking->timeout = 0;
|
||||
}
|
||||
|
||||
// // TODO : transfer_amount change name to bia
|
||||
// $booking->transfer_amount = $booking->bia;
|
||||
// TODO : transfer_amount change name to bia
|
||||
$booking->transfer_amount = $booking->bia;
|
||||
|
||||
// $term = $booking->term;
|
||||
// if($term == "x1_ba" || $term == "x2_cheque"){
|
||||
// $status = $booking->admin_status > 2 ? $booking->admin_status - 2 : $booking->admin_status;
|
||||
// $booking->track_status = "(". $status ."/5)";
|
||||
// }
|
||||
// else{
|
||||
// $booking->track_status = "(". $booking->admin_status ."/7)";
|
||||
// }
|
||||
$term = $booking->term;
|
||||
if($term == "x1_ba" || $term == "x2_cheque"){
|
||||
$status = $booking->admin_status > 2 ? $booking->admin_status - 2 : $booking->admin_status;
|
||||
$booking->track_status = "(". $status ."/5)";
|
||||
}
|
||||
else{
|
||||
$booking->track_status = "(". $booking->admin_status ."/7)";
|
||||
}
|
||||
|
||||
// switch ($booking->admin_status) {
|
||||
// case 1:
|
||||
// $status_desc = "Waiting customer upload bank slip";
|
||||
// break;
|
||||
// case 2:
|
||||
// $status_desc = "Verify user bank slip";
|
||||
// break;
|
||||
// case 3:
|
||||
// if($term !== "x1_ba" || $term !== "x2_cheque"){
|
||||
// $status_desc = "Generate supplier booking report";
|
||||
// break;
|
||||
// }
|
||||
// case 4:
|
||||
// if($term !== "x1_ba" || $term !== "x2_cheque"){
|
||||
// $status_desc = "Supplier booking report. Please confirm with your booking.";
|
||||
// break;
|
||||
// }
|
||||
// case 5:
|
||||
// $status_desc = "Please, upload China Bankslip";
|
||||
// break;
|
||||
// case 6:
|
||||
// $status_desc = "Waiting customer to upload purchase order";
|
||||
// break;
|
||||
// case 7:
|
||||
// $status_desc = "Customer has uploaded purchase order, please upload invoice";
|
||||
// break;
|
||||
// case 8:
|
||||
// $status_desc = "Booking Completed";
|
||||
// break;
|
||||
// default:
|
||||
// $status_desc = "";
|
||||
// }
|
||||
// $booking->marking = $booking->user->marking;
|
||||
// $booking->status_desc = $status_desc;
|
||||
// }
|
||||
// return $bookings;
|
||||
switch ($booking->admin_status) {
|
||||
case 1:
|
||||
$status_desc = "Waiting customer upload bank slip";
|
||||
break;
|
||||
case 2:
|
||||
$status_desc = "Verify user bank slip";
|
||||
break;
|
||||
case 3:
|
||||
if($term !== "x1_ba" || $term !== "x2_cheque"){
|
||||
$status_desc = "Generate supplier booking report";
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
if($term !== "x1_ba" || $term !== "x2_cheque"){
|
||||
$status_desc = "Supplier booking report. Please confirm with your booking.";
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
$status_desc = "Please, upload China Bankslip";
|
||||
break;
|
||||
case 6:
|
||||
$status_desc = "Waiting customer to upload purchase order";
|
||||
break;
|
||||
case 7:
|
||||
$status_desc = "Customer has uploaded purchase order, please upload invoice";
|
||||
break;
|
||||
case 8:
|
||||
$status_desc = "Booking Completed";
|
||||
break;
|
||||
default:
|
||||
$status_desc = "";
|
||||
}
|
||||
$booking->marking = $booking->user->marking;
|
||||
$booking->status_desc = $status_desc;
|
||||
}
|
||||
return $bookings;
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
@@ -602,7 +600,7 @@ class BookingController extends Controller
|
||||
$svcharge = 20.00;
|
||||
}
|
||||
|
||||
$subtotal = $amount + $svcharge) / $rate;
|
||||
$subtotal = round($amount + $svcharge / $rate,2);
|
||||
$taxAmount = round($subtotal * $taxrate,2);
|
||||
$billingChargeAmount = round(($amount + $svcharge) * $billingChargeRate, 2);
|
||||
$bankin_amount = round($subtotal + $taxAmount + $billingChargeAmount , 2);
|
||||
|
||||
Reference in New Issue
Block a user