TBD calculation feature

updated bookingconfirmationTable frontend
This commit is contained in:
Jack Goh
2018-06-15 18:54:03 +08:00
parent eeaffe9018
commit a449d4f30c
3 changed files with 128 additions and 27 deletions
+49 -2
View File
@@ -35,10 +35,10 @@ class BookingController extends Controller
$rate = $rates->x2_ba;
break;
default:
return Response::json(array(
return response()->json([
'success' => false,
'message' => 'Invalid input',
), 422);
], 422);
break;
}
@@ -117,4 +117,51 @@ class BookingController extends Controller
}
// TODO : cancel booking feature
// TODO : get calculation
public function calculation(Request $request){
$amount = $request->input('amount');
$term = $request->input('term');
$rates = Rate::all()->last();
switch ($term) {
case "x1_cash":
$rate = $rates->x1_cash;
break;
case "x1_cheque":
$rate = $rates->x1_cheque;
break;
case "x1_ba":
$rate = $rates->x1_ba;
break;
case "x2_cash":
$rate = $rates->x2_cash;
break;
case "x2_cheque":
$rate = $rates->x2_cheque;
break;
case "x2_ba":
$rate = $rates->x2_ba;
break;
default:
return response()->json([
'success' => false,
'message' => 'Invalid input',
], 422);
break;
}
return $rate;
// order number
// date
// customer marking
// payment method
// CNY RMB
// Service charge
// Rate
// Total before GST
}
}
+78 -25
View File
@@ -144,7 +144,7 @@
<el-form :model="bookingForm" :rules="rules" ref="bookingForm">
<div align="center">
<el-form-item prop="account_name">
<el-input v-model="bookingForm.account_name" placeholder="China Beneficiary Account" style="width: 80%" required="true"/>
<el-input v-model="bookingForm.account_name" placeholder="China Beneficiary Account" style="width: 80%" required="true" />
</el-form-item>
<el-form-item prop="bank_name">
<el-input v-model="bookingForm.bank_name" type="text" placeholder="Bank Name / AliPay / WechatPay" style="width: 80%" />
@@ -169,12 +169,58 @@
<el-dialog :visible.sync="dialogFormVisible1" title="Booking Confirmation" :fullscreen="true" center>
<!-- Table_booking_confirmation -->
<el-table :data="bookingConfirmTable" align="center">
<!-- <el-table :data="bookingConfirmTable" align="center">
<el-table-column prop="data1" align="right" width="200" />
<el-table-column prop="data2" align="left" width="200" />
</el-table>
</el-table> -->
<!-- Table_booking_confirmation-end -->
<table class="table-responsive el-table" style="display:table; width:80%; margin: 0 auto;" >
<tbody>
<tr>
<td class="el-table_2_column_9 is-right ">Date : </td>
<td class="el-table_2_column_9 is-left ">&nbsp;&nbsp;123</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right ">Customer Marking : </td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp;123</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right ">Payment Method : </td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp;123</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right ">CNY/RMB : </td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp;123</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right ">+ Service Charge : </td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp;123</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right "> RATE :</td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp;123</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right "> </td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp;RM 12,000</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right "> </td>
<td width="200" class="el-table_2_column_9 is-left "></td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right ">China Beneficiary Acc :</td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp; 123123</td>
</tr>
<tr>
<td width="200" class="el-table_2_column_9 is-right ">Bank in Amoint :</td>
<td width="200" class="el-table_2_column_9 is-left ">&nbsp;&nbsp; <b>123123</b></td>
</tr>
</tbody>
</table>
<span slot="footer" class="dialog-footer">
<!-- <el-button @click="dialogFormVisible = false">Cancel</el-button> -->
<el-button type="primary" @click="createBooking">Confirm</el-button>
@@ -248,7 +294,7 @@
data() {
return {
status: '',
booking:{
booking: {
amount: ''
},
bookingForm: {
@@ -259,21 +305,31 @@
account_num: ''
},
rules: {
amount: [
{ required: true, message: 'Please input amount', trigger: 'change' },
],
bank_name: [
{ required: true, message: 'Please input bank name', trigger: 'change' },
],
account_name: [
{ required: true, message: 'Please input account name', trigger: 'change' }
],
bank_branch: [
{ required: true, message: 'Please input branch', trigger: 'change' }
],
account_num: [
{ required: true, message: 'Please input account number', trigger: 'change' }
]
amount: [{
required: true,
message: 'Please input amount',
trigger: 'change'
}, ],
bank_name: [{
required: true,
message: 'Please input bank name',
trigger: 'change'
}, ],
account_name: [{
required: true,
message: 'Please input account name',
trigger: 'change'
}],
bank_branch: [{
required: true,
message: 'Please input branch',
trigger: 'change'
}],
account_num: [{
required: true,
message: 'Please input account number',
trigger: 'change'
}]
},
term: '',
options1: [{
@@ -350,9 +406,6 @@
}
],
bookingConfirmTable: [{
data1: 'Order Number :',
data2: '001'
}, {
data1: 'Date :',
data2: '25/5/2018'
}, {
@@ -431,7 +484,7 @@
this.term = newterm
},
getCalculationValue(formName) {
this.$refs[formName].validate((valid) => {
this.$refs[formName].validate((valid) => {
if (valid) {
this.dialogFormVisible = false
this.dialogFormVisible1 = true
@@ -479,13 +532,13 @@
// TODO : Get booking status from server
this.status = 6
switch (this.status) {
case 1:
this.$router.push({
name: 'booking.user.upload'
})
case 2:
this.$router.push({
name: 'booking.user.upload'
+1
View File
@@ -27,6 +27,7 @@ Route::get('/booking/{book_id}', 'BookingController@show');
Route::post('/booking', 'BookingController@store');
Route::put('/booking/{book_id}', 'BookingController@update');
Route::delete('/booking/{book_id}', 'BookingController@delete');
Route::post('/booking/calculation', 'BookingController@calculation');
//Route::middleware('auth:api')->get('/user', function (Request $request) {