edit-bank-ui update edit bank component

This commit is contained in:
azumiru
2022-03-17 03:12:43 +08:00
parent 185111103c
commit 8d73bd12b2
3 changed files with 12 additions and 52 deletions
@@ -31,7 +31,7 @@
<div class="col-auto">
<div class="row align-items-center">
<div class="col-auto no-padding m-r-5">
<button class="btn btn-xs btn-outline-warning b-rad-none m-r-5 requestModal" data-type="createModal">
<button class="btn btn-xs btn-outline-warning b-rad-none m-r-5 requestModal" data-type="editBank">
<i class="fa fa-pencil"></i>
</button>
</div>
@@ -45,14 +45,9 @@
<div class="bg-master-lighter p-t-10 p-b-10 p-r-15 p-l-15 muted hint-text fs-10" v-if="item.company_business_type !== 1 && item.default">Set As Default</div>
</div>
</div>
<!-- <modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="editBank">
<edit-bank-account-form-component :holder_name="item.holder_name" :account_no="item.account_no" :bank_name="item.bank_name" :company_id="item.id" :type="item.type" :country_id="item.country_id" :section="section" :isEditing="true"></edit-bank-account-form-component>
</modal-component> -->
<modal-form-component section="banksSection">
<template slot="form" slot-scope="{section}">
<bank-account-form-component :data="item" :section="section" :isEditing="true"></bank-account-form-component>
</template>
</modal-form-component>
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="editBank">
<edit-bank-account-form-component :data="item" :section="section"></edit-bank-account-form-component>
</modal-component>
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="deleteBank">
<delete-bank-account-form-component :data="item" :section="section" class="text-center"></delete-bank-account-form-component>
</modal-component>
@@ -117,22 +117,6 @@
country_id: {
type: Number,
default: 1
},
holder_name: {
type: String,
default: ''
},
account_no: {
type: String,
default: ''
},
bank_name: {
type: String,
default: ''
},
isEditing: {
type: Boolean,
default: false
}
},
data(){
@@ -141,9 +125,9 @@
company_id: this.company_id,
account_type: this.type,
reference: '',
bank_name: this.bank_name,
holder_name: this.holder_name,
account_no: this.account_no,
bank_name: '',
holder_name: '',
account_no: '',
bank_branch: '',
swift: '',
snap: '',
@@ -178,11 +162,7 @@
},
methods: {
submitForm(){
if (this.isEditing) {
this.submit(route('api.bank.update', this.data.id), 'put', this.section, true, true);
} else {
this.submit(route('api.bank.create'), 'post', this.section, true, false);
}
this.submit(route('api.bank.create'), 'post', this.section, true, false);
},
successHandler(response){
this.type !== 2 ? this.closeModal() : this.$emit('createdBank', response.payload.data);
@@ -7,6 +7,8 @@
<div class="row m-b-20" v-if="type !== 2">
<div class="col">
<h6 class="all-caps m-b-5 bold no-margin">Edit Bank Account</h6>
item: {{ item }}
data: {{ data }}
</div>
</div>
<div class="row m-b-5 animate__animated animate__fadeInUpBig animate__fast" v-if="error">
@@ -96,14 +98,9 @@
<script>
import componentHandler from '../../../general/mixins/componentHandler';
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
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
@@ -115,10 +112,6 @@
disabled: {
type: Boolean,
default: false
},
country_id: {
type: Number,
default: 1
}
},
data(){
@@ -167,18 +160,10 @@
},
methods: {
submitForm(){
this.submit(route('api.bank.update', this.company_id), 'put', this.section, true, false);
},
successHandler(){
this.closeModal();
this.formHandler();
this.resetForm();
},
errorHandler(error){
this.formHandler(error.message);
this.submit(route('api.bank.update', this.item.id), 'put', this.section, true, true);
}
},
mixins: [componentHandler, ModalFormHandler, FormHandler]
mixins: [componentHandler, ModalFormHandler]
}
</script>