Merge branch 'master' into invoice_template
This commit is contained in:
@ -10,8 +10,10 @@
|
||||
]"
|
||||
:error="formError">
|
||||
|
||||
<el-select v-model="selected" :placeholder="placeholder" filterable
|
||||
<el-select v-model="selected" :placeholder="dynamicPlaceholder" filterable
|
||||
@change="change" @visible-change="visibleChange" @remove-tag="removeTag" @clear="clear" @blur="blur" @focus="focus"
|
||||
:remote="remote"
|
||||
:remote-method="serchableMethod"
|
||||
:clearable="clearable"
|
||||
:disabled="disabled"
|
||||
:multiple="multiple"
|
||||
@ -66,7 +68,7 @@
|
||||
</template>
|
||||
|
||||
<el-option v-if="!group" v-for="(option, index) in sortedOptions"
|
||||
:key="index"
|
||||
:key="option.key"
|
||||
:disabled="disabledOptions.includes(option.key)"
|
||||
:label="option.value"
|
||||
:value="option.key">
|
||||
@ -81,7 +83,7 @@
|
||||
:label="group_options.key">
|
||||
<el-option
|
||||
v-for="(option, option_index) in group_options.value"
|
||||
:key="option_index"
|
||||
:key="option.key"
|
||||
:disabled="disabledOptions.includes(option.key)"
|
||||
:label="option.value"
|
||||
:value="option.key">
|
||||
@ -189,6 +191,8 @@ export default {
|
||||
|
||||
dynamicOptions: null,
|
||||
|
||||
fullOptions: null,
|
||||
|
||||
disabledOptions: {
|
||||
type: Array,
|
||||
default: function () {
|
||||
@ -283,10 +287,23 @@ export default {
|
||||
default: 'No Matchign Data',
|
||||
description: "Selectbox search option not found item message"
|
||||
},
|
||||
|
||||
searchable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
description: "Selectbox searchable"
|
||||
},
|
||||
|
||||
searchText: {
|
||||
type: String,
|
||||
default: '',
|
||||
description: "Selectbox input search placeholder text"
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
dynamicPlaceholder: this.placeholder,
|
||||
add_new: {
|
||||
text: this.addNew.text,
|
||||
show: false,
|
||||
@ -301,18 +318,26 @@ export default {
|
||||
|
||||
form: {},
|
||||
sorted_options: [],
|
||||
full_options:[],
|
||||
new_options: {},
|
||||
loading: false,
|
||||
remote: false,
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
this.setSortedOptions();
|
||||
|
||||
if (this.searchable) {
|
||||
this.remote = true;
|
||||
|
||||
this.setFullOptions();
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
sortedOptions() {
|
||||
if (!this.sortOptions) {
|
||||
if (! this.sortOptions) {
|
||||
return this.sorted_options
|
||||
}
|
||||
|
||||
@ -344,7 +369,6 @@ export default {
|
||||
} catch (e) {
|
||||
this.selected = this.model;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (this.multiple && !this.selected.length) {
|
||||
@ -453,6 +477,82 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
setFullOptions() {
|
||||
// Reset full_options
|
||||
this.full_options = [];
|
||||
|
||||
let created_options = (this.dynamicOptions) ? this.dynamicOptions : this.fullOptions;
|
||||
|
||||
if (this.group) {
|
||||
// Option set sort_option data
|
||||
if (!Array.isArray(created_options)) {
|
||||
for (const [index, options] of Object.entries(created_options)) {
|
||||
let values = [];
|
||||
|
||||
for (const [key, value] of Object.entries(options)) {
|
||||
values.push({
|
||||
key: key,
|
||||
value: value,
|
||||
level: 0
|
||||
});
|
||||
}
|
||||
|
||||
this.full_options.push({
|
||||
key: index,
|
||||
value: values
|
||||
});
|
||||
}
|
||||
} else {
|
||||
created_options.forEach(function (option, index) {
|
||||
if (typeof(option) == 'string') {
|
||||
this.full_options.push({
|
||||
index: index,
|
||||
key: index.toString(),
|
||||
value: option,
|
||||
level: 0
|
||||
});
|
||||
} else {
|
||||
this.full_options.push({
|
||||
index: index,
|
||||
key: option.id.toString(),
|
||||
value: (option.title) ? option.title : (option.display_name) ? option.display_name : option.name,
|
||||
level: (option.level) ? option.level : 0
|
||||
});
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
} else {
|
||||
// Option set sort_option data
|
||||
if (!Array.isArray(created_options)) {
|
||||
for (const [key, value] of Object.entries(created_options)) {
|
||||
this.full_options.push({
|
||||
key: key,
|
||||
value: value,
|
||||
level: 0
|
||||
});
|
||||
}
|
||||
} else {
|
||||
created_options.forEach(function (option, index) {
|
||||
if (typeof(option) == 'string') {
|
||||
this.full_options.push({
|
||||
index: index,
|
||||
key: index.toString(),
|
||||
value: option,
|
||||
level: 0
|
||||
});
|
||||
} else {
|
||||
this.full_options.push({
|
||||
index: index,
|
||||
key: option.id.toString(),
|
||||
value: (option.title) ? option.title : (option.display_name) ? option.display_name : option.name,
|
||||
level: (option.level) ? option.level : 0
|
||||
});
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
change() {
|
||||
// This controll added add new changed..
|
||||
if (typeof(this.selected) === 'object' && typeof(this.selected.type) !== 'undefined') {
|
||||
@ -531,6 +631,30 @@ export default {
|
||||
|
||||
visibleChange(event) {
|
||||
this.$emit('visible-change', event);
|
||||
|
||||
this.dynamicPlaceholder = this.placeholder;
|
||||
|
||||
if (event && this.searchText) {
|
||||
this.dynamicPlaceholder = this.searchText;
|
||||
}
|
||||
|
||||
if (this.searchable) {
|
||||
let selected = this.selected;
|
||||
this.sorted_options = [];
|
||||
|
||||
this.setSortedOptions();
|
||||
|
||||
for (const [key, value] of Object.entries(this.full_options)) {
|
||||
if (selected == value.key) {
|
||||
this.sorted_options.push({
|
||||
index: value.index,
|
||||
key: value.key,
|
||||
value: value.value,
|
||||
level: value.level
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
removeTag(event) {
|
||||
@ -724,6 +848,23 @@ export default {
|
||||
addModal() {
|
||||
|
||||
},
|
||||
|
||||
serchableMethod(query) {
|
||||
if (query !== '') {
|
||||
this.loading = true;
|
||||
|
||||
setTimeout(() => {
|
||||
this.loading = false;
|
||||
|
||||
this.sorted_options = this.full_options.filter(item => {
|
||||
return item.value.toLowerCase()
|
||||
.indexOf(query.toLowerCase()) > -1;
|
||||
});
|
||||
}, 200);
|
||||
} else {
|
||||
this.setSortedOptions();
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
|
@ -11,7 +11,7 @@
|
||||
]"
|
||||
:error="formError">
|
||||
|
||||
<el-select v-model="selected" :placeholder="placeholder" filterable remote reserve-keyword
|
||||
<el-select v-model="selected" :placeholder="dynamicPlaceholder" filterable remote reserve-keyword
|
||||
@change="change" @visible-change="visibleChange" @remove-tag="removeTag" @clear="clear" @blur="blur" @focus="focus"
|
||||
:clearable="clearable"
|
||||
:disabled="disabled"
|
||||
@ -111,7 +111,7 @@
|
||||
</base-input>
|
||||
|
||||
<span v-else>
|
||||
<el-select v-model="selected" :placeholder="placeholder" filterable remote reserve-keyword
|
||||
<el-select v-model="selected" :placeholder="dynamicPlaceholder" filterable remote reserve-keyword
|
||||
@change="change" @visible-change="visibleChange" @remove-tag="removeTag" @clear="clear" @blur="blur" @focus="focus"
|
||||
:clearable="clearable"
|
||||
:disabled="disabled"
|
||||
@ -288,6 +288,8 @@ export default {
|
||||
|
||||
dynamicOptions: null,
|
||||
|
||||
fullOptions: null,
|
||||
|
||||
disabledOptions: {
|
||||
type: Array,
|
||||
default: function () {
|
||||
@ -389,11 +391,24 @@ export default {
|
||||
description: "Selectbox search option not found item message"
|
||||
},
|
||||
|
||||
searchable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
description: "Selectbox searchable"
|
||||
},
|
||||
|
||||
searchText: {
|
||||
type: String,
|
||||
default: '',
|
||||
description: "Selectbox input search placeholder text"
|
||||
},
|
||||
|
||||
remoteAction: {
|
||||
type: String,
|
||||
default: null,
|
||||
description: "Selectbox remote action path"
|
||||
},
|
||||
|
||||
currencyCode: {
|
||||
type: String,
|
||||
default: 'USD',
|
||||
@ -403,6 +418,7 @@ export default {
|
||||
|
||||
data() {
|
||||
return {
|
||||
dynamicPlaceholder: this.placeholder,
|
||||
add_new: {
|
||||
text: this.addNew.text,
|
||||
show: false,
|
||||
@ -417,6 +433,7 @@ export default {
|
||||
|
||||
form: {},
|
||||
sorted_options: [],
|
||||
full_options:[],
|
||||
new_options: {},
|
||||
loading: false,
|
||||
}
|
||||
@ -424,11 +441,15 @@ export default {
|
||||
|
||||
created() {
|
||||
this.setSortedOptions();
|
||||
|
||||
if (this.searchable) {
|
||||
this.setFullOptions();
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
sortedOptions() {
|
||||
if (!this.sortOptions) {
|
||||
if (! this.sortOptions) {
|
||||
return this.sorted_options;
|
||||
}
|
||||
|
||||
@ -460,7 +481,6 @@ export default {
|
||||
} catch (e) {
|
||||
this.selected = this.model;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (this.multiple && !this.selected.length) {
|
||||
@ -569,6 +589,82 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
setFullOptions() {
|
||||
// Reset full_options
|
||||
this.full_options = [];
|
||||
|
||||
let created_options = (this.dynamicOptions) ? this.dynamicOptions : this.fullOptions;
|
||||
|
||||
if (this.group) {
|
||||
// Option set sort_option data
|
||||
if (!Array.isArray(created_options)) {
|
||||
for (const [index, options] of Object.entries(created_options)) {
|
||||
let values = [];
|
||||
|
||||
for (const [key, value] of Object.entries(options)) {
|
||||
values.push({
|
||||
key: key,
|
||||
value: value,
|
||||
level: 0
|
||||
});
|
||||
}
|
||||
|
||||
this.full_options.push({
|
||||
key: index,
|
||||
value: values
|
||||
});
|
||||
}
|
||||
} else {
|
||||
created_options.forEach(function (option, index) {
|
||||
if (typeof(option) == 'string') {
|
||||
this.full_options.push({
|
||||
index: index,
|
||||
key: index.toString(),
|
||||
value: option,
|
||||
level: 0
|
||||
});
|
||||
} else {
|
||||
this.full_options.push({
|
||||
index: index,
|
||||
key: option.id.toString(),
|
||||
value: (option.title) ? option.title : (option.display_name) ? option.display_name : option.name,
|
||||
level: (option.level) ? option.level : 0
|
||||
});
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
} else {
|
||||
// Option set sort_option data
|
||||
if (!Array.isArray(created_options)) {
|
||||
for (const [key, value] of Object.entries(created_options)) {
|
||||
this.full_options.push({
|
||||
key: key,
|
||||
value: value,
|
||||
level: 0
|
||||
});
|
||||
}
|
||||
} else {
|
||||
created_options.forEach(function (option, index) {
|
||||
if (typeof(option) == 'string') {
|
||||
this.full_options.push({
|
||||
index: index,
|
||||
key: index.toString(),
|
||||
value: option,
|
||||
level: 0
|
||||
});
|
||||
} else {
|
||||
this.full_options.push({
|
||||
index: index,
|
||||
key: option.id.toString(),
|
||||
value: (option.title) ? option.title : (option.display_name) ? option.display_name : option.name,
|
||||
level: (option.level) ? option.level : 0
|
||||
});
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
change() {
|
||||
// This controll added add new changed..
|
||||
if (typeof(this.selected) === 'object' && typeof(this.selected.type) !== 'undefined') {
|
||||
@ -647,6 +743,30 @@ export default {
|
||||
|
||||
visibleChange(event) {
|
||||
this.$emit('visible-change', event);
|
||||
|
||||
this.dynamicPlaceholder = this.placeholder;
|
||||
|
||||
if (event && this.searchText) {
|
||||
this.dynamicPlaceholder = this.searchText;
|
||||
}
|
||||
|
||||
if (this.searchable) {
|
||||
let selected = this.selected;
|
||||
this.sorted_options = [];
|
||||
|
||||
this.setSortedOptions();
|
||||
|
||||
for (const [key, value] of Object.entries(this.full_options)) {
|
||||
if (selected == value.key) {
|
||||
this.sorted_options.push({
|
||||
index: value.index,
|
||||
key: value.key,
|
||||
value: value.value,
|
||||
level: value.level
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
removeTag(event) {
|
||||
@ -670,6 +790,10 @@ export default {
|
||||
document.getElementById('form-select-' + this.name).getElementsByTagName("input")[0].readOnly = false;
|
||||
}
|
||||
|
||||
if (this.searchable) {
|
||||
return this.serchableMethod(query);
|
||||
}
|
||||
|
||||
if (query !== '') {
|
||||
this.loading = true;
|
||||
|
||||
@ -742,6 +866,23 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
serchableMethod(query) {
|
||||
if (query !== '') {
|
||||
this.loading = true;
|
||||
|
||||
setTimeout(() => {
|
||||
this.loading = false;
|
||||
|
||||
this.sorted_options = this.full_options.filter(item => {
|
||||
return item.value.toLowerCase()
|
||||
.indexOf(query.toLowerCase()) > -1;
|
||||
});
|
||||
}, 200);
|
||||
} else {
|
||||
this.setSortedOptions();
|
||||
}
|
||||
},
|
||||
|
||||
async onAddItem() {
|
||||
// Get Select Input value
|
||||
if (this.multiple) {
|
||||
|
@ -29,7 +29,7 @@ const app = new Vue({
|
||||
return {
|
||||
form: new Form('reconciliation'),
|
||||
bulk_action: new BulkAction('reconciliations'),
|
||||
reconcile: true,
|
||||
reconcile: false,
|
||||
difference: null,
|
||||
totals: {
|
||||
closing_balance: 0,
|
||||
@ -48,8 +48,6 @@ const app = new Vue({
|
||||
if (this.form._method == 'PATCH') {
|
||||
this.onCalculate();
|
||||
}
|
||||
|
||||
this.currencyConversion();
|
||||
},
|
||||
|
||||
methods:{
|
||||
@ -57,18 +55,6 @@ const app = new Vue({
|
||||
this.min_due_date = date;
|
||||
},
|
||||
|
||||
currencyConversion() {
|
||||
setTimeout(() => {
|
||||
if (document.querySelectorAll('.js-conversion-input')) {
|
||||
let currency_input = document.querySelectorAll('.js-conversion-input');
|
||||
|
||||
for (let input of currency_input) {
|
||||
input.setAttribute('size', input.value.length);
|
||||
}
|
||||
}
|
||||
}, 250)
|
||||
},
|
||||
|
||||
onReconcilition() {
|
||||
let form = document.getElementById('form-create-reconciliation');
|
||||
|
||||
@ -78,7 +64,7 @@ const app = new Vue({
|
||||
},
|
||||
|
||||
onCalculate() {
|
||||
this.reconcile = true;
|
||||
this.reconcile = false;
|
||||
this.difference = null;
|
||||
|
||||
let transactions = this.form.transactions;
|
||||
@ -120,10 +106,10 @@ const app = new Vue({
|
||||
|
||||
if (difference != 0) {
|
||||
this.difference = 'bg-orange-300';
|
||||
this.reconcile = true;
|
||||
this.reconcile = false;
|
||||
} else {
|
||||
this.difference = 'bg-green-100';
|
||||
this.reconcile = false;
|
||||
this.reconcile = true;
|
||||
}
|
||||
|
||||
this.totals.cleared_amount = parseFloat(cleared_amount);
|
||||
|
39
resources/assets/js/views/common/documents.js
vendored
39
resources/assets/js/views/common/documents.js
vendored
@ -162,10 +162,17 @@ const app = new Vue({
|
||||
sub_total += item.total;
|
||||
grand_total += item.grand_total;
|
||||
|
||||
let item_tax_ids = [];
|
||||
|
||||
item.tax_ids.forEach(function(item_tax, item_tax_index) {
|
||||
item_tax_ids.push(item_tax.id);
|
||||
});
|
||||
|
||||
this.form.items[index].name = item.name;
|
||||
this.form.items[index].description = item.description;
|
||||
this.form.items[index].quantity = item.quantity;
|
||||
this.form.items[index].price = item.price;
|
||||
this.form.items[index].tax_ids = item_tax_ids;
|
||||
this.form.items[index].discount = item.discount;
|
||||
this.form.items[index].discount_type = item.discount_type;
|
||||
this.form.items[index].total = item.total;
|
||||
@ -262,6 +269,7 @@ const app = new Vue({
|
||||
|
||||
if (inclusives.length) {
|
||||
inclusives.forEach(function(inclusive) {
|
||||
item.tax_ids[inclusive.tax_index].name = inclusive.tax_name;
|
||||
item.tax_ids[inclusive.tax_index].price = item.grand_total - (item.grand_total / (1 + inclusive.tax_rate / 100));
|
||||
|
||||
inclusive_tax_total += item.tax_ids[inclusive.tax_index].price;
|
||||
@ -274,6 +282,7 @@ const app = new Vue({
|
||||
|
||||
if (fixed.length) {
|
||||
fixed.forEach(function(fixed) {
|
||||
item.tax_ids[fixed.tax_index].name = fixed.tax_name;
|
||||
item.tax_ids[fixed.tax_index].price = fixed.tax_rate * item.quantity;
|
||||
|
||||
total_tax_amount += item.tax_ids[fixed.tax_index].price;
|
||||
@ -290,6 +299,7 @@ const app = new Vue({
|
||||
|
||||
if (normal.length) {
|
||||
normal.forEach(function(normal) {
|
||||
item.tax_ids[normal.tax_index].name = normal.tax_name;
|
||||
item.tax_ids[normal.tax_index].price = price_for_tax * (normal.tax_rate / 100);
|
||||
|
||||
total_tax_amount += item.tax_ids[normal.tax_index].price;
|
||||
@ -300,6 +310,7 @@ const app = new Vue({
|
||||
|
||||
if (withholding.length) {
|
||||
withholding.forEach(function(withholding) {
|
||||
item.tax_ids[withholding.tax_index].name = withholding.tax_name;
|
||||
item.tax_ids[withholding.tax_index].price = -(price_for_tax * (withholding.tax_rate / 100));
|
||||
|
||||
total_tax_amount += item.tax_ids[withholding.tax_index].price;
|
||||
@ -312,6 +323,7 @@ const app = new Vue({
|
||||
|
||||
if (compounds.length) {
|
||||
compounds.forEach(function(compound) {
|
||||
item.tax_ids[compound.tax_index].name = compound.tax_name;
|
||||
item.tax_ids[compound.tax_index].price = (item.grand_total / 100) * compound.tax_rate;
|
||||
|
||||
totals_taxes = this.calculateTotalsTax(totals_taxes, compound.tax_id, compound.tax_name, item.tax_ids[compound.tax_index].price);
|
||||
@ -448,6 +460,7 @@ const app = new Vue({
|
||||
},
|
||||
|
||||
onSelectedTax(item_index) {
|
||||
|
||||
if (! this.tax_id) {
|
||||
return;
|
||||
}
|
||||
@ -476,6 +489,7 @@ const app = new Vue({
|
||||
}
|
||||
|
||||
this.tax_id = '';
|
||||
this.items[item_index].add_tax = false;
|
||||
|
||||
this.onCalculateTotal();
|
||||
},
|
||||
@ -954,6 +968,7 @@ const app = new Vue({
|
||||
|
||||
form_html.querySelectorAll('[type="submit"]').forEach((submit) => {
|
||||
submit.addEventListener('click', () => {
|
||||
this.minor_form_loading = false;
|
||||
window.onbeforeunload = null;
|
||||
});
|
||||
});
|
||||
@ -968,9 +983,33 @@ const app = new Vue({
|
||||
},
|
||||
|
||||
onSubmitViaSendEmail() {
|
||||
let type_submit_icon = document.querySelector('[type="submit"]').querySelector('i');
|
||||
let type_submit_span = document.querySelector('[type="submit"]').querySelector('span');
|
||||
|
||||
this.form['senddocument'] = true;
|
||||
|
||||
this.minor_form_loading = true;
|
||||
|
||||
if (this.form.loading) {
|
||||
type_submit_icon.classList.add('hidden');
|
||||
type_submit_span.classList.add('opacity-100');
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
if (type_submit_icon && type_submit_span) {
|
||||
type_submit_icon.classList.remove('hidden');
|
||||
type_submit_span.classList.remove('opacity-100');
|
||||
}
|
||||
}, 5000);
|
||||
|
||||
this.onSubmit();
|
||||
|
||||
setTimeout(() => {
|
||||
if (Object.keys(this.form.errors.errors.length > 0)) {
|
||||
this.minor_form_loading = false;
|
||||
return;
|
||||
}
|
||||
}, 200);
|
||||
},
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user