completed list booking

TBD implement status feature
This commit is contained in:
Jack Goh
2018-06-21 10:43:52 +08:00
parent 7eb8c7bafc
commit a650879977
3 changed files with 41 additions and 23 deletions
+20 -3
View File
@@ -17,11 +17,28 @@ class BookingController extends Controller
{
public function index(){
$booking = Booking::select('bookings.id', 'rates.bookings.term')
->leftJoin('rates', 'bookings.rate_id', '=', 'rates.id')
$bookings = Booking::select('id', 'created_at', 'rate', 'amount', 'bia', 'verification_status')
->where('user_id',Auth::user()->id)
->get();
return $booking;
// reformat to fit frontend structure
foreach ($bookings as $booking) {
// set timeout
$date1 = new DateTime($booking->created_at);
$date2 = new DateTime();
$difference_in_seconds = ($date1->format('U') + 600) - ($date2->format('U'));
$booking->timeout = $difference_in_seconds;
// TODO : transfer_amount change name to bia
$booking->transfer_amount = $booking->bia;
// TODO : Logic for status
$booking->track_status = "1/1";
$booking->status_desc = "hello";
$booking->status = 6;
}
return $bookings;
}
public function show($id)
+17 -16
View File
@@ -239,11 +239,11 @@
<el-row :gutter="20">
<div>
<el-table :data="bookingTable">
<el-table-column label="No." width="106">
<el-table-column label="No." width="50">
<el-button size="mini" @click="handleEdit(scope.$index, scope.row)">Update</el-button>
<el-button type="text" slot-scope="scope" @click="(event) => { BookingStatus(scope.row.status, scope.row.booking_no) }"> {{scope.row.booking_no}}</el-button>
<el-button type="text" slot-scope="scope" @click="(event) => { BookingStatus(scope.row.status, scope.row.id) }"> {{scope.row.id}}</el-button>
</el-table-column>
<el-table-column label="Date" prop="date" width="120" sortable/>
<el-table-column label="DateTime" prop="created_at" width="180" sortable/>
<!-- <el-table-column label="Term" :filters="[{text: 'X1', value: 'X1'}, {text: 'X2', value: 'X2'}]" :filter-method="filterHandler">
</el-table-column> -->
<el-table-column label="Rate" width="74" prop="rate" />
@@ -354,8 +354,8 @@
dialogFormVisible1: false,
formLabelWidth: '0px',
bookingTable: [{
date: '12/1/2018',
booking_no: '12',
created_at: '12/1/2018',
id: '12',
rate: '1.23',
amount: 'RM 1000',
transfer_amount: 'RMB 10000',
@@ -365,8 +365,8 @@
status: 2
},
{
date: '12/1/2018',
booking_no: '13',
created_at: '12/1/2018',
id: '13',
rate: '1.23',
amount: 'RM 1000',
transfer_amount: 'RMB 10000',
@@ -376,8 +376,8 @@
status: 3
},
{
date: '12/1/2018',
booking_no: '14',
created_at: '12/1/2018',
id: '14',
rate: '1.23',
amount: 'RM 1000',
transfer_amount: 'RMB 10000',
@@ -387,8 +387,8 @@
status: 4
},
{
date: '12/1/2018',
booking_no: '15',
created_at: '12/1/2018',
id: '15',
rate: '1.23',
amount: 'RM 1000',
transfer_amount: 'RMB 10000',
@@ -398,8 +398,8 @@
status: 5
},
{
date: '12/1/2018',
booking_no: '16',
created_at: '12/1/2018',
id: '16',
rate: '1.23',
amount: 'RM 1000',
transfer_amount: 'RMB 10000',
@@ -409,8 +409,8 @@
status: 6
},
{
date: '12/1/2018',
booking_no: '17',
created_at: '12/1/2018',
id: '17',
rate: '1.23',
amount: 'RM 1000',
transfer_amount: 'RMB 10000',
@@ -437,8 +437,9 @@
axios
.get('/api/booking/')
.then((response) => {
this.bookingTable = response
console.log(response)
this.bookingTable = response.data
// this.booking.amount = response.data.amount
// this.booking.bankin_amount = response.data.bia
// this.booking.timeout = response.data.timeout * 1000
+4 -4
View File
@@ -11,10 +11,10 @@
|
*/
Route::get('/', 'WelcomeController@index');
//Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.request');
//Route::post('password/reset', 'Auth\ResetPasswordController@postReset')->name('password.reset');
//Route::get('{path}', 'WelcomeController@index')->where('path', '(.*)');
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.request');
Route::post('password/reset', 'Auth\ResetPasswordController@postReset')->name('password.reset');
Route::get('{path}', 'WelcomeController@index')->where('path', '(.*)');
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
//Route::get('/home', 'WelcomeController@index')->name('home');