fix edit supplier booking

fix done supplier booking report button loading
This commit is contained in:
Jack Goh
2018-06-29 15:48:26 +08:00
parent 9d0aadb5c3
commit 7aba4e2b05
3 changed files with 14 additions and 12 deletions
@@ -49,11 +49,6 @@ class BookingSupplierController extends Controller
$rate = $request->input('rate'); $rate = $request->input('rate');
$rebate = $request->input('rebate'); $rebate = $request->input('rebate');
if ($supplierbooking = SupplierBooking::where('book_id', $booking_id)->first()){
return response()->json(['success'=>false, 'message'=>'Bad request, please contact support'], 400);
}
// Calculation // Calculation
$amountInRMB = $transfer_amount * $rate; $amountInRMB = $transfer_amount * $rate;
$billing = 0.015 * $transfer_amount; $billing = 0.015 * $transfer_amount;
@@ -66,7 +61,14 @@ class BookingSupplierController extends Controller
$supplier = SettingSupplier::find($supplier_id); $supplier = SettingSupplier::find($supplier_id);
$booking = Booking::find($booking_id); $booking = Booking::find($booking_id);
$bookingsupplier = new SupplierBooking(); // update existing booking supplier if exist
$bookingsupplier = SupplierBooking::where('book_id', $booking_id)->first();
if (!$bookingsupplier){
$bookingsupplier = new SupplierBooking();
}
$bookingsupplier->supplier_id = $supplier->id; $bookingsupplier->supplier_id = $supplier->id;
$bookingsupplier->payment_method = $request->input('payment_method'); $bookingsupplier->payment_method = $request->input('payment_method');
$bookingsupplier->transfer_amount = $transfer_amount; $bookingsupplier->transfer_amount = $transfer_amount;
@@ -90,7 +92,7 @@ class BookingSupplierController extends Controller
public function update(Request $request, $id) public function update(Request $request, $id)
{ {
$bookingsupplier = BSupplierBooking::find($id); $bookingsupplier = SupplierBooking::find($id);
$bookingsupplier->payment_method = $request->input('payment_method'); $bookingsupplier->payment_method = $request->input('payment_method');
$bookingsupplier->transfer_amount = $request->input('transfer_amount'); $bookingsupplier->transfer_amount = $request->input('transfer_amount');
$bookingsupplier->rate = $request->input('rate'); $bookingsupplier->rate = $request->input('rate');
@@ -300,11 +300,9 @@
axios axios
.get('/api/admin/booking/' + this.$route.params.id) .get('/api/admin/booking/' + this.$route.params.id)
.then((response) => { .then((response) => {
loading.close()
this.booking_details = response.data this.booking_details = response.data
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
loading.close()
this.$router.push({ this.$router.push({
name: 'notfound' name: 'notfound'
}) })
@@ -221,7 +221,7 @@
<el-card class="box-card"> <el-card class="box-card">
<el-row :gutter="12"> <el-row :gutter="12">
<el-col :span="22" style="text-align:center"> <el-col :span="22" style="text-align:center">
<el-button :loading="loading_btn" @click="editReport" type="primary">Edit</el-button> <el-button :loading="loading_btn" @click="$router.go(-1)" type="primary">Edit</el-button>
<el-button :loading="loading_btn" @click="completeReport" type="success">Done</el-button> <el-button :loading="loading_btn" @click="completeReport" type="success">Done</el-button>
</el-col> </el-col>
</el-row> </el-row>
@@ -289,6 +289,7 @@
axios axios
.post('/api/booking/' + this.$route.params.id + '/confirm-supplier') .post('/api/booking/' + this.$route.params.id + '/confirm-supplier')
.then((response) => { .then((response) => {
this.loading_btn = false
this.$message({ this.$message({
showClose: true, showClose: true,
message: 'Success, please comeback after getting china bankslip', message: 'Success, please comeback after getting china bankslip',
@@ -300,6 +301,7 @@
}) })
//this.booking_details = response.data //this.booking_details = response.data
}).catch((error) => { }).catch((error) => {
this.loading_btn = false
console.log(error) console.log(error)
this.$message({ this.$message({
showClose: true, showClose: true,
@@ -309,7 +311,7 @@
}) })
}) })
this.loading_btn = false
this.$router.push({ this.$router.push({
name: 'booking.admin.cnslip', name: 'booking.admin.cnslip',