@layerfi/components 0.1.103 → 0.1.104
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/cjs/index.cjs +393 -107
- package/dist/esm/index.mjs +464 -178
- package/dist/index.css +138 -139
- package/dist/index.d.ts +94 -16
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -5602,7 +5602,7 @@ var import_react12 = require("react");
|
|
|
5602
5602
|
var import_react10 = require("react");
|
|
5603
5603
|
|
|
5604
5604
|
// package.json
|
|
5605
|
-
var version = "0.1.
|
|
5605
|
+
var version = "0.1.104";
|
|
5606
5606
|
|
|
5607
5607
|
// src/models/APIError.ts
|
|
5608
5608
|
var APIError = class _APIError extends Error {
|
|
@@ -5787,9 +5787,9 @@ var getBankTransactions = get(
|
|
|
5787
5787
|
businessId,
|
|
5788
5788
|
cursor,
|
|
5789
5789
|
categorized,
|
|
5790
|
-
descriptionFilter,
|
|
5791
5790
|
direction,
|
|
5792
5791
|
limit,
|
|
5792
|
+
query,
|
|
5793
5793
|
startDate,
|
|
5794
5794
|
endDate,
|
|
5795
5795
|
sortBy = "date",
|
|
@@ -5799,8 +5799,8 @@ var getBankTransactions = get(
|
|
|
5799
5799
|
const parameters = toDefinedSearchParameters({
|
|
5800
5800
|
cursor,
|
|
5801
5801
|
categorized,
|
|
5802
|
-
descriptionFilter,
|
|
5803
5802
|
direction,
|
|
5803
|
+
q: query,
|
|
5804
5804
|
startDate,
|
|
5805
5805
|
endDate,
|
|
5806
5806
|
sortBy,
|
|
@@ -5819,8 +5819,8 @@ var matchBankTransaction = put(
|
|
|
5819
5819
|
var getBankTransactionsExcel = get(({
|
|
5820
5820
|
businessId,
|
|
5821
5821
|
categorized,
|
|
5822
|
-
descriptionFilter,
|
|
5823
5822
|
direction,
|
|
5823
|
+
query,
|
|
5824
5824
|
startDate,
|
|
5825
5825
|
endDate,
|
|
5826
5826
|
sortBy = "date",
|
|
@@ -5828,8 +5828,8 @@ var getBankTransactionsExcel = get(({
|
|
|
5828
5828
|
}) => {
|
|
5829
5829
|
const parameters = toDefinedSearchParameters({
|
|
5830
5830
|
categorized,
|
|
5831
|
-
descriptionFilter,
|
|
5832
5831
|
direction,
|
|
5832
|
+
q: query,
|
|
5833
5833
|
startDate,
|
|
5834
5834
|
endDate,
|
|
5835
5835
|
sortBy,
|
|
@@ -8047,8 +8047,8 @@ function keyLoader(previousPageData, {
|
|
|
8047
8047
|
apiUrl,
|
|
8048
8048
|
businessId,
|
|
8049
8049
|
categorized,
|
|
8050
|
-
descriptionFilter,
|
|
8051
8050
|
direction,
|
|
8051
|
+
query,
|
|
8052
8052
|
startDate,
|
|
8053
8053
|
endDate,
|
|
8054
8054
|
tagFilterQueryString
|
|
@@ -8060,8 +8060,8 @@ function keyLoader(previousPageData, {
|
|
|
8060
8060
|
businessId,
|
|
8061
8061
|
categorized,
|
|
8062
8062
|
cursor: previousPageData ? previousPageData.meta.pagination.cursor : void 0,
|
|
8063
|
-
descriptionFilter,
|
|
8064
8063
|
direction,
|
|
8064
|
+
query,
|
|
8065
8065
|
startDate,
|
|
8066
8066
|
endDate,
|
|
8067
8067
|
tagFilterQueryString,
|
|
@@ -8071,8 +8071,8 @@ function keyLoader(previousPageData, {
|
|
|
8071
8071
|
}
|
|
8072
8072
|
function useBankTransactions({
|
|
8073
8073
|
categorized,
|
|
8074
|
-
descriptionFilter,
|
|
8075
8074
|
direction,
|
|
8075
|
+
query,
|
|
8076
8076
|
startDate,
|
|
8077
8077
|
endDate,
|
|
8078
8078
|
tagFilterQueryString
|
|
@@ -8085,8 +8085,8 @@ function useBankTransactions({
|
|
|
8085
8085
|
__spreadProps(__spreadValues({}, data), {
|
|
8086
8086
|
businessId,
|
|
8087
8087
|
categorized,
|
|
8088
|
-
descriptionFilter,
|
|
8089
8088
|
direction,
|
|
8089
|
+
query,
|
|
8090
8090
|
startDate,
|
|
8091
8091
|
endDate,
|
|
8092
8092
|
tagFilterQueryString
|
|
@@ -8099,7 +8099,7 @@ function useBankTransactions({
|
|
|
8099
8099
|
categorized: categorized2,
|
|
8100
8100
|
cursor,
|
|
8101
8101
|
direction: direction2,
|
|
8102
|
-
|
|
8102
|
+
query: query2,
|
|
8103
8103
|
startDate: startDate2,
|
|
8104
8104
|
endDate: endDate2,
|
|
8105
8105
|
tagFilterQueryString: tagFilterQueryString2
|
|
@@ -8112,9 +8112,9 @@ function useBankTransactions({
|
|
|
8112
8112
|
businessId: businessId2,
|
|
8113
8113
|
categorized: categorized2,
|
|
8114
8114
|
cursor,
|
|
8115
|
-
limit: 200,
|
|
8116
|
-
descriptionFilter: descriptionFilter2,
|
|
8117
8115
|
direction: direction2,
|
|
8116
|
+
limit: 200,
|
|
8117
|
+
query: query2,
|
|
8118
8118
|
startDate: startDate2,
|
|
8119
8119
|
endDate: endDate2,
|
|
8120
8120
|
tagFilterQueryString: tagFilterQueryString2
|
|
@@ -8423,8 +8423,8 @@ function bankTransactionFiltersToHookOptions(filters) {
|
|
|
8423
8423
|
var _a, _b, _c;
|
|
8424
8424
|
return {
|
|
8425
8425
|
categorized: (filters == null ? void 0 : filters.categorizationStatus) ? filters.categorizationStatus !== "all" /* all */ ? filters.categorizationStatus === "categorized" /* categorized */ : void 0 : void 0,
|
|
8426
|
-
descriptionFilter: filters == null ? void 0 : filters.descriptionFilter,
|
|
8427
8426
|
direction: ((_a = filters == null ? void 0 : filters.direction) == null ? void 0 : _a.length) === 1 ? filters.direction[0] === "CREDIT" /* CREDIT */ ? "INFLOW" : "OUTFLOW" : void 0,
|
|
8427
|
+
query: filters == null ? void 0 : filters.query,
|
|
8428
8428
|
startDate: (_b = filters == null ? void 0 : filters.dateRange) == null ? void 0 : _b.startDate,
|
|
8429
8429
|
endDate: (_c = filters == null ? void 0 : filters.dateRange) == null ? void 0 : _c.endDate,
|
|
8430
8430
|
tagFilterQueryString: (filters == null ? void 0 : filters.tagFilter) ? tagFilterToQueryString(filters.tagFilter) : void 0
|
|
@@ -11110,6 +11110,9 @@ var formatter = new Intl.NumberFormat("en-US", {
|
|
|
11110
11110
|
maximumFractionDigits: 2
|
|
11111
11111
|
});
|
|
11112
11112
|
var centsToDollars = (cents = NaN) => isNaN(cents) ? "-.--" : formatter.format(cents / 100);
|
|
11113
|
+
function centsToDollarsWithoutCommas(cents = 0) {
|
|
11114
|
+
return centsToDollars(cents).replaceAll(",", "");
|
|
11115
|
+
}
|
|
11113
11116
|
var dollarsToCents = (dollars = "") => Math.round(parseFloat(dollars) * 100);
|
|
11114
11117
|
|
|
11115
11118
|
// src/components/LinkedAccountThumb/LinkedAccountThumb.tsx
|
|
@@ -20377,7 +20380,7 @@ var import_react115 = require("react");
|
|
|
20377
20380
|
var import_classnames57 = __toESM(require("classnames"));
|
|
20378
20381
|
var import_date_fns21 = require("date-fns");
|
|
20379
20382
|
|
|
20380
|
-
// src/components/
|
|
20383
|
+
// src/components/SearchField/SearchField.tsx
|
|
20381
20384
|
var import_react_aria_components17 = require("react-aria-components");
|
|
20382
20385
|
var import_lucide_react8 = require("lucide-react");
|
|
20383
20386
|
|
|
@@ -20397,19 +20400,18 @@ function MinimalSearchField(_a) {
|
|
|
20397
20400
|
] }));
|
|
20398
20401
|
}
|
|
20399
20402
|
|
|
20400
|
-
// src/components/
|
|
20403
|
+
// src/components/SearchField/SearchField.tsx
|
|
20401
20404
|
var import_jsx_runtime160 = require("react/jsx-runtime");
|
|
20402
|
-
var CLASS_NAME9 = "
|
|
20403
|
-
function
|
|
20404
|
-
var _b = _a, { slot } = _b, restProps = __objRest(_b, ["slot"]);
|
|
20405
|
+
var CLASS_NAME9 = "Layer__SearchField Layer__InputGroup";
|
|
20406
|
+
function SearchField(_a) {
|
|
20407
|
+
var _b = _a, { slot = "search", label } = _b, restProps = __objRest(_b, ["slot", "label"]);
|
|
20405
20408
|
return /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)(import_react_aria_components17.Group, { slot, className: CLASS_NAME9, children: [
|
|
20406
20409
|
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)(VStack, { slot: "icon", align: "center", justify: "center", children: /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(import_lucide_react8.Search, { size: 14 }) }),
|
|
20407
20410
|
/* @__PURE__ */ (0, import_jsx_runtime160.jsx)(
|
|
20408
20411
|
MinimalSearchField,
|
|
20409
20412
|
__spreadProps(__spreadValues({}, restProps), {
|
|
20410
|
-
|
|
20411
|
-
|
|
20412
|
-
"aria-label": "Search transactions"
|
|
20413
|
+
placeholder: label,
|
|
20414
|
+
"aria-label": label
|
|
20413
20415
|
})
|
|
20414
20416
|
)
|
|
20415
20417
|
] });
|
|
@@ -20453,7 +20455,7 @@ function useBankTransactionsDownload() {
|
|
|
20453
20455
|
arg: {
|
|
20454
20456
|
categorized,
|
|
20455
20457
|
direction,
|
|
20456
|
-
|
|
20458
|
+
query,
|
|
20457
20459
|
startDate,
|
|
20458
20460
|
endDate,
|
|
20459
20461
|
tagFilterQueryString
|
|
@@ -20466,7 +20468,7 @@ function useBankTransactionsDownload() {
|
|
|
20466
20468
|
params: {
|
|
20467
20469
|
businessId: businessId2,
|
|
20468
20470
|
categorized,
|
|
20469
|
-
|
|
20471
|
+
query,
|
|
20470
20472
|
direction,
|
|
20471
20473
|
startDate,
|
|
20472
20474
|
endDate,
|
|
@@ -21852,19 +21854,20 @@ function TransactionsSearch({ slot }) {
|
|
|
21852
21854
|
const { filters, setFilters } = useBankTransactionsContext();
|
|
21853
21855
|
const [localSearch, setLocalSearch] = (0, import_react115.useState)(() => {
|
|
21854
21856
|
var _a;
|
|
21855
|
-
return (_a = filters == null ? void 0 : filters.
|
|
21857
|
+
return (_a = filters == null ? void 0 : filters.query) != null ? _a : "";
|
|
21856
21858
|
});
|
|
21857
21859
|
const debouncedSetDescription = useDebounce((value) => {
|
|
21858
|
-
setFilters({
|
|
21860
|
+
setFilters({ query: value });
|
|
21859
21861
|
});
|
|
21860
21862
|
const handleSearch = (0, import_react115.useCallback)((value) => {
|
|
21861
21863
|
setLocalSearch(value);
|
|
21862
21864
|
void debouncedSetDescription(value);
|
|
21863
21865
|
}, [debouncedSetDescription]);
|
|
21864
21866
|
return /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
|
|
21865
|
-
|
|
21867
|
+
SearchField,
|
|
21866
21868
|
{
|
|
21867
21869
|
slot,
|
|
21870
|
+
label: "Search transactions",
|
|
21868
21871
|
value: localSearch,
|
|
21869
21872
|
onChange: handleSearch
|
|
21870
21873
|
}
|
|
@@ -22316,7 +22319,7 @@ var BankTransactionsContent = ({
|
|
|
22316
22319
|
hasVisibleTransactions: ((_a = bankTransactions == null ? void 0 : bankTransactions.length) != null ? _a : 0) > 0,
|
|
22317
22320
|
isCategorizationMode: editable,
|
|
22318
22321
|
isError: Boolean(error),
|
|
22319
|
-
isFiltered: Boolean(filters == null ? void 0 : filters.
|
|
22322
|
+
isFiltered: Boolean(filters == null ? void 0 : filters.query),
|
|
22320
22323
|
isLoadingWithoutData
|
|
22321
22324
|
}
|
|
22322
22325
|
) : null,
|
|
@@ -27550,6 +27553,10 @@ var ASSET_LEDGER_ACCOUNT_SUBTYPES = [
|
|
|
27550
27553
|
value: "FIXED_ASSET",
|
|
27551
27554
|
label: "Fixed Assets"
|
|
27552
27555
|
},
|
|
27556
|
+
{
|
|
27557
|
+
value: "ACCUMULATED_DEPRECIATION",
|
|
27558
|
+
label: "Accumulated Depreciation"
|
|
27559
|
+
},
|
|
27553
27560
|
{
|
|
27554
27561
|
value: "CASH",
|
|
27555
27562
|
label: "Cash"
|
|
@@ -27557,13 +27564,33 @@ var ASSET_LEDGER_ACCOUNT_SUBTYPES = [
|
|
|
27557
27564
|
{
|
|
27558
27565
|
value: "UNDEPOSITED_FUNDS",
|
|
27559
27566
|
label: "Undeposited Funds"
|
|
27567
|
+
},
|
|
27568
|
+
{
|
|
27569
|
+
value: "CURRENT_ASSET",
|
|
27570
|
+
label: "Current Assets"
|
|
27571
|
+
},
|
|
27572
|
+
{
|
|
27573
|
+
value: "NON_CURRENT_ASSET",
|
|
27574
|
+
label: "Non-Current Assets"
|
|
27575
|
+
},
|
|
27576
|
+
{
|
|
27577
|
+
value: "PREPAID_EXPENSES",
|
|
27578
|
+
label: "Prepaid Expenses"
|
|
27579
|
+
},
|
|
27580
|
+
{
|
|
27581
|
+
value: "DEVELOPMENT_COSTS",
|
|
27582
|
+
label: "Development Costs"
|
|
27583
|
+
},
|
|
27584
|
+
{
|
|
27585
|
+
value: "LOANS_RECEIVABLE",
|
|
27586
|
+
label: "Loans Receivable"
|
|
27587
|
+
},
|
|
27588
|
+
{
|
|
27589
|
+
value: "INTANGIBLE_ASSET",
|
|
27590
|
+
label: "Intangible Assets"
|
|
27560
27591
|
}
|
|
27561
27592
|
];
|
|
27562
27593
|
var LIABILITY_LEDGER_ACCOUNT_SUBTYPES = [
|
|
27563
|
-
{
|
|
27564
|
-
value: "LIABILITY",
|
|
27565
|
-
label: "Liabilities"
|
|
27566
|
-
},
|
|
27567
27594
|
{
|
|
27568
27595
|
value: "ACCOUNTS_PAYABLE",
|
|
27569
27596
|
label: "Accounts Payable"
|
|
@@ -27573,36 +27600,72 @@ var LIABILITY_LEDGER_ACCOUNT_SUBTYPES = [
|
|
|
27573
27600
|
label: "Credit Cards"
|
|
27574
27601
|
},
|
|
27575
27602
|
{
|
|
27576
|
-
value: "
|
|
27577
|
-
label: "
|
|
27603
|
+
value: "INCOME_TAXES_PAYABLE",
|
|
27604
|
+
label: "Income Taxes Payable"
|
|
27605
|
+
},
|
|
27606
|
+
{
|
|
27607
|
+
value: "SALES_TAXES_PAYABLE",
|
|
27608
|
+
label: "Sales Taxes Payable"
|
|
27609
|
+
},
|
|
27610
|
+
{
|
|
27611
|
+
value: "OTHER_TAXES_PAYABLE",
|
|
27612
|
+
label: "Other Taxes Payable"
|
|
27613
|
+
},
|
|
27614
|
+
{
|
|
27615
|
+
value: "PAYROLL_TAXES_PAYABLE",
|
|
27616
|
+
label: "Payroll Taxes Payable"
|
|
27617
|
+
},
|
|
27618
|
+
{
|
|
27619
|
+
value: "UNEARNED_REVENUE",
|
|
27620
|
+
label: "Unearned Revenue"
|
|
27578
27621
|
},
|
|
27579
27622
|
{
|
|
27580
27623
|
value: "PAYROLL_LIABILITY",
|
|
27581
27624
|
label: "Payroll Liabilities"
|
|
27582
27625
|
},
|
|
27583
27626
|
{
|
|
27584
|
-
value: "
|
|
27585
|
-
label: "
|
|
27627
|
+
value: "PAYROLL_CLEARING",
|
|
27628
|
+
label: "Payroll Clearing"
|
|
27586
27629
|
},
|
|
27587
27630
|
{
|
|
27588
27631
|
value: "LINE_OF_CREDIT",
|
|
27589
27632
|
label: "Lines of Credit"
|
|
27590
27633
|
},
|
|
27591
|
-
{
|
|
27592
|
-
value: "NOTES_PAYABLE",
|
|
27593
|
-
label: "Notes Payable"
|
|
27594
|
-
},
|
|
27595
27634
|
{
|
|
27596
27635
|
value: "TIPS",
|
|
27597
27636
|
label: "Tips"
|
|
27598
27637
|
},
|
|
27599
27638
|
{
|
|
27600
|
-
value: "
|
|
27601
|
-
label: "
|
|
27639
|
+
value: "REFUND_LIABILITIES",
|
|
27640
|
+
label: "Refund Liabilities"
|
|
27602
27641
|
},
|
|
27603
27642
|
{
|
|
27604
27643
|
value: "UNDEPOSITED_OUTFLOWS",
|
|
27605
27644
|
label: "Undeposited Outflows"
|
|
27645
|
+
},
|
|
27646
|
+
{
|
|
27647
|
+
value: "OUTGOING_PAYMENT_CLEARING_ACCOUNT",
|
|
27648
|
+
label: "Outgoing Payment Clearing Accounts"
|
|
27649
|
+
},
|
|
27650
|
+
{
|
|
27651
|
+
value: "OTHER_CURRENT_LIABILITY",
|
|
27652
|
+
label: "Current Liabilities"
|
|
27653
|
+
},
|
|
27654
|
+
{
|
|
27655
|
+
value: "LOANS_PAYABLE",
|
|
27656
|
+
label: "Loans Payable"
|
|
27657
|
+
},
|
|
27658
|
+
{
|
|
27659
|
+
value: "NOTES_PAYABLE",
|
|
27660
|
+
label: "Notes Payable"
|
|
27661
|
+
},
|
|
27662
|
+
{
|
|
27663
|
+
value: "SHAREHOLDER_LOAN",
|
|
27664
|
+
label: "Shareholder Loans"
|
|
27665
|
+
},
|
|
27666
|
+
{
|
|
27667
|
+
value: "NON_CURRENT_LIABILITY",
|
|
27668
|
+
label: "Long Term Liabilities"
|
|
27606
27669
|
}
|
|
27607
27670
|
];
|
|
27608
27671
|
var EQUITY_LEDGER_ACCOUNT_SUBTYPES = [
|
|
@@ -27618,6 +27681,10 @@ var EQUITY_LEDGER_ACCOUNT_SUBTYPES = [
|
|
|
27618
27681
|
value: "COMMON_STOCK",
|
|
27619
27682
|
label: "Common Stock"
|
|
27620
27683
|
},
|
|
27684
|
+
{
|
|
27685
|
+
value: "PREFERRED_STOCK",
|
|
27686
|
+
label: "Preferred Stock"
|
|
27687
|
+
},
|
|
27621
27688
|
{
|
|
27622
27689
|
value: "ADDITIONAL_PAID_IN_CAPITAL",
|
|
27623
27690
|
label: "Additional Paid In Capital"
|
|
@@ -27633,6 +27700,10 @@ var EQUITY_LEDGER_ACCOUNT_SUBTYPES = [
|
|
|
27633
27700
|
{
|
|
27634
27701
|
value: "OPENING_BALANCE_EQUITY",
|
|
27635
27702
|
label: "Opening Balance Equity"
|
|
27703
|
+
},
|
|
27704
|
+
{
|
|
27705
|
+
value: "OTHER_EQUITY",
|
|
27706
|
+
label: "Other Equity"
|
|
27636
27707
|
}
|
|
27637
27708
|
];
|
|
27638
27709
|
var REVENUE_LEDGER_ACCOUNT_SUBTYPES = [
|
|
@@ -27647,6 +27718,18 @@ var REVENUE_LEDGER_ACCOUNT_SUBTYPES = [
|
|
|
27647
27718
|
{
|
|
27648
27719
|
value: "RETURNS_ALLOWANCES",
|
|
27649
27720
|
label: "Returns & Allowances"
|
|
27721
|
+
},
|
|
27722
|
+
{
|
|
27723
|
+
value: "DIVIDEND_INCOME",
|
|
27724
|
+
label: "Dividend Income"
|
|
27725
|
+
},
|
|
27726
|
+
{
|
|
27727
|
+
value: "INTEREST_INCOME",
|
|
27728
|
+
label: "Interest Income"
|
|
27729
|
+
},
|
|
27730
|
+
{
|
|
27731
|
+
value: "OTHER_INCOME",
|
|
27732
|
+
label: "Other Income"
|
|
27650
27733
|
}
|
|
27651
27734
|
];
|
|
27652
27735
|
var EXPENSE_LEDGER_ACCOUNT_SUBTYPES = [
|
|
@@ -27667,12 +27750,40 @@ var EXPENSE_LEDGER_ACCOUNT_SUBTYPES = [
|
|
|
27667
27750
|
label: "Taxes & Licenses"
|
|
27668
27751
|
},
|
|
27669
27752
|
{
|
|
27670
|
-
value: "
|
|
27671
|
-
label: "
|
|
27753
|
+
value: "UNCATEGORIZED_EXPENSE",
|
|
27754
|
+
label: "Uncategorized Expense"
|
|
27672
27755
|
},
|
|
27673
27756
|
{
|
|
27674
27757
|
value: "CHARITABLE_CONTRIBUTIONS",
|
|
27675
27758
|
label: "Charitable Contributions"
|
|
27759
|
+
},
|
|
27760
|
+
{
|
|
27761
|
+
value: "LOAN_EXPENSES",
|
|
27762
|
+
label: "Loan Expenses"
|
|
27763
|
+
},
|
|
27764
|
+
{
|
|
27765
|
+
value: "FINANCE_COSTS",
|
|
27766
|
+
label: "Finance Costs"
|
|
27767
|
+
},
|
|
27768
|
+
{
|
|
27769
|
+
value: "INTEREST_EXPENSES",
|
|
27770
|
+
label: "Interest Expenses"
|
|
27771
|
+
},
|
|
27772
|
+
{
|
|
27773
|
+
value: "DEPRECIATION",
|
|
27774
|
+
label: "Depreciation"
|
|
27775
|
+
},
|
|
27776
|
+
{
|
|
27777
|
+
value: "AMORTIZATION",
|
|
27778
|
+
label: "Amortization"
|
|
27779
|
+
},
|
|
27780
|
+
{
|
|
27781
|
+
value: "BAD_DEBT",
|
|
27782
|
+
label: "Bad Debt"
|
|
27783
|
+
},
|
|
27784
|
+
{
|
|
27785
|
+
value: "OTHER_EXPENSES",
|
|
27786
|
+
label: "Other Expenses"
|
|
27676
27787
|
}
|
|
27677
27788
|
];
|
|
27678
27789
|
var LEDGER_ACCOUNT_SUBTYPES = [
|
|
@@ -28421,12 +28532,172 @@ var Edit2_default = Edit2;
|
|
|
28421
28532
|
|
|
28422
28533
|
// src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
|
|
28423
28534
|
var import_lucide_react16 = require("lucide-react");
|
|
28535
|
+
|
|
28536
|
+
// src/components/ChartOfAccountsTable/utils/types.ts
|
|
28537
|
+
var LedgerAccountTypeOrderEnum = /* @__PURE__ */ ((LedgerAccountTypeOrderEnum2) => {
|
|
28538
|
+
LedgerAccountTypeOrderEnum2[LedgerAccountTypeOrderEnum2["ASSET"] = 0] = "ASSET";
|
|
28539
|
+
LedgerAccountTypeOrderEnum2[LedgerAccountTypeOrderEnum2["LIABILITY"] = 1] = "LIABILITY";
|
|
28540
|
+
LedgerAccountTypeOrderEnum2[LedgerAccountTypeOrderEnum2["EQUITY"] = 2] = "EQUITY";
|
|
28541
|
+
LedgerAccountTypeOrderEnum2[LedgerAccountTypeOrderEnum2["REVENUE"] = 3] = "REVENUE";
|
|
28542
|
+
LedgerAccountTypeOrderEnum2[LedgerAccountTypeOrderEnum2["EXPENSES"] = 4] = "EXPENSES";
|
|
28543
|
+
return LedgerAccountTypeOrderEnum2;
|
|
28544
|
+
})(LedgerAccountTypeOrderEnum || {});
|
|
28545
|
+
var LedgerAccountSubtypeOrderEnum = /* @__PURE__ */ ((LedgerAccountSubtypeOrderEnum2) => {
|
|
28546
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["BANK_ACCOUNTS"] = 0] = "BANK_ACCOUNTS";
|
|
28547
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["CASH"] = 1] = "CASH";
|
|
28548
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["UNDEPOSITED_FUNDS"] = 2] = "UNDEPOSITED_FUNDS";
|
|
28549
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["PAYMENT_PROCESSOR_CLEARING_ACCOUNT"] = 3] = "PAYMENT_PROCESSOR_CLEARING_ACCOUNT";
|
|
28550
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["INBOUND_PAYMENT_METHOD_CLEARING"] = 4] = "INBOUND_PAYMENT_METHOD_CLEARING";
|
|
28551
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["ACCOUNTS_RECEIVABLE"] = 5] = "ACCOUNTS_RECEIVABLE";
|
|
28552
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["INVENTORY"] = 6] = "INVENTORY";
|
|
28553
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["CURRENT_ASSET"] = 7] = "CURRENT_ASSET";
|
|
28554
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["FIXED_ASSET"] = 8] = "FIXED_ASSET";
|
|
28555
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["INTANGIBLE_ASSET"] = 9] = "INTANGIBLE_ASSET";
|
|
28556
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["PREPAID_EXPENSES"] = 10] = "PREPAID_EXPENSES";
|
|
28557
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["DEVELOPMENT_COSTS"] = 11] = "DEVELOPMENT_COSTS";
|
|
28558
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["CREDIT_CARD"] = 12] = "CREDIT_CARD";
|
|
28559
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["ACCOUNTS_PAYABLE"] = 13] = "ACCOUNTS_PAYABLE";
|
|
28560
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["LINE_OF_CREDIT"] = 14] = "LINE_OF_CREDIT";
|
|
28561
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["REFUND_LIABILITIES"] = 15] = "REFUND_LIABILITIES";
|
|
28562
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["PAYROLL_LIABILITY"] = 16] = "PAYROLL_LIABILITY";
|
|
28563
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["SALES_TAXES_PAYABLE"] = 17] = "SALES_TAXES_PAYABLE";
|
|
28564
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["OTHER_TAXES_PAYABLE"] = 18] = "OTHER_TAXES_PAYABLE";
|
|
28565
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["TIPS"] = 19] = "TIPS";
|
|
28566
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["UNEARNED_REVENUE"] = 20] = "UNEARNED_REVENUE";
|
|
28567
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["UNDEPOSITED_OUTFLOWS"] = 21] = "UNDEPOSITED_OUTFLOWS";
|
|
28568
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["OUTGOING_PAYMENT_CLEARING_ACCOUNT"] = 22] = "OUTGOING_PAYMENT_CLEARING_ACCOUNT";
|
|
28569
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["OTHER_CURRENT_LIABILITY"] = 23] = "OTHER_CURRENT_LIABILITY";
|
|
28570
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["SHAREHOLDER_LOAN"] = 24] = "SHAREHOLDER_LOAN";
|
|
28571
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["NOTES_PAYABLE"] = 25] = "NOTES_PAYABLE";
|
|
28572
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["OTHER_LONG_TERM_LIABILITIES"] = 26] = "OTHER_LONG_TERM_LIABILITIES";
|
|
28573
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["CONTRIBUTIONS"] = 27] = "CONTRIBUTIONS";
|
|
28574
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["DISTRIBUTIONS"] = 28] = "DISTRIBUTIONS";
|
|
28575
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["COMMON_STOCK"] = 29] = "COMMON_STOCK";
|
|
28576
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["ADDITIONAL_PAID_IN_CAPITAL"] = 30] = "ADDITIONAL_PAID_IN_CAPITAL";
|
|
28577
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["RETAINED_EARNINGS"] = 31] = "RETAINED_EARNINGS";
|
|
28578
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["ACCUMULATED_ADJUSTMENTS"] = 32] = "ACCUMULATED_ADJUSTMENTS";
|
|
28579
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["OPENING_BALANCE_EQUITY"] = 33] = "OPENING_BALANCE_EQUITY";
|
|
28580
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["OTHER_EQUITY"] = 34] = "OTHER_EQUITY";
|
|
28581
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["SALES"] = 35] = "SALES";
|
|
28582
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["REVENUE"] = 36] = "REVENUE";
|
|
28583
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["UNCATEGORIZED_REVENUE"] = 37] = "UNCATEGORIZED_REVENUE";
|
|
28584
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["RETURNS_ALLOWANCES"] = 38] = "RETURNS_ALLOWANCES";
|
|
28585
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["OTHER_INCOME"] = 39] = "OTHER_INCOME";
|
|
28586
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["COGS"] = 40] = "COGS";
|
|
28587
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["OPERATING_EXPENSES"] = 41] = "OPERATING_EXPENSES";
|
|
28588
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["PAYROLL"] = 42] = "PAYROLL";
|
|
28589
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["INTEREST_EXPENSES"] = 43] = "INTEREST_EXPENSES";
|
|
28590
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["TAXES_LICENSES"] = 44] = "TAXES_LICENSES";
|
|
28591
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["UNCATEGORIZED_EXPENSE"] = 45] = "UNCATEGORIZED_EXPENSE";
|
|
28592
|
+
return LedgerAccountSubtypeOrderEnum2;
|
|
28593
|
+
})(LedgerAccountSubtypeOrderEnum || {});
|
|
28594
|
+
|
|
28595
|
+
// src/components/ChartOfAccountsTable/utils/utils.ts
|
|
28596
|
+
var compareByEnum = (a, b, enumMap) => {
|
|
28597
|
+
const aVal = a !== void 0 ? enumMap[a] : void 0;
|
|
28598
|
+
const bVal = b !== void 0 ? enumMap[b] : void 0;
|
|
28599
|
+
if (aVal !== void 0 && bVal !== void 0) return aVal - bVal;
|
|
28600
|
+
if (aVal === void 0 && bVal !== void 0) return 1;
|
|
28601
|
+
if (aVal !== void 0 && bVal === void 0) return -1;
|
|
28602
|
+
return 0;
|
|
28603
|
+
};
|
|
28604
|
+
var compareAccounts = (a, b) => {
|
|
28605
|
+
var _a, _b, _c, _d, _e, _f;
|
|
28606
|
+
const typeComparison = compareByEnum(
|
|
28607
|
+
a.account_type.value,
|
|
28608
|
+
b.account_type.value,
|
|
28609
|
+
LedgerAccountTypeOrderEnum
|
|
28610
|
+
);
|
|
28611
|
+
if (typeComparison !== 0) return typeComparison;
|
|
28612
|
+
const subtypeComparison = compareByEnum(
|
|
28613
|
+
(_a = a.account_subtype) == null ? void 0 : _a.value,
|
|
28614
|
+
(_b = b.account_subtype) == null ? void 0 : _b.value,
|
|
28615
|
+
LedgerAccountSubtypeOrderEnum
|
|
28616
|
+
);
|
|
28617
|
+
if (subtypeComparison !== 0) return subtypeComparison;
|
|
28618
|
+
const subtypeNameCompare = ((_d = (_c = a.account_subtype) == null ? void 0 : _c.display_name) != null ? _d : "").localeCompare((_f = (_e = b.account_subtype) == null ? void 0 : _e.display_name) != null ? _f : "");
|
|
28619
|
+
if (subtypeNameCompare !== 0) return subtypeNameCompare;
|
|
28620
|
+
return a.name.localeCompare(b.name);
|
|
28621
|
+
};
|
|
28622
|
+
var sortAccountsRecursive = (accounts) => {
|
|
28623
|
+
return accounts.map((account) => __spreadProps(__spreadValues({}, account), {
|
|
28624
|
+
sub_accounts: account.sub_accounts ? sortAccountsRecursive(account.sub_accounts) : []
|
|
28625
|
+
})).sort(compareAccounts);
|
|
28626
|
+
};
|
|
28627
|
+
var accountMatchesQuery = (account, query) => {
|
|
28628
|
+
var _a;
|
|
28629
|
+
return [
|
|
28630
|
+
account.name,
|
|
28631
|
+
account.account_type.display_name,
|
|
28632
|
+
((_a = account.account_subtype) == null ? void 0 : _a.display_name) || "",
|
|
28633
|
+
centsToDollars(account.balance),
|
|
28634
|
+
centsToDollarsWithoutCommas(account.balance),
|
|
28635
|
+
convertCentsToCurrency(account.balance) || ""
|
|
28636
|
+
].some((field) => field.toLowerCase().includes(query));
|
|
28637
|
+
};
|
|
28638
|
+
var filterAccounts = (accounts, query) => {
|
|
28639
|
+
return accounts.flatMap((account) => {
|
|
28640
|
+
const isMatching = accountMatchesQuery(account, query);
|
|
28641
|
+
const matchingChildren = filterAccounts(account.sub_accounts, query);
|
|
28642
|
+
if (matchingChildren.length > 0) {
|
|
28643
|
+
return [__spreadProps(__spreadValues({}, account), { sub_accounts: matchingChildren, isMatching: true })];
|
|
28644
|
+
}
|
|
28645
|
+
if (isMatching) {
|
|
28646
|
+
return [__spreadProps(__spreadValues({}, account), { isMatching: true })];
|
|
28647
|
+
}
|
|
28648
|
+
return [];
|
|
28649
|
+
});
|
|
28650
|
+
};
|
|
28651
|
+
var skippedChars = ["$", ","];
|
|
28652
|
+
var getMatchedTextIndices = ({
|
|
28653
|
+
text,
|
|
28654
|
+
query,
|
|
28655
|
+
isMatching
|
|
28656
|
+
}) => {
|
|
28657
|
+
if (!query || !isMatching) return null;
|
|
28658
|
+
const normalize = (s) => s.replace(/[$,]/g, "").toLowerCase();
|
|
28659
|
+
const normalizedText = normalize(text);
|
|
28660
|
+
const normalizedQuery = normalize(query);
|
|
28661
|
+
const normalizedMatchStartIdx = normalizedText.indexOf(normalizedQuery);
|
|
28662
|
+
if (normalizedMatchStartIdx === -1) return null;
|
|
28663
|
+
let positionInNormalizedText = 0, matchStartIdx = 0;
|
|
28664
|
+
while (positionInNormalizedText < normalizedMatchStartIdx && matchStartIdx < text.length) {
|
|
28665
|
+
if (!skippedChars.includes(text[matchStartIdx])) positionInNormalizedText++;
|
|
28666
|
+
matchStartIdx++;
|
|
28667
|
+
}
|
|
28668
|
+
if (skippedChars.includes(text[matchStartIdx]) && query[0] !== text[matchStartIdx]) {
|
|
28669
|
+
matchStartIdx++;
|
|
28670
|
+
}
|
|
28671
|
+
let charsMatched = 0, matchEndIdx = matchStartIdx;
|
|
28672
|
+
while (charsMatched < normalizedQuery.length && matchEndIdx < text.length) {
|
|
28673
|
+
if (!skippedChars.includes(text[matchEndIdx])) charsMatched++;
|
|
28674
|
+
matchEndIdx++;
|
|
28675
|
+
}
|
|
28676
|
+
if (skippedChars.includes(text[matchEndIdx]) && query[query.length - 1] === text[matchEndIdx]) {
|
|
28677
|
+
matchEndIdx++;
|
|
28678
|
+
}
|
|
28679
|
+
return { startIdx: matchStartIdx, endIdx: matchEndIdx };
|
|
28680
|
+
};
|
|
28681
|
+
|
|
28682
|
+
// src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
|
|
28424
28683
|
var import_jsx_runtime247 = require("react/jsx-runtime");
|
|
28425
|
-
var
|
|
28684
|
+
var highlightMatch = ({ text, query, isMatching }) => {
|
|
28685
|
+
const matchedTextIndices = getMatchedTextIndices({ text, query, isMatching });
|
|
28686
|
+
if (matchedTextIndices === null) {
|
|
28687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime247.jsx)(Span, { ellipsis: true, children: text });
|
|
28688
|
+
}
|
|
28689
|
+
const { startIdx, endIdx } = matchedTextIndices;
|
|
28690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime247.jsxs)(Span, { ellipsis: true, children: [
|
|
28691
|
+
text.slice(0, startIdx),
|
|
28692
|
+
/* @__PURE__ */ (0, import_jsx_runtime247.jsx)("mark", { className: "Layer__mark", children: text.slice(startIdx, endIdx) }),
|
|
28693
|
+
text.slice(endIdx)
|
|
28694
|
+
] });
|
|
28695
|
+
};
|
|
28426
28696
|
var ChartOfAccountsTable = ({
|
|
28427
28697
|
view,
|
|
28428
28698
|
stringOverrides,
|
|
28429
28699
|
data,
|
|
28700
|
+
searchQuery,
|
|
28430
28701
|
error,
|
|
28431
28702
|
expandAll,
|
|
28432
28703
|
templateAccountsEditable = true
|
|
@@ -28435,6 +28706,7 @@ var ChartOfAccountsTable = ({
|
|
|
28435
28706
|
{
|
|
28436
28707
|
view,
|
|
28437
28708
|
data,
|
|
28709
|
+
searchQuery,
|
|
28438
28710
|
stringOverrides,
|
|
28439
28711
|
error,
|
|
28440
28712
|
expandAll,
|
|
@@ -28444,61 +28716,57 @@ var ChartOfAccountsTable = ({
|
|
|
28444
28716
|
var ChartOfAccountsTableContent = ({
|
|
28445
28717
|
stringOverrides,
|
|
28446
28718
|
data,
|
|
28719
|
+
searchQuery,
|
|
28447
28720
|
error,
|
|
28448
28721
|
expandAll,
|
|
28449
28722
|
templateAccountsEditable
|
|
28450
28723
|
}) => {
|
|
28451
|
-
const hasMountedRef = (0, import_react165.useRef)(false);
|
|
28452
28724
|
const { setAccountId } = (0, import_react165.useContext)(LedgerAccountsContext);
|
|
28453
28725
|
const { editAccount } = (0, import_react165.useContext)(ChartOfAccountsContext);
|
|
28454
|
-
const
|
|
28455
|
-
const sortedAccounts = (0, import_react165.useMemo)(() =>
|
|
28456
|
-
|
|
28457
|
-
const indexA = SORTED_STABLE_NAMES.indexOf(a.stable_name);
|
|
28458
|
-
const indexB = SORTED_STABLE_NAMES.indexOf(b.stable_name);
|
|
28459
|
-
if (indexA === -1 && indexB === -1) return 0;
|
|
28460
|
-
if (indexA === -1) return 1;
|
|
28461
|
-
if (indexB === -1) return -1;
|
|
28462
|
-
return indexA - indexB;
|
|
28463
|
-
});
|
|
28464
|
-
}, [data.accounts]);
|
|
28465
|
-
const expandableRowKeys = (0, import_react165.useMemo)(() => {
|
|
28726
|
+
const [toggledKeys, setToggledKeys] = (0, import_react165.useState)({});
|
|
28727
|
+
const sortedAccounts = (0, import_react165.useMemo)(() => sortAccountsRecursive(data.accounts), [data.accounts]);
|
|
28728
|
+
const allRowKeys = (0, import_react165.useMemo)(() => {
|
|
28466
28729
|
const keys = [];
|
|
28467
|
-
const collect = (accounts
|
|
28730
|
+
const collect = (accounts) => {
|
|
28468
28731
|
for (const account of accounts) {
|
|
28469
|
-
const key =
|
|
28732
|
+
const key = `coa-row-${account.id}`;
|
|
28470
28733
|
if (account.sub_accounts.length > 0) {
|
|
28471
28734
|
keys.push(key);
|
|
28472
|
-
collect(account.sub_accounts
|
|
28735
|
+
collect(account.sub_accounts);
|
|
28473
28736
|
}
|
|
28474
28737
|
}
|
|
28475
28738
|
};
|
|
28476
|
-
collect(data.accounts
|
|
28739
|
+
collect(data.accounts);
|
|
28477
28740
|
return keys;
|
|
28478
28741
|
}, [data.accounts]);
|
|
28479
|
-
(0, import_react165.useLayoutEffect)(() => {
|
|
28480
|
-
if (hasMountedRef.current) return;
|
|
28481
|
-
const defaultExpanded = data.accounts.map(
|
|
28482
|
-
(account) => "coa-row-" + account.id
|
|
28483
|
-
);
|
|
28484
|
-
setIsOpen(defaultExpanded);
|
|
28485
|
-
hasMountedRef.current = true;
|
|
28486
|
-
}, []);
|
|
28487
28742
|
(0, import_react165.useEffect)(() => {
|
|
28488
|
-
if (expandAll ===
|
|
28489
|
-
|
|
28490
|
-
|
|
28491
|
-
|
|
28492
|
-
|
|
28743
|
+
if (expandAll === void 0) return;
|
|
28744
|
+
setToggledKeys(
|
|
28745
|
+
Object.fromEntries(
|
|
28746
|
+
allRowKeys.map((key) => [key, expandAll === "expanded"])
|
|
28747
|
+
)
|
|
28748
|
+
);
|
|
28493
28749
|
}, [expandAll]);
|
|
28494
|
-
|
|
28750
|
+
(0, import_react165.useEffect)(() => {
|
|
28751
|
+
setToggledKeys({});
|
|
28752
|
+
}, [searchQuery]);
|
|
28753
|
+
const filteredAccounts = (0, import_react165.useMemo)(() => {
|
|
28754
|
+
if (!searchQuery) return sortedAccounts;
|
|
28755
|
+
return filterAccounts(sortedAccounts, searchQuery.toLowerCase());
|
|
28756
|
+
}, [searchQuery, sortedAccounts]);
|
|
28757
|
+
const renderChartOfAccountsDesktopRow = ({ account, index, depth, searchQuery: searchQuery2 }) => {
|
|
28495
28758
|
var _a, _b;
|
|
28759
|
+
const rowKey = `coa-row-${account.id}`;
|
|
28496
28760
|
const hasSubAccounts = !!account.sub_accounts && account.sub_accounts.length > 0;
|
|
28497
|
-
const
|
|
28761
|
+
const manuallyToggled = toggledKeys[rowKey];
|
|
28762
|
+
const isExpanded = !hasSubAccounts || manuallyToggled === true || manuallyToggled !== false && (account.isMatching || depth === 0);
|
|
28498
28763
|
const isNonEditable = !templateAccountsEditable && !!account.stable_name;
|
|
28499
28764
|
const onClickRow = (e) => {
|
|
28500
28765
|
e.stopPropagation();
|
|
28501
|
-
if (hasSubAccounts)
|
|
28766
|
+
if (!hasSubAccounts) return;
|
|
28767
|
+
setToggledKeys((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
28768
|
+
[rowKey]: !isExpanded
|
|
28769
|
+
}));
|
|
28502
28770
|
};
|
|
28503
28771
|
const onClickAccountName = (e) => {
|
|
28504
28772
|
e.stopPropagation();
|
|
@@ -28529,12 +28797,28 @@ var ChartOfAccountsTableContent = ({
|
|
|
28529
28797
|
TableCell,
|
|
28530
28798
|
{
|
|
28531
28799
|
withExpandIcon: hasSubAccounts,
|
|
28532
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime247.jsx)(HStack, __spreadProps(__spreadValues({}, !hasSubAccounts && { pis: "lg" }), { overflow: "hidden", children: /* @__PURE__ */ (0, import_jsx_runtime247.jsx)(Button2, { variant: "text", ellipsis: true, onClick: onClickAccountName, children:
|
|
28800
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime247.jsx)(HStack, __spreadProps(__spreadValues({}, !hasSubAccounts && { pis: "lg" }), { overflow: "hidden", children: /* @__PURE__ */ (0, import_jsx_runtime247.jsx)(Button2, { variant: "text", ellipsis: true, onClick: onClickAccountName, children: highlightMatch({
|
|
28801
|
+
text: account.name,
|
|
28802
|
+
query: searchQuery2,
|
|
28803
|
+
isMatching: account.isMatching
|
|
28804
|
+
}) }) }))
|
|
28533
28805
|
}
|
|
28534
28806
|
),
|
|
28535
|
-
/* @__PURE__ */ (0, import_jsx_runtime247.jsx)(TableCell, { children: depth != 0 && (
|
|
28536
|
-
|
|
28537
|
-
|
|
28807
|
+
/* @__PURE__ */ (0, import_jsx_runtime247.jsx)(TableCell, { children: depth != 0 && highlightMatch({
|
|
28808
|
+
text: ((_a = account.account_type) == null ? void 0 : _a.display_name) || "",
|
|
28809
|
+
query: searchQuery2,
|
|
28810
|
+
isMatching: account.isMatching
|
|
28811
|
+
}) }),
|
|
28812
|
+
/* @__PURE__ */ (0, import_jsx_runtime247.jsx)(TableCell, { children: depth != 0 && highlightMatch({
|
|
28813
|
+
text: ((_b = account.account_subtype) == null ? void 0 : _b.display_name) || "",
|
|
28814
|
+
query: searchQuery2,
|
|
28815
|
+
isMatching: account.isMatching
|
|
28816
|
+
}) }),
|
|
28817
|
+
/* @__PURE__ */ (0, import_jsx_runtime247.jsx)(TableCell, { children: highlightMatch({
|
|
28818
|
+
text: convertCentsToCurrency(account.balance) || "",
|
|
28819
|
+
query: searchQuery2,
|
|
28820
|
+
isMatching: account.isMatching
|
|
28821
|
+
}) }),
|
|
28538
28822
|
/* @__PURE__ */ (0, import_jsx_runtime247.jsx)(TableCell, { align: "right" /* RIGHT */, children: /* @__PURE__ */ (0, import_jsx_runtime247.jsxs)(HStack, { className: "Layer__coa__actions", gap: "xs", children: [
|
|
28539
28823
|
/* @__PURE__ */ (0, import_jsx_runtime247.jsx)(
|
|
28540
28824
|
Button,
|
|
@@ -28563,16 +28847,25 @@ var ChartOfAccountsTableContent = ({
|
|
|
28563
28847
|
}
|
|
28564
28848
|
),
|
|
28565
28849
|
hasSubAccounts && isExpanded && account.sub_accounts.map((subItem, subIdx) => {
|
|
28566
|
-
|
|
28567
|
-
|
|
28568
|
-
|
|
28569
|
-
|
|
28570
|
-
|
|
28571
|
-
|
|
28572
|
-
);
|
|
28850
|
+
return renderChartOfAccountsDesktopRow({
|
|
28851
|
+
account: subItem,
|
|
28852
|
+
index: subIdx,
|
|
28853
|
+
depth: depth + 1,
|
|
28854
|
+
searchQuery: searchQuery2
|
|
28855
|
+
});
|
|
28573
28856
|
})
|
|
28574
28857
|
] }, rowKey + "-" + index);
|
|
28575
28858
|
};
|
|
28859
|
+
if (filteredAccounts.length === 0) {
|
|
28860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime247.jsx)("div", { className: "Layer__table-state-container", children: /* @__PURE__ */ (0, import_jsx_runtime247.jsx)(
|
|
28861
|
+
DataState,
|
|
28862
|
+
{
|
|
28863
|
+
status: "info" /* info */,
|
|
28864
|
+
title: "No accounts found",
|
|
28865
|
+
description: 'No accounts match the current filters. Click "Add Account" to create a new one.'
|
|
28866
|
+
}
|
|
28867
|
+
) });
|
|
28868
|
+
}
|
|
28576
28869
|
return /* @__PURE__ */ (0, import_jsx_runtime247.jsxs)(Table, { componentName: "chart-of-accounts", children: [
|
|
28577
28870
|
/* @__PURE__ */ (0, import_jsx_runtime247.jsxs)("colgroup", { children: [
|
|
28578
28871
|
/* @__PURE__ */ (0, import_jsx_runtime247.jsx)("col", { className: "Layer__chart-of-accounts--name" }),
|
|
@@ -28588,13 +28881,13 @@ var ChartOfAccountsTableContent = ({
|
|
|
28588
28881
|
/* @__PURE__ */ (0, import_jsx_runtime247.jsx)(TableCell, { isHeaderCell: true, children: (stringOverrides == null ? void 0 : stringOverrides.balanceColumnHeader) || "Balance" }),
|
|
28589
28882
|
/* @__PURE__ */ (0, import_jsx_runtime247.jsx)(TableCell, { isHeaderCell: true })
|
|
28590
28883
|
] }) }),
|
|
28591
|
-
/* @__PURE__ */ (0, import_jsx_runtime247.jsx)(TableBody, { children: !error &&
|
|
28592
|
-
(account,
|
|
28884
|
+
/* @__PURE__ */ (0, import_jsx_runtime247.jsx)(TableBody, { children: !error && filteredAccounts.map(
|
|
28885
|
+
(account, index) => renderChartOfAccountsDesktopRow({
|
|
28593
28886
|
account,
|
|
28594
|
-
|
|
28595
|
-
|
|
28596
|
-
|
|
28597
|
-
)
|
|
28887
|
+
index,
|
|
28888
|
+
depth: 0,
|
|
28889
|
+
searchQuery
|
|
28890
|
+
})
|
|
28598
28891
|
) })
|
|
28599
28892
|
] });
|
|
28600
28893
|
};
|
|
@@ -28700,6 +28993,7 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
28700
28993
|
}) => {
|
|
28701
28994
|
const { data, isLoading, addAccount, error, isValidating, refetch, form } = (0, import_react166.useContext)(ChartOfAccountsContext);
|
|
28702
28995
|
const [expandAll, setExpandAll] = (0, import_react166.useState)();
|
|
28996
|
+
const { inputValue, searchQuery, handleInputChange } = useDebouncedSearchInput({ initialInputState: "" });
|
|
28703
28997
|
return /* @__PURE__ */ (0, import_jsx_runtime249.jsxs)(
|
|
28704
28998
|
Panel,
|
|
28705
28999
|
{
|
|
@@ -28727,7 +29021,7 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
28727
29021
|
{
|
|
28728
29022
|
size: "secondary" /* secondary */,
|
|
28729
29023
|
className: `Layer__${COMPONENT_NAME6}__subtitle`,
|
|
28730
|
-
children: withDateControl || withExpandAllButton ? /* @__PURE__ */ (0, import_jsx_runtime249.jsxs)(
|
|
29024
|
+
children: withDateControl || withExpandAllButton ? /* @__PURE__ */ (0, import_jsx_runtime249.jsxs)(HStack, { align: "center", gap: "xs", children: [
|
|
28731
29025
|
withDateControl && /* @__PURE__ */ (0, import_jsx_runtime249.jsx)(ChartOfAccountsDatePicker, {}),
|
|
28732
29026
|
withExpandAllButton && /* @__PURE__ */ (0, import_jsx_runtime249.jsx)(
|
|
28733
29027
|
ExpandCollapseButton,
|
|
@@ -28743,7 +29037,8 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
28743
29037
|
] }) : null
|
|
28744
29038
|
}
|
|
28745
29039
|
) }),
|
|
28746
|
-
/* @__PURE__ */ (0, import_jsx_runtime249.jsxs)(HeaderCol, { children: [
|
|
29040
|
+
/* @__PURE__ */ (0, import_jsx_runtime249.jsxs)(HeaderCol, { className: "Layer__chart-of-accounts__actions", children: [
|
|
29041
|
+
/* @__PURE__ */ (0, import_jsx_runtime249.jsx)(SearchField, { label: "Search accounts", value: inputValue, onChange: handleInputChange }),
|
|
28747
29042
|
/* @__PURE__ */ (0, import_jsx_runtime249.jsx)(
|
|
28748
29043
|
AccountBalancesDownloadButton,
|
|
28749
29044
|
{
|
|
@@ -28766,6 +29061,7 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
28766
29061
|
{
|
|
28767
29062
|
view,
|
|
28768
29063
|
data,
|
|
29064
|
+
searchQuery,
|
|
28769
29065
|
error,
|
|
28770
29066
|
stringOverrides,
|
|
28771
29067
|
expandAll,
|
|
@@ -28782,17 +29078,7 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
28782
29078
|
isLoading: isValidating || isLoading
|
|
28783
29079
|
}
|
|
28784
29080
|
) }) : null,
|
|
28785
|
-
(!data || isLoading) && !error ? /* @__PURE__ */ (0, import_jsx_runtime249.jsx)("div", { className: `Layer__${COMPONENT_NAME6}__loader-container`, children: /* @__PURE__ */ (0, import_jsx_runtime249.jsx)(Loader2, {}) }) : null
|
|
28786
|
-
!isLoading && !error && (data == null ? void 0 : data.accounts.length) === 0 ? /* @__PURE__ */ (0, import_jsx_runtime249.jsx)("div", { className: "Layer__table-state-container", children: /* @__PURE__ */ (0, import_jsx_runtime249.jsx)(
|
|
28787
|
-
DataState,
|
|
28788
|
-
{
|
|
28789
|
-
status: "info" /* info */,
|
|
28790
|
-
title: "Accounts were not found",
|
|
28791
|
-
description: 'New account can be created with "Add Account".',
|
|
28792
|
-
onRefresh: () => refetch(),
|
|
28793
|
-
isLoading: isValidating
|
|
28794
|
-
}
|
|
28795
|
-
) }) : null
|
|
29081
|
+
(!data || isLoading) && !error ? /* @__PURE__ */ (0, import_jsx_runtime249.jsx)("div", { className: `Layer__${COMPONENT_NAME6}__loader-container`, children: /* @__PURE__ */ (0, import_jsx_runtime249.jsx)(Loader2, {}) }) : null
|
|
28796
29082
|
]
|
|
28797
29083
|
}
|
|
28798
29084
|
);
|