@feedmepos/mf-kitchen 1.0.0 → 1.0.2

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