mirror of
https://gitlab.com/omair-personal/exchange.git
synced 2026-08-19 04:24:08 +00:00
Fix/RegisterErrorMessage
This commit is contained in:
@@ -10,6 +10,9 @@
|
||||
<div class="col-md-7">
|
||||
<input v-model="form.marking" :class="{ 'is-invalid': form.errors.has('marking') }" class="form-control" type="text" name="marking">
|
||||
<has-error :form="form" field="marking"/>
|
||||
<ul class="text-danger list-unstyled" :class="[{hide: !errors.marking}]">
|
||||
<li v-for="(error, index) in errors.marking" v-bind:key="index">{{error}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -20,6 +23,9 @@
|
||||
<el-input v-model="form.email" type="email" name="email" placeholder="Email">
|
||||
</el-input>
|
||||
<has-error :form="form" field="email"/>
|
||||
<ul class="text-danger list-unstyled" :class="[{hide: !errors.email}]">
|
||||
<li v-for="(error, index) in errors.email" v-bind:key="index">{{error}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -38,6 +44,9 @@
|
||||
</template>
|
||||
</el-input>
|
||||
<has-error :form="form" field="password"/>
|
||||
<ul class="text-danger list-unstyled" :class="[{hide: !errors.password}]">
|
||||
<li v-for="(error, index) in errors.password" v-bind:key="index">{{error}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -101,6 +110,11 @@ export default {
|
||||
password: '',
|
||||
password_confirmation: ''
|
||||
}),
|
||||
errors: {
|
||||
marking: '',
|
||||
email: '',
|
||||
password: ''
|
||||
},
|
||||
email : '',
|
||||
password_visible : false,
|
||||
password_confirmation_visible : false
|
||||
@@ -121,13 +135,11 @@ export default {
|
||||
})
|
||||
})
|
||||
.catch( (error) => {
|
||||
console.log(error)
|
||||
this.$message({
|
||||
message: error.response.data.message,
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
)
|
||||
this.errors['marking'] = error.response.data.errors.marking;
|
||||
this.errors['email'] = error.response.data.errors.email;
|
||||
this.errors['password'] = error.response.data.errors.password;
|
||||
|
||||
})
|
||||
|
||||
|
||||
await this.form.post('/api/login')
|
||||
@@ -136,11 +148,7 @@ export default {
|
||||
token = response.data.token
|
||||
})
|
||||
.catch( (error) => {
|
||||
console.log(error)
|
||||
this.$message({
|
||||
message: error.response.data.message,
|
||||
type: 'error'
|
||||
})
|
||||
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<!-- upload image -->
|
||||
<div class="card-body">
|
||||
|
||||
<el-upload :action="'/api/booking/' + booking_id + '/upload-po'" :on-exceed="handleExceed" :on-preview="handlePreview" :on-remove="handleRemove"
|
||||
<el-upload :action="'/api/booking/' + booking_id + '/upload-po'" :auto-upload="false" :on-change="beforeFileUpload" :on-exceed="handleExceed" :on-preview="handlePreview" :on-remove="handleRemove"
|
||||
:on-error="uploadError" class="upload-demo uploadAreaOne" accept=".jpeg, .jpg, .png, .bmp, .doc, .docx, .xls, .xlsx, .pdf"
|
||||
drag multiple>
|
||||
<i class="el-icon-upload" />
|
||||
@@ -187,6 +187,7 @@
|
||||
import ProgressTrack from '~/components/ProgressTrack'
|
||||
import X2ProgressTrack from '~/components/X2ProgressTrack'
|
||||
import axios from 'axios'
|
||||
import ImageCompressor from 'image-compressor.js'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -200,6 +201,7 @@ export default {
|
||||
status: 5,
|
||||
term: null
|
||||
},
|
||||
purchaseOrderArray: [],
|
||||
loading_btn: false,
|
||||
booking_details: {
|
||||
id: null,
|
||||
@@ -236,28 +238,62 @@ export default {
|
||||
methods: {
|
||||
uploadPo() {
|
||||
this.loading_btn = true
|
||||
console.log(this.purchaseOrderArray);
|
||||
axios
|
||||
.post('/api/booking/' + this.$route.params.id + '/confirm-po')
|
||||
.then((response) => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: 'Your PO has been uploaded. We are processing the Invoice.',
|
||||
type: 'success',
|
||||
duration: 5000
|
||||
})
|
||||
this.$router.push({
|
||||
name: 'home'
|
||||
})
|
||||
this.loading_btn = false
|
||||
}).catch((error) => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: "Please upload your purchase order",
|
||||
type: 'error',
|
||||
duration: 30000
|
||||
})
|
||||
this.loading_btn = false
|
||||
})
|
||||
.post('/api/booking/' + this.$route.params.id + '/confirm-po', { images: this.purchaseOrderArray})
|
||||
// .then((response) => {
|
||||
// this.$message({
|
||||
// showClose: true,
|
||||
// message: 'Your PO has been uploaded. We are processing the Invoice.',
|
||||
// type: 'success',
|
||||
// duration: 5000
|
||||
// })
|
||||
// this.$router.push({
|
||||
// name: 'home'
|
||||
// })
|
||||
// this.loading_btn = false
|
||||
// }).catch((error) => {
|
||||
// this.$message({
|
||||
// showClose: true,
|
||||
// message: "Please upload your purchase order",
|
||||
// type: 'error',
|
||||
// duration: 30000
|
||||
// })
|
||||
// this.loading_btn = false
|
||||
// })
|
||||
},
|
||||
beforeFileUpload(file, fileList) {
|
||||
this.purchaseOrderArray = [];
|
||||
var vm = this;
|
||||
for (var i in fileList) {
|
||||
var filetype = fileList[i].raw.type.split("/")[0];
|
||||
if(filetype === 'image'){
|
||||
new ImageCompressor(fileList[i].raw, {
|
||||
quality: .4,
|
||||
convertSize: 1500000,
|
||||
success(result) {
|
||||
vm.convertFile(result)
|
||||
},
|
||||
error(e) {
|
||||
console.log(e.message);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.convertFile(fileList[i].raw)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
convertFile(file){
|
||||
var vm = this,
|
||||
reader = new FileReader();
|
||||
reader.readAsDataURL(file);
|
||||
reader.onloadend = function() {
|
||||
vm.purchaseOrderArray.push(reader.result);
|
||||
console.log(vm.purchaseOrderArray);
|
||||
}
|
||||
},
|
||||
handleRemove(file, fileList) {
|
||||
console.log(file, fileList)
|
||||
|
||||
Reference in New Issue
Block a user