mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 04:14:04 +00:00
cancel bookings
This commit is contained in:
@@ -28,6 +28,47 @@ class Booking extends Model
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
public function scopeCompleteOrders($query){
|
||||
return $query->where(function ($query) {
|
||||
$query->where(function ($query) {
|
||||
$query->where('admin_status', '6')
|
||||
->where(function ($query) {
|
||||
$query->where('term', 'x2_cash')
|
||||
->orwhere('term', 'x2_cheque')
|
||||
->orwhere('term', 'x2_ba');
|
||||
});
|
||||
})
|
||||
->orwhere(function ($query) {
|
||||
$query->where('admin_status', '7')
|
||||
->where(function ($query) {
|
||||
$query->where('term', 'x1_cash')
|
||||
->orwhere('term', 'x1_cheque')
|
||||
->orwhere('term', 'x1_ba');
|
||||
});
|
||||
});
|
||||
})->where('is_cancel', 0);
|
||||
}
|
||||
|
||||
public function scopeInCompleteOrders($query){
|
||||
return $query->where(function ($query) {
|
||||
$query->where(function ($query) {
|
||||
$query->where('admin_status', '<', '6')
|
||||
->where(function ($query) {
|
||||
$query->where('term', 'x2_cash')
|
||||
->orwhere('term', 'x2_cheque')
|
||||
->orwhere('term', 'x2_ba');
|
||||
});
|
||||
})
|
||||
->orwhere(function ($query) {
|
||||
$query->where('status', '<', '7')
|
||||
->where(function ($query) {
|
||||
$query->where('term', 'x1_cash')
|
||||
->orwhere('term', 'x1_cheque')
|
||||
->orwhere('term', 'x1_ba');
|
||||
});
|
||||
});
|
||||
})->where('is_cancel', 0);
|
||||
}
|
||||
public function scopeUserBooking($query, $userId){
|
||||
if($userId){
|
||||
return $query->where('user_id', $userId);
|
||||
|
||||
@@ -23,30 +23,10 @@ class BookingController extends Controller
|
||||
{
|
||||
|
||||
public function index(){
|
||||
$user = Auth::user();
|
||||
$bookings = Booking::select('user_id', 'id', 'created_at', 'is_cancel', 'status', 'rate', 'term', 'amount', 'bia', 'verification_status')
|
||||
->where('user_id', Auth::user()->id)
|
||||
->where('is_cancel', 0)
|
||||
->where(function ($query) {
|
||||
$query->where(function($query){
|
||||
$query->where('status', '<', '5')
|
||||
->where(function ($query) {
|
||||
$query->where('term', '=', 'x2_cheque')
|
||||
->orwhere('term', '=', 'x2_ba')
|
||||
->orwhere('term', '=', 'x2_cash');
|
||||
});
|
||||
})
|
||||
->orwhere(function ($query) {
|
||||
$query->where('status', '<', '7')
|
||||
->where(function ($query) {
|
||||
$query->where('term', '=', 'x1_cheque')
|
||||
->orwhere('term', '=', 'x1_ba')
|
||||
->orwhere('term', '=', 'x1_cash');
|
||||
});
|
||||
});
|
||||
})
|
||||
->orderby('updated_at','desc')
|
||||
->paginate(10);
|
||||
$bookings = Booking::UserBooking(Auth::user()->id)->InCompleteOrders()
|
||||
->where('is_cancel', 0)
|
||||
->orderby('updated_at','desc')
|
||||
->paginate(10);
|
||||
|
||||
|
||||
// reformat to fit frontend structure
|
||||
@@ -105,28 +85,7 @@ class BookingController extends Controller
|
||||
}
|
||||
|
||||
public function userComplete(){
|
||||
$user = Auth::user();
|
||||
$bookings = Booking::where('user_id', $user->id)
|
||||
->where(function ($query) {
|
||||
$query->where(function ($query) {
|
||||
$query->where('status', '5')
|
||||
->where(function ($query) {
|
||||
$query->where('term', 'x2_cash')
|
||||
->orwhere('term', 'x2_cheque')
|
||||
->orwhere('term', 'x2_ba');
|
||||
});
|
||||
})
|
||||
->orwhere(function ($query) {
|
||||
$query->where('status', '7')
|
||||
->where(function ($query) {
|
||||
$query->where('term', 'x1_cash')
|
||||
->orwhere('term', 'x1_cheque')
|
||||
->orwhere('term', 'x1_ba');
|
||||
});
|
||||
});
|
||||
})
|
||||
->orderby('updated_at','desc')
|
||||
->paginate(10);
|
||||
$bookings = Booking::UserBooking(Auth::user()->id)->CompleteOrders()->orderby('updated_at','desc')->paginate(10);
|
||||
|
||||
// reformat to fit frontend structure
|
||||
foreach ($bookings as $booking) {
|
||||
@@ -151,36 +110,7 @@ class BookingController extends Controller
|
||||
if ($booking->term == "x2_cash" || $booking->term == "x2_cheque" || $booking->term == "x2_ba") {
|
||||
$booking->track_status = "(". $booking->status ."/5)";
|
||||
}
|
||||
|
||||
switch ($booking->status) {
|
||||
case 1:
|
||||
$status_desc = "Order in progress";
|
||||
break;
|
||||
case 2:
|
||||
$status_desc = "Waiting for payment";
|
||||
break;
|
||||
case 3:
|
||||
$status_desc = "Waiting verification";
|
||||
break;
|
||||
case 4:
|
||||
$status_desc = "Processing transfer";
|
||||
break;
|
||||
case 5:
|
||||
$status_desc = "Transfer Complete, please upload your PO";
|
||||
if ($booking->term == "x2_cash" || $booking->term == "x2_cheque" || $booking->term == "x2_ba"){
|
||||
$status_desc = "Order Completed";
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
$status_desc = "Processing invoice";
|
||||
break;
|
||||
case 7:
|
||||
$status_desc = "Order Completed";
|
||||
break;
|
||||
default:
|
||||
$status_desc = "";
|
||||
}
|
||||
$booking->status_desc = $status_desc;
|
||||
$booking->status_desc = "Order Completed";
|
||||
$booking->marking = $booking->user->marking;
|
||||
}
|
||||
|
||||
@@ -188,28 +118,7 @@ class BookingController extends Controller
|
||||
}
|
||||
|
||||
public function adminIndex(?string $userId = null){
|
||||
$user = Auth::user();
|
||||
$bookings = Booking::UserBooking($userId)->select('user_id', 'id', 'created_at', 'admin_status', 'rate', 'term', 'amount', 'bia', 'verification_status')
|
||||
->where(function ($query) {
|
||||
$query->where(function ($query) {
|
||||
$query->where('admin_status', '<', '6')
|
||||
->where(function ($query) {
|
||||
$query->where('term', 'x2_cash')
|
||||
->orwhere('term', 'x2_cheque')
|
||||
->orwhere('term', 'x2_ba');
|
||||
});
|
||||
})
|
||||
->orwhere(function ($query) {
|
||||
$query->where('status', '<', '7')
|
||||
->where(function ($query) {
|
||||
$query->where('term', 'x1_cash')
|
||||
->orwhere('term', 'x1_cheque')
|
||||
->orwhere('term', 'x1_ba');
|
||||
});
|
||||
});
|
||||
})
|
||||
->orderby('updated_at','desc')
|
||||
->paginate(30);
|
||||
$bookings = Booking::UserBooking($userId)->InCompleteOrders()->orderby('updated_at', "desc")->paginate(30);
|
||||
|
||||
// reformat to fit frontend structure
|
||||
foreach ($bookings as $booking) {
|
||||
@@ -275,27 +184,7 @@ class BookingController extends Controller
|
||||
|
||||
public function adminBookComplete(?string $userId = null){
|
||||
$user = Auth::user();
|
||||
$bookings = Booking::UserBooking($userId)->select('user_id', 'id', 'created_at', 'admin_status', 'rate', 'term', 'amount', 'bia', 'verification_status')
|
||||
->where(function ($query) {
|
||||
$query->where(function ($query) {
|
||||
$query->where('admin_status', '6')
|
||||
->where(function ($query) {
|
||||
$query->where('term', 'x2_cash')
|
||||
->orwhere('term', 'x2_cheque')
|
||||
->orwhere('term', 'x2_ba');
|
||||
});
|
||||
})
|
||||
->orwhere(function ($query) {
|
||||
$query->where('admin_status', '7')
|
||||
->where(function ($query) {
|
||||
$query->where('term', 'x1_cash')
|
||||
->orwhere('term', 'x1_cheque')
|
||||
->orwhere('term', 'x1_ba');
|
||||
});
|
||||
});
|
||||
})
|
||||
->orderby('updated_at','desc')
|
||||
->paginate(10);
|
||||
$bookings = Booking::UserBooking($userId)->CompleteOrders()->orderby('updated_at', "desc")->paginate(10);
|
||||
// reformat to fit frontend structure
|
||||
foreach ($bookings as $booking) {
|
||||
// set timeout
|
||||
@@ -321,39 +210,8 @@ class BookingController extends Controller
|
||||
$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:
|
||||
$status_desc = "Generate supplier booking report";
|
||||
break;
|
||||
case 4:
|
||||
$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";
|
||||
if ($booking->term == "x2_cash" || $booking->term == "x2_cheque" || $booking->term == "x2_ba"){
|
||||
$status_desc = "Order Completed";
|
||||
}
|
||||
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;
|
||||
$booking->status_desc = "Booking Completed";
|
||||
}
|
||||
return $bookings;
|
||||
}
|
||||
@@ -750,30 +608,49 @@ class BookingController extends Controller
|
||||
return response()->json($book_id, 204);
|
||||
}
|
||||
|
||||
// public function userCanceledBooking(Request $request)
|
||||
// {
|
||||
// $user = Auth::user();
|
||||
// $bookings = Booking::select('user_id', 'id', 'created_at', 'is_cancel', 'status', 'rate', 'term', 'amount', 'bia', 'verification_status')
|
||||
// ->where('user_id', Auth::user()->id)
|
||||
// ->where('is_cancel', 1)
|
||||
// ->get();
|
||||
// return $bookings;
|
||||
public function CancelledBookings()
|
||||
{
|
||||
$bookings = Booking::where('is_cancel', 1)->paginate(10);
|
||||
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;
|
||||
}
|
||||
|
||||
// public function cancelBooking(Request $request, $book_id)
|
||||
// {
|
||||
// $user = Auth::user();
|
||||
// $bookings = DB::table('booking')
|
||||
// ->where('user_id', Auth::user()->id);
|
||||
// TODO : transfer_amount change name to bia
|
||||
$booking->transfer_amount = $booking->bia;
|
||||
|
||||
// $bookings->is_cancel = 1;
|
||||
$term = $booking->term;
|
||||
if ($booking->term == "x2_cash" || $booking->term == "x2_cheque" || $booking->term == "x2_ba"){
|
||||
$booking->track_status = "(". $booking->admin_status ."/6)";
|
||||
}
|
||||
else{
|
||||
$booking->track_status = "(". $booking->admin_status ."/7)";
|
||||
}
|
||||
|
||||
// if($booking->save()){
|
||||
// return response()->json(['message'=> 'booking cancelled'], 200);
|
||||
// }
|
||||
$booking->marking = $booking->user->marking;
|
||||
$booking->status_desc = "Booking Canclled";
|
||||
}
|
||||
return $bookings;
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
public function cancelBooking($book_id)
|
||||
{
|
||||
$booking = Booking::findOrFail($book_id);
|
||||
$booking->is_cancel = 1;
|
||||
if($booking->save()){
|
||||
return response()->json(['message'=> 'booking cancelled'], 200);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function calculation(Request $request)
|
||||
{
|
||||
|
||||
@@ -40,12 +40,18 @@
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="Balance" prop="transfer_amount" sortable width="100"/> -->
|
||||
<!-- <el-table-column prop="timeout" label="Bankin Timeout" /> -->
|
||||
<el-table-column label="" width="180">
|
||||
<el-button slot-scope="scope" type="text" @click="(event) => { BookingStatus(scope.row.admin_status, scope.row.id, scope.row.term) }"> View Status </el-button>
|
||||
<!-- <template slot-scope="scope">
|
||||
<el-button size="mini" @click="handleEdit(scope.$index, scope.row)">View Status</el-button>
|
||||
<el-button size="mini" type="danger" @click="BookingStatus(scope.$index, scope.row)">Cancel</el-button>
|
||||
</template> -->
|
||||
<el-table-column label="">
|
||||
<template slot-scope="scope">
|
||||
<el-button-group>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="danger"
|
||||
@click="CancelBooking(scope.row.id)"><i class="el-icon-close"></i></el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
@click="(event) => { BookingStatus(scope.row.admin_status, scope.row.id, scope.row.term) }"><i class="el-icon-arrow-right"></i></el-button>
|
||||
</el-button-group>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div align="right">
|
||||
@@ -59,63 +65,107 @@
|
||||
</div>
|
||||
</div>
|
||||
</el-row><br><br></el-tab-pane>
|
||||
|
||||
<el-tab-pane label="Completed">
|
||||
<el-row :gutter="20">
|
||||
<div>
|
||||
<el-table :data="bookingTableComplete">
|
||||
<el-table-column label="Ref No." width="100" >
|
||||
<el-button size="mini" @click="handleEdit(scope.$index, scope.row)">Update</el-button>
|
||||
<el-button slot-scope="scope" type="text" @click="(event) => { BookingStatus(scope.row.admin_status, scope.row.id, scope.row.term) }"> {{ scope.row.id }}</el-button>
|
||||
</el-table-column>
|
||||
<el-table-column label="DateTime" prop="created_at" width="180" sortable/>
|
||||
<el-table-column label="Ref No." width="100" >
|
||||
<el-button slot-scope="scope" type="text" style="font-size: 12px;" @click="(event) => { userBookings(scope.row.user_id) }"> {{ scope.row.marking }} </el-button>
|
||||
</el-table-column>
|
||||
<el-table-column :filters="[{text: 'X1', value: 'X1'}, {text: 'X2', value: 'X2'}]" :filter-method="filterHandlerTerm" label="Term" prop="term" width="100"/> -->
|
||||
<el-table-column label="Rate" width="74" prop="rate" />
|
||||
<el-table-column label="Amount" prop="amount" justify="center" width="110" sortable/>
|
||||
<el-table-column :filters="[{text: 'RMB', value: 'RMB'}, {text: 'USD', value: 'USD'}]" :filter-method="filterHandlerTranferAmount" label="Transfer Amount"
|
||||
prop="transfer_amount" width="180" sortable/>
|
||||
<!-- <el-table-column label="ETA" sortable width="100"/> -->
|
||||
<!-- <el-table-column label="Payment Method" :filters="[{text: 'Cash', value: 'Cash'}, {text: 'Cheque', value: 'Cheque'}, {text: 'BA', value: 'BA'}]" :filter-method="filterHandler">
|
||||
</el-table-column> -->
|
||||
<!-- <el-table-column :filters="[{text: '(1/6)', value: '(1/6) Order Done'}, {text: '(2/6)', value: '(2/6) Waiting for Upload Bank in Slip'}, {text: '(3/6)', value: '(3/6) Order Confirmation'}, {text: '(4/6)', value: '(4/6) Processing Transfer'}, {text: '(5/6)', value: '(5/6) Waiting for Upload PO'}, {text: '(6/6)', value: '(6/6) Order Complete'}]" :filter-method="filterHandler" prop="status" label="Status"/> -->
|
||||
<el-table-column label="Status" width="106" prop="status_desc">
|
||||
<template slot-scope="scope">
|
||||
<el-popover trigger="click" placement="top">
|
||||
<p>{{ scope.row.status_desc }}</p>
|
||||
<div slot="reference" class="name-wrapper">
|
||||
<el-tag size="medium">{{ scope.row.track_status }}</el-tag>
|
||||
|
||||
<el-tab-pane label="Completed">
|
||||
<el-row :gutter="20">
|
||||
<div>
|
||||
<el-table :data="bookingTableComplete">
|
||||
<el-table-column label="Ref No." width="100" >
|
||||
<el-button size="mini" @click="handleEdit(scope.$index, scope.row)">Update</el-button>
|
||||
<el-button slot-scope="scope" type="text" @click="(event) => { BookingStatus(scope.row.admin_status, scope.row.id, scope.row.term) }"> {{ scope.row.id }}</el-button>
|
||||
</el-table-column>
|
||||
<el-table-column label="DateTime" prop="created_at" width="180" sortable/>
|
||||
<el-table-column label="Ref No." width="100" >
|
||||
<el-button slot-scope="scope" type="text" style="font-size: 12px;" @click="(event) => { userBookings(scope.row.user_id) }"> {{ scope.row.marking }} </el-button>
|
||||
</el-table-column>
|
||||
<el-table-column :filters="[{text: 'X1', value: 'X1'}, {text: 'X2', value: 'X2'}]" :filter-method="filterHandlerTerm" label="Term" prop="term" width="100"/> -->
|
||||
<el-table-column label="Rate" width="74" prop="rate" />
|
||||
<el-table-column label="Amount" prop="amount" justify="center" width="110" sortable/>
|
||||
<el-table-column :filters="[{text: 'RMB', value: 'RMB'}, {text: 'USD', value: 'USD'}]" :filter-method="filterHandlerTranferAmount" label="Transfer Amount"
|
||||
prop="transfer_amount" width="180" sortable/>
|
||||
<!-- <el-table-column label="ETA" sortable width="100"/> -->
|
||||
<!-- <el-table-column label="Payment Method" :filters="[{text: 'Cash', value: 'Cash'}, {text: 'Cheque', value: 'Cheque'}, {text: 'BA', value: 'BA'}]" :filter-method="filterHandler">
|
||||
</el-table-column> -->
|
||||
<!-- <el-table-column :filters="[{text: '(1/6)', value: '(1/6) Order Done'}, {text: '(2/6)', value: '(2/6) Waiting for Upload Bank in Slip'}, {text: '(3/6)', value: '(3/6) Order Confirmation'}, {text: '(4/6)', value: '(4/6) Processing Transfer'}, {text: '(5/6)', value: '(5/6) Waiting for Upload PO'}, {text: '(6/6)', value: '(6/6) Order Complete'}]" :filter-method="filterHandler" prop="status" label="Status"/> -->
|
||||
<el-table-column label="Status" width="106" prop="status_desc">
|
||||
<template slot-scope="scope">
|
||||
<el-popover trigger="click" placement="top">
|
||||
<p>{{ scope.row.status_desc }}</p>
|
||||
<div slot="reference" class="name-wrapper">
|
||||
<el-tag size="medium">{{ scope.row.track_status }}</el-tag>
|
||||
</div>
|
||||
</el-popover>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="Balance" prop="transfer_amount" sortable width="100"/> -->
|
||||
<!-- <el-table-column prop="timeout" label="Bankin Timeout" /> -->
|
||||
<!-- <el-table-column :filters="[{ text: 'Success', value: 'Success' }, { text: 'Pending', value: 'Pending' }]" :filter-method="filterHandlerStatus"
|
||||
label="" width="180" filter-placement="bottom-end">
|
||||
<el-button slot-scope="scope" type="text" @click="(event) => { BookingStatus(scope.row.status, scope.row.id) }"> View Status </el-button> -->
|
||||
<el-table-column label="" width="180">
|
||||
<el-button slot-scope="scope" type="text" @click="(event) => { BookingStatus(scope.row.admin_status, scope.row.id, scope.row.term) }"> View Status </el-button>
|
||||
<!-- <template slot-scope="scope">
|
||||
<el-button size="mini" @click="handleEdit(scope.$index, scope.row)">View Status</el-button>
|
||||
<el-button size="mini" type="danger" @click="BookingStatus(scope.$index, scope.row)">Cancel</el-button>
|
||||
</template> -->
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div align="right">
|
||||
<el-button type="primary" size="mini" @click="fetchCompletePaginateBooking(completePagination.prev_page_url)" :disabled="!completePagination.prev_page_url">
|
||||
Previous
|
||||
</el-button>
|
||||
<span>Page {{completePagination.current_page}} of {{completePagination.last_page}}</span>
|
||||
<el-button type="primary" size="mini" @click="fetchCompletePaginateBooking(completePagination.next_page_url)" :disabled="!completePagination.next_page_url">
|
||||
Next
|
||||
</el-button>
|
||||
</div>
|
||||
</el-popover>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="Balance" prop="transfer_amount" sortable width="100"/> -->
|
||||
<!-- <el-table-column prop="timeout" label="Bankin Timeout" /> -->
|
||||
<!-- <el-table-column :filters="[{ text: 'Success', value: 'Success' }, { text: 'Pending', value: 'Pending' }]" :filter-method="filterHandlerStatus"
|
||||
label="" width="180" filter-placement="bottom-end">
|
||||
<el-button slot-scope="scope" type="text" @click="(event) => { BookingStatus(scope.row.status, scope.row.id) }"> View Status </el-button> -->
|
||||
<el-table-column label="" width="180">
|
||||
<el-button slot-scope="scope" type="text" @click="(event) => { BookingStatus(scope.row.admin_status, scope.row.id, scope.row.term) }"> View Status </el-button>
|
||||
<!-- <template slot-scope="scope">
|
||||
<el-button size="mini" @click="handleEdit(scope.$index, scope.row)">View Status</el-button>
|
||||
<el-button size="mini" type="danger" @click="BookingStatus(scope.$index, scope.row)">Cancel</el-button>
|
||||
</template> -->
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div align="right">
|
||||
<el-button type="primary" size="mini" @click="fetchCompletePaginateBooking(completePagination.prev_page_url)" :disabled="!completePagination.prev_page_url">
|
||||
Previous
|
||||
</el-button>
|
||||
<span>Page {{completePagination.current_page}} of {{completePagination.last_page}}</span>
|
||||
<el-button type="primary" size="mini" @click="fetchCompletePaginateBooking(completePagination.next_page_url)" :disabled="!completePagination.next_page_url">
|
||||
Next
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-row><br><br>
|
||||
</el-tab-pane>
|
||||
</div>
|
||||
</el-row><br><br>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="Cancelled">
|
||||
<el-row :gutter="20">
|
||||
<div>
|
||||
<el-table :data="bookingTableCancelled">
|
||||
<el-table-column label="Ref No." width="100" >
|
||||
<el-button size="mini" @click="handleEdit(scope.$index, scope.row)">Update</el-button>
|
||||
<el-button slot-scope="scope" type="text" @click="(event) => { BookingStatus(scope.row.admin_status, scope.row.id, scope.row.term) }"> {{ scope.row.id }}</el-button>
|
||||
</el-table-column>
|
||||
<el-table-column label="DateTime" prop="created_at" width="180" sortable/>
|
||||
<el-table-column label="Ref No." width="100" >
|
||||
<el-button slot-scope="scope" type="text" style="font-size: 12px;" @click="(event) => { userBookings(scope.row.user_id) }"> {{ scope.row.marking }} </el-button>
|
||||
</el-table-column>
|
||||
<el-table-column :filters="[{text: 'X1', value: 'X1'}, {text: 'X2', value: 'X2'}]" :filter-method="filterHandlerTerm" label="Term" prop="term" width="100"/> -->
|
||||
<el-table-column label="Rate" width="74" prop="rate" />
|
||||
<el-table-column label="Amount" prop="amount" justify="center" width="110" sortable/>
|
||||
<el-table-column :filters="[{text: 'RMB', value: 'RMB'}, {text: 'USD', value: 'USD'}]" :filter-method="filterHandlerTranferAmount" label="Transfer Amount"
|
||||
prop="transfer_amount" width="180" sortable/>
|
||||
<!-- <el-table-column label="ETA" sortable width="100"/> -->
|
||||
<!-- <el-table-column label="Payment Method" :filters="[{text: 'Cash', value: 'Cash'}, {text: 'Cheque', value: 'Cheque'}, {text: 'BA', value: 'BA'}]" :filter-method="filterHandler">
|
||||
</el-table-column> -->
|
||||
<!-- <el-table-column :filters="[{text: '(1/6)', value: '(1/6) Order Done'}, {text: '(2/6)', value: '(2/6) Waiting for Upload Bank in Slip'}, {text: '(3/6)', value: '(3/6) Order Confirmation'}, {text: '(4/6)', value: '(4/6) Processing Transfer'}, {text: '(5/6)', value: '(5/6) Waiting for Upload PO'}, {text: '(6/6)', value: '(6/6) Order Complete'}]" :filter-method="filterHandler" prop="status" label="Status"/> -->
|
||||
<el-table-column label="Status" width="106" prop="status_desc">
|
||||
<template slot-scope="scope">
|
||||
<el-popover trigger="click" placement="top">
|
||||
<p>{{ scope.row.status_desc }}</p>
|
||||
<div slot="reference" class="name-wrapper">
|
||||
<el-tag size="medium">{{ scope.row.track_status }}</el-tag>
|
||||
</div>
|
||||
</el-popover>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div align="right">
|
||||
<el-button type="primary" size="mini" @click="getBookingTableCanceled(cancelledPagination.current_page-1)" :disabled="!cancelledPagination.prev_page_url">
|
||||
Previous
|
||||
</el-button>
|
||||
<span>Page {{cancelledPagination.current_page}} of {{cancelledPagination.last_page}}</span>
|
||||
<el-button type="primary" size="mini" @click="getBookingTableCanceled(cancelledPagination.current_page+1)" :disabled="!cancelledPagination.next_page_url">
|
||||
Next
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-row><br><br>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
|
||||
@@ -142,10 +192,12 @@ export default {
|
||||
status: null,
|
||||
bookingTable: [],
|
||||
bookingTableComplete: [],
|
||||
bookingTableCancelled: [],
|
||||
url: 'api/admin/booking',
|
||||
completeBookingurl : "api/admin-complete-booking",
|
||||
pagination: [],
|
||||
completePagination: [],
|
||||
cancelledPagination: [],
|
||||
|
||||
loading_btn: false,
|
||||
}
|
||||
@@ -153,6 +205,7 @@ export default {
|
||||
mounted () {
|
||||
this.getBooking();
|
||||
this.getBookingTableComplete();
|
||||
this.getBookingTableCanceled();
|
||||
},
|
||||
methods: {
|
||||
getBooking(){
|
||||
@@ -169,6 +222,13 @@ export default {
|
||||
$this.makeCompletePagination(response.data)
|
||||
})
|
||||
},
|
||||
getBookingTableCanceled(page = 1){
|
||||
let $this = this
|
||||
axios.get('api/admin/cancelled/booking' + '?page='+ page).then(response => {
|
||||
this.bookingTableCancelled= response.data.data
|
||||
$this.makeCancelledPagination(response.data)
|
||||
})
|
||||
},
|
||||
RefreshBooking() {
|
||||
let $this = this
|
||||
this.loading_btn = true
|
||||
@@ -200,7 +260,7 @@ export default {
|
||||
}
|
||||
this.pagination = pagination
|
||||
},
|
||||
makeCompletePagination(data){
|
||||
makeCompletePagination(data){
|
||||
let pagination ={
|
||||
current_page: data.current_page,
|
||||
last_page: data.last_page,
|
||||
@@ -209,6 +269,15 @@ export default {
|
||||
}
|
||||
this.completePagination = pagination
|
||||
},
|
||||
makeCancelledPagination(data){
|
||||
let pagination ={
|
||||
current_page: data.current_page,
|
||||
last_page: data.last_page,
|
||||
next_page_url: data.next_page_url,
|
||||
prev_page_url: data.prev_page_url
|
||||
}
|
||||
this.cancelledPagination = pagination
|
||||
},
|
||||
fetchPaginateBooking(url) {
|
||||
this.url = url
|
||||
this.getBooking()
|
||||
@@ -217,7 +286,11 @@ export default {
|
||||
fetchCompletePaginateBooking(url) {
|
||||
this.completeBookingurl = url
|
||||
this.getBookingTableComplete()
|
||||
},
|
||||
},
|
||||
fetchCompletePaginateBooking(url) {
|
||||
this.completeBookingurl = url
|
||||
this.getBookingTableComplete()
|
||||
},
|
||||
filterHandlerStatus (value, row, column) {
|
||||
const status = row.admin_status;
|
||||
return value === status;
|
||||
@@ -298,6 +371,24 @@ export default {
|
||||
default:
|
||||
break
|
||||
}
|
||||
},
|
||||
CancelBooking(id) {
|
||||
let vm = this;
|
||||
this.$confirm('Are you sure you want to cancel this booking?', 'Cancel Booking', {
|
||||
confirmButtonText: 'Confirm',
|
||||
cancelButtonText: 'Cancel',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
axios.post('api/admin/booking/'+id+"/cancel").then(() => {
|
||||
vm.RefreshBooking();
|
||||
vm.getBookingTableCanceled();
|
||||
vm.$message({
|
||||
type: 'success',
|
||||
message: 'Booking canceled successfully'
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,8 @@ Route::group(['middleware' => ['role:admin']], function() {
|
||||
Route::get('admin/booking/{userId?}', 'BookingController@adminIndex');
|
||||
Route::get('admin-complete-booking/{userId?}', 'BookingController@adminBookComplete');
|
||||
Route::get('admin/booking/{id}/details', 'BookingController@adminShow');
|
||||
Route::get('admin/cancelled/booking', 'BookingController@CancelledBookings');
|
||||
Route::post('admin/booking/{id}/cancel', 'BookingController@cancelBooking');
|
||||
Route::post('update-rate', 'RateController@store');
|
||||
Route::put('update-rate/{rate}', 'RateController@update');
|
||||
Route::delete('update-rate/{rate}', 'RateController@delete');
|
||||
|
||||
Reference in New Issue
Block a user