feat: allocate incentive plan to rancher
This commit is contained in:
@@ -1,13 +1,12 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Popover } from "../components/PopOver/PopOver";
|
import { Popover } from "../components/PopOver/PopOver";
|
||||||
import { Tooltip } from "../components/Tooltip/Tooltip";
|
|
||||||
import Button from "../components/Button/Button";
|
import Button from "../components/Button/Button";
|
||||||
import { DeleteButtonForPopOver } from "../components/PopOverButtons/PopOverButtons";
|
import { DeleteButtonForPopOver } from "../components/PopOverButtons/PopOverButtons";
|
||||||
import { useModalStore } from "../context/zustand-store/appStore";
|
import { useModalStore } from "../context/zustand-store/appStore";
|
||||||
import { useApiRequest } from "../utils/useApiRequest";
|
import { useApiRequest } from "../utils/useApiRequest";
|
||||||
import { Grid } from "../components/Grid/Grid";
|
import { Grid } from "../components/Grid/Grid";
|
||||||
import Table from "../components/Table/Table";
|
import Table from "../components/Table/Table";
|
||||||
import { AddIncentivePlan } from "../partials/quota/AddIncentivePlan";
|
import { LiveStockRancherAllocateIncentivePlan } from "../partials/live-stock/LiveStockRancherAllocateIncentivePlan";
|
||||||
import { useParams } from "@tanstack/react-router";
|
import { useParams } from "@tanstack/react-router";
|
||||||
|
|
||||||
export default function RancherPlans() {
|
export default function RancherPlans() {
|
||||||
@@ -34,25 +33,11 @@ export default function RancherPlans() {
|
|||||||
item?.livestock_type_name,
|
item?.livestock_type_name,
|
||||||
item?.allowed_quantity?.toLocaleString(),
|
item?.allowed_quantity?.toLocaleString(),
|
||||||
<Popover key={i}>
|
<Popover key={i}>
|
||||||
<Tooltip title="ویرایش طرح" position="right">
|
|
||||||
<Button
|
|
||||||
page="farmer_plans"
|
|
||||||
access="Edit-Rancher-Incentive-Plan"
|
|
||||||
variant="edit"
|
|
||||||
onClick={() => {
|
|
||||||
openModal({
|
|
||||||
title: "ویرایش طرح",
|
|
||||||
content: <AddIncentivePlan getData={refetch} item={item} />,
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Tooltip>
|
|
||||||
|
|
||||||
<DeleteButtonForPopOver
|
<DeleteButtonForPopOver
|
||||||
page="farmer_plans"
|
page="farmer_plans"
|
||||||
access="Delete-Rancher-Incentive-Plan"
|
access="Delete-Rancher-Incentive-Plan"
|
||||||
title="از حذف طرح تشویقی اطمینان دارید؟"
|
title="از حذف طرح تشویقی اطمینان دارید؟"
|
||||||
api={`/product/web/api/v1/incentive_plan/${item?.id}/`}
|
api={`/product/web/api/v1/rancher_incentive_plan/${item?.id}/`}
|
||||||
getData={refetch}
|
getData={refetch}
|
||||||
/>
|
/>
|
||||||
</Popover>,
|
</Popover>,
|
||||||
@@ -67,7 +52,6 @@ export default function RancherPlans() {
|
|||||||
<Grid container className="items-center gap-2">
|
<Grid container className="items-center gap-2">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Button
|
<Button
|
||||||
className="hidden"
|
|
||||||
size="small"
|
size="small"
|
||||||
page="farmer_plans"
|
page="farmer_plans"
|
||||||
access="Post-Rancher-Incentive-Plan"
|
access="Post-Rancher-Incentive-Plan"
|
||||||
@@ -75,7 +59,12 @@ export default function RancherPlans() {
|
|||||||
onClick={() =>
|
onClick={() =>
|
||||||
openModal({
|
openModal({
|
||||||
title: "تخصیص طرح تشویقی",
|
title: "تخصیص طرح تشویقی",
|
||||||
content: <AddIncentivePlan getData={refetch} />,
|
content: (
|
||||||
|
<LiveStockRancherAllocateIncentivePlan
|
||||||
|
getData={refetch}
|
||||||
|
rancher={farmid}
|
||||||
|
/>
|
||||||
|
),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@@ -95,13 +84,7 @@ export default function RancherPlans() {
|
|||||||
title={`طرح های تشویقی دامدار (${name})`}
|
title={`طرح های تشویقی دامدار (${name})`}
|
||||||
isPaginated
|
isPaginated
|
||||||
count={apiData?.count || 10}
|
count={apiData?.count || 10}
|
||||||
columns={[
|
columns={["ردیف", "نام طرح", "نوع دام", "تعداد راس مجاز", "عملیات"]}
|
||||||
"ردیف",
|
|
||||||
"نام طرح",
|
|
||||||
"نوع دام",
|
|
||||||
"تعداد راس مجاز",
|
|
||||||
// , "عملیات"
|
|
||||||
]}
|
|
||||||
rows={tableData}
|
rows={tableData}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
Reference in New Issue
Block a user