@tesouro/embedded-components-react 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,28 +27,29 @@ import { useExpenseHistoryQuery as pe } from "../../../../data-access/dist/lib/u
27
27
  import { useGetTransactionQuery as me } from "../../../../data-access/dist/lib/useGetTransactionQuery.js";
28
28
  import { usePatchReceiptMutation as he } from "../../../../data-access/dist/lib/usePatchReceiptMutation.js";
29
29
  import { useUploadReceiptMutation as ge } from "../../../../data-access/dist/lib/useUploadReceiptMutation.js";
30
- import { useTransactionValidationsQuery as _e } from "../../../../data-access/dist/lib/useTransactionValidationsQuery.js";
31
- import { useGetApprovalRequestsQuery as ve } from "../../../../data-access/dist/lib/useGetApprovalRequestsQuery.js";
32
- import { useUpdateTransactionMutation as ye } from "../../../../data-access/dist/lib/useTransactionReviewMutations.js";
30
+ import { useTrackReceiptMatching as _e } from "../../../../data-access/dist/lib/useTrackReceiptMatching.js";
31
+ import { useTransactionValidationsQuery as ve } from "../../../../data-access/dist/lib/useTransactionValidationsQuery.js";
32
+ import { useGetApprovalRequestsQuery as ye } from "../../../../data-access/dist/lib/useGetApprovalRequestsQuery.js";
33
+ import { useUpdateTransactionMutation as be } from "../../../../data-access/dist/lib/useTransactionReviewMutations.js";
33
34
  import "../../../../data-access/dist/index.js";
34
- import { TransactionDetailsActionsFeature as be } from "./TransactionDetailsActionsFeature.js";
35
- import { entityUserLabel as xe } from "../ExpenseManagementWidget/entityUserLabel.js";
36
- import { canApproveExpenses as Se, canWriteExpenses as Ce, isExpenseAdmin as we } from "../ExpenseManagementWidget/permissions.js";
37
- import { buildExpenseAuditHistory as Te } from "./auditHistory/buildExpenseAuditHistory.js";
38
- import { EXPENSE_AUDIT_HISTORY_LABELS_EN as Ee } from "./auditHistory/labels.js";
39
- import { ReceiptMatchWidget as De } from "../../../../receipt-match/feature/dist/index4.js";
35
+ import { TransactionDetailsActionsFeature as xe } from "./TransactionDetailsActionsFeature.js";
36
+ import { entityUserLabel as Se } from "../ExpenseManagementWidget/entityUserLabel.js";
37
+ import { canApproveExpenses as Ce, canWriteExpenses as we, isExpenseAdmin as Te } from "../ExpenseManagementWidget/permissions.js";
38
+ import { buildExpenseAuditHistory as Ee } from "./auditHistory/buildExpenseAuditHistory.js";
39
+ import { EXPENSE_AUDIT_HISTORY_LABELS_EN as De } from "./auditHistory/labels.js";
40
+ import { ReceiptMatchWidget as Oe } from "../../../../receipt-match/feature/dist/index4.js";
40
41
  import "../../../../receipt-match/feature/dist/index.js";
41
- import { useMemo as Oe, useRef as ke, useState as a } from "react";
42
- import { Fragment as Ae, jsx as o, jsxs as je } from "react/jsx-runtime";
42
+ import { useMemo as ke, useRef as Ae, useState as a } from "react";
43
+ import { Fragment as je, jsx as o, jsxs as Me } from "react/jsx-runtime";
43
44
  //#region ../../libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/TransactionDetails/TransactionDetailsFeature.js
44
- var Me = "—", Ne = /* @__PURE__ */ new Map(), s = "__none__";
45
+ var Ne = "—", Pe = /* @__PURE__ */ new Map(), s = "__none__";
45
46
  function c(e) {
46
47
  return e === s ? null : e;
47
48
  }
48
49
  function l(e) {
49
50
  return !!(e && e !== "user");
50
51
  }
51
- function Pe(e) {
52
+ function Fe(e) {
52
53
  if (!e || typeof e != "object" || !("all" in e)) return {};
53
54
  let t = e.all, n, r;
54
55
  for (let e of t ?? []) {
@@ -63,7 +64,7 @@ function Pe(e) {
63
64
  lessThanCents: r
64
65
  };
65
66
  }
66
- function Fe(e) {
67
+ function Ie(e) {
67
68
  for (let t of e ?? []) {
68
69
  let e = t.event_data;
69
70
  if (!e || typeof e != "object") continue;
@@ -85,10 +86,10 @@ function Fe(e) {
85
86
  }
86
87
  return {};
87
88
  }
88
- function Ie(e) {
89
+ function Le(e) {
89
90
  return e && "required_approval_count" in e && typeof e.required_approval_count == "number" ? e.required_approval_count : 0;
90
91
  }
91
- function Le(e) {
92
+ function Re(e) {
92
93
  for (let t of e ?? []) {
93
94
  if (t.event_type !== "approval_action") continue;
94
95
  let e = t.event_data;
@@ -97,60 +98,60 @@ function Le(e) {
97
98
  if (typeof n == "string" && n) return n;
98
99
  }
99
100
  }
100
- var Re = ".pdf,.png,.jpg,.jpeg,.gif,.svg";
101
+ var ze = ".pdf,.png,.jpg,.jpeg,.gif,.svg";
101
102
  function u(e, t, n) {
102
103
  let r = e.find((e) => e.field === t);
103
104
  return r != null && (r.amount_threshold == null || n >= r.amount_threshold);
104
105
  }
105
- function d({ open: d, onClose: ze, selectedTransactionId: Be, actionItemIds: Ve, cardholderByUserId: f, labels: He, detailsLabels: Ue, cardLabels: We, actionsLabels: Ge, statusBadgeLabels: Ke, fileViewerLabels: qe }) {
106
+ function d({ open: d, onClose: Be, selectedTransactionId: Ve, actionItemIds: He, cardholderByUserId: f, labels: Ue, detailsLabels: We, cardLabels: Ge, actionsLabels: Ke, statusBadgeLabels: qe, fileViewerLabels: Je }) {
106
107
  let p = {
107
108
  ...oe,
108
- ...He
109
- }, [m, h] = a(0), [Je, Ye] = a(!1), [Xe, g] = a(null), [Ze, _] = a(null), [Qe, v] = a(null), [$e, y] = a(!1), [et, b] = a(null), tt = ke(null), x = Ve ?? [], nt = x.length > 1, S = x.length > 0 ? x[m] ?? "" : Be ?? "", { initResponse: rt } = ee(), it = rt?.userId ?? "", C = rt?.scopes, w = we(C), T = Ce(C), at = Se(C), ot = r(C, [i.ApprovalRequestUpdateOrg]), st = !T && !ot && !at, E = me({ transactionId: d ? S : void 0 }), D = E.data, O = D?.applied_policy_id || void 0, k = ne({
109
+ ...Ue
110
+ }, [m, h] = a(0), [Ye, Xe] = a(!1), [g, _] = a(null), [v, y] = a(null), [b, x] = a(null), [Ze, S] = a(!1), [Qe, C] = a(null), $e = Ae(null), w = He ?? [], et = w.length > 1, T = w.length > 0 ? w[m] ?? "" : Ve ?? "", { initResponse: tt } = ee(), nt = tt?.userId ?? "", E = tt?.scopes, D = Te(E), O = we(E), rt = Ce(E), it = r(E, [i.ApprovalRequestUpdateOrg]), at = !O && !it && !rt, k = me({ transactionId: d ? T : void 0 }), A = k.data, j = A?.applied_policy_id || void 0, ot = ne({
110
111
  objectType: te.Transaction,
111
- enabled: d && !!O
112
- }).data?.data?.find((e) => e.id === O), A = ve({ transactionId: d ? S : void 0 }), j = A.latestRequest, M = _e({ enabled: d }), N = ye(), ct = ge(), P = he(), lt = le({ enabled: d && w }), ut = de({ enabled: d && w }), dt = fe({ enabled: d && w }), F = pe({
113
- transactionId: d ? S : void 0,
112
+ enabled: d && !!j
113
+ }).data?.data?.find((e) => e.id === j), st = ye({ transactionId: d ? T : void 0 }), M = st.latestRequest, N = ve({ enabled: d }), P = be(), ct = ge(), F = he(), { trackAttachedReceipt: lt } = _e(), [ut, dt] = a(null), ft = le({ enabled: d && D }), pt = de({ enabled: d && D }), mt = fe({ enabled: d && D }), I = pe({
114
+ transactionId: d ? T : void 0,
114
115
  enabled: d
115
- }), I = ae(D?.expense_status), L = ie(I, !!D?.has_validation_errors, {
116
+ }), L = ae(A?.expense_status), ht = ie(L, !!A?.has_validation_errors, {
116
117
  ...re,
117
- ...Ke
118
- }), R = D?.merchant_amount ?? 0, z = D?.description ?? "", B = Xe?.transactionId === S ? Xe.value : z, V = u(M.requiredFields, "description", R), H = u(M.requiredFields, "receipt_id", R), U = D?.receipt_file_url ?? "", ft = j?.caller_is_policy_approver ?? !1, pt = !!(it && j?.approved_by?.includes(it)), mt = ft && !pt, ht = at && !ft, gt = w || I === "new" || I === "rejected", _t = D?.payment_method, W = _t?.type === "card" ? _t.details : null, vt = W ? p.cardLabel(W.card_type === "debit" ? p.debitCard : p.creditCard, W.last4 ?? "") : Me, G = D?.entity_user_id ?? "", yt = Oe(() => G ? [G] : [], [G]), bt = ue({
119
- ids: yt,
120
- enabled: d && yt.length > 0
121
- }).data?.data?.find((e) => e.id === G), xt = bt ? xe(bt) : f?.get(G) ?? Me, St = !!S && (E.isPending || A.isPending || M.isPending), Ct = () => {
122
- if (nt && m < x.length - 1) {
118
+ ...qe
119
+ }), R = A?.merchant_amount ?? 0, z = A?.description ?? "", gt = g?.transactionId === T ? g.value : z, _t = u(N.requiredFields, "description", R), B = u(N.requiredFields, "receipt_id", R), V = A?.receipt_file_url ?? "", vt = M?.caller_is_policy_approver ?? !1, yt = !!(nt && M?.approved_by?.includes(nt)), bt = vt && !yt, xt = rt && !vt, St = D || L === "new" || L === "rejected", Ct = A?.payment_method, H = Ct?.type === "card" ? Ct.details : null, wt = H ? p.cardLabel(H.card_type === "debit" ? p.debitCard : p.creditCard, H.last4 ?? "") : Ne, U = A?.entity_user_id ?? "", Tt = ke(() => U ? [U] : [], [U]), Et = ue({
120
+ ids: Tt,
121
+ enabled: d && Tt.length > 0
122
+ }).data?.data?.find((e) => e.id === U), Dt = Et ? Se(Et) : f?.get(U) ?? Ne, W = ut === T, Ot = !!T && (k.isPending || st.isPending || N.isPending), kt = () => {
123
+ if (et && m < w.length - 1) {
123
124
  h((e) => e + 1);
124
125
  return;
125
126
  }
126
- K();
127
- }, K = () => {
128
- h(0), g(null), _(null), v(null), b(null), ze();
129
- }, q = T && gt, J = Ze?.transactionId === S && Ze.value, Y = D?.receipt_id, wt = D?.ledger_account_id || s, X = D?.department_id || s, Tt = D?.location_id || s, Z = et?.transactionId === S ? et : {
130
- transactionId: S,
131
- glCategory: wt,
132
- department: X,
133
- location: Tt
134
- }, Et = [{
127
+ G();
128
+ }, G = () => {
129
+ h(0), _(null), y(null), x(null), C(null), Be();
130
+ }, K = O && St, q = v?.transactionId === T && v.value, J = A?.receipt_id, Y = A?.ledger_account_id || s, At = A?.department_id || s, jt = A?.location_id || s, X = Qe?.transactionId === T ? Qe : {
131
+ transactionId: T,
132
+ glCategory: Y,
133
+ department: At,
134
+ location: jt
135
+ }, Mt = [{
135
136
  value: s,
136
137
  label: p.glCategoryUncategorized
137
- }, ...(dt.data?.data ?? []).map((e) => ({
138
+ }, ...(mt.data?.data ?? []).map((e) => ({
138
139
  value: e.id,
139
140
  label: e.name ?? ""
140
- }))], Dt = [{
141
+ }))], Nt = [{
141
142
  value: s,
142
143
  label: p.accountingNone
143
- }, ...(lt.data?.data ?? []).map((e) => ({
144
+ }, ...(ft.data?.data ?? []).map((e) => ({
144
145
  value: e.id,
145
146
  label: e.name
146
- }))], Ot = [{
147
+ }))], Pt = [{
147
148
  value: s,
148
149
  label: p.accountingNone
149
- }, ...(ut.data?.data ?? []).map((e) => ({
150
+ }, ...(pt.data?.data ?? []).map((e) => ({
150
151
  value: e.id,
151
152
  label: e.name
152
- }))], kt = Oe(() => {
153
- let e = (F.data?.data ?? []).map((e) => ({
153
+ }))], Ft = ke(() => {
154
+ let e = (I.data?.data ?? []).map((e) => ({
154
155
  id: e.id,
155
156
  event_type: e.event_type,
156
157
  event_data: e.event_data,
@@ -160,199 +161,205 @@ function d({ open: d, onClose: ze, selectedTransactionId: Be, actionItemIds: Ve,
160
161
  entity_user_last_name: e.entity_user_last_name,
161
162
  recorded_by: e.recorded_by
162
163
  }));
163
- return Te(e, f ?? Ne, Ee);
164
- }, [F.data, f]), At = async (t) => {
164
+ return Ee(e, f ?? Pe, De);
165
+ }, [I.data, f]), It = async (t) => {
165
166
  try {
166
167
  let e = await ct.mutateAsync({ body: { file: t } });
167
168
  if (!e.id) throw Error("Receipt upload returned no id");
168
- await P.mutateAsync({
169
+ await F.mutateAsync({
169
170
  path: { receipt_id: e.id },
170
- body: { transaction_id: S }
171
- }), _({
172
- transactionId: S,
171
+ body: { transaction_id: T }
172
+ }), y({
173
+ transactionId: T,
173
174
  value: !1
174
- });
175
+ }), dt(T), lt({
176
+ receiptId: e.id,
177
+ transactionId: T
178
+ }).catch(() => void 0).finally(() => dt((e) => e === T ? null : e));
175
179
  } catch {
176
180
  e.error(p.receiptUploadFailed);
177
181
  }
178
- }, jt = async () => {
179
- if (Y) try {
180
- await P.mutateAsync({
181
- path: { receipt_id: Y },
182
+ }, Lt = async () => {
183
+ if (J) try {
184
+ await F.mutateAsync({
185
+ path: { receipt_id: J },
182
186
  body: { transaction_id: null },
183
- previousTransactionId: S
187
+ previousTransactionId: T
184
188
  });
185
189
  } catch {
186
190
  e.error(p.receiptDeleteFailed);
187
191
  } finally {
188
- y(!1);
192
+ S(!1);
189
193
  }
190
- }, Q = Pe(k?.trigger), Mt = Q.greaterThanCents == null ? void 0 : n(Q.greaterThanCents / 100, {
191
- currencyCode: D?.merchant_currency,
194
+ }, Z = Fe(ot?.trigger), Rt = Z.greaterThanCents == null ? void 0 : n(Z.greaterThanCents / 100, {
195
+ currencyCode: A?.merchant_currency,
192
196
  includeSpaceAfterCurrencySymbol: !1
193
- }), Nt = Q.lessThanCents == null ? void 0 : n(Q.lessThanCents / 100, {
194
- currencyCode: D?.merchant_currency,
197
+ }), zt = Z.lessThanCents == null ? void 0 : n(Z.lessThanCents / 100, {
198
+ currencyCode: A?.merchant_currency,
195
199
  includeSpaceAfterCurrencySymbol: !1
196
- }), Pt = I === "approved" || I === "rejected" ? F.data?.data : void 0, Ft = Le(Pt), $ = Fe(Pt), It = Ie(j), Lt = I === "approved" && ($.source ? $.source === "auto" : It === 0), Rt = I === "approved" && ($.source ? $.source !== "auto" : It > 0), zt = Ft ?? (Mt || Nt ? void 0 : k?.name);
197
- return /* @__PURE__ */ je(Ae, { children: [
200
+ }), Bt = L === "approved" || L === "rejected" ? I.data?.data : void 0, Vt = Re(Bt), Q = Ie(Bt), $ = Le(M), Ht = L === "approved" && (Q.source ? Q.source === "auto" : $ === 0), Ut = L === "approved" && (Q.source ? Q.source !== "auto" : $ > 0), Wt = Vt ?? (Rt || zt ? void 0 : ot?.name);
201
+ return /* @__PURE__ */ Me(je, { children: [
198
202
  /* @__PURE__ */ o("input", {
199
- ref: tt,
203
+ ref: $e,
200
204
  type: "file",
201
- accept: Re,
205
+ accept: ze,
202
206
  className: "ttw:hidden",
203
207
  "aria-hidden": !0,
204
208
  tabIndex: -1,
205
209
  onChange: (e) => {
206
210
  let t = e.target.files?.[0];
207
- e.target.value = "", t && At(t);
211
+ e.target.value = "", t && It(t);
208
212
  }
209
213
  }),
210
214
  /* @__PURE__ */ o(se, {
211
215
  open: d,
212
- onClose: K,
213
- transactionId: S,
214
- transactionDate: t(D?.started_at, { month: "long" }),
215
- statusLabel: L.label,
216
- statusTone: L.tone,
217
- isRejected: I === "rejected",
218
- isPendingReview: I === "approve_in_progress",
216
+ onClose: G,
217
+ transactionId: T,
218
+ transactionDate: t(A?.started_at, { month: "long" }),
219
+ statusLabel: ht.label,
220
+ statusTone: ht.tone,
221
+ isRejected: L === "rejected",
222
+ isPendingReview: L === "approve_in_progress",
219
223
  amount: n(Math.abs(R) / 100, {
220
- currencyCode: D?.merchant_currency,
224
+ currencyCode: A?.merchant_currency,
221
225
  includeSpaceAfterCurrencySymbol: !1
222
226
  }),
223
- merchant: D?.merchant_name ?? "",
224
- receiptUrl: U,
225
- isLoading: St,
226
- isError: E.isError,
227
- isClosingDisabled: Je,
228
- cardLabel: vt,
229
- cardName: W ? p.travelCard : void 0,
230
- cardholder: xt,
231
- showCardholder: !!G,
232
- showPhysicalPill: !!W,
233
- isDescriptionRequired: V,
234
- isReceiptRequired: H,
235
- isReceiptAutoMatched: D?.source_of_data?.receipt_id === "automatched",
236
- isReceiptActionDisabled: !q && !U,
237
- receiptButtonLabel: U ? p.receiptAttached : J ? p.receiptSubmitWithout : q ? p.receiptAttach : p.receiptMissing,
238
- receiptButtonIcon: U ? "receipt" : J ? "send" : "paperclip",
239
- receiptButtonVariant: U ? "ghost" : "outline",
240
- showNoReceiptWarning: H && !U && J,
241
- onUploadClick: q && !U ? () => tt.current?.click() : void 0,
242
- onFileDrop: q && !U ? (e) => void At(e) : void 0,
243
- onOpenReceiptInbox: q && !U ? () => v(S) : void 0,
244
- onSubmitWithoutReceipt: q && !U ? () => _({
245
- transactionId: S,
227
+ merchant: A?.merchant_name ?? "",
228
+ receiptUrl: V,
229
+ isLoading: Ot,
230
+ isError: k.isError,
231
+ isClosingDisabled: Ye,
232
+ cardLabel: wt,
233
+ cardName: H ? p.travelCard : void 0,
234
+ cardholder: Dt,
235
+ showCardholder: !!U,
236
+ showPhysicalPill: !!H,
237
+ isDescriptionRequired: _t,
238
+ isReceiptRequired: B,
239
+ isReceiptAutoMatched: A?.source_of_data?.receipt_id === "automatched",
240
+ isReceiptActionDisabled: !K && !V,
241
+ receiptButtonLabel: V ? p.receiptAttached : q ? p.receiptSubmitWithout : K ? p.receiptAttach : p.receiptMissing,
242
+ receiptButtonIcon: V ? "receipt" : q ? "send" : "paperclip",
243
+ receiptButtonVariant: V ? "ghost" : "outline",
244
+ showNoReceiptWarning: B && !V && q,
245
+ onUploadClick: K && !V ? () => $e.current?.click() : void 0,
246
+ onFileDrop: K && !V ? (e) => void It(e) : void 0,
247
+ onOpenReceiptInbox: K && !V ? () => x(T) : void 0,
248
+ onSubmitWithoutReceipt: K && !V ? () => y({
249
+ transactionId: T,
246
250
  value: !0
247
251
  }) : void 0,
248
- onDeleteReceiptClick: q && Y ? () => y(!0) : void 0,
249
- isUploading: ct.isPending || P.isPending,
250
- descriptionValue: B,
252
+ onDeleteReceiptClick: K && J ? () => S(!0) : void 0,
253
+ isUploading: ct.isPending || F.isPending,
254
+ descriptionValue: gt,
251
255
  initialDescriptionValue: z,
252
- onDescriptionChange: (e) => g({
253
- transactionId: S,
256
+ onDescriptionChange: (e) => _({
257
+ transactionId: T,
254
258
  value: e.target.value
255
259
  }),
256
260
  onSaveDescription: () => {
257
- N.mutateAsync({
258
- transactionId: S,
259
- body: { description: B || null }
260
- }).then(() => g(null)).catch(() => {
261
+ let t = gt;
262
+ P.mutateAsync({
263
+ transactionId: T,
264
+ body: { description: t || null }
265
+ }).then(() => _((e) => e?.transactionId === T && e.value === t ? null : e)).catch(() => {
261
266
  e.error(p.memoSaveFailed);
262
267
  });
263
268
  },
264
- onCancelDescription: () => g(null),
265
- isSavingDescription: N.isPending,
266
- isMemoEditable: T && gt,
267
- memoBadgeLabel: D?.source_of_data?.description === "generated" ? p.memoAiAssigned : void 0,
268
- showApprovalCard: I !== "new",
269
- isAutoApproved: Lt,
270
- isManuallyApproved: Rt,
271
- approverName: $.approverName,
272
- rejectionReason: D?.reject_reason ?? void 0,
273
- hasAppliedPolicy: !!O,
274
- greaterThanValue: Mt,
275
- lessThanValue: Nt,
276
- ruleLabel: zt,
277
- showAccountingCard: w,
278
- glCategory: Z.glCategory,
279
- initialGlCategory: wt,
280
- glCategoryOptions: Et,
281
- onGlCategoryChange: (e) => b({
282
- ...Z,
269
+ onCancelDescription: () => _(null),
270
+ isSavingDescription: P.isPending,
271
+ isMemoEditable: O && St && !W,
272
+ isReadingReceipt: W,
273
+ isAccountingDisabled: W,
274
+ memoBadgeLabel: A?.source_of_data?.description === "generated" ? p.memoAiAssigned : void 0,
275
+ showApprovalCard: L !== "new",
276
+ isAutoApproved: Ht,
277
+ isManuallyApproved: Ut,
278
+ approverName: Q.approverName,
279
+ rejectionReason: A?.reject_reason ?? void 0,
280
+ hasAppliedPolicy: !!j,
281
+ greaterThanValue: Rt,
282
+ lessThanValue: zt,
283
+ ruleLabel: Wt,
284
+ showAccountingCard: D,
285
+ glCategory: X.glCategory,
286
+ initialGlCategory: Y,
287
+ glCategoryOptions: Mt,
288
+ onGlCategoryChange: (e) => C({
289
+ ...X,
283
290
  glCategory: e
284
291
  }),
285
- department: Z.department,
286
- initialDepartment: X,
287
- departmentOptions: Dt,
288
- onDepartmentChange: (e) => b({
289
- ...Z,
292
+ department: X.department,
293
+ initialDepartment: At,
294
+ departmentOptions: Nt,
295
+ onDepartmentChange: (e) => C({
296
+ ...X,
290
297
  department: e
291
298
  }),
292
- location: Z.location,
293
- initialLocation: Tt,
294
- locationOptions: Ot,
295
- onLocationChange: (e) => b({
296
- ...Z,
299
+ location: X.location,
300
+ initialLocation: jt,
301
+ locationOptions: Pt,
302
+ onLocationChange: (e) => C({
303
+ ...X,
297
304
  location: e
298
305
  }),
299
306
  onSaveAccounting: () => {
300
- N.mutateAsync({
301
- transactionId: S,
307
+ P.mutateAsync({
308
+ transactionId: T,
302
309
  body: {
303
- ledger_account_id: c(Z.glCategory),
304
- department_id: c(Z.department),
305
- location_id: c(Z.location)
310
+ ledger_account_id: c(X.glCategory),
311
+ department_id: c(X.department),
312
+ location_id: c(X.location)
306
313
  }
307
- }).then(() => b(null)).catch(() => {
314
+ }).then(() => C(null)).catch(() => {
308
315
  e.error(p.accountingSaveFailed);
309
316
  });
310
317
  },
311
- onCancelAccounting: () => b(null),
312
- isSavingAccounting: N.isPending,
313
- glCategoryHighlight: l(D?.source_of_data?.ledger_account_id),
314
- departmentHighlight: l(D?.source_of_data?.department_id),
315
- locationHighlight: l(D?.source_of_data?.location_id),
318
+ onCancelAccounting: () => C(null),
319
+ isSavingAccounting: P.isPending,
320
+ glCategoryHighlight: l(A?.source_of_data?.ledger_account_id),
321
+ departmentHighlight: l(A?.source_of_data?.department_id),
322
+ locationHighlight: l(A?.source_of_data?.location_id),
316
323
  showAuditHistoryCard: !0,
317
- auditHistoryRows: kt,
318
- isLoadingAuditHistory: F.isPending,
319
- isAuditHistoryError: F.isError,
320
- labels: Ue,
321
- cardLabels: We,
322
- fileViewerLabels: qe,
323
- children: D && !E.isError ? /* @__PURE__ */ o(be, {
324
- transactionId: S,
325
- status: I,
326
- approvalRequestId: j?.id,
327
- canUseApprovalRequestActions: mt,
328
- canUseForceActions: ht,
329
- canWrite: T,
330
- hasOnlyViewPermission: st,
331
- isDisabled: V && !z,
332
- showNoReceiptField: H && !U && I !== "approved",
333
- isBulkMode: nt,
324
+ auditHistoryRows: Ft,
325
+ isLoadingAuditHistory: I.isPending,
326
+ isAuditHistoryError: I.isError,
327
+ labels: We,
328
+ cardLabels: Ge,
329
+ fileViewerLabels: Je,
330
+ children: A && !k.isError ? /* @__PURE__ */ o(xe, {
331
+ transactionId: T,
332
+ status: L,
333
+ approvalRequestId: M?.id,
334
+ canUseApprovalRequestActions: bt,
335
+ canUseForceActions: xt,
336
+ canWrite: O,
337
+ hasOnlyViewPermission: at,
338
+ isDisabled: _t && !z,
339
+ showNoReceiptField: B && !V && L !== "approved",
340
+ isBulkMode: et,
334
341
  currentItem: m + 1,
335
- totalItems: x.length,
336
- onCompleted: Ct,
337
- onClose: K,
338
- onPendingChange: Ye,
339
- labels: Ge
340
- }, S) : null
342
+ totalItems: w.length,
343
+ onCompleted: kt,
344
+ onClose: G,
345
+ onPendingChange: Xe,
346
+ labels: Ke
347
+ }, T) : null
341
348
  }),
342
- Qe && /* @__PURE__ */ o(De, {
349
+ b && /* @__PURE__ */ o(Oe, {
343
350
  isOpen: !0,
344
- targetTransactionId: Qe,
345
- onClose: () => v(null),
351
+ targetTransactionId: b,
352
+ onClose: () => x(null),
346
353
  onSingleTransactionUpdate: () => {
347
- E.refetch();
354
+ k.refetch();
348
355
  }
349
356
  }),
350
357
  /* @__PURE__ */ o(ce, {
351
- open: $e,
352
- onOpenChange: y,
353
- isRemoving: P.isPending,
354
- onConfirm: () => void jt(),
355
- onCancel: () => y(!1)
358
+ open: Ze,
359
+ onOpenChange: S,
360
+ isRemoving: F.isPending,
361
+ onConfirm: () => void Lt(),
362
+ onCancel: () => S(!1)
356
363
  })
357
364
  ] });
358
365
  }