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
@@ -48,11 +48,6 @@ class BookingSupplierController extends Controller
$booking_id = $request->input("booking_id");
$rate = $request->input('rate');
$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
$amountInRMB = $transfer_amount * $rate;
@@ -66,7 +61,14 @@ class BookingSupplierController extends Controller
$supplier = SettingSupplier::find($supplier_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->payment_method = $request->input('payment_method');
$bookingsupplier->transfer_amount = $transfer_amount;
@@ -90,7 +92,7 @@ class BookingSupplierController extends Controller
public function update(Request $request, $id)
{
$bookingsupplier = BSupplierBooking::find($id);
$bookingsupplier = SupplierBooking::find($id);
$bookingsupplier->payment_method = $request->input('payment_method');
$bookingsupplier->transfer_amount = $request->input('transfer_amount');
$bookingsupplier->rate = $request->input('rate');
@@ -299,12 +299,10 @@
axios
.get('/api/admin/booking/' + this.$route.params.id)
.then((response) => {
loading.close()
.then((response) => {
this.booking_details = response.data
}).catch((error) => {
console.log(error)
loading.close()
this.$router.push({
name: 'notfound'
})
@@ -221,7 +221,7 @@
<el-card class="box-card">
<el-row :gutter="12">
<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-col>
</el-row>
@@ -289,6 +289,7 @@
axios
.post('/api/booking/' + this.$route.params.id + '/confirm-supplier')
.then((response) => {
this.loading_btn = false
this.$message({
showClose: true,
message: 'Success, please comeback after getting china bankslip',
@@ -300,6 +301,7 @@
})
//this.booking_details = response.data
}).catch((error) => {
this.loading_btn = false
console.log(error)
this.$message({
showClose: true,
@@ -309,7 +311,7 @@
})
})
this.loading_btn = false
this.$router.push({
name: 'booking.admin.cnslip',