refactor: organized pages based on domain
This commit is contained in:
@@ -32,7 +32,7 @@ export default function Dashboard() {
|
|||||||
useDashboardTabStore();
|
useDashboardTabStore();
|
||||||
|
|
||||||
const menuItems: ItemWithSubItems[] = getUserPermissions(
|
const menuItems: ItemWithSubItems[] = getUserPermissions(
|
||||||
profile?.permissions
|
profile?.permissions,
|
||||||
);
|
);
|
||||||
|
|
||||||
const [tabs, setTabs] = useState<Tab[]>(dashboarTabs || []);
|
const [tabs, setTabs] = useState<Tab[]>(dashboarTabs || []);
|
||||||
@@ -55,7 +55,7 @@ export default function Dashboard() {
|
|||||||
hour: "2-digit",
|
hour: "2-digit",
|
||||||
minute: "2-digit",
|
minute: "2-digit",
|
||||||
hour12: false,
|
hour12: false,
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -65,7 +65,7 @@ export default function Dashboard() {
|
|||||||
hour: "2-digit",
|
hour: "2-digit",
|
||||||
minute: "2-digit",
|
minute: "2-digit",
|
||||||
hour12: false,
|
hour12: false,
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
}, 60000);
|
}, 60000);
|
||||||
return () => clearInterval(interval);
|
return () => clearInterval(interval);
|
||||||
@@ -96,7 +96,7 @@ export default function Dashboard() {
|
|||||||
|
|
||||||
if (activeTabId === id) {
|
if (activeTabId === id) {
|
||||||
setActiveTabId(
|
setActiveTabId(
|
||||||
newTabs.length > 0 ? newTabs[newTabs.length - 1].id : null
|
newTabs.length > 0 ? newTabs[newTabs.length - 1].id : null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -113,14 +113,14 @@ export default function Dashboard() {
|
|||||||
(subItem) =>
|
(subItem) =>
|
||||||
!subItem.path.includes("$") &&
|
!subItem.path.includes("$") &&
|
||||||
(search.trim() === "" ||
|
(search.trim() === "" ||
|
||||||
getFaPermissions(subItem.name).includes(search.trim()))
|
getFaPermissions(subItem.name).includes(search.trim())),
|
||||||
),
|
),
|
||||||
}))
|
}))
|
||||||
.filter((item) => item.subItems.length > 0);
|
.filter((item) => item.subItems.length > 0);
|
||||||
|
|
||||||
function findSubItemByPath(
|
function findSubItemByPath(
|
||||||
items: ItemWithSubItems[],
|
items: ItemWithSubItems[],
|
||||||
path: string
|
path: string,
|
||||||
): ItemWithSubItems["subItems"][0] | null {
|
): ItemWithSubItems["subItems"][0] | null {
|
||||||
for (const item of items) {
|
for (const item of items) {
|
||||||
for (const subItem of item.subItems) {
|
for (const subItem of item.subItems) {
|
||||||
@@ -247,7 +247,7 @@ export default function Dashboard() {
|
|||||||
const filteredSubItems = subItems.filter(
|
const filteredSubItems = subItems.filter(
|
||||||
(item) =>
|
(item) =>
|
||||||
!item.path.includes("$") &&
|
!item.path.includes("$") &&
|
||||||
getFaPermissions(item.name).includes(search.trim())
|
getFaPermissions(item.name).includes(search.trim()),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (filteredSubItems.length === 0) return null;
|
if (filteredSubItems.length === 0) return null;
|
||||||
@@ -306,7 +306,7 @@ export default function Dashboard() {
|
|||||||
{subItems.map((sub, subIndex) => {
|
{subItems.map((sub, subIndex) => {
|
||||||
const isActive = tabs.some(
|
const isActive = tabs.some(
|
||||||
(tab) =>
|
(tab) =>
|
||||||
tab.path === sub.path && activeTabId === tab.id
|
tab.path === sub.path && activeTabId === tab.id,
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<motion.div
|
<motion.div
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
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 { useNavigate, useParams } from "@tanstack/react-router";
|
import { useNavigate, useParams } from "@tanstack/react-router";
|
||||||
import { Popover } from "../components/PopOver/PopOver";
|
import { Popover } from "../../components/PopOver/PopOver";
|
||||||
import { Tooltip } from "../components/Tooltip/Tooltip";
|
import { Tooltip } from "../../components/Tooltip/Tooltip";
|
||||||
import Button from "../components/Button/Button";
|
import Button from "../../components/Button/Button";
|
||||||
import { useModalStore } from "../context/zustand-store/appStore";
|
import { useModalStore } from "../../context/zustand-store/appStore";
|
||||||
import { LIVESTOCK_FARMERS } from "../routes/paths";
|
import { LIVESTOCK_FARMERS } from "../../routes/paths";
|
||||||
import { TableButton } from "../components/TableButton/TableButton";
|
import { TableButton } from "../../components/TableButton/TableButton";
|
||||||
import { CooperativesDashboardDetails } from "../partials/cooperatives/CooperativesDashboardDetails";
|
import { CooperativesDashboardDetails } from "../../partials/cooperatives/CooperativesDashboardDetails";
|
||||||
import { DeleteButtonForPopOver } from "../components/PopOverButtons/PopOverButtons";
|
import { DeleteButtonForPopOver } from "../../components/PopOverButtons/PopOverButtons";
|
||||||
|
|
||||||
export default function CooperativeRanchers() {
|
export default function CooperativeRanchers() {
|
||||||
const { openModal } = useModalStore();
|
const { openModal } = useModalStore();
|
||||||
@@ -60,10 +60,10 @@ export default function CooperativeRanchers() {
|
|||||||
item?.rancher?.activity === "V"
|
item?.rancher?.activity === "V"
|
||||||
? "روستایی"
|
? "روستایی"
|
||||||
: item?.rancher?.activity === "I"
|
: item?.rancher?.activity === "I"
|
||||||
? "صنعتی"
|
? "صنعتی"
|
||||||
: item?.rancher?.activity === "R"
|
: item?.rancher?.activity === "R"
|
||||||
? "عشایری"
|
? "عشایری"
|
||||||
: "-",
|
: "-",
|
||||||
item?.rancher?.province?.name || "-",
|
item?.rancher?.province?.name || "-",
|
||||||
item?.rancher?.city?.name || "-",
|
item?.rancher?.city?.name || "-",
|
||||||
item?.rancher?.address,
|
item?.rancher?.address,
|
||||||
@@ -98,7 +98,7 @@ export default function CooperativeRanchers() {
|
|||||||
/>
|
/>
|
||||||
</Popover>,
|
</Popover>,
|
||||||
];
|
];
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
setCooperativesTableData(tableData);
|
setCooperativesTableData(tableData);
|
||||||
}
|
}
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
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 { useNavigate, useParams } from "@tanstack/react-router";
|
import { useNavigate, useParams } from "@tanstack/react-router";
|
||||||
import { Popover } from "../components/PopOver/PopOver";
|
import { Popover } from "../../components/PopOver/PopOver";
|
||||||
import { Tooltip } from "../components/Tooltip/Tooltip";
|
import { Tooltip } from "../../components/Tooltip/Tooltip";
|
||||||
import Button from "../components/Button/Button";
|
import Button from "../../components/Button/Button";
|
||||||
import { useModalStore } from "../context/zustand-store/appStore";
|
import { useModalStore } from "../../context/zustand-store/appStore";
|
||||||
import { ChildOrganizations } from "../partials/cooperatives/ChildOrganizations";
|
import { ChildOrganizations } from "../../partials/cooperatives/ChildOrganizations";
|
||||||
import { COOPERATIVE_LIST } from "../routes/paths";
|
import { COOPERATIVE_LIST } from "../../routes/paths";
|
||||||
import { TableButton } from "../components/TableButton/TableButton";
|
import { TableButton } from "../../components/TableButton/TableButton";
|
||||||
import { CooperativesDashboardDetails } from "../partials/cooperatives/CooperativesDashboardDetails";
|
import { CooperativesDashboardDetails } from "../../partials/cooperatives/CooperativesDashboardDetails";
|
||||||
import { AddActivityType } from "../partials/cooperatives/AddActivityType";
|
import { AddActivityType } from "../../partials/cooperatives/AddActivityType";
|
||||||
import ShowMoreInfo from "../components/ShowMoreInfo/ShowMoreInfo";
|
import ShowMoreInfo from "../../components/ShowMoreInfo/ShowMoreInfo";
|
||||||
import ShowStringList from "../components/ShowStringList/ShowStringList";
|
import ShowStringList from "../../components/ShowStringList/ShowStringList";
|
||||||
|
|
||||||
export default function Cooperatives() {
|
export default function Cooperatives() {
|
||||||
const { openModal } = useModalStore();
|
const { openModal } = useModalStore();
|
||||||
@@ -64,7 +64,7 @@ export default function Cooperatives() {
|
|||||||
<ShowStringList
|
<ShowStringList
|
||||||
showSearch={false}
|
showSearch={false}
|
||||||
strings={item.org_service_area.map(
|
strings={item.org_service_area.map(
|
||||||
(city: any) => city.name
|
(city: any) => city.name,
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -75,8 +75,8 @@ export default function Cooperatives() {
|
|||||||
item?.org_purchase_policy === "INTERNAL_ONLY"
|
item?.org_purchase_policy === "INTERNAL_ONLY"
|
||||||
? "بر اساس تعاونی"
|
? "بر اساس تعاونی"
|
||||||
: item?.org_purchase_policy === "CROSS_COOP"
|
: item?.org_purchase_policy === "CROSS_COOP"
|
||||||
? "برای کل استان"
|
? "برای کل استان"
|
||||||
: "-",
|
: "-",
|
||||||
<Popover key={i}>
|
<Popover key={i}>
|
||||||
<Tooltip title="دامداران تعاونی" position="right">
|
<Tooltip title="دامداران تعاونی" position="right">
|
||||||
<Button
|
<Button
|
||||||
@@ -131,7 +131,7 @@ export default function Cooperatives() {
|
|||||||
/>
|
/>
|
||||||
</Tooltip>,
|
</Tooltip>,
|
||||||
];
|
];
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
setCooperativesTableData(formattedData);
|
setCooperativesTableData(formattedData);
|
||||||
}
|
}
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
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 { useApiRequest } from "../utils/useApiRequest";
|
import { useApiRequest } from "../../utils/useApiRequest";
|
||||||
import { Popover } from "../components/PopOver/PopOver";
|
import { Popover } from "../../components/PopOver/PopOver";
|
||||||
import { DeleteButtonForPopOver } from "../components/PopOverButtons/PopOverButtons";
|
import { DeleteButtonForPopOver } from "../../components/PopOverButtons/PopOverButtons";
|
||||||
import { Tooltip } from "../components/Tooltip/Tooltip";
|
import { Tooltip } from "../../components/Tooltip/Tooltip";
|
||||||
import Button from "../components/Button/Button";
|
import Button from "../../components/Button/Button";
|
||||||
import {
|
import {
|
||||||
useDrawerStore,
|
useDrawerStore,
|
||||||
useModalStore,
|
useModalStore,
|
||||||
} from "../context/zustand-store/appStore";
|
} from "../../context/zustand-store/appStore";
|
||||||
import { LiveStockAddHerd } from "../partials/live-stock/LiveStockAddHerd";
|
import { LiveStockAddHerd } from "../../partials/live-stock/LiveStockAddHerd";
|
||||||
import { useNavigate, useParams } from "@tanstack/react-router";
|
import { useNavigate, useParams } from "@tanstack/react-router";
|
||||||
import { LIVESTOCKS } from "../routes/paths";
|
import { LIVESTOCKS } from "../../routes/paths";
|
||||||
import { LiveStockAddLiveStock } from "../partials/live-stock/LiveStockAddLiveStock";
|
import { LiveStockAddLiveStock } from "../../partials/live-stock/LiveStockAddLiveStock";
|
||||||
import { TableButton } from "../components/TableButton/TableButton";
|
import { TableButton } from "../../components/TableButton/TableButton";
|
||||||
import { LiveStockHerdDetails } from "../partials/live-stock/LiveStockHerdDetails";
|
import { LiveStockHerdDetails } from "../../partials/live-stock/LiveStockHerdDetails";
|
||||||
|
|
||||||
export default function LiveStocks() {
|
export default function LiveStocks() {
|
||||||
const [pagesInfo, setPagesInfo] = useState({ page: 1, page_size: 10 });
|
const [pagesInfo, setPagesInfo] = useState({ page: 1, page_size: 10 });
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
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 { 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 { formatJustDate } from "../utils/formatTime";
|
import { formatJustDate } from "../../utils/formatTime";
|
||||||
import { AddIncentivePlan } from "../partials/quota/AddIncentivePlan";
|
import { AddIncentivePlan } from "../../partials/quota/AddIncentivePlan";
|
||||||
import AutoComplete from "../components/AutoComplete/AutoComplete";
|
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
||||||
|
|
||||||
export default function IncentivePlans() {
|
export default function IncentivePlans() {
|
||||||
const { openModal } = useModalStore();
|
const { openModal } = useModalStore();
|
||||||
@@ -47,8 +47,8 @@ export default function IncentivePlans() {
|
|||||||
item?.group === "rural"
|
item?.group === "rural"
|
||||||
? "روستایی"
|
? "روستایی"
|
||||||
: item?.group === "nomadic"
|
: item?.group === "nomadic"
|
||||||
? "عشایری"
|
? "عشایری"
|
||||||
: "صنعتی",
|
: "صنعتی",
|
||||||
item?.is_time_unlimited ? "دارد" : "ندارد",
|
item?.is_time_unlimited ? "دارد" : "ندارد",
|
||||||
formatJustDate(item?.start_date_limit),
|
formatJustDate(item?.start_date_limit),
|
||||||
formatJustDate(item?.end_date_limit),
|
formatJustDate(item?.end_date_limit),
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Grid } from "../components/Grid/Grid";
|
import { Grid } from "../../components/Grid/Grid";
|
||||||
import Tabs from "../components/Tab/Tab";
|
import Tabs from "../../components/Tab/Tab";
|
||||||
import { useUserProfileStore } from "../context/zustand-store/userStore";
|
import { useUserProfileStore } from "../../context/zustand-store/userStore";
|
||||||
import { InventoryStakeHolderAllocations } from "../partials/inventory/InventoryStakeHolderAllocations";
|
import { InventoryStakeHolderAllocations } from "../../partials/inventory/InventoryStakeHolderAllocations";
|
||||||
import { InventoryWarehouseEntryTab } from "../partials/inventory/InventoryWarehouseEntryTab";
|
import { InventoryWarehouseEntryTab } from "../../partials/inventory/InventoryWarehouseEntryTab";
|
||||||
import { useParams } from "@tanstack/react-router";
|
import { useParams } from "@tanstack/react-router";
|
||||||
import { InventoryEntriesList } from "../partials/inventory/InventoryEntriesList";
|
import { InventoryEntriesList } from "../../partials/inventory/InventoryEntriesList";
|
||||||
|
|
||||||
export default function Inventory() {
|
export default function Inventory() {
|
||||||
const [selectedTab, setSelectedTab] = useState<number>(0);
|
const [selectedTab, setSelectedTab] = useState<number>(0);
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
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 { useApiRequest } from "../utils/useApiRequest";
|
import { useApiRequest } from "../../utils/useApiRequest";
|
||||||
import Button from "../components/Button/Button";
|
import Button from "../../components/Button/Button";
|
||||||
import { LiveStockAddRancher } from "../partials/live-stock/LiveStockAddRancher";
|
import { LiveStockAddRancher } from "../../partials/live-stock/LiveStockAddRancher";
|
||||||
import {
|
import {
|
||||||
useDrawerStore,
|
useDrawerStore,
|
||||||
useModalStore,
|
useModalStore,
|
||||||
} from "../context/zustand-store/appStore";
|
} from "../../context/zustand-store/appStore";
|
||||||
import { Popover } from "../components/PopOver/PopOver";
|
import { Popover } from "../../components/PopOver/PopOver";
|
||||||
import { Tooltip } from "../components/Tooltip/Tooltip";
|
import { Tooltip } from "../../components/Tooltip/Tooltip";
|
||||||
import { DeleteButtonForPopOver } from "../components/PopOverButtons/PopOverButtons";
|
import { DeleteButtonForPopOver } from "../../components/PopOverButtons/PopOverButtons";
|
||||||
import { LiveStockAddHerd } from "../partials/live-stock/LiveStockAddHerd";
|
import { LiveStockAddHerd } from "../../partials/live-stock/LiveStockAddHerd";
|
||||||
import { LiveStockAllocateCooperative } from "../partials/live-stock/LiveStockAllocateCooperative";
|
import { LiveStockAllocateCooperative } from "../../partials/live-stock/LiveStockAllocateCooperative";
|
||||||
import { useNavigate } from "@tanstack/react-router";
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
import { LIVESTOCK_FARMERS } from "../routes/paths";
|
import { LIVESTOCK_FARMERS } from "../../routes/paths";
|
||||||
import { LiveStockFarmersDashboardResponse } from "../types/LiveStockFarmers";
|
import { LiveStockFarmersDashboardResponse } from "../../types/LiveStockFarmers";
|
||||||
|
|
||||||
export default function LiveStockFarmers() {
|
export default function LiveStockFarmers() {
|
||||||
const [pagesInfo, setPagesInfo] = useState({ page: 1, page_size: 10 });
|
const [pagesInfo, setPagesInfo] = useState({ page: 1, page_size: 10 });
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
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 { useApiRequest } from "../utils/useApiRequest";
|
import { useApiRequest } from "../../utils/useApiRequest";
|
||||||
import { Popover } from "../components/PopOver/PopOver";
|
import { Popover } from "../../components/PopOver/PopOver";
|
||||||
import { DeleteButtonForPopOver } from "../components/PopOverButtons/PopOverButtons";
|
import { DeleteButtonForPopOver } from "../../components/PopOverButtons/PopOverButtons";
|
||||||
import { useParams } from "@tanstack/react-router";
|
import { useParams } from "@tanstack/react-router";
|
||||||
import { formatAgeCalcuation, formatJustDate } from "../utils/formatTime";
|
import { formatAgeCalcuation, formatJustDate } from "../../utils/formatTime";
|
||||||
import { Tooltip } from "../components/Tooltip/Tooltip";
|
import { Tooltip } from "../../components/Tooltip/Tooltip";
|
||||||
import Button from "../components/Button/Button";
|
import Button from "../../components/Button/Button";
|
||||||
import { LiveStockAddLiveStock } from "../partials/live-stock/LiveStockAddLiveStock";
|
import { LiveStockAddLiveStock } from "../../partials/live-stock/LiveStockAddLiveStock";
|
||||||
import { useDrawerStore } from "../context/zustand-store/appStore";
|
import { useDrawerStore } from "../../context/zustand-store/appStore";
|
||||||
import { CheckCircleIcon, XCircleIcon } from "@heroicons/react/24/outline";
|
import { CheckCircleIcon, XCircleIcon } from "@heroicons/react/24/outline";
|
||||||
import AutoComplete from "../components/AutoComplete/AutoComplete";
|
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
||||||
|
|
||||||
export default function LiveStocks() {
|
export default function LiveStocks() {
|
||||||
const [pagesInfo, setPagesInfo] = useState({ page: 1, page_size: 10 });
|
const [pagesInfo, setPagesInfo] = useState({ page: 1, page_size: 10 });
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import { Grid } from "../components/Grid/Grid";
|
import { Grid } from "../../components/Grid/Grid";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import Tabs from "../components/Tab/Tab";
|
import Tabs from "../../components/Tab/Tab";
|
||||||
import { OrganizationsList } from "../partials/management/OrganizationsList";
|
import { OrganizationsList } from "../../partials/management/OrganizationsList";
|
||||||
import { OrganizationsTypes } from "../partials/management/OrganizationsTypes";
|
import { OrganizationsTypes } from "../../partials/management/OrganizationsTypes";
|
||||||
|
|
||||||
export default function Organizations() {
|
export default function Organizations() {
|
||||||
const tabItems = [
|
const tabItems = [
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
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 Button from "../components/Button/Button";
|
import Button from "../../components/Button/Button";
|
||||||
import { useModalStore } from "../context/zustand-store/appStore";
|
import { useModalStore } from "../../context/zustand-store/appStore";
|
||||||
import { AddPos } from "../partials/pos/AddPos";
|
import { AddPos } from "../../partials/pos/AddPos";
|
||||||
import { Popover } from "../components/PopOver/PopOver";
|
import { Popover } from "../../components/PopOver/PopOver";
|
||||||
import { Tooltip } from "../components/Tooltip/Tooltip";
|
import { Tooltip } from "../../components/Tooltip/Tooltip";
|
||||||
import { DeleteButtonForPopOver } from "../components/PopOverButtons/PopOverButtons";
|
import { DeleteButtonForPopOver } from "../../components/PopOverButtons/PopOverButtons";
|
||||||
import { useUserProfileStore } from "../context/zustand-store/userStore";
|
import { useUserProfileStore } from "../../context/zustand-store/userStore";
|
||||||
import { useNavigate, useParams } from "@tanstack/react-router";
|
import { useNavigate, useParams } from "@tanstack/react-router";
|
||||||
import { AllocatePos } from "../partials/pos/AllocatePos";
|
import { AllocatePos } from "../../partials/pos/AllocatePos";
|
||||||
import { CreditCardIcon } from "@heroicons/react/24/outline";
|
import { CreditCardIcon } from "@heroicons/react/24/outline";
|
||||||
import { POS_POS_LIST } from "../routes/paths";
|
import { POS_POS_LIST } from "../../routes/paths";
|
||||||
|
|
||||||
export default function Pos() {
|
export default function Pos() {
|
||||||
const { openModal } = useModalStore();
|
const { openModal } = useModalStore();
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
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 Button from "../components/Button/Button";
|
import Button from "../../components/Button/Button";
|
||||||
import { useModalStore } from "../context/zustand-store/appStore";
|
import { useModalStore } from "../../context/zustand-store/appStore";
|
||||||
import { AddPos } from "../partials/pos/AddPos";
|
import { AddPos } from "../../partials/pos/AddPos";
|
||||||
import { Popover } from "../components/PopOver/PopOver";
|
import { Popover } from "../../components/PopOver/PopOver";
|
||||||
import { Tooltip } from "../components/Tooltip/Tooltip";
|
import { Tooltip } from "../../components/Tooltip/Tooltip";
|
||||||
import { DeleteButtonForPopOver } from "../components/PopOverButtons/PopOverButtons";
|
import { DeleteButtonForPopOver } from "../../components/PopOverButtons/PopOverButtons";
|
||||||
import { useParams } from "@tanstack/react-router";
|
import { useParams } from "@tanstack/react-router";
|
||||||
import { AllocatePos } from "../partials/pos/AllocatePos";
|
import { AllocatePos } from "../../partials/pos/AllocatePos";
|
||||||
import { PosAllocateOrganizationAccount } from "../partials/pos/PosAllocateOrganizationAccount";
|
import { PosAllocateOrganizationAccount } from "../../partials/pos/PosAllocateOrganizationAccount";
|
||||||
import { AllocateAccountToBroker } from "../partials/pos/AllocateAccountToBroker";
|
import { AllocateAccountToBroker } from "../../partials/pos/AllocateAccountToBroker";
|
||||||
import { BooleanQuestion } from "../components/BooleanQuestion/BooleanQuestion";
|
import { BooleanQuestion } from "../../components/BooleanQuestion/BooleanQuestion";
|
||||||
|
|
||||||
export default function PosAccounts() {
|
export default function PosAccounts() {
|
||||||
const { openModal } = useModalStore();
|
const { openModal } = useModalStore();
|
||||||
@@ -102,7 +102,7 @@ export default function PosAccounts() {
|
|||||||
/>
|
/>
|
||||||
</Popover>,
|
</Popover>,
|
||||||
];
|
];
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
setAccountsTableData(formattedData);
|
setAccountsTableData(formattedData);
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
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 { useApiRequest } from "../utils/useApiRequest";
|
import { useApiRequest } from "../../utils/useApiRequest";
|
||||||
import { Popover } from "../components/PopOver/PopOver";
|
import { Popover } from "../../components/PopOver/PopOver";
|
||||||
import { Tooltip } from "../components/Tooltip/Tooltip";
|
import { Tooltip } from "../../components/Tooltip/Tooltip";
|
||||||
import Button from "../components/Button/Button";
|
import Button from "../../components/Button/Button";
|
||||||
import { useNavigate } from "@tanstack/react-router";
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
import { POS_COMPANIES } from "../routes/paths";
|
import { POS_COMPANIES } from "../../routes/paths";
|
||||||
|
|
||||||
export default function PosCompanies() {
|
export default function PosCompanies() {
|
||||||
const [pagesInfo, setPagesInfo] = useState({ page: 1, page_size: 10 });
|
const [pagesInfo, setPagesInfo] = useState({ page: 1, page_size: 10 });
|
||||||
@@ -35,10 +35,10 @@ export default function PosCompanies() {
|
|||||||
item?.field_of_activity === "CO"
|
item?.field_of_activity === "CO"
|
||||||
? "کشور"
|
? "کشور"
|
||||||
: item?.field_of_activity === "PR"
|
: item?.field_of_activity === "PR"
|
||||||
? "استان"
|
? "استان"
|
||||||
: item?.field_of_activity === "CI"
|
: item?.field_of_activity === "CI"
|
||||||
? "شهرستان"
|
? "شهرستان"
|
||||||
: "نامشخص",
|
: "نامشخص",
|
||||||
<Popover key={i}>
|
<Popover key={i}>
|
||||||
<Tooltip title="نمایش کارتخوان ها" position="right">
|
<Tooltip title="نمایش کارتخوان ها" position="right">
|
||||||
<Button
|
<Button
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Grid } from "../components/Grid/Grid";
|
import { Grid } from "../../components/Grid/Grid";
|
||||||
import Tabs from "../components/Tab/Tab";
|
import Tabs from "../../components/Tab/Tab";
|
||||||
import { Attributes } from "../partials/feed-input/Attributes";
|
import { Attributes } from "../../partials/feed-input/Attributes";
|
||||||
import { Brokers } from "../partials/feed-input/Brokers";
|
import { Brokers } from "../../partials/feed-input/Brokers";
|
||||||
import { SaleUnits } from "../partials/feed-input/SaleUnits";
|
import { SaleUnits } from "../../partials/feed-input/SaleUnits";
|
||||||
const tabItems = [
|
const tabItems = [
|
||||||
{ label: "مولفه" },
|
{ label: "مولفه" },
|
||||||
{ label: "کارگزار" },
|
{ label: "کارگزار" },
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
import { motion } from "framer-motion";
|
import { motion } from "framer-motion";
|
||||||
import { useApiRequest } from "../utils/useApiRequest";
|
import { useApiRequest } from "../../utils/useApiRequest";
|
||||||
import sabos from "../assets/images/products/saboos.png";
|
import sabos from "../../assets/images/products/saboos.png";
|
||||||
import jo from "../assets/images/products/jo.png";
|
import jo from "../../assets/images/products/jo.png";
|
||||||
import soya from "../assets/images/products/soya.png";
|
import soya from "../../assets/images/products/soya.png";
|
||||||
import zorat from "../assets/images/products/zorat.png";
|
import zorat from "../../assets/images/products/zorat.png";
|
||||||
import goosfandi from "../assets/images/products/constantre-goosfandi.png";
|
import goosfandi from "../../assets/images/products/constantre-goosfandi.png";
|
||||||
import parvari from "../assets/images/products/constantre-parvari.png";
|
import parvari from "../../assets/images/products/constantre-parvari.png";
|
||||||
import porTolid from "../assets/images/products/constantre-gave-shiri-por-tolid.png";
|
import porTolid from "../../assets/images/products/constantre-gave-shiri-por-tolid.png";
|
||||||
import shiriMotevaset from "../assets/images/products/constantre-gave-shiri-motevaset.png";
|
import shiriMotevaset from "../../assets/images/products/constantre-gave-shiri-motevaset.png";
|
||||||
import defaultImage from "../assets/images/products/default.png";
|
import defaultImage from "../../assets/images/products/default.png";
|
||||||
import Button from "../components/Button/Button";
|
import Button from "../../components/Button/Button";
|
||||||
import { PencilIcon, TrashIcon } from "@heroicons/react/24/outline";
|
import { PencilIcon, TrashIcon } from "@heroicons/react/24/outline";
|
||||||
import { Grid } from "../components/Grid/Grid";
|
import { Grid } from "../../components/Grid/Grid";
|
||||||
import { useModalStore } from "../context/zustand-store/appStore";
|
import { useModalStore } from "../../context/zustand-store/appStore";
|
||||||
import { AddProduct } from "../partials/feed-input/AddProduct";
|
import { AddProduct } from "../../partials/feed-input/AddProduct";
|
||||||
import { getAbleToSee } from "../utils/getAbleToSee";
|
import { getAbleToSee } from "../../utils/getAbleToSee";
|
||||||
import { DeleteProduct } from "../partials/feed-input/DeleteProduct";
|
import { DeleteProduct } from "../../partials/feed-input/DeleteProduct";
|
||||||
|
|
||||||
interface Category {
|
interface Category {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -232,7 +232,7 @@ export default function Products() {
|
|||||||
<button
|
<button
|
||||||
className={`${getAbleToSee(
|
className={`${getAbleToSee(
|
||||||
"feed_input_products",
|
"feed_input_products",
|
||||||
"Edit-Product"
|
"Edit-Product",
|
||||||
)} rounded-full text-primary-600 text-sm`}
|
)} rounded-full text-primary-600 text-sm`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
openModal({
|
openModal({
|
||||||
@@ -252,7 +252,7 @@ export default function Products() {
|
|||||||
}}
|
}}
|
||||||
className={`${getAbleToSee(
|
className={`${getAbleToSee(
|
||||||
"feed_input_products",
|
"feed_input_products",
|
||||||
"Delete-Product"
|
"Delete-Product",
|
||||||
)} text-red-400 rounded-lg text-sm`}
|
)} text-red-400 rounded-lg text-sm`}
|
||||||
>
|
>
|
||||||
<TrashIcon className="w-5" />
|
<TrashIcon className="w-5" />
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
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 { Popover } from "../components/PopOver/PopOver";
|
import { Popover } from "../../components/PopOver/PopOver";
|
||||||
import { Tooltip } from "../components/Tooltip/Tooltip";
|
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 { Grid } from "../components/Grid/Grid";
|
import { Grid } from "../../components/Grid/Grid";
|
||||||
import Table from "../components/Table/Table";
|
import Table from "../../components/Table/Table";
|
||||||
import { AddProductCategory } from "../partials/feed-input/AddProductCategory";
|
import { AddProductCategory } from "../../partials/feed-input/AddProductCategory";
|
||||||
|
|
||||||
export const ProductsCategories = () => {
|
export const ProductsCategories = () => {
|
||||||
const { openModal } = useModalStore();
|
const { openModal } = useModalStore();
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
import { Grid } from "../components/Grid/Grid";
|
import { Grid } from "../../components/Grid/Grid";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import Tabs from "../components/Tab/Tab";
|
import Tabs from "../../components/Tab/Tab";
|
||||||
import { QuotaActives } from "../partials/quota/QuotaActives";
|
import { QuotaActives } from "../../partials/quota/QuotaActives";
|
||||||
import { QuotaClosed } from "../partials/quota/QuotaClosed";
|
import { QuotaClosed } from "../../partials/quota/QuotaClosed";
|
||||||
import { useParams } from "@tanstack/react-router";
|
import { useParams } from "@tanstack/react-router";
|
||||||
import { QuotaDistributions } from "../partials/quota/QuotaDistributions";
|
import { QuotaDistributions } from "../../partials/quota/QuotaDistributions";
|
||||||
import { QuotaAllDistributions } from "../partials/quota/QuotaAllDistributions";
|
import { QuotaAllDistributions } from "../../partials/quota/QuotaAllDistributions";
|
||||||
|
|
||||||
export default function Quota() {
|
export default function Quota() {
|
||||||
const [selectedTab, setSelectedTab] = useState<number>(0);
|
const [selectedTab, setSelectedTab] = useState<number>(0);
|
||||||
@@ -1,12 +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 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 { LiveStockRancherAllocateIncentivePlan } from "../partials/live-stock/LiveStockRancherAllocateIncentivePlan";
|
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() {
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Grid } from "../components/Grid/Grid";
|
import { Grid } from "../../components/Grid/Grid";
|
||||||
import Tabs from "../components/Tab/Tab";
|
import Tabs from "../../components/Tab/Tab";
|
||||||
import { QuotaReportingProducts } from "../partials/quota/QuotaReportingProducts";
|
import { QuotaReportingProducts } from "../../partials/quota/QuotaReportingProducts";
|
||||||
import { useParams } from "@tanstack/react-router";
|
import { useParams } from "@tanstack/react-router";
|
||||||
import { QuotaReportingProductDetails } from "../partials/quota/QuotaReportingProductDetails";
|
import { QuotaReportingProductDetails } from "../../partials/quota/QuotaReportingProductDetails";
|
||||||
import { QuotaReportingQuotaDistributions } from "../partials/quota/QuotaReportingQuotaDistributions";
|
import { QuotaReportingQuotaDistributions } from "../../partials/quota/QuotaReportingQuotaDistributions";
|
||||||
|
|
||||||
const tabItems = [
|
const tabItems = [
|
||||||
{ label: "محصول" },
|
{ label: "محصول" },
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
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 { Popover } from "../components/PopOver/PopOver";
|
import { Popover } from "../../components/PopOver/PopOver";
|
||||||
import { Tooltip } from "../components/Tooltip/Tooltip";
|
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 { Grid } from "../components/Grid/Grid";
|
import { Grid } from "../../components/Grid/Grid";
|
||||||
import Table from "../components/Table/Table";
|
import Table from "../../components/Table/Table";
|
||||||
import { AddRole } from "../partials/management/AddRole";
|
import { AddRole } from "../../partials/management/AddRole";
|
||||||
import { getFaPermissions } from "../utils/getFaPermissions";
|
import { getFaPermissions } from "../../utils/getFaPermissions";
|
||||||
import ShowStringList from "../components/ShowStringList/ShowStringList";
|
import ShowStringList from "../../components/ShowStringList/ShowStringList";
|
||||||
import ShowMoreInfo from "../components/ShowMoreInfo/ShowMoreInfo";
|
import ShowMoreInfo from "../../components/ShowMoreInfo/ShowMoreInfo";
|
||||||
import Typography from "../components/Typography/Typography";
|
import Typography from "../../components/Typography/Typography";
|
||||||
|
|
||||||
export default function Roles() {
|
export default function Roles() {
|
||||||
const { openModal } = useModalStore();
|
const { openModal } = useModalStore();
|
||||||
@@ -40,7 +40,7 @@ export default function Roles() {
|
|||||||
acc[item.page].names.push(item.name);
|
acc[item.page].names.push(item.name);
|
||||||
acc[item.page].descriptions.push(item.description);
|
acc[item.page].descriptions.push(item.description);
|
||||||
return acc;
|
return acc;
|
||||||
}, {})
|
}, {}),
|
||||||
);
|
);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Grid } from "../components/Grid/Grid";
|
import { Grid } from "../../components/Grid/Grid";
|
||||||
import Tabs from "../components/Tab/Tab";
|
import Tabs from "../../components/Tab/Tab";
|
||||||
import SettingCard from "../components/SettingCard/SettingCard";
|
import SettingCard from "../../components/SettingCard/SettingCard";
|
||||||
import { ShieldExclamationIcon, MapPinIcon } from "@heroicons/react/24/outline";
|
import { ShieldExclamationIcon, MapPinIcon } from "@heroicons/react/24/outline";
|
||||||
import { useModalStore } from "../context/zustand-store/appStore";
|
import { useModalStore } from "../../context/zustand-store/appStore";
|
||||||
import { CooperativesSettingsTable } from "../partials/units/CooperativesSettingsTable";
|
import { CooperativesSettingsTable } from "../../partials/units/CooperativesSettingsTable";
|
||||||
|
|
||||||
const tabItems = [
|
const tabItems = [
|
||||||
{ label: "اتحادیه ها", visible: false },
|
{ label: "اتحادیه ها", visible: false },
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Grid } from "../components/Grid/Grid";
|
import { Grid } from "../../components/Grid/Grid";
|
||||||
import Tabs from "../components/Tab/Tab";
|
import Tabs from "../../components/Tab/Tab";
|
||||||
import TagActiveDistributions from "../partials/tagging/TagActiveDistributions";
|
import TagActiveDistributions from "../../partials/tagging/TagActiveDistributions";
|
||||||
import TagCanceledDistributions from "../partials/tagging/TagCanceledDistributions";
|
import TagCanceledDistributions from "../../partials/tagging/TagCanceledDistributions";
|
||||||
|
|
||||||
export default function TagDistribtution() {
|
export default function TagDistribtution() {
|
||||||
const [selectedTab, setSelectedTab] = useState<number>(0);
|
const [selectedTab, setSelectedTab] = useState<number>(0);
|
||||||
@@ -1,22 +1,22 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useParams } from "@tanstack/react-router";
|
import { useParams } from "@tanstack/react-router";
|
||||||
import { Bars3Icon, CubeIcon, SparklesIcon } from "@heroicons/react/24/outline";
|
import { Bars3Icon, CubeIcon, SparklesIcon } from "@heroicons/react/24/outline";
|
||||||
import { useApiRequest } from "../utils/useApiRequest";
|
import { useApiRequest } from "../../utils/useApiRequest";
|
||||||
import { useModalStore } from "../context/zustand-store/appStore";
|
import { useModalStore } from "../../context/zustand-store/appStore";
|
||||||
import { formatJustDate, formatJustTime } from "../utils/formatTime";
|
import { formatJustDate, formatJustTime } from "../../utils/formatTime";
|
||||||
import ShowMoreInfo from "../components/ShowMoreInfo/ShowMoreInfo";
|
import ShowMoreInfo from "../../components/ShowMoreInfo/ShowMoreInfo";
|
||||||
import { Grid } from "../components/Grid/Grid";
|
import { Grid } from "../../components/Grid/Grid";
|
||||||
import Typography from "../components/Typography/Typography";
|
import Typography from "../../components/Typography/Typography";
|
||||||
import Table from "../components/Table/Table";
|
import Table from "../../components/Table/Table";
|
||||||
import { Popover } from "../components/PopOver/PopOver";
|
import { Popover } from "../../components/PopOver/PopOver";
|
||||||
import Button from "../components/Button/Button";
|
import Button from "../../components/Button/Button";
|
||||||
import { Tooltip } from "../components/Tooltip/Tooltip";
|
import { Tooltip } from "../../components/Tooltip/Tooltip";
|
||||||
import { DistributeFromDistribution } from "../partials/tagging/DistributeFromDistribution";
|
import { DistributeFromDistribution } from "../../partials/tagging/DistributeFromDistribution";
|
||||||
import { DocumentOperation } from "../components/DocumentOperation/DocumentOperation";
|
import { DocumentOperation } from "../../components/DocumentOperation/DocumentOperation";
|
||||||
import { DocumentDownloader } from "../components/DocumentDownloader/DocumentDownloader";
|
import { DocumentDownloader } from "../../components/DocumentDownloader/DocumentDownloader";
|
||||||
import { BooleanQuestion } from "../components/BooleanQuestion/BooleanQuestion";
|
import { BooleanQuestion } from "../../components/BooleanQuestion/BooleanQuestion";
|
||||||
import { useUserProfileStore } from "../context/zustand-store/userStore";
|
import { useUserProfileStore } from "../../context/zustand-store/userStore";
|
||||||
import { DeleteButtonForPopOver } from "../components/PopOverButtons/PopOverButtons";
|
import { DeleteButtonForPopOver } from "../../components/PopOverButtons/PopOverButtons";
|
||||||
|
|
||||||
const speciesMap: Record<number, string> = {
|
const speciesMap: Record<number, string> = {
|
||||||
1: "گاو",
|
1: "گاو",
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Grid } from "../components/Grid/Grid";
|
import { Grid } from "../../components/Grid/Grid";
|
||||||
import Tabs from "../components/Tab/Tab";
|
import Tabs from "../../components/Tab/Tab";
|
||||||
import Taggings from "../partials/tagging/Taggings";
|
import Taggings from "../../partials/tagging/Taggings";
|
||||||
import Tags from "../partials/tagging/Tags";
|
import Tags from "../../partials/tagging/Tags";
|
||||||
|
|
||||||
const tabItems = [
|
const tabItems = [
|
||||||
{ label: "ثبت پلاک" },
|
{ label: "ثبت پلاک" },
|
||||||
@@ -1,16 +1,19 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import Table from "../components/Table/Table";
|
import Table from "../../components/Table/Table";
|
||||||
import { Grid } from "../components/Grid/Grid";
|
import { Grid } from "../../components/Grid/Grid";
|
||||||
import { useApiRequest } from "../utils/useApiRequest";
|
import { useApiRequest } from "../../utils/useApiRequest";
|
||||||
import { formatJustDate, formatJustTime } from "../utils/formatTime";
|
import { formatJustDate, formatJustTime } from "../../utils/formatTime";
|
||||||
import { TableButton } from "../components/TableButton/TableButton";
|
import { TableButton } from "../../components/TableButton/TableButton";
|
||||||
import { useModalStore } from "../context/zustand-store/appStore";
|
import { useModalStore } from "../../context/zustand-store/appStore";
|
||||||
import TransactionDetails from "../partials/transactions/TransactionDetails";
|
import TransactionDetails from "../../partials/transactions/TransactionDetails";
|
||||||
import { DashboardResponse, ProductSummaryItem } from "../types/transactions";
|
import {
|
||||||
import { ProductSummaryModal } from "../partials/transactions/ProductSummaryModal";
|
DashboardResponse,
|
||||||
import { PaginationParameters } from "../components/PaginationParameters/PaginationParameters";
|
ProductSummaryItem,
|
||||||
import TransactionSharingDetails from "../partials/transactions/TransactionSharingDetails";
|
} from "../../types/transactions";
|
||||||
import { convertNumberToPersian } from "../utils/convertNumberToPersian";
|
import { ProductSummaryModal } from "../../partials/transactions/ProductSummaryModal";
|
||||||
|
import { PaginationParameters } from "../../components/PaginationParameters/PaginationParameters";
|
||||||
|
import TransactionSharingDetails from "../../partials/transactions/TransactionSharingDetails";
|
||||||
|
import { convertNumberToPersian } from "../../utils/convertNumberToPersian";
|
||||||
|
|
||||||
type TransactionResponse = {
|
type TransactionResponse = {
|
||||||
results?: any[];
|
results?: any[];
|
||||||
@@ -72,7 +75,7 @@ export default function Transactions() {
|
|||||||
.filter((unit: any) => unit);
|
.filter((unit: any) => unit);
|
||||||
const totalWeight = items.reduce(
|
const totalWeight = items.reduce(
|
||||||
(sum: number, p: any) => sum + (p?.weight || 0),
|
(sum: number, p: any) => sum + (p?.weight || 0),
|
||||||
0
|
0,
|
||||||
);
|
);
|
||||||
|
|
||||||
let weightNature;
|
let weightNature;
|
||||||
@@ -111,12 +114,12 @@ export default function Transactions() {
|
|||||||
item?.transaction_status === "waiting"
|
item?.transaction_status === "waiting"
|
||||||
? "درحال انتظار"
|
? "درحال انتظار"
|
||||||
: item?.transaction_status === "success"
|
: item?.transaction_status === "success"
|
||||||
? "موفق"
|
? "موفق"
|
||||||
: item?.transaction_status === "failed"
|
: item?.transaction_status === "failed"
|
||||||
? `ناموفق ( ${item?.result_text || "-"} ${
|
? `ناموفق ( ${item?.result_text || "-"} ${
|
||||||
item?.transaction_status_code || ""
|
item?.transaction_status_code || ""
|
||||||
} )`
|
} )`
|
||||||
: "-",
|
: "-",
|
||||||
<TableButton
|
<TableButton
|
||||||
size="small"
|
size="small"
|
||||||
key={i}
|
key={i}
|
||||||
@@ -210,7 +213,7 @@ export default function Transactions() {
|
|||||||
DashboardData?.transaction_summary?.total_amount?.toLocaleString() ||
|
DashboardData?.transaction_summary?.total_amount?.toLocaleString() ||
|
||||||
0,
|
0,
|
||||||
convertNumberToPersian(
|
convertNumberToPersian(
|
||||||
DashboardData?.transaction_summary?.total_amount || 0
|
DashboardData?.transaction_summary?.total_amount || 0,
|
||||||
),
|
),
|
||||||
DashboardData?.transaction_summary?.total_weight?.toLocaleString() ||
|
DashboardData?.transaction_summary?.total_weight?.toLocaleString() ||
|
||||||
0,
|
0,
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
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 { Popover } from "../components/PopOver/PopOver";
|
import { Popover } from "../../components/PopOver/PopOver";
|
||||||
import { Tooltip } from "../components/Tooltip/Tooltip";
|
import { Tooltip } from "../../components/Tooltip/Tooltip";
|
||||||
import Button from "../components/Button/Button";
|
import Button from "../../components/Button/Button";
|
||||||
import { COOPERATIVE_LIST } from "../routes/paths";
|
import { COOPERATIVE_LIST } from "../../routes/paths";
|
||||||
import { useNavigate } from "@tanstack/react-router";
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
|
|
||||||
export default function Unions() {
|
export default function Unions() {
|
||||||
@@ -1,22 +1,22 @@
|
|||||||
import Table from "../components/Table/Table";
|
import Table from "../../components/Table/Table";
|
||||||
import { Grid } from "../components/Grid/Grid";
|
import { Grid } from "../../components/Grid/Grid";
|
||||||
import { useApiRequest } from "../utils/useApiRequest";
|
import { useApiRequest } from "../../utils/useApiRequest";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { getFaPermissions } from "../utils/getFaPermissions";
|
import { getFaPermissions } from "../../utils/getFaPermissions";
|
||||||
import { Popover } from "../components/PopOver/PopOver";
|
import { Popover } from "../../components/PopOver/PopOver";
|
||||||
import { Tooltip } from "../components/Tooltip/Tooltip";
|
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 {
|
import {
|
||||||
useDrawerStore,
|
useDrawerStore,
|
||||||
useModalStore,
|
useModalStore,
|
||||||
} from "../context/zustand-store/appStore";
|
} from "../../context/zustand-store/appStore";
|
||||||
import { EditAccess } from "../partials/management/EditAccess";
|
import { EditAccess } from "../../partials/management/EditAccess";
|
||||||
import { AddUser } from "../partials/management/AddUser";
|
import { AddUser } from "../../partials/management/AddUser";
|
||||||
import ShowStringList from "../components/ShowStringList/ShowStringList";
|
import ShowStringList from "../../components/ShowStringList/ShowStringList";
|
||||||
import ShowMoreInfo from "../components/ShowMoreInfo/ShowMoreInfo";
|
import ShowMoreInfo from "../../components/ShowMoreInfo/ShowMoreInfo";
|
||||||
import AutoComplete from "../components/AutoComplete/AutoComplete";
|
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
||||||
import { useUserProfileStore } from "../context/zustand-store/userStore";
|
import { useUserProfileStore } from "../../context/zustand-store/userStore";
|
||||||
|
|
||||||
type PermissionType = {
|
type PermissionType = {
|
||||||
page_name: string;
|
page_name: string;
|
||||||
@@ -95,7 +95,7 @@ export default function Users() {
|
|||||||
>
|
>
|
||||||
<ShowStringList
|
<ShowStringList
|
||||||
strings={item?.permissions?.map((option: PermissionType) =>
|
strings={item?.permissions?.map((option: PermissionType) =>
|
||||||
getFaPermissions(option?.page_name)
|
getFaPermissions(option?.page_name),
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</ShowMoreInfo>,
|
</ShowMoreInfo>,
|
||||||
@@ -58,13 +58,13 @@ export const Menu = () => {
|
|||||||
const { profile } = useUserProfileStore();
|
const { profile } = useUserProfileStore();
|
||||||
|
|
||||||
const menuItems: ItemWithSubItems[] = getUserPermissions(
|
const menuItems: ItemWithSubItems[] = getUserPermissions(
|
||||||
profile?.permissions
|
profile?.permissions,
|
||||||
);
|
);
|
||||||
|
|
||||||
const getOpenedItem = () => {
|
const getOpenedItem = () => {
|
||||||
if (window.location.pathname !== "/") {
|
if (window.location.pathname !== "/") {
|
||||||
const matchedIndex = menuItems.findIndex((item) =>
|
const matchedIndex = menuItems.findIndex((item) =>
|
||||||
item.subItems.some((sub) => sub.path === window.location.pathname)
|
item.subItems.some((sub) => sub.path === window.location.pathname),
|
||||||
);
|
);
|
||||||
return matchedIndex;
|
return matchedIndex;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -46,14 +46,14 @@ const ProfileCard = ({
|
|||||||
return (
|
return (
|
||||||
<Grid
|
<Grid
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"group relative p-4 transition-all duration-500 hover:-translate-y-1 hover:scale-[1.01]"
|
"group relative p-4 transition-all duration-500 hover:-translate-y-1 hover:scale-[1.01]",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<Grid className="relative flex items-start gap-4">
|
<Grid className="relative flex items-start gap-4">
|
||||||
<Grid
|
<Grid
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"rounded-xl p-3 shadow-lg group-hover:shadow-xl transition-all duration-500 group-hover:scale-110",
|
"rounded-xl p-3 shadow-lg group-hover:shadow-xl transition-all duration-500 group-hover:scale-110",
|
||||||
"bg-primary-600"
|
"bg-primary-600",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<Icon className="h-5 w-5 text-white" />
|
<Icon className="h-5 w-5 text-white" />
|
||||||
@@ -128,12 +128,12 @@ export default function UserProfile() {
|
|||||||
<button
|
<button
|
||||||
onClick={() => setIsDark(!isDark)}
|
onClick={() => setIsDark(!isDark)}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"group relative flex items-center gap-3 rounded-2xl transition-all duration-500 cursor-pointer"
|
"group relative flex items-center gap-3 rounded-2xl transition-all duration-500 cursor-pointer",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<Grid
|
<Grid
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"rounded-xl transition-all duration-500 group-hover:scale-110 bg-transparent"
|
"rounded-xl transition-all duration-500 group-hover:scale-110 bg-transparent",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{isDark ? (
|
{isDark ? (
|
||||||
@@ -153,12 +153,12 @@ export default function UserProfile() {
|
|||||||
navigate({ to: path });
|
navigate({ to: path });
|
||||||
}}
|
}}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"group relative flex items-center gap-3 rounded-2xl transition-all duration-500 cursor-pointer"
|
"group relative flex items-center gap-3 rounded-2xl transition-all duration-500 cursor-pointer",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<Grid
|
<Grid
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"rounded-xl transition-all duration-500 group-hover:scale-110 bg-transparent"
|
"rounded-xl transition-all duration-500 group-hover:scale-110 bg-transparent",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<BookOpenIcon className="h-5 w-5 text-green-500" />
|
<BookOpenIcon className="h-5 w-5 text-green-500" />
|
||||||
@@ -176,12 +176,12 @@ export default function UserProfile() {
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"group relative flex items-center gap-3 rounded-2xl transition-all duration-500 cursor-pointer"
|
"group relative flex items-center gap-3 rounded-2xl transition-all duration-500 cursor-pointer",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<Grid
|
<Grid
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"rounded-xl transition-all duration-500 group-hover:scale-110 bg-transparent"
|
"rounded-xl transition-all duration-500 group-hover:scale-110 bg-transparent",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<ArrowLeftStartOnRectangleIcon className="h-5 w-5 text-red-700" />
|
<ArrowLeftStartOnRectangleIcon className="h-5 w-5 text-red-700" />
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ interface Route {
|
|||||||
|
|
||||||
export const getRoutes = (
|
export const getRoutes = (
|
||||||
auth: string | null,
|
auth: string | null,
|
||||||
roles: ItemWithSubItems[]
|
roles: ItemWithSubItems[],
|
||||||
): Route[] => {
|
): Route[] => {
|
||||||
let generalRoutes: Route[] = auth
|
let generalRoutes: Route[] = auth
|
||||||
? [
|
? [
|
||||||
@@ -34,7 +34,7 @@ export const getRoutes = (
|
|||||||
role?.subItems.map((item) => ({
|
role?.subItems.map((item) => ({
|
||||||
path: item.path,
|
path: item.path,
|
||||||
component: item.component,
|
component: item.component,
|
||||||
}))
|
})),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (roles) {
|
if (roles) {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export function makeRouter(auth: string | null, roles: ItemWithSubItems[]) {
|
|||||||
getParentRoute: () => rootRoute,
|
getParentRoute: () => rootRoute,
|
||||||
path,
|
path,
|
||||||
component,
|
component,
|
||||||
}) as AnyRoute
|
}) as AnyRoute,
|
||||||
);
|
);
|
||||||
|
|
||||||
const notFoundRoute = new Route({
|
const notFoundRoute = new Route({
|
||||||
|
|||||||
@@ -1,30 +1,30 @@
|
|||||||
import Management from "../Pages/Management";
|
import Management from "../Pages/Management";
|
||||||
import * as R from "../routes/paths";
|
import * as R from "../routes/paths";
|
||||||
import Users from "../Pages/Users";
|
import Users from "../Pages/LiveStock/Users";
|
||||||
import Organizations from "../Pages/Organizations";
|
import Organizations from "../Pages/LiveStock/Organizations";
|
||||||
import Roles from "../Pages/Roles";
|
import Roles from "../Pages/LiveStock/Roles";
|
||||||
import Products from "../Pages/Products";
|
import Products from "../Pages/LiveStock/Products";
|
||||||
import { ProductsCategories } from "../Pages/ProductsCategories";
|
import { ProductsCategories } from "../Pages/LiveStock/ProductsCategories";
|
||||||
import Pricing from "../Pages/Pricing";
|
import Pricing from "../Pages/LiveStock/Pricing";
|
||||||
import IncentivePlans from "../Pages/IncentivePlans";
|
import IncentivePlans from "../Pages/LiveStock/IncentivePlans";
|
||||||
import Quota from "../Pages/Quota";
|
import Quota from "../Pages/LiveStock/Quota";
|
||||||
import Inventory from "../Pages/Inventory";
|
import Inventory from "../Pages/LiveStock/Inventory";
|
||||||
import Reporting from "../Pages/Reporting";
|
import Reporting from "../Pages/LiveStock/Reporting";
|
||||||
import LiveStockFarmers from "../Pages/LiveStockFarmers";
|
import LiveStockFarmers from "../Pages/LiveStock/LiveStockFarmers";
|
||||||
import LiveStocks from "../Pages/LiveStocks";
|
import LiveStocks from "../Pages/LiveStock/LiveStocks";
|
||||||
import Herds from "../Pages/Herds";
|
import Herds from "../Pages/LiveStock/Herds";
|
||||||
import Pos from "../Pages/Pos";
|
import Pos from "../Pages/LiveStock/Pos";
|
||||||
import PosCompanies from "../Pages/PosCompanies";
|
import PosCompanies from "../Pages/LiveStock/PosCompanies";
|
||||||
import PosAccounts from "../Pages/PosAccounts";
|
import PosAccounts from "../Pages/LiveStock/PosAccounts";
|
||||||
import RancherPlans from "../Pages/RancherPlans";
|
import RancherPlans from "../Pages/LiveStock/RancherPlans";
|
||||||
import Transactions from "../Pages/Transactions";
|
import Transactions from "../Pages/LiveStock/Transactions";
|
||||||
import Unions from "../Pages/Unions";
|
import Unions from "../Pages/LiveStock/Unions";
|
||||||
import Cooperatives from "../Pages/Cooperatives";
|
import Cooperatives from "../Pages/LiveStock/Cooperatives";
|
||||||
import CooperativeRanchers from "../Pages/CooperativeRanchers";
|
import CooperativeRanchers from "../Pages/LiveStock/CooperativeRanchers";
|
||||||
import SettingsOfUnits from "../Pages/SettingsOfUnits";
|
import SettingsOfUnits from "../Pages/LiveStock/SettingsOfUnits";
|
||||||
import Tagging from "../Pages/Tagging";
|
import Tagging from "../Pages/LiveStock/Tagging";
|
||||||
import TagDistribtution from "../Pages/TagDistribution";
|
import TagDistribtution from "../Pages/LiveStock/TagDistribution";
|
||||||
import TagDistribtutionDetails from "../Pages/TagDistributionDetails";
|
import TagDistribtutionDetails from "../Pages/LiveStock/TagDistributionDetails";
|
||||||
import Tags from "../partials/tagging/Tags";
|
import Tags from "../partials/tagging/Tags";
|
||||||
|
|
||||||
export const managementCategoryItems = [
|
export const managementCategoryItems = [
|
||||||
|
|||||||
Reference in New Issue
Block a user