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