@feedmepos/mf-inventory-portal 1.5.11 → 1.6.0-dev.1
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.
- package/dist/{App-BWf57b4t.js → App-HlUs-LF4.js} +4 -4
- package/dist/{ApprovalView-BQjxa4od.js → ApprovalView-qmRODLFE.js} +7 -7
- package/dist/{BindingsDialog-DHQpAKaM.js → BindingsDialog-DhSose8-.js} +2 -2
- package/dist/{BindingsPicker-BtnsTZxq.js → BindingsPicker-JnvHyWiF.js} +2 -2
- package/dist/{BindingsTable-CEjCrzkM.js → BindingsTable-B8BSFIJ8.js} +3 -3
- package/dist/ClosingDraftView-XGq-b6Sj.js +4318 -0
- package/dist/{ClosingHistoryView-COhVCZ6T.js → ClosingHistoryView-DAo8MIT2.js} +5 -5
- package/dist/ClosingTemplateView-DSFABll0.js +2221 -0
- package/dist/{DefaultView-XD_Yt0j2.js → DefaultView-B-HflwRG.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-DPBogeWl.js → DeliveryOrderPrintPreview-Drn8FFa7.js} +2 -2
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CuUjCSg_.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CK8RpMEu.js} +2 -2
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BNaC4SaJ.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-P64wdK5z.js} +2 -2
- package/dist/{FmMultiselectDialog-ZaI1nC7s.js → FmMultiselectDialog-CH126sIF.js} +2 -2
- package/dist/{FmMultiselectDialog-CDwkAKS4.js → FmMultiselectDialog-CRG145W_.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-Bh7vT1ap.js → FmUnitInput.vue_vue_type_script_setup_true_lang-Dg0alt69.js} +5 -5
- package/dist/{ImportView-CGBW80r5.js → ImportView-Ca1QPSKV.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-mhohLiNO.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CoFavJB9.js} +1 -1
- package/dist/{IngredientGroupView-CXmqiSFi.js → IngredientGroupView-BfBtqgnZ.js} +5 -5
- package/dist/{IngredientsView-Bqyoy8bV.js → IngredientsView-WzM4VxgZ.js} +15 -15
- package/dist/{IntegrationExplorerView-Dm7oV3f2.js → IntegrationExplorerView-OwTTR-uV.js} +352 -352
- package/dist/{IntegrationView-C2MenVog.js → IntegrationView-DYAGDE0m.js} +13 -13
- package/dist/{InventoryBindingForm-BrUdmXai.js → InventoryBindingForm-Cs-8ACDl.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-C2D0Y_tA.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-Dm9Nna0r.js} +5 -5
- package/dist/{InventoryBindingSummary-Bc7ad5Sc.js → InventoryBindingSummary-BbhIvkwv.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-B-YNHvHn.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Ci0Wx2Gl.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DxlMUD0-.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BLOC3W1b.js} +1 -1
- package/dist/{PublishView-1Hmh17KB.js → PublishView-CUNDP20R.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-BGPW3oSz.js → PurchaseOrderPrintPreview-oUPrrGvK.js} +2 -2
- package/dist/{ReceiveRequestView-DYGpjUGg.js → ReceiveRequestView-CxcE8Azw.js} +26 -26
- package/dist/{RecipeView-CQSWNVxz.js → RecipeView-CdN4CJal.js} +17 -17
- package/dist/{SettingsView-WRKFaJXm.js → SettingsView-B5QKC4i7.js} +4 -4
- package/dist/{StockView-CkjlbtAM.js → StockView-By0MuX62.js} +19 -19
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-JLZUzvBc.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-C7Elh3p_.js} +1 -1
- package/dist/{SupplierView-Ct5oUSa0.js → SupplierView-apsm42Mq.js} +12 -12
- package/dist/{SurchargeView-F6asKB7s.js → SurchargeView-B-G77ghZ.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-7rHQ_Og6.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-DlhMQg5r.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CX5AkuKm.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CmYIHCe2.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-VkxnUelX.js → TransferDetails.vue_vue_type_script_setup_true_lang-24nRAago.js} +20 -20
- package/dist/TransferTemplateView-BBIIu12F.js +2327 -0
- package/dist/{UnitCostHistoryView-DsEJiOdk.js → UnitCostHistoryView-CG-6grmh.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-DuCYUoSR.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-DtmY7fLw.js} +5 -5
- package/dist/{UnitView-DG3gwIpl.js → UnitView-CIrL8HXK.js} +7 -7
- package/dist/{WarehouseView-fr8lffeM.js → WarehouseView-Bvd72APe.js} +5 -5
- package/dist/{WastageTemplateView-CVH_KJFk.js → WastageTemplateView-DHej2xrY.js} +14 -14
- package/dist/api/closing-draft.d.ts +6 -0
- package/dist/{app-BYizx2TA.js → app-BCF9ZpO-.js} +16564 -14534
- package/dist/app.d.ts +268 -0
- package/dist/app.js +1 -1
- package/dist/{closing-template-DlmTajUF.js → closing-template-CIuRAYD3.js} +1 -1
- package/dist/{date2-CK4pbvFs.js → date2-DJVh7XJh.js} +1 -1
- package/dist/{dayjs.min-eqk6iB0Q.js → dayjs.min-HcfNNaXG.js} +1 -1
- package/dist/{decimal-D6diZdvd.js → decimal-BZ-WtkK6.js} +2 -2
- package/dist/{defineDeepModel-Ddwa5nPa.js → defineDeepModel-D06G28ot.js} +1 -1
- package/dist/{duplicate-template-Clne4Zc0.js → duplicate-template-y-uKyjAx.js} +1 -1
- package/dist/{feature-BH7rzLzp.js → feature-DW0OW8Zl.js} +2 -2
- package/dist/{format-time-from-id-vTGnZA4n.js → format-time-from-id-CrGnGtJV.js} +1 -1
- package/dist/format-unit-display-DVEnGOV-.js +1432 -0
- package/dist/{import-export.helper-DGoitnNS.js → import-export.helper-CPoS7Xw2.js} +6 -6
- package/dist/{index-CgTKerdi.js → index-BAI_qEVG.js} +1 -1
- package/dist/{index-BHxx3tcy.js → index-BF_ER6cD.js} +3 -3
- package/dist/{index-CZNCrbvL.js → index-BSLoykmu.js} +1 -1
- package/dist/{inventory-core-dart.default-CwJecjsN.js → inventory-core-dart.default-B8GRBHwH.js} +1 -1
- package/dist/{lz-string-DNWslmx-.js → lz-string-DllDsJgA.js} +1 -1
- package/dist/{netsuite-CkGOciZz.js → netsuite-BdXvv_AI.js} +2 -2
- package/dist/{number-CKLFAlxa.js → number-fWsZU3Us.js} +3 -3
- package/dist/{predefined-templates-DjRmYzhJ.js → predefined-templates-C-9FNSkn.js} +1 -1
- package/dist/{purchase-order-template-DVgeAvta.js → purchase-order-template-DDMRkK1M.js} +1 -1
- package/dist/{recalculationUtils-DvHtdxhh.js → recalculationUtils-17E1-6g0.js} +1 -1
- package/dist/{rules-BAlQmkcE.js → rules-clVHbjpg.js} +2 -2
- package/dist/{stock-D7Hldocr.js → stock-ZvR0DmAv.js} +1 -1
- package/dist/{supplier-BmgrpHSy.js → supplier-BnYLExem.js} +2 -2
- package/dist/{surcharge-DB_6Y3jb.js → surcharge-CYjKFXbG.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{uom-rules-BH4MTGJI.js → uom-rules-C_eQhUkx.js} +1 -1
- package/dist/{use-ingredient-select-dialog-xVey5vN2.js → use-ingredient-select-dialog-ClGmxwFU.js} +16 -16
- package/dist/{use-inventory-binding-dialog-BJWwE2tm.js → use-inventory-binding-dialog-CpKdIwMo.js} +2 -2
- package/dist/{use-template-enabled-locations-DnwX4_zN.js → use-template-enabled-locations-deP7LXci.js} +2 -2
- package/dist/{use-transfer-locations-CXCnHMBU.js → use-transfer-locations-D3nYdH_3.js} +2 -2
- package/dist/{useHrmPermission-Bm6eZc49.js → useHrmPermission-CMTlJ6AP.js} +1 -1
- package/dist/{useNavigationMenu-CBnZlvGu.js → useNavigationMenu-BxATo1IC.js} +2 -2
- package/dist/{useSseClient-Dndnv55D.js → useSseClient-CGJVJAXa.js} +3 -3
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftApprovalDialog.vue.d.ts +800 -0
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +40 -0
- package/dist/views/closing-draft/components/closing-draft-groups/ClosingGroupAction.vue.d.ts +21 -0
- package/dist/views/closing-draft/components/closing-draft-groups/ClosingGroupCard.vue.d.ts +20 -0
- package/dist/views/closing-draft/components/closing-draft-groups/ClosingGroupDetailSideSheet.vue.d.ts +823 -0
- package/dist/views/closing-draft/components/closing-draft-groups/ClosingGroupGrid.vue.d.ts +20 -0
- package/dist/views/closing-draft/composables/use-closing-draft-import.d.ts +10 -0
- package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +1400 -133
- package/dist/views/closing-draft/helpers/closing-draft-summary.helper.d.ts +11 -0
- package/dist/views/closing-draft/helpers/closing-group-detail.helper.d.ts +68 -0
- package/dist/views/closing-draft/helpers/closing-group-status.helper.d.ts +6 -0
- package/dist/views/closing-draft/helpers/closing-groups.helper.d.ts +28 -0
- package/dist/views/closing-draft/helpers/merge-closing-draft-items.helper.d.ts +9 -0
- package/dist/views/closing-template/components/closing-template-form/components/ClosingTemplateGroupsEditor.vue.d.ts +31 -0
- package/dist/views/closing-template/components/closing-template-form/components/ClosingTemplateItem.vue.d.ts +164 -7
- package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +24 -88
- package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +108 -0
- package/dist/views/closing-template/composables/use-closing-template-table.d.ts +108 -0
- package/dist/views/ingredients/composables/use-ingredient-select-dialog.d.ts +3 -3
- package/dist/views/recipe/composables/use-recipe-bulk-editor.d.ts +3 -3
- package/dist/views/transfer-template/components/template-item-bulk-editor/TemplateItemBulkEditorDialog.vue.d.ts +2 -0
- package/dist/views/transfer-template/components/template-item-bulk-editor/TemplateItemBulkEditorStep1.vue.d.ts +2 -0
- package/dist/views/transfer-template/components/template-item-bulk-editor/TemplateItemBulkEditorStep2.vue.d.ts +8 -0
- package/dist/views/transfer-template/components/template-item-bulk-editor/TemplateItemBulkEditorStep3.vue.d.ts +2 -0
- package/dist/views/transfer-template/composables/use-template-item-bulk-editor.d.ts +3225 -0
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +4 -1
- package/dist/views/transfer-template/helpers/template-item-bulk-editor-export.d.ts +9 -0
- package/dist/{vue-i18n-Kc4rK6IY.js → vue-i18n-DCgzd-Rs.js} +524 -524
- package/dist/{xlsx-b1kG9WEm.js → xlsx-Cy0iFCJQ.js} +1 -1
- package/dist/{xlsx.util-e-nUxrcA.js → xlsx.util-D8wvUM2Y.js} +3 -3
- package/package.json +5 -5
- package/dist/ClosingDraftView-CAVVOHjB.js +0 -3343
- package/dist/ClosingTemplateView-CqTB1w4G.js +0 -2077
- package/dist/TransferTemplateView-CeT8wouO.js +0 -1564
- package/dist/format-unit-display-BCYMMOPa.js +0 -1268
|
@@ -0,0 +1,2327 @@
|
|
|
1
|
+
import { defineComponent as re, onMounted as Ce, computed as M, ref as H, watch as Oe, inject as bt, resolveComponent as E, openBlock as S, createElementBlock as V, createElementVNode as t, createVNode as u, withCtx as P, renderSlot as Qe, withDirectives as je, normalizeClass as te, vModelText as He, reactive as ht, h as K, toDisplayString as w, unref as e, createCommentVNode as j, Fragment as ne, normalizeStyle as Te, renderList as fe, createBlock as oe, mergeProps as Ve, createTextVNode as ie, mergeModels as We, useModel as _t, isRef as Xe, withModifiers as gt, Teleport as xt, normalizeProps as kt, guardReactiveProps as $t } from "vue";
|
|
2
|
+
import { u as Ft, _ as wt } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DGlWE5I8.js";
|
|
3
|
+
import { useI18n as ce, useCoreStore as St } from "@feedmepos/mf-common";
|
|
4
|
+
import { f as It, t as Tt, u as $e, g as Ct, a as Ye, b as Ot } from "./format-unit-display-DVEnGOV-.js";
|
|
5
|
+
import { R as Ge } from "./row-action.enum-DQ9bJ_uv.js";
|
|
6
|
+
import { a as Fe, q as Vt, r as ee, u as et, s as Mt, j as ge } from "./app-BCF9ZpO-.js";
|
|
7
|
+
import { _ as Et } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-P64wdK5z.js";
|
|
8
|
+
import { components as ue, useSnackbar as Dt, useProxiedModel as tt, useDialog as At, useBreakpoints as qt } from "@feedmepos/ui-library";
|
|
9
|
+
import { defineStore as Rt, storeToRefs as Ke } from "pinia";
|
|
10
|
+
import { F as me } from "./form-mode.enum-BKiNVH6A.js";
|
|
11
|
+
import { I as Bt, a as Ut, R as ye, A as xe, M as ot } from "./rules-clVHbjpg.js";
|
|
12
|
+
import { u as Se, t as Ze, b as Pt, n as Nt, a as z, g as de, c as pe, d as Lt } from "./number-fWsZU3Us.js";
|
|
13
|
+
import { d as st } from "./defineDeepModel-D06G28ot.js";
|
|
14
|
+
import { _ as lt, F as nt, a as at, b as rt } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-Dg0alt69.js";
|
|
15
|
+
import { u as ke } from "./feature-DW0OW8Zl.js";
|
|
16
|
+
import { u as Me, _ as zt } from "./netsuite-BdXvv_AI.js";
|
|
17
|
+
import { F as Ie } from "./inventory-core-dart.default-B8GRBHwH.js";
|
|
18
|
+
import { u as Qt } from "./supplier-BnYLExem.js";
|
|
19
|
+
import { u as jt } from "./use-ingredient-select-dialog-ClGmxwFU.js";
|
|
20
|
+
import { F as le, _ as it } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
|
|
21
|
+
import { u as Ht } from "./use-template-enabled-locations-deP7LXci.js";
|
|
22
|
+
import { u as Wt } from "./use-transfer-locations-D3nYdH_3.js";
|
|
23
|
+
import { _ as dt } from "./FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CK8RpMEu.js";
|
|
24
|
+
import { u as Yt } from "./purchase-order-template-DDMRkK1M.js";
|
|
25
|
+
import { _ as Gt } from "./FmConfirmationButton.vue_vue_type_script_setup_true_lang-DLrMEGFR.js";
|
|
26
|
+
import { f as Kt } from "./format-time-from-id-CrGnGtJV.js";
|
|
27
|
+
import { f as ut } from "./date2-DJVh7XJh.js";
|
|
28
|
+
import { u as we } from "./vue-i18n-DCgzd-Rs.js";
|
|
29
|
+
import { t as Zt, a as Jt, d as Xt } from "./xlsx.util-D8wvUM2Y.js";
|
|
30
|
+
const eo = { class: "flex flex-col" }, to = { class: "flex flex-col" }, oo = { class: "flex-1" }, so = { class: "flex items-center" }, lo = { class: "flex-1" }, no = { class: "flex-1" }, mt = /* @__PURE__ */ re({
|
|
31
|
+
__name: "FmMinMaxInput",
|
|
32
|
+
props: {
|
|
33
|
+
rules: {},
|
|
34
|
+
label: {},
|
|
35
|
+
minPlaceholder: {},
|
|
36
|
+
maxPlaceholder: {},
|
|
37
|
+
modelValue: {},
|
|
38
|
+
precision: {},
|
|
39
|
+
minLength: {},
|
|
40
|
+
maxLength: {},
|
|
41
|
+
inputmode: {},
|
|
42
|
+
type: {},
|
|
43
|
+
readonly: { type: Boolean },
|
|
44
|
+
labelMark: {},
|
|
45
|
+
prependIcon: {},
|
|
46
|
+
appendIcon: {},
|
|
47
|
+
showValidBorder: { type: Boolean },
|
|
48
|
+
labelInfo: {},
|
|
49
|
+
showWordCount: { type: Boolean },
|
|
50
|
+
invalid: { type: Boolean },
|
|
51
|
+
autofocus: { type: Boolean },
|
|
52
|
+
formatter: { type: Function },
|
|
53
|
+
decimal: {},
|
|
54
|
+
datalist: {},
|
|
55
|
+
shiftDatalist: { type: Boolean },
|
|
56
|
+
datalistMaxHeight: {},
|
|
57
|
+
datalistMinHeight: {},
|
|
58
|
+
offsetDatalist: {},
|
|
59
|
+
datalistPlacement: {},
|
|
60
|
+
datalistZIndex: {},
|
|
61
|
+
datalistWidth: {},
|
|
62
|
+
disabled: { type: Boolean },
|
|
63
|
+
focused: { type: Boolean },
|
|
64
|
+
helperText: {},
|
|
65
|
+
helperState: {}
|
|
66
|
+
},
|
|
67
|
+
setup(x) {
|
|
68
|
+
const d = x, s = st("modelValue"), l = Bt();
|
|
69
|
+
Ce(() => {
|
|
70
|
+
const { min: y, max: p } = s ?? {};
|
|
71
|
+
if (!(!y || !p) && y.precision !== p.precision) {
|
|
72
|
+
const k = Math.max(y.precision, p.precision), n = Se(y, k), r = Se(p, k);
|
|
73
|
+
s.min = n, s.max = r;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
const o = M(() => {
|
|
77
|
+
const { min: y, max: p } = s ?? {};
|
|
78
|
+
return Math.max((y == null ? void 0 : y.precision) ?? 0, (p == null ? void 0 : p.precision) ?? 0, d.precision ?? 0);
|
|
79
|
+
}), i = (y) => {
|
|
80
|
+
if (!y) return "";
|
|
81
|
+
const p = Pt(y), k = o.value, n = Se(p, k);
|
|
82
|
+
return Nt(
|
|
83
|
+
+z(n),
|
|
84
|
+
n.precision
|
|
85
|
+
);
|
|
86
|
+
}, _ = H(i(s.min)), g = H(i(s.max));
|
|
87
|
+
Oe([_, g], ([y, p]) => {
|
|
88
|
+
const k = s ?? {}, n = l(y), r = l(p), C = o.value;
|
|
89
|
+
if (y !== "" && n === !0) {
|
|
90
|
+
const I = Ze(+y, C);
|
|
91
|
+
k.min = I;
|
|
92
|
+
} else
|
|
93
|
+
k.min = null;
|
|
94
|
+
if (p !== "" && r === !0) {
|
|
95
|
+
const I = Ze(+p, C);
|
|
96
|
+
k.max = I;
|
|
97
|
+
} else
|
|
98
|
+
k.max = null;
|
|
99
|
+
s.min = k.min, s.max = k.max;
|
|
100
|
+
});
|
|
101
|
+
const O = Symbol.for("fm:form-state"), m = bt(O, null), a = M(() => d.disabled ?? (m == null ? void 0 : m.getDisabled()) ?? !1), f = H(), v = H(), $ = H(!1), F = H(!1), b = M(() => $.value || F.value), D = M(() => [...[
|
|
102
|
+
function() {
|
|
103
|
+
return typeof l(_.value) == "string" || typeof l(g.value) == "string" ? "Must be a number" : !0;
|
|
104
|
+
},
|
|
105
|
+
function(k) {
|
|
106
|
+
return !k || !k.min || !k.max ? !0 : +z(k.min) > +z(k.max) ? "Min must be less than or equal to max" : !0;
|
|
107
|
+
}
|
|
108
|
+
], ...d.rules ?? []]);
|
|
109
|
+
return (y, p) => {
|
|
110
|
+
const k = E("FmLabel"), n = E("FmField"), r = E("FmFormGroup");
|
|
111
|
+
return S(), V("div", eo, [
|
|
112
|
+
t("div", to, [
|
|
113
|
+
t("div", oo, [
|
|
114
|
+
u(k, {
|
|
115
|
+
label: y.label,
|
|
116
|
+
disabled: y.disabled,
|
|
117
|
+
required: y.labelMark === "required",
|
|
118
|
+
optional: y.labelMark === "optional"
|
|
119
|
+
}, null, 8, ["label", "disabled", "required", "optional"])
|
|
120
|
+
]),
|
|
121
|
+
u(n, { focused: b.value }, {
|
|
122
|
+
default: P(() => [
|
|
123
|
+
t("div", so, [
|
|
124
|
+
Qe(y.$slots, "prepend"),
|
|
125
|
+
p[6] || (p[6] = t("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400 pr-4" }, "Min.", -1)),
|
|
126
|
+
t("div", lo, [
|
|
127
|
+
je(t("input", {
|
|
128
|
+
type: "text",
|
|
129
|
+
ref_key: "minInputRef",
|
|
130
|
+
ref: f,
|
|
131
|
+
onFocus: p[0] || (p[0] = () => $.value = !0),
|
|
132
|
+
onBlur: p[1] || (p[1] = () => $.value = !1),
|
|
133
|
+
"onUpdate:modelValue": p[2] || (p[2] = (C) => _.value = C),
|
|
134
|
+
class: te({
|
|
135
|
+
"fm-text-field--input fm-typo-en-body-lg-400": !0,
|
|
136
|
+
"text-fm-color-typo-primary": !a.value,
|
|
137
|
+
"text-fm-color-typo-disabled": a.value
|
|
138
|
+
})
|
|
139
|
+
}, null, 34), [
|
|
140
|
+
[He, _.value]
|
|
141
|
+
])
|
|
142
|
+
]),
|
|
143
|
+
p[7] || (p[7] = t("div", { class: "block h-32 mx-4 w-[1px] bg-fm-color-neutral-gray-200" }, null, -1)),
|
|
144
|
+
p[8] || (p[8] = t("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400 pr-4" }, "Max.", -1)),
|
|
145
|
+
t("div", no, [
|
|
146
|
+
je(t("input", {
|
|
147
|
+
type: "text",
|
|
148
|
+
ref_key: "maxInputRef",
|
|
149
|
+
ref: v,
|
|
150
|
+
onFocus: p[3] || (p[3] = () => F.value = !0),
|
|
151
|
+
onBlur: p[4] || (p[4] = () => F.value = !1),
|
|
152
|
+
"onUpdate:modelValue": p[5] || (p[5] = (C) => g.value = C),
|
|
153
|
+
class: te({
|
|
154
|
+
"fm-text-field--input fm-typo-en-body-lg-400": !0,
|
|
155
|
+
"text-fm-color-typo-primary": !a.value,
|
|
156
|
+
"text-fm-color-typo-disabled": a.value
|
|
157
|
+
})
|
|
158
|
+
}, null, 34), [
|
|
159
|
+
[He, g.value]
|
|
160
|
+
])
|
|
161
|
+
]),
|
|
162
|
+
Qe(y.$slots, "append")
|
|
163
|
+
])
|
|
164
|
+
]),
|
|
165
|
+
_: 3
|
|
166
|
+
}, 8, ["focused"])
|
|
167
|
+
]),
|
|
168
|
+
u(r, {
|
|
169
|
+
class: "flex-1",
|
|
170
|
+
"model-value": y.modelValue,
|
|
171
|
+
info: y.labelInfo,
|
|
172
|
+
rules: D.value,
|
|
173
|
+
"helper-text": y.helperText,
|
|
174
|
+
"helper-state": y.helperState
|
|
175
|
+
}, null, 8, ["model-value", "info", "rules", "helper-text", "helper-state"])
|
|
176
|
+
]);
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
function ct({ min: x, max: d } = { min: !0, max: !0 }) {
|
|
181
|
+
return function(l) {
|
|
182
|
+
return !l || !l.min && x != !1 || !l.max && d != !1 ? "Required" : !0;
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function pt(x, d) {
|
|
186
|
+
return function(l) {
|
|
187
|
+
return !l || !l.min || !l.max ? !0 : +z(l.min) < x ? `Must be between ${x} and ${d}` : +z(l.max) > d ? `Must be between ${x} and ${d}` : !0;
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
function ft(x) {
|
|
191
|
+
const d = Ut(x), s = z(x);
|
|
192
|
+
return function(o) {
|
|
193
|
+
const i = !(o != null && o.min) || d(o.min) === !0, _ = !(o != null && o.max) || d(o.max) === !0;
|
|
194
|
+
return !i && !_ ? `Min & max must be a multiple of ${s}` : i ? _ ? !0 : `Max must be a multiple of ${s}` : `Min must be a multiple of ${s}`;
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
const yt = Rt("netsuite-custom-field-helper", () => {
|
|
198
|
+
const x = Me();
|
|
199
|
+
function d(s, l, o, i, _) {
|
|
200
|
+
var m, a, f;
|
|
201
|
+
if (!o) {
|
|
202
|
+
_ == null || _("Unit is not valid");
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
let g = s.code;
|
|
206
|
+
if (((m = s.measurement) == null ? void 0 : m.id) !== ((a = o.measurement) == null ? void 0 : a.id) && x.isEnabled) {
|
|
207
|
+
const v = x.getItemCustomCode(l, (f = o.measurement) == null ? void 0 : f.id);
|
|
208
|
+
v && (g = v);
|
|
209
|
+
}
|
|
210
|
+
i({
|
|
211
|
+
...s,
|
|
212
|
+
quantity: o.amount,
|
|
213
|
+
measurement: o.measurement ?? null,
|
|
214
|
+
code: g
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
return {
|
|
218
|
+
validateUnitInput: d
|
|
219
|
+
};
|
|
220
|
+
});
|
|
221
|
+
var J = /* @__PURE__ */ ((x) => (x.Code = "Code", x.Name = "Name", x.DefaultAmount = "DefaultAmount", x.Limit = "Limit", x.Step = "Step", x.Cost = "Cost", x.Delete = "Delete", x))(J || {});
|
|
222
|
+
function ao(x, d = {}) {
|
|
223
|
+
const { t: s } = ce(), l = Fe(), o = ke(), i = ht({}), _ = yt();
|
|
224
|
+
Ce(() => {
|
|
225
|
+
for (const m of x.items) {
|
|
226
|
+
if (!m.totalCost)
|
|
227
|
+
continue;
|
|
228
|
+
const { cost: a } = Ie.calculateDefaultCost({
|
|
229
|
+
item: m.sku,
|
|
230
|
+
amount: m.quantity,
|
|
231
|
+
measurement: m.measurement,
|
|
232
|
+
overrides: {
|
|
233
|
+
supplier: x.supplier
|
|
234
|
+
},
|
|
235
|
+
defaultCurrency: Vt()
|
|
236
|
+
}), f = m.totalCost ?? Ie.reset();
|
|
237
|
+
a ? i[m.sku._id] = a.amount !== f.amount || a.precision !== f.precision : i[m.sku._id] = !0;
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
const g = [
|
|
241
|
+
{
|
|
242
|
+
id: "Code",
|
|
243
|
+
header: () => K("div", { class: "flex-col" }, [
|
|
244
|
+
K("div", s("inventory.transfer.form.items.table.Code")),
|
|
245
|
+
K(
|
|
246
|
+
"div",
|
|
247
|
+
{ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
|
|
248
|
+
"(original code)"
|
|
249
|
+
)
|
|
250
|
+
]),
|
|
251
|
+
accessorKey: "code",
|
|
252
|
+
size: 180,
|
|
253
|
+
cell(m) {
|
|
254
|
+
const a = m.row.original;
|
|
255
|
+
return K("div", [
|
|
256
|
+
K(ue.FmTextField, {
|
|
257
|
+
modelValue: a.code,
|
|
258
|
+
"onUpdate:modelValue": (f) => {
|
|
259
|
+
x.updateItem({
|
|
260
|
+
...a,
|
|
261
|
+
code: f
|
|
262
|
+
});
|
|
263
|
+
},
|
|
264
|
+
helperText: a.sku.code,
|
|
265
|
+
key: a.sku._id,
|
|
266
|
+
rules: [ye()],
|
|
267
|
+
labelMark: "required"
|
|
268
|
+
})
|
|
269
|
+
]);
|
|
270
|
+
},
|
|
271
|
+
enableSorting: !1
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
id: "Name",
|
|
275
|
+
header: () => K("div", { class: "flex-col" }, [
|
|
276
|
+
K("div", s("inventory.transfer.form.items.table.Name")),
|
|
277
|
+
K(
|
|
278
|
+
"div",
|
|
279
|
+
{ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
|
|
280
|
+
"(original name)"
|
|
281
|
+
)
|
|
282
|
+
]),
|
|
283
|
+
minSize: 300,
|
|
284
|
+
cell(m) {
|
|
285
|
+
const a = m.row.original;
|
|
286
|
+
return K("div", [
|
|
287
|
+
K(ue.FmTextField, {
|
|
288
|
+
modelValue: a.name,
|
|
289
|
+
"onUpdate:modelValue": (f) => {
|
|
290
|
+
x.updateItem({
|
|
291
|
+
...a,
|
|
292
|
+
name: f
|
|
293
|
+
});
|
|
294
|
+
},
|
|
295
|
+
helperText: a.sku.name,
|
|
296
|
+
key: a.sku._id,
|
|
297
|
+
rules: [ye()],
|
|
298
|
+
labelMark: "required"
|
|
299
|
+
})
|
|
300
|
+
]);
|
|
301
|
+
},
|
|
302
|
+
enableSorting: !1
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
id: "DefaultAmount",
|
|
306
|
+
header: () => s("inventory.transfer.form.items.table.DefaultAmount"),
|
|
307
|
+
minSize: 200,
|
|
308
|
+
cell(m) {
|
|
309
|
+
var b;
|
|
310
|
+
const a = m.row.original, f = l.skuById[a.sku._id], v = l.unitById[(b = f.unit) == null ? void 0 : b._id], $ = v.measurements.find((D) => {
|
|
311
|
+
var y;
|
|
312
|
+
return ((y = a.measurement) == null ? void 0 : y.id) === D.id;
|
|
313
|
+
}), F = a.sku.unit._id !== f.unit._id || !v || a.measurement && !$;
|
|
314
|
+
return K(lt, {
|
|
315
|
+
style: {
|
|
316
|
+
flex: "1 1 0%"
|
|
317
|
+
},
|
|
318
|
+
modelValue: {
|
|
319
|
+
amount: a.quantity ?? { amount: 1, precision: 0 },
|
|
320
|
+
// NOTE: leave this reading from row.sku.unit and row.measurement instead,
|
|
321
|
+
measurement: a.measurement ?? (a.sku.unit._id !== f.unit._id ? { ...a.sku.unit, id: "", conversion: { amount: 1, precision: 0 } } : null)
|
|
322
|
+
},
|
|
323
|
+
disabled: x.disabled,
|
|
324
|
+
key: a.sku._id,
|
|
325
|
+
unit: v,
|
|
326
|
+
"onUpdate:modelValue": (D) => {
|
|
327
|
+
_.validateUnitInput(
|
|
328
|
+
a,
|
|
329
|
+
f,
|
|
330
|
+
D,
|
|
331
|
+
(y) => {
|
|
332
|
+
x.updateItem({
|
|
333
|
+
...a,
|
|
334
|
+
code: y.code,
|
|
335
|
+
quantity: y.quantity,
|
|
336
|
+
measurement: y.measurement
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
);
|
|
340
|
+
},
|
|
341
|
+
rules: [
|
|
342
|
+
nt(a.quantityStep),
|
|
343
|
+
...+z(a.quantity) ? [
|
|
344
|
+
at(
|
|
345
|
+
+z(
|
|
346
|
+
a.minimumQuantity ?? {
|
|
347
|
+
amount: 1,
|
|
348
|
+
// NOTE: leave this reading from row.sku.unit and row.measurement instead,
|
|
349
|
+
precision: de(a.sku.unit, a.measurement)
|
|
350
|
+
}
|
|
351
|
+
)
|
|
352
|
+
)
|
|
353
|
+
] : [],
|
|
354
|
+
rt(
|
|
355
|
+
a.maximumQuantity ? +z(a.maximumQuantity) : 1 / 0
|
|
356
|
+
),
|
|
357
|
+
function(y) {
|
|
358
|
+
return F ? "This item is no longer valid due to change in unit. Please reapply unit." : !0;
|
|
359
|
+
}
|
|
360
|
+
],
|
|
361
|
+
applyDefaultRules: !0
|
|
362
|
+
});
|
|
363
|
+
},
|
|
364
|
+
enableSorting: !1
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
id: "Limit",
|
|
368
|
+
header: () => "Limit",
|
|
369
|
+
// TODO: i18n,
|
|
370
|
+
minSize: 280,
|
|
371
|
+
cell(m) {
|
|
372
|
+
const a = m.row.original;
|
|
373
|
+
return K(mt, {
|
|
374
|
+
style: {
|
|
375
|
+
flex: "1 1 0%"
|
|
376
|
+
},
|
|
377
|
+
modelValue: {
|
|
378
|
+
min: a.minimumQuantity,
|
|
379
|
+
max: a.maximumQuantity
|
|
380
|
+
},
|
|
381
|
+
disabled: x.disabled,
|
|
382
|
+
key: a.sku._id,
|
|
383
|
+
unit: a.sku.unit,
|
|
384
|
+
"onUpdate:modelValue": (f) => {
|
|
385
|
+
const v = { ...a };
|
|
386
|
+
f != null && f.min ? v.minimumQuantity = f.min : v.minimumQuantity = null, f != null && f.max ? v.maximumQuantity = f.max : v.maximumQuantity = null, x.updateItem(v);
|
|
387
|
+
},
|
|
388
|
+
rules: [
|
|
389
|
+
ct({ max: !1 }),
|
|
390
|
+
ft(a.quantityStep),
|
|
391
|
+
pt(
|
|
392
|
+
+z({
|
|
393
|
+
amount: 0,
|
|
394
|
+
precision: de(a.sku.unit, a.measurement)
|
|
395
|
+
}),
|
|
396
|
+
1 / 0
|
|
397
|
+
)
|
|
398
|
+
],
|
|
399
|
+
disableUnit: !0,
|
|
400
|
+
applyDefaultRules: !0
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
id: "Step",
|
|
406
|
+
header: () => s("inventory.transfer.form.items.table.Step"),
|
|
407
|
+
minSize: 100,
|
|
408
|
+
cell(m) {
|
|
409
|
+
const a = m.row.original;
|
|
410
|
+
return K(ue.FmTextField, {
|
|
411
|
+
modelValue: z(a.quantityStep ?? Ie.reset(), !1),
|
|
412
|
+
key: a.sku._id,
|
|
413
|
+
"onUpdate:modelValue": (f) => {
|
|
414
|
+
x.updateItem({
|
|
415
|
+
...a,
|
|
416
|
+
quantityStep: pe(+f)
|
|
417
|
+
});
|
|
418
|
+
},
|
|
419
|
+
rules: [
|
|
420
|
+
xe({
|
|
421
|
+
amount: 1,
|
|
422
|
+
precision: de(a.sku.unit, a.measurement)
|
|
423
|
+
}),
|
|
424
|
+
ot(a.sku.unit, a.measurement)
|
|
425
|
+
]
|
|
426
|
+
});
|
|
427
|
+
},
|
|
428
|
+
enableSorting: !1
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
id: "Delete",
|
|
432
|
+
header: "",
|
|
433
|
+
cell(m) {
|
|
434
|
+
const a = m.row.original;
|
|
435
|
+
return K("div", { class: "flex items-center" }, [
|
|
436
|
+
o.usePurchaseOrderV2 ? K(
|
|
437
|
+
ue.FmTooltip,
|
|
438
|
+
{
|
|
439
|
+
zIndex: 50,
|
|
440
|
+
placement: "left"
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
default() {
|
|
444
|
+
return K(ue.FmButton, {
|
|
445
|
+
key: a.sku._id,
|
|
446
|
+
type: "button",
|
|
447
|
+
icon: "add_circle",
|
|
448
|
+
variant: "tertiary",
|
|
449
|
+
size: "md",
|
|
450
|
+
disabled: x.disabled,
|
|
451
|
+
onClick: async () => {
|
|
452
|
+
const f = {
|
|
453
|
+
id: crypto.randomUUID(),
|
|
454
|
+
sku: a.sku,
|
|
455
|
+
code: a.sku.code,
|
|
456
|
+
name: a.sku.name,
|
|
457
|
+
quantity: pe(1),
|
|
458
|
+
quantityStep: pe(1),
|
|
459
|
+
minimumQuantity: pe(1)
|
|
460
|
+
};
|
|
461
|
+
_.validateUnitInput(
|
|
462
|
+
f,
|
|
463
|
+
a.sku,
|
|
464
|
+
{
|
|
465
|
+
amount: f.quantity,
|
|
466
|
+
measurement: null
|
|
467
|
+
},
|
|
468
|
+
(v) => {
|
|
469
|
+
f.code = v.code;
|
|
470
|
+
}
|
|
471
|
+
), x.duplicateItem(f);
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
},
|
|
475
|
+
content() {
|
|
476
|
+
return "Duplicate entry";
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
) : null,
|
|
480
|
+
K(ue.FmButton, {
|
|
481
|
+
class: "delete-button",
|
|
482
|
+
key: a.sku._id,
|
|
483
|
+
type: "button",
|
|
484
|
+
icon: "delete",
|
|
485
|
+
variant: "tertiary",
|
|
486
|
+
size: "md",
|
|
487
|
+
disabled: x.disabled,
|
|
488
|
+
onClick: () => {
|
|
489
|
+
x.deleteItem(a);
|
|
490
|
+
}
|
|
491
|
+
})
|
|
492
|
+
]);
|
|
493
|
+
},
|
|
494
|
+
enableSorting: !1,
|
|
495
|
+
size: 40,
|
|
496
|
+
meta: {
|
|
497
|
+
cellClass: "",
|
|
498
|
+
headerClass: ""
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
];
|
|
502
|
+
return {
|
|
503
|
+
columnDefs: M(() => {
|
|
504
|
+
const m = ke(), a = [...g];
|
|
505
|
+
if (Object.keys(d).length > 0)
|
|
506
|
+
for (const [f, v] of Object.entries(d))
|
|
507
|
+
a.splice(Number(f), 0, {
|
|
508
|
+
...v,
|
|
509
|
+
id: f
|
|
510
|
+
});
|
|
511
|
+
return m.enableTotalCost && x.transferType === ee.enum.purchase ? a : a.filter((f) => f.id !== "Cost");
|
|
512
|
+
})
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
const ro = { class: "flex flex-col gap-8 py-16" }, io = { class: "flex items-center" }, uo = { class: "flex-1 flex gap-1 items-center" }, mo = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, co = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, po = { class: "flex gap-8 w-full" }, fo = { class: "flex-1 flex flex-col gap-4" }, yo = { class: "flex-1 flex flex-col gap-4" }, vo = {
|
|
516
|
+
key: 0,
|
|
517
|
+
class: "flex gap-8 w-full"
|
|
518
|
+
}, bo = { class: "flex-1 flex flex-col gap-4" }, ho = { class: "flex-1 flex flex-col gap-4" }, _o = { class: "flex gap-8 w-full" }, go = { class: "flex-1 flex flex-col gap-4" }, xo = /* @__PURE__ */ re({
|
|
519
|
+
__name: "TransferTemplateItem",
|
|
520
|
+
props: {
|
|
521
|
+
cellByColId: {},
|
|
522
|
+
row: {}
|
|
523
|
+
},
|
|
524
|
+
setup(x) {
|
|
525
|
+
const { t: d } = ce();
|
|
526
|
+
function s(l) {
|
|
527
|
+
return l;
|
|
528
|
+
}
|
|
529
|
+
return (l, o) => {
|
|
530
|
+
var _, g, O, m, a, f, v, $, F, b, D, y, p, k, n, r, C, I, T, U, ae, R, W, N, c, h, A, L, Y, X;
|
|
531
|
+
const i = E("FmLabel");
|
|
532
|
+
return S(), V("div", ro, [
|
|
533
|
+
t("div", io, [
|
|
534
|
+
t("div", uo, [
|
|
535
|
+
t("span", mo, " (" + w(l.row.original.sku.code) + ") ", 1),
|
|
536
|
+
t("span", co, w(l.row.original.sku.name), 1)
|
|
537
|
+
]),
|
|
538
|
+
t("div", null, [
|
|
539
|
+
u(e(le), {
|
|
540
|
+
render: (O = (g = (_ = l.cellByColId.Delete) == null ? void 0 : _.column) == null ? void 0 : g.columnDef) == null ? void 0 : O.cell,
|
|
541
|
+
props: (a = (m = l.cellByColId.Delete) == null ? void 0 : m.getContext) == null ? void 0 : a.call(m)
|
|
542
|
+
}, null, 8, ["render", "props"])
|
|
543
|
+
])
|
|
544
|
+
]),
|
|
545
|
+
t("div", po, [
|
|
546
|
+
t("div", fo, [
|
|
547
|
+
u(i, {
|
|
548
|
+
label: e(d)(`inventory.transfer.form.items.table.${e(J).Code}`)
|
|
549
|
+
}, null, 8, ["label"]),
|
|
550
|
+
u(e(le), {
|
|
551
|
+
render: ($ = (v = (f = l.cellByColId[e(J).Code]) == null ? void 0 : f.column) == null ? void 0 : v.columnDef) == null ? void 0 : $.cell,
|
|
552
|
+
props: (b = (F = l.cellByColId[e(J).Code]) == null ? void 0 : F.getContext) == null ? void 0 : b.call(F)
|
|
553
|
+
}, null, 8, ["render", "props"]),
|
|
554
|
+
o[0] || (o[0] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
555
|
+
]),
|
|
556
|
+
t("div", yo, [
|
|
557
|
+
u(i, {
|
|
558
|
+
label: e(d)(`inventory.transfer.form.items.table.${e(J).Name}`)
|
|
559
|
+
}, null, 8, ["label"]),
|
|
560
|
+
u(e(le), {
|
|
561
|
+
render: (p = (y = (D = l.cellByColId[e(J).Name]) == null ? void 0 : D.column) == null ? void 0 : y.columnDef) == null ? void 0 : p.cell,
|
|
562
|
+
props: (n = (k = l.cellByColId[e(J).Name]) == null ? void 0 : k.getContext) == null ? void 0 : n.call(k)
|
|
563
|
+
}, null, 8, ["render", "props"]),
|
|
564
|
+
o[1] || (o[1] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
565
|
+
])
|
|
566
|
+
]),
|
|
567
|
+
l.row.original ? (S(), V("div", vo, [
|
|
568
|
+
t("div", bo, [
|
|
569
|
+
u(i, {
|
|
570
|
+
label: e(d)(`inventory.transfer.form.items.table.${e(J).DefaultAmount}`)
|
|
571
|
+
}, null, 8, ["label"]),
|
|
572
|
+
u(e(le), {
|
|
573
|
+
render: (I = (C = (r = l.cellByColId[e(J).DefaultAmount]) == null ? void 0 : r.column) == null ? void 0 : C.columnDef) == null ? void 0 : I.cell,
|
|
574
|
+
props: (U = (T = l.cellByColId[e(J).DefaultAmount]) == null ? void 0 : T.getContext) == null ? void 0 : U.call(T)
|
|
575
|
+
}, null, 8, ["render", "props"]),
|
|
576
|
+
o[2] || (o[2] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
577
|
+
]),
|
|
578
|
+
t("div", ho, [
|
|
579
|
+
u(i, {
|
|
580
|
+
label: e(d)(`inventory.transfer.form.items.table.${e(J).Step}`)
|
|
581
|
+
}, null, 8, ["label"]),
|
|
582
|
+
u(e(le), {
|
|
583
|
+
render: (W = (R = (ae = l.cellByColId[e(J).Step]) == null ? void 0 : ae.column) == null ? void 0 : R.columnDef) == null ? void 0 : W.cell,
|
|
584
|
+
props: (c = (N = l.cellByColId[e(J).Step]) == null ? void 0 : N.getContext) == null ? void 0 : c.call(N)
|
|
585
|
+
}, null, 8, ["render", "props"]),
|
|
586
|
+
o[3] || (o[3] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
587
|
+
])
|
|
588
|
+
])) : j("", !0),
|
|
589
|
+
t("div", _o, [
|
|
590
|
+
t("div", go, [
|
|
591
|
+
u(i, {
|
|
592
|
+
label: e(d)(`inventory.transfer.form.items.table.${e(J).Limit}`)
|
|
593
|
+
}, null, 8, ["label"]),
|
|
594
|
+
u(e(le), {
|
|
595
|
+
render: (L = (A = (h = l.cellByColId[e(J).Limit]) == null ? void 0 : h.column) == null ? void 0 : A.columnDef) == null ? void 0 : L.cell,
|
|
596
|
+
props: (X = (Y = l.cellByColId[e(J).Limit]) == null ? void 0 : Y.getContext) == null ? void 0 : X.call(Y)
|
|
597
|
+
}, null, 8, ["render", "props"]),
|
|
598
|
+
o[4] || (o[4] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
|
|
599
|
+
])
|
|
600
|
+
])
|
|
601
|
+
]);
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
}), ko = { class: "fm-typo-en-body-md-400 line-clamp-2 w-full" }, $o = { key: 0 }, Fo = ["colspan"], wo = /* @__PURE__ */ re({
|
|
605
|
+
__name: "TransferTemplateItemTable",
|
|
606
|
+
props: {
|
|
607
|
+
row: {},
|
|
608
|
+
disabled: { type: Boolean },
|
|
609
|
+
errorMessage: {}
|
|
610
|
+
},
|
|
611
|
+
emits: ["update:item"],
|
|
612
|
+
setup(x) {
|
|
613
|
+
function d(s) {
|
|
614
|
+
return s.column.columnDef.meta;
|
|
615
|
+
}
|
|
616
|
+
return (s, l) => (S(), V(ne, null, [
|
|
617
|
+
t("tr", {
|
|
618
|
+
class: "hover:bg-fm-color-opacity-sm border-b border-fm-color-neutral-gray-100",
|
|
619
|
+
style: Te({ backgroundColor: s.errorMessage ? "#ffd6d6" : void 0 })
|
|
620
|
+
}, [
|
|
621
|
+
(S(!0), V(ne, null, fe(s.row.getVisibleCells(), (o) => {
|
|
622
|
+
var i, _, g, O, m;
|
|
623
|
+
return S(), V("td", {
|
|
624
|
+
key: o.id,
|
|
625
|
+
class: te(["text-fm-color-typo-primary", ((i = d(o)) == null ? void 0 : i.cellClass) ?? "px-16", "py-2"]),
|
|
626
|
+
style: Te({
|
|
627
|
+
width: (_ = d(o)) != null && _.width ? (g = d(o)) == null ? void 0 : g.width : o.column.getSize() !== 0 ? `${o.column.getSize()}px` : void 0,
|
|
628
|
+
maxWidth: (O = d(o)) == null ? void 0 : O.maxWidth,
|
|
629
|
+
textAlign: ((m = d(o)) == null ? void 0 : m.textAlign) ?? "left"
|
|
630
|
+
})
|
|
631
|
+
}, [
|
|
632
|
+
t("span", ko, [
|
|
633
|
+
u(e(le), {
|
|
634
|
+
props: o.getContext(),
|
|
635
|
+
render: o.column.columnDef.cell
|
|
636
|
+
}, null, 8, ["props", "render"])
|
|
637
|
+
])
|
|
638
|
+
], 6);
|
|
639
|
+
}), 128))
|
|
640
|
+
], 4),
|
|
641
|
+
s.errorMessage ? (S(), V("tr", $o, [
|
|
642
|
+
t("td", {
|
|
643
|
+
colspan: s.row.getVisibleCells().length,
|
|
644
|
+
class: "text-red-600 px-16 py-2"
|
|
645
|
+
}, w(s.errorMessage), 9, Fo)
|
|
646
|
+
])) : j("", !0)
|
|
647
|
+
], 64));
|
|
648
|
+
}
|
|
649
|
+
}), So = { class: "flex flex-col gap-16" }, Io = { class: "flex flex-col gap-24" }, To = { class: "flex flex-col gap-16" }, Co = { class: "flex items-center" }, Oo = { class: "flex flex-col" }, Vo = { class: "flex flex-col gap-16" }, Mo = { class: "flex gap-3" }, Eo = { class: "flex-1 gap-8 fm-typo-en-title-sm-600" }, Do = {
|
|
650
|
+
key: 0,
|
|
651
|
+
class: "border rounded-sm px-8 py-2 bg-fm-color-system-warning-100 fm-typo-en-body-lg-400"
|
|
652
|
+
}, Ao = { class: "border rounded-sm px-8 py-2 bg-fm-color-system-info-100 fm-typo-en-body-lg-400" }, qo = { class: "mb-2" }, Ro = /* @__PURE__ */ re({
|
|
653
|
+
__name: "TransferTemplateForm",
|
|
654
|
+
props: {
|
|
655
|
+
modelValue: {},
|
|
656
|
+
disabled: { type: Boolean }
|
|
657
|
+
},
|
|
658
|
+
emits: ["update:disabled"],
|
|
659
|
+
setup(x, { expose: d, emit: s }) {
|
|
660
|
+
const l = x, o = s, i = st(), { t: _ } = ce(), g = H({}), O = et(), m = Fe(), a = Qt(), f = ke(), v = Me(), $ = yt();
|
|
661
|
+
Oe(
|
|
662
|
+
() => i.purchaseOrder.items.length,
|
|
663
|
+
() => {
|
|
664
|
+
g.value = {};
|
|
665
|
+
}
|
|
666
|
+
), O.watchLocation(async () => {
|
|
667
|
+
location && (i.purchaseOrder.supplier || (i.purchaseOrder.supplier = a.suppliers.find((c) => c) ?? i.purchaseOrder.supplier));
|
|
668
|
+
});
|
|
669
|
+
const F = Wt(
|
|
670
|
+
() => i.purchaseOrder,
|
|
671
|
+
(c) => {
|
|
672
|
+
i.purchaseOrder = {
|
|
673
|
+
...i.purchaseOrder,
|
|
674
|
+
supplier: c.supplier ?? (i == null ? void 0 : i.purchaseOrder.supplier)
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
), b = M({
|
|
678
|
+
get() {
|
|
679
|
+
var c, h;
|
|
680
|
+
return typeof ((h = (c = i.purchaseOrder) == null ? void 0 : c.supplier) == null ? void 0 : h.internal) == "string" ? ee.enum.transfer : ee.enum.purchase;
|
|
681
|
+
},
|
|
682
|
+
set(c) {
|
|
683
|
+
var A, L;
|
|
684
|
+
const h = typeof ((L = (A = i.purchaseOrder) == null ? void 0 : A.supplier) == null ? void 0 : L.internal) == "string" ? ee.enum.transfer : ee.enum.purchase;
|
|
685
|
+
c !== h && (i.purchaseOrder.supplier = c === ee.enum.purchase ? F.locationOptionsTypePurchase.value[0] : F.locationOptionsTypeTransfer.value[0]);
|
|
686
|
+
}
|
|
687
|
+
}), D = M(() => F.transferLocationOptions.value), y = M({
|
|
688
|
+
get() {
|
|
689
|
+
var c;
|
|
690
|
+
return (c = i.purchaseOrder.supplier) == null ? void 0 : c._id;
|
|
691
|
+
},
|
|
692
|
+
set(c) {
|
|
693
|
+
F.transferLocationModel.value = c;
|
|
694
|
+
}
|
|
695
|
+
});
|
|
696
|
+
async function p() {
|
|
697
|
+
const c = await v.checkCustomFieldCodes({
|
|
698
|
+
beforeStart: async () => {
|
|
699
|
+
o("update:disabled", !0);
|
|
700
|
+
},
|
|
701
|
+
templateItems: i.purchaseOrder.items
|
|
702
|
+
});
|
|
703
|
+
g.value = c, o("update:disabled", !1);
|
|
704
|
+
}
|
|
705
|
+
const {
|
|
706
|
+
promptSelectLocations: k,
|
|
707
|
+
columnDefs: n,
|
|
708
|
+
rowData: r
|
|
709
|
+
} = Ht({
|
|
710
|
+
getLocations() {
|
|
711
|
+
return i.locations;
|
|
712
|
+
},
|
|
713
|
+
setLocations(c) {
|
|
714
|
+
i.locations = c;
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
function C() {
|
|
718
|
+
var c, h;
|
|
719
|
+
return (c = i.locations) != null && c.find((A) => {
|
|
720
|
+
var L, Y;
|
|
721
|
+
return ((L = A.doc) == null ? void 0 : L._id) === ((Y = i.purchaseOrder.supplier) == null ? void 0 : Y._id);
|
|
722
|
+
}) ? `Location ${(h = i.purchaseOrder.supplier) == null ? void 0 : h.name} must be removed because template cannot be used to transfer to itself.` : !0;
|
|
723
|
+
}
|
|
724
|
+
const I = M({
|
|
725
|
+
get() {
|
|
726
|
+
return i.purchaseOrder.remark ?? void 0;
|
|
727
|
+
},
|
|
728
|
+
set(c) {
|
|
729
|
+
i.purchaseOrder.remark = c;
|
|
730
|
+
}
|
|
731
|
+
}), T = H();
|
|
732
|
+
d({
|
|
733
|
+
validateInputs: () => {
|
|
734
|
+
var c, h;
|
|
735
|
+
(h = (c = T.value) == null ? void 0 : c.validateInputs) == null || h.call(c);
|
|
736
|
+
},
|
|
737
|
+
resetInputsValidation: () => {
|
|
738
|
+
var c, h;
|
|
739
|
+
(h = (c = T.value) == null ? void 0 : c.resetInputsValidation) == null || h.call(c);
|
|
740
|
+
},
|
|
741
|
+
resetInputs: () => {
|
|
742
|
+
var c, h;
|
|
743
|
+
(h = (c = T.value) == null ? void 0 : c.resetInputs) == null || h.call(c);
|
|
744
|
+
}
|
|
745
|
+
});
|
|
746
|
+
const U = M(() => ({
|
|
747
|
+
duplicateItem: (c) => {
|
|
748
|
+
i.purchaseOrder.items = [
|
|
749
|
+
...i.purchaseOrder.items,
|
|
750
|
+
{
|
|
751
|
+
...c
|
|
752
|
+
}
|
|
753
|
+
];
|
|
754
|
+
},
|
|
755
|
+
updateItem: (c) => {
|
|
756
|
+
let h = [];
|
|
757
|
+
c.id ? h = i.purchaseOrder.items.map((A) => A.id !== c.id ? A : c) : h = i.purchaseOrder.items.map((A) => A.sku._id !== c.sku._id ? A : c), i.purchaseOrder.items = h;
|
|
758
|
+
},
|
|
759
|
+
deleteItem: (c) => {
|
|
760
|
+
console.log(c.id);
|
|
761
|
+
let h = [];
|
|
762
|
+
c.id ? h = i.purchaseOrder.items.filter((A) => A.id !== c.id) : h = i.purchaseOrder.items.filter((A) => A.sku._id !== c.sku._id), i.purchaseOrder.items = h;
|
|
763
|
+
}
|
|
764
|
+
})), ae = ao(
|
|
765
|
+
{
|
|
766
|
+
duplicateItem: U.value.duplicateItem,
|
|
767
|
+
updateItem: U.value.updateItem,
|
|
768
|
+
deleteItem: U.value.deleteItem,
|
|
769
|
+
get supplier() {
|
|
770
|
+
return i.purchaseOrder.supplier;
|
|
771
|
+
},
|
|
772
|
+
get items() {
|
|
773
|
+
return i.purchaseOrder.items;
|
|
774
|
+
},
|
|
775
|
+
get transferType() {
|
|
776
|
+
return ee.enum.purchase;
|
|
777
|
+
},
|
|
778
|
+
get disabled() {
|
|
779
|
+
return l.disabled;
|
|
780
|
+
}
|
|
781
|
+
},
|
|
782
|
+
v.transferTemplateColumnDefs({
|
|
783
|
+
onUpdate: (c, h, A, L) => {
|
|
784
|
+
if (c < 0 || c >= i.purchaseOrder.items.length) return;
|
|
785
|
+
const Y = i.purchaseOrder.items[c];
|
|
786
|
+
Y && U.value.updateItem({
|
|
787
|
+
...Y,
|
|
788
|
+
sku: h,
|
|
789
|
+
// Sku might be outdated, so we need to update it
|
|
790
|
+
code: A,
|
|
791
|
+
measurement: L
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
})
|
|
795
|
+
), R = M(() => ae.columnDefs.value), { promptSelectIngredients: W } = jt();
|
|
796
|
+
async function N() {
|
|
797
|
+
const h = m.skus.map((B) => ({
|
|
798
|
+
label: B.name,
|
|
799
|
+
sublabel: B.code,
|
|
800
|
+
value: B
|
|
801
|
+
})).filter((B) => {
|
|
802
|
+
var Q;
|
|
803
|
+
return (Q = i.purchaseOrder.items) == null ? void 0 : Q.find((Z) => Z.sku._id === B.value._id);
|
|
804
|
+
}).map((B) => B.value), A = i.purchaseOrder.items ?? [], L = await W(
|
|
805
|
+
h.map((B) => B._id),
|
|
806
|
+
(B) => {
|
|
807
|
+
const Q = m.skuById[B], Z = A.find((G) => G.sku._id === Q._id);
|
|
808
|
+
if (Z)
|
|
809
|
+
return Z;
|
|
810
|
+
const se = { amount: 1, precision: de(Q.unit) };
|
|
811
|
+
let q = {
|
|
812
|
+
id: f.usePurchaseOrderV2 ? crypto.randomUUID() : void 0,
|
|
813
|
+
sku: Q,
|
|
814
|
+
code: Q.code,
|
|
815
|
+
name: Q.name,
|
|
816
|
+
quantity: se,
|
|
817
|
+
minimumQuantity: se,
|
|
818
|
+
// maximumQuantity: adjustmentAmountMultiplyDecimal(minimumQuantity, {
|
|
819
|
+
// amount: 100,
|
|
820
|
+
// precision: 0
|
|
821
|
+
// }),
|
|
822
|
+
quantityStep: se
|
|
823
|
+
};
|
|
824
|
+
return $.validateUnitInput(
|
|
825
|
+
q,
|
|
826
|
+
Q,
|
|
827
|
+
{
|
|
828
|
+
amount: se,
|
|
829
|
+
measurement: null
|
|
830
|
+
},
|
|
831
|
+
(G) => {
|
|
832
|
+
q.code = G.code;
|
|
833
|
+
}
|
|
834
|
+
), q;
|
|
835
|
+
}
|
|
836
|
+
);
|
|
837
|
+
if (!L) return;
|
|
838
|
+
const Y = L.map((B) => B.sku._id), X = [];
|
|
839
|
+
for (const B of Y) {
|
|
840
|
+
const Q = A.filter((Z) => Z.sku._id === B);
|
|
841
|
+
if (Q.length > 0)
|
|
842
|
+
X.push(...Q);
|
|
843
|
+
else {
|
|
844
|
+
const Z = L.find((se) => se.sku._id === B);
|
|
845
|
+
Z && X.push(Z);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
X.sort((B, Q) => B.sku.code.localeCompare(Q.sku.code)), i.purchaseOrder.items = X;
|
|
849
|
+
}
|
|
850
|
+
return (c, h) => {
|
|
851
|
+
const A = E("FmTextField"), L = E("FmSelect"), Y = E("FmTextarea"), X = E("FmButton"), B = E("FmTable"), Q = E("FmFormGroup"), Z = E("FmForm");
|
|
852
|
+
return S(), oe(Z, {
|
|
853
|
+
ref_key: "formRef",
|
|
854
|
+
ref: T,
|
|
855
|
+
class: "flex flex-col gap-32",
|
|
856
|
+
disabled: c.disabled
|
|
857
|
+
}, {
|
|
858
|
+
default: P(() => {
|
|
859
|
+
var se;
|
|
860
|
+
return [
|
|
861
|
+
t("div", So, [
|
|
862
|
+
t("div", Io, [
|
|
863
|
+
u(A, {
|
|
864
|
+
label: e(_)("inventory.transfer.form.name"),
|
|
865
|
+
"label-mark": "required",
|
|
866
|
+
modelValue: e(i).name,
|
|
867
|
+
"onUpdate:modelValue": h[0] || (h[0] = (q) => e(i).name = q),
|
|
868
|
+
rules: [e(ye)()]
|
|
869
|
+
}, null, 8, ["label", "modelValue", "rules"]),
|
|
870
|
+
u(L, {
|
|
871
|
+
label: e(_)("inventory.transfer.form.type.title"),
|
|
872
|
+
"model-value": b.value,
|
|
873
|
+
"onUpdate:modelValue": h[1] || (h[1] = (q) => b.value = q),
|
|
874
|
+
items: [
|
|
875
|
+
{
|
|
876
|
+
label: e(_)("inventory.transfer.form.type.purchase"),
|
|
877
|
+
value: e(ee).enum.purchase,
|
|
878
|
+
disabled: !e(F).locationOptionsTypePurchase.value.length,
|
|
879
|
+
sublabel: e(F).locationOptionsTypePurchase.value.length ? void 0 : e(_)("inventory.transfer.form.noSupplierAvailable")
|
|
880
|
+
},
|
|
881
|
+
{
|
|
882
|
+
label: e(_)("inventory.transfer.form.type.transfer"),
|
|
883
|
+
value: e(ee).enum.transfer,
|
|
884
|
+
disabled: !e(F).locationOptionsTypeTransfer.value.length,
|
|
885
|
+
sublabel: e(F).locationOptionsTypeTransfer.value.length ? void 0 : e(_)("inventory.transfer.form.noLocationAvailable")
|
|
886
|
+
}
|
|
887
|
+
],
|
|
888
|
+
rules: [e(xe)(1)(D.value)]
|
|
889
|
+
}, {
|
|
890
|
+
default: P(() => [
|
|
891
|
+
t("span", {
|
|
892
|
+
class: te([
|
|
893
|
+
"line-clamp-1 fm-typo-en-body-lg-400",
|
|
894
|
+
c.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
|
|
895
|
+
])
|
|
896
|
+
}, w(e(Mt)(b.value)), 3)
|
|
897
|
+
]),
|
|
898
|
+
_: 1
|
|
899
|
+
}, 8, ["label", "model-value", "items", "rules"]),
|
|
900
|
+
u(L, {
|
|
901
|
+
label: b.value === e(ee).enum.purchase ? e(_)("inventory.transfer.form.purchaseFrom") : e(_)("inventory.transfer.form.transferFrom"),
|
|
902
|
+
modelValue: y.value,
|
|
903
|
+
"onUpdate:modelValue": h[2] || (h[2] = (q) => y.value = q),
|
|
904
|
+
items: D.value
|
|
905
|
+
}, {
|
|
906
|
+
"menu-wrapper": P((q) => {
|
|
907
|
+
var G;
|
|
908
|
+
return [
|
|
909
|
+
u(dt, Ve(q, {
|
|
910
|
+
items: D.value,
|
|
911
|
+
"model-value": (G = c.modelValue.purchaseOrder.supplier) == null ? void 0 : G._id
|
|
912
|
+
}), null, 16, ["items", "model-value"])
|
|
913
|
+
];
|
|
914
|
+
}),
|
|
915
|
+
default: P(() => {
|
|
916
|
+
var q;
|
|
917
|
+
return [
|
|
918
|
+
t("span", {
|
|
919
|
+
class: te([
|
|
920
|
+
"line-clamp-1 fm-typo-en-body-lg-400",
|
|
921
|
+
c.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
|
|
922
|
+
])
|
|
923
|
+
}, w((q = D.value.find((G) => G.value === y.value)) == null ? void 0 : q.label), 3)
|
|
924
|
+
];
|
|
925
|
+
}),
|
|
926
|
+
_: 1
|
|
927
|
+
}, 8, ["label", "modelValue", "items"]),
|
|
928
|
+
u(A, {
|
|
929
|
+
label: e(_)("inventory.transfer.form.reference"),
|
|
930
|
+
"label-mark": "optional",
|
|
931
|
+
modelValue: e(i).purchaseOrder.ref,
|
|
932
|
+
"onUpdate:modelValue": h[3] || (h[3] = (q) => e(i).purchaseOrder.ref = q)
|
|
933
|
+
}, null, 8, ["label", "modelValue"]),
|
|
934
|
+
u(Y, {
|
|
935
|
+
label: e(_)("inventory.transfer.form.remark"),
|
|
936
|
+
"label-mark": "optional",
|
|
937
|
+
"max-length": 240,
|
|
938
|
+
modelValue: I.value,
|
|
939
|
+
"onUpdate:modelValue": h[4] || (h[4] = (q) => I.value = q),
|
|
940
|
+
class: te({ "text-fm-color-typo-disabled": c.disabled })
|
|
941
|
+
}, null, 8, ["label", "modelValue", "class"])
|
|
942
|
+
])
|
|
943
|
+
]),
|
|
944
|
+
t("div", To, [
|
|
945
|
+
t("div", Co, [
|
|
946
|
+
h[8] || (h[8] = t("div", { class: "flex-1 fm-typo-en-title-sm-600" }, "Locations", -1)),
|
|
947
|
+
u(X, {
|
|
948
|
+
disabled: c.disabled,
|
|
949
|
+
label: "Select location",
|
|
950
|
+
"prepend-icon": "add",
|
|
951
|
+
variant: "plain",
|
|
952
|
+
class: "border-2 rounded-lg border-fm-color-primary",
|
|
953
|
+
onClick: e(k)
|
|
954
|
+
}, null, 8, ["disabled", "onClick"])
|
|
955
|
+
]),
|
|
956
|
+
u(B, {
|
|
957
|
+
"column-defs": e(n),
|
|
958
|
+
"row-data": e(r),
|
|
959
|
+
"shrink-at": 9999,
|
|
960
|
+
onRowClick: e(k),
|
|
961
|
+
"hide-footer": ""
|
|
962
|
+
}, null, 8, ["column-defs", "row-data", "onRowClick"]),
|
|
963
|
+
t("div", Oo, [
|
|
964
|
+
u(Q, {
|
|
965
|
+
"model-value": [
|
|
966
|
+
(se = l.modelValue.purchaseOrder.supplier) == null ? void 0 : se._id,
|
|
967
|
+
...l.modelValue.locations ?? []
|
|
968
|
+
].join(","),
|
|
969
|
+
rules: [C]
|
|
970
|
+
}, null, 8, ["model-value", "rules"])
|
|
971
|
+
])
|
|
972
|
+
]),
|
|
973
|
+
t("div", Vo, [
|
|
974
|
+
t("div", Mo, [
|
|
975
|
+
t("div", Eo, w(e(_)("inventory.transfer.form.items.title")), 1),
|
|
976
|
+
e(v).isEnabled ? (S(), oe(X, {
|
|
977
|
+
key: 0,
|
|
978
|
+
label: "Check NetSuite",
|
|
979
|
+
"prepend-icon": "troubleshoot",
|
|
980
|
+
variant: "secondary",
|
|
981
|
+
onClick: p,
|
|
982
|
+
size: "md"
|
|
983
|
+
})) : j("", !0),
|
|
984
|
+
u(X, {
|
|
985
|
+
disabled: c.disabled,
|
|
986
|
+
label: e(_)("inventory.transfer.form.items.addItem"),
|
|
987
|
+
"prepend-icon": "add",
|
|
988
|
+
variant: "plain",
|
|
989
|
+
class: "border-2 rounded-lg border-fm-color-primary",
|
|
990
|
+
onClick: h[5] || (h[5] = (q) => N()),
|
|
991
|
+
size: "md"
|
|
992
|
+
}, null, 8, ["disabled", "label"])
|
|
993
|
+
]),
|
|
994
|
+
e(v).isEnabled ? (S(), V("div", Do, h[9] || (h[9] = [
|
|
995
|
+
ie(" NetSuite is enabled. "),
|
|
996
|
+
t("ul", { style: { "list-style": "initial", "margin-left": "20px" } }, [
|
|
997
|
+
t("li", null, ' When adding new item or changing UOM, the first match available custom code (if any) will be applied to "Code" for each item by default. '),
|
|
998
|
+
t("li", null, ' You can also choose to change the code by selecting from the "NetSuite" button in each row. ')
|
|
999
|
+
], -1),
|
|
1000
|
+
t("p", { class: "fm-typo-en-body-lg-600 mt-2" }, " If you use custom code for certain items, please make sure that the custom code is correct before saving the template. ", -1)
|
|
1001
|
+
]))) : j("", !0),
|
|
1002
|
+
t("div", Ao, [
|
|
1003
|
+
t("p", qo, [
|
|
1004
|
+
ie(' Set "' + w(e(_)("inventory.transfer.form.items.table.DefaultAmount")) + '" to "0" to mark the item as ', 1),
|
|
1005
|
+
h[10] || (h[10] = t("b", null, "optional", -1)),
|
|
1006
|
+
h[11] || (h[11] = ie(" when creating an order request. "))
|
|
1007
|
+
]),
|
|
1008
|
+
h[12] || (h[12] = t("p", null, ' You can leave "Max" empty to remove the limit on the maximum quantity of the item when creating an order request. ', -1))
|
|
1009
|
+
]),
|
|
1010
|
+
(S(), oe(B, {
|
|
1011
|
+
"column-defs": R.value,
|
|
1012
|
+
"row-data": e(i).purchaseOrder.items,
|
|
1013
|
+
key: e(i).purchaseOrder.items.map((q) => q.sku._id).join("."),
|
|
1014
|
+
"hide-footer": "",
|
|
1015
|
+
"page-size": e(i).purchaseOrder.items.length
|
|
1016
|
+
}, {
|
|
1017
|
+
"table-row": P((q) => [
|
|
1018
|
+
u(wo, {
|
|
1019
|
+
row: q,
|
|
1020
|
+
errorMessage: g.value[q.index],
|
|
1021
|
+
"onUpdate:item": h[6] || (h[6] = (G) => U.value.updateItem(G)),
|
|
1022
|
+
disabled: c.disabled
|
|
1023
|
+
}, null, 8, ["row", "errorMessage", "disabled"])
|
|
1024
|
+
]),
|
|
1025
|
+
"list-row": P((q) => [
|
|
1026
|
+
(S(), oe(it, {
|
|
1027
|
+
row: q,
|
|
1028
|
+
key: e(i).purchaseOrder.items.map((G) => G.sku._id).join(".")
|
|
1029
|
+
}, {
|
|
1030
|
+
default: P((G) => [
|
|
1031
|
+
u(xo, {
|
|
1032
|
+
row: q,
|
|
1033
|
+
"cell-by-col-id": G,
|
|
1034
|
+
"onUpdate:item": h[7] || (h[7] = (ve) => U.value.updateItem(ve)),
|
|
1035
|
+
disabled: c.disabled
|
|
1036
|
+
}, null, 8, ["row", "cell-by-col-id", "disabled"])
|
|
1037
|
+
]),
|
|
1038
|
+
_: 2
|
|
1039
|
+
}, 1032, ["row"]))
|
|
1040
|
+
]),
|
|
1041
|
+
_: 1
|
|
1042
|
+
}, 8, ["column-defs", "row-data", "page-size"])),
|
|
1043
|
+
u(Q, {
|
|
1044
|
+
"model-value": e(i).purchaseOrder.items.length,
|
|
1045
|
+
rules: [e(xe)(1)]
|
|
1046
|
+
}, null, 8, ["model-value", "rules"])
|
|
1047
|
+
])
|
|
1048
|
+
];
|
|
1049
|
+
}),
|
|
1050
|
+
_: 1
|
|
1051
|
+
}, 8, ["disabled"]);
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
}), Bo = { class: "flex items-center" }, Uo = { class: "fm-typo-en-title-md-800" }, Po = { class: "flex gap-4" }, No = /* @__PURE__ */ re({
|
|
1055
|
+
__name: "TransferTemplateDialog",
|
|
1056
|
+
props: /* @__PURE__ */ We({
|
|
1057
|
+
mode: {},
|
|
1058
|
+
modelValue: {},
|
|
1059
|
+
show: { type: Boolean }
|
|
1060
|
+
}, {
|
|
1061
|
+
disabled: { type: Boolean },
|
|
1062
|
+
disabledModifiers: {}
|
|
1063
|
+
}),
|
|
1064
|
+
emits: /* @__PURE__ */ We(["update:show", "submitted"], ["update:disabled"]),
|
|
1065
|
+
setup(x, { expose: d, emit: s }) {
|
|
1066
|
+
var k;
|
|
1067
|
+
const l = x, o = s, i = Yt(), _ = Dt(), { t: g } = ce(), O = tt(l, "show");
|
|
1068
|
+
function m() {
|
|
1069
|
+
return {
|
|
1070
|
+
_id: "",
|
|
1071
|
+
name: "",
|
|
1072
|
+
purchaseOrder: {
|
|
1073
|
+
remark: void 0,
|
|
1074
|
+
ref: void 0,
|
|
1075
|
+
items: [],
|
|
1076
|
+
supplier: {
|
|
1077
|
+
_rev: void 0,
|
|
1078
|
+
email: void 0,
|
|
1079
|
+
internal: void 0,
|
|
1080
|
+
contactName: void 0,
|
|
1081
|
+
phoneNumber: void 0,
|
|
1082
|
+
registrationNumber: void 0,
|
|
1083
|
+
supplyItems: void 0,
|
|
1084
|
+
_id: "",
|
|
1085
|
+
name: "",
|
|
1086
|
+
address: {
|
|
1087
|
+
line2: void 0,
|
|
1088
|
+
line1: "",
|
|
1089
|
+
state: "",
|
|
1090
|
+
city: "",
|
|
1091
|
+
postcode: "",
|
|
1092
|
+
country: ""
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
};
|
|
1097
|
+
}
|
|
1098
|
+
const a = H(l.modelValue ?? m()), f = H(((k = l.modelValue) == null ? void 0 : k._id) ?? `${Math.random()}`);
|
|
1099
|
+
Oe(
|
|
1100
|
+
() => l.show,
|
|
1101
|
+
(n) => {
|
|
1102
|
+
var r;
|
|
1103
|
+
n && (a.value = l.modelValue ?? m(), f.value = ((r = l.modelValue) == null ? void 0 : r._id) ?? `${Math.random()}`);
|
|
1104
|
+
}
|
|
1105
|
+
);
|
|
1106
|
+
const v = _t(x, "disabled"), $ = M(() => {
|
|
1107
|
+
switch (l.mode) {
|
|
1108
|
+
case me.READ:
|
|
1109
|
+
return "";
|
|
1110
|
+
case me.CREATE:
|
|
1111
|
+
return g("inventory.transfer.template.create.title");
|
|
1112
|
+
case me.UPDATE:
|
|
1113
|
+
return g("inventory.transfer.template.update.title");
|
|
1114
|
+
}
|
|
1115
|
+
return "";
|
|
1116
|
+
}), F = H();
|
|
1117
|
+
d({
|
|
1118
|
+
validateInputs: () => {
|
|
1119
|
+
var n, r;
|
|
1120
|
+
(r = (n = F.value) == null ? void 0 : n.validateInputs) == null || r.call(n);
|
|
1121
|
+
},
|
|
1122
|
+
resetInputsValidation: () => {
|
|
1123
|
+
var n, r;
|
|
1124
|
+
(r = (n = F.value) == null ? void 0 : n.resetInputsValidation) == null || r.call(n);
|
|
1125
|
+
},
|
|
1126
|
+
resetInputs: () => {
|
|
1127
|
+
var n, r;
|
|
1128
|
+
(r = (n = F.value) == null ? void 0 : n.resetInputs) == null || r.call(n);
|
|
1129
|
+
}
|
|
1130
|
+
});
|
|
1131
|
+
async function b() {
|
|
1132
|
+
var r, C;
|
|
1133
|
+
const n = a.value;
|
|
1134
|
+
if (n) {
|
|
1135
|
+
v.value = !0, (((r = n.purchaseOrder.supplier) == null ? void 0 : r.internal) === ge.enum.warehouse || ((C = n.purchaseOrder.supplier) == null ? void 0 : C.internal) === ge.enum.restaurant) && (n.purchaseOrder.items = n.purchaseOrder.items.map(
|
|
1136
|
+
({ totalCost: I, ...T }) => T
|
|
1137
|
+
));
|
|
1138
|
+
try {
|
|
1139
|
+
await i.createTemplate(n), await new Promise((I) => setTimeout(I, 1e3)), _.open({
|
|
1140
|
+
title: g("inventory.transfer.template.create.success"),
|
|
1141
|
+
message: g("inventory.transfer.template.create.successMessage"),
|
|
1142
|
+
type: "success"
|
|
1143
|
+
}), o("update:show", !1), o("submitted");
|
|
1144
|
+
} catch (I) {
|
|
1145
|
+
_.open({
|
|
1146
|
+
title: g("inventory.transfer.template.create.error"),
|
|
1147
|
+
message: g("inventory.transfer.template.create.errorMessage"),
|
|
1148
|
+
type: "error"
|
|
1149
|
+
}), console.error("Error in creating transfer template", I);
|
|
1150
|
+
} finally {
|
|
1151
|
+
v.value = !1;
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
async function D() {
|
|
1156
|
+
var r, C;
|
|
1157
|
+
const n = a.value;
|
|
1158
|
+
if (n) {
|
|
1159
|
+
v.value = !0, (((r = n.purchaseOrder.supplier) == null ? void 0 : r.internal) === ge.enum.warehouse || ((C = n.purchaseOrder.supplier) == null ? void 0 : C.internal) === ge.enum.restaurant) && (n.purchaseOrder.items = n.purchaseOrder.items.map(
|
|
1160
|
+
({ totalCost: I, ...T }) => T
|
|
1161
|
+
));
|
|
1162
|
+
try {
|
|
1163
|
+
await i.updateTemplate(n), await new Promise((I) => setTimeout(I, 1e3)), _.open({
|
|
1164
|
+
title: g("inventory.transfer.template.update.success"),
|
|
1165
|
+
message: g("inventory.transfer.template.update.successMessage"),
|
|
1166
|
+
type: "success"
|
|
1167
|
+
}), o("update:show", !1), o("submitted");
|
|
1168
|
+
} catch (I) {
|
|
1169
|
+
_.open({
|
|
1170
|
+
title: g("inventory.transfer.template.update.error"),
|
|
1171
|
+
message: g("inventory.transfer.template.update.errorMessage"),
|
|
1172
|
+
type: "error"
|
|
1173
|
+
}), console.error("Error in updating transfer template", I);
|
|
1174
|
+
} finally {
|
|
1175
|
+
v.value = !1;
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
function y() {
|
|
1180
|
+
switch (l.mode) {
|
|
1181
|
+
case me.CREATE:
|
|
1182
|
+
return b();
|
|
1183
|
+
case me.UPDATE:
|
|
1184
|
+
return D();
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
function p() {
|
|
1188
|
+
var n, r;
|
|
1189
|
+
(r = (n = F.value) == null ? void 0 : n.validateInputs) == null || r.call(n);
|
|
1190
|
+
}
|
|
1191
|
+
return (n, r) => {
|
|
1192
|
+
const C = E("FmButton"), I = E("FmSideSheet");
|
|
1193
|
+
return S(), oe(I, {
|
|
1194
|
+
modelValue: e(O),
|
|
1195
|
+
"onUpdate:modelValue": r[3] || (r[3] = (T) => Xe(O) ? O.value = T : null),
|
|
1196
|
+
"dismiss-away": "",
|
|
1197
|
+
"close-button": "",
|
|
1198
|
+
"max-width": 1600
|
|
1199
|
+
}, {
|
|
1200
|
+
"side-sheet-header": P(() => [
|
|
1201
|
+
t("div", Bo, [
|
|
1202
|
+
t("div", Uo, w($.value), 1)
|
|
1203
|
+
])
|
|
1204
|
+
]),
|
|
1205
|
+
default: P(() => [
|
|
1206
|
+
(S(), oe(Ro, {
|
|
1207
|
+
class: "w-full",
|
|
1208
|
+
ref_key: "formRef",
|
|
1209
|
+
ref: F,
|
|
1210
|
+
onValidationSuccess: y,
|
|
1211
|
+
"model-value": a.value,
|
|
1212
|
+
"onUpdate:modelValue": r[0] || (r[0] = (T) => a.value = T),
|
|
1213
|
+
disabled: v.value,
|
|
1214
|
+
"onUpdate:disabled": r[1] || (r[1] = (T) => v.value = T),
|
|
1215
|
+
key: f.value
|
|
1216
|
+
}, null, 8, ["model-value", "disabled"]))
|
|
1217
|
+
]),
|
|
1218
|
+
"side-sheet-footer": P(() => [
|
|
1219
|
+
t("div", Po, [
|
|
1220
|
+
u(Gt, {
|
|
1221
|
+
loading: v.value,
|
|
1222
|
+
label: e(g)("common.save"),
|
|
1223
|
+
"confirm-title": `Save ${l.mode === e(me).CREATE ? "Template" : "Changes"}`,
|
|
1224
|
+
onConfirm: p
|
|
1225
|
+
}, {
|
|
1226
|
+
"dialog-content": P(() => r[4] || (r[4] = [
|
|
1227
|
+
t("div", { class: "fm-typo-en-body-md-400 bg-fm-color-primary-oats p-8 rounded" }, [
|
|
1228
|
+
ie(" Warning: This action "),
|
|
1229
|
+
t("span", { class: "text-fm-color-system-error-300" }, "will not"),
|
|
1230
|
+
ie(" create or update any order request, but only a template. ")
|
|
1231
|
+
], -1)
|
|
1232
|
+
])),
|
|
1233
|
+
_: 1
|
|
1234
|
+
}, 8, ["loading", "label", "confirm-title"]),
|
|
1235
|
+
u(C, {
|
|
1236
|
+
disabled: v.value,
|
|
1237
|
+
variant: "tertiary",
|
|
1238
|
+
label: e(g)("common.close"),
|
|
1239
|
+
onClick: r[2] || (r[2] = (T) => o("update:show", !1))
|
|
1240
|
+
}, null, 8, ["disabled", "label"])
|
|
1241
|
+
])
|
|
1242
|
+
]),
|
|
1243
|
+
_: 1
|
|
1244
|
+
}, 8, ["modelValue"]);
|
|
1245
|
+
};
|
|
1246
|
+
}
|
|
1247
|
+
}), Lo = { class: "flex flex-col gap-16 w-full h-full overflow-y-auto" }, zo = { class: "flex justify-between" }, Qo = { class: "fm-typo-en-body-lg-600" }, jo = { class: "fm-status-badge fm-status-badge-info-secondary" }, Ho = { class: "flex flex-col gap-8" }, Wo = { class: "flex flex-col gap-4" }, Yo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Go = { class: "flex gap-1" }, Ko = { class: "fm-typo-en-body-lg-600" }, Zo = {
|
|
1248
|
+
key: 0,
|
|
1249
|
+
class: "flex flex-col gap-4"
|
|
1250
|
+
}, Jo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Xo = { class: "flex gap-1" }, es = { class: "fm-typo-en-body-lg-600" }, ts = {
|
|
1251
|
+
key: 1,
|
|
1252
|
+
class: "flex flex-col gap-4"
|
|
1253
|
+
}, os = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ss = { class: "fm-typo-en-body-lg-600" }, ls = {
|
|
1254
|
+
key: 2,
|
|
1255
|
+
class: "flex flex-col gap-4"
|
|
1256
|
+
}, ns = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, as = { class: "fm-typo-en-body-lg-600" }, rs = {
|
|
1257
|
+
key: 3,
|
|
1258
|
+
class: "flex flex-col gap-4"
|
|
1259
|
+
}, is = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ds = { class: "fm-typo-en-body-lg-600" }, us = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, ms = { class: "flex flex-col gap-8" }, cs = { class: "fm-typo-en-body-lg-600" }, ps = { class: "flex w-full gap-4" }, fs = { class: "grow fm-typo-en-body-lg-400 line-clamp-2" }, ys = { class: "fm-typo-en-body-lg-600 shrink-0" }, vs = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, bs = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, hs = {
|
|
1260
|
+
key: 0,
|
|
1261
|
+
class: "shrink-0 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
|
|
1262
|
+
}, _s = {
|
|
1263
|
+
key: 0,
|
|
1264
|
+
class: "flex gap-4 items-center"
|
|
1265
|
+
}, gs = { class: "flex flex-col gap-12" }, xs = { class: "flex flex-col gap-8" }, ks = { class: "flex gap-8 xs:flex-col" }, $s = /* @__PURE__ */ re({
|
|
1266
|
+
__name: "TransferTemplateDetails",
|
|
1267
|
+
props: {
|
|
1268
|
+
template: {},
|
|
1269
|
+
show: { type: Boolean }
|
|
1270
|
+
},
|
|
1271
|
+
emits: ["update:show", "action:edit"],
|
|
1272
|
+
setup(x, { emit: d }) {
|
|
1273
|
+
const s = x, l = d, o = ke(), { t: i } = ce(), _ = M(() => {
|
|
1274
|
+
var v;
|
|
1275
|
+
return (v = s.template) == null ? void 0 : v.purchaseOrder;
|
|
1276
|
+
}), g = [
|
|
1277
|
+
{ accessorKey: "name", header: () => "Name" },
|
|
1278
|
+
{ accessorKey: "type", header: () => "Type" }
|
|
1279
|
+
], O = H(""), m = M(
|
|
1280
|
+
() => {
|
|
1281
|
+
var v, $, F, b;
|
|
1282
|
+
return (($ = (v = _.value) == null ? void 0 : v.supplier) == null ? void 0 : $.internal) === "restaurant" || ((b = (F = _.value) == null ? void 0 : F.supplier) == null ? void 0 : b.internal) === "warehouse" ? ee.enum.transfer : ee.enum.purchase;
|
|
1283
|
+
}
|
|
1284
|
+
), a = H(!0), f = tt(s, "show");
|
|
1285
|
+
return (v, $) => {
|
|
1286
|
+
var r;
|
|
1287
|
+
const F = E("FmMenuDivider"), b = E("FmCard"), D = E("FmIcon"), y = E("FmTextField"), p = E("FmTable"), k = E("FmButton"), n = E("FmSideSheet");
|
|
1288
|
+
return S(), oe(n, {
|
|
1289
|
+
header: e(i)("inventory.transfer.template.details.view", { template: (r = v.template) == null ? void 0 : r.name }),
|
|
1290
|
+
modelValue: e(f),
|
|
1291
|
+
"onUpdate:modelValue": $[2] || ($[2] = (C) => Xe(f) ? f.value = C : null),
|
|
1292
|
+
"dismiss-away": a.value,
|
|
1293
|
+
"close-button": "",
|
|
1294
|
+
"max-width": 1200
|
|
1295
|
+
}, {
|
|
1296
|
+
default: P(() => {
|
|
1297
|
+
var C, I;
|
|
1298
|
+
return [
|
|
1299
|
+
t("div", Lo, [
|
|
1300
|
+
t("div", null, [
|
|
1301
|
+
u(b, {
|
|
1302
|
+
variant: "outlined",
|
|
1303
|
+
class: "flex flex-col gap-8 px-12 py-16"
|
|
1304
|
+
}, {
|
|
1305
|
+
default: P(() => {
|
|
1306
|
+
var T, U, ae, R, W, N, c, h, A;
|
|
1307
|
+
return [
|
|
1308
|
+
t("div", zo, [
|
|
1309
|
+
t("div", Qo, w(e(i)("inventory.transfer.template.details.templateSummary")), 1),
|
|
1310
|
+
t("div", jo, w(e(i)(
|
|
1311
|
+
`inventory.transfer.receiveRequest.details.type.${m.value.toLocaleLowerCase("en-US")}`
|
|
1312
|
+
)), 1)
|
|
1313
|
+
]),
|
|
1314
|
+
u(F),
|
|
1315
|
+
t("div", Ho, [
|
|
1316
|
+
t("div", Wo, [
|
|
1317
|
+
t("div", Yo, [
|
|
1318
|
+
t("div", Go, w(e(i)("inventory.transfer.receiveRequest.details.createdAt")), 1)
|
|
1319
|
+
]),
|
|
1320
|
+
t("div", Ko, w(e(Kt)(((T = v.template) == null ? void 0 : T._id) ?? "")), 1)
|
|
1321
|
+
]),
|
|
1322
|
+
(U = v.template) != null && U.updatedAt ? (S(), V("div", Zo, [
|
|
1323
|
+
t("div", Jo, [
|
|
1324
|
+
t("div", Xo, w(e(i)("inventory.transfer.receiveRequest.details.updatedAt")), 1)
|
|
1325
|
+
]),
|
|
1326
|
+
t("div", es, [
|
|
1327
|
+
ie(w(e(ut)(new Date(v.template.updatedAt))) + " ", 1),
|
|
1328
|
+
(ae = v.template.updatedBy) != null && ae.name ? (S(), V(ne, { key: 0 }, [
|
|
1329
|
+
ie(" (" + w(v.template.updatedBy.name) + ") ", 1)
|
|
1330
|
+
], 64)) : j("", !0)
|
|
1331
|
+
])
|
|
1332
|
+
])) : j("", !0),
|
|
1333
|
+
(W = (R = _.value) == null ? void 0 : R.supplier) != null && W.name ? (S(), V("div", ts, [
|
|
1334
|
+
t("div", os, w(e(i)("inventory.transfer.receiveRequest.details.from")), 1),
|
|
1335
|
+
t("div", ss, w((c = (N = _.value) == null ? void 0 : N.supplier) == null ? void 0 : c.name), 1)
|
|
1336
|
+
])) : j("", !0),
|
|
1337
|
+
(h = _.value) != null && h.ref ? (S(), V("div", ls, [
|
|
1338
|
+
t("div", ns, w(e(i)("inventory.transfer.receiveRequest.details.reference")), 1),
|
|
1339
|
+
t("div", as, w(_.value.ref), 1)
|
|
1340
|
+
])) : j("", !0),
|
|
1341
|
+
(A = _.value) != null && A.remark ? (S(), V("div", rs, [
|
|
1342
|
+
t("div", is, w(e(i)("inventory.transfer.receiveRequest.details.remark")), 1),
|
|
1343
|
+
t("div", ds, w(_.value.remark), 1)
|
|
1344
|
+
])) : j("", !0)
|
|
1345
|
+
])
|
|
1346
|
+
];
|
|
1347
|
+
}),
|
|
1348
|
+
_: 1
|
|
1349
|
+
})
|
|
1350
|
+
]),
|
|
1351
|
+
t("div", us, [
|
|
1352
|
+
t("div", ms, [
|
|
1353
|
+
t("div", cs, w(e(i)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
|
|
1354
|
+
(S(!0), V(ne, null, fe(((C = _.value) == null ? void 0 : C.items) ?? [], (T) => (S(), V("div", {
|
|
1355
|
+
key: T.code,
|
|
1356
|
+
class: "flex flex-col"
|
|
1357
|
+
}, [
|
|
1358
|
+
t("div", ps, [
|
|
1359
|
+
t("div", fs, w(T.name), 1),
|
|
1360
|
+
$[3] || ($[3] = t("div", { class: "flex-1 min-w-32" }, null, -1)),
|
|
1361
|
+
t("div", ys, w(e(It)(T.quantity, T.sku.unit, T.measurement)), 1)
|
|
1362
|
+
]),
|
|
1363
|
+
t("div", vs, [
|
|
1364
|
+
t("div", bs, w(T.code), 1),
|
|
1365
|
+
T.totalCost && e(o).enableTotalCost ? (S(), V("div", hs, " (" + w(e(Lt)(T.totalCost)) + ") ", 1)) : j("", !0)
|
|
1366
|
+
]),
|
|
1367
|
+
e(Tt)(T) ? (S(), V("div", _s, [
|
|
1368
|
+
u(D, {
|
|
1369
|
+
name: "error",
|
|
1370
|
+
color: "system-error-300",
|
|
1371
|
+
size: "sm"
|
|
1372
|
+
}),
|
|
1373
|
+
$[4] || ($[4] = t("div", { class: "fm-typo-en-body-sm-400 text-fm-color-system-error-400" }, " This item has invalid unit configuration. Apply update on this item. ", -1))
|
|
1374
|
+
])) : j("", !0)
|
|
1375
|
+
]))), 128))
|
|
1376
|
+
])
|
|
1377
|
+
]),
|
|
1378
|
+
$[6] || ($[6] = t("div", null, null, -1)),
|
|
1379
|
+
$[7] || ($[7] = t("div", null, null, -1)),
|
|
1380
|
+
t("div", gs, [
|
|
1381
|
+
$[5] || ($[5] = t("div", { class: "flex flex-col" }, [
|
|
1382
|
+
t("div", { class: "fm-typo-en-body-lg-600" }, "Enabled locations"),
|
|
1383
|
+
t("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " This template is only usable for the following locations. ")
|
|
1384
|
+
], -1)),
|
|
1385
|
+
t("div", xs, [
|
|
1386
|
+
u(y, {
|
|
1387
|
+
modelValue: O.value,
|
|
1388
|
+
"onUpdate:modelValue": $[0] || ($[0] = (T) => O.value = T),
|
|
1389
|
+
placeholder: "Filter locations",
|
|
1390
|
+
"prepend-icon": "search"
|
|
1391
|
+
}, null, 8, ["modelValue"]),
|
|
1392
|
+
u(p, {
|
|
1393
|
+
"hide-footer": "",
|
|
1394
|
+
style: { height: "500px" },
|
|
1395
|
+
"column-defs": g,
|
|
1396
|
+
"search-value": O.value,
|
|
1397
|
+
"row-data": ((I = s.template) == null ? void 0 : I.locations) ?? [{ name: "All locations" }]
|
|
1398
|
+
}, null, 8, ["search-value", "row-data"])
|
|
1399
|
+
])
|
|
1400
|
+
])
|
|
1401
|
+
])
|
|
1402
|
+
];
|
|
1403
|
+
}),
|
|
1404
|
+
"side-sheet-footer": P(() => [
|
|
1405
|
+
t("div", ks, [
|
|
1406
|
+
u(k, {
|
|
1407
|
+
label: e(i)("common.edit"),
|
|
1408
|
+
onClick: $[1] || ($[1] = (C) => l("action:edit")),
|
|
1409
|
+
variant: "tertiary"
|
|
1410
|
+
}, null, 8, ["label"])
|
|
1411
|
+
])
|
|
1412
|
+
]),
|
|
1413
|
+
_: 1
|
|
1414
|
+
}, 8, ["header", "modelValue", "dismiss-away"]);
|
|
1415
|
+
};
|
|
1416
|
+
}
|
|
1417
|
+
}), Fs = { class: "flex flex-col h-full overflow-hidden" }, ws = {
|
|
1418
|
+
class: "flex flex-col gap-16 p-20 border-b border-fm-color-border-default overflow-y-auto",
|
|
1419
|
+
style: { flex: "0 0 30%", "max-height": "30%" }
|
|
1420
|
+
}, Ss = { class: "fm-typo-en-heading-sm-700 text-fm-color-typo-primary" }, Is = { class: "flex-1 flex flex-col overflow-hidden" }, Ts = {
|
|
1421
|
+
key: 0,
|
|
1422
|
+
class: "flex-1 flex items-center justify-center"
|
|
1423
|
+
}, Cs = { class: "text-center px-32" }, Os = { class: "fm-typo-en-body-md-400 text-fm-color-typo-placeholder" }, Vs = { class: "flex items-center justify-between px-16 py-12 border-b border-fm-color-border-default shrink-0" }, Ms = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" }, Es = { class: "flex-1 overflow-y-auto divide-y divide-fm-color-border-default" }, Ds = ["onClick"], As = { class: "flex-1 min-w-0" }, qs = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary truncate" }, Rs = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary mt-2" }, Bs = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary shrink-0" }, Us = { class: "px-16 py-10 border-t border-fm-color-border-default bg-fm-color-surface-secondary shrink-0" }, Ps = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ns = /* @__PURE__ */ re({
|
|
1424
|
+
__name: "TemplateItemBulkEditorStep1",
|
|
1425
|
+
setup(x) {
|
|
1426
|
+
const { t: d } = we(), s = Fe(), l = $e(), o = M(
|
|
1427
|
+
() => s.skus.map((O) => ({
|
|
1428
|
+
label: O.name,
|
|
1429
|
+
sublabel: O.code,
|
|
1430
|
+
value: O._id
|
|
1431
|
+
}))
|
|
1432
|
+
), i = M({
|
|
1433
|
+
get: () => {
|
|
1434
|
+
var O;
|
|
1435
|
+
return ((O = l.selectedSku) == null ? void 0 : O._id) ?? null;
|
|
1436
|
+
},
|
|
1437
|
+
set: (O) => {
|
|
1438
|
+
if (!O) {
|
|
1439
|
+
l.selectedSku = null, l.deselectAllTemplates();
|
|
1440
|
+
return;
|
|
1441
|
+
}
|
|
1442
|
+
l.selectedSku = s.skuById[O] ?? null, l.selectAllTemplates();
|
|
1443
|
+
}
|
|
1444
|
+
}), _ = M(
|
|
1445
|
+
() => l.candidateTemplates.length > 0 && l.candidateTemplates.every((O) => l.selectedTemplateIds.includes(O._id))
|
|
1446
|
+
);
|
|
1447
|
+
function g() {
|
|
1448
|
+
_.value ? l.deselectAllTemplates() : l.selectAllTemplates();
|
|
1449
|
+
}
|
|
1450
|
+
return (O, m) => {
|
|
1451
|
+
var F;
|
|
1452
|
+
const a = E("FmSelect"), f = E("FmIcon"), v = E("FmButton"), $ = E("FmCheckbox");
|
|
1453
|
+
return S(), V("div", Fs, [
|
|
1454
|
+
t("div", ws, [
|
|
1455
|
+
t("div", null, [
|
|
1456
|
+
t("p", Ss, w(e(d)("inventory.transfer.template.bulkEditor.step1.title")), 1)
|
|
1457
|
+
]),
|
|
1458
|
+
u(a, {
|
|
1459
|
+
modelValue: i.value,
|
|
1460
|
+
"onUpdate:modelValue": m[0] || (m[0] = (b) => i.value = b),
|
|
1461
|
+
items: o.value,
|
|
1462
|
+
placeholder: e(d)("inventory.transfer.template.bulkEditor.step1.skuPlaceholder"),
|
|
1463
|
+
clearable: ""
|
|
1464
|
+
}, {
|
|
1465
|
+
"menu-wrapper": P((b) => [
|
|
1466
|
+
u(dt, Ve(b, {
|
|
1467
|
+
items: o.value,
|
|
1468
|
+
"model-value": i.value
|
|
1469
|
+
}), null, 16, ["items", "model-value"])
|
|
1470
|
+
]),
|
|
1471
|
+
_: 1
|
|
1472
|
+
}, 8, ["modelValue", "items", "placeholder"])
|
|
1473
|
+
]),
|
|
1474
|
+
t("div", Is, [
|
|
1475
|
+
!e(l).selectedSku || e(l).candidateTemplates.length === 0 ? (S(), V("div", Ts, [
|
|
1476
|
+
t("div", Cs, [
|
|
1477
|
+
u(f, {
|
|
1478
|
+
name: "list_alt",
|
|
1479
|
+
size: "lg",
|
|
1480
|
+
class: "text-fm-color-typo-placeholder mb-12"
|
|
1481
|
+
}),
|
|
1482
|
+
t("p", Os, w(e(l).selectedSku ? e(d)("inventory.transfer.template.bulkEditor.step1.emptyNoMatch") : e(d)("inventory.transfer.template.bulkEditor.step1.emptyNoSku")), 1)
|
|
1483
|
+
])
|
|
1484
|
+
])) : (S(), V(ne, { key: 1 }, [
|
|
1485
|
+
t("div", Vs, [
|
|
1486
|
+
t("span", Ms, w(e(d)("inventory.transfer.template.bulkEditor.step1.templatesContain", { count: e(l).candidateTemplates.length, sku: (F = e(l).selectedSku) == null ? void 0 : F.name }, e(l).candidateTemplates.length)), 1),
|
|
1487
|
+
u(v, {
|
|
1488
|
+
label: _.value ? e(d)("inventory.transfer.template.bulkEditor.step1.deselectAll") : e(d)("inventory.transfer.template.bulkEditor.step1.selectAll"),
|
|
1489
|
+
variant: "tertiary",
|
|
1490
|
+
size: "md",
|
|
1491
|
+
onClick: g
|
|
1492
|
+
}, null, 8, ["label"])
|
|
1493
|
+
]),
|
|
1494
|
+
t("div", Es, [
|
|
1495
|
+
(S(!0), V(ne, null, fe(e(l).candidateTemplates, (b) => (S(), V("div", {
|
|
1496
|
+
key: b._id,
|
|
1497
|
+
class: "flex items-center gap-12 px-16 py-12 hover:bg-fm-color-surface-hover transition-colors cursor-pointer",
|
|
1498
|
+
onClick: (D) => e(l).toggleTemplate(b._id)
|
|
1499
|
+
}, [
|
|
1500
|
+
u($, {
|
|
1501
|
+
value: !0,
|
|
1502
|
+
"model-value": e(l).selectedTemplateIds.includes(b._id),
|
|
1503
|
+
"onUpdate:modelValue": (D) => e(l).toggleTemplate(b._id),
|
|
1504
|
+
onClick: m[1] || (m[1] = gt(() => {
|
|
1505
|
+
}, ["stop"]))
|
|
1506
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"]),
|
|
1507
|
+
t("div", As, [
|
|
1508
|
+
t("div", qs, w(b.name), 1),
|
|
1509
|
+
t("div", Rs, [
|
|
1510
|
+
ie(w(e(d)("inventory.transfer.template.bulkEditor.step1.from")) + " " + w(b.purchaseOrder.supplier.name) + " ", 1),
|
|
1511
|
+
b.purchaseOrder.ref ? (S(), V(ne, { key: 0 }, [
|
|
1512
|
+
ie(" · " + w(e(d)("inventory.transfer.template.bulkEditor.step1.ref")) + " " + w(b.purchaseOrder.ref), 1)
|
|
1513
|
+
], 64)) : j("", !0)
|
|
1514
|
+
])
|
|
1515
|
+
]),
|
|
1516
|
+
t("span", Bs, w(e(d)("inventory.transfer.template.bulkEditor.step1.items", { count: b.purchaseOrder.items.length }, b.purchaseOrder.items.length)), 1)
|
|
1517
|
+
], 8, Ds))), 128))
|
|
1518
|
+
]),
|
|
1519
|
+
t("div", Us, [
|
|
1520
|
+
t("span", Ps, w(e(d)("inventory.transfer.template.bulkEditor.step1.selectedCount", { selected: e(l).selectedTemplateIds.length, total: e(l).candidateTemplates.length })), 1)
|
|
1521
|
+
])
|
|
1522
|
+
], 64))
|
|
1523
|
+
])
|
|
1524
|
+
]);
|
|
1525
|
+
};
|
|
1526
|
+
}
|
|
1527
|
+
}), Ls = { class: "flex flex-col gap-20 p-24 h-full overflow-y-auto" }, zs = { class: "fm-typo-en-heading-sm-700 text-fm-color-typo-primary" }, Qs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mt-4" }, js = {
|
|
1528
|
+
key: 0,
|
|
1529
|
+
class: "flex flex-col gap-16"
|
|
1530
|
+
}, Hs = { class: "rounded-lg border border-fm-color-border-default bg-fm-color-surface-secondary px-16 py-10 flex items-center gap-12" }, Ws = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" }, Ys = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary ml-8" }, Gs = {
|
|
1531
|
+
key: 0,
|
|
1532
|
+
class: "ml-auto"
|
|
1533
|
+
}, Ks = { class: "grid grid-cols-2 gap-12" }, Zs = { class: "flex flex-col gap-4" }, Js = { class: "flex items-center gap-8" }, Xs = { class: "flex flex-col gap-4" }, el = { class: "flex items-center gap-8" }, tl = { class: "grid grid-cols-2 gap-12" }, ol = { class: "flex flex-col gap-4" }, sl = { class: "flex items-center gap-8" }, ll = { class: "flex flex-col gap-4" }, nl = { class: "flex items-center gap-8" }, al = { class: "flex flex-col gap-4" }, rl = { class: "flex items-center gap-8" }, il = /* @__PURE__ */ re({
|
|
1534
|
+
__name: "TemplateItemBulkEditorStep2",
|
|
1535
|
+
emits: ["validation-success"],
|
|
1536
|
+
setup(x, { expose: d, emit: s }) {
|
|
1537
|
+
const { t: l } = we(), o = $e(), i = Me(), _ = Fe(), g = M(
|
|
1538
|
+
() => o.selectedSku ? _.skuById[o.selectedSku._id] ?? o.selectedSku : null
|
|
1539
|
+
), O = M(() => {
|
|
1540
|
+
var n, r;
|
|
1541
|
+
return (r = (n = g.value) == null ? void 0 : n.unit) != null && r._id ? _.unitById[g.value.unit._id] ?? null : null;
|
|
1542
|
+
}), m = M({
|
|
1543
|
+
get: () => o.editedItem.code ?? "",
|
|
1544
|
+
set: (n) => {
|
|
1545
|
+
o.editedItem = { ...o.editedItem, code: n };
|
|
1546
|
+
}
|
|
1547
|
+
}), a = M({
|
|
1548
|
+
get: () => o.editedItem.name ?? "",
|
|
1549
|
+
set: (n) => {
|
|
1550
|
+
o.editedItem = { ...o.editedItem, name: n };
|
|
1551
|
+
}
|
|
1552
|
+
}), f = M({
|
|
1553
|
+
get: () => ({
|
|
1554
|
+
amount: o.editedItem.quantity ?? { amount: 1, precision: 0 },
|
|
1555
|
+
measurement: o.editedItem.measurement ?? null
|
|
1556
|
+
}),
|
|
1557
|
+
set: (n) => {
|
|
1558
|
+
n && (o.editedItem = {
|
|
1559
|
+
...o.editedItem,
|
|
1560
|
+
quantity: n.amount,
|
|
1561
|
+
measurement: n.measurement ?? void 0
|
|
1562
|
+
});
|
|
1563
|
+
}
|
|
1564
|
+
}), v = M({
|
|
1565
|
+
get: () => z(o.editedItem.quantityStep ?? { amount: 1, precision: 0 }, !1),
|
|
1566
|
+
set: (n) => {
|
|
1567
|
+
const r = +n;
|
|
1568
|
+
n.trim() === "" || isNaN(r) || (o.editedItem = { ...o.editedItem, quantityStep: pe(r) });
|
|
1569
|
+
}
|
|
1570
|
+
}), $ = M({
|
|
1571
|
+
get: () => ({
|
|
1572
|
+
min: o.editedItem.minimumQuantity ?? void 0,
|
|
1573
|
+
max: o.editedItem.maximumQuantity ?? void 0
|
|
1574
|
+
}),
|
|
1575
|
+
set: (n) => {
|
|
1576
|
+
o.editedItem = {
|
|
1577
|
+
...o.editedItem,
|
|
1578
|
+
minimumQuantity: (n == null ? void 0 : n.min) ?? null,
|
|
1579
|
+
maximumQuantity: (n == null ? void 0 : n.max) ?? null
|
|
1580
|
+
};
|
|
1581
|
+
}
|
|
1582
|
+
}), F = M(() => {
|
|
1583
|
+
var I;
|
|
1584
|
+
const n = o.editedItem, r = n.quantityStep ?? { amount: 1, precision: 0 }, C = (I = g.value) == null ? void 0 : I.unit;
|
|
1585
|
+
return C ? [
|
|
1586
|
+
nt(r),
|
|
1587
|
+
...+(z(n.quantity ?? { amount: 0, precision: 0 }) ?? 0) > 0 ? [
|
|
1588
|
+
at(
|
|
1589
|
+
+(z(
|
|
1590
|
+
n.minimumQuantity ?? {
|
|
1591
|
+
amount: 1,
|
|
1592
|
+
precision: de(C, n.measurement)
|
|
1593
|
+
}
|
|
1594
|
+
) ?? 0)
|
|
1595
|
+
)
|
|
1596
|
+
] : [],
|
|
1597
|
+
rt(
|
|
1598
|
+
n.maximumQuantity ? +(z(n.maximumQuantity) ?? 1 / 0) : 1 / 0
|
|
1599
|
+
)
|
|
1600
|
+
] : [];
|
|
1601
|
+
}), b = M(() => g.value ? [
|
|
1602
|
+
xe({
|
|
1603
|
+
amount: 1,
|
|
1604
|
+
precision: de(g.value.unit, o.editedItem.measurement)
|
|
1605
|
+
}),
|
|
1606
|
+
ot(g.value.unit, o.editedItem.measurement)
|
|
1607
|
+
] : []), D = M(() => g.value ? [
|
|
1608
|
+
ct({ max: !1 }),
|
|
1609
|
+
ft(o.editedItem.quantityStep ?? { amount: 1, precision: 0 }),
|
|
1610
|
+
pt(
|
|
1611
|
+
+(z({
|
|
1612
|
+
amount: 0,
|
|
1613
|
+
precision: de(g.value.unit, o.editedItem.measurement)
|
|
1614
|
+
}) ?? 0),
|
|
1615
|
+
1 / 0
|
|
1616
|
+
)
|
|
1617
|
+
] : []), y = s, p = H();
|
|
1618
|
+
d({
|
|
1619
|
+
validateInputs: () => {
|
|
1620
|
+
var n, r;
|
|
1621
|
+
return (r = (n = p.value) == null ? void 0 : n.validateInputs) == null ? void 0 : r.call(n);
|
|
1622
|
+
}
|
|
1623
|
+
});
|
|
1624
|
+
function k(n, r, C) {
|
|
1625
|
+
o.editedItem = {
|
|
1626
|
+
...o.editedItem,
|
|
1627
|
+
sku: n,
|
|
1628
|
+
code: r,
|
|
1629
|
+
measurement: C ?? o.editedItem.measurement
|
|
1630
|
+
};
|
|
1631
|
+
const I = ["code"];
|
|
1632
|
+
C !== void 0 && I.push("defaultAmount"), o.autoSelectFields(I);
|
|
1633
|
+
}
|
|
1634
|
+
return (n, r) => {
|
|
1635
|
+
const C = E("FmIcon"), I = E("FmCheckbox"), T = E("FmLabel"), U = E("FmTextField"), ae = E("FmForm");
|
|
1636
|
+
return S(), V("div", Ls, [
|
|
1637
|
+
t("div", null, [
|
|
1638
|
+
t("p", zs, w(e(l)("inventory.transfer.template.bulkEditor.step2.title")), 1),
|
|
1639
|
+
t("p", Qs, w(e(l)("inventory.transfer.template.bulkEditor.step2.subtitle", { count: e(o).selectedTemplateIds.length }, e(o).selectedTemplateIds.length)), 1)
|
|
1640
|
+
]),
|
|
1641
|
+
u(ae, {
|
|
1642
|
+
ref_key: "formRef",
|
|
1643
|
+
ref: p,
|
|
1644
|
+
onValidationSuccess: r[10] || (r[10] = (R) => y("validation-success"))
|
|
1645
|
+
}, {
|
|
1646
|
+
default: P(() => [
|
|
1647
|
+
g.value ? (S(), V("div", js, [
|
|
1648
|
+
t("div", Hs, [
|
|
1649
|
+
u(C, {
|
|
1650
|
+
name: "inventory_2",
|
|
1651
|
+
size: "sm",
|
|
1652
|
+
class: "text-fm-color-typo-secondary"
|
|
1653
|
+
}),
|
|
1654
|
+
t("div", null, [
|
|
1655
|
+
t("span", Ws, w(g.value.name), 1),
|
|
1656
|
+
t("span", Ys, "(" + w(g.value.code) + ")", 1)
|
|
1657
|
+
]),
|
|
1658
|
+
e(i).isEnabled ? (S(), V("div", Gs, [
|
|
1659
|
+
u(zt, {
|
|
1660
|
+
sku: g.value,
|
|
1661
|
+
"setting-options": e(i).skuSettingOptions,
|
|
1662
|
+
"onUpdate:modelValue": k
|
|
1663
|
+
}, null, 8, ["sku", "setting-options"])
|
|
1664
|
+
])) : j("", !0)
|
|
1665
|
+
]),
|
|
1666
|
+
t("div", Ks, [
|
|
1667
|
+
t("div", Zs, [
|
|
1668
|
+
t("div", Js, [
|
|
1669
|
+
u(I, {
|
|
1670
|
+
value: !0,
|
|
1671
|
+
"model-value": e(o).selectedFields.has("code"),
|
|
1672
|
+
"onUpdate:modelValue": r[0] || (r[0] = (R) => e(o).toggleField("code"))
|
|
1673
|
+
}, null, 8, ["model-value"]),
|
|
1674
|
+
u(T, {
|
|
1675
|
+
label: e(l)("inventory.transfer.template.bulkEditor.step2.fieldCode"),
|
|
1676
|
+
mark: e(o).selectedFields.has("code") ? "required" : void 0
|
|
1677
|
+
}, null, 8, ["label", "mark"])
|
|
1678
|
+
]),
|
|
1679
|
+
t("div", {
|
|
1680
|
+
class: te(e(o).selectedFields.has("code") ? "" : "pointer-events-none select-none opacity-40")
|
|
1681
|
+
}, [
|
|
1682
|
+
u(U, {
|
|
1683
|
+
modelValue: m.value,
|
|
1684
|
+
"onUpdate:modelValue": r[1] || (r[1] = (R) => m.value = R),
|
|
1685
|
+
"helper-text": g.value.code,
|
|
1686
|
+
rules: e(o).selectedFields.has("code") ? [e(ye)()] : [],
|
|
1687
|
+
disabled: !e(o).selectedFields.has("code")
|
|
1688
|
+
}, null, 8, ["modelValue", "helper-text", "rules", "disabled"])
|
|
1689
|
+
], 2)
|
|
1690
|
+
]),
|
|
1691
|
+
t("div", Xs, [
|
|
1692
|
+
t("div", el, [
|
|
1693
|
+
u(I, {
|
|
1694
|
+
value: !0,
|
|
1695
|
+
"model-value": e(o).selectedFields.has("name"),
|
|
1696
|
+
"onUpdate:modelValue": r[2] || (r[2] = (R) => e(o).toggleField("name"))
|
|
1697
|
+
}, null, 8, ["model-value"]),
|
|
1698
|
+
u(T, {
|
|
1699
|
+
label: e(l)("inventory.transfer.template.bulkEditor.step2.fieldName"),
|
|
1700
|
+
mark: e(o).selectedFields.has("name") ? "required" : void 0
|
|
1701
|
+
}, null, 8, ["label", "mark"])
|
|
1702
|
+
]),
|
|
1703
|
+
t("div", {
|
|
1704
|
+
class: te(e(o).selectedFields.has("name") ? "" : "pointer-events-none select-none opacity-40")
|
|
1705
|
+
}, [
|
|
1706
|
+
u(U, {
|
|
1707
|
+
modelValue: a.value,
|
|
1708
|
+
"onUpdate:modelValue": r[3] || (r[3] = (R) => a.value = R),
|
|
1709
|
+
"helper-text": g.value.name,
|
|
1710
|
+
rules: e(o).selectedFields.has("name") ? [e(ye)()] : [],
|
|
1711
|
+
disabled: !e(o).selectedFields.has("name")
|
|
1712
|
+
}, null, 8, ["modelValue", "helper-text", "rules", "disabled"])
|
|
1713
|
+
], 2)
|
|
1714
|
+
])
|
|
1715
|
+
]),
|
|
1716
|
+
t("div", tl, [
|
|
1717
|
+
t("div", ol, [
|
|
1718
|
+
t("div", sl, [
|
|
1719
|
+
u(I, {
|
|
1720
|
+
value: !0,
|
|
1721
|
+
"model-value": e(o).selectedFields.has("defaultAmount"),
|
|
1722
|
+
"onUpdate:modelValue": r[4] || (r[4] = (R) => e(o).toggleField("defaultAmount"))
|
|
1723
|
+
}, null, 8, ["model-value"]),
|
|
1724
|
+
u(T, {
|
|
1725
|
+
label: e(l)("inventory.transfer.template.bulkEditor.step2.fieldDefaultAmount"),
|
|
1726
|
+
mark: e(o).selectedFields.has("defaultAmount") ? "required" : void 0
|
|
1727
|
+
}, null, 8, ["label", "mark"])
|
|
1728
|
+
]),
|
|
1729
|
+
t("div", {
|
|
1730
|
+
class: te(e(o).selectedFields.has("defaultAmount") ? "" : "pointer-events-none select-none opacity-40")
|
|
1731
|
+
}, [
|
|
1732
|
+
O.value ? (S(), oe(lt, {
|
|
1733
|
+
key: 0,
|
|
1734
|
+
modelValue: f.value,
|
|
1735
|
+
"onUpdate:modelValue": r[5] || (r[5] = (R) => f.value = R),
|
|
1736
|
+
unit: O.value,
|
|
1737
|
+
rules: e(o).selectedFields.has("defaultAmount") ? F.value : [],
|
|
1738
|
+
disabled: !e(o).selectedFields.has("defaultAmount"),
|
|
1739
|
+
"apply-default-rules": ""
|
|
1740
|
+
}, null, 8, ["modelValue", "unit", "rules", "disabled"])) : j("", !0)
|
|
1741
|
+
], 2)
|
|
1742
|
+
]),
|
|
1743
|
+
t("div", ll, [
|
|
1744
|
+
t("div", nl, [
|
|
1745
|
+
u(I, {
|
|
1746
|
+
value: !0,
|
|
1747
|
+
"model-value": e(o).selectedFields.has("step"),
|
|
1748
|
+
"onUpdate:modelValue": r[6] || (r[6] = (R) => e(o).toggleField("step"))
|
|
1749
|
+
}, null, 8, ["model-value"]),
|
|
1750
|
+
u(T, {
|
|
1751
|
+
label: e(l)("inventory.transfer.template.bulkEditor.step2.fieldStep")
|
|
1752
|
+
}, null, 8, ["label"])
|
|
1753
|
+
]),
|
|
1754
|
+
t("div", {
|
|
1755
|
+
class: te(e(o).selectedFields.has("step") ? "" : "pointer-events-none select-none opacity-40")
|
|
1756
|
+
}, [
|
|
1757
|
+
u(U, {
|
|
1758
|
+
modelValue: v.value,
|
|
1759
|
+
"onUpdate:modelValue": r[7] || (r[7] = (R) => v.value = R),
|
|
1760
|
+
rules: e(o).selectedFields.has("step") ? b.value : [],
|
|
1761
|
+
disabled: !e(o).selectedFields.has("step")
|
|
1762
|
+
}, null, 8, ["modelValue", "rules", "disabled"])
|
|
1763
|
+
], 2)
|
|
1764
|
+
])
|
|
1765
|
+
]),
|
|
1766
|
+
t("div", al, [
|
|
1767
|
+
t("div", rl, [
|
|
1768
|
+
u(I, {
|
|
1769
|
+
value: !0,
|
|
1770
|
+
"model-value": e(o).selectedFields.has("limit"),
|
|
1771
|
+
"onUpdate:modelValue": r[8] || (r[8] = (R) => e(o).toggleField("limit"))
|
|
1772
|
+
}, null, 8, ["model-value"]),
|
|
1773
|
+
u(T, {
|
|
1774
|
+
label: e(l)("inventory.transfer.template.bulkEditor.step2.fieldLimit")
|
|
1775
|
+
}, null, 8, ["label"])
|
|
1776
|
+
]),
|
|
1777
|
+
t("div", {
|
|
1778
|
+
class: te(e(o).selectedFields.has("limit") ? "" : "pointer-events-none select-none opacity-40")
|
|
1779
|
+
}, [
|
|
1780
|
+
g.value.unit ? (S(), oe(mt, {
|
|
1781
|
+
key: 0,
|
|
1782
|
+
modelValue: $.value,
|
|
1783
|
+
"onUpdate:modelValue": r[9] || (r[9] = (R) => $.value = R),
|
|
1784
|
+
unit: g.value.unit,
|
|
1785
|
+
rules: e(o).selectedFields.has("limit") ? D.value : [],
|
|
1786
|
+
disabled: !e(o).selectedFields.has("limit"),
|
|
1787
|
+
"disable-unit": "",
|
|
1788
|
+
"apply-default-rules": ""
|
|
1789
|
+
}, null, 8, ["modelValue", "unit", "rules", "disabled"])) : j("", !0)
|
|
1790
|
+
], 2)
|
|
1791
|
+
])
|
|
1792
|
+
])) : j("", !0)
|
|
1793
|
+
]),
|
|
1794
|
+
_: 1
|
|
1795
|
+
}, 512)
|
|
1796
|
+
]);
|
|
1797
|
+
};
|
|
1798
|
+
}
|
|
1799
|
+
}), Je = { amount: 0, precision: 0 };
|
|
1800
|
+
function dl(x) {
|
|
1801
|
+
var s;
|
|
1802
|
+
const d = x.sku;
|
|
1803
|
+
return {
|
|
1804
|
+
code: d.code,
|
|
1805
|
+
overrideCode: x.code,
|
|
1806
|
+
name: x.name ?? d.name,
|
|
1807
|
+
unit: ((s = d.unit.measurements.find((l) => l.id === d.trackingMeasurement)) == null ? void 0 : s.abbrev) ?? d.unit.abbrev,
|
|
1808
|
+
defaultQuantity: +z(x.quantity),
|
|
1809
|
+
minimumQuantity: +z(x.minimumQuantity ?? Je),
|
|
1810
|
+
maximumQuantity: +z(x.maximumQuantity ?? Je),
|
|
1811
|
+
quantityStep: +z(x.quantityStep)
|
|
1812
|
+
};
|
|
1813
|
+
}
|
|
1814
|
+
function ul(x) {
|
|
1815
|
+
var O;
|
|
1816
|
+
const s = St().currentBusiness.value, l = Ct(), i = (O = x.map((m) => {
|
|
1817
|
+
var F;
|
|
1818
|
+
const a = m.purchaseOrder.items.map((b) => dl(b)), f = [
|
|
1819
|
+
["Template ID", m._id],
|
|
1820
|
+
["Template name", m.name],
|
|
1821
|
+
["Business name", s == null ? void 0 : s.name],
|
|
1822
|
+
["Business ID", s == null ? void 0 : s._id],
|
|
1823
|
+
["Menu version", s == null ? void 0 : s.menuVersion],
|
|
1824
|
+
[
|
|
1825
|
+
"Purchase/Transfer",
|
|
1826
|
+
typeof m.purchaseOrder.supplier.internal == "string" ? ee.enum.transfer : ee.enum.purchase
|
|
1827
|
+
],
|
|
1828
|
+
[
|
|
1829
|
+
"Transfer from",
|
|
1830
|
+
`${m.purchaseOrder.supplier.name} (${[
|
|
1831
|
+
m.purchaseOrder.supplier.internal,
|
|
1832
|
+
m.purchaseOrder.supplier._id
|
|
1833
|
+
].filter((b) => b).join("_")})`
|
|
1834
|
+
],
|
|
1835
|
+
[
|
|
1836
|
+
"Locations",
|
|
1837
|
+
...(F = m.locations) != null && F.length ? m.locations.map((b) => `${b.name} (${b.dbName})`) : ["All"]
|
|
1838
|
+
],
|
|
1839
|
+
["Reference", m.purchaseOrder.ref ?? ""],
|
|
1840
|
+
["Remark", m.purchaseOrder.remark ?? ""],
|
|
1841
|
+
[],
|
|
1842
|
+
l.map((b) => b.name),
|
|
1843
|
+
...a.map((b) => l.map((D) => b[D.id]))
|
|
1844
|
+
], v = l.map((b) => `system:${b.id}`), $ = Zt(f, v);
|
|
1845
|
+
return { name: m.name, sheet: $ };
|
|
1846
|
+
}).reduce(
|
|
1847
|
+
(m, a) => {
|
|
1848
|
+
var v;
|
|
1849
|
+
const f = a.name.slice(0, 28);
|
|
1850
|
+
return (v = m.sheetOccurence)[f] ?? (v[f] = 0), m.sheetOccurence[f] += 1, m.sheets[`${f} (${m.sheetOccurence[f]})`] = a.sheet, m;
|
|
1851
|
+
},
|
|
1852
|
+
{
|
|
1853
|
+
sheets: {},
|
|
1854
|
+
sheetOccurence: {}
|
|
1855
|
+
}
|
|
1856
|
+
)) == null ? void 0 : O.sheets, _ = `${s == null ? void 0 : s.name} transfer templates bulk edit (${ut(/* @__PURE__ */ new Date())}).xlsx`, g = Jt(i);
|
|
1857
|
+
Xt(g, _);
|
|
1858
|
+
}
|
|
1859
|
+
const ml = { class: "flex flex-col gap-16" }, cl = { class: "rounded-lg border border-fm-color-border-default bg-fm-color-surface-secondary p-16" }, pl = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary mb-8" }, fl = { class: "flex flex-wrap gap-12 items-center" }, yl = { class: "flex items-center gap-6" }, vl = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, bl = { class: "flex items-center gap-6" }, hl = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, _l = { class: "text-fm-color-typo-primary" }, gl = { class: "text-fm-color-typo-placeholder ml-4" }, xl = { class: "mt-12" }, kl = ["onClick"], $l = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary flex-1 truncate" }, Fl = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, wl = {
|
|
1860
|
+
key: 0,
|
|
1861
|
+
class: "px-12 py-8 border-b border-fm-color-border-default"
|
|
1862
|
+
}, Sl = {
|
|
1863
|
+
key: 1,
|
|
1864
|
+
class: "divide-y divide-fm-color-border-default"
|
|
1865
|
+
}, Il = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-secondary w-28 shrink-0" }, Tl = { class: "fm-typo-en-body-sm-400 line-through text-fm-color-error" }, Cl = { class: "fm-typo-en-body-sm-400 text-fm-color-success font-medium" }, Ol = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Vl = { class: "fm-typo-en-body-xs-400 text-fm-color-typo-placeholder ml-4 italic" }, Ml = /* @__PURE__ */ re({
|
|
1866
|
+
__name: "TemplateItemBulkEditorStep3",
|
|
1867
|
+
setup(x) {
|
|
1868
|
+
const { t: d } = we(), s = $e(), l = H(/* @__PURE__ */ new Set());
|
|
1869
|
+
function o($) {
|
|
1870
|
+
return l.value.has($);
|
|
1871
|
+
}
|
|
1872
|
+
function i($) {
|
|
1873
|
+
const F = new Set(l.value);
|
|
1874
|
+
F.has($) ? F.delete($) : F.add($), l.value = F;
|
|
1875
|
+
}
|
|
1876
|
+
const _ = M(() => {
|
|
1877
|
+
const $ = /* @__PURE__ */ new Map();
|
|
1878
|
+
for (const F of s.selectedTemplates)
|
|
1879
|
+
$.set(F._id, F);
|
|
1880
|
+
return $;
|
|
1881
|
+
});
|
|
1882
|
+
function g($) {
|
|
1883
|
+
var C;
|
|
1884
|
+
const F = (C = s.selectedSku) == null ? void 0 : C._id;
|
|
1885
|
+
if (!F) return [];
|
|
1886
|
+
const b = _.value.get($), D = s.reviewPayloads.find((I) => I._id === $);
|
|
1887
|
+
if (!b || !D) return [];
|
|
1888
|
+
const y = b.purchaseOrder.items.find((I) => I.sku._id === F), p = D.purchaseOrder.items.find((I) => I.sku._id === F);
|
|
1889
|
+
if (!y || !p) return [];
|
|
1890
|
+
const k = (I) => I != null ? z(I) : "—", n = s.selectedFields;
|
|
1891
|
+
return [
|
|
1892
|
+
{
|
|
1893
|
+
group: "code",
|
|
1894
|
+
label: d("inventory.transfer.template.bulkEditor.step3.fieldCode"),
|
|
1895
|
+
before: y.code ?? "—",
|
|
1896
|
+
after: p.code ?? "—",
|
|
1897
|
+
changed: y.code !== p.code
|
|
1898
|
+
},
|
|
1899
|
+
{
|
|
1900
|
+
group: "name",
|
|
1901
|
+
label: d("inventory.transfer.template.bulkEditor.step3.fieldName"),
|
|
1902
|
+
before: y.name ?? "—",
|
|
1903
|
+
after: p.name ?? "—",
|
|
1904
|
+
changed: y.name !== p.name
|
|
1905
|
+
},
|
|
1906
|
+
{
|
|
1907
|
+
group: "defaultAmount",
|
|
1908
|
+
label: d("inventory.transfer.template.bulkEditor.step3.fieldDefaultAmount"),
|
|
1909
|
+
before: k(y.quantity),
|
|
1910
|
+
after: k(p.quantity),
|
|
1911
|
+
changed: k(y.quantity) !== k(p.quantity)
|
|
1912
|
+
},
|
|
1913
|
+
{
|
|
1914
|
+
group: "step",
|
|
1915
|
+
label: d("inventory.transfer.template.bulkEditor.step3.fieldStep"),
|
|
1916
|
+
before: k(y.quantityStep),
|
|
1917
|
+
after: k(p.quantityStep),
|
|
1918
|
+
changed: k(y.quantityStep) !== k(p.quantityStep)
|
|
1919
|
+
},
|
|
1920
|
+
{
|
|
1921
|
+
group: "limit",
|
|
1922
|
+
label: d("inventory.transfer.template.bulkEditor.step3.fieldMin"),
|
|
1923
|
+
before: k(y.minimumQuantity),
|
|
1924
|
+
after: k(p.minimumQuantity),
|
|
1925
|
+
changed: k(y.minimumQuantity) !== k(p.minimumQuantity)
|
|
1926
|
+
},
|
|
1927
|
+
{
|
|
1928
|
+
group: "limit",
|
|
1929
|
+
label: d("inventory.transfer.template.bulkEditor.step3.fieldMax"),
|
|
1930
|
+
before: k(y.maximumQuantity),
|
|
1931
|
+
after: k(p.maximumQuantity),
|
|
1932
|
+
changed: k(y.maximumQuantity) !== k(p.maximumQuantity)
|
|
1933
|
+
}
|
|
1934
|
+
].filter((I) => n.has(I.group));
|
|
1935
|
+
}
|
|
1936
|
+
function O() {
|
|
1937
|
+
ul(s.reviewPayloads);
|
|
1938
|
+
}
|
|
1939
|
+
function m($) {
|
|
1940
|
+
return s.succeededIds.has($) ? "updated" : s.applyErrors.has($) ? "failed" : "pending";
|
|
1941
|
+
}
|
|
1942
|
+
const a = {
|
|
1943
|
+
updated: "success",
|
|
1944
|
+
failed: "critical",
|
|
1945
|
+
pending: "success"
|
|
1946
|
+
}, f = {
|
|
1947
|
+
updated: "inventory.transfer.template.bulkEditor.step3.updatedChip",
|
|
1948
|
+
failed: "inventory.transfer.template.bulkEditor.step3.failedChip",
|
|
1949
|
+
pending: "inventory.transfer.template.bulkEditor.step3.willUpdateChip"
|
|
1950
|
+
}, v = M(() => s.reviewPayloads.length);
|
|
1951
|
+
return ($, F) => {
|
|
1952
|
+
var k, n;
|
|
1953
|
+
const b = E("FmChip"), D = E("FmButton"), y = E("FmIcon"), p = E("FmBanner");
|
|
1954
|
+
return S(), V("div", ml, [
|
|
1955
|
+
t("div", cl, [
|
|
1956
|
+
t("p", pl, w(e(d)("inventory.transfer.template.bulkEditor.step3.title")), 1),
|
|
1957
|
+
t("div", fl, [
|
|
1958
|
+
t("div", yl, [
|
|
1959
|
+
u(b, {
|
|
1960
|
+
size: "sm",
|
|
1961
|
+
label: String(v.value),
|
|
1962
|
+
variant: "success"
|
|
1963
|
+
}, null, 8, ["label"]),
|
|
1964
|
+
t("span", vl, w(e(d)("inventory.transfer.template.bulkEditor.step3.willUpdate", { count: v.value }, v.value)), 1)
|
|
1965
|
+
]),
|
|
1966
|
+
t("div", bl, [
|
|
1967
|
+
t("span", hl, [
|
|
1968
|
+
ie(w(e(d)("inventory.transfer.template.bulkEditor.step3.item")) + " ", 1),
|
|
1969
|
+
t("strong", _l, w((k = e(s).selectedSku) == null ? void 0 : k.name), 1),
|
|
1970
|
+
t("span", gl, "(" + w((n = e(s).selectedSku) == null ? void 0 : n.code) + ")", 1)
|
|
1971
|
+
])
|
|
1972
|
+
])
|
|
1973
|
+
]),
|
|
1974
|
+
t("div", xl, [
|
|
1975
|
+
u(D, {
|
|
1976
|
+
label: e(d)("inventory.transfer.template.bulkEditor.step3.export"),
|
|
1977
|
+
variant: "secondary",
|
|
1978
|
+
size: "md",
|
|
1979
|
+
onClick: O
|
|
1980
|
+
}, null, 8, ["label"])
|
|
1981
|
+
])
|
|
1982
|
+
]),
|
|
1983
|
+
(S(!0), V(ne, null, fe(e(s).reviewPayloads, (r) => (S(), V("div", {
|
|
1984
|
+
key: r._id,
|
|
1985
|
+
class: "rounded-lg border border-fm-color-border-default overflow-hidden"
|
|
1986
|
+
}, [
|
|
1987
|
+
t("button", {
|
|
1988
|
+
type: "button",
|
|
1989
|
+
class: te(["w-full flex items-center gap-8 px-12 py-10 bg-fm-color-surface-secondary text-left cursor-pointer", { "border-b border-fm-color-border-default": o(r._id) }]),
|
|
1990
|
+
onClick: (C) => i(r._id)
|
|
1991
|
+
}, [
|
|
1992
|
+
u(y, {
|
|
1993
|
+
name: o(r._id) ? "expand_less" : "expand_more",
|
|
1994
|
+
size: "sm",
|
|
1995
|
+
class: "text-fm-color-typo-secondary flex-shrink-0"
|
|
1996
|
+
}, null, 8, ["name"]),
|
|
1997
|
+
t("span", $l, w(r.name), 1),
|
|
1998
|
+
t("span", Fl, w(e(d)("inventory.transfer.template.bulkEditor.step1.from")) + " " + w(r.purchaseOrder.supplier.name), 1),
|
|
1999
|
+
u(b, {
|
|
2000
|
+
size: "sm",
|
|
2001
|
+
label: e(d)(f[m(r._id)]),
|
|
2002
|
+
variant: a[m(r._id)]
|
|
2003
|
+
}, null, 8, ["label", "variant"])
|
|
2004
|
+
], 10, kl),
|
|
2005
|
+
e(s).applyErrors.has(r._id) ? (S(), V("div", wl, [
|
|
2006
|
+
u(p, {
|
|
2007
|
+
type: "error",
|
|
2008
|
+
message: e(s).applyErrors.get(r._id)
|
|
2009
|
+
}, null, 8, ["message"])
|
|
2010
|
+
])) : j("", !0),
|
|
2011
|
+
o(r._id) ? (S(), V("div", Sl, [
|
|
2012
|
+
(S(!0), V(ne, null, fe(g(r._id), (C) => (S(), V("div", {
|
|
2013
|
+
key: C.label,
|
|
2014
|
+
class: "flex items-center gap-8 px-12 py-8"
|
|
2015
|
+
}, [
|
|
2016
|
+
t("span", Il, w(C.label), 1),
|
|
2017
|
+
C.changed ? (S(), V(ne, { key: 0 }, [
|
|
2018
|
+
t("span", Tl, w(C.before), 1),
|
|
2019
|
+
u(y, {
|
|
2020
|
+
name: "arrow_forward",
|
|
2021
|
+
size: "sm",
|
|
2022
|
+
class: "text-fm-color-typo-placeholder shrink-0"
|
|
2023
|
+
}),
|
|
2024
|
+
t("span", Cl, w(C.after), 1)
|
|
2025
|
+
], 64)) : (S(), V(ne, { key: 1 }, [
|
|
2026
|
+
t("span", Ol, w(C.before), 1),
|
|
2027
|
+
t("span", Vl, w(e(d)("inventory.transfer.template.bulkEditor.step3.unchanged")), 1)
|
|
2028
|
+
], 64))
|
|
2029
|
+
]))), 128))
|
|
2030
|
+
])) : j("", !0)
|
|
2031
|
+
]))), 128))
|
|
2032
|
+
]);
|
|
2033
|
+
};
|
|
2034
|
+
}
|
|
2035
|
+
}), El = { class: "flex items-center gap-12" }, Dl = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Al = {
|
|
2036
|
+
key: 0,
|
|
2037
|
+
class: "h-[calc(98vh-120px)] overflow-hidden flex flex-col"
|
|
2038
|
+
}, ql = {
|
|
2039
|
+
key: 1,
|
|
2040
|
+
class: "h-[calc(98vh-120px)] overflow-hidden flex flex-col"
|
|
2041
|
+
}, Rl = {
|
|
2042
|
+
key: 2,
|
|
2043
|
+
class: "h-[calc(98vh-120px)] overflow-y-auto px-24 py-20"
|
|
2044
|
+
}, Bl = {
|
|
2045
|
+
key: 0,
|
|
2046
|
+
class: "flex items-center gap-8 px-4"
|
|
2047
|
+
}, Ul = {
|
|
2048
|
+
key: 1,
|
|
2049
|
+
class: "flex items-center gap-8 px-4"
|
|
2050
|
+
}, Pl = /* @__PURE__ */ re({
|
|
2051
|
+
__name: "TemplateItemBulkEditorDialog",
|
|
2052
|
+
setup(x) {
|
|
2053
|
+
const { t: d } = we(), s = $e(), l = At(), o = H(), i = M(() => s.currentStep === 1), _ = M(() => s.currentStep === 2), g = M(() => s.currentStep === 3);
|
|
2054
|
+
function O() {
|
|
2055
|
+
var b;
|
|
2056
|
+
s.currentStep === 1 ? s.goToStep2() : s.currentStep === 2 && ((b = o.value) == null || b.validateInputs());
|
|
2057
|
+
}
|
|
2058
|
+
function m() {
|
|
2059
|
+
s.goToStep3();
|
|
2060
|
+
}
|
|
2061
|
+
function a() {
|
|
2062
|
+
s.back();
|
|
2063
|
+
}
|
|
2064
|
+
function f() {
|
|
2065
|
+
s.show = !1, s.reset();
|
|
2066
|
+
}
|
|
2067
|
+
function v() {
|
|
2068
|
+
var b;
|
|
2069
|
+
l.open({
|
|
2070
|
+
title: d("inventory.transfer.template.bulkEditor.confirm.title"),
|
|
2071
|
+
message: d("inventory.transfer.template.bulkEditor.confirm.message", {
|
|
2072
|
+
sku: (b = s.selectedSku) == null ? void 0 : b.name,
|
|
2073
|
+
count: s.reviewPayloads.length
|
|
2074
|
+
}, s.reviewPayloads.length),
|
|
2075
|
+
primaryActions: {
|
|
2076
|
+
text: d("inventory.transfer.template.bulkEditor.confirm.confirm"),
|
|
2077
|
+
variant: "primary",
|
|
2078
|
+
close: !0
|
|
2079
|
+
},
|
|
2080
|
+
secondaryActions: {
|
|
2081
|
+
text: d("inventory.transfer.template.bulkEditor.confirm.cancel"),
|
|
2082
|
+
close: !0
|
|
2083
|
+
}
|
|
2084
|
+
}).onPrimary(async () => {
|
|
2085
|
+
await s.confirmAndApply();
|
|
2086
|
+
});
|
|
2087
|
+
}
|
|
2088
|
+
const $ = M(() => s.currentStep === 2 ? d("inventory.transfer.template.bulkEditor.review") : d("inventory.transfer.template.bulkEditor.next")), F = M(() => s.currentStep === 1 ? !s.canGoToStep2 : s.currentStep === 2 ? !s.canGoToStep3 : !1);
|
|
2089
|
+
return (b, D) => {
|
|
2090
|
+
const y = E("FmChip"), p = E("FmButton"), k = E("FmDialog");
|
|
2091
|
+
return S(), oe(k, {
|
|
2092
|
+
modelValue: e(s).show,
|
|
2093
|
+
"onUpdate:modelValue": [
|
|
2094
|
+
D[0] || (D[0] = (n) => e(s).show = n),
|
|
2095
|
+
D[1] || (D[1] = (n) => {
|
|
2096
|
+
n || e(s).reset();
|
|
2097
|
+
})
|
|
2098
|
+
],
|
|
2099
|
+
overlay: !0,
|
|
2100
|
+
"close-button": "",
|
|
2101
|
+
"max-width": "98vw",
|
|
2102
|
+
"max-height": "98vh"
|
|
2103
|
+
}, {
|
|
2104
|
+
"dialog-header": P(() => [
|
|
2105
|
+
t("div", El, [
|
|
2106
|
+
t("span", Dl, w(e(d)("inventory.transfer.template.bulkEditor.dialogTitle")), 1),
|
|
2107
|
+
u(y, {
|
|
2108
|
+
size: "sm",
|
|
2109
|
+
label: e(d)("inventory.transfer.template.bulkEditor.stepChip", { step: e(s).currentStep }),
|
|
2110
|
+
variant: "neutral"
|
|
2111
|
+
}, null, 8, ["label"])
|
|
2112
|
+
])
|
|
2113
|
+
]),
|
|
2114
|
+
"dialog-footer": P(() => [
|
|
2115
|
+
g.value ? (S(), V("div", Ul, [
|
|
2116
|
+
u(p, {
|
|
2117
|
+
label: e(d)("inventory.transfer.template.bulkEditor.confirmAndUpdate"),
|
|
2118
|
+
disabled: e(s).isSaving,
|
|
2119
|
+
loading: e(s).isSaving,
|
|
2120
|
+
onClick: v
|
|
2121
|
+
}, null, 8, ["label", "disabled", "loading"]),
|
|
2122
|
+
u(p, {
|
|
2123
|
+
label: e(d)("inventory.transfer.template.bulkEditor.back"),
|
|
2124
|
+
variant: "secondary",
|
|
2125
|
+
disabled: e(s).isSaving,
|
|
2126
|
+
onClick: a
|
|
2127
|
+
}, null, 8, ["label", "disabled"]),
|
|
2128
|
+
u(p, {
|
|
2129
|
+
label: e(d)("inventory.transfer.template.bulkEditor.close"),
|
|
2130
|
+
variant: "tertiary",
|
|
2131
|
+
disabled: e(s).isSaving,
|
|
2132
|
+
onClick: f
|
|
2133
|
+
}, null, 8, ["label", "disabled"])
|
|
2134
|
+
])) : (S(), V("div", Bl, [
|
|
2135
|
+
u(p, {
|
|
2136
|
+
label: $.value,
|
|
2137
|
+
disabled: F.value,
|
|
2138
|
+
onClick: O
|
|
2139
|
+
}, null, 8, ["label", "disabled"]),
|
|
2140
|
+
e(s).currentStep > 1 ? (S(), oe(p, {
|
|
2141
|
+
key: 0,
|
|
2142
|
+
label: e(d)("inventory.transfer.template.bulkEditor.back"),
|
|
2143
|
+
variant: "secondary",
|
|
2144
|
+
onClick: a
|
|
2145
|
+
}, null, 8, ["label"])) : j("", !0),
|
|
2146
|
+
u(p, {
|
|
2147
|
+
label: e(d)("inventory.transfer.template.bulkEditor.close"),
|
|
2148
|
+
variant: "tertiary",
|
|
2149
|
+
onClick: f
|
|
2150
|
+
}, null, 8, ["label"])
|
|
2151
|
+
]))
|
|
2152
|
+
]),
|
|
2153
|
+
default: P(() => [
|
|
2154
|
+
i.value ? (S(), V("div", Al, [
|
|
2155
|
+
u(Ns)
|
|
2156
|
+
])) : _.value ? (S(), V("div", ql, [
|
|
2157
|
+
u(il, {
|
|
2158
|
+
ref_key: "step2Ref",
|
|
2159
|
+
ref: o,
|
|
2160
|
+
onValidationSuccess: m
|
|
2161
|
+
}, null, 512)
|
|
2162
|
+
])) : g.value ? (S(), V("div", Rl, [
|
|
2163
|
+
u(Ml)
|
|
2164
|
+
])) : j("", !0)
|
|
2165
|
+
]),
|
|
2166
|
+
_: 1
|
|
2167
|
+
}, 8, ["modelValue"]);
|
|
2168
|
+
};
|
|
2169
|
+
}
|
|
2170
|
+
}), Nl = { class: "flex-1 flex flex-col gap-8" }, Ll = { class: "flex flex-col" }, zl = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ql = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, jl = { class: "fm-typo-en-body-lg-400" }, Hl = { class: "fm-typo-en-body-lg-400 line-clamp-1" }, Wl = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, Fn = /* @__PURE__ */ re({
|
|
2171
|
+
__name: "TransferTemplateView",
|
|
2172
|
+
setup(x) {
|
|
2173
|
+
const { t: d } = ce(), { createTemplate: s, viewTemplate: l, importTemplates: o, exportTemplates: i, openBulkItemEditor: _ } = Ye(), { templateDialogProps: g, templateDetailsProps: O } = Ke(Ye()), m = Ot(), { loading: a, templates: f } = Ke(m), v = H(!1), $ = Ft(), F = et(), { breakpoints: b } = qt();
|
|
2174
|
+
Ce(m.fetchTemplates);
|
|
2175
|
+
const D = M(
|
|
2176
|
+
() => v.value || a.value || !F._currentLocation
|
|
2177
|
+
), y = M(() => f.value), p = H(""), k = M(() => b.value.xs || b.value.sm), n = M(() => k.value ? 10 : 20);
|
|
2178
|
+
function r(T) {
|
|
2179
|
+
switch (T) {
|
|
2180
|
+
case Ge.Add:
|
|
2181
|
+
return s();
|
|
2182
|
+
case "refresh":
|
|
2183
|
+
return m.fetchTemplates();
|
|
2184
|
+
case "import":
|
|
2185
|
+
return o();
|
|
2186
|
+
case "export":
|
|
2187
|
+
return i();
|
|
2188
|
+
case "bulk-edit-items":
|
|
2189
|
+
return _();
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
function C(T) {
|
|
2193
|
+
return T;
|
|
2194
|
+
}
|
|
2195
|
+
const I = M(() => [
|
|
2196
|
+
{
|
|
2197
|
+
label: d("inventory.closing.template.create.title"),
|
|
2198
|
+
value: Ge.Add,
|
|
2199
|
+
isPrimary: !0,
|
|
2200
|
+
prependIcon: "add"
|
|
2201
|
+
},
|
|
2202
|
+
{
|
|
2203
|
+
label: d("inventory.common.refresh"),
|
|
2204
|
+
value: "refresh",
|
|
2205
|
+
isPrimary: !1
|
|
2206
|
+
},
|
|
2207
|
+
{
|
|
2208
|
+
label: d("inventory.common.import"),
|
|
2209
|
+
value: "import",
|
|
2210
|
+
isPrimary: !1
|
|
2211
|
+
},
|
|
2212
|
+
{
|
|
2213
|
+
label: d("inventory.common.export"),
|
|
2214
|
+
value: "export",
|
|
2215
|
+
isPrimary: !1
|
|
2216
|
+
},
|
|
2217
|
+
{
|
|
2218
|
+
label: d("inventory.transfer.template.bulkEditor.pageAction"),
|
|
2219
|
+
value: "bulk-edit-items",
|
|
2220
|
+
isPrimary: !1
|
|
2221
|
+
}
|
|
2222
|
+
]);
|
|
2223
|
+
return (T, U) => {
|
|
2224
|
+
const ae = E("FmTable");
|
|
2225
|
+
return S(), V(ne, null, [
|
|
2226
|
+
u(wt, {
|
|
2227
|
+
title: e(d)("inventory.transfer.template.title2"),
|
|
2228
|
+
actions: I.value,
|
|
2229
|
+
"onClick:action": r
|
|
2230
|
+
}, {
|
|
2231
|
+
default: P(() => {
|
|
2232
|
+
var R;
|
|
2233
|
+
return [
|
|
2234
|
+
t("div", {
|
|
2235
|
+
class: te([
|
|
2236
|
+
"flex flex-col gap-8 max-h-full",
|
|
2237
|
+
{
|
|
2238
|
+
"p-0": k.value,
|
|
2239
|
+
"px-24 ": !k.value
|
|
2240
|
+
}
|
|
2241
|
+
])
|
|
2242
|
+
}, [
|
|
2243
|
+
u(Et, {
|
|
2244
|
+
searchable: "",
|
|
2245
|
+
search: p.value,
|
|
2246
|
+
"onUpdate:search": U[0] || (U[0] = (W) => p.value = W)
|
|
2247
|
+
}, null, 8, ["search"]),
|
|
2248
|
+
(S(), oe(ae, {
|
|
2249
|
+
style: Te(e($).tableHeight),
|
|
2250
|
+
"column-defs": e(m).columnDefs,
|
|
2251
|
+
"row-data": y.value,
|
|
2252
|
+
"search-value": p.value,
|
|
2253
|
+
loading: D.value,
|
|
2254
|
+
key: (R = e(F)._currentLocation) == null ? void 0 : R.dbName,
|
|
2255
|
+
onRowClick: U[1] || (U[1] = (W) => e(l)(W.original)),
|
|
2256
|
+
"page-size": n.value
|
|
2257
|
+
}, {
|
|
2258
|
+
"list-row": P((W) => [
|
|
2259
|
+
u(it, {
|
|
2260
|
+
row: W,
|
|
2261
|
+
onRowClick: (N) => e(l)(N)
|
|
2262
|
+
}, {
|
|
2263
|
+
default: P((N) => {
|
|
2264
|
+
var c, h, A, L, Y, X, B, Q, Z, se, q, G, ve, be, Ee, De, Ae, qe, Re, Be, he, Ue, Pe, Ne, Le, _e, ze;
|
|
2265
|
+
return [
|
|
2266
|
+
t("div", Nl, [
|
|
2267
|
+
t("div", Ll, [
|
|
2268
|
+
t("div", zl, [
|
|
2269
|
+
u(e(le), {
|
|
2270
|
+
render: (A = (h = (c = N._id) == null ? void 0 : c.column) == null ? void 0 : h.columnDef) == null ? void 0 : A.cell,
|
|
2271
|
+
props: (Y = (L = N._id) == null ? void 0 : L.getContext) == null ? void 0 : Y.call(L)
|
|
2272
|
+
}, null, 8, ["render", "props"])
|
|
2273
|
+
]),
|
|
2274
|
+
t("div", Ql, [
|
|
2275
|
+
u(e(le), {
|
|
2276
|
+
render: (Q = (B = (X = N.name) == null ? void 0 : X.column) == null ? void 0 : B.columnDef) == null ? void 0 : Q.cell,
|
|
2277
|
+
props: (se = (Z = N.name) == null ? void 0 : Z.getContext) == null ? void 0 : se.call(Z)
|
|
2278
|
+
}, null, 8, ["render", "props"])
|
|
2279
|
+
]),
|
|
2280
|
+
t("div", jl, [
|
|
2281
|
+
u(e(le), {
|
|
2282
|
+
render: (ve = (G = (q = N.supplier) == null ? void 0 : q.column) == null ? void 0 : G.columnDef) == null ? void 0 : ve.cell,
|
|
2283
|
+
props: (Ee = (be = N.supplier) == null ? void 0 : be.getContext) == null ? void 0 : Ee.call(be)
|
|
2284
|
+
}, null, 8, ["render", "props"])
|
|
2285
|
+
]),
|
|
2286
|
+
t("div", null, w((De = W.original.locations) != null && De.length ? `Enabled for ${(Ae = W.original.locations) == null ? void 0 : Ae.length} outlets` : "Enabled for all outlets"), 1),
|
|
2287
|
+
t("div", Hl, w(W.original.purchaseOrder.items.length ? W.original.purchaseOrder.items.map((vt) => vt.name).join(", ") : "No items"), 1),
|
|
2288
|
+
t("div", Wl, [
|
|
2289
|
+
u(e(le), {
|
|
2290
|
+
render: (Be = (Re = (qe = N.ref) == null ? void 0 : qe.column) == null ? void 0 : Re.columnDef) == null ? void 0 : Be.cell,
|
|
2291
|
+
props: (Ue = (he = N.ref) == null ? void 0 : he.getContext) == null ? void 0 : Ue.call(he)
|
|
2292
|
+
}, null, 8, ["render", "props"])
|
|
2293
|
+
])
|
|
2294
|
+
]),
|
|
2295
|
+
t("div", null, [
|
|
2296
|
+
u(e(le), {
|
|
2297
|
+
render: (Le = (Ne = (Pe = N.type) == null ? void 0 : Pe.column) == null ? void 0 : Ne.columnDef) == null ? void 0 : Le.cell,
|
|
2298
|
+
props: (ze = (_e = N.type) == null ? void 0 : _e.getContext) == null ? void 0 : ze.call(_e)
|
|
2299
|
+
}, null, 8, ["render", "props"])
|
|
2300
|
+
])
|
|
2301
|
+
])
|
|
2302
|
+
];
|
|
2303
|
+
}),
|
|
2304
|
+
_: 2
|
|
2305
|
+
}, 1032, ["row", "onRowClick"])
|
|
2306
|
+
]),
|
|
2307
|
+
_: 1
|
|
2308
|
+
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
2309
|
+
], 2)
|
|
2310
|
+
];
|
|
2311
|
+
}),
|
|
2312
|
+
_: 1
|
|
2313
|
+
}, 8, ["title", "actions"]),
|
|
2314
|
+
(S(), oe(xt, { to: "body" }, [
|
|
2315
|
+
u($s, kt($t(e(O))), null, 16),
|
|
2316
|
+
u(No, Ve(e(g), {
|
|
2317
|
+
onSubmitted: U[2] || (U[2] = (R) => e(m).fetchTemplates())
|
|
2318
|
+
}), null, 16),
|
|
2319
|
+
u(Pl)
|
|
2320
|
+
]))
|
|
2321
|
+
], 64);
|
|
2322
|
+
};
|
|
2323
|
+
}
|
|
2324
|
+
});
|
|
2325
|
+
export {
|
|
2326
|
+
Fn as default
|
|
2327
|
+
};
|