From 03779995bad8d84d001754720d35bfc1fac7b98d Mon Sep 17 00:00:00 2001 From: Jelaletdin12 Date: Sun, 20 Sep 2026 17:21:48 +0500 Subject: [PATCH] added payment setting page and quota --- src/app/router/index.tsx | 6 + src/components/infiniteSelect.tsx | 37 ++- src/components/ui/button.tsx | 2 +- src/constants/regionCodes.ts | 3 +- .../paymentSettings/api/paymentSettingsApi.ts | 34 +++ .../hooks/usePaymentSettings.ts | 33 +++ src/features/shared/api/sharedApi.ts | 40 +-- .../shared/components/assignDialog.tsx | 66 +++-- .../shared/hooks/useSharedUserAssignments.ts | 39 +-- .../api/visaMasterPaymentsApi.ts | 25 ++ .../components/PayDialog.tsx | 240 ++++++++++++++++++ .../hooks/useVisaMasterPayments.ts | 22 ++ src/layouts/DashboardLayout.tsx | 9 + src/lib/i18n/locales/en.json | 23 +- src/lib/i18n/locales/ru.json | 23 +- src/lib/i18n/locales/tk.json | 25 +- .../cardDepartment/orderNewCard/index.tsx | 111 ++++---- .../visaMasterPayments/index.tsx | 22 ++ src/pages/profile/index.tsx | 4 +- src/pages/settings/payment/index.tsx | 173 +++++++++++++ 20 files changed, 824 insertions(+), 113 deletions(-) create mode 100644 src/features/paymentSettings/api/paymentSettingsApi.ts create mode 100644 src/features/paymentSettings/hooks/usePaymentSettings.ts create mode 100644 src/features/visaMasterPayments/components/PayDialog.tsx create mode 100644 src/pages/settings/payment/index.tsx diff --git a/src/app/router/index.tsx b/src/app/router/index.tsx index 20cbeb0..cf29dbe 100644 --- a/src/app/router/index.tsx +++ b/src/app/router/index.tsx @@ -112,6 +112,7 @@ const ActivityLogViewPage = lazy(() => import("@/pages/logs/view")); const BranchCreatePage = lazy(() => import("@/pages/settings/location/branchesCreate")); const BranchesViewPage = lazy(() => import("@/pages/settings/location/branchesView")); const BranchEditPage = lazy(() => import("@/pages/settings/location/branchesEdit")); +const PaymentSettingsPage = lazy(() => import("@/pages/settings/payment")); const ProfilePage = lazy(() => import("@/pages/profile")); // ─── Guards ─────────────────────────────────────────────────────────────────── @@ -800,6 +801,11 @@ const routes: AppRoute[] = [ }, ], }, + // Payment settings + { + ...bc((t) => t("paymentSettings.title", "Töleg sazlamalary"), "/settings/payment"), + children: [{ path: "/settings/payment", element: page(PaymentSettingsPage) }], + }, ], }, ], diff --git a/src/components/infiniteSelect.tsx b/src/components/infiniteSelect.tsx index 03012d6..916490d 100644 --- a/src/components/infiniteSelect.tsx +++ b/src/components/infiniteSelect.tsx @@ -53,7 +53,31 @@ export function InfiniteSelect({ onSearchChange, }: InfiniteSelectProps) { const [open, setOpen] = useState(false); + const containerRef = useRef(null); + const scrollContainerRef = useRef(null); const sentinelRef = useRef(null); + const [portalContainer, setPortalContainer] = useState(undefined); + + useEffect(() => { + if (containerRef.current) { + const dialog = containerRef.current.closest( + '[role="dialog"], [role="alertdialog"], [data-slot="alert-dialog-content"], [data-slot="dialog-content"]', + ); + if (dialog) { + setPortalContainer(dialog); + } + } + }, []); + + useEffect(() => { + const el = scrollContainerRef.current; + if (!el || !open) return; + const handleWheel = (e: WheelEvent) => { + e.stopPropagation(); + }; + el.addEventListener("wheel", handleWheel, { passive: true }); + return () => el.removeEventListener("wheel", handleWheel); + }, [open]); const selected = options.find((o) => o.value === value); @@ -93,7 +117,7 @@ export function InfiniteSelect({ }, [open, hasNextPage, isLoadingMore, onLoadMore]); return ( -
+
{label && (