fixed some ui, upgrade functionalitym added permission to operator
This commit is contained in:
1 parent
25c104ad8c
commit
5ed4c9a8ec
46 files changed
+1058
-1401
No files matched your search
@@ -1,20 +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 {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
AlertDialogCancel,
|
||||
AlertDialogContent,
|
||||
AlertDialogDescription,
|
||||
AlertDialogFooter,
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
} from "@/components/ui/alert-dialog";
|
||||
import { CheckCircle2, XCircle } from "lucide-react";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { Section, InfoRow, MultiLangRow } from "@/components/viewPageComponents";
|
||||
import { Section, InfoRow, MultiLangRow, ViewActions } from "@/components/viewPageComponents";
|
||||
import { useBranchById, useDeleteBranch } from "@/features/branches/hooks/useBranches";
|
||||
|
||||
export function BranchViewPage() {
|
||||
@@ -26,7 +14,6 @@ export function BranchViewPage() {
|
||||
|
||||
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";
|
||||
|
||||
@@ -40,23 +27,14 @@ export function BranchViewPage() {
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="icon"
|
||||
onClick={() => navigate(`/settings/location/branches/${numericId}/edit`)}
|
||||
title={t("common.edit", "Üýtgetmek")}
|
||||
>
|
||||
<Pencil size={15} />
|
||||
</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="icon"
|
||||
className="text-destructive border-destructive/30 hover:bg-destructive/10"
|
||||
onClick={() => setDeleteOpen(true)}
|
||||
title={t("common.delete", "Öçürmek")}
|
||||
>
|
||||
<Trash2 size={15} />
|
||||
</Button>
|
||||
<ViewActions
|
||||
editTo={`/settings/location/branches/${numericId}/edit`}
|
||||
onDelete={() => deleteMutation.mutateAsync(numericId).then(() => navigate("/settings/location/branches"))}
|
||||
deleting={deleteMutation.isPending}
|
||||
deleteTitle={t("common.confirmDelete", "Öçürmegi tassyklaň")}
|
||||
deleteDescription={t("branches.deleteConfirm", "Bu şahamçany öçürmek isleýärsiňizmi?")}
|
||||
deleteConfirmLabel={t("common.delete", "Öçürmek")}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -102,28 +80,6 @@ export function BranchViewPage() {
|
||||
) : (
|
||||
<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>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<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"),
|
||||
})
|
||||
}
|
||||
>
|
||||
{deleteMutation.isPending ? t("common.deleting", "Öçürilýär...") : t("common.delete", "Öçürmek")}
|
||||
</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,20 +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 {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
AlertDialogCancel,
|
||||
AlertDialogContent,
|
||||
AlertDialogDescription,
|
||||
AlertDialogFooter,
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
} from "@/components/ui/alert-dialog";
|
||||
import { CheckCircle2, XCircle } from "lucide-react";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { Section, InfoRow, MultiLangRow } from "@/components/viewPageComponents";
|
||||
import { Section, InfoRow, MultiLangRow, ViewActions } from "@/components/viewPageComponents";
|
||||
import { useDistrictById, useDeleteDistrict } from "@/features/districts/hooks/useDistricts";
|
||||
|
||||
export function DistrictViewPage() {
|
||||
@@ -26,7 +14,6 @@ export function DistrictViewPage() {
|
||||
|
||||
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";
|
||||
|
||||
@@ -40,23 +27,14 @@ export function DistrictViewPage() {
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="icon"
|
||||
onClick={() => navigate(`/settings/location/districts/${numericId}/edit`)}
|
||||
title={t("common.edit", "Üýtgetmek")}
|
||||
>
|
||||
<Pencil size={15} />
|
||||
</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="icon"
|
||||
className="text-destructive border-destructive/30 hover:bg-destructive/10"
|
||||
onClick={() => setDeleteOpen(true)}
|
||||
title={t("common.delete", "Öçürmek")}
|
||||
>
|
||||
<Trash2 size={15} />
|
||||
</Button>
|
||||
<ViewActions
|
||||
editTo={`/settings/location/districts/${numericId}/edit`}
|
||||
onDelete={() => deleteMutation.mutateAsync(numericId).then(() => navigate("/settings/location/districts"))}
|
||||
deleting={deleteMutation.isPending}
|
||||
deleteTitle={t("common.confirmDelete", "Öçürmegi tassyklaň")}
|
||||
deleteDescription={t("districts.deleteConfirm", "Bu etrapy öçürmek isleýärsiňizmi?")}
|
||||
deleteConfirmLabel={t("common.delete", "Öçürmek")}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -85,28 +63,6 @@ export function DistrictViewPage() {
|
||||
) : (
|
||||
<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>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<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"),
|
||||
})
|
||||
}
|
||||
>
|
||||
{deleteMutation.isPending ? t("common.deleting", "Öçürilýär...") : t("common.delete", "Öçürmek")}
|
||||
</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user