Add support for per-item default discount, for new custorder
This commit is contained in:
parent
dfa4178204
commit
b8389c72bb
4 changed files with 72 additions and 8 deletions
|
@ -97,6 +97,29 @@
|
|||
</b-checkbox>
|
||||
</b-field>
|
||||
|
||||
<b-field>
|
||||
<b-checkbox name="rattail.custorders.allow_item_discounts_if_on_sale"
|
||||
v-model="simpleSettings['rattail.custorders.allow_item_discounts_if_on_sale']"
|
||||
native-value="true"
|
||||
@input="settingsNeedSaved = true"
|
||||
:disabled="!simpleSettings['rattail.custorders.allow_item_discounts']">
|
||||
Allow discount even if item is on sale
|
||||
</b-checkbox>
|
||||
</b-field>
|
||||
|
||||
<div class="level-left block">
|
||||
<div class="level-item">Default item discount</div>
|
||||
<div class="level-item">
|
||||
<b-input name="rattail.custorders.default_item_discount"
|
||||
v-model="simpleSettings['rattail.custorders.default_item_discount']"
|
||||
@input="settingsNeedSaved = true"
|
||||
style="width: 5rem;"
|
||||
:disabled="!simpleSettings['rattail.custorders.allow_item_discounts']">
|
||||
</b-input>
|
||||
</div>
|
||||
<div class="level-item">%</div>
|
||||
</div>
|
||||
|
||||
<b-field>
|
||||
<b-checkbox name="rattail.custorders.allow_past_item_reorder"
|
||||
v-model="simpleSettings['rattail.custorders.allow_past_item_reorder']"
|
||||
|
|
|
@ -792,7 +792,8 @@
|
|||
<b-field grouped>
|
||||
|
||||
<b-field label="Quantity" horizontal>
|
||||
<numeric-input v-model="productQuantity">
|
||||
<numeric-input v-model="productQuantity"
|
||||
style="width: 5rem;">
|
||||
</numeric-input>
|
||||
</b-field>
|
||||
|
||||
|
@ -811,9 +812,10 @@
|
|||
<b-field label="Discount" horizontal>
|
||||
<div class="level">
|
||||
<div class="level-item">
|
||||
<numeric-input v-model="productDiscountPercent"
|
||||
style="width: 5rem;">
|
||||
</numeric-input>
|
||||
<numeric-input v-model="productDiscountPercent"
|
||||
style="width: 5rem;"
|
||||
:disabled="!allowItemDiscount">
|
||||
</numeric-input>
|
||||
</div>
|
||||
<div class="level-item">
|
||||
<span> %</span>
|
||||
|
@ -1238,7 +1240,8 @@
|
|||
% endif
|
||||
|
||||
% if allow_item_discounts:
|
||||
productDiscountPercent: null,
|
||||
productDiscountPercent: ${json.dumps(default_item_discount)|n},
|
||||
allowDiscountsIfOnSale: ${json.dumps(allow_item_discounts_if_on_sale)|n},
|
||||
% endif
|
||||
|
||||
pendingProduct: {},
|
||||
|
@ -1421,6 +1424,19 @@
|
|||
return text
|
||||
},
|
||||
|
||||
% if allow_item_discounts:
|
||||
|
||||
allowItemDiscount() {
|
||||
if (!this.allowDiscountsIfOnSale) {
|
||||
if (this.productSalePriceDisplay) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
},
|
||||
|
||||
% endif
|
||||
|
||||
itemDialogSaveDisabled() {
|
||||
if (this.itemDialogSaving) {
|
||||
return true
|
||||
|
@ -1912,7 +1928,7 @@
|
|||
% endif
|
||||
|
||||
% if allow_item_discounts:
|
||||
this.productDiscountPercent = null
|
||||
this.productDiscountPercent = ${json.dumps(default_item_discount)|n}
|
||||
% endif
|
||||
|
||||
this.itemDialogTabIndex = 0
|
||||
|
@ -2060,6 +2076,10 @@
|
|||
this.productImageURL = null
|
||||
this.productUnitChoices = this.defaultUnitChoices
|
||||
|
||||
% if allow_item_discounts:
|
||||
this.productDiscountPercent = ${json.dumps(default_item_discount)|n}
|
||||
% endif
|
||||
|
||||
% if product_price_may_be_questionable:
|
||||
this.productPriceNeedsConfirmation = false
|
||||
% endif
|
||||
|
@ -2106,6 +2126,11 @@
|
|||
this.productSalePrice = response.data.sale_price
|
||||
this.productSalePriceDisplay = response.data.sale_price_display
|
||||
this.productSaleEndsDisplay = response.data.sale_ends_display
|
||||
|
||||
% if allow_item_discounts:
|
||||
this.productDiscountPercent = this.allowItemDiscount ? response.data.default_item_discount : null
|
||||
% endif
|
||||
|
||||
this.productURL = response.data.url
|
||||
this.productImageURL = response.data.image_url
|
||||
this.setProductUnitChoices(response.data.uom_choices)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue