braid-ui 1.0.60 → 1.0.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -13953,40 +13953,29 @@ var mockTransactionTimeline = [
13953
13953
  timestamp: "2025-10-01 00:19:45"
13954
13954
  }
13955
13955
  ];
13956
- var TransactionHistory = () => {
13957
- const navigate = reactRouterDom.useNavigate();
13958
- const [currentPage, setCurrentPage] = React15.useState(1);
13959
- const [rowsPerPage, setRowsPerPage] = React15.useState(100);
13960
- const [filters, setFilters] = React15.useState({
13961
- accountNumber: "",
13962
- product: "",
13963
- customerId: "",
13964
- counterpartyId: "",
13965
- settlementFileName: "",
13966
- originalFileName: "",
13967
- requesterIpAddress: "",
13968
- requesterUsername: "",
13969
- wireFileHandle: "",
13970
- paymentId: "",
13971
- transactionType: "",
13972
- transactionStatus: "",
13973
- processingStatus: "",
13974
- direction: "",
13975
- minAmount: "",
13976
- maxAmount: "",
13977
- creationDateStart: void 0,
13978
- creationDateEnd: void 0,
13979
- postDateStart: void 0,
13980
- postDateEnd: void 0
13981
- });
13982
- const handleFilterChange = (field, value) => {
13983
- setFilters((prev) => ({ ...prev, [field]: value }));
13956
+ var TransactionHistoryFiltersSheet = ({
13957
+ filters,
13958
+ onFilterChange,
13959
+ onResetFilters,
13960
+ onApplyFilters
13961
+ }) => {
13962
+ const [localFilters, setLocalFilters] = React15.useState(filters);
13963
+ const [open, setOpen] = React15.useState(false);
13964
+ React15.useEffect(() => {
13965
+ setLocalFilters(filters);
13966
+ }, [filters]);
13967
+ const handleLocalFilterChange = (field, value) => {
13968
+ setLocalFilters((prev) => ({ ...prev, [field]: value }));
13984
13969
  };
13985
- const applyFilters = () => {
13986
- console.log("Applying filters:", filters);
13970
+ const handleApplyFilters = () => {
13971
+ Object.entries(localFilters).forEach(([key, value]) => {
13972
+ onFilterChange(key, value);
13973
+ });
13974
+ onApplyFilters();
13975
+ setOpen(false);
13987
13976
  };
13988
- const resetFilters = () => {
13989
- setFilters({
13977
+ const handleResetFilters = () => {
13978
+ const resetFilters = {
13990
13979
  accountNumber: "",
13991
13980
  product: "",
13992
13981
  customerId: "",
@@ -14007,373 +13996,467 @@ var TransactionHistory = () => {
14007
13996
  creationDateEnd: void 0,
14008
13997
  postDateStart: void 0,
14009
13998
  postDateEnd: void 0
14010
- });
14011
- };
14012
- const totalPages = Math.ceil(mockTransactions.length / rowsPerPage);
14013
- const startIndex = (currentPage - 1) * rowsPerPage;
14014
- const endIndex = startIndex + rowsPerPage;
14015
- const paginatedTransactions = mockTransactions.slice(startIndex, endIndex);
14016
- const handlePageChange = (newPage) => {
14017
- if (newPage >= 1 && newPage <= totalPages) {
14018
- setCurrentPage(newPage);
14019
- }
14020
- };
14021
- const handleRowsPerPageChange = (value) => {
14022
- setRowsPerPage(value);
14023
- setCurrentPage(1);
14024
- };
14025
- const formatCurrency4 = (value) => {
14026
- const formatted = new Intl.NumberFormat("en-US", {
14027
- style: "currency",
14028
- currency: "USD",
14029
- minimumFractionDigits: 2
14030
- }).format(value);
14031
- return formatted;
13999
+ };
14000
+ setLocalFilters(resetFilters);
14001
+ onResetFilters();
14002
+ setOpen(false);
14032
14003
  };
14033
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col h-screen bg-gradient-subtle", children: [
14034
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-none border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "container mx-auto px-4 py-4 max-w-none", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
14035
- /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-3xl font-bold text-foreground", children: "Transaction History" }),
14036
- /* @__PURE__ */ jsxRuntime.jsxs(Sheet, { children: [
14037
- /* @__PURE__ */ jsxRuntime.jsx(SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", className: "gap-2", children: [
14038
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Filter, { className: "h-4 w-4" }),
14039
- "Filters"
14040
- ] }) }),
14041
- /* @__PURE__ */ jsxRuntime.jsxs(SheetContent, { side: "right", className: "w-full sm:max-w-xl overflow-y-auto", children: [
14042
- /* @__PURE__ */ jsxRuntime.jsx(SheetHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(SheetTitle, { children: "Transaction Filters" }) }),
14043
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6 py-6", children: [
14044
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
14045
- /* @__PURE__ */ jsxRuntime.jsx(
14046
- EnhancedInput,
14047
- {
14048
- label: "Account Number",
14049
- value: filters.accountNumber,
14050
- onChange: (e) => handleFilterChange("accountNumber", e.target.value),
14051
- placeholder: "Enter account number"
14052
- }
14053
- ),
14054
- /* @__PURE__ */ jsxRuntime.jsx(
14055
- EnhancedSelect,
14056
- {
14057
- label: "Product",
14058
- value: filters.product,
14059
- onValueChange: (value) => handleFilterChange("product", value),
14060
- placeholder: "Select product",
14061
- options: [
14062
- { value: "wire", label: "Wire" },
14063
- { value: "ach", label: "ACH" },
14064
- { value: "check", label: "Check" }
14065
- ]
14066
- }
14067
- )
14068
- ] }),
14069
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
14070
- /* @__PURE__ */ jsxRuntime.jsx(
14071
- EnhancedInput,
14072
- {
14073
- label: "Customer ID",
14074
- value: filters.customerId,
14075
- onChange: (e) => handleFilterChange("customerId", e.target.value),
14076
- placeholder: "Enter customer ID"
14077
- }
14078
- ),
14079
- /* @__PURE__ */ jsxRuntime.jsx(
14080
- EnhancedInput,
14081
- {
14082
- label: "Counterparty ID",
14083
- value: filters.counterpartyId,
14084
- onChange: (e) => handleFilterChange("counterpartyId", e.target.value),
14085
- placeholder: "Enter counterparty ID"
14086
- }
14087
- )
14088
- ] }),
14089
- /* @__PURE__ */ jsxRuntime.jsx(
14090
- EnhancedInput,
14091
- {
14092
- label: "Settlement File Name",
14093
- value: filters.settlementFileName,
14094
- onChange: (e) => handleFilterChange("settlementFileName", e.target.value),
14095
- placeholder: "Enter settlement file name"
14096
- }
14097
- ),
14098
- /* @__PURE__ */ jsxRuntime.jsx(
14099
- EnhancedInput,
14100
- {
14101
- label: "Original File Name",
14102
- value: filters.originalFileName,
14103
- onChange: (e) => handleFilterChange("originalFileName", e.target.value),
14104
- placeholder: "Enter original file name"
14105
- }
14106
- ),
14107
- /* @__PURE__ */ jsxRuntime.jsx(
14108
- EnhancedInput,
14109
- {
14110
- label: "Requester IP Address",
14111
- value: filters.requesterIpAddress,
14112
- onChange: (e) => handleFilterChange("requesterIpAddress", e.target.value),
14113
- placeholder: "Enter IP address"
14114
- }
14115
- ),
14116
- /* @__PURE__ */ jsxRuntime.jsx(
14117
- EnhancedInput,
14118
- {
14119
- label: "Requester Username",
14120
- value: filters.requesterUsername,
14121
- onChange: (e) => handleFilterChange("requesterUsername", e.target.value),
14122
- placeholder: "Enter username"
14123
- }
14124
- ),
14125
- /* @__PURE__ */ jsxRuntime.jsx(
14126
- EnhancedInput,
14127
- {
14128
- label: "Wire File Handle",
14129
- value: filters.wireFileHandle,
14130
- onChange: (e) => handleFilterChange("wireFileHandle", e.target.value),
14131
- placeholder: "Enter wire file handle"
14132
- }
14133
- ),
14134
- /* @__PURE__ */ jsxRuntime.jsx(
14135
- EnhancedInput,
14136
- {
14137
- label: "Payment ID",
14138
- value: filters.paymentId,
14139
- onChange: (e) => handleFilterChange("paymentId", e.target.value),
14140
- placeholder: "Enter payment ID"
14141
- }
14142
- ),
14143
- /* @__PURE__ */ jsxRuntime.jsx(
14144
- EnhancedSelect,
14145
- {
14146
- label: "Transaction Type",
14147
- value: filters.transactionType,
14148
- onValueChange: (value) => handleFilterChange("transactionType", value),
14149
- placeholder: "Select transaction type",
14150
- options: [
14151
- { value: "ach_credit", label: "ACH Credit" },
14152
- { value: "ach_debit", label: "ACH Debit" },
14153
- { value: "wire_domestic", label: "Wire Domestic" },
14154
- { value: "wire_international", label: "Wire International" }
14155
- ]
14156
- }
14157
- ),
14158
- /* @__PURE__ */ jsxRuntime.jsx(
14159
- EnhancedSelect,
14160
- {
14161
- label: "Transaction Status",
14162
- value: filters.transactionStatus,
14163
- onValueChange: (value) => handleFilterChange("transactionStatus", value),
14164
- placeholder: "Select transaction status",
14165
- options: [
14166
- { value: "PENDING", label: "Pending" },
14167
- { value: "POSTED", label: "Posted" },
14168
- { value: "FAILED", label: "Failed" },
14169
- { value: "CANCELLED", label: "Cancelled" }
14170
- ]
14171
- }
14172
- ),
14004
+ return /* @__PURE__ */ jsxRuntime.jsxs(Sheet, { open, onOpenChange: setOpen, children: [
14005
+ /* @__PURE__ */ jsxRuntime.jsx(SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", className: "gap-2", children: [
14006
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Filter, { className: "h-4 w-4" }),
14007
+ "Filters"
14008
+ ] }) }),
14009
+ /* @__PURE__ */ jsxRuntime.jsxs(SheetContent, { side: "right", className: "w-full sm:max-w-xl overflow-y-auto", children: [
14010
+ /* @__PURE__ */ jsxRuntime.jsx(SheetHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(SheetTitle, { children: "Transaction Filters" }) }),
14011
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6 py-6", children: [
14012
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
14013
+ /* @__PURE__ */ jsxRuntime.jsx(
14014
+ EnhancedInput,
14015
+ {
14016
+ label: "Account Number",
14017
+ value: localFilters.accountNumber,
14018
+ onChange: (e) => handleLocalFilterChange("accountNumber", e.target.value),
14019
+ placeholder: "Enter account number"
14020
+ }
14021
+ ),
14022
+ /* @__PURE__ */ jsxRuntime.jsx(
14023
+ EnhancedSelect,
14024
+ {
14025
+ label: "Product",
14026
+ value: localFilters.product,
14027
+ onValueChange: (value) => handleLocalFilterChange("product", value),
14028
+ placeholder: "Select product",
14029
+ options: [
14030
+ { value: "wire", label: "Wire" },
14031
+ { value: "ach", label: "ACH" },
14032
+ { value: "check", label: "Check" }
14033
+ ]
14034
+ }
14035
+ )
14036
+ ] }),
14037
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
14038
+ /* @__PURE__ */ jsxRuntime.jsx(
14039
+ EnhancedInput,
14040
+ {
14041
+ label: "Customer ID",
14042
+ value: localFilters.customerId,
14043
+ onChange: (e) => handleLocalFilterChange("customerId", e.target.value),
14044
+ placeholder: "Enter customer ID"
14045
+ }
14046
+ ),
14047
+ /* @__PURE__ */ jsxRuntime.jsx(
14048
+ EnhancedInput,
14049
+ {
14050
+ label: "Counterparty ID",
14051
+ value: localFilters.counterpartyId,
14052
+ onChange: (e) => handleLocalFilterChange("counterpartyId", e.target.value),
14053
+ placeholder: "Enter counterparty ID"
14054
+ }
14055
+ )
14056
+ ] }),
14057
+ /* @__PURE__ */ jsxRuntime.jsx(
14058
+ EnhancedInput,
14059
+ {
14060
+ label: "Settlement File Name",
14061
+ value: localFilters.settlementFileName,
14062
+ onChange: (e) => handleLocalFilterChange("settlementFileName", e.target.value),
14063
+ placeholder: "Enter settlement file name"
14064
+ }
14065
+ ),
14066
+ /* @__PURE__ */ jsxRuntime.jsx(
14067
+ EnhancedInput,
14068
+ {
14069
+ label: "Original File Name",
14070
+ value: localFilters.originalFileName,
14071
+ onChange: (e) => handleLocalFilterChange("originalFileName", e.target.value),
14072
+ placeholder: "Enter original file name"
14073
+ }
14074
+ ),
14075
+ /* @__PURE__ */ jsxRuntime.jsx(
14076
+ EnhancedInput,
14077
+ {
14078
+ label: "Requester IP Address",
14079
+ value: localFilters.requesterIpAddress,
14080
+ onChange: (e) => handleLocalFilterChange("requesterIpAddress", e.target.value),
14081
+ placeholder: "Enter IP address"
14082
+ }
14083
+ ),
14084
+ /* @__PURE__ */ jsxRuntime.jsx(
14085
+ EnhancedInput,
14086
+ {
14087
+ label: "Requester Username",
14088
+ value: localFilters.requesterUsername,
14089
+ onChange: (e) => handleLocalFilterChange("requesterUsername", e.target.value),
14090
+ placeholder: "Enter username"
14091
+ }
14092
+ ),
14093
+ /* @__PURE__ */ jsxRuntime.jsx(
14094
+ EnhancedInput,
14095
+ {
14096
+ label: "Wire File Handle",
14097
+ value: localFilters.wireFileHandle,
14098
+ onChange: (e) => handleLocalFilterChange("wireFileHandle", e.target.value),
14099
+ placeholder: "Enter wire file handle"
14100
+ }
14101
+ ),
14102
+ /* @__PURE__ */ jsxRuntime.jsx(
14103
+ EnhancedInput,
14104
+ {
14105
+ label: "Payment ID",
14106
+ value: localFilters.paymentId,
14107
+ onChange: (e) => handleLocalFilterChange("paymentId", e.target.value),
14108
+ placeholder: "Enter payment ID"
14109
+ }
14110
+ ),
14111
+ /* @__PURE__ */ jsxRuntime.jsx(
14112
+ EnhancedSelect,
14113
+ {
14114
+ label: "Transaction Type",
14115
+ value: localFilters.transactionType,
14116
+ onValueChange: (value) => handleLocalFilterChange("transactionType", value),
14117
+ placeholder: "Select transaction type",
14118
+ options: [
14119
+ { value: "ach_credit", label: "ACH Credit" },
14120
+ { value: "ach_debit", label: "ACH Debit" },
14121
+ { value: "wire_domestic", label: "Wire Domestic" },
14122
+ { value: "wire_international", label: "Wire International" }
14123
+ ]
14124
+ }
14125
+ ),
14126
+ /* @__PURE__ */ jsxRuntime.jsx(
14127
+ EnhancedSelect,
14128
+ {
14129
+ label: "Transaction Status",
14130
+ value: localFilters.transactionStatus,
14131
+ onValueChange: (value) => handleLocalFilterChange("transactionStatus", value),
14132
+ placeholder: "Select transaction status",
14133
+ options: [
14134
+ { value: "PENDING", label: "Pending" },
14135
+ { value: "POSTED", label: "Posted" },
14136
+ { value: "FAILED", label: "Failed" },
14137
+ { value: "CANCELLED", label: "Cancelled" }
14138
+ ]
14139
+ }
14140
+ ),
14141
+ /* @__PURE__ */ jsxRuntime.jsx(
14142
+ EnhancedSelect,
14143
+ {
14144
+ label: "Processing Status",
14145
+ value: localFilters.processingStatus,
14146
+ onValueChange: (value) => handleLocalFilterChange("processingStatus", value),
14147
+ placeholder: "Select processing status",
14148
+ options: [
14149
+ { value: "processing", label: "Processing" },
14150
+ { value: "completed", label: "Completed" },
14151
+ { value: "error", label: "Error" }
14152
+ ]
14153
+ }
14154
+ ),
14155
+ /* @__PURE__ */ jsxRuntime.jsx(
14156
+ EnhancedSelect,
14157
+ {
14158
+ label: "Direction",
14159
+ value: localFilters.direction,
14160
+ onValueChange: (value) => handleLocalFilterChange("direction", value),
14161
+ placeholder: "Select direction",
14162
+ options: [
14163
+ { value: "credit", label: "Credit" },
14164
+ { value: "debit", label: "Debit" }
14165
+ ]
14166
+ }
14167
+ ),
14168
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
14169
+ /* @__PURE__ */ jsxRuntime.jsx(
14170
+ CurrencyInput,
14171
+ {
14172
+ label: "Min Amount",
14173
+ value: localFilters.minAmount,
14174
+ onChange: (value) => handleLocalFilterChange("minAmount", value)
14175
+ }
14176
+ ),
14177
+ /* @__PURE__ */ jsxRuntime.jsx(
14178
+ CurrencyInput,
14179
+ {
14180
+ label: "Max Amount",
14181
+ value: localFilters.maxAmount,
14182
+ onChange: (value) => handleLocalFilterChange("maxAmount", value)
14183
+ }
14184
+ )
14185
+ ] }),
14186
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
14187
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
14188
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Creation Date Start" }),
14173
14189
  /* @__PURE__ */ jsxRuntime.jsx(
14174
- EnhancedSelect,
14190
+ DatePicker,
14175
14191
  {
14176
- label: "Processing Status",
14177
- value: filters.processingStatus,
14178
- onValueChange: (value) => handleFilterChange("processingStatus", value),
14179
- placeholder: "Select processing status",
14180
- options: [
14181
- { value: "processing", label: "Processing" },
14182
- { value: "completed", label: "Completed" },
14183
- { value: "error", label: "Error" }
14184
- ]
14192
+ date: localFilters.creationDateStart,
14193
+ onDateChange: (date) => handleLocalFilterChange("creationDateStart", date),
14194
+ placeholder: "MM/DD/YYYY",
14195
+ buttonClassName: "w-full",
14196
+ className: "bg-background z-50"
14185
14197
  }
14186
- ),
14198
+ )
14199
+ ] }),
14200
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
14201
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Creation Date End" }),
14187
14202
  /* @__PURE__ */ jsxRuntime.jsx(
14188
- EnhancedSelect,
14203
+ DatePicker,
14189
14204
  {
14190
- label: "Direction",
14191
- value: filters.direction,
14192
- onValueChange: (value) => handleFilterChange("direction", value),
14193
- placeholder: "Select direction",
14194
- options: [
14195
- { value: "credit", label: "Credit" },
14196
- { value: "debit", label: "Debit" }
14197
- ]
14205
+ date: localFilters.creationDateEnd,
14206
+ onDateChange: (date) => handleLocalFilterChange("creationDateEnd", date),
14207
+ placeholder: "MM/DD/YYYY",
14208
+ buttonClassName: "w-full",
14209
+ className: "bg-background z-50"
14198
14210
  }
14199
- ),
14200
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
14201
- /* @__PURE__ */ jsxRuntime.jsx(
14202
- CurrencyInput,
14203
- {
14204
- label: "Min Amount",
14205
- value: filters.minAmount,
14206
- onChange: (value) => handleFilterChange("minAmount", value)
14207
- }
14208
- ),
14209
- /* @__PURE__ */ jsxRuntime.jsx(
14210
- CurrencyInput,
14211
- {
14212
- label: "Max Amount",
14213
- value: filters.maxAmount,
14214
- onChange: (value) => handleFilterChange("maxAmount", value)
14215
- }
14216
- )
14217
- ] }),
14218
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
14219
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
14220
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Creation Date Start" }),
14221
- /* @__PURE__ */ jsxRuntime.jsx(
14222
- DatePicker,
14223
- {
14224
- date: filters.creationDateStart,
14225
- onDateChange: (date) => handleFilterChange("creationDateStart", date),
14226
- placeholder: "MM/DD/YYYY",
14227
- buttonClassName: "w-full",
14228
- className: "bg-background z-50"
14229
- }
14230
- )
14231
- ] }),
14232
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
14233
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Creation Date End" }),
14234
- /* @__PURE__ */ jsxRuntime.jsx(
14235
- DatePicker,
14236
- {
14237
- date: filters.creationDateEnd,
14238
- onDateChange: (date) => handleFilterChange("creationDateEnd", date),
14239
- placeholder: "MM/DD/YYYY",
14240
- buttonClassName: "w-full",
14241
- className: "bg-background z-50"
14242
- }
14243
- )
14244
- ] })
14245
- ] }),
14246
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
14247
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
14248
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Post Date Start" }),
14249
- /* @__PURE__ */ jsxRuntime.jsx(
14250
- DatePicker,
14251
- {
14252
- date: filters.postDateStart,
14253
- onDateChange: (date) => handleFilterChange("postDateStart", date),
14254
- placeholder: "MM/DD/YYYY",
14255
- buttonClassName: "w-full",
14256
- className: "bg-background z-50"
14257
- }
14258
- )
14259
- ] }),
14260
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
14261
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Post Date End" }),
14262
- /* @__PURE__ */ jsxRuntime.jsx(
14263
- DatePicker,
14264
- {
14265
- date: filters.postDateEnd,
14266
- onDateChange: (date) => handleFilterChange("postDateEnd", date),
14267
- placeholder: "MM/DD/YYYY",
14268
- buttonClassName: "w-full",
14269
- className: "bg-background z-50"
14270
- }
14271
- )
14272
- ] })
14273
- ] })
14274
- ] }),
14275
- /* @__PURE__ */ jsxRuntime.jsxs(SheetFooter, { className: "gap-2", children: [
14276
- /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", onClick: resetFilters, children: "Reset Filters" }),
14277
- /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: applyFilters, children: "Apply Filters" })
14278
- ] })
14279
- ] })
14280
- ] })
14281
- ] }) }) }),
14282
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "container mx-auto px-4 h-full max-w-none flex flex-col", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 mt-4 rounded-lg border bg-card overflow-hidden flex flex-col", children: [
14283
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "w-full table-fixed", children: [
14284
- /* @__PURE__ */ jsxRuntime.jsxs("colgroup", { children: [
14285
- /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-28" }),
14286
- /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-28" }),
14287
- /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-24" }),
14288
- /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-36" }),
14289
- /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-36" }),
14290
- /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-auto" }),
14291
- /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-36" }),
14292
- /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-24" }),
14293
- /* @__PURE__ */ jsxRuntime.jsx("col", { className: "w-28" })
14294
- ] }),
14295
- /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "sticky top-0 bg-card z-10 shadow-sm", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "border-b", children: [
14296
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-3 py-2 text-left text-xs font-medium bg-muted/50", children: "Created" }),
14297
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-3 py-2 text-left text-xs font-medium bg-muted/50", children: "Account Number" }),
14298
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-3 py-2 text-right text-xs font-medium bg-muted/50", children: "Amount" }),
14299
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-3 py-2 text-left text-xs font-medium bg-muted/50", children: "Customer" }),
14300
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-3 py-2 text-left text-xs font-medium bg-muted/50", children: "Counterparty" }),
14301
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-3 py-2 text-left text-xs font-medium bg-muted/50", children: "Description" }),
14302
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-3 py-2 text-left text-xs font-medium bg-muted/50", children: "Transaction Type" }),
14303
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-3 py-2 text-left text-xs font-medium bg-muted/50", children: "Status" }),
14304
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-3 py-2 text-left text-xs font-medium bg-muted/50", children: "Updated" })
14305
- ] }) }),
14306
- /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: paginatedTransactions.map((transaction) => /* @__PURE__ */ jsxRuntime.jsxs(
14307
- "tr",
14308
- {
14309
- onClick: () => navigate(`/transactions/${transaction.id}`),
14310
- className: "border-b hover:bg-muted/50 transition-colors cursor-pointer",
14311
- children: [
14312
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-3 py-2 text-xs", children: transaction.created }),
14313
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-3 py-2 text-xs", children: transaction.accountNumber }),
14314
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-3 py-2 text-xs text-right", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: transaction.amount < 0 ? "text-destructive" : "", children: formatCurrency4(transaction.amount) }) }),
14315
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "link", className: "h-auto p-0 font-normal text-xs", children: transaction.customer }) }),
14316
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "link", className: "h-auto p-0 font-normal text-xs", children: transaction.counterparty }) }),
14317
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-3 py-2 text-xs truncate", children: transaction.description }),
14318
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "outline", className: "font-normal whitespace-nowrap text-xs", children: transaction.transactionType }) }),
14319
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { status: transaction.status }) }),
14320
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-3 py-2 text-xs", children: transaction.updated })
14321
- ]
14322
- },
14323
- transaction.id
14324
- )) })
14325
- ] }) }),
14326
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-none border-t bg-background py-3 px-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
14327
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
14328
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: "Rows per page:" }),
14329
- /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu, { children: [
14330
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", className: "h-8 gap-1", children: [
14331
- rowsPerPage,
14332
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4 rotate-90" })
14333
- ] }) }),
14334
- /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuContent, { align: "start", className: "bg-background z-50", children: [
14335
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { onClick: () => handleRowsPerPageChange(100), children: "100" }),
14336
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { onClick: () => handleRowsPerPageChange(200), children: "200" }),
14337
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuItem, { onClick: () => handleRowsPerPageChange(500), children: "500" })
14338
- ] })
14211
+ )
14339
14212
  ] })
14340
14213
  ] }),
14341
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4", children: [
14342
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm text-muted-foreground", children: [
14343
- "Page ",
14344
- currentPage,
14345
- " of ",
14346
- totalPages
14347
- ] }),
14348
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
14214
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
14215
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
14216
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Post Date Start" }),
14349
14217
  /* @__PURE__ */ jsxRuntime.jsx(
14350
- Button,
14218
+ DatePicker,
14351
14219
  {
14352
- variant: "outline",
14353
- size: "sm",
14354
- className: "h-8 w-8 p-0",
14355
- onClick: () => handlePageChange(currentPage - 1),
14356
- disabled: currentPage === 1,
14357
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "h-4 w-4" })
14220
+ date: localFilters.postDateStart,
14221
+ onDateChange: (date) => handleLocalFilterChange("postDateStart", date),
14222
+ placeholder: "MM/DD/YYYY",
14223
+ buttonClassName: "w-full",
14224
+ className: "bg-background z-50"
14358
14225
  }
14359
- ),
14226
+ )
14227
+ ] }),
14228
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
14229
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: "Post Date End" }),
14360
14230
  /* @__PURE__ */ jsxRuntime.jsx(
14361
- Button,
14231
+ DatePicker,
14362
14232
  {
14363
- variant: "outline",
14364
- size: "sm",
14365
- className: "h-8 w-8 p-0",
14366
- onClick: () => handlePageChange(currentPage + 1),
14367
- disabled: currentPage === totalPages,
14368
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4" })
14233
+ date: localFilters.postDateEnd,
14234
+ onDateChange: (date) => handleLocalFilterChange("postDateEnd", date),
14235
+ placeholder: "MM/DD/YYYY",
14236
+ buttonClassName: "w-full",
14237
+ className: "bg-background z-50"
14369
14238
  }
14370
14239
  )
14371
14240
  ] })
14372
14241
  ] })
14373
- ] }) })
14374
- ] }) }) })
14242
+ ] }),
14243
+ /* @__PURE__ */ jsxRuntime.jsxs(SheetFooter, { className: "flex gap-2", children: [
14244
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", onClick: handleResetFilters, className: "flex-1", children: "Reset Filters" }),
14245
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: handleApplyFilters, className: "flex-1", children: "Apply Filters" })
14246
+ ] })
14247
+ ] })
14375
14248
  ] });
14376
14249
  };
14250
+ var TransactionHistoryView = ({
14251
+ table,
14252
+ filters,
14253
+ onFilterChange,
14254
+ onResetFilters,
14255
+ onApplyFilters
14256
+ }) => {
14257
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col h-screen bg-gradient-subtle", children: [
14258
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-none border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "container mx-auto px-4 py-4 max-w-none", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
14259
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-3xl font-bold text-foreground", children: "Transaction History" }),
14260
+ /* @__PURE__ */ jsxRuntime.jsx(
14261
+ TransactionHistoryFiltersSheet,
14262
+ {
14263
+ filters,
14264
+ onFilterChange,
14265
+ onResetFilters,
14266
+ onApplyFilters
14267
+ }
14268
+ )
14269
+ ] }) }) }),
14270
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "container mx-auto px-4 h-full max-w-none flex flex-col", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 mt-4 overflow-auto", children: table }) }) })
14271
+ ] });
14272
+ };
14273
+ var TransactionHistory = () => {
14274
+ const navigate = reactRouterDom.useNavigate();
14275
+ const [sortBy, setSortBy] = React15.useState("created");
14276
+ const [sortDirection, setSortDirection] = React15.useState("desc");
14277
+ const [filters, setFilters] = React15.useState({
14278
+ accountNumber: "",
14279
+ product: "",
14280
+ customerId: "",
14281
+ counterpartyId: "",
14282
+ settlementFileName: "",
14283
+ originalFileName: "",
14284
+ requesterIpAddress: "",
14285
+ requesterUsername: "",
14286
+ wireFileHandle: "",
14287
+ paymentId: "",
14288
+ transactionType: "",
14289
+ transactionStatus: "",
14290
+ processingStatus: "",
14291
+ direction: "",
14292
+ minAmount: "",
14293
+ maxAmount: "",
14294
+ creationDateStart: void 0,
14295
+ creationDateEnd: void 0,
14296
+ postDateStart: void 0,
14297
+ postDateEnd: void 0
14298
+ });
14299
+ const filteredTransactions = React15.useMemo(() => {
14300
+ let filtered = [...mockTransactions];
14301
+ if (filters.accountNumber) {
14302
+ filtered = filtered.filter(
14303
+ (t) => t.accountNumber.toLowerCase().includes(filters.accountNumber.toLowerCase())
14304
+ );
14305
+ }
14306
+ if (filters.transactionType) {
14307
+ filtered = filtered.filter((t) => t.transactionType === filters.transactionType);
14308
+ }
14309
+ if (filters.transactionStatus) {
14310
+ filtered = filtered.filter((t) => t.status === filters.transactionStatus);
14311
+ }
14312
+ if (filters.minAmount) {
14313
+ const minAmount = parseFloat(filters.minAmount.replace(/[^0-9.-]/g, ""));
14314
+ if (!isNaN(minAmount)) {
14315
+ filtered = filtered.filter((t) => t.amount >= minAmount);
14316
+ }
14317
+ }
14318
+ if (filters.maxAmount) {
14319
+ const maxAmount = parseFloat(filters.maxAmount.replace(/[^0-9.-]/g, ""));
14320
+ if (!isNaN(maxAmount)) {
14321
+ filtered = filtered.filter((t) => t.amount <= maxAmount);
14322
+ }
14323
+ }
14324
+ return filtered;
14325
+ }, [filters]);
14326
+ const sortedTransactions = React15.useMemo(() => {
14327
+ return [...filteredTransactions].sort((a, b) => {
14328
+ const aValue = a[sortBy];
14329
+ const bValue = b[sortBy];
14330
+ if (aValue === void 0 || bValue === void 0) return 0;
14331
+ if (aValue < bValue) return sortDirection === "asc" ? -1 : 1;
14332
+ if (aValue > bValue) return sortDirection === "asc" ? 1 : -1;
14333
+ return 0;
14334
+ });
14335
+ }, [filteredTransactions, sortBy, sortDirection]);
14336
+ const handleFilterChange = React15.useCallback((field, value) => {
14337
+ setFilters((prev) => ({ ...prev, [field]: value }));
14338
+ }, []);
14339
+ const handleResetFilters = React15.useCallback(() => {
14340
+ setFilters({
14341
+ accountNumber: "",
14342
+ product: "",
14343
+ customerId: "",
14344
+ counterpartyId: "",
14345
+ settlementFileName: "",
14346
+ originalFileName: "",
14347
+ requesterIpAddress: "",
14348
+ requesterUsername: "",
14349
+ wireFileHandle: "",
14350
+ paymentId: "",
14351
+ transactionType: "",
14352
+ transactionStatus: "",
14353
+ processingStatus: "",
14354
+ direction: "",
14355
+ minAmount: "",
14356
+ maxAmount: "",
14357
+ creationDateStart: void 0,
14358
+ creationDateEnd: void 0,
14359
+ postDateStart: void 0,
14360
+ postDateEnd: void 0
14361
+ });
14362
+ }, []);
14363
+ const handleApplyFilters = React15.useCallback(() => {
14364
+ console.log("Applying filters:", filters);
14365
+ }, [filters]);
14366
+ const handleSort = React15.useCallback((key) => {
14367
+ if (sortBy === key) {
14368
+ setSortDirection((prev) => prev === "asc" ? "desc" : "asc");
14369
+ } else {
14370
+ setSortBy(key);
14371
+ setSortDirection("asc");
14372
+ }
14373
+ }, [sortBy]);
14374
+ const handleRowClick = React15.useCallback((transaction) => {
14375
+ navigate(`/transactions/${transaction.id}`);
14376
+ }, [navigate]);
14377
+ const formatCurrency4 = (value) => {
14378
+ return new Intl.NumberFormat("en-US", {
14379
+ style: "currency",
14380
+ currency: "USD",
14381
+ minimumFractionDigits: 2
14382
+ }).format(value);
14383
+ };
14384
+ const columns3 = React15.useMemo(() => [
14385
+ {
14386
+ key: "created",
14387
+ title: "Created",
14388
+ sortable: true
14389
+ },
14390
+ {
14391
+ key: "accountNumber",
14392
+ title: "Account Number",
14393
+ sortable: true
14394
+ },
14395
+ {
14396
+ key: "amount",
14397
+ title: "Amount",
14398
+ sortable: true,
14399
+ align: "right",
14400
+ render: (value) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: value < 0 ? "text-destructive" : "", children: formatCurrency4(value) })
14401
+ },
14402
+ {
14403
+ key: "customer",
14404
+ title: "Customer",
14405
+ sortable: true,
14406
+ render: (value) => /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "link", className: "h-auto p-0 font-normal text-xs", children: value })
14407
+ },
14408
+ {
14409
+ key: "counterparty",
14410
+ title: "Counterparty",
14411
+ sortable: true,
14412
+ render: (value) => /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "link", className: "h-auto p-0 font-normal text-xs", children: value })
14413
+ },
14414
+ {
14415
+ key: "description",
14416
+ title: "Description",
14417
+ sortable: true,
14418
+ render: (value) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate block max-w-[200px]", children: value })
14419
+ },
14420
+ {
14421
+ key: "transactionType",
14422
+ title: "Transaction Type",
14423
+ sortable: true,
14424
+ render: (value) => /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "outline", className: "font-normal whitespace-nowrap text-xs", children: value })
14425
+ },
14426
+ {
14427
+ key: "status",
14428
+ title: "Status",
14429
+ sortable: true,
14430
+ render: (value) => /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { status: value })
14431
+ },
14432
+ {
14433
+ key: "updated",
14434
+ title: "Updated",
14435
+ sortable: true
14436
+ }
14437
+ ], []);
14438
+ const table = React15.useMemo(() => /* @__PURE__ */ jsxRuntime.jsx(
14439
+ DataTable,
14440
+ {
14441
+ columns: columns3,
14442
+ data: sortedTransactions,
14443
+ sortBy,
14444
+ sortDirection,
14445
+ onSort: handleSort,
14446
+ onRowClick: handleRowClick
14447
+ }
14448
+ ), [columns3, sortedTransactions, sortBy, sortDirection, handleSort, handleRowClick]);
14449
+ return /* @__PURE__ */ jsxRuntime.jsx(
14450
+ TransactionHistoryView,
14451
+ {
14452
+ table,
14453
+ filters,
14454
+ onFilterChange: handleFilterChange,
14455
+ onResetFilters: handleResetFilters,
14456
+ onApplyFilters: handleApplyFilters
14457
+ }
14458
+ );
14459
+ };
14377
14460
  var TransactionHistory_default = TransactionHistory;
14378
14461
  var newTransactionSchema = zod.z.object({
14379
14462
  transactionType: zod.z.string().min(1, "Transaction type is required"),
@@ -14794,20 +14877,20 @@ function NewTransaction() {
14794
14877
  setConfirmationOpen(false);
14795
14878
  resetForm();
14796
14879
  };
14880
+ const formValues = form.watch();
14797
14881
  const isReviewReady = React15.useMemo(() => {
14798
- const data = form.watch();
14799
- const requiresCounterparty = ["ach", "wire"].includes(data.transactionType);
14800
- if (!data.transactionType || !data.accountNumber || !data.amount || !data.description) return false;
14801
- if (requiresCounterparty && (!data.counterpartyName || !counterpartyLookedUp)) return false;
14882
+ const requiresCounterparty = ["ach", "wire"].includes(formValues.transactionType);
14883
+ if (!formValues.transactionType || !formValues.accountNumber || !formValues.amount || !formValues.description) return false;
14884
+ if (requiresCounterparty && (!formValues.counterpartyName || !counterpartyLookedUp)) return false;
14802
14885
  if (!accountLookedUp) return false;
14803
- if (data.transactionType === "adjustment") {
14804
- if (!data.adjustmentDirection || !data.adjustmentType) return false;
14886
+ if (formValues.transactionType === "adjustment") {
14887
+ if (!formValues.adjustmentDirection || !formValues.adjustmentType) return false;
14805
14888
  }
14806
- if (data.transactionType === "transfer") {
14807
- if (!data.receiverAccountNumber || !receiverAccountLookedUp) return false;
14889
+ if (formValues.transactionType === "transfer") {
14890
+ if (!formValues.receiverAccountNumber || !receiverAccountLookedUp) return false;
14808
14891
  }
14809
14892
  return true;
14810
- }, [form.watch(), accountLookedUp, counterpartyLookedUp, receiverAccountLookedUp]);
14893
+ }, [formValues, accountLookedUp, counterpartyLookedUp, receiverAccountLookedUp]);
14811
14894
  return /* @__PURE__ */ jsxRuntime.jsx(
14812
14895
  NewTransactionView,
14813
14896
  {
@@ -14854,6 +14937,8 @@ function NewTransaction() {
14854
14937
  }
14855
14938
  );
14856
14939
  }
14940
+
14941
+ // src/lib/utils/transaction-utils.ts
14857
14942
  var getStatusVariant = (status) => {
14858
14943
  switch (status) {
14859
14944
  case "POSTED":
@@ -14894,8 +14979,10 @@ var TransactionDetailView = ({
14894
14979
  timelineEvents,
14895
14980
  isWireTransfer,
14896
14981
  isACHTransfer,
14897
- onReturn,
14898
- onCancel,
14982
+ showCancelButton,
14983
+ showReturnButton,
14984
+ onReturnClick,
14985
+ onCancelClick,
14899
14986
  onAccountClick,
14900
14987
  onCustomerClick,
14901
14988
  onCounterpartyClick,
@@ -14922,16 +15009,16 @@ var TransactionDetailView = ({
14922
15009
  ] }),
14923
15010
  maxWidth: "full",
14924
15011
  actions: [
14925
- {
15012
+ ...showReturnButton ? [{
14926
15013
  label: "Return",
14927
15014
  variant: "outline",
14928
- onClick: onReturn
14929
- },
14930
- {
15015
+ onClick: onReturnClick
15016
+ }] : [],
15017
+ ...showCancelButton ? [{
14931
15018
  label: "Cancel",
14932
15019
  variant: "default",
14933
- onClick: onCancel
14934
- }
15020
+ onClick: onCancelClick
15021
+ }] : []
14935
15022
  ],
14936
15023
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col lg:flex-row items-start gap-6", children: [
14937
15024
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 space-y-6", children: [
@@ -15040,10 +15127,251 @@ var TransactionDetailView = ({
15040
15127
  }
15041
15128
  );
15042
15129
  };
15130
+ var cancelTransactionSchema = zod.z.object({
15131
+ reason: zod.z.string().min(1, "Reason is required").max(500, "Reason must be less than 500 characters")
15132
+ });
15133
+ var returnTransactionSchema = zod.z.object({
15134
+ reasonCode: zod.z.string().min(1, "Reason code is required")
15135
+ });
15136
+ var CancelTransactionDialog = ({
15137
+ transactionId,
15138
+ open,
15139
+ onOpenChange,
15140
+ onCancel
15141
+ }) => {
15142
+ const { toast: toast6 } = useToast();
15143
+ const {
15144
+ register,
15145
+ handleSubmit,
15146
+ formState: { errors, isSubmitting },
15147
+ reset
15148
+ } = useFormWithEditState({
15149
+ schema: cancelTransactionSchema,
15150
+ defaultValues: {
15151
+ reason: ""
15152
+ }
15153
+ });
15154
+ const onSubmit = async (data) => {
15155
+ try {
15156
+ await onCancel(data);
15157
+ toast6({
15158
+ title: "Transaction Cancelled",
15159
+ description: `Transaction ${transactionId} has been cancelled successfully.`
15160
+ });
15161
+ reset();
15162
+ onOpenChange(false);
15163
+ } catch (error) {
15164
+ toast6({
15165
+ title: "Error",
15166
+ description: "Failed to cancel the transaction. Please try again.",
15167
+ variant: "destructive"
15168
+ });
15169
+ }
15170
+ };
15171
+ const handleClose = () => {
15172
+ reset();
15173
+ onOpenChange(false);
15174
+ };
15175
+ return /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "sm:max-w-md", children: [
15176
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
15177
+ /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: "Cancel Transaction" }),
15178
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogDescription, { children: [
15179
+ "Please provide a reason for cancelling transaction ",
15180
+ transactionId,
15181
+ "."
15182
+ ] })
15183
+ ] }),
15184
+ /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit(onSubmit), className: "space-y-4", children: [
15185
+ /* @__PURE__ */ jsxRuntime.jsx(
15186
+ EnhancedTextarea,
15187
+ {
15188
+ label: "Cancellation Reason",
15189
+ placeholder: "Enter the reason for cancellation...",
15190
+ error: errors.reason?.message,
15191
+ ...register("reason")
15192
+ }
15193
+ ),
15194
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogFooter, { className: "gap-2 sm:gap-0", children: [
15195
+ /* @__PURE__ */ jsxRuntime.jsx(
15196
+ Button,
15197
+ {
15198
+ type: "button",
15199
+ variant: "outline",
15200
+ onClick: handleClose,
15201
+ disabled: isSubmitting,
15202
+ children: "Close"
15203
+ }
15204
+ ),
15205
+ /* @__PURE__ */ jsxRuntime.jsx(
15206
+ Button,
15207
+ {
15208
+ type: "submit",
15209
+ variant: "destructive",
15210
+ disabled: isSubmitting,
15211
+ children: isSubmitting ? "Cancelling..." : "Cancel Transaction"
15212
+ }
15213
+ )
15214
+ ] })
15215
+ ] })
15216
+ ] }) });
15217
+ };
15218
+ function ReturnTransactionDialog({
15219
+ transactionId,
15220
+ open,
15221
+ onOpenChange,
15222
+ onReturn,
15223
+ reasonCodes
15224
+ }) {
15225
+ const {
15226
+ watch,
15227
+ setValue,
15228
+ handleSave,
15229
+ handleCancel,
15230
+ isLoading,
15231
+ formState: { errors }
15232
+ } = useFormWithEditState({
15233
+ schema: returnTransactionSchema,
15234
+ initialEditing: true,
15235
+ onSave: async (data) => {
15236
+ try {
15237
+ await onReturn(data);
15238
+ toast({
15239
+ title: "Transaction returned",
15240
+ description: `Transaction #${transactionId} has been returned successfully.`
15241
+ });
15242
+ onOpenChange(false);
15243
+ } catch (error) {
15244
+ toast({
15245
+ title: "Error",
15246
+ description: "Failed to return transaction. Please try again.",
15247
+ variant: "destructive"
15248
+ });
15249
+ throw error;
15250
+ }
15251
+ },
15252
+ onCancel: () => {
15253
+ onOpenChange(false);
15254
+ }
15255
+ });
15256
+ const reasonCode = watch("reasonCode");
15257
+ const selectOptions = reasonCodes.map((code) => ({
15258
+ value: code.value,
15259
+ label: code.label
15260
+ }));
15261
+ return /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "sm:max-w-[425px]", children: [
15262
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
15263
+ /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: "Return Transaction" }),
15264
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogDescription, { children: [
15265
+ "Select a reason code to return transaction #",
15266
+ transactionId,
15267
+ "."
15268
+ ] })
15269
+ ] }),
15270
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
15271
+ EnhancedSelect,
15272
+ {
15273
+ label: "Reason Code",
15274
+ placeholder: "Select a reason code",
15275
+ options: selectOptions,
15276
+ value: reasonCode || "",
15277
+ onValueChange: (value) => setValue("reasonCode", value),
15278
+ error: errors.reasonCode?.message
15279
+ }
15280
+ ) }),
15281
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogFooter, { children: [
15282
+ /* @__PURE__ */ jsxRuntime.jsx(
15283
+ Button,
15284
+ {
15285
+ type: "button",
15286
+ variant: "outline",
15287
+ onClick: handleCancel,
15288
+ disabled: isLoading,
15289
+ children: "Cancel"
15290
+ }
15291
+ ),
15292
+ /* @__PURE__ */ jsxRuntime.jsx(
15293
+ Button,
15294
+ {
15295
+ type: "button",
15296
+ variant: "destructive",
15297
+ onClick: handleSave,
15298
+ disabled: isLoading || !reasonCode,
15299
+ children: isLoading ? "Returning..." : "Return Transaction"
15300
+ }
15301
+ )
15302
+ ] })
15303
+ ] }) });
15304
+ }
15305
+ var returnReasonCodes = [
15306
+ { value: "R01", label: "R01 - Insufficient Funds" },
15307
+ { value: "R02", label: "R02 - Account Closed" },
15308
+ { value: "R03", label: "R03 - No Account/Unable to Locate" },
15309
+ { value: "R04", label: "R04 - Invalid Account Number" },
15310
+ { value: "R05", label: "R05 - Unauthorized Debit" },
15311
+ { value: "R06", label: "R06 - Returned per ODFI Request" },
15312
+ { value: "R07", label: "R07 - Authorization Revoked" },
15313
+ { value: "R08", label: "R08 - Payment Stopped" },
15314
+ { value: "R09", label: "R09 - Uncollected Funds" },
15315
+ { value: "R10", label: "R10 - Customer Advises Not Authorized" }
15316
+ ];
15043
15317
  var TransactionDetail = () => {
15044
15318
  const { id } = reactRouterDom.useParams();
15045
15319
  const navigate = reactRouterDom.useNavigate();
15046
- const transaction = mockTransactions.find((t) => t.id === id);
15320
+ const [isCancelDialogOpen, setIsCancelDialogOpen] = React15.useState(false);
15321
+ const [isReturnDialogOpen, setIsReturnDialogOpen] = React15.useState(false);
15322
+ const transaction = React15.useMemo(
15323
+ () => mockTransactions.find((t) => t.id === id),
15324
+ [id]
15325
+ );
15326
+ const isWireTransfer = React15.useMemo(
15327
+ () => transaction?.transactionType.toLowerCase().includes("wire") ?? false,
15328
+ [transaction?.transactionType]
15329
+ );
15330
+ const isACHTransfer = React15.useMemo(
15331
+ () => transaction?.transactionType.toLowerCase().includes("ach") ?? false,
15332
+ [transaction?.transactionType]
15333
+ );
15334
+ const timelineEvents = React15.useMemo(
15335
+ () => mockTransactionTimeline,
15336
+ []
15337
+ );
15338
+ const showCancelButton = React15.useMemo(() => {
15339
+ if (!transaction) return false;
15340
+ const cancelableStatuses = ["INITIATED", "SUBMITTED", "CUSTOMER_REVIEW", "MANUAL_REVIEW"];
15341
+ return transaction.status === "PENDING" && cancelableStatuses.includes(transaction.processingStatus);
15342
+ }, [transaction]);
15343
+ const showReturnButton = React15.useMemo(() => {
15344
+ if (!transaction) return false;
15345
+ const returnableStatuses = ["POSTED", "SETTLED", "CONFIRMED"];
15346
+ return returnableStatuses.includes(transaction.processingStatus);
15347
+ }, [transaction]);
15348
+ const handleOpenReturnDialog = React15.useCallback(() => {
15349
+ setIsReturnDialogOpen(true);
15350
+ }, []);
15351
+ const handleReturnTransaction = React15.useCallback(async (data) => {
15352
+ console.log("Returning transaction with reason code:", data.reasonCode);
15353
+ }, []);
15354
+ const handleOpenCancelDialog = React15.useCallback(() => {
15355
+ setIsCancelDialogOpen(true);
15356
+ }, []);
15357
+ const handleCancelTransaction = React15.useCallback(async (data) => {
15358
+ console.log("Cancelling transaction with reason:", data.reason);
15359
+ }, []);
15360
+ const handleAccountClick = React15.useCallback((accountNumber) => {
15361
+ navigate(`/accounts/${accountNumber}`);
15362
+ }, [navigate]);
15363
+ const handleCustomerClick = React15.useCallback((customer) => {
15364
+ console.log("Navigate to customer:", customer);
15365
+ }, []);
15366
+ const handleCounterpartyClick = React15.useCallback((counterparty) => {
15367
+ console.log("Navigate to counterparty:", counterparty);
15368
+ }, []);
15369
+ const handleOFACClick = React15.useCallback((ofacId) => {
15370
+ navigate(`/compliance/ofac/${ofacId}`);
15371
+ }, [navigate]);
15372
+ const handleProductClick = React15.useCallback((productId) => {
15373
+ console.log("Navigate to product:", productId);
15374
+ }, []);
15047
15375
  if (!transaction) {
15048
15376
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "container mx-auto px-4 py-8", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
15049
15377
  /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-2xl font-bold mb-2", children: "Transaction Not Found" }),
@@ -15055,45 +15383,45 @@ var TransactionDetail = () => {
15055
15383
  /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: () => navigate("/transactions/history"), children: "Back to Transaction History" })
15056
15384
  ] }) });
15057
15385
  }
15058
- const isWireTransfer = transaction.transactionType.toLowerCase().includes("wire");
15059
- const isACHTransfer = transaction.transactionType.toLowerCase().includes("ach");
15060
- const handleReturn = () => {
15061
- console.log("Return transaction");
15062
- };
15063
- const handleCancel = () => {
15064
- console.log("Cancel transaction");
15065
- };
15066
- const handleAccountClick = (accountNumber) => {
15067
- navigate(`/accounts/${accountNumber}`);
15068
- };
15069
- const handleCustomerClick = (customer) => {
15070
- console.log("Navigate to customer:", customer);
15071
- };
15072
- const handleCounterpartyClick = (counterparty) => {
15073
- console.log("Navigate to counterparty:", counterparty);
15074
- };
15075
- const handleOFACClick = (ofacId) => {
15076
- navigate(`/compliance/ofac/${ofacId}`);
15077
- };
15078
- const handleProductClick = (productId) => {
15079
- console.log("Navigate to product:", productId);
15080
- };
15081
- return /* @__PURE__ */ jsxRuntime.jsx(
15082
- TransactionDetailView,
15083
- {
15084
- transaction,
15085
- timelineEvents: mockTransactionTimeline,
15086
- isWireTransfer,
15087
- isACHTransfer,
15088
- onReturn: handleReturn,
15089
- onCancel: handleCancel,
15090
- onAccountClick: handleAccountClick,
15091
- onCustomerClick: handleCustomerClick,
15092
- onCounterpartyClick: handleCounterpartyClick,
15093
- onOFACClick: handleOFACClick,
15094
- onProductClick: handleProductClick
15095
- }
15096
- );
15386
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
15387
+ /* @__PURE__ */ jsxRuntime.jsx(
15388
+ TransactionDetailView,
15389
+ {
15390
+ transaction,
15391
+ timelineEvents,
15392
+ isWireTransfer,
15393
+ isACHTransfer,
15394
+ showCancelButton,
15395
+ showReturnButton,
15396
+ onReturnClick: handleOpenReturnDialog,
15397
+ onCancelClick: handleOpenCancelDialog,
15398
+ onAccountClick: handleAccountClick,
15399
+ onCustomerClick: handleCustomerClick,
15400
+ onCounterpartyClick: handleCounterpartyClick,
15401
+ onOFACClick: handleOFACClick,
15402
+ onProductClick: handleProductClick
15403
+ }
15404
+ ),
15405
+ /* @__PURE__ */ jsxRuntime.jsx(
15406
+ CancelTransactionDialog,
15407
+ {
15408
+ transactionId: transaction.id,
15409
+ open: isCancelDialogOpen,
15410
+ onOpenChange: setIsCancelDialogOpen,
15411
+ onCancel: handleCancelTransaction
15412
+ }
15413
+ ),
15414
+ /* @__PURE__ */ jsxRuntime.jsx(
15415
+ ReturnTransactionDialog,
15416
+ {
15417
+ transactionId: transaction.id,
15418
+ open: isReturnDialogOpen,
15419
+ onOpenChange: setIsReturnDialogOpen,
15420
+ onReturn: handleReturnTransaction,
15421
+ reasonCodes: returnReasonCodes
15422
+ }
15423
+ )
15424
+ ] });
15097
15425
  };
15098
15426
  var TransactionDetail_default = TransactionDetail;
15099
15427
  function UIKit() {