@feedmepos/mf-hrm-portal 1.1.3-dev → 1.1.4-dev.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,14 +1,15 @@
1
- import { defineComponent as ce, ref as T, computed as _, onMounted as pe, watch as xe, resolveComponent as y, createBlock as C, openBlock as p, unref as t, withCtx as b, createElementVNode as f, createVNode as c, createCommentVNode as re, createElementBlock as L, Fragment as q, renderList as G, toDisplayString as P, h as F, createTextVNode as ne, resolveDynamicComponent as ie, withModifiers as Fe, nextTick as ue } from "vue";
2
- import { e as Ce, a as E, r as K, h as le, f as Re, c as de, d as j } from "./index-D5sdamN5.js";
1
+ import { defineComponent as ce, ref as T, computed as _, onMounted as pe, watch as xe, resolveComponent as y, createBlock as C, openBlock as p, unref as t, withCtx as b, createElementVNode as f, createVNode as c, createCommentVNode as re, createElementBlock as L, Fragment as q, renderList as G, toDisplayString as D, h as F, createTextVNode as ne, resolveDynamicComponent as ie, withModifiers as Fe, nextTick as ue } from "vue";
2
+ import { e as E, r as K, h as le, f as Ce, a as me, c as j } from "./index-DEH1isVF.js";
3
3
  import { useI18n as ve, useCoreStore as fe } from "@feedmepos/mf-common";
4
- import { useSnackbar as _e, components as W, useDialog as Ve, useBreakpoints as we, FmButtonColorThemeVariant as me, FmButtonVariant as ke } from "@feedmepos/ui-library";
5
- import { _ as Ie } from "./app-CcbYGJ22.js";
6
- import { _ as Le } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
7
- import { u as he } from "./useAppStore-DOSLuH24.js";
8
- import { u as Ue, _ as se, a as Se, b as $e } from "./useRestaurantMap-D5BNPLKh.js";
9
- import { l as z } from "./lodash-7Am6_Zd3.js";
10
- import { u as Ee } from "./useLoading-BA-GSZ3R.js";
11
- const Te = { class: "fm-typo-en-title-md-600" }, Be = { class: "space-y-40" }, De = { class: "space-y-8" }, Pe = { class: "space-y-8" }, Me = {
4
+ import { useSnackbar as _e, components as W, useDialog as Re, useBreakpoints as Ve, FmButtonColorThemeVariant as de, FmButtonVariant as we } from "@feedmepos/ui-library";
5
+ import { _ as ke } from "./app-DKuRvdeB.js";
6
+ import { _ as Ie } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
7
+ import { u as he } from "./useAppStore-BJZiy3Q1.js";
8
+ import { u as Le, _ as se, a as Ue, b as Se } from "./useRestaurantMap-D5BNPLKh.js";
9
+ import { l as z } from "./lodash-Bbnb5Nlh.js";
10
+ import { u as $e } from "./useLoading-FywoIKYV.js";
11
+ import { FullPosPermissions as Ee } from "@feedmepos/hrm-permission";
12
+ const Te = { class: "fm-typo-en-title-md-600" }, Pe = { class: "space-y-40" }, Be = { class: "space-y-8" }, De = { class: "space-y-8" }, Me = {
12
13
  key: 0,
13
14
  class: "w-50 ml-5 flex flex-row items-start"
14
15
  }, Ae = { class: "m-2" }, Ne = { class: "flex gap-8 items-center justify-start" }, Oe = /* @__PURE__ */ ce({
@@ -23,11 +24,11 @@ const Te = { class: "fm-typo-en-title-md-600" }, Be = { class: "space-y-40" }, D
23
24
  const { t: s } = ve(), Q = fe(), U = T(""), R = _(() => Q.restaurants.value.filter(({ profile: e }) => {
24
25
  const a = `${e.code ? e.code + "-" : ""}${e.legalName}`;
25
26
  return !U.value || a.toLowerCase().includes(U.value.toLowerCase());
26
- })), S = he(), J = _e(), X = Ee(J), B = te, d = T(!1), Y = () => {
27
- d.value = !d.value, d.value && $();
28
- }, Z = _(() => B.id ? s("hr.role.form.update") : s("hr.role.form.add")), M = _(() => B.id ? s("common.update") : s("common.add")), A = _(() => Ce.filter(
27
+ })), S = he(), J = _e(), X = $e(J), P = te, m = T(!1), Y = () => {
28
+ m.value = !m.value, m.value && $();
29
+ }, Z = _(() => P.id ? s("hr.role.form.update") : s("hr.role.form.add")), M = _(() => P.id ? s("common.update") : s("common.add")), A = _(() => Ee.filter(
29
30
  (e) => !(e.subject === E.F_RULE_SUBJECT.enum.report && !e.conditions)
30
- ).map((e) => K(e))), m = _(() => S.roles.value.find((e) => e._id == B.id)), V = () => ({
31
+ ).map((e) => K(e))), d = _(() => S.roles.value.find((e) => e._id == P.id)), V = () => ({
31
32
  name: "",
32
33
  restaurantIds: [],
33
34
  permissions: [],
@@ -53,14 +54,14 @@ const Te = { class: "fm-typo-en-title-md-600" }, Be = { class: "space-y-40" }, D
53
54
  }))
54
55
  }))), h = _(() => {
55
56
  var e;
56
- return le(((e = m.value) == null ? void 0 : e.permissions) || []);
57
+ return le(((e = d.value) == null ? void 0 : e.permissions) || []);
57
58
  });
58
59
  function $() {
59
60
  var e;
60
- l.value = V(), l.value.name = ((e = m.value) == null ? void 0 : e.name) ?? "", h.value ? (l.value.restaurantIds = R.value.map((a) => a._id), l.value.permissions = A.value.map((a) => a.value)) : m.value && (l.value.restaurantIds = m.value.restaurants.map((a) => a.id), l.value.permissions = m.value.permissions.map(
61
+ l.value = V(), l.value.name = ((e = d.value) == null ? void 0 : e.name) ?? "", h.value ? (l.value.restaurantIds = R.value.map((a) => a._id), l.value.permissions = A.value.map((a) => a.value)) : d.value && (l.value.restaurantIds = d.value.restaurants.map((a) => a.id), l.value.permissions = d.value.permissions.map(
61
62
  (a) => K(a).value
62
- ), l.value.maxDiscountPercentage = de(
63
- m.value.permissions
63
+ ), l.value.maxDiscountPercentage = me(
64
+ d.value.permissions
64
65
  ));
65
66
  }
66
67
  pe(() => {
@@ -70,18 +71,18 @@ const Te = { class: "fm-typo-en-title-md-600" }, Be = { class: "space-y-40" }, D
70
71
  restaurantIds: l.value.restaurantIds,
71
72
  role: {
72
73
  name: l.value.name,
73
- permissions: Re(l.value.permissions, l.value.maxDiscountPercentage)
74
+ permissions: Ce(l.value.permissions, l.value.maxDiscountPercentage)
74
75
  }
75
76
  })), o = () => {
76
77
  const e = ae.value;
77
78
  X.minor(
78
79
  async () => {
79
- m.value ? await S.updateRole(m.value._id, e) : await S.createRole(e);
80
+ d.value ? await S.updateRole(d.value._id, e) : await S.createRole(e);
80
81
  },
81
82
  {
82
- successMessage: m.value ? s("hr.role.add.successMessage", { name: e.role.name }) : s("hr.role.update.successMessage", { name: e.role.name })
83
+ successMessage: d.value ? s("hr.role.add.successMessage", { name: e.role.name }) : s("hr.role.update.successMessage", { name: e.role.name })
83
84
  }
84
- ), d.value = !1;
85
+ ), m.value = !1;
85
86
  }, r = _(
86
87
  () => l.value.restaurantIds.filter((e) => R.value.some((a) => a._id === e))
87
88
  ), i = _(() => R.value.length > 0 && R.value.length === r.value.length), u = () => {
@@ -89,7 +90,7 @@ const Te = { class: "fm-typo-en-title-md-600" }, Be = { class: "space-y-40" }, D
89
90
  i.value === !0 ? l.value.restaurantIds = e : l.value.restaurantIds = R.value.map((a) => a._id);
90
91
  }, g = (e) => e.map((v) => v.value).every((v) => l.value.permissions.includes(v)), w = (e) => {
91
92
  const a = l.value.permissions.filter(
92
- (v) => !e.map((D) => D.value).includes(v)
93
+ (v) => !e.map((B) => B.value).includes(v)
93
94
  );
94
95
  g(e) === !0 ? l.value.permissions = a : l.value.permissions = [...a, ...e.map((v) => v.value)];
95
96
  };
@@ -99,33 +100,33 @@ const Te = { class: "fm-typo-en-title-md-600" }, Be = { class: "space-y-40" }, D
99
100
  e.length > 0 && (ee.value = "");
100
101
  }
101
102
  );
102
- const O = Ue(
103
+ const O = Le(
103
104
  () => {
104
- var e, a, v, D;
105
- return !z.isEqual(l.value.name, ((e = m.value) == null ? void 0 : e.name) || V().name) || !z.isEqual(
105
+ var e, a, v, B;
106
+ return !z.isEqual(l.value.name, ((e = d.value) == null ? void 0 : e.name) || V().name) || !z.isEqual(
106
107
  l.value.restaurantIds,
107
- ((a = m.value) == null ? void 0 : a.restaurants.map((k) => k.id)) || V().restaurantIds
108
+ ((a = d.value) == null ? void 0 : a.restaurants.map((k) => k.id)) || V().restaurantIds
108
109
  ) || !z.isEqual(
109
110
  l.value.permissions,
110
- ((v = m.value) == null ? void 0 : v.permissions.map((k) => K(k).value)) || V().permissions
111
+ ((v = d.value) == null ? void 0 : v.permissions.map((k) => K(k).value)) || V().permissions
111
112
  ) || !z.isEqual(
112
113
  l.value.maxDiscountPercentage,
113
- m.value ? de((D = m.value) == null ? void 0 : D.permissions) : V().maxDiscountPercentage
114
+ d.value ? me((B = d.value) == null ? void 0 : B.permissions) : V().maxDiscountPercentage
114
115
  );
115
116
  },
116
117
  () => {
117
- d.value = !1;
118
+ m.value = !1;
118
119
  }
119
120
  );
120
121
  return H({
121
- show: d,
122
+ show: m,
122
123
  trigger: Y
123
124
  }), (e, a) => {
124
- const v = y("FmTextField"), D = y("FmSearch"), k = y("FmCheckbox"), ge = y("FmFormGroup"), be = y("FmCard"), oe = y("fm-button"), ye = y("fm-side-sheet");
125
+ const v = y("FmTextField"), B = y("FmSearch"), k = y("FmCheckbox"), ge = y("FmFormGroup"), be = y("FmCard"), oe = y("fm-button"), ye = y("fm-side-sheet");
125
126
  return p(), C(ye, {
126
127
  id: "unit-form",
127
- modelValue: d.value,
128
- "onUpdate:modelValue": a[7] || (a[7] = (n) => d.value = n),
128
+ modelValue: m.value,
129
+ "onUpdate:modelValue": a[7] || (a[7] = (n) => m.value = n),
129
130
  "is-container": t(W).FmForm,
130
131
  "is-container-props": {
131
132
  onValidationSuccess: o,
@@ -135,7 +136,7 @@ const Te = { class: "fm-typo-en-title-md-600" }, Be = { class: "space-y-40" }, D
135
136
  "onOn:clickedAway": t(O)
136
137
  }, {
137
138
  "side-sheet-header": b(() => [
138
- f("p", Te, P(Z.value), 1)
139
+ f("p", Te, D(Z.value), 1)
139
140
  ]),
140
141
  "side-sheet-footer": b(() => [
141
142
  f("div", Ne, [
@@ -150,12 +151,12 @@ const Te = { class: "fm-typo-en-title-md-600" }, Be = { class: "space-y-40" }, D
150
151
  label: t(s)("common.cancel"),
151
152
  size: "lg",
152
153
  variant: "tertiary",
153
- onClick: a[6] || (a[6] = () => d.value = !1)
154
+ onClick: a[6] || (a[6] = () => m.value = !1)
154
155
  }, null, 8, ["label"])
155
156
  ])
156
157
  ]),
157
158
  default: b(() => [
158
- f("div", Be, [
159
+ f("div", Pe, [
159
160
  c(se, { title: "Role detail" }, {
160
161
  default: b(() => [
161
162
  c(v, {
@@ -173,7 +174,7 @@ const Te = { class: "fm-typo-en-title-md-600" }, Be = { class: "space-y-40" }, D
173
174
  title: t(s)("hr.role.form.restaurant")
174
175
  }, {
175
176
  default: b(() => [
176
- c(D, {
177
+ c(B, {
177
178
  modelValue: U.value,
178
179
  "onUpdate:modelValue": a[1] || (a[1] = (n) => U.value = n),
179
180
  placeholder: t(s)("hr.restaurant.search.placeholder")
@@ -184,7 +185,7 @@ const Te = { class: "fm-typo-en-title-md-600" }, Be = { class: "space-y-40" }, D
184
185
  rules: [(n) => n.length > 0 || t(s)("hr.role.form.atLeastOneRestaurant")]
185
186
  }, {
186
187
  default: b(() => [
187
- f("div", De, [
188
+ f("div", Be, [
188
189
  U.value ? re("", !0) : (p(), C(k, {
189
190
  key: 0,
190
191
  "model-value": i.value,
@@ -221,11 +222,11 @@ const Te = { class: "fm-typo-en-title-md-600" }, Be = { class: "space-y-40" }, D
221
222
  class: "p-16"
222
223
  }, {
223
224
  default: b(() => [
224
- c(Se, {
225
+ c(Ue, {
225
226
  label: n.title
226
227
  }, {
227
228
  default: b(() => [
228
- f("div", Pe, [
229
+ f("div", De, [
229
230
  c(k, {
230
231
  "model-value": g(n.options),
231
232
  label: "All",
@@ -244,7 +245,7 @@ const Te = { class: "fm-typo-en-title-md-600" }, Be = { class: "space-y-40" }, D
244
245
  disabled: h.value
245
246
  }, null, 8, ["modelValue", "label", "value", "disabled"]),
246
247
  I.value === "order:discount" && l.value.permissions.includes(I.value) ? (p(), L("div", Me, [
247
- f("div", Ae, P(t(s)("hr.role.form.maxDiscountPercentage")), 1),
248
+ f("div", Ae, D(t(s)("hr.role.form.maxDiscountPercentage")), 1),
248
249
  c(v, {
249
250
  modelValue: l.value.maxDiscountPercentage,
250
251
  "onUpdate:modelValue": a[5] || (a[5] = (x) => l.value.maxDiscountPercentage = x),
@@ -291,7 +292,7 @@ const Te = { class: "fm-typo-en-title-md-600" }, Be = { class: "space-y-40" }, D
291
292
  class: "flex"
292
293
  }, He = {
293
294
  class: "flex"
294
- }, ra = /* @__PURE__ */ ce({
295
+ }, na = /* @__PURE__ */ ce({
295
296
  __name: "RoleList",
296
297
  setup(te, {
297
298
  expose: H
@@ -314,7 +315,7 @@ const Te = { class: "fm-typo-en-title-md-600" }, Be = { class: "space-y-40" }, D
314
315
  }),
315
316
  default: () => F(W.FmIcon, {
316
317
  name: "info",
317
- color: me.NeutralGray400
318
+ color: de.NeutralGray400
318
319
  })
319
320
  });
320
321
  }
@@ -358,17 +359,17 @@ const Te = { class: "fm-typo-en-title-md-600" }, Be = { class: "space-y-40" }, D
358
359
  class: "w-full flex justify-end items-center"
359
360
  }, [F(W.FmButton, {
360
361
  prependIcon: "delete",
361
- variant: ke.Tertiary,
362
- textColor: me.NeutralGray400,
362
+ variant: we.Tertiary,
363
+ textColor: de.NeutralGray400,
363
364
  disabled: le(o.row.original.permissions),
364
365
  onClick: (r) => {
365
366
  r.stopPropagation(), l(o.row.original);
366
367
  }
367
368
  })])
368
- }], B = async (o) => {
369
+ }], P = async (o) => {
369
370
  var r;
370
371
  $.value = o._id, await ue(), (r = h.value) == null || r.trigger();
371
- }, d = he(), Y = $e(), Z = _(() => (d.roles.value || []).filter((i) => i.restaurants.some((u) => R.value.includes(u.id))).map((i) => {
372
+ }, m = he(), Y = Se(), Z = _(() => (m.roles.value || []).filter((i) => i.restaurants.some((u) => R.value.includes(u.id))).map((i) => {
372
373
  const u = i.restaurants.map((g) => {
373
374
  const w = Y.value[g.id];
374
375
  return {
@@ -389,9 +390,9 @@ const Te = { class: "fm-typo-en-title-md-600" }, Be = { class: "space-y-40" }, D
389
390
  });
390
391
  return g || O;
391
392
  });
392
- }), A = Ve(), m = _e(), {
393
+ }), A = Re(), d = _e(), {
393
394
  breakpoints: V
394
- } = we(), l = (o) => {
395
+ } = Ve(), l = (o) => {
395
396
  A.open({
396
397
  title: s("hr.role.remove.title"),
397
398
  message: s("hr.role.remove.message", {
@@ -408,12 +409,12 @@ const Te = { class: "fm-typo-en-title-md-600" }, Be = { class: "space-y-40" }, D
408
409
  close: !0
409
410
  }
410
411
  }).onPrimary(async () => {
411
- await d.deleteRole(o).then(() => m.open({
412
+ await m.deleteRole(o).then(() => d.open({
412
413
  message: s("hr.role.remove.successMessage", {
413
414
  name: o.name
414
415
  }),
415
416
  type: "success"
416
- })).catch((r) => m.open({
417
+ })).catch((r) => d.open({
417
418
  message: r,
418
419
  type: "error"
419
420
  })), A.close();
@@ -424,7 +425,7 @@ const Te = { class: "fm-typo-en-title-md-600" }, Be = { class: "space-y-40" }, D
424
425
  $.value = void 0, await ue(), (o = h.value) == null || o.trigger();
425
426
  }
426
427
  async function ae() {
427
- d.roles.value.length === 0 && await d.readRoles();
428
+ m.roles.value.length === 0 && await m.readRoles();
428
429
  }
429
430
  return pe(() => {
430
431
  ae();
@@ -443,7 +444,7 @@ const Te = { class: "fm-typo-en-title-md-600" }, Be = { class: "space-y-40" }, D
443
444
  class: "w-[320px] xs:w-full",
444
445
  autofocus: "",
445
446
  placeholder: t(s)("hr.role.search.placeholder") + " / " + t(s)("hr.restaurant.search.placeholder")
446
- }, null, 8, ["modelValue", "placeholder"])]), t(d).roles.value.length > 0 || t(d).isLoading.value ? (p(), C(Ie, {
447
+ }, null, 8, ["modelValue", "placeholder"])]), t(m).roles.value.length > 0 || t(m).isLoading.value ? (p(), C(ke, {
447
448
  key: 0,
448
449
  class: "overflow-auto"
449
450
  }, {
@@ -452,24 +453,24 @@ const Te = { class: "fm-typo-en-title-md-600" }, Be = { class: "space-y-40" }, D
452
453
  "column-defs": X,
453
454
  "row-data": M.value,
454
455
  "page-size": M.value.length,
455
- loading: t(d).isLoading.value,
456
+ loading: t(m).isLoading.value,
456
457
  "pin-header-row": "",
457
458
  "hide-footer": "",
458
459
  "shrink-at": !1,
459
- onRowClick: r[1] || (r[1] = (e) => B(e.original))
460
+ onRowClick: r[1] || (r[1] = (e) => P(e.original))
460
461
  }, null, 8, ["row-data", "page-size", "loading"]), f("div", je, [c(O, {
461
462
  separator: ""
462
463
  }, {
463
464
  default: b(() => [(p(!0), L(q, null, G(M.value, (e) => (p(), C(w, {
464
465
  key: e._id,
465
466
  class: "py-12 px-16 items-center justify-between",
466
- onClick: (a) => B(e)
467
+ onClick: (a) => P(e)
467
468
  }, {
468
- default: b(() => [f("div", ze, [f("p", Ge, P(e.name), 1), f("div", Ke, [f("p", null, P(t(s)("hr.role.labels.restaurantList", {
469
+ default: b(() => [f("div", ze, [f("p", Ge, D(e.name), 1), f("div", Ke, [f("p", null, D(t(s)("hr.role.labels.restaurantList", {
469
470
  items: e.restaurants.map((a) => a.name).join(", ")
470
- })), 1), f("p", We, [ne(P(t(s)("hr.role.labels.operationList", {
471
+ })), 1), f("p", We, [ne(D(t(s)("hr.role.labels.operationList", {
471
472
  items: t(j)(e.permissions, t(E.F_RULE_SUBJECT).enum.order)
472
- })) + " ", 1), (p(), C(ie(S(e.permissions, t(E.F_RULE_SUBJECT).enum.order))))]), f("p", He, [ne(P(t(s)("hr.role.labels.reportList", {
473
+ })) + " ", 1), (p(), C(ie(S(e.permissions, t(E.F_RULE_SUBJECT).enum.order))))]), f("p", He, [ne(D(t(s)("hr.role.labels.reportList", {
473
474
  items: t(j)(e.permissions, t(E.F_RULE_SUBJECT).enum.report)
474
475
  })) + " ", 1), (p(), C(ie(S(e.permissions, t(E.F_RULE_SUBJECT).enum.report))))])])]), c(g, {
475
476
  disabled: t(le)(e.permissions),
@@ -483,7 +484,7 @@ const Te = { class: "fm-typo-en-title-md-600" }, Be = { class: "space-y-40" }, D
483
484
  _: 1
484
485
  })])]),
485
486
  _: 1
486
- })) : (p(), C(t(Le), {
487
+ })) : (p(), C(t(Ie), {
487
488
  key: 1,
488
489
  title: t(s)("hr.role.noData.title"),
489
490
  subtitle: t(s)("hr.role.noData.subtitle")
@@ -492,5 +493,5 @@ const Te = { class: "fm-typo-en-title-md-600" }, Be = { class: "space-y-40" }, D
492
493
  }
493
494
  });
494
495
  export {
495
- ra as default
496
+ na as default
496
497
  };
@@ -2,9 +2,9 @@ import { defineComponent as I, computed as V, resolveComponent as m, createEleme
2
2
  import { useI18n as N, useCoreStore as K } from "@feedmepos/mf-common";
3
3
  import { useSnackbar as j, useDialog as G, useBreakpoints as O, components as H, FmButtonColorThemeVariant as J, FmButtonVariant as Q } from "@feedmepos/ui-library";
4
4
  import { _ as X } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
5
- import { v as Y, u as z } from "./index-D5sdamN5.js";
6
- import { u as Z } from "./useLoading-BA-GSZ3R.js";
7
- import { a as ee } from "./PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BvjXcknf.js";
5
+ import { v as Y, u as z } from "./index-DEH1isVF.js";
6
+ import { u as Z } from "./useLoading-FywoIKYV.js";
7
+ import { a as ee } from "./PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CRJCyyrg.js";
8
8
  const oe = { class: "flex flex-row items-center gap-8" }, te = /* @__PURE__ */ I({
9
9
  __name: "PermissionWithTooltip",
10
10
  props: {