braid-ui 1.0.34 → 1.0.36
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 +246 -145
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +246 -145
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -327,8 +327,13 @@ interface BusinessDetailViewProps {
|
|
|
327
327
|
onNavigateToCounterparty: () => void;
|
|
328
328
|
onAddAccount: () => void;
|
|
329
329
|
onUBOClick: (customerId: string) => void;
|
|
330
|
+
onDocumentUpload: (file: File, metadata: {
|
|
331
|
+
name: string;
|
|
332
|
+
description: string;
|
|
333
|
+
type: string;
|
|
334
|
+
}) => Promise<void>;
|
|
330
335
|
}
|
|
331
|
-
declare const BusinessDetailView: ({ business, businessProfile, identityVerification, businessUBOs, businessDocuments, businessAccounts, currentStatus, isEditingProfile, onStatusChange, onProfileDataChange, onToggleProfileEdit, onNavigateToAccounts, onNavigateToCounterparty, onAddAccount, onUBOClick }: BusinessDetailViewProps) => react_jsx_runtime.JSX.Element;
|
|
336
|
+
declare const BusinessDetailView: ({ business, businessProfile, identityVerification, businessUBOs, businessDocuments, businessAccounts, currentStatus, isEditingProfile, onStatusChange, onProfileDataChange, onToggleProfileEdit, onNavigateToAccounts, onNavigateToCounterparty, onAddAccount, onUBOClick, onDocumentUpload }: BusinessDetailViewProps) => react_jsx_runtime.JSX.Element;
|
|
332
337
|
|
|
333
338
|
interface BusinessFilters {
|
|
334
339
|
name: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -327,8 +327,13 @@ interface BusinessDetailViewProps {
|
|
|
327
327
|
onNavigateToCounterparty: () => void;
|
|
328
328
|
onAddAccount: () => void;
|
|
329
329
|
onUBOClick: (customerId: string) => void;
|
|
330
|
+
onDocumentUpload: (file: File, metadata: {
|
|
331
|
+
name: string;
|
|
332
|
+
description: string;
|
|
333
|
+
type: string;
|
|
334
|
+
}) => Promise<void>;
|
|
330
335
|
}
|
|
331
|
-
declare const BusinessDetailView: ({ business, businessProfile, identityVerification, businessUBOs, businessDocuments, businessAccounts, currentStatus, isEditingProfile, onStatusChange, onProfileDataChange, onToggleProfileEdit, onNavigateToAccounts, onNavigateToCounterparty, onAddAccount, onUBOClick }: BusinessDetailViewProps) => react_jsx_runtime.JSX.Element;
|
|
336
|
+
declare const BusinessDetailView: ({ business, businessProfile, identityVerification, businessUBOs, businessDocuments, businessAccounts, currentStatus, isEditingProfile, onStatusChange, onProfileDataChange, onToggleProfileEdit, onNavigateToAccounts, onNavigateToCounterparty, onAddAccount, onUBOClick, onDocumentUpload }: BusinessDetailViewProps) => react_jsx_runtime.JSX.Element;
|
|
332
337
|
|
|
333
338
|
interface BusinessFilters {
|
|
334
339
|
name: string;
|
package/dist/index.js
CHANGED
|
@@ -4307,7 +4307,7 @@ var UBOCard = ({ ubos, onUBOClick }) => {
|
|
|
4307
4307
|
) })
|
|
4308
4308
|
] });
|
|
4309
4309
|
};
|
|
4310
|
-
var BusinessDocuments = ({ businessId, documents }) => {
|
|
4310
|
+
var BusinessDocuments = ({ businessId, documents, onDocumentUpload }) => {
|
|
4311
4311
|
const [isUploading, setIsUploading] = useState(false);
|
|
4312
4312
|
const [showUploadDialog, setShowUploadDialog] = useState(false);
|
|
4313
4313
|
const [selectedFile, setSelectedFile] = useState(null);
|
|
@@ -4320,7 +4320,7 @@ var BusinessDocuments = ({ businessId, documents }) => {
|
|
|
4320
4320
|
setSelectedFile(file);
|
|
4321
4321
|
setDocumentName(file.name);
|
|
4322
4322
|
};
|
|
4323
|
-
const handleUploadSubmit = () => {
|
|
4323
|
+
const handleUploadSubmit = async () => {
|
|
4324
4324
|
if (!selectedFile || !documentName || !documentType) {
|
|
4325
4325
|
toast({
|
|
4326
4326
|
title: "Missing Information",
|
|
@@ -4330,15 +4330,27 @@ var BusinessDocuments = ({ businessId, documents }) => {
|
|
|
4330
4330
|
return;
|
|
4331
4331
|
}
|
|
4332
4332
|
setIsUploading(true);
|
|
4333
|
-
|
|
4333
|
+
try {
|
|
4334
|
+
await onDocumentUpload(selectedFile, {
|
|
4335
|
+
name: documentName,
|
|
4336
|
+
description,
|
|
4337
|
+
type: documentType
|
|
4338
|
+
});
|
|
4334
4339
|
toast({
|
|
4335
4340
|
title: "Upload Successful",
|
|
4336
4341
|
description: `${documentName} uploaded successfully`
|
|
4337
4342
|
});
|
|
4338
|
-
setIsUploading(false);
|
|
4339
4343
|
setShowUploadDialog(false);
|
|
4340
4344
|
resetForm();
|
|
4341
|
-
}
|
|
4345
|
+
} catch (error) {
|
|
4346
|
+
toast({
|
|
4347
|
+
title: "Upload Failed",
|
|
4348
|
+
description: "Failed to upload document. Please try again.",
|
|
4349
|
+
variant: "destructive"
|
|
4350
|
+
});
|
|
4351
|
+
} finally {
|
|
4352
|
+
setIsUploading(false);
|
|
4353
|
+
}
|
|
4342
4354
|
};
|
|
4343
4355
|
const resetForm = () => {
|
|
4344
4356
|
setSelectedFile(null);
|
|
@@ -4629,7 +4641,8 @@ var BusinessDetailView = ({
|
|
|
4629
4641
|
onNavigateToAccounts,
|
|
4630
4642
|
onNavigateToCounterparty,
|
|
4631
4643
|
onAddAccount,
|
|
4632
|
-
onUBOClick
|
|
4644
|
+
onUBOClick,
|
|
4645
|
+
onDocumentUpload
|
|
4633
4646
|
}) => {
|
|
4634
4647
|
return /* @__PURE__ */ jsx(
|
|
4635
4648
|
PageLayout,
|
|
@@ -4702,7 +4715,14 @@ var BusinessDetailView = ({
|
|
|
4702
4715
|
}
|
|
4703
4716
|
) })
|
|
4704
4717
|
] }),
|
|
4705
|
-
/* @__PURE__ */ jsx(
|
|
4718
|
+
/* @__PURE__ */ jsx(
|
|
4719
|
+
BusinessDocuments,
|
|
4720
|
+
{
|
|
4721
|
+
businessId: business.id,
|
|
4722
|
+
documents: businessDocuments,
|
|
4723
|
+
onDocumentUpload
|
|
4724
|
+
}
|
|
4725
|
+
)
|
|
4706
4726
|
] }),
|
|
4707
4727
|
/* @__PURE__ */ jsx("div", { className: "lg:w-64", children: /* @__PURE__ */ jsx(BusinessStatusCard, { isEditing: false, onToggleEdit: () => {
|
|
4708
4728
|
} }) })
|
|
@@ -10364,7 +10384,7 @@ var BusinessDetail = () => {
|
|
|
10364
10384
|
const business = mockBusinessesList.find((b) => b.id === id);
|
|
10365
10385
|
const identityVerification = id ? mockIdentityVerifications[id] : void 0;
|
|
10366
10386
|
const businessUBOs = id ? mockBusinessUBOs[id] || [] : [];
|
|
10367
|
-
const
|
|
10387
|
+
const initialDocuments = id ? mockBusinessDocuments[id] || [] : [];
|
|
10368
10388
|
const businessAccounts = id ? mockBusinessAccounts[id] || [] : [];
|
|
10369
10389
|
const initialProfile = id ? mockBusinessProfiles[id] : void 0;
|
|
10370
10390
|
const [currentStatus, setCurrentStatus] = useState(business?.status || "active");
|
|
@@ -10372,6 +10392,7 @@ var BusinessDetail = () => {
|
|
|
10372
10392
|
const [businessProfile, setBusinessProfile] = useState(
|
|
10373
10393
|
initialProfile
|
|
10374
10394
|
);
|
|
10395
|
+
const [businessDocuments, setBusinessDocuments] = useState(initialDocuments);
|
|
10375
10396
|
const handleStatusChange = (newStatus) => {
|
|
10376
10397
|
setCurrentStatus(newStatus);
|
|
10377
10398
|
};
|
|
@@ -10394,6 +10415,20 @@ var BusinessDetail = () => {
|
|
|
10394
10415
|
const handleUBOClick = (customerId) => {
|
|
10395
10416
|
navigate(`/customer/${customerId}`);
|
|
10396
10417
|
};
|
|
10418
|
+
const handleDocumentUpload = async (file, metadata) => {
|
|
10419
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
10420
|
+
const newDocument = {
|
|
10421
|
+
id: `doc-${Date.now()}`,
|
|
10422
|
+
name: metadata.name,
|
|
10423
|
+
type: metadata.type,
|
|
10424
|
+
description: metadata.description,
|
|
10425
|
+
size: `${(file.size / 1024 / 1024).toFixed(2)} MB`,
|
|
10426
|
+
uploadedBy: "Current User",
|
|
10427
|
+
uploadedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
10428
|
+
};
|
|
10429
|
+
setBusinessDocuments((prev) => [...prev, newDocument]);
|
|
10430
|
+
console.log("Document uploaded:", { file, metadata, newDocument });
|
|
10431
|
+
};
|
|
10397
10432
|
if (!business) {
|
|
10398
10433
|
return /* @__PURE__ */ jsx("div", { className: "container mx-auto px-4 py-8", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
10399
10434
|
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold mb-2", children: "Business Not Found" }),
|
|
@@ -10417,7 +10452,8 @@ var BusinessDetail = () => {
|
|
|
10417
10452
|
onNavigateToAccounts: handleNavigateToAccounts,
|
|
10418
10453
|
onNavigateToCounterparty: handleNavigateToCounterparty,
|
|
10419
10454
|
onAddAccount: handleAddAccount,
|
|
10420
|
-
onUBOClick: handleUBOClick
|
|
10455
|
+
onUBOClick: handleUBOClick,
|
|
10456
|
+
onDocumentUpload: handleDocumentUpload
|
|
10421
10457
|
}
|
|
10422
10458
|
);
|
|
10423
10459
|
};
|
|
@@ -10595,11 +10631,121 @@ var mockCounterpartiesList = [
|
|
|
10595
10631
|
modified: "2023-12-28"
|
|
10596
10632
|
}
|
|
10597
10633
|
];
|
|
10634
|
+
var CounterpartiesView = ({
|
|
10635
|
+
table,
|
|
10636
|
+
filters,
|
|
10637
|
+
onFilterChange,
|
|
10638
|
+
onResetFilters,
|
|
10639
|
+
onApplyFilters,
|
|
10640
|
+
onCreateCounterparty
|
|
10641
|
+
}) => {
|
|
10642
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-screen bg-gradient-subtle", children: [
|
|
10643
|
+
/* @__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-6 max-w-none", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
10644
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("h1", { className: "text-3xl font-bold text-foreground mb-2", children: "Counterparties" }) }),
|
|
10645
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
10646
|
+
/* @__PURE__ */ jsxs(Sheet, { children: [
|
|
10647
|
+
/* @__PURE__ */ jsx(SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { variant: "outline", className: "gap-2", children: [
|
|
10648
|
+
/* @__PURE__ */ jsx(Filter, { className: "h-4 w-4" }),
|
|
10649
|
+
"Filters"
|
|
10650
|
+
] }) }),
|
|
10651
|
+
/* @__PURE__ */ jsxs(SheetContent, { side: "right", className: "w-full sm:max-w-xl overflow-y-auto", children: [
|
|
10652
|
+
/* @__PURE__ */ jsx(SheetHeader, { children: /* @__PURE__ */ jsx(SheetTitle, { children: "Counterparty Filters" }) }),
|
|
10653
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-6 py-6", children: [
|
|
10654
|
+
/* @__PURE__ */ jsx(
|
|
10655
|
+
EnhancedInput,
|
|
10656
|
+
{
|
|
10657
|
+
label: "Name",
|
|
10658
|
+
value: filters.name,
|
|
10659
|
+
onChange: (e) => onFilterChange("name", e.target.value),
|
|
10660
|
+
placeholder: "Enter counterparty name"
|
|
10661
|
+
}
|
|
10662
|
+
),
|
|
10663
|
+
/* @__PURE__ */ jsx(
|
|
10664
|
+
EnhancedSelect,
|
|
10665
|
+
{
|
|
10666
|
+
label: "Type",
|
|
10667
|
+
value: filters.type,
|
|
10668
|
+
onValueChange: (value) => onFilterChange("type", value),
|
|
10669
|
+
placeholder: "Select type",
|
|
10670
|
+
options: [
|
|
10671
|
+
{ value: "BUSINESS", label: "Business" },
|
|
10672
|
+
{ value: "INDIVIDUAL", label: "Individual" }
|
|
10673
|
+
]
|
|
10674
|
+
}
|
|
10675
|
+
),
|
|
10676
|
+
/* @__PURE__ */ jsx(
|
|
10677
|
+
EnhancedSelect,
|
|
10678
|
+
{
|
|
10679
|
+
label: "Status",
|
|
10680
|
+
value: filters.status,
|
|
10681
|
+
onValueChange: (value) => onFilterChange("status", value),
|
|
10682
|
+
placeholder: "Select status",
|
|
10683
|
+
options: [
|
|
10684
|
+
{ value: "ACTIVE", label: "Active" },
|
|
10685
|
+
{ value: "INACTIVE", label: "Inactive" },
|
|
10686
|
+
{ value: "PENDING", label: "Pending" },
|
|
10687
|
+
{ value: "SUSPENDED", label: "Suspended" }
|
|
10688
|
+
]
|
|
10689
|
+
}
|
|
10690
|
+
),
|
|
10691
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
10692
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
10693
|
+
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Created Date Start" }),
|
|
10694
|
+
/* @__PURE__ */ jsx(
|
|
10695
|
+
DatePicker,
|
|
10696
|
+
{
|
|
10697
|
+
date: filters.createdDateStart,
|
|
10698
|
+
onDateChange: (date) => onFilterChange("createdDateStart", date),
|
|
10699
|
+
placeholder: "MM/DD/YYYY",
|
|
10700
|
+
buttonClassName: "w-full",
|
|
10701
|
+
className: "bg-background z-50"
|
|
10702
|
+
}
|
|
10703
|
+
)
|
|
10704
|
+
] }),
|
|
10705
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
10706
|
+
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Created Date End" }),
|
|
10707
|
+
/* @__PURE__ */ jsx(
|
|
10708
|
+
DatePicker,
|
|
10709
|
+
{
|
|
10710
|
+
date: filters.createdDateEnd,
|
|
10711
|
+
onDateChange: (date) => onFilterChange("createdDateEnd", date),
|
|
10712
|
+
placeholder: "MM/DD/YYYY",
|
|
10713
|
+
buttonClassName: "w-full",
|
|
10714
|
+
className: "bg-background z-50"
|
|
10715
|
+
}
|
|
10716
|
+
)
|
|
10717
|
+
] })
|
|
10718
|
+
] })
|
|
10719
|
+
] }),
|
|
10720
|
+
/* @__PURE__ */ jsxs(SheetFooter, { className: "gap-2", children: [
|
|
10721
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick: onResetFilters, children: "Reset Filters" }),
|
|
10722
|
+
/* @__PURE__ */ jsx(Button, { onClick: onApplyFilters, children: "Apply Filters" })
|
|
10723
|
+
] })
|
|
10724
|
+
] })
|
|
10725
|
+
] }),
|
|
10726
|
+
/* @__PURE__ */ jsx(Button, { onClick: onCreateCounterparty, children: "Create Counterparty" })
|
|
10727
|
+
] })
|
|
10728
|
+
] }) }) }),
|
|
10729
|
+
/* @__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 }) }) })
|
|
10730
|
+
] });
|
|
10731
|
+
};
|
|
10732
|
+
var mockProducts3 = {
|
|
10733
|
+
"prod-001": "Business Banking Pro",
|
|
10734
|
+
"prod-002": "Premium Banking",
|
|
10735
|
+
"prod-003": "Business Banking Plus"
|
|
10736
|
+
};
|
|
10737
|
+
var mockBusinesses2 = {
|
|
10738
|
+
"bus-001": "Tech Solutions LLC",
|
|
10739
|
+
"bus-002": "Digital Ventures"
|
|
10740
|
+
};
|
|
10741
|
+
var mockIndividuals2 = {
|
|
10742
|
+
"ind-001": "Cloud Services Corp",
|
|
10743
|
+
"ind-002": "Wealth Management"
|
|
10744
|
+
};
|
|
10598
10745
|
var Counterparties = () => {
|
|
10599
10746
|
const navigate = useNavigate();
|
|
10600
10747
|
const [searchParams] = useSearchParams();
|
|
10601
|
-
const
|
|
10602
|
-
const [filteredCounterparties, setFilteredCounterparties] = useState([]);
|
|
10748
|
+
const [counterparties, setCounterparties] = useState([]);
|
|
10603
10749
|
const [sortBy, setSortBy] = useState("created");
|
|
10604
10750
|
const [sortDirection, setSortDirection] = useState("desc");
|
|
10605
10751
|
const [filters, setFilters] = useState({
|
|
@@ -10609,43 +10755,78 @@ var Counterparties = () => {
|
|
|
10609
10755
|
createdDateStart: void 0,
|
|
10610
10756
|
createdDateEnd: void 0
|
|
10611
10757
|
});
|
|
10612
|
-
|
|
10613
|
-
|
|
10614
|
-
|
|
10615
|
-
|
|
10616
|
-
|
|
10758
|
+
useEffect(() => {
|
|
10759
|
+
const enrichCounterparties = async () => {
|
|
10760
|
+
const enriched = await Promise.all(
|
|
10761
|
+
mockCounterpartiesList.map(async (counterparty) => {
|
|
10762
|
+
let associatedEntity = "";
|
|
10763
|
+
let entityType = null;
|
|
10764
|
+
if (counterparty.productId) {
|
|
10765
|
+
associatedEntity = mockProducts3[counterparty.productId] || counterparty.productId;
|
|
10766
|
+
entityType = "product";
|
|
10767
|
+
} else if (counterparty.businessId) {
|
|
10768
|
+
associatedEntity = mockBusinesses2[counterparty.businessId] || counterparty.businessId;
|
|
10769
|
+
entityType = "business";
|
|
10770
|
+
} else if (counterparty.individualId) {
|
|
10771
|
+
associatedEntity = mockIndividuals2[counterparty.individualId] || counterparty.individualId;
|
|
10772
|
+
entityType = "individual";
|
|
10773
|
+
} else if (counterparty.accountNumber) {
|
|
10774
|
+
associatedEntity = counterparty.accountNumber;
|
|
10775
|
+
entityType = "account";
|
|
10776
|
+
}
|
|
10777
|
+
return {
|
|
10778
|
+
...counterparty,
|
|
10779
|
+
associatedEntity,
|
|
10780
|
+
entityType
|
|
10781
|
+
};
|
|
10782
|
+
})
|
|
10783
|
+
);
|
|
10784
|
+
setCounterparties(enriched);
|
|
10785
|
+
};
|
|
10786
|
+
enrichCounterparties();
|
|
10787
|
+
}, []);
|
|
10788
|
+
const filteredCounterparties = useMemo(() => {
|
|
10789
|
+
const customerId = searchParams.get("customerId");
|
|
10790
|
+
let filtered = counterparties;
|
|
10791
|
+
if (customerId) {
|
|
10792
|
+
filtered = filtered.filter((cp) => cp.customerId === customerId);
|
|
10793
|
+
}
|
|
10617
10794
|
if (filters.name) {
|
|
10618
10795
|
filtered = filtered.filter(
|
|
10619
|
-
(
|
|
10796
|
+
(cp) => cp.name.toLowerCase().includes(filters.name.toLowerCase())
|
|
10620
10797
|
);
|
|
10621
10798
|
}
|
|
10622
10799
|
if (filters.type) {
|
|
10623
|
-
filtered = filtered.filter((
|
|
10800
|
+
filtered = filtered.filter((cp) => cp.type === filters.type);
|
|
10624
10801
|
}
|
|
10625
10802
|
if (filters.status) {
|
|
10626
|
-
filtered = filtered.filter((
|
|
10803
|
+
filtered = filtered.filter((cp) => cp.status === filters.status);
|
|
10627
10804
|
}
|
|
10628
10805
|
if (filters.createdDateStart) {
|
|
10629
10806
|
filtered = filtered.filter(
|
|
10630
|
-
(
|
|
10807
|
+
(cp) => new Date(cp.created) >= filters.createdDateStart
|
|
10631
10808
|
);
|
|
10632
10809
|
}
|
|
10633
10810
|
if (filters.createdDateEnd) {
|
|
10634
10811
|
filtered = filtered.filter(
|
|
10635
|
-
(
|
|
10812
|
+
(cp) => new Date(cp.created) <= filters.createdDateEnd
|
|
10636
10813
|
);
|
|
10637
10814
|
}
|
|
10638
|
-
|
|
10639
|
-
};
|
|
10640
|
-
|
|
10641
|
-
|
|
10642
|
-
|
|
10643
|
-
|
|
10644
|
-
|
|
10645
|
-
|
|
10646
|
-
|
|
10647
|
-
|
|
10648
|
-
|
|
10815
|
+
return filtered;
|
|
10816
|
+
}, [counterparties, filters, searchParams]);
|
|
10817
|
+
const sortedCounterparties = useMemo(() => {
|
|
10818
|
+
return [...filteredCounterparties].sort((a, b) => {
|
|
10819
|
+
const aValue = a[sortBy];
|
|
10820
|
+
const bValue = b[sortBy];
|
|
10821
|
+
if (aValue < bValue) return sortDirection === "asc" ? -1 : 1;
|
|
10822
|
+
if (aValue > bValue) return sortDirection === "asc" ? 1 : -1;
|
|
10823
|
+
return 0;
|
|
10824
|
+
});
|
|
10825
|
+
}, [filteredCounterparties, sortBy, sortDirection]);
|
|
10826
|
+
const handleFilterChange = useCallback((field, value) => {
|
|
10827
|
+
setFilters((prev) => ({ ...prev, [field]: value }));
|
|
10828
|
+
}, []);
|
|
10829
|
+
const handleResetFilters = useCallback(() => {
|
|
10649
10830
|
setFilters({
|
|
10650
10831
|
name: "",
|
|
10651
10832
|
type: "",
|
|
@@ -10653,19 +10834,23 @@ var Counterparties = () => {
|
|
|
10653
10834
|
createdDateStart: void 0,
|
|
10654
10835
|
createdDateEnd: void 0
|
|
10655
10836
|
});
|
|
10656
|
-
|
|
10657
|
-
|
|
10658
|
-
|
|
10837
|
+
}, []);
|
|
10838
|
+
const handleApplyFilters = useCallback(() => {
|
|
10839
|
+
}, []);
|
|
10840
|
+
const handleSort = useCallback((key) => {
|
|
10659
10841
|
if (sortBy === key) {
|
|
10660
|
-
setSortDirection(
|
|
10842
|
+
setSortDirection((prev) => prev === "asc" ? "desc" : "asc");
|
|
10661
10843
|
} else {
|
|
10662
10844
|
setSortBy(key);
|
|
10663
10845
|
setSortDirection("asc");
|
|
10664
10846
|
}
|
|
10665
|
-
};
|
|
10666
|
-
const handleRowClick = (counterparty) => {
|
|
10847
|
+
}, [sortBy]);
|
|
10848
|
+
const handleRowClick = useCallback((counterparty) => {
|
|
10667
10849
|
navigate(`/counterparty/${counterparty.id}`);
|
|
10668
|
-
};
|
|
10850
|
+
}, [navigate]);
|
|
10851
|
+
const handleCreateCounterparty = useCallback(() => {
|
|
10852
|
+
navigate("/counterparty/create");
|
|
10853
|
+
}, [navigate]);
|
|
10669
10854
|
const columns3 = [
|
|
10670
10855
|
{
|
|
10671
10856
|
key: "name",
|
|
@@ -10718,112 +10903,28 @@ var Counterparties = () => {
|
|
|
10718
10903
|
sortable: true
|
|
10719
10904
|
}
|
|
10720
10905
|
];
|
|
10721
|
-
const
|
|
10722
|
-
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
|
-
|
|
10728
|
-
|
|
10729
|
-
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10733
|
-
|
|
10734
|
-
|
|
10735
|
-
|
|
10736
|
-
|
|
10737
|
-
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
|
|
10741
|
-
|
|
10742
|
-
|
|
10743
|
-
label: "Name",
|
|
10744
|
-
value: filters.name,
|
|
10745
|
-
onChange: (e) => handleFilterChange("name", e.target.value),
|
|
10746
|
-
placeholder: "Enter counterparty name"
|
|
10747
|
-
}
|
|
10748
|
-
),
|
|
10749
|
-
/* @__PURE__ */ jsx(
|
|
10750
|
-
EnhancedSelect,
|
|
10751
|
-
{
|
|
10752
|
-
label: "Type",
|
|
10753
|
-
value: filters.type,
|
|
10754
|
-
onValueChange: (value) => handleFilterChange("type", value),
|
|
10755
|
-
placeholder: "Select type",
|
|
10756
|
-
options: [
|
|
10757
|
-
{ value: "BUSINESS", label: "Business" },
|
|
10758
|
-
{ value: "INDIVIDUAL", label: "Individual" }
|
|
10759
|
-
]
|
|
10760
|
-
}
|
|
10761
|
-
),
|
|
10762
|
-
/* @__PURE__ */ jsx(
|
|
10763
|
-
EnhancedSelect,
|
|
10764
|
-
{
|
|
10765
|
-
label: "Status",
|
|
10766
|
-
value: filters.status,
|
|
10767
|
-
onValueChange: (value) => handleFilterChange("status", value),
|
|
10768
|
-
placeholder: "Select status",
|
|
10769
|
-
options: [
|
|
10770
|
-
{ value: "ACTIVE", label: "Active" },
|
|
10771
|
-
{ value: "INACTIVE", label: "Inactive" },
|
|
10772
|
-
{ value: "PENDING", label: "Pending" },
|
|
10773
|
-
{ value: "SUSPENDED", label: "Suspended" }
|
|
10774
|
-
]
|
|
10775
|
-
}
|
|
10776
|
-
),
|
|
10777
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
10778
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
10779
|
-
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Created Date Start" }),
|
|
10780
|
-
/* @__PURE__ */ jsx(
|
|
10781
|
-
DatePicker,
|
|
10782
|
-
{
|
|
10783
|
-
date: filters.createdDateStart,
|
|
10784
|
-
onDateChange: (date) => handleFilterChange("createdDateStart", date),
|
|
10785
|
-
placeholder: "MM/DD/YYYY",
|
|
10786
|
-
buttonClassName: "w-full",
|
|
10787
|
-
className: "bg-background z-50"
|
|
10788
|
-
}
|
|
10789
|
-
)
|
|
10790
|
-
] }),
|
|
10791
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
10792
|
-
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: "Created Date End" }),
|
|
10793
|
-
/* @__PURE__ */ jsx(
|
|
10794
|
-
DatePicker,
|
|
10795
|
-
{
|
|
10796
|
-
date: filters.createdDateEnd,
|
|
10797
|
-
onDateChange: (date) => handleFilterChange("createdDateEnd", date),
|
|
10798
|
-
placeholder: "MM/DD/YYYY",
|
|
10799
|
-
buttonClassName: "w-full",
|
|
10800
|
-
className: "bg-background z-50"
|
|
10801
|
-
}
|
|
10802
|
-
)
|
|
10803
|
-
] })
|
|
10804
|
-
] })
|
|
10805
|
-
] }),
|
|
10806
|
-
/* @__PURE__ */ jsxs(SheetFooter, { className: "gap-2", children: [
|
|
10807
|
-
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick: resetFilters, children: "Reset Filters" }),
|
|
10808
|
-
/* @__PURE__ */ jsx(Button, { onClick: applyFilters, children: "Apply Filters" })
|
|
10809
|
-
] })
|
|
10810
|
-
] })
|
|
10811
|
-
] }),
|
|
10812
|
-
/* @__PURE__ */ jsx(Button, { onClick: () => navigate("/counterparty/create"), children: "Create Counterparty" })
|
|
10813
|
-
] })
|
|
10814
|
-
] }) }) }),
|
|
10815
|
-
/* @__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: /* @__PURE__ */ jsx(
|
|
10816
|
-
DataTable,
|
|
10817
|
-
{
|
|
10818
|
-
columns: columns3,
|
|
10819
|
-
data: sortedCounterparties,
|
|
10820
|
-
sortBy,
|
|
10821
|
-
sortDirection,
|
|
10822
|
-
onSort: handleSort,
|
|
10823
|
-
onRowClick: handleRowClick
|
|
10824
|
-
}
|
|
10825
|
-
) }) }) })
|
|
10826
|
-
] });
|
|
10906
|
+
const table = useMemo(() => /* @__PURE__ */ jsx(
|
|
10907
|
+
DataTable,
|
|
10908
|
+
{
|
|
10909
|
+
columns: columns3,
|
|
10910
|
+
data: sortedCounterparties,
|
|
10911
|
+
sortBy,
|
|
10912
|
+
sortDirection,
|
|
10913
|
+
onSort: handleSort,
|
|
10914
|
+
onRowClick: handleRowClick
|
|
10915
|
+
}
|
|
10916
|
+
), [columns3, sortedCounterparties, sortBy, sortDirection, handleSort, handleRowClick]);
|
|
10917
|
+
return /* @__PURE__ */ jsx(
|
|
10918
|
+
CounterpartiesView,
|
|
10919
|
+
{
|
|
10920
|
+
table,
|
|
10921
|
+
filters,
|
|
10922
|
+
onFilterChange: handleFilterChange,
|
|
10923
|
+
onResetFilters: handleResetFilters,
|
|
10924
|
+
onApplyFilters: handleApplyFilters,
|
|
10925
|
+
onCreateCounterparty: handleCreateCounterparty
|
|
10926
|
+
}
|
|
10927
|
+
);
|
|
10827
10928
|
};
|
|
10828
10929
|
var Counterparties_default = Counterparties;
|
|
10829
10930
|
var mockCounterpartyTimeline = [
|