@feedmepos/mf-connect 0.1.58-prod → 0.1.60-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-CB0xAr9Q.js +427 -0
- package/dist/App-fp_3oll7.js +4630 -0
- package/dist/Bin-CPEbn14A.js +166 -0
- package/dist/Broadcast-jKp2iB8c.js +233 -0
- package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CmJG893h.js +121 -0
- package/dist/Card-BaPJkgd2.js +911 -0
- package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +97 -0
- package/dist/Collections-Bqsg-ON3.js +458 -0
- package/dist/Credit-C9zIva1h.js +228 -0
- package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +128 -0
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-CSMV8OwA.js +2194 -0
- package/dist/EffectSheet.vue_vue_type_style_index_0_lang-Doyw0pvU.js +348 -0
- package/dist/Experience-CCI_oesa.js +229 -0
- package/dist/FileSaver.min-NlMItPOc.js +74 -0
- package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +129 -0
- package/dist/Game-CRMVz1JP.js +284 -0
- package/dist/ImageInput.vue_vue_type_script_setup_true_lang-D1KQpDGg.js +144 -0
- package/dist/Index-szNiSnjR.js +259 -0
- package/dist/JsonViewer-v8_C7l5N.js +87 -0
- package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js +18737 -0
- package/dist/MainLayout-B1aJoR95.js +41 -0
- package/dist/Marketing-AvEiNiD9.js +319 -0
- package/dist/Member-DIZwt6Hh.js +279 -0
- package/dist/MemberList-dxteIRWn.js +1607 -0
- package/dist/MemberOverview-wL_ailso.js +58 -0
- package/dist/MemberTransactions-Q3phmXfI.js +45 -0
- package/dist/MessageInput.vue_vue_type_script_setup_true_lang-BLk8rX-T.js +60553 -0
- package/dist/Mission-CZjySlcS.js +302 -0
- package/dist/Overview-BXbWEDy3.js +1079 -0
- package/dist/Point-CgjNc_Qn.js +232 -0
- package/dist/Promotion-COYo3qLi.js +289 -0
- package/dist/Queue-BLIStJth.js +260 -0
- package/dist/Record-BWoTvVEE.js +341 -0
- package/dist/Reward-Dq6GxHMP.js +442 -0
- package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-CR1feHth.js +150 -0
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DuYYfbOH.js +1763 -0
- package/dist/Segment-CUfn6k5R.js +882 -0
- package/dist/SelectItems.vue_vue_type_script_setup_true_lang-CxycOqNJ.js +181 -0
- package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-C7jqrfEj.js +188 -0
- package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-CMmdbYH4.js +147 -0
- package/dist/Setting-CC5AiQSy.js +1928 -0
- package/dist/SettingAdvertisements-DHQTaMC1.js +262 -0
- package/dist/Store-CEgv5aOD.js +1842 -0
- package/dist/StoreRewards-Dtzk_YG2.js +423 -0
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Cwt8pmoM.js +995 -0
- package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-BEU2u1-a.js +139 -0
- package/dist/Tier-1xqQvWzc.js +895 -0
- package/dist/Title-Da-G8plz.js +566 -0
- package/dist/Transaction-B0vuVZFZ.js +39 -0
- package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-e4-wNfrg.js +130 -0
- package/dist/Voucher-DLFjkXLu.js +384 -0
- package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-5X7dGFD9.js +419 -0
- package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-BPTrvEwa.js +56 -0
- package/dist/_commonjsHelpers-BkfeUUK-.js +28 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/app-Do_C3F_N.js +7094 -0
- package/dist/app-o7Kvv5aK.js +57962 -0
- package/dist/app-wDQR6dpb.js +39 -0
- package/dist/app.js +6 -0
- package/dist/business-BDi-QTa5.js +82 -0
- package/dist/campaign-BHqizYy6.js +1810 -0
- package/dist/campaign-CpzFl8Vr.js +4 -0
- package/dist/campaign-DNXI3K9c.js +94 -0
- package/dist/campaign.enum-BXDwYoeA.js +20 -0
- package/dist/campaign.fn-Rws4mJa5.js +758 -0
- package/dist/collectible.enum-cMc4fL1T.js +19 -0
- package/dist/collection.fn-F8FZ7Dnr.js +26 -0
- package/dist/dto-CAtf1jq0.js +216 -0
- package/dist/effect-Dhg1ZIrL.js +78 -0
- package/dist/email-addresses-BZJZwglQ.js +705 -0
- package/dist/export-B6yvRuct.js +97 -0
- package/dist/feedme.ico +0 -0
- package/dist/helper-VoErinsY.js +71 -0
- package/dist/index-B0Pzwzkd.js +31 -0
- package/dist/index-Bq6FwMwW.js +32 -0
- package/dist/index-BvE6Sbog.js +3 -0
- package/dist/index-BysJoGFD.js +146 -0
- package/dist/index-C8m_F_I4.js +121 -0
- package/dist/index-CQZinjc9.js +54 -0
- package/dist/index-Cq7s1Pk2.js +76 -0
- package/dist/index-CuvNtC_M.js +61 -0
- package/dist/index-DOGrOlB8.js +8859 -0
- package/dist/index-Di23nMJ7.js +38 -0
- package/dist/index-Dkyb4P6T.js +30076 -0
- package/dist/index-DvZiQOtl.js +3077 -0
- package/dist/index-Ved5V90A.js +2155 -0
- package/dist/index-d4A3r8kv.js +32269 -0
- package/dist/index-vh86FiIQ.js +10 -0
- package/dist/index-y7IqG-tl.js +44 -0
- package/dist/index.esm2017-CRTpUsW5.js +3069 -0
- package/dist/loading-CoUrS63J.js +71 -0
- package/dist/lodash-B5I3zXaY.js +3678 -0
- package/dist/membership-BiQwBHAA.js +235 -0
- package/dist/moment-D7p2TMB-.js +2583 -0
- package/dist/money-CA3gpWD3.js +15 -0
- package/dist/number-CgmVpwHm.js +12 -0
- package/dist/object-qECH92oz.js +26 -0
- package/dist/objectId-dwaoBfJX.js +7 -0
- package/dist/objectid-C80eoTvt.js +145 -0
- package/dist/plugins-BkWtR_R5.js +208 -0
- package/dist/reward-D7SKofYj.js +36 -0
- package/dist/rule-Cpxty5PH.js +1951 -0
- package/dist/rule-builder-d_TMgXEC.js +102 -0
- package/dist/style.css +4 -0
- package/dist/template-BB7bab5R.js +190 -0
- package/dist/tier-BJDhpH6X.js +4 -0
- package/dist/tiers/tier=1.png +0 -0
- package/dist/tiers/tier=2.png +0 -0
- package/dist/tiers/tier=3.png +0 -0
- package/dist/tiers/tier=4.png +0 -0
- package/dist/timezone-Dj3UaenF.js +1151 -0
- package/dist/titles/type=diamond.png +0 -0
- package/dist/titles/type=drinks.png +0 -0
- package/dist/titles/type=food.png +0 -0
- package/dist/titles/type=heart.png +0 -0
- package/dist/titles/type=medal.png +0 -0
- package/dist/titles/type=spend.png +0 -0
- package/dist/titles/type=thank-you.png +0 -0
- package/dist/titles/type=thumbs-up.png +0 -0
- package/dist/titles/type=years.png +0 -0
- package/dist/trigger-ZVR5eR1H.js +144 -0
- package/dist/tslib.es6-BCqqvLQ_.js +44 -0
- package/dist/type_drinks-D6jnpvwV.js +4 -0
- package/dist/usePagination-Ds-cuHop.js +223 -0
- package/dist/user-DjRqnFsC.js +54 -0
- package/dist/vue-i18n-BlCNfIcP.js +2365 -0
- package/dist/xlsx-CtNr_GAa.js +15491 -0
- package/dist/zod-Bg2FbC-D.js +90 -0
- package/package.json +1 -1
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { defineComponent as j, ref as P, computed as E, h as M, onMounted as H, resolveComponent as l, openBlock as u, createElementBlock as w, Fragment as b, createVNode as r, unref as o, withCtx as g, createElementVNode as a, toDisplayString as d, renderList as q, createBlock as C, resolveDynamicComponent as z } from "vue";
|
|
2
|
+
import { _ as G } from "./campaign-CpzFl8Vr.js";
|
|
3
|
+
import { useDialog as J, components as Q } from "@feedmepos/ui-library";
|
|
4
|
+
import { p as W } from "./plugins-BkWtR_R5.js";
|
|
5
|
+
import { u as X } from "./loading-CoUrS63J.js";
|
|
6
|
+
import { u as Y } from "./business-BDi-QTa5.js";
|
|
7
|
+
import { u as Z } from "./campaign-DNXI3K9c.js";
|
|
8
|
+
import { g as ee, a as V, b as B } from "./campaign-BHqizYy6.js";
|
|
9
|
+
import { _ as te } from "./FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js";
|
|
10
|
+
import { _ as oe } from "./EditCampaignSheet.vue_vue_type_script_setup_true_lang-CSMV8OwA.js";
|
|
11
|
+
import { u as ne } from "./template-BB7bab5R.js";
|
|
12
|
+
import { u as ae } from "./vue-i18n-BlCNfIcP.js";
|
|
13
|
+
import { c as _ } from "./index-C8m_F_I4.js";
|
|
14
|
+
const se = { class: "flex items-center" }, re = { class: "fm-typo-en-title-md-600 fm-step-title line-clamp-2 mr-8" }, ie = { class: "px-24 flex flex-col gap-y-16" }, le = { class: "flex items-center justify-between w-full" }, ce = { class: "flex gap-8 overflow-x-auto" }, me = { class: "space-y-8" }, de = { class: "flex w-full gap-4 items-center" }, pe = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ue = { class: "space-y-4" }, fe = { class: "fm-typo-en-body-lg-600" }, ye = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ge = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _e = { class: "flex flex-col gap-16 text-center" }, he = { class: "fm-typo-en-title-sm-800" }, we = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ne = /* @__PURE__ */ j({
|
|
15
|
+
__name: "Point",
|
|
16
|
+
setup(be) {
|
|
17
|
+
const { t: s } = ae(), I = {
|
|
18
|
+
label: s("connect.program.common.actions.create", {
|
|
19
|
+
type: s("connect.program.point.title").toLowerCase()
|
|
20
|
+
}),
|
|
21
|
+
value: "create",
|
|
22
|
+
isPrimary: !0,
|
|
23
|
+
prependIcon: "add"
|
|
24
|
+
}, $ = ne("COIN", J()), h = Y(), p = Z(), { global: K, minor: x } = X, i = P({
|
|
25
|
+
searchKey: "",
|
|
26
|
+
location: []
|
|
27
|
+
});
|
|
28
|
+
function N(e) {
|
|
29
|
+
const t = i.value.location;
|
|
30
|
+
return !t || t.length === 0 || !e.targetLocation ? !0 : Array.isArray(t) ? t.some((c) => {
|
|
31
|
+
var m;
|
|
32
|
+
return (m = e == null ? void 0 : e.targetLocation) == null ? void 0 : m.includes(c);
|
|
33
|
+
}) : e.targetLocation.includes(t);
|
|
34
|
+
}
|
|
35
|
+
const f = E(
|
|
36
|
+
() => p.campaigns.point.filter((e) => N(e))
|
|
37
|
+
), R = [
|
|
38
|
+
{
|
|
39
|
+
header: s("connect.program.common.table.title"),
|
|
40
|
+
accessorFn: (e) => e.name
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
header: s("connect.program.common.table.status"),
|
|
44
|
+
accessorFn: (e) => ee(e),
|
|
45
|
+
cell(e) {
|
|
46
|
+
return V(e.row.original);
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
header: s("connect.program.common.table.summary"),
|
|
51
|
+
accessorFn: (e) => B(e)
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
header: s("connect.program.common.table.actions"),
|
|
55
|
+
cell(e) {
|
|
56
|
+
return M(Q.FmButton, {
|
|
57
|
+
variant: "tertiary",
|
|
58
|
+
icon: "delete",
|
|
59
|
+
iconColor: "neutral-gray-400",
|
|
60
|
+
onClick: (t) => {
|
|
61
|
+
t.stopPropagation(), F(e.row.original);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
], v = P();
|
|
67
|
+
async function F(e) {
|
|
68
|
+
await W.remove(`Are you sure you want to remove ${e.name}?`) && await x(
|
|
69
|
+
async () => {
|
|
70
|
+
await _.delete(e._id), await p.read("COIN");
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
message: `Removing ${e.name}`,
|
|
74
|
+
successMessage: `Removed ${e.name} successfully`
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
async function y(e) {
|
|
79
|
+
e ? await t() : $.open(async (c) => {
|
|
80
|
+
await t(c);
|
|
81
|
+
});
|
|
82
|
+
async function t(c) {
|
|
83
|
+
var m;
|
|
84
|
+
(m = v.value) == null || m.showSheet(
|
|
85
|
+
!0,
|
|
86
|
+
"COIN",
|
|
87
|
+
e ? await _.readById(e._id) : void 0,
|
|
88
|
+
c
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async function O(e) {
|
|
93
|
+
await x(
|
|
94
|
+
async () => {
|
|
95
|
+
e.campaign._id ? await _.update(e.campaign._id, e) : await _.create(e), await p.read("COIN");
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
message: `${e.campaign._id ? "Updating" : "Creating"} point program`,
|
|
99
|
+
successMessage: `Point program ${e.campaign._id ? "updated" : "created"} successfully`
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
return H(async () => {
|
|
104
|
+
await K(async () => {
|
|
105
|
+
await p.read("COIN");
|
|
106
|
+
});
|
|
107
|
+
}), (e, t) => {
|
|
108
|
+
const c = l("FmPill"), m = l("FmPageHead"), k = l("FmSearch"), A = l("FmTable"), L = l("FmButton"), U = l("FmListItem"), D = l("FmList"), T = l("FmCard");
|
|
109
|
+
return u(), w(b, null, [
|
|
110
|
+
r(m, {
|
|
111
|
+
title: o(s)("connect.program.point.title"),
|
|
112
|
+
actions: o(f).length > 0 && o(h).isPremium ? [I] : [],
|
|
113
|
+
"onClick:action": t[0] || (t[0] = () => y())
|
|
114
|
+
}, {
|
|
115
|
+
title: g(() => [
|
|
116
|
+
a("div", se, [
|
|
117
|
+
a("span", re, d(o(s)("connect.program.point.title")), 1),
|
|
118
|
+
r(c, { variant: "premium" })
|
|
119
|
+
])
|
|
120
|
+
]),
|
|
121
|
+
_: 1
|
|
122
|
+
}, 8, ["title", "actions"]),
|
|
123
|
+
a("div", ie, [
|
|
124
|
+
r(k, {
|
|
125
|
+
modelValue: o(i).searchKey,
|
|
126
|
+
"onUpdate:modelValue": t[1] || (t[1] = (n) => o(i).searchKey = n),
|
|
127
|
+
class: "hidden xs:block border-b-2 border-fm-color-neutral-gray-100",
|
|
128
|
+
placeholder: "search",
|
|
129
|
+
collapsible: ""
|
|
130
|
+
}, null, 8, ["modelValue"]),
|
|
131
|
+
o(p).campaigns.point && o(p).campaigns.point.length > 0 ? (u(), w(b, { key: 0 }, [
|
|
132
|
+
a("div", le, [
|
|
133
|
+
a("div", ce, [
|
|
134
|
+
r(te, {
|
|
135
|
+
label: `${o(s)("connect.common.location")}: `,
|
|
136
|
+
"right-icon": "keyboard_arrow_down",
|
|
137
|
+
modelValue: o(i).location,
|
|
138
|
+
"onUpdate:modelValue": t[2] || (t[2] = (n) => o(i).location = n),
|
|
139
|
+
icon: "storefront",
|
|
140
|
+
"show-item-label": !0,
|
|
141
|
+
items: o(h).locationOptions
|
|
142
|
+
}, null, 8, ["label", "modelValue", "items"])
|
|
143
|
+
]),
|
|
144
|
+
r(k, {
|
|
145
|
+
modelValue: o(i).searchKey,
|
|
146
|
+
"onUpdate:modelValue": t[3] || (t[3] = (n) => o(i).searchKey = n),
|
|
147
|
+
class: "xs:hidden",
|
|
148
|
+
placeholder: "search",
|
|
149
|
+
collapsible: ""
|
|
150
|
+
}, null, 8, ["modelValue"])
|
|
151
|
+
]),
|
|
152
|
+
r(A, {
|
|
153
|
+
class: "xs:hidden",
|
|
154
|
+
"row-data": o(f),
|
|
155
|
+
"column-defs": R,
|
|
156
|
+
"search-value": o(i).searchKey,
|
|
157
|
+
"column-filter": [],
|
|
158
|
+
onRowClick: t[4] || (t[4] = (n) => y(n.original)),
|
|
159
|
+
"hide-footer": o(f).length < 10
|
|
160
|
+
}, null, 8, ["row-data", "search-value", "hide-footer"]),
|
|
161
|
+
r(D, { class: "hidden xs:flex flex-col mx-[-24px]" }, {
|
|
162
|
+
default: g(() => [
|
|
163
|
+
(u(!0), w(b, null, q(o(f).filter(
|
|
164
|
+
(n) => n.name.toLowerCase().includes(o(i).searchKey.toLowerCase())
|
|
165
|
+
), (n) => (u(), C(U, {
|
|
166
|
+
key: n._id.toString(),
|
|
167
|
+
onClick: (S) => y(n),
|
|
168
|
+
class: "py-12 px-16 flex items-center justify-between border-b border-fm-color-neutral-gray-100"
|
|
169
|
+
}, {
|
|
170
|
+
default: g(() => [
|
|
171
|
+
a("div", me, [
|
|
172
|
+
a("div", de, [
|
|
173
|
+
(u(), C(z(o(V)(n)))),
|
|
174
|
+
a("div", pe, d(o(s)("connect.program.point.used", {
|
|
175
|
+
count: n.currentReceive ?? 0
|
|
176
|
+
})), 1)
|
|
177
|
+
]),
|
|
178
|
+
a("div", ue, [
|
|
179
|
+
a("div", fe, d(n.name), 1),
|
|
180
|
+
a("div", ye, d(o(B)(n)), 1)
|
|
181
|
+
]),
|
|
182
|
+
a("div", ge, " Point received: " + d(n.currentReceive ?? 0), 1)
|
|
183
|
+
]),
|
|
184
|
+
r(L, {
|
|
185
|
+
icon: "delete",
|
|
186
|
+
"icon-color": "neutral-gray-400",
|
|
187
|
+
variant: "tertiary",
|
|
188
|
+
onClick: (S) => (S.stopPropagation(), F(n))
|
|
189
|
+
}, null, 8, ["onClick"])
|
|
190
|
+
]),
|
|
191
|
+
_: 2
|
|
192
|
+
}, 1032, ["onClick"]))), 128))
|
|
193
|
+
]),
|
|
194
|
+
_: 1
|
|
195
|
+
})
|
|
196
|
+
], 64)) : (u(), C(T, {
|
|
197
|
+
key: 1,
|
|
198
|
+
variant: "outlined",
|
|
199
|
+
class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
|
|
200
|
+
}, {
|
|
201
|
+
default: g(() => [
|
|
202
|
+
t[6] || (t[6] = a("img", {
|
|
203
|
+
src: G,
|
|
204
|
+
class: "aspect-square w-[150px]"
|
|
205
|
+
}, null, -1)),
|
|
206
|
+
a("div", _e, [
|
|
207
|
+
a("div", he, d(o(s)("connect.program.point.empty_state.title")), 1),
|
|
208
|
+
a("div", we, d(o(s)("connect.program.point.empty_state.description")), 1)
|
|
209
|
+
]),
|
|
210
|
+
r(L, {
|
|
211
|
+
variant: "primary",
|
|
212
|
+
label: "Create point program",
|
|
213
|
+
disabled: !o(h).isPremium,
|
|
214
|
+
icon: "add",
|
|
215
|
+
onClick: t[5] || (t[5] = (n) => y())
|
|
216
|
+
}, null, 8, ["disabled"])
|
|
217
|
+
]),
|
|
218
|
+
_: 1
|
|
219
|
+
})),
|
|
220
|
+
r(oe, {
|
|
221
|
+
ref_key: "sheetRef",
|
|
222
|
+
ref: v,
|
|
223
|
+
"onSubmit:modelValue": O
|
|
224
|
+
}, null, 512)
|
|
225
|
+
])
|
|
226
|
+
], 64);
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
export {
|
|
231
|
+
Ne as default
|
|
232
|
+
};
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { defineComponent as J, ref as S, computed as Q, h as W, onMounted as X, resolveComponent as m, openBlock as u, createElementBlock as w, Fragment as v, createVNode as l, unref as a, createElementVNode as r, withCtx as b, renderList as Y, createBlock as x, resolveDynamicComponent as Z, toDisplayString as _ } from "vue";
|
|
2
|
+
import { _ as ee } from "./campaign-CpzFl8Vr.js";
|
|
3
|
+
import { useDialog as oe, components as te } from "@feedmepos/ui-library";
|
|
4
|
+
import { c as O, p as L } from "./plugins-BkWtR_R5.js";
|
|
5
|
+
import { u as ne } from "./loading-CoUrS63J.js";
|
|
6
|
+
import { u as ae } from "./business-BDi-QTa5.js";
|
|
7
|
+
import { u as se } from "./campaign-DNXI3K9c.js";
|
|
8
|
+
import { u as re } from "./vue-i18n-BlCNfIcP.js";
|
|
9
|
+
import { g as ie, a as V } from "./campaign-BHqizYy6.js";
|
|
10
|
+
import { e as I } from "./effect-Dhg1ZIrL.js";
|
|
11
|
+
import { _ as le } from "./EditCampaignSheet.vue_vue_type_script_setup_true_lang-CSMV8OwA.js";
|
|
12
|
+
import { u as ce } from "./template-BB7bab5R.js";
|
|
13
|
+
import { _ as B } from "./FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js";
|
|
14
|
+
import { c as d } from "./index-C8m_F_I4.js";
|
|
15
|
+
const me = { class: "px-24 flex flex-col gap-y-16" }, pe = { class: "flex items-center justify-between w-full" }, ue = { class: "flex gap-8 overflow-x-auto" }, de = { class: "space-y-8" }, fe = { class: "flex w-full gap-4 items-center" }, ye = { class: "space-y-4" }, ge = { class: "fm-typo-en-body-lg-600" }, _e = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, he = { class: "flex flex-col gap-16 text-center" }, we = { class: "fm-typo-en-title-sm-800" }, ve = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ae = /* @__PURE__ */ J({
|
|
16
|
+
__name: "Promotion",
|
|
17
|
+
setup(be) {
|
|
18
|
+
const { t: n } = re(), M = {
|
|
19
|
+
label: n("connect.promotion.createCampaign"),
|
|
20
|
+
value: "create",
|
|
21
|
+
isPrimary: !0,
|
|
22
|
+
prependIcon: "add"
|
|
23
|
+
}, R = {
|
|
24
|
+
label: "Force sync",
|
|
25
|
+
value: "sync",
|
|
26
|
+
isPrimary: !1,
|
|
27
|
+
prependIcon: "refresh"
|
|
28
|
+
}, A = ce("PROMOTION", oe()), C = ae(), f = se(), { global: K, minor: h } = ne, N = [
|
|
29
|
+
{
|
|
30
|
+
label: "Bill promotion",
|
|
31
|
+
value: "BILL"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
label: "Item promotion",
|
|
35
|
+
value: "ITEM"
|
|
36
|
+
}
|
|
37
|
+
], s = S({
|
|
38
|
+
searchKey: "",
|
|
39
|
+
location: [],
|
|
40
|
+
effectType: []
|
|
41
|
+
});
|
|
42
|
+
function $(e) {
|
|
43
|
+
const o = s.value.location;
|
|
44
|
+
return !o || o.length === 0 || !e.targetLocation ? !0 : Array.isArray(o) ? o.some((c) => {
|
|
45
|
+
var i;
|
|
46
|
+
return (i = e == null ? void 0 : e.targetLocation) == null ? void 0 : i.includes(c);
|
|
47
|
+
}) : e.targetLocation.includes(o);
|
|
48
|
+
}
|
|
49
|
+
function U(e) {
|
|
50
|
+
var i, g;
|
|
51
|
+
const o = s.value.effectType;
|
|
52
|
+
if (!o || o.length === 0) return !0;
|
|
53
|
+
const c = (g = (i = e.effect) == null ? void 0 : i.options) == null ? void 0 : g.target;
|
|
54
|
+
return o.includes(c);
|
|
55
|
+
}
|
|
56
|
+
const p = Q(
|
|
57
|
+
() => f.campaigns.promotion.filter(
|
|
58
|
+
(e) => $(e) && U(e)
|
|
59
|
+
)
|
|
60
|
+
), D = [
|
|
61
|
+
{
|
|
62
|
+
header: n("connect.promotion.promotionTitle"),
|
|
63
|
+
accessorFn: (e) => e.name
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
header: n("connect.promotion.status"),
|
|
67
|
+
accessorFn: (e) => ie(e),
|
|
68
|
+
cell(e) {
|
|
69
|
+
return V(e.row.original);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
header: n("connect.promotion.type"),
|
|
74
|
+
accessorFn: (e) => `${O.title(e.effect.options.target)} promotion`
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
header: n("connect.promotion.summary"),
|
|
78
|
+
accessorFn: (e) => I(e.effect)
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
header: n("connect.promotion.actions"),
|
|
82
|
+
cell(e) {
|
|
83
|
+
return W(te.FmButton, {
|
|
84
|
+
variant: "tertiary",
|
|
85
|
+
icon: "delete",
|
|
86
|
+
iconColor: "neutral-gray-400",
|
|
87
|
+
onClick: (o) => {
|
|
88
|
+
o.stopPropagation(), k(e.row.original);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
], F = S();
|
|
94
|
+
async function k(e) {
|
|
95
|
+
await L.remove(
|
|
96
|
+
n("connect.promotion.confirmRemove", { name: e.name })
|
|
97
|
+
) && await h(
|
|
98
|
+
async () => {
|
|
99
|
+
await d.delete(e._id), await f.read("PROMOTION");
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
message: n("connect.promotion.removing", { name: e.name }),
|
|
103
|
+
successMessage: n("connect.promotion.removedSuccessfully", {
|
|
104
|
+
name: e.name
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
async function y(e) {
|
|
110
|
+
e ? await o() : A.open(async (c) => {
|
|
111
|
+
await o(c);
|
|
112
|
+
});
|
|
113
|
+
async function o(c) {
|
|
114
|
+
var i;
|
|
115
|
+
(i = F.value) == null || i.showSheet(
|
|
116
|
+
!0,
|
|
117
|
+
"PROMOTION",
|
|
118
|
+
e ? await d.readById(e._id) : void 0,
|
|
119
|
+
c
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
async function E(e) {
|
|
124
|
+
await h(
|
|
125
|
+
async () => {
|
|
126
|
+
e.campaign._id ? await d.update(e.campaign._id, e) : await d.create(e), await f.read("PROMOTION");
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
message: n(
|
|
130
|
+
e.campaign._id ? "connect.promotion.updating" : "connect.promotion.creating"
|
|
131
|
+
),
|
|
132
|
+
successMessage: n(
|
|
133
|
+
e.campaign._id ? "connect.promotion.updatedSuccessfully" : "connect.promotion.createdSuccessfully"
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
async function j(e) {
|
|
139
|
+
switch (e) {
|
|
140
|
+
case "create":
|
|
141
|
+
y();
|
|
142
|
+
break;
|
|
143
|
+
case "sync":
|
|
144
|
+
await L.confirm(
|
|
145
|
+
"Are you sure you want to synchronize all promotions to POS?",
|
|
146
|
+
"Force sync"
|
|
147
|
+
) && h(
|
|
148
|
+
async () => {
|
|
149
|
+
await d.syncAllPromotion();
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
message: "Syncing promotions...",
|
|
153
|
+
successMessage: "All promotions synced"
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return X(async () => {
|
|
160
|
+
await K(async () => {
|
|
161
|
+
await C.readLocations(), await f.read("PROMOTION");
|
|
162
|
+
});
|
|
163
|
+
}), (e, o) => {
|
|
164
|
+
const c = m("FmPageHead"), i = m("FmSearch"), g = m("FmTable"), H = m("FmChip"), T = m("FmButton"), q = m("FmListItem"), z = m("FmList"), G = m("FmCard");
|
|
165
|
+
return u(), w(v, null, [
|
|
166
|
+
l(c, {
|
|
167
|
+
title: a(n)("connect.promotion.title"),
|
|
168
|
+
actions: a(p).length > 0 ? [M, R] : [],
|
|
169
|
+
"onClick:action": j
|
|
170
|
+
}, null, 8, ["title", "actions"]),
|
|
171
|
+
r("div", me, [
|
|
172
|
+
l(i, {
|
|
173
|
+
modelValue: s.value.searchKey,
|
|
174
|
+
"onUpdate:modelValue": o[0] || (o[0] = (t) => s.value.searchKey = t),
|
|
175
|
+
class: "hidden xs:block border-b-2 border-fm-color-neutral-gray-100",
|
|
176
|
+
placeholder: a(n)("connect.promotion.search"),
|
|
177
|
+
collapsible: ""
|
|
178
|
+
}, null, 8, ["modelValue", "placeholder"]),
|
|
179
|
+
a(p) && a(p).length > 0 ? (u(), w(v, { key: 0 }, [
|
|
180
|
+
r("div", pe, [
|
|
181
|
+
r("div", ue, [
|
|
182
|
+
l(B, {
|
|
183
|
+
label: `${a(n)("connect.common.location")}: `,
|
|
184
|
+
"right-icon": "keyboard_arrow_down",
|
|
185
|
+
modelValue: s.value.location,
|
|
186
|
+
"onUpdate:modelValue": o[1] || (o[1] = (t) => s.value.location = t),
|
|
187
|
+
icon: "storefront",
|
|
188
|
+
"show-item-label": !0,
|
|
189
|
+
items: a(C).locationOptions
|
|
190
|
+
}, null, 8, ["label", "modelValue", "items"]),
|
|
191
|
+
l(B, {
|
|
192
|
+
label: "Type:",
|
|
193
|
+
"right-icon": "keyboard_arrow_down",
|
|
194
|
+
modelValue: s.value.effectType,
|
|
195
|
+
"onUpdate:modelValue": o[2] || (o[2] = (t) => s.value.effectType = t),
|
|
196
|
+
icon: "filter_list",
|
|
197
|
+
"show-item-label": !0,
|
|
198
|
+
items: N
|
|
199
|
+
}, null, 8, ["modelValue"])
|
|
200
|
+
]),
|
|
201
|
+
l(i, {
|
|
202
|
+
modelValue: s.value.searchKey,
|
|
203
|
+
"onUpdate:modelValue": o[3] || (o[3] = (t) => s.value.searchKey = t),
|
|
204
|
+
class: "xs:hidden",
|
|
205
|
+
placeholder: "search",
|
|
206
|
+
collapsible: ""
|
|
207
|
+
}, null, 8, ["modelValue"])
|
|
208
|
+
]),
|
|
209
|
+
l(g, {
|
|
210
|
+
class: "xs:hidden",
|
|
211
|
+
"row-data": a(p),
|
|
212
|
+
"column-defs": D,
|
|
213
|
+
"search-value": s.value.searchKey,
|
|
214
|
+
"column-filter": [],
|
|
215
|
+
onRowClick: o[4] || (o[4] = (t) => y(t.original)),
|
|
216
|
+
"hide-footer": a(p).length < 10
|
|
217
|
+
}, null, 8, ["row-data", "search-value", "hide-footer"]),
|
|
218
|
+
l(z, { class: "hidden xs:flex flex-col mx-[-24px]" }, {
|
|
219
|
+
default: b(() => [
|
|
220
|
+
(u(!0), w(v, null, Y(a(p).filter(
|
|
221
|
+
(t) => t.name.toLowerCase().includes(s.value.searchKey.toLowerCase())
|
|
222
|
+
), (t) => (u(), x(q, {
|
|
223
|
+
key: t._id.toString(),
|
|
224
|
+
onClick: (P) => y(t),
|
|
225
|
+
class: "py-12 px-16 flex items-center justify-between border-b border-fm-color-neutral-gray-100"
|
|
226
|
+
}, {
|
|
227
|
+
default: b(() => [
|
|
228
|
+
r("div", de, [
|
|
229
|
+
r("div", fe, [
|
|
230
|
+
(u(), x(Z(a(V)(t)))),
|
|
231
|
+
l(H, {
|
|
232
|
+
class: "!text-fm-color-typo-info !bg-fm-color-system-info-100",
|
|
233
|
+
compact: !0,
|
|
234
|
+
label: `${a(O).title(t.effect.options.target)} promotion`
|
|
235
|
+
}, null, 8, ["label"])
|
|
236
|
+
]),
|
|
237
|
+
r("div", ye, [
|
|
238
|
+
r("div", ge, _(t.name), 1),
|
|
239
|
+
r("div", _e, _(a(I)(t.effect)), 1)
|
|
240
|
+
])
|
|
241
|
+
]),
|
|
242
|
+
l(T, {
|
|
243
|
+
icon: "delete",
|
|
244
|
+
"icon-color": "neutral-gray-400",
|
|
245
|
+
variant: "tertiary",
|
|
246
|
+
onClick: (P) => (P.stopPropagation(), k(t))
|
|
247
|
+
}, null, 8, ["onClick"])
|
|
248
|
+
]),
|
|
249
|
+
_: 2
|
|
250
|
+
}, 1032, ["onClick"]))), 128))
|
|
251
|
+
]),
|
|
252
|
+
_: 1
|
|
253
|
+
})
|
|
254
|
+
], 64)) : (u(), x(G, {
|
|
255
|
+
key: 1,
|
|
256
|
+
variant: "outlined",
|
|
257
|
+
class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
|
|
258
|
+
}, {
|
|
259
|
+
default: b(() => [
|
|
260
|
+
o[6] || (o[6] = r("img", {
|
|
261
|
+
src: ee,
|
|
262
|
+
class: "aspect-square w-[150px]"
|
|
263
|
+
}, null, -1)),
|
|
264
|
+
r("div", he, [
|
|
265
|
+
r("div", we, _(a(n)("connect.promotion.createPromotionCampaign")), 1),
|
|
266
|
+
r("div", ve, _(a(n)("connect.promotion.description")), 1)
|
|
267
|
+
]),
|
|
268
|
+
l(T, {
|
|
269
|
+
variant: "primary",
|
|
270
|
+
label: a(n)("connect.promotion.createPromotionCampaign"),
|
|
271
|
+
icon: "add",
|
|
272
|
+
onClick: o[5] || (o[5] = (t) => y())
|
|
273
|
+
}, null, 8, ["label"])
|
|
274
|
+
]),
|
|
275
|
+
_: 1
|
|
276
|
+
}))
|
|
277
|
+
]),
|
|
278
|
+
l(le, {
|
|
279
|
+
ref_key: "sheetRef",
|
|
280
|
+
ref: F,
|
|
281
|
+
"onSubmit:modelValue": E
|
|
282
|
+
}, null, 512)
|
|
283
|
+
], 64);
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
export {
|
|
288
|
+
Ae as default
|
|
289
|
+
};
|