diff --git a/src/sideshow/web/templates/orders/configure.mako b/src/sideshow/web/templates/orders/configure.mako
index e247b2f..144e5f0 100644
--- a/src/sideshow/web/templates/orders/configure.mako
+++ b/src/sideshow/web/templates/orders/configure.mako
@@ -3,6 +3,28 @@
<%def name="form_content()">
+ Stores
+
+
+
+
+ Show/choose the Store ID for each order
+
+
+
+
+
+
+
+
+
Customers
@@ -14,41 +36,12 @@
+
Products
-
-
- Allow per-item discounts
-
-
-
-
-
- Allow discount even if item is on sale
-
-
-
-
-
Default item discount
-
-
-
-
%
-
-
+ Pricing
+
+
+
+
+ Allow per-item discounts
+
+
+
+
+
+ Allow discount even if item is on sale
+
+
+
+
+ Global default item discount
+
+ %
+
+
+
+
+
Per-Department default item discounts
+
+
+ Add
+
+
+ <${b}-modal has-modal-card
+ % if request.use_oruga:
+ v-model:active="deptItemDiscountShowDialog"
+ % else:
+ :active.sync="deptItemDiscountShowDialog"
+ % endif
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ %
+
+
+
+
+
+
+
+ ${b}-modal>
+
+
+ <${b}-table :data="deptItemDiscounts">
+ <${b}-table-column field="department_id"
+ label="Dept. ID"
+ v-slot="props">
+ {{ props.row.department_id }}
+ ${b}-table-column>
+ <${b}-table-column field="department_name"
+ label="Department Name"
+ v-slot="props">
+ {{ props.row.department_name }}
+ ${b}-table-column>
+ <${b}-table-column field="default_item_discount"
+ label="Discount"
+ v-slot="props">
+ {{ props.row.default_item_discount }} %
+ ${b}-table-column>
+ <${b}-table-column label="Actions"
+ v-slot="props">
+
+
+ Edit
+
+
+
+ Delete
+
+ ${b}-table-column>
+ ${b}-table>
+
+
+
Batches
@@ -118,5 +241,62 @@
ThisPageData.batchHandlers = ${json.dumps(batch_handlers)|n}
+ ThisPageData.deptItemDiscounts = ${json.dumps(dept_item_discounts)|n}
+ ThisPageData.deptItemDiscountShowDialog = false
+ ThisPageData.deptItemDiscountRow = null
+ ThisPageData.deptItemDiscountDeptID = null
+ ThisPageData.deptItemDiscountDeptName = null
+ ThisPageData.deptItemDiscountPercent = null
+
+ ThisPage.computed.deptItemDiscountSaveDisabled = function() {
+ if (!this.deptItemDiscountDeptID) {
+ return true
+ }
+ if (!this.deptItemDiscountDeptName) {
+ return true
+ }
+ if (!this.deptItemDiscountPercent) {
+ return true
+ }
+ return false
+ }
+
+ ThisPage.methods.deptItemDiscountDelete = function(row) {
+ const i = this.deptItemDiscounts.indexOf(row)
+ this.deptItemDiscounts.splice(i, 1)
+ this.settingsNeedSaved = true
+ }
+
+ ThisPage.methods.deptItemDiscountInit = function(row) {
+ this.deptItemDiscountRow = row
+ this.deptItemDiscountDeptID = row?.department_id
+ this.deptItemDiscountDeptName = row?.department_name
+ this.deptItemDiscountPercent = row?.default_item_discount
+ this.deptItemDiscountShowDialog = true
+ this.$nextTick(() => {
+ if (row) {
+ this.$refs.deptItemDiscountPercent.focus()
+ } else {
+ this.$refs.deptItemDiscountDeptID.focus()
+ }
+ })
+ }
+
+ ThisPage.methods.deptItemDiscountSave = function() {
+ if (this.deptItemDiscountRow) {
+ this.deptItemDiscountRow.department_id = this.deptItemDiscountDeptID
+ this.deptItemDiscountRow.department_name = this.deptItemDiscountDeptName
+ this.deptItemDiscountRow.default_item_discount = this.deptItemDiscountPercent
+ } else {
+ this.deptItemDiscounts.push({
+ department_id: this.deptItemDiscountDeptID,
+ department_name: this.deptItemDiscountDeptName,
+ default_item_discount: this.deptItemDiscountPercent,
+ })
+ }
+ this.deptItemDiscountShowDialog = false
+ this.settingsNeedSaved = true
+ }
+
%def>
diff --git a/src/sideshow/web/templates/orders/create.mako b/src/sideshow/web/templates/orders/create.mako
index 2ac6f0a..5dd39b7 100644
--- a/src/sideshow/web/templates/orders/create.mako
+++ b/src/sideshow/web/templates/orders/create.mako
@@ -42,7 +42,25 @@