@feedmepos/mf-connect 0.0.6 → 0.0.7
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-BJYHu6np.js → Analytic-D-E67IbN.js} +8 -8
- package/dist/{Broadcast-B8FNr597.js → Broadcast-NjpOa4PK.js} +8 -8
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BlZ4cdrl.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-7KnDJ-sV.js} +8 -8
- package/dist/{Card-DLHnQyMF.js → Card-BOEkf7wo.js} +16 -16
- package/dist/{Collections-d7N7aO1G.js → Collections-sLYCpBxu.js} +16 -16
- package/dist/{Credit-DWbl28df.js → Credit-DU2_9ex7.js} +8 -8
- package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-DBRqd0z4.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-CBO6OHrM.js} +21 -21
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-DTxJHWjb.js → EffectSheet.vue_vue_type_style_index_0_lang-CTvGOX7T.js} +5 -5
- package/dist/{Experience-Bzt7yrvt.js → Experience-DGNdVxuU.js} +8 -8
- package/dist/{Game-IRXuMUL3.js → Game-B1i79HLc.js} +8 -8
- package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-C8d0t8nQ.js → ImageInput.vue_vue_type_script_setup_true_lang-DzdMpEl_.js} +1 -1
- package/dist/{MainLayout-DDh1WuO8.js → MainLayout-CfgDdm6k.js} +1 -1
- package/dist/{Marketing-C2kkxDFL.js → Marketing-CBre7DEM.js} +5 -5
- package/dist/Member-BfvuL8GL.js +91 -0
- package/dist/MemberList-CQ17Q4V7.js +1664 -0
- package/dist/{MemberTransactions-DNIJDHOQ.js → MemberTransactions-Cviim4GX.js} +4 -4
- package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-DYWmeADi.js → MessageInput.vue_vue_type_script_setup_true_lang-j31pc2Wx.js} +2 -2
- package/dist/{Point-Bgp7ogL-.js → Point-9ta-6dJv.js} +8 -8
- package/dist/{Promotion-Dk6STeBk.js → Promotion-CBmH5FNG.js} +9 -9
- package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-BXzBoSgP.js → RuleGroup.vue_vue_type_script_setup_true_lang-r9Q-pOrs.js} +12 -12
- package/dist/{Segment-BEQJcNkY.js → Segment-ZUtFZM5W.js} +10 -10
- package/dist/{Setting-CZi479L2.js → Setting-TQdqaKPQ.js} +9 -9
- package/dist/Store-DX1ALcTQ.js +1424 -0
- package/dist/StoreRewards-Bd1ZFUQM.js +434 -0
- package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-Bdo4vZkG.js → StoreTransactions.vue_vue_type_script_setup_true_lang-D0L-LkOm.js} +5 -5
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-DQQ-EPvQ.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-C0xL6Ua_.js} +1 -1
- package/dist/{Tier-DS1BnVuA.js → Tier-DAUABM7F.js} +17 -17
- package/dist/{Title-Dc3COZA9.js → Title-YJtGygMA.js} +15 -15
- package/dist/{Transaction-BCa3ObND.js → Transaction-DmvmaPk6.js} +1 -1
- package/dist/Voucher-D88gJYa3.js +449 -0
- package/dist/{app-DldkpdyI.js → app-g6ra_l_x.js} +1455 -1455
- package/dist/app.js +1 -1
- package/dist/{campaign-COrVPhtR.js → campaign-DdY0vnwY.js} +2 -2
- package/dist/{dto-lHIRZTaN.js → dto-BQHDb7XC.js} +8 -8
- package/dist/{effect-B4_HDofh.js → effect-CghM-w8z.js} +1 -1
- package/dist/{helper-CwQEM81T.js → helper-xWsMhdHl.js} +1 -1
- package/dist/{index-D8ae8TSh.js → index-B4ootZIL.js} +2 -2
- package/dist/{index-DApTNNm8.js → index-BSF_A6Bx.js} +2 -2
- package/dist/{index-CDXgQC_P.js → index-Bp8rb1uM.js} +5 -5
- package/dist/{index-DCIJl8iK.js → index-C5UTq5_2.js} +2 -2
- package/dist/{index-BDLy_dUj.js → index-CPU_mtDw.js} +3 -3
- package/dist/{index-DujHgfez.js → index-CVSXd2FW.js} +5 -5
- package/dist/{index-D3Oa_lL4.js → index-Cl-b6jYW.js} +1 -1
- package/dist/{index-ClQze5GX.js → index-D71HFulf.js} +1 -1
- package/dist/{index-Cd-A6imB.js → index-Dz8i7yJ_.js} +1 -1
- package/dist/{index-BGEOMkg0.js → index-gLwPyXKM.js} +1 -1
- package/dist/{loading-CEcLG67g.js → loading-DClM7b3o.js} +2 -2
- package/dist/{lodash-CQck_rTn.js → lodash-wTDGx83S.js} +1 -1
- package/dist/{membership-Bat0mrVs.js → membership-BEDm55VI.js} +3 -3
- package/dist/{money-JE8h3c0z.js → money-CPy2C0LJ.js} +1 -1
- package/dist/{number-D5WgTK0X.js → number-ROACK3bi.js} +1 -1
- package/dist/{plugins-B53iVLET.js → plugins-CJou3ejy.js} +4 -4
- package/dist/{rule-lH1B2od5.js → rule-Cp7qN96m.js} +2 -2
- package/dist/{rule-builder-D6chADAd.js → rule-builder-OR4oX_mq.js} +1 -1
- package/dist/{template-D4IPNePW.js → template-Dk2sky27.js} +5 -5
- package/dist/{usePagination-MD91K8Ao.js → usePagination-DRHXkOF-.js} +1 -1
- package/dist/{xlsx-zo_mxA6a.js → xlsx-C5St1Lch.js} +1 -1
- package/package.json +1 -1
- package/dist/Member-CNfC-lCV.js +0 -90
- package/dist/MemberList-B_lQ2EIK.js +0 -1663
- package/dist/Store-BeH0Gm7T.js +0 -1423
- package/dist/StoreRewards-BgYxgC_0.js +0 -433
- package/dist/Voucher-BG51P9yR.js +0 -448
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
import { defineComponent as N, ref as g, watch as H, onMounted as D, resolveComponent as d, openBlock as _, createBlock as U, unref as o, isRef as O, withCtx as V, createElementVNode as l, createVNode as i, toDisplayString as I, computed as Q, createElementBlock as B, Fragment as A, renderList as W, resolveDynamicComponent as Z, h as y } from "vue";
|
|
2
|
+
import { _ as Y } from "./campaign-CpzFl8Vr.js";
|
|
3
|
+
import { useDialog as ee, components as S } from "@feedmepos/ui-library";
|
|
4
|
+
import { p as z, c as ae } from "./plugins-CJou3ejy.js";
|
|
5
|
+
import { useCoreStore as oe } from "@feedmepos/mf-common";
|
|
6
|
+
import { u as q } from "./loading-DClM7b3o.js";
|
|
7
|
+
import { u as te, J as ne, a as se, R as le } from "./app-g6ra_l_x.js";
|
|
8
|
+
import { u as ie } from "./campaign-DdY0vnwY.js";
|
|
9
|
+
import { g as K, b as j } from "./dto-BQHDb7XC.js";
|
|
10
|
+
import { u as re } from "./template-Dk2sky27.js";
|
|
11
|
+
import { _ as ce } from "./EditCampaignSheet.vue_vue_type_script_setup_true_lang-CBO6OHrM.js";
|
|
12
|
+
import { _ as ue } from "./ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js";
|
|
13
|
+
import { l as me } from "./lodash-wTDGx83S.js";
|
|
14
|
+
import { m as de } from "./index-gLwPyXKM.js";
|
|
15
|
+
import { c as x } from "./index-D71HFulf.js";
|
|
16
|
+
import { useRouter as pe } from "vue-router";
|
|
17
|
+
const fe = { class: "space-y-16" }, he = { class: "fm-typo-en-body-md-600" }, ge = { class: "flex items-center justify-end" }, ye = { class: "flex items-center gap-8" }, ve = /* @__PURE__ */ N({
|
|
18
|
+
__name: "SendVoucherSheet",
|
|
19
|
+
emits: ["success"],
|
|
20
|
+
setup(X, { expose: L, emit: F }) {
|
|
21
|
+
const { minor: M } = q, k = g(""), r = g({}), P = F, p = g(!1), m = g([]);
|
|
22
|
+
function u(e) {
|
|
23
|
+
p.value = !0, k.value = e.campaignId;
|
|
24
|
+
}
|
|
25
|
+
function v() {
|
|
26
|
+
p.value = !1;
|
|
27
|
+
}
|
|
28
|
+
const $ = [
|
|
29
|
+
{
|
|
30
|
+
header: "Name",
|
|
31
|
+
accessorFn: (e) => e.name || "No Profile"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
header: "Phone",
|
|
35
|
+
accessorFn: (e) => e.phoneNumber || "-"
|
|
36
|
+
}
|
|
37
|
+
], s = g({
|
|
38
|
+
searchValue: "",
|
|
39
|
+
pageSize: 10,
|
|
40
|
+
pageCount: 0,
|
|
41
|
+
pageIndex: 0,
|
|
42
|
+
totalRows: 0,
|
|
43
|
+
isLoading: !1
|
|
44
|
+
}), f = g([]), b = async (e) => {
|
|
45
|
+
s.value.isLoading = !0, f.value = [];
|
|
46
|
+
const a = await de.read({
|
|
47
|
+
limit: e.pageSize,
|
|
48
|
+
skip: e.pageIndex * e.pageSize,
|
|
49
|
+
sortBy: "_id",
|
|
50
|
+
search: s.value.searchValue,
|
|
51
|
+
descending: !1
|
|
52
|
+
});
|
|
53
|
+
f.value = a.resources, s.value.totalRows = a.meta.totalResources ?? 0, s.value.pageCount = a.meta.totalPages ?? 0, s.value.isLoading = !1, r.value = {}, m.value.forEach((t) => {
|
|
54
|
+
const c = f.value.findIndex((C) => C._id == t);
|
|
55
|
+
c > -1 && (console.log(c, "fetch member index"), r.value[c] = !0);
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
function w() {
|
|
59
|
+
f.value.length > 0 && (m.value = m.value.filter(
|
|
60
|
+
(e) => f.value.some((a) => a._id != e)
|
|
61
|
+
));
|
|
62
|
+
for (const [e, a] of Object.entries(r.value)) {
|
|
63
|
+
const t = f.value[e]._id;
|
|
64
|
+
m.value.includes(t) || m.value.push(t);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
async function E(e) {
|
|
68
|
+
m.value.length < 1 || await M(
|
|
69
|
+
async () => {
|
|
70
|
+
await x.sendCollection(k.value, {
|
|
71
|
+
memberId: m.value
|
|
72
|
+
}), await P("success"), v();
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
message: "Sending claim(s)",
|
|
76
|
+
successMessage: "Claim(s) created"
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
return H(r, w, { deep: !0 }), H(
|
|
81
|
+
() => s.value.searchValue,
|
|
82
|
+
me.debounce(async () => {
|
|
83
|
+
await b({ pageSize: 10, pageIndex: 0 });
|
|
84
|
+
}, 500)
|
|
85
|
+
), L({
|
|
86
|
+
showSheet: u,
|
|
87
|
+
hideSheet: v
|
|
88
|
+
}), D(async () => {
|
|
89
|
+
await b(s.value);
|
|
90
|
+
}), (e, a) => {
|
|
91
|
+
const t = d("FmSearch"), c = d("FmTable"), C = d("FmButton"), R = d("FmSideSheet");
|
|
92
|
+
return _(), U(R, {
|
|
93
|
+
"max-width": 560,
|
|
94
|
+
"dismiss-away": !0,
|
|
95
|
+
header: "Send voucher to",
|
|
96
|
+
modelValue: o(p),
|
|
97
|
+
"onUpdate:modelValue": [
|
|
98
|
+
a[3] || (a[3] = (h) => O(p) ? p.value = h : null),
|
|
99
|
+
a[4] || (a[4] = (h) => p.value = h)
|
|
100
|
+
]
|
|
101
|
+
}, {
|
|
102
|
+
"side-sheet-footer": V(() => [
|
|
103
|
+
l("div", ye, [
|
|
104
|
+
i(C, {
|
|
105
|
+
label: "Send",
|
|
106
|
+
loading: o(te)().isLoading,
|
|
107
|
+
onClick: E
|
|
108
|
+
}, null, 8, ["loading"]),
|
|
109
|
+
i(C, {
|
|
110
|
+
label: "Cancel",
|
|
111
|
+
type: "button",
|
|
112
|
+
variant: "tertiary",
|
|
113
|
+
onClick: a[2] || (a[2] = (h) => p.value = !1)
|
|
114
|
+
})
|
|
115
|
+
])
|
|
116
|
+
]),
|
|
117
|
+
default: V(() => [
|
|
118
|
+
i(ne, { json: o(m) }, null, 8, ["json"]),
|
|
119
|
+
l("div", fe, [
|
|
120
|
+
l("div", he, I(o(m).length) + " members selected ", 1),
|
|
121
|
+
l("div", ge, [
|
|
122
|
+
i(t, {
|
|
123
|
+
class: "mt-4",
|
|
124
|
+
modelValue: o(s).searchValue,
|
|
125
|
+
"onUpdate:modelValue": a[0] || (a[0] = (h) => o(s).searchValue = h),
|
|
126
|
+
placeholder: "Search Member",
|
|
127
|
+
collapsible: ""
|
|
128
|
+
}, null, 8, ["modelValue"])
|
|
129
|
+
]),
|
|
130
|
+
i(c, {
|
|
131
|
+
modelValue: o(r),
|
|
132
|
+
"onUpdate:modelValue": a[1] || (a[1] = (h) => O(r) ? r.value = h : null),
|
|
133
|
+
class: "xs:hidden",
|
|
134
|
+
selection: "multiple",
|
|
135
|
+
loading: o(s).isLoading,
|
|
136
|
+
"row-data": o(f),
|
|
137
|
+
"column-defs": $,
|
|
138
|
+
"page-size": o(s).pageSize,
|
|
139
|
+
"page-count": o(s).pageCount,
|
|
140
|
+
"hide-footer": o(s).totalRows <= o(s).pageSize,
|
|
141
|
+
"fetch-fn": b
|
|
142
|
+
}, null, 8, ["modelValue", "loading", "row-data", "page-size", "page-count", "hide-footer"])
|
|
143
|
+
])
|
|
144
|
+
]),
|
|
145
|
+
_: 1
|
|
146
|
+
}, 8, ["modelValue"]);
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
var _e = { authUrl: "https://portal-v2-dev.feedmeapi.com/", slackWebhookUrl: "https://hooks.slack.com/services/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", appUrl: "member.feedmedev.cc", crmUrl: "crm.feedmedev.cc", marketingV1Portal: "https://marketing-v1.feedmedev.cc" };
|
|
151
|
+
const be = { class: "px-24 flex flex-col gap-y-16" }, we = { class: "flex items-center justify-between w-full" }, Ce = { class: "flex gap-8 overflow-x-auto" }, Se = { class: "space-y-8" }, xe = { class: "flex w-full gap-4 items-center" }, Ve = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Fe = { class: "space-y-4" }, ke = { class: "fm-typo-en-body-lg-600" }, Re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ue = /* @__PURE__ */ l("img", {
|
|
152
|
+
src: Y,
|
|
153
|
+
class: "aspect-square w-[150px]"
|
|
154
|
+
}, null, -1), Ie = /* @__PURE__ */ l("div", { class: "flex flex-col gap-16 text-center" }, [
|
|
155
|
+
/* @__PURE__ */ l("div", { class: "fm-typo-en-title-sm-800" }, "Create voucher campaign"),
|
|
156
|
+
/* @__PURE__ */ l("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " A digital coupon that users can redeem for discounts on future purchases. Users usually need to claim and apply the voucher to benefit from the discount. ")
|
|
157
|
+
], -1), Xe = /* @__PURE__ */ N({
|
|
158
|
+
__name: "Voucher",
|
|
159
|
+
setup(X) {
|
|
160
|
+
const L = {
|
|
161
|
+
label: "Create campaign",
|
|
162
|
+
value: "create",
|
|
163
|
+
isPrimary: !0,
|
|
164
|
+
prependIcon: "add"
|
|
165
|
+
}, F = ee(), M = re("VOUCHER", F), k = se(), r = ie(), { global: P, minor: p } = q, m = pe(), u = g({
|
|
166
|
+
searchKey: "",
|
|
167
|
+
location: null
|
|
168
|
+
}), v = Q(
|
|
169
|
+
() => r.campaigns.voucher.filter(
|
|
170
|
+
(e) => !u.value.location || !e.targetLocation || e.targetLocation.includes(u.value.location)
|
|
171
|
+
)
|
|
172
|
+
), $ = [
|
|
173
|
+
{
|
|
174
|
+
header: "Voucher title",
|
|
175
|
+
accessorFn: (e) => e.name
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
header: "Status",
|
|
179
|
+
cell(e) {
|
|
180
|
+
return K(e.row.original);
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
header: "Summary",
|
|
185
|
+
accessorFn: (e) => j(e)
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
header: "Quota",
|
|
189
|
+
accessorFn: (e) => {
|
|
190
|
+
var a;
|
|
191
|
+
return ((a = e.pf_collectible) == null ? void 0 : a.options.maxReceive) ?? "Unlimited";
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
header: "Claimed",
|
|
196
|
+
accessorFn: (e) => {
|
|
197
|
+
var a;
|
|
198
|
+
return ((a = e == null ? void 0 : e.pf_collectible) == null ? void 0 : a.currentReceive) ?? 0;
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
header: "Actions",
|
|
203
|
+
cell(e) {
|
|
204
|
+
return y("div", { class: "flex items-center justify-end" }, [
|
|
205
|
+
y(S.FmButton, {
|
|
206
|
+
icon: "visibility",
|
|
207
|
+
variant: "tertiary",
|
|
208
|
+
iconColor: "neutral-gray-400",
|
|
209
|
+
onClick: async (a) => {
|
|
210
|
+
a.stopPropagation(), await m.push({
|
|
211
|
+
name: le["$connect-CAMPAIGN_VOUCHER_COLLECTIONS"],
|
|
212
|
+
params: { id: e.row.original._id }
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}),
|
|
216
|
+
y(
|
|
217
|
+
S.FmMenu,
|
|
218
|
+
{
|
|
219
|
+
placement: "bottom-end",
|
|
220
|
+
onClick: (a) => {
|
|
221
|
+
a.stopPropagation();
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"menu-button": () => y(S.FmButton, {
|
|
226
|
+
icon: "more_vert",
|
|
227
|
+
iconColor: "neutral-gray-400",
|
|
228
|
+
variant: "tertiary"
|
|
229
|
+
}),
|
|
230
|
+
default: () => {
|
|
231
|
+
const a = [
|
|
232
|
+
y(
|
|
233
|
+
S.FmMenuItem,
|
|
234
|
+
{
|
|
235
|
+
onClick: async (t) => {
|
|
236
|
+
t.stopPropagation(), b(e.row.original);
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
label: y(
|
|
241
|
+
"div",
|
|
242
|
+
{
|
|
243
|
+
class: "text-fm-color-typo-error fm-typo-en-body-md-400"
|
|
244
|
+
},
|
|
245
|
+
"Remove"
|
|
246
|
+
)
|
|
247
|
+
}
|
|
248
|
+
)
|
|
249
|
+
];
|
|
250
|
+
return e.row.original.event.type === "SIMPLE_CLAIM" && (a.unshift(
|
|
251
|
+
y(S.FmMenuItem, {
|
|
252
|
+
label: "Send",
|
|
253
|
+
onClick: async (t) => {
|
|
254
|
+
var c;
|
|
255
|
+
t.stopPropagation(), (c = f.value) == null || c.showSheet({
|
|
256
|
+
campaignId: e.row.original._id
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
})
|
|
260
|
+
), a.unshift(
|
|
261
|
+
y(S.FmMenuItem, {
|
|
262
|
+
label: "Share",
|
|
263
|
+
onClick: async (t) => {
|
|
264
|
+
if (t.stopPropagation(), e.row.original.event.type !== "SIMPLE_CLAIM")
|
|
265
|
+
return await z.confirm(
|
|
266
|
+
"Cannot share a voucher that is not a simple claim.",
|
|
267
|
+
"Share Voucher",
|
|
268
|
+
"OK"
|
|
269
|
+
);
|
|
270
|
+
await ae(
|
|
271
|
+
`https://${oe().currentBusiness.value._id}.${_e.appUrl}/vouchers/${e.row.original._id}`,
|
|
272
|
+
{
|
|
273
|
+
successMessage: "Voucher link copied to clipboard"
|
|
274
|
+
}
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
})
|
|
278
|
+
)), a;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
)
|
|
282
|
+
]);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
], s = g(), f = g();
|
|
286
|
+
async function b(e) {
|
|
287
|
+
await z.remove(`Are you sure you want to remove ${e.name}?`) && await p(
|
|
288
|
+
async () => {
|
|
289
|
+
await x.delete(e._id), await r.read("VOUCHER");
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
message: `Removing ${e.name}`,
|
|
293
|
+
successMessage: `Removed ${e.name} successfully`
|
|
294
|
+
}
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
async function w(e) {
|
|
298
|
+
e ? await a() : M.open(async (t) => {
|
|
299
|
+
await a(t);
|
|
300
|
+
});
|
|
301
|
+
async function a(t) {
|
|
302
|
+
var c;
|
|
303
|
+
(c = s.value) == null || c.showSheet(
|
|
304
|
+
!0,
|
|
305
|
+
"VOUCHER",
|
|
306
|
+
e ? await x.readById(e._id) : void 0,
|
|
307
|
+
t
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
async function E(e) {
|
|
312
|
+
e.campaign._id && await new Promise((a) => {
|
|
313
|
+
F.open({
|
|
314
|
+
title: "Confirmation",
|
|
315
|
+
message: "This will change all future vouchers? Would you like to update previous claimed vouchers expiry date and discount?",
|
|
316
|
+
primaryActions: { text: "Update all", close: !0 },
|
|
317
|
+
secondaryActions: { text: "Update future only", close: !0 }
|
|
318
|
+
}).onPrimary(async () => {
|
|
319
|
+
var t;
|
|
320
|
+
e.updateCollections = !0, (t = window.top) == null || t.postMessage("updateAllVoucher", "*"), a();
|
|
321
|
+
}).onSecondary(async () => {
|
|
322
|
+
a();
|
|
323
|
+
});
|
|
324
|
+
}), await p(
|
|
325
|
+
async () => {
|
|
326
|
+
e.campaign._id ? await x.update(e.campaign._id, e) : await x.create(e), await r.read("VOUCHER");
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
message: `${e.campaign._id ? "Updating" : "Creating"} voucher`,
|
|
330
|
+
successMessage: `Voucher ${e.campaign._id ? "updated" : "created"} successfully`
|
|
331
|
+
}
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
return D(async () => {
|
|
335
|
+
await P(async () => {
|
|
336
|
+
await r.read("VOUCHER");
|
|
337
|
+
});
|
|
338
|
+
}), (e, a) => {
|
|
339
|
+
const t = d("FmPageHead"), c = d("FmSearch"), C = d("FmTable"), R = d("FmButton"), h = d("FmListItem"), G = d("FmList"), J = d("FmCard");
|
|
340
|
+
return _(), B(A, null, [
|
|
341
|
+
i(t, {
|
|
342
|
+
title: "Voucher",
|
|
343
|
+
actions: o(v).length > 0 ? [L] : [],
|
|
344
|
+
"onClick:action": a[0] || (a[0] = () => w())
|
|
345
|
+
}, null, 8, ["actions"]),
|
|
346
|
+
l("div", be, [
|
|
347
|
+
i(c, {
|
|
348
|
+
modelValue: o(u).searchKey,
|
|
349
|
+
"onUpdate:modelValue": a[1] || (a[1] = (n) => o(u).searchKey = n),
|
|
350
|
+
class: "hidden xs:block border-b-2 border-fm-color-neutral-gray-100",
|
|
351
|
+
placeholder: "search",
|
|
352
|
+
collapsible: ""
|
|
353
|
+
}, null, 8, ["modelValue"]),
|
|
354
|
+
o(r).campaigns.voucher && o(r).campaigns.voucher.length > 0 ? (_(), B(A, { key: 0 }, [
|
|
355
|
+
l("div", we, [
|
|
356
|
+
l("div", Ce, [
|
|
357
|
+
i(ue, {
|
|
358
|
+
modelValue: o(u).location,
|
|
359
|
+
"onUpdate:modelValue": a[2] || (a[2] = (n) => o(u).location = n),
|
|
360
|
+
label: "Location: ",
|
|
361
|
+
"show-item-label": !0,
|
|
362
|
+
icon: "storefront",
|
|
363
|
+
placement: "bottom-start",
|
|
364
|
+
items: o(k).locationItems
|
|
365
|
+
}, null, 8, ["modelValue", "items"])
|
|
366
|
+
]),
|
|
367
|
+
i(c, {
|
|
368
|
+
modelValue: o(u).searchKey,
|
|
369
|
+
"onUpdate:modelValue": a[3] || (a[3] = (n) => o(u).searchKey = n),
|
|
370
|
+
class: "xs:hidden",
|
|
371
|
+
placeholder: "search",
|
|
372
|
+
collapsible: ""
|
|
373
|
+
}, null, 8, ["modelValue"])
|
|
374
|
+
]),
|
|
375
|
+
i(C, {
|
|
376
|
+
class: "xs:hidden",
|
|
377
|
+
"row-data": o(v),
|
|
378
|
+
"column-defs": $,
|
|
379
|
+
"search-value": o(u).searchKey,
|
|
380
|
+
"column-filter": [],
|
|
381
|
+
onRowClick: a[4] || (a[4] = (n) => w(n.original)),
|
|
382
|
+
"hide-footer": o(v).length < 10
|
|
383
|
+
}, null, 8, ["row-data", "search-value", "hide-footer"]),
|
|
384
|
+
i(G, { class: "hidden xs:flex flex-col mx-[-24px]" }, {
|
|
385
|
+
default: V(() => [
|
|
386
|
+
(_(!0), B(A, null, W(o(v).filter(
|
|
387
|
+
(n) => n.name.toLowerCase().includes(o(u).searchKey.toLowerCase())
|
|
388
|
+
), (n) => (_(), U(h, {
|
|
389
|
+
key: n._id.toString(),
|
|
390
|
+
onClick: (T) => w(n),
|
|
391
|
+
class: "py-12 px-16 flex items-center justify-between border-b border-fm-color-neutral-gray-100"
|
|
392
|
+
}, {
|
|
393
|
+
default: V(() => [
|
|
394
|
+
l("div", Se, [
|
|
395
|
+
l("div", xe, [
|
|
396
|
+
(_(), U(Z(o(K)(n)))),
|
|
397
|
+
l("div", Ve, I(n.currentReceive ?? 0) + " used ", 1)
|
|
398
|
+
]),
|
|
399
|
+
l("div", Fe, [
|
|
400
|
+
l("div", ke, I(n.name), 1),
|
|
401
|
+
l("div", Re, I(o(j)(n)), 1)
|
|
402
|
+
])
|
|
403
|
+
]),
|
|
404
|
+
i(R, {
|
|
405
|
+
icon: "delete",
|
|
406
|
+
"icon-color": "neutral-gray-400",
|
|
407
|
+
variant: "tertiary",
|
|
408
|
+
onClick: (T) => (T.stopPropagation(), b(n))
|
|
409
|
+
}, null, 8, ["onClick"])
|
|
410
|
+
]),
|
|
411
|
+
_: 2
|
|
412
|
+
}, 1032, ["onClick"]))), 128))
|
|
413
|
+
]),
|
|
414
|
+
_: 1
|
|
415
|
+
})
|
|
416
|
+
], 64)) : (_(), U(J, {
|
|
417
|
+
key: 1,
|
|
418
|
+
variant: "outlined",
|
|
419
|
+
class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
|
|
420
|
+
}, {
|
|
421
|
+
default: V(() => [
|
|
422
|
+
Ue,
|
|
423
|
+
Ie,
|
|
424
|
+
i(R, {
|
|
425
|
+
variant: "primary",
|
|
426
|
+
label: "Create voucher campaign",
|
|
427
|
+
icon: "add",
|
|
428
|
+
onClick: a[5] || (a[5] = (n) => w())
|
|
429
|
+
})
|
|
430
|
+
]),
|
|
431
|
+
_: 1
|
|
432
|
+
})),
|
|
433
|
+
i(ce, {
|
|
434
|
+
ref_key: "sheetRef",
|
|
435
|
+
ref: s,
|
|
436
|
+
"onSubmit:modelValue": E
|
|
437
|
+
}, null, 512),
|
|
438
|
+
i(ve, {
|
|
439
|
+
ref_key: "sendVoucherSheetRef",
|
|
440
|
+
ref: f
|
|
441
|
+
}, null, 512)
|
|
442
|
+
])
|
|
443
|
+
], 64);
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
export {
|
|
448
|
+
Xe as default
|
|
449
|
+
};
|