mirror of
https://gitlab.com/omair-personal/exchange.git
synced 2026-08-19 04:24:08 +00:00
Showing Completed Orders Task Done
This commit is contained in:
@@ -20,12 +20,11 @@ class BookingController extends Controller
|
||||
|
||||
public function index(){
|
||||
$user = Auth::user();
|
||||
$bookings = Booking::select('id', 'created_at', 'status', 'rate', 'term', 'amount', 'bia', 'verification_status')
|
||||
$bookings = Booking::select('user_id', 'id', 'created_at', 'status', 'rate', 'term', 'amount', 'bia', 'verification_status')
|
||||
->where('user_id', $user->id)
|
||||
->orderby('updated_at','desc')
|
||||
->paginate(10);
|
||||
|
||||
|
||||
// reformat to fit frontend structure
|
||||
foreach ($bookings as $booking) {
|
||||
// set timeout
|
||||
@@ -42,7 +41,7 @@ class BookingController extends Controller
|
||||
|
||||
// TODO : transfer_amount change name to bia
|
||||
$booking->transfer_amount = $booking->bia;
|
||||
|
||||
|
||||
$booking->track_status = "(". $booking->status ."/7)";
|
||||
switch ($booking->status) {
|
||||
case 1:
|
||||
@@ -69,15 +68,15 @@ class BookingController extends Controller
|
||||
default:
|
||||
$status_desc = "";
|
||||
}
|
||||
$booking->status_desc = $status_desc;
|
||||
$booking->marking = $booking->user->marking;
|
||||
}
|
||||
|
||||
|
||||
return $bookings;
|
||||
}
|
||||
|
||||
public function adminIndex(){
|
||||
$user = Auth::user();
|
||||
$bookings = Booking::select('id', 'created_at', 'admin_status', 'rate', 'term', 'amount', 'bia', 'verification_status')
|
||||
$bookings = Booking::select('user_id', 'id', 'created_at', 'admin_status', 'rate', 'term', 'amount', 'bia', 'verification_status')
|
||||
->orderby('updated_at','desc')
|
||||
->get();
|
||||
|
||||
@@ -126,7 +125,8 @@ class BookingController extends Controller
|
||||
break;
|
||||
default:
|
||||
$status_desc = "";
|
||||
}
|
||||
}
|
||||
$booking->marking = $booking->user->marking;
|
||||
$booking->status_desc = $status_desc;
|
||||
}
|
||||
return $bookings;
|
||||
@@ -169,6 +169,7 @@ class BookingController extends Controller
|
||||
$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;
|
||||
$booking->marking = $booking->user->marking;
|
||||
|
||||
if (!$booking){
|
||||
return response()->json(['success'=>false, 'message'=>'not found'], 404);
|
||||
@@ -214,6 +215,7 @@ class BookingController extends Controller
|
||||
$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;
|
||||
$booking->marking = $booking->user->marking;
|
||||
|
||||
if (!$booking){
|
||||
return response()->json(['success'=>false, 'message'=>'not found'], 404);
|
||||
@@ -350,7 +352,7 @@ class BookingController extends Controller
|
||||
|
||||
return response()->json(['book_id'=>$book_id],200);
|
||||
}
|
||||
//upload
|
||||
|
||||
public function uploadbankslip(Request $request, $id)
|
||||
{
|
||||
$booking = Booking::where('user_id',Auth::user()->id)->where('id',$id)->first();
|
||||
@@ -410,8 +412,7 @@ class BookingController extends Controller
|
||||
}
|
||||
else {
|
||||
return response()->json(['message' => 'No file detected'], 400);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function updateBankSlipAmount(Request $request, $id){
|
||||
@@ -487,7 +488,6 @@ class BookingController extends Controller
|
||||
|
||||
return response()->json(['message'=>'Success'],200);
|
||||
}
|
||||
|
||||
|
||||
public function showPurchaseOrder($id){
|
||||
$booking = Booking::where('id',$id)->first();
|
||||
@@ -526,6 +526,7 @@ class BookingController extends Controller
|
||||
$term = $request->input('term');
|
||||
$china_beneficiary = $request->input('china_beneficiary');
|
||||
$rates = Rate::orderby('updated_at','desc')->first();
|
||||
$marking = $user = Auth::user()->marking;
|
||||
|
||||
$creditLimit = SettingCredit::orderby('updated_at','desc')->first();
|
||||
|
||||
@@ -536,9 +537,7 @@ class BookingController extends Controller
|
||||
if($amount > $creditLimit->rmb_credit_limit){
|
||||
return response()->json(["message" => "Exceed credit limit, please contact our sales team for larger quantitiy"], 400);
|
||||
}
|
||||
|
||||
// TODO : get marking
|
||||
$marking = "123X";
|
||||
|
||||
|
||||
switch ($term) {
|
||||
case "x1_cash":
|
||||
@@ -656,7 +655,7 @@ class BookingController extends Controller
|
||||
|
||||
return response()->json(['message'=>'Success'],200);
|
||||
}
|
||||
//upload
|
||||
|
||||
public function uploadInvoice(Request $request, $id)
|
||||
{
|
||||
$booking = Booking::where('id',$id)->first();
|
||||
@@ -756,10 +755,9 @@ class BookingController extends Controller
|
||||
|
||||
public function adminShowCompletedOrders()
|
||||
{
|
||||
$bookings = Booking::select('id', 'company_name','company_address','created_at', 'rmb_book_amount', 'admin_status')
|
||||
->where('admin_status', 1)
|
||||
$bookings = Booking::select('id', 'company_name','company_address','created_at','rate','amount', 'rmb_book_amount', 'admin_status')
|
||||
->where('admin_status', 7)
|
||||
->orderBy('id', 'desc')
|
||||
->take(10)
|
||||
->get();
|
||||
|
||||
foreach ($bookings as $booking) {
|
||||
@@ -767,6 +765,8 @@ class BookingController extends Controller
|
||||
$booking->company_name;
|
||||
$booking->company_address;
|
||||
$booking->created_at;
|
||||
$booking->rate;
|
||||
$booking->amount;
|
||||
$booking->rmb_book_amount;
|
||||
$booking->admin_status;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user