Skip to content

Commit

Permalink
close #1353 Fixed: Invoice item selected tax not calculate real time
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Mar 13, 2020
1 parent 7c027ad commit 0f34bd0
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 23 deletions.
28 changes: 19 additions & 9 deletions resources/assets/js/components/AkauntingSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
</el-option>
</el-option-group>

<el-option v-if="addNew.status && options.length != 0" class="el-select__footer" :value="add_new">
<el-option v-if="addNew.status && options.length != 0" class="el-select__footer" :disabled="true" :value="add_new">
<div @click="onAddItem">
<i class="fas fa-plus"></i>
<span>
Expand Down Expand Up @@ -147,7 +147,7 @@
</el-option>
</el-option-group>

<el-option v-if="addNew.status && options.length != 0" class="el-select__footer" :value="add_new">
<el-option v-if="addNew.status && options.length != 0" class="el-select__footer" :disabled="true" :value="add_new">
<div @click="onAddItem">
<i class="fas fa-plus"></i>
<span>
Expand Down Expand Up @@ -220,7 +220,7 @@
</el-option>
</el-option-group>

<el-option v-if="addNew.status && options.length != 0" class="el-select__footer" :value="add_new">
<el-option v-if="addNew.status && options.length != 0" class="el-select__footer" :disabled="true" :value="add_new">
<div @click="onAddItem">
<i class="fas fa-plus"></i>
<span>
Expand Down Expand Up @@ -293,7 +293,7 @@
</el-option>
</el-option-group>

<el-option v-if="addNew.status && options.length != 0" class="el-select__footer" :value="add_new">
<el-option v-if="addNew.status && options.length != 0" class="el-select__footer" :disabled="true" :value="add_new">
<div @click="onAddItem">
<i class="fas fa-plus"></i>
<span>
Expand Down Expand Up @@ -366,7 +366,7 @@
</el-option>
</el-option-group>

<el-option v-if="addNew.status && options.length != 0" class="el-select__footer" :value="add_new">
<el-option v-if="addNew.status && options.length != 0" class="el-select__footer" :disabled="true" :value="add_new">
<div @click="onAddItem">
<i class="fas fa-plus"></i>
<span>
Expand Down Expand Up @@ -549,12 +549,12 @@ export default {
methods: {
change() {
if (typeof(this.real_model) === 'object') {
if (typeof(this.real_model) === 'object' && typeof(this.real_model.type) !== 'undefined') {
return false;
}
this.$emit('change', this.real_model);
this.$emit('interface', this.real_model);
this.$emit('change', this.real_model);
},
async onAddItem() {
Expand Down Expand Up @@ -679,6 +679,10 @@ export default {
this.form.loading = false;
if (response.data.success) {
if (!this.selectOptions.length) {
this.selectOptions = {};
}
this.selectOptions[response.data.data[this.add_new.field.key]] = response.data.data[this.add_new.field.value];
this.new_options[response.data.data[this.add_new.field.key]] = response.data.data[this.add_new.field.value];
Expand All @@ -688,8 +692,6 @@ export default {
this.real_model = response.data.data[this.add_new.field.key].toString();
}
this.change();
this.add_new.show = false;
this.add_new.html = '';
Expand All @@ -698,6 +700,10 @@ export default {
if (this.multiple) {
this.hide_selected = false;
}
this.$emit('new', response.data.data);
this.change();
}
})
.catch(error => {
Expand Down Expand Up @@ -726,6 +732,10 @@ export default {
this.selectOptions = options;
if (Object.keys(this.new_options).length) {
if (!this.selectOptions.length) {
this.selectOptions = {};
}
for (let [key, value] of Object.entries(this.new_options)) {
if (!this.selectOptions[key]) {
this.selectOptions[key] = value;
Expand Down
24 changes: 14 additions & 10 deletions resources/assets/js/components/AkauntingSelectRemote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
</el-option>
</el-option-group>

<el-option v-if="addNew.status && options.length != 0" class="el-select__footer" :value="add_new">
<el-option v-if="addNew.status && options.length != 0" class="el-select__footer" :disabled="true" :value="add_new">
<div @click="onAddItem">
<i class="fas fa-plus"></i>
<span>
Expand Down Expand Up @@ -147,7 +147,7 @@
</el-option>
</el-option-group>

<el-option v-if="addNew.status && options.length != 0" class="el-select__footer" :value="add_new">
<el-option v-if="addNew.status && options.length != 0" class="el-select__footer" :disabled="true" :value="add_new">
<div @click="onAddItem">
<i class="fas fa-plus"></i>
<span>
Expand Down Expand Up @@ -220,7 +220,7 @@
</el-option>
</el-option-group>

<el-option v-if="addNew.status && options.length != 0" class="el-select__footer" :value="add_new">
<el-option v-if="addNew.status && options.length != 0" class="el-select__footer" :disabled="true" :value="add_new">
<div @click="onAddItem">
<i class="fas fa-plus"></i>
<span>
Expand Down Expand Up @@ -293,7 +293,7 @@
</el-option>
</el-option-group>

<el-option v-if="addNew.status && options.length != 0" class="el-select__footer" :value="add_new">
<el-option v-if="addNew.status && options.length != 0" class="el-select__footer" :disabled="true" :value="add_new">
<div @click="onAddItem">
<i class="fas fa-plus"></i>
<span>
Expand Down Expand Up @@ -390,7 +390,7 @@
</el-option>
</el-option-group>

<el-option v-if="!loading && addNew.status && selectOptions != null && selectOptions.length != 0" class="el-select__footer" :value="add_new">
<el-option v-if="!loading && addNew.status && selectOptions != null && selectOptions.length != 0" class="el-select__footer" :disabled="true" :value="add_new">
<div @click="onAddItem">
<i class="fas fa-plus"></i>
<span>
Expand Down Expand Up @@ -634,8 +634,8 @@ export default {
return false;
}
this.$emit('change', this.real_model);
this.$emit('interface', this.real_model);
this.$emit('change', this.real_model);
this.selectOptions.forEach(item => {
if (item.id == this.real_model) {
Expand Down Expand Up @@ -687,13 +687,15 @@ export default {
this.new_options[response.data.data[this.add_new.field.key]] = response.data.data;
this.real_model = response.data.data[this.add_new.field.key];
this.change();
if (this.title) {
this.$children[0].$children[0].visible = false;
} else {
this.$children[0].visible = false;
}
this.$emit('new', response.data.data);
this.change();
}
})
.catch(error => {
Expand Down Expand Up @@ -804,12 +806,14 @@ export default {
this.new_options[response.data.data[this.add_new.field.key]] = response.data.data[this.add_new.field.value];
this.real_model = response.data.data[this.add_new.field.key];//.toString();
this.change();
this.add_new.show = false;
this.add_new.html = '';
this.add_new_html = null;
this.$emit('new', response.data.data);
this.change();
}
})
.catch(error => {
Expand Down
5 changes: 3 additions & 2 deletions resources/views/purchases/bills/item.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,10 @@ class="mb-0 select-tax"
]
]
])}}"
:collapse="false"
:collapse="true"
@interface="row.tax_id = $event"
@change="onCalculateTotal($event)"
@change="onCalculateTotal()"
@new="taxes.push($event)"
:form-error="form.errors.get('items.' + index + '.tax_id')"
:no-data-text="'{{ trans('general.no_data') }}'"
:no-matching-data-text="'{{ trans('general.no_matching_data') }}'"
Expand Down
5 changes: 3 additions & 2 deletions resources/views/sales/invoices/item.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,10 @@ class="mb-0 select-tax"
]
]
])}}"
:collapse="false"
:collapse="true"
@interface="row.tax_id = $event"
@change="onCalculateTotal($event)"
@change="onCalculateTotal()"
@new="taxes.push($event)"
:form-error="form.errors.get('items.' + index + '.tax_id')"
:no-data-text="'{{ trans('general.no_data') }}'"
:no-matching-data-text="'{{ trans('general.no_matching_data') }}'"
Expand Down

0 comments on commit 0f34bd0

Please sign in to comment.