mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 12:24:09 +00:00
Add admin page 1. show error when upload wrong file in upload po and invoice
This commit is contained in:
@@ -452,16 +452,16 @@ class BookingController extends Controller
|
||||
/* Validation */
|
||||
if (!$booking)
|
||||
{
|
||||
return response()->json(['message'=>'Access denied'], 200);
|
||||
return response()->json(['message'=>'Access denied'], 403);
|
||||
}
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
'file' => 'image|mimes:jpg,jpeg,bmp,png,xls,xlsx,doc,docx,pdf'
|
||||
'file' => 'mimes:jpg,jpeg,bmp,png,xls,xlsx,doc,docx,pdf'
|
||||
]);
|
||||
|
||||
if($validator->fails())
|
||||
{
|
||||
return response()->json(['message'=>'Incorrect format'],200);
|
||||
return response()->json(['message'=>'Incorrect format'],400);
|
||||
}
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
@@ -475,7 +475,7 @@ class BookingController extends Controller
|
||||
|
||||
if(!$user_input_file = $request->file('file'))
|
||||
{
|
||||
return response()->json(['message' => 'No file detected'], 400);
|
||||
return response()->json(['message' => 'No file detected'], 404);
|
||||
}
|
||||
/* End Validation */
|
||||
|
||||
@@ -495,7 +495,8 @@ class BookingController extends Controller
|
||||
$user_po->save();
|
||||
|
||||
$booking->status = 6;
|
||||
$booking->admin_status = 7;
|
||||
// $booking->admin_status = 7;
|
||||
$booking->admin_status = 6;
|
||||
$booking->save();
|
||||
|
||||
return response()->json(['message'=>'Success'],200);
|
||||
@@ -678,16 +679,16 @@ class BookingController extends Controller
|
||||
/* Validation */
|
||||
if (!$booking)
|
||||
{
|
||||
return response()->json(['message'=>'Access denied'], 200);
|
||||
return response()->json(['message'=>'Access denied'], 403);
|
||||
}
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
'invoice_path' => 'mimes:jpg,jpeg,bmp,png,pdf,doc,docx'
|
||||
'invoice_path' => 'mimes:jpg,jpeg,bmp,png,xls,xlsx,doc,docx,pdf'
|
||||
]);
|
||||
|
||||
if($validator->fails())
|
||||
{
|
||||
return response()->json(['message'=>'Incorrect format'],200);
|
||||
return response()->json(['message'=>'Incorrect format'],400);
|
||||
}
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
|
||||
@@ -0,0 +1,262 @@
|
||||
<template>
|
||||
<el-main>
|
||||
<progress-track v-model="trackerConfig" />
|
||||
|
||||
<div align="center">
|
||||
<h4 style="margin-top:5%;"></h4>
|
||||
<h5>Waiting User Upload Bank Slip</h5>
|
||||
<br/>
|
||||
<el-button type="primary" @click="$router.go(-1)">Go Back</el-button>
|
||||
</div>
|
||||
<br>
|
||||
<el-row justify="center" align="center">
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>Order Details</span>
|
||||
<!-- <el-button style="float: right; padding: 3px 0" type="text">Operation button</el-button> -->
|
||||
</div>
|
||||
<div class="el-row" style="margin-left: -6px; margin-right: -6px;">
|
||||
<div class="el-col el-col-12" style="padding-left: 6px; padding-right: 6px;">
|
||||
<div class="el-table el-table--fit el-table--enable-row-hover el-table--enable-row-transition" align="center">
|
||||
|
||||
<div class="el-table__body-wrapper is-scrolling-none">
|
||||
<table class="el-table__body" style="width: 400px;" cellspacing="0" cellpadding="0" border="0">
|
||||
<colgroup>
|
||||
<col name="el-table_2_column_9" width="200">
|
||||
<col name="el-table_2_column_10" width="200">
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr class="el-table__row">
|
||||
<td class="el-table_2_column_9 is-right ">
|
||||
<div class="cell">Order Number :</div>
|
||||
</td>
|
||||
<td class="el-table_2_column_10 is-left ">
|
||||
<div class="cell">{{ booking_details.id }}</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="el-table__row">
|
||||
<td class="el-table_2_column_9 is-right ">
|
||||
<div class="cell">Date :</div>
|
||||
</td>
|
||||
<td class="el-table_2_column_10 is-left ">
|
||||
<div class="cell">{{ booking_details.created_at }}</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="el-table__row">
|
||||
<td class="el-table_2_column_9 is-right ">
|
||||
<div class="cell">Customer Marking :</div>
|
||||
</td>
|
||||
<td class="el-table_2_column_10 is-left ">
|
||||
<div class="cell">{{ booking_details.marking }}</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="el-table__row">
|
||||
<td class="el-table_2_column_9 is-right ">
|
||||
<div class="cell"></div>
|
||||
</td>
|
||||
<td class="el-table_2_column_10 is-left ">
|
||||
<div class="cell"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="el-table__row">
|
||||
<td class="el-table_2_column_9 is-right ">
|
||||
<div class="cell">Term :</div>
|
||||
</td>
|
||||
<td class="el-table_2_column_10 is-left ">
|
||||
<div class="cell">{{ booking_details.term }}</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="el-table__row">
|
||||
<td class="el-table_2_column_9 is-right ">
|
||||
<div class="cell"></div>
|
||||
</td>
|
||||
<td class="el-table_2_column_10 is-left ">
|
||||
<div class="cell"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<!---->
|
||||
</tbody>
|
||||
</table>
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
<div class="el-table__column-resize-proxy" style="display: none;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="el-col el-col-12" style="padding-left: 6px; padding-right: 6px;">
|
||||
<div class="el-table el-table--fit el-table--enable-row-hover el-table--enable-row-transition" align="center">
|
||||
<div class="hidden-columns">
|
||||
<div></div>
|
||||
<div></div>
|
||||
</div>
|
||||
<!---->
|
||||
<div class="el-table__body-wrapper is-scrolling-none">
|
||||
<table class="el-table__body" style="width: 400px;" cellspacing="0" cellpadding="0" border="0">
|
||||
<colgroup>
|
||||
<col name="el-table_3_column_11" width="200">
|
||||
<col name="el-table_3_column_12" width="200">
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr class="el-table__row">
|
||||
<td class="el-table_3_column_11 is-right ">
|
||||
<div class="cell">CNY/RMB :</div>
|
||||
</td>
|
||||
<td class="el-table_3_column_12 is-left ">
|
||||
<div class="cell">CNY {{ booking_details.amount }}</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="el-table__row">
|
||||
<td class="el-table_3_column_11 is-right ">
|
||||
<div class="cell">+ Service Charge :</div>
|
||||
</td>
|
||||
<td class="el-table_3_column_12 is-left ">
|
||||
<div class="cell">CNY {{ booking_details.service_charge }}</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="el-table__row">
|
||||
<td class="el-table_3_column_11 is-right ">
|
||||
<div class="cell">/ RATE :</div>
|
||||
</td>
|
||||
<td class="el-table_3_column_12 is-left ">
|
||||
<div class="cell">{{ booking_details.rate }}</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="el-table__row">
|
||||
<td class="el-table_3_column_11 is-right ">
|
||||
<div class="cell"></div>
|
||||
</td>
|
||||
<td class="el-table_3_column_12 is-left ">
|
||||
<div class="cell">MYR {{ booking_details.bia }}</div>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- <tr class="el-table__row">
|
||||
<td class="el-table_3_column_11 is-right ">
|
||||
<div class="cell">+ GST 6% :</div>
|
||||
</td>
|
||||
<td class="el-table_3_column_12 is-left ">
|
||||
<div class="cell">MYR 4,430.88</div>
|
||||
</td>
|
||||
</tr> -->
|
||||
<tr class="el-table__row">
|
||||
<td class="el-table_3_column_11 is-right ">
|
||||
<div class="cell"></div>
|
||||
</td>
|
||||
<td class="el-table_3_column_12 is-left ">
|
||||
<div class="cell">
|
||||
<b>MYR {{ booking_details.bia }}</b>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="el-table__row">
|
||||
<td class="el-table_3_column_11 is-right ">
|
||||
<div class="cell"></div>
|
||||
</td>
|
||||
<td class="el-table_3_column_12 is-left ">
|
||||
<div class="cell"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<!---->
|
||||
</tbody>
|
||||
</table>
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
<div class="el-table__column-resize-proxy" style="display: none;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <el-row :gutter="12">
|
||||
<el-col :span="12">
|
||||
<el-table :data="bookingConfirmTable" :show-header="false" align="center">
|
||||
<el-table-column prop="data1" align="right" width="200" />
|
||||
<el-table-column prop="data2" align="left" width="200" />
|
||||
</el-table>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-table :data="bookingConfirmTable2" :show-header="false" align="center">
|
||||
<el-table-column prop="data1" align="right" width="200" />
|
||||
<el-table-column prop="data2" align="left" width="200" />
|
||||
</el-table>
|
||||
</el-col>
|
||||
</el-row> -->
|
||||
</el-card>
|
||||
</el-row>
|
||||
<br>
|
||||
|
||||
</el-main>
|
||||
</template>
|
||||
<style>
|
||||
.booking-details {
|
||||
font-weight: bold;
|
||||
}
|
||||
.image {
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 150px;
|
||||
display: block;
|
||||
}
|
||||
.image:hover {
|
||||
box-shadow: 0 0 2px 1px rgba(0, 140, 186, 0.5);
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
import ProgressTrack from '~/components/AdminProgressTrack'
|
||||
import axios from 'axios'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
'progress-track': ProgressTrack
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
trackerConfig :{
|
||||
status: 1,
|
||||
term: null
|
||||
},
|
||||
loading_btn: false,
|
||||
rejectDialogVisible: false,
|
||||
reject_reason: null,
|
||||
booking_details: {
|
||||
id: null,
|
||||
amount: null,
|
||||
bia: null,
|
||||
user_bankslip_path: null,
|
||||
},
|
||||
estimated_arrival_time: null,
|
||||
}
|
||||
},
|
||||
beforeCreate() {
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: 'Please wait..',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
|
||||
axios
|
||||
.get('/api/admin/booking/' + this.$route.params.id)
|
||||
.then((response) => {
|
||||
this.booking_details = response.data;
|
||||
this.trackerConfig.term = response.data.term;
|
||||
loading.close()
|
||||
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
loading.close()
|
||||
this.$router.push({
|
||||
name: 'notfound'
|
||||
})
|
||||
})
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -192,6 +192,7 @@
|
||||
<!-- upload image -->
|
||||
<el-upload :action="'/api/booking/' + booking_id + '/upload-invoice'" :on-exceed="handleExceed" :on-preview="handlePreview"
|
||||
:on-remove="handleRemove"
|
||||
:on-error="uploadError"
|
||||
class="upload-demo"
|
||||
drag
|
||||
multiple>
|
||||
@@ -199,7 +200,7 @@
|
||||
<div class="el-upload__text">Drop file here or
|
||||
<em>click to upload</em>
|
||||
</div>
|
||||
<div slot="tip" class="el-upload__tip">jpg/png/pdf files with a size less than 3mb</div>
|
||||
<div slot="tip" class="el-upload__tip">bmp/jpeg/jpg/png/pdf/xls/xlxs/doc/docx files with a size less than 3mb</div>
|
||||
</el-upload>
|
||||
|
||||
<br>
|
||||
@@ -369,12 +370,16 @@
|
||||
},
|
||||
handleRemove(file, fileList) {
|
||||
console.log(file, fileList);
|
||||
// Should send some reqeust to controller to delete the file
|
||||
},
|
||||
handlePreview(file) {
|
||||
console.log(file);
|
||||
},
|
||||
handleExceed(file){
|
||||
console.log(file)
|
||||
},
|
||||
uploadError(file,fileList){
|
||||
this.$message.warning(`Incorrect file format or file size too big.`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ export default {
|
||||
switch (this.status) {
|
||||
case 1:
|
||||
this.$router.push({
|
||||
name: 'booking.admin.pending',
|
||||
name: 'booking.admin.booking.detail',
|
||||
params: {id: booking_id }
|
||||
})
|
||||
break
|
||||
|
||||
@@ -20,9 +20,10 @@
|
||||
|
||||
<!-- upload image -->
|
||||
<el-upload :action="'/api/booking/' + booking_id + '/upload-po'" :on-exceed="handleExceed" :on-preview="handlePreview"
|
||||
accept=".jpeg, .jpg, .png, .bmp, .doc, .docx, .xls, .xlsx, .pdf"
|
||||
:on-remove="handleRemove"
|
||||
:on-error="uploadError"
|
||||
class="upload-demo"
|
||||
accept=".jpeg, .jpg, .png, .bmp, .doc, .docx, .xls, .xlsx, .pdf"
|
||||
drag
|
||||
multiple>
|
||||
<i class="el-icon-upload"/>
|
||||
@@ -308,8 +309,6 @@ export default {
|
||||
axios
|
||||
.post('/api/booking/' + this.$route.params.id + '/confirm-po')
|
||||
.then((response) => {
|
||||
console.log(12);
|
||||
console.log(response);
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Your PO has been uploaded. We are processing the Invoice.',
|
||||
@@ -332,6 +331,7 @@ export default {
|
||||
},
|
||||
handleRemove (file, fileList) {
|
||||
console.log(file, fileList)
|
||||
// Should send some reqeust to controller to delete the file
|
||||
},
|
||||
handlePreview (file) {
|
||||
console.log(file)
|
||||
@@ -341,6 +341,9 @@ export default {
|
||||
},
|
||||
beforeRemove (file, fileList) {
|
||||
return this.$confirm(`确定移除 ${file.name}?`)
|
||||
},
|
||||
uploadError(file,fileList){
|
||||
this.$message.warning(`Incorrect file format or file size too big.`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ const Completed = () => import('~/pages/booking/completed').then(m => m.default
|
||||
const PurchaseOrder = () => import('~/pages/booking/po').then(m => m.default || m)
|
||||
|
||||
// Admin booking
|
||||
const BookingDetail = () => import('~/pages/admin/booking/bookingDetail').then(m => m.default || m)
|
||||
const Verification = () => import('~/pages/admin/booking/verification').then(m => m.default || m)
|
||||
const Supplier = () => import('~/pages/admin/booking/supplierBooking').then(m => m.default || m)
|
||||
const SupplierReport = () => import('~/pages/admin/booking/supplierReport').then(m => m.default || m)
|
||||
@@ -72,6 +73,7 @@ export default [
|
||||
{ path: '/booking/:id/complete', name: 'booking.user.complete', component: Completed },
|
||||
|
||||
// Admin booking
|
||||
{ path: '/booking/:id/booking-detail', name: 'booking.admin.booking.detail', component: BookingDetail },
|
||||
{ path: '/booking/:id/verification', name: 'booking.admin.verification', component: Verification },
|
||||
{ path: '/booking/:id/supplier', name: 'booking.admin.supplier', component: Supplier },
|
||||
{ path: '/booking/:id/supplier-report', name: 'booking.admin.supplier.report', component: SupplierReport },
|
||||
|
||||
Reference in New Issue
Block a user