Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion POS/src/components/sale/InvoiceCart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,10 @@
</div>

<!-- Offers & Coupon Buttons -->
<div class="flex gap-2">
<div v-if="settingsStore.allowPromotionalOffers || settingsStore.allowCoupons" class="flex gap-2">
<!-- View All Offers Button -->
<button
v-if="settingsStore.allowPromotionalOffers"
type="button"
@click="$emit('show-offers')"
class="relative flex-1 flex items-center justify-center gap-1.5 px-2.5 py-2 rounded-lg bg-gradient-to-r from-green-50 to-emerald-50 border border-green-200 hover:border-green-400 hover:from-green-100 hover:to-emerald-100 hover:shadow-sm transition-all min-w-0 touch-manipulation active:scale-[0.98]"
Expand Down Expand Up @@ -498,6 +499,7 @@

<!-- Enter Coupon Code Button -->
<button
v-if="settingsStore.allowCoupons"
type="button"
@click="$emit('apply-coupon')"
class="relative flex-1 flex items-center justify-center gap-1.5 px-2.5 py-2 rounded-lg bg-gradient-to-r from-purple-50 to-violet-50 border border-purple-200 hover:border-purple-400 hover:from-purple-100 hover:to-violet-100 hover:shadow-sm transition-all min-w-0 touch-manipulation active:scale-[0.98]"
Expand Down
4 changes: 3 additions & 1 deletion POS/src/components/sale/PaymentDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,10 @@
</div>

<!-- Promotional offers & coupons (same entry points as cart — usable while paying) -->
<div class="px-3 py-2 border-b border-gray-100 bg-gray-50/80 shrink-0">
<div v-if="settingsStore.allowPromotionalOffers || settingsStore.allowCoupons" class="px-3 py-2 border-b border-gray-100 bg-gray-50/80 shrink-0">
<div class="flex gap-2">
<button
v-if="settingsStore.allowPromotionalOffers"
type="button"
@click="emit('show-offers')"
class="relative flex-1 flex items-center justify-center gap-1.5 px-2 py-2 rounded-lg bg-gradient-to-r from-green-50 to-emerald-50 border border-green-200 hover:border-green-400 hover:from-green-100 hover:to-emerald-100 hover:shadow-sm transition-all min-w-0 touch-manipulation active:scale-[0.98]"
Expand Down Expand Up @@ -326,6 +327,7 @@
</span>
</button>
<button
v-if="settingsStore.allowCoupons"
type="button"
@click="emit('show-coupon')"
class="relative flex-1 flex items-center justify-center gap-1.5 px-2 py-2 rounded-lg bg-gradient-to-r from-purple-50 to-violet-50 border border-purple-200 hover:border-purple-400 hover:from-purple-100 hover:to-violet-100 hover:shadow-sm transition-all min-w-0 touch-manipulation active:scale-[0.98]"
Expand Down
12 changes: 12 additions & 0 deletions POS/src/components/settings/POSSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,16 @@
:label="__('Disable Rounded Total')"
:description="__('Show exact totals without rounding')"
/>
<CheckboxField
v-model="settings.allow_promotional_offers"
:label="__('Allow Promotional Offers')"
:description="__('Show promotional offers button in cart and checkout')"
/>
<CheckboxField
v-model="settings.allow_coupons"
:label="__('Allow Coupons')"
:description="__('Show coupon code field in cart and checkout')"
/>
</div>
</div>

Expand Down Expand Up @@ -622,6 +632,8 @@ const settings = ref({
silent_print: 0,
allow_negative_stock: 0,
tax_inclusive: 0,
allow_promotional_offers: 1,
allow_coupons: 1,
})

// Stock Sync Settings (localStorage persisted)
Expand Down
12 changes: 12 additions & 0 deletions POS/src/stores/posSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ export const usePOSSettingsStore = defineStore("posSettings", () => {
allow_customer_purchase_order: 0,
allow_duplicate_customer_names: 0,
fetch_coupon: 0,
allow_promotional_offers: 0,
allow_coupons: 0,
// Printing
allow_print_last_invoice: 0,
silent_print: 0,
Expand Down Expand Up @@ -183,6 +185,12 @@ export const usePOSSettingsStore = defineStore("posSettings", () => {
Boolean(settings.value.allow_duplicate_customer_names),
)
const fetchCoupon = computed(() => Boolean(settings.value.fetch_coupon))
const allowPromotionalOffers = computed(() => {
return Number(settings.value.allow_promotional_offers) === 1
})
const allowCoupons = computed(() => {
return Number(settings.value.allow_coupons) === 1
})

// Computed - Printing
const allowPrintLastInvoice = computed(() =>
Expand Down Expand Up @@ -330,6 +338,8 @@ export const usePOSSettingsStore = defineStore("posSettings", () => {
allow_customer_purchase_order: 0,
allow_duplicate_customer_names: 0,
fetch_coupon: 0,
allow_promotional_offers: 0,
allow_coupons: 0,
allow_print_last_invoice: 0,
silent_print: 0,
use_delivery_charges: 0,
Expand Down Expand Up @@ -451,6 +461,8 @@ export const usePOSSettingsStore = defineStore("posSettings", () => {
allowCustomerPurchaseOrder,
allowDuplicateCustomerNames,
fetchCoupon,
allowPromotionalOffers,
allowCoupons,

// Computed - Printing
allowPrintLastInvoice,
Expand Down
4 changes: 4 additions & 0 deletions pos_next/api/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
"allow_sales_order",
"allow_select_sales_order",
"create_only_sales_order",
"allow_promotional_offers",
"allow_coupons",
"enable_session_lock",
"session_lock_timeout",
"show_variants_as_items",
Expand Down Expand Up @@ -67,6 +69,8 @@
"allow_sales_order": 0,
"allow_select_sales_order": 0,
"create_only_sales_order": 0,
"allow_promotional_offers": 1,
"allow_coupons": 1,
"enable_session_lock": 0,
"session_lock_timeout": 5,
"show_variants_as_items": 0,
Expand Down
28 changes: 21 additions & 7 deletions pos_next/pos_next/doctype/pos_settings/pos_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -403,13 +403,27 @@
"fieldtype": "Check",
"label": "Allow Duplicate Customer Names"
},
{
"default": "0",
"description": "Automatically apply eligible coupons",
"fieldname": "fetch_coupon",
"fieldtype": "Check",
"label": "Auto Fetch Coupon Gifts"
},
{
"default": "0",
"description": "Automatically apply eligible coupons",
"fieldname": "fetch_coupon",
"fieldtype": "Check",
"label": "Auto Fetch Coupon Gifts"
},
{
"default": "1",
"description": "Allow applying promotional offers on the cart",
"fieldname": "allow_promotional_offers",
"fieldtype": "Check",
"label": "Allow Promotional Offers"
},
{
"default": "1",
"description": "Allow applying coupons on the cart",
"fieldname": "allow_coupons",
"fieldtype": "Check",
"label": "Allow Coupons"
},
{
"collapsible": 1,
"fieldname": "section_break_printing",
Expand Down
Loading