@feedmepos/mf-kitchen 1.0.1 → 1.0.3-beta.0

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.
@@ -1,222 +0,0 @@
1
- import { defineComponent as _, resolveComponent as c, openBlock as g, createElementBlock as F, createElementVNode as r, createVNode as i, unref as a, toDisplayString as U, ref as y, onMounted as B, createBlock as w, createCommentVNode as S } from "vue";
2
- import { useSnackbar as C } from "@feedmepos/ui-library";
3
- import { useI18n as P, useCoreStore as M } from "@feedmepos/mf-common";
4
- import { u as $, _ as I, I as N, a as D, r as T, b as E, T as z, P as A } from "./restaurant-821ac89e.js";
5
- import "pinia";
6
- const H = { class: "flex flex-col w-[420px]" }, R = { class: "flex flex-col px-[24px] py-[16px] overflow-y-auto gap-24" }, Q = { class: "flex flex-col gap-2" }, W = { class: "fm-typo-en-body-lg-600" }, j = { class: "gap" }, O = { class: "flex flex-row gap-[24px]" }, q = { class: "p-[16px] fm-shadow-light-300" }, G = /* @__PURE__ */ _({
7
- __name: "NormalModeEditor",
8
- props: {
9
- modelValue: {}
10
- },
11
- emits: ["update:model-value", "reset"],
12
- setup(V, { emit: x }) {
13
- const f = V, m = x, { t: n } = P();
14
- function d(o) {
15
- m("update:model-value", o(f.modelValue));
16
- }
17
- const h = $(() => {
18
- m("reset");
19
- });
20
- return (o, l) => {
21
- const b = c("FmTextarea"), k = c("FmTextField"), p = c("FmStepperField"), v = c("FmSwitch"), s = c("FmButton");
22
- return g(), F("div", H, [
23
- r("div", R, [
24
- i(b, {
25
- "model-value": o.modelValue.headerText,
26
- label: a(n)("mf-kitchen.editor.headerText"),
27
- placeholder: a(n)("mf-kitchen.headerTextPlaceholder"),
28
- "onUpdate:modelValue": l[0] || (l[0] = (e) => d((t) => ({ ...t, headerText: e })))
29
- }, null, 8, ["model-value", "label", "placeholder"]),
30
- i(k, {
31
- "model-value": o.modelValue.invoicePrefix,
32
- label: a(n)("mf-kitchen.editor.invoicePrefix"),
33
- placeholder: a(n)("mf-kitchen.invoicePrefixPlaceholder"),
34
- "onUpdate:modelValue": l[1] || (l[1] = (e) => d((t) => ({ ...t, invoicePrefix: e })))
35
- }, null, 8, ["model-value", "label", "placeholder"]),
36
- i(p, {
37
- "model-value": o.modelValue.fontSize ?? 16,
38
- max: 40,
39
- min: 1,
40
- step: 1,
41
- label: a(n)("mf-kitchen.editor.overallFontSize"),
42
- rules: [(e) => e <= 40 || a(n)("mf-kitchen.editor.validation.fontSizeMax")],
43
- "onUpdate:modelValue": l[2] || (l[2] = (e) => {
44
- const t = Math.min(e, 40);
45
- d((u) => ({ ...u, fontSize: t }));
46
- })
47
- }, null, 8, ["model-value", "label", "rules"]),
48
- r("div", Q, [
49
- r("label", W, U(a(n)("mf-kitchen.receiptSetting")), 1),
50
- r("div", j, [
51
- i(v, {
52
- "model-value": o.modelValue.needPhoneNo,
53
- label: a(n)("mf-kitchen.editor.showContact"),
54
- "label-placement": "left",
55
- class: "receiptSettingSwitch",
56
- "onUpdate:modelValue": l[3] || (l[3] = (e) => d((t) => ({ ...t, needPhoneNo: e })))
57
- }, null, 8, ["model-value", "label"]),
58
- i(v, {
59
- "model-value": o.modelValue.needAddress,
60
- label: a(n)("mf-kitchen.editor.showAddress"),
61
- "label-placement": "left",
62
- class: "receiptSettingSwitch",
63
- "onUpdate:modelValue": l[4] || (l[4] = (e) => d((t) => ({ ...t, needAddress: e })))
64
- }, null, 8, ["model-value", "label"]),
65
- i(v, {
66
- "model-value": o.modelValue.needEmail,
67
- label: a(n)("mf-kitchen.editor.showEmail"),
68
- "label-placement": "left",
69
- class: "receiptSettingSwitch",
70
- "onUpdate:modelValue": l[5] || (l[5] = (e) => d((t) => ({ ...t, needEmail: e })))
71
- }, null, 8, ["model-value", "label"]),
72
- i(I, {
73
- "model-value": o.modelValue,
74
- "onUpdate:modelValue": l[6] || (l[6] = (e) => m("update:model-value", e))
75
- }, null, 8, ["model-value"])
76
- ])
77
- ]),
78
- i(b, {
79
- "model-value": o.modelValue.footerText,
80
- label: a(n)("mf-kitchen.editor.footerText"),
81
- placeholder: a(n)("mf-kitchen.footerTextPlaceholder"),
82
- "onUpdate:modelValue": l[7] || (l[7] = (e) => d((t) => ({ ...t, footerText: e })))
83
- }, null, 8, ["model-value", "label", "placeholder"]),
84
- i(k, {
85
- "model-value": o.modelValue.footerQr ?? "",
86
- label: a(n)("mf-kitchen.editor.footerQr"),
87
- placeholder: a(n)("mf-kitchen.footerQrPlaceholder"),
88
- "onUpdate:modelValue": l[8] || (l[8] = (e) => d((t) => ({ ...t, footerQr: e })))
89
- }, null, 8, ["model-value", "label", "placeholder"]),
90
- i(N, {
91
- "model-value": o.modelValue.imgData,
92
- title: a(n)("mf-kitchen.editor.logoImage"),
93
- "onUpdate:modelValue": l[9] || (l[9] = (e) => d((t) => ({ ...t, imgData: e })))
94
- }, null, 8, ["model-value", "title"]),
95
- r("div", O, [
96
- i(p, {
97
- "model-value": o.modelValue.imgHeight ?? 160,
98
- max: 999,
99
- min: 0,
100
- step: 1,
101
- label: a(n)("mf-kitchen.editor.logoHeight"),
102
- rules: [(e) => e <= 999 || "More than 999"],
103
- "onUpdate:modelValue": l[10] || (l[10] = (e) => {
104
- const t = Math.min(e, 999);
105
- d((u) => ({ ...u, imgHeight: t }));
106
- })
107
- }, null, 8, ["model-value", "label", "rules"]),
108
- i(p, {
109
- "model-value": o.modelValue.imgWidth ?? 160,
110
- max: 999,
111
- min: 0,
112
- step: 1,
113
- label: a(n)("mf-kitchen.editor.logoWidth"),
114
- rules: [(e) => e <= 999 || "More than 999"],
115
- "onUpdate:modelValue": l[11] || (l[11] = (e) => {
116
- const t = Math.min(e, 999);
117
- d((u) => ({ ...u, imgWidth: t }));
118
- })
119
- }, null, 8, ["model-value", "label", "rules"])
120
- ])
121
- ]),
122
- r("div", q, [
123
- i(s, {
124
- class: "w-full",
125
- variant: "secondary",
126
- label: a(n)("mf-kitchen.resetToDefault"),
127
- size: "md",
128
- onClick: a(h)
129
- }, null, 8, ["label", "onClick"])
130
- ])
131
- ]);
132
- };
133
- }
134
- }), J = { class: "h-full flex flex-col" }, K = { class: "flex flex-row min-h-0" }, L = { class: "flex flex-col flex-1" }, X = { class: "templateBuilderHeader" }, Y = { class: "fm-typo-en-body-lg-600" }, Z = { class: "flex h-full justify-center py-10 overflow-y-auto bg-fm-color-neutral-gray-100" }, ne = /* @__PURE__ */ _({
135
- __name: "NormalModeView",
136
- emits: ["change-mode"],
137
- setup(V, { emit: x }) {
138
- const f = C(), { t: m } = P(), n = M(), d = D(), h = y(), o = y();
139
- async function l() {
140
- if (o.value)
141
- try {
142
- const s = await T.updateInfo(o.value);
143
- p(s), f.open(
144
- {
145
- title: m("mf-kitchen.template.save.success", { file: m("mf-kitchen.receiptTemplate") }),
146
- type: "success"
147
- },
148
- 2e3
149
- );
150
- } catch {
151
- f.open(
152
- {
153
- title: m("mf-kitchen.template.save.failed", { file: m("mf-kitchen.receiptTemplate") }),
154
- type: "error"
155
- },
156
- 3e3
157
- );
158
- }
159
- }
160
- const b = x;
161
- function k() {
162
- b("change-mode", "advance");
163
- }
164
- function p(s) {
165
- h.value = s, o.value = s;
166
- }
167
- function v() {
168
- o.value = h.value;
169
- }
170
- return B(async () => {
171
- try {
172
- await n.readRestaurants(), p(await T.readInfo());
173
- } catch (s) {
174
- f.open(
175
- {
176
- title: m("mf-kitchen.template.load.fail", { file: m("mf-kitchen.receiptTemplate") }),
177
- message: `${s}`,
178
- type: "error"
179
- },
180
- 1e3
181
- );
182
- }
183
- }), (s, e) => {
184
- const t = c("FmButton");
185
- return g(), F("div", J, [
186
- i(E),
187
- i(z, { onUpdateTemplate: l }),
188
- r("div", K, [
189
- o.value ? (g(), w(G, {
190
- key: 0,
191
- modelValue: o.value,
192
- "onUpdate:modelValue": e[0] || (e[0] = (u) => o.value = u),
193
- onReset: v
194
- }, null, 8, ["modelValue"])) : S("", !0),
195
- r("div", L, [
196
- r("div", X, [
197
- r("label", Y, U(a(m)("mf-kitchen.templateBuilder")), 1),
198
- i(t, {
199
- variant: "secondary",
200
- label: a(m)("mf-kitchen.advanceBuilder"),
201
- "text-color": "primary",
202
- bgColor: "typo-white",
203
- "border-color": "primary",
204
- onClick: k
205
- }, null, 8, ["label"])
206
- ]),
207
- r("div", Z, [
208
- o.value && a(d).profile ? (g(), w(A, {
209
- key: 0,
210
- "receipt-info": o.value,
211
- profile: a(d).profile
212
- }, null, 8, ["receipt-info", "profile"])) : S("", !0)
213
- ])
214
- ])
215
- ])
216
- ]);
217
- };
218
- }
219
- });
220
- export {
221
- ne as default
222
- };