@feedmepos/mf-connect 0.1.0-beta.8 → 0.1.0-prod
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-D1vIDmhJ.js +620 -0
- package/dist/{App-SRz4257n.js → App-DHrfWG8l.js} +249 -250
- package/dist/Broadcast-B2rxZAZi.js +216 -0
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CZXSxA9u.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-D2a9rcXK.js} +20 -20
- package/dist/Card-Dr6pTTM0.js +824 -0
- package/dist/Collections-0tbg0MFt.js +441 -0
- package/dist/Credit-KbB_7Jq-.js +214 -0
- package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-Cuklmxur.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-we7ADwFk.js} +999 -1018
- package/dist/EffectSheet.vue_vue_type_style_index_0_lang-VBNyvZCJ.js +344 -0
- package/dist/Experience-C_Q9Iml8.js +211 -0
- package/dist/Game-BwODw7M6.js +250 -0
- package/dist/ImageInput.vue_vue_type_script_setup_true_lang-ByhTB9Ie.js +144 -0
- package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js → MainLayout-DpZC6o3R.js} +53 -19
- package/dist/Marketing-QOKTAS_T.js +309 -0
- package/dist/Member-d7RIGRm1.js +92 -0
- package/dist/MemberList-CK9629ew.js +1737 -0
- package/dist/MemberOverview-C2n9oJZh.js +58 -0
- package/dist/{MemberTransactions-BwT3zE2a.js → MemberTransactions-D-pnlXiP.js} +1 -1
- package/dist/MessageInput.vue_vue_type_script_setup_true_lang-3VS7JnK6.js +203 -0
- package/dist/Mission-BAKDm4VZ.js +248 -0
- package/dist/Point-Puu0jKz0.js +220 -0
- package/dist/Promotion-DRIaUvJi.js +244 -0
- package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-BkFm7tXq.js → RuleGroup.vue_vue_type_script_setup_true_lang-DTdfYGya.js} +557 -557
- package/dist/Segment-DpBxGuuu.js +435 -0
- package/dist/Setting-DLB2ywCp.js +1870 -0
- package/dist/Store-8DO6ITWc.js +1513 -0
- package/dist/StoreRewards-DZfqUeYR.js +429 -0
- package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-BqpsMcl1.js → StoreTransactions.vue_vue_type_script_setup_true_lang-RTfozD01.js} +10 -10
- package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-DrzmjYmU.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BGI78ycg.js} +1 -1
- package/dist/{Tier-CJ9-d8Zg.js → Tier-BnQRujpX.js} +453 -481
- package/dist/{Title-DZCpvg4q.js → Title-BPf1tUFx.js} +295 -314
- package/dist/Transaction-ese0oNrz.js +36 -0
- package/dist/Voucher--gtOZQx1.js +485 -0
- package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-3LlSDiq0.js +140 -0
- package/dist/app-Bt59niI-.js +2974 -0
- package/dist/{app-Cg2pTZJK.js → app-DHE61XdR.js} +1 -1
- package/dist/app.js +3 -5
- package/dist/{business-Cw_qGw8y.js → business-BSo7EPan.js} +1 -1
- package/dist/{campaign-winsqufa.js → campaign-CsOje3Ap.js} +3 -5
- package/dist/{collection.fn-CI5Llblg.js → collection.fn-BYQfFJOr.js} +2 -2
- package/dist/dto-CfEXSCq6.js +1145 -0
- package/dist/{effect-CdkrIYgX.js → effect-Bn_ofYS3.js} +9 -9
- package/dist/{export-DGxfief1.js → export-CMR243CF.js} +3 -3
- package/dist/{helper-B8RqcTNu.js → helper-BqOQRtvW.js} +1 -1
- package/dist/index-BLDYTxnc.js +28058 -0
- package/dist/{index-Cw_aXFH6.js → index-BWnFs-Cb.js} +281 -299
- package/dist/{index-wzdbEEcZ.js → index-BaBNmzUb.js} +1 -1
- package/dist/{index-CjVmULNd.js → index-Boo5np6l.js} +1 -1
- package/dist/{index-HZC9LLAX.js → index-CC1GV8OW.js} +1 -1
- package/dist/{index-OzicErwL.js → index-CHO4_zsT.js} +1 -1
- package/dist/{index-DAEmawcj.js → index-DEZsrQ2f.js} +3 -3
- package/dist/{index-9w43_U1v.js → index-D_f2lmK2.js} +1 -1
- package/dist/{index-BaozRfWB.js → index-Da142OER.js} +66 -78
- package/dist/index-DbP04yeg.js +11 -0
- package/dist/{index-A34xEz20.js → index-DtPe-TEm.js} +3 -3
- package/dist/{index-BLACZ3-L.js → index-FvlaxwGB.js} +20 -20
- package/dist/{index.esm2017-CppSMh_U.js → index.esm2017-ePm--Atp.js} +55 -55
- package/dist/{loading-DuEFUCwF.js → loading-KNmEMBUB.js} +460 -469
- package/dist/{membership-nsMtWeTC.js → membership-DKoVIS1a.js} +3 -3
- package/dist/money-CkD3zl5C.js +15 -0
- package/dist/number-BDsGpOXm.js +12 -0
- package/dist/{rule-CPIMqt1h.js → rule-CzamI50_.js} +2 -2
- package/dist/{rule-builder-CSs5XRKP.js → rule-builder-DHf6wfaQ.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{template-CJZoYavu.js → template-CFAIPoD7.js} +63 -63
- package/dist/{usePagination-BeF5K3M7.js → usePagination-JoYaROkV.js} +85 -85
- package/dist/{xlsx-BZlnYinX.js → xlsx-BDJMaozs.js} +517 -517
- package/package.json +4 -7
- package/dist/Analytic-5QztrYSp.js +0 -622
- package/dist/Broadcast-DmkrJGp2.js +0 -223
- package/dist/Card-BsjFTVsH.js +0 -825
- package/dist/Collections-7wqZHOax.js +0 -453
- package/dist/Credit-CcNrq9qk.js +0 -220
- package/dist/EffectSheet.vue_vue_type_style_index_0_lang-BIZDiLns.js +0 -345
- package/dist/Experience-DNsQLzDH.js +0 -221
- package/dist/Game-DlzDerT7.js +0 -255
- package/dist/ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js +0 -144
- package/dist/MainLayout-B1aJoR95.js +0 -41
- package/dist/Marketing-BqhpaG4o.js +0 -316
- package/dist/Member-AFgZcdtz.js +0 -69
- package/dist/MemberList-BKgrLz2C.js +0 -1733
- package/dist/MemberOverview-wL_ailso.js +0 -58
- package/dist/MessageInput.vue_vue_type_script_setup_true_lang-GCEQCVOt.js +0 -432
- package/dist/Mission-BTAia7AS.js +0 -261
- package/dist/Point-Ck8EG_3k.js +0 -222
- package/dist/Promotion-0v3kvsK3.js +0 -247
- package/dist/Segment-BenLupqV.js +0 -437
- package/dist/Setting-0fpREqpJ.js +0 -1901
- package/dist/Store-BDGwe4ar.js +0 -1511
- package/dist/StoreRewards-TDZt9H1V.js +0 -401
- package/dist/Transaction-DpnTxlbf.js +0 -39
- package/dist/Voucher-DsP_rh8I.js +0 -490
- package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-SukfoJpU.js +0 -56
- package/dist/app-DzAexOqx.js +0 -5639
- package/dist/dto-ozu1smC3.js +0 -2770
- package/dist/index-CZgQVRsm.js +0 -3
- package/dist/index-Oxr-mU6h.js +0 -29193
- package/dist/money-BGZPFtUc.js +0 -15
- package/dist/number-4J0xvXP9.js +0 -12
- package/dist/vue-i18n-CCyiVzOE.js +0 -2365
- package/dist/zod-Bg2FbC-D.js +0 -90
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { defineComponent as D, ref as S, computed as T, onMounted as j, resolveComponent as l, openBlock as c, createElementBlock as g, Fragment as h, createVNode as i, unref as o, withCtx as f, createElementVNode as n, renderList as E, createBlock as C, resolveDynamicComponent as M, toDisplayString as y, h as H } from "vue";
|
|
2
|
+
import { _ as q } from "./campaign-CpzFl8Vr.js";
|
|
3
|
+
import { useDialog as z, components as G } from "@feedmepos/ui-library";
|
|
4
|
+
import { u as J, p as Q } from "./loading-KNmEMBUB.js";
|
|
5
|
+
import { u as W } from "./business-BSo7EPan.js";
|
|
6
|
+
import { u as X } from "./campaign-CsOje3Ap.js";
|
|
7
|
+
import { g as V, b as L } from "./dto-CfEXSCq6.js";
|
|
8
|
+
import { _ as Y } from "./ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js";
|
|
9
|
+
import { _ as Z } from "./EditCampaignSheet.vue_vue_type_script_setup_true_lang-we7ADwFk.js";
|
|
10
|
+
import { u as ee } from "./template-CFAIPoD7.js";
|
|
11
|
+
import { c as _ } from "./index-Boo5np6l.js";
|
|
12
|
+
const te = { class: "flex items-center" }, oe = /* @__PURE__ */ n("span", { class: "fm-typo-en-title-md-600 fm-step-title line-clamp-2 mr-8" }, "Point", -1), ae = { class: "px-24 flex flex-col gap-y-16" }, ne = { class: "flex items-center justify-between w-full" }, se = { class: "flex gap-8 overflow-x-auto" }, ie = { class: "space-y-8" }, le = { class: "flex w-full gap-4 items-center" }, re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ce = { class: "space-y-4" }, me = { class: "fm-typo-en-body-lg-600" }, de = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, pe = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ue = /* @__PURE__ */ n("img", {
|
|
13
|
+
src: q,
|
|
14
|
+
class: "aspect-square w-[150px]"
|
|
15
|
+
}, null, -1), fe = /* @__PURE__ */ n("div", { class: "flex flex-col gap-16 text-center" }, [
|
|
16
|
+
/* @__PURE__ */ n("div", { class: "fm-typo-en-title-sm-800" }, "Create your point program"),
|
|
17
|
+
/* @__PURE__ */ n("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Points are virtual point that customers can earn and use to purchase bundle items. ")
|
|
18
|
+
], -1), Se = /* @__PURE__ */ D({
|
|
19
|
+
__name: "Point",
|
|
20
|
+
setup(ye) {
|
|
21
|
+
const I = {
|
|
22
|
+
label: "Create campaign",
|
|
23
|
+
value: "create",
|
|
24
|
+
isPrimary: !0,
|
|
25
|
+
prependIcon: "add"
|
|
26
|
+
}, B = ee("COIN", z()), v = W(), r = X(), { global: $, minor: w } = J, s = S({
|
|
27
|
+
searchKey: "",
|
|
28
|
+
location: null
|
|
29
|
+
}), d = T(
|
|
30
|
+
() => r.campaigns.point.filter(
|
|
31
|
+
(e) => !s.value.location || !e.targetLocation || e.targetLocation.includes(s.value.location)
|
|
32
|
+
)
|
|
33
|
+
), K = [
|
|
34
|
+
{
|
|
35
|
+
header: "Program title",
|
|
36
|
+
accessorFn: (e) => e.name
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
header: "Status",
|
|
40
|
+
cell(e) {
|
|
41
|
+
return V(e.row.original);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
header: "Summary",
|
|
46
|
+
accessorFn: (e) => L(e)
|
|
47
|
+
//v.effect,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
header: "Actions",
|
|
51
|
+
cell(e) {
|
|
52
|
+
return H(G.FmButton, {
|
|
53
|
+
variant: "tertiary",
|
|
54
|
+
icon: "delete",
|
|
55
|
+
iconColor: "neutral-gray-400",
|
|
56
|
+
onClick: (a) => {
|
|
57
|
+
a.stopPropagation(), b(e.row.original);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
], x = S();
|
|
63
|
+
async function b(e) {
|
|
64
|
+
await Q.remove(`Are you sure you want to remove ${e.name}?`) && await w(
|
|
65
|
+
async () => {
|
|
66
|
+
await _.delete(e._id), await r.read("COIN");
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
message: `Removing ${e.name}`,
|
|
70
|
+
successMessage: `Removed ${e.name} successfully`
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
async function p(e) {
|
|
75
|
+
e ? await a() : B.open(async (m) => {
|
|
76
|
+
await a(m);
|
|
77
|
+
});
|
|
78
|
+
async function a(m) {
|
|
79
|
+
var u;
|
|
80
|
+
(u = x.value) == null || u.showSheet(
|
|
81
|
+
!0,
|
|
82
|
+
"COIN",
|
|
83
|
+
e ? await _.readById(e._id) : void 0,
|
|
84
|
+
m
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
async function N(e) {
|
|
89
|
+
await w(
|
|
90
|
+
async () => {
|
|
91
|
+
e.campaign._id ? await _.update(e.campaign._id, e) : await _.create(e), await r.read("COIN");
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
message: `${e.campaign._id ? "Updating" : "Creating"} point program`,
|
|
95
|
+
successMessage: `Point program ${e.campaign._id ? "updated" : "created"} successfully`
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
return j(async () => {
|
|
100
|
+
await $(async () => {
|
|
101
|
+
await r.read("COIN");
|
|
102
|
+
});
|
|
103
|
+
}), (e, a) => {
|
|
104
|
+
const m = l("FmPill"), u = l("FmPageHead"), F = l("FmSearch"), R = l("FmTable"), k = l("FmButton"), O = l("FmListItem"), U = l("FmList"), A = l("FmCard");
|
|
105
|
+
return c(), g(h, null, [
|
|
106
|
+
i(u, {
|
|
107
|
+
title: "Point",
|
|
108
|
+
actions: o(d).length > 0 ? [I] : [],
|
|
109
|
+
"onClick:action": a[0] || (a[0] = () => p())
|
|
110
|
+
}, {
|
|
111
|
+
title: f(() => [
|
|
112
|
+
n("div", te, [
|
|
113
|
+
oe,
|
|
114
|
+
i(m, { variant: "premium" })
|
|
115
|
+
])
|
|
116
|
+
]),
|
|
117
|
+
_: 1
|
|
118
|
+
}, 8, ["actions"]),
|
|
119
|
+
n("div", ae, [
|
|
120
|
+
i(F, {
|
|
121
|
+
modelValue: o(s).searchKey,
|
|
122
|
+
"onUpdate:modelValue": a[1] || (a[1] = (t) => o(s).searchKey = t),
|
|
123
|
+
class: "hidden xs:block border-b-2 border-fm-color-neutral-gray-100",
|
|
124
|
+
placeholder: "search",
|
|
125
|
+
collapsible: ""
|
|
126
|
+
}, null, 8, ["modelValue"]),
|
|
127
|
+
o(r).campaigns.point && o(r).campaigns.point.length > 0 ? (c(), g(h, { key: 0 }, [
|
|
128
|
+
n("div", ne, [
|
|
129
|
+
n("div", se, [
|
|
130
|
+
i(Y, {
|
|
131
|
+
modelValue: o(s).location,
|
|
132
|
+
"onUpdate:modelValue": a[2] || (a[2] = (t) => o(s).location = t),
|
|
133
|
+
label: "Location: ",
|
|
134
|
+
"show-item-label": !0,
|
|
135
|
+
icon: "storefront",
|
|
136
|
+
placement: "bottom-start",
|
|
137
|
+
items: o(v).locationItems
|
|
138
|
+
}, null, 8, ["modelValue", "items"])
|
|
139
|
+
]),
|
|
140
|
+
i(F, {
|
|
141
|
+
modelValue: o(s).searchKey,
|
|
142
|
+
"onUpdate:modelValue": a[3] || (a[3] = (t) => o(s).searchKey = t),
|
|
143
|
+
class: "xs:hidden",
|
|
144
|
+
placeholder: "search",
|
|
145
|
+
collapsible: ""
|
|
146
|
+
}, null, 8, ["modelValue"])
|
|
147
|
+
]),
|
|
148
|
+
i(R, {
|
|
149
|
+
class: "xs:hidden",
|
|
150
|
+
"row-data": o(d),
|
|
151
|
+
"column-defs": K,
|
|
152
|
+
"search-value": o(s).searchKey,
|
|
153
|
+
"column-filter": [],
|
|
154
|
+
onRowClick: a[4] || (a[4] = (t) => p(t.original)),
|
|
155
|
+
"hide-footer": o(d).length < 10
|
|
156
|
+
}, null, 8, ["row-data", "search-value", "hide-footer"]),
|
|
157
|
+
i(U, { class: "hidden xs:flex flex-col mx-[-24px]" }, {
|
|
158
|
+
default: f(() => [
|
|
159
|
+
(c(!0), g(h, null, E(o(d).filter(
|
|
160
|
+
(t) => t.name.toLowerCase().includes(o(s).searchKey.toLowerCase())
|
|
161
|
+
), (t) => (c(), C(O, {
|
|
162
|
+
key: t._id.toString(),
|
|
163
|
+
onClick: (P) => p(t),
|
|
164
|
+
class: "py-12 px-16 flex items-center justify-between border-b border-fm-color-neutral-gray-100"
|
|
165
|
+
}, {
|
|
166
|
+
default: f(() => [
|
|
167
|
+
n("div", ie, [
|
|
168
|
+
n("div", le, [
|
|
169
|
+
(c(), C(M(o(V)(t)))),
|
|
170
|
+
n("div", re, y(t.currentReceive ?? 0) + " used ", 1)
|
|
171
|
+
]),
|
|
172
|
+
n("div", ce, [
|
|
173
|
+
n("div", me, y(t.name), 1),
|
|
174
|
+
n("div", de, y(o(L)(t)), 1)
|
|
175
|
+
]),
|
|
176
|
+
n("div", pe, " Point received: " + y(t.currentReceive ?? 0), 1)
|
|
177
|
+
]),
|
|
178
|
+
i(k, {
|
|
179
|
+
icon: "delete",
|
|
180
|
+
"icon-color": "neutral-gray-400",
|
|
181
|
+
variant: "tertiary",
|
|
182
|
+
onClick: (P) => (P.stopPropagation(), b(t))
|
|
183
|
+
}, null, 8, ["onClick"])
|
|
184
|
+
]),
|
|
185
|
+
_: 2
|
|
186
|
+
}, 1032, ["onClick"]))), 128))
|
|
187
|
+
]),
|
|
188
|
+
_: 1
|
|
189
|
+
})
|
|
190
|
+
], 64)) : (c(), C(A, {
|
|
191
|
+
key: 1,
|
|
192
|
+
variant: "outlined",
|
|
193
|
+
class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
|
|
194
|
+
}, {
|
|
195
|
+
default: f(() => [
|
|
196
|
+
ue,
|
|
197
|
+
fe,
|
|
198
|
+
i(k, {
|
|
199
|
+
variant: "primary",
|
|
200
|
+
label: "Create point program",
|
|
201
|
+
disabled: !o(v).isPremium,
|
|
202
|
+
icon: "add",
|
|
203
|
+
onClick: a[5] || (a[5] = (t) => p())
|
|
204
|
+
}, null, 8, ["disabled"])
|
|
205
|
+
]),
|
|
206
|
+
_: 1
|
|
207
|
+
})),
|
|
208
|
+
i(Z, {
|
|
209
|
+
ref_key: "sheetRef",
|
|
210
|
+
ref: x,
|
|
211
|
+
"onSubmit:modelValue": N
|
|
212
|
+
}, null, 512)
|
|
213
|
+
])
|
|
214
|
+
], 64);
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
export {
|
|
219
|
+
Se as default
|
|
220
|
+
};
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { defineComponent as E, ref as P, computed as H, onMounted as q, resolveComponent as i, openBlock as c, createElementBlock as g, Fragment as _, createVNode as s, unref as l, createElementVNode as a, withCtx as h, renderList as z, createBlock as w, resolveDynamicComponent as G, toDisplayString as k, h as J } from "vue";
|
|
2
|
+
import { _ as Q } from "./campaign-CpzFl8Vr.js";
|
|
3
|
+
import { useDialog as W, components as X } from "@feedmepos/ui-library";
|
|
4
|
+
import { c as S, u as Y, p as O } from "./loading-KNmEMBUB.js";
|
|
5
|
+
import { u as Z } from "./business-BSo7EPan.js";
|
|
6
|
+
import { u as ee } from "./campaign-CsOje3Ap.js";
|
|
7
|
+
import { g as L } from "./dto-CfEXSCq6.js";
|
|
8
|
+
import { e as V } from "./effect-Bn_ofYS3.js";
|
|
9
|
+
import { _ as oe } from "./ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js";
|
|
10
|
+
import { _ as te } from "./EditCampaignSheet.vue_vue_type_script_setup_true_lang-we7ADwFk.js";
|
|
11
|
+
import { u as ae } from "./template-CFAIPoD7.js";
|
|
12
|
+
import { c as u } from "./index-Boo5np6l.js";
|
|
13
|
+
const ne = { class: "px-24 flex flex-col gap-y-16" }, se = { class: "flex items-center justify-between w-full" }, le = { class: "flex gap-8 overflow-x-auto" }, ie = { class: "space-y-8" }, re = { class: "flex w-full gap-4 items-center" }, ce = { class: "space-y-4" }, me = { class: "fm-typo-en-body-lg-600" }, de = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ue = /* @__PURE__ */ a("img", {
|
|
14
|
+
src: Q,
|
|
15
|
+
class: "aspect-square w-[150px]"
|
|
16
|
+
}, null, -1), pe = /* @__PURE__ */ a("div", { class: "flex flex-col gap-16 text-center" }, [
|
|
17
|
+
/* @__PURE__ */ a("div", { class: "fm-typo-en-title-sm-800" }, "Create promotion campaign"),
|
|
18
|
+
/* @__PURE__ */ a("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Special offers or deals made available for a limited time to encourage user engagement and purchases. Promotions are generally available to all eligible users without the need for a specific code and are applied by merchant during the promotional period. ")
|
|
19
|
+
], -1), Se = /* @__PURE__ */ E({
|
|
20
|
+
__name: "Promotion",
|
|
21
|
+
setup(fe) {
|
|
22
|
+
const I = {
|
|
23
|
+
label: "Create campaign",
|
|
24
|
+
value: "create",
|
|
25
|
+
isPrimary: !0,
|
|
26
|
+
prependIcon: "add"
|
|
27
|
+
}, T = {
|
|
28
|
+
label: "Force sync",
|
|
29
|
+
value: "sync",
|
|
30
|
+
isPrimary: !1,
|
|
31
|
+
prependIcon: "refresh"
|
|
32
|
+
}, $ = ae("PROMOTION", W()), v = Z(), p = ee(), { global: R, minor: y } = Y, n = P({
|
|
33
|
+
searchKey: "",
|
|
34
|
+
location: null
|
|
35
|
+
}), r = H(
|
|
36
|
+
() => p.campaigns.promotion.filter(
|
|
37
|
+
(e) => !n.value.location || !e.targetLocation || e.targetLocation.includes(n.value.location)
|
|
38
|
+
)
|
|
39
|
+
), B = [
|
|
40
|
+
{
|
|
41
|
+
header: "Promotion title",
|
|
42
|
+
accessorFn: (e) => e.name
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
header: "Status",
|
|
46
|
+
cell(e) {
|
|
47
|
+
return L(e.row.original);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
header: "Type",
|
|
52
|
+
accessorFn: (e) => `${S.title(e.effect.options.target)} promotion`
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
header: "Summary",
|
|
56
|
+
accessorFn: (e) => V(e.effect)
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
header: "Actions",
|
|
60
|
+
cell(e) {
|
|
61
|
+
return J(X.FmButton, {
|
|
62
|
+
variant: "tertiary",
|
|
63
|
+
icon: "delete",
|
|
64
|
+
iconColor: "neutral-gray-400",
|
|
65
|
+
onClick: (t) => {
|
|
66
|
+
t.stopPropagation(), x(e.row.original);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
], b = P();
|
|
72
|
+
async function x(e) {
|
|
73
|
+
await O.remove(`Are you sure you want to remove ${e.name}?`) && await y(
|
|
74
|
+
async () => {
|
|
75
|
+
await u.delete(e._id), await p.read("PROMOTION");
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
message: `Removing ${e.name}`,
|
|
79
|
+
successMessage: `Removed ${e.name} successfully`
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
async function f(e) {
|
|
84
|
+
e ? await t() : $.open(async (m) => {
|
|
85
|
+
await t(m);
|
|
86
|
+
});
|
|
87
|
+
async function t(m) {
|
|
88
|
+
var d;
|
|
89
|
+
(d = b.value) == null || d.showSheet(
|
|
90
|
+
!0,
|
|
91
|
+
"PROMOTION",
|
|
92
|
+
e ? await u.readById(e._id) : void 0,
|
|
93
|
+
m
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async function M(e) {
|
|
98
|
+
await y(
|
|
99
|
+
async () => {
|
|
100
|
+
e.campaign._id ? await u.update(e.campaign._id, e) : await u.create(e), await p.read("PROMOTION");
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
message: `${e.campaign._id ? "Updating" : "Creating"} promotion`,
|
|
104
|
+
successMessage: `Promotion ${e.campaign._id ? "updated" : "created"} successfully`
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
async function A(e) {
|
|
109
|
+
switch (e) {
|
|
110
|
+
case "create":
|
|
111
|
+
f();
|
|
112
|
+
break;
|
|
113
|
+
case "sync":
|
|
114
|
+
await O.confirm(
|
|
115
|
+
"Are you sure you want to synchronize all promotions to POS?",
|
|
116
|
+
"Force sync"
|
|
117
|
+
) && y(
|
|
118
|
+
async () => {
|
|
119
|
+
await u.syncAllPromotion();
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
message: "Syncing promotions...",
|
|
123
|
+
successMessage: "All promotions synced"
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return q(async () => {
|
|
130
|
+
await R(async () => {
|
|
131
|
+
await v.readLocations(), await p.read("PROMOTION");
|
|
132
|
+
});
|
|
133
|
+
}), (e, t) => {
|
|
134
|
+
const m = i("FmPageHead"), d = i("FmSearch"), K = i("FmTable"), N = i("FmChip"), C = i("FmButton"), U = i("FmListItem"), D = i("FmList"), j = i("FmCard");
|
|
135
|
+
return c(), g(_, null, [
|
|
136
|
+
s(m, {
|
|
137
|
+
title: "Promotion",
|
|
138
|
+
actions: l(r).length > 0 ? [I, T] : [],
|
|
139
|
+
"onClick:action": A
|
|
140
|
+
}, null, 8, ["actions"]),
|
|
141
|
+
a("div", ne, [
|
|
142
|
+
s(d, {
|
|
143
|
+
modelValue: n.value.searchKey,
|
|
144
|
+
"onUpdate:modelValue": t[0] || (t[0] = (o) => n.value.searchKey = o),
|
|
145
|
+
class: "hidden xs:block border-b-2 border-fm-color-neutral-gray-100",
|
|
146
|
+
placeholder: "search",
|
|
147
|
+
collapsible: ""
|
|
148
|
+
}, null, 8, ["modelValue"]),
|
|
149
|
+
l(r) && l(r).length > 0 ? (c(), g(_, { key: 0 }, [
|
|
150
|
+
a("div", se, [
|
|
151
|
+
a("div", le, [
|
|
152
|
+
s(oe, {
|
|
153
|
+
modelValue: n.value.location,
|
|
154
|
+
"onUpdate:modelValue": t[1] || (t[1] = (o) => n.value.location = o),
|
|
155
|
+
label: "Location: ",
|
|
156
|
+
"show-item-label": !0,
|
|
157
|
+
icon: "storefront",
|
|
158
|
+
placement: "bottom-start",
|
|
159
|
+
items: l(v).locationItems
|
|
160
|
+
}, null, 8, ["modelValue", "items"])
|
|
161
|
+
]),
|
|
162
|
+
s(d, {
|
|
163
|
+
modelValue: n.value.searchKey,
|
|
164
|
+
"onUpdate:modelValue": t[2] || (t[2] = (o) => n.value.searchKey = o),
|
|
165
|
+
class: "xs:hidden",
|
|
166
|
+
placeholder: "search",
|
|
167
|
+
collapsible: ""
|
|
168
|
+
}, null, 8, ["modelValue"])
|
|
169
|
+
]),
|
|
170
|
+
s(K, {
|
|
171
|
+
class: "xs:hidden",
|
|
172
|
+
"row-data": l(r),
|
|
173
|
+
"column-defs": B,
|
|
174
|
+
"search-value": n.value.searchKey,
|
|
175
|
+
"column-filter": [],
|
|
176
|
+
onRowClick: t[3] || (t[3] = (o) => f(o.original)),
|
|
177
|
+
"hide-footer": l(r).length < 10
|
|
178
|
+
}, null, 8, ["row-data", "search-value", "hide-footer"]),
|
|
179
|
+
s(D, { class: "hidden xs:flex flex-col mx-[-24px]" }, {
|
|
180
|
+
default: h(() => [
|
|
181
|
+
(c(!0), g(_, null, z(l(r).filter(
|
|
182
|
+
(o) => o.name.toLowerCase().includes(n.value.searchKey.toLowerCase())
|
|
183
|
+
), (o) => (c(), w(U, {
|
|
184
|
+
key: o._id.toString(),
|
|
185
|
+
onClick: (F) => f(o),
|
|
186
|
+
class: "py-12 px-16 flex items-center justify-between border-b border-fm-color-neutral-gray-100"
|
|
187
|
+
}, {
|
|
188
|
+
default: h(() => [
|
|
189
|
+
a("div", ie, [
|
|
190
|
+
a("div", re, [
|
|
191
|
+
(c(), w(G(l(L)(o)))),
|
|
192
|
+
s(N, {
|
|
193
|
+
class: "!text-fm-color-typo-info !bg-fm-color-system-info-100",
|
|
194
|
+
compact: !0,
|
|
195
|
+
label: `${l(S).title(o.effect.options.target)} promotion`
|
|
196
|
+
}, null, 8, ["label"])
|
|
197
|
+
]),
|
|
198
|
+
a("div", ce, [
|
|
199
|
+
a("div", me, k(o.name), 1),
|
|
200
|
+
a("div", de, k(l(V)(o.effect)), 1)
|
|
201
|
+
])
|
|
202
|
+
]),
|
|
203
|
+
s(C, {
|
|
204
|
+
icon: "delete",
|
|
205
|
+
"icon-color": "neutral-gray-400",
|
|
206
|
+
variant: "tertiary",
|
|
207
|
+
onClick: (F) => (F.stopPropagation(), x(o))
|
|
208
|
+
}, null, 8, ["onClick"])
|
|
209
|
+
]),
|
|
210
|
+
_: 2
|
|
211
|
+
}, 1032, ["onClick"]))), 128))
|
|
212
|
+
]),
|
|
213
|
+
_: 1
|
|
214
|
+
})
|
|
215
|
+
], 64)) : (c(), w(j, {
|
|
216
|
+
key: 1,
|
|
217
|
+
variant: "outlined",
|
|
218
|
+
class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
|
|
219
|
+
}, {
|
|
220
|
+
default: h(() => [
|
|
221
|
+
ue,
|
|
222
|
+
pe,
|
|
223
|
+
s(C, {
|
|
224
|
+
variant: "primary",
|
|
225
|
+
label: "Create promotion campaign",
|
|
226
|
+
icon: "add",
|
|
227
|
+
onClick: t[4] || (t[4] = (o) => f())
|
|
228
|
+
})
|
|
229
|
+
]),
|
|
230
|
+
_: 1
|
|
231
|
+
}))
|
|
232
|
+
]),
|
|
233
|
+
s(te, {
|
|
234
|
+
ref_key: "sheetRef",
|
|
235
|
+
ref: b,
|
|
236
|
+
"onSubmit:modelValue": M
|
|
237
|
+
}, null, 512)
|
|
238
|
+
], 64);
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
export {
|
|
243
|
+
Se as default
|
|
244
|
+
};
|