@feedmepos/mf-connect 0.1.0-beta.29 → 0.1.0-beta.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Analytic-B7H12ZTY.js → Analytic-DLez3H4H.js} +8 -8
- package/dist/{App-BJBZpXsi.js → App-dkNRyYLR.js} +6 -6
- package/dist/{Broadcast-D0svFToh.js → Broadcast-DlAaBitD.js} +8 -8
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-V6dyJp-S.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BtpiGQEs.js} +8 -8
- package/dist/Card-JpWEjzjP.js +897 -0
- package/dist/{Collections-DpVQPZSJ.js → Collections-D5hUfDJo.js} +4 -4
- package/dist/{Credit-BhIu4jF4.js → Credit-v3KdCFwT.js} +8 -8
- package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-pzOdN_tj.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-CE2Ar-Ll.js} +27 -27
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-P1FmEqVw.js → EffectSheet.vue_vue_type_style_index_0_lang-C12m8EXP.js} +6 -6
- package/dist/{Experience-B0UJSnfv.js → Experience-9A41fyZO.js} +8 -8
- package/dist/{Game-CjTZrcic.js → Game-l1tUsePJ.js} +8 -8
- package/dist/{Index-D3bjiL6r.js → Index-rF6OzGw_.js} +9 -9
- package/dist/{Marketing-BiydZ2KN.js → Marketing-6zS-6CS3.js} +5 -5
- package/dist/{Member-C_SndZD8.js → Member-B5jPh0DM.js} +4 -4
- package/dist/{MemberList-qWoogtFZ.js → MemberList-c2P1lToO.js} +15 -15
- package/dist/{MemberTransactions-DacRov_h.js → MemberTransactions-BiwAZyCP.js} +1 -1
- package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-siVkENbo.js → MessageInput.vue_vue_type_script_setup_true_lang-CYVOCazs.js} +2 -2
- package/dist/{Mission-DgQD1GQh.js → Mission-BM7abR6J.js} +8 -8
- package/dist/{Overview-BivEfeMs.js → Overview-Drjb4oAW.js} +18 -18
- package/dist/{Point-CMBDCgG1.js → Point-BP9YezdW.js} +8 -8
- package/dist/{Promotion-Dlvz9906.js → Promotion-DiqlNOWk.js} +9 -9
- package/dist/{Record-B1eXPmYG.js → Record-DJ2A1L-C.js} +5 -5
- package/dist/{Reward-D_LnUiNr.js → Reward-DN6z6LXf.js} +12 -12
- package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-906OJcQU.js → RewardGroup.vue_vue_type_script_setup_true_lang-CcbzCFUg.js} +12 -12
- package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-3BpQJMYN.js → RuleGroup.vue_vue_type_script_setup_true_lang-CFD10xnG.js} +14 -14
- package/dist/{Segment-CZ1kkGzP.js → Segment-Cm48eZrS.js} +13 -13
- package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-Dy6r1Z5L.js → SelectItems.vue_vue_type_script_setup_true_lang-6XokSm7W.js} +2 -2
- package/dist/{Setting-Cg_XklQe.js → Setting-3jXUi2cS.js} +8 -8
- package/dist/{Store-CvHwri9D.js → Store-Csditfe8.js} +19 -19
- package/dist/{StoreRewards-CWVlZBSc.js → StoreRewards-DOMxpeaj.js} +12 -12
- package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-CqWmuEwq.js → StoreTransactions.vue_vue_type_script_setup_true_lang-Csoobxol.js} +11 -11
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-D3ZO5mV4.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-C8UhKTgD.js} +1 -1
- package/dist/{Tier-Qim06_JX.js → Tier-BmhQYaPz.js} +20 -20
- package/dist/{Title-DSoxdfi4.js → Title-BJV4yLCu.js} +20 -20
- package/dist/{Transaction-C39eH7OQ.js → Transaction-DB81PNYL.js} +2 -2
- package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-Lg4RcvDz.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-wyCBPQRj.js} +6 -6
- package/dist/{Voucher-4VuH_U33.js → Voucher-B8nnAIUZ.js} +11 -11
- package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-BFzAkZT7.js → VoucherEditor.vue_vue_type_script_setup_true_lang-B4zIOBh0.js} +10 -10
- package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-Be7O95mu.js → ZodTextField.vue_vue_type_script_setup_true_lang-DvfcNsj9.js} +1 -1
- package/dist/{app-oaja6GAw.js → app-BYTkNtdY.js} +1 -1
- package/dist/{app-BU1nEmX2.js → app-sD3N1iqR.js} +34 -31
- package/dist/app.js +1 -1
- package/dist/{business-DRfPUryQ.js → business-B6OFKNz4.js} +1 -1
- package/dist/{campaign-EUg81J3m.js → campaign-DhumfBC6.js} +2 -2
- package/dist/{collectible.enum-DiyCwu7G.js → collectible.enum-4Gywgj__.js} +1 -1
- package/dist/{collection.fn-DkUNMAwp.js → collection.fn-D-uexOQL.js} +2 -2
- package/dist/{dto-DOU8rlC4.js → dto-b9jcbMWA.js} +75 -75
- package/dist/{effect-Btnss9MT.js → effect-CBN4vtSi.js} +1 -1
- package/dist/{email-addresses-3JHKorik.js → email-addresses-BqgJVUoG.js} +1 -1
- package/dist/{export-BxPBiupf.js → export-D1kS_vMc.js} +3 -3
- package/dist/{helper-DlbWOkH4.js → helper-SbkTJZDm.js} +1 -1
- package/dist/{index-CSWUy0du.js → index-BBBSm4kr.js} +3 -3
- package/dist/{index-CAthbo3G.js → index-BIs-Ed1-.js} +3 -3
- package/dist/{index-CL7xcNdG.js → index-CBwwTcb5.js} +1 -1
- package/dist/{index-C2BR29Vi.js → index-CHg2swyg.js} +3 -3
- package/dist/{index-Gukxl3XS.js → index-Cd94xjeo.js} +1 -1
- package/dist/{index-B47o3NfN.js → index-Cehc8dyz.js} +4 -4
- package/dist/{index-DhJ-NmuV.js → index-CxBG7i3n.js} +8 -8
- package/dist/{index-D14jHheQ.js → index-DgJVPeks.js} +7 -1
- package/dist/{index-D1U64Rfz.js → index-Dp-5hs3q.js} +1 -1
- package/dist/{index-CwTjIu6w.js → index-DtX7V_mF.js} +2 -2
- package/dist/{index-BRJIZklM.js → index-Hhxoo_Eg.js} +4 -4
- package/dist/{index-BhVNGG1a.js → index-OCIxZJKd.js} +1 -1
- package/dist/{index-C-x169Z5.js → index-wJ5e3mQa.js} +1 -1
- package/dist/{index.esm2017-BWiGGYVx.js → index.esm2017-Bl1OPd9N.js} +1 -1
- package/dist/{loading-DbE0TtP2.js → loading-BghJIv3w.js} +4 -4
- package/dist/{membership-uyBactAw.js → membership-D532uzUJ.js} +3 -3
- package/dist/{money-BsUvoufR.js → money-BJmDeENN.js} +1 -1
- package/dist/{number-DiPlxGL4.js → number-E_LdkU9a.js} +1 -1
- package/dist/{objectid-VjhETDeC.js → objectid-DSB8jlsT.js} +6 -6
- package/dist/{reward-D4YqBsKN.js → reward-CiTzAsCd.js} +1 -1
- package/dist/{rule-D2_VoqyD.js → rule-0MEHUef9.js} +3 -3
- package/dist/{rule-builder-TGGNw2iM.js → rule-builder-BQZN0Bi4.js} +1 -1
- package/dist/{template-Dovds0qm.js → template-2xDKWfij.js} +4 -4
- package/dist/{trigger-D5wtvsvc.js → trigger-BFmJQkCL.js} +4 -4
- package/dist/{user-PC0zQDCH.js → user-B_diJ-ER.js} +1 -1
- package/dist/{vue-i18n-CqmzEsDq.js → vue-i18n-D0S05G9j.js} +473 -473
- package/dist/{xlsx-9iUmZwLG.js → xlsx-9pjTnN_k.js} +1 -1
- package/package.json +1 -1
- package/dist/Card-Fc097UAX.js +0 -685
|
@@ -0,0 +1,897 @@
|
|
|
1
|
+
import { defineComponent as Z, ref as y, computed as E, watch as ce, onMounted as X, resolveComponent as v, openBlock as m, createBlock as F, unref as e, isRef as G, withCtx as _, createElementVNode as d, createVNode as i, createElementBlock as $, Fragment as z, renderList as H, createCommentVNode as k, normalizeClass as re, createSlots as pe, h as K, toDisplayString as te, withModifiers as fe } from "vue";
|
|
2
|
+
import { _ as be } from "./campaign-CpzFl8Vr.js";
|
|
3
|
+
import { h as ne } from "./moment-BWErdI6_.js";
|
|
4
|
+
import { useDialog as ge, components as oe } from "@feedmepos/ui-library";
|
|
5
|
+
import { p as de, u as J, f as se, n as ve } from "./loading-BghJIv3w.js";
|
|
6
|
+
import { u as ue } from "./app-wDQR6dpb.js";
|
|
7
|
+
import { u as W } from "./membership-D532uzUJ.js";
|
|
8
|
+
import { _ as Q } from "./CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js";
|
|
9
|
+
import { m as L } from "./index-DgJVPeks.js";
|
|
10
|
+
import { z as ye } from "./app-sD3N1iqR.js";
|
|
11
|
+
import { Z as xe } from "./zod-Bg2FbC-D.js";
|
|
12
|
+
import { _ as ie } from "./ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js";
|
|
13
|
+
import "./index-CHg2swyg.js";
|
|
14
|
+
import "./index-DtX7V_mF.js";
|
|
15
|
+
import { k as Ce } from "./index-Hhxoo_Eg.js";
|
|
16
|
+
import "./index-Cehc8dyz.js";
|
|
17
|
+
import "./index-CxBG7i3n.js";
|
|
18
|
+
import "./index-CBwwTcb5.js";
|
|
19
|
+
import "./index-BBBSm4kr.js";
|
|
20
|
+
import { O as Se } from "./objectid-DSB8jlsT.js";
|
|
21
|
+
import { a as _e, c as he } from "./object-qECH92oz.js";
|
|
22
|
+
import { u as we } from "./business-B6OFKNz4.js";
|
|
23
|
+
import { w as ke } from "./xlsx-9pjTnN_k.js";
|
|
24
|
+
import { e as Fe, C as Ve } from "./export-D1kS_vMc.js";
|
|
25
|
+
import { u as $e, _ as Me } from "./usePagination-BeF5K3M7.js";
|
|
26
|
+
import { u as Be } from "./vue-i18n-D0S05G9j.js";
|
|
27
|
+
import { o as Ue } from "./objectId-dwaoBfJX.js";
|
|
28
|
+
const De = { class: "space-y-16" }, Ae = { class: "gap-16 grid grid-cols-2" }, Ne = { class: "space-y-16" }, Pe = {
|
|
29
|
+
key: 0,
|
|
30
|
+
class: "flex flex-col gap-[16px] w-full"
|
|
31
|
+
}, Ie = { class: "flex flex-col gap-[8px]" }, Re = ["src"], qe = { class: "flex pt-[24px] gap-[24px]" }, ze = ["src", "onClick", "alt"], Ee = { class: "flex items-center gap-8" }, je = /* @__PURE__ */ Z({
|
|
32
|
+
__name: "CreateCardSheet",
|
|
33
|
+
emits: ["success", "export"],
|
|
34
|
+
setup(ee, { expose: j, emit: T }) {
|
|
35
|
+
const { minor: A } = J, f = W(), M = y(), x = y(!1), w = T, o = y(!1);
|
|
36
|
+
function B(c) {
|
|
37
|
+
o.value = c, c && (s.value = {
|
|
38
|
+
quantity: 1,
|
|
39
|
+
code: "",
|
|
40
|
+
codeConfig: {
|
|
41
|
+
length: 12,
|
|
42
|
+
charset: "1234567890",
|
|
43
|
+
prefix: "",
|
|
44
|
+
suffix: "",
|
|
45
|
+
pattern: "####-####-####-####"
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
const s = y({
|
|
50
|
+
quantity: 1,
|
|
51
|
+
code: "",
|
|
52
|
+
codeConfig: {
|
|
53
|
+
length: 12,
|
|
54
|
+
charset: "1234567890",
|
|
55
|
+
prefix: "",
|
|
56
|
+
suffix: "",
|
|
57
|
+
pattern: "####-####-####-####"
|
|
58
|
+
},
|
|
59
|
+
setCardOnBind: !1,
|
|
60
|
+
bundle: void 0
|
|
61
|
+
}), b = [
|
|
62
|
+
{
|
|
63
|
+
label: "Bulk number",
|
|
64
|
+
value: "bulk",
|
|
65
|
+
sublabel: "Bulk generate unique number"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
label: "Custom number",
|
|
69
|
+
value: "single",
|
|
70
|
+
sublabel: "Enter your own custom number"
|
|
71
|
+
}
|
|
72
|
+
], D = [
|
|
73
|
+
{
|
|
74
|
+
label: "Alphanumeric",
|
|
75
|
+
value: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
label: "Alphabetic",
|
|
79
|
+
value: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
80
|
+
},
|
|
81
|
+
{ label: "Alphabetic Lowercase", value: "abcdefghijklmnopqrstuvwxyz" },
|
|
82
|
+
{ label: "Alphabetic Uppercase", value: "ABCDEFGHIJKLMNOPQRSTUVWXYZ" },
|
|
83
|
+
{ label: "Numbers", value: "0123456789" },
|
|
84
|
+
{ label: "Custom", value: "" }
|
|
85
|
+
], N = y(D[0].value), h = y("bulk"), C = y(0), n = E(
|
|
86
|
+
() => {
|
|
87
|
+
var c;
|
|
88
|
+
return (c = f.membership.design) == null ? void 0 : c[C.value];
|
|
89
|
+
}
|
|
90
|
+
), u = y(!1), r = E(
|
|
91
|
+
() => f.sortedStoreCategories.flatMap((c) => c.bundles)
|
|
92
|
+
);
|
|
93
|
+
async function g(c) {
|
|
94
|
+
var l, V;
|
|
95
|
+
if (await ((l = M.value) == null ? void 0 : l.validateInputs()), !x.value) return;
|
|
96
|
+
c.design = (V = n.value) == null ? void 0 : V.image;
|
|
97
|
+
const t = await de.confirm(
|
|
98
|
+
"",
|
|
99
|
+
"Do you want to export generated card(s)?",
|
|
100
|
+
"Export",
|
|
101
|
+
"Generate and without export"
|
|
102
|
+
);
|
|
103
|
+
console.log(t), await A(
|
|
104
|
+
async () => {
|
|
105
|
+
const U = await L.createCards(c);
|
|
106
|
+
console.log(U), await w("success"), t && await w("export", U);
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
message: "Creating card(s)",
|
|
110
|
+
successMessage: "Card(s) created"
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
return j({
|
|
115
|
+
showSheet: B
|
|
116
|
+
}), ce(
|
|
117
|
+
() => s.value.codeConfig.length,
|
|
118
|
+
(c, t) => {
|
|
119
|
+
c != t && (s.value.codeConfig.pattern = "#".repeat(Number(c)));
|
|
120
|
+
}
|
|
121
|
+
), X(async () => {
|
|
122
|
+
await f.readMemberStore();
|
|
123
|
+
}), (c, t) => {
|
|
124
|
+
const l = v("FmRadio"), V = v("FmRadioGroup"), U = v("FmSwitch"), p = v("FmStepperField"), P = v("FmSelect"), q = v("FmTextField"), S = v("FmTextarea"), I = v("FmButton"), O = v("FmForm"), me = v("FmSideSheet");
|
|
125
|
+
return m(), F(me, {
|
|
126
|
+
"max-width": 560,
|
|
127
|
+
"dismiss-away": !0,
|
|
128
|
+
header: "Create collection",
|
|
129
|
+
modelValue: e(o),
|
|
130
|
+
"onUpdate:modelValue": [
|
|
131
|
+
t[19] || (t[19] = (R) => G(o) ? o.value = R : null),
|
|
132
|
+
t[20] || (t[20] = (R) => o.value = R)
|
|
133
|
+
]
|
|
134
|
+
}, {
|
|
135
|
+
"side-sheet-footer": _(() => [
|
|
136
|
+
d("div", Ee, [
|
|
137
|
+
i(I, {
|
|
138
|
+
label: "Save",
|
|
139
|
+
onClick: t[17] || (t[17] = (R) => g(e(s))),
|
|
140
|
+
loading: e(ue)().isLoading
|
|
141
|
+
}, null, 8, ["loading"]),
|
|
142
|
+
i(I, {
|
|
143
|
+
label: "Cancel",
|
|
144
|
+
type: "button",
|
|
145
|
+
variant: "tertiary",
|
|
146
|
+
onClick: t[18] || (t[18] = (R) => o.value = !1)
|
|
147
|
+
})
|
|
148
|
+
])
|
|
149
|
+
]),
|
|
150
|
+
default: _(() => [
|
|
151
|
+
i(O, {
|
|
152
|
+
ref_key: "form",
|
|
153
|
+
ref: M,
|
|
154
|
+
class: "space-y-40",
|
|
155
|
+
onValidationSuccess: t[15] || (t[15] = (R) => x.value = !0),
|
|
156
|
+
onValidationFailed: t[16] || (t[16] = (R) => x.value = !1)
|
|
157
|
+
}, {
|
|
158
|
+
default: _(() => {
|
|
159
|
+
var R, le, ae;
|
|
160
|
+
return [
|
|
161
|
+
d("div", null, [
|
|
162
|
+
t[21] || (t[21] = d("div", { class: "fm-typo-en-body-lg-600" }, "Number type", -1)),
|
|
163
|
+
i(V, {
|
|
164
|
+
modelValue: e(h),
|
|
165
|
+
"onUpdate:modelValue": t[0] || (t[0] = (a) => G(h) ? h.value = a : null),
|
|
166
|
+
inline: !1
|
|
167
|
+
}, {
|
|
168
|
+
default: _(() => [
|
|
169
|
+
(m(), $(z, null, H(b, (a) => i(l, {
|
|
170
|
+
key: a.value,
|
|
171
|
+
value: a.value,
|
|
172
|
+
label: a.label,
|
|
173
|
+
sublabel: a.sublabel
|
|
174
|
+
}, null, 8, ["value", "label", "sublabel"])), 64))
|
|
175
|
+
]),
|
|
176
|
+
_: 1
|
|
177
|
+
}, 8, ["modelValue"])
|
|
178
|
+
]),
|
|
179
|
+
d("div", De, [
|
|
180
|
+
t[22] || (t[22] = d("div", { class: "fm-typo-en-body-lg-600" }, "Number Settings", -1)),
|
|
181
|
+
e(h) === "bulk" ? (m(), $(z, { key: 0 }, [
|
|
182
|
+
i(U, {
|
|
183
|
+
"model-value": e(u),
|
|
184
|
+
"label-placement": "right",
|
|
185
|
+
value: "true",
|
|
186
|
+
label: "Advance number setting",
|
|
187
|
+
required: !0,
|
|
188
|
+
"onUpdate:modelValue": t[1] || (t[1] = () => u.value = !e(u))
|
|
189
|
+
}, null, 8, ["model-value"]),
|
|
190
|
+
e(u) ? (m(), $(z, { key: 0 }, [
|
|
191
|
+
i(p, {
|
|
192
|
+
"model-value": e(s).codeConfig.length || null,
|
|
193
|
+
"onUpdate:modelValue": t[2] || (t[2] = (a) => e(s).codeConfig.length = a),
|
|
194
|
+
label: "Code length",
|
|
195
|
+
rules: [(a) => Number(a) >= 1 || "Code length must at least 1"],
|
|
196
|
+
required: !0
|
|
197
|
+
}, null, 8, ["model-value", "rules"]),
|
|
198
|
+
i(P, {
|
|
199
|
+
label: "Charset",
|
|
200
|
+
"model-value": e(N),
|
|
201
|
+
items: D,
|
|
202
|
+
"helper-text": e(s).codeConfig.charset.length > 62 ? `${e(s).codeConfig.charset.substring(0, 62)}...` : e(s).codeConfig.charset,
|
|
203
|
+
"onUpdate:modelValue": t[3] || (t[3] = (a) => {
|
|
204
|
+
N.value = a, e(s).codeConfig.charset = a;
|
|
205
|
+
})
|
|
206
|
+
}, null, 8, ["model-value", "helper-text"]),
|
|
207
|
+
e(N) === "" ? (m(), F(q, {
|
|
208
|
+
key: 0,
|
|
209
|
+
modelValue: e(s).codeConfig.charset,
|
|
210
|
+
"onUpdate:modelValue": t[4] || (t[4] = (a) => e(s).codeConfig.charset = a),
|
|
211
|
+
label: "Custom Charset",
|
|
212
|
+
required: ""
|
|
213
|
+
}, null, 8, ["modelValue"])) : k("", !0),
|
|
214
|
+
d("div", Ae, [
|
|
215
|
+
i(q, {
|
|
216
|
+
modelValue: e(s).codeConfig.prefix,
|
|
217
|
+
"onUpdate:modelValue": t[5] || (t[5] = (a) => e(s).codeConfig.prefix = a),
|
|
218
|
+
label: "Prefix (Optional)"
|
|
219
|
+
}, null, 8, ["modelValue"]),
|
|
220
|
+
i(q, {
|
|
221
|
+
modelValue: e(s).codeConfig.suffix,
|
|
222
|
+
"onUpdate:modelValue": t[6] || (t[6] = (a) => e(s).codeConfig.suffix = a),
|
|
223
|
+
label: "Suffix (Optional)"
|
|
224
|
+
}, null, 8, ["modelValue"])
|
|
225
|
+
]),
|
|
226
|
+
i(q, {
|
|
227
|
+
modelValue: e(s).codeConfig.pattern,
|
|
228
|
+
"onUpdate:modelValue": t[7] || (t[7] = (a) => e(s).codeConfig.pattern = a),
|
|
229
|
+
label: "Pattern",
|
|
230
|
+
required: !0
|
|
231
|
+
}, null, 8, ["modelValue"])
|
|
232
|
+
], 64)) : k("", !0),
|
|
233
|
+
i(q, {
|
|
234
|
+
modelValue: e(s).quantity,
|
|
235
|
+
"onUpdate:modelValue": t[8] || (t[8] = (a) => e(s).quantity = a),
|
|
236
|
+
label: "Number of code",
|
|
237
|
+
rules: [
|
|
238
|
+
(a) => a >= 1 || "Quantity cannot be less than 1",
|
|
239
|
+
(a) => a <= 1e4 || "Quantity cannot more than 10,000"
|
|
240
|
+
],
|
|
241
|
+
required: !0,
|
|
242
|
+
"helper-text": `${e(s).quantity} card will be created`
|
|
243
|
+
}, null, 8, ["modelValue", "rules", "helper-text"])
|
|
244
|
+
], 64)) : k("", !0),
|
|
245
|
+
e(h) !== "bulk" ? (m(), F(S, {
|
|
246
|
+
key: 1,
|
|
247
|
+
modelValue: e(s).code,
|
|
248
|
+
"onUpdate:modelValue": t[9] || (t[9] = (a) => e(s).code = a),
|
|
249
|
+
label: "Custom Card Number",
|
|
250
|
+
rules: [(a) => e(h) != "single" || !!a || "Custom code is required"],
|
|
251
|
+
placeholder: "(For multiple numbers, please enter in the new row.)"
|
|
252
|
+
}, null, 8, ["modelValue", "rules"])) : k("", !0)
|
|
253
|
+
]),
|
|
254
|
+
d("div", Ne, [
|
|
255
|
+
t[23] || (t[23] = d("div", { class: "fm-typo-en-body-lg-600" }, "Card Settings", -1)),
|
|
256
|
+
i(U, {
|
|
257
|
+
"label-placement": "right",
|
|
258
|
+
label: "Set card number on bind",
|
|
259
|
+
"model-value": e(s).setCardOnBind || !1,
|
|
260
|
+
"onUpdate:modelValue": t[10] || (t[10] = (a) => e(s).setCardOnBind = a)
|
|
261
|
+
}, null, 8, ["model-value"]),
|
|
262
|
+
i(Q, {
|
|
263
|
+
label: "Activate bundle on bind",
|
|
264
|
+
placeholder: "Select bundle",
|
|
265
|
+
items: e(r).filter((a) => !a.stripePriceId).map((a) => ({ label: a.name, value: a._id })),
|
|
266
|
+
modelValue: e(s).bundle,
|
|
267
|
+
"onUpdate:modelValue": t[12] || (t[12] = (a) => e(s).bundle = a)
|
|
268
|
+
}, {
|
|
269
|
+
append: _(() => [
|
|
270
|
+
e(s).bundle ? (m(), F(I, {
|
|
271
|
+
key: 0,
|
|
272
|
+
icon: "link_off",
|
|
273
|
+
variant: "plain",
|
|
274
|
+
onClick: t[11] || (t[11] = (a) => e(s).bundle = void 0)
|
|
275
|
+
})) : k("", !0)
|
|
276
|
+
]),
|
|
277
|
+
_: 1
|
|
278
|
+
}, 8, ["items", "modelValue"]),
|
|
279
|
+
(le = (R = e(f).store) == null ? void 0 : R.stripe) != null && le.apiKey ? (m(), F(Q, {
|
|
280
|
+
key: 0,
|
|
281
|
+
label: "Linked subscription bundle",
|
|
282
|
+
placeholder: "Select bundle",
|
|
283
|
+
items: e(r).filter((a) => a.stripePriceId).map((a) => ({ label: a.name, value: a._id })),
|
|
284
|
+
modelValue: e(s).subscriptionBundle,
|
|
285
|
+
"onUpdate:modelValue": t[14] || (t[14] = (a) => e(s).subscriptionBundle = a)
|
|
286
|
+
}, {
|
|
287
|
+
append: _(() => [
|
|
288
|
+
e(s).subscriptionBundle ? (m(), F(I, {
|
|
289
|
+
key: 0,
|
|
290
|
+
icon: "link_off",
|
|
291
|
+
variant: "plain",
|
|
292
|
+
onClick: t[13] || (t[13] = (a) => e(s).subscriptionBundle = void 0)
|
|
293
|
+
})) : k("", !0)
|
|
294
|
+
]),
|
|
295
|
+
_: 1
|
|
296
|
+
}, 8, ["items", "modelValue"])) : k("", !0)
|
|
297
|
+
]),
|
|
298
|
+
e(f).membership.design ? (m(), $("div", Pe, [
|
|
299
|
+
d("div", Ie, [
|
|
300
|
+
t[24] || (t[24] = d("p", { class: "fm-typo-en-title-sm-800" }, "Design preview", -1)),
|
|
301
|
+
d("img", {
|
|
302
|
+
src: (ae = e(n)) == null ? void 0 : ae.image,
|
|
303
|
+
class: "aspect-[16/9]"
|
|
304
|
+
}, null, 8, Re),
|
|
305
|
+
d("div", qe, [
|
|
306
|
+
(m(!0), $(z, null, H(e(f).membership.design, (a, Y) => (m(), $("img", {
|
|
307
|
+
src: a.image,
|
|
308
|
+
key: `image_${Y}`,
|
|
309
|
+
class: re(["w-[112px] h-[63px] cursor-pointer", `${e(C) === Y ? "border-[2px] border-fm-color-primary" : ""}`]),
|
|
310
|
+
onClick: (dt) => C.value = Y,
|
|
311
|
+
alt: `ai_image_predict_${Y}`,
|
|
312
|
+
style: { objectFit: "cover" }
|
|
313
|
+
}, null, 10, ze))), 128))
|
|
314
|
+
])
|
|
315
|
+
])
|
|
316
|
+
])) : k("", !0)
|
|
317
|
+
];
|
|
318
|
+
}),
|
|
319
|
+
_: 1
|
|
320
|
+
}, 512)
|
|
321
|
+
]),
|
|
322
|
+
_: 1
|
|
323
|
+
}, 8, ["modelValue"]);
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
}), Te = { class: "space-y-16" }, Le = {
|
|
327
|
+
key: 0,
|
|
328
|
+
class: "flex flex-col gap-[16px] w-full"
|
|
329
|
+
}, Oe = { class: "flex flex-col gap-[8px]" }, Ye = ["src"], Ke = { class: "flex pt-[24px] gap-[24px]" }, Ge = ["src", "onClick", "alt"], He = { class: "flex items-center gap-8" }, Qe = /* @__PURE__ */ Z({
|
|
330
|
+
__name: "EditCardSheet",
|
|
331
|
+
emits: ["success"],
|
|
332
|
+
setup(ee, { expose: j, emit: T }) {
|
|
333
|
+
const { minor: A } = J, f = W(), M = y(), x = y(!1), w = T, o = y({
|
|
334
|
+
_id: "",
|
|
335
|
+
business: "",
|
|
336
|
+
serialNumber: ""
|
|
337
|
+
}), B = y(!1);
|
|
338
|
+
function s(C, n) {
|
|
339
|
+
var u;
|
|
340
|
+
B.value = C, C && n && (o.value = n, b.value = (u = f.membership.design) == null ? void 0 : u.findIndex(
|
|
341
|
+
(r) => r.image === n.design
|
|
342
|
+
));
|
|
343
|
+
}
|
|
344
|
+
const b = y(0), D = E(
|
|
345
|
+
() => {
|
|
346
|
+
var C;
|
|
347
|
+
return (C = f.membership.design) == null ? void 0 : C[b.value];
|
|
348
|
+
}
|
|
349
|
+
), N = E(
|
|
350
|
+
() => f.sortedStoreCategories.flatMap(
|
|
351
|
+
(C) => C.bundles
|
|
352
|
+
)
|
|
353
|
+
);
|
|
354
|
+
async function h(C) {
|
|
355
|
+
var n, u;
|
|
356
|
+
await ((n = M.value) == null ? void 0 : n.validateInputs()), x.value && (C.design = (u = D.value) == null ? void 0 : u.image, await A(
|
|
357
|
+
async () => {
|
|
358
|
+
await L.updateCard(C), await w("success");
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
message: "Updating card",
|
|
362
|
+
successMessage: "Card updated"
|
|
363
|
+
}
|
|
364
|
+
));
|
|
365
|
+
}
|
|
366
|
+
return j({
|
|
367
|
+
showSheet: s
|
|
368
|
+
}), X(async () => {
|
|
369
|
+
await f.readMemberStore();
|
|
370
|
+
}), (C, n) => {
|
|
371
|
+
const u = v("FmTextField"), r = v("FmSwitch"), g = v("FmButton"), c = v("FmForm"), t = v("FmSideSheet");
|
|
372
|
+
return m(), F(t, {
|
|
373
|
+
"max-width": 560,
|
|
374
|
+
"dismiss-away": !0,
|
|
375
|
+
header: "Edit card",
|
|
376
|
+
modelValue: e(B),
|
|
377
|
+
"onUpdate:modelValue": [
|
|
378
|
+
n[10] || (n[10] = (l) => G(B) ? B.value = l : null),
|
|
379
|
+
n[11] || (n[11] = (l) => B.value = l)
|
|
380
|
+
]
|
|
381
|
+
}, {
|
|
382
|
+
"side-sheet-footer": _(() => [
|
|
383
|
+
d("div", He, [
|
|
384
|
+
i(g, {
|
|
385
|
+
label: "Save",
|
|
386
|
+
disabled: !!e(o).redeemedAt,
|
|
387
|
+
onClick: n[8] || (n[8] = (l) => h(e(o))),
|
|
388
|
+
loading: e(ue)().isLoading
|
|
389
|
+
}, null, 8, ["disabled", "loading"]),
|
|
390
|
+
i(g, {
|
|
391
|
+
label: "Cancel",
|
|
392
|
+
type: "button",
|
|
393
|
+
variant: "tertiary",
|
|
394
|
+
onClick: n[9] || (n[9] = (l) => B.value = !1)
|
|
395
|
+
})
|
|
396
|
+
])
|
|
397
|
+
]),
|
|
398
|
+
default: _(() => [
|
|
399
|
+
i(c, {
|
|
400
|
+
ref_key: "form",
|
|
401
|
+
ref: M,
|
|
402
|
+
class: "space-y-40",
|
|
403
|
+
onValidationSuccess: n[6] || (n[6] = (l) => x.value = !0),
|
|
404
|
+
onValidationFailed: n[7] || (n[7] = (l) => x.value = !1)
|
|
405
|
+
}, {
|
|
406
|
+
default: _(() => {
|
|
407
|
+
var l, V, U;
|
|
408
|
+
return [
|
|
409
|
+
d("div", Te, [
|
|
410
|
+
i(u, {
|
|
411
|
+
modelValue: e(o).serialNumber,
|
|
412
|
+
"onUpdate:modelValue": n[0] || (n[0] = (p) => e(o).serialNumber = p),
|
|
413
|
+
label: "Card Number",
|
|
414
|
+
rules: [
|
|
415
|
+
e(xe).toRule(e(ye).string().min(1, "Card number is required"))
|
|
416
|
+
],
|
|
417
|
+
required: !0
|
|
418
|
+
}, null, 8, ["modelValue", "rules"]),
|
|
419
|
+
n[12] || (n[12] = d("div", { class: "fm-typo-en-body-lg-600" }, "Card Settings", -1)),
|
|
420
|
+
i(r, {
|
|
421
|
+
"label-placement": "right",
|
|
422
|
+
label: "Set card number on bind",
|
|
423
|
+
"model-value": e(o).setCardOnBind || !1,
|
|
424
|
+
"onUpdate:modelValue": n[1] || (n[1] = (p) => e(o).setCardOnBind = p)
|
|
425
|
+
}, null, 8, ["model-value"]),
|
|
426
|
+
i(Q, {
|
|
427
|
+
label: "Activate bundle on bind",
|
|
428
|
+
placeholder: "Select bundle",
|
|
429
|
+
items: e(N).filter((p) => !p.stripePriceId).map((p) => ({ label: p.name, value: p._id })),
|
|
430
|
+
modelValue: e(o).bundle,
|
|
431
|
+
"onUpdate:modelValue": n[3] || (n[3] = (p) => e(o).bundle = p)
|
|
432
|
+
}, {
|
|
433
|
+
append: _(() => [
|
|
434
|
+
e(o).bundle ? (m(), F(g, {
|
|
435
|
+
key: 0,
|
|
436
|
+
icon: "link_off",
|
|
437
|
+
variant: "plain",
|
|
438
|
+
onClick: n[2] || (n[2] = (p) => e(o).bundle = null)
|
|
439
|
+
})) : k("", !0)
|
|
440
|
+
]),
|
|
441
|
+
_: 1
|
|
442
|
+
}, 8, ["items", "modelValue"]),
|
|
443
|
+
(V = (l = e(f).store) == null ? void 0 : l.stripe) != null && V.apiKey ? (m(), F(Q, {
|
|
444
|
+
key: 0,
|
|
445
|
+
label: "Linked subscription bundle",
|
|
446
|
+
placeholder: "Select bundle",
|
|
447
|
+
items: e(N).filter((p) => p.stripePriceId).map((p) => ({ label: p.name, value: p._id })),
|
|
448
|
+
modelValue: e(o).subscriptionBundle,
|
|
449
|
+
"onUpdate:modelValue": n[5] || (n[5] = (p) => e(o).subscriptionBundle = p)
|
|
450
|
+
}, {
|
|
451
|
+
append: _(() => [
|
|
452
|
+
e(o).subscriptionBundle ? (m(), F(g, {
|
|
453
|
+
key: 0,
|
|
454
|
+
icon: "link_off",
|
|
455
|
+
variant: "plain",
|
|
456
|
+
onClick: n[4] || (n[4] = (p) => e(o).subscriptionBundle = null)
|
|
457
|
+
})) : k("", !0)
|
|
458
|
+
]),
|
|
459
|
+
_: 1
|
|
460
|
+
}, 8, ["items", "modelValue"])) : k("", !0)
|
|
461
|
+
]),
|
|
462
|
+
e(f).membership.design ? (m(), $("div", Le, [
|
|
463
|
+
d("div", Oe, [
|
|
464
|
+
n[13] || (n[13] = d("p", { class: "fm-typo-en-title-sm-800" }, "Design preview", -1)),
|
|
465
|
+
d("img", {
|
|
466
|
+
src: (U = e(D)) == null ? void 0 : U.image,
|
|
467
|
+
class: "aspect-[16/9]"
|
|
468
|
+
}, null, 8, Ye),
|
|
469
|
+
d("div", Ke, [
|
|
470
|
+
(m(!0), $(z, null, H(e(f).membership.design, (p, P) => (m(), $("img", {
|
|
471
|
+
src: p.image,
|
|
472
|
+
key: `image_${P}`,
|
|
473
|
+
class: re(["w-[112px] h-[63px] cursor-pointer", `${e(b) === P ? "border-[2px] border-fm-color-primary" : ""}`]),
|
|
474
|
+
onClick: (q) => b.value = P,
|
|
475
|
+
alt: `ai_image_predict_${P}`,
|
|
476
|
+
style: { objectFit: "cover" }
|
|
477
|
+
}, null, 10, Ge))), 128))
|
|
478
|
+
])
|
|
479
|
+
])
|
|
480
|
+
])) : k("", !0)
|
|
481
|
+
];
|
|
482
|
+
}),
|
|
483
|
+
_: 1
|
|
484
|
+
}, 512)
|
|
485
|
+
]),
|
|
486
|
+
_: 1
|
|
487
|
+
}, 8, ["modelValue"]);
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
}), Ze = {
|
|
491
|
+
key: 0,
|
|
492
|
+
class: "grid grid-cols-1 gap-8"
|
|
493
|
+
}, Xe = { class: "flex items-center gap-8" }, Je = { class: "flex items-center gap-8" }, We = 5, et = /* @__PURE__ */ Z({
|
|
494
|
+
__name: "CardDesignSheet",
|
|
495
|
+
emits: ["success"],
|
|
496
|
+
setup(ee, { expose: j, emit: T }) {
|
|
497
|
+
const { minor: A } = J, f = W(), M = ge(), x = y(!1);
|
|
498
|
+
y(), y(!1);
|
|
499
|
+
const w = y(), o = y(null);
|
|
500
|
+
E(() => {
|
|
501
|
+
var u, r;
|
|
502
|
+
return Math.min((((r = (u = w.value) == null ? void 0 : u.design) == null ? void 0 : r.length) ?? 0) + 1, We);
|
|
503
|
+
});
|
|
504
|
+
const B = T, s = E(() => {
|
|
505
|
+
var u, r;
|
|
506
|
+
return ((r = (u = f.membership) == null ? void 0 : u.design) == null ? void 0 : r.filter((g) => g.image)) || [];
|
|
507
|
+
}), b = y(!1);
|
|
508
|
+
function D(u) {
|
|
509
|
+
b.value = u;
|
|
510
|
+
}
|
|
511
|
+
function N() {
|
|
512
|
+
x.value = !0;
|
|
513
|
+
}
|
|
514
|
+
async function h() {
|
|
515
|
+
await A(
|
|
516
|
+
async () => {
|
|
517
|
+
var g;
|
|
518
|
+
const u = _e(w.value), r = Ce.parse(u);
|
|
519
|
+
if (r.design = (r == null ? void 0 : r.design) || [], o.value) {
|
|
520
|
+
const c = Se().toHexString(), t = await se.update(
|
|
521
|
+
se.designPath(c, o.value),
|
|
522
|
+
o.value
|
|
523
|
+
);
|
|
524
|
+
(g = r.design) == null || g.push({
|
|
525
|
+
_id: c,
|
|
526
|
+
image: t
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
await L.update(r), await n(), await B("success"), o.value = null, x.value = !1;
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
message: "Saving card design",
|
|
533
|
+
successMessage: "Card design saved"
|
|
534
|
+
}
|
|
535
|
+
);
|
|
536
|
+
}
|
|
537
|
+
async function C(u, r) {
|
|
538
|
+
u ? o.value = u : r && M.open({
|
|
539
|
+
title: "Delete Design",
|
|
540
|
+
message: "Are you sure you want to delete this design?",
|
|
541
|
+
primaryActions: { text: "Delete", close: !0 },
|
|
542
|
+
secondaryActions: { text: "Cancel", close: !1 }
|
|
543
|
+
}).onPrimary(async () => {
|
|
544
|
+
var c, t;
|
|
545
|
+
const g = (c = w.value.design) == null ? void 0 : c.findIndex((l) => l._id == r);
|
|
546
|
+
console.log(g), g !== -1 && ((t = w.value.design) == null || t.splice(g, 1)), await h();
|
|
547
|
+
}).onSecondary(() => {
|
|
548
|
+
M.close();
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
async function n() {
|
|
552
|
+
await f.readMembership(), w.value = f.membership;
|
|
553
|
+
}
|
|
554
|
+
return j({
|
|
555
|
+
showSheet: D
|
|
556
|
+
}), X(async () => {
|
|
557
|
+
await n(), s.value.length || (x.value = !0);
|
|
558
|
+
}), (u, r) => {
|
|
559
|
+
const g = v("FmButton"), c = v("FmSideSheet");
|
|
560
|
+
return m(), F(c, {
|
|
561
|
+
"max-width": 560,
|
|
562
|
+
"dismiss-away": !0,
|
|
563
|
+
header: "Manage Design",
|
|
564
|
+
modelValue: e(b),
|
|
565
|
+
"onUpdate:modelValue": [
|
|
566
|
+
r[2] || (r[2] = (t) => G(b) ? b.value = t : null),
|
|
567
|
+
r[3] || (r[3] = (t) => b.value = t)
|
|
568
|
+
]
|
|
569
|
+
}, pe({
|
|
570
|
+
default: _(() => [
|
|
571
|
+
e(x) ? k("", !0) : (m(), $("div", Ze, [
|
|
572
|
+
(m(!0), $(z, null, H(e(s), (t) => (m(), F(ie, {
|
|
573
|
+
key: String(t._id),
|
|
574
|
+
"image-fit": "cover",
|
|
575
|
+
label: "",
|
|
576
|
+
"aspect-ratio": "16/9",
|
|
577
|
+
thumbnail: t.image,
|
|
578
|
+
accept: ".png, .jpg, .jpeg, .gif",
|
|
579
|
+
"recommended-size": "Recommended 16:9 ratio / 1280px x 720px",
|
|
580
|
+
file: void 0,
|
|
581
|
+
"delete-button": !1
|
|
582
|
+
}, {
|
|
583
|
+
"delete-button": _(() => [
|
|
584
|
+
i(g, {
|
|
585
|
+
class: "!text-neutral-50 !bg-neutral-700",
|
|
586
|
+
icon: "delete",
|
|
587
|
+
variant: "tertiary",
|
|
588
|
+
onClick: (l) => C(null, t._id)
|
|
589
|
+
}, null, 8, ["onClick"])
|
|
590
|
+
]),
|
|
591
|
+
_: 2
|
|
592
|
+
}, 1032, ["thumbnail"]))), 128))
|
|
593
|
+
])),
|
|
594
|
+
e(x) ? (m(), F(ie, {
|
|
595
|
+
key: 1,
|
|
596
|
+
"image-fit": "cover",
|
|
597
|
+
label: "",
|
|
598
|
+
"aspect-ratio": "16/9",
|
|
599
|
+
accept: ".png, .jpg, .jpeg, .gif",
|
|
600
|
+
"recommended-size": "Recommended 16:9 ratio / 1280px x 720px",
|
|
601
|
+
"onUpdate:file": C
|
|
602
|
+
})) : k("", !0)
|
|
603
|
+
]),
|
|
604
|
+
_: 2
|
|
605
|
+
}, [
|
|
606
|
+
e(x) ? {
|
|
607
|
+
name: "side-sheet-footer",
|
|
608
|
+
fn: _(() => [
|
|
609
|
+
d("div", Je, [
|
|
610
|
+
i(g, {
|
|
611
|
+
label: "Save",
|
|
612
|
+
onClick: h,
|
|
613
|
+
disabled: !e(o)
|
|
614
|
+
}, null, 8, ["disabled"]),
|
|
615
|
+
i(g, {
|
|
616
|
+
label: "Cancel",
|
|
617
|
+
type: "button",
|
|
618
|
+
variant: "tertiary",
|
|
619
|
+
onClick: r[1] || (r[1] = (t) => x.value = !1)
|
|
620
|
+
})
|
|
621
|
+
])
|
|
622
|
+
]),
|
|
623
|
+
key: "1"
|
|
624
|
+
} : {
|
|
625
|
+
name: "side-sheet-footer",
|
|
626
|
+
fn: _(() => [
|
|
627
|
+
d("div", Xe, [
|
|
628
|
+
i(g, {
|
|
629
|
+
label: "Add Design",
|
|
630
|
+
onClick: N
|
|
631
|
+
}),
|
|
632
|
+
i(g, {
|
|
633
|
+
label: "Cancel",
|
|
634
|
+
type: "button",
|
|
635
|
+
variant: "tertiary",
|
|
636
|
+
onClick: r[0] || (r[0] = (t) => b.value = !1)
|
|
637
|
+
})
|
|
638
|
+
])
|
|
639
|
+
]),
|
|
640
|
+
key: "0"
|
|
641
|
+
}
|
|
642
|
+
]), 1032, ["modelValue"]);
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
}), tt = { class: "flex items-center" }, lt = { class: "fm-typo-en-title-md-600 fm-step-title line-clamp-2 mr-8" }, at = { class: "px-24 flex flex-col pb-24 gap-y-16" }, nt = { class: "flex items-center justify-end" }, ot = { class: "flex flex-col gap-16 text-center" }, st = { class: "fm-typo-en-title-sm-800" }, it = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, rt = { class: "flex gap-x-8" }, Rt = /* @__PURE__ */ Z({
|
|
646
|
+
__name: "Card",
|
|
647
|
+
setup(ee) {
|
|
648
|
+
const { minor: j, global: T } = J, A = y(), f = y(), M = y(), x = we(), w = W(), { t: o } = Be(), B = E(
|
|
649
|
+
() => w.sortedStoreCategories.flatMap((t) => t.bundles)
|
|
650
|
+
), s = [
|
|
651
|
+
{
|
|
652
|
+
header: o("connect.loyalty.card.table.card_number"),
|
|
653
|
+
accessorFn: (t) => t.serialNumber
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
header: o("connect.loyalty.card.table.redeemed_by"),
|
|
657
|
+
accessorKey: "user",
|
|
658
|
+
enableSorting: !1,
|
|
659
|
+
cell(t) {
|
|
660
|
+
const l = t.row.original.pf_member;
|
|
661
|
+
return K(
|
|
662
|
+
"div",
|
|
663
|
+
{
|
|
664
|
+
class: "flex items-center gap-x-8"
|
|
665
|
+
},
|
|
666
|
+
[
|
|
667
|
+
K(oe.FmAvatar, {
|
|
668
|
+
name: l != null && l.photoUrl || l == null ? void 0 : l.name,
|
|
669
|
+
src: (l == null ? void 0 : l.photoUrl) ?? void 0,
|
|
670
|
+
size: "sm"
|
|
671
|
+
}),
|
|
672
|
+
K("span", { class: "fm-typo-en-body-sm-400" }, l == null ? void 0 : l.name)
|
|
673
|
+
]
|
|
674
|
+
);
|
|
675
|
+
}
|
|
676
|
+
},
|
|
677
|
+
{
|
|
678
|
+
header: o("connect.loyalty.card.table.phone"),
|
|
679
|
+
accessorFn: (t) => {
|
|
680
|
+
var l;
|
|
681
|
+
return ((l = t.pf_member) == null ? void 0 : l.phoneNumber) || "-";
|
|
682
|
+
},
|
|
683
|
+
accessorKey: "pf_member.phoneNumber"
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
header: o("connect.loyalty.card.table.created_at"),
|
|
687
|
+
accessorKey: "_id",
|
|
688
|
+
accessorFn: (t) => ne(Ue(t._id.toString())).format("DD MMM YYYY hh:mmA")
|
|
689
|
+
},
|
|
690
|
+
{
|
|
691
|
+
header: o("connect.loyalty.card.table.bundle"),
|
|
692
|
+
accessorFn: (t) => {
|
|
693
|
+
var l;
|
|
694
|
+
return ((l = B.value.find((V) => V._id === t.bundle)) == null ? void 0 : l.name) || "-";
|
|
695
|
+
}
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
header: o("connect.loyalty.card.table.redeemed_at"),
|
|
699
|
+
accessorKey: "redeemedAt",
|
|
700
|
+
accessorFn: (t) => t.redeemedAt ? ne(t.redeemedAt).format("DD MMM YYYY hh:mmA") : "-"
|
|
701
|
+
},
|
|
702
|
+
{
|
|
703
|
+
header: o("connect.loyalty.card.table.actions"),
|
|
704
|
+
cell(t) {
|
|
705
|
+
return K(oe.FmButton, {
|
|
706
|
+
variant: "tertiary",
|
|
707
|
+
icon: "delete",
|
|
708
|
+
iconColor: "neutral-gray-400",
|
|
709
|
+
disabled: !!t.row.original.redeemedAt,
|
|
710
|
+
onClick: (l) => {
|
|
711
|
+
l.stopPropagation(), r(t.row.original);
|
|
712
|
+
}
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
], { tableMeta: b, rowData: D, onSort: N, debouncedFetchData: h, onSearch: C } = $e(L.readCards);
|
|
717
|
+
async function n() {
|
|
718
|
+
var t;
|
|
719
|
+
await h(), (t = A.value) == null || t.showSheet(!1);
|
|
720
|
+
}
|
|
721
|
+
const u = E(() => x.isPremium ? [
|
|
722
|
+
{
|
|
723
|
+
label: o("connect.loyalty.card.actions.create"),
|
|
724
|
+
value: "create",
|
|
725
|
+
isPrimary: !0
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
label: o("connect.loyalty.card.actions.manage_design"),
|
|
729
|
+
value: "design",
|
|
730
|
+
isPrimary: !0
|
|
731
|
+
}
|
|
732
|
+
] : []);
|
|
733
|
+
async function r(t) {
|
|
734
|
+
await de.remove(
|
|
735
|
+
`Are you sure you want to remove card ${t.serialNumber}?`
|
|
736
|
+
) && await j(
|
|
737
|
+
async () => {
|
|
738
|
+
await L.deleteCard(t._id.toString()), await h({ pageSize: 10, pageIndex: 0 });
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
message: `Removing card ${t.serialNumber}`,
|
|
742
|
+
successMessage: `Removed card ${t.serialNumber} successfully`
|
|
743
|
+
}
|
|
744
|
+
);
|
|
745
|
+
}
|
|
746
|
+
async function g(t) {
|
|
747
|
+
const l = new Ve(), V = t.map((U) => ({
|
|
748
|
+
CardNumber: U
|
|
749
|
+
}));
|
|
750
|
+
l.addRecords(V), await ke(
|
|
751
|
+
l.buildExcel(),
|
|
752
|
+
`cards-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
|
|
753
|
+
{
|
|
754
|
+
bookType: "xlsx",
|
|
755
|
+
bookSST: !1,
|
|
756
|
+
type: "array"
|
|
757
|
+
}
|
|
758
|
+
);
|
|
759
|
+
}
|
|
760
|
+
const c = (t) => {
|
|
761
|
+
var l;
|
|
762
|
+
if (t.redeemedAt) {
|
|
763
|
+
ve.error("Update not permitted", 2e3);
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
(l = f == null ? void 0 : f.value) == null || l.showSheet(!0, t);
|
|
767
|
+
};
|
|
768
|
+
return X(async () => {
|
|
769
|
+
await T(async () => {
|
|
770
|
+
await x.readPremium(), await w.readMemberStore(), await w.readMembership(), await n();
|
|
771
|
+
});
|
|
772
|
+
}), (t, l) => {
|
|
773
|
+
const V = v("FmPill"), U = v("FmPageHead"), p = v("FmSearch"), P = v("FmButton"), q = v("FmCard");
|
|
774
|
+
return m(), $(z, null, [
|
|
775
|
+
i(U, {
|
|
776
|
+
title: e(o)("connect.loyalty.card.title"),
|
|
777
|
+
actions: e(u),
|
|
778
|
+
"onClick:action": l[0] || (l[0] = (S) => {
|
|
779
|
+
var I, O;
|
|
780
|
+
console.log(S), S === "design" && ((I = e(M)) == null || I.showSheet(!0)), S === "create" && ((O = e(A)) == null || O.showSheet(!0));
|
|
781
|
+
})
|
|
782
|
+
}, {
|
|
783
|
+
title: _(() => [
|
|
784
|
+
d("div", tt, [
|
|
785
|
+
d("span", lt, te(e(o)("connect.loyalty.card.title")), 1),
|
|
786
|
+
i(V, {
|
|
787
|
+
class: "ml-8",
|
|
788
|
+
variant: "premium"
|
|
789
|
+
})
|
|
790
|
+
])
|
|
791
|
+
]),
|
|
792
|
+
_: 1
|
|
793
|
+
}, 8, ["title", "actions"]),
|
|
794
|
+
d("div", at, [
|
|
795
|
+
e(D).length > 0 || e(D).length <= 0 && e(b).searchValue || e(b).pageCount > 0 ? (m(), $(z, { key: 0 }, [
|
|
796
|
+
d("div", nt, [
|
|
797
|
+
i(p, {
|
|
798
|
+
class: "mt-4",
|
|
799
|
+
modelValue: e(b).searchValue,
|
|
800
|
+
"onUpdate:modelValue": [
|
|
801
|
+
l[1] || (l[1] = (S) => e(b).searchValue = S),
|
|
802
|
+
e(C)
|
|
803
|
+
],
|
|
804
|
+
placeholder: "Search",
|
|
805
|
+
collapsible: ""
|
|
806
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
807
|
+
i(P, {
|
|
808
|
+
icon: "ios_share",
|
|
809
|
+
variant: "tertiary",
|
|
810
|
+
onClick: fe(e(Fe), ["prevent"])
|
|
811
|
+
}, null, 8, ["onClick"])
|
|
812
|
+
]),
|
|
813
|
+
i(Me, {
|
|
814
|
+
loading: e(b).isLoading,
|
|
815
|
+
"row-data": e(D),
|
|
816
|
+
"row-count": e(b).totalRows,
|
|
817
|
+
"column-defs": s,
|
|
818
|
+
"shrink-at": !1,
|
|
819
|
+
"page-count": e(b).pageCount,
|
|
820
|
+
"page-index": e(b).pageIndex,
|
|
821
|
+
"page-size": e(b).pageSize,
|
|
822
|
+
onSortChange: e(N),
|
|
823
|
+
onPageChange: l[2] || (l[2] = (S) => {
|
|
824
|
+
e(h)({
|
|
825
|
+
pageSize: S.pageSize,
|
|
826
|
+
pageIndex: S.pageIndex
|
|
827
|
+
});
|
|
828
|
+
}),
|
|
829
|
+
onRowClick: l[3] || (l[3] = (S) => {
|
|
830
|
+
c(e(he)(S.original));
|
|
831
|
+
})
|
|
832
|
+
}, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"])
|
|
833
|
+
], 64)) : (m(), F(q, {
|
|
834
|
+
key: 1,
|
|
835
|
+
variant: "outlined",
|
|
836
|
+
class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
|
|
837
|
+
}, {
|
|
838
|
+
default: _(() => [
|
|
839
|
+
l[7] || (l[7] = d("img", {
|
|
840
|
+
src: be,
|
|
841
|
+
class: "aspect-square w-[150px]"
|
|
842
|
+
}, null, -1)),
|
|
843
|
+
d("div", ot, [
|
|
844
|
+
d("div", st, te(e(o)("connect.loyalty.card.empty_state.title")), 1),
|
|
845
|
+
d("div", it, te(e(o)("connect.loyalty.card.empty_state.description")), 1)
|
|
846
|
+
]),
|
|
847
|
+
d("div", rt, [
|
|
848
|
+
i(P, {
|
|
849
|
+
variant: "primary",
|
|
850
|
+
label: e(o)("connect.loyalty.card.actions.add"),
|
|
851
|
+
icon: "add",
|
|
852
|
+
disabled: !e(x).isPremium,
|
|
853
|
+
onClick: l[4] || (l[4] = () => {
|
|
854
|
+
var S;
|
|
855
|
+
return (S = e(A)) == null ? void 0 : S.showSheet(!0);
|
|
856
|
+
})
|
|
857
|
+
}, null, 8, ["label", "disabled"]),
|
|
858
|
+
i(P, {
|
|
859
|
+
variant: "secondary",
|
|
860
|
+
label: e(o)("connect.loyalty.card.actions.manage_design"),
|
|
861
|
+
disabled: !e(x).isPremium,
|
|
862
|
+
onClick: l[5] || (l[5] = () => {
|
|
863
|
+
var S;
|
|
864
|
+
return (S = e(M)) == null ? void 0 : S.showSheet(!0);
|
|
865
|
+
})
|
|
866
|
+
}, null, 8, ["label", "disabled"])
|
|
867
|
+
])
|
|
868
|
+
]),
|
|
869
|
+
_: 1
|
|
870
|
+
})),
|
|
871
|
+
i(je, {
|
|
872
|
+
ref_key: "sheetRef",
|
|
873
|
+
ref: A,
|
|
874
|
+
onSuccess: n,
|
|
875
|
+
onExport: g
|
|
876
|
+
}, null, 512),
|
|
877
|
+
i(et, {
|
|
878
|
+
ref_key: "designSheetRef",
|
|
879
|
+
ref: M,
|
|
880
|
+
onSuccess: n
|
|
881
|
+
}, null, 512),
|
|
882
|
+
i(Qe, {
|
|
883
|
+
ref_key: "editSheetRef",
|
|
884
|
+
ref: f,
|
|
885
|
+
onSuccess: l[6] || (l[6] = (S) => {
|
|
886
|
+
var I;
|
|
887
|
+
n(), (I = e(f)) == null || I.showSheet(!1);
|
|
888
|
+
})
|
|
889
|
+
}, null, 512)
|
|
890
|
+
])
|
|
891
|
+
], 64);
|
|
892
|
+
};
|
|
893
|
+
}
|
|
894
|
+
});
|
|
895
|
+
export {
|
|
896
|
+
Rt as default
|
|
897
|
+
};
|