@feedmepos/mf-kitchen 1.0.3 → 1.0.5-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,27 +1,27 @@
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({
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 M, createBlock as w, createCommentVNode as S } from "vue";
2
+ import { u as B, _ as C, I as $, r as T, a as I, T as E, P as N, g as D } from "./TemplateHeader-3a3b15b3.js";
3
+ import { useI18n as P, useCoreStore as z } from "@feedmepos/mf-common";
4
+ import { useSnackbar as A } from "@feedmepos/ui-library";
5
+ import "./app-70a6f50f.js";
6
+ const H = { class: "flex flex-col w-[420px]" }, Q = { class: "flex flex-col px-[24px] py-[16px] overflow-y-auto gap-24" }, R = { 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__ */ F({
7
7
  __name: "NormalModeEditor",
8
8
  props: {
9
9
  modelValue: {}
10
10
  },
11
11
  emits: ["update:model-value", "reset"],
12
- setup(b, { emit: V }) {
13
- const c = b, m = V, { t: a } = P();
12
+ setup(g, { emit: V }) {
13
+ const c = g, r = V, { t: a } = P();
14
14
  function d(n) {
15
- m("update:model-value", n(c.modelValue));
15
+ r("update:model-value", n(c.modelValue));
16
16
  }
17
- const s = C(() => {
18
- m("reset");
17
+ const s = B(() => {
18
+ r("reset");
19
19
  });
20
20
  return (n, l) => {
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, {
21
+ const b = p("FmTextarea"), f = p("FmTextField"), v = p("FmStepperField"), m = p("FmSwitch"), k = p("FmButton");
22
+ return x(), U("div", H, [
23
+ u("div", Q, [
24
+ i(b, {
25
25
  "model-value": n.modelValue.headerText,
26
26
  label: t(a)("mf-kitchen.editor.headerText"),
27
27
  placeholder: t(a)("mf-kitchen.headerTextPlaceholder"),
@@ -45,37 +45,37 @@ const A = { class: "flex flex-col w-[420px]" }, H = { class: "flex flex-col px-[
45
45
  d((h) => ({ ...h, fontSize: o }));
46
46
  })
47
47
  }, null, 8, ["model-value", "label", "rules"]),
48
- u("div", Q, [
49
- u("label", R, _(t(a)("mf-kitchen.receiptSetting")), 1),
50
- u("div", W, [
51
- i(r, {
48
+ u("div", R, [
49
+ u("label", W, _(t(a)("mf-kitchen.receiptSetting")), 1),
50
+ u("div", j, [
51
+ i(m, {
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(r, {
58
+ i(m, {
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(r, {
65
+ i(m, {
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(M, {
72
+ i(C, {
73
73
  "model-value": n.modelValue,
74
- "onUpdate:modelValue": l[6] || (l[6] = (e) => m("update:model-value", e))
74
+ "onUpdate:modelValue": l[6] || (l[6] = (e) => r("update:model-value", e))
75
75
  }, null, 8, ["model-value"])
76
76
  ])
77
77
  ]),
78
- i(k, {
78
+ i(b, {
79
79
  "model-value": n.modelValue.footerText,
80
80
  label: t(a)("mf-kitchen.editor.footerText"),
81
81
  placeholder: t(a)("mf-kitchen.footerTextPlaceholder"),
@@ -92,7 +92,7 @@ const A = { class: "flex flex-col w-[420px]" }, H = { class: "flex flex-col px-[
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
- u("div", j, [
95
+ u("div", O, [
96
96
  i(v, {
97
97
  "model-value": n.modelValue.imgHeight ?? 160,
98
98
  max: 999,
@@ -119,8 +119,8 @@ const A = { class: "flex flex-col w-[420px]" }, H = { class: "flex flex-col px-[
119
119
  }, null, 8, ["model-value", "label", "rules"])
120
120
  ])
121
121
  ]),
122
- u("div", O, [
123
- i(g, {
122
+ u("div", q, [
123
+ i(k, {
124
124
  class: "w-full",
125
125
  variant: "secondary",
126
126
  label: t(a)("mf-kitchen.resetToDefault"),
@@ -131,7 +131,7 @@ const A = { class: "flex flex-col w-[420px]" }, H = { class: "flex flex-col px-[
131
131
  ]);
132
132
  };
133
133
  }
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({
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__ */ F({
135
135
  __name: "NormalModeView",
136
136
  props: {
137
137
  profile: {
@@ -140,23 +140,24 @@ const A = { class: "flex flex-col w-[420px]" }, H = { class: "flex flex-col px-[
140
140
  }
141
141
  },
142
142
  emits: ["change-mode"],
143
- setup(b, { emit: V }) {
144
- const c = z(), { t: m } = P(), a = E(), d = y(), s = y();
143
+ setup(g, { emit: V }) {
144
+ const c = A(), { t: r } = P(), a = z(), d = y(), s = y();
145
145
  async function n() {
146
146
  if (s.value)
147
147
  try {
148
- const r = await T.updateInfo(s.value);
149
- f(r), c.open(
148
+ const m = await T.updateInfo(s.value);
149
+ f(m), c.open(
150
150
  {
151
- title: m("mf-kitchen.template.save.success", { file: m("mf-kitchen.receiptTemplate") }),
151
+ title: r("mf-kitchen.template.save.success", { file: r("mf-kitchen.receiptTemplate") }),
152
152
  type: "success"
153
153
  },
154
154
  2e3
155
155
  );
156
- } catch {
156
+ } catch (m) {
157
157
  c.open(
158
158
  {
159
- title: m("mf-kitchen.template.save.failed", { file: m("mf-kitchen.receiptTemplate") }),
159
+ title: r("mf-kitchen.template.save.failed", { file: r("mf-kitchen.receiptTemplate") }),
160
+ message: D(m),
160
161
  type: "error"
161
162
  },
162
163
  3e3
@@ -164,57 +165,57 @@ const A = { class: "flex flex-col w-[420px]" }, H = { class: "flex flex-col px-[
164
165
  }
165
166
  }
166
167
  const l = V;
167
- function k() {
168
+ function b() {
168
169
  l("change-mode", "advance");
169
170
  }
170
- function f(r) {
171
- d.value = r, s.value = r;
171
+ function f(m) {
172
+ d.value = m, s.value = m;
172
173
  }
173
174
  function v() {
174
175
  s.value = d.value;
175
176
  }
176
- return B(async () => {
177
+ return M(async () => {
177
178
  try {
178
179
  await a.readRestaurants(), f(await T.readInfo());
179
- } catch (r) {
180
+ } catch (m) {
180
181
  c.open(
181
182
  {
182
- title: m("mf-kitchen.template.load.fail", { file: m("mf-kitchen.receiptTemplate") }),
183
- message: `${r}`,
183
+ title: r("mf-kitchen.template.load.fail", { file: r("mf-kitchen.receiptTemplate") }),
184
+ message: `${m}`,
184
185
  type: "error"
185
186
  },
186
187
  1e3
187
188
  );
188
189
  }
189
- }), (r, g) => {
190
+ }), (m, k) => {
190
191
  const e = p("FmButton");
191
- return x(), U("div", G, [
192
+ return x(), U("div", J, [
192
193
  i(I),
193
- i(N, { onUpdateTemplate: n }),
194
- u("div", J, [
195
- s.value ? (x(), w(q, {
194
+ i(E, { onUpdateTemplate: n }),
195
+ u("div", K, [
196
+ s.value ? (x(), w(G, {
196
197
  key: 0,
197
198
  modelValue: s.value,
198
- "onUpdate:modelValue": g[0] || (g[0] = (o) => s.value = o),
199
+ "onUpdate:modelValue": k[0] || (k[0] = (o) => s.value = o),
199
200
  onReset: v
200
201
  }, null, 8, ["modelValue"])) : S("", !0),
201
- u("div", K, [
202
- u("div", L, [
203
- u("label", X, _(t(m)("mf-kitchen.templateBuilder")), 1),
202
+ u("div", L, [
203
+ u("div", X, [
204
+ u("label", Y, _(t(r)("mf-kitchen.templateBuilder")), 1),
204
205
  i(e, {
205
206
  variant: "secondary",
206
- label: t(m)("mf-kitchen.advanceBuilder"),
207
+ label: t(r)("mf-kitchen.advanceBuilder"),
207
208
  "text-color": "primary",
208
209
  bgColor: "typo-white",
209
210
  "border-color": "primary",
210
- onClick: k
211
+ onClick: b
211
212
  }, null, 8, ["label"])
212
213
  ]),
213
- u("div", Y, [
214
- s.value && b.profile ? (x(), w(D, {
214
+ u("div", Z, [
215
+ s.value && g.profile ? (x(), w(N, {
215
216
  key: 0,
216
217
  "receipt-info": s.value,
217
- profile: b.profile
218
+ profile: g.profile
218
219
  }, null, 8, ["receipt-info", "profile"])) : S("", !0)
219
220
  ])
220
221
  ])
@@ -224,5 +225,5 @@ const A = { class: "flex flex-col w-[420px]" }, H = { class: "flex flex-col px-[
224
225
  }
225
226
  });
226
227
  export {
227
- ae as default
228
+ ne as default
228
229
  };
@@ -0,0 +1,113 @@
1
+ import { defineComponent as f, defineAsyncComponent as s, computed as a, openBlock as c, createBlock as u, KeepAlive as v, resolveDynamicComponent as R } from "vue";
2
+ import { useCoreStore as _ } from "@feedmepos/mf-common";
3
+ import { useRoute as A, useRouter as N } from "vue-router";
4
+ const g = "mProfile_2021-08-11T03:00:54.471Z", b = "25-b8e114a8abdd0f62619314e6e057ee7a", O = "Mock Receipt Template", P = {
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
+ }, y = "+60123456789", M = "-", T = "", C = !0, H = [], k = [], J = {
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
+ }, B = "", S = "Mock Receipt Template", q = null, x = "mockReceiptTemplate", L = "", Y = "", D = {
72
+ _id: g,
73
+ _rev: b,
74
+ name: O,
75
+ address: P,
76
+ phoneNo: y,
77
+ regNo: M,
78
+ email: T,
79
+ type_mProfile: C,
80
+ photos: H,
81
+ tags: k,
82
+ operatingHours: J,
83
+ description: B,
84
+ legalName: S,
85
+ sstRegNo: q,
86
+ url: x,
87
+ coverPhoto: L,
88
+ thumbnailPhoto: Y
89
+ }, j = /* @__PURE__ */ f({
90
+ __name: "ReceiptTemplate",
91
+ setup(I) {
92
+ const l = A(), i = s(() => import("./NormalModeView-c9e891a1.js")), p = s(() => import("./AdvanceModeView-bf31793f.js")), m = a(() => l.query.mode === "advance" ? p : i), o = _(), d = a(() => {
93
+ var r;
94
+ const e = o.currentRestaurant.value, [n] = o.restaurants.value;
95
+ return ((r = e ?? n) == null ? void 0 : r.profile) || D;
96
+ }), t = N();
97
+ function h(e) {
98
+ t.replace({
99
+ name: t.currentRoute.value.name,
100
+ query: { mode: e }
101
+ });
102
+ }
103
+ return (e, n) => (c(), u(v, null, [
104
+ (c(), u(R(m.value), {
105
+ onChangeMode: h,
106
+ profile: d.value
107
+ }, null, 40, ["profile"]))
108
+ ], 1024));
109
+ }
110
+ });
111
+ export {
112
+ j as default
113
+ };