@wealthx/shadcn 1.2.2 → 1.3.0
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/.turbo/turbo-build.log +200 -156
- package/CHANGELOG.md +22 -0
- package/dist/{chunk-4Y6R4WEC.mjs → chunk-2A5RRQGG.mjs} +9 -22
- package/dist/{chunk-TS2ZX2VS.mjs → chunk-2UM72RJ7.mjs} +11 -15
- package/dist/{chunk-A56YQQHG.mjs → chunk-3NCUZIFP.mjs} +2 -2
- package/dist/chunk-3OYFOX3X.mjs +79 -0
- package/dist/{chunk-RP3SQYA3.mjs → chunk-3TTACBDP.mjs} +9 -4
- package/dist/chunk-4GAWMKMI.mjs +710 -0
- package/dist/{chunk-VGSESELX.mjs → chunk-5FQIKDKP.mjs} +5 -5
- package/dist/{chunk-K3JYD4IU.mjs → chunk-5IS7G74I.mjs} +11 -4
- package/dist/chunk-6AW4KJHE.mjs +235 -0
- package/dist/chunk-6CR5N2JW.mjs +302 -0
- package/dist/{chunk-XIRTEFKH.mjs → chunk-6DZEXFNB.mjs} +36 -8
- package/dist/chunk-6O6KD7CE.mjs +271 -0
- package/dist/chunk-7PV3IWCN.mjs +33 -0
- package/dist/{chunk-SPJ5KXW7.mjs → chunk-7S5AESZO.mjs} +5 -5
- package/dist/{chunk-RYCLWMZ7.mjs → chunk-ABFDMHOR.mjs} +9 -7
- package/dist/{chunk-SWGT756Z.mjs → chunk-AMQZRHEZ.mjs} +10 -4
- package/dist/{chunk-WAZD7NFU.mjs → chunk-BKNFWEH2.mjs} +6 -6
- package/dist/{chunk-CLIN5525.mjs → chunk-C7CQJNMR.mjs} +1 -1
- package/dist/{chunk-D4ILTPOG.mjs → chunk-CFMQP5QS.mjs} +5 -4
- package/dist/{chunk-VPBN3WOO.mjs → chunk-DGHAXJBN.mjs} +9 -7
- package/dist/chunk-DOEO3CDL.mjs +27 -0
- package/dist/{chunk-5MEWU56Z.mjs → chunk-DUJTAXMH.mjs} +11 -6
- package/dist/{chunk-GGM2UYGG.mjs → chunk-EBXQWIYG.mjs} +10 -4
- package/dist/chunk-EWRB4PAD.mjs +468 -0
- package/dist/{chunk-ZSHYDDRB.mjs → chunk-FAKPBKLT.mjs} +6 -2
- package/dist/chunk-FNQXOAYJ.mjs +169 -0
- package/dist/{chunk-A6AAWBPF.mjs → chunk-GHC7LLUX.mjs} +13 -4
- package/dist/chunk-HBZLGDIN.mjs +507 -0
- package/dist/{chunk-SIZMLSRU.mjs → chunk-HISNT2MG.mjs} +8 -6
- package/dist/{chunk-CGH4DRNG.mjs → chunk-HVY6KCCF.mjs} +10 -7
- package/dist/chunk-I3RZS7V2.mjs +136 -0
- package/dist/chunk-IAE3F7DR.mjs +1962 -0
- package/dist/{chunk-UT4KJR7V.mjs → chunk-IHMFS7NZ.mjs} +35 -74
- package/dist/{chunk-PCPLO5HT.mjs → chunk-IOJRDS6V.mjs} +96 -14
- package/dist/{chunk-LHYCMLVA.mjs → chunk-JKGDCQTZ.mjs} +11 -4
- package/dist/{chunk-H45TKD34.mjs → chunk-JMHR3YGZ.mjs} +1 -1
- package/dist/{chunk-4MN6UQHG.mjs → chunk-K5A5L6T2.mjs} +17 -39
- package/dist/chunk-LV35NGVG.mjs +272 -0
- package/dist/{chunk-FZIXGLMV.mjs → chunk-M3FV7LOK.mjs} +5 -12
- package/dist/{chunk-FMAXJ2SI.mjs → chunk-MBON7YRJ.mjs} +1 -1
- package/dist/chunk-MIZQHHUO.mjs +441 -0
- package/dist/chunk-MN5NYQCL.mjs +29 -0
- package/dist/chunk-NL3ZO62D.mjs +31 -0
- package/dist/{chunk-Q76O3RIQ.mjs → chunk-NMOI6CQD.mjs} +1 -1
- package/dist/{chunk-P6AM5V7O.mjs → chunk-OODBHKG7.mjs} +1 -1
- package/dist/chunk-PBL4OQV2.mjs +283 -0
- package/dist/{chunk-Y4QFWRNR.mjs → chunk-PU4YZQXV.mjs} +17 -18
- package/dist/chunk-QMY3AZJH.mjs +80 -0
- package/dist/{chunk-BL3DXM2X.mjs → chunk-QZ4RE6NA.mjs} +11 -4
- package/dist/{chunk-VACKZOMY.mjs → chunk-R3VSPKNP.mjs} +3 -3
- package/dist/{chunk-OPNQAVVH.mjs → chunk-RJI6GKVF.mjs} +8 -6
- package/dist/{chunk-WG6JGJXB.mjs → chunk-T4BJLT57.mjs} +1 -1
- package/dist/chunk-UMTOX62O.mjs +415 -0
- package/dist/{chunk-7MMXNK3C.mjs → chunk-VLARHE5V.mjs} +8 -6
- package/dist/{chunk-2I5S2AMY.mjs → chunk-XREGSKX3.mjs} +2 -2
- package/dist/{chunk-JNQORUPP.mjs → chunk-YJG55G2H.mjs} +14 -11
- package/dist/{chunk-ZRSDX6OW.mjs → chunk-ZC45IGZO.mjs} +33 -30
- package/dist/components/ui/add-column-modal.js +42 -14
- package/dist/components/ui/add-column-modal.mjs +5 -5
- package/dist/components/ui/add-lead-modal.js +42 -11
- package/dist/components/ui/add-lead-modal.mjs +3 -3
- package/dist/components/ui/advisor-card.js +497 -0
- package/dist/components/ui/advisor-card.mjs +13 -0
- package/dist/components/ui/ai-assistant-drawer.js +11 -10
- package/dist/components/ui/ai-assistant-drawer.mjs +3 -3
- package/dist/components/ui/alert-dialog.js +2 -2
- package/dist/components/ui/alert-dialog.mjs +2 -2
- package/dist/components/ui/appointment-action-dialogs.js +1160 -0
- package/dist/components/ui/appointment-action-dialogs.mjs +23 -0
- package/dist/components/ui/appointment-availability-settings.js +1590 -0
- package/dist/components/ui/appointment-availability-settings.mjs +23 -0
- package/dist/components/ui/appointment-book-dialog.js +1744 -0
- package/dist/components/ui/appointment-book-dialog.mjs +27 -0
- package/dist/components/ui/appointment-calendar-view.js +833 -0
- package/dist/components/ui/appointment-calendar-view.mjs +14 -0
- package/dist/components/ui/appointment-detail-sheet.js +1517 -0
- package/dist/components/ui/appointment-detail-sheet.mjs +24 -0
- package/dist/components/ui/appointment-gmail-connect.js +467 -0
- package/dist/components/ui/appointment-gmail-connect.mjs +14 -0
- package/dist/components/ui/appointment-mini-card.js +345 -0
- package/dist/components/ui/appointment-mini-card.mjs +11 -0
- package/dist/components/ui/appointment-time-slot-picker.js +311 -0
- package/dist/components/ui/appointment-time-slot-picker.mjs +13 -0
- package/dist/components/ui/appointment-upcoming-card.js +1268 -0
- package/dist/components/ui/appointment-upcoming-card.mjs +21 -0
- package/dist/components/ui/backoffice-alert-history-chart.js +11 -5
- package/dist/components/ui/backoffice-alert-history-chart.mjs +5 -4
- package/dist/components/ui/backoffice-alerts-chart.js +786 -0
- package/dist/components/ui/backoffice-alerts-chart.mjs +19 -0
- package/dist/components/ui/backoffice-connections-chart.js +817 -0
- package/dist/components/ui/backoffice-connections-chart.mjs +19 -0
- package/dist/components/ui/backoffice-contact-history-chart.js +11 -5
- package/dist/components/ui/backoffice-contact-history-chart.mjs +5 -4
- package/dist/components/ui/badge.js +6 -6
- package/dist/components/ui/badge.mjs +1 -1
- package/dist/components/ui/borrowing-capacity-line-chart.js +30 -21
- package/dist/components/ui/borrowing-capacity-line-chart.mjs +5 -4
- package/dist/components/ui/button.js +2 -2
- package/dist/components/ui/button.mjs +1 -1
- package/dist/components/ui/calendar.js +2 -2
- package/dist/components/ui/calendar.mjs +2 -2
- package/dist/components/ui/card.js +1 -1
- package/dist/components/ui/card.mjs +1 -1
- package/dist/components/ui/cash-balance-line-chart.js +31 -23
- package/dist/components/ui/cash-balance-line-chart.mjs +5 -4
- package/dist/components/ui/cashflow-bar-chart.js +12 -5
- package/dist/components/ui/cashflow-bar-chart.mjs +5 -4
- package/dist/components/ui/chip.js +97 -18
- package/dist/components/ui/chip.mjs +3 -2
- package/dist/components/ui/color-picker.js +158 -28
- package/dist/components/ui/color-picker.mjs +3 -1
- package/dist/components/ui/data-table.js +140 -119
- package/dist/components/ui/data-table.mjs +3 -2
- package/dist/components/ui/date-picker.js +48 -27
- package/dist/components/ui/date-picker.mjs +4 -3
- package/dist/components/ui/dialog.js +37 -9
- package/dist/components/ui/dialog.mjs +2 -2
- package/dist/components/ui/expense-bar-chart.js +12 -5
- package/dist/components/ui/expense-bar-chart.mjs +5 -4
- package/dist/components/ui/field.mjs +2 -2
- package/dist/components/ui/financial-cards.js +322 -155
- package/dist/components/ui/financial-cards.mjs +5 -3
- package/dist/components/ui/financial-drawers.js +2 -2
- package/dist/components/ui/financial-drawers.mjs +3 -3
- package/dist/components/ui/financial-sections.js +14 -10
- package/dist/components/ui/financial-sections.mjs +6 -5
- package/dist/components/ui/income-bar-chart.js +12 -5
- package/dist/components/ui/income-bar-chart.mjs +5 -4
- package/dist/components/ui/input-group.js +2 -2
- package/dist/components/ui/input-group.mjs +2 -2
- package/dist/components/ui/kanban-column.js +52 -44
- package/dist/components/ui/kanban-column.mjs +7 -5
- package/dist/components/ui/opportunity-card.js +52 -44
- package/dist/components/ui/opportunity-card.mjs +6 -4
- package/dist/components/ui/opportunity-edit-modals.js +1367 -1263
- package/dist/components/ui/opportunity-edit-modals.mjs +8 -8
- package/dist/components/ui/opportunity-summary-tab.js +2744 -2157
- package/dist/components/ui/opportunity-summary-tab.mjs +14 -14
- package/dist/components/ui/page-header.js +92 -0
- package/dist/components/ui/page-header.mjs +8 -0
- package/dist/components/ui/page-top-bar.js +88 -0
- package/dist/components/ui/page-top-bar.mjs +8 -0
- package/dist/components/ui/pagination.js +303 -19
- package/dist/components/ui/pagination.mjs +11 -4
- package/dist/components/ui/pipeline-board.js +205 -191
- package/dist/components/ui/pipeline-board.mjs +9 -7
- package/dist/components/ui/pipeline-dialogs.js +114 -65
- package/dist/components/ui/pipeline-dialogs.mjs +7 -6
- package/dist/components/ui/pipeline-primitives.js +6 -6
- package/dist/components/ui/pipeline-primitives.mjs +2 -2
- package/dist/components/ui/property-cashflow-doughnut-chart.js +14 -12
- package/dist/components/ui/property-cashflow-doughnut-chart.mjs +5 -4
- package/dist/components/ui/property-debt-equity-doughnut-chart.js +14 -12
- package/dist/components/ui/property-debt-equity-doughnut-chart.mjs +5 -4
- package/dist/components/ui/property-mobile-estimate-line-chart.js +16 -14
- package/dist/components/ui/property-mobile-estimate-line-chart.mjs +5 -4
- package/dist/components/ui/sidebar-nav.js +234 -95
- package/dist/components/ui/sidebar-nav.mjs +4 -1
- package/dist/components/ui/stage-timeline.js +6 -6
- package/dist/components/ui/stage-timeline.mjs +3 -3
- package/dist/components/ui/transactions-expense-categories-doughnut-chart.js +18 -16
- package/dist/components/ui/transactions-expense-categories-doughnut-chart.mjs +5 -4
- package/dist/components/ui/transactions-income-expense-bar-chart.js +28 -12
- package/dist/components/ui/transactions-income-expense-bar-chart.mjs +5 -4
- package/dist/components/ui/transactions-liabilities-breakdown-doughnut-chart.js +18 -16
- package/dist/components/ui/transactions-liabilities-breakdown-doughnut-chart.mjs +5 -4
- package/dist/index.js +12899 -9343
- package/dist/index.mjs +256 -190
- package/dist/styles.css +1 -1
- package/package.json +71 -1
- package/src/components/index.tsx +114 -9
- package/src/components/ui/add-column-modal.tsx +7 -7
- package/src/components/ui/add-lead-modal.tsx +6 -3
- package/src/components/ui/advisor-card.tsx +227 -0
- package/src/components/ui/ai-assistant-drawer.tsx +4 -3
- package/src/components/ui/appointment-action-dialogs.tsx +297 -0
- package/src/components/ui/appointment-availability-settings.tsx +645 -0
- package/src/components/ui/appointment-book-dialog.tsx +618 -0
- package/src/components/ui/appointment-calendar-view.tsx +510 -0
- package/src/components/ui/appointment-detail-sheet.tsx +415 -0
- package/src/components/ui/appointment-gmail-connect.tsx +188 -0
- package/src/components/ui/appointment-mini-card.tsx +104 -0
- package/src/components/ui/appointment-time-slot-picker.tsx +123 -0
- package/src/components/ui/appointment-upcoming-card.tsx +635 -0
- package/src/components/ui/backoffice-alert-history-chart.tsx +10 -2
- package/src/components/ui/backoffice-alerts-chart.tsx +312 -0
- package/src/components/ui/backoffice-connections-chart.tsx +339 -0
- package/src/components/ui/backoffice-contact-history-chart.tsx +10 -2
- package/src/components/ui/badge.tsx +12 -6
- package/src/components/ui/borrowing-capacity-line-chart.tsx +4 -11
- package/src/components/ui/button.tsx +2 -2
- package/src/components/ui/card.tsx +1 -1
- package/src/components/ui/cash-balance-line-chart.tsx +4 -23
- package/src/components/ui/cashflow-bar-chart.tsx +9 -2
- package/src/components/ui/chart-shared.tsx +4 -11
- package/src/components/ui/chip.tsx +23 -19
- package/src/components/ui/color-picker.tsx +4 -2
- package/src/components/ui/data-table.tsx +28 -74
- package/src/components/ui/date-picker.tsx +42 -37
- package/src/components/ui/dialog.tsx +72 -6
- package/src/components/ui/expense-bar-chart.tsx +11 -2
- package/src/components/ui/financial-cards.tsx +99 -10
- package/src/components/ui/income-bar-chart.tsx +11 -2
- package/src/components/ui/opportunity-card.tsx +10 -39
- package/src/components/ui/opportunity-edit-modals.tsx +98 -36
- package/src/components/ui/opportunity-summary-tab.tsx +548 -232
- package/src/components/ui/page-header.tsx +57 -0
- package/src/components/ui/page-top-bar.tsx +48 -0
- package/src/components/ui/pagination.tsx +171 -22
- package/src/components/ui/pipeline-board.tsx +12 -5
- package/src/components/ui/property-cashflow-doughnut-chart.tsx +3 -1
- package/src/components/ui/property-debt-equity-doughnut-chart.tsx +3 -1
- package/src/components/ui/property-mobile-estimate-line-chart.tsx +3 -1
- package/src/components/ui/sidebar-nav.tsx +36 -37
- package/src/components/ui/transactions-expense-categories-doughnut-chart.tsx +3 -1
- package/src/components/ui/transactions-income-expense-bar-chart.tsx +12 -9
- package/src/components/ui/transactions-liabilities-breakdown-doughnut-chart.tsx +3 -1
- package/src/lib/format-currency.ts +44 -0
- package/src/lib/format-date.ts +50 -0
- package/src/lib/opportunity-constants.ts +12 -0
- package/src/styles/globals.css +17 -15
- package/src/styles/styles-css.ts +1 -1
- package/tsup.config.ts +14 -0
- package/dist/chunk-S4QRUQNW.mjs +0 -475
- package/dist/chunk-URGMJAE3.mjs +0 -1885
- package/dist/chunk-WNGWBVLV.mjs +0 -148
- package/dist/{chunk-LLVQKSU3.mjs → chunk-GD4BJDJR.mjs} +3 -3
|
@@ -109,6 +109,15 @@ function cn(...inputs) {
|
|
|
109
109
|
return twMerge((0, import_clsx.clsx)(inputs));
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
// src/lib/opportunity-constants.ts
|
|
113
|
+
var PROPERTY_ASSET_TYPES = /* @__PURE__ */ new Set([
|
|
114
|
+
"Primary Residence",
|
|
115
|
+
"Investment Property",
|
|
116
|
+
"Holiday Home",
|
|
117
|
+
"Commercial Property",
|
|
118
|
+
"Rural Property"
|
|
119
|
+
]);
|
|
120
|
+
|
|
112
121
|
// src/components/ui/dialog.tsx
|
|
113
122
|
var import_lucide_react2 = require("lucide-react");
|
|
114
123
|
var import_dialog = require("@base-ui/react/dialog");
|
|
@@ -183,10 +192,10 @@ var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
|
183
192
|
default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
|
|
184
193
|
secondary: "bg-brand-secondary text-brand-secondary-foreground shadow-xs hover:bg-brand-secondary/80 focus-visible:ring-brand-secondary/30",
|
|
185
194
|
destructive: "bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
|
|
186
|
-
outline: "border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
195
|
+
outline: "border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground focus-visible:ring-border/50 dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
187
196
|
"outline-primary": "border border-primary text-foreground bg-transparent shadow-xs hover:bg-primary/5 focus-visible:ring-primary/50",
|
|
188
197
|
"outline-secondary": "border border-brand-secondary text-brand-secondary bg-transparent shadow-xs hover:bg-brand-secondary/10 focus-visible:ring-brand-secondary/30",
|
|
189
|
-
ghost: "hover:bg-accent hover:text-accent-foreground hover:shadow-xs dark:hover:bg-accent/50",
|
|
198
|
+
ghost: "hover:bg-accent hover:text-accent-foreground hover:shadow-xs focus-visible:ring-border/50 dark:hover:bg-accent/50",
|
|
190
199
|
link: "text-primary underline-offset-4 hover:underline"
|
|
191
200
|
},
|
|
192
201
|
size: {
|
|
@@ -275,38 +284,65 @@ function DialogOverlay(_a) {
|
|
|
275
284
|
}, props)
|
|
276
285
|
);
|
|
277
286
|
}
|
|
287
|
+
var DIALOG_MAX_WIDTHS = {
|
|
288
|
+
sm: "24rem",
|
|
289
|
+
md: "28rem",
|
|
290
|
+
lg: "32rem",
|
|
291
|
+
xl: "36rem",
|
|
292
|
+
"2xl": "42rem",
|
|
293
|
+
"3xl": "48rem",
|
|
294
|
+
"4xl": "56rem",
|
|
295
|
+
full: "100%"
|
|
296
|
+
};
|
|
297
|
+
var DIALOG_AUTO_MIN_WIDTH = "20rem";
|
|
278
298
|
function DialogContent(_a) {
|
|
279
299
|
var _b = _a, {
|
|
280
300
|
className,
|
|
281
301
|
children,
|
|
282
302
|
showCloseButton = true,
|
|
283
|
-
style
|
|
303
|
+
style,
|
|
304
|
+
container,
|
|
305
|
+
align = "center",
|
|
306
|
+
size = "lg",
|
|
307
|
+
minWidth
|
|
284
308
|
} = _b, props = __objRest(_b, [
|
|
285
309
|
"className",
|
|
286
310
|
"children",
|
|
287
311
|
"showCloseButton",
|
|
288
|
-
"style"
|
|
312
|
+
"style",
|
|
313
|
+
"container",
|
|
314
|
+
"align",
|
|
315
|
+
"size",
|
|
316
|
+
"minWidth"
|
|
289
317
|
]);
|
|
290
318
|
const themeVars = useThemeVars();
|
|
291
|
-
|
|
319
|
+
const isAuto = size === "auto";
|
|
320
|
+
const sizeStyle = isAuto ? { minWidth: minWidth != null ? minWidth : DIALOG_AUTO_MIN_WIDTH } : { maxWidth: DIALOG_MAX_WIDTHS[size] };
|
|
321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(DialogPortal, { container: container != null ? container : void 0, children: [
|
|
292
322
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DialogOverlay, { style: themeVars }),
|
|
293
323
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
294
324
|
import_dialog.Dialog.Popup,
|
|
295
325
|
__spreadProps(__spreadValues({
|
|
296
326
|
className: cn(
|
|
297
|
-
// WealthX: removed rounded-lg (sharp corners), shadow-lg (flat panels)
|
|
298
|
-
|
|
327
|
+
// WealthX: removed rounded-lg (sharp corners), shadow-lg (flat panels)
|
|
328
|
+
// max-w-[calc(100%-2rem)] acts as a viewport-edge guard on all sizes.
|
|
329
|
+
// Fixed max-width is applied via inline style (sizeStyle) to avoid
|
|
330
|
+
// Tailwind v4 class-scanning gaps with dynamic class lookups.
|
|
331
|
+
"fixed left-[50%] z-50 grid max-w-[calc(100%-2rem)] translate-x-[-50%] gap-4 border bg-background p-6 duration-200 outline-none data-ending-style:animate-out data-ending-style:fade-out-0 data-ending-style:zoom-out-95 data-ending-style:fill-mode-forwards data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95",
|
|
332
|
+
// "auto" → hug content (with min-width floor); fixed sizes → fill to max-width
|
|
333
|
+
isAuto ? "w-auto" : "w-full",
|
|
334
|
+
align === "center" ? "top-[50%] translate-y-[-50%]" : "top-4 translate-y-0",
|
|
299
335
|
className
|
|
300
336
|
),
|
|
301
337
|
"data-slot": "dialog-content",
|
|
302
|
-
style: __spreadValues(__spreadValues({}, themeVars), style)
|
|
338
|
+
style: __spreadValues(__spreadValues(__spreadValues({}, themeVars), sizeStyle), style)
|
|
303
339
|
}, props), {
|
|
304
340
|
children: [
|
|
305
341
|
children,
|
|
306
342
|
showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
307
343
|
import_dialog.Dialog.Close,
|
|
308
344
|
{
|
|
309
|
-
className: "absolute top-4 right-4 transition-colors hover:bg-foreground/5 focus:outline-hidden focus:ring-2 focus:ring-border focus:ring-offset-0 disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
345
|
+
className: "absolute top-4 right-4 inline-flex size-7 items-center justify-center transition-colors hover:bg-foreground/5 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-border focus-visible:ring-offset-0 disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
310
346
|
"data-slot": "dialog-close",
|
|
311
347
|
children: [
|
|
312
348
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react2.XIcon, {}),
|
|
@@ -359,6 +395,7 @@ function DialogFooter(_a) {
|
|
|
359
395
|
import_dialog.Dialog.Close,
|
|
360
396
|
{
|
|
361
397
|
className: cn(buttonVariants({ variant: "outline" })),
|
|
398
|
+
type: "button",
|
|
362
399
|
children: "Close"
|
|
363
400
|
}
|
|
364
401
|
) : null
|
|
@@ -955,6 +992,8 @@ function DatePicker({
|
|
|
955
992
|
{
|
|
956
993
|
className: cn(
|
|
957
994
|
"w-full justify-start rounded-none font-normal data-[empty=true]:text-muted-foreground",
|
|
995
|
+
// Show open/focus state when the popover is expanded
|
|
996
|
+
"aria-expanded:border-ring aria-expanded:ring-2 aria-expanded:ring-ring/20",
|
|
958
997
|
className
|
|
959
998
|
),
|
|
960
999
|
"data-empty": !value,
|
|
@@ -992,9 +1031,9 @@ function DatePicker({
|
|
|
992
1031
|
showTimePicker ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "border-t border-border px-3 pb-3 pt-2", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "mb-1.5 block text-xs font-medium text-muted-foreground", children: [
|
|
993
1032
|
"Time",
|
|
994
1033
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
995
|
-
|
|
1034
|
+
Input,
|
|
996
1035
|
{
|
|
997
|
-
className: "mt-1.5 h-8
|
|
1036
|
+
className: "mt-1.5 h-8",
|
|
998
1037
|
onChange: handleTimeChange,
|
|
999
1038
|
type: "time",
|
|
1000
1039
|
value: timeValue
|
|
@@ -1568,13 +1607,6 @@ var ASSET_TYPES = [
|
|
|
1568
1607
|
"Bonds / Fixed Income",
|
|
1569
1608
|
"Other"
|
|
1570
1609
|
];
|
|
1571
|
-
var PROPERTY_ASSET_TYPES = /* @__PURE__ */ new Set([
|
|
1572
|
-
"Primary Residence",
|
|
1573
|
-
"Investment Property",
|
|
1574
|
-
"Holiday Home",
|
|
1575
|
-
"Commercial Property",
|
|
1576
|
-
"Rural Property"
|
|
1577
|
-
]);
|
|
1578
1610
|
var PROPERTY_SUBTYPES = [
|
|
1579
1611
|
"House",
|
|
1580
1612
|
"Unit / Apartment",
|
|
@@ -1783,13 +1815,15 @@ function AccordionItemHeader({
|
|
|
1783
1815
|
}
|
|
1784
1816
|
),
|
|
1785
1817
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1786
|
-
|
|
1818
|
+
Button,
|
|
1787
1819
|
{
|
|
1788
1820
|
type: "button",
|
|
1821
|
+
variant: "ghost",
|
|
1822
|
+
size: "icon",
|
|
1789
1823
|
onClick: onRemove,
|
|
1790
|
-
className: "
|
|
1824
|
+
className: "size-8 shrink-0",
|
|
1791
1825
|
"aria-label": removeLabel,
|
|
1792
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react10.Trash2, { className: "
|
|
1826
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react10.Trash2, { className: "size-3.5 text-destructive" })
|
|
1793
1827
|
}
|
|
1794
1828
|
)
|
|
1795
1829
|
] });
|
|
@@ -1889,14 +1923,19 @@ function EditLoanScenarioModal({
|
|
|
1889
1923
|
onOpenChange,
|
|
1890
1924
|
initialData,
|
|
1891
1925
|
onSave,
|
|
1926
|
+
container,
|
|
1892
1927
|
className
|
|
1893
1928
|
}) {
|
|
1894
1929
|
const [form, setForm] = React8.useState(__spreadValues(__spreadValues({}, LOAN_SCENARIO_DEFAULTS), initialData));
|
|
1930
|
+
const initialSnapshot = React8.useRef("");
|
|
1895
1931
|
React8.useEffect(() => {
|
|
1896
1932
|
if (open) {
|
|
1897
|
-
|
|
1933
|
+
const data = __spreadValues(__spreadValues({}, LOAN_SCENARIO_DEFAULTS), initialData);
|
|
1934
|
+
setForm(data);
|
|
1935
|
+
initialSnapshot.current = JSON.stringify(data);
|
|
1898
1936
|
}
|
|
1899
1937
|
}, [open]);
|
|
1938
|
+
const isDirty = JSON.stringify(form) !== initialSnapshot.current;
|
|
1900
1939
|
const set = (key, val) => setForm((prev) => __spreadProps(__spreadValues({}, prev), { [key]: val }));
|
|
1901
1940
|
const togglePriority = (priority) => {
|
|
1902
1941
|
setForm((prev) => {
|
|
@@ -1937,801 +1976,831 @@ function EditLoanScenarioModal({
|
|
|
1937
1976
|
label: "Anticipated changes impacting repayment?"
|
|
1938
1977
|
}
|
|
1939
1978
|
];
|
|
1940
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
children:
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
onValueChange: (val) => set("propertyEstimate", val)
|
|
1963
|
-
}
|
|
1964
|
-
) }),
|
|
1965
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Cash/equity towards property", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1966
|
-
CurrencyInputWithSlider,
|
|
1967
|
-
{
|
|
1968
|
-
value: form.cashEquity,
|
|
1969
|
-
min: 0,
|
|
1970
|
-
max: 2e6,
|
|
1971
|
-
step: 5e3,
|
|
1972
|
-
onValueChange: (val) => set("cashEquity", val)
|
|
1973
|
-
}
|
|
1974
|
-
) })
|
|
1975
|
-
] }),
|
|
1976
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
1977
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Loan Amount", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1978
|
-
CurrencyInputWithSlider,
|
|
1979
|
-
{
|
|
1980
|
-
value: form.loanAmount,
|
|
1981
|
-
min: 0,
|
|
1982
|
-
max: 5e6,
|
|
1983
|
-
step: 1e4,
|
|
1984
|
-
onValueChange: (val) => set("loanAmount", val)
|
|
1985
|
-
}
|
|
1986
|
-
) }),
|
|
1987
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Loan Duration", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
1988
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1989
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1990
|
-
Input,
|
|
1979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1980
|
+
DialogContent,
|
|
1981
|
+
{
|
|
1982
|
+
className: cn("max-w-lg", className),
|
|
1983
|
+
container,
|
|
1984
|
+
children: [
|
|
1985
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogTitle, { children: "Edit Loan Scenario" }) }),
|
|
1986
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(ModalScroll, { children: [
|
|
1987
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "What would you like to do?", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1988
|
+
Select,
|
|
1989
|
+
{
|
|
1990
|
+
value: form.loanPurpose,
|
|
1991
|
+
onValueChange: (val) => set("loanPurpose", val),
|
|
1992
|
+
children: [
|
|
1993
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select purpose" }) }),
|
|
1994
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: LOAN_PURPOSES.map((p) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: p, children: p }, p)) })
|
|
1995
|
+
]
|
|
1996
|
+
}
|
|
1997
|
+
) }),
|
|
1998
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
1999
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Property Estimate", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2000
|
+
CurrencyInputWithSlider,
|
|
1991
2001
|
{
|
|
1992
|
-
|
|
1993
|
-
min:
|
|
1994
|
-
max:
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2002
|
+
value: form.propertyEstimate,
|
|
2003
|
+
min: 0,
|
|
2004
|
+
max: 1e7,
|
|
2005
|
+
step: 5e4,
|
|
2006
|
+
onValueChange: (val) => set("propertyEstimate", val)
|
|
2007
|
+
}
|
|
2008
|
+
) }),
|
|
2009
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Cash/equity towards property", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2010
|
+
CurrencyInputWithSlider,
|
|
2011
|
+
{
|
|
2012
|
+
value: form.cashEquity,
|
|
2013
|
+
min: 0,
|
|
2014
|
+
max: 2e6,
|
|
2015
|
+
step: 5e3,
|
|
2016
|
+
onValueChange: (val) => set("cashEquity", val)
|
|
2017
|
+
}
|
|
2018
|
+
) })
|
|
2019
|
+
] }),
|
|
2020
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2021
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Loan Amount", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2022
|
+
CurrencyInputWithSlider,
|
|
2023
|
+
{
|
|
2024
|
+
value: form.loanAmount,
|
|
2025
|
+
min: 0,
|
|
2026
|
+
max: 5e6,
|
|
2027
|
+
step: 1e4,
|
|
2028
|
+
onValueChange: (val) => set("loanAmount", val)
|
|
2029
|
+
}
|
|
2030
|
+
) }),
|
|
2031
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Loan Duration", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
2032
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2033
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2034
|
+
Input,
|
|
2035
|
+
{
|
|
2036
|
+
type: "number",
|
|
2037
|
+
min: 1,
|
|
2038
|
+
max: 40,
|
|
2039
|
+
value: form.loanDuration,
|
|
2040
|
+
onChange: (e) => {
|
|
2041
|
+
const parsed = parseInt(e.target.value, 10);
|
|
2042
|
+
if (!isNaN(parsed)) {
|
|
2043
|
+
set("loanDuration", Math.min(40, Math.max(1, parsed)));
|
|
2044
|
+
}
|
|
2045
|
+
},
|
|
2046
|
+
className: "flex-1"
|
|
2047
|
+
}
|
|
2048
|
+
),
|
|
2049
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-sm text-muted-foreground", children: "years" })
|
|
2050
|
+
] }),
|
|
2051
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2052
|
+
Slider,
|
|
2053
|
+
{
|
|
2054
|
+
min: 1,
|
|
2055
|
+
max: 40,
|
|
2056
|
+
step: 1,
|
|
2057
|
+
value: form.loanDuration,
|
|
2058
|
+
onValueChange: (val) => set("loanDuration", val)
|
|
2059
|
+
}
|
|
2060
|
+
)
|
|
2061
|
+
] }) })
|
|
2062
|
+
] }),
|
|
2063
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Do you know what loan features you want?", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2064
|
+
Select,
|
|
2065
|
+
{
|
|
2066
|
+
value: form.knowsFeatures,
|
|
2067
|
+
onValueChange: (val) => set("knowsFeatures", val),
|
|
2068
|
+
children: [
|
|
2069
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select" }) }),
|
|
2070
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(SelectContent, { children: [
|
|
2071
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: "Yes", children: "Yes" }),
|
|
2072
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: "No", children: "No" })
|
|
2073
|
+
] })
|
|
2074
|
+
]
|
|
2075
|
+
}
|
|
2076
|
+
) }),
|
|
2077
|
+
form.knowsFeatures === "Yes" && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
2078
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Label, { className: "text-sm font-medium text-muted-foreground", children: "What features are important to you?" }),
|
|
2079
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "grid grid-cols-2 gap-2", children: LOAN_FEATURES.map(({ key, label }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2080
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2081
|
+
Checkbox,
|
|
2082
|
+
{
|
|
2083
|
+
id: `feature-${key}`,
|
|
2084
|
+
checked: form[key],
|
|
2085
|
+
onCheckedChange: (checked) => set(key, checked === true)
|
|
2086
|
+
}
|
|
2087
|
+
),
|
|
2088
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2089
|
+
"label",
|
|
2090
|
+
{
|
|
2091
|
+
htmlFor: `feature-${key}`,
|
|
2092
|
+
className: "text-sm cursor-pointer select-none",
|
|
2093
|
+
children: label
|
|
2094
|
+
}
|
|
2095
|
+
)
|
|
2096
|
+
] }, key)) })
|
|
2097
|
+
] }),
|
|
2098
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
2099
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Label, { className: "text-sm font-medium text-muted-foreground", children: "Top 3 Priorities (Select up to 3)" }),
|
|
2100
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "grid grid-cols-2 gap-2", children: PRIORITIES.map((priority) => {
|
|
2101
|
+
const checked = form.priorities.includes(priority);
|
|
2102
|
+
const disabled = prioritiesAtMax && !checked;
|
|
2103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2104
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2105
|
+
Checkbox,
|
|
2106
|
+
{
|
|
2107
|
+
id: `priority-${priority}`,
|
|
2108
|
+
checked,
|
|
2109
|
+
disabled,
|
|
2110
|
+
onCheckedChange: () => togglePriority(priority)
|
|
2111
|
+
}
|
|
2112
|
+
),
|
|
2113
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2114
|
+
"label",
|
|
2115
|
+
{
|
|
2116
|
+
htmlFor: `priority-${priority}`,
|
|
2117
|
+
className: cn(
|
|
2118
|
+
"text-sm cursor-pointer select-none",
|
|
2119
|
+
disabled && "opacity-40 cursor-not-allowed"
|
|
2120
|
+
),
|
|
2121
|
+
children: priority
|
|
2000
2122
|
}
|
|
2123
|
+
)
|
|
2124
|
+
] }, priority);
|
|
2125
|
+
}) })
|
|
2126
|
+
] }),
|
|
2127
|
+
YES_NO_FIELDS.map(({ key, label }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
2128
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Label, { className: "text-sm font-medium text-muted-foreground", children: label }),
|
|
2129
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2130
|
+
RadioGroup,
|
|
2131
|
+
{
|
|
2132
|
+
value: form[key],
|
|
2133
|
+
onValueChange: (val) => {
|
|
2134
|
+
if (val === "Yes" || val === "No") set(key, val);
|
|
2001
2135
|
},
|
|
2002
|
-
className: "flex-
|
|
2136
|
+
className: "flex gap-4",
|
|
2137
|
+
children: ["Yes", "No"].map((opt) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2138
|
+
"label",
|
|
2139
|
+
{
|
|
2140
|
+
className: "flex items-center gap-2 cursor-pointer select-none",
|
|
2141
|
+
children: [
|
|
2142
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RadioGroupItem, { value: opt }),
|
|
2143
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-sm", children: opt })
|
|
2144
|
+
]
|
|
2145
|
+
},
|
|
2146
|
+
opt
|
|
2147
|
+
))
|
|
2003
2148
|
}
|
|
2004
|
-
)
|
|
2005
|
-
|
|
2006
|
-
|
|
2149
|
+
)
|
|
2150
|
+
] }, key)),
|
|
2151
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "What age are you planning to retire?", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2152
|
+
Input,
|
|
2153
|
+
{
|
|
2154
|
+
type: "number",
|
|
2155
|
+
min: 0,
|
|
2156
|
+
max: 100,
|
|
2157
|
+
value: form.retirementAge,
|
|
2158
|
+
onChange: (e) => set("retirementAge", e.target.value),
|
|
2159
|
+
placeholder: "e.g. 65"
|
|
2160
|
+
}
|
|
2161
|
+
) })
|
|
2162
|
+
] }),
|
|
2163
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogFooter, { children: [
|
|
2164
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { variant: "outline", onClick: () => onOpenChange(false), children: "Cancel" }),
|
|
2007
2165
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2008
|
-
|
|
2166
|
+
Button,
|
|
2009
2167
|
{
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2168
|
+
disabled: !isDirty,
|
|
2169
|
+
onClick: () => {
|
|
2170
|
+
onSave(form);
|
|
2171
|
+
onOpenChange(false);
|
|
2172
|
+
},
|
|
2173
|
+
children: "Save"
|
|
2015
2174
|
}
|
|
2016
2175
|
)
|
|
2017
|
-
] })
|
|
2018
|
-
]
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2176
|
+
] })
|
|
2177
|
+
]
|
|
2178
|
+
}
|
|
2179
|
+
) });
|
|
2180
|
+
}
|
|
2181
|
+
function EditAssetsModal({
|
|
2182
|
+
open,
|
|
2183
|
+
onOpenChange,
|
|
2184
|
+
initialItems = [],
|
|
2185
|
+
onSave,
|
|
2186
|
+
mainApplicantName = "Main Applicant",
|
|
2187
|
+
coApplicantName = "Co-Applicant",
|
|
2188
|
+
container,
|
|
2189
|
+
className
|
|
2190
|
+
}) {
|
|
2191
|
+
const [items, setItems] = React8.useState(
|
|
2192
|
+
initialItems.length > 0 ? initialItems : [makeDefaultAssetItem()]
|
|
2193
|
+
);
|
|
2194
|
+
const initialSnapshot = React8.useRef("");
|
|
2195
|
+
React8.useEffect(() => {
|
|
2196
|
+
if (open) {
|
|
2197
|
+
const data = initialItems.length > 0 ? initialItems : [makeDefaultAssetItem()];
|
|
2198
|
+
setItems(data);
|
|
2199
|
+
initialSnapshot.current = JSON.stringify(data);
|
|
2200
|
+
}
|
|
2201
|
+
}, [open]);
|
|
2202
|
+
const isDirty = JSON.stringify(items) !== initialSnapshot.current;
|
|
2203
|
+
const updateItem = (id, key, val) => setItems(
|
|
2204
|
+
(prev) => prev.map((item) => item.id === id ? __spreadProps(__spreadValues({}, item), { [key]: val }) : item)
|
|
2205
|
+
);
|
|
2206
|
+
const removeItem = (id) => setItems((prev) => prev.filter((item) => item.id !== id));
|
|
2207
|
+
const addItem = () => setItems((prev) => [...prev, makeDefaultAssetItem()]);
|
|
2208
|
+
const defaultOpenItems = items.length > 0 ? [items[0].id] : [];
|
|
2209
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2210
|
+
DialogContent,
|
|
2211
|
+
{
|
|
2212
|
+
className: cn("max-w-lg", className),
|
|
2213
|
+
container,
|
|
2214
|
+
children: [
|
|
2215
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogTitle, { children: "Edit Assets" }) }),
|
|
2216
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(ModalScroll, { children: [
|
|
2036
2217
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2037
|
-
|
|
2218
|
+
Accordion,
|
|
2038
2219
|
{
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2220
|
+
multiple: true,
|
|
2221
|
+
defaultValue: defaultOpenItems,
|
|
2222
|
+
className: "w-full",
|
|
2223
|
+
children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(AccordionItem, { value: item.id, children: [
|
|
2224
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2225
|
+
AccordionItemHeader,
|
|
2226
|
+
{
|
|
2227
|
+
label: `Asset ${index + 1} \u2014 ${item.assetType || "New Asset"}`,
|
|
2228
|
+
onRemove: () => removeItem(item.id),
|
|
2229
|
+
removeLabel: "Remove asset"
|
|
2230
|
+
}
|
|
2231
|
+
),
|
|
2232
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AccordionContent, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-4 pt-1", children: [
|
|
2233
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Asset Type", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2234
|
+
Select,
|
|
2235
|
+
{
|
|
2236
|
+
value: item.assetType,
|
|
2237
|
+
onValueChange: (val) => updateItem(item.id, "assetType", val),
|
|
2238
|
+
children: [
|
|
2239
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select type" }) }),
|
|
2240
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: ASSET_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: t, children: t }, t)) })
|
|
2241
|
+
]
|
|
2242
|
+
}
|
|
2243
|
+
) }),
|
|
2244
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Value", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2245
|
+
CurrencyInputWithSlider,
|
|
2246
|
+
{
|
|
2247
|
+
value: item.value,
|
|
2248
|
+
min: 0,
|
|
2249
|
+
max: 1e7,
|
|
2250
|
+
step: 1e4,
|
|
2251
|
+
onValueChange: (val) => updateItem(item.id, "value", val)
|
|
2252
|
+
}
|
|
2253
|
+
) }),
|
|
2254
|
+
(() => {
|
|
2255
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2256
|
+
const f = assetFields(item.assetType);
|
|
2257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
2258
|
+
f.isProperty && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
2259
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Property Address", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2260
|
+
AddressAutocomplete,
|
|
2261
|
+
{
|
|
2262
|
+
value: (_a = item.address) != null ? _a : "",
|
|
2263
|
+
onValueChange: (val) => updateItem(item.id, "address", val),
|
|
2264
|
+
onSelect: (opt) => updateItem(item.id, "address", opt.label)
|
|
2265
|
+
}
|
|
2266
|
+
) }),
|
|
2267
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2268
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Property Type", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2269
|
+
Select,
|
|
2270
|
+
{
|
|
2271
|
+
value: (_b = item.propertySubtype) != null ? _b : "",
|
|
2272
|
+
onValueChange: (val) => updateItem(
|
|
2273
|
+
item.id,
|
|
2274
|
+
"propertySubtype",
|
|
2275
|
+
val
|
|
2276
|
+
),
|
|
2277
|
+
children: [
|
|
2278
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select" }) }),
|
|
2279
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: PROPERTY_SUBTYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: t, children: t }, t)) })
|
|
2280
|
+
]
|
|
2281
|
+
}
|
|
2282
|
+
) }),
|
|
2283
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Used As", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2284
|
+
Select,
|
|
2285
|
+
{
|
|
2286
|
+
value: (_c = item.usedAs) != null ? _c : "",
|
|
2287
|
+
onValueChange: (val) => updateItem(item.id, "usedAs", val),
|
|
2288
|
+
children: [
|
|
2289
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select" }) }),
|
|
2290
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: PROPERTY_USED_AS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: t, children: t }, t)) })
|
|
2291
|
+
]
|
|
2292
|
+
}
|
|
2293
|
+
) })
|
|
2294
|
+
] })
|
|
2295
|
+
] }),
|
|
2296
|
+
f.isVehicle && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-3 gap-4", children: [
|
|
2297
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Make", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2298
|
+
Input,
|
|
2299
|
+
{
|
|
2300
|
+
value: (_d = item.make) != null ? _d : "",
|
|
2301
|
+
onChange: (e) => updateItem(item.id, "make", e.target.value),
|
|
2302
|
+
placeholder: "e.g. Toyota"
|
|
2303
|
+
}
|
|
2304
|
+
) }),
|
|
2305
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Model", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2306
|
+
Input,
|
|
2307
|
+
{
|
|
2308
|
+
value: (_e = item.model) != null ? _e : "",
|
|
2309
|
+
onChange: (e) => updateItem(item.id, "model", e.target.value),
|
|
2310
|
+
placeholder: "e.g. Camry"
|
|
2311
|
+
}
|
|
2312
|
+
) }),
|
|
2313
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Year", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2314
|
+
Input,
|
|
2315
|
+
{
|
|
2316
|
+
type: "number",
|
|
2317
|
+
min: 1900,
|
|
2318
|
+
max: (/* @__PURE__ */ new Date()).getFullYear() + 1,
|
|
2319
|
+
value: (_f = item.year) != null ? _f : "",
|
|
2320
|
+
onChange: (e) => updateItem(item.id, "year", e.target.value),
|
|
2321
|
+
placeholder: "e.g. 2022"
|
|
2322
|
+
}
|
|
2323
|
+
) })
|
|
2324
|
+
] }),
|
|
2325
|
+
(f.isFinancialAccount || f.isInvestment) && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Institution / Platform", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2326
|
+
Input,
|
|
2327
|
+
{
|
|
2328
|
+
value: (_g = item.institution) != null ? _g : "",
|
|
2329
|
+
onChange: (e) => updateItem(
|
|
2330
|
+
item.id,
|
|
2331
|
+
"institution",
|
|
2332
|
+
e.target.value
|
|
2333
|
+
),
|
|
2334
|
+
placeholder: "e.g. CommBank, Vanguard"
|
|
2335
|
+
}
|
|
2336
|
+
) }),
|
|
2337
|
+
f.isSuper && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2338
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Fund Name", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2339
|
+
Input,
|
|
2340
|
+
{
|
|
2341
|
+
value: (_h = item.fundName) != null ? _h : "",
|
|
2342
|
+
onChange: (e) => updateItem(
|
|
2343
|
+
item.id,
|
|
2344
|
+
"fundName",
|
|
2345
|
+
e.target.value
|
|
2346
|
+
),
|
|
2347
|
+
placeholder: "e.g. Australian Super"
|
|
2348
|
+
}
|
|
2349
|
+
) }),
|
|
2350
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Member Number", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2351
|
+
Input,
|
|
2352
|
+
{
|
|
2353
|
+
value: (_i = item.memberNumber) != null ? _i : "",
|
|
2354
|
+
onChange: (e) => updateItem(
|
|
2355
|
+
item.id,
|
|
2356
|
+
"memberNumber",
|
|
2357
|
+
e.target.value
|
|
2358
|
+
),
|
|
2359
|
+
placeholder: "e.g. 1234567"
|
|
2360
|
+
}
|
|
2361
|
+
) })
|
|
2362
|
+
] }),
|
|
2363
|
+
f.isBusiness && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2364
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Business Name", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2365
|
+
Input,
|
|
2366
|
+
{
|
|
2367
|
+
value: (_j = item.businessName) != null ? _j : "",
|
|
2368
|
+
onChange: (e) => updateItem(
|
|
2369
|
+
item.id,
|
|
2370
|
+
"businessName",
|
|
2371
|
+
e.target.value
|
|
2372
|
+
),
|
|
2373
|
+
placeholder: "e.g. Acme Pty Ltd"
|
|
2374
|
+
}
|
|
2375
|
+
) }),
|
|
2376
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "ABN", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2377
|
+
Input,
|
|
2378
|
+
{
|
|
2379
|
+
value: (_k = item.abn) != null ? _k : "",
|
|
2380
|
+
onChange: (e) => updateItem(item.id, "abn", e.target.value),
|
|
2381
|
+
placeholder: "e.g. 12 345 678 901"
|
|
2382
|
+
}
|
|
2383
|
+
) })
|
|
2384
|
+
] }),
|
|
2385
|
+
f.isInsurance && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2386
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Insurer", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2387
|
+
Input,
|
|
2388
|
+
{
|
|
2389
|
+
value: (_l = item.insurer) != null ? _l : "",
|
|
2390
|
+
onChange: (e) => updateItem(
|
|
2391
|
+
item.id,
|
|
2392
|
+
"insurer",
|
|
2393
|
+
e.target.value
|
|
2394
|
+
),
|
|
2395
|
+
placeholder: "e.g. TAL, AIA"
|
|
2396
|
+
}
|
|
2397
|
+
) }),
|
|
2398
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Policy Number", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2399
|
+
Input,
|
|
2400
|
+
{
|
|
2401
|
+
value: (_m = item.policyNumber) != null ? _m : "",
|
|
2402
|
+
onChange: (e) => updateItem(
|
|
2403
|
+
item.id,
|
|
2404
|
+
"policyNumber",
|
|
2405
|
+
e.target.value
|
|
2406
|
+
),
|
|
2407
|
+
placeholder: "e.g. POL-123456"
|
|
2408
|
+
}
|
|
2409
|
+
) })
|
|
2410
|
+
] })
|
|
2411
|
+
] });
|
|
2412
|
+
})(),
|
|
2413
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Ownership (%)", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2414
|
+
OwnershipSplit,
|
|
2415
|
+
{
|
|
2416
|
+
owners: [
|
|
2417
|
+
{
|
|
2418
|
+
id: "main",
|
|
2419
|
+
name: mainApplicantName != null ? mainApplicantName : "Main Applicant",
|
|
2420
|
+
share: item.mainShare
|
|
2421
|
+
},
|
|
2422
|
+
{
|
|
2423
|
+
id: "co",
|
|
2424
|
+
name: coApplicantName != null ? coApplicantName : "Co-Applicant",
|
|
2425
|
+
share: item.coShare
|
|
2426
|
+
}
|
|
2427
|
+
],
|
|
2428
|
+
onOwnersChange: (owners) => {
|
|
2429
|
+
var _a, _b, _c, _d;
|
|
2430
|
+
updateItem(
|
|
2431
|
+
item.id,
|
|
2432
|
+
"mainShare",
|
|
2433
|
+
(_b = (_a = owners.find((o) => o.id === "main")) == null ? void 0 : _a.share) != null ? _b : 50
|
|
2434
|
+
);
|
|
2435
|
+
updateItem(
|
|
2436
|
+
item.id,
|
|
2437
|
+
"coShare",
|
|
2438
|
+
(_d = (_c = owners.find((o) => o.id === "co")) == null ? void 0 : _c.share) != null ? _d : 50
|
|
2439
|
+
);
|
|
2440
|
+
}
|
|
2441
|
+
}
|
|
2442
|
+
) })
|
|
2443
|
+
] }) })
|
|
2444
|
+
] }, item.id))
|
|
2042
2445
|
}
|
|
2043
2446
|
),
|
|
2044
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.
|
|
2045
|
-
|
|
2447
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2448
|
+
Button,
|
|
2046
2449
|
{
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2450
|
+
variant: "outline",
|
|
2451
|
+
onClick: addItem,
|
|
2452
|
+
className: "w-full gap-1.5",
|
|
2453
|
+
children: [
|
|
2454
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react10.Plus, { className: "h-4 w-4" }),
|
|
2455
|
+
"Add More"
|
|
2456
|
+
]
|
|
2050
2457
|
}
|
|
2051
2458
|
)
|
|
2052
|
-
] },
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
{
|
|
2063
|
-
id: `priority-${priority}`,
|
|
2064
|
-
checked,
|
|
2065
|
-
disabled,
|
|
2066
|
-
onCheckedChange: () => togglePriority(priority)
|
|
2067
|
-
}
|
|
2068
|
-
),
|
|
2069
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2070
|
-
"label",
|
|
2071
|
-
{
|
|
2072
|
-
htmlFor: `priority-${priority}`,
|
|
2073
|
-
className: cn(
|
|
2074
|
-
"text-sm cursor-pointer select-none",
|
|
2075
|
-
disabled && "opacity-40 cursor-not-allowed"
|
|
2076
|
-
),
|
|
2077
|
-
children: priority
|
|
2078
|
-
}
|
|
2079
|
-
)
|
|
2080
|
-
] }, priority);
|
|
2081
|
-
}) })
|
|
2082
|
-
] }),
|
|
2083
|
-
YES_NO_FIELDS.map(({ key, label }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
2084
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Label, { className: "text-sm font-medium text-muted-foreground", children: label }),
|
|
2085
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2086
|
-
RadioGroup,
|
|
2087
|
-
{
|
|
2088
|
-
value: form[key],
|
|
2089
|
-
onValueChange: (val) => {
|
|
2090
|
-
if (val === "Yes" || val === "No") set(key, val);
|
|
2091
|
-
},
|
|
2092
|
-
className: "flex gap-4",
|
|
2093
|
-
children: ["Yes", "No"].map((opt) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2094
|
-
"label",
|
|
2095
|
-
{
|
|
2096
|
-
className: "flex items-center gap-2 cursor-pointer select-none",
|
|
2097
|
-
children: [
|
|
2098
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RadioGroupItem, { value: opt }),
|
|
2099
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-sm", children: opt })
|
|
2100
|
-
]
|
|
2459
|
+
] }),
|
|
2460
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogFooter, { children: [
|
|
2461
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { variant: "outline", onClick: () => onOpenChange(false), children: "Cancel" }),
|
|
2462
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2463
|
+
Button,
|
|
2464
|
+
{
|
|
2465
|
+
disabled: !isDirty,
|
|
2466
|
+
onClick: () => {
|
|
2467
|
+
onSave(items);
|
|
2468
|
+
onOpenChange(false);
|
|
2101
2469
|
},
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
)
|
|
2106
|
-
]
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
{
|
|
2110
|
-
type: "number",
|
|
2111
|
-
min: 0,
|
|
2112
|
-
max: 100,
|
|
2113
|
-
value: form.retirementAge,
|
|
2114
|
-
onChange: (e) => set("retirementAge", e.target.value),
|
|
2115
|
-
placeholder: "e.g. 65"
|
|
2116
|
-
}
|
|
2117
|
-
) })
|
|
2118
|
-
] }),
|
|
2119
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogFooter, { children: [
|
|
2120
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { variant: "outline", onClick: () => onOpenChange(false), children: "Cancel" }),
|
|
2121
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2122
|
-
Button,
|
|
2123
|
-
{
|
|
2124
|
-
onClick: () => {
|
|
2125
|
-
onSave(form);
|
|
2126
|
-
onOpenChange(false);
|
|
2127
|
-
},
|
|
2128
|
-
children: "Save"
|
|
2129
|
-
}
|
|
2130
|
-
)
|
|
2131
|
-
] })
|
|
2132
|
-
] }) });
|
|
2470
|
+
children: "Save"
|
|
2471
|
+
}
|
|
2472
|
+
)
|
|
2473
|
+
] })
|
|
2474
|
+
]
|
|
2475
|
+
}
|
|
2476
|
+
) });
|
|
2133
2477
|
}
|
|
2134
|
-
function
|
|
2478
|
+
function EditDebtsModal({
|
|
2135
2479
|
open,
|
|
2136
2480
|
onOpenChange,
|
|
2137
2481
|
initialItems = [],
|
|
2138
2482
|
onSave,
|
|
2139
2483
|
mainApplicantName = "Main Applicant",
|
|
2140
2484
|
coApplicantName = "Co-Applicant",
|
|
2485
|
+
container,
|
|
2141
2486
|
className
|
|
2142
2487
|
}) {
|
|
2143
2488
|
const [items, setItems] = React8.useState(
|
|
2144
|
-
initialItems.length > 0 ? initialItems : [
|
|
2489
|
+
initialItems.length > 0 ? initialItems : [makeDefaultDebtItem()]
|
|
2145
2490
|
);
|
|
2491
|
+
const initialSnapshot = React8.useRef("");
|
|
2146
2492
|
React8.useEffect(() => {
|
|
2147
2493
|
if (open) {
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
);
|
|
2494
|
+
const data = initialItems.length > 0 ? initialItems : [makeDefaultDebtItem()];
|
|
2495
|
+
setItems(data);
|
|
2496
|
+
initialSnapshot.current = JSON.stringify(data);
|
|
2151
2497
|
}
|
|
2152
2498
|
}, [open]);
|
|
2499
|
+
const isDirty = JSON.stringify(items) !== initialSnapshot.current;
|
|
2153
2500
|
const updateItem = (id, key, val) => setItems(
|
|
2154
2501
|
(prev) => prev.map((item) => item.id === id ? __spreadProps(__spreadValues({}, item), { [key]: val }) : item)
|
|
2155
2502
|
);
|
|
2156
2503
|
const removeItem = (id) => setItems((prev) => prev.filter((item) => item.id !== id));
|
|
2157
|
-
const addItem = () => setItems((prev) => [...prev,
|
|
2504
|
+
const addItem = () => setItems((prev) => [...prev, makeDefaultDebtItem()]);
|
|
2158
2505
|
const defaultOpenItems = items.length > 0 ? [items[0].id] : [];
|
|
2159
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2506
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2507
|
+
DialogContent,
|
|
2508
|
+
{
|
|
2509
|
+
className: cn("max-w-xl", className),
|
|
2510
|
+
container,
|
|
2511
|
+
children: [
|
|
2512
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogTitle, { children: "Edit Debts" }) }),
|
|
2513
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(ModalScroll, { children: [
|
|
2514
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2515
|
+
Accordion,
|
|
2516
|
+
{
|
|
2517
|
+
multiple: true,
|
|
2518
|
+
defaultValue: defaultOpenItems,
|
|
2519
|
+
className: "w-full",
|
|
2520
|
+
children: items.map((item) => {
|
|
2521
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
2522
|
+
const df = debtFields(item.debtType);
|
|
2523
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(AccordionItem, { value: item.id, children: [
|
|
2524
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2525
|
+
AccordionItemHeader,
|
|
2526
|
+
{
|
|
2527
|
+
label: item.debtType || "New Debt",
|
|
2528
|
+
onRemove: () => removeItem(item.id),
|
|
2529
|
+
removeLabel: "Remove debt"
|
|
2530
|
+
}
|
|
2531
|
+
),
|
|
2532
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AccordionContent, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-4 pt-1", children: [
|
|
2533
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Debt Type", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2534
|
+
Select,
|
|
2535
|
+
{
|
|
2536
|
+
value: item.debtType,
|
|
2537
|
+
onValueChange: (val) => updateItem(item.id, "debtType", val),
|
|
2538
|
+
children: [
|
|
2539
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select type" }) }),
|
|
2540
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: DEBT_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: t, children: t }, t)) })
|
|
2541
|
+
]
|
|
2542
|
+
}
|
|
2543
|
+
) }),
|
|
2544
|
+
(df.isPropertyLoan || df.isGeneralLoan || df.isVehicle) && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2545
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Lender", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2546
|
+
Input,
|
|
2547
|
+
{
|
|
2548
|
+
value: (_a = item.lender) != null ? _a : "",
|
|
2549
|
+
onChange: (e) => updateItem(item.id, "lender", e.target.value),
|
|
2550
|
+
placeholder: "e.g. CommBank"
|
|
2551
|
+
}
|
|
2552
|
+
) }),
|
|
2553
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Account Number", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2554
|
+
Input,
|
|
2555
|
+
{
|
|
2556
|
+
value: (_b = item.accountNumber) != null ? _b : "",
|
|
2557
|
+
onChange: (e) => updateItem(
|
|
2558
|
+
item.id,
|
|
2559
|
+
"accountNumber",
|
|
2560
|
+
e.target.value
|
|
2561
|
+
),
|
|
2562
|
+
placeholder: "e.g. 123-456"
|
|
2563
|
+
}
|
|
2564
|
+
) })
|
|
2565
|
+
] }),
|
|
2566
|
+
df.isPropertyLoan && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Property Address", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2205
2567
|
AddressAutocomplete,
|
|
2206
2568
|
{
|
|
2207
|
-
value: (
|
|
2208
|
-
onValueChange: (val) => updateItem(item.id, "
|
|
2209
|
-
onSelect: (opt) => updateItem(item.id, "
|
|
2569
|
+
value: (_c = item.propertyAddress) != null ? _c : "",
|
|
2570
|
+
onValueChange: (val) => updateItem(item.id, "propertyAddress", val),
|
|
2571
|
+
onSelect: (opt) => updateItem(item.id, "propertyAddress", opt.label)
|
|
2210
2572
|
}
|
|
2211
2573
|
) }),
|
|
2212
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-
|
|
2213
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "
|
|
2214
|
-
|
|
2574
|
+
df.isVehicle && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-3 gap-4", children: [
|
|
2575
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Make", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2576
|
+
Input,
|
|
2215
2577
|
{
|
|
2216
|
-
value: (
|
|
2217
|
-
|
|
2578
|
+
value: (_d = item.vehicleMake) != null ? _d : "",
|
|
2579
|
+
onChange: (e) => updateItem(
|
|
2218
2580
|
item.id,
|
|
2219
|
-
"
|
|
2220
|
-
|
|
2581
|
+
"vehicleMake",
|
|
2582
|
+
e.target.value
|
|
2221
2583
|
),
|
|
2222
|
-
|
|
2223
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select" }) }),
|
|
2224
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: PROPERTY_SUBTYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: t, children: t }, t)) })
|
|
2225
|
-
]
|
|
2584
|
+
placeholder: "e.g. Toyota"
|
|
2226
2585
|
}
|
|
2227
2586
|
) }),
|
|
2228
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "
|
|
2229
|
-
|
|
2587
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Model", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2588
|
+
Input,
|
|
2230
2589
|
{
|
|
2231
|
-
value: (
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2590
|
+
value: (_e = item.vehicleModel) != null ? _e : "",
|
|
2591
|
+
onChange: (e) => updateItem(
|
|
2592
|
+
item.id,
|
|
2593
|
+
"vehicleModel",
|
|
2594
|
+
e.target.value
|
|
2595
|
+
),
|
|
2596
|
+
placeholder: "e.g. Camry"
|
|
2597
|
+
}
|
|
2598
|
+
) }),
|
|
2599
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Year", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2600
|
+
Input,
|
|
2601
|
+
{
|
|
2602
|
+
type: "number",
|
|
2603
|
+
min: 1900,
|
|
2604
|
+
max: (/* @__PURE__ */ new Date()).getFullYear() + 1,
|
|
2605
|
+
value: (_f = item.vehicleYear) != null ? _f : "",
|
|
2606
|
+
onChange: (e) => updateItem(
|
|
2607
|
+
item.id,
|
|
2608
|
+
"vehicleYear",
|
|
2609
|
+
e.target.value
|
|
2610
|
+
),
|
|
2611
|
+
placeholder: "e.g. 2022"
|
|
2237
2612
|
}
|
|
2238
2613
|
) })
|
|
2239
|
-
] })
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2614
|
+
] }),
|
|
2615
|
+
df.isCard && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2616
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Provider", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2617
|
+
Input,
|
|
2618
|
+
{
|
|
2619
|
+
value: (_g = item.lender) != null ? _g : "",
|
|
2620
|
+
onChange: (e) => updateItem(item.id, "lender", e.target.value),
|
|
2621
|
+
placeholder: "e.g. ANZ, Afterpay"
|
|
2622
|
+
}
|
|
2623
|
+
) }),
|
|
2624
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Credit Limit", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2625
|
+
CurrencyInputWithSlider,
|
|
2626
|
+
{
|
|
2627
|
+
value: (_h = item.creditLimit) != null ? _h : 0,
|
|
2628
|
+
min: 0,
|
|
2629
|
+
max: 1e5,
|
|
2630
|
+
step: 500,
|
|
2631
|
+
onValueChange: (val) => updateItem(item.id, "creditLimit", val)
|
|
2632
|
+
}
|
|
2633
|
+
) })
|
|
2634
|
+
] }),
|
|
2635
|
+
df.isHecs && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Institution", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2243
2636
|
Input,
|
|
2244
2637
|
{
|
|
2245
|
-
value: (
|
|
2246
|
-
onChange: (e) => updateItem(item.id, "
|
|
2247
|
-
placeholder: "e.g.
|
|
2638
|
+
value: (_i = item.institution) != null ? _i : "",
|
|
2639
|
+
onChange: (e) => updateItem(item.id, "institution", e.target.value),
|
|
2640
|
+
placeholder: "e.g. University of Sydney"
|
|
2248
2641
|
}
|
|
2249
2642
|
) }),
|
|
2250
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
{
|
|
2273
|
-
value: (_g = item.institution) != null ? _g : "",
|
|
2274
|
-
onChange: (e) => updateItem(
|
|
2275
|
-
item.id,
|
|
2276
|
-
"institution",
|
|
2277
|
-
e.target.value
|
|
2278
|
-
),
|
|
2279
|
-
placeholder: "e.g. CommBank, Vanguard"
|
|
2280
|
-
}
|
|
2281
|
-
) }),
|
|
2282
|
-
f.isSuper && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2283
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Fund Name", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2284
|
-
Input,
|
|
2285
|
-
{
|
|
2286
|
-
value: (_h = item.fundName) != null ? _h : "",
|
|
2287
|
-
onChange: (e) => updateItem(
|
|
2288
|
-
item.id,
|
|
2289
|
-
"fundName",
|
|
2290
|
-
e.target.value
|
|
2291
|
-
),
|
|
2292
|
-
placeholder: "e.g. Australian Super"
|
|
2293
|
-
}
|
|
2294
|
-
) }),
|
|
2295
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Member Number", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2296
|
-
Input,
|
|
2297
|
-
{
|
|
2298
|
-
value: (_i = item.memberNumber) != null ? _i : "",
|
|
2299
|
-
onChange: (e) => updateItem(
|
|
2300
|
-
item.id,
|
|
2301
|
-
"memberNumber",
|
|
2302
|
-
e.target.value
|
|
2303
|
-
),
|
|
2304
|
-
placeholder: "e.g. 1234567"
|
|
2305
|
-
}
|
|
2306
|
-
) })
|
|
2307
|
-
] }),
|
|
2308
|
-
f.isBusiness && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2309
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Business Name", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2643
|
+
df.isTax && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2644
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Tax Year", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2645
|
+
Input,
|
|
2646
|
+
{
|
|
2647
|
+
value: (_j = item.taxYear) != null ? _j : "",
|
|
2648
|
+
onChange: (e) => updateItem(item.id, "taxYear", e.target.value),
|
|
2649
|
+
placeholder: "e.g. 2023\u201324"
|
|
2650
|
+
}
|
|
2651
|
+
) }),
|
|
2652
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "ATO Reference", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2653
|
+
Input,
|
|
2654
|
+
{
|
|
2655
|
+
value: (_k = item.referenceNumber) != null ? _k : "",
|
|
2656
|
+
onChange: (e) => updateItem(
|
|
2657
|
+
item.id,
|
|
2658
|
+
"referenceNumber",
|
|
2659
|
+
e.target.value
|
|
2660
|
+
),
|
|
2661
|
+
placeholder: "e.g. 1234567890"
|
|
2662
|
+
}
|
|
2663
|
+
) })
|
|
2664
|
+
] }),
|
|
2665
|
+
df.isGuarantor && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Beneficiary (borrower's name)", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2310
2666
|
Input,
|
|
2311
2667
|
{
|
|
2312
|
-
value: (
|
|
2313
|
-
onChange: (e) => updateItem(
|
|
2314
|
-
|
|
2315
|
-
"businessName",
|
|
2316
|
-
e.target.value
|
|
2317
|
-
),
|
|
2318
|
-
placeholder: "e.g. Acme Pty Ltd"
|
|
2668
|
+
value: (_l = item.beneficiary) != null ? _l : "",
|
|
2669
|
+
onChange: (e) => updateItem(item.id, "beneficiary", e.target.value),
|
|
2670
|
+
placeholder: "e.g. Jane Smith"
|
|
2319
2671
|
}
|
|
2320
2672
|
) }),
|
|
2321
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2673
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2674
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Amount Owing", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2675
|
+
CurrencyInputWithSlider,
|
|
2676
|
+
{
|
|
2677
|
+
value: item.amountOwing,
|
|
2678
|
+
min: 0,
|
|
2679
|
+
max: 1e6,
|
|
2680
|
+
step: 1e3,
|
|
2681
|
+
onValueChange: (val) => updateItem(item.id, "amountOwing", val)
|
|
2682
|
+
}
|
|
2683
|
+
) }),
|
|
2684
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Original Loan Amount", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2685
|
+
CurrencyInputWithSlider,
|
|
2686
|
+
{
|
|
2687
|
+
value: item.originalLoanAmount,
|
|
2688
|
+
min: 0,
|
|
2689
|
+
max: 1e6,
|
|
2690
|
+
step: 1e3,
|
|
2691
|
+
onValueChange: (val) => updateItem(item.id, "originalLoanAmount", val)
|
|
2692
|
+
}
|
|
2693
|
+
) })
|
|
2694
|
+
] }),
|
|
2695
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-start gap-3", children: [
|
|
2696
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Repayments", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2697
|
+
CurrencyInputWithSlider,
|
|
2698
|
+
{
|
|
2699
|
+
value: item.repaymentAmount,
|
|
2700
|
+
min: 0,
|
|
2701
|
+
max: 1e6,
|
|
2702
|
+
step: 100,
|
|
2703
|
+
onValueChange: (val) => updateItem(item.id, "repaymentAmount", val)
|
|
2704
|
+
}
|
|
2705
|
+
) }) }),
|
|
2706
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "shrink-0 mt-[1.625rem]", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2707
|
+
FrequencyToggle,
|
|
2708
|
+
{
|
|
2709
|
+
value: item.repaymentFrequency,
|
|
2710
|
+
onValueChange: (val) => updateItem(item.id, "repaymentFrequency", val)
|
|
2711
|
+
}
|
|
2712
|
+
) })
|
|
2713
|
+
] }),
|
|
2714
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Interest Rate", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2715
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2716
|
+
Input,
|
|
2717
|
+
{
|
|
2718
|
+
value: item.interestRate,
|
|
2719
|
+
onChange: (e) => updateItem(
|
|
2720
|
+
item.id,
|
|
2721
|
+
"interestRate",
|
|
2722
|
+
e.target.value
|
|
2723
|
+
),
|
|
2724
|
+
placeholder: "e.g. 6.5",
|
|
2725
|
+
className: "flex-1"
|
|
2726
|
+
}
|
|
2727
|
+
),
|
|
2728
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-sm text-muted-foreground shrink-0", children: "%" })
|
|
2729
|
+
] }) }),
|
|
2730
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Notes", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2731
|
+
Textarea,
|
|
2333
2732
|
{
|
|
2334
|
-
value:
|
|
2335
|
-
onChange: (e) => updateItem(
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
e.target.value
|
|
2339
|
-
),
|
|
2340
|
-
placeholder: "e.g. TAL, AIA"
|
|
2733
|
+
value: item.details,
|
|
2734
|
+
onChange: (e) => updateItem(item.id, "details", e.target.value),
|
|
2735
|
+
placeholder: "Short comment",
|
|
2736
|
+
rows: 2
|
|
2341
2737
|
}
|
|
2342
2738
|
) }),
|
|
2343
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "
|
|
2344
|
-
|
|
2739
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Ownership (%)", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2740
|
+
OwnershipSplit,
|
|
2345
2741
|
{
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2742
|
+
owners: [
|
|
2743
|
+
{
|
|
2744
|
+
id: "main",
|
|
2745
|
+
name: mainApplicantName != null ? mainApplicantName : "Main Applicant",
|
|
2746
|
+
share: item.mainShare
|
|
2747
|
+
},
|
|
2748
|
+
{
|
|
2749
|
+
id: "co",
|
|
2750
|
+
name: coApplicantName != null ? coApplicantName : "Co-Applicant",
|
|
2751
|
+
share: item.coShare
|
|
2752
|
+
}
|
|
2753
|
+
],
|
|
2754
|
+
onOwnersChange: (owners) => {
|
|
2755
|
+
var _a2, _b2, _c2, _d2;
|
|
2756
|
+
updateItem(
|
|
2757
|
+
item.id,
|
|
2758
|
+
"mainShare",
|
|
2759
|
+
(_b2 = (_a2 = owners.find((o) => o.id === "main")) == null ? void 0 : _a2.share) != null ? _b2 : 50
|
|
2760
|
+
);
|
|
2761
|
+
updateItem(
|
|
2762
|
+
item.id,
|
|
2763
|
+
"coShare",
|
|
2764
|
+
(_d2 = (_c2 = owners.find((o) => o.id === "co")) == null ? void 0 : _c2.share) != null ? _d2 : 50
|
|
2765
|
+
);
|
|
2766
|
+
}
|
|
2353
2767
|
}
|
|
2354
2768
|
) })
|
|
2355
|
-
] })
|
|
2356
|
-
] });
|
|
2357
|
-
})
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
] }) })
|
|
2389
|
-
] }, item.id))
|
|
2390
|
-
}
|
|
2391
|
-
),
|
|
2392
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2393
|
-
Button,
|
|
2394
|
-
{
|
|
2395
|
-
variant: "outline",
|
|
2396
|
-
onClick: addItem,
|
|
2397
|
-
className: "w-full gap-1.5",
|
|
2398
|
-
children: [
|
|
2399
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react10.Plus, { className: "h-4 w-4" }),
|
|
2400
|
-
"Add More"
|
|
2401
|
-
]
|
|
2402
|
-
}
|
|
2403
|
-
)
|
|
2404
|
-
] }),
|
|
2405
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogFooter, { children: [
|
|
2406
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { variant: "outline", onClick: () => onOpenChange(false), children: "Cancel" }),
|
|
2407
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2408
|
-
Button,
|
|
2409
|
-
{
|
|
2410
|
-
onClick: () => {
|
|
2411
|
-
onSave(items);
|
|
2412
|
-
onOpenChange(false);
|
|
2413
|
-
},
|
|
2414
|
-
children: "Save"
|
|
2415
|
-
}
|
|
2416
|
-
)
|
|
2417
|
-
] })
|
|
2418
|
-
] }) });
|
|
2419
|
-
}
|
|
2420
|
-
function EditDebtsModal({
|
|
2421
|
-
open,
|
|
2422
|
-
onOpenChange,
|
|
2423
|
-
initialItems = [],
|
|
2424
|
-
onSave,
|
|
2425
|
-
mainApplicantName = "Main Applicant",
|
|
2426
|
-
coApplicantName = "Co-Applicant",
|
|
2427
|
-
className
|
|
2428
|
-
}) {
|
|
2429
|
-
const [items, setItems] = React8.useState(
|
|
2430
|
-
initialItems.length > 0 ? initialItems : [makeDefaultDebtItem()]
|
|
2431
|
-
);
|
|
2432
|
-
React8.useEffect(() => {
|
|
2433
|
-
if (open) {
|
|
2434
|
-
setItems(
|
|
2435
|
-
initialItems.length > 0 ? initialItems : [makeDefaultDebtItem()]
|
|
2436
|
-
);
|
|
2769
|
+
] }) })
|
|
2770
|
+
] }, item.id);
|
|
2771
|
+
})
|
|
2772
|
+
}
|
|
2773
|
+
),
|
|
2774
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2775
|
+
Button,
|
|
2776
|
+
{
|
|
2777
|
+
variant: "outline",
|
|
2778
|
+
onClick: addItem,
|
|
2779
|
+
className: "w-full gap-1.5",
|
|
2780
|
+
children: [
|
|
2781
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react10.Plus, { className: "h-4 w-4" }),
|
|
2782
|
+
"Add More"
|
|
2783
|
+
]
|
|
2784
|
+
}
|
|
2785
|
+
)
|
|
2786
|
+
] }),
|
|
2787
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogFooter, { children: [
|
|
2788
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { variant: "outline", onClick: () => onOpenChange(false), children: "Cancel" }),
|
|
2789
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2790
|
+
Button,
|
|
2791
|
+
{
|
|
2792
|
+
disabled: !isDirty,
|
|
2793
|
+
onClick: () => {
|
|
2794
|
+
onSave(items);
|
|
2795
|
+
onOpenChange(false);
|
|
2796
|
+
},
|
|
2797
|
+
children: "Save"
|
|
2798
|
+
}
|
|
2799
|
+
)
|
|
2800
|
+
] })
|
|
2801
|
+
]
|
|
2437
2802
|
}
|
|
2438
|
-
}
|
|
2439
|
-
const updateItem = (id, key, val) => setItems(
|
|
2440
|
-
(prev) => prev.map((item) => item.id === id ? __spreadProps(__spreadValues({}, item), { [key]: val }) : item)
|
|
2441
|
-
);
|
|
2442
|
-
const removeItem = (id) => setItems((prev) => prev.filter((item) => item.id !== id));
|
|
2443
|
-
const addItem = () => setItems((prev) => [...prev, makeDefaultDebtItem()]);
|
|
2444
|
-
const defaultOpenItems = items.length > 0 ? [items[0].id] : [];
|
|
2445
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogContent, { className: cn("max-w-xl", className), children: [
|
|
2446
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogTitle, { children: "Edit Debts" }) }),
|
|
2447
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(ModalScroll, { children: [
|
|
2448
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2449
|
-
Accordion,
|
|
2450
|
-
{
|
|
2451
|
-
multiple: true,
|
|
2452
|
-
defaultValue: defaultOpenItems,
|
|
2453
|
-
className: "w-full",
|
|
2454
|
-
children: items.map((item) => {
|
|
2455
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
2456
|
-
const df = debtFields(item.debtType);
|
|
2457
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(AccordionItem, { value: item.id, children: [
|
|
2458
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2459
|
-
AccordionItemHeader,
|
|
2460
|
-
{
|
|
2461
|
-
label: item.debtType || "New Debt",
|
|
2462
|
-
onRemove: () => removeItem(item.id),
|
|
2463
|
-
removeLabel: "Remove debt"
|
|
2464
|
-
}
|
|
2465
|
-
),
|
|
2466
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AccordionContent, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-4 pt-1", children: [
|
|
2467
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Debt Type", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2468
|
-
Select,
|
|
2469
|
-
{
|
|
2470
|
-
value: item.debtType,
|
|
2471
|
-
onValueChange: (val) => updateItem(item.id, "debtType", val),
|
|
2472
|
-
children: [
|
|
2473
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select type" }) }),
|
|
2474
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: DEBT_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: t, children: t }, t)) })
|
|
2475
|
-
]
|
|
2476
|
-
}
|
|
2477
|
-
) }),
|
|
2478
|
-
(df.isPropertyLoan || df.isGeneralLoan || df.isVehicle) && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2479
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Lender", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2480
|
-
Input,
|
|
2481
|
-
{
|
|
2482
|
-
value: (_a = item.lender) != null ? _a : "",
|
|
2483
|
-
onChange: (e) => updateItem(item.id, "lender", e.target.value),
|
|
2484
|
-
placeholder: "e.g. CommBank"
|
|
2485
|
-
}
|
|
2486
|
-
) }),
|
|
2487
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Account Number", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2488
|
-
Input,
|
|
2489
|
-
{
|
|
2490
|
-
value: (_b = item.accountNumber) != null ? _b : "",
|
|
2491
|
-
onChange: (e) => updateItem(
|
|
2492
|
-
item.id,
|
|
2493
|
-
"accountNumber",
|
|
2494
|
-
e.target.value
|
|
2495
|
-
),
|
|
2496
|
-
placeholder: "e.g. 123-456"
|
|
2497
|
-
}
|
|
2498
|
-
) })
|
|
2499
|
-
] }),
|
|
2500
|
-
df.isPropertyLoan && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Property Address", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2501
|
-
AddressAutocomplete,
|
|
2502
|
-
{
|
|
2503
|
-
value: (_c = item.propertyAddress) != null ? _c : "",
|
|
2504
|
-
onValueChange: (val) => updateItem(item.id, "propertyAddress", val),
|
|
2505
|
-
onSelect: (opt) => updateItem(item.id, "propertyAddress", opt.label)
|
|
2506
|
-
}
|
|
2507
|
-
) }),
|
|
2508
|
-
df.isVehicle && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-3 gap-4", children: [
|
|
2509
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Make", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2510
|
-
Input,
|
|
2511
|
-
{
|
|
2512
|
-
value: (_d = item.vehicleMake) != null ? _d : "",
|
|
2513
|
-
onChange: (e) => updateItem(
|
|
2514
|
-
item.id,
|
|
2515
|
-
"vehicleMake",
|
|
2516
|
-
e.target.value
|
|
2517
|
-
),
|
|
2518
|
-
placeholder: "e.g. Toyota"
|
|
2519
|
-
}
|
|
2520
|
-
) }),
|
|
2521
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Model", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2522
|
-
Input,
|
|
2523
|
-
{
|
|
2524
|
-
value: (_e = item.vehicleModel) != null ? _e : "",
|
|
2525
|
-
onChange: (e) => updateItem(
|
|
2526
|
-
item.id,
|
|
2527
|
-
"vehicleModel",
|
|
2528
|
-
e.target.value
|
|
2529
|
-
),
|
|
2530
|
-
placeholder: "e.g. Camry"
|
|
2531
|
-
}
|
|
2532
|
-
) }),
|
|
2533
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Year", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2534
|
-
Input,
|
|
2535
|
-
{
|
|
2536
|
-
type: "number",
|
|
2537
|
-
min: 1900,
|
|
2538
|
-
max: (/* @__PURE__ */ new Date()).getFullYear() + 1,
|
|
2539
|
-
value: (_f = item.vehicleYear) != null ? _f : "",
|
|
2540
|
-
onChange: (e) => updateItem(
|
|
2541
|
-
item.id,
|
|
2542
|
-
"vehicleYear",
|
|
2543
|
-
e.target.value
|
|
2544
|
-
),
|
|
2545
|
-
placeholder: "e.g. 2022"
|
|
2546
|
-
}
|
|
2547
|
-
) })
|
|
2548
|
-
] }),
|
|
2549
|
-
df.isCard && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2550
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Provider", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2551
|
-
Input,
|
|
2552
|
-
{
|
|
2553
|
-
value: (_g = item.lender) != null ? _g : "",
|
|
2554
|
-
onChange: (e) => updateItem(item.id, "lender", e.target.value),
|
|
2555
|
-
placeholder: "e.g. ANZ, Afterpay"
|
|
2556
|
-
}
|
|
2557
|
-
) }),
|
|
2558
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Credit Limit", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2559
|
-
CurrencyInputWithSlider,
|
|
2560
|
-
{
|
|
2561
|
-
value: (_h = item.creditLimit) != null ? _h : 0,
|
|
2562
|
-
min: 0,
|
|
2563
|
-
max: 1e5,
|
|
2564
|
-
step: 500,
|
|
2565
|
-
onValueChange: (val) => updateItem(item.id, "creditLimit", val)
|
|
2566
|
-
}
|
|
2567
|
-
) })
|
|
2568
|
-
] }),
|
|
2569
|
-
df.isHecs && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Institution", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2570
|
-
Input,
|
|
2571
|
-
{
|
|
2572
|
-
value: (_i = item.institution) != null ? _i : "",
|
|
2573
|
-
onChange: (e) => updateItem(item.id, "institution", e.target.value),
|
|
2574
|
-
placeholder: "e.g. University of Sydney"
|
|
2575
|
-
}
|
|
2576
|
-
) }),
|
|
2577
|
-
df.isTax && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2578
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Tax Year", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2579
|
-
Input,
|
|
2580
|
-
{
|
|
2581
|
-
value: (_j = item.taxYear) != null ? _j : "",
|
|
2582
|
-
onChange: (e) => updateItem(item.id, "taxYear", e.target.value),
|
|
2583
|
-
placeholder: "e.g. 2023\u201324"
|
|
2584
|
-
}
|
|
2585
|
-
) }),
|
|
2586
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "ATO Reference", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2587
|
-
Input,
|
|
2588
|
-
{
|
|
2589
|
-
value: (_k = item.referenceNumber) != null ? _k : "",
|
|
2590
|
-
onChange: (e) => updateItem(
|
|
2591
|
-
item.id,
|
|
2592
|
-
"referenceNumber",
|
|
2593
|
-
e.target.value
|
|
2594
|
-
),
|
|
2595
|
-
placeholder: "e.g. 1234567890"
|
|
2596
|
-
}
|
|
2597
|
-
) })
|
|
2598
|
-
] }),
|
|
2599
|
-
df.isGuarantor && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Beneficiary (borrower's name)", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2600
|
-
Input,
|
|
2601
|
-
{
|
|
2602
|
-
value: (_l = item.beneficiary) != null ? _l : "",
|
|
2603
|
-
onChange: (e) => updateItem(item.id, "beneficiary", e.target.value),
|
|
2604
|
-
placeholder: "e.g. Jane Smith"
|
|
2605
|
-
}
|
|
2606
|
-
) }),
|
|
2607
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2608
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Amount Owing", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2609
|
-
CurrencyInputWithSlider,
|
|
2610
|
-
{
|
|
2611
|
-
value: item.amountOwing,
|
|
2612
|
-
min: 0,
|
|
2613
|
-
max: 1e6,
|
|
2614
|
-
step: 1e3,
|
|
2615
|
-
onValueChange: (val) => updateItem(item.id, "amountOwing", val)
|
|
2616
|
-
}
|
|
2617
|
-
) }),
|
|
2618
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Original Loan Amount", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2619
|
-
CurrencyInputWithSlider,
|
|
2620
|
-
{
|
|
2621
|
-
value: item.originalLoanAmount,
|
|
2622
|
-
min: 0,
|
|
2623
|
-
max: 1e6,
|
|
2624
|
-
step: 1e3,
|
|
2625
|
-
onValueChange: (val) => updateItem(item.id, "originalLoanAmount", val)
|
|
2626
|
-
}
|
|
2627
|
-
) })
|
|
2628
|
-
] }),
|
|
2629
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-start gap-3", children: [
|
|
2630
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Repayments", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2631
|
-
CurrencyInputWithSlider,
|
|
2632
|
-
{
|
|
2633
|
-
value: item.repaymentAmount,
|
|
2634
|
-
min: 0,
|
|
2635
|
-
max: 1e6,
|
|
2636
|
-
step: 100,
|
|
2637
|
-
onValueChange: (val) => updateItem(item.id, "repaymentAmount", val)
|
|
2638
|
-
}
|
|
2639
|
-
) }) }),
|
|
2640
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "shrink-0 mt-[1.625rem]", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2641
|
-
FrequencyToggle,
|
|
2642
|
-
{
|
|
2643
|
-
value: item.repaymentFrequency,
|
|
2644
|
-
onValueChange: (val) => updateItem(item.id, "repaymentFrequency", val)
|
|
2645
|
-
}
|
|
2646
|
-
) })
|
|
2647
|
-
] }),
|
|
2648
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Interest Rate", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2649
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2650
|
-
Input,
|
|
2651
|
-
{
|
|
2652
|
-
value: item.interestRate,
|
|
2653
|
-
onChange: (e) => updateItem(
|
|
2654
|
-
item.id,
|
|
2655
|
-
"interestRate",
|
|
2656
|
-
e.target.value
|
|
2657
|
-
),
|
|
2658
|
-
placeholder: "e.g. 6.5",
|
|
2659
|
-
className: "flex-1"
|
|
2660
|
-
}
|
|
2661
|
-
),
|
|
2662
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-sm text-muted-foreground shrink-0", children: "%" })
|
|
2663
|
-
] }) }),
|
|
2664
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Notes", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2665
|
-
Textarea,
|
|
2666
|
-
{
|
|
2667
|
-
value: item.details,
|
|
2668
|
-
onChange: (e) => updateItem(item.id, "details", e.target.value),
|
|
2669
|
-
placeholder: "Short comment",
|
|
2670
|
-
rows: 2
|
|
2671
|
-
}
|
|
2672
|
-
) }),
|
|
2673
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Ownership (%)", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2674
|
-
OwnershipSplit,
|
|
2675
|
-
{
|
|
2676
|
-
owners: [
|
|
2677
|
-
{
|
|
2678
|
-
id: "main",
|
|
2679
|
-
name: mainApplicantName != null ? mainApplicantName : "Main Applicant",
|
|
2680
|
-
share: item.mainShare
|
|
2681
|
-
},
|
|
2682
|
-
{
|
|
2683
|
-
id: "co",
|
|
2684
|
-
name: coApplicantName != null ? coApplicantName : "Co-Applicant",
|
|
2685
|
-
share: item.coShare
|
|
2686
|
-
}
|
|
2687
|
-
],
|
|
2688
|
-
onOwnersChange: (owners) => {
|
|
2689
|
-
var _a2, _b2, _c2, _d2;
|
|
2690
|
-
updateItem(
|
|
2691
|
-
item.id,
|
|
2692
|
-
"mainShare",
|
|
2693
|
-
(_b2 = (_a2 = owners.find((o) => o.id === "main")) == null ? void 0 : _a2.share) != null ? _b2 : 50
|
|
2694
|
-
);
|
|
2695
|
-
updateItem(
|
|
2696
|
-
item.id,
|
|
2697
|
-
"coShare",
|
|
2698
|
-
(_d2 = (_c2 = owners.find((o) => o.id === "co")) == null ? void 0 : _c2.share) != null ? _d2 : 50
|
|
2699
|
-
);
|
|
2700
|
-
}
|
|
2701
|
-
}
|
|
2702
|
-
) })
|
|
2703
|
-
] }) })
|
|
2704
|
-
] }, item.id);
|
|
2705
|
-
})
|
|
2706
|
-
}
|
|
2707
|
-
),
|
|
2708
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2709
|
-
Button,
|
|
2710
|
-
{
|
|
2711
|
-
variant: "outline",
|
|
2712
|
-
onClick: addItem,
|
|
2713
|
-
className: "w-full gap-1.5",
|
|
2714
|
-
children: [
|
|
2715
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react10.Plus, { className: "h-4 w-4" }),
|
|
2716
|
-
"Add More"
|
|
2717
|
-
]
|
|
2718
|
-
}
|
|
2719
|
-
)
|
|
2720
|
-
] }),
|
|
2721
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogFooter, { children: [
|
|
2722
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { variant: "outline", onClick: () => onOpenChange(false), children: "Cancel" }),
|
|
2723
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2724
|
-
Button,
|
|
2725
|
-
{
|
|
2726
|
-
onClick: () => {
|
|
2727
|
-
onSave(items);
|
|
2728
|
-
onOpenChange(false);
|
|
2729
|
-
},
|
|
2730
|
-
children: "Save"
|
|
2731
|
-
}
|
|
2732
|
-
)
|
|
2733
|
-
] })
|
|
2734
|
-
] }) });
|
|
2803
|
+
) });
|
|
2735
2804
|
}
|
|
2736
2805
|
function EditAboutApplicantModal({
|
|
2737
2806
|
open,
|
|
@@ -2739,14 +2808,19 @@ function EditAboutApplicantModal({
|
|
|
2739
2808
|
applicantLabel = "Applicant",
|
|
2740
2809
|
initialData,
|
|
2741
2810
|
onSave,
|
|
2811
|
+
container,
|
|
2742
2812
|
className
|
|
2743
2813
|
}) {
|
|
2744
2814
|
const [form, setForm] = React8.useState(__spreadValues(__spreadValues({}, ABOUT_APPLICANT_DEFAULTS), initialData));
|
|
2815
|
+
const initialSnapshot = React8.useRef("");
|
|
2745
2816
|
React8.useEffect(() => {
|
|
2746
2817
|
if (open) {
|
|
2747
|
-
|
|
2818
|
+
const data = __spreadValues(__spreadValues({}, ABOUT_APPLICANT_DEFAULTS), initialData);
|
|
2819
|
+
setForm(data);
|
|
2820
|
+
initialSnapshot.current = JSON.stringify(data);
|
|
2748
2821
|
}
|
|
2749
2822
|
}, [open]);
|
|
2823
|
+
const isDirty = JSON.stringify(form) !== initialSnapshot.current;
|
|
2750
2824
|
const setStr = (key) => (val) => setForm((prev) => __spreadProps(__spreadValues({}, prev), { [key]: val }));
|
|
2751
2825
|
const handleNumDependantsChange = (val) => {
|
|
2752
2826
|
const n = Math.max(0, Math.min(20, parseInt(val, 10) || 0));
|
|
@@ -2761,238 +2835,246 @@ function EditAboutApplicantModal({
|
|
|
2761
2835
|
const next = prev.dependants.map((d, i) => i === index ? { dob } : d);
|
|
2762
2836
|
return __spreadProps(__spreadValues({}, prev), { dependants: next });
|
|
2763
2837
|
});
|
|
2764
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Marital Status", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2831
|
-
Select,
|
|
2832
|
-
{
|
|
2833
|
-
value: form.maritalStatus,
|
|
2834
|
-
onValueChange: setStr("maritalStatus"),
|
|
2835
|
-
children: [
|
|
2838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2839
|
+
DialogContent,
|
|
2840
|
+
{
|
|
2841
|
+
className: cn("max-w-md", className),
|
|
2842
|
+
container,
|
|
2843
|
+
children: [
|
|
2844
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogTitle, { children: [
|
|
2845
|
+
"Edit About ",
|
|
2846
|
+
applicantLabel
|
|
2847
|
+
] }) }),
|
|
2848
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(ModalScroll, { children: [
|
|
2849
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex gap-3 items-start", children: [
|
|
2850
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "w-24 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Title", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Select, { value: form.title, onValueChange: setStr("title"), children: [
|
|
2851
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Title" }) }),
|
|
2852
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: TITLE_OPTIONS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: t, children: t }, t)) })
|
|
2853
|
+
] }) }) }),
|
|
2854
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "First Name", className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2855
|
+
Input,
|
|
2856
|
+
{
|
|
2857
|
+
value: form.firstName,
|
|
2858
|
+
onChange: (e) => setStr("firstName")(e.target.value),
|
|
2859
|
+
placeholder: "First name"
|
|
2860
|
+
}
|
|
2861
|
+
) }),
|
|
2862
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Last Name", className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2863
|
+
Input,
|
|
2864
|
+
{
|
|
2865
|
+
value: form.lastName,
|
|
2866
|
+
onChange: (e) => setStr("lastName")(e.target.value),
|
|
2867
|
+
placeholder: "Last name"
|
|
2868
|
+
}
|
|
2869
|
+
) })
|
|
2870
|
+
] }),
|
|
2871
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2872
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Phone Number", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2873
|
+
Input,
|
|
2874
|
+
{
|
|
2875
|
+
value: form.phone,
|
|
2876
|
+
onChange: (e) => setStr("phone")(e.target.value),
|
|
2877
|
+
placeholder: "+61 4xx xxx xxx",
|
|
2878
|
+
type: "tel"
|
|
2879
|
+
}
|
|
2880
|
+
) }),
|
|
2881
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Email", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2882
|
+
Input,
|
|
2883
|
+
{
|
|
2884
|
+
value: form.email,
|
|
2885
|
+
onChange: (e) => setStr("email")(e.target.value),
|
|
2886
|
+
placeholder: "email@example.com",
|
|
2887
|
+
type: "email"
|
|
2888
|
+
}
|
|
2889
|
+
) })
|
|
2890
|
+
] }),
|
|
2891
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2892
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Date of Birth", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2893
|
+
DatePicker,
|
|
2894
|
+
{
|
|
2895
|
+
value: form.dob ? new Date(form.dob) : void 0,
|
|
2896
|
+
onChange: (d) => setStr("dob")(d ? d.toISOString().slice(0, 10) : ""),
|
|
2897
|
+
calendarProps: {
|
|
2898
|
+
fromYear: 1900,
|
|
2899
|
+
toYear: (/* @__PURE__ */ new Date()).getFullYear() - 16
|
|
2900
|
+
}
|
|
2901
|
+
}
|
|
2902
|
+
) }),
|
|
2903
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Gender", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Select, { value: form.gender, onValueChange: setStr("gender"), children: [
|
|
2836
2904
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select" }) }),
|
|
2837
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children:
|
|
2838
|
-
]
|
|
2839
|
-
}
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
)
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2905
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: GENDER_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: g, children: g }, g)) })
|
|
2906
|
+
] }) })
|
|
2907
|
+
] }),
|
|
2908
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2909
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Marital Status", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2910
|
+
Select,
|
|
2911
|
+
{
|
|
2912
|
+
value: form.maritalStatus,
|
|
2913
|
+
onValueChange: setStr("maritalStatus"),
|
|
2914
|
+
children: [
|
|
2915
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select" }) }),
|
|
2916
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: MARITAL_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: m, children: m }, m)) })
|
|
2917
|
+
]
|
|
2918
|
+
}
|
|
2919
|
+
) }),
|
|
2920
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "No. of Dependants", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2921
|
+
Input,
|
|
2922
|
+
{
|
|
2923
|
+
type: "number",
|
|
2924
|
+
min: 0,
|
|
2925
|
+
max: 20,
|
|
2926
|
+
value: form.numDependants,
|
|
2927
|
+
onChange: (e) => handleNumDependantsChange(e.target.value),
|
|
2928
|
+
placeholder: "0"
|
|
2929
|
+
}
|
|
2930
|
+
) })
|
|
2931
|
+
] }),
|
|
2932
|
+
form.dependants.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-3", children: [
|
|
2933
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Label, { className: "text-sm font-medium", children: "Dependant Date of Birth" }),
|
|
2934
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "grid grid-cols-2 gap-3", children: form.dependants.map((dep, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: `Dependant ${i + 1}`, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2935
|
+
DatePicker,
|
|
2936
|
+
{
|
|
2937
|
+
value: dep.dob ? new Date(dep.dob) : void 0,
|
|
2938
|
+
onChange: (d) => setDependantDob(
|
|
2939
|
+
i,
|
|
2940
|
+
d ? d.toISOString().slice(0, 10) : ""
|
|
2941
|
+
),
|
|
2942
|
+
calendarProps: {
|
|
2943
|
+
fromYear: 1900,
|
|
2944
|
+
toYear: (/* @__PURE__ */ new Date()).getFullYear()
|
|
2945
|
+
}
|
|
2946
|
+
}
|
|
2947
|
+
) }, i)) })
|
|
2948
|
+
] }),
|
|
2949
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Citizen Status", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2950
|
+
Select,
|
|
2951
|
+
{
|
|
2952
|
+
value: form.citizenStatus,
|
|
2953
|
+
onValueChange: setStr("citizenStatus"),
|
|
2954
|
+
children: [
|
|
2955
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select status" }) }),
|
|
2956
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: CITIZEN_OPTIONS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: c, children: c }, c)) })
|
|
2957
|
+
]
|
|
2958
|
+
}
|
|
2959
|
+
) }),
|
|
2960
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Current Residential Address", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2961
|
+
AddressAutocomplete,
|
|
2962
|
+
{
|
|
2963
|
+
value: form.residentialAddress,
|
|
2964
|
+
onValueChange: setStr("residentialAddress"),
|
|
2965
|
+
onSelect: (opt) => setStr("residentialAddress")(opt.label)
|
|
2966
|
+
}
|
|
2967
|
+
) }),
|
|
2968
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2969
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Residential Status", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2970
|
+
Select,
|
|
2971
|
+
{
|
|
2972
|
+
value: form.residentialStatus,
|
|
2973
|
+
onValueChange: setStr("residentialStatus"),
|
|
2974
|
+
children: [
|
|
2975
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select" }) }),
|
|
2976
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: RESIDENTIAL_STATUS_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: o, children: o }, o)) })
|
|
2977
|
+
]
|
|
2978
|
+
}
|
|
2979
|
+
) }),
|
|
2980
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Time at Address", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex gap-2", children: [
|
|
2981
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1 flex-1", children: [
|
|
2982
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2983
|
+
Input,
|
|
2984
|
+
{
|
|
2985
|
+
type: "number",
|
|
2986
|
+
min: 0,
|
|
2987
|
+
value: form.timeAtAddressYears,
|
|
2988
|
+
onChange: (e) => setStr("timeAtAddressYears")(e.target.value),
|
|
2989
|
+
placeholder: "0"
|
|
2990
|
+
}
|
|
2991
|
+
),
|
|
2992
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-sm text-muted-foreground shrink-0", children: "yr" })
|
|
2993
|
+
] }),
|
|
2994
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1 flex-1", children: [
|
|
2995
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2996
|
+
Input,
|
|
2997
|
+
{
|
|
2998
|
+
type: "number",
|
|
2999
|
+
min: 0,
|
|
3000
|
+
max: 11,
|
|
3001
|
+
value: form.timeAtAddressMonths,
|
|
3002
|
+
onChange: (e) => setStr("timeAtAddressMonths")(e.target.value),
|
|
3003
|
+
placeholder: "0"
|
|
3004
|
+
}
|
|
3005
|
+
),
|
|
3006
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-sm text-muted-foreground shrink-0", children: "mo" })
|
|
3007
|
+
] })
|
|
3008
|
+
] }) })
|
|
3009
|
+
] }),
|
|
3010
|
+
parseInt(form.timeAtAddressYears || "99") < 2 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Previous Address", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3011
|
+
AddressAutocomplete,
|
|
3012
|
+
{
|
|
3013
|
+
value: form.previousAddress,
|
|
3014
|
+
onValueChange: setStr("previousAddress"),
|
|
3015
|
+
onSelect: (opt) => setStr("previousAddress")(opt.label)
|
|
2866
3016
|
}
|
|
2867
|
-
}
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Citizen Status", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2871
|
-
Select,
|
|
2872
|
-
{
|
|
2873
|
-
value: form.citizenStatus,
|
|
2874
|
-
onValueChange: setStr("citizenStatus"),
|
|
2875
|
-
children: [
|
|
2876
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select status" }) }),
|
|
2877
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: CITIZEN_OPTIONS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: c, children: c }, c)) })
|
|
2878
|
-
]
|
|
2879
|
-
}
|
|
2880
|
-
) }),
|
|
2881
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Current Residential Address", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2882
|
-
AddressAutocomplete,
|
|
2883
|
-
{
|
|
2884
|
-
value: form.residentialAddress,
|
|
2885
|
-
onValueChange: setStr("residentialAddress"),
|
|
2886
|
-
onSelect: (opt) => setStr("residentialAddress")(opt.label)
|
|
2887
|
-
}
|
|
2888
|
-
) }),
|
|
2889
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2890
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Residential Status", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2891
|
-
Select,
|
|
2892
|
-
{
|
|
2893
|
-
value: form.residentialStatus,
|
|
2894
|
-
onValueChange: setStr("residentialStatus"),
|
|
2895
|
-
children: [
|
|
2896
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select" }) }),
|
|
2897
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: RESIDENTIAL_STATUS_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: o, children: o }, o)) })
|
|
2898
|
-
]
|
|
2899
|
-
}
|
|
2900
|
-
) }),
|
|
2901
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Time at Address", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex gap-2", children: [
|
|
2902
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1 flex-1", children: [
|
|
2903
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3017
|
+
) }),
|
|
3018
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
3019
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Driver's Licence", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2904
3020
|
Input,
|
|
2905
3021
|
{
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
onChange: (e) => setStr("timeAtAddressYears")(e.target.value),
|
|
2910
|
-
placeholder: "0"
|
|
3022
|
+
value: form.driversLicence,
|
|
3023
|
+
onChange: (e) => setStr("driversLicence")(e.target.value),
|
|
3024
|
+
placeholder: "e.g. 12345678"
|
|
2911
3025
|
}
|
|
2912
|
-
),
|
|
2913
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2914
|
-
] }),
|
|
2915
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1 flex-1", children: [
|
|
2916
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3026
|
+
) }),
|
|
3027
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Passport Number", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2917
3028
|
Input,
|
|
2918
3029
|
{
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
value: form.timeAtAddressMonths,
|
|
2923
|
-
onChange: (e) => setStr("timeAtAddressMonths")(e.target.value),
|
|
2924
|
-
placeholder: "0"
|
|
3030
|
+
value: form.passport,
|
|
3031
|
+
onChange: (e) => setStr("passport")(e.target.value),
|
|
3032
|
+
placeholder: "e.g. PA1234567"
|
|
2925
3033
|
}
|
|
2926
|
-
)
|
|
2927
|
-
|
|
3034
|
+
) })
|
|
3035
|
+
] }),
|
|
3036
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
3037
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Property in Trust", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3038
|
+
Select,
|
|
3039
|
+
{
|
|
3040
|
+
value: form.propertyInTrust,
|
|
3041
|
+
onValueChange: setStr("propertyInTrust"),
|
|
3042
|
+
children: [
|
|
3043
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select" }) }),
|
|
3044
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: PROPERTY_IN_TRUST_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: o, children: o }, o)) })
|
|
3045
|
+
]
|
|
3046
|
+
}
|
|
3047
|
+
) }),
|
|
3048
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Company Ownership", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3049
|
+
Select,
|
|
3050
|
+
{
|
|
3051
|
+
value: form.companyOwnership,
|
|
3052
|
+
onValueChange: setStr("companyOwnership"),
|
|
3053
|
+
children: [
|
|
3054
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select" }) }),
|
|
3055
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: COMPANY_OWNERSHIP_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: o, children: o }, o)) })
|
|
3056
|
+
]
|
|
3057
|
+
}
|
|
3058
|
+
) })
|
|
2928
3059
|
] })
|
|
2929
|
-
] })
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
) }),
|
|
2948
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Passport Number", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2949
|
-
Input,
|
|
2950
|
-
{
|
|
2951
|
-
value: form.passport,
|
|
2952
|
-
onChange: (e) => setStr("passport")(e.target.value),
|
|
2953
|
-
placeholder: "e.g. PA1234567"
|
|
2954
|
-
}
|
|
2955
|
-
) })
|
|
2956
|
-
] }),
|
|
2957
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2958
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Property in Trust", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2959
|
-
Select,
|
|
2960
|
-
{
|
|
2961
|
-
value: form.propertyInTrust,
|
|
2962
|
-
onValueChange: setStr("propertyInTrust"),
|
|
2963
|
-
children: [
|
|
2964
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select" }) }),
|
|
2965
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: PROPERTY_IN_TRUST_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: o, children: o }, o)) })
|
|
2966
|
-
]
|
|
2967
|
-
}
|
|
2968
|
-
) }),
|
|
2969
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Company Ownership", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2970
|
-
Select,
|
|
2971
|
-
{
|
|
2972
|
-
value: form.companyOwnership,
|
|
2973
|
-
onValueChange: setStr("companyOwnership"),
|
|
2974
|
-
children: [
|
|
2975
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select" }) }),
|
|
2976
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: COMPANY_OWNERSHIP_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: o, children: o }, o)) })
|
|
2977
|
-
]
|
|
2978
|
-
}
|
|
2979
|
-
) })
|
|
2980
|
-
] })
|
|
2981
|
-
] }),
|
|
2982
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogFooter, { children: [
|
|
2983
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { variant: "outline", onClick: () => onOpenChange(false), children: "Cancel" }),
|
|
2984
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2985
|
-
Button,
|
|
2986
|
-
{
|
|
2987
|
-
onClick: () => {
|
|
2988
|
-
onSave(form);
|
|
2989
|
-
onOpenChange(false);
|
|
2990
|
-
},
|
|
2991
|
-
children: "Save"
|
|
2992
|
-
}
|
|
2993
|
-
)
|
|
2994
|
-
] })
|
|
2995
|
-
] }) });
|
|
3060
|
+
] }),
|
|
3061
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogFooter, { children: [
|
|
3062
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { variant: "outline", onClick: () => onOpenChange(false), children: "Cancel" }),
|
|
3063
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3064
|
+
Button,
|
|
3065
|
+
{
|
|
3066
|
+
disabled: !isDirty,
|
|
3067
|
+
onClick: () => {
|
|
3068
|
+
onSave(form);
|
|
3069
|
+
onOpenChange(false);
|
|
3070
|
+
},
|
|
3071
|
+
children: "Save"
|
|
3072
|
+
}
|
|
3073
|
+
)
|
|
3074
|
+
] })
|
|
3075
|
+
]
|
|
3076
|
+
}
|
|
3077
|
+
) });
|
|
2996
3078
|
}
|
|
2997
3079
|
function EditIncomeModal({
|
|
2998
3080
|
open,
|
|
@@ -3000,6 +3082,7 @@ function EditIncomeModal({
|
|
|
3000
3082
|
applicantLabel = "Applicant",
|
|
3001
3083
|
initialData,
|
|
3002
3084
|
onSave,
|
|
3085
|
+
container,
|
|
3003
3086
|
className
|
|
3004
3087
|
}) {
|
|
3005
3088
|
const defaultItems = React8.useMemo(
|
|
@@ -3011,204 +3094,214 @@ function EditIncomeModal({
|
|
|
3011
3094
|
// eslint-disable-line react-hooks/exhaustive-deps
|
|
3012
3095
|
);
|
|
3013
3096
|
const [items, setItems] = React8.useState(defaultItems);
|
|
3097
|
+
const initialSnapshot = React8.useRef("");
|
|
3014
3098
|
React8.useEffect(() => {
|
|
3015
3099
|
var _a;
|
|
3016
3100
|
if (open) {
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
);
|
|
3101
|
+
const data = ((_a = initialData == null ? void 0 : initialData.items) == null ? void 0 : _a.length) ? initialData.items : [makeDefaultIncomeItem()];
|
|
3102
|
+
setItems(data);
|
|
3103
|
+
initialSnapshot.current = JSON.stringify(data);
|
|
3020
3104
|
}
|
|
3021
3105
|
}, [open]);
|
|
3106
|
+
const isDirty = JSON.stringify(items) !== initialSnapshot.current;
|
|
3022
3107
|
const updateItem = (id, key, val) => setItems(
|
|
3023
3108
|
(prev) => prev.map((item) => item.id === id ? __spreadProps(__spreadValues({}, item), { [key]: val }) : item)
|
|
3024
3109
|
);
|
|
3025
3110
|
const removeItem = (id) => setItems((prev) => prev.filter((item) => item.id !== id));
|
|
3026
3111
|
const addItem = () => setItems((prev) => [...prev, makeDefaultIncomeItem()]);
|
|
3027
3112
|
const defaultOpenItems = items.length > 0 ? [items[0].id] : [];
|
|
3028
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
removeLabel: "Remove income item"
|
|
3047
|
-
}
|
|
3048
|
-
),
|
|
3049
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AccordionContent, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-4 pt-1", children: [
|
|
3050
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Income Type", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3051
|
-
Select,
|
|
3052
|
-
{
|
|
3053
|
-
value: item.incomeType,
|
|
3054
|
-
onValueChange: (val) => updateItem(item.id, "incomeType", val),
|
|
3055
|
-
children: [
|
|
3056
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select type" }) }),
|
|
3057
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: INCOME_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: t, children: t }, t)) })
|
|
3058
|
-
]
|
|
3059
|
-
}
|
|
3060
|
-
) }),
|
|
3061
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Job Title", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3062
|
-
Input,
|
|
3063
|
-
{
|
|
3064
|
-
value: item.jobTitle,
|
|
3065
|
-
onChange: (e) => updateItem(item.id, "jobTitle", e.target.value),
|
|
3066
|
-
placeholder: "Job title"
|
|
3067
|
-
}
|
|
3068
|
-
) }),
|
|
3069
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
3070
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Start Date", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3071
|
-
DatePicker,
|
|
3072
|
-
{
|
|
3073
|
-
value: item.startDate ? new Date(item.startDate) : void 0,
|
|
3074
|
-
onChange: (d) => updateItem(
|
|
3075
|
-
item.id,
|
|
3076
|
-
"startDate",
|
|
3077
|
-
d ? d.toISOString().slice(0, 10) : ""
|
|
3078
|
-
),
|
|
3079
|
-
calendarProps: {
|
|
3080
|
-
fromYear: 1950,
|
|
3081
|
-
toYear: (/* @__PURE__ */ new Date()).getFullYear()
|
|
3082
|
-
}
|
|
3083
|
-
}
|
|
3084
|
-
) }),
|
|
3085
|
-
!item.stillInPosition && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "End Date", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3086
|
-
DatePicker,
|
|
3087
|
-
{
|
|
3088
|
-
value: item.endDate ? new Date(item.endDate) : void 0,
|
|
3089
|
-
onChange: (d) => updateItem(
|
|
3090
|
-
item.id,
|
|
3091
|
-
"endDate",
|
|
3092
|
-
d ? d.toISOString().slice(0, 10) : ""
|
|
3093
|
-
),
|
|
3094
|
-
calendarProps: {
|
|
3095
|
-
fromYear: 1950,
|
|
3096
|
-
toYear: (/* @__PURE__ */ new Date()).getFullYear()
|
|
3097
|
-
}
|
|
3098
|
-
}
|
|
3099
|
-
) })
|
|
3100
|
-
] }),
|
|
3101
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3114
|
+
DialogContent,
|
|
3115
|
+
{
|
|
3116
|
+
className: cn("max-w-lg", className),
|
|
3117
|
+
container,
|
|
3118
|
+
children: [
|
|
3119
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogTitle, { children: [
|
|
3120
|
+
"Edit Income ",
|
|
3121
|
+
applicantLabel
|
|
3122
|
+
] }) }),
|
|
3123
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(ModalScroll, { children: [
|
|
3124
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3125
|
+
Accordion,
|
|
3126
|
+
{
|
|
3127
|
+
multiple: true,
|
|
3128
|
+
defaultValue: defaultOpenItems,
|
|
3129
|
+
className: "w-full",
|
|
3130
|
+
children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(AccordionItem, { value: item.id, children: [
|
|
3102
3131
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3103
|
-
|
|
3132
|
+
AccordionItemHeader,
|
|
3104
3133
|
{
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
item.id,
|
|
3109
|
-
"stillInPosition",
|
|
3110
|
-
checked === true
|
|
3111
|
-
)
|
|
3134
|
+
label: `Income ${index + 1} \u2014 ${item.incomeType || "New Income"}`,
|
|
3135
|
+
onRemove: () => removeItem(item.id),
|
|
3136
|
+
removeLabel: "Remove income item"
|
|
3112
3137
|
}
|
|
3113
3138
|
),
|
|
3114
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
htmlFor: `still-in-position-${item.id}`,
|
|
3118
|
-
className: "text-sm cursor-pointer select-none",
|
|
3119
|
-
children: "Still in position"
|
|
3120
|
-
}
|
|
3121
|
-
)
|
|
3122
|
-
] }),
|
|
3123
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Company Name", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3124
|
-
Input,
|
|
3125
|
-
{
|
|
3126
|
-
value: item.companyName,
|
|
3127
|
-
onChange: (e) => updateItem(item.id, "companyName", e.target.value),
|
|
3128
|
-
placeholder: "Company name"
|
|
3129
|
-
}
|
|
3130
|
-
) }),
|
|
3131
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Company Address", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3132
|
-
AddressAutocomplete,
|
|
3133
|
-
{
|
|
3134
|
-
value: item.companyAddress,
|
|
3135
|
-
onValueChange: (val) => updateItem(item.id, "companyAddress", val),
|
|
3136
|
-
placeholder: "Search company address"
|
|
3137
|
-
}
|
|
3138
|
-
) }),
|
|
3139
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-start gap-3", children: [
|
|
3140
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Income Amount", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3141
|
-
CurrencyInputWithSlider,
|
|
3142
|
-
{
|
|
3143
|
-
value: item.incomeAmount,
|
|
3144
|
-
min: 0,
|
|
3145
|
-
max: 1e6,
|
|
3146
|
-
step: 1e3,
|
|
3147
|
-
onValueChange: (val) => updateItem(item.id, "incomeAmount", val)
|
|
3148
|
-
}
|
|
3149
|
-
) }) }),
|
|
3150
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "shrink-0 mt-[1.625rem]", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3151
|
-
FrequencyToggle,
|
|
3152
|
-
{
|
|
3153
|
-
value: item.frequency,
|
|
3154
|
-
onValueChange: (val) => updateItem(item.id, "frequency", val)
|
|
3155
|
-
}
|
|
3156
|
-
) })
|
|
3157
|
-
] }),
|
|
3158
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Type of Company", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3159
|
-
RadioGroup,
|
|
3160
|
-
{
|
|
3161
|
-
value: item.companyType,
|
|
3162
|
-
onValueChange: (val) => updateItem(
|
|
3163
|
-
item.id,
|
|
3164
|
-
"companyType",
|
|
3165
|
-
val
|
|
3166
|
-
),
|
|
3167
|
-
className: "flex gap-4",
|
|
3168
|
-
children: ["Public", "Private"].map((opt) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3169
|
-
"label",
|
|
3139
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AccordionContent, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-4 pt-1", children: [
|
|
3140
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Income Type", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3141
|
+
Select,
|
|
3170
3142
|
{
|
|
3171
|
-
|
|
3143
|
+
value: item.incomeType,
|
|
3144
|
+
onValueChange: (val) => updateItem(item.id, "incomeType", val),
|
|
3172
3145
|
children: [
|
|
3173
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3174
|
-
|
|
3146
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select type" }) }),
|
|
3147
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: INCOME_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: t, children: t }, t)) })
|
|
3175
3148
|
]
|
|
3176
|
-
}
|
|
3177
|
-
|
|
3178
|
-
))
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3149
|
+
}
|
|
3150
|
+
) }),
|
|
3151
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Job Title", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3152
|
+
Input,
|
|
3153
|
+
{
|
|
3154
|
+
value: item.jobTitle,
|
|
3155
|
+
onChange: (e) => updateItem(item.id, "jobTitle", e.target.value),
|
|
3156
|
+
placeholder: "Job title"
|
|
3157
|
+
}
|
|
3158
|
+
) }),
|
|
3159
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
3160
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Start Date", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3161
|
+
DatePicker,
|
|
3162
|
+
{
|
|
3163
|
+
value: item.startDate ? new Date(item.startDate) : void 0,
|
|
3164
|
+
onChange: (d) => updateItem(
|
|
3165
|
+
item.id,
|
|
3166
|
+
"startDate",
|
|
3167
|
+
d ? d.toISOString().slice(0, 10) : ""
|
|
3168
|
+
),
|
|
3169
|
+
calendarProps: {
|
|
3170
|
+
fromYear: 1950,
|
|
3171
|
+
toYear: (/* @__PURE__ */ new Date()).getFullYear()
|
|
3172
|
+
}
|
|
3173
|
+
}
|
|
3174
|
+
) }),
|
|
3175
|
+
!item.stillInPosition && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "End Date", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3176
|
+
DatePicker,
|
|
3177
|
+
{
|
|
3178
|
+
value: item.endDate ? new Date(item.endDate) : void 0,
|
|
3179
|
+
onChange: (d) => updateItem(
|
|
3180
|
+
item.id,
|
|
3181
|
+
"endDate",
|
|
3182
|
+
d ? d.toISOString().slice(0, 10) : ""
|
|
3183
|
+
),
|
|
3184
|
+
calendarProps: {
|
|
3185
|
+
fromYear: 1950,
|
|
3186
|
+
toYear: (/* @__PURE__ */ new Date()).getFullYear()
|
|
3187
|
+
}
|
|
3188
|
+
}
|
|
3189
|
+
) })
|
|
3190
|
+
] }),
|
|
3191
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3192
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3193
|
+
Checkbox,
|
|
3194
|
+
{
|
|
3195
|
+
id: `still-in-position-${item.id}`,
|
|
3196
|
+
checked: item.stillInPosition,
|
|
3197
|
+
onCheckedChange: (checked) => updateItem(
|
|
3198
|
+
item.id,
|
|
3199
|
+
"stillInPosition",
|
|
3200
|
+
checked === true
|
|
3201
|
+
)
|
|
3202
|
+
}
|
|
3203
|
+
),
|
|
3204
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3205
|
+
"label",
|
|
3206
|
+
{
|
|
3207
|
+
htmlFor: `still-in-position-${item.id}`,
|
|
3208
|
+
className: "text-sm cursor-pointer select-none",
|
|
3209
|
+
children: "Still in position"
|
|
3210
|
+
}
|
|
3211
|
+
)
|
|
3212
|
+
] }),
|
|
3213
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Company Name", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3214
|
+
Input,
|
|
3215
|
+
{
|
|
3216
|
+
value: item.companyName,
|
|
3217
|
+
onChange: (e) => updateItem(item.id, "companyName", e.target.value),
|
|
3218
|
+
placeholder: "Company name"
|
|
3219
|
+
}
|
|
3220
|
+
) }),
|
|
3221
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Company Address", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3222
|
+
AddressAutocomplete,
|
|
3223
|
+
{
|
|
3224
|
+
value: item.companyAddress,
|
|
3225
|
+
onValueChange: (val) => updateItem(item.id, "companyAddress", val),
|
|
3226
|
+
placeholder: "Search company address"
|
|
3227
|
+
}
|
|
3228
|
+
) }),
|
|
3229
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-start gap-3", children: [
|
|
3230
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Income Amount", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3231
|
+
CurrencyInputWithSlider,
|
|
3232
|
+
{
|
|
3233
|
+
value: item.incomeAmount,
|
|
3234
|
+
min: 0,
|
|
3235
|
+
max: 1e6,
|
|
3236
|
+
step: 1e3,
|
|
3237
|
+
onValueChange: (val) => updateItem(item.id, "incomeAmount", val)
|
|
3238
|
+
}
|
|
3239
|
+
) }) }),
|
|
3240
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "shrink-0 mt-[1.625rem]", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3241
|
+
FrequencyToggle,
|
|
3242
|
+
{
|
|
3243
|
+
value: item.frequency,
|
|
3244
|
+
onValueChange: (val) => updateItem(item.id, "frequency", val)
|
|
3245
|
+
}
|
|
3246
|
+
) })
|
|
3247
|
+
] }),
|
|
3248
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Type of Company", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3249
|
+
RadioGroup,
|
|
3250
|
+
{
|
|
3251
|
+
value: item.companyType,
|
|
3252
|
+
onValueChange: (val) => updateItem(
|
|
3253
|
+
item.id,
|
|
3254
|
+
"companyType",
|
|
3255
|
+
val
|
|
3256
|
+
),
|
|
3257
|
+
className: "flex gap-4",
|
|
3258
|
+
children: ["Public", "Private"].map((opt) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3259
|
+
"label",
|
|
3260
|
+
{
|
|
3261
|
+
className: "flex items-center gap-2 cursor-pointer text-sm",
|
|
3262
|
+
children: [
|
|
3263
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RadioGroupItem, { value: opt }),
|
|
3264
|
+
opt
|
|
3265
|
+
]
|
|
3266
|
+
},
|
|
3267
|
+
opt
|
|
3268
|
+
))
|
|
3269
|
+
}
|
|
3270
|
+
) })
|
|
3271
|
+
] }) })
|
|
3272
|
+
] }, item.id))
|
|
3273
|
+
}
|
|
3274
|
+
),
|
|
3275
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3276
|
+
Button,
|
|
3277
|
+
{
|
|
3278
|
+
variant: "outline",
|
|
3279
|
+
onClick: addItem,
|
|
3280
|
+
className: "w-full gap-1.5",
|
|
3281
|
+
children: [
|
|
3282
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react10.Plus, { className: "h-4 w-4" }),
|
|
3283
|
+
"Add More"
|
|
3284
|
+
]
|
|
3285
|
+
}
|
|
3286
|
+
)
|
|
3287
|
+
] }),
|
|
3288
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogFooter, { children: [
|
|
3289
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { variant: "outline", onClick: () => onOpenChange(false), children: "Cancel" }),
|
|
3290
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3291
|
+
Button,
|
|
3292
|
+
{
|
|
3293
|
+
disabled: !isDirty,
|
|
3294
|
+
onClick: () => {
|
|
3295
|
+
onSave({ items });
|
|
3296
|
+
onOpenChange(false);
|
|
3297
|
+
},
|
|
3298
|
+
children: "Save"
|
|
3299
|
+
}
|
|
3300
|
+
)
|
|
3301
|
+
] })
|
|
3302
|
+
]
|
|
3303
|
+
}
|
|
3304
|
+
) });
|
|
3212
3305
|
}
|
|
3213
3306
|
function EditExpensesModal({
|
|
3214
3307
|
open,
|
|
@@ -3216,6 +3309,7 @@ function EditExpensesModal({
|
|
|
3216
3309
|
applicantLabel = "Applicant",
|
|
3217
3310
|
initialData,
|
|
3218
3311
|
onSave,
|
|
3312
|
+
container,
|
|
3219
3313
|
className
|
|
3220
3314
|
}) {
|
|
3221
3315
|
const defaultItems = React8.useMemo(
|
|
@@ -3227,127 +3321,137 @@ function EditExpensesModal({
|
|
|
3227
3321
|
// eslint-disable-line react-hooks/exhaustive-deps
|
|
3228
3322
|
);
|
|
3229
3323
|
const [items, setItems] = React8.useState(defaultItems);
|
|
3324
|
+
const initialSnapshot = React8.useRef("");
|
|
3230
3325
|
React8.useEffect(() => {
|
|
3231
3326
|
var _a;
|
|
3232
3327
|
if (open) {
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
);
|
|
3328
|
+
const data = ((_a = initialData == null ? void 0 : initialData.items) == null ? void 0 : _a.length) ? initialData.items : [makeDefaultExpenseItem()];
|
|
3329
|
+
setItems(data);
|
|
3330
|
+
initialSnapshot.current = JSON.stringify(data);
|
|
3236
3331
|
}
|
|
3237
3332
|
}, [open]);
|
|
3333
|
+
const isDirty = JSON.stringify(items) !== initialSnapshot.current;
|
|
3238
3334
|
const updateItem = (id, key, val) => setItems(
|
|
3239
3335
|
(prev) => prev.map((item) => item.id === id ? __spreadProps(__spreadValues({}, item), { [key]: val }) : item)
|
|
3240
3336
|
);
|
|
3241
3337
|
const removeItem = (id) => setItems((prev) => prev.filter((item) => item.id !== id));
|
|
3242
3338
|
const addItem = () => setItems((prev) => [...prev, makeDefaultExpenseItem()]);
|
|
3243
3339
|
const defaultOpenItems = items.length > 0 ? [items[0].id] : [];
|
|
3244
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
),
|
|
3265
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AccordionContent, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-4 pt-1", children: [
|
|
3266
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Expense Type", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3267
|
-
Select,
|
|
3268
|
-
{
|
|
3269
|
-
value: item.expenseType,
|
|
3270
|
-
onValueChange: (val) => updateItem(item.id, "expenseType", val),
|
|
3271
|
-
children: [
|
|
3272
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select type" }) }),
|
|
3273
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: EXPENSE_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: t, children: t }, t)) })
|
|
3274
|
-
]
|
|
3275
|
-
}
|
|
3276
|
-
) }),
|
|
3277
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-start gap-3", children: [
|
|
3278
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Amount", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3279
|
-
CurrencyInputWithSlider,
|
|
3280
|
-
{
|
|
3281
|
-
value: item.amount,
|
|
3282
|
-
min: 0,
|
|
3283
|
-
max: 1e5,
|
|
3284
|
-
step: 100,
|
|
3285
|
-
onValueChange: (val) => updateItem(item.id, "amount", val)
|
|
3286
|
-
}
|
|
3287
|
-
) }) }),
|
|
3288
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "shrink-0 mt-[1.625rem]", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3289
|
-
FrequencyToggle,
|
|
3340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3341
|
+
DialogContent,
|
|
3342
|
+
{
|
|
3343
|
+
className: cn("max-w-lg", className),
|
|
3344
|
+
container,
|
|
3345
|
+
children: [
|
|
3346
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogTitle, { children: [
|
|
3347
|
+
"Edit Expenses ",
|
|
3348
|
+
applicantLabel
|
|
3349
|
+
] }) }),
|
|
3350
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(ModalScroll, { children: [
|
|
3351
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3352
|
+
Accordion,
|
|
3353
|
+
{
|
|
3354
|
+
multiple: true,
|
|
3355
|
+
defaultValue: defaultOpenItems,
|
|
3356
|
+
className: "w-full",
|
|
3357
|
+
children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(AccordionItem, { value: item.id, children: [
|
|
3358
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3359
|
+
AccordionItemHeader,
|
|
3290
3360
|
{
|
|
3291
|
-
|
|
3292
|
-
|
|
3361
|
+
label: `Expense ${index + 1} \u2014 ${item.expenseType || "New Expense"}`,
|
|
3362
|
+
onRemove: () => removeItem(item.id),
|
|
3363
|
+
removeLabel: "Remove expense item"
|
|
3293
3364
|
}
|
|
3294
|
-
)
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
{
|
|
3299
|
-
owners: [
|
|
3365
|
+
),
|
|
3366
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AccordionContent, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col gap-4 pt-1", children: [
|
|
3367
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Expense Type", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3368
|
+
Select,
|
|
3300
3369
|
{
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3370
|
+
value: item.expenseType,
|
|
3371
|
+
onValueChange: (val) => updateItem(item.id, "expenseType", val),
|
|
3372
|
+
children: [
|
|
3373
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectValue, { placeholder: "Select type" }) }),
|
|
3374
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectContent, { children: EXPENSE_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectItem, { value: t, children: t }, t)) })
|
|
3375
|
+
]
|
|
3376
|
+
}
|
|
3377
|
+
) }),
|
|
3378
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-start gap-3", children: [
|
|
3379
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Amount", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3380
|
+
CurrencyInputWithSlider,
|
|
3381
|
+
{
|
|
3382
|
+
value: item.amount,
|
|
3383
|
+
min: 0,
|
|
3384
|
+
max: 1e5,
|
|
3385
|
+
step: 100,
|
|
3386
|
+
onValueChange: (val) => updateItem(item.id, "amount", val)
|
|
3387
|
+
}
|
|
3388
|
+
) }) }),
|
|
3389
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "shrink-0 mt-[1.625rem]", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3390
|
+
FrequencyToggle,
|
|
3391
|
+
{
|
|
3392
|
+
value: item.frequency,
|
|
3393
|
+
onValueChange: (val) => updateItem(item.id, "frequency", val)
|
|
3394
|
+
}
|
|
3395
|
+
) })
|
|
3396
|
+
] }),
|
|
3397
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FormField, { label: "Ownership (%)", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3398
|
+
OwnershipSplit,
|
|
3305
3399
|
{
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3400
|
+
owners: [
|
|
3401
|
+
{
|
|
3402
|
+
id: "main",
|
|
3403
|
+
name: "Main Applicant",
|
|
3404
|
+
share: item.mainShare
|
|
3405
|
+
},
|
|
3406
|
+
{
|
|
3407
|
+
id: "co",
|
|
3408
|
+
name: "Co-Applicant",
|
|
3409
|
+
share: item.coShare
|
|
3410
|
+
}
|
|
3411
|
+
],
|
|
3412
|
+
onOwnersChange: (owners) => {
|
|
3413
|
+
var _a, _b, _c, _d;
|
|
3414
|
+
const main = (_b = (_a = owners.find((o) => o.id === "main")) == null ? void 0 : _a.share) != null ? _b : item.mainShare;
|
|
3415
|
+
const co = (_d = (_c = owners.find((o) => o.id === "co")) == null ? void 0 : _c.share) != null ? _d : item.coShare;
|
|
3416
|
+
updateItem(item.id, "mainShare", main);
|
|
3417
|
+
updateItem(item.id, "coShare", co);
|
|
3418
|
+
}
|
|
3309
3419
|
}
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
},
|
|
3346
|
-
children: "Save"
|
|
3347
|
-
}
|
|
3348
|
-
)
|
|
3349
|
-
] })
|
|
3350
|
-
] }) });
|
|
3420
|
+
) })
|
|
3421
|
+
] }) })
|
|
3422
|
+
] }, item.id))
|
|
3423
|
+
}
|
|
3424
|
+
),
|
|
3425
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3426
|
+
Button,
|
|
3427
|
+
{
|
|
3428
|
+
variant: "outline",
|
|
3429
|
+
onClick: addItem,
|
|
3430
|
+
className: "w-full gap-1.5",
|
|
3431
|
+
children: [
|
|
3432
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react10.Plus, { className: "h-4 w-4" }),
|
|
3433
|
+
"Add More"
|
|
3434
|
+
]
|
|
3435
|
+
}
|
|
3436
|
+
)
|
|
3437
|
+
] }),
|
|
3438
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogFooter, { children: [
|
|
3439
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { variant: "outline", onClick: () => onOpenChange(false), children: "Cancel" }),
|
|
3440
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3441
|
+
Button,
|
|
3442
|
+
{
|
|
3443
|
+
disabled: !isDirty,
|
|
3444
|
+
onClick: () => {
|
|
3445
|
+
onSave({ items });
|
|
3446
|
+
onOpenChange(false);
|
|
3447
|
+
},
|
|
3448
|
+
children: "Save"
|
|
3449
|
+
}
|
|
3450
|
+
)
|
|
3451
|
+
] })
|
|
3452
|
+
]
|
|
3453
|
+
}
|
|
3454
|
+
) });
|
|
3351
3455
|
}
|
|
3352
3456
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3353
3457
|
0 && (module.exports = {
|