@feedmepos/mf-inventory-portal 1.7.2-dev.5 → 1.7.2-dev.7

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.
Files changed (90) hide show
  1. package/dist/{App-sgOs35aA.js → App-B-cNop0z.js} +4 -4
  2. package/dist/{ApprovalView-CPwDNlgh.js → ApprovalView-CH9fH4Qb.js} +8 -8
  3. package/dist/{BindingsDialog-DpArZE1W.js → BindingsDialog-CgUzfXM7.js} +2 -2
  4. package/dist/{BindingsPicker-nL4r_o4G.js → BindingsPicker-R_P6Lcic.js} +2 -2
  5. package/dist/{BindingsTable-6nGQghKG.js → BindingsTable-Dp3m86QO.js} +3 -3
  6. package/dist/{BulkReceiveRequestView-CI_cdOab.js → BulkReceiveRequestView-Dfm6mZ6B.js} +19 -19
  7. package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-ByvPyfqs.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-CMF5nNXe.js} +1 -1
  8. package/dist/{ClosingDraftView-BxBBJN2U.js → ClosingDraftView-DzT0E_Mh.js} +19 -19
  9. package/dist/{ClosingHistoryView-BFKeLC1c.js → ClosingHistoryView-BhmDFISo.js} +5 -5
  10. package/dist/{ClosingTemplateView-CDOgVXV6.js → ClosingTemplateView-NnByNbgZ.js} +16 -16
  11. package/dist/{DefaultView-NwCKxFeV.js → DefaultView-gqkkFXje.js} +2 -2
  12. package/dist/{DeliveryOrderPrintPreview-tYTyfuJ3.js → DeliveryOrderPrintPreview-7_JJg7bM.js} +2 -2
  13. package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-OBFDl_6u.js → EmailDialog.vue_vue_type_script_setup_true_lang-CNyHaFyl.js} +3562 -3562
  14. package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-M89ua0y9.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-Dh2QQzUU.js} +1 -1
  15. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BKRLykeg.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-yipZr2ks.js} +2 -2
  16. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DZtBc9rV.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DskF3Ejf.js} +2 -2
  17. package/dist/{FmMultiselectDialog-BrXP0QyX.js → FmMultiselectDialog-CqppB7ct.js} +1 -1
  18. package/dist/{FmMultiselectDialog-DXzQevSA.js → FmMultiselectDialog-CyIIUY_-.js} +2 -2
  19. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DrSTg7py.js → FmUnitInput.vue_vue_type_script_setup_true_lang-B19Lrgpy.js} +5 -5
  20. package/dist/{ImportView-DtniVSEg.js → ImportView-BCzDy9hu.js} +6 -6
  21. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-d63QOGCF.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-D-aszpkJ.js} +1 -1
  22. package/dist/{IngredientGroupView-tt6DHwY7.js → IngredientGroupView-CP2OQuKu.js} +5 -5
  23. package/dist/{IngredientsView-CsTkraJt.js → IngredientsView-o7dPYomM.js} +15 -15
  24. package/dist/IntegrationExplorerView-Bb-JtmQE.js +4184 -0
  25. package/dist/{IntegrationView-PYcCY7pD.js → IntegrationView-Dso9ph27.js} +2260 -2249
  26. package/dist/{InventoryBindingForm-DTiTveNk.js → InventoryBindingForm-CcAI1CUM.js} +1 -1
  27. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-Ch1f11d3.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DspvE3QV.js} +5 -5
  28. package/dist/{InventoryBindingSummary-BpH9ALn_.js → InventoryBindingSummary-CczZmWg1.js} +1 -1
  29. package/dist/{IntegrationExplorerView-Cv0tvGcz.js → JsonViewer.vue_vue_type_script_setup_true_lang-ig2zSXAB.js} +3935 -8114
  30. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-oRfjOztM.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BaxDzap7.js} +1 -1
  31. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CuIo7PEh.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BCw5uMdd.js} +1 -1
  32. package/dist/{ProductionView-eAxWfdGl.js → ProductionView-CmGvJd8w.js} +7 -7
  33. package/dist/{PublishView-DHqZ_Khw.js → PublishView-CoRnayCK.js} +3 -3
  34. package/dist/{PurchaseOrderPrintPreview-Hju7svbs.js → PurchaseOrderPrintPreview-DI_bju59.js} +2 -2
  35. package/dist/{ReceiveRequestView-Qo1Ju84Z.js → ReceiveRequestView-DtpMExX4.js} +13 -13
  36. package/dist/{RecipeView-BMgKWZr9.js → RecipeView-ByWGxmmi.js} +17 -17
  37. package/dist/{SettingsView-BUfOMyYk.js → SettingsView-Cope9kkO.js} +4 -4
  38. package/dist/{StockView-t0O8PRUV.js → StockView-DlPomoqq.js} +21 -21
  39. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DteSCJSr.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-2GpJv2Xj.js} +1 -1
  40. package/dist/{SupplierView-DynMI3e_.js → SupplierView-Bl8iVd_N.js} +12 -12
  41. package/dist/{SurchargeView-CA4Xquxf.js → SurchargeView-RQ_pvucd.js} +6 -6
  42. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-1gIrn5CO.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-C2dIgIh5.js} +2 -2
  43. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-Rd5i3o6l.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-Das0-7BS.js} +1 -1
  44. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-8mbR7VQG.js → TransferDetails.vue_vue_type_script_setup_true_lang-BFweoaXQ.js} +20 -20
  45. package/dist/{TransferTemplateView-AcUDiVtZ.js → TransferTemplateView-CCsW83v_.js} +20 -20
  46. package/dist/{UnitCostHistoryView-HKG9kBJj.js → UnitCostHistoryView-r_edQ-eq.js} +4 -4
  47. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-GOpoebUk.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-ClGDKA3X.js} +4 -4
  48. package/dist/{UnitView-DvBFzxzu.js → UnitView-BZWqwFco.js} +7 -7
  49. package/dist/{WarehouseView-DdvHLm_U.js → WarehouseView-CP9wNM1E.js} +5 -5
  50. package/dist/{WastageTemplateView-BHRtowdx.js → WastageTemplateView-CqEhqsWu.js} +14 -14
  51. package/dist/{app-CmltXEIy.js → app-NciT9fFY.js} +15 -15
  52. package/dist/app.js +1 -1
  53. package/dist/{closing-template-CuSjZM_v.js → closing-template-DxtW0P1l.js} +1 -1
  54. package/dist/{date2-CSIqacwy.js → date2-Ei37LliT.js} +1 -1
  55. package/dist/{dayjs.min-L-DOn9FB.js → dayjs.min-EIcpBkwY.js} +1 -1
  56. package/dist/{decimal-DQr1CGve.js → decimal-BKRg1pg_.js} +2 -2
  57. package/dist/{defineDeepModel-Di-rNBqK.js → defineDeepModel-qwmM6MC5.js} +1 -1
  58. package/dist/{duplicate-template-C1jIZ7Dp.js → duplicate-template-7umGFrPP.js} +1 -1
  59. package/dist/{feature-D0QofU0G.js → feature-DNPvkSld.js} +2 -2
  60. package/dist/{format-time-from-id-CxTQUcxA.js → format-time-from-id-B-xug5OX.js} +1 -1
  61. package/dist/{format-unit-display-BY5Bzvxl.js → format-unit-display-C6CgQhaP.js} +12 -12
  62. package/dist/{import-export.helper-CraoKtWt.js → import-export.helper-B9goQptC.js} +6 -6
  63. package/dist/{index-CfMYAIng.js → index-BsZo4pgH.js} +20 -24
  64. package/dist/{index-Cc28qYrs.js → index-CLpYcebt.js} +1 -1
  65. package/dist/{index-BItVFhm3.js → index-DVGzv0Cp.js} +1 -1
  66. package/dist/{inventory-core-dart.default-DAIR38_q.js → inventory-core-dart.default-Csfw73CS.js} +1 -1
  67. package/dist/{jszip.min-DRsG5r8H.js → jszip.min-Cp12YShz.js} +253 -253
  68. package/dist/{lz-string-DL6qcS0P.js → lz-string-Dtv48niR.js} +1 -1
  69. package/dist/{netsuite-DkCOdQdu.js → netsuite-BrNpmVj4.js} +2 -2
  70. package/dist/{number-CW5l8gfM.js → number-BjVCPgeg.js} +3 -3
  71. package/dist/{predefined-templates-CAwt-Dte.js → predefined-templates-DTuckE0W.js} +1 -1
  72. package/dist/{purchase-order-template-wpQSFrFy.js → purchase-order-template-0o5kmTLn.js} +1 -1
  73. package/dist/{recalculationUtils-eI_1G-1t.js → recalculationUtils-BZrm0pDq.js} +1 -1
  74. package/dist/{rules-C4l55Hep.js → rules-BYehRjzh.js} +2 -2
  75. package/dist/{stock-BvzJ_Xgq.js → stock-D6cWqBWO.js} +1 -1
  76. package/dist/{stock-C2_dljZq.js → stock-DLpjzRFQ.js} +3 -3
  77. package/dist/{supplier-CvVnnw5v.js → supplier-DKkmWDC8.js} +2 -2
  78. package/dist/{surcharge-C8TThA-8.js → surcharge-Cthu-1pt.js} +1 -1
  79. package/dist/tsconfig.app.tsbuildinfo +1 -1
  80. package/dist/{uom-rules-D5ZoSlXt.js → uom-rules-DGZ2Ohoa.js} +1 -1
  81. package/dist/{use-ingredient-select-dialog-DP8hEfVW.js → use-ingredient-select-dialog-DzCnOhOV.js} +2 -2
  82. package/dist/{use-inventory-binding-dialog-C-juC_Hb.js → use-inventory-binding-dialog-w2tI4C5R.js} +2 -2
  83. package/dist/{use-template-enabled-locations-FElDcCCM.js → use-template-enabled-locations-0nnAcRQv.js} +2 -2
  84. package/dist/{use-transfer-locations-y4CSNcrf.js → use-transfer-locations-DmBSO6Hj.js} +2 -2
  85. package/dist/{useHrmPermission-DGXWYR3s.js → useHrmPermission-D2dSFoKy.js} +1 -1
  86. package/dist/{useNavigationMenu-MIZDirGc.js → useNavigationMenu-ud8wGPZf.js} +2 -2
  87. package/dist/{useSseClient-CQmabS1w.js → useSseClient-DPhAUq0d.js} +1 -1
  88. package/dist/{vue-i18n-DmL1-LYL.js → vue-i18n-BYe477BY.js} +519 -519
  89. package/dist/{xlsx.util-DxdEGhYc.js → xlsx.util-aaZMR32z.js} +2 -2
  90. package/package.json +4 -4
@@ -0,0 +1,4184 @@
1
+ import { defineComponent as ne, ref as f, computed as B, watch as Oe, onMounted as _e, resolveComponent as se, createElementBlock as a, openBlock as t, createElementVNode as e, createBlock as H, createCommentVNode as r, normalizeClass as j, createTextVNode as re, toDisplayString as o, createVNode as T, Fragment as M, renderList as X, unref as g, withCtx as te, withModifiers as de, withDirectives as Ve, withKeys as we, vModelText as Ue, h as q, watchEffect as Be } from "vue";
2
+ import { m as Se, N as be, C as xe, u as Ce } from "./app-NciT9fFY.js";
3
+ import { components as oe, useBreakpoints as Pe } from "@feedmepos/ui-library";
4
+ import { _ as Ae } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DwrLsWX_.js";
5
+ import { _ as Ee } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DskF3Ejf.js";
6
+ import { u as Ie, a as Te, S as ge } from "./netsuite-BrNpmVj4.js";
7
+ import { P as he, J as ke, D as De } from "./app-C39bYJmq.js";
8
+ import { useCoreStore as Le } from "@feedmepos/mf-common";
9
+ import { _ as ye } from "./JsonViewer.vue_vue_type_script_setup_true_lang-ig2zSXAB.js";
10
+ import { b as ue } from "./date2-Ei37LliT.js";
11
+ const ce = Se((W, P) => {
12
+ const n = Le();
13
+ function N() {
14
+ var k;
15
+ return ((k = n.currentBusiness.value) == null ? void 0 : k._id) ?? "";
16
+ }
17
+ return {
18
+ // ============================ Orders ============================
19
+ /**
20
+ * Look up a single NetSuite order by its internal ID.
21
+ */
22
+ async readOrderById(k, F) {
23
+ const S = N(), x = `${W.netSuiteBackendUrl}/${S}/v2/explorer/order/${k}/${F}`;
24
+ return await P.get(x);
25
+ },
26
+ /**
27
+ * List NetSuite records by date range, cross-referenced with FM POs.
28
+ * Returns records with purchaseOrderSeqNo (null = unsynced, number = synced).
29
+ */
30
+ async browseOrdersByDateRange(k, F, S, x) {
31
+ const l = N(), $ = `${W.netSuiteBackendUrl}/${l}/v2/explorer/order/${k}/${F}`;
32
+ return await P.post($, {
33
+ startDate: S,
34
+ endDate: x
35
+ });
36
+ },
37
+ /**
38
+ * Query NetSuite records by IDs or date range using unified endpoint.
39
+ * Supports lookup by recordIds, transactionIds, or date range.
40
+ * Returns standardized NSOrderExplorerResultDto[] format with sync status.
41
+ */
42
+ async browseOrdersByFilter(k, F, S) {
43
+ const x = N(), l = `${W.netSuiteBackendUrl}/${x}/v2/explorer/order/query/${k}/${F}`;
44
+ return await P.post(l, S);
45
+ },
46
+ // ============================ Items ============================
47
+ /**
48
+ * List NetSuite items from the `item` table.
49
+ * Pass an optional filter object to narrow results (e.g. { itemtype: 'InvtPart' }).
50
+ */
51
+ async browseItemsByFilter(k) {
52
+ const F = N(), S = `${W.netSuiteBackendUrl}/${F}/v2/explorer/item/query`;
53
+ return await P.post(S, k ? { where: k } : {});
54
+ },
55
+ /**
56
+ * Look up a single NetSuite item by its internal ID.
57
+ */
58
+ async readItemById(k, F) {
59
+ const S = N(), x = `${W.netSuiteBackendUrl}/${S}/v2/explorer/item/${k}/${F}`;
60
+ return await P.get(x);
61
+ },
62
+ // ============================ Vendors ============================
63
+ /**
64
+ * List NetSuite vendors from the `vendor` table.
65
+ * Pass an optional raw SuiteQL WHERE clause to narrow results.
66
+ */
67
+ async browseVendorsByFilter(k) {
68
+ const F = N(), S = `${W.netSuiteBackendUrl}/${F}/v2/explorer/vendor/query`;
69
+ return await P.post(S, k ? { where: k } : {});
70
+ },
71
+ async readVendorById(k) {
72
+ const F = N(), S = `${W.netSuiteBackendUrl}/${F}/v2/explorer/vendor/${k}`;
73
+ return await P.get(S);
74
+ },
75
+ async triggerWebHook(k) {
76
+ const F = N(), S = `${W.netSuiteBackendUrl}/${F}/v2/explorer/trigger-webhook`;
77
+ await P.post(S, k);
78
+ }
79
+ };
80
+ }), Me = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
81
+ __proto__: null,
82
+ useNetSuiteExplorerApi: ce
83
+ }, Symbol.toStringTag, { value: "Module" })), je = Se((W, P) => {
84
+ const n = Le();
85
+ function N() {
86
+ var k;
87
+ return ((k = n.currentBusiness.value) == null ? void 0 : k._id) ?? "";
88
+ }
89
+ return {
90
+ async querySyncLogs(k = {}) {
91
+ const F = N(), S = new URLSearchParams();
92
+ Object.entries(k).forEach(([l, $]) => {
93
+ $ != null && $ !== "" && S.set(l, String($));
94
+ });
95
+ const x = `${W.netSuiteBackendUrl}/${F}/v2/integration/sync-log?${S.toString()}`;
96
+ return await P.get(x);
97
+ },
98
+ async getSyncLogStats(k = {}) {
99
+ const F = N(), S = new URLSearchParams();
100
+ Object.entries(k).forEach(([l, $]) => {
101
+ $ != null && $ !== "" && S.set(l, String($));
102
+ });
103
+ const x = `${W.netSuiteBackendUrl}/${F}/v2/integration/sync-log/stats?${S.toString()}`;
104
+ return await P.get(x);
105
+ },
106
+ async retrySyncLog(k) {
107
+ const F = N(), S = `${W.netSuiteBackendUrl}/${F}/v2/integration/sync-log/${k}/retry`;
108
+ return await P.post(S, {});
109
+ }
110
+ };
111
+ }), qe = { class: "flex flex-col gap-2" }, Je = { class: "flex items-center gap-2 mb-1" }, ze = ["disabled"], We = {
112
+ key: 0,
113
+ class: "w-3.5 h-3.5",
114
+ fill: "none",
115
+ stroke: "currentColor",
116
+ viewBox: "0 0 24 24"
117
+ }, Qe = {
118
+ key: 0,
119
+ class: "flex items-center gap-2 py-2"
120
+ }, He = {
121
+ key: 1,
122
+ class: "text-xs text-gray-400 py-2"
123
+ }, Ke = {
124
+ key: 2,
125
+ class: "text-xs text-gray-400 py-2"
126
+ }, Ye = {
127
+ key: 3,
128
+ class: "flex flex-col gap-1"
129
+ }, Ge = ["onClick"], Xe = { class: "text-gray-400 whitespace-nowrap" }, Ze = {
130
+ key: 0,
131
+ class: "px-3 py-2 bg-gray-50 border-t border-gray-100 text-xs space-y-1"
132
+ }, et = { key: 0 }, tt = { class: "text-gray-400" }, st = {
133
+ key: 0,
134
+ class: "flex items-center justify-between pt-2 text-xs text-gray-500"
135
+ }, at = { class: "flex items-center gap-1" }, ot = ["disabled"], lt = ["disabled"], $e = 20, ve = /* @__PURE__ */ ne({
136
+ __name: "ExplorerRecordSyncLog",
137
+ props: {
138
+ purchaseOrderId: {},
139
+ netsuiteId: {},
140
+ recordType: {}
141
+ },
142
+ setup(W) {
143
+ const P = W, n = je(), N = f([]), k = f(!1), F = f(null), S = f(1), x = f(0), l = f(!1), $ = f(!1), p = B(() => Math.max(1, Math.ceil(x.value / $e)));
144
+ async function c() {
145
+ k.value = !0;
146
+ try {
147
+ const R = await n.querySyncLogs({
148
+ internalId: P.purchaseOrderId,
149
+ externalId: P.netsuiteId,
150
+ provider: "netsuite",
151
+ ...P.recordType ? { metadataRecordType: P.recordType } : {},
152
+ limit: $e,
153
+ page: S.value
154
+ });
155
+ N.value = R.data, x.value = R.total, l.value = !0, $.value = !0, setTimeout(() => $.value = !1, 2e3);
156
+ } catch (R) {
157
+ console.error("Failed to fetch sync logs for record:", R);
158
+ } finally {
159
+ k.value = !1;
160
+ }
161
+ }
162
+ function _(R) {
163
+ R < 1 || R > p.value || R === S.value || (S.value = R, F.value = null, c());
164
+ }
165
+ function h(R) {
166
+ F.value = F.value === R ? null : R;
167
+ }
168
+ function A(R) {
169
+ return new Date(R).toLocaleString();
170
+ }
171
+ function w(R) {
172
+ const V = R.level ?? 30;
173
+ return V >= 50 ? "text-red-600" : V >= 40 ? "text-amber-600" : "text-gray-700";
174
+ }
175
+ function b(R) {
176
+ const V = R.level ?? 30;
177
+ return V >= 50 ? "border-red-200" : V >= 40 ? "border-amber-200" : "border-gray-100";
178
+ }
179
+ return Oe(
180
+ () => P.netsuiteId,
181
+ () => {
182
+ S.value = 1, l.value = !1, N.value = [], x.value = 0, F.value = null;
183
+ }
184
+ ), _e(c), (R, V) => {
185
+ const J = se("FmChip"), Q = se("FmCircularProgress"), K = se("FmIcon");
186
+ return t(), a("div", qe, [
187
+ e("div", Je, [
188
+ l.value && !k.value ? (t(), H(J, {
189
+ key: 0,
190
+ label: `${x.value} entries`,
191
+ compact: ""
192
+ }, null, 8, ["label"])) : r("", !0),
193
+ e("button", {
194
+ class: j(["ml-auto text-xs flex items-center gap-1 transition-colors disabled:opacity-40", $.value ? "text-green-600" : "text-gray-400 hover:text-gray-700"]),
195
+ disabled: k.value,
196
+ onClick: c
197
+ }, [
198
+ $.value ? (t(), a("svg", We, V[2] || (V[2] = [
199
+ e("path", {
200
+ "stroke-linecap": "round",
201
+ "stroke-linejoin": "round",
202
+ "stroke-width": "2",
203
+ d: "M5 13l4 4L19 7"
204
+ }, null, -1)
205
+ ]))) : (t(), a("svg", {
206
+ key: 1,
207
+ class: j(["w-3.5 h-3.5", k.value ? "animate-spin" : ""]),
208
+ fill: "none",
209
+ stroke: "currentColor",
210
+ viewBox: "0 0 24 24"
211
+ }, V[3] || (V[3] = [
212
+ e("path", {
213
+ "stroke-linecap": "round",
214
+ "stroke-linejoin": "round",
215
+ "stroke-width": "2",
216
+ d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
217
+ }, null, -1)
218
+ ]), 2)),
219
+ re(" " + o($.value ? "Refreshed!" : "Refresh"), 1)
220
+ ], 10, ze)
221
+ ]),
222
+ k.value ? (t(), a("div", Qe, [
223
+ T(Q, { size: "md" }),
224
+ V[4] || (V[4] = e("span", { class: "text-xs text-gray-400" }, "Loading sync logs...", -1))
225
+ ])) : l.value ? N.value.length === 0 ? (t(), a("div", Ke, " No sync logs found for this record ")) : (t(), a("div", Ye, [
226
+ (t(!0), a(M, null, X(N.value, (v) => (t(), a("div", {
227
+ key: v._id,
228
+ class: j(["border rounded-lg overflow-hidden", b(v)])
229
+ }, [
230
+ e("div", {
231
+ class: "flex items-center gap-3 px-3 py-2 cursor-pointer hover:bg-gray-50 text-xs",
232
+ onClick: (s) => h(v._id)
233
+ }, [
234
+ e("span", Xe, o(A(v.createdAt)), 1),
235
+ e("span", {
236
+ class: j(["shrink-0 px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wide", {
237
+ "bg-red-100 text-red-700": (v.level ?? 30) >= 50,
238
+ "bg-amber-100 text-amber-700": (v.level ?? 30) >= 40 && (v.level ?? 30) < 50,
239
+ "bg-blue-100 text-blue-700": (v.level ?? 30) >= 30 && (v.level ?? 30) < 40,
240
+ "bg-gray-100 text-gray-500": (v.level ?? 30) < 30
241
+ }])
242
+ }, o((v.level ?? 30) >= 60 ? "fatal" : (v.level ?? 30) >= 50 ? "error" : (v.level ?? 30) >= 40 ? "warn" : (v.level ?? 30) >= 30 ? "info" : (v.level ?? 30) >= 20 ? "debug" : "trace"), 3),
243
+ e("span", {
244
+ class: j(["flex-1 truncate", w(v)])
245
+ }, o(v.message || "—"), 3),
246
+ T(K, {
247
+ name: F.value === v._id ? "expand_less" : "expand_more",
248
+ size: "sm",
249
+ color: "neutral-gray-400"
250
+ }, null, 8, ["name"])
251
+ ], 8, Ge),
252
+ F.value === v._id ? (t(), a("div", Ze, [
253
+ e("div", null, [
254
+ V[5] || (V[5] = e("strong", null, "ID:", -1)),
255
+ re(" " + o(v._id), 1)
256
+ ]),
257
+ v.level != null ? (t(), a("div", et, [
258
+ V[6] || (V[6] = e("strong", null, "Level: ", -1)),
259
+ e("span", {
260
+ class: j(w(v))
261
+ }, [
262
+ re(o(v.level) + " ", 1),
263
+ e("span", tt, "(" + o(v.level >= 60 ? "fatal" : v.level >= 50 ? "error" : v.level >= 40 ? "warn" : v.level >= 30 ? "info" : v.level >= 20 ? "debug" : "trace") + ")", 1)
264
+ ], 2)
265
+ ])) : r("", !0),
266
+ T(ye, {
267
+ value: v,
268
+ "max-height": "15rem"
269
+ }, null, 8, ["value"])
270
+ ])) : r("", !0)
271
+ ], 2))), 128)),
272
+ p.value > 1 ? (t(), a("div", st, [
273
+ e("span", null, "Page " + o(S.value) + " of " + o(p.value), 1),
274
+ e("div", at, [
275
+ e("button", {
276
+ class: "px-2 py-1 rounded border border-gray-200 hover:bg-gray-100 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",
277
+ disabled: S.value <= 1,
278
+ onClick: V[0] || (V[0] = (v) => _(S.value - 1))
279
+ }, " ‹ Prev ", 8, ot),
280
+ e("button", {
281
+ class: "px-2 py-1 rounded border border-gray-200 hover:bg-gray-100 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",
282
+ disabled: S.value >= p.value,
283
+ onClick: V[1] || (V[1] = (v) => _(S.value + 1))
284
+ }, " Next › ", 8, lt)
285
+ ])
286
+ ])) : r("", !0)
287
+ ])) : (t(), a("div", He, " Click Refresh to load sync logs "))
288
+ ]);
289
+ };
290
+ }
291
+ }), rt = { class: "p-6 space-y-6" }, nt = { class: "flex flex-wrap gap-2" }, it = {
292
+ key: 0,
293
+ class: "flex justify-center py-8"
294
+ }, dt = {
295
+ key: 1,
296
+ class: "space-y-6"
297
+ }, ut = { class: "grid grid-cols-2 gap-x-8 gap-y-4 text-sm" }, ct = { class: "col-span-2" }, vt = { class: "font-semibold text-base" }, pt = { class: "font-mono font-medium" }, yt = { class: "font-mono font-medium" }, xt = { class: "font-medium" }, mt = { key: 0 }, gt = { class: "font-mono text-xs" }, ft = { class: "text-xs text-gray-500" }, bt = { class: "font-medium" }, _t = { class: "font-medium" }, ht = { class: "font-medium" }, kt = { class: "p-3 bg-gray-50 border border-gray-200 rounded-lg" }, $t = { class: "grid grid-cols-2 gap-x-8 gap-y-3 text-sm" }, wt = { class: "font-mono font-medium" }, St = { class: "font-mono font-medium" }, Ct = { class: "font-medium" }, It = { class: "p-3 bg-gray-50 border border-gray-200 rounded-lg" }, Tt = { class: "grid grid-cols-2 gap-x-8 gap-y-3 text-sm" }, Dt = { key: 0 }, Lt = { class: "font-medium" }, Ft = { class: "font-mono text-xs text-gray-400" }, Rt = { class: "font-mono text-xs" }, Nt = { class: "font-mono text-xs" }, Ot = { class: "font-mono text-xs" }, Vt = {
298
+ key: 0,
299
+ class: "p-3 bg-gray-50 border border-gray-200 rounded-lg"
300
+ }, Ut = { class: "grid grid-cols-2 gap-x-8 gap-y-3 text-sm" }, Bt = { class: "font-mono text-xs" }, Pt = { class: "font-medium" }, At = { key: 1 }, Et = { class: "text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2" }, Mt = { class: "mb-2 text-sm" }, jt = { class: "font-medium" }, qt = { class: "flex flex-wrap gap-1.5" }, Jt = ["title"], zt = { key: 2 }, Wt = { class: "text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2" }, Qt = { class: "border border-gray-200 rounded-lg overflow-hidden" }, Ht = { class: "w-full text-sm" }, Kt = { class: "px-3 py-2 font-mono text-xs text-gray-400" }, Yt = { class: "px-3 py-2" }, Gt = { class: "font-medium" }, Xt = {
301
+ key: 0,
302
+ class: "text-xs text-gray-400 font-mono"
303
+ }, Zt = {
304
+ key: 1,
305
+ class: "text-xs text-gray-400"
306
+ }, es = { class: "px-3 py-2 text-gray-600 text-xs" }, ts = { class: "px-3 py-2 text-gray-600 text-xs" }, ss = { class: "px-3 py-2 text-right font-mono" }, as = {
307
+ key: 3,
308
+ class: "p-3 bg-amber-50 border border-amber-200 rounded-lg"
309
+ }, os = { class: "grid grid-cols-2 gap-x-8 gap-y-3 text-sm" }, ls = { class: "text-xs text-amber-600 font-mono mb-0.5" }, rs = { class: "font-medium text-xs" }, ns = {
310
+ key: 0,
311
+ class: "text-xs text-gray-400 font-mono"
312
+ }, is = {
313
+ key: 1,
314
+ class: "font-mono text-xs text-gray-800"
315
+ }, ds = {
316
+ key: 2,
317
+ class: "border border-gray-200 rounded-lg overflow-hidden"
318
+ }, us = { key: 0 }, cs = {
319
+ key: 3,
320
+ class: "border border-gray-200 rounded-lg overflow-hidden"
321
+ }, vs = {
322
+ key: 0,
323
+ class: "p-4"
324
+ }, ps = { class: "flex items-center justify-between gap-3" }, ys = { class: "text-xs" }, xs = {
325
+ key: 0,
326
+ class: "text-green-600 font-medium"
327
+ }, ms = {
328
+ key: 1,
329
+ class: "text-red-500"
330
+ }, gs = { class: "flex gap-2" }, fs = /* @__PURE__ */ ne({
331
+ __name: "InventoryItemSideSheet",
332
+ setup(W, { expose: P }) {
333
+ const { FmSideSheet: n, FmButton: N, FmChip: k, FmCircularProgress: F } = oe, S = ce(), x = f(!1), l = f(null), $ = f(null), p = f(!1), c = f(!1), _ = f(!1), h = f(!1);
334
+ async function A(v) {
335
+ if (l.value = null, $.value = null, p.value = !1, c.value = !1, x.value = !0, v) {
336
+ p.value = !0;
337
+ try {
338
+ const s = await v();
339
+ l.value = (s == null ? void 0 : s.nsRecord) ?? null, $.value = (s == null ? void 0 : s.replica) ?? null;
340
+ } catch (s) {
341
+ l.value = { error: (s == null ? void 0 : s.message) ?? "Failed to fetch" };
342
+ } finally {
343
+ p.value = !1;
344
+ }
345
+ }
346
+ }
347
+ function w() {
348
+ x.value = !1, l.value = null, $.value = null, h.value = !1;
349
+ }
350
+ function b() {
351
+ var v;
352
+ (v = window.navigator.clipboard) == null || v.writeText(JSON.stringify(l.value, null, 2)), _.value = !0, setTimeout(() => _.value = !1, 2e3);
353
+ }
354
+ const R = B(() => l.value ? Object.entries(l.value).filter(
355
+ ([v, s]) => /^cust[^_]+_/.test(v) && s !== null && s !== void 0 && s !== ""
356
+ ).map(([v, s]) => ({ key: v, val: s })) : []), V = f(!1), J = f(null), Q = f(!1);
357
+ async function K() {
358
+ var v;
359
+ if ((v = l.value) != null && v.id) {
360
+ V.value = !0, J.value = null, Q.value = !1;
361
+ try {
362
+ await S.triggerWebHook({
363
+ event: "edit",
364
+ recordId: l.value.id,
365
+ recordType: "inventoryitem"
366
+ }), Q.value = !0, setTimeout(() => Q.value = !1, 3e3);
367
+ } catch (s) {
368
+ J.value = (s == null ? void 0 : s.message) ?? "Failed to trigger webhook";
369
+ } finally {
370
+ V.value = !1;
371
+ }
372
+ }
373
+ }
374
+ return P({ open: A, close: w }), (v, s) => {
375
+ var D;
376
+ return t(), H(g(n), {
377
+ modelValue: x.value,
378
+ "onUpdate:modelValue": s[2] || (s[2] = (d) => x.value = d),
379
+ header: `Inventory Item · ${((D = l.value) == null ? void 0 : D.id) ?? "…"}`,
380
+ "max-width": 840
381
+ }, {
382
+ "side-sheet-footer": te(() => {
383
+ var d;
384
+ return [
385
+ e("div", ps, [
386
+ e("div", ys, [
387
+ Q.value ? (t(), a("span", xs, "Webhook triggered!")) : J.value ? (t(), a("span", ms, o(J.value), 1)) : r("", !0)
388
+ ]),
389
+ e("div", gs, [
390
+ (d = l.value) != null && d.id ? (t(), H(g(N), {
391
+ key: 0,
392
+ variant: "secondary",
393
+ disabled: V.value || p.value,
394
+ label: V.value ? "Triggering…" : "Trigger Webhook",
395
+ onClick: K
396
+ }, null, 8, ["disabled", "label"])) : r("", !0),
397
+ T(g(N), {
398
+ variant: "tertiary",
399
+ label: "Close",
400
+ onClick: w
401
+ })
402
+ ])
403
+ ])
404
+ ];
405
+ }),
406
+ default: te(() => {
407
+ var d, y, L, E, I;
408
+ return [
409
+ e("div", rt, [
410
+ e("div", nt, [
411
+ T(g(k), {
412
+ label: "Inventory Part",
413
+ compact: ""
414
+ }),
415
+ (d = l.value) != null && d.isInactive ? (t(), H(g(k), {
416
+ key: 0,
417
+ label: "Inactive",
418
+ compact: ""
419
+ })) : r("", !0),
420
+ (y = l.value) != null && y.parent ? (t(), H(g(k), {
421
+ key: 1,
422
+ label: `Child of ${l.value.parent.refName}`,
423
+ compact: ""
424
+ }, null, 8, ["label"])) : r("", !0),
425
+ p.value ? (t(), H(g(k), {
426
+ key: 2,
427
+ label: "Loading…",
428
+ compact: ""
429
+ })) : r("", !0),
430
+ (L = $.value) != null && L.syncedAt ? (t(), H(g(k), {
431
+ key: 3,
432
+ label: `Last Synced: ${new Date($.value.syncedAt).toLocaleString()}`,
433
+ compact: ""
434
+ }, null, 8, ["label"])) : !p.value && l.value ? (t(), H(g(k), {
435
+ key: 4,
436
+ label: "Not synced",
437
+ compact: ""
438
+ })) : r("", !0)
439
+ ]),
440
+ p.value ? (t(), a("div", it, [
441
+ T(g(F), { size: "md" })
442
+ ])) : l.value ? (t(), a("div", dt, [
443
+ e("div", ut, [
444
+ e("div", ct, [
445
+ s[3] || (s[3] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Item ID", -1)),
446
+ e("div", vt, o(l.value.itemId), 1)
447
+ ]),
448
+ e("div", null, [
449
+ s[4] || (s[4] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "External ID", -1)),
450
+ e("div", pt, o(l.value.externalId), 1)
451
+ ]),
452
+ e("div", null, [
453
+ s[5] || (s[5] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Internal ID", -1)),
454
+ e("div", yt, o(l.value.internalId), 1)
455
+ ]),
456
+ e("div", null, [
457
+ s[6] || (s[6] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Item Type", -1)),
458
+ e("div", xt, o(l.value.itemType.refName), 1)
459
+ ]),
460
+ l.value.parent ? (t(), a("div", mt, [
461
+ s[7] || (s[7] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Parent Item", -1)),
462
+ e("div", gt, o(l.value.parent.id), 1),
463
+ e("div", ft, o(l.value.parent.refName), 1)
464
+ ])) : r("", !0),
465
+ e("div", null, [
466
+ s[8] || (s[8] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Currency", -1)),
467
+ e("div", bt, o(l.value.currency.refName), 1)
468
+ ]),
469
+ e("div", null, [
470
+ s[9] || (s[9] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Created", -1)),
471
+ e("div", _t, o(l.value.createdDate), 1)
472
+ ]),
473
+ e("div", null, [
474
+ s[10] || (s[10] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Last Modified", -1)),
475
+ e("div", ht, o(l.value.lastModifiedDate), 1)
476
+ ])
477
+ ]),
478
+ e("div", kt, [
479
+ s[14] || (s[14] = e("div", { class: "text-xs font-semibold text-gray-500 uppercase tracking-wide mb-3" }, " Costing ", -1)),
480
+ e("div", $t, [
481
+ e("div", null, [
482
+ s[11] || (s[11] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, " Cost (Purchase Price) ", -1)),
483
+ e("div", wt, o(l.value.cost), 1)
484
+ ]),
485
+ e("div", null, [
486
+ s[12] || (s[12] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Average Cost", -1)),
487
+ e("div", St, o(l.value.averageCost ?? "—"), 1)
488
+ ]),
489
+ e("div", null, [
490
+ s[13] || (s[13] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Costing Method", -1)),
491
+ e("div", Ct, o(l.value.costingMethod.refName), 1)
492
+ ])
493
+ ])
494
+ ]),
495
+ e("div", It, [
496
+ s[19] || (s[19] = e("div", { class: "text-xs font-semibold text-gray-500 uppercase tracking-wide mb-3" }, "Units", -1)),
497
+ e("div", Tt, [
498
+ l.value.unitsType ? (t(), a("div", Dt, [
499
+ s[15] || (s[15] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Units Type", -1)),
500
+ e("div", Lt, o(l.value.unitsType.refName), 1),
501
+ e("div", Ft, o(l.value.unitsType.id), 1)
502
+ ])) : r("", !0),
503
+ e("div", null, [
504
+ s[16] || (s[16] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Base Unit ID", -1)),
505
+ e("div", Rt, o(l.value.baseUnit), 1)
506
+ ]),
507
+ e("div", null, [
508
+ s[17] || (s[17] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, " Purchase Unit ID ", -1)),
509
+ e("div", Nt, o(l.value.purchaseUnit), 1)
510
+ ]),
511
+ e("div", null, [
512
+ s[18] || (s[18] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Stock Unit ID", -1)),
513
+ e("div", Ot, o(l.value.stockUnit), 1)
514
+ ])
515
+ ])
516
+ ]),
517
+ l.value.cogsAccount ? (t(), a("div", Vt, [
518
+ s[22] || (s[22] = e("div", { class: "text-xs font-semibold text-gray-500 uppercase tracking-wide mb-3" }, " COGS Account ", -1)),
519
+ e("div", Ut, [
520
+ e("div", null, [
521
+ s[20] || (s[20] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "ID", -1)),
522
+ e("div", Bt, o(l.value.cogsAccount.id), 1)
523
+ ]),
524
+ e("div", null, [
525
+ s[21] || (s[21] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Name", -1)),
526
+ e("div", Pt, o(l.value.cogsAccount.refName), 1)
527
+ ])
528
+ ])
529
+ ])) : r("", !0),
530
+ l.value.subsidiary.items.length > 0 ? (t(), a("div", At, [
531
+ e("div", Et, " Subsidiaries (" + o(l.value.subsidiary.totalResults) + ") ", 1),
532
+ e("div", Mt, [
533
+ s[23] || (s[23] = e("span", { class: "text-xs text-gray-500 uppercase tracking-wide" }, "Include Children: ", -1)),
534
+ e("span", jt, o(l.value.includeChildren ? "Yes" : "No"), 1)
535
+ ]),
536
+ e("div", qt, [
537
+ (t(!0), a(M, null, X(l.value.subsidiary.items, (C) => (t(), a("span", {
538
+ key: C.id,
539
+ class: "px-2 py-0.5 rounded-full text-xs border bg-gray-50 border-gray-200 text-gray-700",
540
+ title: C.id
541
+ }, o(C.refName), 9, Jt))), 128))
542
+ ])
543
+ ])) : r("", !0),
544
+ ((E = l.value.itemVendor) == null ? void 0 : E.totalResults) > 0 ? (t(), a("div", zt, [
545
+ e("div", Wt, " Vendors (" + o(l.value.itemVendor.totalResults) + ") ", 1),
546
+ e("div", Qt, [
547
+ e("table", Ht, [
548
+ s[24] || (s[24] = e("thead", { class: "bg-gray-50 border-b border-gray-200" }, [
549
+ e("tr", null, [
550
+ e("th", { class: "text-left px-3 py-2 font-medium text-gray-600" }, "#"),
551
+ e("th", { class: "text-left px-3 py-2 font-medium text-gray-600" }, "Vendor"),
552
+ e("th", { class: "text-left px-3 py-2 font-medium text-gray-600" }, "Subsidiary"),
553
+ e("th", { class: "text-left px-3 py-2 font-medium text-gray-600" }, "Currency"),
554
+ e("th", { class: "text-right px-3 py-2 font-medium text-gray-600" }, "Price")
555
+ ])
556
+ ], -1)),
557
+ e("tbody", null, [
558
+ (t(!0), a(M, null, X(l.value.itemVendor.items, (C, Y) => {
559
+ var Z, O, u;
560
+ return t(), a("tr", {
561
+ key: Y,
562
+ class: "border-b border-gray-100 last:border-0"
563
+ }, [
564
+ e("td", Kt, o(Y + 1), 1),
565
+ e("td", Yt, [
566
+ e("div", Gt, o(((Z = C.vendor) == null ? void 0 : Z.refName) ?? "—"), 1),
567
+ (O = C.vendor) != null && O.id ? (t(), a("div", Xt, " ID: " + o(C.vendor.id), 1)) : r("", !0),
568
+ C.vendorCode ? (t(), a("div", Zt, " Code: " + o(C.vendorCode), 1)) : r("", !0)
569
+ ]),
570
+ e("td", es, o(((u = C.subsidiary) == null ? void 0 : u.refName) ?? "—"), 1),
571
+ e("td", ts, o(C.vendorCurrencyName ?? "—"), 1),
572
+ e("td", ss, o(C.purchasePrice ?? "—"), 1)
573
+ ]);
574
+ }), 128))
575
+ ])
576
+ ])
577
+ ])
578
+ ])) : r("", !0),
579
+ R.value.length > 0 ? (t(), a("div", as, [
580
+ s[25] || (s[25] = e("div", { class: "text-xs font-semibold text-amber-700 uppercase tracking-wide mb-3" }, " Custom Fields ", -1)),
581
+ e("div", os, [
582
+ (t(!0), a(M, null, X(R.value, (C) => (t(), a("div", {
583
+ key: C.key
584
+ }, [
585
+ e("div", ls, o(C.key), 1),
586
+ C.val && typeof C.val == "object" && "refName" in C.val ? (t(), a(M, { key: 0 }, [
587
+ e("div", rs, o(C.val.refName), 1),
588
+ C.val.id ? (t(), a("div", ns, " ID: " + o(C.val.id), 1)) : r("", !0)
589
+ ], 64)) : (t(), a("div", is, o(C.val), 1))
590
+ ]))), 128))
591
+ ])
592
+ ])) : r("", !0)
593
+ ])) : r("", !0),
594
+ l.value ? (t(), a("div", ds, [
595
+ e("div", {
596
+ class: j(["flex items-center gap-1.5 px-3 py-2 bg-gray-50 cursor-pointer select-none hover:bg-gray-100 transition-colors", c.value ? "border-b border-gray-200" : ""]),
597
+ onClick: s[0] || (s[0] = (C) => c.value = !c.value)
598
+ }, [
599
+ (t(), a("svg", {
600
+ class: j(["w-3.5 h-3.5 transition-transform text-gray-500", c.value ? "rotate-90" : ""]),
601
+ fill: "none",
602
+ stroke: "currentColor",
603
+ viewBox: "0 0 24 24"
604
+ }, s[26] || (s[26] = [
605
+ e("path", {
606
+ "stroke-linecap": "round",
607
+ "stroke-linejoin": "round",
608
+ "stroke-width": "2",
609
+ d: "M9 5l7 7-7 7"
610
+ }, null, -1)
611
+ ]), 2)),
612
+ s[27] || (s[27] = e("span", { class: "text-xs font-medium text-gray-600" }, "(NetSuite) Raw JSON", -1)),
613
+ c.value ? (t(), a("button", {
614
+ key: 0,
615
+ class: j(["ml-auto text-xs flex items-center gap-1 transition-colors", _.value ? "text-green-600" : "text-gray-400 hover:text-gray-700"]),
616
+ onClick: de(b, ["stop"])
617
+ }, o(_.value ? "Copied!" : "Copy JSON"), 3)) : r("", !0)
618
+ ], 2),
619
+ c.value ? (t(), a("div", us, [
620
+ T(ye, { value: l.value }, null, 8, ["value"])
621
+ ])) : r("", !0)
622
+ ])) : r("", !0),
623
+ (I = l.value) != null && I.id ? (t(), a("div", cs, [
624
+ e("div", {
625
+ class: j(["flex items-center gap-1.5 px-3 py-2 bg-gray-50 cursor-pointer select-none hover:bg-gray-100 transition-colors", h.value ? "border-b border-gray-200" : ""]),
626
+ onClick: s[1] || (s[1] = (C) => h.value = !h.value)
627
+ }, [
628
+ (t(), a("svg", {
629
+ class: j(["w-3.5 h-3.5 transition-transform text-gray-500", h.value ? "rotate-90" : ""]),
630
+ fill: "none",
631
+ stroke: "currentColor",
632
+ viewBox: "0 0 24 24"
633
+ }, s[28] || (s[28] = [
634
+ e("path", {
635
+ "stroke-linecap": "round",
636
+ "stroke-linejoin": "round",
637
+ "stroke-width": "2",
638
+ d: "M9 5l7 7-7 7"
639
+ }, null, -1)
640
+ ]), 2)),
641
+ s[29] || (s[29] = e("span", { class: "text-xs font-medium text-gray-600" }, "Sync Logs", -1))
642
+ ], 2),
643
+ h.value ? (t(), a("div", vs, [
644
+ T(ve, {
645
+ "netsuite-id": l.value.id,
646
+ "record-type": "inventoryItem"
647
+ }, null, 8, ["netsuite-id"])
648
+ ])) : r("", !0)
649
+ ])) : r("", !0)
650
+ ])
651
+ ];
652
+ }),
653
+ _: 1
654
+ }, 8, ["modelValue", "header"]);
655
+ };
656
+ }
657
+ }), bs = { class: "p-6 space-y-6" }, _s = { class: "flex flex-wrap gap-2" }, hs = {
658
+ key: 0,
659
+ class: "flex justify-center py-8"
660
+ }, ks = {
661
+ key: 1,
662
+ class: "space-y-6"
663
+ }, $s = { class: "grid grid-cols-2 gap-x-8 gap-y-4 text-sm" }, ws = { class: "col-span-2" }, Ss = { class: "font-semibold text-base" }, Cs = { class: "font-mono font-medium" }, Is = { class: "font-mono font-medium" }, Ts = { class: "font-medium" }, Ds = { key: 0 }, Ls = { class: "font-mono text-xs" }, Fs = { class: "text-xs text-gray-500" }, Rs = { class: "font-medium" }, Ns = { class: "font-medium" }, Os = { class: "font-medium" }, Vs = { class: "p-3 bg-gray-50 border border-gray-200 rounded-lg" }, Us = { class: "grid grid-cols-2 gap-x-8 gap-y-3 text-sm" }, Bs = { class: "font-mono font-medium" }, Ps = { class: "font-mono font-medium" }, As = { class: "font-medium" }, Es = { class: "p-3 bg-gray-50 border border-gray-200 rounded-lg" }, Ms = { class: "grid grid-cols-2 gap-x-8 gap-y-3 text-sm" }, js = { key: 0 }, qs = { class: "font-medium" }, Js = { class: "font-mono text-xs text-gray-400" }, zs = { class: "font-mono text-xs" }, Ws = { class: "font-mono text-xs" }, Qs = { class: "font-mono text-xs" }, Hs = {
664
+ key: 0,
665
+ class: "p-3 bg-gray-50 border border-gray-200 rounded-lg"
666
+ }, Ks = { class: "grid grid-cols-2 gap-x-8 gap-y-3 text-sm" }, Ys = { class: "font-mono text-xs" }, Gs = { class: "font-medium" }, Xs = { key: 1 }, Zs = { class: "text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2" }, ea = { class: "mb-2 text-sm" }, ta = { class: "font-medium" }, sa = { class: "flex flex-wrap gap-1.5" }, aa = ["title"], oa = { key: 2 }, la = { class: "text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2" }, ra = { class: "border border-gray-200 rounded-lg overflow-hidden" }, na = { class: "w-full text-sm" }, ia = { class: "px-3 py-2 font-mono text-xs text-gray-400" }, da = { class: "px-3 py-2" }, ua = { class: "font-medium" }, ca = {
667
+ key: 0,
668
+ class: "text-xs text-gray-400 font-mono"
669
+ }, va = {
670
+ key: 1,
671
+ class: "text-xs text-gray-400"
672
+ }, pa = { class: "px-3 py-2 text-gray-600 text-xs" }, ya = { class: "px-3 py-2 text-gray-600 text-xs" }, xa = { class: "px-3 py-2 text-right font-mono" }, ma = {
673
+ key: 3,
674
+ class: "p-3 bg-amber-50 border border-amber-200 rounded-lg"
675
+ }, ga = { class: "grid grid-cols-2 gap-x-8 gap-y-3 text-sm" }, fa = { class: "text-xs text-amber-600 font-mono mb-0.5" }, ba = { class: "font-medium text-xs" }, _a = {
676
+ key: 0,
677
+ class: "text-xs text-gray-400 font-mono"
678
+ }, ha = {
679
+ key: 1,
680
+ class: "font-mono text-xs text-gray-800"
681
+ }, ka = {
682
+ key: 2,
683
+ class: "border border-gray-200 rounded-lg overflow-hidden"
684
+ }, $a = { key: 0 }, wa = {
685
+ key: 3,
686
+ class: "border border-gray-200 rounded-lg overflow-hidden"
687
+ }, Sa = {
688
+ key: 0,
689
+ class: "p-4"
690
+ }, Ca = { class: "flex items-center justify-between gap-3" }, Ia = { class: "text-xs" }, Ta = {
691
+ key: 0,
692
+ class: "text-green-600 font-medium"
693
+ }, Da = {
694
+ key: 1,
695
+ class: "text-red-500"
696
+ }, La = { class: "flex gap-2" }, Fa = /* @__PURE__ */ ne({
697
+ __name: "AssemblyItemSideSheet",
698
+ setup(W, { expose: P }) {
699
+ const { FmSideSheet: n, FmButton: N, FmChip: k, FmCircularProgress: F } = oe, S = ce(), x = f(!1), l = f(null), $ = f(null), p = f(!1), c = f(!1), _ = f(!1), h = f(!1);
700
+ async function A(v) {
701
+ if (l.value = null, $.value = null, p.value = !1, c.value = !1, x.value = !0, v) {
702
+ p.value = !0;
703
+ try {
704
+ const s = await v();
705
+ l.value = (s == null ? void 0 : s.nsRecord) ?? null, $.value = (s == null ? void 0 : s.replica) ?? null;
706
+ } catch (s) {
707
+ l.value = { error: (s == null ? void 0 : s.message) ?? "Failed to fetch" };
708
+ } finally {
709
+ p.value = !1;
710
+ }
711
+ }
712
+ }
713
+ function w() {
714
+ x.value = !1, l.value = null, $.value = null, h.value = !1;
715
+ }
716
+ function b() {
717
+ var v;
718
+ (v = window.navigator.clipboard) == null || v.writeText(JSON.stringify(l.value, null, 2)), _.value = !0, setTimeout(() => _.value = !1, 2e3);
719
+ }
720
+ const R = B(() => l.value ? Object.entries(l.value).filter(
721
+ ([v, s]) => /^cust[^_]+_/.test(v) && s !== null && s !== void 0 && s !== ""
722
+ ).map(([v, s]) => ({ key: v, val: s })) : []), V = f(!1), J = f(null), Q = f(!1);
723
+ async function K() {
724
+ var v;
725
+ if ((v = l.value) != null && v.id) {
726
+ V.value = !0, J.value = null, Q.value = !1;
727
+ try {
728
+ await S.triggerWebHook({
729
+ event: "edit",
730
+ recordId: l.value.id,
731
+ recordType: "assemblyitem"
732
+ }), Q.value = !0, setTimeout(() => Q.value = !1, 3e3);
733
+ } catch (s) {
734
+ J.value = (s == null ? void 0 : s.message) ?? "Failed to trigger webhook";
735
+ } finally {
736
+ V.value = !1;
737
+ }
738
+ }
739
+ }
740
+ return P({ open: A, close: w }), (v, s) => {
741
+ var D;
742
+ return t(), H(g(n), {
743
+ modelValue: x.value,
744
+ "onUpdate:modelValue": s[2] || (s[2] = (d) => x.value = d),
745
+ header: `Assembly / BOM · ${((D = l.value) == null ? void 0 : D.id) ?? "…"}`,
746
+ "max-width": 840
747
+ }, {
748
+ "side-sheet-footer": te(() => {
749
+ var d;
750
+ return [
751
+ e("div", Ca, [
752
+ e("div", Ia, [
753
+ Q.value ? (t(), a("span", Ta, "Webhook triggered!")) : J.value ? (t(), a("span", Da, o(J.value), 1)) : r("", !0)
754
+ ]),
755
+ e("div", La, [
756
+ (d = l.value) != null && d.id ? (t(), H(g(N), {
757
+ key: 0,
758
+ variant: "secondary",
759
+ disabled: V.value || p.value,
760
+ label: V.value ? "Triggering…" : "Trigger Webhook",
761
+ onClick: K
762
+ }, null, 8, ["disabled", "label"])) : r("", !0),
763
+ T(g(N), {
764
+ variant: "tertiary",
765
+ label: "Close",
766
+ onClick: w
767
+ })
768
+ ])
769
+ ])
770
+ ];
771
+ }),
772
+ default: te(() => {
773
+ var d, y, L, E, I;
774
+ return [
775
+ e("div", bs, [
776
+ e("div", _s, [
777
+ T(g(k), {
778
+ label: "Assembly / BOM",
779
+ compact: ""
780
+ }),
781
+ (d = l.value) != null && d.isInactive ? (t(), H(g(k), {
782
+ key: 0,
783
+ label: "Inactive",
784
+ compact: ""
785
+ })) : r("", !0),
786
+ (y = l.value) != null && y.parent ? (t(), H(g(k), {
787
+ key: 1,
788
+ label: `Child of ${l.value.parent.refName}`,
789
+ compact: ""
790
+ }, null, 8, ["label"])) : r("", !0),
791
+ p.value ? (t(), H(g(k), {
792
+ key: 2,
793
+ label: "Loading…",
794
+ compact: ""
795
+ })) : r("", !0),
796
+ (L = $.value) != null && L.syncedAt ? (t(), H(g(k), {
797
+ key: 3,
798
+ label: `Last Synced: ${new Date($.value.syncedAt).toLocaleString()}`,
799
+ compact: ""
800
+ }, null, 8, ["label"])) : !p.value && l.value ? (t(), H(g(k), {
801
+ key: 4,
802
+ label: "Not synced",
803
+ compact: ""
804
+ })) : r("", !0)
805
+ ]),
806
+ p.value ? (t(), a("div", hs, [
807
+ T(g(F), { size: "md" })
808
+ ])) : l.value ? (t(), a("div", ks, [
809
+ e("div", $s, [
810
+ e("div", ws, [
811
+ s[3] || (s[3] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Item ID", -1)),
812
+ e("div", Ss, o(l.value.itemId), 1)
813
+ ]),
814
+ e("div", null, [
815
+ s[4] || (s[4] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "External ID", -1)),
816
+ e("div", Cs, o(l.value.externalId), 1)
817
+ ]),
818
+ e("div", null, [
819
+ s[5] || (s[5] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Internal ID", -1)),
820
+ e("div", Is, o(l.value.internalId), 1)
821
+ ]),
822
+ e("div", null, [
823
+ s[6] || (s[6] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Item Type", -1)),
824
+ e("div", Ts, o(l.value.itemType.refName), 1)
825
+ ]),
826
+ l.value.parent ? (t(), a("div", Ds, [
827
+ s[7] || (s[7] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Parent Item", -1)),
828
+ e("div", Ls, o(l.value.parent.id), 1),
829
+ e("div", Fs, o(l.value.parent.refName), 1)
830
+ ])) : r("", !0),
831
+ e("div", null, [
832
+ s[8] || (s[8] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Currency", -1)),
833
+ e("div", Rs, o(l.value.currency.refName), 1)
834
+ ]),
835
+ e("div", null, [
836
+ s[9] || (s[9] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Created", -1)),
837
+ e("div", Ns, o(l.value.createdDate), 1)
838
+ ]),
839
+ e("div", null, [
840
+ s[10] || (s[10] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Last Modified", -1)),
841
+ e("div", Os, o(l.value.lastModifiedDate), 1)
842
+ ])
843
+ ]),
844
+ e("div", Vs, [
845
+ s[14] || (s[14] = e("div", { class: "text-xs font-semibold text-gray-500 uppercase tracking-wide mb-3" }, " Costing ", -1)),
846
+ e("div", Us, [
847
+ e("div", null, [
848
+ s[11] || (s[11] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Cost", -1)),
849
+ e("div", Bs, o(l.value.cost), 1)
850
+ ]),
851
+ e("div", null, [
852
+ s[12] || (s[12] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Average Cost", -1)),
853
+ e("div", Ps, o(l.value.averageCost ?? "—"), 1)
854
+ ]),
855
+ e("div", null, [
856
+ s[13] || (s[13] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Costing Method", -1)),
857
+ e("div", As, o(l.value.costingMethod.refName), 1)
858
+ ])
859
+ ])
860
+ ]),
861
+ e("div", Es, [
862
+ s[19] || (s[19] = e("div", { class: "text-xs font-semibold text-gray-500 uppercase tracking-wide mb-3" }, "Units", -1)),
863
+ e("div", Ms, [
864
+ l.value.unitsType ? (t(), a("div", js, [
865
+ s[15] || (s[15] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Units Type", -1)),
866
+ e("div", qs, o(l.value.unitsType.refName), 1),
867
+ e("div", Js, o(l.value.unitsType.id), 1)
868
+ ])) : r("", !0),
869
+ e("div", null, [
870
+ s[16] || (s[16] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Base Unit ID", -1)),
871
+ e("div", zs, o(l.value.baseUnit), 1)
872
+ ]),
873
+ e("div", null, [
874
+ s[17] || (s[17] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, " Purchase Unit ID ", -1)),
875
+ e("div", Ws, o(l.value.purchaseUnit), 1)
876
+ ]),
877
+ e("div", null, [
878
+ s[18] || (s[18] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Stock Unit ID", -1)),
879
+ e("div", Qs, o(l.value.stockUnit), 1)
880
+ ])
881
+ ])
882
+ ]),
883
+ l.value.cogsAccount ? (t(), a("div", Hs, [
884
+ s[22] || (s[22] = e("div", { class: "text-xs font-semibold text-gray-500 uppercase tracking-wide mb-3" }, " COGS Account ", -1)),
885
+ e("div", Ks, [
886
+ e("div", null, [
887
+ s[20] || (s[20] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "ID", -1)),
888
+ e("div", Ys, o(l.value.cogsAccount.id), 1)
889
+ ]),
890
+ e("div", null, [
891
+ s[21] || (s[21] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Name", -1)),
892
+ e("div", Gs, o(l.value.cogsAccount.refName), 1)
893
+ ])
894
+ ])
895
+ ])) : r("", !0),
896
+ l.value.subsidiary.items.length > 0 ? (t(), a("div", Xs, [
897
+ e("div", Zs, " Subsidiaries (" + o(l.value.subsidiary.totalResults) + ") ", 1),
898
+ e("div", ea, [
899
+ s[23] || (s[23] = e("span", { class: "text-xs text-gray-500 uppercase tracking-wide" }, "Include Children: ", -1)),
900
+ e("span", ta, o(l.value.includeChildren ? "Yes" : "No"), 1)
901
+ ]),
902
+ e("div", sa, [
903
+ (t(!0), a(M, null, X(l.value.subsidiary.items, (C) => (t(), a("span", {
904
+ key: C.id,
905
+ class: "px-2 py-0.5 rounded-full text-xs border bg-gray-50 border-gray-200 text-gray-700",
906
+ title: C.id
907
+ }, o(C.refName), 9, aa))), 128))
908
+ ])
909
+ ])) : r("", !0),
910
+ ((E = l.value.itemVendor) == null ? void 0 : E.totalResults) > 0 ? (t(), a("div", oa, [
911
+ e("div", la, " Vendors (" + o(l.value.itemVendor.totalResults) + ") ", 1),
912
+ e("div", ra, [
913
+ e("table", na, [
914
+ s[24] || (s[24] = e("thead", { class: "bg-gray-50 border-b border-gray-200" }, [
915
+ e("tr", null, [
916
+ e("th", { class: "text-left px-3 py-2 font-medium text-gray-600" }, "#"),
917
+ e("th", { class: "text-left px-3 py-2 font-medium text-gray-600" }, "Vendor"),
918
+ e("th", { class: "text-left px-3 py-2 font-medium text-gray-600" }, "Subsidiary"),
919
+ e("th", { class: "text-left px-3 py-2 font-medium text-gray-600" }, "Currency"),
920
+ e("th", { class: "text-right px-3 py-2 font-medium text-gray-600" }, "Price")
921
+ ])
922
+ ], -1)),
923
+ e("tbody", null, [
924
+ (t(!0), a(M, null, X(l.value.itemVendor.items, (C, Y) => {
925
+ var Z, O, u;
926
+ return t(), a("tr", {
927
+ key: Y,
928
+ class: "border-b border-gray-100 last:border-0"
929
+ }, [
930
+ e("td", ia, o(Y + 1), 1),
931
+ e("td", da, [
932
+ e("div", ua, o(((Z = C.vendor) == null ? void 0 : Z.refName) ?? "—"), 1),
933
+ (O = C.vendor) != null && O.id ? (t(), a("div", ca, " ID: " + o(C.vendor.id), 1)) : r("", !0),
934
+ C.vendorCode ? (t(), a("div", va, " Code: " + o(C.vendorCode), 1)) : r("", !0)
935
+ ]),
936
+ e("td", pa, o(((u = C.subsidiary) == null ? void 0 : u.refName) ?? "—"), 1),
937
+ e("td", ya, o(C.vendorCurrencyName ?? "—"), 1),
938
+ e("td", xa, o(C.purchasePrice ?? "—"), 1)
939
+ ]);
940
+ }), 128))
941
+ ])
942
+ ])
943
+ ])
944
+ ])) : r("", !0),
945
+ R.value.length > 0 ? (t(), a("div", ma, [
946
+ s[25] || (s[25] = e("div", { class: "text-xs font-semibold text-amber-700 uppercase tracking-wide mb-3" }, " Custom Fields ", -1)),
947
+ e("div", ga, [
948
+ (t(!0), a(M, null, X(R.value, (C) => (t(), a("div", {
949
+ key: C.key
950
+ }, [
951
+ e("div", fa, o(C.key), 1),
952
+ C.val && typeof C.val == "object" && "refName" in C.val ? (t(), a(M, { key: 0 }, [
953
+ e("div", ba, o(C.val.refName), 1),
954
+ C.val.id ? (t(), a("div", _a, " ID: " + o(C.val.id), 1)) : r("", !0)
955
+ ], 64)) : (t(), a("div", ha, o(C.val), 1))
956
+ ]))), 128))
957
+ ])
958
+ ])) : r("", !0)
959
+ ])) : r("", !0),
960
+ l.value ? (t(), a("div", ka, [
961
+ e("div", {
962
+ class: j(["flex items-center gap-1.5 px-3 py-2 bg-gray-50 cursor-pointer select-none hover:bg-gray-100 transition-colors", c.value ? "border-b border-gray-200" : ""]),
963
+ onClick: s[0] || (s[0] = (C) => c.value = !c.value)
964
+ }, [
965
+ (t(), a("svg", {
966
+ class: j(["w-3.5 h-3.5 transition-transform text-gray-500", c.value ? "rotate-90" : ""]),
967
+ fill: "none",
968
+ stroke: "currentColor",
969
+ viewBox: "0 0 24 24"
970
+ }, s[26] || (s[26] = [
971
+ e("path", {
972
+ "stroke-linecap": "round",
973
+ "stroke-linejoin": "round",
974
+ "stroke-width": "2",
975
+ d: "M9 5l7 7-7 7"
976
+ }, null, -1)
977
+ ]), 2)),
978
+ s[27] || (s[27] = e("span", { class: "text-xs font-medium text-gray-600" }, "(NetSuite) Raw JSON", -1)),
979
+ c.value ? (t(), a("button", {
980
+ key: 0,
981
+ class: j(["ml-auto text-xs flex items-center gap-1 transition-colors", _.value ? "text-green-600" : "text-gray-400 hover:text-gray-700"]),
982
+ onClick: de(b, ["stop"])
983
+ }, o(_.value ? "Copied!" : "Copy JSON"), 3)) : r("", !0)
984
+ ], 2),
985
+ c.value ? (t(), a("div", $a, [
986
+ T(ye, { value: l.value }, null, 8, ["value"])
987
+ ])) : r("", !0)
988
+ ])) : r("", !0),
989
+ (I = l.value) != null && I.id ? (t(), a("div", wa, [
990
+ e("div", {
991
+ class: j(["flex items-center gap-1.5 px-3 py-2 bg-gray-50 cursor-pointer select-none hover:bg-gray-100 transition-colors", h.value ? "border-b border-gray-200" : ""]),
992
+ onClick: s[1] || (s[1] = (C) => h.value = !h.value)
993
+ }, [
994
+ (t(), a("svg", {
995
+ class: j(["w-3.5 h-3.5 transition-transform text-gray-500", h.value ? "rotate-90" : ""]),
996
+ fill: "none",
997
+ stroke: "currentColor",
998
+ viewBox: "0 0 24 24"
999
+ }, s[28] || (s[28] = [
1000
+ e("path", {
1001
+ "stroke-linecap": "round",
1002
+ "stroke-linejoin": "round",
1003
+ "stroke-width": "2",
1004
+ d: "M9 5l7 7-7 7"
1005
+ }, null, -1)
1006
+ ]), 2)),
1007
+ s[29] || (s[29] = e("span", { class: "text-xs font-medium text-gray-600" }, "Sync Logs", -1))
1008
+ ], 2),
1009
+ h.value ? (t(), a("div", Sa, [
1010
+ T(ve, {
1011
+ "netsuite-id": l.value.id,
1012
+ "record-type": "assemblyItem"
1013
+ }, null, 8, ["netsuite-id"])
1014
+ ])) : r("", !0)
1015
+ ])) : r("", !0)
1016
+ ])
1017
+ ];
1018
+ }),
1019
+ _: 1
1020
+ }, 8, ["modelValue", "header"]);
1021
+ };
1022
+ }
1023
+ }), Ra = { class: "p-6 space-y-6" }, Na = { class: "flex flex-wrap gap-2" }, Oa = {
1024
+ key: 0,
1025
+ class: "flex justify-center py-8"
1026
+ }, Va = {
1027
+ key: 1,
1028
+ class: "space-y-6"
1029
+ }, Ua = { class: "grid grid-cols-2 gap-x-8 gap-y-4 text-sm" }, Ba = { class: "col-span-2" }, Pa = { class: "font-semibold text-base" }, Aa = { class: "font-mono font-medium" }, Ea = { class: "font-mono font-medium" }, Ma = { class: "font-medium" }, ja = { class: "font-medium" }, qa = { class: "font-medium" }, Ja = { class: "font-medium" }, za = { class: "font-medium" }, Wa = { class: "p-3 bg-gray-50 border border-gray-200 rounded-lg" }, Qa = { class: "grid grid-cols-2 gap-x-8 gap-y-3 text-sm" }, Ha = { class: "font-medium" }, Ka = { class: "font-mono text-xs text-gray-400" }, Ya = { class: "font-mono text-xs" }, Ga = { class: "font-mono text-xs" }, Xa = { class: "font-mono text-xs" }, Za = { key: 0 }, eo = { class: "text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2" }, to = { class: "mb-2 text-sm" }, so = { class: "font-medium" }, ao = { class: "flex flex-wrap gap-1.5" }, oo = ["title"], lo = { key: 1 }, ro = { class: "text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2" }, no = { class: "border border-gray-200 rounded-lg overflow-hidden" }, io = { class: "w-full text-sm" }, uo = { class: "px-3 py-2 font-mono text-xs text-gray-400" }, co = { class: "px-3 py-2" }, vo = { class: "font-medium" }, po = {
1030
+ key: 0,
1031
+ class: "text-xs text-gray-400 font-mono"
1032
+ }, yo = {
1033
+ key: 1,
1034
+ class: "text-xs text-gray-400"
1035
+ }, xo = { class: "px-3 py-2 text-gray-600 text-xs" }, mo = { class: "px-3 py-2 text-gray-600 text-xs" }, go = { class: "px-3 py-2 text-right font-mono" }, fo = {
1036
+ key: 2,
1037
+ class: "p-3 bg-amber-50 border border-amber-200 rounded-lg"
1038
+ }, bo = { class: "grid grid-cols-2 gap-x-8 gap-y-3 text-sm" }, _o = { class: "text-xs text-amber-600 font-mono mb-0.5" }, ho = { class: "font-medium text-xs" }, ko = {
1039
+ key: 0,
1040
+ class: "text-xs text-gray-400 font-mono"
1041
+ }, $o = {
1042
+ key: 1,
1043
+ class: "font-mono text-xs text-gray-800"
1044
+ }, wo = {
1045
+ key: 3,
1046
+ class: "border border-gray-200 rounded-lg overflow-hidden"
1047
+ }, So = { key: 0 }, Co = {
1048
+ key: 4,
1049
+ class: "border border-gray-200 rounded-lg overflow-hidden"
1050
+ }, Io = {
1051
+ key: 0,
1052
+ class: "p-4"
1053
+ }, To = { class: "flex items-center justify-between gap-3" }, Do = { class: "text-xs" }, Lo = {
1054
+ key: 0,
1055
+ class: "text-green-600 font-medium"
1056
+ }, Fo = {
1057
+ key: 1,
1058
+ class: "text-red-500"
1059
+ }, Ro = { class: "flex gap-2" }, No = /* @__PURE__ */ ne({
1060
+ __name: "ServiceItemSideSheet",
1061
+ setup(W, { expose: P }) {
1062
+ const { FmSideSheet: n, FmButton: N, FmChip: k, FmCircularProgress: F } = oe, S = ce(), x = f(!1), l = f(null), $ = f(null), p = f(!1), c = f(!1), _ = f(!1), h = f(!1);
1063
+ async function A(v) {
1064
+ if (l.value = null, $.value = null, p.value = !1, c.value = !1, x.value = !0, v) {
1065
+ p.value = !0;
1066
+ try {
1067
+ const s = await v();
1068
+ l.value = (s == null ? void 0 : s.nsRecord) ?? null, $.value = (s == null ? void 0 : s.replica) ?? null;
1069
+ } catch (s) {
1070
+ l.value = { error: (s == null ? void 0 : s.message) ?? "Failed to fetch" };
1071
+ } finally {
1072
+ p.value = !1;
1073
+ }
1074
+ }
1075
+ }
1076
+ function w() {
1077
+ x.value = !1, l.value = null, $.value = null, h.value = !1;
1078
+ }
1079
+ function b() {
1080
+ var v;
1081
+ (v = window.navigator.clipboard) == null || v.writeText(JSON.stringify(l.value, null, 2)), _.value = !0, setTimeout(() => _.value = !1, 2e3);
1082
+ }
1083
+ const R = B(() => l.value ? Object.entries(l.value).filter(
1084
+ ([v, s]) => /^cust[^_]+_/.test(v) && s !== null && s !== void 0 && s !== ""
1085
+ ).map(([v, s]) => ({ key: v, val: s })) : []), V = f(!1), J = f(null), Q = f(!1);
1086
+ async function K() {
1087
+ var v;
1088
+ if ((v = l.value) != null && v.id) {
1089
+ V.value = !0, J.value = null, Q.value = !1;
1090
+ try {
1091
+ await S.triggerWebHook({
1092
+ event: "edit",
1093
+ recordId: l.value.id,
1094
+ recordType: "serviceitem"
1095
+ }), Q.value = !0, setTimeout(() => Q.value = !1, 3e3);
1096
+ } catch (s) {
1097
+ J.value = (s == null ? void 0 : s.message) ?? "Failed to trigger webhook";
1098
+ } finally {
1099
+ V.value = !1;
1100
+ }
1101
+ }
1102
+ }
1103
+ return P({ open: A, close: w }), (v, s) => {
1104
+ var D;
1105
+ return t(), H(g(n), {
1106
+ modelValue: x.value,
1107
+ "onUpdate:modelValue": s[2] || (s[2] = (d) => x.value = d),
1108
+ header: `Service Item · ${((D = l.value) == null ? void 0 : D.id) ?? "…"}`,
1109
+ "max-width": 840
1110
+ }, {
1111
+ "side-sheet-footer": te(() => {
1112
+ var d;
1113
+ return [
1114
+ e("div", To, [
1115
+ e("div", Do, [
1116
+ Q.value ? (t(), a("span", Lo, "Webhook triggered!")) : J.value ? (t(), a("span", Fo, o(J.value), 1)) : r("", !0)
1117
+ ]),
1118
+ e("div", Ro, [
1119
+ (d = l.value) != null && d.id ? (t(), H(g(N), {
1120
+ key: 0,
1121
+ variant: "secondary",
1122
+ disabled: V.value || p.value,
1123
+ label: V.value ? "Triggering…" : "Trigger Webhook",
1124
+ onClick: K
1125
+ }, null, 8, ["disabled", "label"])) : r("", !0),
1126
+ T(g(N), {
1127
+ variant: "tertiary",
1128
+ label: "Close",
1129
+ onClick: w
1130
+ })
1131
+ ])
1132
+ ])
1133
+ ];
1134
+ }),
1135
+ default: te(() => {
1136
+ var d, y, L, E, I, C, Y, Z, O, u, i, m;
1137
+ return [
1138
+ e("div", Ra, [
1139
+ e("div", Na, [
1140
+ T(g(k), {
1141
+ label: "Service",
1142
+ compact: ""
1143
+ }),
1144
+ (d = l.value) != null && d.subtype ? (t(), H(g(k), {
1145
+ key: 0,
1146
+ label: l.value.subtype.refName,
1147
+ compact: ""
1148
+ }, null, 8, ["label"])) : r("", !0),
1149
+ (y = l.value) != null && y.isInactive ? (t(), H(g(k), {
1150
+ key: 1,
1151
+ label: "Inactive",
1152
+ compact: ""
1153
+ })) : r("", !0),
1154
+ p.value ? (t(), H(g(k), {
1155
+ key: 2,
1156
+ label: "Loading…",
1157
+ compact: ""
1158
+ })) : r("", !0),
1159
+ (L = $.value) != null && L.syncedAt ? (t(), H(g(k), {
1160
+ key: 3,
1161
+ label: `Last Synced: ${new Date($.value.syncedAt).toLocaleString()}`,
1162
+ compact: ""
1163
+ }, null, 8, ["label"])) : !p.value && l.value ? (t(), H(g(k), {
1164
+ key: 4,
1165
+ label: "Not synced",
1166
+ compact: ""
1167
+ })) : r("", !0)
1168
+ ]),
1169
+ p.value ? (t(), a("div", Oa, [
1170
+ T(g(F), { size: "md" })
1171
+ ])) : l.value ? (t(), a("div", Va, [
1172
+ e("div", Ua, [
1173
+ e("div", Ba, [
1174
+ s[3] || (s[3] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Item ID", -1)),
1175
+ e("div", Pa, o(l.value.itemId), 1)
1176
+ ]),
1177
+ e("div", null, [
1178
+ s[4] || (s[4] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "External ID", -1)),
1179
+ e("div", Aa, o(l.value.externalId), 1)
1180
+ ]),
1181
+ e("div", null, [
1182
+ s[5] || (s[5] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Internal ID", -1)),
1183
+ e("div", Ea, o(l.value.internalId), 1)
1184
+ ]),
1185
+ e("div", null, [
1186
+ s[6] || (s[6] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Item Type", -1)),
1187
+ e("div", Ma, o(((E = l.value.itemType) == null ? void 0 : E.refName) ?? "—"), 1)
1188
+ ]),
1189
+ e("div", null, [
1190
+ s[7] || (s[7] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Subtype", -1)),
1191
+ e("div", ja, o(((I = l.value.subtype) == null ? void 0 : I.refName) ?? "—"), 1)
1192
+ ]),
1193
+ e("div", null, [
1194
+ s[8] || (s[8] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Currency", -1)),
1195
+ e("div", qa, o(((C = l.value.currency) == null ? void 0 : C.refName) ?? "—"), 1)
1196
+ ]),
1197
+ e("div", null, [
1198
+ s[9] || (s[9] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Created", -1)),
1199
+ e("div", Ja, o(l.value.createdDate), 1)
1200
+ ]),
1201
+ e("div", null, [
1202
+ s[10] || (s[10] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Last Modified", -1)),
1203
+ e("div", za, o(l.value.lastModifiedDate), 1)
1204
+ ])
1205
+ ]),
1206
+ e("div", Wa, [
1207
+ s[15] || (s[15] = e("div", { class: "text-xs font-semibold text-gray-500 uppercase tracking-wide mb-3" }, "Units", -1)),
1208
+ e("div", Qa, [
1209
+ e("div", null, [
1210
+ s[11] || (s[11] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Units Type", -1)),
1211
+ e("div", Ha, o(((Y = l.value.unitsType) == null ? void 0 : Y.refName) ?? "—"), 1),
1212
+ e("div", Ka, o(((Z = l.value.unitsType) == null ? void 0 : Z.id) ?? "—"), 1)
1213
+ ]),
1214
+ e("div", null, [
1215
+ s[12] || (s[12] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Base Unit ID", -1)),
1216
+ e("div", Ya, o(l.value.baseUnit), 1)
1217
+ ]),
1218
+ e("div", null, [
1219
+ s[13] || (s[13] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, " Consumption Unit ID ", -1)),
1220
+ e("div", Ga, o(l.value.consumptionUnit), 1)
1221
+ ]),
1222
+ e("div", null, [
1223
+ s[14] || (s[14] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, " Purchase Unit ID ", -1)),
1224
+ e("div", Xa, o(l.value.purchaseUnit), 1)
1225
+ ])
1226
+ ])
1227
+ ]),
1228
+ ((u = (O = l.value.subsidiary) == null ? void 0 : O.items) == null ? void 0 : u.length) > 0 ? (t(), a("div", Za, [
1229
+ e("div", eo, " Subsidiaries (" + o(l.value.subsidiary.totalResults) + ") ", 1),
1230
+ e("div", to, [
1231
+ s[16] || (s[16] = e("span", { class: "text-xs text-gray-500 uppercase tracking-wide" }, "Include Children: ", -1)),
1232
+ e("span", so, o(l.value.includeChildren ? "Yes" : "No"), 1)
1233
+ ]),
1234
+ e("div", ao, [
1235
+ (t(!0), a(M, null, X(l.value.subsidiary.items, (U) => (t(), a("span", {
1236
+ key: U.id,
1237
+ class: "px-2 py-0.5 rounded-full text-xs border bg-gray-50 border-gray-200 text-gray-700",
1238
+ title: U.id
1239
+ }, o(U.refName), 9, oo))), 128))
1240
+ ])
1241
+ ])) : r("", !0),
1242
+ ((i = l.value.itemVendor) == null ? void 0 : i.totalResults) > 0 ? (t(), a("div", lo, [
1243
+ e("div", ro, " Vendors (" + o(l.value.itemVendor.totalResults) + ") ", 1),
1244
+ e("div", no, [
1245
+ e("table", io, [
1246
+ s[17] || (s[17] = e("thead", { class: "bg-gray-50 border-b border-gray-200" }, [
1247
+ e("tr", null, [
1248
+ e("th", { class: "text-left px-3 py-2 font-medium text-gray-600" }, "#"),
1249
+ e("th", { class: "text-left px-3 py-2 font-medium text-gray-600" }, "Vendor"),
1250
+ e("th", { class: "text-left px-3 py-2 font-medium text-gray-600" }, "Subsidiary"),
1251
+ e("th", { class: "text-left px-3 py-2 font-medium text-gray-600" }, "Currency"),
1252
+ e("th", { class: "text-right px-3 py-2 font-medium text-gray-600" }, "Price")
1253
+ ])
1254
+ ], -1)),
1255
+ e("tbody", null, [
1256
+ (t(!0), a(M, null, X(l.value.itemVendor.items, (U, z) => {
1257
+ var ae, G, ee;
1258
+ return t(), a("tr", {
1259
+ key: z,
1260
+ class: "border-b border-gray-100 last:border-0"
1261
+ }, [
1262
+ e("td", uo, o(z + 1), 1),
1263
+ e("td", co, [
1264
+ e("div", vo, o(((ae = U.vendor) == null ? void 0 : ae.refName) ?? "—"), 1),
1265
+ (G = U.vendor) != null && G.id ? (t(), a("div", po, " ID: " + o(U.vendor.id), 1)) : r("", !0),
1266
+ U.vendorCode ? (t(), a("div", yo, " Code: " + o(U.vendorCode), 1)) : r("", !0)
1267
+ ]),
1268
+ e("td", xo, o(((ee = U.subsidiary) == null ? void 0 : ee.refName) ?? "—"), 1),
1269
+ e("td", mo, o(U.vendorCurrencyName ?? "—"), 1),
1270
+ e("td", go, o(U.purchasePrice ?? "—"), 1)
1271
+ ]);
1272
+ }), 128))
1273
+ ])
1274
+ ])
1275
+ ])
1276
+ ])) : r("", !0)
1277
+ ])) : r("", !0),
1278
+ R.value.length > 0 ? (t(), a("div", fo, [
1279
+ s[18] || (s[18] = e("div", { class: "text-xs font-semibold text-amber-700 uppercase tracking-wide mb-3" }, " Custom Fields ", -1)),
1280
+ e("div", bo, [
1281
+ (t(!0), a(M, null, X(R.value, (U) => (t(), a("div", {
1282
+ key: U.key
1283
+ }, [
1284
+ e("div", _o, o(U.key), 1),
1285
+ U.val && typeof U.val == "object" && "refName" in U.val ? (t(), a(M, { key: 0 }, [
1286
+ e("div", ho, o(U.val.refName), 1),
1287
+ U.val.id ? (t(), a("div", ko, "ID: " + o(U.val.id), 1)) : r("", !0)
1288
+ ], 64)) : (t(), a("div", $o, o(U.val), 1))
1289
+ ]))), 128))
1290
+ ])
1291
+ ])) : r("", !0),
1292
+ l.value ? (t(), a("div", wo, [
1293
+ e("div", {
1294
+ class: j(["flex items-center gap-1.5 px-3 py-2 bg-gray-50 cursor-pointer select-none hover:bg-gray-100 transition-colors", c.value ? "border-b border-gray-200" : ""]),
1295
+ onClick: s[0] || (s[0] = (U) => c.value = !c.value)
1296
+ }, [
1297
+ (t(), a("svg", {
1298
+ class: j(["w-3.5 h-3.5 transition-transform text-gray-500", c.value ? "rotate-90" : ""]),
1299
+ fill: "none",
1300
+ stroke: "currentColor",
1301
+ viewBox: "0 0 24 24"
1302
+ }, s[19] || (s[19] = [
1303
+ e("path", {
1304
+ "stroke-linecap": "round",
1305
+ "stroke-linejoin": "round",
1306
+ "stroke-width": "2",
1307
+ d: "M9 5l7 7-7 7"
1308
+ }, null, -1)
1309
+ ]), 2)),
1310
+ s[20] || (s[20] = e("span", { class: "text-xs font-medium text-gray-600" }, "(NetSuite) Raw JSON", -1)),
1311
+ c.value ? (t(), a("button", {
1312
+ key: 0,
1313
+ class: j(["ml-auto text-xs flex items-center gap-1 transition-colors", _.value ? "text-green-600" : "text-gray-400 hover:text-gray-700"]),
1314
+ onClick: de(b, ["stop"])
1315
+ }, o(_.value ? "Copied!" : "Copy JSON"), 3)) : r("", !0)
1316
+ ], 2),
1317
+ c.value ? (t(), a("div", So, [
1318
+ T(ye, { value: l.value }, null, 8, ["value"])
1319
+ ])) : r("", !0)
1320
+ ])) : r("", !0),
1321
+ (m = l.value) != null && m.id ? (t(), a("div", Co, [
1322
+ e("div", {
1323
+ class: j(["flex items-center gap-1.5 px-3 py-2 bg-gray-50 cursor-pointer select-none hover:bg-gray-100 transition-colors", h.value ? "border-b border-gray-200" : ""]),
1324
+ onClick: s[1] || (s[1] = (U) => h.value = !h.value)
1325
+ }, [
1326
+ (t(), a("svg", {
1327
+ class: j(["w-3.5 h-3.5 transition-transform text-gray-500", h.value ? "rotate-90" : ""]),
1328
+ fill: "none",
1329
+ stroke: "currentColor",
1330
+ viewBox: "0 0 24 24"
1331
+ }, s[21] || (s[21] = [
1332
+ e("path", {
1333
+ "stroke-linecap": "round",
1334
+ "stroke-linejoin": "round",
1335
+ "stroke-width": "2",
1336
+ d: "M9 5l7 7-7 7"
1337
+ }, null, -1)
1338
+ ]), 2)),
1339
+ s[22] || (s[22] = e("span", { class: "text-xs font-medium text-gray-600" }, "Sync Logs", -1))
1340
+ ], 2),
1341
+ h.value ? (t(), a("div", Io, [
1342
+ T(ve, {
1343
+ "netsuite-id": l.value.id,
1344
+ "record-type": "serviceItem"
1345
+ }, null, 8, ["netsuite-id"])
1346
+ ])) : r("", !0)
1347
+ ])) : r("", !0)
1348
+ ])
1349
+ ];
1350
+ }),
1351
+ _: 1
1352
+ }, 8, ["modelValue", "header"]);
1353
+ };
1354
+ }
1355
+ }), Oo = { class: "flex flex-col gap-4" }, Vo = { class: "flex gap-1 p-1 bg-gray-100 rounded-lg w-fit" }, Uo = ["onClick"], Bo = { class: "flex flex-wrap gap-3 items-end" }, Po = {
1356
+ key: 0,
1357
+ class: "flex flex-col gap-2"
1358
+ }, Ao = { class: "flex items-center gap-2" }, Eo = ["value"], Mo = { class: "flex flex-col gap-1" }, jo = { class: "text-xs text-gray-500 font-medium" }, qo = {
1359
+ key: 0,
1360
+ class: "text-gray-400 font-normal"
1361
+ }, Jo = {
1362
+ key: 1,
1363
+ class: "px-3 py-2 text-sm font-mono bg-gray-50 border border-gray-200 rounded-lg text-gray-700 min-w-[28rem] min-h-9 whitespace-pre-wrap"
1364
+ }, zo = { class: "flex flex-wrap gap-4 items-center" }, Wo = { class: "flex items-center gap-1.5 ml-auto" }, Qo = {
1365
+ key: 0,
1366
+ class: "p-3 bg-red-50 border border-red-200 rounded-lg text-sm text-red-700"
1367
+ }, Ho = {
1368
+ key: 1,
1369
+ class: "flex justify-center py-8"
1370
+ }, Ko = {
1371
+ key: 3,
1372
+ class: "text-center py-8 text-gray-400"
1373
+ }, Yo = {
1374
+ key: 4,
1375
+ class: "text-center py-8 text-gray-400"
1376
+ }, Go = /* @__PURE__ */ ne({
1377
+ __name: "ItemsView",
1378
+ setup(W) {
1379
+ const P = ce(), n = Ie();
1380
+ _e(async () => {
1381
+ n.state.itemReplicas.length === 0 && await n.getAllItemReplicas();
1382
+ });
1383
+ const N = f(), k = f(), F = f(), S = f("lookup"), x = f("id"), l = f(""), $ = f(""), p = B(() => {
1384
+ if (x.value === "custom") return $.value;
1385
+ const v = l.value.split(",").map((s) => s.trim()).filter(Boolean);
1386
+ return v.length === 0 ? "" : x.value === "id" ? `item.id IN (${v.join(", ")})` : `UPPER(item.itemid) LIKE '%${l.value.toUpperCase()}%'`;
1387
+ });
1388
+ function c(v) {
1389
+ v === "custom" && ($.value = p.value), x.value = v;
1390
+ }
1391
+ const _ = f(""), h = f(!1), A = f(null), w = f([]), b = f(null);
1392
+ async function R() {
1393
+ h.value = !0, A.value = null, w.value = [];
1394
+ try {
1395
+ if (S.value === "lookup") {
1396
+ const v = p.value.trim();
1397
+ if (!v) {
1398
+ A.value = "Build or enter a WHERE clause";
1399
+ return;
1400
+ }
1401
+ w.value = await P.browseItemsByFilter(v);
1402
+ } else
1403
+ w.value = await P.browseItemsByFilter();
1404
+ } catch (v) {
1405
+ A.value = (v == null ? void 0 : v.message) || "Failed to fetch items";
1406
+ } finally {
1407
+ h.value = !1;
1408
+ }
1409
+ }
1410
+ const V = [
1411
+ {
1412
+ key: "itemType",
1413
+ type: "string",
1414
+ entity: "item",
1415
+ values: Object.values(be.Values)
1416
+ }
1417
+ ], J = B(() => {
1418
+ var s;
1419
+ let v = w.value;
1420
+ if (b.value) {
1421
+ const D = he.build(b.value);
1422
+ v = v.filter((d) => ke({ itemType: d.itemType }, D));
1423
+ }
1424
+ if ((s = _.value) != null && s.trim()) {
1425
+ const D = _.value.toLowerCase();
1426
+ v = v.filter(
1427
+ (d) => {
1428
+ var y, L;
1429
+ return ((y = d.name) == null ? void 0 : y.toLowerCase().includes(D)) || ((L = d.recordId) == null ? void 0 : L.toLowerCase().includes(D));
1430
+ }
1431
+ );
1432
+ }
1433
+ return v;
1434
+ });
1435
+ function Q(v) {
1436
+ var d, y, L;
1437
+ const s = v.original, D = () => P.readItemById(s.itemType, s.recordId);
1438
+ s.itemType === be.Enum.InvtPart ? (d = N.value) == null || d.open(D) : s.itemType === be.Enum.Assembly ? (y = k.value) == null || y.open(D) : (L = F.value) == null || L.open(D);
1439
+ }
1440
+ const K = [
1441
+ {
1442
+ id: "nsItem",
1443
+ header: () => "NetSuite Item",
1444
+ accessorFn: (v) => `${v.name} ${v.recordId}`,
1445
+ cell(v) {
1446
+ const s = v.row.original;
1447
+ return q("div", { class: "flex flex-col" }, [
1448
+ q("span", { class: "font-medium" }, s.name || "Unnamed"),
1449
+ q("span", { class: "text-xs text-gray-400" }, `ID: ${s.recordId}`)
1450
+ ]);
1451
+ }
1452
+ },
1453
+ {
1454
+ id: "itemType",
1455
+ header: () => "Type",
1456
+ accessorFn: (v) => v.itemType,
1457
+ cell(v) {
1458
+ return q(
1459
+ "span",
1460
+ { class: "text-sm" },
1461
+ v.row.original.itemType
1462
+ );
1463
+ }
1464
+ },
1465
+ {
1466
+ id: "skuInSystem",
1467
+ header: () => "SKU in our system",
1468
+ accessorFn: (v) => {
1469
+ const s = n.state.itemReplicas.find((d) => d.netSuiteId === v.recordId), D = s == null ? void 0 : s.skuCache;
1470
+ return `${(D == null ? void 0 : D.name) || ""} ${(D == null ? void 0 : D._id) || ""} ${(D == null ? void 0 : D.code) || ""}`;
1471
+ },
1472
+ cell(v) {
1473
+ const s = v.row.original, D = n.state.itemReplicas.find((y) => y.netSuiteId === s.recordId);
1474
+ if (!D)
1475
+ return q("span", { class: "text-gray-300 text-sm" }, "—");
1476
+ if (D.parentNetSuiteId)
1477
+ return q("div", { class: "text-gray-400 text-sm" }, "Child Item");
1478
+ const d = D.skuCache;
1479
+ return d ? q("div", { class: "flex items-center gap-2" }, [
1480
+ q(oe.FmIcon, {
1481
+ name: "grocery",
1482
+ color: "neutral-gray-400",
1483
+ size: "md",
1484
+ outline: !0
1485
+ }),
1486
+ q("div", { class: "flex flex-col" }, [
1487
+ q("span", { class: "font-medium" }, d.name),
1488
+ q("span", { class: "text-xs text-gray-400" }, `ID: ${d._id}`),
1489
+ q("span", { class: "text-xs text-gray-400" }, `Code: ${d.code}`)
1490
+ ])
1491
+ ]) : q("div", { class: "text-sm" }, "Unknown Ingredient");
1492
+ }
1493
+ },
1494
+ {
1495
+ id: "syncedAt",
1496
+ header: () => "Synced At",
1497
+ accessorKey: "syncedAt",
1498
+ size: 160,
1499
+ cell(v) {
1500
+ const s = v.getValue();
1501
+ return s ? q("span", { class: "text-sm" }, new Date(s).toLocaleString()) : q("span", { class: "text-gray-300 text-sm" }, "—");
1502
+ }
1503
+ }
1504
+ ];
1505
+ return (v, s) => {
1506
+ const D = se("FmTextarea"), d = se("FmButton"), y = se("FmTextField");
1507
+ return t(), a("div", Oo, [
1508
+ e("div", Vo, [
1509
+ (t(), a(M, null, X([
1510
+ { key: "lookup", label: "Lookup by Query" },
1511
+ { key: "all", label: "All Items" }
1512
+ ], (L) => e("button", {
1513
+ key: L.key,
1514
+ class: j([
1515
+ "px-3 py-1.5 text-sm rounded-md transition-colors",
1516
+ S.value === L.key ? "bg-white text-gray-900 font-medium shadow-sm" : "text-gray-500 hover:text-gray-700"
1517
+ ]),
1518
+ onClick: (E) => S.value = L.key
1519
+ }, o(L.label), 11, Uo)), 64))
1520
+ ]),
1521
+ e("div", Bo, [
1522
+ S.value === "lookup" ? (t(), a("div", Po, [
1523
+ e("div", Ao, [
1524
+ e("select", {
1525
+ value: x.value,
1526
+ class: "h-9 px-2 text-sm border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500",
1527
+ onChange: s[0] || (s[0] = (L) => c(L.target.value))
1528
+ }, s[5] || (s[5] = [
1529
+ e("option", { value: "id" }, "id", -1),
1530
+ e("option", { value: "itemid" }, "itemid (name)", -1),
1531
+ e("option", { value: "custom" }, "custom…", -1)
1532
+ ]), 40, Eo),
1533
+ x.value !== "custom" ? Ve((t(), a("input", {
1534
+ key: 0,
1535
+ "onUpdate:modelValue": s[1] || (s[1] = (L) => l.value = L),
1536
+ type: "text",
1537
+ placeholder: "e.g. 1234, 5678",
1538
+ class: "h-9 px-3 text-sm border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 min-w-64",
1539
+ onKeydown: we(R, ["enter"])
1540
+ }, null, 544)), [
1541
+ [Ue, l.value]
1542
+ ]) : r("", !0)
1543
+ ]),
1544
+ e("div", Mo, [
1545
+ e("label", jo, [
1546
+ s[6] || (s[6] = re(" WHERE ")),
1547
+ x.value !== "custom" ? (t(), a("span", qo, "— switch to “custom…” to edit freely")) : r("", !0)
1548
+ ]),
1549
+ x.value === "custom" ? (t(), a(M, { key: 0 }, [
1550
+ T(D, {
1551
+ modelValue: $.value,
1552
+ "onUpdate:modelValue": s[2] || (s[2] = (L) => $.value = L),
1553
+ rows: "3",
1554
+ placeholder: "e.g. itemid LIKE '%latte%' OR custitem_brand = 'xyz'",
1555
+ class: "text-sm font-mono rounded-lg focus:outline-none min-w-[28rem] resize-y"
1556
+ }, null, 8, ["modelValue"]),
1557
+ s[7] || (s[7] = e("span", { class: "text-xs font-bold" }, [
1558
+ re(" WHERE clause syntax reference: "),
1559
+ e("a", {
1560
+ href: "https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_156257770590.html#subsect_156474852230",
1561
+ target: "_blank",
1562
+ class: "text-blue-600 hover:underline"
1563
+ }, "here")
1564
+ ], -1))
1565
+ ], 64)) : (t(), a("div", Jo, o(p.value || "—"), 1))
1566
+ ])
1567
+ ])) : r("", !0),
1568
+ T(d, {
1569
+ loading: h.value,
1570
+ disabled: h.value,
1571
+ icon: "play_arrow",
1572
+ label: "Fetch",
1573
+ onClick: R
1574
+ }, null, 8, ["loading", "disabled"])
1575
+ ]),
1576
+ e("div", zo, [
1577
+ T(g(De), {
1578
+ modelValue: b.value,
1579
+ "onUpdate:modelValue": s[3] || (s[3] = (L) => b.value = L),
1580
+ attributes: V
1581
+ }, null, 8, ["modelValue"]),
1582
+ e("div", Wo, [
1583
+ T(y, {
1584
+ modelValue: _.value,
1585
+ "onUpdate:modelValue": s[4] || (s[4] = (L) => _.value = L),
1586
+ type: "text",
1587
+ "prepend-icon": "search",
1588
+ placeholder: "Filter loaded results…",
1589
+ class: "h-8 px-2 text-sm border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
1590
+ }, null, 8, ["modelValue"])
1591
+ ])
1592
+ ]),
1593
+ A.value ? (t(), a("div", Qo, o(A.value), 1)) : r("", !0),
1594
+ h.value ? (t(), a("div", Ho, [
1595
+ T(g(oe).FmCircularProgress, { size: "md" })
1596
+ ])) : J.value.length > 0 ? (t(), H(g(oe).FmTable, {
1597
+ key: 2,
1598
+ "column-defs": K,
1599
+ "row-data": J.value,
1600
+ class: "cursor-pointer",
1601
+ onRowClick: Q
1602
+ }, null, 8, ["row-data"])) : !h.value && !A.value && w.value.length === 0 ? (t(), a("div", Ko, o(S.value === "lookup" ? 'Enter a NetSuite ID and click "Run" to lookup items' : 'Click "Run" to load all items directly from NetSuite'), 1)) : !h.value && J.value.length === 0 ? (t(), a("div", Yo, " No items match the current filters ")) : r("", !0),
1603
+ T(fs, {
1604
+ ref_key: "inventoryItemSideSheetRef",
1605
+ ref: N
1606
+ }, null, 512),
1607
+ T(Fa, {
1608
+ ref_key: "assemblyItemSideSheetRef",
1609
+ ref: k
1610
+ }, null, 512),
1611
+ T(No, {
1612
+ ref_key: "serviceItemSideSheetRef",
1613
+ ref: F
1614
+ }, null, 512)
1615
+ ]);
1616
+ };
1617
+ }
1618
+ }), Xo = { class: "flex flex-col gap-4" }, Zo = {
1619
+ key: 0,
1620
+ class: "flex flex-col gap-3"
1621
+ }, el = { class: "flex gap-3 items-end flex-wrap" }, tl = { class: "flex flex-col gap-1" }, sl = { class: "flex flex-col gap-1" }, al = { class: "flex flex-col gap-1 flex-1" }, ol = { class: "flex gap-2" }, ll = {
1622
+ key: 1,
1623
+ class: "flex flex-col gap-3"
1624
+ }, rl = { class: "flex gap-3 items-end flex-wrap" }, nl = {
1625
+ key: 0,
1626
+ class: "flex flex-col gap-1"
1627
+ }, il = {
1628
+ key: 1,
1629
+ class: "flex flex-col gap-1"
1630
+ }, dl = { class: "flex flex-col gap-1" }, ul = {
1631
+ key: 0,
1632
+ class: "text-xs text-red-600"
1633
+ }, cl = {
1634
+ key: 1,
1635
+ class: "flex items-center gap-4 flex-wrap"
1636
+ }, vl = { class: "flex gap-2 items-center ml-auto" }, pl = { class: "text-sm text-gray-500" }, Fe = /* @__PURE__ */ ne({
1637
+ __name: "ExplorerRecordToolbar",
1638
+ props: {
1639
+ activeUseCase: { default: "listByDate" },
1640
+ netsuiteIdInput: { default: "" },
1641
+ lookupRecordType: { default: "purchaseOrder" },
1642
+ lookupRecordTypeOptions: { default: void 0 },
1643
+ queryField: { default: "id" },
1644
+ dateRange: { default: () => ({ startDate: /* @__PURE__ */ new Date(), endDate: /* @__PURE__ */ new Date() }) },
1645
+ syncFilter: { default: "all" },
1646
+ filterRule: { default: null },
1647
+ searchValue: { default: "" },
1648
+ dateRangeError: { default: null },
1649
+ loading: { type: Boolean, default: !1 },
1650
+ stats: { default: () => ({ total: 0, synced: 0, unsynced: 0 }) },
1651
+ showDirection: { type: Boolean, default: !1 },
1652
+ direction: { default: "in" },
1653
+ showOrderTypeFilter: { type: Boolean, default: !1 },
1654
+ orderTypeFilter: { default: "all" }
1655
+ },
1656
+ emits: ["update:activeUseCase", "update:netsuiteIdInput", "update:lookupRecordType", "update:queryField", "update:dateRange", "update:syncFilter", "update:filterRule", "update:searchValue", "update:direction", "update:orderTypeFilter", "execute"],
1657
+ setup(W, { emit: P }) {
1658
+ const n = W, N = P, k = [
1659
+ { value: "lookup", label: "Lookup by Query" },
1660
+ { value: "listByDate", label: "List by Date Range" }
1661
+ ], F = [
1662
+ { value: "in", label: "Transfer In" },
1663
+ { value: "out", label: "Transfer Out" }
1664
+ ], S = [
1665
+ { value: "purchaseOrder", label: "Purchase Order" },
1666
+ { value: "transferOrder", label: "Transfer Order" },
1667
+ { value: "inventoryTransfer", label: "Inventory Transfer" }
1668
+ ], x = B(
1669
+ () => n.lookupRecordTypeOptions ?? S
1670
+ ), l = [
1671
+ { value: "all", label: "All Orders" },
1672
+ { value: "purchaseOrder", label: "Purchase Order" },
1673
+ { value: "transferOrder", label: "Transfer Order" }
1674
+ ], $ = [
1675
+ { value: "id", label: "NetSuite ID" },
1676
+ { value: "tranid", label: "Tran ID" }
1677
+ ], p = [
1678
+ {
1679
+ key: "syncStatus",
1680
+ type: "string",
1681
+ entity: "record",
1682
+ values: ["synced", "unsynced"]
1683
+ },
1684
+ {
1685
+ key: "recordType",
1686
+ type: "string",
1687
+ entity: "record",
1688
+ values: ["PurchOrd", "TrnfrOrd", "InvTrnfr"]
1689
+ }
1690
+ ];
1691
+ function c(w) {
1692
+ N("update:activeUseCase", w);
1693
+ }
1694
+ const _ = B(() => ({
1695
+ startDate: ue(n.dateRange.startDate),
1696
+ endDate: ue(n.dateRange.endDate)
1697
+ }));
1698
+ function h(w) {
1699
+ N("update:dateRange", {
1700
+ startDate: new Date(w.startDate),
1701
+ endDate: new Date(w.endDate)
1702
+ });
1703
+ }
1704
+ function A() {
1705
+ N("execute");
1706
+ }
1707
+ return (w, b) => {
1708
+ const R = se("FmTabs"), V = se("FmSelect"), J = se("FmTextField"), Q = se("FmIcon"), K = se("FmButton"), v = se("FmDateRangePicker"), s = se("FmSearch");
1709
+ return t(), a("div", Xo, [
1710
+ T(R, {
1711
+ "model-value": w.activeUseCase,
1712
+ items: k,
1713
+ "onUpdate:modelValue": c
1714
+ }, null, 8, ["model-value"]),
1715
+ w.activeUseCase === "lookup" ? (t(), a("div", Zo, [
1716
+ e("div", el, [
1717
+ e("div", tl, [
1718
+ b[7] || (b[7] = e("label", { class: "text-xs text-gray-500 font-medium" }, "Record Type", -1)),
1719
+ T(V, {
1720
+ "model-value": w.lookupRecordType,
1721
+ items: x.value,
1722
+ "onUpdate:modelValue": b[0] || (b[0] = (D) => N("update:lookupRecordType", D)),
1723
+ style: { width: "200px" }
1724
+ }, null, 8, ["model-value", "items"])
1725
+ ]),
1726
+ e("div", sl, [
1727
+ b[8] || (b[8] = e("label", { class: "text-xs text-gray-500 font-medium" }, "Query Field", -1)),
1728
+ T(V, {
1729
+ "model-value": w.queryField,
1730
+ items: $,
1731
+ "onUpdate:modelValue": b[1] || (b[1] = (D) => N("update:queryField", D)),
1732
+ style: { width: "150px" }
1733
+ }, null, 8, ["model-value"])
1734
+ ]),
1735
+ e("div", al, [
1736
+ b[9] || (b[9] = e("label", { class: "text-xs text-gray-500 font-medium" }, [
1737
+ re(" Query Value "),
1738
+ e("span", { class: "text-gray-400" }, "(comma-separated for multiple)")
1739
+ ], -1)),
1740
+ e("div", ol, [
1741
+ T(J, {
1742
+ "model-value": w.netsuiteIdInput,
1743
+ placeholder: w.queryField === "id" ? "e.g. 12345, 12346" : "e.g. PO123, PO124",
1744
+ "onUpdate:modelValue": b[2] || (b[2] = (D) => N("update:netsuiteIdInput", D)),
1745
+ onKeyup: we(A, ["enter"])
1746
+ }, null, 8, ["model-value", "placeholder"]),
1747
+ T(K, {
1748
+ label: "Run",
1749
+ variant: "primary",
1750
+ loading: w.loading,
1751
+ disabled: w.loading || !w.netsuiteIdInput.trim(),
1752
+ onClick: A
1753
+ }, {
1754
+ prepend: te(() => [
1755
+ T(Q, {
1756
+ name: "play_arrow",
1757
+ size: "sm"
1758
+ })
1759
+ ]),
1760
+ _: 1
1761
+ }, 8, ["loading", "disabled"])
1762
+ ])
1763
+ ])
1764
+ ])
1765
+ ])) : (t(), a("div", ll, [
1766
+ e("div", rl, [
1767
+ w.showOrderTypeFilter ? (t(), a("div", nl, [
1768
+ b[10] || (b[10] = e("label", { class: "text-xs text-gray-500 font-medium" }, "Order Type", -1)),
1769
+ T(V, {
1770
+ "model-value": w.orderTypeFilter,
1771
+ items: l,
1772
+ "onUpdate:modelValue": b[3] || (b[3] = (D) => N("update:orderTypeFilter", D)),
1773
+ style: { width: "180px" }
1774
+ }, null, 8, ["model-value"])
1775
+ ])) : r("", !0),
1776
+ w.showDirection ? (t(), a("div", il, [
1777
+ b[11] || (b[11] = e("label", { class: "text-xs text-gray-500 font-medium" }, "Direction", -1)),
1778
+ T(V, {
1779
+ "model-value": w.direction,
1780
+ items: F,
1781
+ "onUpdate:modelValue": b[4] || (b[4] = (D) => N("update:direction", D)),
1782
+ style: { width: "150px" }
1783
+ }, null, 8, ["model-value"])
1784
+ ])) : r("", !0),
1785
+ e("div", dl, [
1786
+ b[12] || (b[12] = e("label", { class: "text-xs text-gray-500 font-medium" }, "Date Range (max 6 months)", -1)),
1787
+ T(v, {
1788
+ "model-value": _.value,
1789
+ "onUpdate:modelValue": h
1790
+ }, null, 8, ["model-value"])
1791
+ ]),
1792
+ T(K, {
1793
+ label: "Run",
1794
+ variant: "primary",
1795
+ loading: w.loading,
1796
+ disabled: w.loading || !!w.dateRangeError,
1797
+ onClick: A
1798
+ }, {
1799
+ prepend: te(() => [
1800
+ T(Q, {
1801
+ name: "play_arrow",
1802
+ size: "sm"
1803
+ })
1804
+ ]),
1805
+ _: 1
1806
+ }, 8, ["loading", "disabled"])
1807
+ ]),
1808
+ w.dateRangeError ? (t(), a("div", ul, o(w.dateRangeError), 1)) : r("", !0),
1809
+ w.stats.total > 0 ? (t(), a("div", cl, [
1810
+ T(s, {
1811
+ "model-value": w.searchValue,
1812
+ "onUpdate:modelValue": b[5] || (b[5] = (D) => N("update:searchValue", D)),
1813
+ placeholder: "Search records...",
1814
+ class: "w-[300px]"
1815
+ }, null, 8, ["model-value"]),
1816
+ T(g(De), {
1817
+ "model-value": w.filterRule,
1818
+ "onUpdate:modelValue": b[6] || (b[6] = (D) => N("update:filterRule", D)),
1819
+ attributes: p
1820
+ }, null, 8, ["model-value"]),
1821
+ e("div", vl, [
1822
+ e("span", pl, " Total: " + o(w.stats.total) + " | Synced: " + o(w.stats.synced) + " | Unsynced: " + o(w.stats.unsynced), 1)
1823
+ ])
1824
+ ])) : r("", !0)
1825
+ ]))
1826
+ ]);
1827
+ };
1828
+ }
1829
+ }), yl = { class: "border border-gray-200 rounded-lg overflow-hidden" }, xl = {
1830
+ key: 0,
1831
+ class: "p-2"
1832
+ }, ml = {
1833
+ key: 0,
1834
+ class: "flex items-center gap-2 py-4 px-2 text-xs text-gray-500"
1835
+ }, gl = {
1836
+ key: 1,
1837
+ class: "py-4 px-2 text-xs text-red-600"
1838
+ }, fl = {
1839
+ key: 2,
1840
+ class: "py-4 px-2 text-xs text-gray-400"
1841
+ }, bl = {
1842
+ key: 3,
1843
+ class: "overflow-x-auto"
1844
+ }, _l = { class: "w-full text-xs" }, hl = { class: "px-2 py-1.5 font-mono whitespace-nowrap text-gray-500" }, kl = { class: "px-2 py-1.5 text-gray-500" }, $l = { class: "px-2 py-1.5 text-gray-500" }, wl = { class: "px-2 py-1.5 text-gray-500" }, Sl = { class: "px-2 py-1.5" }, Cl = { class: "px-2 py-1.5 font-mono text-gray-400" }, Il = { class: "px-2 py-1.5 text-gray-600" }, Tl = { class: "px-2 py-1.5 text-gray-400" }, Dl = { class: "px-2 py-1.5 font-medium text-gray-700" }, Re = /* @__PURE__ */ ne({
1845
+ __name: "ExplorerSystemNote",
1846
+ props: {
1847
+ netsuiteId: {}
1848
+ },
1849
+ setup(W) {
1850
+ const { FmCircularProgress: P } = oe, n = W, N = Te(), k = f(!1), F = f([]), S = f(!1), x = f(!1);
1851
+ async function l() {
1852
+ if (!(F.value.length > 0 || S.value)) {
1853
+ S.value = !0, x.value = !1;
1854
+ try {
1855
+ F.value = await N.getChangeLogs(n.netsuiteId);
1856
+ } catch {
1857
+ x.value = !0;
1858
+ } finally {
1859
+ S.value = !1;
1860
+ }
1861
+ }
1862
+ }
1863
+ function $(c) {
1864
+ switch (Number(c) - 1) {
1865
+ case ge.Create:
1866
+ return "bg-green-100 text-green-700";
1867
+ case ge.Set:
1868
+ return "bg-blue-100 text-blue-700";
1869
+ case ge.Change:
1870
+ return "bg-amber-100 text-amber-700";
1871
+ case ge.Unset:
1872
+ return "bg-red-100 text-red-700";
1873
+ default:
1874
+ return "bg-gray-100 text-gray-600";
1875
+ }
1876
+ }
1877
+ function p(c) {
1878
+ return new Date(c).toLocaleString();
1879
+ }
1880
+ return (c, _) => (t(), a("div", yl, [
1881
+ e("div", {
1882
+ class: j(["flex items-center gap-1.5 px-3 py-2 bg-gray-50 cursor-pointer select-none hover:bg-gray-100 transition-colors", k.value ? "border-b border-gray-200" : ""]),
1883
+ onClick: _[0] || (_[0] = () => {
1884
+ k.value = !k.value, l();
1885
+ })
1886
+ }, [
1887
+ (t(), a("svg", {
1888
+ class: j(["w-3.5 h-3.5 transition-transform text-gray-500", k.value ? "rotate-90" : ""]),
1889
+ fill: "none",
1890
+ stroke: "currentColor",
1891
+ viewBox: "0 0 24 24"
1892
+ }, _[1] || (_[1] = [
1893
+ e("path", {
1894
+ "stroke-linecap": "round",
1895
+ "stroke-linejoin": "round",
1896
+ "stroke-width": "2",
1897
+ d: "M9 5l7 7-7 7"
1898
+ }, null, -1)
1899
+ ]), 2)),
1900
+ _[2] || (_[2] = e("span", { class: "text-xs font-medium text-gray-600" }, "(NetSuite) System Note", -1))
1901
+ ], 2),
1902
+ k.value ? (t(), a("div", xl, [
1903
+ S.value ? (t(), a("div", ml, [
1904
+ T(g(P), { size: "md" }),
1905
+ _[3] || (_[3] = re(" Loading... "))
1906
+ ])) : x.value ? (t(), a("div", gl, " Failed to load system note. ")) : F.value.length === 0 ? (t(), a("div", fl, " No system notes found. ")) : (t(), a("div", bl, [
1907
+ e("table", _l, [
1908
+ _[4] || (_[4] = e("thead", { class: "bg-gray-50 border-b border-gray-200" }, [
1909
+ e("tr", null, [
1910
+ e("th", { class: "text-left px-2 py-1.5 font-medium text-gray-600 whitespace-nowrap" }, " Date "),
1911
+ e("th", { class: "text-left px-2 py-1.5 font-medium text-gray-600" }, "Role"),
1912
+ e("th", { class: "text-left px-2 py-1.5 font-medium text-gray-600" }, "Name"),
1913
+ e("th", { class: "text-left px-2 py-1.5 font-medium text-gray-600" }, "Context"),
1914
+ e("th", { class: "text-left px-2 py-1.5 font-medium text-gray-600" }, "Type"),
1915
+ e("th", { class: "text-left px-2 py-1.5 font-medium text-gray-600" }, "Line"),
1916
+ e("th", { class: "text-left px-2 py-1.5 font-medium text-gray-600" }, "Field"),
1917
+ e("th", { class: "text-left px-2 py-1.5 font-medium text-gray-600" }, "Old Value"),
1918
+ e("th", { class: "text-left px-2 py-1.5 font-medium text-gray-600" }, "New Value")
1919
+ ])
1920
+ ], -1)),
1921
+ e("tbody", null, [
1922
+ (t(!0), a(M, null, X(F.value, (h, A) => (t(), a("tr", {
1923
+ key: A,
1924
+ class: "border-b border-gray-100 last:border-b-0 hover:bg-gray-50"
1925
+ }, [
1926
+ e("td", hl, o(p(h._dateiso8601)), 1),
1927
+ e("td", kl, o(h._rolename), 1),
1928
+ e("td", $l, o(h._employeename), 1),
1929
+ e("td", wl, o(h._contextname), 1),
1930
+ e("td", Sl, [
1931
+ e("span", {
1932
+ class: j([
1933
+ "inline-block px-1.5 py-0.5 rounded font-medium",
1934
+ $(h.type)
1935
+ ])
1936
+ }, o(g(ge)[Number(h.type) - 1]), 3)
1937
+ ]),
1938
+ e("td", Cl, o(h.lineid || "—"), 1),
1939
+ e("td", Il, o(h._fieldname), 1),
1940
+ e("td", Tl, o(h.oldvalue || "—"), 1),
1941
+ e("td", Dl, o(h.newvalue || "—"), 1)
1942
+ ]))), 128))
1943
+ ])
1944
+ ])
1945
+ ]))
1946
+ ])) : r("", !0)
1947
+ ]));
1948
+ }
1949
+ }), Ll = { class: "flex flex-col gap-4" }, Fl = { class: "ml-auto flex gap-4" }, fe = /* @__PURE__ */ ne({
1950
+ __name: "SyncNetsuiteButton",
1951
+ props: {
1952
+ netsuiteIds: {},
1953
+ recordType: {},
1954
+ disabled: { type: Boolean },
1955
+ label: {},
1956
+ compact: { type: Boolean }
1957
+ },
1958
+ emits: ["synced", "error"],
1959
+ setup(W, { emit: P }) {
1960
+ const { FmButton: n, FmDialog: N, FmRadioGroup: k, FmRadio: F } = oe, S = W, x = P, l = Te(), $ = f(!1), p = f(!1), c = f(xe.enum[1]), _ = [
1961
+ { value: xe.enum[1], label: "Version 1" },
1962
+ {
1963
+ value: xe.enum[2],
1964
+ label: "Version 2",
1965
+ subLabel: "Supports duplicate skus"
1966
+ }
1967
+ ];
1968
+ function h() {
1969
+ S.netsuiteIds.length && (c.value = xe.enum[1], $.value = !0);
1970
+ }
1971
+ async function A() {
1972
+ $.value = !1;
1973
+ const w = c.value === xe.enum[2] ? xe.enum[2] : void 0;
1974
+ p.value = !0;
1975
+ try {
1976
+ S.recordType === "purchaseOrder" ? await l.manualSyncMultiplePurchaseOrders({
1977
+ netsuiteIds: S.netsuiteIds,
1978
+ version: w
1979
+ }) : await l.manualSyncMultipleTransferInOrders({
1980
+ netsuiteIds: S.netsuiteIds,
1981
+ version: w
1982
+ }), x("synced");
1983
+ } catch (b) {
1984
+ x("error", (b == null ? void 0 : b.message) || "Sync failed");
1985
+ } finally {
1986
+ p.value = !1;
1987
+ }
1988
+ }
1989
+ return (w, b) => (t(), a(M, null, [
1990
+ T(g(n), {
1991
+ variant: "secondary",
1992
+ "prepend-icon": "sync",
1993
+ label: w.label ?? `Sync${w.netsuiteIds.length > 1 ? ` (${w.netsuiteIds.length})` : ""}`,
1994
+ loading: p.value,
1995
+ disabled: w.disabled || !w.netsuiteIds.length || p.value,
1996
+ compact: w.compact,
1997
+ onClick: h
1998
+ }, null, 8, ["label", "loading", "disabled", "compact"]),
1999
+ T(g(N), {
2000
+ modelValue: $.value,
2001
+ "onUpdate:modelValue": b[2] || (b[2] = (R) => $.value = R),
2002
+ overlay: !0
2003
+ }, {
2004
+ "dialog-header": te(() => b[3] || (b[3] = [
2005
+ e("span", { class: "fm-typo-en-heading-lg-700" }, "Select Sync Version", -1)
2006
+ ])),
2007
+ "dialog-footer": te(() => [
2008
+ e("div", Fl, [
2009
+ T(g(n), {
2010
+ label: "Not now",
2011
+ variant: "secondary",
2012
+ onClick: b[1] || (b[1] = (R) => $.value = !1)
2013
+ }),
2014
+ T(g(n), {
2015
+ label: "Confirm",
2016
+ variant: "primary",
2017
+ onClick: A
2018
+ })
2019
+ ])
2020
+ ]),
2021
+ default: te(() => [
2022
+ e("div", Ll, [
2023
+ e("p", null, " Choose the version to use for syncing " + o(S.recordType === "purchaseOrder" ? "purchase orders" : "transfer orders") + " " + o(w.netsuiteIds.length === 1 ? `record ${w.netsuiteIds[0]}` : `${w.netsuiteIds.length} records`) + ": ", 1),
2024
+ T(g(k), {
2025
+ modelValue: c.value,
2026
+ "onUpdate:modelValue": b[0] || (b[0] = (R) => c.value = R)
2027
+ }, {
2028
+ default: te(() => [
2029
+ (t(), a(M, null, X(_, (R) => T(g(F), {
2030
+ key: R.value,
2031
+ value: R.value,
2032
+ label: R.label,
2033
+ sublabel: R.subLabel
2034
+ }, null, 8, ["value", "label", "sublabel"])), 64))
2035
+ ]),
2036
+ _: 1
2037
+ }, 8, ["modelValue"])
2038
+ ])
2039
+ ]),
2040
+ _: 1
2041
+ }, 8, ["modelValue"])
2042
+ ], 64));
2043
+ }
2044
+ }), Rl = { class: "p-6 space-y-6" }, Nl = {
2045
+ key: 0,
2046
+ class: "flex items-center justify-center py-16"
2047
+ }, Ol = { class: "grid grid-cols-2 gap-x-8 gap-y-3 text-sm" }, Vl = { key: 0 }, Ul = { class: "font-medium" }, Bl = { key: 1 }, Pl = { class: "font-medium" }, Al = { key: 2 }, El = { class: "font-medium" }, Ml = { key: 3 }, jl = { class: "font-medium" }, ql = { key: 4 }, Jl = { class: "font-medium" }, zl = { key: 5 }, Wl = { class: "font-medium" }, Ql = { key: 6 }, Hl = { class: "font-medium" }, Kl = { key: 7 }, Yl = { class: "font-medium font-mono" }, Gl = { key: 8 }, Xl = { class: "font-medium font-mono text-xs" }, Zl = {
2048
+ key: 9,
2049
+ class: "col-span-2"
2050
+ }, er = { class: "text-gray-700 italic" }, tr = { key: 0 }, sr = { class: "text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2" }, ar = { class: "border border-gray-200 rounded-lg overflow-hidden" }, or = { class: "w-full text-sm" }, lr = ["onClick"], rr = { class: "w-8 pl-2 py-2 text-gray-400" }, nr = { class: "px-3 py-2 font-mono text-xs text-gray-400" }, ir = { class: "px-3 py-2" }, dr = { class: "font-medium" }, ur = {
2051
+ key: 0,
2052
+ class: "text-xs text-gray-400 font-mono"
2053
+ }, cr = { class: "px-3 py-2 text-xs text-gray-500" }, vr = { class: "px-3 py-2 text-right font-medium" }, pr = { class: "px-3 py-2 text-gray-500 font-mono text-xs" }, yr = { class: "px-3 py-2 text-gray-600 text-xs" }, xr = { class: "px-3 py-2 text-right text-gray-600" }, mr = { class: "px-3 py-2 text-right font-medium" }, gr = { class: "px-3 py-2 text-right text-gray-500 text-xs" }, fr = { class: "px-3 py-2 text-right text-gray-500 text-xs" }, br = { class: "px-3 py-2 text-right text-gray-500 text-xs" }, _r = { class: "px-3 py-2 text-right text-gray-500 text-xs" }, hr = { class: "px-3 py-2 text-center" }, kr = {
2054
+ key: 0,
2055
+ class: "inline-block px-1.5 py-0.5 rounded text-xs bg-gray-200 text-gray-500"
2056
+ }, $r = {
2057
+ key: 1,
2058
+ class: "text-gray-300"
2059
+ }, wr = {
2060
+ key: 0,
2061
+ class: "border-b border-gray-100 bg-gray-50"
2062
+ }, Sr = { class: "flex items-center justify-between mb-2" }, Cr = ["onClick"], Ir = {
2063
+ key: 0,
2064
+ class: "w-3.5 h-3.5",
2065
+ fill: "none",
2066
+ stroke: "currentColor",
2067
+ viewBox: "0 0 24 24"
2068
+ }, Tr = { class: "space-y-1 text-xs font-mono" }, Dr = { class: "text-gray-400 shrink-0" }, Lr = { class: "text-gray-700 break-all" }, Fr = { class: "text-amber-700 font-semibold shrink-0" }, Rr = { class: "text-amber-900 break-all" }, Nr = { class: "border border-gray-200 rounded-lg overflow-hidden" }, Or = {
2069
+ key: 0,
2070
+ class: "w-3.5 h-3.5",
2071
+ fill: "none",
2072
+ stroke: "currentColor",
2073
+ viewBox: "0 0 24 24"
2074
+ }, Vr = {
2075
+ key: 1,
2076
+ class: "w-3.5 h-3.5",
2077
+ fill: "none",
2078
+ stroke: "currentColor",
2079
+ viewBox: "0 0 24 24"
2080
+ }, Ur = { key: 0 }, Br = {
2081
+ key: 2,
2082
+ class: "p-3 bg-red-50 border border-red-200 rounded-lg text-sm text-red-700"
2083
+ }, Pr = {
2084
+ key: 3,
2085
+ class: "border border-gray-200 rounded-lg overflow-hidden"
2086
+ }, Ar = {
2087
+ key: 0,
2088
+ class: "p-4"
2089
+ }, Er = { class: "flex items-center justify-between gap-2 w-full" }, Mr = { class: "flex items-center gap-2" }, jr = {
2090
+ key: 0,
2091
+ class: "text-xs text-green-600"
2092
+ }, qr = {
2093
+ key: 1,
2094
+ class: "text-xs text-red-600"
2095
+ }, Jr = { class: "flex gap-2" }, zr = 14, Wr = /* @__PURE__ */ ne({
2096
+ __name: "PurchaseOrderSideSheet",
2097
+ setup(W, { expose: P }) {
2098
+ const { FmSideSheet: n, FmButton: N, FmCircularProgress: k } = oe, F = f(!1), S = f(!1), x = f(null), l = f(null), $ = f(!1), p = f(!1), c = f(!1), _ = f(null), h = f(!1);
2099
+ function A() {
2100
+ h.value = !0, _.value = null;
2101
+ }
2102
+ function w(i) {
2103
+ _.value = i, h.value = !1;
2104
+ }
2105
+ async function b(i, m) {
2106
+ l.value = i, F.value = !0, S.value = !0, x.value = null, $.value = !1;
2107
+ try {
2108
+ x.value = await m();
2109
+ } catch (U) {
2110
+ x.value = { error: (U == null ? void 0 : U.message) || "Failed to fetch raw data" };
2111
+ } finally {
2112
+ S.value = !1;
2113
+ }
2114
+ }
2115
+ function R() {
2116
+ F.value = !1, x.value = null, l.value = null, $.value = !1, p.value = !1, _.value = null, h.value = !1;
2117
+ }
2118
+ function V() {
2119
+ var i;
2120
+ (i = window.navigator.clipboard) == null || i.writeText(JSON.stringify(x.value, null, 2)), c.value = !0, setTimeout(() => c.value = !1, 2e3);
2121
+ }
2122
+ const J = B(() => {
2123
+ var i;
2124
+ return ((i = x.value) == null ? void 0 : i.tranId) ?? null;
2125
+ }), Q = B(() => {
2126
+ var i, m;
2127
+ return ((m = (i = x.value) == null ? void 0 : i.status) == null ? void 0 : m.refName) ?? null;
2128
+ }), K = B(() => {
2129
+ var i;
2130
+ return ((i = x.value) == null ? void 0 : i.tranDate) ?? null;
2131
+ }), v = B(() => {
2132
+ var i;
2133
+ return ((i = x.value) == null ? void 0 : i.createdDate) ?? null;
2134
+ }), s = B(() => {
2135
+ var i;
2136
+ return ((i = x.value) == null ? void 0 : i.lastModifiedDate) ?? null;
2137
+ }), D = B(() => {
2138
+ var i;
2139
+ return ((i = x.value) == null ? void 0 : i.memo) ?? null;
2140
+ }), d = B(() => {
2141
+ var i, m;
2142
+ return ((m = (i = x.value) == null ? void 0 : i.location) == null ? void 0 : m.refName) ?? null;
2143
+ }), y = B(() => {
2144
+ var i, m;
2145
+ return ((m = (i = x.value) == null ? void 0 : i.entity) == null ? void 0 : m.refName) ?? null;
2146
+ }), L = B(() => {
2147
+ var i;
2148
+ return ((i = x.value) == null ? void 0 : i.custbody_fm_po_num) ?? null;
2149
+ }), E = B(() => {
2150
+ var i;
2151
+ return ((i = x.value) == null ? void 0 : i.custbody_fm_po_id) ?? null;
2152
+ }), I = B(() => {
2153
+ var i, m;
2154
+ return ((m = (i = x.value) == null ? void 0 : i.item) == null ? void 0 : m.items) ?? [];
2155
+ }), C = f(/* @__PURE__ */ new Set());
2156
+ function Y(i) {
2157
+ C.value.has(i) ? C.value.delete(i) : C.value.add(i), C.value = new Set(C.value);
2158
+ }
2159
+ function Z(i) {
2160
+ const m = [], U = [];
2161
+ for (const [z, ae] of Object.entries(i))
2162
+ z.startsWith("custcol") ? U.push([z, ae]) : m.push([z, ae]);
2163
+ return { normal: m, custcol: U };
2164
+ }
2165
+ const O = f(null);
2166
+ function u(i, m) {
2167
+ var U;
2168
+ (U = window.navigator.clipboard) == null || U.writeText(JSON.stringify(i, null, 2)), O.value = m, setTimeout(() => O.value = null, 2e3);
2169
+ }
2170
+ return P({ open: b, close: R }), (i, m) => (t(), H(g(n), {
2171
+ modelValue: F.value,
2172
+ "onUpdate:modelValue": m[2] || (m[2] = (U) => F.value = U),
2173
+ header: `Purchase Order · ${l.value ?? "-"}`,
2174
+ "max-width": 1600
2175
+ }, {
2176
+ "side-sheet-footer": te(() => [
2177
+ e("div", Er, [
2178
+ e("div", Mr, [
2179
+ h.value ? (t(), a("span", jr, "Sync triggered")) : r("", !0),
2180
+ _.value ? (t(), a("span", qr, o(_.value), 1)) : r("", !0)
2181
+ ]),
2182
+ e("div", Jr, [
2183
+ T(fe, {
2184
+ "netsuite-ids": l.value ? [l.value] : [],
2185
+ "record-type": "purchaseOrder",
2186
+ label: "Sync Now",
2187
+ onSynced: A,
2188
+ onError: w
2189
+ }, null, 8, ["netsuite-ids"]),
2190
+ T(g(N), {
2191
+ variant: "tertiary",
2192
+ onClick: R
2193
+ }, {
2194
+ default: te(() => m[24] || (m[24] = [
2195
+ re("Close")
2196
+ ])),
2197
+ _: 1
2198
+ })
2199
+ ])
2200
+ ])
2201
+ ]),
2202
+ default: te(() => {
2203
+ var U;
2204
+ return [
2205
+ e("div", Rl, [
2206
+ S.value ? (t(), a("div", Nl, [
2207
+ T(g(k), { size: "md" })
2208
+ ])) : x.value && !x.value.error ? (t(), a(M, { key: 1 }, [
2209
+ e("div", Ol, [
2210
+ J.value ? (t(), a("div", Vl, [
2211
+ m[3] || (m[3] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Transaction ID", -1)),
2212
+ e("div", Ul, o(J.value), 1)
2213
+ ])) : r("", !0),
2214
+ Q.value ? (t(), a("div", Bl, [
2215
+ m[4] || (m[4] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Status", -1)),
2216
+ e("div", Pl, o(Q.value), 1)
2217
+ ])) : r("", !0),
2218
+ K.value ? (t(), a("div", Al, [
2219
+ m[5] || (m[5] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Tran Date", -1)),
2220
+ e("div", El, o(new Date(K.value).toLocaleDateString()), 1)
2221
+ ])) : r("", !0),
2222
+ v.value ? (t(), a("div", Ml, [
2223
+ m[6] || (m[6] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Created", -1)),
2224
+ e("div", jl, o(new Date(v.value).toLocaleString()), 1)
2225
+ ])) : r("", !0),
2226
+ s.value ? (t(), a("div", ql, [
2227
+ m[7] || (m[7] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Last Modified", -1)),
2228
+ e("div", Jl, o(new Date(s.value).toLocaleString()), 1)
2229
+ ])) : r("", !0),
2230
+ y.value ? (t(), a("div", zl, [
2231
+ m[8] || (m[8] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Vendor", -1)),
2232
+ e("div", Wl, o(y.value), 1)
2233
+ ])) : r("", !0),
2234
+ d.value ? (t(), a("div", Ql, [
2235
+ m[9] || (m[9] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Location", -1)),
2236
+ e("div", Hl, o(d.value), 1)
2237
+ ])) : r("", !0),
2238
+ L.value != null ? (t(), a("div", Kl, [
2239
+ m[10] || (m[10] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "(FEEDME) PO Seq", -1)),
2240
+ e("div", Yl, "#" + o(L.value), 1)
2241
+ ])) : r("", !0),
2242
+ E.value ? (t(), a("div", Gl, [
2243
+ m[11] || (m[11] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "(FEEDME) PO ID", -1)),
2244
+ e("div", Xl, o(E.value), 1)
2245
+ ])) : r("", !0),
2246
+ D.value ? (t(), a("div", Zl, [
2247
+ m[12] || (m[12] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Memo", -1)),
2248
+ e("div", er, o(D.value), 1)
2249
+ ])) : r("", !0)
2250
+ ]),
2251
+ I.value.length > 0 ? (t(), a("div", tr, [
2252
+ e("div", sr, " Items (" + o(I.value.length) + ") ", 1),
2253
+ e("div", ar, [
2254
+ e("table", or, [
2255
+ m[17] || (m[17] = e("thead", { class: "bg-gray-50 border-b border-gray-200" }, [
2256
+ e("tr", null, [
2257
+ e("th", { class: "w-8" }),
2258
+ e("th", { class: "text-left px-3 py-2 font-medium text-gray-600" }, "#"),
2259
+ e("th", { class: "text-left px-3 py-2 font-medium text-gray-600" }, "Item"),
2260
+ e("th", { class: "text-left px-3 py-2 font-medium text-gray-600" }, "Type"),
2261
+ e("th", { class: "text-right px-3 py-2 font-medium text-gray-600" }, "Qty"),
2262
+ e("th", { class: "text-left px-3 py-2 font-medium text-gray-600" }, "Unit"),
2263
+ e("th", { class: "text-left px-3 py-2 font-medium text-gray-600" }, "Location"),
2264
+ e("th", { class: "text-right px-3 py-2 font-medium text-gray-600" }, "Rate"),
2265
+ e("th", { class: "text-right px-3 py-2 font-medium text-gray-600" }, "Amount"),
2266
+ e("th", { class: "text-right px-3 py-2 font-medium text-gray-600" }, "Available"),
2267
+ e("th", { class: "text-right px-3 py-2 font-medium text-gray-600" }, "Committed"),
2268
+ e("th", { class: "text-right px-3 py-2 font-medium text-gray-600" }, "Fulfilled"),
2269
+ e("th", { class: "text-right px-3 py-2 font-medium text-gray-600" }, "Received"),
2270
+ e("th", { class: "text-center px-3 py-2 font-medium text-gray-600" }, "Closed")
2271
+ ])
2272
+ ], -1)),
2273
+ e("tbody", null, [
2274
+ (t(!0), a(M, null, X(I.value, (z, ae) => {
2275
+ var G, ee, ie, me;
2276
+ return t(), a(M, {
2277
+ key: z.line ?? ae
2278
+ }, [
2279
+ e("tr", {
2280
+ class: j(["border-b border-gray-100 cursor-pointer select-none", [
2281
+ z.isClosed ? "bg-gray-50 text-gray-400" : "hover:bg-blue-50/40",
2282
+ C.value.has(ae) ? "bg-blue-50/60" : ""
2283
+ ]]),
2284
+ onClick: (le) => Y(ae)
2285
+ }, [
2286
+ e("td", rr, [
2287
+ (t(), a("svg", {
2288
+ class: j(["w-3.5 h-3.5 transition-transform", C.value.has(ae) ? "rotate-90" : ""]),
2289
+ fill: "none",
2290
+ stroke: "currentColor",
2291
+ viewBox: "0 0 24 24"
2292
+ }, m[13] || (m[13] = [
2293
+ e("path", {
2294
+ "stroke-linecap": "round",
2295
+ "stroke-linejoin": "round",
2296
+ "stroke-width": "2",
2297
+ d: "M9 5l7 7-7 7"
2298
+ }, null, -1)
2299
+ ]), 2))
2300
+ ]),
2301
+ e("td", nr, o(z.line ?? ae + 1), 1),
2302
+ e("td", ir, [
2303
+ e("div", dr, o(((G = z.item) == null ? void 0 : G.refName) || "—"), 1),
2304
+ (ee = z.item) != null && ee.id ? (t(), a("div", ur, " ID: " + o(z.item.id), 1)) : r("", !0)
2305
+ ]),
2306
+ e("td", cr, o(((ie = z.itemType) == null ? void 0 : ie.refName) || "—"), 1),
2307
+ e("td", vr, o(z.quantity), 1),
2308
+ e("td", pr, o(z.units || "—"), 1),
2309
+ e("td", yr, o(((me = z.location) == null ? void 0 : me.refName) || "—"), 1),
2310
+ e("td", xr, o(z.rate != null ? z.rate.toFixed(4) : "—"), 1),
2311
+ e("td", mr, o(z.amount != null ? z.amount.toFixed(2) : "—"), 1),
2312
+ e("td", gr, o(z.quantityAvailable ?? "—"), 1),
2313
+ e("td", fr, o(z.quantityCommitted ?? "—"), 1),
2314
+ e("td", br, o(z.quantityFulfilled ?? "—"), 1),
2315
+ e("td", _r, o(z.quantityReceived ?? "—"), 1),
2316
+ e("td", hr, [
2317
+ z.isClosed ? (t(), a("span", kr, "Closed")) : (t(), a("span", $r, "—"))
2318
+ ])
2319
+ ], 10, lr),
2320
+ C.value.has(ae) ? (t(), a("tr", wr, [
2321
+ e("td", {
2322
+ colspan: zr,
2323
+ class: "px-4 py-3"
2324
+ }, [
2325
+ e("div", Sr, [
2326
+ m[15] || (m[15] = e("span", { class: "text-xs font-semibold text-gray-500 uppercase tracking-wide" }, "Raw Item Data", -1)),
2327
+ e("button", {
2328
+ class: j([
2329
+ "text-xs flex items-center gap-1 transition-colors",
2330
+ O.value === ae ? "text-green-600" : "text-gray-400 hover:text-gray-700"
2331
+ ]),
2332
+ onClick: de((le) => u(z, ae), ["stop"])
2333
+ }, [
2334
+ O.value === ae ? (t(), a("svg", Ir, m[14] || (m[14] = [
2335
+ e("path", {
2336
+ "stroke-linecap": "round",
2337
+ "stroke-linejoin": "round",
2338
+ "stroke-width": "2",
2339
+ d: "M5 13l4 4L19 7"
2340
+ }, null, -1)
2341
+ ]))) : r("", !0),
2342
+ re(" " + o(O.value === ae ? "Copied!" : "Copy"), 1)
2343
+ ], 10, Cr)
2344
+ ]),
2345
+ e("div", Tr, [
2346
+ (t(!0), a(M, null, X(Z(z).normal, ([le, pe]) => (t(), a("div", {
2347
+ key: le,
2348
+ class: "flex gap-2"
2349
+ }, [
2350
+ e("span", Dr, o(le) + ":", 1),
2351
+ e("span", Lr, o(JSON.stringify(pe)), 1)
2352
+ ]))), 128)),
2353
+ Z(z).custcol.length > 0 ? (t(), a(M, { key: 0 }, [
2354
+ m[16] || (m[16] = e("div", { class: "mt-2 mb-1 text-xs font-semibold text-amber-600 uppercase tracking-wide" }, " Custom Columns ", -1)),
2355
+ (t(!0), a(M, null, X(Z(z).custcol, ([le, pe]) => (t(), a("div", {
2356
+ key: le,
2357
+ class: "flex gap-2 rounded px-1.5 py-0.5 bg-amber-50 border border-amber-200"
2358
+ }, [
2359
+ e("span", Fr, o(le) + ":", 1),
2360
+ e("span", Rr, o(JSON.stringify(pe)), 1)
2361
+ ]))), 128))
2362
+ ], 64)) : r("", !0)
2363
+ ])
2364
+ ])
2365
+ ])) : r("", !0)
2366
+ ], 64);
2367
+ }), 128))
2368
+ ])
2369
+ ])
2370
+ ])
2371
+ ])) : r("", !0),
2372
+ l.value ? (t(), H(Re, {
2373
+ key: l.value,
2374
+ "netsuite-id": l.value
2375
+ }, null, 8, ["netsuite-id"])) : r("", !0),
2376
+ e("div", Nr, [
2377
+ e("div", {
2378
+ class: j(["flex items-center gap-1.5 px-3 py-2 bg-gray-50 cursor-pointer select-none hover:bg-gray-100 transition-colors", $.value ? "border-b border-gray-200" : ""]),
2379
+ onClick: m[0] || (m[0] = (z) => $.value = !$.value)
2380
+ }, [
2381
+ (t(), a("svg", {
2382
+ class: j(["w-3.5 h-3.5 transition-transform text-gray-500", $.value ? "rotate-90" : ""]),
2383
+ fill: "none",
2384
+ stroke: "currentColor",
2385
+ viewBox: "0 0 24 24"
2386
+ }, m[18] || (m[18] = [
2387
+ e("path", {
2388
+ "stroke-linecap": "round",
2389
+ "stroke-linejoin": "round",
2390
+ "stroke-width": "2",
2391
+ d: "M9 5l7 7-7 7"
2392
+ }, null, -1)
2393
+ ]), 2)),
2394
+ m[21] || (m[21] = e("span", { class: "text-xs font-medium text-gray-600" }, "(NetSuite) Raw JSON", -1)),
2395
+ $.value ? (t(), a("button", {
2396
+ key: 0,
2397
+ class: j(["ml-auto text-xs flex items-center gap-1 transition-colors", c.value ? "text-green-600" : "text-gray-400 hover:text-gray-700"]),
2398
+ onClick: de(V, ["stop"])
2399
+ }, [
2400
+ c.value ? (t(), a("svg", Or, m[19] || (m[19] = [
2401
+ e("path", {
2402
+ "stroke-linecap": "round",
2403
+ "stroke-linejoin": "round",
2404
+ "stroke-width": "2",
2405
+ d: "M5 13l4 4L19 7"
2406
+ }, null, -1)
2407
+ ]))) : (t(), a("svg", Vr, m[20] || (m[20] = [
2408
+ e("path", {
2409
+ "stroke-linecap": "round",
2410
+ "stroke-linejoin": "round",
2411
+ "stroke-width": "2",
2412
+ d: "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"
2413
+ }, null, -1)
2414
+ ]))),
2415
+ re(" " + o(c.value ? "Copied!" : "Copy JSON"), 1)
2416
+ ], 2)) : r("", !0)
2417
+ ], 2),
2418
+ $.value ? (t(), a("div", Ur, [
2419
+ T(ye, {
2420
+ value: x.value,
2421
+ "max-height": "50vh"
2422
+ }, null, 8, ["value"])
2423
+ ])) : r("", !0)
2424
+ ])
2425
+ ], 64)) : (U = x.value) != null && U.error ? (t(), a("div", Br, o(x.value.error), 1)) : r("", !0),
2426
+ l.value ? (t(), a("div", Pr, [
2427
+ e("div", {
2428
+ class: j(["flex items-center gap-1.5 px-3 py-2 bg-gray-50 cursor-pointer select-none hover:bg-gray-100 transition-colors", p.value ? "border-b border-gray-200" : ""]),
2429
+ onClick: m[1] || (m[1] = (z) => p.value = !p.value)
2430
+ }, [
2431
+ (t(), a("svg", {
2432
+ class: j(["w-3.5 h-3.5 transition-transform text-gray-500", p.value ? "rotate-90" : ""]),
2433
+ fill: "none",
2434
+ stroke: "currentColor",
2435
+ viewBox: "0 0 24 24"
2436
+ }, m[22] || (m[22] = [
2437
+ e("path", {
2438
+ "stroke-linecap": "round",
2439
+ "stroke-linejoin": "round",
2440
+ "stroke-width": "2",
2441
+ d: "M9 5l7 7-7 7"
2442
+ }, null, -1)
2443
+ ]), 2)),
2444
+ m[23] || (m[23] = e("span", { class: "text-xs font-medium text-gray-600" }, "Sync Logs", -1))
2445
+ ], 2),
2446
+ p.value ? (t(), a("div", Ar, [
2447
+ T(ve, {
2448
+ "purchase-order-id": x.value.custbody_fm_po_id,
2449
+ "netsuite-id": l.value,
2450
+ "record-type": "purchaseOrder"
2451
+ }, null, 8, ["purchase-order-id", "netsuite-id"])
2452
+ ])) : r("", !0)
2453
+ ])) : r("", !0)
2454
+ ])
2455
+ ];
2456
+ }),
2457
+ _: 1
2458
+ }, 8, ["modelValue", "header"]));
2459
+ }
2460
+ }), Qr = { class: "p-6 space-y-6" }, Hr = {
2461
+ key: 0,
2462
+ class: "flex items-center justify-center py-16"
2463
+ }, Kr = { class: "grid grid-cols-2 gap-x-8 gap-y-3 text-sm" }, Yr = { key: 0 }, Gr = { class: "font-medium" }, Xr = { key: 1 }, Zr = { class: "font-medium" }, en = { key: 2 }, tn = { class: "font-medium" }, sn = { key: 3 }, an = { class: "font-medium" }, on = { key: 4 }, ln = { class: "font-medium" }, rn = { key: 5 }, nn = { class: "font-medium" }, dn = { key: 6 }, un = { class: "font-medium" }, cn = { key: 7 }, vn = { class: "font-medium text-blue-700" }, pn = {
2464
+ key: 8,
2465
+ class: "col-span-2"
2466
+ }, yn = { class: "text-gray-700 italic" }, xn = { key: 0 }, mn = { class: "text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2" }, gn = { class: "border border-gray-200 rounded-lg overflow-hidden" }, fn = { class: "w-full text-sm" }, bn = ["onClick"], _n = { class: "w-8 pl-2 py-2 text-gray-400" }, hn = { class: "px-3 py-2 font-mono text-xs text-gray-400" }, kn = { class: "px-3 py-2" }, $n = { class: "font-medium" }, wn = {
2467
+ key: 0,
2468
+ class: "text-xs text-gray-400 font-mono"
2469
+ }, Sn = { class: "px-3 py-2 text-xs text-gray-500" }, Cn = { class: "px-3 py-2 text-right font-medium" }, In = { class: "px-3 py-2 text-gray-500 font-mono text-xs" }, Tn = { class: "px-3 py-2 text-right text-gray-500 text-xs" }, Dn = { class: "px-3 py-2 text-right text-gray-500 text-xs" }, Ln = { class: "px-3 py-2 text-right text-gray-500 text-xs" }, Fn = { class: "px-3 py-2 text-right text-gray-500 text-xs" }, Rn = { class: "px-3 py-2 text-center" }, Nn = {
2470
+ key: 0,
2471
+ class: "inline-block px-1.5 py-0.5 rounded text-xs bg-gray-200 text-gray-500"
2472
+ }, On = {
2473
+ key: 1,
2474
+ class: "text-gray-300"
2475
+ }, Vn = {
2476
+ key: 0,
2477
+ class: "border-b border-gray-100 bg-gray-50"
2478
+ }, Un = { class: "flex items-center justify-between mb-2" }, Bn = ["onClick"], Pn = {
2479
+ key: 0,
2480
+ class: "w-3.5 h-3.5",
2481
+ fill: "none",
2482
+ stroke: "currentColor",
2483
+ viewBox: "0 0 24 24"
2484
+ }, An = { class: "space-y-1 text-xs font-mono" }, En = { class: "text-gray-400 shrink-0" }, Mn = { class: "text-gray-700 break-all" }, jn = { class: "text-amber-700 font-semibold shrink-0" }, qn = { class: "text-amber-900 break-all" }, Jn = { class: "border border-gray-200 rounded-lg overflow-hidden" }, zn = {
2485
+ key: 0,
2486
+ class: "w-3.5 h-3.5",
2487
+ fill: "none",
2488
+ stroke: "currentColor",
2489
+ viewBox: "0 0 24 24"
2490
+ }, Wn = {
2491
+ key: 1,
2492
+ class: "w-3.5 h-3.5",
2493
+ fill: "none",
2494
+ stroke: "currentColor",
2495
+ viewBox: "0 0 24 24"
2496
+ }, Qn = { key: 0 }, Hn = {
2497
+ key: 2,
2498
+ class: "p-3 bg-red-50 border border-red-200 rounded-lg text-sm text-red-700"
2499
+ }, Kn = {
2500
+ key: 3,
2501
+ class: "border border-gray-200 rounded-lg overflow-hidden"
2502
+ }, Yn = {
2503
+ key: 0,
2504
+ class: "p-2"
2505
+ }, Gn = { class: "flex items-center justify-between gap-2 w-full" }, Xn = { class: "flex items-center gap-2" }, Zn = {
2506
+ key: 0,
2507
+ class: "text-xs text-green-600"
2508
+ }, ei = {
2509
+ key: 1,
2510
+ class: "text-xs text-red-600"
2511
+ }, ti = { class: "flex gap-2" }, si = 11, ai = /* @__PURE__ */ ne({
2512
+ __name: "TransferOrderSideSheet",
2513
+ setup(W, { expose: P }) {
2514
+ const { FmSideSheet: n, FmButton: N, FmCircularProgress: k } = oe, F = f(!1), S = f(!1), x = f(null), l = f(""), $ = f(!1), p = f(!1), c = f(!1), _ = f(null), h = f(!1);
2515
+ function A() {
2516
+ h.value = !0, _.value = null;
2517
+ }
2518
+ function w(O) {
2519
+ _.value = O, h.value = !1;
2520
+ }
2521
+ async function b(O, u) {
2522
+ l.value = O, F.value = !0, S.value = !0, x.value = null, $.value = !1;
2523
+ try {
2524
+ x.value = await u();
2525
+ } catch (i) {
2526
+ x.value = { error: (i == null ? void 0 : i.message) || "Failed to fetch raw data" };
2527
+ } finally {
2528
+ S.value = !1;
2529
+ }
2530
+ }
2531
+ function R() {
2532
+ F.value = !1, x.value = null, l.value = "", $.value = !1, p.value = !1, _.value = null, h.value = !1;
2533
+ }
2534
+ function V() {
2535
+ var O;
2536
+ (O = window.navigator.clipboard) == null || O.writeText(JSON.stringify(x.value, null, 2)), c.value = !0, setTimeout(() => c.value = !1, 2e3);
2537
+ }
2538
+ const J = B(() => {
2539
+ var O, u;
2540
+ return ((u = (O = x.value) == null ? void 0 : O.status) == null ? void 0 : u.refName) ?? null;
2541
+ }), Q = B(() => {
2542
+ var O;
2543
+ return ((O = x.value) == null ? void 0 : O.tranId) ?? null;
2544
+ }), K = B(() => {
2545
+ var O;
2546
+ return ((O = x.value) == null ? void 0 : O.tranDate) ?? null;
2547
+ }), v = B(() => {
2548
+ var O;
2549
+ return ((O = x.value) == null ? void 0 : O.createdDate) ?? null;
2550
+ }), s = B(() => {
2551
+ var O;
2552
+ return ((O = x.value) == null ? void 0 : O.lastModifiedDate) ?? null;
2553
+ }), D = B(() => {
2554
+ var O;
2555
+ return ((O = x.value) == null ? void 0 : O.memo) ?? null;
2556
+ }), d = B(() => {
2557
+ var O, u;
2558
+ return ((u = (O = x.value) == null ? void 0 : O.location) == null ? void 0 : u.refName) ?? null;
2559
+ }), y = B(() => {
2560
+ var O, u;
2561
+ return ((u = (O = x.value) == null ? void 0 : O.transferLocation) == null ? void 0 : u.refName) ?? null;
2562
+ }), L = B(() => {
2563
+ var O, u;
2564
+ return ((u = (O = x.value) == null ? void 0 : O.item) == null ? void 0 : u.items) ?? [];
2565
+ }), E = f(/* @__PURE__ */ new Set());
2566
+ function I(O) {
2567
+ E.value.has(O) ? E.value.delete(O) : E.value.add(O), E.value = new Set(E.value);
2568
+ }
2569
+ function C(O) {
2570
+ const u = [], i = [];
2571
+ for (const [m, U] of Object.entries(O))
2572
+ m.startsWith("custcol") ? i.push([m, U]) : u.push([m, U]);
2573
+ return { normal: u, custcol: i };
2574
+ }
2575
+ const Y = f(null);
2576
+ function Z(O, u) {
2577
+ var i;
2578
+ (i = window.navigator.clipboard) == null || i.writeText(JSON.stringify(O, null, 2)), Y.value = u, setTimeout(() => Y.value = null, 2e3);
2579
+ }
2580
+ return P({ open: b, close: R }), (O, u) => (t(), H(g(n), {
2581
+ modelValue: F.value,
2582
+ "onUpdate:modelValue": u[2] || (u[2] = (i) => F.value = i),
2583
+ header: `Transfer Order · ${l.value}`,
2584
+ "max-width": 1600
2585
+ }, {
2586
+ "side-sheet-footer": te(() => [
2587
+ e("div", Gn, [
2588
+ e("div", Xn, [
2589
+ h.value ? (t(), a("span", Zn, "Sync triggered")) : r("", !0),
2590
+ _.value ? (t(), a("span", ei, o(_.value), 1)) : r("", !0)
2591
+ ]),
2592
+ e("div", ti, [
2593
+ T(fe, {
2594
+ "netsuite-ids": l.value ? [l.value] : [],
2595
+ "record-type": "transferOrder",
2596
+ label: "Sync Now",
2597
+ onSynced: A,
2598
+ onError: w
2599
+ }, null, 8, ["netsuite-ids"]),
2600
+ T(g(N), {
2601
+ variant: "tertiary",
2602
+ onClick: R
2603
+ }, {
2604
+ default: te(() => u[23] || (u[23] = [
2605
+ re("Close")
2606
+ ])),
2607
+ _: 1
2608
+ })
2609
+ ])
2610
+ ])
2611
+ ]),
2612
+ default: te(() => {
2613
+ var i;
2614
+ return [
2615
+ e("div", Qr, [
2616
+ S.value ? (t(), a("div", Hr, [
2617
+ T(g(k), { size: "md" })
2618
+ ])) : x.value && !x.value.error ? (t(), a(M, { key: 1 }, [
2619
+ e("div", Kr, [
2620
+ J.value ? (t(), a("div", Yr, [
2621
+ u[3] || (u[3] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Status", -1)),
2622
+ e("div", Gr, o(J.value), 1)
2623
+ ])) : r("", !0),
2624
+ Q.value ? (t(), a("div", Xr, [
2625
+ u[4] || (u[4] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Transaction ID", -1)),
2626
+ e("div", Zr, o(Q.value), 1)
2627
+ ])) : r("", !0),
2628
+ J.value ? (t(), a("div", en, [
2629
+ u[5] || (u[5] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Status", -1)),
2630
+ e("div", tn, o(J.value), 1)
2631
+ ])) : r("", !0),
2632
+ K.value ? (t(), a("div", sn, [
2633
+ u[6] || (u[6] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Tran Date", -1)),
2634
+ e("div", an, o(new Date(K.value).toLocaleDateString()), 1)
2635
+ ])) : r("", !0),
2636
+ v.value ? (t(), a("div", on, [
2637
+ u[7] || (u[7] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Created", -1)),
2638
+ e("div", ln, o(new Date(v.value).toLocaleString()), 1)
2639
+ ])) : r("", !0),
2640
+ s.value ? (t(), a("div", rn, [
2641
+ u[8] || (u[8] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Last Modified", -1)),
2642
+ e("div", nn, o(new Date(s.value).toLocaleString()), 1)
2643
+ ])) : r("", !0),
2644
+ d.value ? (t(), a("div", dn, [
2645
+ u[9] || (u[9] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Source Location", -1)),
2646
+ e("div", un, o(d.value), 1)
2647
+ ])) : r("", !0),
2648
+ y.value ? (t(), a("div", cn, [
2649
+ u[10] || (u[10] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, " Destination Location ", -1)),
2650
+ e("div", vn, o(y.value), 1)
2651
+ ])) : r("", !0),
2652
+ D.value ? (t(), a("div", pn, [
2653
+ u[11] || (u[11] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Memo", -1)),
2654
+ e("div", yn, o(D.value), 1)
2655
+ ])) : r("", !0)
2656
+ ]),
2657
+ L.value.length > 0 ? (t(), a("div", xn, [
2658
+ e("div", mn, " Items (" + o(L.value.length) + ") ", 1),
2659
+ e("div", gn, [
2660
+ e("table", fn, [
2661
+ u[16] || (u[16] = e("thead", { class: "bg-gray-50 border-b border-gray-200" }, [
2662
+ e("tr", null, [
2663
+ e("th", { class: "w-8" }),
2664
+ e("th", { class: "text-left px-3 py-2 font-medium text-gray-600" }, "#"),
2665
+ e("th", { class: "text-left px-3 py-2 font-medium text-gray-600" }, "Item"),
2666
+ e("th", { class: "text-left px-3 py-2 font-medium text-gray-600" }, "Type"),
2667
+ e("th", { class: "text-right px-3 py-2 font-medium text-gray-600" }, "Qty"),
2668
+ e("th", { class: "text-left px-3 py-2 font-medium text-gray-600" }, "Unit ID"),
2669
+ e("th", { class: "text-right px-3 py-2 font-medium text-gray-600" }, "Available"),
2670
+ e("th", { class: "text-right px-3 py-2 font-medium text-gray-600" }, "Committed"),
2671
+ e("th", { class: "text-right px-3 py-2 font-medium text-gray-600" }, "Fulfilled"),
2672
+ e("th", { class: "text-right px-3 py-2 font-medium text-gray-600" }, "Received"),
2673
+ e("th", { class: "text-center px-3 py-2 font-medium text-gray-600" }, "Closed")
2674
+ ])
2675
+ ], -1)),
2676
+ e("tbody", null, [
2677
+ (t(!0), a(M, null, X(L.value, (m, U) => {
2678
+ var z, ae, G;
2679
+ return t(), a(M, {
2680
+ key: m.line ?? U
2681
+ }, [
2682
+ e("tr", {
2683
+ class: j(["border-b border-gray-100 cursor-pointer select-none", [
2684
+ m.isClosed ? "bg-gray-50 text-gray-400" : "hover:bg-blue-50/40",
2685
+ E.value.has(U) ? "bg-blue-50/60" : ""
2686
+ ]]),
2687
+ onClick: (ee) => I(U)
2688
+ }, [
2689
+ e("td", _n, [
2690
+ (t(), a("svg", {
2691
+ class: j(["w-3.5 h-3.5 transition-transform", E.value.has(U) ? "rotate-90" : ""]),
2692
+ fill: "none",
2693
+ stroke: "currentColor",
2694
+ viewBox: "0 0 24 24"
2695
+ }, u[12] || (u[12] = [
2696
+ e("path", {
2697
+ "stroke-linecap": "round",
2698
+ "stroke-linejoin": "round",
2699
+ "stroke-width": "2",
2700
+ d: "M9 5l7 7-7 7"
2701
+ }, null, -1)
2702
+ ]), 2))
2703
+ ]),
2704
+ e("td", hn, o(m.line ?? U + 1), 1),
2705
+ e("td", kn, [
2706
+ e("div", $n, o(((z = m.item) == null ? void 0 : z.refName) || "—"), 1),
2707
+ (ae = m.item) != null && ae.id ? (t(), a("div", wn, " ID: " + o(m.item.id), 1)) : r("", !0)
2708
+ ]),
2709
+ e("td", Sn, o(((G = m.itemType) == null ? void 0 : G.refName) || "—"), 1),
2710
+ e("td", Cn, o(m.quantity), 1),
2711
+ e("td", In, o(m.units || "—"), 1),
2712
+ e("td", Tn, o(m.quantityAvailable ?? "—"), 1),
2713
+ e("td", Dn, o(m.quantityCommitted ?? "—"), 1),
2714
+ e("td", Ln, o(m.quantityFulfilled ?? "—"), 1),
2715
+ e("td", Fn, o(m.quantityReceived ?? "—"), 1),
2716
+ e("td", Rn, [
2717
+ m.isClosed ? (t(), a("span", Nn, "Closed")) : (t(), a("span", On, "—"))
2718
+ ])
2719
+ ], 10, bn),
2720
+ E.value.has(U) ? (t(), a("tr", Vn, [
2721
+ e("td", {
2722
+ colspan: si,
2723
+ class: "px-4 py-3"
2724
+ }, [
2725
+ e("div", Un, [
2726
+ u[14] || (u[14] = e("span", { class: "text-xs font-semibold text-gray-500 uppercase tracking-wide" }, "Raw Item Data", -1)),
2727
+ e("button", {
2728
+ class: j([
2729
+ "text-xs flex items-center gap-1 transition-colors",
2730
+ Y.value === U ? "text-green-600" : "text-gray-400 hover:text-gray-700"
2731
+ ]),
2732
+ onClick: de((ee) => Z(m, U), ["stop"])
2733
+ }, [
2734
+ Y.value === U ? (t(), a("svg", Pn, u[13] || (u[13] = [
2735
+ e("path", {
2736
+ "stroke-linecap": "round",
2737
+ "stroke-linejoin": "round",
2738
+ "stroke-width": "2",
2739
+ d: "M5 13l4 4L19 7"
2740
+ }, null, -1)
2741
+ ]))) : r("", !0),
2742
+ re(" " + o(Y.value === U ? "Copied!" : "Copy"), 1)
2743
+ ], 10, Bn)
2744
+ ]),
2745
+ e("div", An, [
2746
+ (t(!0), a(M, null, X(C(m).normal, ([ee, ie]) => (t(), a("div", {
2747
+ key: ee,
2748
+ class: "flex gap-2"
2749
+ }, [
2750
+ e("span", En, o(ee) + ":", 1),
2751
+ e("span", Mn, o(JSON.stringify(ie)), 1)
2752
+ ]))), 128)),
2753
+ C(m).custcol.length > 0 ? (t(), a(M, { key: 0 }, [
2754
+ u[15] || (u[15] = e("div", { class: "mt-2 mb-1 text-xs font-semibold text-amber-600 uppercase tracking-wide" }, " Custom Columns ", -1)),
2755
+ (t(!0), a(M, null, X(C(m).custcol, ([ee, ie]) => (t(), a("div", {
2756
+ key: ee,
2757
+ class: "flex gap-2 rounded px-1.5 py-0.5 bg-amber-50 border border-amber-200"
2758
+ }, [
2759
+ e("span", jn, o(ee) + ":", 1),
2760
+ e("span", qn, o(JSON.stringify(ie)), 1)
2761
+ ]))), 128))
2762
+ ], 64)) : r("", !0)
2763
+ ])
2764
+ ])
2765
+ ])) : r("", !0)
2766
+ ], 64);
2767
+ }), 128))
2768
+ ])
2769
+ ])
2770
+ ])
2771
+ ])) : r("", !0),
2772
+ l.value ? (t(), H(Re, {
2773
+ key: l.value,
2774
+ "netsuite-id": l.value
2775
+ }, null, 8, ["netsuite-id"])) : r("", !0),
2776
+ e("div", Jn, [
2777
+ e("div", {
2778
+ class: j(["flex items-center gap-1.5 px-3 py-2 bg-gray-50 cursor-pointer select-none hover:bg-gray-100 transition-colors", $.value ? "border-b border-gray-200" : ""]),
2779
+ onClick: u[0] || (u[0] = (m) => $.value = !$.value)
2780
+ }, [
2781
+ (t(), a("svg", {
2782
+ class: j(["w-3.5 h-3.5 transition-transform text-gray-500", $.value ? "rotate-90" : ""]),
2783
+ fill: "none",
2784
+ stroke: "currentColor",
2785
+ viewBox: "0 0 24 24"
2786
+ }, u[17] || (u[17] = [
2787
+ e("path", {
2788
+ "stroke-linecap": "round",
2789
+ "stroke-linejoin": "round",
2790
+ "stroke-width": "2",
2791
+ d: "M9 5l7 7-7 7"
2792
+ }, null, -1)
2793
+ ]), 2)),
2794
+ u[20] || (u[20] = e("span", { class: "text-xs font-medium text-gray-600" }, "(NetSuite) Raw JSON", -1)),
2795
+ $.value ? (t(), a("button", {
2796
+ key: 0,
2797
+ class: j(["ml-auto text-xs flex items-center gap-1 transition-colors", c.value ? "text-green-600" : "text-gray-400 hover:text-gray-700"]),
2798
+ onClick: de(V, ["stop"])
2799
+ }, [
2800
+ c.value ? (t(), a("svg", zn, u[18] || (u[18] = [
2801
+ e("path", {
2802
+ "stroke-linecap": "round",
2803
+ "stroke-linejoin": "round",
2804
+ "stroke-width": "2",
2805
+ d: "M5 13l4 4L19 7"
2806
+ }, null, -1)
2807
+ ]))) : (t(), a("svg", Wn, u[19] || (u[19] = [
2808
+ e("path", {
2809
+ "stroke-linecap": "round",
2810
+ "stroke-linejoin": "round",
2811
+ "stroke-width": "2",
2812
+ d: "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"
2813
+ }, null, -1)
2814
+ ]))),
2815
+ re(" " + o(c.value ? "Copied!" : "Copy JSON"), 1)
2816
+ ], 2)) : r("", !0)
2817
+ ], 2),
2818
+ $.value ? (t(), a("div", Qn, [
2819
+ T(ye, {
2820
+ value: x.value,
2821
+ "max-height": "50vh"
2822
+ }, null, 8, ["value"])
2823
+ ])) : r("", !0)
2824
+ ])
2825
+ ], 64)) : (i = x.value) != null && i.error ? (t(), a("div", Hn, o(x.value.error), 1)) : r("", !0),
2826
+ l.value ? (t(), a("div", Kn, [
2827
+ e("div", {
2828
+ class: j(["flex items-center gap-1.5 px-3 py-2 bg-gray-50 cursor-pointer select-none hover:bg-gray-100 transition-colors", p.value ? "border-b border-gray-200" : ""]),
2829
+ onClick: u[1] || (u[1] = (m) => p.value = !p.value)
2830
+ }, [
2831
+ (t(), a("svg", {
2832
+ class: j(["w-3.5 h-3.5 transition-transform text-gray-500", p.value ? "rotate-90" : ""]),
2833
+ fill: "none",
2834
+ stroke: "currentColor",
2835
+ viewBox: "0 0 24 24"
2836
+ }, u[21] || (u[21] = [
2837
+ e("path", {
2838
+ "stroke-linecap": "round",
2839
+ "stroke-linejoin": "round",
2840
+ "stroke-width": "2",
2841
+ d: "M9 5l7 7-7 7"
2842
+ }, null, -1)
2843
+ ]), 2)),
2844
+ u[22] || (u[22] = e("span", { class: "text-xs font-medium text-gray-600" }, "Sync Logs", -1))
2845
+ ], 2),
2846
+ p.value ? (t(), a("div", Yn, [
2847
+ T(ve, {
2848
+ "purchase-order-id": x.value.custbody_fm_po_id,
2849
+ "netsuite-id": l.value,
2850
+ "record-type": "transferOrder"
2851
+ }, null, 8, ["purchase-order-id", "netsuite-id"])
2852
+ ])) : r("", !0)
2853
+ ])) : r("", !0)
2854
+ ])
2855
+ ];
2856
+ }),
2857
+ _: 1
2858
+ }, 8, ["modelValue", "header"]));
2859
+ }
2860
+ }), oi = 180;
2861
+ function li(W = 30) {
2862
+ const P = /* @__PURE__ */ new Date();
2863
+ return P.setDate(P.getDate() - W), { startDate: P, endDate: /* @__PURE__ */ new Date() };
2864
+ }
2865
+ function Ne() {
2866
+ const W = ce(), P = f("listByDate"), n = f(""), N = f("purchaseOrder"), k = f("id"), F = f([]), S = f(null), x = f(li()), l = f("all"), $ = f("in"), p = f(null), c = f(""), _ = f([]), h = f(!1), A = f(null), w = f(/* @__PURE__ */ new Set()), b = B(() => {
2867
+ const D = _.value.length, d = _.value.filter((L) => L.syncedAt != null).length, y = D - d;
2868
+ return { total: D, synced: d, unsynced: y };
2869
+ }), R = B(() => {
2870
+ const { startDate: D, endDate: d } = x.value;
2871
+ return !D || !d ? "Start date and end date are required" : D > d ? "Start date must be before end date" : (d.getTime() - D.getTime()) / (1e3 * 60 * 60 * 24) > oi ? "Date range must not exceed 6 months" : null;
2872
+ });
2873
+ function V(D) {
2874
+ const d = new Set(w.value);
2875
+ d.has(D) ? d.delete(D) : d.add(D), w.value = d;
2876
+ }
2877
+ function J(D) {
2878
+ return w.value.has(D);
2879
+ }
2880
+ async function Q(D, d, y, L) {
2881
+ if (!y.trim()) {
2882
+ A.value = "Query value is required";
2883
+ return;
2884
+ }
2885
+ if (!d) {
2886
+ A.value = "Location ID is required";
2887
+ return;
2888
+ }
2889
+ h.value = !0, A.value = null, S.value = null, F.value = [], _.value = [], w.value = /* @__PURE__ */ new Set();
2890
+ try {
2891
+ const E = y.split(",").map((I) => I.trim()).filter((I) => I.length > 0);
2892
+ if (E.length === 0) {
2893
+ A.value = "Please enter at least one query value";
2894
+ return;
2895
+ }
2896
+ if (L === "id" ? _.value = await W.browseOrdersByFilter(D, d, {
2897
+ recordIds: E
2898
+ }) : _.value = await W.browseOrdersByFilter(D, d, {
2899
+ transactionIds: E
2900
+ }), _.value.length > 0) {
2901
+ const I = _.value[0];
2902
+ S.value = {
2903
+ netsuiteRecord: I,
2904
+ additionalInfo: {
2905
+ id: I.recordId,
2906
+ tranid: I.transactionId,
2907
+ transactionnumber: I.transactionId
2908
+ }
2909
+ };
2910
+ }
2911
+ } catch (E) {
2912
+ A.value = (E == null ? void 0 : E.message) || "Failed to look up records";
2913
+ } finally {
2914
+ h.value = !1;
2915
+ }
2916
+ }
2917
+ async function K(D, d) {
2918
+ if (R.value) {
2919
+ A.value = R.value;
2920
+ return;
2921
+ }
2922
+ h.value = !0, A.value = null, _.value = [], w.value = /* @__PURE__ */ new Set();
2923
+ try {
2924
+ _.value = await W.browseOrdersByDateRange(
2925
+ D,
2926
+ d,
2927
+ ue(x.value.startDate),
2928
+ ue(x.value.endDate)
2929
+ );
2930
+ } catch (y) {
2931
+ A.value = (y == null ? void 0 : y.message) || "Failed to fetch records";
2932
+ } finally {
2933
+ h.value = !1;
2934
+ }
2935
+ }
2936
+ async function v(D, d) {
2937
+ P.value === "lookup" ? await Q(
2938
+ N.value,
2939
+ d,
2940
+ n.value,
2941
+ k.value
2942
+ ) : await K(D, d);
2943
+ }
2944
+ function s() {
2945
+ _.value = [], S.value = null, F.value = [], A.value = null, h.value = !1, w.value = /* @__PURE__ */ new Set();
2946
+ }
2947
+ return {
2948
+ // State
2949
+ activeUseCase: P,
2950
+ netsuiteIdInput: n,
2951
+ lookupRecordType: N,
2952
+ queryField: k,
2953
+ lookupResult: S,
2954
+ lookupResults: F,
2955
+ dateRange: x,
2956
+ syncFilter: l,
2957
+ direction: $,
2958
+ filterRule: p,
2959
+ searchValue: c,
2960
+ records: _,
2961
+ loading: h,
2962
+ error: A,
2963
+ expandedRowIds: w,
2964
+ // Computed
2965
+ stats: b,
2966
+ dateRangeError: R,
2967
+ // Actions
2968
+ execute: v,
2969
+ executeLookup: Q,
2970
+ executeListByDateRange: K,
2971
+ toggleRowExpand: V,
2972
+ isRowExpanded: J,
2973
+ reset: s
2974
+ };
2975
+ }
2976
+ const ri = { class: "flex flex-col gap-4" }, ni = {
2977
+ key: 0,
2978
+ class: "p-3 bg-red-50 border border-red-200 rounded-lg text-sm text-red-700"
2979
+ }, ii = {
2980
+ key: 1,
2981
+ class: "flex justify-center py-8"
2982
+ }, di = {
2983
+ key: 0,
2984
+ class: "flex flex-col gap-3 px-3 py-3 bg-blue-50 border border-blue-200 rounded-lg"
2985
+ }, ui = { class: "text-sm text-blue-700 font-semibold" }, ci = {
2986
+ key: 0,
2987
+ class: "flex flex-col gap-1.5"
2988
+ }, vi = { class: "flex items-center gap-2" }, pi = { class: "text-xs font-semibold text-violet-600 uppercase tracking-wide" }, yi = { class: "flex flex-wrap gap-1.5" }, xi = { class: "font-mono" }, mi = { class: "font-medium" }, gi = ["onClick"], fi = {
2989
+ key: 1,
2990
+ class: "flex flex-col gap-1.5"
2991
+ }, bi = { class: "flex items-center gap-2" }, _i = { class: "text-xs font-semibold text-sky-600 uppercase tracking-wide" }, hi = { class: "flex flex-wrap gap-1.5" }, ki = { class: "font-mono" }, $i = { class: "font-medium" }, wi = ["onClick"], Si = {
2992
+ key: 0,
2993
+ class: "p-4 bg-gray-50 border border-gray-200 rounded-lg mt-1 mb-2"
2994
+ }, Ci = {
2995
+ key: 3,
2996
+ class: "text-center py-8 text-gray-400"
2997
+ }, Ii = /* @__PURE__ */ ne({
2998
+ __name: "OrdersView",
2999
+ props: {
3000
+ currentLocationSetting: {},
3001
+ nsLocations: {},
3002
+ currentLocationSubsidiary: {}
3003
+ },
3004
+ setup(W) {
3005
+ const P = W, n = Ne(), N = ce(), k = f(), F = f(), S = f("all"), x = B(
3006
+ () => !1
3007
+ // Direction no longer needed for Transfer Orders
3008
+ ), l = f([]);
3009
+ async function $() {
3010
+ var y;
3011
+ const d = ((y = P.currentLocationSetting) == null ? void 0 : y.id) || "";
3012
+ if (!d) {
3013
+ n.error.value = "Location ID is required";
3014
+ return;
3015
+ }
3016
+ if (n.activeUseCase.value === "lookup") {
3017
+ await n.executeLookup(
3018
+ n.lookupRecordType.value,
3019
+ d,
3020
+ n.netsuiteIdInput.value,
3021
+ n.queryField.value
3022
+ );
3023
+ return;
3024
+ }
3025
+ n.loading.value = !0, n.error.value = null, l.value = [], n.records.value = [];
3026
+ try {
3027
+ if (S.value === "purchaseOrder")
3028
+ await n.executeListByDateRange("purchaseOrder", d), l.value = n.records.value;
3029
+ else if (S.value === "transferOrder")
3030
+ await n.executeListByDateRange("transferOrder", d), l.value = n.records.value;
3031
+ else {
3032
+ const { useNetSuiteExplorerApi: L } = await Promise.resolve().then(() => Me), E = L(), [I, C] = await Promise.all([
3033
+ E.browseOrdersByDateRange(
3034
+ "purchaseOrder",
3035
+ d,
3036
+ ue(n.dateRange.value.startDate),
3037
+ ue(n.dateRange.value.endDate)
3038
+ ),
3039
+ E.browseOrdersByDateRange(
3040
+ "transferOrder",
3041
+ d,
3042
+ ue(n.dateRange.value.startDate),
3043
+ ue(n.dateRange.value.endDate)
3044
+ )
3045
+ ]), Y = (Z) => {
3046
+ if (!Z) return 0;
3047
+ const [O, u, i] = Z.split("/");
3048
+ return new Date(Number(i), Number(u) - 1, Number(O)).getTime();
3049
+ };
3050
+ l.value = [...I, ...C].sort((Z, O) => {
3051
+ const u = Y(Z.transactionDate);
3052
+ return Y(O.transactionDate) - u;
3053
+ }), n.records.value = l.value;
3054
+ }
3055
+ } catch (L) {
3056
+ n.error.value = (L == null ? void 0 : L.message) || "Failed to fetch records";
3057
+ } finally {
3058
+ n.loading.value = !1;
3059
+ }
3060
+ }
3061
+ const p = B(() => {
3062
+ let d = [];
3063
+ if (n.activeUseCase.value === "lookup" ? d = n.records.value : d = l.value.length > 0 ? l.value : n.records.value, n.syncFilter.value === "synced" ? d = d.filter((y) => y.syncedAt != null) : n.syncFilter.value === "unsynced" && (d = d.filter((y) => y.syncedAt == null)), n.filterRule.value) {
3064
+ const y = he.build(n.filterRule.value);
3065
+ d = d.filter(
3066
+ (L) => ke(
3067
+ {
3068
+ syncStatus: L.syncedAt != null ? "synced" : "unsynced",
3069
+ recordType: L.recordType || "Unknown"
3070
+ },
3071
+ y
3072
+ )
3073
+ );
3074
+ }
3075
+ if (n.searchValue.value && n.searchValue.value.trim()) {
3076
+ const y = n.searchValue.value.toLowerCase();
3077
+ d = d.filter(
3078
+ (L) => {
3079
+ var E, I, C, Y;
3080
+ return ((E = L.recordId) == null ? void 0 : E.toLowerCase().includes(y)) || ((I = L.transactionId) == null ? void 0 : I.toLowerCase().includes(y)) || ((C = L.sourceLocationName) == null ? void 0 : C.toLowerCase().includes(y)) || ((Y = L.destinationLocationName) == null ? void 0 : Y.toLowerCase().includes(y));
3081
+ }
3082
+ );
3083
+ }
3084
+ return d;
3085
+ });
3086
+ function c(d) {
3087
+ return d ? d === "PurchOrd" ? "Purchase" : d === "TrnfrOrd" ? "Transfer" : d.substring(0, 3).toUpperCase() : "Unknown";
3088
+ }
3089
+ function _(d) {
3090
+ return d === "PurchOrd" ? "purchaseOrder" : d === "TrnfrOrd" ? "transferOrder" : "purchaseOrder";
3091
+ }
3092
+ const h = f(/* @__PURE__ */ new Set()), A = B(
3093
+ () => p.value.length > 0 && h.value.size === p.value.length
3094
+ ), w = B(
3095
+ () => h.value.size > 0 && h.value.size < p.value.length
3096
+ );
3097
+ function b(d) {
3098
+ return h.value.has(d);
3099
+ }
3100
+ function R(d) {
3101
+ d ? h.value = new Set(p.value.map((y) => y.recordId)) : h.value = /* @__PURE__ */ new Set();
3102
+ }
3103
+ function V(d, y) {
3104
+ y ? h.value.add(d) : h.value.delete(d), h.value = new Set(h.value);
3105
+ }
3106
+ const J = B(
3107
+ () => p.value.filter(
3108
+ (d) => h.value.has(d.recordId) && d.recordType === "PurchOrd"
3109
+ )
3110
+ ), Q = B(
3111
+ () => p.value.filter(
3112
+ (d) => h.value.has(d.recordId) && d.recordType === "TrnfrOrd"
3113
+ )
3114
+ ), K = B(
3115
+ () => J.value.map((d) => d.recordId)
3116
+ ), v = B(
3117
+ () => Q.value.map((d) => d.recordId)
3118
+ );
3119
+ async function s(d) {
3120
+ var E, I;
3121
+ const y = d.original, L = _(y.recordType);
3122
+ L === "purchaseOrder" ? (E = k.value) == null || E.open(y.recordId, async () => (await N.readOrderById(L, y.recordId)).netsuiteRecord) : (I = F.value) == null || I.open(y.recordId, async () => (await N.readOrderById(L, y.recordId)).netsuiteRecord);
3123
+ }
3124
+ const D = [
3125
+ {
3126
+ id: "select",
3127
+ header: () => q(oe.FmCheckbox, {
3128
+ modelValue: A.value,
3129
+ indeterminate: w.value,
3130
+ value: "all",
3131
+ "onUpdate:modelValue": (d) => R(d)
3132
+ }),
3133
+ cell: ({ row: d }) => {
3134
+ const y = d.original.recordId;
3135
+ return q(
3136
+ "div",
3137
+ { onClick: (L) => L.stopPropagation() },
3138
+ q(oe.FmCheckbox, {
3139
+ modelValue: b(y),
3140
+ value: y,
3141
+ "onUpdate:modelValue": (L) => V(y, L)
3142
+ })
3143
+ );
3144
+ },
3145
+ size: 50
3146
+ },
3147
+ {
3148
+ id: "recordType",
3149
+ header: () => "Type",
3150
+ accessorKey: "recordType",
3151
+ size: 130,
3152
+ cell: (d) => {
3153
+ const y = d.getValue(), L = c(y);
3154
+ return q(oe.FmChip, {
3155
+ label: L,
3156
+ compact: !0
3157
+ });
3158
+ }
3159
+ },
3160
+ {
3161
+ id: "id",
3162
+ header: () => "NS ID",
3163
+ accessorKey: "recordId",
3164
+ size: 100,
3165
+ cell: (d) => q("span", { class: "font-mono text-sm" }, d.getValue())
3166
+ },
3167
+ {
3168
+ id: "tranid",
3169
+ header: () => "Tran ID",
3170
+ accessorKey: "transactionId",
3171
+ cell: (d) => q("span", { class: "font-medium" }, d.getValue())
3172
+ },
3173
+ {
3174
+ id: "trandate",
3175
+ header: () => "Tran Date",
3176
+ accessorFn: (d) => {
3177
+ const y = d.transactionDate;
3178
+ if (!y) return 0;
3179
+ const [L, E, I] = y.split("/");
3180
+ return new Date(Number(I), Number(E) - 1, Number(L)).getTime();
3181
+ },
3182
+ cell: (d) => {
3183
+ const y = d.getValue();
3184
+ return y ? q("span", { class: "text-sm" }, new Date(y).toLocaleDateString()) : q("span", { class: "text-sm" }, "-");
3185
+ }
3186
+ },
3187
+ {
3188
+ id: "sourceLocation",
3189
+ header: () => "Source Location",
3190
+ accessorFn: (d) => d.sourceLocationName || "N/A",
3191
+ cell: (d) => {
3192
+ var C;
3193
+ const y = d.row.original, L = y.sourceLocationName || "N/A", E = y.sourceLocationId || "", I = E && E === ((C = P.currentLocationSetting) == null ? void 0 : C.netSuiteId);
3194
+ return q("div", { class: "flex flex-col" }, [
3195
+ q(
3196
+ "span",
3197
+ {
3198
+ class: I ? "text-sm font-semibold text-blue-700" : "text-sm"
3199
+ },
3200
+ L
3201
+ ),
3202
+ q("span", { class: "text-xs text-gray-400" }, `ID: ${E || "N/A"}`)
3203
+ ]);
3204
+ }
3205
+ },
3206
+ {
3207
+ id: "destinationLocation",
3208
+ header: () => "Destination Location",
3209
+ accessorFn: (d) => d.destinationLocationName || "N/A",
3210
+ cell: (d) => {
3211
+ var C;
3212
+ const y = d.row.original, L = y.destinationLocationName || "N/A", E = y.destinationLocationId || "", I = E && E === ((C = P.currentLocationSetting) == null ? void 0 : C.netSuiteId);
3213
+ return q("div", { class: "flex flex-col" }, [
3214
+ q(
3215
+ "span",
3216
+ {
3217
+ class: I ? "text-sm font-semibold text-blue-700" : "text-sm"
3218
+ },
3219
+ L
3220
+ ),
3221
+ q("span", { class: "text-xs text-gray-400" }, `ID: ${E || "N/A"}`)
3222
+ ]);
3223
+ }
3224
+ },
3225
+ {
3226
+ id: "syncedAt",
3227
+ header: () => "Synced At",
3228
+ accessorKey: "syncedAt",
3229
+ size: 160,
3230
+ cell: (d) => {
3231
+ const y = d.getValue();
3232
+ return y ? q("span", { class: "text-sm" }, new Date(y).toLocaleString()) : q("span", { class: "text-gray-300" }, "—");
3233
+ }
3234
+ },
3235
+ {
3236
+ id: "expand",
3237
+ header: () => "",
3238
+ size: 50,
3239
+ cell: (d) => {
3240
+ const y = d.row.original.recordId, L = n.isRowExpanded(y);
3241
+ return q(
3242
+ oe.FmButton,
3243
+ {
3244
+ variant: "tertiary",
3245
+ compact: !0,
3246
+ onClick: (E) => {
3247
+ E.stopPropagation(), n.toggleRowExpand(y);
3248
+ }
3249
+ },
3250
+ () => q(oe.FmIcon, { name: L ? "expand_less" : "expand_more", size: "sm" })
3251
+ );
3252
+ }
3253
+ }
3254
+ ];
3255
+ return (d, y) => {
3256
+ const L = se("FmCircularProgress"), E = se("FmTable");
3257
+ return t(), a("div", ri, [
3258
+ y[14] || (y[14] = e("div", { class: "text-sm text-gray-600" }, " Query Purchase Orders and Transfer Orders from NetSuite. Results are cross-referenced with FeedMe to show sync status. ", -1)),
3259
+ T(Fe, {
3260
+ "active-use-case": g(n).activeUseCase.value,
3261
+ "netsuite-id-input": g(n).netsuiteIdInput.value,
3262
+ "lookup-record-type": g(n).lookupRecordType.value,
3263
+ "lookup-record-type-options": [
3264
+ { value: "purchaseOrder", label: "Purchase Order" },
3265
+ { value: "transferOrder", label: "Transfer Order" }
3266
+ ],
3267
+ "query-field": g(n).queryField.value,
3268
+ "date-range": g(n).dateRange.value,
3269
+ "sync-filter": g(n).syncFilter.value,
3270
+ "filter-rule": g(n).filterRule.value,
3271
+ "search-value": g(n).searchValue.value,
3272
+ "date-range-error": g(n).dateRangeError.value,
3273
+ loading: g(n).loading.value,
3274
+ stats: g(n).stats.value,
3275
+ "show-order-type-filter": g(n).activeUseCase.value === "listByDate",
3276
+ "order-type-filter": S.value,
3277
+ "show-direction": x.value,
3278
+ direction: g(n).direction.value,
3279
+ "onUpdate:activeUseCase": y[0] || (y[0] = (I) => g(n).activeUseCase.value = I),
3280
+ "onUpdate:netsuiteIdInput": y[1] || (y[1] = (I) => g(n).netsuiteIdInput.value = I),
3281
+ "onUpdate:lookupRecordType": y[2] || (y[2] = (I) => g(n).lookupRecordType.value = I),
3282
+ "onUpdate:queryField": y[3] || (y[3] = (I) => g(n).queryField.value = I),
3283
+ "onUpdate:dateRange": y[4] || (y[4] = (I) => g(n).dateRange.value = I),
3284
+ "onUpdate:syncFilter": y[5] || (y[5] = (I) => g(n).syncFilter.value = I),
3285
+ "onUpdate:filterRule": y[6] || (y[6] = (I) => g(n).filterRule.value = I),
3286
+ "onUpdate:searchValue": y[7] || (y[7] = (I) => g(n).searchValue.value = I),
3287
+ "onUpdate:direction": y[8] || (y[8] = (I) => g(n).direction.value = I),
3288
+ "onUpdate:orderTypeFilter": y[9] || (y[9] = (I) => S.value = I),
3289
+ onExecute: $
3290
+ }, null, 8, ["active-use-case", "netsuite-id-input", "lookup-record-type", "query-field", "date-range", "sync-filter", "filter-rule", "search-value", "date-range-error", "loading", "stats", "show-order-type-filter", "order-type-filter", "show-direction", "direction"]),
3291
+ g(n).error.value ? (t(), a("div", ni, o(g(n).error.value), 1)) : r("", !0),
3292
+ g(n).loading.value ? (t(), a("div", ii, [
3293
+ T(L, { size: "md" })
3294
+ ])) : p.value.length > 0 ? (t(), a(M, { key: 2 }, [
3295
+ h.value.size > 0 ? (t(), a("div", di, [
3296
+ e("span", ui, o(h.value.size) + " selected", 1),
3297
+ J.value.length > 0 ? (t(), a("div", ci, [
3298
+ e("div", vi, [
3299
+ e("span", pi, "Purchase Orders (" + o(J.value.length) + ")", 1),
3300
+ T(fe, {
3301
+ "netsuite-ids": K.value,
3302
+ "record-type": "purchaseOrder",
3303
+ label: "Sync PO",
3304
+ compact: !0,
3305
+ onSynced: y[10] || (y[10] = (I) => K.value.forEach((C) => V(C, !1)))
3306
+ }, null, 8, ["netsuite-ids"])
3307
+ ]),
3308
+ e("div", yi, [
3309
+ (t(!0), a(M, null, X(J.value, (I) => (t(), a("span", {
3310
+ key: I.recordId,
3311
+ class: "inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs border bg-violet-50 border-violet-200 text-violet-700"
3312
+ }, [
3313
+ e("span", xi, o(I.recordId), 1),
3314
+ y[12] || (y[12] = e("span", { class: "text-violet-400" }, "·", -1)),
3315
+ e("span", mi, o(I.transactionId || "—"), 1),
3316
+ e("button", {
3317
+ class: "ml-0.5 opacity-50 hover:opacity-100 leading-none",
3318
+ onClick: (C) => V(I.recordId, !1)
3319
+ }, " × ", 8, gi)
3320
+ ]))), 128))
3321
+ ])
3322
+ ])) : r("", !0),
3323
+ Q.value.length > 0 ? (t(), a("div", fi, [
3324
+ e("div", bi, [
3325
+ e("span", _i, "Transfer Orders (" + o(Q.value.length) + ")", 1),
3326
+ T(fe, {
3327
+ "netsuite-ids": v.value,
3328
+ "record-type": "transferOrder",
3329
+ label: "Sync TO",
3330
+ compact: !0,
3331
+ onSynced: y[11] || (y[11] = (I) => v.value.forEach((C) => V(C, !1)))
3332
+ }, null, 8, ["netsuite-ids"])
3333
+ ]),
3334
+ e("div", hi, [
3335
+ (t(!0), a(M, null, X(Q.value, (I) => (t(), a("span", {
3336
+ key: I.recordId,
3337
+ class: "inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs border bg-sky-50 border-sky-200 text-sky-700"
3338
+ }, [
3339
+ e("span", ki, o(I.recordId), 1),
3340
+ y[13] || (y[13] = e("span", { class: "text-sky-400" }, "·", -1)),
3341
+ e("span", $i, o(I.transactionId || "—"), 1),
3342
+ e("button", {
3343
+ class: "ml-0.5 opacity-50 hover:opacity-100 leading-none",
3344
+ onClick: (C) => V(I.recordId, !1)
3345
+ }, " × ", 8, wi)
3346
+ ]))), 128))
3347
+ ])
3348
+ ])) : r("", !0)
3349
+ ])) : r("", !0),
3350
+ T(E, {
3351
+ "column-defs": D,
3352
+ "row-data": p.value,
3353
+ onRowClick: s,
3354
+ class: "cursor-pointer"
3355
+ }, null, 8, ["row-data"]),
3356
+ (t(!0), a(M, null, X(p.value, (I) => (t(), a("div", {
3357
+ key: I.recordId
3358
+ }, [
3359
+ g(n).isRowExpanded(I.recordId) ? (t(), a("div", Si, [
3360
+ T(ve, {
3361
+ "netsuite-id": I.recordId
3362
+ }, null, 8, ["netsuite-id"])
3363
+ ])) : r("", !0)
3364
+ ]))), 128))
3365
+ ], 64)) : !g(n).loading.value && !g(n).error.value ? (t(), a("div", Ci, o(g(n).activeUseCase.value === "lookup" ? 'Enter a query and click "Run" to lookup records' : 'Click "Run" to query NetSuite records'), 1)) : r("", !0),
3366
+ T(Wr, {
3367
+ ref_key: "poSideSheetRef",
3368
+ ref: k
3369
+ }, null, 512),
3370
+ T(ai, {
3371
+ ref_key: "toSideSheetRef",
3372
+ ref: F
3373
+ }, null, 512)
3374
+ ]);
3375
+ };
3376
+ }
3377
+ }), Ti = { class: "p-6 space-y-6" }, Di = {
3378
+ key: 0,
3379
+ class: "flex items-center justify-center py-16"
3380
+ }, Li = {
3381
+ key: 0,
3382
+ class: "flex flex-col gap-3 p-4 bg-blue-50 border border-blue-200 rounded-lg"
3383
+ }, Fi = { class: "flex items-center gap-2" }, Ri = {
3384
+ key: 0,
3385
+ class: "flex flex-col gap-0.5"
3386
+ }, Ni = { class: "font-mono text-sm font-medium" }, Oi = {
3387
+ key: 1,
3388
+ class: "text-sm text-gray-400 italic"
3389
+ }, Vi = {
3390
+ key: 0,
3391
+ class: "flex flex-col gap-0.5"
3392
+ }, Ui = { class: "font-mono text-sm font-medium" }, Bi = {
3393
+ key: 1,
3394
+ class: "text-sm text-gray-400 italic"
3395
+ }, Pi = { class: "grid grid-cols-2 gap-4" }, Ai = {
3396
+ key: 0,
3397
+ class: "flex flex-col gap-0.5"
3398
+ }, Ei = { class: "font-mono text-sm font-medium" }, Mi = {
3399
+ key: 1,
3400
+ class: "flex flex-col gap-0.5"
3401
+ }, ji = { class: "font-mono text-sm font-medium" }, qi = {
3402
+ key: 0,
3403
+ class: "text-sm text-gray-400 italic"
3404
+ }, Ji = {
3405
+ key: 3,
3406
+ class: "flex flex-col gap-0.5"
3407
+ }, zi = { class: "text-sm" }, Wi = { class: "grid grid-cols-2 gap-x-8 gap-y-3 text-sm" }, Qi = {
3408
+ key: 0,
3409
+ class: "col-span-2"
3410
+ }, Hi = { class: "font-mono font-medium" }, Ki = { key: 1 }, Yi = { class: "font-medium" }, Gi = { key: 2 }, Xi = { class: "font-medium" }, Zi = { key: 3 }, ed = { class: "font-medium" }, td = { key: 4 }, sd = { class: "font-medium" }, ad = { key: 5 }, od = { class: "font-medium" }, ld = { key: 6 }, rd = { class: "font-medium text-blue-700" }, nd = {
3411
+ key: 7,
3412
+ class: "col-span-2"
3413
+ }, id = { class: "text-gray-700 italic" }, dd = { key: 0 }, ud = { class: "text-xs font-semibold text-gray-500 uppercase tracking-wide mb-2" }, cd = { class: "border border-gray-200 rounded-lg overflow-hidden" }, vd = { class: "w-full text-sm" }, pd = ["onClick"], yd = { class: "w-8 pl-2 py-2 text-gray-400" }, xd = { class: "px-3 py-2 font-mono text-xs text-gray-400" }, md = { class: "px-3 py-2" }, gd = { class: "font-medium" }, fd = {
3414
+ key: 0,
3415
+ class: "text-xs text-gray-400 font-mono"
3416
+ }, bd = { class: "px-3 py-2 text-right font-medium" }, _d = { class: "px-3 py-2 text-gray-500 font-mono text-xs" }, hd = { class: "px-3 py-2 text-right text-gray-500 text-xs" }, kd = { class: "px-3 py-2 text-right text-gray-500 text-xs" }, $d = { class: "px-3 py-2 text-right text-gray-500 text-xs" }, wd = {
3417
+ key: 0,
3418
+ class: "border-b border-gray-100 bg-gray-50"
3419
+ }, Sd = { class: "flex items-center justify-between mb-2" }, Cd = ["onClick"], Id = {
3420
+ key: 0,
3421
+ class: "w-3.5 h-3.5",
3422
+ fill: "none",
3423
+ stroke: "currentColor",
3424
+ viewBox: "0 0 24 24"
3425
+ }, Td = { class: "space-y-1 text-xs font-mono" }, Dd = { class: "text-gray-400 shrink-0" }, Ld = { class: "text-gray-700 break-all" }, Fd = { class: "text-amber-700 font-semibold shrink-0" }, Rd = { class: "text-amber-900 break-all" }, Nd = { class: "border border-gray-200 rounded-lg overflow-hidden" }, Od = { key: 0 }, Vd = {
3426
+ key: 2,
3427
+ class: "p-3 bg-red-50 border border-red-200 rounded-lg text-sm text-red-700"
3428
+ }, Ud = {
3429
+ key: 2,
3430
+ class: "border border-gray-200 rounded-lg overflow-hidden"
3431
+ }, Bd = {
3432
+ key: 0,
3433
+ class: "p-2"
3434
+ }, Pd = { class: "flex justify-end gap-2" }, Ad = 8, Ed = /* @__PURE__ */ ne({
3435
+ __name: "InventoryTransferSideSheet",
3436
+ setup(W, { expose: P }) {
3437
+ const { FmSideSheet: n, FmButton: N, FmCircularProgress: k, FmChip: F } = oe, S = f(!1), x = f(!1), l = f(null), $ = f(null), p = f(!1), c = f(!1), _ = f(!1);
3438
+ async function h(u, i) {
3439
+ $.value = u, S.value = !0, x.value = !0, l.value = null, p.value = !1;
3440
+ try {
3441
+ l.value = await i();
3442
+ } catch (m) {
3443
+ l.value = { error: (m == null ? void 0 : m.message) || "Failed to fetch raw data" };
3444
+ } finally {
3445
+ x.value = !1;
3446
+ }
3447
+ }
3448
+ function A() {
3449
+ S.value = !1, l.value = null, $.value = null, p.value = !1, c.value = !1;
3450
+ }
3451
+ function w() {
3452
+ var u;
3453
+ (u = window.navigator.clipboard) == null || u.writeText(JSON.stringify(l.value, null, 2)), _.value = !0, setTimeout(() => _.value = !1, 2e3);
3454
+ }
3455
+ const b = B(() => {
3456
+ var u, i;
3457
+ return ((i = (u = l.value) == null ? void 0 : u.status) == null ? void 0 : i.refName) ?? null;
3458
+ }), R = B(() => {
3459
+ var u, i;
3460
+ return ((u = l.value) == null ? void 0 : u.tranId) ?? ((i = $.value) == null ? void 0 : i.transactionId) ?? null;
3461
+ }), V = B(() => {
3462
+ var u;
3463
+ return ((u = l.value) == null ? void 0 : u.tranDate) ?? null;
3464
+ }), J = B(() => {
3465
+ var u;
3466
+ return ((u = l.value) == null ? void 0 : u.createdDate) ?? null;
3467
+ }), Q = B(() => {
3468
+ var u;
3469
+ return ((u = l.value) == null ? void 0 : u.lastModifiedDate) ?? null;
3470
+ }), K = B(() => {
3471
+ var u;
3472
+ return ((u = l.value) == null ? void 0 : u.memo) ?? null;
3473
+ }), v = B(
3474
+ () => {
3475
+ var u, i, m;
3476
+ return ((i = (u = l.value) == null ? void 0 : u.location) == null ? void 0 : i.refName) ?? ((m = $.value) == null ? void 0 : m.sourceLocationName) ?? null;
3477
+ }
3478
+ ), s = B(
3479
+ () => {
3480
+ var u, i, m;
3481
+ return ((i = (u = l.value) == null ? void 0 : u.transferLocation) == null ? void 0 : i.refName) ?? ((m = $.value) == null ? void 0 : m.destinationLocationName) ?? null;
3482
+ }
3483
+ ), D = B(() => {
3484
+ var u, i;
3485
+ return l.value ? (u = l.value.inventory) != null && u.items ? l.value.inventory.items : (i = l.value.item) != null && i.items ? l.value.item.items : [] : [];
3486
+ }), d = B(() => {
3487
+ var u, i;
3488
+ return (i = (u = $.value) == null ? void 0 : u.meta) == null ? void 0 : i.itReplicaType;
3489
+ }), y = B(() => {
3490
+ var u, i;
3491
+ return (i = (u = $.value) == null ? void 0 : u.meta) == null ? void 0 : i.fmLinkedId;
3492
+ }), L = B(
3493
+ () => {
3494
+ var u, i;
3495
+ return (i = (u = $.value) == null ? void 0 : u.meta) == null ? void 0 : i.fmDeliveryOrderId;
3496
+ }
3497
+ ), E = B(() => {
3498
+ switch (d.value) {
3499
+ case "externalTransferOut":
3500
+ return "External Transfer Out";
3501
+ case "externalTransferIn":
3502
+ return "External Transfer In";
3503
+ case "internalTransfer":
3504
+ return "Internal Transfer";
3505
+ default:
3506
+ return null;
3507
+ }
3508
+ }), I = f(/* @__PURE__ */ new Set());
3509
+ function C(u) {
3510
+ I.value.has(u) ? I.value.delete(u) : I.value.add(u), I.value = new Set(I.value);
3511
+ }
3512
+ function Y(u) {
3513
+ const i = [], m = [];
3514
+ for (const [U, z] of Object.entries(u))
3515
+ U.startsWith("custcol") ? m.push([U, z]) : i.push([U, z]);
3516
+ return { normal: i, custcol: m };
3517
+ }
3518
+ const Z = f(null);
3519
+ function O(u, i) {
3520
+ var m;
3521
+ (m = window.navigator.clipboard) == null || m.writeText(JSON.stringify(u, null, 2)), Z.value = i, setTimeout(() => Z.value = null, 2e3);
3522
+ }
3523
+ return P({ open: h, close: A }), (u, i) => {
3524
+ var m;
3525
+ return t(), H(g(n), {
3526
+ modelValue: S.value,
3527
+ "onUpdate:modelValue": i[2] || (i[2] = (U) => S.value = U),
3528
+ header: `Inventory Transfer · ${((m = $.value) == null ? void 0 : m.recordId) ?? "-"}`,
3529
+ "max-width": 1200
3530
+ }, {
3531
+ "side-sheet-footer": te(() => [
3532
+ e("div", Pd, [
3533
+ T(g(N), {
3534
+ variant: "tertiary",
3535
+ onClick: A
3536
+ }, {
3537
+ default: te(() => i[26] || (i[26] = [
3538
+ re("Close")
3539
+ ])),
3540
+ _: 1
3541
+ })
3542
+ ])
3543
+ ]),
3544
+ default: te(() => {
3545
+ var U, z, ae;
3546
+ return [
3547
+ e("div", Ti, [
3548
+ x.value ? (t(), a("div", Di, [
3549
+ T(g(k), { size: "md" })
3550
+ ])) : x.value ? r("", !0) : (t(), a(M, { key: 1 }, [
3551
+ d.value ? (t(), a("div", Li, [
3552
+ e("div", Fi, [
3553
+ i[3] || (i[3] = e("span", { class: "text-xs font-semibold text-blue-700 uppercase tracking-wide" }, "FeedMe Link", -1)),
3554
+ E.value ? (t(), H(g(F), {
3555
+ key: 0,
3556
+ label: E.value,
3557
+ compact: ""
3558
+ }, null, 8, ["label"])) : r("", !0)
3559
+ ]),
3560
+ d.value === "externalTransferOut" ? (t(), a(M, { key: 0 }, [
3561
+ y.value ? (t(), a("div", Ri, [
3562
+ i[4] || (i[4] = e("span", { class: "text-xs text-gray-500 uppercase tracking-wide" }, "Adjustment ID", -1)),
3563
+ e("span", Ni, o(y.value), 1)
3564
+ ])) : (t(), a("div", Oi, "No adjustment linked"))
3565
+ ], 64)) : d.value === "externalTransferIn" ? (t(), a(M, { key: 1 }, [
3566
+ y.value ? (t(), a("div", Vi, [
3567
+ i[5] || (i[5] = e("span", { class: "text-xs text-gray-500 uppercase tracking-wide" }, "Purchase Order ID", -1)),
3568
+ e("span", Ui, o(y.value), 1)
3569
+ ])) : (t(), a("div", Bi, "No purchase order linked"))
3570
+ ], 64)) : d.value === "internalTransfer" ? (t(), a(M, { key: 2 }, [
3571
+ e("div", Pi, [
3572
+ y.value ? (t(), a("div", Ai, [
3573
+ i[6] || (i[6] = e("span", { class: "text-xs text-gray-500 uppercase tracking-wide" }, "Purchase Order ID", -1)),
3574
+ e("span", Ei, o(y.value), 1)
3575
+ ])) : r("", !0),
3576
+ L.value ? (t(), a("div", Mi, [
3577
+ i[7] || (i[7] = e("span", { class: "text-xs text-gray-500 uppercase tracking-wide" }, "Delivery Order ID", -1)),
3578
+ e("span", ji, o(L.value), 1)
3579
+ ])) : r("", !0)
3580
+ ]),
3581
+ !y.value && !L.value ? (t(), a("div", qi, " No purchase order or delivery order linked ")) : r("", !0)
3582
+ ], 64)) : r("", !0),
3583
+ (U = $.value) != null && U.syncedAt ? (t(), a("div", Ji, [
3584
+ i[8] || (i[8] = e("span", { class: "text-xs text-gray-500 uppercase tracking-wide" }, "Last Synced", -1)),
3585
+ e("span", zi, o(new Date($.value.syncedAt).toLocaleString()), 1)
3586
+ ])) : r("", !0)
3587
+ ])) : r("", !0),
3588
+ l.value && !l.value.error ? (t(), a(M, { key: 1 }, [
3589
+ e("div", Wi, [
3590
+ R.value ? (t(), a("div", Qi, [
3591
+ i[9] || (i[9] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Transaction ID", -1)),
3592
+ e("div", Hi, o(R.value), 1)
3593
+ ])) : r("", !0),
3594
+ b.value ? (t(), a("div", Ki, [
3595
+ i[10] || (i[10] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Status", -1)),
3596
+ e("div", Yi, o(b.value), 1)
3597
+ ])) : r("", !0),
3598
+ V.value ? (t(), a("div", Gi, [
3599
+ i[11] || (i[11] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Tran Date", -1)),
3600
+ e("div", Xi, o(new Date(V.value).toLocaleDateString()), 1)
3601
+ ])) : r("", !0),
3602
+ J.value ? (t(), a("div", Zi, [
3603
+ i[12] || (i[12] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Created", -1)),
3604
+ e("div", ed, o(new Date(J.value).toLocaleString()), 1)
3605
+ ])) : r("", !0),
3606
+ Q.value ? (t(), a("div", td, [
3607
+ i[13] || (i[13] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Last Modified", -1)),
3608
+ e("div", sd, o(new Date(Q.value).toLocaleString()), 1)
3609
+ ])) : r("", !0),
3610
+ v.value ? (t(), a("div", ad, [
3611
+ i[14] || (i[14] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, " Source Location ", -1)),
3612
+ e("div", od, o(v.value), 1)
3613
+ ])) : r("", !0),
3614
+ s.value ? (t(), a("div", ld, [
3615
+ i[15] || (i[15] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, " Destination Location ", -1)),
3616
+ e("div", rd, o(s.value), 1)
3617
+ ])) : r("", !0),
3618
+ K.value ? (t(), a("div", nd, [
3619
+ i[16] || (i[16] = e("div", { class: "text-xs text-gray-500 uppercase tracking-wide mb-0.5" }, "Memo", -1)),
3620
+ e("div", id, o(K.value), 1)
3621
+ ])) : r("", !0)
3622
+ ]),
3623
+ D.value.length > 0 ? (t(), a("div", dd, [
3624
+ e("div", ud, " Items (" + o(D.value.length) + ") ", 1),
3625
+ e("div", cd, [
3626
+ e("table", vd, [
3627
+ i[21] || (i[21] = e("thead", { class: "bg-gray-50 border-b border-gray-200" }, [
3628
+ e("tr", null, [
3629
+ e("th", { class: "w-8" }),
3630
+ e("th", { class: "text-left px-3 py-2 font-medium text-gray-600" }, "#"),
3631
+ e("th", { class: "text-left px-3 py-2 font-medium text-gray-600" }, "Item"),
3632
+ e("th", { class: "text-right px-3 py-2 font-medium text-gray-600" }, "Qty"),
3633
+ e("th", { class: "text-left px-3 py-2 font-medium text-gray-600" }, "Unit"),
3634
+ e("th", { class: "text-right px-3 py-2 font-medium text-gray-600" }, "On Hand"),
3635
+ e("th", { class: "text-right px-3 py-2 font-medium text-gray-600" }, "Available"),
3636
+ e("th", { class: "text-right px-3 py-2 font-medium text-gray-600" }, "Committed")
3637
+ ])
3638
+ ], -1)),
3639
+ e("tbody", null, [
3640
+ (t(!0), a(M, null, X(D.value, (G, ee) => {
3641
+ var ie, me;
3642
+ return t(), a(M, {
3643
+ key: G.line ?? ee
3644
+ }, [
3645
+ e("tr", {
3646
+ class: j(["border-b border-gray-100 cursor-pointer select-none hover:bg-blue-50/40", I.value.has(ee) ? "bg-blue-50/60" : ""]),
3647
+ onClick: (le) => C(ee)
3648
+ }, [
3649
+ e("td", yd, [
3650
+ (t(), a("svg", {
3651
+ class: j(["w-3.5 h-3.5 transition-transform", I.value.has(ee) ? "rotate-90" : ""]),
3652
+ fill: "none",
3653
+ stroke: "currentColor",
3654
+ viewBox: "0 0 24 24"
3655
+ }, i[17] || (i[17] = [
3656
+ e("path", {
3657
+ "stroke-linecap": "round",
3658
+ "stroke-linejoin": "round",
3659
+ "stroke-width": "2",
3660
+ d: "M9 5l7 7-7 7"
3661
+ }, null, -1)
3662
+ ]), 2))
3663
+ ]),
3664
+ e("td", xd, o(G.line ?? ee + 1), 1),
3665
+ e("td", md, [
3666
+ e("div", gd, o(((ie = G.item) == null ? void 0 : ie.refName) || "—"), 1),
3667
+ (me = G.item) != null && me.id ? (t(), a("div", fd, " ID: " + o(G.item.id), 1)) : r("", !0)
3668
+ ]),
3669
+ e("td", bd, o(G.adjustQtyBy ?? G.quantity ?? "—"), 1),
3670
+ e("td", _d, o(G.units || "—"), 1),
3671
+ e("td", hd, o(G.quantityOnHand ?? "—"), 1),
3672
+ e("td", kd, o(G.quantityAvailable ?? "—"), 1),
3673
+ e("td", $d, o(G.quantityCommitted ?? "—"), 1)
3674
+ ], 10, pd),
3675
+ I.value.has(ee) ? (t(), a("tr", wd, [
3676
+ e("td", {
3677
+ colspan: Ad,
3678
+ class: "px-4 py-3"
3679
+ }, [
3680
+ e("div", Sd, [
3681
+ i[19] || (i[19] = e("span", { class: "text-xs font-semibold text-gray-500 uppercase tracking-wide" }, "Raw Item Data", -1)),
3682
+ e("button", {
3683
+ class: j([
3684
+ "text-xs flex items-center gap-1 transition-colors",
3685
+ Z.value === ee ? "text-green-600" : "text-gray-400 hover:text-gray-700"
3686
+ ]),
3687
+ onClick: de((le) => O(G, ee), ["stop"])
3688
+ }, [
3689
+ Z.value === ee ? (t(), a("svg", Id, i[18] || (i[18] = [
3690
+ e("path", {
3691
+ "stroke-linecap": "round",
3692
+ "stroke-linejoin": "round",
3693
+ "stroke-width": "2",
3694
+ d: "M5 13l4 4L19 7"
3695
+ }, null, -1)
3696
+ ]))) : r("", !0),
3697
+ re(" " + o(Z.value === ee ? "Copied!" : "Copy"), 1)
3698
+ ], 10, Cd)
3699
+ ]),
3700
+ e("div", Td, [
3701
+ (t(!0), a(M, null, X(Y(G).normal, ([le, pe]) => (t(), a("div", {
3702
+ key: le,
3703
+ class: "flex gap-2"
3704
+ }, [
3705
+ e("span", Dd, o(le) + ":", 1),
3706
+ e("span", Ld, o(JSON.stringify(pe)), 1)
3707
+ ]))), 128)),
3708
+ Y(G).custcol.length > 0 ? (t(), a(M, { key: 0 }, [
3709
+ i[20] || (i[20] = e("div", { class: "mt-2 mb-1 text-xs font-semibold text-amber-600 uppercase tracking-wide" }, " Custom Columns ", -1)),
3710
+ (t(!0), a(M, null, X(Y(G).custcol, ([le, pe]) => (t(), a("div", {
3711
+ key: le,
3712
+ class: "flex gap-2 rounded px-1.5 py-0.5 bg-amber-50 border border-amber-200"
3713
+ }, [
3714
+ e("span", Fd, o(le) + ":", 1),
3715
+ e("span", Rd, o(JSON.stringify(pe)), 1)
3716
+ ]))), 128))
3717
+ ], 64)) : r("", !0)
3718
+ ])
3719
+ ])
3720
+ ])) : r("", !0)
3721
+ ], 64);
3722
+ }), 128))
3723
+ ])
3724
+ ])
3725
+ ])
3726
+ ])) : r("", !0),
3727
+ e("div", Nd, [
3728
+ e("div", {
3729
+ class: j(["flex items-center gap-1.5 px-3 py-2 bg-gray-50 cursor-pointer select-none hover:bg-gray-100 transition-colors", p.value ? "border-b border-gray-200" : ""]),
3730
+ onClick: i[0] || (i[0] = (G) => p.value = !p.value)
3731
+ }, [
3732
+ (t(), a("svg", {
3733
+ class: j(["w-3.5 h-3.5 transition-transform text-gray-500", p.value ? "rotate-90" : ""]),
3734
+ fill: "none",
3735
+ stroke: "currentColor",
3736
+ viewBox: "0 0 24 24"
3737
+ }, i[22] || (i[22] = [
3738
+ e("path", {
3739
+ "stroke-linecap": "round",
3740
+ "stroke-linejoin": "round",
3741
+ "stroke-width": "2",
3742
+ d: "M9 5l7 7-7 7"
3743
+ }, null, -1)
3744
+ ]), 2)),
3745
+ i[23] || (i[23] = e("span", { class: "text-xs font-medium text-gray-600" }, "(NetSuite) Raw JSON", -1)),
3746
+ p.value ? (t(), a("button", {
3747
+ key: 0,
3748
+ class: j(["ml-auto text-xs flex items-center gap-1 transition-colors", _.value ? "text-green-600" : "text-gray-400 hover:text-gray-700"]),
3749
+ onClick: de(w, ["stop"])
3750
+ }, o(_.value ? "Copied!" : "Copy JSON"), 3)) : r("", !0)
3751
+ ], 2),
3752
+ p.value ? (t(), a("div", Od, [
3753
+ T(ye, { value: l.value }, null, 8, ["value"])
3754
+ ])) : r("", !0)
3755
+ ])
3756
+ ], 64)) : r("", !0),
3757
+ (z = l.value) != null && z.error ? (t(), a("div", Vd, o(l.value.error), 1)) : r("", !0)
3758
+ ], 64)),
3759
+ (ae = $.value) != null && ae.recordId ? (t(), a("div", Ud, [
3760
+ e("div", {
3761
+ class: j(["flex items-center gap-1.5 px-3 py-2 bg-gray-50 cursor-pointer select-none hover:bg-gray-100 transition-colors", c.value ? "border-b border-gray-200" : ""]),
3762
+ onClick: i[1] || (i[1] = (G) => c.value = !c.value)
3763
+ }, [
3764
+ (t(), a("svg", {
3765
+ class: j(["w-3.5 h-3.5 transition-transform text-gray-500", c.value ? "rotate-90" : ""]),
3766
+ fill: "none",
3767
+ stroke: "currentColor",
3768
+ viewBox: "0 0 24 24"
3769
+ }, i[24] || (i[24] = [
3770
+ e("path", {
3771
+ "stroke-linecap": "round",
3772
+ "stroke-linejoin": "round",
3773
+ "stroke-width": "2",
3774
+ d: "M9 5l7 7-7 7"
3775
+ }, null, -1)
3776
+ ]), 2)),
3777
+ i[25] || (i[25] = e("span", { class: "text-xs font-medium text-gray-600" }, "Sync Logs", -1))
3778
+ ], 2),
3779
+ c.value ? (t(), a("div", Bd, [
3780
+ T(ve, {
3781
+ "netsuite-id": $.value.recordId,
3782
+ "record-type": "inventoryTransfer"
3783
+ }, null, 8, ["netsuite-id"])
3784
+ ])) : r("", !0)
3785
+ ])) : r("", !0)
3786
+ ])
3787
+ ];
3788
+ }),
3789
+ _: 1
3790
+ }, 8, ["modelValue", "header"]);
3791
+ };
3792
+ }
3793
+ }), Md = { class: "flex flex-col gap-4" }, jd = {
3794
+ key: 0,
3795
+ class: "p-3 bg-red-50 border border-red-200 rounded-lg text-sm text-red-700"
3796
+ }, qd = {
3797
+ key: 1,
3798
+ class: "flex justify-center py-8"
3799
+ }, Jd = {
3800
+ key: 2,
3801
+ class: "flex flex-col gap-4"
3802
+ }, zd = { class: "flex flex-col gap-2" }, Wd = { class: "text-lg font-semibold" }, Qd = { class: "grid grid-cols-2 gap-2 text-sm" }, Hd = { class: "ml-2 font-mono" }, Kd = { class: "ml-2" }, Yd = {
3803
+ key: 0,
3804
+ class: "p-4 bg-gray-50 border border-gray-200 rounded-lg mt-1 mb-2"
3805
+ }, Gd = {
3806
+ key: 4,
3807
+ class: "text-center py-8 text-gray-400"
3808
+ }, Xd = /* @__PURE__ */ ne({
3809
+ __name: "InventoryTransferView",
3810
+ props: {
3811
+ currentLocationSetting: {},
3812
+ nsLocations: {},
3813
+ currentLocationSubsidiary: {}
3814
+ },
3815
+ setup(W) {
3816
+ const P = W, n = Ne(), N = ce(), k = f(), F = [{ value: "inventoryTransfer", label: "Inventory Transfer" }];
3817
+ async function S() {
3818
+ var c;
3819
+ const p = ((c = P.currentLocationSetting) == null ? void 0 : c.id) || "";
3820
+ if (!p) {
3821
+ n.error.value = "Location ID is required";
3822
+ return;
3823
+ }
3824
+ if (n.activeUseCase.value === "lookup") {
3825
+ n.lookupRecordType.value = "inventoryTransfer", await n.executeLookup(
3826
+ "inventoryTransfer",
3827
+ p,
3828
+ n.netsuiteIdInput.value,
3829
+ n.queryField.value
3830
+ );
3831
+ return;
3832
+ }
3833
+ await n.executeListByDateRange("inventoryTransfer", p);
3834
+ }
3835
+ const x = B(() => {
3836
+ let p = n.records.value;
3837
+ if (n.syncFilter.value === "synced" ? p = p.filter((c) => c.syncedAt != null) : n.syncFilter.value === "unsynced" && (p = p.filter((c) => c.syncedAt == null)), n.filterRule.value) {
3838
+ const c = he.build(n.filterRule.value);
3839
+ p = p.filter(
3840
+ (_) => ke(
3841
+ {
3842
+ syncStatus: _.syncedAt != null ? "synced" : "unsynced"
3843
+ },
3844
+ c
3845
+ )
3846
+ );
3847
+ }
3848
+ if (n.searchValue.value && n.searchValue.value.trim()) {
3849
+ const c = n.searchValue.value.toLowerCase();
3850
+ p = p.filter(
3851
+ (_) => {
3852
+ var h, A, w, b;
3853
+ return ((h = _.recordId) == null ? void 0 : h.toLowerCase().includes(c)) || ((A = _.transactionId) == null ? void 0 : A.toLowerCase().includes(c)) || ((w = _.sourceLocationName) == null ? void 0 : w.toLowerCase().includes(c)) || ((b = _.destinationLocationName) == null ? void 0 : b.toLowerCase().includes(c));
3854
+ }
3855
+ );
3856
+ }
3857
+ return p;
3858
+ });
3859
+ async function l(p) {
3860
+ var _;
3861
+ const c = p.original;
3862
+ (_ = k.value) == null || _.open(c, async () => (await N.readOrderById("inventoryTransfer", c.recordId)).netsuiteRecord);
3863
+ }
3864
+ const $ = [
3865
+ {
3866
+ id: "id",
3867
+ header: () => "NS ID",
3868
+ accessorKey: "recordId",
3869
+ size: 100,
3870
+ cell: (p) => q("span", { class: "font-mono text-sm" }, p.getValue())
3871
+ },
3872
+ {
3873
+ id: "tranid",
3874
+ header: () => "Tran ID",
3875
+ accessorKey: "transactionId",
3876
+ cell: (p) => q("span", { class: "font-medium" }, p.getValue())
3877
+ },
3878
+ {
3879
+ id: "trandate",
3880
+ header: () => "Tran Date",
3881
+ accessorFn: (p) => {
3882
+ const c = p.transactionDate;
3883
+ if (!c) return 0;
3884
+ const [_, h, A] = c.split("/");
3885
+ return new Date(Number(A), Number(h) - 1, Number(_)).getTime();
3886
+ },
3887
+ cell: (p) => {
3888
+ const c = p.getValue();
3889
+ return c ? q("span", { class: "text-sm" }, new Date(c).toLocaleDateString()) : q("span", { class: "text-sm" }, "-");
3890
+ }
3891
+ },
3892
+ {
3893
+ id: "fromLocation",
3894
+ header: () => "From Location",
3895
+ accessorFn: (p) => p.sourceLocationName || "N/A",
3896
+ cell: (p) => {
3897
+ var w;
3898
+ const c = p.row.original, _ = c.sourceLocationId || "", h = c.sourceLocationName || "N/A", A = _ && _ === ((w = P.currentLocationSetting) == null ? void 0 : w.netSuiteId);
3899
+ return q("div", { class: "flex flex-col" }, [
3900
+ q(
3901
+ "span",
3902
+ { class: A ? "text-sm font-semibold text-blue-700" : "text-sm" },
3903
+ h
3904
+ ),
3905
+ q("span", { class: "text-xs text-gray-400" }, `ID: ${_ || "N/A"}`)
3906
+ ]);
3907
+ }
3908
+ },
3909
+ {
3910
+ id: "toLocation",
3911
+ header: () => "To Location",
3912
+ accessorFn: (p) => p.destinationLocationName || "N/A",
3913
+ cell: (p) => {
3914
+ var w;
3915
+ const c = p.row.original, _ = c.destinationLocationId || "", h = c.destinationLocationName || "N/A", A = _ && _ === ((w = P.currentLocationSetting) == null ? void 0 : w.netSuiteId);
3916
+ return q("div", { class: "flex flex-col" }, [
3917
+ q(
3918
+ "span",
3919
+ { class: A ? "text-sm font-semibold text-blue-700" : "text-sm" },
3920
+ h
3921
+ ),
3922
+ q("span", { class: "text-xs text-gray-400" }, `ID: ${_ || "N/A"}`)
3923
+ ]);
3924
+ }
3925
+ },
3926
+ {
3927
+ id: "syncedAt",
3928
+ header: () => "Synced At",
3929
+ accessorKey: "syncedAt",
3930
+ size: 160,
3931
+ cell: (p) => {
3932
+ const c = p.getValue();
3933
+ return c ? q("span", { class: "text-sm" }, new Date(c).toLocaleString()) : q("span", { class: "text-gray-300" }, "—");
3934
+ }
3935
+ },
3936
+ {
3937
+ id: "expand",
3938
+ header: () => "",
3939
+ size: 50,
3940
+ cell: (p) => {
3941
+ const c = p.row.original.recordId, _ = n.isRowExpanded(c);
3942
+ return q(
3943
+ oe.FmButton,
3944
+ {
3945
+ variant: "tertiary",
3946
+ compact: !0,
3947
+ onClick: (h) => {
3948
+ h.stopPropagation(), n.toggleRowExpand(c);
3949
+ }
3950
+ },
3951
+ () => q(oe.FmIcon, { name: _ ? "expand_less" : "expand_more", size: "sm" })
3952
+ );
3953
+ }
3954
+ }
3955
+ ];
3956
+ return (p, c) => {
3957
+ const _ = se("FmCircularProgress"), h = se("FmCardSection"), A = se("FmCard"), w = se("FmTable");
3958
+ return t(), a("div", Md, [
3959
+ c[11] || (c[11] = e("div", { class: "text-sm text-gray-600" }, " Query Inventory Transfers from NetSuite. Results are cross-referenced with FeedMe to show sync status. DO-linked records are annotated. ", -1)),
3960
+ T(Fe, {
3961
+ "active-use-case": g(n).activeUseCase.value,
3962
+ "netsuite-id-input": g(n).netsuiteIdInput.value,
3963
+ "lookup-record-type": "inventoryTransfer",
3964
+ "lookup-record-type-options": F,
3965
+ "query-field": g(n).queryField.value,
3966
+ "date-range": g(n).dateRange.value,
3967
+ "sync-filter": g(n).syncFilter.value,
3968
+ "filter-rule": g(n).filterRule.value,
3969
+ "search-value": g(n).searchValue.value,
3970
+ "date-range-error": g(n).dateRangeError.value,
3971
+ loading: g(n).loading.value,
3972
+ stats: g(n).stats.value,
3973
+ "show-direction": !1,
3974
+ direction: g(n).direction.value,
3975
+ "onUpdate:activeUseCase": c[0] || (c[0] = (b) => g(n).activeUseCase.value = b),
3976
+ "onUpdate:netsuiteIdInput": c[1] || (c[1] = (b) => g(n).netsuiteIdInput.value = b),
3977
+ "onUpdate:lookupRecordType": c[2] || (c[2] = (b) => g(n).lookupRecordType.value = "inventoryTransfer"),
3978
+ "onUpdate:queryField": c[3] || (c[3] = (b) => g(n).queryField.value = b),
3979
+ "onUpdate:dateRange": c[4] || (c[4] = (b) => g(n).dateRange.value = b),
3980
+ "onUpdate:syncFilter": c[5] || (c[5] = (b) => g(n).syncFilter.value = b),
3981
+ "onUpdate:filterRule": c[6] || (c[6] = (b) => g(n).filterRule.value = b),
3982
+ "onUpdate:searchValue": c[7] || (c[7] = (b) => g(n).searchValue.value = b),
3983
+ "onUpdate:direction": c[8] || (c[8] = (b) => g(n).direction.value = b),
3984
+ onExecute: S
3985
+ }, null, 8, ["active-use-case", "netsuite-id-input", "query-field", "date-range", "sync-filter", "filter-rule", "search-value", "date-range-error", "loading", "stats", "direction"]),
3986
+ g(n).error.value ? (t(), a("div", jd, o(g(n).error.value), 1)) : r("", !0),
3987
+ g(n).loading.value ? (t(), a("div", qd, [
3988
+ T(_, { size: "md" })
3989
+ ])) : g(n).activeUseCase.value === "lookup" && g(n).lookupResult.value ? (t(), a("div", Jd, [
3990
+ T(A, null, {
3991
+ default: te(() => [
3992
+ T(h, null, {
3993
+ default: te(() => {
3994
+ var b, R, V;
3995
+ return [
3996
+ e("div", zd, [
3997
+ e("div", Wd, o(((b = g(n).lookupResult.value.additionalInfo) == null ? void 0 : b.tranid) || "Inventory Transfer"), 1),
3998
+ e("div", Qd, [
3999
+ e("div", null, [
4000
+ c[9] || (c[9] = e("span", { class: "text-gray-500" }, "NetSuite ID:", -1)),
4001
+ e("span", Hd, o((R = g(n).lookupResult.value.additionalInfo) == null ? void 0 : R.id), 1)
4002
+ ]),
4003
+ e("div", null, [
4004
+ c[10] || (c[10] = e("span", { class: "text-gray-500" }, "Transaction #:", -1)),
4005
+ e("span", Kd, o((V = g(n).lookupResult.value.additionalInfo) == null ? void 0 : V.transactionnumber), 1)
4006
+ ])
4007
+ ])
4008
+ ])
4009
+ ];
4010
+ }),
4011
+ _: 1
4012
+ })
4013
+ ]),
4014
+ _: 1
4015
+ })
4016
+ ])) : x.value.length > 0 ? (t(), a(M, { key: 3 }, [
4017
+ T(w, {
4018
+ "column-defs": $,
4019
+ "row-data": x.value,
4020
+ onRowClick: l,
4021
+ class: "cursor-pointer"
4022
+ }, null, 8, ["row-data"]),
4023
+ (t(!0), a(M, null, X(x.value, (b) => (t(), a("div", {
4024
+ key: b.recordId
4025
+ }, [
4026
+ g(n).isRowExpanded(b.recordId) ? (t(), a("div", Yd, [
4027
+ T(ve, {
4028
+ "netsuite-id": b.recordId
4029
+ }, null, 8, ["netsuite-id"])
4030
+ ])) : r("", !0)
4031
+ ]))), 128))
4032
+ ], 64)) : !g(n).loading.value && !g(n).error.value ? (t(), a("div", Gd, o(g(n).activeUseCase.value === "lookup" ? 'Enter a query and click "Run" to lookup records' : 'Click "Run" to query NetSuite inventory transfers'), 1)) : r("", !0),
4033
+ T(Ed, {
4034
+ ref_key: "itSideSheetRef",
4035
+ ref: k
4036
+ }, null, 512)
4037
+ ]);
4038
+ };
4039
+ }
4040
+ }), Zd = { class: "flex flex-col gap-6" }, eu = {
4041
+ key: 0,
4042
+ class: "flex justify-center py-8"
4043
+ }, tu = {
4044
+ key: 1,
4045
+ class: "flex flex-col items-center my-10 gap-5"
4046
+ }, su = {
4047
+ key: 2,
4048
+ class: "flex flex-col items-center my-10 gap-5"
4049
+ }, au = { key: 1 }, ou = /* @__PURE__ */ ne({
4050
+ __name: "NetSuiteExplorerView",
4051
+ setup(W) {
4052
+ const P = Ce(), n = Ie(), N = f(!1), k = B(() => n.isBusinessLocation), F = B(() => n.isEnabled), S = B(() => n.isCurrentLocationBindedToNetSuite), x = [
4053
+ { value: "explorer-items", label: "Items" },
4054
+ { value: "explorer-unitTypes", label: "Unit Types" }
4055
+ ], l = [
4056
+ { value: "explorer-orders", label: "Orders (PO / TO)" },
4057
+ { value: "explorer-inventoryTransfer", label: "Inventory Transfer" }
4058
+ ], $ = B(() => k.value ? x : l), p = f(
4059
+ "explorer-items"
4060
+ /* ITEMS */
4061
+ );
4062
+ Be(() => {
4063
+ const w = $.value[0];
4064
+ w && !$.value.find((b) => b.value === p.value) && (p.value = w.value);
4065
+ });
4066
+ const c = f([]), _ = B(() => n.currentLocationSubsidiary()), h = B(() => n.currentLocationSetting), A = B(
4067
+ () => c.value.filter(
4068
+ (w) => {
4069
+ var b, R;
4070
+ return w.subsidiaryId === ((b = _.value) == null ? void 0 : b.id) || w.netsuiteId === ((R = _.value) == null ? void 0 : R.id);
4071
+ }
4072
+ )
4073
+ );
4074
+ return _e(async () => {
4075
+ if (P._currentLocation) {
4076
+ N.value = !0;
4077
+ try {
4078
+ await n.readSetting();
4079
+ } finally {
4080
+ N.value = !1;
4081
+ }
4082
+ }
4083
+ }), (w, b) => {
4084
+ const R = se("FmCircularProgress"), V = se("FmTabs");
4085
+ return t(), a("div", Zd, [
4086
+ N.value ? (t(), a("div", eu, [
4087
+ T(R, { size: "lg" })
4088
+ ])) : F.value ? !k.value && !S.value ? (t(), a("div", su, b[2] || (b[2] = [
4089
+ e("div", { class: "font-bold text-lg" }, "NetSuite not configured", -1),
4090
+ e("div", {
4091
+ class: "text-xs text-neutral-400 text-center",
4092
+ style: { "max-width": "25rem" }
4093
+ }, " NetSuite is not configured for this location. Please contact your administrator. ", -1)
4094
+ ]))) : (t(), a(M, { key: 3 }, [
4095
+ T(V, {
4096
+ "model-value": p.value,
4097
+ "onUpdate:modelValue": b[0] || (b[0] = (J) => p.value = J),
4098
+ items: $.value,
4099
+ key: "netsuite-explorer-tabs"
4100
+ }, null, 8, ["model-value", "items"]),
4101
+ k.value ? (t(), a(M, { key: 0 }, [
4102
+ p.value === "explorer-items" ? (t(), H(Go, { key: 0 })) : r("", !0),
4103
+ p.value === "explorer-unitTypes" ? (t(), a("div", au, "Coming Soon")) : r("", !0)
4104
+ ], 64)) : S.value ? (t(), a(M, { key: 1 }, [
4105
+ p.value === "explorer-orders" ? (t(), H(Ii, {
4106
+ key: 0,
4107
+ currentLocationSetting: h.value,
4108
+ nsLocations: A.value,
4109
+ currentLocationSubsidiary: _.value
4110
+ }, null, 8, ["currentLocationSetting", "nsLocations", "currentLocationSubsidiary"])) : r("", !0),
4111
+ p.value === "explorer-inventoryTransfer" ? (t(), H(Xd, {
4112
+ key: 1,
4113
+ currentLocationSetting: h.value,
4114
+ nsLocations: A.value,
4115
+ currentLocationSubsidiary: _.value
4116
+ }, null, 8, ["currentLocationSetting", "nsLocations", "currentLocationSubsidiary"])) : r("", !0)
4117
+ ], 64)) : r("", !0)
4118
+ ], 64)) : (t(), a("div", tu, b[1] || (b[1] = [
4119
+ e("div", { class: "font-bold text-lg" }, "NetSuite not enabled", -1),
4120
+ e("div", {
4121
+ class: "text-xs text-neutral-400 text-center",
4122
+ style: { "max-width": "25rem" }
4123
+ }, " NetSuite integration is not configured for this business. Please enable it from the Integration page first. ", -1)
4124
+ ])))
4125
+ ]);
4126
+ };
4127
+ }
4128
+ }), lu = {
4129
+ key: 0,
4130
+ class: "flex justify-center py-8"
4131
+ }, ru = { class: "flex flex-col gap-3" }, nu = {
4132
+ key: 1,
4133
+ class: "flex flex-col items-center my-10 gap-5"
4134
+ }, fu = /* @__PURE__ */ ne({
4135
+ __name: "IntegrationExplorerView",
4136
+ setup(W) {
4137
+ const P = Ce(), { breakpoints: n } = Pe(), N = B(() => n.value.xs || n.value.sm), k = f(
4138
+ "netsuite"
4139
+ /* NETSUITE */
4140
+ ), F = [{ value: "netsuite", label: "NetSuite" }];
4141
+ return (S, x) => {
4142
+ const l = se("FmCircularProgress"), $ = se("FmSelect");
4143
+ return t(), H(Ae, { title: "Integration Explorer" }, {
4144
+ default: te(() => [
4145
+ e("div", {
4146
+ class: j(["flex flex-col gap-8 max-h-full", { "p-0": N.value, "px-24": !N.value }])
4147
+ }, [
4148
+ g(P)._currentLocation ? (t(), a(M, { key: 1 }, [
4149
+ e("div", ru, [
4150
+ x[1] || (x[1] = e("label", { class: "text-sm font-medium text-gray-700" }, "Integration Platform", -1)),
4151
+ T($, {
4152
+ modelValue: k.value,
4153
+ "onUpdate:modelValue": x[0] || (x[0] = (p) => k.value = p),
4154
+ items: F,
4155
+ placeholder: "Select integration platform",
4156
+ style: { "max-width": "300px" }
4157
+ }, null, 8, ["modelValue"])
4158
+ ]),
4159
+ T(Ee, {
4160
+ "change-location": "",
4161
+ showBusiness: ""
4162
+ }),
4163
+ x[3] || (x[3] = e("hr", { class: "my-2" }, null, -1)),
4164
+ k.value === "netsuite" ? (t(), H(ou, { key: 0 })) : r("", !0),
4165
+ k.value ? r("", !0) : (t(), a("div", nu, x[2] || (x[2] = [
4166
+ e("div", { class: "font-bold text-lg" }, "Select an Integration Platform", -1),
4167
+ e("div", {
4168
+ class: "text-xs text-neutral-400 text-center",
4169
+ style: { "max-width": "25rem" }
4170
+ }, " Choose an integration platform from the dropdown above to get started. ", -1)
4171
+ ])))
4172
+ ], 64)) : (t(), a("div", lu, [
4173
+ T(l, { size: "lg" })
4174
+ ]))
4175
+ ], 2)
4176
+ ]),
4177
+ _: 1
4178
+ });
4179
+ };
4180
+ }
4181
+ });
4182
+ export {
4183
+ fu as default
4184
+ };