fixed retrive po path in booking controller

updated chinabankslip error message to be more clear
fixed supplier booking report loading button
updated upload invoice frontend to show user po image
This commit is contained in:
Jack Goh
2018-06-28 15:07:41 +08:00
parent 0cf92b9936
commit 105b61eab3
6 changed files with 18 additions and 11 deletions
+6 -2
View File
@@ -441,7 +441,11 @@ class BookingController extends Controller
$booking = Booking::where('id',$id)->first();
$user_po = $booking->purchaseOrder()->first();
return response()->json(['po_path'=> $user_po],200);
if($user_po){
return response()->json(['user_po_path'=> $user_po->image_path ],200);
}
return response()->json(['message'=> 'waiting customer to upload their po'],400);
}
public function delete(Booking $book_id)
@@ -593,7 +597,7 @@ class BookingController extends Controller
//upload
public function uploadInvoice(Request $request, $id)
{
$booking = Booking::where('user_id',Auth::user()->id)->where('id',$id)->first();
$booking = Booking::where('id',$id)->first();
/* Validation */
if (!$booking)
@@ -131,4 +131,6 @@ class BookingSupplierController extends Controller
}
}
@@ -68,7 +68,7 @@ class ChinaBankSlipController extends Controller
// TODO: first or fail
if(!$china_bankslip){
return response()->json(["message"=> "not found"],400);
return response()->json(["message"=> "China bankslip not found. Please upload first."],400);
}
$china_bankslip->actual_transfer_amount = $request->input('actual_transfer_amount');
@@ -285,6 +285,7 @@
methods: {
completeReport(){
// TODO : send request to change status
this.loading_btn = true
axios
.post('/api/booking/' + this.$route.params.id + '/confirm-supplier')
.then((response) => {
@@ -308,6 +309,8 @@
})
})
this.loading_btn = false
this.$router.push({
name: 'booking.admin.cnslip',
params: {id: this.$route.params.id }
@@ -361,7 +361,7 @@
.then((response) => {
this.$message({
showClose: true,
message: 'Your bankinslip has been submitted, please wait admin to approve.',
message: 'Your bankinslip has been submitted, please wait customer to upload their purchase order.',
type: 'success',
duration: 5000
})
@@ -5,7 +5,7 @@
<div align="center">
<h4 style="margin-top:5%;"></h4>
<br>
<div v-if="po_status">
<div v-if="user_po_path">
<h4>Upload Invoice</h4>
</div>
<div v-else>
@@ -237,9 +237,8 @@
</div>
<el-row :gutter="12" type="flex">
<el-col :span="12">
<a href="https://placeholder.com">
<img width="100%" height="100%" src="http://via.placeholder.com/700x800">
</a>
<img v-bind:src="user_po_path" width="100%" height="100%">
<img v-bind:src="booking_details.user_bankslip_path" class="image">
</el-col>
</el-row>
</el-card>
@@ -264,8 +263,8 @@
return {
status: 6,
loading_btn: false,
po_status: null,
booking_id: this.$route.params.id,
user_po_path: null,
booking_details: {
id: null,
amount: null,
@@ -334,7 +333,6 @@
axios
.get('/api/admin/booking/' + this.$route.params.id)
.then((response) => {
loading.close()
this.booking_details = response.data
}).catch((error) => {
console.log(error)
@@ -348,7 +346,7 @@
.get('/api/booking/'+ this.$route.params.id +'/po')
.then((response) => {
loading.close()
this.supplier_options = response.data
this.user_po_path = response.user_po_path
}).catch((error) => {
loading.close()
console.log(error)