mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
179 lines
7.1 KiB
Vue
179 lines
7.1 KiB
Vue
<template>
|
|
<div class="row">
|
|
<div class="col">
|
|
<loading-component style="height: 50px; top: 0;" key="1" color="success" v-show="$store.getters.isLoading(section)"></loading-component>
|
|
<div class="row" v-show="!$store.getters.isLoading(section)">
|
|
<div class="col">
|
|
<div class="row m-b-20" v-if="type !== 2">
|
|
<div class="col">
|
|
<h6 class="all-caps m-b-5 bold no-margin">Add Bank Account</h6>
|
|
</div>
|
|
</div>
|
|
<div class="row m-b-5 animate__animated animate__fadeInUpBig animate__fast" v-if="error">
|
|
<div class="col">
|
|
<small class="bold fs-10 text-danger">{{error}}</small>
|
|
</div>
|
|
</div>
|
|
<div class="row m-b-10">
|
|
<div class="col">
|
|
<validation-wrapper-component :validator="$v.parameters.account_no">
|
|
<label>{{ serviceType.id === 4 ? '1688 Login Id/Email/Phone' : 'Account No.' }}</label>
|
|
<input type="text" class="form-control" v-model="parameters.account_no" :disabled="disabled">
|
|
</validation-wrapper-component>
|
|
</div>
|
|
</div>
|
|
<div class="row m-b-10">
|
|
<div class="col">
|
|
<validation-wrapper-component :validator="$v.parameters.holder_name">
|
|
<label>1688 Login Password</label>
|
|
<input type="text" class="form-control" v-model="parameters.holder_name" @keyup="onlyChinese($event)" :disabled="disabled">
|
|
</validation-wrapper-component>
|
|
</div>
|
|
</div>
|
|
<div class="row m-b-10">
|
|
<div class="col">
|
|
<validation-wrapper-component :validator="$v.parameters.bank_branch">
|
|
<label>AliPay 6-digit Payment Pin</label>
|
|
<input type="text" class="form-control" v-model="parameters.bank_branch" :disabled="disabled">
|
|
</validation-wrapper-component>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col" :class="[{'p-r-15': disabled}, {'p-r-5': !disabled}]" v-if="!isCancelButtonHidden">
|
|
<div class="btn btn-sm btn-default bg-master-lightest btn-block b-rad-none" :data-dismiss="closable ? 'modal' : ''" @click="$emit('close')">{{disabled ? 'Change Recipient Account' : 'Cancel'}}</div>
|
|
</div>
|
|
<div class="col p-l-5" v-if="!disabled && !isEditing">
|
|
<button class="btn btn-sm btn-success btn-block b-rad-none" @click="submitForm()">Add Account</button>
|
|
</div>
|
|
<div class="col p-l-5" v-if="isEditing">
|
|
<button class="btn btn-sm btn-success btn-block b-rad-none" @click="submitForm()">Update Details</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
import FormHandler from '../../../general/mixins/formHandler';
|
|
import { required, requiredIf } from "vuelidate/lib/validators";
|
|
export default {
|
|
props : {
|
|
company_id: {
|
|
type: Number,
|
|
default: 1
|
|
},
|
|
type: {
|
|
type: Number,
|
|
default: 1
|
|
},
|
|
closable: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
disabled: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
country_id: {
|
|
type: Number,
|
|
default: 1
|
|
},
|
|
serviceType: {
|
|
type: Object,
|
|
required: false,
|
|
default: null
|
|
},
|
|
isEditing: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
isCancelButtonHidden: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
billNo: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
transactionId: {
|
|
type: Number,
|
|
default: 0
|
|
}
|
|
},
|
|
data(){
|
|
return {
|
|
parameters: {
|
|
company_id: this.company_id,
|
|
account_type: 3,
|
|
reference: '',
|
|
bank_name: '-',
|
|
holder_name: '',
|
|
account_no: '',
|
|
bank_branch: '',
|
|
country_id: this.country_id,
|
|
bill_no: this.billNo,
|
|
transaction_id: this.transactionId,
|
|
},
|
|
englishTextWarning: false,
|
|
confirmProceedEnglishText: false,
|
|
}
|
|
},
|
|
validations: {
|
|
parameters: {
|
|
holder_name: {
|
|
required
|
|
},
|
|
account_no: {
|
|
required
|
|
},
|
|
bank_branch: {
|
|
required
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
submitForm(){
|
|
this.parameters.account_type = 3;
|
|
this.parameters.bank_name = '-';
|
|
if(this.isEditing){
|
|
this.parameters.company_id = this.company_id;
|
|
this.parameters.account_type = this.type;
|
|
this.parameters.bill_no = this.billNo;
|
|
this.parameters.transaction_id = this.transactionId;
|
|
this.submit(route('api.bank.update', this.parameters.id), 'put', this.section, true, false);
|
|
}
|
|
else{
|
|
this.submit(route('api.bank.create'), 'post', this.section, true, false);
|
|
}
|
|
},
|
|
successHandler(response){
|
|
if(this.isEditing){
|
|
this.type !== 2 ? this.closeModal() : this.$emit('updatedBankDetails', response.payload.data, this.transactionId);
|
|
}
|
|
else{
|
|
this.type !== 2 ? this.closeModal() : this.$emit('createdBank', response.payload.data);
|
|
}
|
|
this.formHandler();
|
|
this.resetForm();
|
|
},
|
|
errorHandler(error){
|
|
this.formHandler(error.message);
|
|
},
|
|
onlyChinese(event){
|
|
let value = event.target.value,
|
|
regex = /^[^~`!@#$%^&*()_+=[\]\{}|;':",.\/<>?a-zA-Z0-9-]+$/;
|
|
|
|
event.preventDefault();
|
|
|
|
this.englishTextWarning = false;
|
|
if(regex.test(value) === false){
|
|
this.englishTextWarning = true;
|
|
}
|
|
},
|
|
},
|
|
mixins: [FormHandler]
|
|
|
|
}
|
|
</script>
|