feat(admin): max uses column + used count in the promo editor

The Quasar editor gains a "Max uses" input per code (blank = unlimited,
normalised to null on save) and shows "Used n / max" from the derived
count. The public buy page's Clear button now also clears the promo field.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ByAwHU4pRnyE58YocQvAas
This commit is contained in:
Padreug 2026-09-10 12:19:44 +02:00
commit 07519bec1b
3 changed files with 31 additions and 4 deletions

View file

@ -729,12 +729,22 @@
class="row q-col-gutter-sm q-mt-md"
>
<q-input
class="col-8"
class="col-6"
filled
dense
v-model.trim="formDialog.data.extra.promo_codes[index].code"
type="text"
label="Promo Code"
:hint="
formDialog.data.extra.promo_codes[index].used_count
? 'Used ' +
formDialog.data.extra.promo_codes[index].used_count +
(formDialog.data.extra.promo_codes[index].max_uses
? ' / ' +
formDialog.data.extra.promo_codes[index].max_uses
: '')
: ''
"
>
<template v-slot:before>
<q-checkbox
@ -755,7 +765,7 @@
</template>
</q-input>
<q-input
class="col-4"
class="col-3"
filled
dense
v-model.number="
@ -765,6 +775,19 @@
label="Discount (%)"
min="0"
max="100"
></q-input>
<q-input
class="col-3"
filled
dense
v-model.number="
formDialog.data.extra.promo_codes[index].max_uses
"
type="number"
label="Max uses"
placeholder="∞"
min="1"
hint="Blank = unlimited"
>
<template v-slot:after>
<q-btn
@ -783,7 +806,8 @@
formDialog.data.extra.promo_codes.push({
code: '',
discount_percent: 0,
active: true
active: true,
max_uses: null
})
"
>Add Promo Code</q-btn