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