added lang param to api

This commit is contained in:
Jelaletdin12 committed 2026-10-25 00:30:50 +05:00
1 parent 11903e23bf
commit 524733ad9f
50 files changed
+798 -361

No files matched your search

@@ -11,7 +11,7 @@ import { CreateButton } from "@/components/createButton";
import { TableActions } from "@/components/tableActions";
import type { FilterField, ActiveFilter } from "@/components/dataTableToolbar";
import { useBranches, useDeleteBranch, useInfiniteProvinces } from "@/features/branches/hooks/useBranches";
import type { Branch } from "@/features/branches/api/branchesApi";
import { type Branch, resolveLocalizedName } from "@/features/branches/api/branchesApi";
export function BranchesListPage() {
const { t, i18n } = useTranslation();
@@ -70,7 +70,7 @@ export function BranchesListPage() {
(provincesInfiniteData?.pages ?? []).flatMap((page) =>
(page?.provinces ?? []).map((p) => ({
value: String(p.id),
label: p.name[lang],
label: resolveLocalizedName(p.name, lang),
})),
),
[provincesInfiniteData, lang],
@@ -133,13 +133,13 @@ export function BranchesListPage() {
accessorKey: "name",
id: "name",
header: t("branches.fields.name", "ADY").toUpperCase(),
cell: ({ row }) => <span className="text-sm text-foreground">{row.original.name[lang]}</span>,
cell: ({ row }) => <span className="text-sm text-foreground">{resolveLocalizedName(row.original.name, lang)}</span>,
},
{
accessorKey: "provinceName",
id: "provinceName",
header: t("branches.fields.district", "ETRAP").toUpperCase(),
cell: ({ row }) => <span className="text-sm text-muted-foreground">{row.original.provinceName[lang]}</span>,
cell: ({ row }) => <span className="text-sm text-muted-foreground">{resolveLocalizedName(row.original.provinceName, lang)}</span>,
},
{
accessorKey: "phoneNumbers",
@@ -4,6 +4,7 @@ import { ActiveStatusCell } from "@/constants";
import { Skeleton } from "@/components/ui/skeleton";
import { Section, InfoRow, MultiLangRow, ViewActions } from "@/components/viewPageComponents";
import { useBranchById, useDeleteBranch } from "@/features/branches/hooks/useBranches";
import { resolveLocalizedName } from "@/features/branches/api/branchesApi";
export function BranchViewPage() {
const { id } = useParams<{ id: string }>();
@@ -22,7 +23,7 @@ export function BranchViewPage() {
<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[lang] ?? ""}`}
{isLoading ? "..." : `${t("branches.viewTitle", "Şahamça giňişleýin")}: ${resolveLocalizedName(data?.name, lang)}`}
</h1>
</div>
@@ -11,7 +11,7 @@ import { CreateButton } from "@/components/createButton";
import { TableActions } from "@/components/tableActions";
import type { FilterField, ActiveFilter } from "@/components/dataTableToolbar";
import { useDistricts, useDeleteDistrict } from "@/features/districts/hooks/useDistricts";
import type { District } from "@/features/districts/api/districtsApi";
import { type District, resolveDistrictName } from "@/features/districts/api/districtsApi";
export function DistrictsListPage() {
const { t, i18n } = useTranslation();
@@ -64,13 +64,13 @@ export function DistrictsListPage() {
accessorKey: "name",
id: "name",
header: t("districts.fields.name", "ADY").toUpperCase(),
cell: ({ row }) => <span className="text-sm text-foreground">{row.original.name[lang]}</span>,
cell: ({ row }) => <span className="text-sm text-foreground">{resolveDistrictName(row.original.name, lang)}</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>,
cell: ({ row }) => <span className="text-sm text-muted-foreground">{resolveDistrictName(row.original.region, lang) || "—"}</span>,
},
{
accessorKey: "active",
@@ -4,6 +4,7 @@ import { ActiveStatusCell } from "@/constants";
import { Skeleton } from "@/components/ui/skeleton";
import { Section, InfoRow, MultiLangRow, ViewActions } from "@/components/viewPageComponents";
import { useDistrictById, useDeleteDistrict } from "@/features/districts/hooks/useDistricts";
import { resolveDistrictName } from "@/features/districts/api/districtsApi";
export function DistrictViewPage() {
const { id } = useParams<{ id: string }>();
@@ -22,7 +23,7 @@ export function DistrictViewPage() {
<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[lang] ?? ""}`}
{isLoading ? "..." : `${t("districts.viewTitle", "Etrap giňişleýin")}: ${resolveDistrictName(data?.name, lang)}`}
</h1>
</div>