@feedmepos/mf-kitchen 1.0.1 → 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
+ };
@@ -3,7 +3,7 @@ import { useRoute as l, useRouter as _ } from "vue-router";
3
3
  const M = /* @__PURE__ */ m({
4
4
  __name: "ReceiptTemplate",
5
5
  setup(f) {
6
- const t = l(), c = n(() => import("./NormalModeView-39415dd5.js")), r = n(() => import("./AdvanceModeView-1ae75ba9.js")), a = p(() => t.query.mode === "advance" ? r : c), o = _();
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
7
  function u(e) {
8
8
  o.replace({
9
9
  name: o.currentRoute.value.name,
package/dist/app.d.ts CHANGED
@@ -6,6 +6,7 @@ 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;
@@ -219,6 +220,7 @@ 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;
@@ -433,6 +435,7 @@ 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;
package/dist/app.js CHANGED
@@ -1,9 +1,10 @@
1
- import { defineComponent as o, computed as p, ref as u, resolveComponent as n, openBlock as m, createBlock as l, onMounted as g } from "vue";
2
- import { useRouter as v } from "vue-router";
3
- import { useI18n as h, useCoreStore as b } from "@feedmepos/mf-common";
4
- const f = {
1
+ import { defineComponent as m, computed as g, ref as v, resolveComponent as l, openBlock as c, createBlock as d, onMounted as h } from "vue";
2
+ import { useRouter as b } from "vue-router";
3
+ import { useI18n as f, useCoreStore as k } from "@feedmepos/mf-common";
4
+ const y = {
5
5
  "mf-kitchen": {
6
6
  title: "Receipt builder",
7
+ cancel: "Cancel",
7
8
  count: "Count: {count}",
8
9
  advance: "Advance",
9
10
  advanceBuilder: "Advance builder",
@@ -215,9 +216,10 @@ Scan QR code to let us know how you enjoyed with us, or to claim e-invoice`,
215
216
  footerTextPlaceholder: "Enter footer text here",
216
217
  footerQrPlaceholder: "Enter footer QR here"
217
218
  }
218
- }, k = {
219
+ }, T = {
219
220
  "mf-kitchen": {
220
221
  title: "โปรแกรมสร้างใบเสร็จ",
222
+ cancel: "ยกเลิก",
221
223
  count: "Count: {count}",
222
224
  advance: "ขั้นสูง",
223
225
  advanceBuilder: "ผู้สร้างขั้นสูง",
@@ -430,9 +432,10 @@ Scan QR code to let us know how you enjoyed with us, or to claim e-invoice`,
430
432
  footerTextPlaceholder: "กรอกข้อความท้ายกระดาษที่นี่",
431
433
  footerQrPlaceholder: "กรอก QR ท้ายกระดาษที่นี่"
432
434
  }
433
- }, y = {
435
+ }, x = {
434
436
  "mf-kitchen": {
435
437
  title: "模板生成器",
438
+ cancel: "取消",
436
439
  count: "计数: {count}",
437
440
  advance: "高级",
438
441
  advanceBuilder: "高级建造",
@@ -645,54 +648,58 @@ Scan QR code to let us know how you enjoyed with us, or to claim e-invoice`,
645
648
  footerTextPlaceholder: "在此处输入页脚文本",
646
649
  footerQrPlaceholder: "在此处输入页脚二维码"
647
650
  }
648
- }, A = [
649
- {
650
- path: "/",
651
- redirect: "/receipt-template"
652
- },
651
+ }, r = [
653
652
  {
654
653
  path: "/receipt-template",
655
654
  name: "receipt-template",
656
- component: () => import("./ReceiptTemplate-6fd26b0f.js")
655
+ component: () => import("./ReceiptTemplate-ad04045a.js")
656
+ }
657
+ ];
658
+ var n;
659
+ r.push({
660
+ path: "/",
661
+ redirect: {
662
+ name: ((n = r[0].children) == null ? void 0 : n[0].name) || r[0].name
657
663
  }
658
- ], T = /* @__PURE__ */ o({
664
+ });
665
+ const w = /* @__PURE__ */ m({
659
666
  __name: "Navigator",
660
- setup(c) {
661
- const { t } = h(), r = v(), a = p(() => [
667
+ setup(s) {
668
+ const { t } = f(), a = b(), i = g(() => [
662
669
  {
663
670
  label: t("mf-kitchen.receiptTemplate"),
664
671
  value: "receipt-template",
665
- action: () => r.push({ name: "receipt-template" })
672
+ action: () => a.push({ name: "receipt-template" })
666
673
  }
667
- ]), e = u("");
668
- return (x, i) => {
669
- const d = n("fm-collapsible-tabs");
670
- return m(), l(d, {
674
+ ]), e = v("");
675
+ return (C, o) => {
676
+ const p = l("fm-collapsible-tabs");
677
+ return c(), d(p, {
671
678
  modelValue: e.value,
672
- "onUpdate:modelValue": i[0] || (i[0] = (s) => e.value = s),
673
- items: a.value,
679
+ "onUpdate:modelValue": o[0] || (o[0] = (u) => e.value = u),
680
+ items: i.value,
674
681
  class: "py-16 px-8"
675
682
  }, null, 8, ["modelValue", "items"]);
676
683
  };
677
684
  }
678
- }), R = /* @__PURE__ */ o({
685
+ }), S = /* @__PURE__ */ m({
679
686
  __name: "App",
680
- setup(c) {
681
- const t = b();
682
- return g(() => {
683
- t.registerSidebarComponent(T);
684
- }), (r, a) => {
685
- const e = n("router-view");
686
- return m(), l(e);
687
+ setup(s) {
688
+ const t = k();
689
+ return h(() => {
690
+ t.registerSidebarComponent(w);
691
+ }), (a, i) => {
692
+ const e = l("router-view");
693
+ return c(), d(e);
687
694
  };
688
695
  }
689
- }), S = {
690
- "en-US": f,
691
- "zh-CN": y,
692
- "th-TH": k
696
+ }), D = {
697
+ "en-US": y,
698
+ "zh-CN": x,
699
+ "th-TH": T
693
700
  };
694
701
  export {
695
- R as FmApp,
696
- S as i18nMessages,
697
- A as routes
702
+ S as FmApp,
703
+ D as i18nMessages,
704
+ r as routes
698
705
  };
@@ -1,6 +1,6 @@
1
- import type { Row, Widget } from '@/components/type';
1
+ import type { AdvancedRow, Widget } from '@/components/type';
2
2
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
3
- modelValue: Row[];
3
+ modelValue: AdvancedRow[];
4
4
  fontSize: number;
5
5
  selectedWidget?: Widget | null | undefined;
6
6
  selectedWidgetSectionType?: "GENERAL" | "ITEM" | "CALCULATION" | "PAYMENT" | null | undefined;
@@ -99,9 +99,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
99
99
  } | null | undefined;
100
100
  }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
101
101
  selectWidget: (v: any) => void;
102
- "update:model-value": (v: Row[]) => void;
102
+ "update:model-value": (v: AdvancedRow[]) => void;
103
103
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
104
- modelValue: Row[];
104
+ modelValue: AdvancedRow[];
105
105
  fontSize: number;
106
106
  selectedWidget?: Widget | null | undefined;
107
107
  selectedWidgetSectionType?: "GENERAL" | "ITEM" | "CALCULATION" | "PAYMENT" | null | undefined;
@@ -199,7 +199,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
199
199
  }[];
200
200
  } | null | undefined;
201
201
  }>>> & Readonly<{
202
- "onUpdate:model-value"?: ((v: Row[]) => any) | undefined;
202
+ "onUpdate:model-value"?: ((v: AdvancedRow[]) => any) | undefined;
203
203
  onSelectWidget?: ((v: any) => any) | undefined;
204
204
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
205
205
  export default _default;