mirror of
https://github.com/mokuappio/serverless-invoices.git
synced 2025-10-28 00:11:08 -04:00
Bank account fields improved to allow multi-line info (if you need to enter more details than only your account no).
This commit is contained in:
@ -8,13 +8,13 @@
|
|||||||
<div v-if="bankAccount" class="row">
|
<div v-if="bankAccount" class="row">
|
||||||
<AppInput :value="bankAccount.bank_name"
|
<AppInput :value="bankAccount.bank_name"
|
||||||
@change="updateProp({ bank_name: $event })"
|
@change="updateProp({ bank_name: $event })"
|
||||||
label="Bank Name"
|
label="Bank name"
|
||||||
field="bank_name"
|
field="bank_name"
|
||||||
:errors="errors"
|
:errors="errors"
|
||||||
class="col-sm-10"/>
|
class="col-sm-10"/>
|
||||||
<AppInput :value="bankAccount.account_no"
|
<AppTextarea :value="bankAccount.account_no"
|
||||||
@change="updateProp({ account_no: $event })"
|
@change="updateProp({ account_no: $event })"
|
||||||
label="Account no"
|
label="Bank account details"
|
||||||
field="account_no"
|
field="account_no"
|
||||||
:errors="errors"
|
:errors="errors"
|
||||||
class="col-12"/>
|
class="col-12"/>
|
||||||
@ -43,11 +43,13 @@
|
|||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import NotificationService from '@/services/notification.service';
|
import NotificationService from '@/services/notification.service';
|
||||||
import AppInput from '@/components/form/AppInput';
|
import AppInput from '@/components/form/AppInput';
|
||||||
|
import AppTextarea from '@/components/form/AppTextarea';
|
||||||
import Errors from '@/utils/errors';
|
import Errors from '@/utils/errors';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
AppInput,
|
AppInput,
|
||||||
|
AppTextarea,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -5,16 +5,16 @@
|
|||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Account no.</th>
|
|
||||||
<th>Bank</th>
|
<th>Bank</th>
|
||||||
|
<th>Bank account details</th>
|
||||||
<th class="text-right"></th>
|
<th class="text-right"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="account in bankAccounts" :key="account.id"
|
<tr v-for="account in bankAccounts" :key="account.id"
|
||||||
@click="onSelect(account)" :class="{pointer: $listeners.select }">
|
@click="onSelect(account)" :class="{pointer: $listeners.select }">
|
||||||
<td>{{ account.account_no }}</td>
|
|
||||||
<td>{{ account.bank_name }}</td>
|
<td>{{ account.bank_name }}</td>
|
||||||
|
<td>{{ account.account_no }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<i class="material-icons md-18 p-1 pointer"
|
<i class="material-icons md-18 p-1 pointer"
|
||||||
@click.stop="openBankAccountModal(account)">
|
@click.stop="openBankAccountModal(account)">
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
class="editable">
|
class="editable">
|
||||||
<span ref="editable"
|
<span ref="editable"
|
||||||
class="editable__item"
|
class="editable__item"
|
||||||
contenteditable
|
:contenteditable="!disabled"
|
||||||
v-on="listeners"
|
v-on="listeners"
|
||||||
:class="{'position-absolute': !tmpVal || (!tmpVal && !isFocused)}"
|
:class="{'position-absolute': !tmpVal || (!tmpVal && !isFocused)}"
|
||||||
></span>
|
></span>
|
||||||
@ -31,6 +31,9 @@ export default {
|
|||||||
type: String,
|
type: String,
|
||||||
default: 'Enter item',
|
default: 'Enter item',
|
||||||
},
|
},
|
||||||
|
disabled: {
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
suffix: {},
|
suffix: {},
|
||||||
errors: {},
|
errors: {},
|
||||||
field: {},
|
field: {},
|
||||||
|
|||||||
61
src/components/form/AppTextarea.vue
Normal file
61
src/components/form/AppTextarea.vue
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<template>
|
||||||
|
<div class="form-group">
|
||||||
|
<label :for="field" v-if="label" :class="labelClasses">{{ label }}</label>
|
||||||
|
<div :class="containerClasses">
|
||||||
|
<textarea :disabled="disabled"
|
||||||
|
:id="field"
|
||||||
|
:placeholder="placeholder"
|
||||||
|
class="form-control"
|
||||||
|
:rows="rows"
|
||||||
|
:class="[
|
||||||
|
errors && errors.has(field) ? 'is-invalid' : '',
|
||||||
|
size ? 'form-control-' + size : '',
|
||||||
|
...inputClasses,
|
||||||
|
]"
|
||||||
|
:autocomplete="autocomplete"
|
||||||
|
:maxlength="max"
|
||||||
|
:value="value"
|
||||||
|
@input="$emit('input', $event.target.value)"
|
||||||
|
@change="$emit('change', $event.target.value)"
|
||||||
|
@keydown.self.enter.exact="$emit('submit', $event.target.value)"
|
||||||
|
:ref="field"
|
||||||
|
>
|
||||||
|
</textarea>
|
||||||
|
</div>
|
||||||
|
<slot></slot>
|
||||||
|
<AppError v-if="errors" :errors="errors" :field="field"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import AppError from '@/components/form/AppError';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
AppError,
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
errors: {},
|
||||||
|
label: {},
|
||||||
|
value: {},
|
||||||
|
field: {},
|
||||||
|
type: {},
|
||||||
|
max: {},
|
||||||
|
rows: {},
|
||||||
|
disabled: {},
|
||||||
|
placeholder: {},
|
||||||
|
size: {},
|
||||||
|
labelClasses: {},
|
||||||
|
inputClasses: {},
|
||||||
|
containerClasses: {},
|
||||||
|
autocomplete: {
|
||||||
|
default: 'on',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
focus() {
|
||||||
|
this.$refs[this.field].focus();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@ -1,20 +1,22 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<strong v-b-modal.bank_details class="editable__item"
|
<strong>
|
||||||
:class="{'is-invalid': errors && errors.has('bank_account_no')}">
|
<AppEditable :value="invoice.bank_name"
|
||||||
{{ invoice.bank_account_no }}
|
v-b-modal.bank_account_no
|
||||||
<span v-if="!invoice.bank_account_no">Add bank account no</span>
|
:errors="errors"
|
||||||
|
:disabled="true"
|
||||||
|
field="bank_name"
|
||||||
|
placeholder="Add bank"
|
||||||
|
class="break-line"/>
|
||||||
</strong>
|
</strong>
|
||||||
<AppError :errors="errors" field="bank_account_no"/>
|
<AppEditable :value="invoice.bank_account_no"
|
||||||
<br>
|
v-b-modal.bank_account_no
|
||||||
<span class="editable__item" v-b-modal.bank_details
|
:errors="errors"
|
||||||
:class="{'is-invalid': errors && errors.has('bank_name')}">
|
:disabled="true"
|
||||||
{{ invoice.bank_name }}
|
field="bank_account_no"
|
||||||
<span v-if="!invoice.bank_name">Add bank name</span>
|
placeholder="Add bank details"
|
||||||
</span>
|
class="break-line"/>
|
||||||
<AppError :errors="errors" field="bank_name"/>
|
<BModal id="bank_account_no"
|
||||||
|
|
||||||
<BModal id="bank_details"
|
|
||||||
centered
|
centered
|
||||||
title="Choose bank account"
|
title="Choose bank account"
|
||||||
hide-footer
|
hide-footer
|
||||||
@ -27,14 +29,14 @@
|
|||||||
<script>
|
<script>
|
||||||
import { BModal, VBModal } from 'bootstrap-vue';
|
import { BModal, VBModal } from 'bootstrap-vue';
|
||||||
import BankAccountsList from '@/components/bank-accounts/BankAccountsList';
|
import BankAccountsList from '@/components/bank-accounts/BankAccountsList';
|
||||||
import AppError from '@/components/form/AppError';
|
import AppEditable from '@/components/form/AppEditable';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['invoice', 'errors'],
|
props: ['invoice', 'errors'],
|
||||||
components: {
|
components: {
|
||||||
|
AppEditable,
|
||||||
BModal,
|
BModal,
|
||||||
BankAccountsList,
|
BankAccountsList,
|
||||||
AppError,
|
|
||||||
},
|
},
|
||||||
directives: {
|
directives: {
|
||||||
'b-modal': VBModal,
|
'b-modal': VBModal,
|
||||||
@ -46,7 +48,7 @@ export default {
|
|||||||
bank_name: account.bank_name,
|
bank_name: account.bank_name,
|
||||||
bank_account_id: account.id,
|
bank_account_id: account.id,
|
||||||
});
|
});
|
||||||
this.$bvModal.hide('bank_details');
|
this.$bvModal.hide('account_no');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@ -75,26 +75,26 @@ class InvoiceService {
|
|||||||
currency: 'Currency',
|
currency: 'Currency',
|
||||||
vat_rate: 'Vat rate',
|
vat_rate: 'Vat rate',
|
||||||
late_fee: 'Late fee',
|
late_fee: 'Late fee',
|
||||||
issued_at: 'Issued At',
|
issued_at: 'Issued at',
|
||||||
due_at: 'Due At',
|
due_at: 'Due at',
|
||||||
number: 'Number',
|
number: 'Number',
|
||||||
client_id: 'Client Id',
|
client_id: 'Client',
|
||||||
client_name: 'Client Name',
|
client_name: 'Client name',
|
||||||
client_address: 'Client Address',
|
client_address: 'Address',
|
||||||
client_postal_code: 'Client Postal Code',
|
client_postal_code: 'Postal code',
|
||||||
client_city: 'Client City',
|
client_city: 'City',
|
||||||
client_email: 'Client Email',
|
client_email: 'Client\'s email',
|
||||||
client_country: 'Country',
|
client_country: 'Country',
|
||||||
from_name: 'Name',
|
from_name: 'Name',
|
||||||
from_address: 'Address',
|
from_address: 'Address',
|
||||||
from_postal_code: 'Postal Code',
|
from_postal_code: 'Postal code',
|
||||||
from_country: 'Country/State',
|
from_country: 'Country',
|
||||||
from_city: 'City',
|
from_city: 'City',
|
||||||
from_website: 'Website',
|
from_website: 'Website',
|
||||||
from_email: 'Your Email',
|
from_email: 'Your email',
|
||||||
from_phone: 'From Phone',
|
from_phone: 'Your phone',
|
||||||
bank_name: 'Bank Name',
|
bank_name: 'Bank name',
|
||||||
bank_account_no: 'Bank Account No.',
|
bank_account_no: 'Bank account details',
|
||||||
rows: {
|
rows: {
|
||||||
item: 'Item',
|
item: 'Item',
|
||||||
quantity: 'Quantity',
|
quantity: 'Quantity',
|
||||||
|
|||||||
@ -8,8 +8,8 @@ export default class BankAccount extends Model {
|
|||||||
static fields() {
|
static fields() {
|
||||||
return {
|
return {
|
||||||
id: this.attr(() => uuidv4()),
|
id: this.attr(() => uuidv4()),
|
||||||
account_no: this.attr(''),
|
|
||||||
bank_name: this.attr(''),
|
bank_name: this.attr(''),
|
||||||
|
account_no: this.attr(''),
|
||||||
updated_at: this.attr(''),
|
updated_at: this.attr(''),
|
||||||
created_at: this.attr(''),
|
created_at: this.attr(''),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user