permission

This commit is contained in:
hamid zarghami
2026-07-26 08:45:44 +03:30
parent b60a38e21d
commit 185961c162
35 changed files with 764 additions and 497 deletions
+23 -17
View File
@@ -8,11 +8,13 @@ import PageLoading from "../../components/PageLoading";
import Pagination from "../../components/Pagination";
import Td from "../../components/Td";
import { Pages } from "../../config/Pages";
import { usePermissions } from "../../hooks/usePermissions";
import { useGetCustomers } from "./hooks/useCustomerData";
import { CustomerItemType } from "./types/CustomerTypes";
const CustomerList: FC = () => {
const { t } = useTranslation("global");
const { canCreate, canUpdate } = usePermissions();
const [page, setPage] = useState(1);
const [limit, setLimit] = useState(10);
const [search, setSearch] = useState("");
@@ -29,17 +31,19 @@ const CustomerList: FC = () => {
<div className="mt-4">
<div className="flex w-full justify-between items-center">
<div>{t("customer.customer_list")}</div>
<Link to={Pages.customer.create}>
<Button className="px-5">
<div className="flex gap-2">
<Add
className="size-5"
color="#fff"
/>
<div>{t("customer.add_cutomer")}</div>
</div>
</Button>
</Link>
{canCreate("customers") && (
<Link to={Pages.customer.create}>
<Button className="px-5">
<div className="flex gap-2">
<Add
className="size-5"
color="#fff"
/>
<div>{t("customer.add_cutomer")}</div>
</div>
</Button>
</Link>
)}
</div>
<div className="flex justify-end items-center mt-12">
@@ -92,12 +96,14 @@ const CustomerList: FC = () => {
</Link>
</Td>
<Td text={""}>
<Link to={Pages.customer.update + item.id}>
<Eye
size={20}
color="#8C90A3"
/>
</Link>
{canUpdate("customers") && (
<Link to={Pages.customer.update + item.id}>
<Eye
size={20}
color="#8C90A3"
/>
</Link>
)}
</Td>
<Td text={""} />
</tr>