fixPaginationAdmin_and_user

This commit is contained in:
lonetrinity
2018-08-10 17:45:01 +08:00
parent 97f7041459
commit 3f38fef845
4 changed files with 87 additions and 33 deletions
+1 -1
View File
@@ -209,7 +209,7 @@ class BookingController extends Controller
return $bookings;
}
public function Bookcomplete(){
public function bookcomplete(){
$user = Auth::user();
$bookings = Booking::select('user_id', 'id', 'created_at', 'status', 'rate', 'term', 'amount', 'bia', 'verification_status')
->where('status', '=', '7')
+42 -15
View File
@@ -46,6 +46,15 @@
</template> -->
</el-table-column>
</el-table>
<div align="right">
<el-button type="primary" size="mini" @click="fetchPaginateBooking(pagination.prev_page_url)" :disabled="!pagination.prev_page_url">
Previous
</el-button>
<span>Page {{pagination.current_page}} of {{pagination.last_page}}</span>
<el-button type="primary" size="mini" @click="fetchPaginateBooking(pagination.next_page_url)" :disabled="!pagination.next_page_url">
Next
</el-button>
</div>
</div>
</el-row><br><br></el-tab-pane>
@@ -88,21 +97,22 @@
</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>
</el-tabs>
<div align="right">
<el-button type="primary" size="mini" @click="fetchPaginateBooking(pagination.prev_page_url)" :disabled="!pagination.prev_page_url">
Previous
</el-button>
<span>Page {{pagination.current_page}} of {{pagination.last_page}}</span>
<el-button type="primary" size="mini" @click="fetchPaginateBooking(pagination.next_page_url)" :disabled="!pagination.next_page_url">
Next
</el-button>
</div>
<!-- Booking Table-end -->
@@ -126,27 +136,30 @@ export default {
bookingTable: [],
bookingTableComplete: [],
url: 'api/admin/booking',
pagination: {prev_page_url: null},
completeBookingurl : "api/complete_booking",
pagination: [],
completePagination: [],
loading_btn: false,
}
},
mounted () {
this.getBooking();
this.getbookingTableComplete();
this.getBookingTableComplete();
},
methods: {
getBooking(){
let $this = this
axios.get(this.url).then(response => {
this.bookingTable = response.data.data;
$this.makePagination(this.bookingTable);
$this.makePagination(response.data);
})
},
getbookingTableComplete(){
getBookingTableComplete(){
let $this = this
axios.get('api/complete_booking').then(response => {
axios.get(this.completeBookingurl).then(response => {
this.bookingTableComplete = response.data.data
$this.makePagination(response.data)
$this.makeCompletePagination(response.data)
})
},
RefreshBooking() {
@@ -171,11 +184,25 @@ export default {
prev_page_url: data.prev_page_url
}
this.pagination = pagination
},
makeCompletePagination(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.completePagination = pagination
},
fetchPaginateBooking(url) {
this.url = url
this.getBooking()
},
fetchCompletePaginateBooking(url) {
this.completeBookingurl = url
this.getBookingTableComplete()
},
filterHandlerStatus (value, row, column) {
const status = row.track_status;
if(value ==="Success")
+43 -16
View File
@@ -317,7 +317,17 @@
<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="fetchPaginateBooking(pagination.prev_page_url)" :disabled="!pagination.prev_page_url">
Previous
</el-button>
<span>Page {{pagination.current_page}} of {{pagination.last_page}}</span>
<el-button type="primary" size="mini" @click="fetchPaginateBooking(pagination.next_page_url)" :disabled="!pagination.next_page_url">
Next
</el-button>
</div>
</div>
</el-row><br><br></el-tab-pane>
@@ -359,24 +369,22 @@
<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>
</el-tabs>
<div align="right">
<el-button type="primary" size="mini" @click="fetchPaginateBooking(pagination.prev_page_url)" :disabled="!pagination.prev_page_url">
Previous
</el-button>
<span>Page {{pagination.current_page}} of {{pagination.last_page}}</span>
<el-button type="primary" size="mini" @click="fetchPaginateBooking(pagination.next_page_url)" :disabled="!pagination.next_page_url">
Next
</el-button>
</div>
<!-- Booking Table-end -->
</el-main>
@@ -492,7 +500,9 @@ export default {
bookingTable: [],
bookingTableComplete: [],
url: 'api/booking',
completeBookingurl : "api/complete-booking",
pagination: [],
completePagination: [],
bookingConfirmTable: {
date: 'undefined',
marking: 'undefined',
@@ -510,7 +520,7 @@ export default {
this.getBooking();
this.initBooking();
this.getRate();
this.getbookingTableComplete();
this.getCompleteBooking();
},
methods: {
getBooking(){
@@ -520,11 +530,11 @@ export default {
$this.makePagination(response.data)
})
},
getbookingTableComplete(){
getCompleteBooking(){
let $this = this
axios.get('api/complete-booking').then(response => {
axios.get(this.completeBookingurl).then(response => {
this.bookingTableComplete = response.data.data
$this.makePagination(response.data)
$this.makeCompletePagination(response.data)
})
},
getRate() {
@@ -576,10 +586,27 @@ export default {
}
this.pagination = pagination
},
makeCompletePagination(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.completePagination = pagination
},
fetchPaginateBooking(url) {
this.url = url
this.getBooking()
},
fetchCompletePaginateBooking(url) {
this.completeBookingurl = url
this.getCompleteBooking()
},
// TODO fetch booking data on load
formatter (row, column) {
return row.address
+1 -1
View File
@@ -70,7 +70,7 @@ Route::group(['middleware' => 'guest:api'], function () {
Route::group(['middleware' => ['role:admin']], function() {
Route::get('admin/booking/', 'BookingController@adminIndex');
Route::get('complete_booking', 'BookingController@Bookcomplete');
Route::get('complete_booking', 'BookingController@bookcomplete');
Route::get('admin/booking/{id}', 'BookingController@adminShow');
Route::post('update-rate', 'RateController@store');
Route::put('update-rate/{rate}', 'RateController@update');