fixed some statuses and filters
This commit is contained in:
1 parent
34e8fef9b6
commit
edf503e329
20 files changed
+355
-214
No files matched your search
@@ -241,14 +241,14 @@ function FilterDropdown({
|
|||||||
</button>
|
</button>
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
|
|
||||||
<PopoverContent align="end" sideOffset={4} className="w-64 p-0">
|
<PopoverContent align="end" sideOffset={4} className="w-64 p-0 max-h-(--radix-popover-content-available-height) flex flex-col">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<div className="flex items-center justify-between px-3 py-2 border-b border-border">
|
<div className="flex items-center justify-between px-3 py-2 border-b border-border">
|
||||||
<p className="text-[11px] font-semibold text-muted-foreground uppercase tracking-wider">{t("table.filters", "Filters")}</p>
|
<p className="text-[11px] font-semibold text-muted-foreground uppercase tracking-wider">{t("table.filters", "Filters")}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Fields */}
|
{/* Fields */}
|
||||||
<div className="px-3 py-3 space-y-3">
|
<div className="px-3 py-3 space-y-3 overflow-y-auto">
|
||||||
{filterFields.map((field) => {
|
{filterFields.map((field) => {
|
||||||
const current = getActiveValue(field.id);
|
const current = getActiveValue(field.id);
|
||||||
const isFieldActive = current !== "";
|
const isFieldActive = current !== "";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useState, useRef, useEffect } from "react";
|
import { useState, useRef, useEffect, useMemo } from "react";
|
||||||
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
||||||
import { Check, ChevronsUpDown, Search, X, Eye, EyeOff, Upload, Hash, CreditCard } from "lucide-react";
|
import { Check, ChevronsUpDown, Search, X, Eye, EyeOff, Upload, Hash, CreditCard } from "lucide-react";
|
||||||
|
|
||||||
@@ -257,7 +257,7 @@ function PhoneInput({
|
|||||||
|
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex h-8 w-full rounded-md border bg-background overflow-hidden",
|
"flex h-8 w-full rounded-md border border-input bg-transparent dark:bg-input/30 overflow-hidden",
|
||||||
"ring-offset-background transition-colors duration-150",
|
"ring-offset-background transition-colors duration-150",
|
||||||
"focus-within:outline-none focus-within:ring-1 focus-within:ring-ring focus-within:ring-offset-0",
|
"focus-within:outline-none focus-within:ring-1 focus-within:ring-ring focus-within:ring-offset-0",
|
||||||
error ? "border-destructive focus-within:ring-destructive/30" : "border-input",
|
error ? "border-destructive focus-within:ring-destructive/30" : "border-input",
|
||||||
@@ -273,7 +273,7 @@ function PhoneInput({
|
|||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className="flex-1 h-full px-3 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 focus:outline-none disabled:cursor-not-allowed"
|
className="flex-1 h-full px-3 bg-transparent text-sm text-foreground placeholder:text-muted-foreground focus:outline-none disabled:cursor-not-allowed"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -491,12 +491,12 @@ function DateInput({ value = "", onChange, error, disabled, required, label, cla
|
|||||||
type="button"
|
type="button"
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex h-8 w-full items-center justify-between rounded-md border bg-background px-3 py-2",
|
"flex h-8 w-full items-center justify-between rounded-md border border-input bg-transparent dark:bg-input/30 px-3 py-2",
|
||||||
"text-sm ring-offset-background transition-colors duration-150",
|
"text-sm ring-offset-background transition-colors duration-150",
|
||||||
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-0",
|
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-0",
|
||||||
"disabled:cursor-not-allowed disabled:opacity-50",
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
||||||
error ? "border-destructive" : "border-input",
|
error ? "border-destructive" : "border-input",
|
||||||
!selected && "text-muted-foreground/60",
|
!selected && "text-muted-foreground",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<span>{selected ? format(selected, "dd.MM.yyyy") : placeholder}</span>
|
<span>{selected ? format(selected, "dd.MM.yyyy") : placeholder}</span>
|
||||||
@@ -539,7 +539,16 @@ function SelectInput({
|
|||||||
}: FormInputProps) {
|
}: FormInputProps) {
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
const selected = options.find((o) => o.value === value);
|
const uniqueOptions = useMemo(() => {
|
||||||
|
const seen = new Set<string>();
|
||||||
|
return options.filter((opt) => {
|
||||||
|
if (seen.has(opt.value)) return false;
|
||||||
|
seen.add(opt.value);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}, [options]);
|
||||||
|
|
||||||
|
const selected = uniqueOptions.find((o) => o.value === value);
|
||||||
|
|
||||||
const handleSelect = (val: string) => {
|
const handleSelect = (val: string) => {
|
||||||
onChange?.(val);
|
onChange?.(val);
|
||||||
@@ -561,7 +570,7 @@ function SelectInput({
|
|||||||
type="button"
|
type="button"
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex h-8 w-full items-center justify-between rounded-md border bg-background px-3 py-2",
|
"flex h-8 w-full items-center justify-between rounded-md border border-input bg-transparent dark:bg-input/30 px-3 py-2",
|
||||||
"text-sm ring-offset-background transition-colors duration-150",
|
"text-sm ring-offset-background transition-colors duration-150",
|
||||||
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-0",
|
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-0",
|
||||||
"disabled:cursor-not-allowed disabled:opacity-50",
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
||||||
@@ -569,7 +578,7 @@ function SelectInput({
|
|||||||
open && !error && "ring-2 ring-ring ring-offset-0 border-transparent",
|
open && !error && "ring-2 ring-ring ring-offset-0 border-transparent",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<span className={cn("truncate text-left", !selected && "text-muted-foreground/60")}>
|
<span className={cn("truncate text-left", !selected && "text-muted-foreground")}>
|
||||||
{selected ? selected.label : placeholder}
|
{selected ? selected.label : placeholder}
|
||||||
</span>
|
</span>
|
||||||
<ChevronsUpDown
|
<ChevronsUpDown
|
||||||
@@ -583,7 +592,7 @@ function SelectInput({
|
|||||||
className={cn("absolute z-50 top-full left-0 right-0 mt-1", "rounded-md border border-border bg-card shadow-lg overflow-hidden")}
|
className={cn("absolute z-50 top-full left-0 right-0 mt-1", "rounded-md border border-border bg-card shadow-lg overflow-hidden")}
|
||||||
>
|
>
|
||||||
<div className="max-h-52 overflow-y-auto scrollbar-thin py-1">
|
<div className="max-h-52 overflow-y-auto scrollbar-thin py-1">
|
||||||
{options.map((opt) => {
|
{uniqueOptions.map((opt) => {
|
||||||
const isSelected = opt.value === value;
|
const isSelected = opt.value === value;
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
@@ -633,8 +642,17 @@ function SearchableSelect({
|
|||||||
const [query, setQuery] = useState("");
|
const [query, setQuery] = useState("");
|
||||||
const searchRef = useRef<HTMLInputElement>(null);
|
const searchRef = useRef<HTMLInputElement>(null);
|
||||||
|
|
||||||
const selected = options.find((o) => o.value === value);
|
const uniqueOptions = useMemo(() => {
|
||||||
const filtered = query.trim() ? options.filter((o) => o.label.toLowerCase().includes(query.toLowerCase())) : options;
|
const seen = new Set<string>();
|
||||||
|
return options.filter((opt) => {
|
||||||
|
if (seen.has(opt.value)) return false;
|
||||||
|
seen.add(opt.value);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}, [options]);
|
||||||
|
|
||||||
|
const selected = uniqueOptions.find((o) => o.value === value);
|
||||||
|
const filtered = query.trim() ? uniqueOptions.filter((o) => o.label.toLowerCase().includes(query.toLowerCase())) : uniqueOptions;
|
||||||
|
|
||||||
const openDropdown = () => {
|
const openDropdown = () => {
|
||||||
setOpen(true);
|
setOpen(true);
|
||||||
@@ -680,7 +698,7 @@ function SearchableSelect({
|
|||||||
type="button"
|
type="button"
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex h-8 w-full items-center justify-between rounded-md border bg-background px-3 py-2",
|
"flex h-8 w-full items-center justify-between rounded-md border border-input bg-transparent dark:bg-input/30 px-3 py-2",
|
||||||
"text-sm ring-offset-background transition-colors duration-150",
|
"text-sm ring-offset-background transition-colors duration-150",
|
||||||
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-0",
|
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-0",
|
||||||
"disabled:cursor-not-allowed disabled:opacity-50",
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
||||||
@@ -688,7 +706,7 @@ function SearchableSelect({
|
|||||||
open && !error && "ring-2 ring-ring ring-offset-0 border-transparent",
|
open && !error && "ring-2 ring-ring ring-offset-0 border-transparent",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<span className={cn("truncate text-left", !selected && "text-muted-foreground/60")}>
|
<span className={cn("truncate text-left", !selected && "text-muted-foreground")}>
|
||||||
{selected ? selected.label : placeholder}
|
{selected ? selected.label : placeholder}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
||||||
import { Check, ChevronsUpDown, Search, X, Loader2 } from "lucide-react";
|
import { Check, ChevronsUpDown, Search, X, Loader2 } from "lucide-react";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
@@ -20,25 +20,14 @@ export interface InfiniteSelectProps {
|
|||||||
required?: boolean;
|
required?: boolean;
|
||||||
error?: string;
|
error?: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
/** True while the first page is being fetched. */
|
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
/** True while the next page is being fetched. */
|
|
||||||
isLoadingMore?: boolean;
|
isLoadingMore?: boolean;
|
||||||
/** Whether more pages are available to load. */
|
|
||||||
hasNextPage?: boolean;
|
hasNextPage?: boolean;
|
||||||
/** Called when the user scrolls to the bottom of the list. */
|
|
||||||
onLoadMore?: () => void;
|
onLoadMore?: () => void;
|
||||||
/** Controlled search text; drives server-side search + page reset. */
|
|
||||||
searchValue?: string;
|
searchValue?: string;
|
||||||
onSearchChange?: (value: string) => void;
|
onSearchChange?: (value: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── Collapsible aliases ──────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
const Collapsible = CollapsiblePrimitive.Root;
|
|
||||||
const CollapsibleTrigger = CollapsiblePrimitive.Trigger;
|
|
||||||
const CollapsibleContent = CollapsiblePrimitive.Content;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searchable select with infinite scroll.
|
* Searchable select with infinite scroll.
|
||||||
*
|
*
|
||||||
@@ -81,14 +70,12 @@ export function InfiniteSelect({
|
|||||||
|
|
||||||
const loadingRef = useRef(false);
|
const loadingRef = useRef(false);
|
||||||
|
|
||||||
// Reset loading ref when the query transitions out of loading state
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isLoadingMore) {
|
if (!isLoadingMore) {
|
||||||
loadingRef.current = false;
|
loadingRef.current = false;
|
||||||
}
|
}
|
||||||
}, [isLoadingMore]);
|
}, [isLoadingMore]);
|
||||||
|
|
||||||
// ── Infinite scroll: load more when the sentinel becomes visible ──
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!open || !sentinelRef.current || !hasNextPage || isLoadingMore) return;
|
if (!open || !sentinelRef.current || !hasNextPage || isLoadingMore) return;
|
||||||
const el = sentinelRef.current;
|
const el = sentinelRef.current;
|
||||||
@@ -114,18 +101,18 @@ export function InfiniteSelect({
|
|||||||
</label>
|
</label>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Collapsible
|
<PopoverPrimitive.Root
|
||||||
open={open}
|
open={open}
|
||||||
onOpenChange={(next) => {
|
onOpenChange={(next) => {
|
||||||
if (!disabled) setOpen(next);
|
if (!disabled) setOpen(next);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<CollapsibleTrigger asChild>
|
<PopoverPrimitive.Trigger asChild>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex h-8 w-full items-center justify-between rounded-md border bg-background px-3 py-2",
|
"flex h-8 w-full items-center justify-between rounded-md border border-input bg-transparent dark:bg-input/30 px-3 py-2",
|
||||||
"text-sm ring-offset-background transition-colors duration-150",
|
"text-sm ring-offset-background transition-colors duration-150",
|
||||||
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-0",
|
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-0",
|
||||||
"disabled:cursor-not-allowed disabled:opacity-50",
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
||||||
@@ -133,7 +120,7 @@ export function InfiniteSelect({
|
|||||||
open && !error && "ring-2 ring-ring ring-offset-0 border-transparent",
|
open && !error && "ring-2 ring-ring ring-offset-0 border-transparent",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<span className={cn("truncate text-left", !selected && "text-muted-foreground/60")}>
|
<span className={cn("truncate text-left", !selected && "text-muted-foreground")}>
|
||||||
{selected ? selected.label : placeholder}
|
{selected ? selected.label : placeholder}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
@@ -154,75 +141,85 @@ export function InfiniteSelect({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
</CollapsibleTrigger>
|
</PopoverPrimitive.Trigger>
|
||||||
|
|
||||||
<CollapsibleContent className="absolute z-50 top-full left-0 right-0 mt-1 rounded-md border border-border bg-card shadow-lg overflow-hidden">
|
<PopoverPrimitive.Portal>
|
||||||
{onSearchChange && (
|
<PopoverPrimitive.Content
|
||||||
<div className="flex items-center gap-2 px-3 py-2 border-b border-border bg-muted/20">
|
align="start"
|
||||||
<Search size={13} className="text-muted-foreground shrink-0" />
|
side="bottom"
|
||||||
<input
|
sideOffset={4}
|
||||||
type="text"
|
collisionPadding={16}
|
||||||
value={searchValue ?? ""}
|
avoidCollisions
|
||||||
onChange={(e) => onSearchChange(e.target.value)}
|
style={{ width: "var(--radix-popover-trigger-width)" }}
|
||||||
placeholder={searchPlaceholder}
|
className="z-50 rounded-md border border-border bg-card shadow-lg overflow-hidden max-h-[var(--radix-popover-content-available-height)] flex flex-col"
|
||||||
className="flex-1 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 focus:outline-none"
|
>
|
||||||
/>
|
{onSearchChange && (
|
||||||
{searchValue && (
|
<div className="flex items-center gap-2 px-3 py-2 border-b border-border bg-muted/20 shrink-0">
|
||||||
<button
|
<Search size={13} className="text-muted-foreground shrink-0" />
|
||||||
type="button"
|
<input
|
||||||
tabIndex={-1}
|
type="text"
|
||||||
onMouseDown={() => onSearchChange?.("")}
|
value={searchValue ?? ""}
|
||||||
className="text-muted-foreground hover:text-foreground transition-colors"
|
onChange={(e) => onSearchChange(e.target.value)}
|
||||||
>
|
placeholder={searchPlaceholder}
|
||||||
<X size={12} />
|
className="flex-1 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 focus:outline-none"
|
||||||
</button>
|
/>
|
||||||
)}
|
{searchValue && (
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<div className="max-h-60 overflow-y-auto scrollbar-thin py-1">
|
|
||||||
{loading && options.length === 0 ? (
|
|
||||||
<p className="px-3 py-4 text-sm text-muted-foreground text-center flex items-center justify-center gap-2">
|
|
||||||
<Loader2 size={14} className="animate-spin" /> Loading...
|
|
||||||
</p>
|
|
||||||
) : options.length === 0 ? (
|
|
||||||
<p className="px-3 py-4 text-sm text-muted-foreground text-center">Netije tapylmady</p>
|
|
||||||
) : (
|
|
||||||
options.map((opt) => {
|
|
||||||
const isSelected = opt.value === value;
|
|
||||||
return (
|
|
||||||
<button
|
<button
|
||||||
key={opt.value}
|
|
||||||
type="button"
|
type="button"
|
||||||
onMouseDown={(e) => {
|
tabIndex={-1}
|
||||||
e.preventDefault();
|
onMouseDown={() => onSearchChange?.("")}
|
||||||
handleSelect(opt.value);
|
className="text-muted-foreground hover:text-foreground transition-colors"
|
||||||
}}
|
|
||||||
className={cn(
|
|
||||||
"flex items-center justify-between w-full text-left px-3 py-2 text-sm transition-colors",
|
|
||||||
"hover:bg-accent hover:text-accent-foreground",
|
|
||||||
isSelected && "text-primary font-medium bg-primary/10",
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
<span>{opt.label}</span>
|
<X size={12} />
|
||||||
{isSelected && <Check size={13} className="text-primary shrink-0" />}
|
|
||||||
</button>
|
</button>
|
||||||
);
|
|
||||||
})
|
|
||||||
)}
|
|
||||||
|
|
||||||
{hasNextPage && (
|
|
||||||
<div ref={sentinelRef} className="px-3 py-2 text-xs text-muted-foreground text-center">
|
|
||||||
{isLoadingMore && (
|
|
||||||
<span className="inline-flex items-center gap-1.5">
|
|
||||||
<Loader2 size={12} className="animate-spin" /> Loading...
|
|
||||||
</span>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
|
||||||
</CollapsibleContent>
|
<div className="max-h-60 overflow-y-auto scrollbar-thin py-1">
|
||||||
</Collapsible>
|
{loading && options.length === 0 ? (
|
||||||
|
<p className="px-3 py-4 text-sm text-muted-foreground text-center flex items-center justify-center gap-2">
|
||||||
|
<Loader2 size={14} className="animate-spin" /> Loading...
|
||||||
|
</p>
|
||||||
|
) : options.length === 0 ? (
|
||||||
|
<p className="px-3 py-4 text-sm text-muted-foreground text-center">Netije tapylmady</p>
|
||||||
|
) : (
|
||||||
|
options.map((opt) => {
|
||||||
|
const isSelected = opt.value === value;
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
key={opt.value}
|
||||||
|
type="button"
|
||||||
|
onMouseDown={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
handleSelect(opt.value);
|
||||||
|
}}
|
||||||
|
className={cn(
|
||||||
|
"flex items-center justify-between w-full text-left px-3 py-2 text-sm transition-colors",
|
||||||
|
"hover:bg-accent hover:text-accent-foreground",
|
||||||
|
isSelected && "text-primary font-medium bg-primary/10",
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<span>{opt.label}</span>
|
||||||
|
{isSelected && <Check size={13} className="text-primary shrink-0" />}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
})
|
||||||
|
)}
|
||||||
|
|
||||||
|
{hasNextPage && (
|
||||||
|
<div ref={sentinelRef} className="px-3 py-2 text-xs text-muted-foreground text-center">
|
||||||
|
{isLoadingMore && (
|
||||||
|
<span className="inline-flex items-center gap-1.5">
|
||||||
|
<Loader2 size={12} className="animate-spin" /> Loading...
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</PopoverPrimitive.Content>
|
||||||
|
</PopoverPrimitive.Portal>
|
||||||
|
</PopoverPrimitive.Root>
|
||||||
|
|
||||||
{error && (
|
{error && (
|
||||||
<p className="mt-1.5 text-xs text-destructive font-medium flex items-center gap-1.5">
|
<p className="mt-1.5 text-xs text-destructive font-medium flex items-center gap-1.5">
|
||||||
|
|||||||
@@ -1,18 +1,7 @@
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Clock, CheckCircle2, XCircle, CheckCheck } from "lucide-react";
|
import { CheckCircle2, XCircle } from "lucide-react";
|
||||||
import { StatusBadge, type StatusBadgeVariant } from "@/components/ui/statusBadge";
|
import { StatusBadge, type StatusBadgeVariant } from "@/components/ui/statusBadge";
|
||||||
import { STATUS_BADGE_VARIANTS, isStatusValue, getStatusLabel, type StatusValue } from "@/constants/statusOptions";
|
import { STATUS_ICONS, STATUS_BADGE_VARIANTS, isStatusValue, getStatusLabel } from "@/constants/statusOptions";
|
||||||
|
|
||||||
export const STATUS_ICONS: Record<StatusValue, React.ElementType> = {
|
|
||||||
pending: Clock,
|
|
||||||
approved: CheckCircle2,
|
|
||||||
rejected: XCircle,
|
|
||||||
completed: CheckCheck,
|
|
||||||
satisfied: CheckCircle2,
|
|
||||||
processing: Clock,
|
|
||||||
cancelled: XCircle,
|
|
||||||
registered: CheckCircle2,
|
|
||||||
};
|
|
||||||
|
|
||||||
interface StatusCellProps {
|
interface StatusCellProps {
|
||||||
status: string;
|
status: string;
|
||||||
|
|||||||
@@ -1,16 +1,31 @@
|
|||||||
import type { TFunction } from "i18next";
|
import type { TFunction } from "i18next";
|
||||||
|
import type { ComponentType } from "react";
|
||||||
|
import { Clock, CheckCircle2, XCircle, CheckCheck } from "lucide-react";
|
||||||
import type { SelectOption } from "@/components/formInput";
|
import type { SelectOption } from "@/components/formInput";
|
||||||
import type { StatusBadgeVariant } from "@/components/ui/statusBadge";
|
import type { StatusBadgeVariant } from "@/components/ui/statusBadge";
|
||||||
|
|
||||||
|
export const STATUS_ICONS: Record<StatusValue, ComponentType> = {
|
||||||
|
pending: Clock,
|
||||||
|
approved: CheckCircle2,
|
||||||
|
rejected: XCircle,
|
||||||
|
completed: CheckCheck,
|
||||||
|
// satisfied: CheckCircle2,
|
||||||
|
// processing: Clock,
|
||||||
|
// cancelled: XCircle,
|
||||||
|
// registered: CheckCircle2,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const DEFAULT_STATUS_VALUES = ["pending", "approved", "rejected", "completed"] as const;
|
||||||
|
|
||||||
export const STATUS_VALUES = [
|
export const STATUS_VALUES = [
|
||||||
"pending",
|
"pending",
|
||||||
"approved",
|
"approved",
|
||||||
"rejected",
|
"rejected",
|
||||||
"completed",
|
"completed",
|
||||||
"satisfied",
|
// "satisfied",
|
||||||
"processing",
|
// "processing",
|
||||||
"cancelled",
|
// "cancelled",
|
||||||
"registered",
|
// "registered",
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export type StatusValue = (typeof STATUS_VALUES)[number];
|
export type StatusValue = (typeof STATUS_VALUES)[number];
|
||||||
@@ -20,18 +35,23 @@ export const STATUS_OPTIONS: SelectOption[] = [
|
|||||||
{ value: "approved", label: "Approved" },
|
{ value: "approved", label: "Approved" },
|
||||||
{ value: "rejected", label: "Rejected" },
|
{ value: "rejected", label: "Rejected" },
|
||||||
{ value: "completed", label: "Completed" },
|
{ value: "completed", label: "Completed" },
|
||||||
{ value: "satisfied", label: "Satisfied" },
|
|
||||||
{ value: "processing", label: "Processing" },
|
|
||||||
{ value: "cancelled", label: "Cancelled" },
|
|
||||||
{ value: "registered", label: "Registered" },
|
|
||||||
];
|
];
|
||||||
|
|
||||||
type TranslateFn = TFunction | ((key: string, fallback?: string) => string);
|
type TranslateFn = TFunction | ((key: string, fallback?: string) => string);
|
||||||
|
|
||||||
export function getStatusOptions(t?: TranslateFn, prefix = "status"): SelectOption[] {
|
export function getStatusOptions(
|
||||||
if (!t) return STATUS_OPTIONS;
|
t?: TranslateFn,
|
||||||
|
prefix = "status",
|
||||||
|
values: readonly StatusValue[] = DEFAULT_STATUS_VALUES,
|
||||||
|
): SelectOption[] {
|
||||||
|
if (!t) {
|
||||||
|
return values.map((val) => ({
|
||||||
|
value: val,
|
||||||
|
label: STATUS_LABEL_FALLBACKS[val] ?? val,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
return STATUS_VALUES.map((val) => ({
|
return values.map((val) => ({
|
||||||
value: val,
|
value: val,
|
||||||
label: t(`${prefix}.${val}`, STATUS_LABEL_FALLBACKS[val] ?? val),
|
label: t(`${prefix}.${val}`, STATUS_LABEL_FALLBACKS[val] ?? val),
|
||||||
}));
|
}));
|
||||||
@@ -42,10 +62,10 @@ export const STATUS_BADGE_VARIANTS: Record<StatusValue, StatusBadgeVariant> = {
|
|||||||
approved: "success",
|
approved: "success",
|
||||||
rejected: "error",
|
rejected: "error",
|
||||||
completed: "info",
|
completed: "info",
|
||||||
satisfied: "success",
|
// satisfied: "success",
|
||||||
processing: "info",
|
// processing: "info",
|
||||||
cancelled: "error",
|
// cancelled: "error",
|
||||||
registered: "default",
|
// registered: "default",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const STATUS_LABEL_FALLBACKS: Record<StatusValue, string> = {
|
export const STATUS_LABEL_FALLBACKS: Record<StatusValue, string> = {
|
||||||
@@ -53,10 +73,10 @@ export const STATUS_LABEL_FALLBACKS: Record<StatusValue, string> = {
|
|||||||
approved: "Approved",
|
approved: "Approved",
|
||||||
rejected: "Rejected",
|
rejected: "Rejected",
|
||||||
completed: "Completed",
|
completed: "Completed",
|
||||||
satisfied: "Satisfied",
|
// satisfied: "Satisfied",
|
||||||
processing: "Processing",
|
// processing: "Processing",
|
||||||
cancelled: "Cancelled",
|
// cancelled: "Cancelled",
|
||||||
registered: "Registered",
|
// registered: "Registered",
|
||||||
};
|
};
|
||||||
|
|
||||||
export function isStatusValue(value: string): value is StatusValue {
|
export function isStatusValue(value: string): value is StatusValue {
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ export interface CardListParams {
|
|||||||
page?: number;
|
page?: number;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
search?: string;
|
search?: string;
|
||||||
|
user_id?: number;
|
||||||
|
type?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── API functions ────────────────────────────────────────────────────────────
|
// ─── API functions ────────────────────────────────────────────────────────────
|
||||||
@@ -53,9 +55,9 @@ export interface CardListParams {
|
|||||||
export const cardTransactionsApi = {
|
export const cardTransactionsApi = {
|
||||||
/** GET /cards */
|
/** GET /cards */
|
||||||
getAll: async (params: CardListParams = {}, signal?: AbortSignal): Promise<CardListResponse> => {
|
getAll: async (params: CardListParams = {}, signal?: AbortSignal): Promise<CardListResponse> => {
|
||||||
const { page, limit, search } = params;
|
const { page, limit, search, user_id, type } = params;
|
||||||
const { data } = await apiClient.get<CardListResponse>("/cards", {
|
const { data } = await apiClient.get<CardListResponse>("/cards", {
|
||||||
params: { page, limit, search },
|
params: { page, limit, search, user_id, type },
|
||||||
signal,
|
signal,
|
||||||
});
|
});
|
||||||
return data;
|
return data;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { useDebouncedValue, normalizeSearch } from "@/hooks/useDebouncedSearch";
|
||||||
import {
|
import {
|
||||||
currencyRatesApi,
|
currencyRatesApi,
|
||||||
type CurrencyRateListParams,
|
type CurrencyRateListParams,
|
||||||
@@ -21,9 +22,13 @@ export const currencyRateKeys = {
|
|||||||
// ─── List ─────────────────────────────────────────────────────────────────────
|
// ─── List ─────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
export function useGetCurrencyRates(params: CurrencyRateListParams = {}) {
|
export function useGetCurrencyRates(params: CurrencyRateListParams = {}) {
|
||||||
|
const debouncedSearch = useDebouncedValue(params.search ?? "");
|
||||||
|
const normalized = normalizeSearch(debouncedSearch);
|
||||||
|
const queryParams: CurrencyRateListParams = { ...params, search: normalized || undefined };
|
||||||
|
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: currencyRateKeys.list(params),
|
queryKey: currencyRateKeys.list(queryParams),
|
||||||
queryFn: ({ signal }) => currencyRatesApi.getList(params, signal),
|
queryFn: ({ signal }) => currencyRatesApi.getList(queryParams, signal),
|
||||||
placeholderData: (prev) => prev,
|
placeholderData: (prev) => prev,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ export async function fetchLoanPaidOffLetters(
|
|||||||
params: {
|
params: {
|
||||||
page,
|
page,
|
||||||
limit,
|
limit,
|
||||||
customer_name: search || undefined,
|
name: search || undefined,
|
||||||
passport_id: passport_id || undefined,
|
passport_id: passport_id || undefined,
|
||||||
status: status || undefined,
|
status: status || undefined,
|
||||||
branch_id: branch_id || undefined,
|
branch_id: branch_id || undefined,
|
||||||
|
|||||||
@@ -1,69 +1,74 @@
|
|||||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
|
||||||
import { toast } from 'sonner'
|
import { toast } from "sonner";
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { useDebouncedValue, normalizeSearch } from "@/hooks/useDebouncedSearch";
|
||||||
import {
|
import {
|
||||||
intlPaymentApi,
|
intlPaymentApi,
|
||||||
type IntlPaymentListParams,
|
type IntlPaymentListParams,
|
||||||
type IntlPaymentCreatePayload,
|
type IntlPaymentCreatePayload,
|
||||||
type IntlPaymentUpdatePayload,
|
type IntlPaymentUpdatePayload,
|
||||||
} from '../api/visaMasterPaymentsApi'
|
} from "../api/visaMasterPaymentsApi";
|
||||||
|
|
||||||
export const INTL_PAYMENT_KEYS = {
|
export const INTL_PAYMENT_KEYS = {
|
||||||
all: ['intl-payments-visa'] as const,
|
all: ["intl-payments-visa"] as const,
|
||||||
lists: () => [...INTL_PAYMENT_KEYS.all, 'list'] as const,
|
lists: () => [...INTL_PAYMENT_KEYS.all, "list"] as const,
|
||||||
list: (p: IntlPaymentListParams) => [...INTL_PAYMENT_KEYS.lists(), p] as const,
|
list: (p: IntlPaymentListParams) => [...INTL_PAYMENT_KEYS.lists(), p] as const,
|
||||||
detail: (id: string) => [...INTL_PAYMENT_KEYS.all, 'detail', id] as const,
|
detail: (id: string) => [...INTL_PAYMENT_KEYS.all, "detail", id] as const,
|
||||||
}
|
};
|
||||||
|
|
||||||
export function useIntlPayments(params: IntlPaymentListParams) {
|
export function useIntlPayments(params: IntlPaymentListParams) {
|
||||||
|
const debouncedSearch = useDebouncedValue(params.search ?? "");
|
||||||
|
const normalized = normalizeSearch(debouncedSearch);
|
||||||
|
const queryParams: IntlPaymentListParams = { ...params, search: normalized || undefined };
|
||||||
|
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: INTL_PAYMENT_KEYS.list(params),
|
queryKey: INTL_PAYMENT_KEYS.list(queryParams),
|
||||||
queryFn: () => intlPaymentApi.list(params),
|
queryFn: () => intlPaymentApi.list(queryParams),
|
||||||
placeholderData: (prev) => prev,
|
placeholderData: (prev) => prev,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useIntlPayment(id: string) {
|
export function useIntlPayment(id: string) {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: INTL_PAYMENT_KEYS.detail(id),
|
queryKey: INTL_PAYMENT_KEYS.detail(id),
|
||||||
queryFn: () => intlPaymentApi.getById(id),
|
queryFn: () => intlPaymentApi.getById(id),
|
||||||
enabled: !!id,
|
enabled: !!id,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useCreateIntlPayment() {
|
export function useCreateIntlPayment() {
|
||||||
const qc = useQueryClient()
|
const qc = useQueryClient();
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation();
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: (payload: IntlPaymentCreatePayload) => intlPaymentApi.create(payload),
|
mutationFn: (payload: IntlPaymentCreatePayload) => intlPaymentApi.create(payload),
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
qc.invalidateQueries({ queryKey: INTL_PAYMENT_KEYS.lists() })
|
qc.invalidateQueries({ queryKey: INTL_PAYMENT_KEYS.lists() });
|
||||||
toast.success(t('intlPayment.createSuccess', 'Töleg döredildi'))
|
toast.success(t("intlPayment.createSuccess", "Töleg döredildi"));
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useUpdateIntlPayment(id: string) {
|
export function useUpdateIntlPayment(id: string) {
|
||||||
const qc = useQueryClient()
|
const qc = useQueryClient();
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation();
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: (payload: IntlPaymentUpdatePayload) => intlPaymentApi.update(id, payload),
|
mutationFn: (payload: IntlPaymentUpdatePayload) => intlPaymentApi.update(id, payload),
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
qc.invalidateQueries({ queryKey: INTL_PAYMENT_KEYS.lists() })
|
qc.invalidateQueries({ queryKey: INTL_PAYMENT_KEYS.lists() });
|
||||||
qc.invalidateQueries({ queryKey: INTL_PAYMENT_KEYS.detail(id) })
|
qc.invalidateQueries({ queryKey: INTL_PAYMENT_KEYS.detail(id) });
|
||||||
toast.success(t('intlPayment.updateSuccess', 'Töleg üýtgedildi'))
|
toast.success(t("intlPayment.updateSuccess", "Töleg üýtgedildi"));
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useDeleteIntlPayment() {
|
export function useDeleteIntlPayment() {
|
||||||
const qc = useQueryClient()
|
const qc = useQueryClient();
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation();
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: (id: string) => intlPaymentApi.delete(id),
|
mutationFn: (id: string) => intlPaymentApi.delete(id),
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
qc.invalidateQueries({ queryKey: INTL_PAYMENT_KEYS.lists() })
|
qc.invalidateQueries({ queryKey: INTL_PAYMENT_KEYS.lists() });
|
||||||
toast.success(t('intlPayment.deleteSuccess', 'Töleg pozuldy'))
|
toast.success(t("intlPayment.deleteSuccess", "Töleg pozuldy"));
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,7 @@ function NavSubGroup({ subItem, pathname }: { subItem: NavSubItem; pathname: str
|
|||||||
<CollapsibleTrigger asChild>
|
<CollapsibleTrigger asChild>
|
||||||
<button
|
<button
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex w-full items-center justify-between px-2 py-1 mt-1",
|
"flex w-full items-center justify-between px-2 py-1 mt-1 cursor-pointer",
|
||||||
"text-[10px] font-semibold uppercase tracking-widest select-none",
|
"text-[10px] font-semibold uppercase tracking-widest select-none",
|
||||||
"text-sidebar-foreground/40 hover:text-sidebar-foreground/60 transition-colors duration-150 rounded-sm",
|
"text-sidebar-foreground/40 hover:text-sidebar-foreground/60 transition-colors duration-150 rounded-sm",
|
||||||
)}
|
)}
|
||||||
@@ -158,7 +158,7 @@ function NavGroupItem({ item }: { item: NavItem }) {
|
|||||||
isActive={active}
|
isActive={active}
|
||||||
tooltip={item.title}
|
tooltip={item.title}
|
||||||
className={cn(
|
className={cn(
|
||||||
"group/btn rounded-md font-medium",
|
"group/btn rounded-md font-medium cursor-pointer",
|
||||||
"text-sidebar-foreground/70 hover:text-sidebar-foreground hover:bg-sidebar-accent/70",
|
"text-sidebar-foreground/70 hover:text-sidebar-foreground hover:bg-sidebar-accent/70",
|
||||||
"data-[active=true]:text-sidebar-foreground data-[active=true]:bg-sidebar-accent",
|
"data-[active=true]:text-sidebar-foreground data-[active=true]:bg-sidebar-accent",
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ export default function CardBalancesPage() {
|
|||||||
return {
|
return {
|
||||||
page,
|
page,
|
||||||
limit: perPage,
|
limit: perPage,
|
||||||
search: search || undefined,
|
passport_number: search || undefined,
|
||||||
status: filterMap.status || undefined,
|
status: filterMap.status || undefined,
|
||||||
created_by: filterMap.created_by ? Number(filterMap.created_by) : undefined,
|
created_by: filterMap.created_by ? Number(filterMap.created_by) : undefined,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
import type { ColumnDef, VisibilityState } from "@tanstack/react-table";
|
import type { ColumnDef, VisibilityState } from "@tanstack/react-table";
|
||||||
import { DataTable } from "@/components/dataTable";
|
import { DataTable } from "@/components/dataTable";
|
||||||
import { DataTableToolbar, type ColumnMeta, type ActiveFilter, type FilterField } from "@/components/dataTableToolbar";
|
import { DataTableToolbar, type ColumnMeta, type ActiveFilter, type FilterField } from "@/components/dataTableToolbar";
|
||||||
import { TableSearchInput } from "@/components/tableSearch";
|
// import { TableSearchInput } from "@/components/tableSearch";
|
||||||
import { CreateButton } from "@/components/createButton";
|
import { CreateButton } from "@/components/createButton";
|
||||||
import { TableActions } from "@/components/tableActions";
|
import { TableActions } from "@/components/tableActions";
|
||||||
import { DeleteDialog } from "@/components/deleteDialog";
|
import { DeleteDialog } from "@/components/deleteDialog";
|
||||||
@@ -214,15 +214,15 @@ export default function CardPinsPage() {
|
|||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<h1 className="text-xl font-semibold text-foreground">{t("Card pins", "Kart pin bukjalary")}</h1>
|
<h1 className="text-xl font-semibold text-foreground">{t("Card pins", "Kart pin bukjalary")}</h1>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-3 justify-between">
|
<div className="flex items-center gap-3 justify-end">
|
||||||
<TableSearchInput
|
{/* <TableSearchInput
|
||||||
value={search}
|
value={search}
|
||||||
onChange={(v) => {
|
onChange={(v) => {
|
||||||
setSearch(v);
|
setSearch(v);
|
||||||
setPage(1);
|
setPage(1);
|
||||||
}}
|
}}
|
||||||
placeholder={t("common.search", "Gözlemek")}
|
placeholder={t("common.search", "Gözlemek")}
|
||||||
/>
|
/> */}
|
||||||
<CreateButton label={t("cardPin.createBtn", "Kart pin bukja dörediň")} onClick={() => navigate("/card-pins/create")} />
|
<CreateButton label={t("cardPin.createBtn", "Kart pin bukja dörediň")} onClick={() => navigate("/card-pins/create")} />
|
||||||
</div>
|
</div>
|
||||||
<div className="bg-card border border-border rounded-xl p-4">
|
<div className="bg-card border border-border rounded-xl p-4">
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import type { ColumnDef, VisibilityState } from "@tanstack/react-table";
|
|||||||
|
|
||||||
import { DataTable } from "@/components/dataTable";
|
import { DataTable } from "@/components/dataTable";
|
||||||
import { DataTableToolbar, type ActiveFilter, type FilterField } from "@/components/dataTableToolbar";
|
import { DataTableToolbar, type ActiveFilter, type FilterField } from "@/components/dataTableToolbar";
|
||||||
import { TableSearchInput } from "@/components/tableSearch";
|
// import { TableSearchInput } from "@/components/tableSearch";
|
||||||
import { CreateButton } from "@/components/createButton";
|
import { CreateButton } from "@/components/createButton";
|
||||||
import { TableActions } from "@/components/tableActions";
|
import { TableActions } from "@/components/tableActions";
|
||||||
|
|
||||||
@@ -336,15 +336,15 @@ export default function CardRequisitesPage() {
|
|||||||
<h1 className="text-xl font-semibold text-foreground">{t("cardRequisites.title", "Kart rekwizitler")}</h1>
|
<h1 className="text-xl font-semibold text-foreground">{t("cardRequisites.title", "Kart rekwizitler")}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center gap-3 justify-between">
|
<div className="flex items-center gap-3 justify-end">
|
||||||
<TableSearchInput
|
{/* <TableSearchInput
|
||||||
value={search}
|
value={search}
|
||||||
onChange={(v) => {
|
onChange={(v) => {
|
||||||
setSearch(v);
|
setSearch(v);
|
||||||
setPage(1);
|
setPage(1);
|
||||||
}}
|
}}
|
||||||
placeholder={t("cardRequisites.searchPlaceholder", "Gözlemek")}
|
placeholder={t("cardRequisites.searchPlaceholder", "Gözlemek")}
|
||||||
/>
|
/> */}
|
||||||
<CreateButton
|
<CreateButton
|
||||||
label={t("cardRequisites.createTitle", "Kart rekwiziti üçin sargyt dörediň")}
|
label={t("cardRequisites.createTitle", "Kart rekwiziti üçin sargyt dörediň")}
|
||||||
onClick={() => navigate("/card-requisites/create")}
|
onClick={() => navigate("/card-requisites/create")}
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
import { useState } from "react";
|
import { useState, useMemo, useCallback } from "react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { DeleteDialog } from "@/components/deleteDialog";
|
import { DeleteDialog } from "@/components/deleteDialog";
|
||||||
import { DataTable, type ColumnDef } from "@/components/dataTable";
|
import { DataTable, type ColumnDef } from "@/components/dataTable";
|
||||||
import { DataTableToolbar, type ColumnMeta } from "@/components/dataTableToolbar";
|
import { DataTableToolbar, type ColumnMeta, type ActiveFilter, type FilterField } from "@/components/dataTableToolbar";
|
||||||
import { TableSearchInput } from "@/components/tableSearch";
|
|
||||||
import { CreateButton } from "@/components/createButton";
|
import { CreateButton } from "@/components/createButton";
|
||||||
import { TableActions } from "@/components/tableActions";
|
import { TableActions } from "@/components/tableActions";
|
||||||
import type { VisibilityState } from "@tanstack/react-table";
|
import type { VisibilityState } from "@tanstack/react-table";
|
||||||
import { useCardTransactions, useDeleteCardTransaction } from "@/features/cardTransactions/hooks/useCardTransactions";
|
import { useCardTransactions, useDeleteCardTransaction } from "@/features/cardTransactions/hooks/useCardTransactions";
|
||||||
import type { Card } from "@/features/cardTransactions/api/cardTransactionsApi";
|
import type { Card } from "@/features/cardTransactions/api/cardTransactionsApi";
|
||||||
|
import { useInfiniteClients } from "@/features/clients/hooks/useClients";
|
||||||
|
import { useInfiniteCardTypes } from "@/features/cardTypes/hooks/useCardTypes";
|
||||||
import { formatFromApiDate } from "@/lib/utils";
|
import { formatFromApiDate } from "@/lib/utils";
|
||||||
|
|
||||||
// ─── Page ─────────────────────────────────────────────────────────────────────
|
// ─── Page ─────────────────────────────────────────────────────────────────────
|
||||||
@@ -27,9 +28,121 @@ export default function CardTransactionsPage() {
|
|||||||
const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({});
|
const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({});
|
||||||
const [columnOrder, setColumnOrder] = useState<string[]>([]);
|
const [columnOrder, setColumnOrder] = useState<string[]>([]);
|
||||||
|
|
||||||
const { data, isLoading } = useCardTransactions({ page, limit: perPage, search });
|
const [activeFilters, setActiveFilters] = useState<ActiveFilter[]>([
|
||||||
|
{ fieldId: "user_id", value: "" },
|
||||||
|
{ fieldId: "type", value: "" },
|
||||||
|
]);
|
||||||
|
|
||||||
|
// ── Filter option sources ───────────────────────────────────────────────────
|
||||||
|
const [userSearch, setUserSearch] = useState("");
|
||||||
|
const {
|
||||||
|
data: usersData,
|
||||||
|
fetchNextPage: fetchNextUsers,
|
||||||
|
hasNextPage: hasNextUsers,
|
||||||
|
isFetchingNextPage: isFetchingNextUsers,
|
||||||
|
isLoading: isUsersLoading,
|
||||||
|
} = useInfiniteClients(userSearch);
|
||||||
|
|
||||||
|
const userOptions = useMemo(
|
||||||
|
() =>
|
||||||
|
(usersData?.pages ?? []).flatMap((page) =>
|
||||||
|
(page?.users ?? []).map((u) => ({
|
||||||
|
value: String(u.id),
|
||||||
|
label: u.name || u.username || String(u.id),
|
||||||
|
})),
|
||||||
|
),
|
||||||
|
[usersData],
|
||||||
|
);
|
||||||
|
|
||||||
|
const [typeSearch, setTypeSearch] = useState("");
|
||||||
|
const {
|
||||||
|
data: cardTypesData,
|
||||||
|
fetchNextPage: fetchNextCardTypes,
|
||||||
|
hasNextPage: hasNextCardTypes,
|
||||||
|
isFetchingNextPage: isFetchingNextCardTypes,
|
||||||
|
isLoading: isCardTypesLoading,
|
||||||
|
} = useInfiniteCardTypes(typeSearch);
|
||||||
|
|
||||||
|
const cardTypeOptions = useMemo(() => {
|
||||||
|
const langKey = i18n.language as "tm" | "ru" | "en";
|
||||||
|
return (cardTypesData?.pages ?? []).flatMap((p) =>
|
||||||
|
(p?.paymentCards ?? []).map((c) => ({
|
||||||
|
value: String(c.id),
|
||||||
|
label: c.title?.[langKey] || c.title?.tm || c.title?.en || String(c.id),
|
||||||
|
})),
|
||||||
|
);
|
||||||
|
}, [cardTypesData, i18n.language]);
|
||||||
|
|
||||||
|
// ── Query ──────────────────────────────────────────────────────────────────
|
||||||
|
const queryParams = useMemo(() => {
|
||||||
|
const filterMap = Object.fromEntries(activeFilters.map((f) => [f.fieldId, f.value]));
|
||||||
|
return {
|
||||||
|
search: search || undefined,
|
||||||
|
user_id: filterMap.user_id ? Number(filterMap.user_id) : undefined,
|
||||||
|
type: filterMap.type ? Number(filterMap.type) : undefined,
|
||||||
|
page,
|
||||||
|
limit: perPage,
|
||||||
|
};
|
||||||
|
}, [search, activeFilters, page, perPage]);
|
||||||
|
|
||||||
|
const { data, isLoading } = useCardTransactions(queryParams);
|
||||||
const deleteMutation = useDeleteCardTransaction();
|
const deleteMutation = useDeleteCardTransaction();
|
||||||
|
|
||||||
|
const handleFilterChange = useCallback((fieldId: string, value: string) => {
|
||||||
|
setActiveFilters((prev) => prev.map((f) => (f.fieldId === fieldId ? { ...f, value } : f)));
|
||||||
|
setPage(1);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleFilterReset = useCallback(() => {
|
||||||
|
setActiveFilters((prev) => prev.map((f) => ({ ...f, value: "" })));
|
||||||
|
setPage(1);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// ── Filter fields ───────────────────────────────────────────────────────────
|
||||||
|
const filterFields = useMemo<FilterField[]>(
|
||||||
|
() => [
|
||||||
|
{
|
||||||
|
id: "user_id",
|
||||||
|
label: t("User", "ULANYJY"),
|
||||||
|
type: "infinite-select",
|
||||||
|
options: userOptions,
|
||||||
|
loading: isUsersLoading,
|
||||||
|
isLoadingMore: isFetchingNextUsers,
|
||||||
|
hasNextPage: hasNextUsers,
|
||||||
|
onLoadMore: fetchNextUsers,
|
||||||
|
searchValue: userSearch,
|
||||||
|
onSearchChange: setUserSearch,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "type",
|
||||||
|
label: t("Card type", "KART GÖRNÜŞI"),
|
||||||
|
type: "infinite-select",
|
||||||
|
options: cardTypeOptions,
|
||||||
|
loading: isCardTypesLoading,
|
||||||
|
isLoadingMore: isFetchingNextCardTypes,
|
||||||
|
hasNextPage: hasNextCardTypes,
|
||||||
|
onLoadMore: fetchNextCardTypes,
|
||||||
|
searchValue: typeSearch,
|
||||||
|
onSearchChange: setTypeSearch,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
t,
|
||||||
|
userOptions,
|
||||||
|
isUsersLoading,
|
||||||
|
isFetchingNextUsers,
|
||||||
|
hasNextUsers,
|
||||||
|
userSearch,
|
||||||
|
fetchNextUsers,
|
||||||
|
cardTypeOptions,
|
||||||
|
isCardTypesLoading,
|
||||||
|
isFetchingNextCardTypes,
|
||||||
|
hasNextCardTypes,
|
||||||
|
typeSearch,
|
||||||
|
fetchNextCardTypes,
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
// ── Columns ──────────────────────────────────────────────────────────────────
|
// ── Columns ──────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
const columns: ColumnDef<Card>[] = [
|
const columns: ColumnDef<Card>[] = [
|
||||||
@@ -152,15 +265,15 @@ export default function CardTransactionsPage() {
|
|||||||
<h1 className="text-xl font-semibold text-foreground">{t("Card transactions", "Kartlar")}</h1>
|
<h1 className="text-xl font-semibold text-foreground">{t("Card transactions", "Kartlar")}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center gap-3 justify-between">
|
<div className="flex items-center gap-3 justify-end">
|
||||||
<TableSearchInput
|
{/* <TableSearchInput
|
||||||
value={search}
|
value={search}
|
||||||
onChange={(v) => {
|
onChange={(v) => {
|
||||||
setSearch(v);
|
setSearch(v);
|
||||||
setPage(1);
|
setPage(1);
|
||||||
}}
|
}}
|
||||||
placeholder={t("common.search", "Gözlemek")}
|
placeholder={t("common.search", "Gözlemek")}
|
||||||
/>
|
/> */}
|
||||||
<CreateButton label={t("Create card", "Kart dörediň")} onClick={() => navigate("/card-transactions/create")} />
|
<CreateButton label={t("Create card", "Kart dörediň")} onClick={() => navigate("/card-transactions/create")} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -180,6 +293,10 @@ export default function CardTransactionsPage() {
|
|||||||
onColumnOrderChange={setColumnOrder}
|
onColumnOrderChange={setColumnOrder}
|
||||||
hideSearch
|
hideSearch
|
||||||
hideAction
|
hideAction
|
||||||
|
filterFields={filterFields}
|
||||||
|
activeFilters={activeFilters}
|
||||||
|
onFilterChange={handleFilterChange}
|
||||||
|
onFilterReset={handleFilterReset}
|
||||||
perPageOptions={[10, 25, 50, 100]}
|
perPageOptions={[10, 25, 50, 100]}
|
||||||
perPage={perPage}
|
perPage={perPage}
|
||||||
onPerPageChange={(v) => {
|
onPerPageChange={(v) => {
|
||||||
|
|||||||
@@ -173,7 +173,11 @@ export default function CurrencyRatesPage() {
|
|||||||
<h1 className="text-xl font-semibold text-foreground">{t("currencyRates.title", "Walýuta kurslary")}</h1>
|
<h1 className="text-xl font-semibold text-foreground">{t("currencyRates.title", "Walýuta kurslary")}</h1>
|
||||||
|
|
||||||
<div className="flex items-center gap-3 justify-between">
|
<div className="flex items-center gap-3 justify-between">
|
||||||
<TableSearchInput value={search} onChange={handleSearchChange} placeholder={t("common.search", "Gözlemek")} />
|
<TableSearchInput
|
||||||
|
value={search}
|
||||||
|
onChange={handleSearchChange}
|
||||||
|
placeholder={t("currencyRates.searchPlaceholder", "Walýuta boýunça gözle (möw. CNY → TMT)")}
|
||||||
|
/>
|
||||||
<CreateButton
|
<CreateButton
|
||||||
label={t("currencyRates.actions.create", "Walýuta kursy dörediň")}
|
label={t("currencyRates.actions.create", "Walýuta kursy dörediň")}
|
||||||
onClick={() => navigate("/currency-rates/create")}
|
onClick={() => navigate("/currency-rates/create")}
|
||||||
@@ -186,7 +190,7 @@ export default function CurrencyRatesPage() {
|
|||||||
hideAction
|
hideAction
|
||||||
searchValue={search}
|
searchValue={search}
|
||||||
onSearchChange={handleSearchChange}
|
onSearchChange={handleSearchChange}
|
||||||
searchPlaceholder={t("common.search", "Gözlemek")}
|
searchPlaceholder={t("currencyRates.searchPlaceholder", "Walýuta boýunça gözle (möw. CNY → TMT)")}
|
||||||
columns={toggleableColumns}
|
columns={toggleableColumns}
|
||||||
columnVisibility={columnVisibility}
|
columnVisibility={columnVisibility}
|
||||||
onColumnVisibilityChange={setColumnVisibility}
|
onColumnVisibilityChange={setColumnVisibility}
|
||||||
|
|||||||
@@ -379,12 +379,12 @@ export default function DashboardPage({ isLoading: propLoading = false }: { isLo
|
|||||||
|
|
||||||
<div className="flex items-center gap-2 self-start sm:self-auto">
|
<div className="flex items-center gap-2 self-start sm:self-auto">
|
||||||
<Select value={String(selectedYear)} onValueChange={(val) => setSelectedYear(Number(val))}>
|
<Select value={String(selectedYear)} onValueChange={(val) => setSelectedYear(Number(val))}>
|
||||||
<SelectTrigger className="w-[120px] h-9">
|
<SelectTrigger className="w-[120px] h-9 cursor-pointer">
|
||||||
<SelectValue placeholder={String(selectedYear)} />
|
<SelectValue placeholder={String(selectedYear)} />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{yearOptions.map((y) => (
|
{yearOptions.map((y) => (
|
||||||
<SelectItem key={y} value={String(y)}>
|
<SelectItem key={y} value={String(y)} className="cursor-pointer">
|
||||||
{y} {t("common.year", "ýyl")}
|
{y} {t("common.year", "ýyl")}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
@@ -397,7 +397,7 @@ export default function DashboardPage({ isLoading: propLoading = false }: { isLo
|
|||||||
onClick={() => refetch()}
|
onClick={() => refetch()}
|
||||||
disabled={isFetching}
|
disabled={isFetching}
|
||||||
title={t("common.refresh", "Täzele")}
|
title={t("common.refresh", "Täzele")}
|
||||||
className="h-9 w-9"
|
className="h-9 w-9 cursor-pointer"
|
||||||
>
|
>
|
||||||
<RefreshCw className={cn("h-4 w-4", isFetching && "animate-spin")} />
|
<RefreshCw className={cn("h-4 w-4", isFetching && "animate-spin")} />
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { TableSearchInput } from "@/components/tableSearch";
|
|||||||
import { CreateButton } from "@/components/createButton";
|
import { CreateButton } from "@/components/createButton";
|
||||||
import { TableActions } from "@/components/tableActions";
|
import { TableActions } from "@/components/tableActions";
|
||||||
import { DeleteDialog } from "@/components/deleteDialog";
|
import { DeleteDialog } from "@/components/deleteDialog";
|
||||||
import { MonthSelect } from "@/components/monthSelect";
|
// import { MonthSelect } from "@/components/monthSelect";
|
||||||
import { InfiniteSelect } from "@/components/infiniteSelect";
|
import { InfiniteSelect } from "@/components/infiniteSelect";
|
||||||
import { REGION_CODES, REGION_LABELS, StatusCell } from "@/constants";
|
import { REGION_CODES, REGION_LABELS, StatusCell } from "@/constants";
|
||||||
import { useIntlPayments, useDeleteIntlPayment } from "@/features/visaMasterPayments/hooks/useVisaMasterPayments";
|
import { useIntlPayments, useDeleteIntlPayment } from "@/features/visaMasterPayments/hooks/useVisaMasterPayments";
|
||||||
@@ -36,7 +36,7 @@ export default function IntlPaymentsPage() {
|
|||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
const [perPage, setPerPage] = useState(25);
|
const [perPage, setPerPage] = useState(25);
|
||||||
const [search, setSearch] = useState("");
|
const [search, setSearch] = useState("");
|
||||||
const [month, setMonth] = useState("");
|
const [month] = useState("");
|
||||||
const [statusFilter, setStatusFilter] = useState<IntlPaymentStatus | "">("");
|
const [statusFilter, setStatusFilter] = useState<IntlPaymentStatus | "">("");
|
||||||
const [regionFilter, setRegionFilter] = useState("");
|
const [regionFilter, setRegionFilter] = useState("");
|
||||||
const [branchFilter, setBranchFilter] = useState("");
|
const [branchFilter, setBranchFilter] = useState("");
|
||||||
@@ -263,13 +263,13 @@ export default function IntlPaymentsPage() {
|
|||||||
placeholder={t("intlPayment.client", "Ulanyjy")}
|
placeholder={t("intlPayment.client", "Ulanyjy")}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<MonthSelect
|
{/* <MonthSelect
|
||||||
value={month}
|
value={month}
|
||||||
onChange={(v) => {
|
onChange={(v) => {
|
||||||
setMonth(v);
|
setMonth(v);
|
||||||
setPage(1);
|
setPage(1);
|
||||||
}}
|
}}
|
||||||
/>
|
/> */}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import type { ColumnDef, VisibilityState } from "@tanstack/react-table";
|
|||||||
|
|
||||||
import { DataTable } from "@/components/dataTable";
|
import { DataTable } from "@/components/dataTable";
|
||||||
import { DataTableToolbar, type ActiveFilter, type FilterField } from "@/components/dataTableToolbar";
|
import { DataTableToolbar, type ActiveFilter, type FilterField } from "@/components/dataTableToolbar";
|
||||||
import { TableSearchInput } from "@/components/tableSearch";
|
// import { TableSearchInput } from "@/components/tableSearch";
|
||||||
import { CreateButton } from "@/components/createButton";
|
import { CreateButton } from "@/components/createButton";
|
||||||
import { TableActions } from "@/components/tableActions";
|
import { TableActions } from "@/components/tableActions";
|
||||||
import { useLoanOrderMobiles, useDeleteLoanOrderMobile } from "@/features/loanOrderMobiles/hooks/useLoanOrderMobiles";
|
import { useLoanOrderMobiles, useDeleteLoanOrderMobile } from "@/features/loanOrderMobiles/hooks/useLoanOrderMobiles";
|
||||||
@@ -227,15 +227,15 @@ export default function LoanOrderMobilesPage() {
|
|||||||
<h1 className="text-xl font-semibold text-foreground">{t("loanOrderMobiles.title", "Karz sargytlary (Mobile)")}</h1>
|
<h1 className="text-xl font-semibold text-foreground">{t("loanOrderMobiles.title", "Karz sargytlary (Mobile)")}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center gap-3 justify-between">
|
<div className="flex items-center gap-3 justify-end">
|
||||||
<TableSearchInput
|
{/* <TableSearchInput
|
||||||
value={search}
|
value={search}
|
||||||
onChange={(v) => {
|
onChange={(v) => {
|
||||||
setSearch(v);
|
setSearch(v);
|
||||||
setPage(1);
|
setPage(1);
|
||||||
}}
|
}}
|
||||||
placeholder={t("loanOrderMobiles.searchPlaceholder", "Gözlemek")}
|
placeholder={t("loanOrderMobiles.searchPlaceholder", "Gözlemek")}
|
||||||
/>
|
/> */}
|
||||||
<CreateButton
|
<CreateButton
|
||||||
label={t("loanOrderMobiles.createButton", "Karz sargyt dörediñ")}
|
label={t("loanOrderMobiles.createButton", "Karz sargyt dörediñ")}
|
||||||
onClick={() => navigate("/loan-order-mobiles/create")}
|
onClick={() => navigate("/loan-order-mobiles/create")}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import type { ColumnDef, VisibilityState } from "@tanstack/react-table";
|
|||||||
|
|
||||||
import { DataTable } from "@/components/dataTable";
|
import { DataTable } from "@/components/dataTable";
|
||||||
import { DataTableToolbar, type ActiveFilter, type FilterField } from "@/components/dataTableToolbar";
|
import { DataTableToolbar, type ActiveFilter, type FilterField } from "@/components/dataTableToolbar";
|
||||||
import { TableSearchInput } from "@/components/tableSearch";
|
|
||||||
import { CreateButton } from "@/components/createButton";
|
import { CreateButton } from "@/components/createButton";
|
||||||
import { TableActions } from "@/components/tableActions";
|
import { TableActions } from "@/components/tableActions";
|
||||||
import { useLoanOrders, useDeleteLoanOrder } from "@/features/loanOrders/hooks/useLoanOrders";
|
import { useLoanOrders, useDeleteLoanOrder } from "@/features/loanOrders/hooks/useLoanOrders";
|
||||||
@@ -49,7 +48,6 @@ export default function LoanOrdersPage() {
|
|||||||
[branchesInfiniteData, lang],
|
[branchesInfiniteData, lang],
|
||||||
);
|
);
|
||||||
|
|
||||||
const [search, setSearch] = useState("");
|
|
||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
const [perPage, setPerPage] = useState(25);
|
const [perPage, setPerPage] = useState(25);
|
||||||
const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({});
|
const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({});
|
||||||
@@ -63,14 +61,13 @@ export default function LoanOrdersPage() {
|
|||||||
const queryParams = useMemo(() => {
|
const queryParams = useMemo(() => {
|
||||||
const filterMap = Object.fromEntries(activeFilters.map((f) => [f.fieldId, f.value]));
|
const filterMap = Object.fromEntries(activeFilters.map((f) => [f.fieldId, f.value]));
|
||||||
return {
|
return {
|
||||||
search: search || undefined,
|
|
||||||
region: filterMap.region || undefined,
|
region: filterMap.region || undefined,
|
||||||
status: (filterMap.status as LoanOrderStatus) || undefined,
|
status: (filterMap.status as LoanOrderStatus) || undefined,
|
||||||
branch: filterMap.branch || undefined,
|
branch: filterMap.branch || undefined,
|
||||||
page,
|
page,
|
||||||
perPage,
|
perPage,
|
||||||
};
|
};
|
||||||
}, [search, activeFilters, page, perPage]);
|
}, [activeFilters, page, perPage]);
|
||||||
|
|
||||||
const { data, isLoading } = useLoanOrders(queryParams);
|
const { data, isLoading } = useLoanOrders(queryParams);
|
||||||
const totalPages = data ? Math.ceil(data.total / perPage) : 1;
|
const totalPages = data ? Math.ceil(data.total / perPage) : 1;
|
||||||
@@ -216,16 +213,7 @@ export default function LoanOrdersPage() {
|
|||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<h1 className="text-xl font-semibold text-foreground">{t("loanOrders.title", "Karz sargytlary")}</h1>
|
<h1 className="text-xl font-semibold text-foreground">{t("loanOrders.title", "Karz sargytlary")}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="flex items-center gap-3 justify-end">
|
||||||
<div className="flex items-center gap-3 justify-between">
|
|
||||||
<TableSearchInput
|
|
||||||
value={search}
|
|
||||||
onChange={(v) => {
|
|
||||||
setSearch(v);
|
|
||||||
setPage(1);
|
|
||||||
}}
|
|
||||||
placeholder={t("loanOrderMobiles.searchPlaceholder", "Gözlemek")}
|
|
||||||
/>
|
|
||||||
<CreateButton label={t("loanOrderMobiles.createButton", "Karz sargyt dörediñ")} onClick={() => navigate("/loan-orders/create")} />
|
<CreateButton label={t("loanOrderMobiles.createButton", "Karz sargyt dörediñ")} onClick={() => navigate("/loan-orders/create")} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -233,12 +221,8 @@ export default function LoanOrdersPage() {
|
|||||||
<DataTableToolbar
|
<DataTableToolbar
|
||||||
hideSearch
|
hideSearch
|
||||||
hideAction
|
hideAction
|
||||||
searchValue={search}
|
searchValue=""
|
||||||
onSearchChange={(v) => {
|
onSearchChange={() => {}}
|
||||||
setSearch(v);
|
|
||||||
setPage(1);
|
|
||||||
}}
|
|
||||||
searchPlaceholder={t("loanOrderMobiles.searchPlaceholder", "Gözlemek")}
|
|
||||||
columns={toggleableColumns}
|
columns={toggleableColumns}
|
||||||
columnVisibility={columnVisibility}
|
columnVisibility={columnVisibility}
|
||||||
onColumnVisibilityChange={setColumnVisibility}
|
onColumnVisibilityChange={setColumnVisibility}
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ export default function LoanRemainingPage() {
|
|||||||
setSearch(v);
|
setSearch(v);
|
||||||
setPage(1);
|
setPage(1);
|
||||||
}}
|
}}
|
||||||
placeholder={t("common.search", "Gözlemek")}
|
placeholder={t("loanRemaining.searchPlaceholder", "Passport series")}
|
||||||
/>
|
/>
|
||||||
<CreateButton
|
<CreateButton
|
||||||
label={t("loanRemaining.createButton", "Karzyň galyndysy dörediň")}
|
label={t("loanRemaining.createButton", "Karzyň galyndysy dörediň")}
|
||||||
|
|||||||
Reference in new issue
Block a user