@layerfi/components 0.1.56 → 0.1.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +468 -628
- package/dist/esm/index.js.map +4 -4
- package/dist/index.d.ts +50 -56
- package/dist/index.js +417 -577
- package/dist/index.js.map +4 -4
- package/dist/styles/index.css +21 -98
- package/dist/styles/index.css.map +2 -2
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -11585,7 +11585,9 @@ var TableCell = ({
|
|
|
11585
11585
|
isCurrency,
|
|
11586
11586
|
primary,
|
|
11587
11587
|
withExpandIcon = false,
|
|
11588
|
-
fullWidth
|
|
11588
|
+
fullWidth,
|
|
11589
|
+
colSpan = 1,
|
|
11590
|
+
onClick
|
|
11589
11591
|
}) => {
|
|
11590
11592
|
const amount = typeof children === "number" ? children : 0;
|
|
11591
11593
|
const isPositive = amount >= 0;
|
|
@@ -11598,13 +11600,15 @@ var TableCell = ({
|
|
|
11598
11600
|
isCurrency && !isPositive && "Layer__table-cell-amount--negative"
|
|
11599
11601
|
);
|
|
11600
11602
|
if (isHeaderCell) {
|
|
11601
|
-
return /* @__PURE__ */ React133.createElement("th", { className: cellClassNames }, /* @__PURE__ */ React133.createElement("span", { className: "Layer__table-cell-content" }, children));
|
|
11603
|
+
return /* @__PURE__ */ React133.createElement("th", { className: cellClassNames, colSpan }, /* @__PURE__ */ React133.createElement("span", { className: "Layer__table-cell-content" }, children));
|
|
11602
11604
|
}
|
|
11603
11605
|
return /* @__PURE__ */ React133.createElement(
|
|
11604
11606
|
"td",
|
|
11605
11607
|
{
|
|
11606
11608
|
className: cellClassNames,
|
|
11607
|
-
style: fullWidth ? { width: "100%" } : void 0
|
|
11609
|
+
style: fullWidth ? { width: "100%" } : void 0,
|
|
11610
|
+
colSpan,
|
|
11611
|
+
onClick: (e) => onClick && onClick(e)
|
|
11608
11612
|
},
|
|
11609
11613
|
/* @__PURE__ */ React133.createElement("span", { className: "Layer__table-cell-content" }, withExpandIcon && /* @__PURE__ */ React133.createElement(
|
|
11610
11614
|
ChevronDownFill_default,
|
|
@@ -11635,20 +11639,35 @@ var TableRow = ({
|
|
|
11635
11639
|
variant = expandable ? "expandable" : "default",
|
|
11636
11640
|
withDivider,
|
|
11637
11641
|
withDividerPosition = "top",
|
|
11638
|
-
isHeadRow = false
|
|
11642
|
+
isHeadRow = false,
|
|
11643
|
+
selected,
|
|
11644
|
+
onClick
|
|
11639
11645
|
}) => {
|
|
11640
|
-
const toggleExpanded = () => {
|
|
11641
|
-
if (
|
|
11642
|
-
|
|
11643
|
-
|
|
11646
|
+
const toggleExpanded = (e) => {
|
|
11647
|
+
if (onClick) {
|
|
11648
|
+
onClick(e);
|
|
11649
|
+
} else {
|
|
11650
|
+
if (variant === "summation" || !expandable)
|
|
11651
|
+
return;
|
|
11652
|
+
handleExpand && handleExpand();
|
|
11653
|
+
}
|
|
11644
11654
|
};
|
|
11645
11655
|
const rowClassNames = classNames48([
|
|
11646
11656
|
"Layer__table-row",
|
|
11647
11657
|
!isHeadRow && `Layer__table-row--depth-${depth}`,
|
|
11648
11658
|
!isHeadRow && `Layer__table-row--variant-${variant}`,
|
|
11659
|
+
selected && "Layer__table-row--selected",
|
|
11649
11660
|
!isHeadRow && expandable && (isExpanded ? "Layer__table-row--expanded" : "Layer__table-row--collapsed")
|
|
11650
11661
|
]);
|
|
11651
|
-
return /* @__PURE__ */ React135.createElement(React135.Fragment, null, withDivider && withDividerPosition === "top" && /* @__PURE__ */ React135.createElement("tr", { className: "Layer__table-empty-row" }, /* @__PURE__ */ React135.createElement("td", { colSpan: Array.isArray(children) ? children.length : 1 })), /* @__PURE__ */ React135.createElement(
|
|
11662
|
+
return /* @__PURE__ */ React135.createElement(React135.Fragment, null, withDivider && withDividerPosition === "top" && /* @__PURE__ */ React135.createElement("tr", { className: "Layer__table-empty-row" }, /* @__PURE__ */ React135.createElement("td", { colSpan: Array.isArray(children) ? children.length : 1 })), /* @__PURE__ */ React135.createElement(
|
|
11663
|
+
"tr",
|
|
11664
|
+
{
|
|
11665
|
+
"data-key": rowKey,
|
|
11666
|
+
className: rowClassNames,
|
|
11667
|
+
onClick: (e) => toggleExpanded(e)
|
|
11668
|
+
},
|
|
11669
|
+
children
|
|
11670
|
+
), withDivider && withDividerPosition === "bottom" && /* @__PURE__ */ React135.createElement("tr", { className: "Layer__table-empty-row" }, /* @__PURE__ */ React135.createElement("td", { colSpan: Array.isArray(children) ? children.length : 1 })));
|
|
11652
11671
|
};
|
|
11653
11672
|
|
|
11654
11673
|
// src/components/Table/Table.tsx
|
|
@@ -12078,7 +12097,7 @@ ProfitAndLoss.DetailedCharts = ProfitAndLossDetailedCharts;
|
|
|
12078
12097
|
ProfitAndLoss.Header = ProfitAndLossHeader;
|
|
12079
12098
|
|
|
12080
12099
|
// src/components/BalanceSheet/BalanceSheet.tsx
|
|
12081
|
-
import React148, { useEffect as useEffect35, useState as
|
|
12100
|
+
import React148, { useEffect as useEffect35, useState as useState38 } from "react";
|
|
12082
12101
|
|
|
12083
12102
|
// src/contexts/BalanceSheetContext/BalanceSheetContext.tsx
|
|
12084
12103
|
import { createContext as createContext9 } from "react";
|
|
@@ -12225,7 +12244,7 @@ var ViewHeader = ({ title, controls }) => {
|
|
|
12225
12244
|
};
|
|
12226
12245
|
|
|
12227
12246
|
// src/components/Panel/Panel.tsx
|
|
12228
|
-
import React146, { useEffect as useEffect34, useState as
|
|
12247
|
+
import React146, { useEffect as useEffect34, useState as useState37 } from "react";
|
|
12229
12248
|
import classNames52 from "classnames";
|
|
12230
12249
|
var Panel = ({
|
|
12231
12250
|
children,
|
|
@@ -12236,7 +12255,7 @@ var Panel = ({
|
|
|
12236
12255
|
parentRef,
|
|
12237
12256
|
defaultSidebarHeight = false
|
|
12238
12257
|
}) => {
|
|
12239
|
-
const [sidebarHeight, setSidebarHeight] =
|
|
12258
|
+
const [sidebarHeight, setSidebarHeight] = useState37(0);
|
|
12240
12259
|
useEffect34(() => {
|
|
12241
12260
|
if (parentRef?.current?.offsetHeight) {
|
|
12242
12261
|
setSidebarHeight(parentRef?.current?.offsetHeight - 1);
|
|
@@ -12323,7 +12342,7 @@ var BalanceSheetView = ({
|
|
|
12323
12342
|
asWidget = false,
|
|
12324
12343
|
stringOverrides
|
|
12325
12344
|
}) => {
|
|
12326
|
-
const [effectiveDate, setEffectiveDate] =
|
|
12345
|
+
const [effectiveDate, setEffectiveDate] = useState38(startOfDay2(/* @__PURE__ */ new Date()));
|
|
12327
12346
|
const { data, isLoading, refetch } = useBalanceSheet(effectiveDate);
|
|
12328
12347
|
useEffect35(() => {
|
|
12329
12348
|
const d1 = effectiveDate && format5(startOfDay2(effectiveDate), "yyyy-MM-dd'T'HH:mm:ssXXX");
|
|
@@ -12384,7 +12403,7 @@ var BalanceSheetView = ({
|
|
|
12384
12403
|
};
|
|
12385
12404
|
|
|
12386
12405
|
// src/components/StatementOfCashFlow/StatementOfCashFlow.tsx
|
|
12387
|
-
import React150, { useState as
|
|
12406
|
+
import React150, { useState as useState39 } from "react";
|
|
12388
12407
|
|
|
12389
12408
|
// src/contexts/StatementOfCashContext/StatementOfCashFlowContext.tsx
|
|
12390
12409
|
import { createContext as createContext10 } from "react";
|
|
@@ -12542,10 +12561,10 @@ var StatementOfCashFlow = ({ stringOverrides }) => {
|
|
|
12542
12561
|
return /* @__PURE__ */ React150.createElement(StatementOfCashFlowContext.Provider, { value: cashContextData }, /* @__PURE__ */ React150.createElement(StatementOfCashFlowView, { stringOverrides }));
|
|
12543
12562
|
};
|
|
12544
12563
|
var StatementOfCashFlowView = ({ stringOverrides }) => {
|
|
12545
|
-
const [startDate, setStartDate] =
|
|
12564
|
+
const [startDate, setStartDate] = useState39(
|
|
12546
12565
|
startOfDay4(subWeeks(/* @__PURE__ */ new Date(), 4))
|
|
12547
12566
|
);
|
|
12548
|
-
const [endDate, setEndDate] =
|
|
12567
|
+
const [endDate, setEndDate] = useState39(startOfDay4(/* @__PURE__ */ new Date()));
|
|
12549
12568
|
const { data, isLoading, refetch } = useStatementOfCashFlow(
|
|
12550
12569
|
startDate,
|
|
12551
12570
|
endDate
|
|
@@ -12587,7 +12606,7 @@ var StatementOfCashFlowView = ({ stringOverrides }) => {
|
|
|
12587
12606
|
};
|
|
12588
12607
|
|
|
12589
12608
|
// src/components/ChartOfAccounts/ChartOfAccounts.tsx
|
|
12590
|
-
import React165, { useContext as useContext28, useState as
|
|
12609
|
+
import React165, { useContext as useContext28, useState as useState46 } from "react";
|
|
12591
12610
|
|
|
12592
12611
|
// src/contexts/ChartOfAccountsContext/ChartOfAccountsContext.tsx
|
|
12593
12612
|
import { createContext as createContext11 } from "react";
|
|
@@ -12646,7 +12665,7 @@ var LedgerAccountsContext = createContext12({
|
|
|
12646
12665
|
});
|
|
12647
12666
|
|
|
12648
12667
|
// src/hooks/useChartOfAccounts/useChartOfAccounts.tsx
|
|
12649
|
-
import { useEffect as useEffect37, useState as
|
|
12668
|
+
import { useEffect as useEffect37, useState as useState40 } from "react";
|
|
12650
12669
|
|
|
12651
12670
|
// src/components/ChartOfAccountsForm/constants.ts
|
|
12652
12671
|
var LEDGER_ACCOUNT_TYPES = [
|
|
@@ -12943,13 +12962,13 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
|
|
|
12943
12962
|
syncTimestamps,
|
|
12944
12963
|
hasBeenTouched
|
|
12945
12964
|
} = useLayerContext();
|
|
12946
|
-
const [form, setForm] =
|
|
12947
|
-
const [sendingForm, setSendingForm] =
|
|
12948
|
-
const [apiError, setApiError] =
|
|
12949
|
-
const [startDate, setStartDate] =
|
|
12965
|
+
const [form, setForm] = useState40();
|
|
12966
|
+
const [sendingForm, setSendingForm] = useState40(false);
|
|
12967
|
+
const [apiError, setApiError] = useState40(void 0);
|
|
12968
|
+
const [startDate, setStartDate] = useState40(
|
|
12950
12969
|
initialStartDate ?? startOfMonth13(Date.now())
|
|
12951
12970
|
);
|
|
12952
|
-
const [endDate, setEndDate] =
|
|
12971
|
+
const [endDate, setEndDate] = useState40(
|
|
12953
12972
|
initialEndDate ?? endOfMonth10(Date.now())
|
|
12954
12973
|
);
|
|
12955
12974
|
const queryKey = businessId && auth?.access_token && `chart-of-accounts-${businessId}-${startDate?.valueOf()}-${endDate?.valueOf()}`;
|
|
@@ -13164,12 +13183,12 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
|
|
|
13164
13183
|
};
|
|
13165
13184
|
|
|
13166
13185
|
// src/hooks/useLedgerAccounts/useLedgerAccounts.tsx
|
|
13167
|
-
import { useEffect as useEffect38, useState as
|
|
13186
|
+
import { useEffect as useEffect38, useState as useState41 } from "react";
|
|
13168
13187
|
import useSWR8 from "swr";
|
|
13169
13188
|
var useLedgerAccounts = () => {
|
|
13170
13189
|
const { auth, businessId, apiUrl, read, syncTimestamps, hasBeenTouched } = useLayerContext();
|
|
13171
|
-
const [accountId, setAccountId] =
|
|
13172
|
-
const [selectedEntryId, setSelectedEntryId] =
|
|
13190
|
+
const [accountId, setAccountId] = useState41();
|
|
13191
|
+
const [selectedEntryId, setSelectedEntryId] = useState41();
|
|
13173
13192
|
const queryKey = businessId && accountId && auth?.access_token && `ledger-accounts-lines-${businessId}-${accountId}`;
|
|
13174
13193
|
const { data, isLoading, isValidating, error, mutate } = useSWR8(
|
|
13175
13194
|
queryKey,
|
|
@@ -13222,8 +13241,8 @@ var useLedgerAccounts = () => {
|
|
|
13222
13241
|
};
|
|
13223
13242
|
};
|
|
13224
13243
|
|
|
13225
|
-
// src/components/ChartOfAccountsTable/
|
|
13226
|
-
import React157, { useContext as useContext24, useState as
|
|
13244
|
+
// src/components/ChartOfAccountsTable/ChartOfAccountsTableWithPanel.tsx
|
|
13245
|
+
import React157, { useContext as useContext24, useState as useState43 } from "react";
|
|
13227
13246
|
|
|
13228
13247
|
// src/components/ChartOfAccountsDatePicker/ChartOfAccountsDatePicker.tsx
|
|
13229
13248
|
import React151, { useContext as useContext21 } from "react";
|
|
@@ -13247,261 +13266,11 @@ var ChartOfAccountsDatePicker = () => {
|
|
|
13247
13266
|
);
|
|
13248
13267
|
};
|
|
13249
13268
|
|
|
13250
|
-
// src/components/ChartOfAccountsRow/ChartOfAccountsRow.tsx
|
|
13251
|
-
import React153, { useContext as useContext22, useEffect as useEffect39, useState as useState41 } from "react";
|
|
13252
|
-
|
|
13253
|
-
// src/icons/Edit2.tsx
|
|
13254
|
-
import * as React152 from "react";
|
|
13255
|
-
var Edit2 = ({ size = 18, ...props }) => /* @__PURE__ */ React152.createElement(
|
|
13256
|
-
"svg",
|
|
13257
|
-
{
|
|
13258
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
13259
|
-
viewBox: "0 0 18 18",
|
|
13260
|
-
fill: "none",
|
|
13261
|
-
...props,
|
|
13262
|
-
width: size,
|
|
13263
|
-
height: size
|
|
13264
|
-
},
|
|
13265
|
-
/* @__PURE__ */ React152.createElement(
|
|
13266
|
-
"path",
|
|
13267
|
-
{
|
|
13268
|
-
d: "M12.75 2.25C12.947 2.05301 13.1808 1.89676 13.4382 1.79015C13.6956 1.68355 13.9714 1.62868 14.25 1.62868C14.5286 1.62868 14.8044 1.68355 15.0618 1.79015C15.3192 1.89676 15.553 2.05301 15.75 2.25C15.947 2.44698 16.1032 2.68083 16.2098 2.9382C16.3165 3.19557 16.3713 3.47142 16.3713 3.75C16.3713 4.02857 16.3165 4.30442 16.2098 4.56179C16.1032 4.81916 15.947 5.05302 15.75 5.25L5.625 15.375L1.5 16.5L2.625 12.375L12.75 2.25Z",
|
|
13269
|
-
stroke: "currentColor",
|
|
13270
|
-
strokeLinecap: "round",
|
|
13271
|
-
strokeLinejoin: "round"
|
|
13272
|
-
}
|
|
13273
|
-
)
|
|
13274
|
-
);
|
|
13275
|
-
var Edit2_default = Edit2;
|
|
13276
|
-
|
|
13277
|
-
// src/components/ChartOfAccountsRow/ChartOfAccountsRow.tsx
|
|
13278
|
-
import classNames54 from "classnames";
|
|
13279
|
-
var INDENTATION = 24;
|
|
13280
|
-
var EXPANDED_STYLE2 = {
|
|
13281
|
-
height: 52,
|
|
13282
|
-
paddingTop: 12,
|
|
13283
|
-
paddingBottom: 12,
|
|
13284
|
-
opacity: 1
|
|
13285
|
-
};
|
|
13286
|
-
var EXPANDED_MOBILE_STYLE = {
|
|
13287
|
-
height: 76,
|
|
13288
|
-
paddingTop: 12,
|
|
13289
|
-
paddingBottom: 12,
|
|
13290
|
-
opacity: 1
|
|
13291
|
-
};
|
|
13292
|
-
var COLLAPSED_STYLE2 = {
|
|
13293
|
-
height: 0,
|
|
13294
|
-
paddingTop: 0,
|
|
13295
|
-
paddingBottom: 0,
|
|
13296
|
-
opacity: 0.5
|
|
13297
|
-
};
|
|
13298
|
-
var ChartOfAccountsRow = ({
|
|
13299
|
-
account,
|
|
13300
|
-
depth = 0,
|
|
13301
|
-
index,
|
|
13302
|
-
cumulativeIndex = 0,
|
|
13303
|
-
expanded = false,
|
|
13304
|
-
defaultOpen = false,
|
|
13305
|
-
acountsLength,
|
|
13306
|
-
view,
|
|
13307
|
-
expandAll
|
|
13308
|
-
}) => {
|
|
13309
|
-
const { form, editAccount } = useContext22(ChartOfAccountsContext);
|
|
13310
|
-
const { setAccountId } = useContext22(LedgerAccountsContext);
|
|
13311
|
-
const baseStyle = view === "desktop" ? EXPANDED_STYLE2 : EXPANDED_MOBILE_STYLE;
|
|
13312
|
-
const [isOpen, setIsOpen] = useState41(defaultOpen);
|
|
13313
|
-
const style = expanded ? {
|
|
13314
|
-
...baseStyle,
|
|
13315
|
-
transitionDelay: `${15 * index}ms`
|
|
13316
|
-
} : {
|
|
13317
|
-
...COLLAPSED_STYLE2,
|
|
13318
|
-
transitionDelay: `${acountsLength - 15 * index}ms`
|
|
13319
|
-
};
|
|
13320
|
-
const [showComponent, setShowComponent] = useState41(false);
|
|
13321
|
-
const [prevExpandedAll, setPrevExpandedAll] = useState41(expandAll);
|
|
13322
|
-
useEffect39(() => {
|
|
13323
|
-
const timeoutId = setTimeout(() => {
|
|
13324
|
-
setShowComponent(true);
|
|
13325
|
-
}, cumulativeIndex * 50);
|
|
13326
|
-
return () => clearTimeout(timeoutId);
|
|
13327
|
-
}, []);
|
|
13328
|
-
useEffect39(() => {
|
|
13329
|
-
if (prevExpandedAll !== expandAll && expandAll) {
|
|
13330
|
-
setIsOpen(expandAll === "collapsed" ? false : true);
|
|
13331
|
-
}
|
|
13332
|
-
}, [expandAll]);
|
|
13333
|
-
const baseClass = classNames54(
|
|
13334
|
-
"Layer__table-row",
|
|
13335
|
-
isOpen ? "Layer__table-row--expanded" : "Layer__table-row--collapsed",
|
|
13336
|
-
!expanded && "Layer__table-row--hidden",
|
|
13337
|
-
`Layer__table-row--depth-${depth}`,
|
|
13338
|
-
form?.accountId === account.id && "Layer__table-row--active",
|
|
13339
|
-
!showComponent && "Layer__table-row--anim-starting-state"
|
|
13340
|
-
);
|
|
13341
|
-
const desktopRowClass = classNames54(
|
|
13342
|
-
baseClass,
|
|
13343
|
-
"Layer__chart-of-accounts__row---desktop"
|
|
13344
|
-
);
|
|
13345
|
-
const mobileRowClass = classNames54(
|
|
13346
|
-
baseClass,
|
|
13347
|
-
"Layer__chart-of-accounts__row---mobile"
|
|
13348
|
-
);
|
|
13349
|
-
return /* @__PURE__ */ React153.createElement(React153.Fragment, null, view === "desktop" && /* @__PURE__ */ React153.createElement(
|
|
13350
|
-
"tr",
|
|
13351
|
-
{
|
|
13352
|
-
className: desktopRowClass,
|
|
13353
|
-
onClick: (e) => {
|
|
13354
|
-
e.preventDefault();
|
|
13355
|
-
e.stopPropagation();
|
|
13356
|
-
setAccountId(account.id);
|
|
13357
|
-
}
|
|
13358
|
-
},
|
|
13359
|
-
/* @__PURE__ */ React153.createElement("td", { className: "Layer__table-cell Layer__coa__name" }, /* @__PURE__ */ React153.createElement("span", { className: "Layer__table-cell-content", style }, /* @__PURE__ */ React153.createElement(
|
|
13360
|
-
"span",
|
|
13361
|
-
{
|
|
13362
|
-
className: "Layer__table-cell-content-indentation",
|
|
13363
|
-
style: {
|
|
13364
|
-
paddingLeft: INDENTATION * depth + 16
|
|
13365
|
-
}
|
|
13366
|
-
},
|
|
13367
|
-
account.sub_accounts && account.sub_accounts.length > 0 && /* @__PURE__ */ React153.createElement(
|
|
13368
|
-
ChevronDownFill_default,
|
|
13369
|
-
{
|
|
13370
|
-
size: 16,
|
|
13371
|
-
className: "Layer__table__expand-icon",
|
|
13372
|
-
onClick: (e) => {
|
|
13373
|
-
e.stopPropagation();
|
|
13374
|
-
setIsOpen(!isOpen);
|
|
13375
|
-
}
|
|
13376
|
-
}
|
|
13377
|
-
),
|
|
13378
|
-
/* @__PURE__ */ React153.createElement("span", { className: "Layer__coa__name__text" }, account.name)
|
|
13379
|
-
))),
|
|
13380
|
-
/* @__PURE__ */ React153.createElement("td", { className: "Layer__table-cell Layer__coa__type" }, /* @__PURE__ */ React153.createElement(
|
|
13381
|
-
"span",
|
|
13382
|
-
{
|
|
13383
|
-
className: "Layer__table-cell-content Layer__mobile--hidden",
|
|
13384
|
-
style
|
|
13385
|
-
},
|
|
13386
|
-
account.account_type?.display_name
|
|
13387
|
-
), /* @__PURE__ */ React153.createElement(
|
|
13388
|
-
"span",
|
|
13389
|
-
{
|
|
13390
|
-
className: "Layer__table-cell-content Layer__desktop--hidden",
|
|
13391
|
-
style
|
|
13392
|
-
},
|
|
13393
|
-
/* @__PURE__ */ React153.createElement(
|
|
13394
|
-
Text,
|
|
13395
|
-
{
|
|
13396
|
-
weight: "bold" /* bold */,
|
|
13397
|
-
className: "Layer__coa__type--mobile"
|
|
13398
|
-
},
|
|
13399
|
-
account.normality
|
|
13400
|
-
),
|
|
13401
|
-
/* @__PURE__ */ React153.createElement(Text, { className: "Layer__coa__subtype--mobile" }, account.account_subtype?.display_name)
|
|
13402
|
-
)),
|
|
13403
|
-
/* @__PURE__ */ React153.createElement("td", { className: "Layer__table-cell Layer__coa__subtype Layer__mobile--hidden" }, /* @__PURE__ */ React153.createElement("span", { className: "Layer__table-cell-content", style }, account.account_subtype?.display_name)),
|
|
13404
|
-
/* @__PURE__ */ React153.createElement("td", { className: "Layer__table-cell Layer__coa__balance" }, /* @__PURE__ */ React153.createElement(
|
|
13405
|
-
"span",
|
|
13406
|
-
{
|
|
13407
|
-
className: "Layer__table-cell-content Layer__table-cell--amount",
|
|
13408
|
-
style
|
|
13409
|
-
},
|
|
13410
|
-
"$",
|
|
13411
|
-
centsToDollars(Math.abs(account.balance || 0))
|
|
13412
|
-
)),
|
|
13413
|
-
/* @__PURE__ */ React153.createElement("td", { className: "Layer__table-cell Layer__coa__actions" }, /* @__PURE__ */ React153.createElement("span", { className: "Layer__table-cell-content", style }, /* @__PURE__ */ React153.createElement(
|
|
13414
|
-
Button,
|
|
13415
|
-
{
|
|
13416
|
-
variant: "secondary" /* secondary */,
|
|
13417
|
-
rightIcon: /* @__PURE__ */ React153.createElement(Edit2_default, { size: 12 }),
|
|
13418
|
-
iconOnly: true,
|
|
13419
|
-
onClick: (e) => {
|
|
13420
|
-
e.preventDefault();
|
|
13421
|
-
e.stopPropagation();
|
|
13422
|
-
editAccount(account.id);
|
|
13423
|
-
}
|
|
13424
|
-
},
|
|
13425
|
-
"Edit"
|
|
13426
|
-
)))
|
|
13427
|
-
), view === "mobile" || view === "tablet" ? /* @__PURE__ */ React153.createElement(
|
|
13428
|
-
"tr",
|
|
13429
|
-
{
|
|
13430
|
-
className: mobileRowClass,
|
|
13431
|
-
onClick: (e) => {
|
|
13432
|
-
e.preventDefault();
|
|
13433
|
-
e.stopPropagation();
|
|
13434
|
-
setAccountId(account.id);
|
|
13435
|
-
}
|
|
13436
|
-
},
|
|
13437
|
-
/* @__PURE__ */ React153.createElement("td", { className: "Layer__table-cell", colSpan: 5 }, /* @__PURE__ */ React153.createElement(
|
|
13438
|
-
"span",
|
|
13439
|
-
{
|
|
13440
|
-
className: "Layer__table-cell-content Layer__table-cell-content-indentation",
|
|
13441
|
-
style: {
|
|
13442
|
-
paddingLeft: INDENTATION * depth + 16,
|
|
13443
|
-
...style
|
|
13444
|
-
}
|
|
13445
|
-
},
|
|
13446
|
-
account.sub_accounts && account.sub_accounts.length > 0 && /* @__PURE__ */ React153.createElement(
|
|
13447
|
-
ChevronDownFill_default,
|
|
13448
|
-
{
|
|
13449
|
-
size: 16,
|
|
13450
|
-
className: "Layer__table__expand-icon",
|
|
13451
|
-
onClick: (e) => {
|
|
13452
|
-
e.stopPropagation();
|
|
13453
|
-
setIsOpen(!isOpen);
|
|
13454
|
-
}
|
|
13455
|
-
}
|
|
13456
|
-
),
|
|
13457
|
-
/* @__PURE__ */ React153.createElement("div", { className: "Layer__chart-of-accounts__mobile-row-content" }, /* @__PURE__ */ React153.createElement("div", { className: "Layer__chart-of-accounts__mobile-row-content__top-row" }, /* @__PURE__ */ React153.createElement(
|
|
13458
|
-
Text,
|
|
13459
|
-
{
|
|
13460
|
-
as: "span",
|
|
13461
|
-
className: "Layer__chart-of-accounts__mobile-row-content__name"
|
|
13462
|
-
},
|
|
13463
|
-
account.name
|
|
13464
|
-
), /* @__PURE__ */ React153.createElement(
|
|
13465
|
-
TextButton,
|
|
13466
|
-
{
|
|
13467
|
-
onClick: (e) => {
|
|
13468
|
-
e.preventDefault();
|
|
13469
|
-
e.stopPropagation();
|
|
13470
|
-
editAccount(account.id);
|
|
13471
|
-
}
|
|
13472
|
-
},
|
|
13473
|
-
"Edit"
|
|
13474
|
-
)), /* @__PURE__ */ React153.createElement("div", { className: "Layer__chart-of-accounts__mobile-row-content__bottom-row" }, /* @__PURE__ */ React153.createElement("div", { className: "Layer__chart-of-accounts__mobile-row-content__types" }, /* @__PURE__ */ React153.createElement(Text, { as: "span" }, account.normality), /* @__PURE__ */ React153.createElement("span", { className: "Layer__chart-of-accounts__mobile-row-content__separator" }), /* @__PURE__ */ React153.createElement(Text, { as: "span" }, "Sub-Type")), /* @__PURE__ */ React153.createElement(
|
|
13475
|
-
Text,
|
|
13476
|
-
{
|
|
13477
|
-
as: "span",
|
|
13478
|
-
className: "Layer__chart-of-accounts__mobile-row-content__balance"
|
|
13479
|
-
},
|
|
13480
|
-
"$",
|
|
13481
|
-
centsToDollars(Math.abs(account.balance || 0))
|
|
13482
|
-
)))
|
|
13483
|
-
))
|
|
13484
|
-
) : null, (account.sub_accounts || []).map((subAccount, idx) => /* @__PURE__ */ React153.createElement(
|
|
13485
|
-
ChartOfAccountsRow,
|
|
13486
|
-
{
|
|
13487
|
-
key: subAccount.id,
|
|
13488
|
-
account: subAccount,
|
|
13489
|
-
depth: depth + 1,
|
|
13490
|
-
index: idx,
|
|
13491
|
-
expanded: isOpen && expanded,
|
|
13492
|
-
cumulativeIndex: cumulativeIndex + idx + 1,
|
|
13493
|
-
acountsLength: (account.sub_accounts ?? []).length,
|
|
13494
|
-
view,
|
|
13495
|
-
expandAll
|
|
13496
|
-
}
|
|
13497
|
-
)));
|
|
13498
|
-
};
|
|
13499
|
-
|
|
13500
13269
|
// src/components/ChartOfAccountsSidebar/ChartOfAccountsSidebar.tsx
|
|
13501
|
-
import
|
|
13270
|
+
import React154 from "react";
|
|
13502
13271
|
|
|
13503
13272
|
// src/components/ChartOfAccountsForm/ChartOfAccountsForm.tsx
|
|
13504
|
-
import
|
|
13273
|
+
import React153, { useContext as useContext22, useMemo as useMemo14 } from "react";
|
|
13505
13274
|
|
|
13506
13275
|
// src/components/ChartOfAccountsForm/useParentOptions.ts
|
|
13507
13276
|
import { useMemo as useMemo13 } from "react";
|
|
@@ -13525,7 +13294,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
|
|
|
13525
13294
|
submitForm,
|
|
13526
13295
|
sendingForm,
|
|
13527
13296
|
apiError
|
|
13528
|
-
} =
|
|
13297
|
+
} = useContext22(ChartOfAccountsContext);
|
|
13529
13298
|
const parentOptions = useParentOptions(data);
|
|
13530
13299
|
const entry = useMemo14(() => {
|
|
13531
13300
|
if (form?.action === "edit" && form.accountId) {
|
|
@@ -13538,7 +13307,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
|
|
|
13538
13307
|
if (!form) {
|
|
13539
13308
|
return;
|
|
13540
13309
|
}
|
|
13541
|
-
return /* @__PURE__ */
|
|
13310
|
+
return /* @__PURE__ */ React153.createElement(
|
|
13542
13311
|
"form",
|
|
13543
13312
|
{
|
|
13544
13313
|
className: "Layer__form",
|
|
@@ -13547,7 +13316,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
|
|
|
13547
13316
|
submitForm();
|
|
13548
13317
|
}
|
|
13549
13318
|
},
|
|
13550
|
-
/* @__PURE__ */
|
|
13319
|
+
/* @__PURE__ */ React153.createElement("div", { className: "Layer__chart-of-accounts__sidebar__header" }, /* @__PURE__ */ React153.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, form?.action === "edit" ? stringOverrides?.editModeHeader || "Edit Account" : stringOverrides?.createModeHeader || "Add New Account"), /* @__PURE__ */ React153.createElement("div", { className: "actions" }, /* @__PURE__ */ React153.createElement(
|
|
13551
13320
|
Button,
|
|
13552
13321
|
{
|
|
13553
13322
|
type: "button",
|
|
@@ -13556,7 +13325,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
|
|
|
13556
13325
|
disabled: sendingForm
|
|
13557
13326
|
},
|
|
13558
13327
|
stringOverrides?.cancelButton || "Cancel"
|
|
13559
|
-
), apiError && /* @__PURE__ */
|
|
13328
|
+
), apiError && /* @__PURE__ */ React153.createElement(
|
|
13560
13329
|
RetryButton,
|
|
13561
13330
|
{
|
|
13562
13331
|
type: "submit",
|
|
@@ -13565,7 +13334,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
|
|
|
13565
13334
|
disabled: sendingForm
|
|
13566
13335
|
},
|
|
13567
13336
|
stringOverrides?.retryButton || "Retry"
|
|
13568
|
-
), !apiError && /* @__PURE__ */
|
|
13337
|
+
), !apiError && /* @__PURE__ */ React153.createElement(
|
|
13569
13338
|
SubmitButton,
|
|
13570
13339
|
{
|
|
13571
13340
|
type: "submit",
|
|
@@ -13575,7 +13344,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
|
|
|
13575
13344
|
},
|
|
13576
13345
|
stringOverrides?.saveButton || "Save"
|
|
13577
13346
|
))),
|
|
13578
|
-
apiError && /* @__PURE__ */
|
|
13347
|
+
apiError && /* @__PURE__ */ React153.createElement(
|
|
13579
13348
|
Text,
|
|
13580
13349
|
{
|
|
13581
13350
|
size: "sm" /* sm */,
|
|
@@ -13583,8 +13352,8 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
|
|
|
13583
13352
|
},
|
|
13584
13353
|
apiError
|
|
13585
13354
|
),
|
|
13586
|
-
entry && /* @__PURE__ */
|
|
13587
|
-
/* @__PURE__ */
|
|
13355
|
+
entry && /* @__PURE__ */ React153.createElement("div", { className: "Layer__chart-of-accounts__form-edit-entry" }, /* @__PURE__ */ React153.createElement(Text, { weight: "bold" /* bold */ }, entry.name), /* @__PURE__ */ React153.createElement(Text, { weight: "bold" /* bold */ }, "$", centsToDollars(entry.balance || 0))),
|
|
13356
|
+
/* @__PURE__ */ React153.createElement("div", { className: "Layer__chart-of-accounts__form" }, /* @__PURE__ */ React153.createElement(InputGroup, { name: "parent", label: stringOverrides?.parentLabel || "Parent", inline: true }, /* @__PURE__ */ React153.createElement(
|
|
13588
13357
|
Select2,
|
|
13589
13358
|
{
|
|
13590
13359
|
options: parentOptions,
|
|
@@ -13592,7 +13361,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
|
|
|
13592
13361
|
onChange: (sel) => changeFormData("parent", sel),
|
|
13593
13362
|
disabled: sendingForm
|
|
13594
13363
|
}
|
|
13595
|
-
)), /* @__PURE__ */
|
|
13364
|
+
)), /* @__PURE__ */ React153.createElement(InputGroup, { name: "name", label: stringOverrides?.nameLabel || "Name", inline: true }, /* @__PURE__ */ React153.createElement(
|
|
13596
13365
|
Input,
|
|
13597
13366
|
{
|
|
13598
13367
|
name: "name",
|
|
@@ -13603,7 +13372,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
|
|
|
13603
13372
|
disabled: sendingForm,
|
|
13604
13373
|
onChange: (e) => changeFormData("name", e.target.value)
|
|
13605
13374
|
}
|
|
13606
|
-
)), /* @__PURE__ */
|
|
13375
|
+
)), /* @__PURE__ */ React153.createElement(InputGroup, { name: "type", label: stringOverrides?.typeLabel || "Type", inline: true }, /* @__PURE__ */ React153.createElement(
|
|
13607
13376
|
Select2,
|
|
13608
13377
|
{
|
|
13609
13378
|
options: LEDGER_ACCOUNT_TYPES,
|
|
@@ -13613,7 +13382,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
|
|
|
13613
13382
|
errorMessage: form?.errors?.find((x) => x.field === "type")?.message,
|
|
13614
13383
|
disabled: sendingForm || form.action === "edit" || form.data.parent !== void 0
|
|
13615
13384
|
}
|
|
13616
|
-
)), /* @__PURE__ */
|
|
13385
|
+
)), /* @__PURE__ */ React153.createElement(InputGroup, { name: "subType", label: stringOverrides?.subTypeLabel || "Sub-Type", inline: true }, /* @__PURE__ */ React153.createElement(
|
|
13617
13386
|
Select2,
|
|
13618
13387
|
{
|
|
13619
13388
|
options: form?.data.type?.value !== void 0 ? LEDGER_ACCOUNT_SUBTYPES_FOR_TYPE[form?.data.type?.value] : LEDGER_ACCOUNT_SUBTYPES,
|
|
@@ -13621,7 +13390,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
|
|
|
13621
13390
|
onChange: (sel) => changeFormData("subType", sel),
|
|
13622
13391
|
disabled: sendingForm
|
|
13623
13392
|
}
|
|
13624
|
-
)), /* @__PURE__ */
|
|
13393
|
+
)), /* @__PURE__ */ React153.createElement(InputGroup, { name: "normality", label: stringOverrides?.normalityLabel || "Normality", inline: true }, /* @__PURE__ */ React153.createElement(
|
|
13625
13394
|
Select2,
|
|
13626
13395
|
{
|
|
13627
13396
|
options: NORMALITY_OPTIONS,
|
|
@@ -13633,7 +13402,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
|
|
|
13633
13402
|
onChange: (sel) => changeFormData("normality", sel),
|
|
13634
13403
|
disabled: sendingForm
|
|
13635
13404
|
}
|
|
13636
|
-
)), /* @__PURE__ */
|
|
13405
|
+
)), /* @__PURE__ */ React153.createElement("div", { className: "actions" }, /* @__PURE__ */ React153.createElement(
|
|
13637
13406
|
Button,
|
|
13638
13407
|
{
|
|
13639
13408
|
type: "button",
|
|
@@ -13642,7 +13411,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
|
|
|
13642
13411
|
disabled: sendingForm
|
|
13643
13412
|
},
|
|
13644
13413
|
stringOverrides?.cancelButton || "Cancel"
|
|
13645
|
-
), apiError && /* @__PURE__ */
|
|
13414
|
+
), apiError && /* @__PURE__ */ React153.createElement(
|
|
13646
13415
|
RetryButton,
|
|
13647
13416
|
{
|
|
13648
13417
|
type: "submit",
|
|
@@ -13651,7 +13420,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
|
|
|
13651
13420
|
disabled: sendingForm
|
|
13652
13421
|
},
|
|
13653
13422
|
stringOverrides?.retryButton || "Retry"
|
|
13654
|
-
), !apiError && /* @__PURE__ */
|
|
13423
|
+
), !apiError && /* @__PURE__ */ React153.createElement(
|
|
13655
13424
|
SubmitButton,
|
|
13656
13425
|
{
|
|
13657
13426
|
type: "submit",
|
|
@@ -13669,12 +13438,158 @@ var ChartOfAccountsSidebar = ({
|
|
|
13669
13438
|
parentRef: _parentRef,
|
|
13670
13439
|
stringOverrides
|
|
13671
13440
|
}) => {
|
|
13672
|
-
return /* @__PURE__ */
|
|
13441
|
+
return /* @__PURE__ */ React154.createElement(ChartOfAccountsForm, { stringOverrides });
|
|
13673
13442
|
};
|
|
13674
13443
|
|
|
13675
13444
|
// src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
|
|
13676
|
-
|
|
13445
|
+
import React156, { useContext as useContext23, useEffect as useEffect39, useState as useState42 } from "react";
|
|
13446
|
+
|
|
13447
|
+
// src/icons/Edit2.tsx
|
|
13448
|
+
import * as React155 from "react";
|
|
13449
|
+
var Edit2 = ({ size = 18, ...props }) => /* @__PURE__ */ React155.createElement(
|
|
13450
|
+
"svg",
|
|
13451
|
+
{
|
|
13452
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13453
|
+
viewBox: "0 0 18 18",
|
|
13454
|
+
fill: "none",
|
|
13455
|
+
...props,
|
|
13456
|
+
width: size,
|
|
13457
|
+
height: size
|
|
13458
|
+
},
|
|
13459
|
+
/* @__PURE__ */ React155.createElement(
|
|
13460
|
+
"path",
|
|
13461
|
+
{
|
|
13462
|
+
d: "M12.75 2.25C12.947 2.05301 13.1808 1.89676 13.4382 1.79015C13.6956 1.68355 13.9714 1.62868 14.25 1.62868C14.5286 1.62868 14.8044 1.68355 15.0618 1.79015C15.3192 1.89676 15.553 2.05301 15.75 2.25C15.947 2.44698 16.1032 2.68083 16.2098 2.9382C16.3165 3.19557 16.3713 3.47142 16.3713 3.75C16.3713 4.02857 16.3165 4.30442 16.2098 4.56179C16.1032 4.81916 15.947 5.05302 15.75 5.25L5.625 15.375L1.5 16.5L2.625 12.375L12.75 2.25Z",
|
|
13463
|
+
stroke: "currentColor",
|
|
13464
|
+
strokeLinecap: "round",
|
|
13465
|
+
strokeLinejoin: "round"
|
|
13466
|
+
}
|
|
13467
|
+
)
|
|
13468
|
+
);
|
|
13469
|
+
var Edit2_default = Edit2;
|
|
13470
|
+
|
|
13471
|
+
// src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
|
|
13677
13472
|
var ChartOfAccountsTable = ({
|
|
13473
|
+
view,
|
|
13474
|
+
stringOverrides,
|
|
13475
|
+
data,
|
|
13476
|
+
error,
|
|
13477
|
+
expandAll,
|
|
13478
|
+
cumulativeIndex,
|
|
13479
|
+
accountsLength
|
|
13480
|
+
}) => /* @__PURE__ */ React156.createElement(TableProvider, null, /* @__PURE__ */ React156.createElement(
|
|
13481
|
+
ChartOfAccountsTableContent,
|
|
13482
|
+
{
|
|
13483
|
+
view,
|
|
13484
|
+
data,
|
|
13485
|
+
stringOverrides,
|
|
13486
|
+
error,
|
|
13487
|
+
expandAll,
|
|
13488
|
+
cumulativeIndex,
|
|
13489
|
+
accountsLength
|
|
13490
|
+
}
|
|
13491
|
+
));
|
|
13492
|
+
var ChartOfAccountsTableContent = ({
|
|
13493
|
+
view,
|
|
13494
|
+
stringOverrides,
|
|
13495
|
+
data,
|
|
13496
|
+
error,
|
|
13497
|
+
expandAll,
|
|
13498
|
+
cumulativeIndex,
|
|
13499
|
+
accountsLength
|
|
13500
|
+
}) => {
|
|
13501
|
+
const { setAccountId } = useContext23(LedgerAccountsContext);
|
|
13502
|
+
const { editAccount } = useContext23(ChartOfAccountsContext);
|
|
13503
|
+
const { isOpen, setIsOpen } = useTableExpandRow();
|
|
13504
|
+
const [accountsRowKeys, setAccountsRowKeys] = useState42([]);
|
|
13505
|
+
useEffect39(() => {
|
|
13506
|
+
if (expandAll === "expanded") {
|
|
13507
|
+
setIsOpen(accountsRowKeys);
|
|
13508
|
+
} else if (expandAll === "collapsed") {
|
|
13509
|
+
setIsOpen([]);
|
|
13510
|
+
}
|
|
13511
|
+
}, [expandAll]);
|
|
13512
|
+
useEffect39(() => {
|
|
13513
|
+
const defaultExpanded = data.accounts.map(
|
|
13514
|
+
(account) => "coa-row-" + account.id
|
|
13515
|
+
);
|
|
13516
|
+
setIsOpen(defaultExpanded);
|
|
13517
|
+
const searchRowsToExpand = (accounts, rowKey) => {
|
|
13518
|
+
accounts.map((account) => {
|
|
13519
|
+
if (account.sub_accounts.length > 0) {
|
|
13520
|
+
setAccountsRowKeys((prev) => [...prev, `${rowKey}-${account.id}`]);
|
|
13521
|
+
searchRowsToExpand(account.sub_accounts, `${rowKey}-${account.id}`);
|
|
13522
|
+
}
|
|
13523
|
+
});
|
|
13524
|
+
};
|
|
13525
|
+
searchRowsToExpand(data.accounts, "coa-row");
|
|
13526
|
+
}, []);
|
|
13527
|
+
const renderChartOfAccountsDesktopRow = (account, index, rowKey, depth) => {
|
|
13528
|
+
const expandable = !!account.sub_accounts && account.sub_accounts.length > 0;
|
|
13529
|
+
const expanded = expandable ? isOpen(rowKey) : true;
|
|
13530
|
+
return /* @__PURE__ */ React156.createElement(React156.Fragment, { key: rowKey + "-" + index }, /* @__PURE__ */ React156.createElement(
|
|
13531
|
+
TableRow,
|
|
13532
|
+
{
|
|
13533
|
+
rowKey: rowKey + "-" + index,
|
|
13534
|
+
expandable,
|
|
13535
|
+
isExpanded: expanded,
|
|
13536
|
+
onClick: (e) => {
|
|
13537
|
+
e.stopPropagation();
|
|
13538
|
+
setAccountId(account.id);
|
|
13539
|
+
},
|
|
13540
|
+
depth
|
|
13541
|
+
},
|
|
13542
|
+
/* @__PURE__ */ React156.createElement(
|
|
13543
|
+
TableCell,
|
|
13544
|
+
{
|
|
13545
|
+
withExpandIcon: expandable,
|
|
13546
|
+
onClick: (e) => {
|
|
13547
|
+
e.stopPropagation();
|
|
13548
|
+
expandable && setIsOpen(rowKey);
|
|
13549
|
+
}
|
|
13550
|
+
},
|
|
13551
|
+
account.name
|
|
13552
|
+
),
|
|
13553
|
+
/* @__PURE__ */ React156.createElement(TableCell, null, account.account_type?.display_name),
|
|
13554
|
+
/* @__PURE__ */ React156.createElement(TableCell, null, account.account_subtype?.display_name),
|
|
13555
|
+
/* @__PURE__ */ React156.createElement(TableCell, { isCurrency: true }, account.balance),
|
|
13556
|
+
/* @__PURE__ */ React156.createElement(TableCell, null, /* @__PURE__ */ React156.createElement("span", { className: "Layer__coa__actions" }, /* @__PURE__ */ React156.createElement(
|
|
13557
|
+
Button,
|
|
13558
|
+
{
|
|
13559
|
+
variant: "secondary" /* secondary */,
|
|
13560
|
+
rightIcon: /* @__PURE__ */ React156.createElement(Edit2_default, { size: 12 }),
|
|
13561
|
+
iconOnly: true,
|
|
13562
|
+
onClick: (e) => {
|
|
13563
|
+
e.preventDefault();
|
|
13564
|
+
e.stopPropagation();
|
|
13565
|
+
editAccount(account.id);
|
|
13566
|
+
}
|
|
13567
|
+
},
|
|
13568
|
+
"Edit"
|
|
13569
|
+
)))
|
|
13570
|
+
), expandable && expanded && account.sub_accounts.map((subItem, subIdx) => {
|
|
13571
|
+
const subRowKey = `${rowKey}-${subItem.id}`;
|
|
13572
|
+
return renderChartOfAccountsDesktopRow(
|
|
13573
|
+
subItem,
|
|
13574
|
+
subIdx,
|
|
13575
|
+
subRowKey,
|
|
13576
|
+
depth + 1
|
|
13577
|
+
);
|
|
13578
|
+
}));
|
|
13579
|
+
};
|
|
13580
|
+
return /* @__PURE__ */ React156.createElement(Table, null, /* @__PURE__ */ React156.createElement(TableHead, null, /* @__PURE__ */ React156.createElement(TableRow, { isHeadRow: true, rowKey: "charts-of-accounts-head-row" }, /* @__PURE__ */ React156.createElement(TableCell, { isHeaderCell: true }, stringOverrides?.nameColumnHeader || "Name"), /* @__PURE__ */ React156.createElement(TableCell, { isHeaderCell: true }, stringOverrides?.typeColumnHeader || "Type"), /* @__PURE__ */ React156.createElement(TableCell, { isHeaderCell: true }, stringOverrides?.subtypeColumnHeader || "Sub-Type"), /* @__PURE__ */ React156.createElement(TableCell, { isHeaderCell: true }, stringOverrides?.balanceColumnHeader || "Balance"), /* @__PURE__ */ React156.createElement(TableCell, { isHeaderCell: true }))), /* @__PURE__ */ React156.createElement(TableBody, null, !error && data.accounts.map(
|
|
13581
|
+
(account, idx) => renderChartOfAccountsDesktopRow(
|
|
13582
|
+
account,
|
|
13583
|
+
idx,
|
|
13584
|
+
`coa-row-${account.id}`,
|
|
13585
|
+
0
|
|
13586
|
+
)
|
|
13587
|
+
)));
|
|
13588
|
+
};
|
|
13589
|
+
|
|
13590
|
+
// src/components/ChartOfAccountsTable/ChartOfAccountsTableWithPanel.tsx
|
|
13591
|
+
var COMPONENT_NAME5 = "chart-of-accounts";
|
|
13592
|
+
var ChartOfAccountsTableWithPanel = ({
|
|
13678
13593
|
view,
|
|
13679
13594
|
containerRef,
|
|
13680
13595
|
asWidget = false,
|
|
@@ -13683,7 +13598,7 @@ var ChartOfAccountsTable = ({
|
|
|
13683
13598
|
stringOverrides
|
|
13684
13599
|
}) => {
|
|
13685
13600
|
const { data, isLoading, addAccount, error, isValidating, refetch, form } = useContext24(ChartOfAccountsContext);
|
|
13686
|
-
const [expandAll, setExpandAll] =
|
|
13601
|
+
const [expandAll, setExpandAll] = useState43();
|
|
13687
13602
|
let cumulativeIndex = 0;
|
|
13688
13603
|
const accountsLength = data?.accounts.length ?? 0;
|
|
13689
13604
|
return /* @__PURE__ */ React157.createElement(
|
|
@@ -13731,25 +13646,18 @@ var ChartOfAccountsTable = ({
|
|
|
13731
13646
|
/* @__PURE__ */ React157.createElement("div", { className: "Layer__header__actions-col" }, /* @__PURE__ */ React157.createElement(Button, { onClick: () => addAccount(), disabled: isLoading }, stringOverrides?.addAccountButtonText || "Add Account"))
|
|
13732
13647
|
)
|
|
13733
13648
|
),
|
|
13734
|
-
|
|
13735
|
-
|
|
13736
|
-
|
|
13737
|
-
|
|
13738
|
-
|
|
13739
|
-
|
|
13740
|
-
|
|
13741
|
-
|
|
13742
|
-
|
|
13743
|
-
|
|
13744
|
-
|
|
13745
|
-
|
|
13746
|
-
defaultOpen: true,
|
|
13747
|
-
acountsLength: accountsLength,
|
|
13748
|
-
view,
|
|
13749
|
-
expandAll
|
|
13750
|
-
}
|
|
13751
|
-
);
|
|
13752
|
-
}))),
|
|
13649
|
+
data && /* @__PURE__ */ React157.createElement(
|
|
13650
|
+
ChartOfAccountsTable,
|
|
13651
|
+
{
|
|
13652
|
+
view,
|
|
13653
|
+
data,
|
|
13654
|
+
error,
|
|
13655
|
+
stringOverrides,
|
|
13656
|
+
expandAll,
|
|
13657
|
+
accountsLength,
|
|
13658
|
+
cumulativeIndex
|
|
13659
|
+
}
|
|
13660
|
+
),
|
|
13753
13661
|
error ? /* @__PURE__ */ React157.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React157.createElement(
|
|
13754
13662
|
DataState,
|
|
13755
13663
|
{
|
|
@@ -13779,7 +13687,7 @@ import React164, {
|
|
|
13779
13687
|
useContext as useContext27,
|
|
13780
13688
|
useEffect as useEffect41,
|
|
13781
13689
|
useMemo as useMemo16,
|
|
13782
|
-
useState as
|
|
13690
|
+
useState as useState45
|
|
13783
13691
|
} from "react";
|
|
13784
13692
|
|
|
13785
13693
|
// src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
|
|
@@ -13787,9 +13695,9 @@ import React162, { useContext as useContext25, useMemo as useMemo15 } from "reac
|
|
|
13787
13695
|
|
|
13788
13696
|
// src/components/Card/Card.tsx
|
|
13789
13697
|
import React158 from "react";
|
|
13790
|
-
import
|
|
13698
|
+
import classNames54 from "classnames";
|
|
13791
13699
|
var Card = ({ children, className }) => {
|
|
13792
|
-
return /* @__PURE__ */ React158.createElement("div", { className:
|
|
13700
|
+
return /* @__PURE__ */ React158.createElement("div", { className: classNames54("Layer__card", className) }, children);
|
|
13793
13701
|
};
|
|
13794
13702
|
|
|
13795
13703
|
// src/components/DateTime/DateTime.tsx
|
|
@@ -13831,14 +13739,14 @@ var DateTime = ({
|
|
|
13831
13739
|
|
|
13832
13740
|
// src/components/DetailsList/DetailsList.tsx
|
|
13833
13741
|
import React160 from "react";
|
|
13834
|
-
import
|
|
13742
|
+
import classNames55 from "classnames";
|
|
13835
13743
|
var DetailsList = ({
|
|
13836
13744
|
title,
|
|
13837
13745
|
children,
|
|
13838
13746
|
className,
|
|
13839
13747
|
actions
|
|
13840
13748
|
}) => {
|
|
13841
|
-
return /* @__PURE__ */ React160.createElement("div", { className:
|
|
13749
|
+
return /* @__PURE__ */ React160.createElement("div", { className: classNames55("Layer__details-list", className) }, title && /* @__PURE__ */ React160.createElement(Header, null, /* @__PURE__ */ React160.createElement(Heading, { size: "secondary" /* secondary */ }, title), actions && /* @__PURE__ */ React160.createElement("div", { className: "Layer__details-list__actions" }, actions)), /* @__PURE__ */ React160.createElement("ul", { className: "Layer__details-list__list" }, children));
|
|
13842
13750
|
};
|
|
13843
13751
|
|
|
13844
13752
|
// src/components/DetailsList/DetailsListItem.tsx
|
|
@@ -14065,8 +13973,8 @@ var LedgerAccountEntryDetails = ({
|
|
|
14065
13973
|
};
|
|
14066
13974
|
|
|
14067
13975
|
// src/components/LedgerAccount/LedgerAccountRow.tsx
|
|
14068
|
-
import React163, { useContext as useContext26, useEffect as useEffect40, useState as
|
|
14069
|
-
import
|
|
13976
|
+
import React163, { useContext as useContext26, useEffect as useEffect40, useState as useState44 } from "react";
|
|
13977
|
+
import classNames56 from "classnames";
|
|
14070
13978
|
import { parseISO as parseISO13, format as formatTime10 } from "date-fns";
|
|
14071
13979
|
var LedgerAccountRow = ({
|
|
14072
13980
|
row,
|
|
@@ -14075,7 +13983,7 @@ var LedgerAccountRow = ({
|
|
|
14075
13983
|
view
|
|
14076
13984
|
}) => {
|
|
14077
13985
|
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = useContext26(LedgerAccountsContext);
|
|
14078
|
-
const [showComponent, setShowComponent] =
|
|
13986
|
+
const [showComponent, setShowComponent] = useState44(false);
|
|
14079
13987
|
useEffect40(() => {
|
|
14080
13988
|
if (initialLoad) {
|
|
14081
13989
|
const timeoutId = setTimeout(() => {
|
|
@@ -14090,7 +13998,7 @@ var LedgerAccountRow = ({
|
|
|
14090
13998
|
return /* @__PURE__ */ React163.createElement(
|
|
14091
13999
|
"tr",
|
|
14092
14000
|
{
|
|
14093
|
-
className:
|
|
14001
|
+
className: classNames56(
|
|
14094
14002
|
"Layer__table-row",
|
|
14095
14003
|
row.entry_id === selectedEntryId && "Layer__table-row--active",
|
|
14096
14004
|
initialLoad && "initial-load",
|
|
@@ -14123,7 +14031,7 @@ var LedgerAccountRow = ({
|
|
|
14123
14031
|
return /* @__PURE__ */ React163.createElement(
|
|
14124
14032
|
"tr",
|
|
14125
14033
|
{
|
|
14126
|
-
className:
|
|
14034
|
+
className: classNames56(
|
|
14127
14035
|
"Layer__table-row",
|
|
14128
14036
|
row.entry_id === selectedEntryId && "Layer__table-row--active",
|
|
14129
14037
|
initialLoad && "initial-load",
|
|
@@ -14152,7 +14060,7 @@ var LedgerAccountRow = ({
|
|
|
14152
14060
|
return /* @__PURE__ */ React163.createElement(
|
|
14153
14061
|
"tr",
|
|
14154
14062
|
{
|
|
14155
|
-
className:
|
|
14063
|
+
className: classNames56(
|
|
14156
14064
|
"Layer__table-row",
|
|
14157
14065
|
row.entry_id === selectedEntryId && "Layer__table-row--active",
|
|
14158
14066
|
initialLoad && "initial-load",
|
|
@@ -14178,15 +14086,15 @@ var LedgerAccountRow = ({
|
|
|
14178
14086
|
};
|
|
14179
14087
|
|
|
14180
14088
|
// src/components/LedgerAccount/LedgerAccountIndex.tsx
|
|
14181
|
-
import
|
|
14089
|
+
import classNames57 from "classnames";
|
|
14182
14090
|
var LedgerAccount = ({
|
|
14183
14091
|
containerRef,
|
|
14184
14092
|
pageSize = 15,
|
|
14185
14093
|
view,
|
|
14186
14094
|
stringOverrides
|
|
14187
14095
|
}) => {
|
|
14188
|
-
const [currentPage, setCurrentPage] =
|
|
14189
|
-
const [initialLoad, setInitialLoad] =
|
|
14096
|
+
const [currentPage, setCurrentPage] = useState45(1);
|
|
14097
|
+
const [initialLoad, setInitialLoad] = useState45(true);
|
|
14190
14098
|
const { data: accountData } = useContext27(ChartOfAccountsContext);
|
|
14191
14099
|
const {
|
|
14192
14100
|
data: rawData,
|
|
@@ -14207,7 +14115,7 @@ var LedgerAccount = ({
|
|
|
14207
14115
|
return () => clearTimeout(timeoutLoad);
|
|
14208
14116
|
}
|
|
14209
14117
|
}, [isLoading]);
|
|
14210
|
-
const baseClassName =
|
|
14118
|
+
const baseClassName = classNames57(
|
|
14211
14119
|
"Layer__ledger-account__index",
|
|
14212
14120
|
accountId && "open"
|
|
14213
14121
|
);
|
|
@@ -14313,7 +14221,7 @@ var ChartOfAccountsContent = ({
|
|
|
14313
14221
|
stringOverrides
|
|
14314
14222
|
}) => {
|
|
14315
14223
|
const { accountId } = useContext28(LedgerAccountsContext);
|
|
14316
|
-
const [view, setView] =
|
|
14224
|
+
const [view, setView] = useState46("desktop");
|
|
14317
14225
|
const containerRef = useElementSize((_a, _b, { width }) => {
|
|
14318
14226
|
if (width) {
|
|
14319
14227
|
if (width >= BREAKPOINTS.TABLET && view !== "desktop") {
|
|
@@ -14325,8 +14233,15 @@ var ChartOfAccountsContent = ({
|
|
|
14325
14233
|
}
|
|
14326
14234
|
}
|
|
14327
14235
|
});
|
|
14328
|
-
return /* @__PURE__ */ React165.createElement(Container, { name: "chart-of-accounts", ref: containerRef, asWidget }, accountId ? /* @__PURE__ */ React165.createElement(
|
|
14329
|
-
|
|
14236
|
+
return /* @__PURE__ */ React165.createElement(Container, { name: "chart-of-accounts", ref: containerRef, asWidget }, accountId ? /* @__PURE__ */ React165.createElement(
|
|
14237
|
+
LedgerAccount,
|
|
14238
|
+
{
|
|
14239
|
+
view,
|
|
14240
|
+
containerRef,
|
|
14241
|
+
stringOverrides: stringOverrides?.ledgerAccount
|
|
14242
|
+
}
|
|
14243
|
+
) : /* @__PURE__ */ React165.createElement(
|
|
14244
|
+
ChartOfAccountsTableWithPanel,
|
|
14330
14245
|
{
|
|
14331
14246
|
asWidget,
|
|
14332
14247
|
withDateControl,
|
|
@@ -14339,7 +14254,7 @@ var ChartOfAccountsContent = ({
|
|
|
14339
14254
|
};
|
|
14340
14255
|
|
|
14341
14256
|
// src/components/Journal/Journal.tsx
|
|
14342
|
-
import React172, { useState as
|
|
14257
|
+
import React172, { useState as useState50 } from "react";
|
|
14343
14258
|
|
|
14344
14259
|
// src/contexts/JournalContext/JournalContext.tsx
|
|
14345
14260
|
import { createContext as createContext13 } from "react";
|
|
@@ -14376,7 +14291,7 @@ var JournalContext = createContext13({
|
|
|
14376
14291
|
});
|
|
14377
14292
|
|
|
14378
14293
|
// src/hooks/useJournal/useJournal.tsx
|
|
14379
|
-
import { useEffect as useEffect42, useState as
|
|
14294
|
+
import { useEffect as useEffect42, useState as useState47 } from "react";
|
|
14380
14295
|
|
|
14381
14296
|
// src/utils/journal.ts
|
|
14382
14297
|
var getAccountIdentifierPayload = (journalLineItem) => {
|
|
@@ -14407,11 +14322,11 @@ var useJournal = () => {
|
|
|
14407
14322
|
syncTimestamps,
|
|
14408
14323
|
hasBeenTouched
|
|
14409
14324
|
} = useLayerContext();
|
|
14410
|
-
const [selectedEntryId, setSelectedEntryId] =
|
|
14411
|
-
const [form, setForm] =
|
|
14412
|
-
const [addingEntry, setAddingEntry] =
|
|
14413
|
-
const [sendingForm, setSendingForm] =
|
|
14414
|
-
const [apiError, setApiError] =
|
|
14325
|
+
const [selectedEntryId, setSelectedEntryId] = useState47();
|
|
14326
|
+
const [form, setForm] = useState47();
|
|
14327
|
+
const [addingEntry, setAddingEntry] = useState47(false);
|
|
14328
|
+
const [sendingForm, setSendingForm] = useState47(false);
|
|
14329
|
+
const [apiError, setApiError] = useState47(void 0);
|
|
14415
14330
|
const queryKey = businessId && auth?.access_token && `journal-lines-${businessId}`;
|
|
14416
14331
|
const { data, isLoading, isValidating, error, mutate } = useSWR9(
|
|
14417
14332
|
queryKey,
|
|
@@ -14672,190 +14587,14 @@ var useJournal = () => {
|
|
|
14672
14587
|
};
|
|
14673
14588
|
};
|
|
14674
14589
|
|
|
14675
|
-
// src/components/JournalTable/
|
|
14676
|
-
import React171, { useContext as useContext34, useMemo as useMemo18, useState as
|
|
14677
|
-
|
|
14678
|
-
// src/components/JournalRow/JournalRow.tsx
|
|
14679
|
-
import React166, { useContext as useContext29, useEffect as useEffect43, useState as useState47 } from "react";
|
|
14680
|
-
import classNames59 from "classnames";
|
|
14681
|
-
import { parseISO as parseISO14, format as formatTime11 } from "date-fns";
|
|
14682
|
-
var INDENTATION2 = 24;
|
|
14683
|
-
var EXPANDED_STYLE3 = {
|
|
14684
|
-
height: "100%",
|
|
14685
|
-
opacity: 1
|
|
14686
|
-
};
|
|
14687
|
-
var COLLAPSED_STYLE3 = {
|
|
14688
|
-
height: 0,
|
|
14689
|
-
opacity: 0.5,
|
|
14690
|
-
paddingTop: 0,
|
|
14691
|
-
paddingBottom: 0
|
|
14692
|
-
};
|
|
14693
|
-
var rowId = (row) => {
|
|
14694
|
-
if ("id" in row) {
|
|
14695
|
-
return row.id;
|
|
14696
|
-
}
|
|
14697
|
-
return `${row.account_identifier.id}-${Math.random()}`;
|
|
14698
|
-
};
|
|
14699
|
-
var accountName = (row) => {
|
|
14700
|
-
if ("account" in row) {
|
|
14701
|
-
return row.account.name;
|
|
14702
|
-
}
|
|
14703
|
-
return row.account_identifier.name;
|
|
14704
|
-
};
|
|
14705
|
-
var JournalRow = ({
|
|
14706
|
-
row,
|
|
14707
|
-
index,
|
|
14708
|
-
initialLoad,
|
|
14709
|
-
view,
|
|
14710
|
-
lineItemsLength = 8,
|
|
14711
|
-
defaultOpen = false,
|
|
14712
|
-
expanded = false,
|
|
14713
|
-
depth = 0,
|
|
14714
|
-
cumulativeIndex = 0,
|
|
14715
|
-
selectedEntries = false
|
|
14716
|
-
}) => {
|
|
14717
|
-
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = useContext29(JournalContext);
|
|
14718
|
-
const [isOpen, setIsOpen] = useState47(index === 0 ? true : defaultOpen);
|
|
14719
|
-
const style = expanded ? {
|
|
14720
|
-
...EXPANDED_STYLE3,
|
|
14721
|
-
transitionDelay: `${15 * index}ms`
|
|
14722
|
-
} : {
|
|
14723
|
-
...COLLAPSED_STYLE3,
|
|
14724
|
-
transitionDelay: `${lineItemsLength - 15 * index}ms`
|
|
14725
|
-
};
|
|
14726
|
-
const [showComponent, setShowComponent] = useState47(false);
|
|
14727
|
-
const baseClass = classNames59(
|
|
14728
|
-
"Layer__journal-table-row",
|
|
14729
|
-
rowId(row) === selectedEntryId && "Layer__table-row--active",
|
|
14730
|
-
initialLoad && "initial-load",
|
|
14731
|
-
"Layer__table-row--with-show",
|
|
14732
|
-
showComponent ? "show" : "Layer__table-row--anim-starting-state",
|
|
14733
|
-
isOpen && "Layer__journal__table-row--expanded"
|
|
14734
|
-
);
|
|
14735
|
-
const journalEntryLineClass = classNames59(
|
|
14736
|
-
"Layer__journal-entry-table-row",
|
|
14737
|
-
selectedEntries && "Layer__table-row--active",
|
|
14738
|
-
initialLoad && "initial-load",
|
|
14739
|
-
"Layer__table-row--with-show",
|
|
14740
|
-
showComponent ? "show" : "Layer__table-row--anim-starting-state",
|
|
14741
|
-
"Layer__journal-line__table-row",
|
|
14742
|
-
!expanded && "Layer__table-row--hidden"
|
|
14743
|
-
);
|
|
14744
|
-
useEffect43(() => {
|
|
14745
|
-
if (initialLoad) {
|
|
14746
|
-
const timeoutId = setTimeout(() => {
|
|
14747
|
-
setShowComponent(true);
|
|
14748
|
-
}, index * 10);
|
|
14749
|
-
return () => clearTimeout(timeoutId);
|
|
14750
|
-
} else {
|
|
14751
|
-
setShowComponent(true);
|
|
14752
|
-
}
|
|
14753
|
-
}, []);
|
|
14754
|
-
if ("line_items" in row) {
|
|
14755
|
-
return /* @__PURE__ */ React166.createElement(React166.Fragment, null, /* @__PURE__ */ React166.createElement(
|
|
14756
|
-
"tr",
|
|
14757
|
-
{
|
|
14758
|
-
className: baseClass,
|
|
14759
|
-
style: { transitionDelay: `${15 * index}ms` },
|
|
14760
|
-
onClick: (e) => {
|
|
14761
|
-
e.stopPropagation();
|
|
14762
|
-
if (selectedEntryId === row.id) {
|
|
14763
|
-
closeSelectedEntry();
|
|
14764
|
-
} else {
|
|
14765
|
-
setSelectedEntryId(row.id);
|
|
14766
|
-
}
|
|
14767
|
-
}
|
|
14768
|
-
},
|
|
14769
|
-
/* @__PURE__ */ React166.createElement("td", { className: "Layer__table-cell Layer__journal__arrow" }, /* @__PURE__ */ React166.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ React166.createElement(
|
|
14770
|
-
"span",
|
|
14771
|
-
{
|
|
14772
|
-
className: "Layer__table-cell-content-indentation",
|
|
14773
|
-
style: {
|
|
14774
|
-
paddingLeft: INDENTATION2 * depth + 16
|
|
14775
|
-
},
|
|
14776
|
-
onClick: (e) => {
|
|
14777
|
-
e.stopPropagation();
|
|
14778
|
-
e.preventDefault();
|
|
14779
|
-
setIsOpen(!isOpen);
|
|
14780
|
-
}
|
|
14781
|
-
},
|
|
14782
|
-
row.line_items && row.line_items.length > 0 && /* @__PURE__ */ React166.createElement(
|
|
14783
|
-
ChevronDownFill_default,
|
|
14784
|
-
{
|
|
14785
|
-
size: 16,
|
|
14786
|
-
className: "Layer__table__expand-icon",
|
|
14787
|
-
style: {
|
|
14788
|
-
transform: isOpen ? "rotate(0deg)" : "rotate(-90deg)"
|
|
14789
|
-
}
|
|
14790
|
-
}
|
|
14791
|
-
)
|
|
14792
|
-
))),
|
|
14793
|
-
/* @__PURE__ */ React166.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React166.createElement("span", { className: "Layer__table-cell-content" }, row.id.substring(0, 5))),
|
|
14794
|
-
/* @__PURE__ */ React166.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React166.createElement("span", { className: "Layer__table-cell-content" }, row.date && formatTime11(parseISO14(row.date), DATE_FORMAT))),
|
|
14795
|
-
/* @__PURE__ */ React166.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React166.createElement("span", { className: "Layer__table-cell-content" }, humanizeEnum(row.entry_type))),
|
|
14796
|
-
/* @__PURE__ */ React166.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React166.createElement("span", { className: "Layer__table-cell-content" }, `(${row.line_items.length})`)),
|
|
14797
|
-
/* @__PURE__ */ React166.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ React166.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, "$", centsToDollars(
|
|
14798
|
-
Math.abs(
|
|
14799
|
-
row.line_items.filter((item) => item.direction === "DEBIT").map((item) => item.amount).reduce((a, b) => a + b, 0)
|
|
14800
|
-
)
|
|
14801
|
-
))),
|
|
14802
|
-
/* @__PURE__ */ React166.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ React166.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, "$", centsToDollars(
|
|
14803
|
-
Math.abs(
|
|
14804
|
-
row.line_items.filter((item) => item.direction === "CREDIT").map((item) => item.amount).reduce((a, b) => a + b, 0)
|
|
14805
|
-
)
|
|
14806
|
-
)))
|
|
14807
|
-
), (row.line_items || []).map((lineItem, idx) => /* @__PURE__ */ React166.createElement(
|
|
14808
|
-
JournalRow,
|
|
14809
|
-
{
|
|
14810
|
-
key: `${row.id}-${idx}`,
|
|
14811
|
-
row: lineItem,
|
|
14812
|
-
depth: depth + 1,
|
|
14813
|
-
index: idx,
|
|
14814
|
-
expanded: isOpen,
|
|
14815
|
-
cumulativeIndex: cumulativeIndex + idx + 1,
|
|
14816
|
-
lineItemsLength: (row.line_items ?? []).length,
|
|
14817
|
-
view,
|
|
14818
|
-
selectedEntries: row.id === selectedEntryId
|
|
14819
|
-
}
|
|
14820
|
-
)));
|
|
14821
|
-
}
|
|
14822
|
-
return /* @__PURE__ */ React166.createElement(
|
|
14823
|
-
"tr",
|
|
14824
|
-
{
|
|
14825
|
-
className: journalEntryLineClass,
|
|
14826
|
-
style: { transitionDelay: `${15 * index}ms` }
|
|
14827
|
-
},
|
|
14828
|
-
/* @__PURE__ */ React166.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React166.createElement("span", { className: "Layer__table-cell-content", style })),
|
|
14829
|
-
/* @__PURE__ */ React166.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React166.createElement("span", { className: "Layer__table-cell-content", style }, /* @__PURE__ */ React166.createElement("span", { className: "Layer__table-cell-hidden" }, rowId(row).substring(0, 5)))),
|
|
14830
|
-
/* @__PURE__ */ React166.createElement("td", { className: "Layer__table-cell" }),
|
|
14831
|
-
/* @__PURE__ */ React166.createElement("td", { className: "Layer__table-cell" }),
|
|
14832
|
-
/* @__PURE__ */ React166.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React166.createElement("span", { className: "Layer__table-cell-content", style }, accountName(row))),
|
|
14833
|
-
/* @__PURE__ */ React166.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, row.direction === "DEBIT" && /* @__PURE__ */ React166.createElement(
|
|
14834
|
-
"span",
|
|
14835
|
-
{
|
|
14836
|
-
className: "Layer__table-cell-content Layer__table-cell--amount",
|
|
14837
|
-
style
|
|
14838
|
-
},
|
|
14839
|
-
"$",
|
|
14840
|
-
centsToDollars(Math.abs(row.amount))
|
|
14841
|
-
)),
|
|
14842
|
-
/* @__PURE__ */ React166.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, row.direction === "CREDIT" && /* @__PURE__ */ React166.createElement(
|
|
14843
|
-
"span",
|
|
14844
|
-
{
|
|
14845
|
-
className: "Layer__table-cell-content Layer__table-cell--amount",
|
|
14846
|
-
style
|
|
14847
|
-
},
|
|
14848
|
-
"$",
|
|
14849
|
-
centsToDollars(Math.abs(row.amount))
|
|
14850
|
-
))
|
|
14851
|
-
);
|
|
14852
|
-
};
|
|
14590
|
+
// src/components/JournalTable/JournalTableWithPanel.tsx
|
|
14591
|
+
import React171, { useContext as useContext34, useMemo as useMemo18, useState as useState49 } from "react";
|
|
14853
14592
|
|
|
14854
14593
|
// src/components/JournalSidebar/JournalSidebar.tsx
|
|
14855
|
-
import
|
|
14594
|
+
import React169, { useContext as useContext32 } from "react";
|
|
14856
14595
|
|
|
14857
14596
|
// src/components/JournalEntryDetails/JournalEntryDetails.tsx
|
|
14858
|
-
import
|
|
14597
|
+
import React166, { useContext as useContext29, useMemo as useMemo17 } from "react";
|
|
14859
14598
|
var JournalEntryDetails = () => {
|
|
14860
14599
|
const {
|
|
14861
14600
|
data,
|
|
@@ -14863,21 +14602,21 @@ var JournalEntryDetails = () => {
|
|
|
14863
14602
|
errorEntry,
|
|
14864
14603
|
closeSelectedEntry,
|
|
14865
14604
|
selectedEntryId
|
|
14866
|
-
} =
|
|
14605
|
+
} = useContext29(JournalContext);
|
|
14867
14606
|
const entry = useMemo17(() => {
|
|
14868
14607
|
if (selectedEntryId && data) {
|
|
14869
14608
|
return data.find((x) => x.id === selectedEntryId);
|
|
14870
14609
|
}
|
|
14871
14610
|
return;
|
|
14872
14611
|
}, [data, selectedEntryId]);
|
|
14873
|
-
return /* @__PURE__ */
|
|
14612
|
+
return /* @__PURE__ */ React166.createElement("div", { className: "Layer__journal__entry-details" }, /* @__PURE__ */ React166.createElement(
|
|
14874
14613
|
DetailsList,
|
|
14875
14614
|
{
|
|
14876
14615
|
title: "Transaction source",
|
|
14877
|
-
actions: /* @__PURE__ */
|
|
14616
|
+
actions: /* @__PURE__ */ React166.createElement(
|
|
14878
14617
|
Button,
|
|
14879
14618
|
{
|
|
14880
|
-
rightIcon: /* @__PURE__ */
|
|
14619
|
+
rightIcon: /* @__PURE__ */ React166.createElement(X_default, null),
|
|
14881
14620
|
iconOnly: true,
|
|
14882
14621
|
onClick: closeSelectedEntry,
|
|
14883
14622
|
className: "Layer__details-list__close-btn",
|
|
@@ -14885,54 +14624,54 @@ var JournalEntryDetails = () => {
|
|
|
14885
14624
|
}
|
|
14886
14625
|
)
|
|
14887
14626
|
},
|
|
14888
|
-
/* @__PURE__ */
|
|
14889
|
-
entry?.source?.display_description && /* @__PURE__ */
|
|
14890
|
-
), /* @__PURE__ */
|
|
14627
|
+
/* @__PURE__ */ React166.createElement(DetailsListItem, { label: "Source", isLoading: isLoadingEntry }, /* @__PURE__ */ React166.createElement(Badge, null, entry?.source?.entity_name)),
|
|
14628
|
+
entry?.source?.display_description && /* @__PURE__ */ React166.createElement(SourceDetailView, { source: entry?.source })
|
|
14629
|
+
), /* @__PURE__ */ React166.createElement(
|
|
14891
14630
|
DetailsList,
|
|
14892
14631
|
{
|
|
14893
14632
|
title: `Journal Entry ${entry?.id.substring(0, 5)}`,
|
|
14894
14633
|
className: "Layer__border-top"
|
|
14895
14634
|
},
|
|
14896
|
-
/* @__PURE__ */
|
|
14897
|
-
/* @__PURE__ */
|
|
14898
|
-
/* @__PURE__ */
|
|
14899
|
-
entry?.reversal_id && /* @__PURE__ */
|
|
14900
|
-
), !isLoadingEntry && !errorEntry ? /* @__PURE__ */
|
|
14635
|
+
/* @__PURE__ */ React166.createElement(DetailsListItem, { label: "Entry type", isLoading: isLoadingEntry }, humanizeEnum(entry?.entry_type ?? "")),
|
|
14636
|
+
/* @__PURE__ */ React166.createElement(DetailsListItem, { label: "Date", isLoading: isLoadingEntry }, entry?.entry_at && /* @__PURE__ */ React166.createElement(DateTime, { value: entry?.entry_at })),
|
|
14637
|
+
/* @__PURE__ */ React166.createElement(DetailsListItem, { label: "Creation date", isLoading: isLoadingEntry }, entry?.date && /* @__PURE__ */ React166.createElement(DateTime, { value: entry?.date })),
|
|
14638
|
+
entry?.reversal_id && /* @__PURE__ */ React166.createElement(DetailsListItem, { label: "Reversal", isLoading: isLoadingEntry }, "Journal Entry #", entry?.reversal_id)
|
|
14639
|
+
), !isLoadingEntry && !errorEntry ? /* @__PURE__ */ React166.createElement("div", { className: "Layer__ledger-account__entry-details__line-items" }, /* @__PURE__ */ React166.createElement(Card, null, /* @__PURE__ */ React166.createElement(
|
|
14901
14640
|
Table,
|
|
14902
14641
|
{
|
|
14903
14642
|
componentName: "ledger-account__entry-details",
|
|
14904
14643
|
borderCollapse: "collapse"
|
|
14905
14644
|
},
|
|
14906
|
-
/* @__PURE__ */
|
|
14907
|
-
/* @__PURE__ */
|
|
14645
|
+
/* @__PURE__ */ React166.createElement(TableHead, null, /* @__PURE__ */ React166.createElement(TableRow, { rowKey: "soc-flow-head-row", isHeadRow: true }, /* @__PURE__ */ React166.createElement(TableCell, null, "Line items"), [...Array(3)].map((_, index) => /* @__PURE__ */ React166.createElement(TableCell, { key: `ledger-empty-cell-${index}` })), /* @__PURE__ */ React166.createElement(TableCell, null, "Debit"), /* @__PURE__ */ React166.createElement(TableCell, null, "Credit"))),
|
|
14646
|
+
/* @__PURE__ */ React166.createElement(TableBody, null, entry?.line_items?.map((item, index) => /* @__PURE__ */ React166.createElement(
|
|
14908
14647
|
TableRow,
|
|
14909
14648
|
{
|
|
14910
14649
|
key: `ledger-line-item-${index}`,
|
|
14911
14650
|
rowKey: `ledger-line-item-${index}`
|
|
14912
14651
|
},
|
|
14913
|
-
/* @__PURE__ */
|
|
14914
|
-
[...Array(3)].map((_, index2) => /* @__PURE__ */
|
|
14915
|
-
/* @__PURE__ */
|
|
14916
|
-
/* @__PURE__ */
|
|
14917
|
-
)), /* @__PURE__ */
|
|
14652
|
+
/* @__PURE__ */ React166.createElement(TableCell, null, item.account_identifier?.name || ""),
|
|
14653
|
+
[...Array(3)].map((_, index2) => /* @__PURE__ */ React166.createElement(TableCell, { key: `ledger-empty-cell-${index2}` })),
|
|
14654
|
+
/* @__PURE__ */ React166.createElement(TableCell, null, item.direction === "DEBIT" /* DEBIT */ && /* @__PURE__ */ React166.createElement(Badge, { variant: "warning" /* WARNING */ }, "$", centsToDollars(item.amount || 0))),
|
|
14655
|
+
/* @__PURE__ */ React166.createElement(TableCell, null, item.direction === "CREDIT" /* CREDIT */ && /* @__PURE__ */ React166.createElement(Badge, { variant: "success" /* SUCCESS */ }, "$", centsToDollars(item.amount || 0)))
|
|
14656
|
+
)), /* @__PURE__ */ React166.createElement(
|
|
14918
14657
|
TableRow,
|
|
14919
14658
|
{
|
|
14920
14659
|
rowKey: "ledger-line-item-summation",
|
|
14921
14660
|
variant: "summation"
|
|
14922
14661
|
},
|
|
14923
|
-
/* @__PURE__ */
|
|
14924
|
-
[...Array(3)].map((_, index) => /* @__PURE__ */
|
|
14925
|
-
/* @__PURE__ */
|
|
14926
|
-
/* @__PURE__ */
|
|
14662
|
+
/* @__PURE__ */ React166.createElement(TableCell, { primary: true }, "Total"),
|
|
14663
|
+
[...Array(3)].map((_, index) => /* @__PURE__ */ React166.createElement(TableCell, { key: `ledger-empty-cell-${index}` })),
|
|
14664
|
+
/* @__PURE__ */ React166.createElement(TableCell, { isCurrency: true, primary: true }, entry?.line_items.filter((item) => item.direction === "DEBIT").map((item) => item.amount).reduce((a, b) => a + b, 0) || 0),
|
|
14665
|
+
/* @__PURE__ */ React166.createElement(TableCell, { isCurrency: true, primary: true }, entry?.line_items.filter((item) => item.direction === "CREDIT").map((item) => item.amount).reduce((a, b) => a + b, 0) || 0)
|
|
14927
14666
|
))
|
|
14928
14667
|
))) : null);
|
|
14929
14668
|
};
|
|
14930
14669
|
|
|
14931
14670
|
// src/components/JournalForm/JournalForm.tsx
|
|
14932
|
-
import
|
|
14671
|
+
import React168, { useContext as useContext31 } from "react";
|
|
14933
14672
|
|
|
14934
14673
|
// src/components/JournalForm/JournalFormEntryLines.tsx
|
|
14935
|
-
import
|
|
14674
|
+
import React167, { useContext as useContext30 } from "react";
|
|
14936
14675
|
var JournalFormEntryLines = ({
|
|
14937
14676
|
entrylineItems,
|
|
14938
14677
|
addEntryLine,
|
|
@@ -14941,17 +14680,17 @@ var JournalFormEntryLines = ({
|
|
|
14941
14680
|
sendingForm,
|
|
14942
14681
|
config
|
|
14943
14682
|
}) => {
|
|
14944
|
-
const { data: accountsData } =
|
|
14945
|
-
const { form } =
|
|
14683
|
+
const { data: accountsData } = useContext30(ChartOfAccountsContext);
|
|
14684
|
+
const { form } = useContext30(JournalContext);
|
|
14946
14685
|
const parentOptions = useParentOptions(accountsData);
|
|
14947
|
-
return /* @__PURE__ */
|
|
14948
|
-
return /* @__PURE__ */
|
|
14686
|
+
return /* @__PURE__ */ React167.createElement(React167.Fragment, null, Object.keys(Direction).map((direction, idx) => {
|
|
14687
|
+
return /* @__PURE__ */ React167.createElement(
|
|
14949
14688
|
"div",
|
|
14950
14689
|
{
|
|
14951
14690
|
key: "Layer__journal__form__input-group-" + idx,
|
|
14952
14691
|
className: "Layer__journal__form__input-group Layer__journal__form__input-group__border"
|
|
14953
14692
|
},
|
|
14954
|
-
/* @__PURE__ */
|
|
14693
|
+
/* @__PURE__ */ React167.createElement(
|
|
14955
14694
|
Text,
|
|
14956
14695
|
{
|
|
14957
14696
|
className: "Layer__journal__form__input-group__title",
|
|
@@ -14965,13 +14704,13 @@ var JournalFormEntryLines = ({
|
|
|
14965
14704
|
if (item.direction !== direction) {
|
|
14966
14705
|
return null;
|
|
14967
14706
|
}
|
|
14968
|
-
return /* @__PURE__ */
|
|
14707
|
+
return /* @__PURE__ */ React167.createElement(
|
|
14969
14708
|
"div",
|
|
14970
14709
|
{
|
|
14971
14710
|
className: "Layer__journal__form__input-group__line-item",
|
|
14972
14711
|
key: direction + "-" + idx2
|
|
14973
14712
|
},
|
|
14974
|
-
/* @__PURE__ */
|
|
14713
|
+
/* @__PURE__ */ React167.createElement(InputGroup, { name: direction, label: "Amount", inline: true }, /* @__PURE__ */ React167.createElement(
|
|
14975
14714
|
InputWithBadge,
|
|
14976
14715
|
{
|
|
14977
14716
|
name: direction,
|
|
@@ -14997,14 +14736,14 @@ var JournalFormEntryLines = ({
|
|
|
14997
14736
|
)?.message
|
|
14998
14737
|
}
|
|
14999
14738
|
)),
|
|
15000
|
-
/* @__PURE__ */
|
|
14739
|
+
/* @__PURE__ */ React167.createElement(
|
|
15001
14740
|
InputGroup,
|
|
15002
14741
|
{
|
|
15003
14742
|
name: "account-name",
|
|
15004
14743
|
label: "Account name",
|
|
15005
14744
|
inline: true
|
|
15006
14745
|
},
|
|
15007
|
-
/* @__PURE__ */
|
|
14746
|
+
/* @__PURE__ */ React167.createElement(
|
|
15008
14747
|
Select2,
|
|
15009
14748
|
{
|
|
15010
14749
|
options: parentOptions,
|
|
@@ -15028,18 +14767,18 @@ var JournalFormEntryLines = ({
|
|
|
15028
14767
|
)?.message
|
|
15029
14768
|
}
|
|
15030
14769
|
),
|
|
15031
|
-
idx2 >= 2 && /* @__PURE__ */
|
|
14770
|
+
idx2 >= 2 && /* @__PURE__ */ React167.createElement(
|
|
15032
14771
|
IconButton,
|
|
15033
14772
|
{
|
|
15034
14773
|
className: "Layer__remove__button",
|
|
15035
14774
|
onClick: () => removeEntryLine(idx2),
|
|
15036
|
-
icon: /* @__PURE__ */
|
|
14775
|
+
icon: /* @__PURE__ */ React167.createElement(Trash_default, null)
|
|
15037
14776
|
}
|
|
15038
14777
|
)
|
|
15039
14778
|
)
|
|
15040
14779
|
);
|
|
15041
14780
|
}),
|
|
15042
|
-
(config.form.addEntryLinesLimit === void 0 || config.form.addEntryLinesLimit > entrylineItems?.length) && /* @__PURE__ */
|
|
14781
|
+
(config.form.addEntryLinesLimit === void 0 || config.form.addEntryLinesLimit > entrylineItems?.length) && /* @__PURE__ */ React167.createElement(
|
|
15043
14782
|
TextButton,
|
|
15044
14783
|
{
|
|
15045
14784
|
className: "Layer__journal__add-entry-line",
|
|
@@ -15062,8 +14801,8 @@ var JournalForm = ({ config, stringOverrides }) => {
|
|
|
15062
14801
|
changeFormData,
|
|
15063
14802
|
addEntryLine,
|
|
15064
14803
|
removeEntryLine
|
|
15065
|
-
} =
|
|
15066
|
-
return /* @__PURE__ */
|
|
14804
|
+
} = useContext31(JournalContext);
|
|
14805
|
+
return /* @__PURE__ */ React168.createElement(
|
|
15067
14806
|
"form",
|
|
15068
14807
|
{
|
|
15069
14808
|
className: "Layer__form",
|
|
@@ -15072,7 +14811,7 @@ var JournalForm = ({ config, stringOverrides }) => {
|
|
|
15072
14811
|
submitForm();
|
|
15073
14812
|
}
|
|
15074
14813
|
},
|
|
15075
|
-
/* @__PURE__ */
|
|
14814
|
+
/* @__PURE__ */ React168.createElement("div", { className: "Layer__journal__sidebar__header" }, /* @__PURE__ */ React168.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, stringOverrides?.header && "Add New Entry"), /* @__PURE__ */ React168.createElement("div", { className: "actions" }, /* @__PURE__ */ React168.createElement(
|
|
15076
14815
|
Button,
|
|
15077
14816
|
{
|
|
15078
14817
|
type: "button",
|
|
@@ -15081,7 +14820,7 @@ var JournalForm = ({ config, stringOverrides }) => {
|
|
|
15081
14820
|
disabled: sendingForm
|
|
15082
14821
|
},
|
|
15083
14822
|
stringOverrides?.cancelButton || "Cancel"
|
|
15084
|
-
), apiError && /* @__PURE__ */
|
|
14823
|
+
), apiError && /* @__PURE__ */ React168.createElement(
|
|
15085
14824
|
RetryButton,
|
|
15086
14825
|
{
|
|
15087
14826
|
type: "submit",
|
|
@@ -15090,7 +14829,7 @@ var JournalForm = ({ config, stringOverrides }) => {
|
|
|
15090
14829
|
disabled: sendingForm
|
|
15091
14830
|
},
|
|
15092
14831
|
stringOverrides?.retryButton || "Retry"
|
|
15093
|
-
), !apiError && /* @__PURE__ */
|
|
14832
|
+
), !apiError && /* @__PURE__ */ React168.createElement(
|
|
15094
14833
|
SubmitButton,
|
|
15095
14834
|
{
|
|
15096
14835
|
type: "submit",
|
|
@@ -15100,7 +14839,7 @@ var JournalForm = ({ config, stringOverrides }) => {
|
|
|
15100
14839
|
},
|
|
15101
14840
|
stringOverrides?.saveButton || "Save"
|
|
15102
14841
|
))),
|
|
15103
|
-
apiError && /* @__PURE__ */
|
|
14842
|
+
apiError && /* @__PURE__ */ React168.createElement(
|
|
15104
14843
|
Text,
|
|
15105
14844
|
{
|
|
15106
14845
|
size: "sm" /* sm */,
|
|
@@ -15108,7 +14847,7 @@ var JournalForm = ({ config, stringOverrides }) => {
|
|
|
15108
14847
|
},
|
|
15109
14848
|
apiError
|
|
15110
14849
|
),
|
|
15111
|
-
/* @__PURE__ */
|
|
14850
|
+
/* @__PURE__ */ React168.createElement("div", { className: "Layer__journal__form__input-group" }, /* @__PURE__ */ React168.createElement(InputGroup, { name: "date", label: "Date", inline: true }, /* @__PURE__ */ React168.createElement("div", { className: "Layer__journal__datepicker__wrapper" }, /* @__PURE__ */ React168.createElement(
|
|
15112
14851
|
DatePicker,
|
|
15113
14852
|
{
|
|
15114
14853
|
selected: form?.data.entry_at ? new Date(form?.data.entry_at) : /* @__PURE__ */ new Date(),
|
|
@@ -15121,7 +14860,7 @@ var JournalForm = ({ config, stringOverrides }) => {
|
|
|
15121
14860
|
placeholderText: "Select date",
|
|
15122
14861
|
currentDateOption: false
|
|
15123
14862
|
}
|
|
15124
|
-
), /* @__PURE__ */
|
|
14863
|
+
), /* @__PURE__ */ React168.createElement(
|
|
15125
14864
|
DatePicker,
|
|
15126
14865
|
{
|
|
15127
14866
|
selected: form?.data.entry_at ? new Date(form?.data.entry_at) : /* @__PURE__ */ new Date(),
|
|
@@ -15135,7 +14874,7 @@ var JournalForm = ({ config, stringOverrides }) => {
|
|
|
15135
14874
|
currentDateOption: false
|
|
15136
14875
|
}
|
|
15137
14876
|
)))),
|
|
15138
|
-
/* @__PURE__ */
|
|
14877
|
+
/* @__PURE__ */ React168.createElement(
|
|
15139
14878
|
JournalFormEntryLines,
|
|
15140
14879
|
{
|
|
15141
14880
|
entrylineItems: form?.data.line_items || [],
|
|
@@ -15146,7 +14885,7 @@ var JournalForm = ({ config, stringOverrides }) => {
|
|
|
15146
14885
|
config
|
|
15147
14886
|
}
|
|
15148
14887
|
),
|
|
15149
|
-
/* @__PURE__ */
|
|
14888
|
+
/* @__PURE__ */ React168.createElement("div", { className: "Layer__journal__form__input-group Layer__journal__form__input-group__textarea" }, /* @__PURE__ */ React168.createElement(InputGroup, { name: "memo", label: "Notes" }, /* @__PURE__ */ React168.createElement(
|
|
15150
14889
|
Textarea,
|
|
15151
14890
|
{
|
|
15152
14891
|
name: "memo",
|
|
@@ -15156,7 +14895,7 @@ var JournalForm = ({ config, stringOverrides }) => {
|
|
|
15156
14895
|
disabled: sendingForm
|
|
15157
14896
|
}
|
|
15158
14897
|
))),
|
|
15159
|
-
/* @__PURE__ */
|
|
14898
|
+
/* @__PURE__ */ React168.createElement("div", { className: "Layer__journal__bottom-actions" }, /* @__PURE__ */ React168.createElement(
|
|
15160
14899
|
Button,
|
|
15161
14900
|
{
|
|
15162
14901
|
type: "button",
|
|
@@ -15165,7 +14904,7 @@ var JournalForm = ({ config, stringOverrides }) => {
|
|
|
15165
14904
|
disabled: sendingForm
|
|
15166
14905
|
},
|
|
15167
14906
|
stringOverrides?.cancelButton || "Cancel"
|
|
15168
|
-
), apiError && /* @__PURE__ */
|
|
14907
|
+
), apiError && /* @__PURE__ */ React168.createElement(
|
|
15169
14908
|
RetryButton,
|
|
15170
14909
|
{
|
|
15171
14910
|
type: "submit",
|
|
@@ -15174,7 +14913,7 @@ var JournalForm = ({ config, stringOverrides }) => {
|
|
|
15174
14913
|
disabled: sendingForm
|
|
15175
14914
|
},
|
|
15176
14915
|
stringOverrides?.retryButton || "Retry"
|
|
15177
|
-
), !apiError && /* @__PURE__ */
|
|
14916
|
+
), !apiError && /* @__PURE__ */ React168.createElement(
|
|
15178
14917
|
SubmitButton,
|
|
15179
14918
|
{
|
|
15180
14919
|
type: "submit",
|
|
@@ -15193,23 +14932,127 @@ var JournalSidebar = ({
|
|
|
15193
14932
|
config,
|
|
15194
14933
|
stringOverrides
|
|
15195
14934
|
}) => {
|
|
15196
|
-
const { selectedEntryId } =
|
|
14935
|
+
const { selectedEntryId } = useContext32(JournalContext);
|
|
15197
14936
|
if (selectedEntryId !== "new") {
|
|
15198
|
-
return /* @__PURE__ */
|
|
14937
|
+
return /* @__PURE__ */ React169.createElement(JournalEntryDetails, null);
|
|
15199
14938
|
}
|
|
15200
|
-
return /* @__PURE__ */
|
|
14939
|
+
return /* @__PURE__ */ React169.createElement(JournalForm, { config, stringOverrides });
|
|
15201
14940
|
};
|
|
15202
14941
|
|
|
15203
14942
|
// src/components/JournalTable/JournalTable.tsx
|
|
15204
|
-
|
|
14943
|
+
import React170, { useContext as useContext33, useEffect as useEffect43 } from "react";
|
|
14944
|
+
import { parseISO as parseISO14, format as formatTime11 } from "date-fns";
|
|
14945
|
+
var rowId = (row) => {
|
|
14946
|
+
if ("id" in row) {
|
|
14947
|
+
return row.id;
|
|
14948
|
+
}
|
|
14949
|
+
if ("account_identifier" in row) {
|
|
14950
|
+
return `${row.account_identifier.id}-${Math.random()}`;
|
|
14951
|
+
}
|
|
14952
|
+
return `${Math.random()}`;
|
|
14953
|
+
};
|
|
14954
|
+
var accountName = (row) => {
|
|
14955
|
+
if ("account" in row) {
|
|
14956
|
+
return row.account.name;
|
|
14957
|
+
}
|
|
14958
|
+
if ("account_identifier" in row) {
|
|
14959
|
+
return row.account_identifier.name;
|
|
14960
|
+
}
|
|
14961
|
+
return "";
|
|
14962
|
+
};
|
|
15205
14963
|
var JournalTable = ({
|
|
15206
14964
|
view,
|
|
14965
|
+
data,
|
|
14966
|
+
stringOverrides
|
|
14967
|
+
}) => /* @__PURE__ */ React170.createElement(TableProvider, null, /* @__PURE__ */ React170.createElement(
|
|
14968
|
+
JournalTableContent,
|
|
14969
|
+
{
|
|
14970
|
+
view,
|
|
14971
|
+
data,
|
|
14972
|
+
stringOverrides
|
|
14973
|
+
}
|
|
14974
|
+
));
|
|
14975
|
+
var JournalTableContent = ({
|
|
14976
|
+
view,
|
|
14977
|
+
data,
|
|
14978
|
+
stringOverrides
|
|
14979
|
+
}) => {
|
|
14980
|
+
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = useContext33(JournalContext);
|
|
14981
|
+
const { isOpen, setIsOpen } = useTableExpandRow();
|
|
14982
|
+
useEffect43(() => {
|
|
14983
|
+
setIsOpen([`journal-row- + ${data[0].id}`]);
|
|
14984
|
+
}, []);
|
|
14985
|
+
const renderJournalRow = (row, index, rowKey, depth) => {
|
|
14986
|
+
const expandable = !!row.line_items && row.line_items.length > 0;
|
|
14987
|
+
const expanded = expandable ? isOpen(rowKey) : true;
|
|
14988
|
+
return /* @__PURE__ */ React170.createElement(React170.Fragment, { key: rowKey + "-" + index }, /* @__PURE__ */ React170.createElement(
|
|
14989
|
+
TableRow,
|
|
14990
|
+
{
|
|
14991
|
+
rowKey: rowKey + "-" + index,
|
|
14992
|
+
expandable,
|
|
14993
|
+
isExpanded: expanded,
|
|
14994
|
+
handleExpand: () => setIsOpen(rowKey),
|
|
14995
|
+
selected: selectedEntryId === row.id,
|
|
14996
|
+
onClick: (e) => {
|
|
14997
|
+
e.stopPropagation();
|
|
14998
|
+
if (selectedEntryId === row.id) {
|
|
14999
|
+
closeSelectedEntry();
|
|
15000
|
+
} else {
|
|
15001
|
+
setSelectedEntryId(row.id);
|
|
15002
|
+
}
|
|
15003
|
+
},
|
|
15004
|
+
depth
|
|
15005
|
+
},
|
|
15006
|
+
/* @__PURE__ */ React170.createElement(
|
|
15007
|
+
TableCell,
|
|
15008
|
+
{
|
|
15009
|
+
withExpandIcon: expandable,
|
|
15010
|
+
onClick: (e) => {
|
|
15011
|
+
e.stopPropagation();
|
|
15012
|
+
expandable && setIsOpen(rowKey);
|
|
15013
|
+
}
|
|
15014
|
+
},
|
|
15015
|
+
rowId(row).substring(0, 5)
|
|
15016
|
+
),
|
|
15017
|
+
/* @__PURE__ */ React170.createElement(TableCell, null, row.date && formatTime11(parseISO14(row.date), DATE_FORMAT)),
|
|
15018
|
+
/* @__PURE__ */ React170.createElement(TableCell, null, humanizeEnum(row.entry_type)),
|
|
15019
|
+
/* @__PURE__ */ React170.createElement(TableCell, null, "(", row.line_items.length, ")"),
|
|
15020
|
+
/* @__PURE__ */ React170.createElement(TableCell, { isCurrency: true, primary: true }, "line_items" in row && Math.abs(
|
|
15021
|
+
row.line_items.filter((item) => item.direction === "DEBIT").map((item) => item.amount).reduce((a, b) => a + b, 0)
|
|
15022
|
+
)),
|
|
15023
|
+
/* @__PURE__ */ React170.createElement(TableCell, { isCurrency: true, primary: true }, "line_items" in row && Math.abs(
|
|
15024
|
+
row.line_items.filter((item) => item.direction === "CREDIT").map((item) => item.amount).reduce((a, b) => a + b, 0)
|
|
15025
|
+
))
|
|
15026
|
+
), expandable && expanded && row.line_items.map((subItem, subIdx) => /* @__PURE__ */ React170.createElement(
|
|
15027
|
+
TableRow,
|
|
15028
|
+
{
|
|
15029
|
+
key: rowKey + "-" + index + "-" + subIdx,
|
|
15030
|
+
rowKey: rowKey + "-" + index + "-" + subIdx,
|
|
15031
|
+
depth: depth + 1,
|
|
15032
|
+
selected: selectedEntryId === row.id
|
|
15033
|
+
},
|
|
15034
|
+
/* @__PURE__ */ React170.createElement(TableCell, null),
|
|
15035
|
+
/* @__PURE__ */ React170.createElement(TableCell, null),
|
|
15036
|
+
/* @__PURE__ */ React170.createElement(TableCell, null),
|
|
15037
|
+
/* @__PURE__ */ React170.createElement(TableCell, null, accountName(subItem)),
|
|
15038
|
+
subItem.direction === "DEBIT" && subItem.amount > 0 ? /* @__PURE__ */ React170.createElement(TableCell, { isCurrency: true, primary: true }, subItem.amount) : /* @__PURE__ */ React170.createElement(TableCell, null),
|
|
15039
|
+
subItem.direction === "CREDIT" && subItem.amount > 0 ? /* @__PURE__ */ React170.createElement(TableCell, { isCurrency: true, primary: true }, subItem.amount) : /* @__PURE__ */ React170.createElement(TableCell, null)
|
|
15040
|
+
)));
|
|
15041
|
+
};
|
|
15042
|
+
return /* @__PURE__ */ React170.createElement(Table, { borderCollapse: "collapse" }, /* @__PURE__ */ React170.createElement(TableHead, null, /* @__PURE__ */ React170.createElement(TableRow, { isHeadRow: true, rowKey: "journal-head-row" }, /* @__PURE__ */ React170.createElement(TableCell, { isHeaderCell: true }, stringOverrides?.idColumnHeader || "Id"), /* @__PURE__ */ React170.createElement(TableCell, { isHeaderCell: true }, stringOverrides?.dateColumnHeader || "Date"), /* @__PURE__ */ React170.createElement(TableCell, { isHeaderCell: true }, stringOverrides?.transactionColumnHeader || "Transaction"), /* @__PURE__ */ React170.createElement(TableCell, { isHeaderCell: true }, stringOverrides?.accountColumnHeader || "Account"), /* @__PURE__ */ React170.createElement(TableCell, { isHeaderCell: true }, stringOverrides?.debitColumnHeader || "Debit"), /* @__PURE__ */ React170.createElement(TableCell, { isHeaderCell: true }, stringOverrides?.creditColumnHeader || "Credit"))), /* @__PURE__ */ React170.createElement(TableBody, null, data.map(
|
|
15043
|
+
(entry, idx) => renderJournalRow(entry, idx, `journal-row-${entry.id}`, 0)
|
|
15044
|
+
)));
|
|
15045
|
+
};
|
|
15046
|
+
|
|
15047
|
+
// src/components/JournalTable/JournalTableWithPanel.tsx
|
|
15048
|
+
var COMPONENT_NAME6 = "journal";
|
|
15049
|
+
var JournalTableWithPanel = ({
|
|
15207
15050
|
containerRef,
|
|
15208
15051
|
pageSize = 15,
|
|
15209
15052
|
config,
|
|
15210
15053
|
stringOverrides
|
|
15211
15054
|
}) => {
|
|
15212
|
-
const [currentPage, setCurrentPage] =
|
|
15055
|
+
const [currentPage, setCurrentPage] = useState49(1);
|
|
15213
15056
|
const {
|
|
15214
15057
|
data: rawData,
|
|
15215
15058
|
isLoading,
|
|
@@ -15227,22 +15070,19 @@ var JournalTable = ({
|
|
|
15227
15070
|
return /* @__PURE__ */ React171.createElement(
|
|
15228
15071
|
Panel,
|
|
15229
15072
|
{
|
|
15230
|
-
sidebar: /* @__PURE__ */ React171.createElement(
|
|
15073
|
+
sidebar: /* @__PURE__ */ React171.createElement(
|
|
15074
|
+
JournalSidebar,
|
|
15075
|
+
{
|
|
15076
|
+
parentRef: containerRef,
|
|
15077
|
+
config,
|
|
15078
|
+
stringOverrides: stringOverrides?.journalForm
|
|
15079
|
+
}
|
|
15080
|
+
),
|
|
15231
15081
|
sidebarIsOpen: Boolean(selectedEntryId),
|
|
15232
15082
|
parentRef: containerRef
|
|
15233
15083
|
},
|
|
15234
15084
|
/* @__PURE__ */ React171.createElement(Header, { className: `Layer__${COMPONENT_NAME6}__header` }, /* @__PURE__ */ React171.createElement(Heading, { className: `Layer__${COMPONENT_NAME6}__title` }, stringOverrides?.componentTitle || "Journal"), /* @__PURE__ */ React171.createElement("div", { className: `Layer__${COMPONENT_NAME6}__actions` }, /* @__PURE__ */ React171.createElement(Button, { onClick: () => addEntry(), disabled: isLoading }, stringOverrides?.addEntryButton || "Add Entry"))),
|
|
15235
|
-
|
|
15236
|
-
return /* @__PURE__ */ React171.createElement(
|
|
15237
|
-
JournalRow,
|
|
15238
|
-
{
|
|
15239
|
-
key: "journal-row-" + idx + entry.id,
|
|
15240
|
-
index: idx,
|
|
15241
|
-
view,
|
|
15242
|
-
row: entry
|
|
15243
|
-
}
|
|
15244
|
-
);
|
|
15245
|
-
}))),
|
|
15085
|
+
data && /* @__PURE__ */ React171.createElement(JournalTable, { view: "desktop", data }),
|
|
15246
15086
|
data && /* @__PURE__ */ React171.createElement("div", { className: "Layer__journal__pagination" }, /* @__PURE__ */ React171.createElement(
|
|
15247
15087
|
Pagination,
|
|
15248
15088
|
{
|
|
@@ -15275,14 +15115,14 @@ var JOURNAL_CONFIG = {
|
|
|
15275
15115
|
var Journal = (props) => {
|
|
15276
15116
|
const JournalContextData = useJournal();
|
|
15277
15117
|
const AccountsContextData = useChartOfAccounts();
|
|
15278
|
-
return /* @__PURE__ */ React172.createElement(ChartOfAccountsContext.Provider, { value: AccountsContextData }, /* @__PURE__ */ React172.createElement(JournalContext.Provider, { value: JournalContextData }, /* @__PURE__ */ React172.createElement(
|
|
15118
|
+
return /* @__PURE__ */ React172.createElement(ChartOfAccountsContext.Provider, { value: AccountsContextData }, /* @__PURE__ */ React172.createElement(JournalContext.Provider, { value: JournalContextData }, /* @__PURE__ */ React172.createElement(JournalContent, { ...props })));
|
|
15279
15119
|
};
|
|
15280
15120
|
var JournalContent = ({
|
|
15281
15121
|
asWidget,
|
|
15282
15122
|
config = JOURNAL_CONFIG,
|
|
15283
15123
|
stringOverrides
|
|
15284
15124
|
}) => {
|
|
15285
|
-
const [view, setView] =
|
|
15125
|
+
const [view, setView] = useState50("desktop");
|
|
15286
15126
|
const containerRef = useElementSize((_a, _b, { width }) => {
|
|
15287
15127
|
if (width) {
|
|
15288
15128
|
if (width >= BREAKPOINTS.TABLET && view !== "desktop") {
|
|
@@ -15295,7 +15135,7 @@ var JournalContent = ({
|
|
|
15295
15135
|
}
|
|
15296
15136
|
});
|
|
15297
15137
|
return /* @__PURE__ */ React172.createElement(Container, { name: "journal", ref: containerRef, asWidget }, /* @__PURE__ */ React172.createElement(
|
|
15298
|
-
|
|
15138
|
+
JournalTableWithPanel,
|
|
15299
15139
|
{
|
|
15300
15140
|
view,
|
|
15301
15141
|
containerRef,
|
|
@@ -15311,7 +15151,7 @@ import React179, {
|
|
|
15311
15151
|
useContext as useContext39,
|
|
15312
15152
|
useEffect as useEffect47,
|
|
15313
15153
|
useMemo as useMemo20,
|
|
15314
|
-
useState as
|
|
15154
|
+
useState as useState54
|
|
15315
15155
|
} from "react";
|
|
15316
15156
|
|
|
15317
15157
|
// src/contexts/TasksContext/TasksContext.tsx
|
|
@@ -15328,10 +15168,10 @@ var TasksContext = createContext14({
|
|
|
15328
15168
|
});
|
|
15329
15169
|
|
|
15330
15170
|
// src/hooks/useTasks/useTasks.tsx
|
|
15331
|
-
import { useEffect as useEffect44, useState as
|
|
15171
|
+
import { useEffect as useEffect44, useState as useState51 } from "react";
|
|
15332
15172
|
import useSWR10 from "swr";
|
|
15333
15173
|
var useTasks = () => {
|
|
15334
|
-
const [loadedStatus, setLoadedStatus] =
|
|
15174
|
+
const [loadedStatus, setLoadedStatus] = useState51("initial");
|
|
15335
15175
|
const { auth, businessId, apiUrl, read, syncTimestamps, hasBeenTouched } = useLayerContext();
|
|
15336
15176
|
const queryKey = businessId && auth?.access_token && `tasks-${businessId}`;
|
|
15337
15177
|
const { data, isLoading, isValidating, error, mutate } = useSWR10(
|
|
@@ -15521,7 +15361,7 @@ var TasksHeader = ({
|
|
|
15521
15361
|
};
|
|
15522
15362
|
|
|
15523
15363
|
// src/components/TasksList/TasksList.tsx
|
|
15524
|
-
import React177, { useContext as useContext37, useMemo as useMemo19, useState as
|
|
15364
|
+
import React177, { useContext as useContext37, useMemo as useMemo19, useState as useState53 } from "react";
|
|
15525
15365
|
|
|
15526
15366
|
// src/icons/SmileIcon.tsx
|
|
15527
15367
|
import * as React175 from "react";
|
|
@@ -15575,26 +15415,26 @@ var SmileIcon = ({ size = 12, ...props }) => /* @__PURE__ */ React175.createElem
|
|
|
15575
15415
|
var SmileIcon_default = SmileIcon;
|
|
15576
15416
|
|
|
15577
15417
|
// src/components/TasksListItem/TasksListItem.tsx
|
|
15578
|
-
import React176, { useContext as useContext36, useEffect as useEffect45, useState as
|
|
15579
|
-
import
|
|
15418
|
+
import React176, { useContext as useContext36, useEffect as useEffect45, useState as useState52 } from "react";
|
|
15419
|
+
import classNames58 from "classnames";
|
|
15580
15420
|
var TasksListItem = ({
|
|
15581
15421
|
task,
|
|
15582
15422
|
goToNextPageIfAllComplete,
|
|
15583
15423
|
defaultOpen
|
|
15584
15424
|
}) => {
|
|
15585
|
-
const [isOpen, setIsOpen] =
|
|
15586
|
-
const [userResponse, setUserResponse] =
|
|
15425
|
+
const [isOpen, setIsOpen] = useState52(defaultOpen);
|
|
15426
|
+
const [userResponse, setUserResponse] = useState52(task.user_response || "");
|
|
15587
15427
|
const { submitResponseToTask: submitResponseToTask2 } = useContext36(TasksContext);
|
|
15588
|
-
const taskBodyClassName =
|
|
15428
|
+
const taskBodyClassName = classNames58(
|
|
15589
15429
|
"Layer__tasks-list-item__body",
|
|
15590
15430
|
isOpen && "Layer__tasks-list-item__body--expanded",
|
|
15591
15431
|
isComplete(task.status) && "Layer__tasks-list-item--completed"
|
|
15592
15432
|
);
|
|
15593
|
-
const taskHeadClassName =
|
|
15433
|
+
const taskHeadClassName = classNames58(
|
|
15594
15434
|
"Layer__tasks-list-item__head-info",
|
|
15595
15435
|
isComplete(task.status) ? "Layer__tasks-list-item--completed" : "Layer__tasks-list-item--pending"
|
|
15596
15436
|
);
|
|
15597
|
-
const taskItemClassName =
|
|
15437
|
+
const taskItemClassName = classNames58(
|
|
15598
15438
|
"Layer__tasks-list-item",
|
|
15599
15439
|
isOpen && "Layer__tasks-list-item__expanded"
|
|
15600
15440
|
);
|
|
@@ -15655,7 +15495,7 @@ var TasksList = ({ pageSize = 10 }) => {
|
|
|
15655
15495
|
tasks || [],
|
|
15656
15496
|
pageSize
|
|
15657
15497
|
).findIndex((page) => page.some((task) => !isComplete(task.status)));
|
|
15658
|
-
const [currentPage, setCurrentPage] =
|
|
15498
|
+
const [currentPage, setCurrentPage] = useState53(
|
|
15659
15499
|
firstPageWithIincompleteTasks === -1 ? 1 : firstPageWithIincompleteTasks + 1
|
|
15660
15500
|
);
|
|
15661
15501
|
const sortedTasks = useMemo19(() => {
|
|
@@ -15693,7 +15533,7 @@ var TasksList = ({ pageSize = 10 }) => {
|
|
|
15693
15533
|
|
|
15694
15534
|
// src/components/TasksPending/TasksPending.tsx
|
|
15695
15535
|
import React178, { useContext as useContext38 } from "react";
|
|
15696
|
-
import
|
|
15536
|
+
import classNames59 from "classnames";
|
|
15697
15537
|
import { format as format7 } from "date-fns";
|
|
15698
15538
|
import { Cell as Cell4, Pie as Pie3, PieChart as PieChart4 } from "recharts";
|
|
15699
15539
|
var TasksPending = () => {
|
|
@@ -15709,7 +15549,7 @@ var TasksPending = () => {
|
|
|
15709
15549
|
value: data?.filter((task) => !isComplete(task.status)).length
|
|
15710
15550
|
}
|
|
15711
15551
|
];
|
|
15712
|
-
const taskStatusClassName =
|
|
15552
|
+
const taskStatusClassName = classNames59(
|
|
15713
15553
|
completedTasks && completedTasks > 0 ? "Layer__tasks-pending-bar__status--done" : "Layer__tasks-pending-bar__status--pending"
|
|
15714
15554
|
);
|
|
15715
15555
|
return /* @__PURE__ */ React178.createElement("div", { className: "Layer__tasks-pending" }, /* @__PURE__ */ React178.createElement(Text, { size: "lg" /* lg */ }, format7(Date.now(), "MMMM")), /* @__PURE__ */ React178.createElement("div", { className: "Layer__tasks-pending-bar" }, /* @__PURE__ */ React178.createElement(Text, { size: "sm" /* sm */ }, /* @__PURE__ */ React178.createElement("span", { className: taskStatusClassName }, completedTasks), "/", data?.length, " done"), /* @__PURE__ */ React178.createElement(PieChart4, { width: 24, height: 24, className: "mini-chart" }, /* @__PURE__ */ React178.createElement(
|
|
@@ -15743,7 +15583,7 @@ var TasksPending = () => {
|
|
|
15743
15583
|
};
|
|
15744
15584
|
|
|
15745
15585
|
// src/components/Tasks/Tasks.tsx
|
|
15746
|
-
import
|
|
15586
|
+
import classNames60 from "classnames";
|
|
15747
15587
|
var UseTasksContext = createContext15({
|
|
15748
15588
|
data: void 0,
|
|
15749
15589
|
isLoading: void 0,
|
|
@@ -15796,7 +15636,7 @@ var TasksComponent = ({
|
|
|
15796
15636
|
}
|
|
15797
15637
|
return false;
|
|
15798
15638
|
}, [data, isLoading]);
|
|
15799
|
-
const [open, setOpen] =
|
|
15639
|
+
const [open, setOpen] = useState54(
|
|
15800
15640
|
defaultCollapsed || collapsedWhenComplete ? false : true
|
|
15801
15641
|
);
|
|
15802
15642
|
useEffect47(() => {
|
|
@@ -15815,7 +15655,7 @@ var TasksComponent = ({
|
|
|
15815
15655
|
), /* @__PURE__ */ React179.createElement(
|
|
15816
15656
|
"div",
|
|
15817
15657
|
{
|
|
15818
|
-
className:
|
|
15658
|
+
className: classNames60(
|
|
15819
15659
|
"Layer__tasks__content",
|
|
15820
15660
|
!open && "Layer__tasks__content--collapsed"
|
|
15821
15661
|
)
|
|
@@ -15908,14 +15748,14 @@ var BookkeepingUpsellBar = ({
|
|
|
15908
15748
|
};
|
|
15909
15749
|
|
|
15910
15750
|
// src/views/BookkeepingOverview/BookkeepingOverview.tsx
|
|
15911
|
-
import React182, { useState as
|
|
15912
|
-
import
|
|
15751
|
+
import React182, { useState as useState55 } from "react";
|
|
15752
|
+
import classNames61 from "classnames";
|
|
15913
15753
|
var BookkeepingOverview = ({
|
|
15914
15754
|
title,
|
|
15915
15755
|
// deprecated
|
|
15916
15756
|
stringOverrides
|
|
15917
15757
|
}) => {
|
|
15918
|
-
const [pnlToggle, setPnlToggle] =
|
|
15758
|
+
const [pnlToggle, setPnlToggle] = useState55("expenses");
|
|
15919
15759
|
const [width] = useWindowSize();
|
|
15920
15760
|
return /* @__PURE__ */ React182.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ React182.createElement(TasksProvider, null, /* @__PURE__ */ React182.createElement(
|
|
15921
15761
|
View,
|
|
@@ -15975,7 +15815,7 @@ var BookkeepingOverview = ({
|
|
|
15975
15815
|
), /* @__PURE__ */ React182.createElement(
|
|
15976
15816
|
Container,
|
|
15977
15817
|
{
|
|
15978
|
-
name:
|
|
15818
|
+
name: classNames61(
|
|
15979
15819
|
"bookkeeping-overview-profit-and-loss-chart",
|
|
15980
15820
|
pnlToggle !== "revenue" && "bookkeeping-overview-profit-and-loss-chart--hidden"
|
|
15981
15821
|
)
|
|
@@ -15991,7 +15831,7 @@ var BookkeepingOverview = ({
|
|
|
15991
15831
|
), /* @__PURE__ */ React182.createElement(
|
|
15992
15832
|
Container,
|
|
15993
15833
|
{
|
|
15994
|
-
name:
|
|
15834
|
+
name: classNames61(
|
|
15995
15835
|
"bookkeeping-overview-profit-and-loss-chart",
|
|
15996
15836
|
pnlToggle !== "expenses" && "bookkeeping-overview-profit-and-loss-chart--hidden"
|
|
15997
15837
|
)
|
|
@@ -16009,10 +15849,10 @@ var BookkeepingOverview = ({
|
|
|
16009
15849
|
};
|
|
16010
15850
|
|
|
16011
15851
|
// src/views/AccountingOverview/AccountingOverview.tsx
|
|
16012
|
-
import React186, { useState as
|
|
15852
|
+
import React186, { useState as useState57 } from "react";
|
|
16013
15853
|
|
|
16014
15854
|
// src/components/TransactionToReviewCard/TransactionToReviewCard.tsx
|
|
16015
|
-
import React185, { useContext as useContext40, useEffect as useEffect48, useState as
|
|
15855
|
+
import React185, { useContext as useContext40, useEffect as useEffect48, useState as useState56 } from "react";
|
|
16016
15856
|
|
|
16017
15857
|
// src/components/BadgeLoader/BadgeLoader.tsx
|
|
16018
15858
|
import React183 from "react";
|
|
@@ -16022,13 +15862,13 @@ var BadgeLoader = ({ children }) => {
|
|
|
16022
15862
|
|
|
16023
15863
|
// src/components/NotificationCard/NotificationCard.tsx
|
|
16024
15864
|
import React184 from "react";
|
|
16025
|
-
import
|
|
15865
|
+
import classNames62 from "classnames";
|
|
16026
15866
|
var NotificationCard = ({
|
|
16027
15867
|
onClick,
|
|
16028
15868
|
children,
|
|
16029
15869
|
className
|
|
16030
15870
|
}) => {
|
|
16031
|
-
return /* @__PURE__ */ React184.createElement("div", { className:
|
|
15871
|
+
return /* @__PURE__ */ React184.createElement("div", { className: classNames62("Layer__notification-card", className) }, /* @__PURE__ */ React184.createElement("div", { className: "Layer__notification-card__main" }, children), /* @__PURE__ */ React184.createElement(
|
|
16032
15872
|
IconButton,
|
|
16033
15873
|
{
|
|
16034
15874
|
icon: /* @__PURE__ */ React184.createElement(ChevronRight_default, null),
|
|
@@ -16046,7 +15886,7 @@ var TransactionToReviewCard = ({
|
|
|
16046
15886
|
}) => {
|
|
16047
15887
|
const { dateRange: contextDateRange } = useContext40(ProfitAndLoss.Context);
|
|
16048
15888
|
const dateRange = usePnlDateRange ? contextDateRange : void 0;
|
|
16049
|
-
const [toReview, setToReview] =
|
|
15889
|
+
const [toReview, setToReview] = useState56(0);
|
|
16050
15890
|
const { data, loaded, error, refetch } = useProfitAndLossLTM({
|
|
16051
15891
|
currentDate: dateRange ? dateRange.startDate : startOfMonth15(/* @__PURE__ */ new Date())
|
|
16052
15892
|
});
|
|
@@ -16107,7 +15947,7 @@ var TransactionToReviewCard = ({
|
|
|
16107
15947
|
};
|
|
16108
15948
|
|
|
16109
15949
|
// src/views/AccountingOverview/AccountingOverview.tsx
|
|
16110
|
-
import
|
|
15950
|
+
import classNames63 from "classnames";
|
|
16111
15951
|
var AccountingOverview = ({
|
|
16112
15952
|
title = "Accounting overview",
|
|
16113
15953
|
enableOnboarding = false,
|
|
@@ -16116,7 +15956,7 @@ var AccountingOverview = ({
|
|
|
16116
15956
|
chartColorsList,
|
|
16117
15957
|
stringOverrides
|
|
16118
15958
|
}) => {
|
|
16119
|
-
const [pnlToggle, setPnlToggle] =
|
|
15959
|
+
const [pnlToggle, setPnlToggle] = useState57("expenses");
|
|
16120
15960
|
return /* @__PURE__ */ React186.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ React186.createElement(View, { title, headerControls: /* @__PURE__ */ React186.createElement(ProfitAndLoss.DatePicker, null) }, enableOnboarding && /* @__PURE__ */ React186.createElement(
|
|
16121
15961
|
Onboarding,
|
|
16122
15962
|
{
|
|
@@ -16167,7 +16007,7 @@ var AccountingOverview = ({
|
|
|
16167
16007
|
), /* @__PURE__ */ React186.createElement(
|
|
16168
16008
|
Container,
|
|
16169
16009
|
{
|
|
16170
|
-
name:
|
|
16010
|
+
name: classNames63(
|
|
16171
16011
|
"accounting-overview-profit-and-loss-chart",
|
|
16172
16012
|
pnlToggle !== "revenue" && "accounting-overview-profit-and-loss-chart--hidden"
|
|
16173
16013
|
)
|
|
@@ -16184,7 +16024,7 @@ var AccountingOverview = ({
|
|
|
16184
16024
|
), /* @__PURE__ */ React186.createElement(
|
|
16185
16025
|
Container,
|
|
16186
16026
|
{
|
|
16187
|
-
name:
|
|
16027
|
+
name: classNames63(
|
|
16188
16028
|
"accounting-overview-profit-and-loss-chart",
|
|
16189
16029
|
pnlToggle !== "expenses" && "accounting-overview-profit-and-loss-chart--hidden"
|
|
16190
16030
|
)
|
|
@@ -16239,13 +16079,13 @@ var BankTransactionsWithLinkedAccounts = ({
|
|
|
16239
16079
|
};
|
|
16240
16080
|
|
|
16241
16081
|
// src/views/GeneralLedger/GeneralLedger.tsx
|
|
16242
|
-
import React188, { useState as
|
|
16082
|
+
import React188, { useState as useState58 } from "react";
|
|
16243
16083
|
var GeneralLedgerView = ({
|
|
16244
16084
|
title,
|
|
16245
16085
|
// deprecated
|
|
16246
16086
|
stringOverrides
|
|
16247
16087
|
}) => {
|
|
16248
|
-
const [activeTab, setActiveTab] =
|
|
16088
|
+
const [activeTab, setActiveTab] = useState58("chartOfAccounts");
|
|
16249
16089
|
return /* @__PURE__ */ React188.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ React188.createElement(View, { title: stringOverrides?.title || title || "General Ledger" }, /* @__PURE__ */ React188.createElement(
|
|
16250
16090
|
Toggle,
|
|
16251
16091
|
{
|
|
@@ -16274,13 +16114,13 @@ var GeneralLedgerView = ({
|
|
|
16274
16114
|
};
|
|
16275
16115
|
|
|
16276
16116
|
// src/views/Reports/Reports.tsx
|
|
16277
|
-
import React189, { useContext as useContext41, useRef as useRef19, useState as
|
|
16117
|
+
import React189, { useContext as useContext41, useRef as useRef19, useState as useState59 } from "react";
|
|
16278
16118
|
var DownloadButton2 = ({
|
|
16279
16119
|
stringOverrides
|
|
16280
16120
|
}) => {
|
|
16281
16121
|
const { dateRange } = useContext41(ProfitAndLoss.Context);
|
|
16282
16122
|
const { auth, businessId, apiUrl } = useLayerContext();
|
|
16283
|
-
const [requestFailed, setRequestFailed] =
|
|
16123
|
+
const [requestFailed, setRequestFailed] = useState59(false);
|
|
16284
16124
|
const handleClick = async () => {
|
|
16285
16125
|
const month = (dateRange.startDate.getMonth() + 1).toString();
|
|
16286
16126
|
const year = dateRange.startDate.getFullYear().toString();
|
|
@@ -16348,7 +16188,7 @@ var Reports = ({
|
|
|
16348
16188
|
comparisonConfig
|
|
16349
16189
|
}) => {
|
|
16350
16190
|
const containerRef = useRef19(null);
|
|
16351
|
-
const [activeTab, setActiveTab] =
|
|
16191
|
+
const [activeTab, setActiveTab] = useState59(enabledReports[0]);
|
|
16352
16192
|
const options = getOptions(enabledReports);
|
|
16353
16193
|
const defaultTitle = enabledReports.length > 1 ? "Reports" : options.find((option) => option.value = enabledReports[0])?.label;
|
|
16354
16194
|
return /* @__PURE__ */ React189.createElement(View, { title: stringOverrides?.title || title || defaultTitle }, enabledReports.length > 1 && /* @__PURE__ */ React189.createElement("div", { className: "Layer__component Layer__header__actions" }, /* @__PURE__ */ React189.createElement(
|