braid-ui 1.0.59 → 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.js CHANGED
@@ -13921,40 +13921,29 @@ var mockTransactionTimeline = [
13921
13921
  timestamp: "2025-10-01 00:19:45"
13922
13922
  }
13923
13923
  ];
13924
- var TransactionHistory = () => {
13925
- const navigate = useNavigate();
13926
- const [currentPage, setCurrentPage] = useState(1);
13927
- const [rowsPerPage, setRowsPerPage] = useState(100);
13928
- const [filters, setFilters] = useState({
13929
- accountNumber: "",
13930
- product: "",
13931
- customerId: "",
13932
- counterpartyId: "",
13933
- settlementFileName: "",
13934
- originalFileName: "",
13935
- requesterIpAddress: "",
13936
- requesterUsername: "",
13937
- wireFileHandle: "",
13938
- paymentId: "",
13939
- transactionType: "",
13940
- transactionStatus: "",
13941
- processingStatus: "",
13942
- direction: "",
13943
- minAmount: "",
13944
- maxAmount: "",
13945
- creationDateStart: void 0,
13946
- creationDateEnd: void 0,
13947
- postDateStart: void 0,
13948
- postDateEnd: void 0
13949
- });
13950
- const handleFilterChange = (field, value) => {
13951
- setFilters((prev) => ({ ...prev, [field]: value }));
13924
+ var TransactionHistoryFiltersSheet = ({
13925
+ filters,
13926
+ onFilterChange,
13927
+ onResetFilters,
13928
+ onApplyFilters
13929
+ }) => {
13930
+ const [localFilters, setLocalFilters] = useState(filters);
13931
+ const [open, setOpen] = useState(false);
13932
+ useEffect(() => {
13933
+ setLocalFilters(filters);
13934
+ }, [filters]);
13935
+ const handleLocalFilterChange = (field, value) => {
13936
+ setLocalFilters((prev) => ({ ...prev, [field]: value }));
13952
13937
  };
13953
- const applyFilters = () => {
13954
- console.log("Applying filters:", filters);
13938
+ const handleApplyFilters = () => {
13939
+ Object.entries(localFilters).forEach(([key, value]) => {
13940
+ onFilterChange(key, value);
13941
+ });
13942
+ onApplyFilters();
13943
+ setOpen(false);
13955
13944
  };
13956
- const resetFilters = () => {
13957
- setFilters({
13945
+ const handleResetFilters = () => {
13946
+ const resetFilters = {
13958
13947
  accountNumber: "",
13959
13948
  product: "",
13960
13949
  customerId: "",
@@ -13975,373 +13964,467 @@ var TransactionHistory = () => {
13975
13964
  creationDateEnd: void 0,
13976
13965
  postDateStart: void 0,
13977
13966
  postDateEnd: void 0
13978
- });
13979
- };
13980
- const totalPages = Math.ceil(mockTransactions.length / rowsPerPage);
13981
- const startIndex = (currentPage - 1) * rowsPerPage;
13982
- const endIndex = startIndex + rowsPerPage;
13983
- const paginatedTransactions = mockTransactions.slice(startIndex, endIndex);
13984
- const handlePageChange = (newPage) => {
13985
- if (newPage >= 1 && newPage <= totalPages) {
13986
- setCurrentPage(newPage);
13987
- }
13988
- };
13989
- const handleRowsPerPageChange = (value) => {
13990
- setRowsPerPage(value);
13991
- setCurrentPage(1);
13992
- };
13993
- const formatCurrency4 = (value) => {
13994
- const formatted = new Intl.NumberFormat("en-US", {
13995
- style: "currency",
13996
- currency: "USD",
13997
- minimumFractionDigits: 2
13998
- }).format(value);
13999
- return formatted;
13967
+ };
13968
+ setLocalFilters(resetFilters);
13969
+ onResetFilters();
13970
+ setOpen(false);
14000
13971
  };
14001
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-screen bg-gradient-subtle", children: [
14002
- /* @__PURE__ */ jsx("div", { className: "flex-none border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60", children: /* @__PURE__ */ jsx("div", { className: "container mx-auto px-4 py-4 max-w-none", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
14003
- /* @__PURE__ */ jsx("h1", { className: "text-3xl font-bold text-foreground", children: "Transaction History" }),
14004
- /* @__PURE__ */ jsxs(Sheet, { children: [
14005
- /* @__PURE__ */ jsx(SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { variant: "outline", className: "gap-2", children: [
14006
- /* @__PURE__ */ jsx(Filter, { className: "h-4 w-4" }),
14007
- "Filters"
14008
- ] }) }),
14009
- /* @__PURE__ */ jsxs(SheetContent, { side: "right", className: "w-full sm:max-w-xl overflow-y-auto", children: [
14010
- /* @__PURE__ */ jsx(SheetHeader, { children: /* @__PURE__ */ jsx(SheetTitle, { children: "Transaction Filters" }) }),
14011
- /* @__PURE__ */ jsxs("div", { className: "space-y-6 py-6", children: [
14012
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
14013
- /* @__PURE__ */ jsx(
14014
- EnhancedInput,
14015
- {
14016
- label: "Account Number",
14017
- value: filters.accountNumber,
14018
- onChange: (e) => handleFilterChange("accountNumber", e.target.value),
14019
- placeholder: "Enter account number"
14020
- }
14021
- ),
14022
- /* @__PURE__ */ jsx(
14023
- EnhancedSelect,
14024
- {
14025
- label: "Product",
14026
- value: filters.product,
14027
- onValueChange: (value) => handleFilterChange("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__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
14038
- /* @__PURE__ */ jsx(
14039
- EnhancedInput,
14040
- {
14041
- label: "Customer ID",
14042
- value: filters.customerId,
14043
- onChange: (e) => handleFilterChange("customerId", e.target.value),
14044
- placeholder: "Enter customer ID"
14045
- }
14046
- ),
14047
- /* @__PURE__ */ jsx(
14048
- EnhancedInput,
14049
- {
14050
- label: "Counterparty ID",
14051
- value: filters.counterpartyId,
14052
- onChange: (e) => handleFilterChange("counterpartyId", e.target.value),
14053
- placeholder: "Enter counterparty ID"
14054
- }
14055
- )
14056
- ] }),
14057
- /* @__PURE__ */ jsx(
14058
- EnhancedInput,
14059
- {
14060
- label: "Settlement File Name",
14061
- value: filters.settlementFileName,
14062
- onChange: (e) => handleFilterChange("settlementFileName", e.target.value),
14063
- placeholder: "Enter settlement file name"
14064
- }
14065
- ),
14066
- /* @__PURE__ */ jsx(
14067
- EnhancedInput,
14068
- {
14069
- label: "Original File Name",
14070
- value: filters.originalFileName,
14071
- onChange: (e) => handleFilterChange("originalFileName", e.target.value),
14072
- placeholder: "Enter original file name"
14073
- }
14074
- ),
14075
- /* @__PURE__ */ jsx(
14076
- EnhancedInput,
14077
- {
14078
- label: "Requester IP Address",
14079
- value: filters.requesterIpAddress,
14080
- onChange: (e) => handleFilterChange("requesterIpAddress", e.target.value),
14081
- placeholder: "Enter IP address"
14082
- }
14083
- ),
14084
- /* @__PURE__ */ jsx(
14085
- EnhancedInput,
14086
- {
14087
- label: "Requester Username",
14088
- value: filters.requesterUsername,
14089
- onChange: (e) => handleFilterChange("requesterUsername", e.target.value),
14090
- placeholder: "Enter username"
14091
- }
14092
- ),
14093
- /* @__PURE__ */ jsx(
14094
- EnhancedInput,
14095
- {
14096
- label: "Wire File Handle",
14097
- value: filters.wireFileHandle,
14098
- onChange: (e) => handleFilterChange("wireFileHandle", e.target.value),
14099
- placeholder: "Enter wire file handle"
14100
- }
14101
- ),
14102
- /* @__PURE__ */ jsx(
14103
- EnhancedInput,
14104
- {
14105
- label: "Payment ID",
14106
- value: filters.paymentId,
14107
- onChange: (e) => handleFilterChange("paymentId", e.target.value),
14108
- placeholder: "Enter payment ID"
14109
- }
14110
- ),
14111
- /* @__PURE__ */ jsx(
14112
- EnhancedSelect,
14113
- {
14114
- label: "Transaction Type",
14115
- value: filters.transactionType,
14116
- onValueChange: (value) => handleFilterChange("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__ */ jsx(
14127
- EnhancedSelect,
14128
- {
14129
- label: "Transaction Status",
14130
- value: filters.transactionStatus,
14131
- onValueChange: (value) => handleFilterChange("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
- ),
13972
+ return /* @__PURE__ */ jsxs(Sheet, { open, onOpenChange: setOpen, children: [
13973
+ /* @__PURE__ */ jsx(SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { variant: "outline", className: "gap-2", children: [
13974
+ /* @__PURE__ */ jsx(Filter, { className: "h-4 w-4" }),
13975
+ "Filters"
13976
+ ] }) }),
13977
+ /* @__PURE__ */ jsxs(SheetContent, { side: "right", className: "w-full sm:max-w-xl overflow-y-auto", children: [
13978
+ /* @__PURE__ */ jsx(SheetHeader, { children: /* @__PURE__ */ jsx(SheetTitle, { children: "Transaction Filters" }) }),
13979
+ /* @__PURE__ */ jsxs("div", { className: "space-y-6 py-6", children: [
13980
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
13981
+ /* @__PURE__ */ jsx(
13982
+ EnhancedInput,
13983
+ {
13984
+ label: "Account Number",
13985
+ value: localFilters.accountNumber,
13986
+ onChange: (e) => handleLocalFilterChange("accountNumber", e.target.value),
13987
+ placeholder: "Enter account number"
13988
+ }
13989
+ ),
13990
+ /* @__PURE__ */ jsx(
13991
+ EnhancedSelect,
13992
+ {
13993
+ label: "Product",
13994
+ value: localFilters.product,
13995
+ onValueChange: (value) => handleLocalFilterChange("product", value),
13996
+ placeholder: "Select product",
13997
+ options: [
13998
+ { value: "wire", label: "Wire" },
13999
+ { value: "ach", label: "ACH" },
14000
+ { value: "check", label: "Check" }
14001
+ ]
14002
+ }
14003
+ )
14004
+ ] }),
14005
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
14006
+ /* @__PURE__ */ jsx(
14007
+ EnhancedInput,
14008
+ {
14009
+ label: "Customer ID",
14010
+ value: localFilters.customerId,
14011
+ onChange: (e) => handleLocalFilterChange("customerId", e.target.value),
14012
+ placeholder: "Enter customer ID"
14013
+ }
14014
+ ),
14015
+ /* @__PURE__ */ jsx(
14016
+ EnhancedInput,
14017
+ {
14018
+ label: "Counterparty ID",
14019
+ value: localFilters.counterpartyId,
14020
+ onChange: (e) => handleLocalFilterChange("counterpartyId", e.target.value),
14021
+ placeholder: "Enter counterparty ID"
14022
+ }
14023
+ )
14024
+ ] }),
14025
+ /* @__PURE__ */ jsx(
14026
+ EnhancedInput,
14027
+ {
14028
+ label: "Settlement File Name",
14029
+ value: localFilters.settlementFileName,
14030
+ onChange: (e) => handleLocalFilterChange("settlementFileName", e.target.value),
14031
+ placeholder: "Enter settlement file name"
14032
+ }
14033
+ ),
14034
+ /* @__PURE__ */ jsx(
14035
+ EnhancedInput,
14036
+ {
14037
+ label: "Original File Name",
14038
+ value: localFilters.originalFileName,
14039
+ onChange: (e) => handleLocalFilterChange("originalFileName", e.target.value),
14040
+ placeholder: "Enter original file name"
14041
+ }
14042
+ ),
14043
+ /* @__PURE__ */ jsx(
14044
+ EnhancedInput,
14045
+ {
14046
+ label: "Requester IP Address",
14047
+ value: localFilters.requesterIpAddress,
14048
+ onChange: (e) => handleLocalFilterChange("requesterIpAddress", e.target.value),
14049
+ placeholder: "Enter IP address"
14050
+ }
14051
+ ),
14052
+ /* @__PURE__ */ jsx(
14053
+ EnhancedInput,
14054
+ {
14055
+ label: "Requester Username",
14056
+ value: localFilters.requesterUsername,
14057
+ onChange: (e) => handleLocalFilterChange("requesterUsername", e.target.value),
14058
+ placeholder: "Enter username"
14059
+ }
14060
+ ),
14061
+ /* @__PURE__ */ jsx(
14062
+ EnhancedInput,
14063
+ {
14064
+ label: "Wire File Handle",
14065
+ value: localFilters.wireFileHandle,
14066
+ onChange: (e) => handleLocalFilterChange("wireFileHandle", e.target.value),
14067
+ placeholder: "Enter wire file handle"
14068
+ }
14069
+ ),
14070
+ /* @__PURE__ */ jsx(
14071
+ EnhancedInput,
14072
+ {
14073
+ label: "Payment ID",
14074
+ value: localFilters.paymentId,
14075
+ onChange: (e) => handleLocalFilterChange("paymentId", e.target.value),
14076
+ placeholder: "Enter payment ID"
14077
+ }
14078
+ ),
14079
+ /* @__PURE__ */ jsx(
14080
+ EnhancedSelect,
14081
+ {
14082
+ label: "Transaction Type",
14083
+ value: localFilters.transactionType,
14084
+ onValueChange: (value) => handleLocalFilterChange("transactionType", value),
14085
+ placeholder: "Select transaction type",
14086
+ options: [
14087
+ { value: "ach_credit", label: "ACH Credit" },
14088
+ { value: "ach_debit", label: "ACH Debit" },
14089
+ { value: "wire_domestic", label: "Wire Domestic" },
14090
+ { value: "wire_international", label: "Wire International" }
14091
+ ]
14092
+ }
14093
+ ),
14094
+ /* @__PURE__ */ jsx(
14095
+ EnhancedSelect,
14096
+ {
14097
+ label: "Transaction Status",
14098
+ value: localFilters.transactionStatus,
14099
+ onValueChange: (value) => handleLocalFilterChange("transactionStatus", value),
14100
+ placeholder: "Select transaction status",
14101
+ options: [
14102
+ { value: "PENDING", label: "Pending" },
14103
+ { value: "POSTED", label: "Posted" },
14104
+ { value: "FAILED", label: "Failed" },
14105
+ { value: "CANCELLED", label: "Cancelled" }
14106
+ ]
14107
+ }
14108
+ ),
14109
+ /* @__PURE__ */ jsx(
14110
+ EnhancedSelect,
14111
+ {
14112
+ label: "Processing Status",
14113
+ value: localFilters.processingStatus,
14114
+ onValueChange: (value) => handleLocalFilterChange("processingStatus", value),
14115
+ placeholder: "Select processing status",
14116
+ options: [
14117
+ { value: "processing", label: "Processing" },
14118
+ { value: "completed", label: "Completed" },
14119
+ { value: "error", label: "Error" }
14120
+ ]
14121
+ }
14122
+ ),
14123
+ /* @__PURE__ */ jsx(
14124
+ EnhancedSelect,
14125
+ {
14126
+ label: "Direction",
14127
+ value: localFilters.direction,
14128
+ onValueChange: (value) => handleLocalFilterChange("direction", value),
14129
+ placeholder: "Select direction",
14130
+ options: [
14131
+ { value: "credit", label: "Credit" },
14132
+ { value: "debit", label: "Debit" }
14133
+ ]
14134
+ }
14135
+ ),
14136
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
14137
+ /* @__PURE__ */ jsx(
14138
+ CurrencyInput,
14139
+ {
14140
+ label: "Min Amount",
14141
+ value: localFilters.minAmount,
14142
+ onChange: (value) => handleLocalFilterChange("minAmount", value)
14143
+ }
14144
+ ),
14145
+ /* @__PURE__ */ jsx(
14146
+ CurrencyInput,
14147
+ {
14148
+ label: "Max Amount",
14149
+ value: localFilters.maxAmount,
14150
+ onChange: (value) => handleLocalFilterChange("maxAmount", value)
14151
+ }
14152
+ )
14153
+ ] }),
14154
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
14155
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
14156
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Creation Date Start" }),
14141
14157
  /* @__PURE__ */ jsx(
14142
- EnhancedSelect,
14158
+ DatePicker,
14143
14159
  {
14144
- label: "Processing Status",
14145
- value: filters.processingStatus,
14146
- onValueChange: (value) => handleFilterChange("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
- ]
14160
+ date: localFilters.creationDateStart,
14161
+ onDateChange: (date) => handleLocalFilterChange("creationDateStart", date),
14162
+ placeholder: "MM/DD/YYYY",
14163
+ buttonClassName: "w-full",
14164
+ className: "bg-background z-50"
14153
14165
  }
14154
- ),
14166
+ )
14167
+ ] }),
14168
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
14169
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Creation Date End" }),
14155
14170
  /* @__PURE__ */ jsx(
14156
- EnhancedSelect,
14171
+ DatePicker,
14157
14172
  {
14158
- label: "Direction",
14159
- value: filters.direction,
14160
- onValueChange: (value) => handleFilterChange("direction", value),
14161
- placeholder: "Select direction",
14162
- options: [
14163
- { value: "credit", label: "Credit" },
14164
- { value: "debit", label: "Debit" }
14165
- ]
14173
+ date: localFilters.creationDateEnd,
14174
+ onDateChange: (date) => handleLocalFilterChange("creationDateEnd", date),
14175
+ placeholder: "MM/DD/YYYY",
14176
+ buttonClassName: "w-full",
14177
+ className: "bg-background z-50"
14166
14178
  }
14167
- ),
14168
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
14169
- /* @__PURE__ */ jsx(
14170
- CurrencyInput,
14171
- {
14172
- label: "Min Amount",
14173
- value: filters.minAmount,
14174
- onChange: (value) => handleFilterChange("minAmount", value)
14175
- }
14176
- ),
14177
- /* @__PURE__ */ jsx(
14178
- CurrencyInput,
14179
- {
14180
- label: "Max Amount",
14181
- value: filters.maxAmount,
14182
- onChange: (value) => handleFilterChange("maxAmount", value)
14183
- }
14184
- )
14185
- ] }),
14186
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
14187
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
14188
- /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Creation Date Start" }),
14189
- /* @__PURE__ */ jsx(
14190
- DatePicker,
14191
- {
14192
- date: filters.creationDateStart,
14193
- onDateChange: (date) => handleFilterChange("creationDateStart", date),
14194
- placeholder: "MM/DD/YYYY",
14195
- buttonClassName: "w-full",
14196
- className: "bg-background z-50"
14197
- }
14198
- )
14199
- ] }),
14200
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
14201
- /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Creation Date End" }),
14202
- /* @__PURE__ */ jsx(
14203
- DatePicker,
14204
- {
14205
- date: filters.creationDateEnd,
14206
- onDateChange: (date) => handleFilterChange("creationDateEnd", date),
14207
- placeholder: "MM/DD/YYYY",
14208
- buttonClassName: "w-full",
14209
- className: "bg-background z-50"
14210
- }
14211
- )
14212
- ] })
14213
- ] }),
14214
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
14215
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
14216
- /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Post Date Start" }),
14217
- /* @__PURE__ */ jsx(
14218
- DatePicker,
14219
- {
14220
- date: filters.postDateStart,
14221
- onDateChange: (date) => handleFilterChange("postDateStart", date),
14222
- placeholder: "MM/DD/YYYY",
14223
- buttonClassName: "w-full",
14224
- className: "bg-background z-50"
14225
- }
14226
- )
14227
- ] }),
14228
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
14229
- /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Post Date End" }),
14230
- /* @__PURE__ */ jsx(
14231
- DatePicker,
14232
- {
14233
- date: filters.postDateEnd,
14234
- onDateChange: (date) => handleFilterChange("postDateEnd", date),
14235
- placeholder: "MM/DD/YYYY",
14236
- buttonClassName: "w-full",
14237
- className: "bg-background z-50"
14238
- }
14239
- )
14240
- ] })
14241
- ] })
14242
- ] }),
14243
- /* @__PURE__ */ jsxs(SheetFooter, { className: "gap-2", children: [
14244
- /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: resetFilters, children: "Reset Filters" }),
14245
- /* @__PURE__ */ jsx(Button, { onClick: applyFilters, children: "Apply Filters" })
14246
- ] })
14247
- ] })
14248
- ] })
14249
- ] }) }) }),
14250
- /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "container mx-auto px-4 h-full max-w-none flex flex-col", children: /* @__PURE__ */ jsxs("div", { className: "flex-1 mt-4 rounded-lg border bg-card overflow-hidden flex flex-col", children: [
14251
- /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ jsxs("table", { className: "w-full table-fixed", children: [
14252
- /* @__PURE__ */ jsxs("colgroup", { children: [
14253
- /* @__PURE__ */ jsx("col", { className: "w-28" }),
14254
- /* @__PURE__ */ jsx("col", { className: "w-28" }),
14255
- /* @__PURE__ */ jsx("col", { className: "w-24" }),
14256
- /* @__PURE__ */ jsx("col", { className: "w-36" }),
14257
- /* @__PURE__ */ jsx("col", { className: "w-36" }),
14258
- /* @__PURE__ */ jsx("col", { className: "w-auto" }),
14259
- /* @__PURE__ */ jsx("col", { className: "w-36" }),
14260
- /* @__PURE__ */ jsx("col", { className: "w-24" }),
14261
- /* @__PURE__ */ jsx("col", { className: "w-28" })
14262
- ] }),
14263
- /* @__PURE__ */ jsx("thead", { className: "sticky top-0 bg-card z-10 shadow-sm", children: /* @__PURE__ */ jsxs("tr", { className: "border-b", children: [
14264
- /* @__PURE__ */ jsx("th", { className: "px-3 py-2 text-left text-xs font-medium bg-muted/50", children: "Created" }),
14265
- /* @__PURE__ */ jsx("th", { className: "px-3 py-2 text-left text-xs font-medium bg-muted/50", children: "Account Number" }),
14266
- /* @__PURE__ */ jsx("th", { className: "px-3 py-2 text-right text-xs font-medium bg-muted/50", children: "Amount" }),
14267
- /* @__PURE__ */ jsx("th", { className: "px-3 py-2 text-left text-xs font-medium bg-muted/50", children: "Customer" }),
14268
- /* @__PURE__ */ jsx("th", { className: "px-3 py-2 text-left text-xs font-medium bg-muted/50", children: "Counterparty" }),
14269
- /* @__PURE__ */ jsx("th", { className: "px-3 py-2 text-left text-xs font-medium bg-muted/50", children: "Description" }),
14270
- /* @__PURE__ */ jsx("th", { className: "px-3 py-2 text-left text-xs font-medium bg-muted/50", children: "Transaction Type" }),
14271
- /* @__PURE__ */ jsx("th", { className: "px-3 py-2 text-left text-xs font-medium bg-muted/50", children: "Status" }),
14272
- /* @__PURE__ */ jsx("th", { className: "px-3 py-2 text-left text-xs font-medium bg-muted/50", children: "Updated" })
14273
- ] }) }),
14274
- /* @__PURE__ */ jsx("tbody", { children: paginatedTransactions.map((transaction) => /* @__PURE__ */ jsxs(
14275
- "tr",
14276
- {
14277
- onClick: () => navigate(`/transactions/${transaction.id}`),
14278
- className: "border-b hover:bg-muted/50 transition-colors cursor-pointer",
14279
- children: [
14280
- /* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-xs", children: transaction.created }),
14281
- /* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-xs", children: transaction.accountNumber }),
14282
- /* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-xs text-right", children: /* @__PURE__ */ jsx("span", { className: transaction.amount < 0 ? "text-destructive" : "", children: formatCurrency4(transaction.amount) }) }),
14283
- /* @__PURE__ */ jsx("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsx(Button, { variant: "link", className: "h-auto p-0 font-normal text-xs", children: transaction.customer }) }),
14284
- /* @__PURE__ */ jsx("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsx(Button, { variant: "link", className: "h-auto p-0 font-normal text-xs", children: transaction.counterparty }) }),
14285
- /* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-xs truncate", children: transaction.description }),
14286
- /* @__PURE__ */ jsx("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsx(Badge, { variant: "outline", className: "font-normal whitespace-nowrap text-xs", children: transaction.transactionType }) }),
14287
- /* @__PURE__ */ jsx("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsx(StatusBadge, { status: transaction.status }) }),
14288
- /* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-xs", children: transaction.updated })
14289
- ]
14290
- },
14291
- transaction.id
14292
- )) })
14293
- ] }) }),
14294
- /* @__PURE__ */ jsx("div", { className: "flex-none border-t bg-background py-3 px-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
14295
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
14296
- /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: "Rows per page:" }),
14297
- /* @__PURE__ */ jsxs(DropdownMenu, { children: [
14298
- /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "sm", className: "h-8 gap-1", children: [
14299
- rowsPerPage,
14300
- /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4 rotate-90" })
14301
- ] }) }),
14302
- /* @__PURE__ */ jsxs(DropdownMenuContent, { align: "start", className: "bg-background z-50", children: [
14303
- /* @__PURE__ */ jsx(DropdownMenuItem, { onClick: () => handleRowsPerPageChange(100), children: "100" }),
14304
- /* @__PURE__ */ jsx(DropdownMenuItem, { onClick: () => handleRowsPerPageChange(200), children: "200" }),
14305
- /* @__PURE__ */ jsx(DropdownMenuItem, { onClick: () => handleRowsPerPageChange(500), children: "500" })
14306
- ] })
14179
+ )
14307
14180
  ] })
14308
14181
  ] }),
14309
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
14310
- /* @__PURE__ */ jsxs("span", { className: "text-sm text-muted-foreground", children: [
14311
- "Page ",
14312
- currentPage,
14313
- " of ",
14314
- totalPages
14315
- ] }),
14316
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
14182
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
14183
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
14184
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Post Date Start" }),
14317
14185
  /* @__PURE__ */ jsx(
14318
- Button,
14186
+ DatePicker,
14319
14187
  {
14320
- variant: "outline",
14321
- size: "sm",
14322
- className: "h-8 w-8 p-0",
14323
- onClick: () => handlePageChange(currentPage - 1),
14324
- disabled: currentPage === 1,
14325
- children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" })
14188
+ date: localFilters.postDateStart,
14189
+ onDateChange: (date) => handleLocalFilterChange("postDateStart", date),
14190
+ placeholder: "MM/DD/YYYY",
14191
+ buttonClassName: "w-full",
14192
+ className: "bg-background z-50"
14326
14193
  }
14327
- ),
14194
+ )
14195
+ ] }),
14196
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
14197
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Post Date End" }),
14328
14198
  /* @__PURE__ */ jsx(
14329
- Button,
14199
+ DatePicker,
14330
14200
  {
14331
- variant: "outline",
14332
- size: "sm",
14333
- className: "h-8 w-8 p-0",
14334
- onClick: () => handlePageChange(currentPage + 1),
14335
- disabled: currentPage === totalPages,
14336
- children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" })
14201
+ date: localFilters.postDateEnd,
14202
+ onDateChange: (date) => handleLocalFilterChange("postDateEnd", date),
14203
+ placeholder: "MM/DD/YYYY",
14204
+ buttonClassName: "w-full",
14205
+ className: "bg-background z-50"
14337
14206
  }
14338
14207
  )
14339
14208
  ] })
14340
14209
  ] })
14341
- ] }) })
14342
- ] }) }) })
14210
+ ] }),
14211
+ /* @__PURE__ */ jsxs(SheetFooter, { className: "flex gap-2", children: [
14212
+ /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: handleResetFilters, className: "flex-1", children: "Reset Filters" }),
14213
+ /* @__PURE__ */ jsx(Button, { onClick: handleApplyFilters, className: "flex-1", children: "Apply Filters" })
14214
+ ] })
14215
+ ] })
14343
14216
  ] });
14344
14217
  };
14218
+ var TransactionHistoryView = ({
14219
+ table,
14220
+ filters,
14221
+ onFilterChange,
14222
+ onResetFilters,
14223
+ onApplyFilters
14224
+ }) => {
14225
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-screen bg-gradient-subtle", children: [
14226
+ /* @__PURE__ */ jsx("div", { className: "flex-none border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60", children: /* @__PURE__ */ jsx("div", { className: "container mx-auto px-4 py-4 max-w-none", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
14227
+ /* @__PURE__ */ jsx("h1", { className: "text-3xl font-bold text-foreground", children: "Transaction History" }),
14228
+ /* @__PURE__ */ jsx(
14229
+ TransactionHistoryFiltersSheet,
14230
+ {
14231
+ filters,
14232
+ onFilterChange,
14233
+ onResetFilters,
14234
+ onApplyFilters
14235
+ }
14236
+ )
14237
+ ] }) }) }),
14238
+ /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "container mx-auto px-4 h-full max-w-none flex flex-col", children: /* @__PURE__ */ jsx("div", { className: "flex-1 mt-4 overflow-auto", children: table }) }) })
14239
+ ] });
14240
+ };
14241
+ var TransactionHistory = () => {
14242
+ const navigate = useNavigate();
14243
+ const [sortBy, setSortBy] = useState("created");
14244
+ const [sortDirection, setSortDirection] = useState("desc");
14245
+ const [filters, setFilters] = useState({
14246
+ accountNumber: "",
14247
+ product: "",
14248
+ customerId: "",
14249
+ counterpartyId: "",
14250
+ settlementFileName: "",
14251
+ originalFileName: "",
14252
+ requesterIpAddress: "",
14253
+ requesterUsername: "",
14254
+ wireFileHandle: "",
14255
+ paymentId: "",
14256
+ transactionType: "",
14257
+ transactionStatus: "",
14258
+ processingStatus: "",
14259
+ direction: "",
14260
+ minAmount: "",
14261
+ maxAmount: "",
14262
+ creationDateStart: void 0,
14263
+ creationDateEnd: void 0,
14264
+ postDateStart: void 0,
14265
+ postDateEnd: void 0
14266
+ });
14267
+ const filteredTransactions = useMemo(() => {
14268
+ let filtered = [...mockTransactions];
14269
+ if (filters.accountNumber) {
14270
+ filtered = filtered.filter(
14271
+ (t) => t.accountNumber.toLowerCase().includes(filters.accountNumber.toLowerCase())
14272
+ );
14273
+ }
14274
+ if (filters.transactionType) {
14275
+ filtered = filtered.filter((t) => t.transactionType === filters.transactionType);
14276
+ }
14277
+ if (filters.transactionStatus) {
14278
+ filtered = filtered.filter((t) => t.status === filters.transactionStatus);
14279
+ }
14280
+ if (filters.minAmount) {
14281
+ const minAmount = parseFloat(filters.minAmount.replace(/[^0-9.-]/g, ""));
14282
+ if (!isNaN(minAmount)) {
14283
+ filtered = filtered.filter((t) => t.amount >= minAmount);
14284
+ }
14285
+ }
14286
+ if (filters.maxAmount) {
14287
+ const maxAmount = parseFloat(filters.maxAmount.replace(/[^0-9.-]/g, ""));
14288
+ if (!isNaN(maxAmount)) {
14289
+ filtered = filtered.filter((t) => t.amount <= maxAmount);
14290
+ }
14291
+ }
14292
+ return filtered;
14293
+ }, [filters]);
14294
+ const sortedTransactions = useMemo(() => {
14295
+ return [...filteredTransactions].sort((a, b) => {
14296
+ const aValue = a[sortBy];
14297
+ const bValue = b[sortBy];
14298
+ if (aValue === void 0 || bValue === void 0) return 0;
14299
+ if (aValue < bValue) return sortDirection === "asc" ? -1 : 1;
14300
+ if (aValue > bValue) return sortDirection === "asc" ? 1 : -1;
14301
+ return 0;
14302
+ });
14303
+ }, [filteredTransactions, sortBy, sortDirection]);
14304
+ const handleFilterChange = useCallback((field, value) => {
14305
+ setFilters((prev) => ({ ...prev, [field]: value }));
14306
+ }, []);
14307
+ const handleResetFilters = useCallback(() => {
14308
+ setFilters({
14309
+ accountNumber: "",
14310
+ product: "",
14311
+ customerId: "",
14312
+ counterpartyId: "",
14313
+ settlementFileName: "",
14314
+ originalFileName: "",
14315
+ requesterIpAddress: "",
14316
+ requesterUsername: "",
14317
+ wireFileHandle: "",
14318
+ paymentId: "",
14319
+ transactionType: "",
14320
+ transactionStatus: "",
14321
+ processingStatus: "",
14322
+ direction: "",
14323
+ minAmount: "",
14324
+ maxAmount: "",
14325
+ creationDateStart: void 0,
14326
+ creationDateEnd: void 0,
14327
+ postDateStart: void 0,
14328
+ postDateEnd: void 0
14329
+ });
14330
+ }, []);
14331
+ const handleApplyFilters = useCallback(() => {
14332
+ console.log("Applying filters:", filters);
14333
+ }, [filters]);
14334
+ const handleSort = useCallback((key) => {
14335
+ if (sortBy === key) {
14336
+ setSortDirection((prev) => prev === "asc" ? "desc" : "asc");
14337
+ } else {
14338
+ setSortBy(key);
14339
+ setSortDirection("asc");
14340
+ }
14341
+ }, [sortBy]);
14342
+ const handleRowClick = useCallback((transaction) => {
14343
+ navigate(`/transactions/${transaction.id}`);
14344
+ }, [navigate]);
14345
+ const formatCurrency4 = (value) => {
14346
+ return new Intl.NumberFormat("en-US", {
14347
+ style: "currency",
14348
+ currency: "USD",
14349
+ minimumFractionDigits: 2
14350
+ }).format(value);
14351
+ };
14352
+ const columns3 = useMemo(() => [
14353
+ {
14354
+ key: "created",
14355
+ title: "Created",
14356
+ sortable: true
14357
+ },
14358
+ {
14359
+ key: "accountNumber",
14360
+ title: "Account Number",
14361
+ sortable: true
14362
+ },
14363
+ {
14364
+ key: "amount",
14365
+ title: "Amount",
14366
+ sortable: true,
14367
+ align: "right",
14368
+ render: (value) => /* @__PURE__ */ jsx("span", { className: value < 0 ? "text-destructive" : "", children: formatCurrency4(value) })
14369
+ },
14370
+ {
14371
+ key: "customer",
14372
+ title: "Customer",
14373
+ sortable: true,
14374
+ render: (value) => /* @__PURE__ */ jsx(Button, { variant: "link", className: "h-auto p-0 font-normal text-xs", children: value })
14375
+ },
14376
+ {
14377
+ key: "counterparty",
14378
+ title: "Counterparty",
14379
+ sortable: true,
14380
+ render: (value) => /* @__PURE__ */ jsx(Button, { variant: "link", className: "h-auto p-0 font-normal text-xs", children: value })
14381
+ },
14382
+ {
14383
+ key: "description",
14384
+ title: "Description",
14385
+ sortable: true,
14386
+ render: (value) => /* @__PURE__ */ jsx("span", { className: "truncate block max-w-[200px]", children: value })
14387
+ },
14388
+ {
14389
+ key: "transactionType",
14390
+ title: "Transaction Type",
14391
+ sortable: true,
14392
+ render: (value) => /* @__PURE__ */ jsx(Badge, { variant: "outline", className: "font-normal whitespace-nowrap text-xs", children: value })
14393
+ },
14394
+ {
14395
+ key: "status",
14396
+ title: "Status",
14397
+ sortable: true,
14398
+ render: (value) => /* @__PURE__ */ jsx(StatusBadge, { status: value })
14399
+ },
14400
+ {
14401
+ key: "updated",
14402
+ title: "Updated",
14403
+ sortable: true
14404
+ }
14405
+ ], []);
14406
+ const table = useMemo(() => /* @__PURE__ */ jsx(
14407
+ DataTable,
14408
+ {
14409
+ columns: columns3,
14410
+ data: sortedTransactions,
14411
+ sortBy,
14412
+ sortDirection,
14413
+ onSort: handleSort,
14414
+ onRowClick: handleRowClick
14415
+ }
14416
+ ), [columns3, sortedTransactions, sortBy, sortDirection, handleSort, handleRowClick]);
14417
+ return /* @__PURE__ */ jsx(
14418
+ TransactionHistoryView,
14419
+ {
14420
+ table,
14421
+ filters,
14422
+ onFilterChange: handleFilterChange,
14423
+ onResetFilters: handleResetFilters,
14424
+ onApplyFilters: handleApplyFilters
14425
+ }
14426
+ );
14427
+ };
14345
14428
  var TransactionHistory_default = TransactionHistory;
14346
14429
  var newTransactionSchema = z.object({
14347
14430
  transactionType: z.string().min(1, "Transaction type is required"),
@@ -14762,20 +14845,20 @@ function NewTransaction() {
14762
14845
  setConfirmationOpen(false);
14763
14846
  resetForm();
14764
14847
  };
14848
+ const formValues = form.watch();
14765
14849
  const isReviewReady = useMemo(() => {
14766
- const data = form.watch();
14767
- const requiresCounterparty = ["ach", "wire"].includes(data.transactionType);
14768
- if (!data.transactionType || !data.accountNumber || !data.amount) return false;
14769
- if (requiresCounterparty && (!data.counterpartyName || !counterpartyLookedUp)) return false;
14850
+ const requiresCounterparty = ["ach", "wire"].includes(formValues.transactionType);
14851
+ if (!formValues.transactionType || !formValues.accountNumber || !formValues.amount || !formValues.description) return false;
14852
+ if (requiresCounterparty && (!formValues.counterpartyName || !counterpartyLookedUp)) return false;
14770
14853
  if (!accountLookedUp) return false;
14771
- if (data.transactionType === "adjustment") {
14772
- if (!data.adjustmentDirection || !data.adjustmentType) return false;
14854
+ if (formValues.transactionType === "adjustment") {
14855
+ if (!formValues.adjustmentDirection || !formValues.adjustmentType) return false;
14773
14856
  }
14774
- if (data.transactionType === "transfer") {
14775
- if (!data.receiverAccountNumber || !receiverAccountLookedUp) return false;
14857
+ if (formValues.transactionType === "transfer") {
14858
+ if (!formValues.receiverAccountNumber || !receiverAccountLookedUp) return false;
14776
14859
  }
14777
14860
  return true;
14778
- }, [form.watch(), accountLookedUp, counterpartyLookedUp, receiverAccountLookedUp]);
14861
+ }, [formValues, accountLookedUp, counterpartyLookedUp, receiverAccountLookedUp]);
14779
14862
  return /* @__PURE__ */ jsx(
14780
14863
  NewTransactionView,
14781
14864
  {
@@ -14822,6 +14905,8 @@ function NewTransaction() {
14822
14905
  }
14823
14906
  );
14824
14907
  }
14908
+
14909
+ // src/lib/utils/transaction-utils.ts
14825
14910
  var getStatusVariant = (status) => {
14826
14911
  switch (status) {
14827
14912
  case "POSTED":
@@ -14862,8 +14947,10 @@ var TransactionDetailView = ({
14862
14947
  timelineEvents,
14863
14948
  isWireTransfer,
14864
14949
  isACHTransfer,
14865
- onReturn,
14866
- onCancel,
14950
+ showCancelButton,
14951
+ showReturnButton,
14952
+ onReturnClick,
14953
+ onCancelClick,
14867
14954
  onAccountClick,
14868
14955
  onCustomerClick,
14869
14956
  onCounterpartyClick,
@@ -14890,16 +14977,16 @@ var TransactionDetailView = ({
14890
14977
  ] }),
14891
14978
  maxWidth: "full",
14892
14979
  actions: [
14893
- {
14980
+ ...showReturnButton ? [{
14894
14981
  label: "Return",
14895
14982
  variant: "outline",
14896
- onClick: onReturn
14897
- },
14898
- {
14983
+ onClick: onReturnClick
14984
+ }] : [],
14985
+ ...showCancelButton ? [{
14899
14986
  label: "Cancel",
14900
14987
  variant: "default",
14901
- onClick: onCancel
14902
- }
14988
+ onClick: onCancelClick
14989
+ }] : []
14903
14990
  ],
14904
14991
  children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col lg:flex-row items-start gap-6", children: [
14905
14992
  /* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-6", children: [
@@ -15008,10 +15095,251 @@ var TransactionDetailView = ({
15008
15095
  }
15009
15096
  );
15010
15097
  };
15098
+ var cancelTransactionSchema = z.object({
15099
+ reason: z.string().min(1, "Reason is required").max(500, "Reason must be less than 500 characters")
15100
+ });
15101
+ var returnTransactionSchema = z.object({
15102
+ reasonCode: z.string().min(1, "Reason code is required")
15103
+ });
15104
+ var CancelTransactionDialog = ({
15105
+ transactionId,
15106
+ open,
15107
+ onOpenChange,
15108
+ onCancel
15109
+ }) => {
15110
+ const { toast: toast6 } = useToast();
15111
+ const {
15112
+ register,
15113
+ handleSubmit,
15114
+ formState: { errors, isSubmitting },
15115
+ reset
15116
+ } = useFormWithEditState({
15117
+ schema: cancelTransactionSchema,
15118
+ defaultValues: {
15119
+ reason: ""
15120
+ }
15121
+ });
15122
+ const onSubmit = async (data) => {
15123
+ try {
15124
+ await onCancel(data);
15125
+ toast6({
15126
+ title: "Transaction Cancelled",
15127
+ description: `Transaction ${transactionId} has been cancelled successfully.`
15128
+ });
15129
+ reset();
15130
+ onOpenChange(false);
15131
+ } catch (error) {
15132
+ toast6({
15133
+ title: "Error",
15134
+ description: "Failed to cancel the transaction. Please try again.",
15135
+ variant: "destructive"
15136
+ });
15137
+ }
15138
+ };
15139
+ const handleClose = () => {
15140
+ reset();
15141
+ onOpenChange(false);
15142
+ };
15143
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-md", children: [
15144
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [
15145
+ /* @__PURE__ */ jsx(DialogTitle, { children: "Cancel Transaction" }),
15146
+ /* @__PURE__ */ jsxs(DialogDescription, { children: [
15147
+ "Please provide a reason for cancelling transaction ",
15148
+ transactionId,
15149
+ "."
15150
+ ] })
15151
+ ] }),
15152
+ /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit(onSubmit), className: "space-y-4", children: [
15153
+ /* @__PURE__ */ jsx(
15154
+ EnhancedTextarea,
15155
+ {
15156
+ label: "Cancellation Reason",
15157
+ placeholder: "Enter the reason for cancellation...",
15158
+ error: errors.reason?.message,
15159
+ ...register("reason")
15160
+ }
15161
+ ),
15162
+ /* @__PURE__ */ jsxs(DialogFooter, { className: "gap-2 sm:gap-0", children: [
15163
+ /* @__PURE__ */ jsx(
15164
+ Button,
15165
+ {
15166
+ type: "button",
15167
+ variant: "outline",
15168
+ onClick: handleClose,
15169
+ disabled: isSubmitting,
15170
+ children: "Close"
15171
+ }
15172
+ ),
15173
+ /* @__PURE__ */ jsx(
15174
+ Button,
15175
+ {
15176
+ type: "submit",
15177
+ variant: "destructive",
15178
+ disabled: isSubmitting,
15179
+ children: isSubmitting ? "Cancelling..." : "Cancel Transaction"
15180
+ }
15181
+ )
15182
+ ] })
15183
+ ] })
15184
+ ] }) });
15185
+ };
15186
+ function ReturnTransactionDialog({
15187
+ transactionId,
15188
+ open,
15189
+ onOpenChange,
15190
+ onReturn,
15191
+ reasonCodes
15192
+ }) {
15193
+ const {
15194
+ watch,
15195
+ setValue,
15196
+ handleSave,
15197
+ handleCancel,
15198
+ isLoading,
15199
+ formState: { errors }
15200
+ } = useFormWithEditState({
15201
+ schema: returnTransactionSchema,
15202
+ initialEditing: true,
15203
+ onSave: async (data) => {
15204
+ try {
15205
+ await onReturn(data);
15206
+ toast({
15207
+ title: "Transaction returned",
15208
+ description: `Transaction #${transactionId} has been returned successfully.`
15209
+ });
15210
+ onOpenChange(false);
15211
+ } catch (error) {
15212
+ toast({
15213
+ title: "Error",
15214
+ description: "Failed to return transaction. Please try again.",
15215
+ variant: "destructive"
15216
+ });
15217
+ throw error;
15218
+ }
15219
+ },
15220
+ onCancel: () => {
15221
+ onOpenChange(false);
15222
+ }
15223
+ });
15224
+ const reasonCode = watch("reasonCode");
15225
+ const selectOptions = reasonCodes.map((code) => ({
15226
+ value: code.value,
15227
+ label: code.label
15228
+ }));
15229
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-[425px]", children: [
15230
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [
15231
+ /* @__PURE__ */ jsx(DialogTitle, { children: "Return Transaction" }),
15232
+ /* @__PURE__ */ jsxs(DialogDescription, { children: [
15233
+ "Select a reason code to return transaction #",
15234
+ transactionId,
15235
+ "."
15236
+ ] })
15237
+ ] }),
15238
+ /* @__PURE__ */ jsx("div", { className: "py-4", children: /* @__PURE__ */ jsx(
15239
+ EnhancedSelect,
15240
+ {
15241
+ label: "Reason Code",
15242
+ placeholder: "Select a reason code",
15243
+ options: selectOptions,
15244
+ value: reasonCode || "",
15245
+ onValueChange: (value) => setValue("reasonCode", value),
15246
+ error: errors.reasonCode?.message
15247
+ }
15248
+ ) }),
15249
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [
15250
+ /* @__PURE__ */ jsx(
15251
+ Button,
15252
+ {
15253
+ type: "button",
15254
+ variant: "outline",
15255
+ onClick: handleCancel,
15256
+ disabled: isLoading,
15257
+ children: "Cancel"
15258
+ }
15259
+ ),
15260
+ /* @__PURE__ */ jsx(
15261
+ Button,
15262
+ {
15263
+ type: "button",
15264
+ variant: "destructive",
15265
+ onClick: handleSave,
15266
+ disabled: isLoading || !reasonCode,
15267
+ children: isLoading ? "Returning..." : "Return Transaction"
15268
+ }
15269
+ )
15270
+ ] })
15271
+ ] }) });
15272
+ }
15273
+ var returnReasonCodes = [
15274
+ { value: "R01", label: "R01 - Insufficient Funds" },
15275
+ { value: "R02", label: "R02 - Account Closed" },
15276
+ { value: "R03", label: "R03 - No Account/Unable to Locate" },
15277
+ { value: "R04", label: "R04 - Invalid Account Number" },
15278
+ { value: "R05", label: "R05 - Unauthorized Debit" },
15279
+ { value: "R06", label: "R06 - Returned per ODFI Request" },
15280
+ { value: "R07", label: "R07 - Authorization Revoked" },
15281
+ { value: "R08", label: "R08 - Payment Stopped" },
15282
+ { value: "R09", label: "R09 - Uncollected Funds" },
15283
+ { value: "R10", label: "R10 - Customer Advises Not Authorized" }
15284
+ ];
15011
15285
  var TransactionDetail = () => {
15012
15286
  const { id } = useParams();
15013
15287
  const navigate = useNavigate();
15014
- const transaction = mockTransactions.find((t) => t.id === id);
15288
+ const [isCancelDialogOpen, setIsCancelDialogOpen] = useState(false);
15289
+ const [isReturnDialogOpen, setIsReturnDialogOpen] = useState(false);
15290
+ const transaction = useMemo(
15291
+ () => mockTransactions.find((t) => t.id === id),
15292
+ [id]
15293
+ );
15294
+ const isWireTransfer = useMemo(
15295
+ () => transaction?.transactionType.toLowerCase().includes("wire") ?? false,
15296
+ [transaction?.transactionType]
15297
+ );
15298
+ const isACHTransfer = useMemo(
15299
+ () => transaction?.transactionType.toLowerCase().includes("ach") ?? false,
15300
+ [transaction?.transactionType]
15301
+ );
15302
+ const timelineEvents = useMemo(
15303
+ () => mockTransactionTimeline,
15304
+ []
15305
+ );
15306
+ const showCancelButton = useMemo(() => {
15307
+ if (!transaction) return false;
15308
+ const cancelableStatuses = ["INITIATED", "SUBMITTED", "CUSTOMER_REVIEW", "MANUAL_REVIEW"];
15309
+ return transaction.status === "PENDING" && cancelableStatuses.includes(transaction.processingStatus);
15310
+ }, [transaction]);
15311
+ const showReturnButton = useMemo(() => {
15312
+ if (!transaction) return false;
15313
+ const returnableStatuses = ["POSTED", "SETTLED", "CONFIRMED"];
15314
+ return returnableStatuses.includes(transaction.processingStatus);
15315
+ }, [transaction]);
15316
+ const handleOpenReturnDialog = useCallback(() => {
15317
+ setIsReturnDialogOpen(true);
15318
+ }, []);
15319
+ const handleReturnTransaction = useCallback(async (data) => {
15320
+ console.log("Returning transaction with reason code:", data.reasonCode);
15321
+ }, []);
15322
+ const handleOpenCancelDialog = useCallback(() => {
15323
+ setIsCancelDialogOpen(true);
15324
+ }, []);
15325
+ const handleCancelTransaction = useCallback(async (data) => {
15326
+ console.log("Cancelling transaction with reason:", data.reason);
15327
+ }, []);
15328
+ const handleAccountClick = useCallback((accountNumber) => {
15329
+ navigate(`/accounts/${accountNumber}`);
15330
+ }, [navigate]);
15331
+ const handleCustomerClick = useCallback((customer) => {
15332
+ console.log("Navigate to customer:", customer);
15333
+ }, []);
15334
+ const handleCounterpartyClick = useCallback((counterparty) => {
15335
+ console.log("Navigate to counterparty:", counterparty);
15336
+ }, []);
15337
+ const handleOFACClick = useCallback((ofacId) => {
15338
+ navigate(`/compliance/ofac/${ofacId}`);
15339
+ }, [navigate]);
15340
+ const handleProductClick = useCallback((productId) => {
15341
+ console.log("Navigate to product:", productId);
15342
+ }, []);
15015
15343
  if (!transaction) {
15016
15344
  return /* @__PURE__ */ jsx("div", { className: "container mx-auto px-4 py-8", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
15017
15345
  /* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold mb-2", children: "Transaction Not Found" }),
@@ -15023,45 +15351,45 @@ var TransactionDetail = () => {
15023
15351
  /* @__PURE__ */ jsx(Button, { onClick: () => navigate("/transactions/history"), children: "Back to Transaction History" })
15024
15352
  ] }) });
15025
15353
  }
15026
- const isWireTransfer = transaction.transactionType.toLowerCase().includes("wire");
15027
- const isACHTransfer = transaction.transactionType.toLowerCase().includes("ach");
15028
- const handleReturn = () => {
15029
- console.log("Return transaction");
15030
- };
15031
- const handleCancel = () => {
15032
- console.log("Cancel transaction");
15033
- };
15034
- const handleAccountClick = (accountNumber) => {
15035
- navigate(`/accounts/${accountNumber}`);
15036
- };
15037
- const handleCustomerClick = (customer) => {
15038
- console.log("Navigate to customer:", customer);
15039
- };
15040
- const handleCounterpartyClick = (counterparty) => {
15041
- console.log("Navigate to counterparty:", counterparty);
15042
- };
15043
- const handleOFACClick = (ofacId) => {
15044
- navigate(`/compliance/ofac/${ofacId}`);
15045
- };
15046
- const handleProductClick = (productId) => {
15047
- console.log("Navigate to product:", productId);
15048
- };
15049
- return /* @__PURE__ */ jsx(
15050
- TransactionDetailView,
15051
- {
15052
- transaction,
15053
- timelineEvents: mockTransactionTimeline,
15054
- isWireTransfer,
15055
- isACHTransfer,
15056
- onReturn: handleReturn,
15057
- onCancel: handleCancel,
15058
- onAccountClick: handleAccountClick,
15059
- onCustomerClick: handleCustomerClick,
15060
- onCounterpartyClick: handleCounterpartyClick,
15061
- onOFACClick: handleOFACClick,
15062
- onProductClick: handleProductClick
15063
- }
15064
- );
15354
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
15355
+ /* @__PURE__ */ jsx(
15356
+ TransactionDetailView,
15357
+ {
15358
+ transaction,
15359
+ timelineEvents,
15360
+ isWireTransfer,
15361
+ isACHTransfer,
15362
+ showCancelButton,
15363
+ showReturnButton,
15364
+ onReturnClick: handleOpenReturnDialog,
15365
+ onCancelClick: handleOpenCancelDialog,
15366
+ onAccountClick: handleAccountClick,
15367
+ onCustomerClick: handleCustomerClick,
15368
+ onCounterpartyClick: handleCounterpartyClick,
15369
+ onOFACClick: handleOFACClick,
15370
+ onProductClick: handleProductClick
15371
+ }
15372
+ ),
15373
+ /* @__PURE__ */ jsx(
15374
+ CancelTransactionDialog,
15375
+ {
15376
+ transactionId: transaction.id,
15377
+ open: isCancelDialogOpen,
15378
+ onOpenChange: setIsCancelDialogOpen,
15379
+ onCancel: handleCancelTransaction
15380
+ }
15381
+ ),
15382
+ /* @__PURE__ */ jsx(
15383
+ ReturnTransactionDialog,
15384
+ {
15385
+ transactionId: transaction.id,
15386
+ open: isReturnDialogOpen,
15387
+ onOpenChange: setIsReturnDialogOpen,
15388
+ onReturn: handleReturnTransaction,
15389
+ reasonCodes: returnReasonCodes
15390
+ }
15391
+ )
15392
+ ] });
15065
15393
  };
15066
15394
  var TransactionDetail_default = TransactionDetail;
15067
15395
  function UIKit() {