@layerfi/components 0.1.11 → 0.1.13
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 +462 -127
- package/dist/esm/index.js.map +4 -4
- package/dist/index.d.ts +123 -36
- package/dist/index.js +466 -131
- package/dist/index.js.map +4 -4
- package/dist/styles/index.css +4 -1
- package/dist/styles/index.css.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -313,6 +313,9 @@ var getCategories = get(({ businessId }) => `/v1/businesses/${businessId}/catego
|
|
|
313
313
|
var getChartOfAccounts = get(
|
|
314
314
|
({ businessId }) => `/v1/businesses/${businessId}/ledger/accounts`
|
|
315
315
|
);
|
|
316
|
+
var getLedgerAccountBalances = get(
|
|
317
|
+
({ businessId }) => `/v1/businesses/${businessId}/ledger/balances`
|
|
318
|
+
);
|
|
316
319
|
var createAccount = post(
|
|
317
320
|
({ businessId }) => `/v1/businesses/${businessId}/ledger/accounts`
|
|
318
321
|
);
|
|
@@ -355,6 +358,7 @@ var Layer = {
|
|
|
355
358
|
getBankTransactions,
|
|
356
359
|
getCategories,
|
|
357
360
|
getChartOfAccounts,
|
|
361
|
+
getLedgerAccountBalances,
|
|
358
362
|
getLedgerAccountsLines,
|
|
359
363
|
getLedgerAccountsEntry,
|
|
360
364
|
getProfitAndLoss,
|
|
@@ -823,7 +827,6 @@ var debounce = (fnc, timeout = 300) => {
|
|
|
823
827
|
}, timeout);
|
|
824
828
|
};
|
|
825
829
|
};
|
|
826
|
-
var convertToStableName = (name) => name.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "").replace(/\W+/g, " ").split(/ |\B(?=[A-Z])/).map((word) => word.toLowerCase()).join("_");
|
|
827
830
|
|
|
828
831
|
// src/components/BankTransactionListItem/BankTransactionListItem.tsx
|
|
829
832
|
var import_react36 = __toESM(require("react"));
|
|
@@ -2226,6 +2229,7 @@ var FileInput = ({ text = "Upload", onUpload }) => {
|
|
|
2226
2229
|
// src/components/Input/Select.tsx
|
|
2227
2230
|
var import_react26 = __toESM(require("react"));
|
|
2228
2231
|
var import_react_select2 = __toESM(require("react-select"));
|
|
2232
|
+
var import_classnames14 = __toESM(require("classnames"));
|
|
2229
2233
|
var DropdownIndicator2 = (props) => {
|
|
2230
2234
|
return /* @__PURE__ */ import_react26.default.createElement(import_react_select2.components.DropdownIndicator, { ...props }, /* @__PURE__ */ import_react26.default.createElement(ChevronDownFill_default, null));
|
|
2231
2235
|
};
|
|
@@ -2237,13 +2241,20 @@ var Select2 = ({
|
|
|
2237
2241
|
value,
|
|
2238
2242
|
onChange,
|
|
2239
2243
|
disabled,
|
|
2240
|
-
placeholder
|
|
2244
|
+
placeholder,
|
|
2245
|
+
isInvalid,
|
|
2246
|
+
errorMessage
|
|
2241
2247
|
}) => {
|
|
2242
|
-
|
|
2248
|
+
const baseClassName = (0, import_classnames14.default)(
|
|
2249
|
+
"Layer__select",
|
|
2250
|
+
isInvalid ? "Layer__select--error" : "",
|
|
2251
|
+
className
|
|
2252
|
+
);
|
|
2253
|
+
return /* @__PURE__ */ import_react26.default.createElement(Tooltip, { disabled: !isInvalid || !errorMessage }, /* @__PURE__ */ import_react26.default.createElement(TooltipTrigger, { className: "Layer__input-tooltip" }, /* @__PURE__ */ import_react26.default.createElement(
|
|
2243
2254
|
import_react_select2.default,
|
|
2244
2255
|
{
|
|
2245
2256
|
name,
|
|
2246
|
-
className:
|
|
2257
|
+
className: baseClassName,
|
|
2247
2258
|
classNamePrefix,
|
|
2248
2259
|
placeholder: placeholder ?? "Select...",
|
|
2249
2260
|
options,
|
|
@@ -2254,7 +2265,7 @@ var Select2 = ({
|
|
|
2254
2265
|
components: { DropdownIndicator: DropdownIndicator2 },
|
|
2255
2266
|
isDisabled: disabled
|
|
2256
2267
|
}
|
|
2257
|
-
);
|
|
2268
|
+
)), /* @__PURE__ */ import_react26.default.createElement(TooltipContent, { className: "Layer__tooltip" }, errorMessage));
|
|
2258
2269
|
};
|
|
2259
2270
|
|
|
2260
2271
|
// src/components/MatchForm/MatchForm.tsx
|
|
@@ -2284,7 +2295,7 @@ var MatchBadge = ({
|
|
|
2284
2295
|
};
|
|
2285
2296
|
|
|
2286
2297
|
// src/components/MatchForm/MatchForm.tsx
|
|
2287
|
-
var
|
|
2298
|
+
var import_classnames15 = __toESM(require("classnames"));
|
|
2288
2299
|
var import_date_fns6 = require("date-fns");
|
|
2289
2300
|
var MatchForm = ({
|
|
2290
2301
|
classNamePrefix,
|
|
@@ -2303,7 +2314,7 @@ var MatchForm = ({
|
|
|
2303
2314
|
"div",
|
|
2304
2315
|
{
|
|
2305
2316
|
key: idx,
|
|
2306
|
-
className: (0,
|
|
2317
|
+
className: (0, import_classnames15.default)(
|
|
2307
2318
|
`${classNamePrefix}__match-row`,
|
|
2308
2319
|
match.id === selectedMatchId ? `${classNamePrefix}__match-row--selected` : ""
|
|
2309
2320
|
),
|
|
@@ -2362,18 +2373,18 @@ var MatchForm = ({
|
|
|
2362
2373
|
|
|
2363
2374
|
// src/components/Textarea/Textarea.tsx
|
|
2364
2375
|
var import_react29 = __toESM(require("react"));
|
|
2365
|
-
var
|
|
2376
|
+
var import_classnames16 = __toESM(require("classnames"));
|
|
2366
2377
|
var Textarea = ({
|
|
2367
2378
|
className,
|
|
2368
2379
|
...props
|
|
2369
2380
|
}) => {
|
|
2370
|
-
const baseClassName = (0,
|
|
2381
|
+
const baseClassName = (0, import_classnames16.default)("Layer__textarea", className);
|
|
2371
2382
|
return /* @__PURE__ */ import_react29.default.createElement("textarea", { ...props, className: baseClassName });
|
|
2372
2383
|
};
|
|
2373
2384
|
|
|
2374
2385
|
// src/components/Toggle/Toggle.tsx
|
|
2375
2386
|
var import_react30 = __toESM(require("react"));
|
|
2376
|
-
var
|
|
2387
|
+
var import_classnames17 = __toESM(require("classnames"));
|
|
2377
2388
|
var Toggle = ({
|
|
2378
2389
|
name,
|
|
2379
2390
|
options,
|
|
@@ -2390,7 +2401,7 @@ var Toggle = ({
|
|
|
2390
2401
|
}
|
|
2391
2402
|
});
|
|
2392
2403
|
const selectedValue = selected || options[0].value;
|
|
2393
|
-
const baseClassName = (0,
|
|
2404
|
+
const baseClassName = (0, import_classnames17.default)(
|
|
2394
2405
|
"Layer__toggle",
|
|
2395
2406
|
`Layer__toggle--${size}`,
|
|
2396
2407
|
initialized ? "Layer__toggle--initialized" : ""
|
|
@@ -2641,7 +2652,7 @@ var Notification = ({
|
|
|
2641
2652
|
};
|
|
2642
2653
|
|
|
2643
2654
|
// src/components/ExpandedBankTransactionRow/ExpandedBankTransactionRow.tsx
|
|
2644
|
-
var
|
|
2655
|
+
var import_classnames18 = __toESM(require("classnames"));
|
|
2645
2656
|
var hasMatch = (bankTransaction) => {
|
|
2646
2657
|
return Boolean(
|
|
2647
2658
|
bankTransaction?.suggested_matches && bankTransaction?.suggested_matches?.length > 0 || bankTransaction?.match
|
|
@@ -2894,7 +2905,7 @@ var ExpandedBankTransactionRow = (0, import_react32.forwardRef)(
|
|
|
2894
2905
|
/* @__PURE__ */ import_react32.default.createElement("div", { className: `${className}__content-panels` }, /* @__PURE__ */ import_react32.default.createElement(
|
|
2895
2906
|
"div",
|
|
2896
2907
|
{
|
|
2897
|
-
className: (0,
|
|
2908
|
+
className: (0, import_classnames18.default)(
|
|
2898
2909
|
`${className}__match`,
|
|
2899
2910
|
`${className}__content-panel`,
|
|
2900
2911
|
purpose === "match" /* match */ ? `${className}__content-panel--active` : ""
|
|
@@ -2916,7 +2927,7 @@ var ExpandedBankTransactionRow = (0, import_react32.forwardRef)(
|
|
|
2916
2927
|
), /* @__PURE__ */ import_react32.default.createElement(
|
|
2917
2928
|
"div",
|
|
2918
2929
|
{
|
|
2919
|
-
className: (0,
|
|
2930
|
+
className: (0, import_classnames18.default)(
|
|
2920
2931
|
`${className}__splits`,
|
|
2921
2932
|
`${className}__content-panel`,
|
|
2922
2933
|
purpose === "categorize" /* categorize */ ? `${className}__content-panel--active` : ""
|
|
@@ -3055,7 +3066,7 @@ var SplitTooltipDetails = ({
|
|
|
3055
3066
|
};
|
|
3056
3067
|
|
|
3057
3068
|
// src/components/BankTransactionRow/BankTransactionRow.tsx
|
|
3058
|
-
var
|
|
3069
|
+
var import_classnames19 = __toESM(require("classnames"));
|
|
3059
3070
|
var import_date_fns7 = require("date-fns");
|
|
3060
3071
|
var isCredit = ({ direction }) => direction === "CREDIT" /* CREDIT */;
|
|
3061
3072
|
var extractDescriptionForSplit = (category) => {
|
|
@@ -3065,7 +3076,15 @@ var extractDescriptionForSplit = (category) => {
|
|
|
3065
3076
|
return category.entries.map((c) => c.category.display_name).join(", ");
|
|
3066
3077
|
};
|
|
3067
3078
|
var getDefaultSelectedCategory = (bankTransaction) => {
|
|
3068
|
-
|
|
3079
|
+
if (bankTransaction.suggested_matches?.[0]) {
|
|
3080
|
+
return mapSuggestedMatchToOption(bankTransaction.suggested_matches?.[0]);
|
|
3081
|
+
}
|
|
3082
|
+
if (hasSuggestions(bankTransaction.categorization_flow)) {
|
|
3083
|
+
return mapCategoryToOption(
|
|
3084
|
+
bankTransaction.categorization_flow.suggestions[0]
|
|
3085
|
+
);
|
|
3086
|
+
}
|
|
3087
|
+
return void 0;
|
|
3069
3088
|
};
|
|
3070
3089
|
var clickTimer = Date.now();
|
|
3071
3090
|
var BankTransactionRow = ({
|
|
@@ -3146,7 +3165,7 @@ var BankTransactionRow = ({
|
|
|
3146
3165
|
}
|
|
3147
3166
|
const className = "Layer__bank-transaction-row";
|
|
3148
3167
|
const openClassName = open ? `${className}--expanded` : "";
|
|
3149
|
-
const rowClassName = (0,
|
|
3168
|
+
const rowClassName = (0, import_classnames19.default)(
|
|
3150
3169
|
className,
|
|
3151
3170
|
bankTransaction.recently_categorized && editable ? "Layer__bank-transaction-row--removing" : "",
|
|
3152
3171
|
open ? openClassName : "",
|
|
@@ -3220,7 +3239,7 @@ var BankTransactionRow = ({
|
|
|
3220
3239
|
/* @__PURE__ */ import_react34.default.createElement(
|
|
3221
3240
|
"td",
|
|
3222
3241
|
{
|
|
3223
|
-
className: (0,
|
|
3242
|
+
className: (0, import_classnames19.default)(
|
|
3224
3243
|
"Layer__table-cell",
|
|
3225
3244
|
"Layer__table-cell__category-col",
|
|
3226
3245
|
`${className}__actions-cell`,
|
|
@@ -3375,7 +3394,7 @@ var Assignment = ({ bankTransaction }) => {
|
|
|
3375
3394
|
};
|
|
3376
3395
|
|
|
3377
3396
|
// src/components/BankTransactionListItem/BankTransactionListItem.tsx
|
|
3378
|
-
var
|
|
3397
|
+
var import_classnames20 = __toESM(require("classnames"));
|
|
3379
3398
|
var import_date_fns9 = require("date-fns");
|
|
3380
3399
|
var isCredit2 = ({ direction }) => direction === "CREDIT" /* CREDIT */;
|
|
3381
3400
|
var BankTransactionListItem = ({
|
|
@@ -3434,7 +3453,7 @@ var BankTransactionListItem = ({
|
|
|
3434
3453
|
}
|
|
3435
3454
|
const className = "Layer__bank-transaction-list-item";
|
|
3436
3455
|
const openClassName = open ? `${className}--expanded` : "";
|
|
3437
|
-
const rowClassName = (0,
|
|
3456
|
+
const rowClassName = (0, import_classnames20.default)(
|
|
3438
3457
|
className,
|
|
3439
3458
|
bankTransaction.recently_categorized ? "Layer__bank-transaction-row--removing" : "",
|
|
3440
3459
|
open ? openClassName : "",
|
|
@@ -3741,10 +3760,10 @@ var hslToHex = (hsl) => {
|
|
|
3741
3760
|
};
|
|
3742
3761
|
|
|
3743
3762
|
// src/components/Container/Container.tsx
|
|
3744
|
-
var
|
|
3763
|
+
var import_classnames21 = __toESM(require("classnames"));
|
|
3745
3764
|
var Container = (0, import_react37.forwardRef)(
|
|
3746
3765
|
({ name, className, children, asWidget, elevated = false }, ref) => {
|
|
3747
|
-
const baseClassName = (0,
|
|
3766
|
+
const baseClassName = (0, import_classnames21.default)(
|
|
3748
3767
|
"Layer__component Layer__component-container",
|
|
3749
3768
|
`Layer__${name}`,
|
|
3750
3769
|
elevated && "Layer__component--elevated",
|
|
@@ -3759,10 +3778,10 @@ var Container = (0, import_react37.forwardRef)(
|
|
|
3759
3778
|
|
|
3760
3779
|
// src/components/Container/Header.tsx
|
|
3761
3780
|
var import_react38 = __toESM(require("react"));
|
|
3762
|
-
var
|
|
3781
|
+
var import_classnames22 = __toESM(require("classnames"));
|
|
3763
3782
|
var Header = (0, import_react38.forwardRef)(
|
|
3764
3783
|
({ className, children, style }, ref) => {
|
|
3765
|
-
const baseClassName = (0,
|
|
3784
|
+
const baseClassName = (0, import_classnames22.default)("Layer__component-header", className);
|
|
3766
3785
|
return /* @__PURE__ */ import_react38.default.createElement("header", { ref, className: baseClassName, style }, children);
|
|
3767
3786
|
}
|
|
3768
3787
|
);
|
|
@@ -3910,7 +3929,7 @@ var ChavronRight = ({ size = 18, ...props }) => /* @__PURE__ */ React54.createEl
|
|
|
3910
3929
|
var ChevronRight_default = ChavronRight;
|
|
3911
3930
|
|
|
3912
3931
|
// src/components/Pagination/Pagination.tsx
|
|
3913
|
-
var
|
|
3932
|
+
var import_classnames23 = __toESM(require("classnames"));
|
|
3914
3933
|
var Pagination = ({
|
|
3915
3934
|
onPageChange,
|
|
3916
3935
|
totalCount,
|
|
@@ -3935,7 +3954,7 @@ var Pagination = ({
|
|
|
3935
3954
|
"li",
|
|
3936
3955
|
{
|
|
3937
3956
|
key: `page-prev`,
|
|
3938
|
-
className: (0,
|
|
3957
|
+
className: (0, import_classnames23.default)(
|
|
3939
3958
|
"Layer__pagination-item Layer__pagination-arrow Layer__pagination-arrow--previous",
|
|
3940
3959
|
{
|
|
3941
3960
|
disabled: currentPage === 1
|
|
@@ -3959,7 +3978,7 @@ var Pagination = ({
|
|
|
3959
3978
|
"li",
|
|
3960
3979
|
{
|
|
3961
3980
|
key: `page-${pageNumber}`,
|
|
3962
|
-
className: (0,
|
|
3981
|
+
className: (0, import_classnames23.default)("Layer__pagination-item", {
|
|
3963
3982
|
selected: pageNumber === currentPage
|
|
3964
3983
|
}),
|
|
3965
3984
|
onClick: () => {
|
|
@@ -3974,7 +3993,7 @@ var Pagination = ({
|
|
|
3974
3993
|
"li",
|
|
3975
3994
|
{
|
|
3976
3995
|
key: `page-last`,
|
|
3977
|
-
className: (0,
|
|
3996
|
+
className: (0, import_classnames23.default)(
|
|
3978
3997
|
"Layer__pagination-item Layer__pagination-arrow Layer__pagination-arrow--next",
|
|
3979
3998
|
{
|
|
3980
3999
|
disabled: currentPage === lastPage
|
|
@@ -4472,7 +4491,7 @@ var MoreVertical_default = MoreVertical;
|
|
|
4472
4491
|
|
|
4473
4492
|
// src/components/HoverMenu/HoverMenu.tsx
|
|
4474
4493
|
var import_react47 = __toESM(require("react"));
|
|
4475
|
-
var
|
|
4494
|
+
var import_classnames24 = __toESM(require("classnames"));
|
|
4476
4495
|
var HoverMenu = ({
|
|
4477
4496
|
children,
|
|
4478
4497
|
config,
|
|
@@ -4481,7 +4500,7 @@ var HoverMenu = ({
|
|
|
4481
4500
|
}) => {
|
|
4482
4501
|
const [openMenu, setOpenMenu] = (0, import_react47.useState)(false);
|
|
4483
4502
|
const hoverMenuRef = (0, import_react47.useRef)(null);
|
|
4484
|
-
const hoverMenuClassName = (0,
|
|
4503
|
+
const hoverMenuClassName = (0, import_classnames24.default)(
|
|
4485
4504
|
"Layer__hover-menu",
|
|
4486
4505
|
openMenu && "Layer__hover-menu--open"
|
|
4487
4506
|
);
|
|
@@ -4844,22 +4863,17 @@ var InstitutionIcon = ({ size = 18, ...props }) => /* @__PURE__ */ React62.creat
|
|
|
4844
4863
|
var InstitutionIcon_default = InstitutionIcon;
|
|
4845
4864
|
|
|
4846
4865
|
// src/components/LinkedAccountThumb/LinkedAccountThumb.tsx
|
|
4847
|
-
var
|
|
4848
|
-
var AccountNumber = ({ accountNumber }) => /* @__PURE__ */ import_react49.default.createElement("div", { className: "account-number" }, /* @__PURE__ */ import_react49.default.createElement(Text, { size: "sm" }, "\u2022\u2022\u2022", accountNumber));
|
|
4866
|
+
var import_classnames25 = __toESM(require("classnames"));
|
|
4867
|
+
var AccountNumber = ({ accountNumber }) => /* @__PURE__ */ import_react49.default.createElement("div", { className: "account-number" }, /* @__PURE__ */ import_react49.default.createElement(Text, { size: "sm" }, "\u2022\u2022\u2022 ", accountNumber));
|
|
4849
4868
|
var LinkedAccountThumb = ({
|
|
4850
4869
|
account,
|
|
4851
4870
|
asWidget
|
|
4852
4871
|
}) => {
|
|
4853
|
-
const linkedAccountThumbClassName = (0,
|
|
4872
|
+
const linkedAccountThumbClassName = (0, import_classnames25.default)(
|
|
4854
4873
|
"Layer__linked-account-thumb",
|
|
4855
4874
|
asWidget && "--as-widget"
|
|
4856
4875
|
);
|
|
4857
|
-
return /* @__PURE__ */ import_react49.default.createElement("div", { className: linkedAccountThumbClassName }, /* @__PURE__ */ import_react49.default.createElement("div", { className: "topbar" }, /* @__PURE__ */ import_react49.default.createElement("div", { className: "topbar-details" }, /* @__PURE__ */ import_react49.default.createElement(Text, { as: "span", className: "account-name" }, account.external_account_name), !asWidget && /* @__PURE__ */ import_react49.default.createElement(
|
|
4858
|
-
AccountNumber,
|
|
4859
|
-
{
|
|
4860
|
-
accountNumber: "TODO"
|
|
4861
|
-
}
|
|
4862
|
-
), /* @__PURE__ */ import_react49.default.createElement(
|
|
4876
|
+
return /* @__PURE__ */ import_react49.default.createElement("div", { className: linkedAccountThumbClassName }, /* @__PURE__ */ import_react49.default.createElement("div", { className: "topbar" }, /* @__PURE__ */ import_react49.default.createElement("div", { className: "topbar-details" }, /* @__PURE__ */ import_react49.default.createElement(Text, { as: "span", className: "account-name" }, account.external_account_name), !asWidget && account.mask && /* @__PURE__ */ import_react49.default.createElement(AccountNumber, { accountNumber: account.mask }), /* @__PURE__ */ import_react49.default.createElement(
|
|
4863
4877
|
Text,
|
|
4864
4878
|
{
|
|
4865
4879
|
as: "span",
|
|
@@ -4867,7 +4881,15 @@ var LinkedAccountThumb = ({
|
|
|
4867
4881
|
size: "sm"
|
|
4868
4882
|
},
|
|
4869
4883
|
account.institution?.name
|
|
4870
|
-
)), /* @__PURE__ */ import_react49.default.createElement("div", { className: "topbar-logo" },
|
|
4884
|
+
)), /* @__PURE__ */ import_react49.default.createElement("div", { className: "topbar-logo" }, account.logo_base64 != void 0 ? /* @__PURE__ */ import_react49.default.createElement(
|
|
4885
|
+
"img",
|
|
4886
|
+
{
|
|
4887
|
+
width: 28,
|
|
4888
|
+
height: 28,
|
|
4889
|
+
src: `data:image/png;base64,${account.logo_base64}`,
|
|
4890
|
+
alt: account.institution?.name
|
|
4891
|
+
}
|
|
4892
|
+
) : /* @__PURE__ */ import_react49.default.createElement(InstitutionIcon_default, null))), !asWidget && /* @__PURE__ */ import_react49.default.createElement("div", { className: "middlebar" }, /* @__PURE__ */ import_react49.default.createElement(
|
|
4871
4893
|
Text,
|
|
4872
4894
|
{
|
|
4873
4895
|
as: "span",
|
|
@@ -4887,12 +4909,12 @@ var LinkedAccountThumb = ({
|
|
|
4887
4909
|
className: "account-balance-text",
|
|
4888
4910
|
size: "sm"
|
|
4889
4911
|
},
|
|
4890
|
-
"
|
|
4912
|
+
"Ledger balance"
|
|
4891
4913
|
), /* @__PURE__ */ import_react49.default.createElement(Text, { as: "span", className: "account-balance" }, "$", centsToDollars(account.current_ledger_balance))));
|
|
4892
4914
|
};
|
|
4893
4915
|
|
|
4894
4916
|
// src/components/LinkedAccounts/LinkedAccounts.tsx
|
|
4895
|
-
var
|
|
4917
|
+
var import_classnames26 = __toESM(require("classnames"));
|
|
4896
4918
|
var COMPONENT_NAME2 = "linked-accounts";
|
|
4897
4919
|
var LinkedAccounts = ({ asWidget, elevated }) => {
|
|
4898
4920
|
const {
|
|
@@ -4909,7 +4931,7 @@ var LinkedAccounts = ({ asWidget, elevated }) => {
|
|
|
4909
4931
|
{ name: "Renew link", action: renewLinkAccount },
|
|
4910
4932
|
{ name: "Unlink", action: unlinkAccount }
|
|
4911
4933
|
];
|
|
4912
|
-
const linkedAccountsNewAccountClassName = (0,
|
|
4934
|
+
const linkedAccountsNewAccountClassName = (0, import_classnames26.default)(
|
|
4913
4935
|
"Layer__linked-accounts__new-account",
|
|
4914
4936
|
asWidget && "--as-widget"
|
|
4915
4937
|
);
|
|
@@ -6068,7 +6090,7 @@ var SortArrows = ({ size = 13, ...props }) => /* @__PURE__ */ React70.createElem
|
|
|
6068
6090
|
var SortArrows_default = SortArrows;
|
|
6069
6091
|
|
|
6070
6092
|
// src/components/ProfitAndLossDetailedCharts/DetailedTable.tsx
|
|
6071
|
-
var
|
|
6093
|
+
var import_classnames27 = __toESM(require("classnames"));
|
|
6072
6094
|
var DetailedTable = ({
|
|
6073
6095
|
filteredData,
|
|
6074
6096
|
sidebarScope,
|
|
@@ -6078,7 +6100,7 @@ var DetailedTable = ({
|
|
|
6078
6100
|
setHoveredItem
|
|
6079
6101
|
}) => {
|
|
6080
6102
|
const buildColClass = (column) => {
|
|
6081
|
-
return (0,
|
|
6103
|
+
return (0, import_classnames27.default)(
|
|
6082
6104
|
"Layer__sortable-col",
|
|
6083
6105
|
sidebarScope && filters[sidebarScope]?.sortBy === column ? `sort--${(sidebarScope && filters[sidebarScope]?.sortDirection) ?? "desc"}` : ""
|
|
6084
6106
|
);
|
|
@@ -6113,7 +6135,7 @@ var DetailedTable = ({
|
|
|
6113
6135
|
"tr",
|
|
6114
6136
|
{
|
|
6115
6137
|
key: `pl-side-table-item-${idx}`,
|
|
6116
|
-
className: (0,
|
|
6138
|
+
className: (0, import_classnames27.default)(
|
|
6117
6139
|
"Layer__profit-and-loss-detailed-table__row",
|
|
6118
6140
|
hoveredItem && hoveredItem === item.display_name ? "active" : ""
|
|
6119
6141
|
),
|
|
@@ -6244,13 +6266,13 @@ var import_react61 = __toESM(require("react"));
|
|
|
6244
6266
|
|
|
6245
6267
|
// src/components/SkeletonLoader/SkeletonLoader.tsx
|
|
6246
6268
|
var import_react59 = __toESM(require("react"));
|
|
6247
|
-
var
|
|
6269
|
+
var import_classnames28 = __toESM(require("classnames"));
|
|
6248
6270
|
var SkeletonLoader = ({
|
|
6249
6271
|
height,
|
|
6250
6272
|
width,
|
|
6251
6273
|
className
|
|
6252
6274
|
}) => {
|
|
6253
|
-
const baseClassName = (0,
|
|
6275
|
+
const baseClassName = (0, import_classnames28.default)(
|
|
6254
6276
|
"Layer__skeleton-loader Layer__anim--skeleton-loading",
|
|
6255
6277
|
className
|
|
6256
6278
|
);
|
|
@@ -6294,7 +6316,7 @@ var MiniChart = ({ data }) => {
|
|
|
6294
6316
|
};
|
|
6295
6317
|
|
|
6296
6318
|
// src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
|
|
6297
|
-
var
|
|
6319
|
+
var import_classnames29 = __toESM(require("classnames"));
|
|
6298
6320
|
var CHART_PLACEHOLDER = [
|
|
6299
6321
|
{
|
|
6300
6322
|
name: "placeholder",
|
|
@@ -6350,7 +6372,7 @@ var ProfitAndLossSummaries = ({
|
|
|
6350
6372
|
/* @__PURE__ */ import_react61.default.createElement(
|
|
6351
6373
|
"div",
|
|
6352
6374
|
{
|
|
6353
|
-
className: (0,
|
|
6375
|
+
className: (0, import_classnames29.default)(
|
|
6354
6376
|
"Layer__profit-and-loss-summaries__summary",
|
|
6355
6377
|
actionable && "Layer__actionable",
|
|
6356
6378
|
"Layer__profit-and-loss-summaries__summary--income",
|
|
@@ -6372,7 +6394,7 @@ var ProfitAndLossSummaries = ({
|
|
|
6372
6394
|
/* @__PURE__ */ import_react61.default.createElement(
|
|
6373
6395
|
"div",
|
|
6374
6396
|
{
|
|
6375
|
-
className: (0,
|
|
6397
|
+
className: (0, import_classnames29.default)(
|
|
6376
6398
|
"Layer__profit-and-loss-summaries__summary",
|
|
6377
6399
|
actionable && "Layer__actionable",
|
|
6378
6400
|
"Layer__profit-and-loss-summaries__summary--expenses",
|
|
@@ -6396,7 +6418,7 @@ var ProfitAndLossSummaries = ({
|
|
|
6396
6418
|
/* @__PURE__ */ import_react61.default.createElement(
|
|
6397
6419
|
"div",
|
|
6398
6420
|
{
|
|
6399
|
-
className: (0,
|
|
6421
|
+
className: (0, import_classnames29.default)(
|
|
6400
6422
|
"Layer__profit-and-loss-summaries__summary net-profit Layer__profit-and-loss-summaries__summary--net-profit",
|
|
6401
6423
|
actionable && "Layer__actionable"
|
|
6402
6424
|
)
|
|
@@ -6587,7 +6609,7 @@ var empty_profit_and_loss_report_default = {
|
|
|
6587
6609
|
};
|
|
6588
6610
|
|
|
6589
6611
|
// src/components/ProfitAndLossTable/ProfitAndLossTable.tsx
|
|
6590
|
-
var
|
|
6612
|
+
var import_classnames30 = __toESM(require("classnames"));
|
|
6591
6613
|
var ProfitAndLossTable = ({ lockExpanded, asContainer }) => {
|
|
6592
6614
|
const {
|
|
6593
6615
|
data: actualData,
|
|
@@ -6599,7 +6621,7 @@ var ProfitAndLossTable = ({ lockExpanded, asContainer }) => {
|
|
|
6599
6621
|
return /* @__PURE__ */ import_react63.default.createElement(
|
|
6600
6622
|
"div",
|
|
6601
6623
|
{
|
|
6602
|
-
className: (0,
|
|
6624
|
+
className: (0, import_classnames30.default)(
|
|
6603
6625
|
"Layer__profit-and-loss-table__loader-container",
|
|
6604
6626
|
asContainer && "Layer__component-container"
|
|
6605
6627
|
)
|
|
@@ -6610,7 +6632,7 @@ var ProfitAndLossTable = ({ lockExpanded, asContainer }) => {
|
|
|
6610
6632
|
return /* @__PURE__ */ import_react63.default.createElement(import_react63.default.Fragment, null, /* @__PURE__ */ import_react63.default.createElement(
|
|
6611
6633
|
"div",
|
|
6612
6634
|
{
|
|
6613
|
-
className: (0,
|
|
6635
|
+
className: (0, import_classnames30.default)(
|
|
6614
6636
|
"Layer__profit-and-loss-table Layer__profit-and-loss-table--main",
|
|
6615
6637
|
asContainer && "Layer__component-container"
|
|
6616
6638
|
)
|
|
@@ -6764,7 +6786,7 @@ var import_react66 = __toESM(require("react"));
|
|
|
6764
6786
|
|
|
6765
6787
|
// src/components/Panel/Panel.tsx
|
|
6766
6788
|
var import_react65 = __toESM(require("react"));
|
|
6767
|
-
var
|
|
6789
|
+
var import_classnames31 = __toESM(require("classnames"));
|
|
6768
6790
|
var Panel = ({
|
|
6769
6791
|
children,
|
|
6770
6792
|
className,
|
|
@@ -6782,7 +6804,7 @@ var Panel = ({
|
|
|
6782
6804
|
return /* @__PURE__ */ import_react65.default.createElement(
|
|
6783
6805
|
"div",
|
|
6784
6806
|
{
|
|
6785
|
-
className: (0,
|
|
6807
|
+
className: (0, import_classnames31.default)(
|
|
6786
6808
|
"Layer__panel",
|
|
6787
6809
|
className,
|
|
6788
6810
|
sidebarIsOpen && "Layer__panel--open"
|
|
@@ -6864,6 +6886,209 @@ var import_react81 = __toESM(require("react"));
|
|
|
6864
6886
|
|
|
6865
6887
|
// src/hooks/useChartOfAccounts/useChartOfAccounts.tsx
|
|
6866
6888
|
var import_react67 = require("react");
|
|
6889
|
+
|
|
6890
|
+
// src/components/ChartOfAccountsForm/constants.ts
|
|
6891
|
+
var LEDGER_ACCOUNT_TYPES = [
|
|
6892
|
+
{
|
|
6893
|
+
value: "ASSET",
|
|
6894
|
+
label: "Assets"
|
|
6895
|
+
},
|
|
6896
|
+
{
|
|
6897
|
+
value: "LIABILITY",
|
|
6898
|
+
label: "Liabilities"
|
|
6899
|
+
},
|
|
6900
|
+
{
|
|
6901
|
+
value: "EQUITY",
|
|
6902
|
+
label: "Equities"
|
|
6903
|
+
},
|
|
6904
|
+
{
|
|
6905
|
+
value: "REVENUE",
|
|
6906
|
+
label: "Revenue"
|
|
6907
|
+
},
|
|
6908
|
+
{
|
|
6909
|
+
value: "EXPENSE",
|
|
6910
|
+
label: "Expenses"
|
|
6911
|
+
}
|
|
6912
|
+
];
|
|
6913
|
+
var DEFAULT_ACCOUNT_TYPE_DIRECTION = {
|
|
6914
|
+
ASSET: "DEBIT" /* DEBIT */,
|
|
6915
|
+
LIABILITY: "CREDIT" /* CREDIT */,
|
|
6916
|
+
EQUITY: "CREDIT" /* CREDIT */,
|
|
6917
|
+
REVENUE: "CREDIT" /* CREDIT */,
|
|
6918
|
+
EXPENSE: "DEBIT" /* DEBIT */
|
|
6919
|
+
};
|
|
6920
|
+
var NORMALITY_OPTIONS = [
|
|
6921
|
+
{
|
|
6922
|
+
value: "DEBIT" /* DEBIT */,
|
|
6923
|
+
label: "Debit"
|
|
6924
|
+
},
|
|
6925
|
+
{
|
|
6926
|
+
value: "CREDIT" /* CREDIT */,
|
|
6927
|
+
label: "Credit"
|
|
6928
|
+
}
|
|
6929
|
+
];
|
|
6930
|
+
var ASSET_LEDGER_ACCOUNT_SUBTYPES = [
|
|
6931
|
+
{
|
|
6932
|
+
value: "BANK_ACCOUNTS",
|
|
6933
|
+
label: "Bank Accounts"
|
|
6934
|
+
},
|
|
6935
|
+
{
|
|
6936
|
+
value: "ACCOUNTS_RECEIVABLE",
|
|
6937
|
+
label: "Accounts Receivable"
|
|
6938
|
+
},
|
|
6939
|
+
{
|
|
6940
|
+
value: "INVENTORY",
|
|
6941
|
+
label: "Inventory"
|
|
6942
|
+
},
|
|
6943
|
+
{
|
|
6944
|
+
value: "PAYMENT_PROCESSOR_CLEARING_ACCOUNT",
|
|
6945
|
+
label: "Payment Processor Clearing Accounts"
|
|
6946
|
+
},
|
|
6947
|
+
{
|
|
6948
|
+
value: "FIXED_ASSET",
|
|
6949
|
+
label: "Fixed Assets"
|
|
6950
|
+
},
|
|
6951
|
+
{
|
|
6952
|
+
value: "CASH",
|
|
6953
|
+
label: "Cash"
|
|
6954
|
+
},
|
|
6955
|
+
{
|
|
6956
|
+
value: "UNDEPOSITED_FUNDS",
|
|
6957
|
+
label: "Undeposited Funds"
|
|
6958
|
+
}
|
|
6959
|
+
];
|
|
6960
|
+
var LIABILITY_LEDGER_ACCOUNT_SUBTYPES = [
|
|
6961
|
+
{
|
|
6962
|
+
value: "LIABILITY",
|
|
6963
|
+
label: "Liabilities"
|
|
6964
|
+
},
|
|
6965
|
+
{
|
|
6966
|
+
value: "ACCOUNTS_PAYABLE",
|
|
6967
|
+
label: "Accounts Payable"
|
|
6968
|
+
},
|
|
6969
|
+
{
|
|
6970
|
+
value: "CREDIT_CARD",
|
|
6971
|
+
label: "Credit Cards"
|
|
6972
|
+
},
|
|
6973
|
+
{
|
|
6974
|
+
value: "SHAREHOLDER_LOAN",
|
|
6975
|
+
label: "Shareholder Loans"
|
|
6976
|
+
},
|
|
6977
|
+
{
|
|
6978
|
+
value: "PAYROLL_LIABILITY",
|
|
6979
|
+
label: "Payroll Liabilities"
|
|
6980
|
+
},
|
|
6981
|
+
{
|
|
6982
|
+
value: "SALES_TAXES_PAYABLE",
|
|
6983
|
+
label: "Sales Taxes Payable"
|
|
6984
|
+
},
|
|
6985
|
+
{
|
|
6986
|
+
value: "LINE_OF_CREDIT",
|
|
6987
|
+
label: "Lines of Credit"
|
|
6988
|
+
},
|
|
6989
|
+
{
|
|
6990
|
+
value: "NOTES_PAYABLE",
|
|
6991
|
+
label: "Notes Payable"
|
|
6992
|
+
},
|
|
6993
|
+
{
|
|
6994
|
+
value: "TIPS",
|
|
6995
|
+
label: "Tips"
|
|
6996
|
+
},
|
|
6997
|
+
{
|
|
6998
|
+
value: "UNEARNED_REVENUE",
|
|
6999
|
+
label: "Unearned Revenue"
|
|
7000
|
+
},
|
|
7001
|
+
{
|
|
7002
|
+
value: "UNDEPOSITED_OUTFLOWS",
|
|
7003
|
+
label: "Undeposited Outflows"
|
|
7004
|
+
}
|
|
7005
|
+
];
|
|
7006
|
+
var EQUITY_LEDGER_ACCOUNT_SUBTYPES = [
|
|
7007
|
+
{
|
|
7008
|
+
value: "CONTRIBUTIONS",
|
|
7009
|
+
label: "Contributions"
|
|
7010
|
+
},
|
|
7011
|
+
{
|
|
7012
|
+
value: "DISTRIBUTIONS",
|
|
7013
|
+
label: "Distributions"
|
|
7014
|
+
},
|
|
7015
|
+
{
|
|
7016
|
+
value: "COMMON_STOCK",
|
|
7017
|
+
label: "Common Stock"
|
|
7018
|
+
},
|
|
7019
|
+
{
|
|
7020
|
+
value: "ADDITIONAL_PAID_IN_CAPITAL",
|
|
7021
|
+
label: "Additional Paid In Capital"
|
|
7022
|
+
},
|
|
7023
|
+
{
|
|
7024
|
+
value: "RETAINED_EARNINGS",
|
|
7025
|
+
label: "Retained Earnings"
|
|
7026
|
+
},
|
|
7027
|
+
{
|
|
7028
|
+
value: "ACCUMULATED_ADJUSTMENTS",
|
|
7029
|
+
label: "Accumulated Adjustments"
|
|
7030
|
+
},
|
|
7031
|
+
{
|
|
7032
|
+
value: "OPENING_BALANCE_EQUITY",
|
|
7033
|
+
label: "Opening Balance Equity"
|
|
7034
|
+
}
|
|
7035
|
+
];
|
|
7036
|
+
var REVENUE_LEDGER_ACCOUNT_SUBTYPES = [
|
|
7037
|
+
{
|
|
7038
|
+
value: "SALES",
|
|
7039
|
+
label: "Sales"
|
|
7040
|
+
},
|
|
7041
|
+
{
|
|
7042
|
+
value: "UNCATEGORIZED_REVENUE",
|
|
7043
|
+
label: "Uncategorized Revenue"
|
|
7044
|
+
},
|
|
7045
|
+
{
|
|
7046
|
+
value: "RETURNS_ALLOWANCES",
|
|
7047
|
+
label: "Returns & Allowances"
|
|
7048
|
+
}
|
|
7049
|
+
];
|
|
7050
|
+
var EXPENSE_LEDGER_ACCOUNT_SUBTYPES = [
|
|
7051
|
+
{
|
|
7052
|
+
value: "COGS",
|
|
7053
|
+
label: "COGS"
|
|
7054
|
+
},
|
|
7055
|
+
{
|
|
7056
|
+
value: "OPERATING_EXPENSES",
|
|
7057
|
+
label: "Operating Expenses"
|
|
7058
|
+
},
|
|
7059
|
+
{
|
|
7060
|
+
value: "PAYROLL",
|
|
7061
|
+
label: "Payroll"
|
|
7062
|
+
},
|
|
7063
|
+
{
|
|
7064
|
+
value: "TAXES_LICENSES",
|
|
7065
|
+
label: "Taxes & Licenses"
|
|
7066
|
+
},
|
|
7067
|
+
{
|
|
7068
|
+
value: "BAD_DEBT",
|
|
7069
|
+
label: "Bad Debt"
|
|
7070
|
+
},
|
|
7071
|
+
{
|
|
7072
|
+
value: "CHARITABLE_CONTRIBUTIONS",
|
|
7073
|
+
label: "Charitable Contributions"
|
|
7074
|
+
}
|
|
7075
|
+
];
|
|
7076
|
+
var LEDGER_ACCOUNT_SUBTYPES = [
|
|
7077
|
+
...ASSET_LEDGER_ACCOUNT_SUBTYPES,
|
|
7078
|
+
...LIABILITY_LEDGER_ACCOUNT_SUBTYPES,
|
|
7079
|
+
...EQUITY_LEDGER_ACCOUNT_SUBTYPES,
|
|
7080
|
+
...REVENUE_LEDGER_ACCOUNT_SUBTYPES,
|
|
7081
|
+
...EXPENSE_LEDGER_ACCOUNT_SUBTYPES
|
|
7082
|
+
];
|
|
7083
|
+
var LEDGER_ACCOUNT_SUBTYPES_FOR_TYPE = {
|
|
7084
|
+
ASSET: ASSET_LEDGER_ACCOUNT_SUBTYPES,
|
|
7085
|
+
LIABILITY: LIABILITY_LEDGER_ACCOUNT_SUBTYPES,
|
|
7086
|
+
EQUITY: EQUITY_LEDGER_ACCOUNT_SUBTYPES,
|
|
7087
|
+
REVENUE: REVENUE_LEDGER_ACCOUNT_SUBTYPES,
|
|
7088
|
+
EXPENSE: EXPENSE_LEDGER_ACCOUNT_SUBTYPES
|
|
7089
|
+
};
|
|
7090
|
+
|
|
7091
|
+
// src/hooks/useChartOfAccounts/useChartOfAccounts.tsx
|
|
6867
7092
|
var import_swr6 = __toESM(require("swr"));
|
|
6868
7093
|
var validate = (formData) => {
|
|
6869
7094
|
const errors = [];
|
|
@@ -6871,20 +7096,67 @@ var validate = (formData) => {
|
|
|
6871
7096
|
if (nameError) {
|
|
6872
7097
|
errors.push(nameError);
|
|
6873
7098
|
}
|
|
7099
|
+
const normalityError = validateNormality(formData);
|
|
7100
|
+
if (normalityError) {
|
|
7101
|
+
errors.push(normalityError);
|
|
7102
|
+
}
|
|
7103
|
+
const typeError = validateType(formData);
|
|
7104
|
+
if (typeError) {
|
|
7105
|
+
errors.push(typeError);
|
|
7106
|
+
}
|
|
6874
7107
|
return errors;
|
|
6875
7108
|
};
|
|
6876
7109
|
var revalidateField = (fieldName, formData) => {
|
|
6877
7110
|
switch (fieldName) {
|
|
6878
|
-
case "name":
|
|
7111
|
+
case "name": {
|
|
6879
7112
|
const nameError = validateName(formData);
|
|
6880
7113
|
if (nameError) {
|
|
6881
7114
|
return (formData?.errors || []).filter((x) => x.field !== fieldName).concat([nameError]);
|
|
6882
7115
|
}
|
|
6883
7116
|
return (formData?.errors || []).filter((x) => x.field !== fieldName);
|
|
7117
|
+
}
|
|
7118
|
+
case "normality": {
|
|
7119
|
+
const normalityError = validateNormality(formData);
|
|
7120
|
+
if (normalityError) {
|
|
7121
|
+
return (formData?.errors || []).filter((x) => x.field !== fieldName).concat([normalityError]);
|
|
7122
|
+
}
|
|
7123
|
+
return (formData?.errors || []).filter((x) => x.field !== fieldName);
|
|
7124
|
+
}
|
|
7125
|
+
case "type": {
|
|
7126
|
+
const typeError = validateType(formData);
|
|
7127
|
+
if (typeError) {
|
|
7128
|
+
return (formData?.errors || []).filter((x) => x.field !== fieldName).concat([typeError]);
|
|
7129
|
+
}
|
|
7130
|
+
return (formData?.errors || []).filter((x) => x.field !== fieldName);
|
|
7131
|
+
}
|
|
6884
7132
|
default:
|
|
6885
7133
|
return formData?.errors;
|
|
6886
7134
|
}
|
|
6887
7135
|
};
|
|
7136
|
+
var validateType = (formData) => {
|
|
7137
|
+
if (!formData?.data.type?.value) {
|
|
7138
|
+
return {
|
|
7139
|
+
field: "type",
|
|
7140
|
+
message: "Must be selected"
|
|
7141
|
+
};
|
|
7142
|
+
}
|
|
7143
|
+
return;
|
|
7144
|
+
};
|
|
7145
|
+
var validateNormality = (formData) => {
|
|
7146
|
+
const stringValueNormality = formData?.data.normality?.value?.toString();
|
|
7147
|
+
if (stringValueNormality === void 0) {
|
|
7148
|
+
return {
|
|
7149
|
+
field: "normality",
|
|
7150
|
+
message: "Must be selected"
|
|
7151
|
+
};
|
|
7152
|
+
} else if (!["DEBIT", "CREDIT"].includes(stringValueNormality)) {
|
|
7153
|
+
return {
|
|
7154
|
+
field: "normality",
|
|
7155
|
+
message: "Must be selected"
|
|
7156
|
+
};
|
|
7157
|
+
}
|
|
7158
|
+
return;
|
|
7159
|
+
};
|
|
6888
7160
|
var validateName = (formData) => {
|
|
6889
7161
|
if (!formData?.data.name?.trim()) {
|
|
6890
7162
|
return {
|
|
@@ -6902,7 +7174,7 @@ var useChartOfAccounts = () => {
|
|
|
6902
7174
|
const [apiError, setApiError] = (0, import_react67.useState)(void 0);
|
|
6903
7175
|
const { data, isLoading, isValidating, error, mutate } = (0, import_swr6.default)(
|
|
6904
7176
|
businessId && auth?.access_token && `chart-of-accounts-${businessId}`,
|
|
6905
|
-
Layer.
|
|
7177
|
+
Layer.getLedgerAccountBalances(apiUrl, auth?.access_token, {
|
|
6906
7178
|
params: { businessId }
|
|
6907
7179
|
})
|
|
6908
7180
|
);
|
|
@@ -6925,14 +7197,8 @@ var useChartOfAccounts = () => {
|
|
|
6925
7197
|
const update = async (accountData, accountId) => {
|
|
6926
7198
|
setSendingForm(true);
|
|
6927
7199
|
setApiError(void 0);
|
|
6928
|
-
const stable_name = convertToStableName(accountData.name);
|
|
6929
7200
|
const newAccountData = {
|
|
6930
|
-
...accountData
|
|
6931
|
-
stable_name,
|
|
6932
|
-
pnl_category: "INCOME",
|
|
6933
|
-
//this field will be deprecated soon, but is still required
|
|
6934
|
-
always_show_in_pnl: false
|
|
6935
|
-
//this field will be deprecated soon, but is still required
|
|
7201
|
+
...accountData
|
|
6936
7202
|
};
|
|
6937
7203
|
try {
|
|
6938
7204
|
await Layer.updateAccount(apiUrl, auth?.access_token, {
|
|
@@ -6961,12 +7227,14 @@ var useChartOfAccounts = () => {
|
|
|
6961
7227
|
}
|
|
6962
7228
|
const data2 = {
|
|
6963
7229
|
name: form.data.name ?? "",
|
|
6964
|
-
|
|
7230
|
+
stable_name: form.data.stable_name,
|
|
6965
7231
|
parent_id: form.data.parent ? {
|
|
6966
7232
|
type: "AccountId",
|
|
6967
7233
|
id: form.data.parent.value
|
|
6968
7234
|
} : void 0,
|
|
6969
|
-
|
|
7235
|
+
account_type: form.data.type.value.toString(),
|
|
7236
|
+
account_subtype: form.data.subType?.value.toString(),
|
|
7237
|
+
normality: form.data.normality?.value
|
|
6970
7238
|
};
|
|
6971
7239
|
if (form.action === "new") {
|
|
6972
7240
|
create(data2);
|
|
@@ -6983,12 +7251,9 @@ var useChartOfAccounts = () => {
|
|
|
6983
7251
|
data: {
|
|
6984
7252
|
parent: void 0,
|
|
6985
7253
|
name: void 0,
|
|
6986
|
-
type:
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
},
|
|
6990
|
-
subType: void 0,
|
|
6991
|
-
category: void 0
|
|
7254
|
+
type: void 0,
|
|
7255
|
+
normality: void 0,
|
|
7256
|
+
subType: void 0
|
|
6992
7257
|
}
|
|
6993
7258
|
});
|
|
6994
7259
|
const editAccount = (id) => {
|
|
@@ -7008,13 +7273,19 @@ var useChartOfAccounts = () => {
|
|
|
7008
7273
|
value: parent.id,
|
|
7009
7274
|
label: parent.name
|
|
7010
7275
|
} : void 0,
|
|
7276
|
+
stable_name: found.stable_name,
|
|
7011
7277
|
name: found.name,
|
|
7012
7278
|
type: {
|
|
7013
|
-
value:
|
|
7014
|
-
label:
|
|
7279
|
+
value: found.account_type.value,
|
|
7280
|
+
label: found.account_type.display_name
|
|
7015
7281
|
},
|
|
7016
|
-
subType:
|
|
7017
|
-
|
|
7282
|
+
subType: found.account_subtype ? {
|
|
7283
|
+
value: found.account_subtype?.value,
|
|
7284
|
+
label: found.account_subtype?.display_name
|
|
7285
|
+
} : void 0,
|
|
7286
|
+
normality: NORMALITY_OPTIONS.find(
|
|
7287
|
+
(normalityOption) => normalityOption.value == found.normality
|
|
7288
|
+
)
|
|
7018
7289
|
}
|
|
7019
7290
|
});
|
|
7020
7291
|
};
|
|
@@ -7023,13 +7294,41 @@ var useChartOfAccounts = () => {
|
|
|
7023
7294
|
if (!form) {
|
|
7024
7295
|
return;
|
|
7025
7296
|
}
|
|
7026
|
-
|
|
7297
|
+
let newFormData = {
|
|
7027
7298
|
...form,
|
|
7028
7299
|
data: {
|
|
7029
7300
|
...form.data,
|
|
7030
7301
|
[fieldName]: value
|
|
7031
7302
|
}
|
|
7032
7303
|
};
|
|
7304
|
+
if (fieldName === "parent") {
|
|
7305
|
+
const allAccounts = flattenAccounts(data?.data?.accounts || []);
|
|
7306
|
+
const foundParent = allAccounts?.find(
|
|
7307
|
+
(x) => x.id === value.value
|
|
7308
|
+
);
|
|
7309
|
+
if (foundParent) {
|
|
7310
|
+
newFormData = {
|
|
7311
|
+
...newFormData,
|
|
7312
|
+
data: {
|
|
7313
|
+
...newFormData.data,
|
|
7314
|
+
/* Inherit the parent's type */
|
|
7315
|
+
type: {
|
|
7316
|
+
value: foundParent.account_type.value,
|
|
7317
|
+
label: foundParent.account_type.display_name
|
|
7318
|
+
},
|
|
7319
|
+
/* If the parent has a subtype, inherit it */
|
|
7320
|
+
subType: foundParent.account_subtype ? {
|
|
7321
|
+
value: foundParent.account_subtype?.value,
|
|
7322
|
+
label: foundParent.account_subtype?.display_name
|
|
7323
|
+
} : void 0,
|
|
7324
|
+
/* Inherit the parent's normality */
|
|
7325
|
+
normality: NORMALITY_OPTIONS.find(
|
|
7326
|
+
(normalityOption) => normalityOption.value == foundParent.normality
|
|
7327
|
+
)
|
|
7328
|
+
}
|
|
7329
|
+
};
|
|
7330
|
+
}
|
|
7331
|
+
}
|
|
7033
7332
|
const errors = revalidateField(fieldName, newFormData);
|
|
7034
7333
|
setForm({
|
|
7035
7334
|
...newFormData,
|
|
@@ -7134,7 +7433,7 @@ var Edit2 = ({ size = 18, ...props }) => /* @__PURE__ */ React83.createElement(
|
|
|
7134
7433
|
var Edit2_default = Edit2;
|
|
7135
7434
|
|
|
7136
7435
|
// src/components/ChartOfAccountsRow/ChartOfAccountsRow.tsx
|
|
7137
|
-
var
|
|
7436
|
+
var import_classnames32 = __toESM(require("classnames"));
|
|
7138
7437
|
var INDENTATION = 24;
|
|
7139
7438
|
var MOBILE_INDENTATION = 12;
|
|
7140
7439
|
var EXPANDED_STYLE = {
|
|
@@ -7183,7 +7482,7 @@ var ChartOfAccountsRow = ({
|
|
|
7183
7482
|
}, cumulativeIndex * 50);
|
|
7184
7483
|
return () => clearTimeout(timeoutId);
|
|
7185
7484
|
}, []);
|
|
7186
|
-
const baseClass = (0,
|
|
7485
|
+
const baseClass = (0, import_classnames32.default)(
|
|
7187
7486
|
"Layer__table-row",
|
|
7188
7487
|
isOpen ? "Layer__table-row--expanded" : "Layer__table-row--collapsed",
|
|
7189
7488
|
!expanded && "Layer__table-row--hidden",
|
|
@@ -7191,11 +7490,11 @@ var ChartOfAccountsRow = ({
|
|
|
7191
7490
|
form?.accountId === account.id && "Layer__table-row--active",
|
|
7192
7491
|
!showComponent && "Layer__table-row--anim-starting-state"
|
|
7193
7492
|
);
|
|
7194
|
-
const desktopRowClass = (0,
|
|
7493
|
+
const desktopRowClass = (0, import_classnames32.default)(
|
|
7195
7494
|
baseClass,
|
|
7196
7495
|
"Layer__chart-of-accounts__row---desktop"
|
|
7197
7496
|
);
|
|
7198
|
-
const mobileRowClass = (0,
|
|
7497
|
+
const mobileRowClass = (0, import_classnames32.default)(
|
|
7199
7498
|
baseClass,
|
|
7200
7499
|
"Layer__chart-of-accounts__row---mobile"
|
|
7201
7500
|
);
|
|
@@ -7236,7 +7535,7 @@ var ChartOfAccountsRow = ({
|
|
|
7236
7535
|
className: "Layer__table-cell-content Layer__mobile--hidden",
|
|
7237
7536
|
style
|
|
7238
7537
|
},
|
|
7239
|
-
account.
|
|
7538
|
+
account.account_type?.display_name
|
|
7240
7539
|
), /* @__PURE__ */ import_react69.default.createElement(
|
|
7241
7540
|
"span",
|
|
7242
7541
|
{
|
|
@@ -7251,9 +7550,9 @@ var ChartOfAccountsRow = ({
|
|
|
7251
7550
|
},
|
|
7252
7551
|
account.normality
|
|
7253
7552
|
),
|
|
7254
|
-
/* @__PURE__ */ import_react69.default.createElement(Text, { className: "Layer__coa__subtype--mobile" },
|
|
7553
|
+
/* @__PURE__ */ import_react69.default.createElement(Text, { className: "Layer__coa__subtype--mobile" }, account.account_subtype?.display_name)
|
|
7255
7554
|
)),
|
|
7256
|
-
/* @__PURE__ */ import_react69.default.createElement("td", { className: "Layer__table-cell Layer__coa__subtype Layer__mobile--hidden" }, /* @__PURE__ */ import_react69.default.createElement("span", { className: "Layer__table-cell-content", style },
|
|
7555
|
+
/* @__PURE__ */ import_react69.default.createElement("td", { className: "Layer__table-cell Layer__coa__subtype Layer__mobile--hidden" }, /* @__PURE__ */ import_react69.default.createElement("span", { className: "Layer__table-cell-content", style }, account.account_subtype?.display_name)),
|
|
7257
7556
|
/* @__PURE__ */ import_react69.default.createElement("td", { className: "Layer__table-cell Layer__coa__balance" }, /* @__PURE__ */ import_react69.default.createElement(
|
|
7258
7557
|
"span",
|
|
7259
7558
|
{
|
|
@@ -7355,18 +7654,6 @@ var import_react72 = __toESM(require("react"));
|
|
|
7355
7654
|
// src/components/ChartOfAccountsForm/ChartOfAccountsForm.tsx
|
|
7356
7655
|
var import_react71 = __toESM(require("react"));
|
|
7357
7656
|
|
|
7358
|
-
// src/components/ChartOfAccountsForm/constants.ts
|
|
7359
|
-
var SUB_TYPE_OPTIONS = [
|
|
7360
|
-
{
|
|
7361
|
-
value: "DEBIT" /* DEBIT */,
|
|
7362
|
-
label: "Debit"
|
|
7363
|
-
},
|
|
7364
|
-
{
|
|
7365
|
-
value: "CREDIT" /* CREDIT */,
|
|
7366
|
-
label: "Credit"
|
|
7367
|
-
}
|
|
7368
|
-
];
|
|
7369
|
-
|
|
7370
7657
|
// src/components/ChartOfAccountsForm/useParentOptions.ts
|
|
7371
7658
|
var import_react70 = require("react");
|
|
7372
7659
|
var useParentOptions = (data) => (0, import_react70.useMemo)(
|
|
@@ -7470,25 +7757,31 @@ var ChartOfAccountsForm = () => {
|
|
|
7470
7757
|
)), /* @__PURE__ */ import_react71.default.createElement(InputGroup, { name: "type", label: "Type", inline: true }, /* @__PURE__ */ import_react71.default.createElement(
|
|
7471
7758
|
Select2,
|
|
7472
7759
|
{
|
|
7473
|
-
options:
|
|
7474
|
-
disabled: true,
|
|
7760
|
+
options: LEDGER_ACCOUNT_TYPES,
|
|
7475
7761
|
value: form?.data.type,
|
|
7476
|
-
onChange: (sel) => changeFormData("type", sel)
|
|
7762
|
+
onChange: (sel) => changeFormData("type", sel),
|
|
7763
|
+
isInvalid: Boolean(form?.errors?.find((x) => x.field === "type")),
|
|
7764
|
+
errorMessage: form?.errors?.find((x) => x.field === "type")?.message,
|
|
7765
|
+
disabled: sendingForm || form.action === "edit" || form.data.parent !== void 0
|
|
7477
7766
|
}
|
|
7478
7767
|
)), /* @__PURE__ */ import_react71.default.createElement(InputGroup, { name: "subType", label: "Sub-Type", inline: true }, /* @__PURE__ */ import_react71.default.createElement(
|
|
7479
7768
|
Select2,
|
|
7480
7769
|
{
|
|
7481
|
-
options:
|
|
7770
|
+
options: form?.data.type?.value !== void 0 ? LEDGER_ACCOUNT_SUBTYPES_FOR_TYPE[form?.data.type?.value] : LEDGER_ACCOUNT_SUBTYPES,
|
|
7482
7771
|
value: form?.data.subType,
|
|
7483
7772
|
onChange: (sel) => changeFormData("subType", sel),
|
|
7484
7773
|
disabled: sendingForm
|
|
7485
7774
|
}
|
|
7486
|
-
)), /* @__PURE__ */ import_react71.default.createElement(InputGroup, { name: "
|
|
7775
|
+
)), /* @__PURE__ */ import_react71.default.createElement(InputGroup, { name: "normality", label: "Normality", inline: true }, /* @__PURE__ */ import_react71.default.createElement(
|
|
7487
7776
|
Select2,
|
|
7488
7777
|
{
|
|
7489
|
-
options:
|
|
7490
|
-
value: form?.data.
|
|
7491
|
-
|
|
7778
|
+
options: NORMALITY_OPTIONS,
|
|
7779
|
+
value: form?.data.normality,
|
|
7780
|
+
isInvalid: Boolean(
|
|
7781
|
+
form?.errors?.find((x) => x.field === "normality")
|
|
7782
|
+
),
|
|
7783
|
+
errorMessage: form?.errors?.find((x) => x.field === "normality")?.message,
|
|
7784
|
+
onChange: (sel) => changeFormData("normality", sel),
|
|
7492
7785
|
disabled: sendingForm
|
|
7493
7786
|
}
|
|
7494
7787
|
)))
|
|
@@ -7577,9 +7870,9 @@ var import_react78 = __toESM(require("react"));
|
|
|
7577
7870
|
|
|
7578
7871
|
// src/components/Card/Card.tsx
|
|
7579
7872
|
var import_react74 = __toESM(require("react"));
|
|
7580
|
-
var
|
|
7873
|
+
var import_classnames33 = __toESM(require("classnames"));
|
|
7581
7874
|
var Card = ({ children, className }) => {
|
|
7582
|
-
return /* @__PURE__ */ import_react74.default.createElement("div", { className: (0,
|
|
7875
|
+
return /* @__PURE__ */ import_react74.default.createElement("div", { className: (0, import_classnames33.default)("Layer__card", className) }, children);
|
|
7583
7876
|
};
|
|
7584
7877
|
|
|
7585
7878
|
// src/components/DateTime/DateTime.tsx
|
|
@@ -7621,14 +7914,14 @@ var DateTime = ({
|
|
|
7621
7914
|
|
|
7622
7915
|
// src/components/DetailsList/DetailsList.tsx
|
|
7623
7916
|
var import_react76 = __toESM(require("react"));
|
|
7624
|
-
var
|
|
7917
|
+
var import_classnames34 = __toESM(require("classnames"));
|
|
7625
7918
|
var DetailsList = ({
|
|
7626
7919
|
title,
|
|
7627
7920
|
children,
|
|
7628
7921
|
className,
|
|
7629
7922
|
actions
|
|
7630
7923
|
}) => {
|
|
7631
|
-
return /* @__PURE__ */ import_react76.default.createElement("div", { className: (0,
|
|
7924
|
+
return /* @__PURE__ */ import_react76.default.createElement("div", { className: (0, import_classnames34.default)("Layer__details-list", className) }, title && /* @__PURE__ */ import_react76.default.createElement(Header, null, /* @__PURE__ */ import_react76.default.createElement(Heading, { size: "secondary" /* secondary */ }, title), actions && /* @__PURE__ */ import_react76.default.createElement("div", { className: "Layer__details-list__actions" }, actions)), /* @__PURE__ */ import_react76.default.createElement("ul", { className: "Layer__details-list__list" }, children));
|
|
7632
7925
|
};
|
|
7633
7926
|
|
|
7634
7927
|
// src/components/DetailsList/DetailsListItem.tsx
|
|
@@ -7648,6 +7941,40 @@ var DetailsListItem = ({
|
|
|
7648
7941
|
};
|
|
7649
7942
|
|
|
7650
7943
|
// src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
|
|
7944
|
+
var SourceDetailView = ({ source }) => {
|
|
7945
|
+
switch (source.type) {
|
|
7946
|
+
case "Transaction_Ledger_Entry_Source": {
|
|
7947
|
+
const transactionSource = source;
|
|
7948
|
+
return /* @__PURE__ */ import_react78.default.createElement(import_react78.default.Fragment, null, /* @__PURE__ */ import_react78.default.createElement(DetailsListItem, { label: "Account name" }, transactionSource.account_name), /* @__PURE__ */ import_react78.default.createElement(DetailsListItem, { label: "Date" }, /* @__PURE__ */ import_react78.default.createElement(DateTime, { value: transactionSource.date })), /* @__PURE__ */ import_react78.default.createElement(DetailsListItem, { label: "Amount" }, `$${centsToDollars(transactionSource.amount)}`), /* @__PURE__ */ import_react78.default.createElement(DetailsListItem, { label: "Direction" }, transactionSource.direction), /* @__PURE__ */ import_react78.default.createElement(DetailsListItem, { label: "Counterparty" }, transactionSource.counterparty));
|
|
7949
|
+
}
|
|
7950
|
+
case "Invoice_Ledger_Entry_Source": {
|
|
7951
|
+
const invoiceSource = source;
|
|
7952
|
+
return /* @__PURE__ */ import_react78.default.createElement(import_react78.default.Fragment, null, /* @__PURE__ */ import_react78.default.createElement(DetailsListItem, { label: "Invoice number" }, invoiceSource.invoice_number), /* @__PURE__ */ import_react78.default.createElement(DetailsListItem, { label: "Recipient name" }, invoiceSource.recipient_name), /* @__PURE__ */ import_react78.default.createElement(DetailsListItem, { label: "Date" }, /* @__PURE__ */ import_react78.default.createElement(DateTime, { value: invoiceSource.date })), /* @__PURE__ */ import_react78.default.createElement(DetailsListItem, { label: "Amount" }, `$${centsToDollars(invoiceSource.amount)}`));
|
|
7953
|
+
}
|
|
7954
|
+
case "Manual_Ledger_Entry_Source": {
|
|
7955
|
+
const manualSource = source;
|
|
7956
|
+
return /* @__PURE__ */ import_react78.default.createElement(import_react78.default.Fragment, null, /* @__PURE__ */ import_react78.default.createElement(DetailsListItem, { label: "Memo" }, manualSource.memo), /* @__PURE__ */ import_react78.default.createElement(DetailsListItem, { label: "Created by" }, manualSource.created_by));
|
|
7957
|
+
}
|
|
7958
|
+
case "Invoice_Payment_Ledger_Entry_Source": {
|
|
7959
|
+
const invoicePaymentSource = source;
|
|
7960
|
+
return /* @__PURE__ */ import_react78.default.createElement(import_react78.default.Fragment, null, /* @__PURE__ */ import_react78.default.createElement(DetailsListItem, { label: "Invoice number" }, invoicePaymentSource.invoice_number), /* @__PURE__ */ import_react78.default.createElement(DetailsListItem, { label: "Amount" }, `$${centsToDollars(invoicePaymentSource.amount)}`));
|
|
7961
|
+
}
|
|
7962
|
+
case "Refund_Ledger_Entry_Source": {
|
|
7963
|
+
const refundSource = source;
|
|
7964
|
+
return /* @__PURE__ */ import_react78.default.createElement(import_react78.default.Fragment, null, /* @__PURE__ */ import_react78.default.createElement(DetailsListItem, { label: "Amount" }, `$${centsToDollars(refundSource.refunded_to_customer_amount)}`), /* @__PURE__ */ import_react78.default.createElement(DetailsListItem, { label: "Recipient name" }, refundSource.recipient_name));
|
|
7965
|
+
}
|
|
7966
|
+
case "Opening_Balance_Ledger_Entry_Source": {
|
|
7967
|
+
const openingBalanceSource = source;
|
|
7968
|
+
return /* @__PURE__ */ import_react78.default.createElement(import_react78.default.Fragment, null, /* @__PURE__ */ import_react78.default.createElement(DetailsListItem, { label: "Account name" }, openingBalanceSource.account_name));
|
|
7969
|
+
}
|
|
7970
|
+
case "Payout_Ledger_Entry_Source": {
|
|
7971
|
+
const payoutSource = source;
|
|
7972
|
+
return /* @__PURE__ */ import_react78.default.createElement(import_react78.default.Fragment, null, /* @__PURE__ */ import_react78.default.createElement(DetailsListItem, { label: "Amount" }, `$${centsToDollars(payoutSource.paid_out_amount)}`), /* @__PURE__ */ import_react78.default.createElement(DetailsListItem, { label: "Processor" }, payoutSource.processor));
|
|
7973
|
+
}
|
|
7974
|
+
default:
|
|
7975
|
+
return null;
|
|
7976
|
+
}
|
|
7977
|
+
};
|
|
7651
7978
|
var LedgerAccountEntryDetails = () => {
|
|
7652
7979
|
const { entryData, isLoadingEntry, closeSelectedEntry, errorEntry } = (0, import_react78.useContext)(LedgerAccountsContext);
|
|
7653
7980
|
const { totalDebit, totalCredit } = (0, import_react78.useMemo)(() => {
|
|
@@ -7675,16 +8002,24 @@ var LedgerAccountEntryDetails = () => {
|
|
|
7675
8002
|
}
|
|
7676
8003
|
)
|
|
7677
8004
|
},
|
|
7678
|
-
/* @__PURE__ */ import_react78.default.createElement(DetailsListItem, { label: "Source", isLoading: isLoadingEntry }, /* @__PURE__ */ import_react78.default.createElement(Badge, null,
|
|
7679
|
-
/* @__PURE__ */ import_react78.default.createElement(
|
|
7680
|
-
|
|
7681
|
-
|
|
7682
|
-
|
|
8005
|
+
/* @__PURE__ */ import_react78.default.createElement(DetailsListItem, { label: "Source", isLoading: isLoadingEntry }, /* @__PURE__ */ import_react78.default.createElement(Badge, null, entryData?.source?.entity_name)),
|
|
8006
|
+
entryData?.source?.display_description && /* @__PURE__ */ import_react78.default.createElement(SourceDetailView, { source: entryData?.source })
|
|
8007
|
+
), /* @__PURE__ */ import_react78.default.createElement(
|
|
8008
|
+
DetailsList,
|
|
8009
|
+
{
|
|
8010
|
+
title: `Journal Entry ${entryData?.id.substring(0, 5)}`,
|
|
8011
|
+
className: "Layer__border-top"
|
|
8012
|
+
},
|
|
8013
|
+
/* @__PURE__ */ import_react78.default.createElement(DetailsListItem, { label: "Entry type", isLoading: isLoadingEntry }, humanizeEnum(entryData?.entry_type ?? "")),
|
|
8014
|
+
/* @__PURE__ */ import_react78.default.createElement(DetailsListItem, { label: "Date", isLoading: isLoadingEntry }, entryData?.entry_at && /* @__PURE__ */ import_react78.default.createElement(DateTime, { value: entryData?.entry_at })),
|
|
8015
|
+
/* @__PURE__ */ import_react78.default.createElement(DetailsListItem, { label: "Creation date", isLoading: isLoadingEntry }, entryData?.date && /* @__PURE__ */ import_react78.default.createElement(DateTime, { value: entryData?.date })),
|
|
8016
|
+
entryData?.reversal_id && /* @__PURE__ */ import_react78.default.createElement(DetailsListItem, { label: "Reversal", isLoading: isLoadingEntry }, entryData?.reversal_id.substring(0, 5))
|
|
8017
|
+
), !isLoadingEntry && !errorEntry ? /* @__PURE__ */ import_react78.default.createElement("div", { className: "Layer__ledger-account__entry-details__line-items" }, /* @__PURE__ */ import_react78.default.createElement(Card, null, /* @__PURE__ */ import_react78.default.createElement("table", { className: "Layer__table Layer__ledger-account__entry-details__table" }, /* @__PURE__ */ import_react78.default.createElement("thead", null, /* @__PURE__ */ import_react78.default.createElement("tr", null, /* @__PURE__ */ import_react78.default.createElement("th", { className: "Layer__table-header" }, "Line items"), /* @__PURE__ */ import_react78.default.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, "Debit"), /* @__PURE__ */ import_react78.default.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, "Credit"))), /* @__PURE__ */ import_react78.default.createElement("tbody", null, entryData?.line_items?.map((item) => /* @__PURE__ */ import_react78.default.createElement("tr", { key: `ledger-line-item-${item.id}` }, /* @__PURE__ */ import_react78.default.createElement("td", { className: "Layer__table-cell" }, item.account?.name || ""), /* @__PURE__ */ import_react78.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--amount" }, item.direction === "DEBIT" /* DEBIT */ && /* @__PURE__ */ import_react78.default.createElement(Badge, { variant: "warning" /* WARNING */ }, "$", centsToDollars(item.amount || 0))), /* @__PURE__ */ import_react78.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--amount" }, item.direction === "CREDIT" /* CREDIT */ && /* @__PURE__ */ import_react78.default.createElement(Badge, { variant: "success" /* SUCCESS */ }, "$", centsToDollars(item.amount || 0))))), /* @__PURE__ */ import_react78.default.createElement("tr", { className: "Layer__table Layer__ledger-account__entry-details__table__total-row" }, /* @__PURE__ */ import_react78.default.createElement("td", { className: "Layer__table-cell" }, "Total"), /* @__PURE__ */ import_react78.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--amount" }, "$", centsToDollars(totalDebit || 0)), /* @__PURE__ */ import_react78.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--amount" }, "$", centsToDollars(totalCredit || 0))))))) : null);
|
|
7683
8018
|
};
|
|
7684
8019
|
|
|
7685
8020
|
// src/components/LedgerAccount/LedgerAccountRow.tsx
|
|
7686
8021
|
var import_react79 = __toESM(require("react"));
|
|
7687
|
-
var
|
|
8022
|
+
var import_classnames35 = __toESM(require("classnames"));
|
|
7688
8023
|
var import_date_fns16 = require("date-fns");
|
|
7689
8024
|
var LedgerAccountRow = ({
|
|
7690
8025
|
row,
|
|
@@ -7708,7 +8043,7 @@ var LedgerAccountRow = ({
|
|
|
7708
8043
|
return /* @__PURE__ */ import_react79.default.createElement(
|
|
7709
8044
|
"tr",
|
|
7710
8045
|
{
|
|
7711
|
-
className: (0,
|
|
8046
|
+
className: (0, import_classnames35.default)(
|
|
7712
8047
|
"Layer__table-row",
|
|
7713
8048
|
row.entry_id === selectedEntryId && "Layer__table-row--active",
|
|
7714
8049
|
initialLoad && "initial-load",
|
|
@@ -7727,21 +8062,21 @@ var LedgerAccountRow = ({
|
|
|
7727
8062
|
/* @__PURE__ */ import_react79.default.createElement("td", { className: "Layer__table-cell Layer__ledger-account-table__tablet-main-col" }, /* @__PURE__ */ import_react79.default.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ import_react79.default.createElement("div", { className: "Layer__ledger-account-table__tablet-main-col__date" }, /* @__PURE__ */ import_react79.default.createElement(Text, null, row.date && (0, import_date_fns16.format)((0, import_date_fns16.parseISO)(row.date), DATE_FORMAT)), /* @__PURE__ */ import_react79.default.createElement(
|
|
7728
8063
|
Text,
|
|
7729
8064
|
{
|
|
7730
|
-
weight: "
|
|
8065
|
+
weight: "normal" /* normal */,
|
|
7731
8066
|
className: "Layer__ledger_account-table__journal-id"
|
|
7732
8067
|
},
|
|
7733
|
-
|
|
7734
|
-
)), /* @__PURE__ */ import_react79.default.createElement(Text, null,
|
|
8068
|
+
row.entry_id.substring(0, 5)
|
|
8069
|
+
)), /* @__PURE__ */ import_react79.default.createElement(Text, null, row.source?.display_description ?? ""))),
|
|
7735
8070
|
/* @__PURE__ */ import_react79.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ import_react79.default.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, row.direction === "DEBIT" /* DEBIT */ && `$${centsToDollars(row?.amount || 0)}`)),
|
|
7736
8071
|
/* @__PURE__ */ import_react79.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ import_react79.default.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, row.direction === "CREDIT" /* CREDIT */ && `$${centsToDollars(row?.amount || 0)}`)),
|
|
7737
|
-
/* @__PURE__ */ import_react79.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ import_react79.default.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" },
|
|
8072
|
+
/* @__PURE__ */ import_react79.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ import_react79.default.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, `$${centsToDollars(row.running_balance)}`))
|
|
7738
8073
|
);
|
|
7739
8074
|
}
|
|
7740
8075
|
if (view === "mobile") {
|
|
7741
8076
|
return /* @__PURE__ */ import_react79.default.createElement(
|
|
7742
8077
|
"tr",
|
|
7743
8078
|
{
|
|
7744
|
-
className: (0,
|
|
8079
|
+
className: (0, import_classnames35.default)(
|
|
7745
8080
|
"Layer__table-row",
|
|
7746
8081
|
row.entry_id === selectedEntryId && "Layer__table-row--active",
|
|
7747
8082
|
initialLoad && "initial-load",
|
|
@@ -7760,17 +8095,17 @@ var LedgerAccountRow = ({
|
|
|
7760
8095
|
/* @__PURE__ */ import_react79.default.createElement("td", { className: "Layer__table-cell Layer__ledger-account-table__tablet-main-col" }, /* @__PURE__ */ import_react79.default.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ import_react79.default.createElement("div", { className: "Layer__ledger-account-table__tablet-main-col__date" }, /* @__PURE__ */ import_react79.default.createElement(Text, null, row.date && (0, import_date_fns16.format)((0, import_date_fns16.parseISO)(row.date), DATE_FORMAT)), /* @__PURE__ */ import_react79.default.createElement(
|
|
7761
8096
|
Text,
|
|
7762
8097
|
{
|
|
7763
|
-
weight: "
|
|
8098
|
+
weight: "normal" /* normal */,
|
|
7764
8099
|
className: "Layer__ledger_account-table__journal-id"
|
|
7765
8100
|
},
|
|
7766
|
-
|
|
7767
|
-
)), /* @__PURE__ */ import_react79.default.createElement(Text, null,
|
|
8101
|
+
row.entry_id.substring(0, 5)
|
|
8102
|
+
)), /* @__PURE__ */ import_react79.default.createElement(Text, null, row.source?.display_description ?? ""), /* @__PURE__ */ import_react79.default.createElement("div", { className: "Layer__ledger_account-table__balances-mobile" }, /* @__PURE__ */ import_react79.default.createElement("div", { className: "Layer__ledger_account-table__balance-item" }, /* @__PURE__ */ import_react79.default.createElement("span", { className: "Layer__ledger_account-table__balances-mobile__label" }, "Debit"), /* @__PURE__ */ import_react79.default.createElement("span", { className: "Layer__ledger_account-table__balances-mobile__value" }, " ", row.direction === "DEBIT" /* DEBIT */ && `$${centsToDollars(row?.amount || 0)}`)), /* @__PURE__ */ import_react79.default.createElement("div", { className: "Layer__ledger_account-table__balance-item" }, /* @__PURE__ */ import_react79.default.createElement("span", { className: "Layer__ledger_account-table__balances-mobile__label" }, "Credit"), /* @__PURE__ */ import_react79.default.createElement("span", { className: "Layer__ledger_account-table__balances-mobile__value" }, row.direction === "CREDIT" /* CREDIT */ && `$${centsToDollars(row?.amount || 0)}`)), /* @__PURE__ */ import_react79.default.createElement("div", { className: "Layer__ledger_account-table__balance-item" }, /* @__PURE__ */ import_react79.default.createElement("span", { className: "Layer__ledger_account-table__balances-mobile__label" }, "Running balance"), /* @__PURE__ */ import_react79.default.createElement("span", { className: "Layer__ledger_account-table__balances-mobile__value" }, `$${centsToDollars(row.running_balance)}`)))))
|
|
7768
8103
|
);
|
|
7769
8104
|
}
|
|
7770
8105
|
return /* @__PURE__ */ import_react79.default.createElement(
|
|
7771
8106
|
"tr",
|
|
7772
8107
|
{
|
|
7773
|
-
className: (0,
|
|
8108
|
+
className: (0, import_classnames35.default)(
|
|
7774
8109
|
"Layer__table-row",
|
|
7775
8110
|
row.entry_id === selectedEntryId && "Layer__table-row--active",
|
|
7776
8111
|
initialLoad && "initial-load",
|
|
@@ -7787,16 +8122,16 @@ var LedgerAccountRow = ({
|
|
|
7787
8122
|
}
|
|
7788
8123
|
},
|
|
7789
8124
|
/* @__PURE__ */ import_react79.default.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ import_react79.default.createElement("span", { className: "Layer__table-cell-content" }, row.date && (0, import_date_fns16.format)((0, import_date_fns16.parseISO)(row.date), DATE_FORMAT))),
|
|
7790
|
-
/* @__PURE__ */ import_react79.default.createElement("td", { className: "Layer__table-cell
|
|
7791
|
-
/* @__PURE__ */ import_react79.default.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ import_react79.default.createElement("span", { className: "Layer__table-cell-content" },
|
|
8125
|
+
/* @__PURE__ */ import_react79.default.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ import_react79.default.createElement("span", { className: "Layer__table-cell-content" }, row.entry_id.substring(0, 5))),
|
|
8126
|
+
/* @__PURE__ */ import_react79.default.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ import_react79.default.createElement("span", { className: "Layer__table-cell-content" }, row.source?.display_description ?? "")),
|
|
7792
8127
|
/* @__PURE__ */ import_react79.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ import_react79.default.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, row.direction === "DEBIT" /* DEBIT */ && `$${centsToDollars(row?.amount || 0)}`)),
|
|
7793
8128
|
/* @__PURE__ */ import_react79.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ import_react79.default.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, row.direction === "CREDIT" /* CREDIT */ && `$${centsToDollars(row?.amount || 0)}`)),
|
|
7794
|
-
/* @__PURE__ */ import_react79.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ import_react79.default.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" },
|
|
8129
|
+
/* @__PURE__ */ import_react79.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ import_react79.default.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, `$${centsToDollars(row.running_balance)}`))
|
|
7795
8130
|
);
|
|
7796
8131
|
};
|
|
7797
8132
|
|
|
7798
8133
|
// src/components/LedgerAccount/LedgerAccountIndex.tsx
|
|
7799
|
-
var
|
|
8134
|
+
var import_classnames36 = __toESM(require("classnames"));
|
|
7800
8135
|
var LedgerAccount = ({
|
|
7801
8136
|
containerRef,
|
|
7802
8137
|
pageSize = 15,
|
|
@@ -7824,7 +8159,7 @@ var LedgerAccount = ({
|
|
|
7824
8159
|
return () => clearTimeout(timeoutLoad);
|
|
7825
8160
|
}
|
|
7826
8161
|
}, [isLoading]);
|
|
7827
|
-
const baseClassName = (0,
|
|
8162
|
+
const baseClassName = (0, import_classnames36.default)(
|
|
7828
8163
|
"Layer__ledger-account__index",
|
|
7829
8164
|
accountId && "open"
|
|
7830
8165
|
);
|