@feedmepos/mf-kitchen 1.0.2 → 1.0.3

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