started connect with api

This commit is contained in:
Jelaletdin12 committed 2026-08-11 22:48:25 +05:00
1 parent 0ca218505d
commit 6da59f42d9
112 files changed
+7091 -6989

No files matched your search

+60 -44
View File
@@ -10,51 +10,70 @@ import { TableSearchInput } from "@/components/tableSearch";
import { CreateButton } from "@/components/createButton";
import { TableActions } from "@/components/tableActions";
import type { FilterField, ActiveFilter } from "@/components/dataTableToolbar";
import { useBranches, useDeleteBranch } from "@/features/branches/hooks/useBranches";
import { useBranches, useDeleteBranch, useProvinceOptions } from "@/features/branches/hooks/useBranches";
import type { Branch } from "@/features/branches/api/branchesApi";
import { getDistrictOptions } from "@/features/branches/api/branchesApi";
export function BranchesListPage() {
const { t, i18n } = useTranslation();
const navigate = useNavigate();
const lang = (i18n.language?.slice(0, 2) ?? "tk") as "tk" | "ru" | "en";
const lang = ((i18n.language?.slice(0, 2) === "tk" ? "tm" : i18n.language?.slice(0, 2)) ?? "tm") as "tm" | "ru" | "en";
const [page, setPage] = useState(1);
const [perPage, setPerPage] = useState(25);
const [search, setSearch] = useState("");
const [activeFilters, setActiveFilters] = useState<ActiveFilter[]>([
{ fieldId: "isActive", value: "" },
{ fieldId: "districtId", value: "" },
{ fieldId: "provinceId", value: "" },
{ fieldId: "provinceName", value: "" },
{ fieldId: "uniqueCode", value: "" },
]);
const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({});
const [columnOrder, setColumnOrder] = useState<string[]>(["id", "code", "name", "districtName", "phone", "isActive", "actions"]);
const [columnOrder, setColumnOrder] = useState<string[]>([
"id",
"uniqueCode",
"name",
"provinceName",
"phoneNumbers",
"isActive",
"actions",
]);
const [deleteId, setDeleteId] = useState<number | null>(null);
const deleteMutation = useDeleteBranch();
const isActiveFilter = activeFilters.find((f) => f.fieldId === "isActive")?.value ?? "";
const districtIdFilter = activeFilters.find((f) => f.fieldId === "districtId")?.value ?? "";
const provinceIdFilter = activeFilters.find((f) => f.fieldId === "provinceId")?.value ?? "";
const provinceNameFilter = activeFilters.find((f) => f.fieldId === "provinceName")?.value ?? "";
const uniqueCodeFilter = activeFilters.find((f) => f.fieldId === "uniqueCode")?.value ?? "";
const { data, isLoading } = useBranches({ page, perPage, search, isActive: isActiveFilter, districtId: districtIdFilter });
const { data, isLoading } = useBranches({
page,
limit: perPage,
search,
provinceId: provinceIdFilter,
provinceName: provinceNameFilter,
uniqueCode: uniqueCodeFilter,
});
const districtOptions = getDistrictOptions().map((d) => ({
value: String(d.id),
label: d.name[lang],
const { data: provinceData } = useProvinceOptions();
const provinceOptions = (provinceData ?? []).map((p) => ({
value: String(p.id),
label: p.name[lang],
}));
const filterFields: FilterField[] = [
{
id: "isActive",
label: t("branches.fields.isActive", "Işjeň"),
options: [
{ value: "true", label: t("common.active", "Işjeň") },
{ value: "false", label: t("common.inactive", "Işjeň däl") },
],
id: "provinceId",
label: t("branches.fields.district", "Etrap"),
options: provinceOptions,
},
{
id: "districtId",
label: t("branches.fields.district", "Etrap"),
options: districtOptions,
id: "provinceName",
label: t("branches.fields.provinceName", "Sebit ady"),
type: "text",
},
{
id: "uniqueCode",
label: t("branches.fields.uniqueCode", "Unikal belgi"),
type: "text",
},
];
@@ -65,8 +84,9 @@ export function BranchesListPage() {
const handleFilterReset = () => {
setActiveFilters([
{ fieldId: "isActive", value: "" },
{ fieldId: "districtId", value: "" },
{ fieldId: "provinceId", value: "" },
{ fieldId: "provinceName", value: "" },
{ fieldId: "uniqueCode", value: "" },
]);
setPage(1);
};
@@ -79,11 +99,11 @@ export function BranchesListPage() {
size: 70,
},
{
accessorKey: "code",
id: "code",
header: t("branches.fields.code", "KOD").toUpperCase(),
cell: ({ row }) => <span className="text-sm font-mono text-foreground">{row.original.code}</span>,
size: 100,
accessorKey: "uniqueCode",
id: "uniqueCode",
header: t("branches.fields.uniqueCode", "UNIKAL BELGI").toUpperCase(),
cell: ({ row }) => <span className="text-sm font-mono text-foreground">{row.original.uniqueCode}</span>,
size: 150,
},
{
accessorKey: "name",
@@ -92,27 +112,23 @@ export function BranchesListPage() {
cell: ({ row }) => <span className="text-sm text-foreground">{row.original.name[lang]}</span>,
},
{
accessorKey: "districtName",
id: "districtName",
accessorKey: "provinceName",
id: "provinceName",
header: t("branches.fields.district", "ETRAP").toUpperCase(),
cell: ({ row }) => <span className="text-sm text-muted-foreground">{row.original.districtName[lang]}</span>,
cell: ({ row }) => <span className="text-sm text-muted-foreground">{row.original.provinceName[lang]}</span>,
},
{
accessorKey: "phone",
header: t("branches.fields.phone", "TELEFON").toUpperCase(),
cell: ({ row }) => <span className="text-sm text-foreground">{row.original.phone}</span>,
size: 150,
accessorKey: "phoneNumbers",
header: t("branches.fields.phoneNumbers", "TELEFONLAR").toUpperCase(),
cell: ({ row }) => <span className="text-sm text-foreground">{row.original.phoneNumbers}</span>,
size: 190,
},
{
accessorKey: "isActive",
accessorKey: "active",
id: "isActive",
header: t("branches.fields.isActive", "IŞJEŇ").toUpperCase(),
cell: ({ row }) =>
row.original.isActive ? (
<CheckCircle2 size={18} className="text-emerald-500" />
) : (
<XCircle size={18} className="text-destructive" />
),
row.original.active ? <CheckCircle2 size={18} className="text-emerald-500" /> : <XCircle size={18} className="text-destructive" />,
size: 100,
},
{
@@ -138,7 +154,7 @@ export function BranchesListPage() {
label: typeof c.header === "string" ? c.header : (c.id ?? (c as { accessorKey?: string }).accessorKey ?? ""),
}));
const totalPages = data ? Math.ceil(data.total / perPage) : 1;
const totalPages = data ? Math.ceil(data.count / perPage) : 1;
return (
<div className="space-y-4">
@@ -189,7 +205,7 @@ export function BranchesListPage() {
<DataTable
columns={columns}
data={data?.data ?? []}
data={data?.branches ?? []}
isLoading={isLoading}
columnVisibility={columnVisibility}
onColumnVisibilityChange={setColumnVisibility}
@@ -199,7 +215,7 @@ export function BranchesListPage() {
getRowId={(row) => String(row.id)}
currentPage={page}
totalPages={totalPages}
totalCount={data?.total}
totalCount={data?.count}
onPageChange={setPage}
/>
</div>
@@ -1,8 +1,8 @@
import { useState } from 'react'
import { useNavigate, useParams } from 'react-router-dom'
import { useTranslation } from 'react-i18next'
import { Pencil, Trash2, CheckCircle2, XCircle } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { useState } from "react";
import { useNavigate, useParams } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { Pencil, Trash2, CheckCircle2, XCircle } from "lucide-react";
import { Button } from "@/components/ui/button";
import {
AlertDialog,
AlertDialogAction,
@@ -12,31 +12,30 @@ import {
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from '@/components/ui/alert-dialog'
import { Skeleton } from '@/components/ui/skeleton'
import { Section, InfoRow, MultiLangRow } from '@/components/viewPageComponents'
import { useBranchById, useDeleteBranch } from '@/features/branches/hooks/useBranches'
} from "@/components/ui/alert-dialog";
import { Skeleton } from "@/components/ui/skeleton";
import { Section, InfoRow, MultiLangRow } from "@/components/viewPageComponents";
import { useBranchById, useDeleteBranch } from "@/features/branches/hooks/useBranches";
export function BranchViewPage() {
const { id } = useParams<{ id: string }>()
const navigate = useNavigate()
const { t } = useTranslation()
const { id } = useParams<{ id: string }>();
const navigate = useNavigate();
const { t, i18n } = useTranslation();
const numericId = Number(id)
const numericId = Number(id);
const { data, isLoading } = useBranchById(numericId)
const deleteMutation = useDeleteBranch()
const [deleteOpen, setDeleteOpen] = useState(false)
const { data, isLoading } = useBranchById(numericId);
const deleteMutation = useDeleteBranch();
const [deleteOpen, setDeleteOpen] = useState(false);
const lang = ((i18n.language?.slice(0, 2) === "tk" ? "tm" : i18n.language?.slice(0, 2)) ?? "tm") as "tm" | "ru" | "en";
return (
<div>
<div className="flex items-start justify-between mb-6">
<div>
<h1 className="text-2xl font-bold text-foreground">
{isLoading
? '...'
: `${t('branches.viewTitle', 'Şahamça giňişleýin')}: ${data?.name.tk ?? ''}`}
{isLoading ? "..." : `${t("branches.viewTitle", "Şahamça giňişleýin")}: ${data?.name[lang] ?? ""}`}
</h1>
</div>
@@ -45,7 +44,7 @@ export function BranchViewPage() {
variant="outline"
size="icon"
onClick={() => navigate(`/settings/location/branches/${numericId}/edit`)}
title={t('common.edit', 'Üýtgetmek')}
title={t("common.edit", "Üýtgetmek")}
>
<Pencil size={15} />
</Button>
@@ -54,7 +53,7 @@ export function BranchViewPage() {
size="icon"
className="text-destructive border-destructive/30 hover:bg-destructive/10"
onClick={() => setDeleteOpen(true)}
title={t('common.delete', 'Öçürmek')}
title={t("common.delete", "Öçürmek")}
>
<Trash2 size={15} />
</Button>
@@ -64,10 +63,7 @@ export function BranchViewPage() {
{isLoading ? (
<div className="bg-card border border-border rounded-xl overflow-hidden">
{Array.from({ length: 6 }).map((_, i) => (
<div
key={i}
className="grid grid-cols-[220px_1fr] items-center py-2.5 px-4 border-b border-border last:border-0"
>
<div key={i} className="grid grid-cols-[220px_1fr] items-center py-2.5 px-4 border-b border-border last:border-0">
<Skeleton className="h-4 w-24" />
<Skeleton className="h-4 w-40" />
</div>
@@ -75,71 +71,61 @@ export function BranchViewPage() {
</div>
) : data ? (
<>
<Section title={t('branches.sections.basic', 'Esasy maglumatlar')}>
<InfoRow label={t('common.id', 'ID')} value={data.id} />
<InfoRow label={t('branches.fields.code', 'Kod')} value={data.code} />
<Section title={t("branches.sections.basic", "Esasy maglumatlar")}>
<InfoRow label={t("common.id", "ID")} value={data.id} />
<InfoRow label={t("branches.fields.uniqueCode", "Unikal belgisi")} value={data.uniqueCode} />
<MultiLangRow label={t('branches.fields.name', 'Ady')} value={data.name} />
<MultiLangRow label={t("branches.fields.name", "Ady")} value={data.name} />
<MultiLangRow label={t('branches.fields.district', 'Etrap')} value={data.districtName} />
<MultiLangRow label={t("branches.fields.district", "Etrap")} value={data.provinceName} />
<InfoRow label={t("branches.fields.region", "Welaýat")} value={data.region} />
<div className="grid grid-cols-[220px_1fr] items-center py-2.5 px-4">
<span className="text-sm text-muted-foreground">
{t('branches.fields.isActive', 'Işjeň')}
</span>
{data.isActive ? (
<CheckCircle2 size={18} className="text-emerald-500" />
) : (
<XCircle size={18} className="text-destructive" />
)}
<span className="text-sm text-muted-foreground">{t("branches.fields.isActive", "Işjeň")}</span>
{data.active ? <CheckCircle2 size={18} className="text-emerald-500" /> : <XCircle size={18} className="text-destructive" />}
</div>
</Section>
<Section title={t('branches.sections.address', 'Salgy we habarlaşmak')}>
<MultiLangRow label={t('branches.fields.address', 'Salgy')} value={data.address} />
<InfoRow label={t('branches.fields.phone', 'Telefon')} value={data.phone} />
<InfoRow label={t('branches.fields.email', 'E-poçta')} value={data.email} />
<Section title={t("branches.sections.address", "Salgy we habarlaşmak")}>
<MultiLangRow label={t("branches.fields.address", "Salgy")} value={data.address} />
<InfoRow label={t("branches.fields.phoneNumbers", "Telefonlar")} value={data.phoneNumbers} />
</Section>
<Section title={t('branches.sections.hours', 'Iş wagty')}>
<InfoRow label={t('branches.fields.workingHours', 'Iş wagty')} value={data.workingHours} />
<InfoRow
label={t('branches.fields.description', 'Bellikler')}
value={data.description ?? undefined}
/>
<Section title={t("branches.sections.billing", "Billing maglumatlary")}>
<InfoRow label={t("branches.fields.billingIbr", "Billing ulanyjy ady")} value={data.billingUsername} />
<InfoRow label={t("branches.fields.billingSber", "Billing ulanyjy ady (SBER)")} value={data.billingSberUsername} />
<InfoRow label={t("branches.fields.billingVisa", "Billing ulanyjy ady (VISA)")} value={data.billingVisaMasterUsername} />
<InfoRow label={t("branches.fields.billingSwift", "Billing ulanyjy ady (SWIFT)")} value={data.billingSwiftUsername} />
</Section>
</>
) : (
<p className="text-muted-foreground text-sm">{t('common.noData', 'Maglumat ýok')}</p>
<p className="text-muted-foreground text-sm">{t("common.noData", "Maglumat ýok")}</p>
)}
<AlertDialog open={deleteOpen} onOpenChange={setDeleteOpen}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>{t('common.confirmDelete', 'Öçürmegi tassyklaň')}</AlertDialogTitle>
<AlertDialogDescription>
{t('branches.deleteConfirm', 'Bu şahamçany öçürmek isleýärsiňizmi?')}
</AlertDialogDescription>
<AlertDialogTitle>{t("common.confirmDelete", "Öçürmegi tassyklaň")}</AlertDialogTitle>
<AlertDialogDescription>{t("branches.deleteConfirm", "Bu şahamçany öçürmek isleýärsiňizmi?")}</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>{t('common.cancel', 'Ýatyr')}</AlertDialogCancel>
<AlertDialogCancel>{t("common.cancel", "Ýatyr")}</AlertDialogCancel>
<AlertDialogAction
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
onClick={() =>
deleteMutation.mutate(numericId, {
onSuccess: () => navigate('/settings/location/branches'),
onSuccess: () => navigate("/settings/location/branches"),
})
}
>
{deleteMutation.isPending
? t('common.deleting', 'Öçürilýär...')
: t('common.delete', 'Öçürmek')}
{deleteMutation.isPending ? t("common.deleting", "Öçürilýär...") : t("common.delete", "Öçürmek")}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</div>
)
);
}
export default BranchViewPage
export default BranchViewPage;
+12 -15
View File
@@ -17,20 +17,20 @@ export function DistrictsListPage() {
const { t, i18n } = useTranslation();
const navigate = useNavigate();
const lang = (i18n.language?.slice(0, 2) ?? "tk") as "tk" | "ru" | "en";
const lang = ((i18n.language?.slice(0, 2) === "tk" ? "tm" : i18n.language?.slice(0, 2)) ?? "tm") as "tm" | "ru" | "en";
const [page, setPage] = useState(1);
const [perPage, setPerPage] = useState(25);
const [search, setSearch] = useState("");
const [activeFilters, setActiveFilters] = useState<ActiveFilter[]>([{ fieldId: "isActive", value: "" }]);
const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({});
const [columnOrder, setColumnOrder] = useState<string[]>(["id", "name", "description", "isActive", "actions"]);
const [columnOrder, setColumnOrder] = useState<string[]>(["id", "name", "region", "isActive", "actions"]);
const [deleteId, setDeleteId] = useState<number | null>(null);
const deleteMutation = useDeleteDistrict();
const isActiveFilter = activeFilters.find((f) => f.fieldId === "isActive")?.value ?? "";
const { data, isLoading } = useDistricts({ page, perPage, search, isActive: isActiveFilter });
const { data, isLoading } = useDistricts({ page, limit: perPage, search, active: isActiveFilter });
const filterFields: FilterField[] = [
{
@@ -67,20 +67,17 @@ export function DistrictsListPage() {
cell: ({ row }) => <span className="text-sm text-foreground">{row.original.name[lang]}</span>,
},
{
accessorKey: "description",
header: t("districts.fields.description", "BELLIKLER").toUpperCase(),
cell: ({ row }) => <span className="text-sm text-muted-foreground">{row.original.description ?? "—"}</span>,
accessorKey: "region",
id: "region",
header: t("districts.fields.region", "REGION").toUpperCase(),
cell: ({ row }) => <span className="text-sm text-muted-foreground">{row.original.region[lang] ?? "—"}</span>,
},
{
accessorKey: "isActive",
accessorKey: "active",
id: "isActive",
header: t("districts.fields.isActive", "IŞJEŇ").toUpperCase(),
cell: ({ row }) =>
row.original.isActive ? (
<CheckCircle2 size={18} className="text-emerald-500" />
) : (
<XCircle size={18} className="text-destructive" />
),
row.original.active ? <CheckCircle2 size={18} className="text-emerald-500" /> : <XCircle size={18} className="text-destructive" />,
size: 100,
},
{
@@ -106,7 +103,7 @@ export function DistrictsListPage() {
label: typeof c.header === "string" ? c.header : (c.id ?? (c as { accessorKey?: string }).accessorKey ?? ""),
}));
const totalPages = data ? Math.ceil(data.total / perPage) : 1;
const totalPages = data ? Math.ceil(data.count / perPage) : 1;
return (
<div className="space-y-4">
@@ -157,7 +154,7 @@ export function DistrictsListPage() {
<DataTable
columns={columns}
data={data?.data ?? []}
data={data?.provinces ?? []}
isLoading={isLoading}
columnVisibility={columnVisibility}
onColumnVisibilityChange={setColumnVisibility}
@@ -167,7 +164,7 @@ export function DistrictsListPage() {
getRowId={(row) => String(row.id)}
currentPage={page}
totalPages={totalPages}
totalCount={data?.total}
totalCount={data?.count}
onPageChange={setPage}
/>
</div>
@@ -1,8 +1,8 @@
import { useState } from 'react'
import { useNavigate, useParams } from 'react-router-dom'
import { useTranslation } from 'react-i18next'
import { Pencil, Trash2, CheckCircle2, XCircle } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { useState } from "react";
import { useNavigate, useParams } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { Pencil, Trash2, CheckCircle2, XCircle } from "lucide-react";
import { Button } from "@/components/ui/button";
import {
AlertDialog,
AlertDialogAction,
@@ -12,31 +12,30 @@ import {
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from '@/components/ui/alert-dialog'
import { Skeleton } from '@/components/ui/skeleton'
import { Section, InfoRow, MultiLangRow } from '@/components/viewPageComponents'
import { useDistrictById, useDeleteDistrict } from '@/features/districts/hooks/useDistricts'
} from "@/components/ui/alert-dialog";
import { Skeleton } from "@/components/ui/skeleton";
import { Section, InfoRow, MultiLangRow } from "@/components/viewPageComponents";
import { useDistrictById, useDeleteDistrict } from "@/features/districts/hooks/useDistricts";
export function DistrictViewPage() {
const { id } = useParams<{ id: string }>()
const navigate = useNavigate()
const { t } = useTranslation()
const { id } = useParams<{ id: string }>();
const navigate = useNavigate();
const { t, i18n } = useTranslation();
const numericId = Number(id)
const numericId = Number(id);
const { data, isLoading } = useDistrictById(numericId)
const deleteMutation = useDeleteDistrict()
const [deleteOpen, setDeleteOpen] = useState(false)
const { data, isLoading } = useDistrictById(numericId);
const deleteMutation = useDeleteDistrict();
const [deleteOpen, setDeleteOpen] = useState(false);
const lang = ((i18n.language?.slice(0, 2) === "tk" ? "tm" : i18n.language?.slice(0, 2)) ?? "tm") as "tm" | "ru" | "en";
return (
<div>
<div className="flex items-start justify-between mb-6">
<div>
<h1 className="text-2xl font-bold text-foreground">
{isLoading
? '...'
: `${t('districts.viewTitle', 'Etrap giňişleýin')}: ${data?.name.tk ?? ''}`}
{isLoading ? "..." : `${t("districts.viewTitle", "Etrap giňişleýin")}: ${data?.name[lang] ?? ""}`}
</h1>
</div>
@@ -45,7 +44,7 @@ export function DistrictViewPage() {
variant="outline"
size="icon"
onClick={() => navigate(`/settings/location/districts/${numericId}/edit`)}
title={t('common.edit', 'Üýtgetmek')}
title={t("common.edit", "Üýtgetmek")}
>
<Pencil size={15} />
</Button>
@@ -54,7 +53,7 @@ export function DistrictViewPage() {
size="icon"
className="text-destructive border-destructive/30 hover:bg-destructive/10"
onClick={() => setDeleteOpen(true)}
title={t('common.delete', 'Öçürmek')}
title={t("common.delete", "Öçürmek")}
>
<Trash2 size={15} />
</Button>
@@ -64,10 +63,7 @@ export function DistrictViewPage() {
{isLoading ? (
<div className="bg-card border border-border rounded-xl overflow-hidden">
{Array.from({ length: 3 }).map((_, i) => (
<div
key={i}
className="grid grid-cols-[220px_1fr] items-center py-2.5 px-4 border-b border-border last:border-0"
>
<div key={i} className="grid grid-cols-[220px_1fr] items-center py-2.5 px-4 border-b border-border last:border-0">
<Skeleton className="h-4 w-24" />
<Skeleton className="h-4 w-40" />
</div>
@@ -75,57 +71,44 @@ export function DistrictViewPage() {
</div>
) : data ? (
<Section>
<InfoRow label={t('common.id', 'ID')} value={data.id} />
<InfoRow label={t("common.id", "ID")} value={data.id} />
<MultiLangRow label={t('districts.fields.name', 'Ady')} value={data.name} />
<MultiLangRow label={t("districts.fields.name", "Ady")} value={data.name} />
<InfoRow
label={t('districts.fields.description', 'Bellikler')}
value={data.description ?? undefined}
/>
<MultiLangRow label={t("districts.fields.region", "Region")} value={data.region} />
<div className="grid grid-cols-[220px_1fr] items-center py-2.5 px-4">
<span className="text-sm text-muted-foreground">
{t('districts.fields.isActive', 'Işjeň')}
</span>
{data.isActive ? (
<CheckCircle2 size={18} className="text-emerald-500" />
) : (
<XCircle size={18} className="text-destructive" />
)}
<span className="text-sm text-muted-foreground">{t("districts.fields.isActive", "Işjeň")}</span>
{data.active ? <CheckCircle2 size={18} className="text-emerald-500" /> : <XCircle size={18} className="text-destructive" />}
</div>
</Section>
) : (
<p className="text-muted-foreground text-sm">{t('common.noData', 'Maglumat ýok')}</p>
<p className="text-muted-foreground text-sm">{t("common.noData", "Maglumat ýok")}</p>
)}
<AlertDialog open={deleteOpen} onOpenChange={setDeleteOpen}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>{t('common.confirmDelete', 'Öçürmegi tassyklaň')}</AlertDialogTitle>
<AlertDialogDescription>
{t('districts.deleteConfirm', 'Bu etrapy öçürmek isleýärsiňizmi?')}
</AlertDialogDescription>
<AlertDialogTitle>{t("common.confirmDelete", "Öçürmegi tassyklaň")}</AlertDialogTitle>
<AlertDialogDescription>{t("districts.deleteConfirm", "Bu etrapy öçürmek isleýärsiňizmi?")}</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>{t('common.cancel', 'Ýatyr')}</AlertDialogCancel>
<AlertDialogCancel>{t("common.cancel", "Ýatyr")}</AlertDialogCancel>
<AlertDialogAction
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
onClick={() =>
deleteMutation.mutate(numericId, {
onSuccess: () => navigate('/settings/location/districts'),
onSuccess: () => navigate("/settings/location/districts"),
})
}
>
{deleteMutation.isPending
? t('common.deleting', 'Öçürilýär...')
: t('common.delete', 'Öçürmek')}
{deleteMutation.isPending ? t("common.deleting", "Öçürilýär...") : t("common.delete", "Öçürmek")}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</div>
)
);
}
export default DistrictViewPage
export default DistrictViewPage;