Rename discount type Normal => Percentage #kbcqjv
This commit is contained in:
10
resources/assets/js/views/common/documents.js
vendored
10
resources/assets/js/views/common/documents.js
vendored
@ -70,7 +70,7 @@ const app = new Vue({
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.form.discount_type = 'normal';
|
||||
this.form.discount_type = 'percentage';
|
||||
|
||||
if ((document.getElementById('items') != null) && (document.getElementById('items').rows)) {
|
||||
this.colspan = document.getElementById("items").rows[0].cells.length - 1;
|
||||
@ -118,7 +118,7 @@ const app = new Vue({
|
||||
let line_discount_amount = 0;
|
||||
|
||||
if (item.discount) {
|
||||
if (item.discount_type === 'normal') {
|
||||
if (item.discount_type === 'percentage') {
|
||||
if (item.discount > 100) {
|
||||
item.discount = 100;
|
||||
}
|
||||
@ -249,7 +249,7 @@ const app = new Vue({
|
||||
|
||||
// Apply discount to total
|
||||
if (global_discount) {
|
||||
if (this.form.discount_type === 'normal') {
|
||||
if (this.form.discount_type === 'percentage') {
|
||||
discount_total = parseFloat(sub_total + inclusive_tax_total) * (global_discount / 100);
|
||||
} else {
|
||||
discount_total = global_discount;
|
||||
@ -398,7 +398,7 @@ const app = new Vue({
|
||||
},
|
||||
|
||||
onAddLineDiscount(item_index) {
|
||||
this.items[item_index].discount_type = 'normal';
|
||||
this.items[item_index].discount_type = 'percentage';
|
||||
this.items[item_index].add_discount = true;
|
||||
},
|
||||
|
||||
@ -415,7 +415,7 @@ const app = new Vue({
|
||||
onAddTotalDiscount() {
|
||||
let discount = document.getElementById('pre-discount').value;
|
||||
|
||||
if (this.form.discount_type === 'normal') {
|
||||
if (this.form.discount_type === 'percentage') {
|
||||
if (discount < 0) {
|
||||
discount = 0;
|
||||
} else if (discount > 100) {
|
||||
|
Reference in New Issue
Block a user