refactored some code

This commit is contained in:
Jelaletdin12 committed 2026-06-04 11:42:19 +05:00
1 parent caae941346
commit b83f350c6b
33 files changed
+1031 -1402

No files matched your search

@@ -1,6 +1,6 @@
import { useState, useMemo, useCallback } from "react";
import { useTranslation } from "react-i18next";
import { Eye, Pencil, Trash2, AlertCircle, CheckCircle2, XCircle, Loader2 } from "lucide-react";
import { AlertCircle, CheckCircle2, XCircle, Loader2 } from "lucide-react";
import { useNavigate } from "react-router-dom";
import type { ColumnDef, VisibilityState } from "@tanstack/react-table";
import { StatusBadge, type StatusBadgeVariant } from "@/components/ui/statusBadge";
@@ -8,6 +8,7 @@ import { DataTable } from "@/components/dataTable";
import { DataTableToolbar, type ActiveFilter, type FilterField } from "@/components/dataTableToolbar";
import { TableSearchInput } from "@/components/tableSearch";
import { CreateButton } from "@/components/createButton";
import { TableActions } from "@/components/tableActions";
import { useLoanOrderMobiles, useDeleteLoanOrderMobile } from "@/features/loanOrderMobiles/hooks/useLoanOrderMobiles";
import type { LoanOrderMobile, LoanOrderMobileStatus } from "@/features/loanOrderMobiles/api/loanOrderMobilesApi";
import { DeleteDialog } from "@/components/deleteDialog";
@@ -166,30 +167,12 @@ export default function LoanOrderMobilesPage() {
header: "",
enableHiding: false,
cell: ({ row }) => (
<div className="flex items-center gap-1.5 justify-end">
<button
onClick={() => navigate(`/loan-order-mobiles/${row.original.id}`)}
className="p-1.5 cursor-pointer rounded hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors"
title={t("common.view", "Görmek")}
>
<Eye size={15} />
</button>
<button
onClick={() => navigate(`/loan-order-mobiles/${row.original.id}/edit`)}
className="p-1.5 cursor-pointer rounded hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors"
title={t("common.edit", "Üýtgetmek")}
>
<Pencil size={15} />
</button>
<button
onClick={() => handleDelete(row.original.id)}
disabled={deleteMutation.isPending}
className="p-1.5 cursor-pointer rounded hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors disabled:opacity-50"
title={t("common.delete", "Pozmak")}
>
<Trash2 size={15} />
</button>
</div>
<TableActions
onView={() => navigate(`/loan-order-mobiles/${row.original.id}`)}
onEdit={() => navigate(`/loan-order-mobiles/${row.original.id}/edit`)}
onDelete={() => handleDelete(row.original.id)}
isDeleting={deleteMutation.isPending}
/>
),
size: 100,
},
@@ -237,7 +220,7 @@ export default function LoanOrderMobilesPage() {
<h1 className="text-xl font-semibold text-foreground">{t("loanOrderMobiles.title", "Karz sargytlary")}</h1>
</div>
<div className="flex flex-wrap items-center gap-3 justify-between">
<div className="flex items-center gap-3 justify-between">
<TableSearchInput
value={search}
onChange={(v) => {