remove date option in supplier report. upload china bankslip detail should be optional. make accept for uploadpurchaseorder - frontend only

This commit is contained in:
weiweitoo
2018-07-17 16:31:37 +08:00
parent e92e9b551f
commit 8c31bcc420
4 changed files with 93 additions and 97 deletions
+3 -2
View File
@@ -456,7 +456,7 @@ class BookingController extends Controller
}
$validator = Validator::make($request->all(), [
'file' => 'image|mimes:jpg,jpeg,bmp,png'
'file' => 'image|mimes:jpg,jpeg,bmp,png,xls,xlsx,doc,docx,pdf'
]);
if($validator->fails())
@@ -470,7 +470,7 @@ class BookingController extends Controller
if($validator->fails())
{
return response()->json(['message'=>'Image too large, upload files up to 3 MB'], 400);
return response()->json(['message'=>'File too large, upload files up to 3 MB'], 400);
}
if(!$user_input_file = $request->file('file'))
@@ -739,6 +739,7 @@ class BookingController extends Controller
$booking = Booking::where('user_id',Auth::user()->id)->where('id',$id)->first();
$purchase_order = $booking->purchaseOrder()->first();
return($purchase_order);
if(!$purchase_order){
return response()->json(["message"=> "Please upload your purchase order"],400);
@@ -213,10 +213,10 @@
<br>
<!-- upload image end -->
<el-form-item prop="date">
<!-- <el-form-item prop="date">
<el-date-picker v-model="chinaSlipForm.date" type="date" placeholder="Pick a day" :picker-options="pickerOptions1">
</el-date-picker>
</el-form-item>
</el-form-item> -->
<el-form-item prop="actual_transfer_amount">
<el-input v-model="chinaSlipForm.actual_transfer_amount" type="text" placeholder="Amount" style="width: 80%" />
</el-form-item>
@@ -266,7 +266,7 @@
supplier_options: null,
chinaSlipForm: {
actual_transfer_amount: null,
date: null,
// date: null,
details: null,
},
rules: {
@@ -275,42 +275,42 @@
message: 'Please input transfer amount',
trigger: 'change'
}],
date: [{
required: true,
message: 'Please input date',
trigger: 'change'
}],
details: [{
required: true,
message: 'Please input details',
trigger: 'change'
}]
// date: [{
// required: true,
// message: 'Please input date',
// trigger: 'change'
// }],
// details: [{
// required: true,
// message: 'Please input details',
// trigger: 'change'
// }]
},
pickerOptions1: {
disabledDate(time) {
return time.getTime() > Date.now();
},
shortcuts: [{
text: 'Today',
onClick(picker) {
picker.$emit('pick', new Date());
}
}, {
text: 'Yesterday',
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24);
picker.$emit('pick', date);
}
}, {
text: 'A week ago',
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit('pick', date);
}
}]
}
// pickerOptions1: {
// disabledDate(time) {
// return time.getTime() > Date.now();
// },
// shortcuts: [{
// text: 'Today',
// onClick(picker) {
// picker.$emit('pick', new Date());
// }
// }, {
// text: 'Yesterday',
// onClick(picker) {
// const date = new Date();
// date.setTime(date.getTime() - 3600 * 1000 * 24);
// picker.$emit('pick', date);
// }
// }, {
// text: 'A week ago',
// onClick(picker) {
// const date = new Date();
// date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
// picker.$emit('pick', date);
// }
// }]
// }
}
},
beforeCreate() {
+10 -8
View File
@@ -20,15 +20,16 @@
<!-- upload image -->
<el-upload :action="'/api/booking/' + booking_id + '/upload-po'" :on-exceed="handleExceed" :on-preview="handlePreview"
:on-remove="handleRemove"
class="upload-demo"
drag
multiple>
accept=".jpeg, .jpg, .png, .bmp, .doc, .docx, .xls, .xlsx, .pdf"
:on-remove="handleRemove"
class="upload-demo"
drag
multiple>
<i class="el-icon-upload"/>
<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>
@@ -65,7 +66,7 @@
<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-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">
@@ -307,7 +308,8 @@ export default {
axios
.post('/api/booking/' + this.$route.params.id + '/confirm-po')
.then((response) => {
console.log(response)
console.log(12);
console.log(response);
this.$message({
showClose: true,
message: 'Your PO has been uploaded. We are processing the Invoice.',
@@ -321,7 +323,7 @@ export default {
}).catch((error) => {
this.$message({
showClose: true,
message: 'Please upload purchase order',
message: "Please upload your purchase order",
type: 'error',
duration: 30000
})
@@ -168,7 +168,6 @@ export default {
}
this.start = true
loading.close()
if (this.booking.timeout < 0){
this.$message({
@@ -182,15 +181,49 @@ export default {
})
}
}).catch((error) => {
console.log(error)
loading.close()
this.$router.push({
name: 'notfound'
this.$router.push({
name: 'notfound'
})
console.log(error)
})
})
},
beforeMount(){
this.updateBankDetail();
axios.get('/api/active-bank')
.then((response) => {
this.active_bank_setting = response.data;
console.log(this.active_bank_setting.x1_bank_id);
var url = '';
if(this.booking.term === 'x1_cash' || this.booking.term === 'x1_cheque' ||this.booking.term === 'x1_ba'){
url = '/api/malaysia-bank/' + this.active_bank_setting.x1_bank_id;
}
else if(this.booking.term === 'x2_cash' || this.booking.term === 'x2_cheque' ||this.booking.term === 'x2_ba'){
url = '/api/malaysia-bank/' + this.active_bank_setting.x2_bank_id;
}
axios.get(url)
.then((response) => {
this.bankDetail = response.data;
loading.close()
})
.catch((error) => {
loading.close()
console.log(error);
this.$message({
showClose: true,
message: 'Fetch data fail',
type: 'error',
duration: 10000
});
});
})
.catch((error) => {
console.log(error);
this.$message({
showClose: true,
message: 'Fetch data fail',
type: 'error',
duration: 10000
});
});
},
methods: {
handleCoutdownend () {
@@ -255,46 +288,6 @@ export default {
},
startTimer () {
this.start = true;
},
updateBankDetail(){
axios.get('/api/active-bank')
.then((response) => {
this.active_bank_setting = response.data;
console.log(this.active_bank_setting.x1_bank_id);
this.getBankDetailWithTerm();
})
.catch((error) => {
console.log(error);
this.$message({
showClose: true,
message: 'Fetch data fail',
type: 'error',
duration: 10000
});
});
},
getBankDetailWithTerm(){
var url = '';
if(this.booking.term === 'x1_cash' || this.booking.term === 'x1_cheque' ||this.booking.term === 'x1_ba'){
url = '/api/malaysia-bank/' + this.active_bank_setting.x1_bank_id;
}
else if(this.booking.term === 'x2_cash' || this.booking.term === 'x2_cheque' ||this.booking.term === 'x2_ba'){
url = '/api/malaysia-bank/' + this.active_bank_setting.x2_bank_id;
}
axios.get(url)
.then((response) => {
this.bankDetail = response.data;
})
.catch((error) => {
console.log(error);
this.$message({
showClose: true,
message: 'Fetch data fail',
type: 'error',
duration: 10000
});
});
}
}
}