delete super admin

This commit is contained in:
Samandar Turgunboyev
2025-12-12 16:39:32 +05:00
parent 92151f4b98
commit 18e43f0eb8
20 changed files with 267 additions and 110 deletions

View File

@@ -5,6 +5,7 @@ import {
} from "@/features/pharm/lib/data";
import AddedPharm from "@/features/pharm/ui/AddedPharm";
import DeletePharm from "@/features/pharm/ui/DeletePharm";
import { userStore } from "@/shared/hooks/user";
import { Button } from "@/shared/ui/button";
import {
Dialog,
@@ -28,6 +29,7 @@ import { Edit, Loader2, Plus, Trash } from "lucide-react";
import { useState } from "react";
const PharmList = () => {
const { user: getme } = userStore();
const [currentPage, setCurrentPage] = useState(1);
const [nameFilter, setNameFilter] = useState<string>("");
const limit = 20;
@@ -140,14 +142,17 @@ const PharmList = () => {
>
<Edit className="h-4 w-4" />
</Button>
<Button
variant="destructive"
size="sm"
className="cursor-pointer"
onClick={() => handleDelete(plan)}
>
<Trash className="h-4 w-4" />
</Button>
{getme?.is_superuser && (
<Button
variant="destructive"
size="sm"
disabled={!getme.is_superuser}
className="cursor-pointer"
onClick={() => handleDelete(plan)}
>
<Trash className="h-4 w-4" />
</Button>
)}
</TableCell>
</TableRow>
))