refactor: organized components based on domain
This commit is contained in:
@@ -9,7 +9,7 @@ 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/LiveStock/cooperatives/CooperativesDashboardDetails";
|
||||||
import { DeleteButtonForPopOver } from "../../components/PopOverButtons/PopOverButtons";
|
import { DeleteButtonForPopOver } from "../../components/PopOverButtons/PopOverButtons";
|
||||||
|
|
||||||
export default function CooperativeRanchers() {
|
export default function CooperativeRanchers() {
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ 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/LiveStock/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/LiveStock/cooperatives/CooperativesDashboardDetails";
|
||||||
import { AddActivityType } from "../../partials/cooperatives/AddActivityType";
|
import { AddActivityType } from "../../partials/LiveStock/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";
|
||||||
|
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ 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/LiveStock/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/LiveStock/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/LiveStock/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 });
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ 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/LiveStock/quota/AddIncentivePlan";
|
||||||
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
||||||
|
|
||||||
export default function IncentivePlans() {
|
export default function IncentivePlans() {
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ 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/LiveStock/inventory/InventoryStakeHolderAllocations";
|
||||||
import { InventoryWarehouseEntryTab } from "../../partials/inventory/InventoryWarehouseEntryTab";
|
import { InventoryWarehouseEntryTab } from "../../partials/LiveStock/inventory/InventoryWarehouseEntryTab";
|
||||||
import { useParams } from "@tanstack/react-router";
|
import { useParams } from "@tanstack/react-router";
|
||||||
import { InventoryEntriesList } from "../../partials/inventory/InventoryEntriesList";
|
import { InventoryEntriesList } from "../../partials/LiveStock/inventory/InventoryEntriesList";
|
||||||
|
|
||||||
export default function Inventory() {
|
export default function Inventory() {
|
||||||
const [selectedTab, setSelectedTab] = useState<number>(0);
|
const [selectedTab, setSelectedTab] = useState<number>(0);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ 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/LiveStock/live-stock/LiveStockAddRancher";
|
||||||
import {
|
import {
|
||||||
useDrawerStore,
|
useDrawerStore,
|
||||||
useModalStore,
|
useModalStore,
|
||||||
@@ -11,8 +11,8 @@ import {
|
|||||||
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/LiveStock/live-stock/LiveStockAddHerd";
|
||||||
import { LiveStockAllocateCooperative } from "../../partials/live-stock/LiveStockAllocateCooperative";
|
import { LiveStockAllocateCooperative } from "../../partials/LiveStock/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";
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ 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/LiveStock/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";
|
||||||
|
|||||||
@@ -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/LiveStock/management/OrganizationsList";
|
||||||
import { OrganizationsTypes } from "../../partials/management/OrganizationsTypes";
|
import { OrganizationsTypes } from "../../partials/LiveStock/management/OrganizationsTypes";
|
||||||
|
|
||||||
export default function Organizations() {
|
export default function Organizations() {
|
||||||
const tabItems = [
|
const tabItems = [
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ 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/LiveStock/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/LiveStock/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";
|
||||||
|
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ 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/LiveStock/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/LiveStock/pos/AllocatePos";
|
||||||
import { PosAllocateOrganizationAccount } from "../../partials/pos/PosAllocateOrganizationAccount";
|
import { PosAllocateOrganizationAccount } from "../../partials/LiveStock/pos/PosAllocateOrganizationAccount";
|
||||||
import { AllocateAccountToBroker } from "../../partials/pos/AllocateAccountToBroker";
|
import { AllocateAccountToBroker } from "../../partials/LiveStock/pos/AllocateAccountToBroker";
|
||||||
import { BooleanQuestion } from "../../components/BooleanQuestion/BooleanQuestion";
|
import { BooleanQuestion } from "../../components/BooleanQuestion/BooleanQuestion";
|
||||||
|
|
||||||
export default function PosAccounts() {
|
export default function PosAccounts() {
|
||||||
|
|||||||
@@ -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/LiveStock/feed-input/Attributes";
|
||||||
import { Brokers } from "../../partials/feed-input/Brokers";
|
import { Brokers } from "../../partials/LiveStock/feed-input/Brokers";
|
||||||
import { SaleUnits } from "../../partials/feed-input/SaleUnits";
|
import { SaleUnits } from "../../partials/LiveStock/feed-input/SaleUnits";
|
||||||
const tabItems = [
|
const tabItems = [
|
||||||
{ label: "مولفه" },
|
{ label: "مولفه" },
|
||||||
{ label: "کارگزار" },
|
{ label: "کارگزار" },
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ 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/LiveStock/feed-input/AddProduct";
|
||||||
import { getAbleToSee } from "../../utils/getAbleToSee";
|
import { getAbleToSee } from "../../utils/getAbleToSee";
|
||||||
import { DeleteProduct } from "../../partials/feed-input/DeleteProduct";
|
import { DeleteProduct } from "../../partials/LiveStock/feed-input/DeleteProduct";
|
||||||
|
|
||||||
interface Category {
|
interface Category {
|
||||||
id: number;
|
id: number;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ 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/LiveStock/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/LiveStock/quota/QuotaActives";
|
||||||
import { QuotaClosed } from "../../partials/quota/QuotaClosed";
|
import { QuotaClosed } from "../../partials/LiveStock/quota/QuotaClosed";
|
||||||
import { useParams } from "@tanstack/react-router";
|
import { useParams } from "@tanstack/react-router";
|
||||||
import { QuotaDistributions } from "../../partials/quota/QuotaDistributions";
|
import { QuotaDistributions } from "../../partials/LiveStock/quota/QuotaDistributions";
|
||||||
import { QuotaAllDistributions } from "../../partials/quota/QuotaAllDistributions";
|
import { QuotaAllDistributions } from "../../partials/LiveStock/quota/QuotaAllDistributions";
|
||||||
|
|
||||||
export default function Quota() {
|
export default function Quota() {
|
||||||
const [selectedTab, setSelectedTab] = useState<number>(0);
|
const [selectedTab, setSelectedTab] = useState<number>(0);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ 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/LiveStock/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/LiveStock/quota/QuotaReportingProducts";
|
||||||
import { useParams } from "@tanstack/react-router";
|
import { useParams } from "@tanstack/react-router";
|
||||||
import { QuotaReportingProductDetails } from "../../partials/quota/QuotaReportingProductDetails";
|
import { QuotaReportingProductDetails } from "../../partials/LiveStock/quota/QuotaReportingProductDetails";
|
||||||
import { QuotaReportingQuotaDistributions } from "../../partials/quota/QuotaReportingQuotaDistributions";
|
import { QuotaReportingQuotaDistributions } from "../../partials/LiveStock/quota/QuotaReportingQuotaDistributions";
|
||||||
|
|
||||||
const tabItems = [
|
const tabItems = [
|
||||||
{ label: "محصول" },
|
{ label: "محصول" },
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ 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/LiveStock/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";
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ 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/LiveStock/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/LiveStock/tagging/TagActiveDistributions";
|
||||||
import TagCanceledDistributions from "../../partials/tagging/TagCanceledDistributions";
|
import TagCanceledDistributions from "../../partials/LiveStock/tagging/TagCanceledDistributions";
|
||||||
|
|
||||||
export default function TagDistribtution() {
|
export default function TagDistribtution() {
|
||||||
const [selectedTab, setSelectedTab] = useState<number>(0);
|
const [selectedTab, setSelectedTab] = useState<number>(0);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ 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/LiveStock/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";
|
||||||
|
|||||||
@@ -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/LiveStock/tagging/Taggings";
|
||||||
import Tags from "../../partials/tagging/Tags";
|
import Tags from "../../partials/LiveStock/tagging/Tags";
|
||||||
|
|
||||||
const tabItems = [
|
const tabItems = [
|
||||||
{ label: "ثبت پلاک" },
|
{ label: "ثبت پلاک" },
|
||||||
|
|||||||
@@ -5,14 +5,14 @@ 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/LiveStock/transactions/TransactionDetails";
|
||||||
import {
|
import {
|
||||||
DashboardResponse,
|
DashboardResponse,
|
||||||
ProductSummaryItem,
|
ProductSummaryItem,
|
||||||
} from "../../types/transactions";
|
} from "../../types/transactions";
|
||||||
import { ProductSummaryModal } from "../../partials/transactions/ProductSummaryModal";
|
import { ProductSummaryModal } from "../../partials/LiveStock/transactions/ProductSummaryModal";
|
||||||
import { PaginationParameters } from "../../components/PaginationParameters/PaginationParameters";
|
import { PaginationParameters } from "../../components/PaginationParameters/PaginationParameters";
|
||||||
import TransactionSharingDetails from "../../partials/transactions/TransactionSharingDetails";
|
import TransactionSharingDetails from "../../partials/LiveStock/transactions/TransactionSharingDetails";
|
||||||
import { convertNumberToPersian } from "../../utils/convertNumberToPersian";
|
import { convertNumberToPersian } from "../../utils/convertNumberToPersian";
|
||||||
|
|
||||||
type TransactionResponse = {
|
type TransactionResponse = {
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ 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/Access/EditAccess";
|
||||||
import { AddUser } from "../../partials/management/AddUser";
|
import { AddUser } from "../../partials/LiveStock/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";
|
||||||
|
|||||||
@@ -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 Pages from "../partials/management/Pages";
|
import Pages from "../partials/Access/Pages";
|
||||||
import Access from "../partials/management/Access";
|
import Access from "../partials/Access/Access";
|
||||||
import UnusedAccess from "../partials/management/UnusedAccess";
|
import UnusedAccess from "../partials/Access/UnusedAccess";
|
||||||
|
|
||||||
const tabItems = [
|
const tabItems = [
|
||||||
{ label: "صفحات" },
|
{ label: "صفحات" },
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import { Grid } from "../components/Grid/Grid";
|
|||||||
import { useDarkMode } from "../hooks/useDarkMode";
|
import { useDarkMode } from "../hooks/useDarkMode";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { useModalStore } from "../context/zustand-store/appStore";
|
import { useModalStore } from "../context/zustand-store/appStore";
|
||||||
import { Logout } from "../partials/auth/Logout";
|
import { Logout } from "../partials/Auth/Logout";
|
||||||
import { useUserProfileStore } from "../context/zustand-store/userStore";
|
import { useUserProfileStore } from "../context/zustand-store/userStore";
|
||||||
import { formatJustDate } from "../utils/formatTime";
|
import { formatJustDate } from "../utils/formatTime";
|
||||||
import bg from "../assets/images/profile-bg.png";
|
import bg from "../assets/images/profile-bg.png";
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export const AddAccess = ({ getData, item }: AddAccessProps) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (pagesData?.results && item?.page) {
|
if (pagesData?.results && item?.page) {
|
||||||
const matchingPage = pagesData.results.find(
|
const matchingPage = pagesData.results.find(
|
||||||
(page: any) => page.name === item.page
|
(page: any) => page.name === item.page,
|
||||||
);
|
);
|
||||||
if (matchingPage) {
|
if (matchingPage) {
|
||||||
const keys = [matchingPage.id];
|
const keys = [matchingPage.id];
|
||||||
@@ -52,11 +52,11 @@ export const EditAccess = ({ getData, item }: AddAccessProps) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (accessData?.results && item?.permissions) {
|
if (accessData?.results && item?.permissions) {
|
||||||
const permissionPageAccesses = item.permissions.flatMap(
|
const permissionPageAccesses = item.permissions.flatMap(
|
||||||
(option: any) => option.page_access || []
|
(option: any) => option.page_access || [],
|
||||||
);
|
);
|
||||||
|
|
||||||
const matchingPages = accessData.results.filter((page: any) =>
|
const matchingPages = accessData.results.filter((page: any) =>
|
||||||
permissionPageAccesses.includes(page.name)
|
permissionPageAccesses.includes(page.name),
|
||||||
);
|
);
|
||||||
|
|
||||||
const matchingIds = matchingPages.map((page: any) => page.id);
|
const matchingIds = matchingPages.map((page: any) => page.id);
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
zValidateAutoComplete,
|
zValidateAutoComplete,
|
||||||
zValidateString,
|
zValidateString,
|
||||||
} from "../../data/getFormTypeErrors";
|
} from "../../../data/getFormTypeErrors";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { useApiMutation, useApiRequest } from "../../utils/useApiRequest";
|
import { useApiMutation, useApiRequest } from "../../../utils/useApiRequest";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
import AutoComplete from "../../../components/AutoComplete/AutoComplete";
|
||||||
import { getToastResponse } from "../../data/getToastResponse";
|
import { getToastResponse } from "../../../data/getToastResponse";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
|
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
@@ -107,7 +107,7 @@ export const AddActivityType = ({ getData, item }: AddActivityTypeProps) => {
|
|||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
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";
|
||||||
|
|
||||||
interface ChildOrganizationsProps {
|
interface ChildOrganizationsProps {
|
||||||
orgId: number;
|
orgId: number;
|
||||||
@@ -40,7 +40,7 @@ export const ChildOrganizations: React.FC<ChildOrganizationsProps> = ({
|
|||||||
item?.national_unique_id || "-",
|
item?.national_unique_id || "-",
|
||||||
item?.address || "-",
|
item?.address || "-",
|
||||||
];
|
];
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
setChildOrgsTableData(formattedData);
|
setChildOrgsTableData(formattedData);
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useApiRequest } from "../../utils/useApiRequest";
|
import { useApiRequest } from "../../../utils/useApiRequest";
|
||||||
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 { ShowWeight } from "../../components/ShowWeight/ShowWeight";
|
import { ShowWeight } from "../../../components/ShowWeight/ShowWeight";
|
||||||
|
|
||||||
interface QuotaDashboardByProduct {
|
interface QuotaDashboardByProduct {
|
||||||
quotas_count: string;
|
quotas_count: string;
|
||||||
@@ -3,19 +3,19 @@ import {
|
|||||||
zValidateAutoComplete,
|
zValidateAutoComplete,
|
||||||
zValidateAutoCompleteOptional,
|
zValidateAutoCompleteOptional,
|
||||||
zValidateString,
|
zValidateString,
|
||||||
} from "../../data/getFormTypeErrors";
|
} from "../../../data/getFormTypeErrors";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import { getToastResponse } from "../../data/getToastResponse";
|
import { getToastResponse } from "../../../data/getToastResponse";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { RadioGroup } from "../../components/RadioButton/RadioGroup";
|
import { RadioGroup } from "../../../components/RadioButton/RadioGroup";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { FormApiBasedAutoComplete } from "../../components/FormItems/FormApiBasedAutoComplete";
|
import { FormApiBasedAutoComplete } from "../../../components/FormItems/FormApiBasedAutoComplete";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
getData: () => void;
|
getData: () => void;
|
||||||
@@ -82,7 +82,7 @@ export const AddAttribute = ({ getData, item }: Props) => {
|
|||||||
} else {
|
} else {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
zValidateAutoComplete,
|
zValidateAutoComplete,
|
||||||
@@ -9,17 +9,17 @@ import {
|
|||||||
zValidateNumber,
|
zValidateNumber,
|
||||||
zValidateNumberOptional,
|
zValidateNumberOptional,
|
||||||
zValidateString,
|
zValidateString,
|
||||||
} from "../../data/getFormTypeErrors";
|
} from "../../../data/getFormTypeErrors";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
import { getToastResponse } from "../../data/getToastResponse";
|
import { getToastResponse } from "../../../data/getToastResponse";
|
||||||
import { FormApiBasedAutoComplete } from "../../components/FormItems/FormApiBasedAutoComplete";
|
import { FormApiBasedAutoComplete } from "../../../components/FormItems/FormApiBasedAutoComplete";
|
||||||
import { RadioGroup } from "../../components/RadioButton/RadioGroup";
|
import { RadioGroup } from "../../../components/RadioButton/RadioGroup";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { checkAccess } from "../../utils/checkAccess";
|
import { checkAccess } from "../../../utils/checkAccess";
|
||||||
import Checkbox from "../../components/CheckBox/CheckBox";
|
import Checkbox from "../../../components/CheckBox/CheckBox";
|
||||||
|
|
||||||
type AddPageProps = {
|
type AddPageProps = {
|
||||||
getData: () => void;
|
getData: () => void;
|
||||||
@@ -47,7 +47,7 @@ export const AddBroker = ({ getData, item }: AddPageProps) => {
|
|||||||
const { closeModal } = useModalStore();
|
const { closeModal } = useModalStore();
|
||||||
|
|
||||||
const [isGlobal, setIsGlobal] = useState(
|
const [isGlobal, setIsGlobal] = useState(
|
||||||
item?.broker_type === "exclusive" ? false : true
|
item?.broker_type === "exclusive" ? false : true,
|
||||||
);
|
);
|
||||||
const [isRequired, setIsRequired] = useState(item ? item?.required : true);
|
const [isRequired, setIsRequired] = useState(item ? item?.required : true);
|
||||||
|
|
||||||
@@ -114,12 +114,12 @@ export const AddBroker = ({ getData, item }: AddPageProps) => {
|
|||||||
if (error?.status === 403) {
|
if (error?.status === 403) {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "این مورد تکراری است!",
|
error?.response?.data?.message || "این مورد تکراری است!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
zValidateAutoComplete,
|
zValidateAutoComplete,
|
||||||
zValidateNumber,
|
zValidateNumber,
|
||||||
zValidateString,
|
zValidateString,
|
||||||
} from "../../data/getFormTypeErrors";
|
} from "../../../data/getFormTypeErrors";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
import { getToastResponse } from "../../data/getToastResponse";
|
import { getToastResponse } from "../../../data/getToastResponse";
|
||||||
import { FormApiBasedAutoComplete } from "../../components/FormItems/FormApiBasedAutoComplete";
|
import { FormApiBasedAutoComplete } from "../../../components/FormItems/FormApiBasedAutoComplete";
|
||||||
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
import AutoComplete from "../../../components/AutoComplete/AutoComplete";
|
||||||
import { ImageUploader } from "../../components/ImageUploader/ImageUploader";
|
import { ImageUploader } from "../../../components/ImageUploader/ImageUploader";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
@@ -74,12 +74,12 @@ export const AddProduct = ({ getData, item }: AddPageProps) => {
|
|||||||
if (error?.status === 403) {
|
if (error?.status === 403) {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "این مورد تکراری است!",
|
error?.response?.data?.message || "این مورد تکراری است!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
import { zValidateString } from "../../data/getFormTypeErrors";
|
import { zValidateString } from "../../../data/getFormTypeErrors";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
import { getToastResponse } from "../../data/getToastResponse";
|
import { getToastResponse } from "../../../data/getToastResponse";
|
||||||
|
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
name: zValidateString("نام "),
|
name: zValidateString("نام "),
|
||||||
@@ -53,12 +53,12 @@ export const AddProductCategory = ({ getData, item }: AddPageProps) => {
|
|||||||
if (error?.status === 403) {
|
if (error?.status === 403) {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "این مورد تکراری است!",
|
error?.response?.data?.message || "این مورد تکراری است!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
import { zValidateString } from "../../data/getFormTypeErrors";
|
import { zValidateString } from "../../../data/getFormTypeErrors";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
|
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
unit: zValidateString("نام واحد فروش"),
|
unit: zValidateString("نام واحد فروش"),
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
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 { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { motion } from "framer-motion";
|
import { motion } from "framer-motion";
|
||||||
import SVGImage from "../../components/SvgImage/SvgImage";
|
import SVGImage from "../../../components/SvgImage/SvgImage";
|
||||||
import editIcon from "../../assets/images/svg/edit.svg?react";
|
import editIcon from "../../../assets/images/svg/edit.svg?react";
|
||||||
import trashIcon from "../../assets/images/svg/trash.svg?react";
|
import trashIcon from "../../../assets/images/svg/trash.svg?react";
|
||||||
import { AddAttribute } from "./AddAttribute";
|
import { AddAttribute } from "./AddAttribute";
|
||||||
import { NoData } from "../../components/NoData/NoData";
|
import { NoData } from "../../../components/NoData/NoData";
|
||||||
import { PageTitle } from "../../components/PageTitle/PageTitle";
|
import { PageTitle } from "../../../components/PageTitle/PageTitle";
|
||||||
import { checkAccess } from "../../utils/checkAccess";
|
import { checkAccess } from "../../../utils/checkAccess";
|
||||||
import { BooleanQuestion } from "../../components/BooleanQuestion/BooleanQuestion";
|
import { BooleanQuestion } from "../../../components/BooleanQuestion/BooleanQuestion";
|
||||||
|
|
||||||
export const Attributes = () => {
|
export const Attributes = () => {
|
||||||
const { openModal } = useModalStore();
|
const { openModal } = useModalStore();
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
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 { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { motion } from "framer-motion";
|
import { motion } from "framer-motion";
|
||||||
import SVGImage from "../../components/SvgImage/SvgImage";
|
import SVGImage from "../../../components/SvgImage/SvgImage";
|
||||||
import editIcon from "../../assets/images/svg/edit.svg?react";
|
import editIcon from "../../../assets/images/svg/edit.svg?react";
|
||||||
import { AddBroker } from "./AddBroker";
|
import { AddBroker } from "./AddBroker";
|
||||||
import { NoData } from "../../components/NoData/NoData";
|
import { NoData } from "../../../components/NoData/NoData";
|
||||||
import { PageTitle } from "../../components/PageTitle/PageTitle";
|
import { PageTitle } from "../../../components/PageTitle/PageTitle";
|
||||||
import { checkAccess } from "../../utils/checkAccess";
|
import { checkAccess } from "../../../utils/checkAccess";
|
||||||
import { BooleanQuestion } from "../../components/BooleanQuestion/BooleanQuestion";
|
import { BooleanQuestion } from "../../../components/BooleanQuestion/BooleanQuestion";
|
||||||
import trashIcon from "../../assets/images/svg/trash.svg?react";
|
import trashIcon from "../../../assets/images/svg/trash.svg?react";
|
||||||
|
|
||||||
export const Brokers = () => {
|
export const Brokers = () => {
|
||||||
const { openModal } = useModalStore();
|
const { openModal } = useModalStore();
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import { motion } from "framer-motion";
|
import { motion } from "framer-motion";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
item: any;
|
item: any;
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
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 { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { motion } from "framer-motion";
|
import { motion } from "framer-motion";
|
||||||
import SVGImage from "../../components/SvgImage/SvgImage";
|
import SVGImage from "../../../components/SvgImage/SvgImage";
|
||||||
import editIcon from "../../assets/images/svg/edit.svg?react";
|
import editIcon from "../../../assets/images/svg/edit.svg?react";
|
||||||
import { AddSaleUnit } from "./AddSaleUnit";
|
import { AddSaleUnit } from "./AddSaleUnit";
|
||||||
import { NoData } from "../../components/NoData/NoData";
|
import { NoData } from "../../../components/NoData/NoData";
|
||||||
import { PageTitle } from "../../components/PageTitle/PageTitle";
|
import { PageTitle } from "../../../components/PageTitle/PageTitle";
|
||||||
import { checkAccess } from "../../utils/checkAccess";
|
import { checkAccess } from "../../../utils/checkAccess";
|
||||||
import { BooleanQuestion } from "../../components/BooleanQuestion/BooleanQuestion";
|
import { BooleanQuestion } from "../../../components/BooleanQuestion/BooleanQuestion";
|
||||||
import trashIcon from "../../assets/images/svg/trash.svg?react";
|
import trashIcon from "../../../assets/images/svg/trash.svg?react";
|
||||||
|
|
||||||
export const SaleUnits = () => {
|
export const SaleUnits = () => {
|
||||||
const { openModal } = useModalStore();
|
const { openModal } = useModalStore();
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
import { useParams } from "@tanstack/react-router";
|
import { useParams } from "@tanstack/react-router";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useApiRequest } from "../../utils/useApiRequest";
|
import { useApiRequest } from "../../../utils/useApiRequest";
|
||||||
import Table from "../../components/Table/Table";
|
import Table from "../../../components/Table/Table";
|
||||||
import { formatJustDate, formatJustTime } from "../../utils/formatTime";
|
import { formatJustDate, formatJustTime } from "../../../utils/formatTime";
|
||||||
import { ShowWeight } from "../../components/ShowWeight/ShowWeight";
|
import { ShowWeight } from "../../../components/ShowWeight/ShowWeight";
|
||||||
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 { QuotaDistributionEntryInventory } from "../quota/QuotaDistributionEntryInventory";
|
import { QuotaDistributionEntryInventory } from "../quota/QuotaDistributionEntryInventory";
|
||||||
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 { DocumentDownloader } from "../../components/DocumentDownloader/DocumentDownloader";
|
import { DocumentDownloader } from "../../../components/DocumentDownloader/DocumentDownloader";
|
||||||
|
|
||||||
const formatGroupNames = (groups?: any[]) =>
|
const formatGroupNames = (groups?: any[]) =>
|
||||||
groups
|
groups
|
||||||
@@ -19,8 +19,8 @@ const formatGroupNames = (groups?: any[]) =>
|
|||||||
group === "rural"
|
group === "rural"
|
||||||
? "روستایی"
|
? "روستایی"
|
||||||
: group === "industrial"
|
: group === "industrial"
|
||||||
? "صنعتی"
|
? "صنعتی"
|
||||||
: "عشایری"
|
: "عشایری",
|
||||||
)
|
)
|
||||||
.join(", ");
|
.join(", ");
|
||||||
|
|
||||||
@@ -28,10 +28,10 @@ const formatDeviceSaleType = (value?: string) =>
|
|||||||
value === "all"
|
value === "all"
|
||||||
? "بر اساس تعداد راس دام و وزن"
|
? "بر اساس تعداد راس دام و وزن"
|
||||||
: value === "weight"
|
: value === "weight"
|
||||||
? "بر اساس وزن"
|
? "بر اساس وزن"
|
||||||
: value === "count"
|
: value === "count"
|
||||||
? "بر اساس تعداد راس دام"
|
? "بر اساس تعداد راس دام"
|
||||||
: "-";
|
: "-";
|
||||||
|
|
||||||
export const InventoryEntriesList = () => {
|
export const InventoryEntriesList = () => {
|
||||||
const params = useParams({ strict: false });
|
const params = useParams({ strict: false });
|
||||||
@@ -73,7 +73,7 @@ export const InventoryEntriesList = () => {
|
|||||||
? i + 1
|
? i + 1
|
||||||
: i + pagesInfo.page_size * (pagesInfo.page - 1) + 1,
|
: i + pagesInfo.page_size * (pagesInfo.page - 1) + 1,
|
||||||
`${formatJustDate(item?.create_date)} (${formatJustTime(
|
`${formatJustDate(item?.create_date)} (${formatJustTime(
|
||||||
item?.create_date
|
item?.create_date,
|
||||||
)})`,
|
)})`,
|
||||||
<ShowWeight
|
<ShowWeight
|
||||||
key={i}
|
key={i}
|
||||||
@@ -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 { formatJustDate, formatJustTime } from "../../utils/formatTime";
|
import { formatJustDate, formatJustTime } from "../../../utils/formatTime";
|
||||||
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 { ShowWeight } from "../../components/ShowWeight/ShowWeight";
|
import { ShowWeight } from "../../../components/ShowWeight/ShowWeight";
|
||||||
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 { BarsArrowUpIcon } from "@heroicons/react/24/outline";
|
import { BarsArrowUpIcon } from "@heroicons/react/24/outline";
|
||||||
import { QuotaAllocateToStakeHolders } from "../quota/QuotaAllocateToStakeHolders";
|
import { QuotaAllocateToStakeHolders } from "../quota/QuotaAllocateToStakeHolders";
|
||||||
import { Popover } from "../../components/PopOver/PopOver";
|
import { Popover } from "../../../components/PopOver/PopOver";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
import { DeleteButtonForPopOver } from "../../components/PopOverButtons/PopOverButtons";
|
import { DeleteButtonForPopOver } from "../../../components/PopOverButtons/PopOverButtons";
|
||||||
|
|
||||||
export const InventoryStakeHolderAllocations = () => {
|
export const InventoryStakeHolderAllocations = () => {
|
||||||
const { openModal } = useModalStore();
|
const { openModal } = useModalStore();
|
||||||
@@ -34,7 +34,7 @@ export const InventoryStakeHolderAllocations = () => {
|
|||||||
item?.quota_distribution?.distribution_id,
|
item?.quota_distribution?.distribution_id,
|
||||||
item?.quota_distribution?.quota?.quota_id,
|
item?.quota_distribution?.quota?.quota_id,
|
||||||
`${formatJustDate(item?.create_date)} (${formatJustTime(
|
`${formatJustDate(item?.create_date)} (${formatJustTime(
|
||||||
item?.quota_distribution?.create_date
|
item?.quota_distribution?.create_date,
|
||||||
)})`,
|
)})`,
|
||||||
item?.quota_distribution?.assigner_organization?.organization,
|
item?.quota_distribution?.assigner_organization?.organization,
|
||||||
item?.quota_distribution?.assigned_organization?.organization,
|
item?.quota_distribution?.assigned_organization?.organization,
|
||||||
@@ -1,24 +1,24 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useApiRequest } from "../../utils/useApiRequest";
|
import { useApiRequest } from "../../../utils/useApiRequest";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
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 { ShowWeight } from "../../components/ShowWeight/ShowWeight";
|
import { ShowWeight } from "../../../components/ShowWeight/ShowWeight";
|
||||||
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 { ListBulletIcon } from "@heroicons/react/24/outline";
|
import { ListBulletIcon } from "@heroicons/react/24/outline";
|
||||||
import { INVENTORY } from "../../routes/paths";
|
import { INVENTORY } from "../../../routes/paths";
|
||||||
import { useNavigate } from "@tanstack/react-router";
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
import { PaginationParameters } from "../../components/PaginationParameters/PaginationParameters";
|
import { PaginationParameters } from "../../../components/PaginationParameters/PaginationParameters";
|
||||||
|
|
||||||
const formatDeviceSaleType = (value?: string) =>
|
const formatDeviceSaleType = (value?: string) =>
|
||||||
value === "all"
|
value === "all"
|
||||||
? "بر اساس تعداد راس دام و وزن"
|
? "بر اساس تعداد راس دام و وزن"
|
||||||
: value === "weight"
|
: value === "weight"
|
||||||
? "بر اساس وزن"
|
? "بر اساس وزن"
|
||||||
: value === "count"
|
: value === "count"
|
||||||
? "بر اساس تعداد راس دام"
|
? "بر اساس تعداد راس دام"
|
||||||
: "-";
|
: "-";
|
||||||
|
|
||||||
export const InventoryWarehouseEntryTab = () => {
|
export const InventoryWarehouseEntryTab = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -62,8 +62,8 @@ export const InventoryWarehouseEntryTab = () => {
|
|||||||
group === "rural"
|
group === "rural"
|
||||||
? "روستایی"
|
? "روستایی"
|
||||||
: group === "industrial"
|
: group === "industrial"
|
||||||
? "صنعتی"
|
? "صنعتی"
|
||||||
: "عشایری"
|
: "عشایری",
|
||||||
)
|
)
|
||||||
.join(", ");
|
.join(", ");
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ export const InventoryWarehouseEntryTab = () => {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Popover>,
|
</Popover>,
|
||||||
];
|
];
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
setPagesTableData(formattedData);
|
setPagesTableData(formattedData);
|
||||||
}
|
}
|
||||||
@@ -1,23 +1,23 @@
|
|||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
zValidateNumber,
|
zValidateNumber,
|
||||||
zValidateNumberOptional,
|
zValidateNumberOptional,
|
||||||
zValidateString,
|
zValidateString,
|
||||||
} from "../../data/getFormTypeErrors";
|
} from "../../../data/getFormTypeErrors";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useDrawerStore } from "../../context/zustand-store/appStore";
|
import { useDrawerStore } from "../../../context/zustand-store/appStore";
|
||||||
import { getToastResponse } from "../../data/getToastResponse";
|
import { getToastResponse } from "../../../data/getToastResponse";
|
||||||
import { RadioGroup } from "../../components/RadioButton/RadioGroup";
|
import { RadioGroup } from "../../../components/RadioButton/RadioGroup";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { FormEnterLocations } from "../../components/FormItems/FormEnterLocation";
|
import { FormEnterLocations } from "../../../components/FormItems/FormEnterLocation";
|
||||||
import { FormApiBasedAutoComplete } from "../../components/FormItems/FormApiBasedAutoComplete";
|
import { FormApiBasedAutoComplete } from "../../../components/FormItems/FormApiBasedAutoComplete";
|
||||||
import { useUserProfileStore } from "../../context/zustand-store/userStore";
|
import { useUserProfileStore } from "../../../context/zustand-store/userStore";
|
||||||
|
|
||||||
type AddPageProps = {
|
type AddPageProps = {
|
||||||
getData: () => void;
|
getData: () => void;
|
||||||
@@ -71,10 +71,10 @@ export const LiveStockAddHerd = ({ getData, item, rancher }: AddPageProps) => {
|
|||||||
const [activityType, setActivityType] = useState(item?.activity || "V");
|
const [activityType, setActivityType] = useState(item?.activity || "V");
|
||||||
|
|
||||||
const [activityState, setActivityState] = useState(
|
const [activityState, setActivityState] = useState(
|
||||||
item ? item?.activity_state : true
|
item ? item?.activity_state : true,
|
||||||
);
|
);
|
||||||
const [operatingLicenseState, setOperatingLicenseState] = useState(
|
const [operatingLicenseState, setOperatingLicenseState] = useState(
|
||||||
item ? item?.operating_license_state : true
|
item ? item?.operating_license_state : true,
|
||||||
);
|
);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -137,12 +137,12 @@ export const LiveStockAddHerd = ({ getData, item, rancher }: AddPageProps) => {
|
|||||||
if (error?.status === 403) {
|
if (error?.status === 403) {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "این مورد تکراری است!",
|
error?.response?.data?.message || "این مورد تکراری است!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
zValidateNumber,
|
zValidateNumber,
|
||||||
zValidateNumberOptional,
|
zValidateNumberOptional,
|
||||||
zValidateString,
|
zValidateString,
|
||||||
} from "../../data/getFormTypeErrors";
|
} from "../../../data/getFormTypeErrors";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useDrawerStore } from "../../context/zustand-store/appStore";
|
import { useDrawerStore } from "../../../context/zustand-store/appStore";
|
||||||
import { getToastResponse } from "../../data/getToastResponse";
|
import { getToastResponse } from "../../../data/getToastResponse";
|
||||||
import { RadioGroup } from "../../components/RadioButton/RadioGroup";
|
import { RadioGroup } from "../../../components/RadioButton/RadioGroup";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { FormApiBasedAutoComplete } from "../../components/FormItems/FormApiBasedAutoComplete";
|
import { FormApiBasedAutoComplete } from "../../../components/FormItems/FormApiBasedAutoComplete";
|
||||||
import DatePicker from "../../components/date-picker/DatePicker";
|
import DatePicker from "../../../components/date-picker/DatePicker";
|
||||||
|
|
||||||
type AddPageProps = {
|
type AddPageProps = {
|
||||||
getData: () => void;
|
getData: () => void;
|
||||||
@@ -51,7 +51,7 @@ export const LiveStockAddLiveStock = ({
|
|||||||
const { closeDrawer } = useDrawerStore();
|
const { closeDrawer } = useDrawerStore();
|
||||||
const [gender, setGender] = useState(item?.gender || 1);
|
const [gender, setGender] = useState(item?.gender || 1);
|
||||||
const [weightType, setWeightType] = useState(
|
const [weightType, setWeightType] = useState(
|
||||||
item?.weight_type === "H" ? "H" : "L"
|
item?.weight_type === "H" ? "H" : "L",
|
||||||
);
|
);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -92,12 +92,12 @@ export const LiveStockAddLiveStock = ({
|
|||||||
if (error?.status === 403) {
|
if (error?.status === 403) {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "این مورد تکراری است!",
|
error?.response?.data?.message || "این مورد تکراری است!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
zValidateAutoComplete,
|
zValidateAutoComplete,
|
||||||
@@ -10,16 +10,16 @@ import {
|
|||||||
zValidateNumber,
|
zValidateNumber,
|
||||||
zValidateString,
|
zValidateString,
|
||||||
zValidateStringOptional,
|
zValidateStringOptional,
|
||||||
} from "../../data/getFormTypeErrors";
|
} from "../../../data/getFormTypeErrors";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useDrawerStore } from "../../context/zustand-store/appStore";
|
import { useDrawerStore } from "../../../context/zustand-store/appStore";
|
||||||
import { getToastResponse } from "../../data/getToastResponse";
|
import { getToastResponse } from "../../../data/getToastResponse";
|
||||||
import { FormEnterLocations } from "../../components/FormItems/FormEnterLocation";
|
import { FormEnterLocations } from "../../../components/FormItems/FormEnterLocation";
|
||||||
import { RadioGroup } from "../../components/RadioButton/RadioGroup";
|
import { RadioGroup } from "../../../components/RadioButton/RadioGroup";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
import AutoComplete from "../../../components/AutoComplete/AutoComplete";
|
||||||
|
|
||||||
type AddPageProps = {
|
type AddPageProps = {
|
||||||
getData: () => void;
|
getData: () => void;
|
||||||
@@ -67,7 +67,7 @@ export const LiveStockAddRancher = ({ getData, item }: AddPageProps) => {
|
|||||||
{
|
{
|
||||||
message: "نام واحد حقوقی نمیتواند خالی باشد",
|
message: "نام واحد حقوقی نمیتواند خالی باشد",
|
||||||
path: ["union_name"],
|
path: ["union_name"],
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.refine(
|
.refine(
|
||||||
(data) => {
|
(data) => {
|
||||||
@@ -79,7 +79,7 @@ export const LiveStockAddRancher = ({ getData, item }: AddPageProps) => {
|
|||||||
{
|
{
|
||||||
message: "شناسه ملی واحد حقوقی نمیتواند خالی باشد",
|
message: "شناسه ملی واحد حقوقی نمیتواند خالی باشد",
|
||||||
path: ["union_code"],
|
path: ["union_code"],
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
type FormValues = z.infer<typeof schema>;
|
type FormValues = z.infer<typeof schema>;
|
||||||
@@ -90,7 +90,7 @@ export const LiveStockAddRancher = ({ getData, item }: AddPageProps) => {
|
|||||||
const [activityType, setActivityType] = useState(item?.activity || "V");
|
const [activityType, setActivityType] = useState(item?.activity || "V");
|
||||||
|
|
||||||
const [rancherHerdType, setRancherHerdType] = useState(
|
const [rancherHerdType, setRancherHerdType] = useState(
|
||||||
item ? item?.without_herd : false
|
item ? item?.without_herd : false,
|
||||||
);
|
);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -149,12 +149,12 @@ export const LiveStockAddRancher = ({ getData, item }: AddPageProps) => {
|
|||||||
if (error?.status === 403) {
|
if (error?.status === 403) {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "این مورد تکراری است!",
|
error?.response?.data?.message || "این مورد تکراری است!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { zValidateAutoComplete } from "../../data/getFormTypeErrors";
|
import { zValidateAutoComplete } from "../../../data/getFormTypeErrors";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import { getToastResponse } from "../../data/getToastResponse";
|
import { getToastResponse } from "../../../data/getToastResponse";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { FormApiBasedAutoComplete } from "../../components/FormItems/FormApiBasedAutoComplete";
|
import { FormApiBasedAutoComplete } from "../../../components/FormItems/FormApiBasedAutoComplete";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
getData: () => void;
|
getData: () => void;
|
||||||
@@ -57,7 +57,7 @@ export const LiveStockAllocateCooperative = ({ getData, item }: Props) => {
|
|||||||
} else {
|
} else {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
TruckIcon,
|
TruckIcon,
|
||||||
UserIcon,
|
UserIcon,
|
||||||
} from "@heroicons/react/24/outline";
|
} from "@heroicons/react/24/outline";
|
||||||
import { useApiRequest } from "../../utils/useApiRequest";
|
import { useApiRequest } from "../../../utils/useApiRequest";
|
||||||
|
|
||||||
export const LiveStockHerdDetails = ({
|
export const LiveStockHerdDetails = ({
|
||||||
farmid,
|
farmid,
|
||||||
@@ -23,7 +23,7 @@ export const LiveStockHerdDetails = ({
|
|||||||
Record<number, boolean>
|
Record<number, boolean>
|
||||||
>({});
|
>({});
|
||||||
const [expandedItems, setExpandedItems] = useState<Record<string, boolean>>(
|
const [expandedItems, setExpandedItems] = useState<Record<string, boolean>>(
|
||||||
{}
|
{},
|
||||||
);
|
);
|
||||||
|
|
||||||
const { data: herdData } = useApiRequest({
|
const { data: herdData } = useApiRequest({
|
||||||
@@ -237,12 +237,12 @@ export const LiveStockHerdDetails = ({
|
|||||||
{item?.by_type?.length > 0 &&
|
{item?.by_type?.length > 0 &&
|
||||||
item?.by_type
|
item?.by_type
|
||||||
.filter(
|
.filter(
|
||||||
(animal: any) => animal.weight > 0
|
(animal: any) => animal.weight > 0,
|
||||||
)
|
)
|
||||||
.map(
|
.map(
|
||||||
(
|
(
|
||||||
animal: any,
|
animal: any,
|
||||||
animalIndex: number
|
animalIndex: number,
|
||||||
) => (
|
) => (
|
||||||
<motion.div
|
<motion.div
|
||||||
key={animal.name}
|
key={animal.name}
|
||||||
@@ -261,23 +261,23 @@ export const LiveStockHerdDetails = ({
|
|||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
className={`text-xs px-2 py-1 rounded-full ${getAnimalTypeColor(
|
className={`text-xs px-2 py-1 rounded-full ${getAnimalTypeColor(
|
||||||
animal.type
|
animal.type,
|
||||||
)}`}
|
)}`}
|
||||||
>
|
>
|
||||||
{getAnimalTypeText(
|
{getAnimalTypeText(
|
||||||
animal.type
|
animal.type,
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<p className="text-lg font-bold text-gray-800 dark:text-gray-200 mt-2">
|
<p className="text-lg font-bold text-gray-800 dark:text-gray-200 mt-2">
|
||||||
{formatWeight(
|
{formatWeight(
|
||||||
animal.weight
|
animal.weight,
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
)
|
),
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
import { useApiMutation, useApiRequest } from "../../utils/useApiRequest";
|
import { useApiMutation, useApiRequest } from "../../../utils/useApiRequest";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
import AutoComplete from "../../../components/AutoComplete/AutoComplete";
|
||||||
import { FormApiBasedAutoComplete } from "../../components/FormItems/FormApiBasedAutoComplete";
|
import { FormApiBasedAutoComplete } from "../../../components/FormItems/FormApiBasedAutoComplete";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
getData: () => void;
|
getData: () => void;
|
||||||
@@ -1,35 +1,35 @@
|
|||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
zValidateBigNumber,
|
zValidateBigNumber,
|
||||||
zValidateNumber,
|
zValidateNumber,
|
||||||
zValidateNumberOptional,
|
zValidateNumberOptional,
|
||||||
zValidateStringOptional,
|
zValidateStringOptional,
|
||||||
} from "../../data/getFormTypeErrors";
|
} from "../../../data/getFormTypeErrors";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
import { getToastResponse } from "../../data/getToastResponse";
|
import { getToastResponse } from "../../../data/getToastResponse";
|
||||||
import Typography from "../../components/Typography/Typography";
|
import Typography from "../../../components/Typography/Typography";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import ansar from "../../assets/images/banks/ansar.png";
|
import ansar from "../../../assets/images/banks/ansar.png";
|
||||||
import ayandeh from "../../assets/images/banks/ayandeh.png";
|
import ayandeh from "../../../assets/images/banks/ayandeh.png";
|
||||||
import eghtesadNovin from "../../assets/images/banks/eghtesad-novin.png";
|
import eghtesadNovin from "../../../assets/images/banks/eghtesad-novin.png";
|
||||||
import keshavarzi from "../../assets/images/banks/keshavarzi.png";
|
import keshavarzi from "../../../assets/images/banks/keshavarzi.png";
|
||||||
import maskan from "../../assets/images/banks/maskan.png";
|
import maskan from "../../../assets/images/banks/maskan.png";
|
||||||
import mehriran from "../../assets/images/banks/mehriran.png";
|
import mehriran from "../../../assets/images/banks/mehriran.png";
|
||||||
import meli from "../../assets/images/banks/meli.png";
|
import meli from "../../../assets/images/banks/meli.png";
|
||||||
import mellat from "../../assets/images/banks/mellat.png";
|
import mellat from "../../../assets/images/banks/mellat.png";
|
||||||
import pasargad from "../../assets/images/banks/pasargad.png";
|
import pasargad from "../../../assets/images/banks/pasargad.png";
|
||||||
import saderat from "../../assets/images/banks/saderat.png";
|
import saderat from "../../../assets/images/banks/saderat.png";
|
||||||
import saman from "../../assets/images/banks/saman.png";
|
import saman from "../../../assets/images/banks/saman.png";
|
||||||
import sina from "../../assets/images/banks/sina.png";
|
import sina from "../../../assets/images/banks/sina.png";
|
||||||
import tejarat from "../../assets/images/banks/tejarat.png";
|
import tejarat from "../../../assets/images/banks/tejarat.png";
|
||||||
import toseeTavon from "../../assets/images/banks/tosee-tavon.png";
|
import toseeTavon from "../../../assets/images/banks/tosee-tavon.png";
|
||||||
|
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
name: zValidateStringOptional("بانک"),
|
name: zValidateStringOptional("بانک"),
|
||||||
@@ -112,7 +112,7 @@ export const AddCard = ({ getData, item, target }: AddPageProps) => {
|
|||||||
const foundBank =
|
const foundBank =
|
||||||
cardToBank[
|
cardToBank[
|
||||||
Object.keys(cardToBank).find((prefix) =>
|
Object.keys(cardToBank).find((prefix) =>
|
||||||
cardNumber.toString().startsWith(prefix)
|
cardNumber.toString().startsWith(prefix),
|
||||||
) || ""
|
) || ""
|
||||||
];
|
];
|
||||||
if (foundBank) setValue("name", foundBank);
|
if (foundBank) setValue("name", foundBank);
|
||||||
@@ -145,7 +145,7 @@ export const AddCard = ({ getData, item, target }: AddPageProps) => {
|
|||||||
} else {
|
} else {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,25 +1,25 @@
|
|||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
zValidateAutoComplete,
|
zValidateAutoComplete,
|
||||||
zValidateNumber,
|
zValidateNumber,
|
||||||
zValidateNumberOptional,
|
zValidateNumberOptional,
|
||||||
zValidateString,
|
zValidateString,
|
||||||
} from "../../data/getFormTypeErrors";
|
} from "../../../data/getFormTypeErrors";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
import { FormEnterLocations } from "../../components/FormItems/FormEnterLocation";
|
import { FormEnterLocations } from "../../../components/FormItems/FormEnterLocation";
|
||||||
import { FormApiBasedAutoComplete } from "../../components/FormItems/FormApiBasedAutoComplete";
|
import { FormApiBasedAutoComplete } from "../../../components/FormItems/FormApiBasedAutoComplete";
|
||||||
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
import AutoComplete from "../../../components/AutoComplete/AutoComplete";
|
||||||
import { getToastResponse } from "../../data/getToastResponse";
|
import { getToastResponse } from "../../../data/getToastResponse";
|
||||||
import { useUserProfileStore } from "../../context/zustand-store/userStore";
|
import { useUserProfileStore } from "../../../context/zustand-store/userStore";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import Checkbox from "../../components/CheckBox/CheckBox";
|
import Checkbox from "../../../components/CheckBox/CheckBox";
|
||||||
import {
|
import {
|
||||||
ArrowPathIcon,
|
ArrowPathIcon,
|
||||||
CheckBadgeIcon,
|
CheckBadgeIcon,
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
zValidateAutoComplete,
|
zValidateAutoComplete,
|
||||||
zValidateNumberOptional,
|
zValidateNumberOptional,
|
||||||
zValidateString,
|
zValidateString,
|
||||||
} from "../../data/getFormTypeErrors";
|
} from "../../../data/getFormTypeErrors";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
import { getToastResponse } from "../../data/getToastResponse";
|
import { getToastResponse } from "../../../data/getToastResponse";
|
||||||
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
import AutoComplete from "../../../components/AutoComplete/AutoComplete";
|
||||||
import Checkbox from "../../components/CheckBox/CheckBox";
|
import Checkbox from "../../../components/CheckBox/CheckBox";
|
||||||
import { FormApiBasedAutoComplete } from "../../components/FormItems/FormApiBasedAutoComplete";
|
import { FormApiBasedAutoComplete } from "../../../components/FormItems/FormApiBasedAutoComplete";
|
||||||
|
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
name: zValidateString("نام نهاد "),
|
name: zValidateString("نام نهاد "),
|
||||||
@@ -81,12 +81,12 @@ export const AddOrganizationType = ({ getData, item }: AddPageProps) => {
|
|||||||
if (error?.status === 403) {
|
if (error?.status === 403) {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "این مورد تکراری است!",
|
error?.response?.data?.message || "این مورد تکراری است!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
zValidateAutoComplete,
|
zValidateAutoComplete,
|
||||||
@@ -9,15 +9,15 @@ import {
|
|||||||
zValidateNumberOptional,
|
zValidateNumberOptional,
|
||||||
zValidateString,
|
zValidateString,
|
||||||
zValidateStringOptional,
|
zValidateStringOptional,
|
||||||
} from "../../data/getFormTypeErrors";
|
} from "../../../data/getFormTypeErrors";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
import { getToastResponse } from "../../data/getToastResponse";
|
import { getToastResponse } from "../../../data/getToastResponse";
|
||||||
import { FormApiBasedAutoComplete } from "../../components/FormItems/FormApiBasedAutoComplete";
|
import { FormApiBasedAutoComplete } from "../../../components/FormItems/FormApiBasedAutoComplete";
|
||||||
import { useFetchProfile } from "../../hooks/useFetchProfile";
|
import { useFetchProfile } from "../../../hooks/useFetchProfile";
|
||||||
import { getFaPermissions } from "../../utils/getFaPermissions";
|
import { getFaPermissions } from "../../../utils/getFaPermissions";
|
||||||
|
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
name: zValidateString("نام سازمان"),
|
name: zValidateString("نام سازمان"),
|
||||||
@@ -79,7 +79,7 @@ export const AddRole = ({ getData, item }: AddPageProps) => {
|
|||||||
} else {
|
} else {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,23 +6,23 @@ import {
|
|||||||
zValidateNumber,
|
zValidateNumber,
|
||||||
zValidateString,
|
zValidateString,
|
||||||
zValidateStringOptional,
|
zValidateStringOptional,
|
||||||
} from "../../data/getFormTypeErrors";
|
} from "../../../data/getFormTypeErrors";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import DatePicker from "../../components/date-picker/DatePicker";
|
import DatePicker from "../../../components/date-picker/DatePicker";
|
||||||
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
import AutoComplete from "../../../components/AutoComplete/AutoComplete";
|
||||||
import { FormEnterLocations } from "../../components/FormItems/FormEnterLocation";
|
import { FormEnterLocations } from "../../../components/FormItems/FormEnterLocation";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import { FormApiBasedAutoComplete } from "../../components/FormItems/FormApiBasedAutoComplete";
|
import { FormApiBasedAutoComplete } from "../../../components/FormItems/FormApiBasedAutoComplete";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useDrawerStore } from "../../context/zustand-store/appStore";
|
import { useDrawerStore } from "../../../context/zustand-store/appStore";
|
||||||
import Typography from "../../components/Typography/Typography";
|
import Typography from "../../../components/Typography/Typography";
|
||||||
import { useFetchProfile } from "../../hooks/useFetchProfile";
|
import { useFetchProfile } from "../../../hooks/useFetchProfile";
|
||||||
import { useUserProfileStore } from "../../context/zustand-store/userStore";
|
import { useUserProfileStore } from "../../../context/zustand-store/userStore";
|
||||||
|
|
||||||
type AddAccessProps = {
|
type AddAccessProps = {
|
||||||
getData: () => void;
|
getData: () => void;
|
||||||
@@ -71,7 +71,7 @@ export const AddUser = ({ getData, item }: AddAccessProps) => {
|
|||||||
{
|
{
|
||||||
message: "نام واحد حقوقی نمیتواند خالی باشد",
|
message: "نام واحد حقوقی نمیتواند خالی باشد",
|
||||||
path: ["unit_name"],
|
path: ["unit_name"],
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.refine(
|
.refine(
|
||||||
(data) => {
|
(data) => {
|
||||||
@@ -83,7 +83,7 @@ export const AddUser = ({ getData, item }: AddAccessProps) => {
|
|||||||
{
|
{
|
||||||
message: "شناسه ملی واحد حقوقی نمیتواند خالی باشد",
|
message: "شناسه ملی واحد حقوقی نمیتواند خالی باشد",
|
||||||
path: ["unit_national_id"],
|
path: ["unit_national_id"],
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
type FormValues = z.infer<typeof schema>;
|
type FormValues = z.infer<typeof schema>;
|
||||||
@@ -398,7 +398,7 @@ export const AddUser = ({ getData, item }: AddAccessProps) => {
|
|||||||
defaultKey={item?.organization?.id}
|
defaultKey={item?.organization?.id}
|
||||||
title="سازمان"
|
title="سازمان"
|
||||||
api={`auth/api/v1/organization/organizations_by_province?province=${getValues(
|
api={`auth/api/v1/organization/organizations_by_province?province=${getValues(
|
||||||
"province"
|
"province",
|
||||||
)}`}
|
)}`}
|
||||||
keyField="id"
|
keyField="id"
|
||||||
valueField="name"
|
valueField="name"
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { AddOrganization } from "./AddOrganization";
|
import { AddOrganization } from "./AddOrganization";
|
||||||
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
import AutoComplete from "../../../components/AutoComplete/AutoComplete";
|
||||||
import { FormApiBasedAutoComplete } from "../../components/FormItems/FormApiBasedAutoComplete";
|
import { FormApiBasedAutoComplete } from "../../../components/FormItems/FormApiBasedAutoComplete";
|
||||||
import Table from "../../components/Table/Table";
|
import Table from "../../../components/Table/Table";
|
||||||
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 { DeleteButtonForPopOver } from "../../components/PopOverButtons/PopOverButtons";
|
import { DeleteButtonForPopOver } from "../../../components/PopOverButtons/PopOverButtons";
|
||||||
import { Tooltip } from "../../components/Tooltip/Tooltip";
|
import { Tooltip } from "../../../components/Tooltip/Tooltip";
|
||||||
import { Popover } from "../../components/PopOver/PopOver";
|
import { Popover } from "../../../components/PopOver/PopOver";
|
||||||
import { AddCard } from "./AddCard";
|
import { AddCard } from "./AddCard";
|
||||||
import ShowMoreInfo from "../../components/ShowMoreInfo/ShowMoreInfo";
|
import ShowMoreInfo from "../../../components/ShowMoreInfo/ShowMoreInfo";
|
||||||
import { ShowCardsStringList } from "../../components/ShowCardsStringList/ShowCardsStringList";
|
import { ShowCardsStringList } from "../../../components/ShowCardsStringList/ShowCardsStringList";
|
||||||
import { useUserProfileStore } from "../../context/zustand-store/userStore";
|
import { useUserProfileStore } from "../../../context/zustand-store/userStore";
|
||||||
|
|
||||||
export const OrganizationsList = () => {
|
export const OrganizationsList = () => {
|
||||||
const { openModal } = useModalStore();
|
const { openModal } = useModalStore();
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import Table from "../../components/Table/Table";
|
import Table from "../../../components/Table/Table";
|
||||||
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 { DeleteButtonForPopOver } from "../../components/PopOverButtons/PopOverButtons";
|
import { DeleteButtonForPopOver } from "../../../components/PopOverButtons/PopOverButtons";
|
||||||
import { Tooltip } from "../../components/Tooltip/Tooltip";
|
import { Tooltip } from "../../../components/Tooltip/Tooltip";
|
||||||
import { Popover } from "../../components/PopOver/PopOver";
|
import { Popover } from "../../../components/PopOver/PopOver";
|
||||||
import { AddOrganizationType } from "./AddOrganizationType";
|
import { AddOrganizationType } from "./AddOrganizationType";
|
||||||
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
import AutoComplete from "../../../components/AutoComplete/AutoComplete";
|
||||||
|
|
||||||
export const OrganizationsTypes = () => {
|
export const OrganizationsTypes = () => {
|
||||||
const { openModal } = useModalStore();
|
const { openModal } = useModalStore();
|
||||||
@@ -55,10 +55,10 @@ export const OrganizationsTypes = () => {
|
|||||||
item?.org_type_field === "CO"
|
item?.org_type_field === "CO"
|
||||||
? "کشور"
|
? "کشور"
|
||||||
: item?.org_type_field === "PR"
|
: item?.org_type_field === "PR"
|
||||||
? "استان"
|
? "استان"
|
||||||
: item?.org_type_field === "CI"
|
: item?.org_type_field === "CI"
|
||||||
? "شهرستان"
|
? "شهرستان"
|
||||||
: "نامشخص",
|
: "نامشخص",
|
||||||
item?.is_repeatable ? "دارد" : "ندارد",
|
item?.is_repeatable ? "دارد" : "ندارد",
|
||||||
<Popover key={i}>
|
<Popover key={i}>
|
||||||
<Tooltip title="ویرایش نهاد" position="right">
|
<Tooltip title="ویرایش نهاد" position="right">
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import {
|
import {
|
||||||
zValidateAutoComplete,
|
zValidateAutoComplete,
|
||||||
zValidateAutoCompleteOptional,
|
zValidateAutoCompleteOptional,
|
||||||
zValidateEnglishString,
|
zValidateEnglishString,
|
||||||
zValidateString,
|
zValidateString,
|
||||||
} from "../../data/getFormTypeErrors";
|
} from "../../../data/getFormTypeErrors";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import { getToastResponse } from "../../data/getToastResponse";
|
import { getToastResponse } from "../../../data/getToastResponse";
|
||||||
import { useUserProfileStore } from "../../context/zustand-store/userStore";
|
import { useUserProfileStore } from "../../../context/zustand-store/userStore";
|
||||||
import { FormApiBasedAutoComplete } from "../../components/FormItems/FormApiBasedAutoComplete";
|
import { FormApiBasedAutoComplete } from "../../../components/FormItems/FormApiBasedAutoComplete";
|
||||||
|
|
||||||
type AddPosProps = {
|
type AddPosProps = {
|
||||||
getData: () => void;
|
getData: () => void;
|
||||||
@@ -80,12 +80,12 @@ export const AddPos = ({ getData, item }: AddPosProps) => {
|
|||||||
if (error?.status === 403) {
|
if (error?.status === 403) {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "این مورد تکراری است!",
|
error?.response?.data?.message || "این مورد تکراری است!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import { FormApiBasedAutoComplete } from "../../components/FormItems/FormApiBasedAutoComplete";
|
import { FormApiBasedAutoComplete } from "../../../components/FormItems/FormApiBasedAutoComplete";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
import { zValidateAutoComplete } from "../../data/getFormTypeErrors";
|
import { zValidateAutoComplete } from "../../../data/getFormTypeErrors";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import { getToastResponse } from "../../data/getToastResponse";
|
import { getToastResponse } from "../../../data/getToastResponse";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
getData: () => void;
|
getData: () => void;
|
||||||
@@ -59,7 +59,7 @@ export const AllocateAccountToBroker = ({ getData, item }: Props) => {
|
|||||||
} else {
|
} else {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,22 +1,22 @@
|
|||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import {
|
import {
|
||||||
zValidateAutoComplete,
|
zValidateAutoComplete,
|
||||||
zValidateString,
|
zValidateString,
|
||||||
zValidateStringOptional,
|
zValidateStringOptional,
|
||||||
} from "../../data/getFormTypeErrors";
|
} from "../../../data/getFormTypeErrors";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import { getToastResponse } from "../../data/getToastResponse";
|
import { getToastResponse } from "../../../data/getToastResponse";
|
||||||
import { FormApiBasedAutoComplete } from "../../components/FormItems/FormApiBasedAutoComplete";
|
import { FormApiBasedAutoComplete } from "../../../components/FormItems/FormApiBasedAutoComplete";
|
||||||
import { RadioGroup } from "../../components/RadioButton/RadioGroup";
|
import { RadioGroup } from "../../../components/RadioButton/RadioGroup";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import Divider from "../../components/Divider/Divider";
|
import Divider from "../../../components/Divider/Divider";
|
||||||
|
|
||||||
type AddPosProps = {
|
type AddPosProps = {
|
||||||
getData: () => void;
|
getData: () => void;
|
||||||
@@ -96,12 +96,12 @@ export const AllocatePos = ({ getData, item }: AddPosProps) => {
|
|||||||
if (error?.status === 403) {
|
if (error?.status === 403) {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "این مورد تکراری است!",
|
error?.response?.data?.message || "این مورد تکراری است!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { zValidateAutoComplete } from "../../data/getFormTypeErrors";
|
import { zValidateAutoComplete } from "../../../data/getFormTypeErrors";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import { getToastResponse } from "../../data/getToastResponse";
|
import { getToastResponse } from "../../../data/getToastResponse";
|
||||||
import { FormApiBasedAutoComplete } from "../../components/FormItems/FormApiBasedAutoComplete";
|
import { FormApiBasedAutoComplete } from "../../../components/FormItems/FormApiBasedAutoComplete";
|
||||||
|
|
||||||
type AddPosProps = {
|
type AddPosProps = {
|
||||||
getData: () => void;
|
getData: () => void;
|
||||||
@@ -66,12 +66,12 @@ export const PosAllocateOrganizationAccount = ({
|
|||||||
if (error?.status === 403) {
|
if (error?.status === 403) {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "این مورد تکراری است!",
|
error?.response?.data?.message || "این مورد تکراری است!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
235
src/partials/LiveStock/quota/AddIncentivePlan.tsx
Normal file
235
src/partials/LiveStock/quota/AddIncentivePlan.tsx
Normal file
@@ -0,0 +1,235 @@
|
|||||||
|
import { z } from "zod";
|
||||||
|
import {
|
||||||
|
zValidateAutoComplete,
|
||||||
|
zValidateString,
|
||||||
|
zValidateStringOptional,
|
||||||
|
} from "../../../data/getFormTypeErrors";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { useToast } from "../../../hooks/useToast";
|
||||||
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
|
import { Controller, useForm } from "react-hook-form";
|
||||||
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
|
import { getToastResponse } from "../../../data/getToastResponse";
|
||||||
|
import Button from "../../../components/Button/Button";
|
||||||
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
|
import { RadioGroup } from "../../../components/RadioButton/RadioGroup";
|
||||||
|
import AutoComplete from "../../../components/AutoComplete/AutoComplete";
|
||||||
|
import DatePicker from "../../../components/date-picker/DatePicker";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
getData: () => void;
|
||||||
|
item?: any;
|
||||||
|
};
|
||||||
|
|
||||||
|
const groupTypes = [
|
||||||
|
{ key: "rural", value: "روستایی", disabled: false },
|
||||||
|
{ key: "industrial", value: "صنعتی", disabled: false },
|
||||||
|
{ key: "nomadic", value: "عشایری", disabled: false },
|
||||||
|
];
|
||||||
|
|
||||||
|
const planTypes = [
|
||||||
|
{ key: "ILQ", value: "افزایش سهمیه دام", disabled: false },
|
||||||
|
{ key: "SM", value: "آماری / پایشی", disabled: true },
|
||||||
|
];
|
||||||
|
|
||||||
|
const limitTimeTypes = [
|
||||||
|
{ label: "دارد", value: true },
|
||||||
|
{
|
||||||
|
label: "ندارد",
|
||||||
|
value: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const AddIncentivePlan = ({ getData, item }: Props) => {
|
||||||
|
const showToast = useToast();
|
||||||
|
const { closeModal } = useModalStore();
|
||||||
|
|
||||||
|
const [isTimeUnlimited, setIsTimeUnlimited] = useState(
|
||||||
|
item ? item?.is_time_unlimited : false,
|
||||||
|
);
|
||||||
|
|
||||||
|
const schema = z.object({
|
||||||
|
name: zValidateString("نام طرح"),
|
||||||
|
description: zValidateStringOptional("توضیحات"),
|
||||||
|
plan_type: zValidateAutoComplete("نوع طرح"),
|
||||||
|
group: zValidateAutoComplete("گروه"),
|
||||||
|
// is_time_unlimited: zValidateNumber("شهر"),
|
||||||
|
start_date_limit: isTimeUnlimited
|
||||||
|
? zValidateString("تاریخ شروع محدودیت")
|
||||||
|
: zValidateStringOptional("تاریخ شروع محدودیت"),
|
||||||
|
end_date_limit: isTimeUnlimited
|
||||||
|
? zValidateString("تاریخ اتمام محدودیت")
|
||||||
|
: zValidateStringOptional("تاریخ اتمام محدودیت"),
|
||||||
|
});
|
||||||
|
|
||||||
|
type FormValues = z.infer<typeof schema>;
|
||||||
|
|
||||||
|
const {
|
||||||
|
control,
|
||||||
|
handleSubmit,
|
||||||
|
setValue,
|
||||||
|
formState: { errors },
|
||||||
|
} = useForm<FormValues>({
|
||||||
|
resolver: zodResolver(schema),
|
||||||
|
defaultValues: {
|
||||||
|
name: item?.name || "",
|
||||||
|
description: item?.description || "",
|
||||||
|
group: item?.group ? [item?.group] : [],
|
||||||
|
plan_type: item?.plan_type ? [item?.plan_type] : [],
|
||||||
|
start_date_limit: item?.start_date_limit,
|
||||||
|
end_date_limit: item?.end_date_limit,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const mutation = useApiMutation({
|
||||||
|
api: `/product/web/api/v1/incentive_plan/${item ? item?.id + "/" : ""}`,
|
||||||
|
method: item ? "put" : "post",
|
||||||
|
});
|
||||||
|
|
||||||
|
const onSubmit = async (data: FormValues) => {
|
||||||
|
try {
|
||||||
|
await mutation.mutateAsync({
|
||||||
|
name: data.name,
|
||||||
|
description: data.description,
|
||||||
|
plan_type: data.plan_type[0],
|
||||||
|
group: data.group[0],
|
||||||
|
is_time_unlimited: isTimeUnlimited,
|
||||||
|
...(isTimeUnlimited
|
||||||
|
? {
|
||||||
|
start_date_limit: data?.start_date_limit,
|
||||||
|
end_date_limit: data?.end_date_limit,
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
|
|
||||||
|
...(item
|
||||||
|
? { registering_organization: item?.registering_organization }
|
||||||
|
: {}),
|
||||||
|
});
|
||||||
|
showToast(getToastResponse(item, ""), "success");
|
||||||
|
getData();
|
||||||
|
closeModal();
|
||||||
|
} catch (error: any) {
|
||||||
|
if (error?.status === 403) {
|
||||||
|
showToast(
|
||||||
|
error?.response?.data?.message || "این مورد تکراری است!",
|
||||||
|
"error",
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
showToast(
|
||||||
|
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
||||||
|
"error",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<form onSubmit={handleSubmit(onSubmit)}>
|
||||||
|
<Grid container column className="gap-2">
|
||||||
|
<Controller
|
||||||
|
name="name"
|
||||||
|
control={control}
|
||||||
|
render={({ field }) => (
|
||||||
|
<Textfield
|
||||||
|
fullWidth
|
||||||
|
placeholder="نام طرح "
|
||||||
|
value={field.value}
|
||||||
|
onChange={field.onChange}
|
||||||
|
error={!!errors.name}
|
||||||
|
helperText={errors.name?.message}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Controller
|
||||||
|
name="description"
|
||||||
|
control={control}
|
||||||
|
render={({ field }) => (
|
||||||
|
<Textfield
|
||||||
|
fullWidth
|
||||||
|
placeholder="توضیحات (اختیاری)"
|
||||||
|
value={field.value}
|
||||||
|
onChange={field.onChange}
|
||||||
|
error={!!errors.description}
|
||||||
|
helperText={errors.description?.message}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Controller
|
||||||
|
name="plan_type"
|
||||||
|
control={control}
|
||||||
|
render={({ field }) => (
|
||||||
|
<AutoComplete
|
||||||
|
data={planTypes}
|
||||||
|
selectedKeys={field.value}
|
||||||
|
onChange={(keys: (string | number)[]) => {
|
||||||
|
setValue("plan_type", keys);
|
||||||
|
}}
|
||||||
|
error={!!errors.plan_type}
|
||||||
|
helperText={errors.plan_type?.message}
|
||||||
|
title="نوع طرح"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Controller
|
||||||
|
name="group"
|
||||||
|
control={control}
|
||||||
|
render={({ field }) => (
|
||||||
|
<AutoComplete
|
||||||
|
data={groupTypes}
|
||||||
|
selectedKeys={field.value}
|
||||||
|
onChange={(keys: (string | number)[]) => {
|
||||||
|
setValue("group", keys);
|
||||||
|
}}
|
||||||
|
error={!!errors.group}
|
||||||
|
helperText={errors.group?.message}
|
||||||
|
title="گروه"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<RadioGroup
|
||||||
|
groupTitle="محدودیت زمانی"
|
||||||
|
className="mr-2 mt-2"
|
||||||
|
direction="row"
|
||||||
|
options={limitTimeTypes}
|
||||||
|
name="دریافت تعرفه"
|
||||||
|
value={isTimeUnlimited}
|
||||||
|
onChange={(e) =>
|
||||||
|
e.target.value === "true"
|
||||||
|
? setIsTimeUnlimited(true)
|
||||||
|
: setIsTimeUnlimited(false)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{isTimeUnlimited && (
|
||||||
|
<>
|
||||||
|
<DatePicker
|
||||||
|
value={item?.start_date_limit || ""}
|
||||||
|
label="تاریخ شروع طرح"
|
||||||
|
size="medium"
|
||||||
|
onChange={(r) => {
|
||||||
|
setValue("start_date_limit", r);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<DatePicker
|
||||||
|
value={item?.end_date_limit || ""}
|
||||||
|
label="تاریخ اتمام طرح"
|
||||||
|
size="medium"
|
||||||
|
onChange={(r) => {
|
||||||
|
setValue("end_date_limit", r);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<Button type="submit">ثبت</Button>
|
||||||
|
</Grid>
|
||||||
|
</form>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import { Stepper } from "../../components/Stepper/Stepper";
|
import { Stepper } from "../../../components/Stepper/Stepper";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { QuotaLevel1 } from "./QuotaLevel1";
|
import { QuotaLevel1 } from "./QuotaLevel1";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { QuotaLevel2 } from "./QuotaLevel2";
|
import { QuotaLevel2 } from "./QuotaLevel2";
|
||||||
import { QuotaLevel3 } from "./QuotaLevel3";
|
import { QuotaLevel3 } from "./QuotaLevel3";
|
||||||
import { QuotaLevel4 } from "./QuotaLevel4";
|
import { QuotaLevel4 } from "./QuotaLevel4";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import { useToast, useConfirmToast } from "../../hooks/useToast";
|
import { useToast, useConfirmToast } from "../../../hooks/useToast";
|
||||||
import { getToastResponse } from "../../data/getToastResponse";
|
import { getToastResponse } from "../../../data/getToastResponse";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
item?: any;
|
item?: any;
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
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 Table from "../../components/Table/Table";
|
import Table from "../../../components/Table/Table";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
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 { AddQuota } from "./AddQuota";
|
import { AddQuota } from "./AddQuota";
|
||||||
import { QuotaView } from "./QuotaView";
|
import { QuotaView } from "./QuotaView";
|
||||||
import { PopoverCustomModalOperation } from "../../components/PopOverCustomModalOperation/PopoverCustomModalOperation";
|
import { PopoverCustomModalOperation } from "../../../components/PopOverCustomModalOperation/PopoverCustomModalOperation";
|
||||||
import {
|
import {
|
||||||
ArrowDownOnSquareIcon,
|
ArrowDownOnSquareIcon,
|
||||||
ArrowUpOnSquareIcon,
|
ArrowUpOnSquareIcon,
|
||||||
@@ -16,14 +16,14 @@ import {
|
|||||||
XMarkIcon,
|
XMarkIcon,
|
||||||
} from "@heroicons/react/24/outline";
|
} from "@heroicons/react/24/outline";
|
||||||
import { useNavigate } from "@tanstack/react-router";
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
import { QUOTAS } from "../../routes/paths";
|
import { QUOTAS } from "../../../routes/paths";
|
||||||
import { getQuotaTableColumns, getQuotaTableRowData } from "./quotaTableUtils";
|
import { getQuotaTableColumns, getQuotaTableRowData } from "./quotaTableUtils";
|
||||||
import { QuotaAllocateToStakeHolders } from "./QuotaAllocateToStakeHolders";
|
import { QuotaAllocateToStakeHolders } from "./QuotaAllocateToStakeHolders";
|
||||||
import { QuotaDistributionEntryInventory } from "./QuotaDistributionEntryInventory";
|
import { QuotaDistributionEntryInventory } from "./QuotaDistributionEntryInventory";
|
||||||
import { useUserProfileStore } from "../../context/zustand-store/userStore";
|
import { useUserProfileStore } from "../../../context/zustand-store/userStore";
|
||||||
import { TableButton } from "../../components/TableButton/TableButton";
|
import { TableButton } from "../../../components/TableButton/TableButton";
|
||||||
import { QuotaActivesDashboardDetails } from "./QuotaActivesDashboardDetails";
|
import { QuotaActivesDashboardDetails } from "./QuotaActivesDashboardDetails";
|
||||||
import { PaginationParameters } from "../../components/PaginationParameters/PaginationParameters";
|
import { PaginationParameters } from "../../../components/PaginationParameters/PaginationParameters";
|
||||||
|
|
||||||
export const QuotaActives = () => {
|
export const QuotaActives = () => {
|
||||||
const { openModal } = useModalStore();
|
const { openModal } = useModalStore();
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useApiRequest } from "../../utils/useApiRequest";
|
import { useApiRequest } from "../../../utils/useApiRequest";
|
||||||
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 { ShowWeight } from "../../components/ShowWeight/ShowWeight";
|
import { ShowWeight } from "../../../components/ShowWeight/ShowWeight";
|
||||||
|
|
||||||
interface QuotaDashboardByProduct {
|
interface QuotaDashboardByProduct {
|
||||||
quotas_count: string;
|
quotas_count: string;
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useApiRequest } from "../../utils/useApiRequest";
|
import { useApiRequest } from "../../../utils/useApiRequest";
|
||||||
import Table from "../../components/Table/Table";
|
import Table from "../../../components/Table/Table";
|
||||||
import { formatJustDate, formatJustTime } from "../../utils/formatTime";
|
import { formatJustDate, formatJustTime } from "../../../utils/formatTime";
|
||||||
import { ShowWeight } from "../../components/ShowWeight/ShowWeight";
|
import { ShowWeight } from "../../../components/ShowWeight/ShowWeight";
|
||||||
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 { QuotaDistribution } from "./QuotaDistribution";
|
import { QuotaDistribution } from "./QuotaDistribution";
|
||||||
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 { PaginationParameters } from "../../components/PaginationParameters/PaginationParameters";
|
import { PaginationParameters } from "../../../components/PaginationParameters/PaginationParameters";
|
||||||
|
|
||||||
export const QuotaAllDistributions = () => {
|
export const QuotaAllDistributions = () => {
|
||||||
const [params, setParams] = useState({ page: 1, page_size: 10 });
|
const [params, setParams] = useState({ page: 1, page_size: 10 });
|
||||||
@@ -55,7 +55,7 @@ export const QuotaAllDistributions = () => {
|
|||||||
item?.quota?.quota_id,
|
item?.quota?.quota_id,
|
||||||
item?.quota?.product?.product,
|
item?.quota?.product?.product,
|
||||||
`${formatJustDate(item?.create_date)} (${formatJustTime(
|
`${formatJustDate(item?.create_date)} (${formatJustTime(
|
||||||
item?.create_date
|
item?.create_date,
|
||||||
)})`,
|
)})`,
|
||||||
`${item?.assigner_organization?.organization} (${item?.creator_info})`,
|
`${item?.assigner_organization?.organization} (${item?.creator_info})`,
|
||||||
item?.assigned_organization?.organization,
|
item?.assigned_organization?.organization,
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
zValidateNumber,
|
zValidateNumber,
|
||||||
zValidateStringOptional,
|
zValidateStringOptional,
|
||||||
} from "../../data/getFormTypeErrors";
|
} from "../../../data/getFormTypeErrors";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
import { getToastResponse } from "../../data/getToastResponse";
|
import { getToastResponse } from "../../../data/getToastResponse";
|
||||||
import { FormApiBasedAutoComplete } from "../../components/FormItems/FormApiBasedAutoComplete";
|
import { FormApiBasedAutoComplete } from "../../../components/FormItems/FormApiBasedAutoComplete";
|
||||||
import Typography from "../../components/Typography/Typography";
|
import Typography from "../../../components/Typography/Typography";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
getData: () => void;
|
getData: () => void;
|
||||||
@@ -31,16 +31,16 @@ export const QuotaAllocateToStakeHolders = ({
|
|||||||
|
|
||||||
const cooperativeValue = isSubmit
|
const cooperativeValue = isSubmit
|
||||||
? item?.quota?.brokers?.find(
|
? item?.quota?.brokers?.find(
|
||||||
(broker: any) => broker?.broker_name === "تعاونی"
|
(broker: any) => broker?.broker_name === "تعاونی",
|
||||||
)?.value
|
)?.value
|
||||||
: item?.quota_distribution?.quota?.brokers?.find(
|
: item?.quota_distribution?.quota?.brokers?.find(
|
||||||
(broker: any) => broker?.broker_name === "تعاونی"
|
(broker: any) => broker?.broker_name === "تعاونی",
|
||||||
)?.value;
|
)?.value;
|
||||||
|
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
share_amount: zValidateNumber("سهم از تعرفه").max(
|
share_amount: zValidateNumber("سهم از تعرفه").max(
|
||||||
cooperativeValue,
|
cooperativeValue,
|
||||||
`سهم از تعرفه نمیتواند بیشتر از ${cooperativeValue?.toLocaleString()} باشد!`
|
`سهم از تعرفه نمیتواند بیشتر از ${cooperativeValue?.toLocaleString()} باشد!`,
|
||||||
),
|
),
|
||||||
organization: zValidateNumber("سازمان"),
|
organization: zValidateNumber("سازمان"),
|
||||||
assigned_organization: zValidateNumber("سازمان تخصیص دهنده"),
|
assigned_organization: zValidateNumber("سازمان تخصیص دهنده"),
|
||||||
@@ -88,7 +88,7 @@ export const QuotaAllocateToStakeHolders = ({
|
|||||||
await mutation.mutateAsync(payload as any);
|
await mutation.mutateAsync(payload as any);
|
||||||
showToast(
|
showToast(
|
||||||
getToastResponse(isSubmit ? false : true, "تخصیص به زیر مجموعه"),
|
getToastResponse(isSubmit ? false : true, "تخصیص به زیر مجموعه"),
|
||||||
"success"
|
"success",
|
||||||
);
|
);
|
||||||
getData();
|
getData();
|
||||||
closeModal();
|
closeModal();
|
||||||
@@ -96,18 +96,18 @@ export const QuotaAllocateToStakeHolders = ({
|
|||||||
if (error?.status === 400) {
|
if (error?.status === 400) {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.detail || error?.response?.data?.message,
|
error?.response?.data?.detail || error?.response?.data?.message,
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
closeModal();
|
closeModal();
|
||||||
} else if (error?.status === 403) {
|
} else if (error?.status === 403) {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "این مورد تکراری است!",
|
error?.response?.data?.message || "این مورد تکراری است!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useApiRequest } from "../../utils/useApiRequest";
|
import { useApiRequest } from "../../../utils/useApiRequest";
|
||||||
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 { Popover } from "../../components/PopOver/PopOver";
|
import { Popover } from "../../../components/PopOver/PopOver";
|
||||||
import { PopoverCustomModalOperation } from "../../components/PopOverCustomModalOperation/PopoverCustomModalOperation";
|
import { PopoverCustomModalOperation } from "../../../components/PopOverCustomModalOperation/PopoverCustomModalOperation";
|
||||||
import { ArrowUturnDownIcon } from "@heroicons/react/24/outline";
|
import { ArrowUturnDownIcon } from "@heroicons/react/24/outline";
|
||||||
import { getQuotaTableColumns, getQuotaTableRowData } from "./quotaTableUtils";
|
import { getQuotaTableColumns, getQuotaTableRowData } from "./quotaTableUtils";
|
||||||
import { PaginationParameters } from "../../components/PaginationParameters/PaginationParameters";
|
import { PaginationParameters } from "../../../components/PaginationParameters/PaginationParameters";
|
||||||
|
|
||||||
export const QuotaClosed = () => {
|
export const QuotaClosed = () => {
|
||||||
const [pagesInfo, setPagesInfo] = useState({ page: 1, page_size: 10 });
|
const [pagesInfo, setPagesInfo] = useState({ page: 1, page_size: 10 });
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
zValidateAutoComplete,
|
zValidateAutoComplete,
|
||||||
zValidateNumber,
|
zValidateNumber,
|
||||||
zValidateStringOptional,
|
zValidateStringOptional,
|
||||||
} from "../../data/getFormTypeErrors";
|
} from "../../../data/getFormTypeErrors";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
import { getToastResponse } from "../../data/getToastResponse";
|
import { getToastResponse } from "../../../data/getToastResponse";
|
||||||
import { FormApiBasedAutoComplete } from "../../components/FormItems/FormApiBasedAutoComplete";
|
import { FormApiBasedAutoComplete } from "../../../components/FormItems/FormApiBasedAutoComplete";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import Typography from "../../components/Typography/Typography";
|
import Typography from "../../../components/Typography/Typography";
|
||||||
import Checkbox from "../../components/CheckBox/CheckBox";
|
import Checkbox from "../../../components/CheckBox/CheckBox";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -100,17 +100,17 @@ export const QuotaDistribution = ({
|
|||||||
if (editPriceComponents) {
|
if (editPriceComponents) {
|
||||||
const currentAttributeSum = Object.values(attributeValues).reduce(
|
const currentAttributeSum = Object.values(attributeValues).reduce(
|
||||||
(sum, val) => sum + val,
|
(sum, val) => sum + val,
|
||||||
0
|
0,
|
||||||
);
|
);
|
||||||
const currentBrokerSum = Object.values(brokerValues).reduce(
|
const currentBrokerSum = Object.values(brokerValues).reduce(
|
||||||
(sum, val) => sum + val,
|
(sum, val) => sum + val,
|
||||||
0
|
0,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (currentAttributeSum !== initialAttributeSum) {
|
if (currentAttributeSum !== initialAttributeSum) {
|
||||||
showToast(
|
showToast(
|
||||||
`مجموع قیمت مولفه های قیمت گذاری باید برابر ${initialAttributeSum.toLocaleString()} باشد. مجموع فعلی: ${currentAttributeSum.toLocaleString()}`,
|
`مجموع قیمت مولفه های قیمت گذاری باید برابر ${initialAttributeSum.toLocaleString()} باشد. مجموع فعلی: ${currentAttributeSum.toLocaleString()}`,
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -118,7 +118,7 @@ export const QuotaDistribution = ({
|
|||||||
if (currentBrokerSum !== initialBrokerSum) {
|
if (currentBrokerSum !== initialBrokerSum) {
|
||||||
showToast(
|
showToast(
|
||||||
`مجموع قیمت کارگزاران باید برابر ${initialBrokerSum.toLocaleString()} باشد. مجموع فعلی: ${currentBrokerSum.toLocaleString()}`,
|
`مجموع قیمت کارگزاران باید برابر ${initialBrokerSum.toLocaleString()} باشد. مجموع فعلی: ${currentBrokerSum.toLocaleString()}`,
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -136,7 +136,7 @@ export const QuotaDistribution = ({
|
|||||||
(key) => ({
|
(key) => ({
|
||||||
attribute: parseInt(key),
|
attribute: parseInt(key),
|
||||||
value: attributeValues[parseInt(key)],
|
value: attributeValues[parseInt(key)],
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
payload.broker_data = Object.keys(brokerValues).map((key) => ({
|
payload.broker_data = Object.keys(brokerValues).map((key) => ({
|
||||||
broker: parseInt(key),
|
broker: parseInt(key),
|
||||||
@@ -152,18 +152,18 @@ export const QuotaDistribution = ({
|
|||||||
if (error?.status === 400) {
|
if (error?.status === 400) {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.detail || error?.response?.data?.message,
|
error?.response?.data?.detail || error?.response?.data?.message,
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
closeModal();
|
closeModal();
|
||||||
} else if (error?.status === 403) {
|
} else if (error?.status === 403) {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "این مورد تکراری است!",
|
error?.response?.data?.message || "این مورد تکراری است!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -273,7 +273,7 @@ export const QuotaDistribution = ({
|
|||||||
className={
|
className={
|
||||||
Object.values(attributeValues).reduce(
|
Object.values(attributeValues).reduce(
|
||||||
(sum, val) => sum + val,
|
(sum, val) => sum + val,
|
||||||
0
|
0,
|
||||||
) === initialAttributeSum
|
) === initialAttributeSum
|
||||||
? "text-green-500"
|
? "text-green-500"
|
||||||
: "text-red-500"
|
: "text-red-500"
|
||||||
@@ -320,7 +320,7 @@ export const QuotaDistribution = ({
|
|||||||
className={
|
className={
|
||||||
Object.values(brokerValues).reduce(
|
Object.values(brokerValues).reduce(
|
||||||
(sum, val) => sum + val,
|
(sum, val) => sum + val,
|
||||||
0
|
0,
|
||||||
) === initialBrokerSum
|
) === initialBrokerSum
|
||||||
? "text-green-500"
|
? "text-green-500"
|
||||||
: "text-red-500"
|
: "text-red-500"
|
||||||
@@ -1,20 +1,20 @@
|
|||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
zValidateBase64Optional,
|
zValidateBase64Optional,
|
||||||
zValidateNumber,
|
zValidateNumber,
|
||||||
zValidateStringOptional,
|
zValidateStringOptional,
|
||||||
} from "../../data/getFormTypeErrors";
|
} from "../../../data/getFormTypeErrors";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
import { getToastResponse } from "../../data/getToastResponse";
|
import { getToastResponse } from "../../../data/getToastResponse";
|
||||||
import FileUploader from "../../components/FIleUploader/FileUploader";
|
import FileUploader from "../../../components/FIleUploader/FileUploader";
|
||||||
import Typography from "../../components/Typography/Typography";
|
import Typography from "../../../components/Typography/Typography";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
getData: () => void;
|
getData: () => void;
|
||||||
@@ -81,18 +81,18 @@ export const QuotaDistributionEntryInventory = ({
|
|||||||
if (error?.status === 400) {
|
if (error?.status === 400) {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.detail || error?.response?.data?.message,
|
error?.response?.data?.detail || error?.response?.data?.message,
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
closeModal();
|
closeModal();
|
||||||
} else if (error?.status === 403) {
|
} else if (error?.status === 403) {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "این مورد تکراری است!",
|
error?.response?.data?.message || "این مورد تکراری است!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import { useApiRequest } from "../../utils/useApiRequest";
|
import { useApiRequest } from "../../../utils/useApiRequest";
|
||||||
import { motion, AnimatePresence } from "framer-motion";
|
import { motion, AnimatePresence } from "framer-motion";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import {
|
import {
|
||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
DocumentTextIcon,
|
DocumentTextIcon,
|
||||||
TruckIcon,
|
TruckIcon,
|
||||||
} from "@heroicons/react/24/outline";
|
} from "@heroicons/react/24/outline";
|
||||||
import { formatJustDate } from "../../utils/formatTime";
|
import { formatJustDate } from "../../../utils/formatTime";
|
||||||
|
|
||||||
const formatWeight = (value: number | string | undefined, unit?: string) => {
|
const formatWeight = (value: number | string | undefined, unit?: string) => {
|
||||||
if (value === null || value === undefined || value === "") return "-";
|
if (value === null || value === undefined || value === "") return "-";
|
||||||
@@ -136,7 +136,7 @@ const DistributionNode = ({
|
|||||||
مانده:{" "}
|
مانده:{" "}
|
||||||
{formatWeight(
|
{formatWeight(
|
||||||
item?.warehouse_balance,
|
item?.warehouse_balance,
|
||||||
item?.sale_unit?.unit
|
item?.sale_unit?.unit,
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
<span className="inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-amber-50 text-amber-700 dark:bg-amber-900/30 dark:text-amber-200">
|
<span className="inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium bg-amber-50 text-amber-700 dark:bg-amber-900/30 dark:text-amber-200">
|
||||||
@@ -155,7 +155,7 @@ const DistributionNode = ({
|
|||||||
<button
|
<button
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
setIsWarehouseEntriesExpanded(
|
setIsWarehouseEntriesExpanded(
|
||||||
!isWarehouseEntriesExpanded
|
!isWarehouseEntriesExpanded,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
className="w-full flex items-center justify-between px-1.5 py-1 rounded text-xs text-gray-600 bg-gray-50 hover:bg-gray-100 transition-colors dark:bg-gray-700/40 dark:text-gray-100 dark:hover:bg-gray-700/60"
|
className="w-full flex items-center justify-between px-1.5 py-1 rounded text-xs text-gray-600 bg-gray-50 hover:bg-gray-100 transition-colors dark:bg-gray-700/40 dark:text-gray-100 dark:hover:bg-gray-700/60"
|
||||||
@@ -222,7 +222,7 @@ const DistributionNode = ({
|
|||||||
وزن:{" "}
|
وزن:{" "}
|
||||||
{formatWeight(
|
{formatWeight(
|
||||||
entry?.weight,
|
entry?.weight,
|
||||||
item?.sale_unit?.unit
|
item?.sale_unit?.unit,
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
{entry?.lading_number && (
|
{entry?.lading_number && (
|
||||||
@@ -249,7 +249,7 @@ const DistributionNode = ({
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
)
|
),
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!isLoadingWarehouseEntries &&
|
{!isLoadingWarehouseEntries &&
|
||||||
@@ -1,22 +1,22 @@
|
|||||||
import { useParams } from "@tanstack/react-router";
|
import { useParams } from "@tanstack/react-router";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useApiRequest } from "../../utils/useApiRequest";
|
import { useApiRequest } from "../../../utils/useApiRequest";
|
||||||
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 { QuotaDistribution } from "./QuotaDistribution";
|
import { QuotaDistribution } from "./QuotaDistribution";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } 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 { formatJustDate, formatJustTime } from "../../utils/formatTime";
|
import { formatJustDate, formatJustTime } from "../../../utils/formatTime";
|
||||||
import { DeleteButtonForPopOver } from "../../components/PopOverButtons/PopOverButtons";
|
import { DeleteButtonForPopOver } from "../../../components/PopOverButtons/PopOverButtons";
|
||||||
import { ShowWeight } from "../../components/ShowWeight/ShowWeight";
|
import { ShowWeight } from "../../../components/ShowWeight/ShowWeight";
|
||||||
import {
|
import {
|
||||||
getQuotaDashboardColumns,
|
getQuotaDashboardColumns,
|
||||||
getQuotaDashboardRowData,
|
getQuotaDashboardRowData,
|
||||||
} from "./quotaTableUtils";
|
} from "./quotaTableUtils";
|
||||||
import { QuotaDistributionOverview } from "./QuotaDistributionOverview";
|
import { QuotaDistributionOverview } from "./QuotaDistributionOverview";
|
||||||
import { useUserProfileStore } from "../../context/zustand-store/userStore";
|
import { useUserProfileStore } from "../../../context/zustand-store/userStore";
|
||||||
|
|
||||||
export const QuotaDistributions = () => {
|
export const QuotaDistributions = () => {
|
||||||
const params = useParams({ strict: false });
|
const params = useParams({ strict: false });
|
||||||
@@ -49,7 +49,7 @@ export const QuotaDistributions = () => {
|
|||||||
: i + pagesInfo.page_size * (pagesInfo.page - 1) + 1,
|
: i + pagesInfo.page_size * (pagesInfo.page - 1) + 1,
|
||||||
item?.distribution_id,
|
item?.distribution_id,
|
||||||
`${formatJustDate(item?.create_date)} (${formatJustTime(
|
`${formatJustDate(item?.create_date)} (${formatJustTime(
|
||||||
item?.create_date
|
item?.create_date,
|
||||||
)})`,
|
)})`,
|
||||||
item?.assigner_organization?.organization +
|
item?.assigner_organization?.organization +
|
||||||
" (" +
|
" (" +
|
||||||
@@ -1,22 +1,22 @@
|
|||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import { FormApiBasedAutoComplete } from "../../components/FormItems/FormApiBasedAutoComplete";
|
import { FormApiBasedAutoComplete } from "../../../components/FormItems/FormApiBasedAutoComplete";
|
||||||
import {
|
import {
|
||||||
zValidateAutoComplete,
|
zValidateAutoComplete,
|
||||||
zValidateAutoCompleteOptional,
|
zValidateAutoCompleteOptional,
|
||||||
zValidateNumber,
|
zValidateNumber,
|
||||||
zValidateString,
|
zValidateString,
|
||||||
} from "../../data/getFormTypeErrors";
|
} from "../../../data/getFormTypeErrors";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
import AutoComplete from "../../../components/AutoComplete/AutoComplete";
|
||||||
import { getMonthsList } from "../../data/getMonths";
|
import { getMonthsList } from "../../../data/getMonths";
|
||||||
import { RadioGroup } from "../../components/RadioButton/RadioGroup";
|
import { RadioGroup } from "../../../components/RadioButton/RadioGroup";
|
||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import ToggleButton from "../../components/ToggleButton/ToggleButton";
|
import ToggleButton from "../../../components/ToggleButton/ToggleButton";
|
||||||
import Typography from "../../components/Typography/Typography";
|
import Typography from "../../../components/Typography/Typography";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import { useApiRequest } from "../../utils/useApiRequest";
|
import { useApiRequest } from "../../../utils/useApiRequest";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
item: any;
|
item: any;
|
||||||
@@ -45,7 +45,7 @@ const posSaleTypes = [
|
|||||||
|
|
||||||
export const QuotaLevel1 = ({ item, onSubmit, setFormRef, visible }: Props) => {
|
export const QuotaLevel1 = ({ item, onSubmit, setFormRef, visible }: Props) => {
|
||||||
const [hasDistributionLimit, setHasDistributionLimit] = useState(
|
const [hasDistributionLimit, setHasDistributionLimit] = useState(
|
||||||
item?.distribution_mode?.length ? true : false
|
item?.distribution_mode?.length ? true : false,
|
||||||
);
|
);
|
||||||
const internalRef = useRef<HTMLFormElement>(null);
|
const internalRef = useRef<HTMLFormElement>(null);
|
||||||
const [livestockTypes, setLivestockTypes] = useState<
|
const [livestockTypes, setLivestockTypes] = useState<
|
||||||
@@ -116,7 +116,7 @@ export const QuotaLevel1 = ({ item, onSubmit, setFormRef, visible }: Props) => {
|
|||||||
(option: any) =>
|
(option: any) =>
|
||||||
option?.livestock_type?.weight_type === allocate?.weight_type &&
|
option?.livestock_type?.weight_type === allocate?.weight_type &&
|
||||||
option?.livestock_group === group &&
|
option?.livestock_group === group &&
|
||||||
option?.livestock_type?.name === allocate?.name
|
option?.livestock_type?.name === allocate?.name,
|
||||||
);
|
);
|
||||||
return result?.quantity_kg || 0;
|
return result?.quantity_kg || 0;
|
||||||
};
|
};
|
||||||
@@ -153,13 +153,13 @@ export const QuotaLevel1 = ({ item, onSubmit, setFormRef, visible }: Props) => {
|
|||||||
const findLivestockIndex = (
|
const findLivestockIndex = (
|
||||||
group: string,
|
group: string,
|
||||||
weightType: string,
|
weightType: string,
|
||||||
fa: string
|
fa: string,
|
||||||
) => {
|
) => {
|
||||||
return livestockTypes.findIndex(
|
return livestockTypes.findIndex(
|
||||||
(item) =>
|
(item) =>
|
||||||
item.livestock_group === group &&
|
item.livestock_group === group &&
|
||||||
item.weight_type === weightType &&
|
item.weight_type === weightType &&
|
||||||
item.fa === fa
|
item.fa === fa,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -394,7 +394,7 @@ export const QuotaLevel1 = ({ item, onSubmit, setFormRef, visible }: Props) => {
|
|||||||
?.filter(
|
?.filter(
|
||||||
(option) =>
|
(option) =>
|
||||||
option.livestock_group === "rural" &&
|
option.livestock_group === "rural" &&
|
||||||
option?.weight_type === "H"
|
option?.weight_type === "H",
|
||||||
)
|
)
|
||||||
.map((item, i) => {
|
.map((item, i) => {
|
||||||
const index = findLivestockIndex("rural", "H", item.fa);
|
const index = findLivestockIndex("rural", "H", item.fa);
|
||||||
@@ -428,7 +428,7 @@ export const QuotaLevel1 = ({ item, onSubmit, setFormRef, visible }: Props) => {
|
|||||||
?.filter(
|
?.filter(
|
||||||
(option) =>
|
(option) =>
|
||||||
option.livestock_group === "rural" &&
|
option.livestock_group === "rural" &&
|
||||||
option?.weight_type === "L"
|
option?.weight_type === "L",
|
||||||
)
|
)
|
||||||
.map((item, i) => {
|
.map((item, i) => {
|
||||||
const index = findLivestockIndex("rural", "L", item.fa);
|
const index = findLivestockIndex("rural", "L", item.fa);
|
||||||
@@ -475,13 +475,13 @@ export const QuotaLevel1 = ({ item, onSubmit, setFormRef, visible }: Props) => {
|
|||||||
?.filter(
|
?.filter(
|
||||||
(option) =>
|
(option) =>
|
||||||
option.livestock_group === "industrial" &&
|
option.livestock_group === "industrial" &&
|
||||||
option?.weight_type === "H"
|
option?.weight_type === "H",
|
||||||
)
|
)
|
||||||
.map((item, i) => {
|
.map((item, i) => {
|
||||||
const index = findLivestockIndex(
|
const index = findLivestockIndex(
|
||||||
"industrial",
|
"industrial",
|
||||||
"H",
|
"H",
|
||||||
item.fa
|
item.fa,
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<Textfield
|
<Textfield
|
||||||
@@ -513,13 +513,13 @@ export const QuotaLevel1 = ({ item, onSubmit, setFormRef, visible }: Props) => {
|
|||||||
?.filter(
|
?.filter(
|
||||||
(option) =>
|
(option) =>
|
||||||
option.livestock_group === "industrial" &&
|
option.livestock_group === "industrial" &&
|
||||||
option?.weight_type === "L"
|
option?.weight_type === "L",
|
||||||
)
|
)
|
||||||
.map((item, i) => {
|
.map((item, i) => {
|
||||||
const index = findLivestockIndex(
|
const index = findLivestockIndex(
|
||||||
"industrial",
|
"industrial",
|
||||||
"L",
|
"L",
|
||||||
item.fa
|
item.fa,
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<Textfield
|
<Textfield
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, 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 Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import Typography from "../../components/Typography/Typography";
|
import Typography from "../../../components/Typography/Typography";
|
||||||
import Checkbox from "../../components/CheckBox/CheckBox";
|
import Checkbox from "../../../components/CheckBox/CheckBox";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
item: any;
|
item: any;
|
||||||
@@ -48,7 +48,7 @@ export const QuotaLevel2 = ({ item, onSubmit, setFormRef, visible }: Props) => {
|
|||||||
if (livestockData) {
|
if (livestockData) {
|
||||||
const d = data?.results?.map((option: PlansProps) => {
|
const d = data?.results?.map((option: PlansProps) => {
|
||||||
const founded = item?.incentive_plan?.find(
|
const founded = item?.incentive_plan?.find(
|
||||||
(itm: PlansProps) => itm?.incentive_plan === option.id
|
(itm: PlansProps) => itm?.incentive_plan === option.id,
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
name: option?.name,
|
name: option?.name,
|
||||||
@@ -56,7 +56,7 @@ export const QuotaLevel2 = ({ item, onSubmit, setFormRef, visible }: Props) => {
|
|||||||
active: founded ? true : false,
|
active: founded ? true : false,
|
||||||
live_stocks: livestockData.results.flatMap((item: any) => {
|
live_stocks: livestockData.results.flatMap((item: any) => {
|
||||||
const foundedLiveStock = founded?.live_stocks?.find(
|
const foundedLiveStock = founded?.live_stocks?.find(
|
||||||
(option: any) => option?.id === item.id
|
(option: any) => option?.id === item.id,
|
||||||
);
|
);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, 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 Checkbox from "../../components/CheckBox/CheckBox";
|
import Checkbox from "../../../components/CheckBox/CheckBox";
|
||||||
import { FormApiBasedAutoComplete } from "../../components/FormItems/FormApiBasedAutoComplete";
|
import { FormApiBasedAutoComplete } from "../../../components/FormItems/FormApiBasedAutoComplete";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import Typography from "../../components/Typography/Typography";
|
import Typography from "../../../components/Typography/Typography";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
item: any;
|
item: any;
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import Checkbox from "../../components/CheckBox/CheckBox";
|
import Checkbox from "../../../components/CheckBox/CheckBox";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import Typography from "../../components/Typography/Typography";
|
import Typography from "../../../components/Typography/Typography";
|
||||||
import { useApiRequest } from "../../utils/useApiRequest";
|
import { useApiRequest } from "../../../utils/useApiRequest";
|
||||||
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
import AutoComplete from "../../../components/AutoComplete/AutoComplete";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
item: any;
|
item: any;
|
||||||
@@ -64,7 +64,7 @@ export const QuotaLevel4 = ({
|
|||||||
if (visible) {
|
if (visible) {
|
||||||
const getQuatity = (allocate: any) => {
|
const getQuatity = (allocate: any) => {
|
||||||
const result = item?.attribute_values?.find(
|
const result = item?.attribute_values?.find(
|
||||||
(option: any) => option?.attribute === allocate?.id
|
(option: any) => option?.attribute === allocate?.id,
|
||||||
);
|
);
|
||||||
if (result) {
|
if (result) {
|
||||||
return result.value;
|
return result.value;
|
||||||
@@ -91,7 +91,7 @@ export const QuotaLevel4 = ({
|
|||||||
if (visible) {
|
if (visible) {
|
||||||
const getQuatity = (allocate: any) => {
|
const getQuatity = (allocate: any) => {
|
||||||
const result = item?.brokers?.find(
|
const result = item?.brokers?.find(
|
||||||
(option: any) => option?.broker === allocate?.id
|
(option: any) => option?.broker === allocate?.id,
|
||||||
);
|
);
|
||||||
if (result) {
|
if (result) {
|
||||||
return result.value;
|
return result.value;
|
||||||
@@ -106,8 +106,8 @@ export const QuotaLevel4 = ({
|
|||||||
const active = broker?.fix_broker_price_state
|
const active = broker?.fix_broker_price_state
|
||||||
? true
|
? true
|
||||||
: item
|
: item
|
||||||
? existingValue > 0
|
? existingValue > 0
|
||||||
: value > 0;
|
: value > 0;
|
||||||
return {
|
return {
|
||||||
broker: broker?.id,
|
broker: broker?.id,
|
||||||
value,
|
value,
|
||||||
@@ -169,7 +169,7 @@ export const QuotaLevel4 = ({
|
|||||||
fixedBrokers.forEach((broker: any) => {
|
fixedBrokers.forEach((broker: any) => {
|
||||||
const existingIndex = next.findIndex(
|
const existingIndex = next.findIndex(
|
||||||
(selection) =>
|
(selection) =>
|
||||||
selection.pricing_type === pt?.id && selection.name === broker.fa
|
selection.pricing_type === pt?.id && selection.name === broker.fa,
|
||||||
);
|
);
|
||||||
if (existingIndex === -1) {
|
if (existingIndex === -1) {
|
||||||
next.push({
|
next.push({
|
||||||
@@ -195,7 +195,7 @@ export const QuotaLevel4 = ({
|
|||||||
return getPriceList()
|
return getPriceList()
|
||||||
?.filter((opt) => {
|
?.filter((opt) => {
|
||||||
const isSelected = selectedItems.some(
|
const isSelected = selectedItems.some(
|
||||||
(item) => item.name === opt.value
|
(item) => item.name === opt.value,
|
||||||
);
|
);
|
||||||
if (!isSelected) return false;
|
if (!isSelected) return false;
|
||||||
const broker = brokersData?.find((b: any) => b.fa === opt.value);
|
const broker = brokersData?.find((b: any) => b.fa === opt.value);
|
||||||
@@ -209,7 +209,7 @@ export const QuotaLevel4 = ({
|
|||||||
|
|
||||||
const handleSubmitForm = () => {
|
const handleSubmitForm = () => {
|
||||||
const allTypesSelected = priceTypesResponse?.results?.every((pt: any) =>
|
const allTypesSelected = priceTypesResponse?.results?.every((pt: any) =>
|
||||||
priceSelections?.some((item) => item.pricing_type === pt?.id)
|
priceSelections?.some((item) => item.pricing_type === pt?.id),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@@ -217,7 +217,7 @@ export const QuotaLevel4 = ({
|
|||||||
!brokersData?.filter((opt: any) => opt.required && opt.value === 0).length
|
!brokersData?.filter((opt: any) => opt.required && opt.value === 0).length
|
||||||
) {
|
) {
|
||||||
const activeBrokersData = brokersData?.filter(
|
const activeBrokersData = brokersData?.filter(
|
||||||
(broker: any) => broker.active
|
(broker: any) => broker.active,
|
||||||
);
|
);
|
||||||
const activeBrokerNames = activeBrokersData?.map((b: any) => b.fa) || [];
|
const activeBrokerNames = activeBrokersData?.map((b: any) => b.fa) || [];
|
||||||
const filteredPriceSelections = priceSelections?.filter((item) => {
|
const filteredPriceSelections = priceSelections?.filter((item) => {
|
||||||
@@ -243,8 +243,8 @@ export const QuotaLevel4 = ({
|
|||||||
...item,
|
...item,
|
||||||
value,
|
value,
|
||||||
}
|
}
|
||||||
: item
|
: item,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -313,7 +313,7 @@ export const QuotaLevel4 = ({
|
|||||||
});
|
});
|
||||||
if (!newActiveState) {
|
if (!newActiveState) {
|
||||||
setPriceSelections((prev) =>
|
setPriceSelections((prev) =>
|
||||||
prev.filter((selection) => selection.name !== item.fa)
|
prev.filter((selection) => selection.name !== item.fa),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
@@ -379,16 +379,16 @@ export const QuotaLevel4 = ({
|
|||||||
onChange={(e: (string | number)[]) => {
|
onChange={(e: (string | number)[]) => {
|
||||||
setPriceSelections((prev) => {
|
setPriceSelections((prev) => {
|
||||||
const filtered = prev.filter(
|
const filtered = prev.filter(
|
||||||
(item) => item.pricing_type !== pt?.id
|
(item) => item.pricing_type !== pt?.id,
|
||||||
);
|
);
|
||||||
const requiredBrokers = item
|
const requiredBrokers = item
|
||||||
? []
|
? []
|
||||||
: brokersData?.filter(
|
: brokersData?.filter(
|
||||||
(broker: any) => broker?.fix_broker_price_state
|
(broker: any) => broker?.fix_broker_price_state,
|
||||||
) || [];
|
) || [];
|
||||||
const newSelections = e.map((selectedKey) => {
|
const newSelections = e.map((selectedKey) => {
|
||||||
const selectedItem = getPriceList().find(
|
const selectedItem = getPriceList().find(
|
||||||
(item) => item.key === selectedKey
|
(item) => item.key === selectedKey,
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -402,7 +402,7 @@ export const QuotaLevel4 = ({
|
|||||||
const existingIndex = merged.findIndex(
|
const existingIndex = merged.findIndex(
|
||||||
(selection) =>
|
(selection) =>
|
||||||
selection.pricing_type === pt?.id &&
|
selection.pricing_type === pt?.id &&
|
||||||
selection.name === broker.fa
|
selection.name === broker.fa,
|
||||||
);
|
);
|
||||||
const brokerValue = broker.value || 0;
|
const brokerValue = broker.value || 0;
|
||||||
if (existingIndex === -1) {
|
if (existingIndex === -1) {
|
||||||
@@ -424,11 +424,11 @@ export const QuotaLevel4 = ({
|
|||||||
selectedKeys={(() => {
|
selectedKeys={(() => {
|
||||||
const filtered =
|
const filtered =
|
||||||
priceSelections?.filter(
|
priceSelections?.filter(
|
||||||
(item) => item.pricing_type === pt?.id
|
(item) => item.pricing_type === pt?.id,
|
||||||
) || [];
|
) || [];
|
||||||
const keys = filtered.map((item) => {
|
const keys = filtered.map((item) => {
|
||||||
const priceItem = getPriceList().find(
|
const priceItem = getPriceList().find(
|
||||||
(p) => p.value === item.name
|
(p) => p.value === item.name,
|
||||||
);
|
);
|
||||||
return priceItem?.key;
|
return priceItem?.key;
|
||||||
});
|
});
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
import { useNavigate, useParams } from "@tanstack/react-router";
|
import { useNavigate, useParams } from "@tanstack/react-router";
|
||||||
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 { 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 { REPORTING } from "../../routes/paths";
|
import { REPORTING } from "../../../routes/paths";
|
||||||
import { getQuotaTableColumns, getQuotaTableRowData } from "./quotaTableUtils";
|
import { getQuotaTableColumns, getQuotaTableRowData } from "./quotaTableUtils";
|
||||||
|
|
||||||
export const QuotaReportingProductDetails = () => {
|
export const QuotaReportingProductDetails = () => {
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useApiRequest } from "../../utils/useApiRequest";
|
import { useApiRequest } from "../../../utils/useApiRequest";
|
||||||
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 Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
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 { useNavigate } from "@tanstack/react-router";
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
import { REPORTING } from "../../routes/paths";
|
import { REPORTING } from "../../../routes/paths";
|
||||||
import { ShowWeight } from "../../components/ShowWeight/ShowWeight";
|
import { ShowWeight } from "../../../components/ShowWeight/ShowWeight";
|
||||||
import { PaginationParameters } from "../../components/PaginationParameters/PaginationParameters";
|
import { PaginationParameters } from "../../../components/PaginationParameters/PaginationParameters";
|
||||||
|
|
||||||
interface QuotaDashboardByProduct {
|
interface QuotaDashboardByProduct {
|
||||||
product_id: string;
|
product_id: string;
|
||||||
@@ -42,7 +42,7 @@ export const QuotaReportingProducts = () => {
|
|||||||
method: "get",
|
method: "get",
|
||||||
params: { ...publicParams },
|
params: { ...publicParams },
|
||||||
queryKey: ["QuotaReportingAllProducts", publicParams],
|
queryKey: ["QuotaReportingAllProducts", publicParams],
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -89,7 +89,7 @@ export const QuotaReportingProducts = () => {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Popover>,
|
</Popover>,
|
||||||
];
|
];
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
setPagesTableData(tableData);
|
setPagesTableData(tableData);
|
||||||
} else {
|
} else {
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
import { useParams } from "@tanstack/react-router";
|
import { useParams } from "@tanstack/react-router";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useApiRequest } from "../../utils/useApiRequest";
|
import { useApiRequest } from "../../../utils/useApiRequest";
|
||||||
import Table from "../../components/Table/Table";
|
import Table from "../../../components/Table/Table";
|
||||||
import { formatJustDate, formatJustTime } from "../../utils/formatTime";
|
import { formatJustDate, formatJustTime } from "../../../utils/formatTime";
|
||||||
import { getPersianMonths } from "../../utils/getPersianMonths";
|
import { getPersianMonths } from "../../../utils/getPersianMonths";
|
||||||
import ShowMoreInfo from "../../components/ShowMoreInfo/ShowMoreInfo";
|
import ShowMoreInfo from "../../../components/ShowMoreInfo/ShowMoreInfo";
|
||||||
import Typography from "../../components/Typography/Typography";
|
import Typography from "../../../components/Typography/Typography";
|
||||||
import ShowStringList from "../../components/ShowStringList/ShowStringList";
|
import ShowStringList from "../../../components/ShowStringList/ShowStringList";
|
||||||
import Divider from "../../components/Divider/Divider";
|
import Divider from "../../../components/Divider/Divider";
|
||||||
import { ShowWeight } from "../../components/ShowWeight/ShowWeight";
|
import { ShowWeight } from "../../../components/ShowWeight/ShowWeight";
|
||||||
|
|
||||||
export const QuotaReportingQuotaDistributions = () => {
|
export const QuotaReportingQuotaDistributions = () => {
|
||||||
const params = useParams({ strict: false });
|
const params = useParams({ strict: false });
|
||||||
@@ -39,7 +39,7 @@ export const QuotaReportingQuotaDistributions = () => {
|
|||||||
: i + pagesInfo.page_size * (pagesInfo.page - 1) + 1,
|
: i + pagesInfo.page_size * (pagesInfo.page - 1) + 1,
|
||||||
item?.distribution_id,
|
item?.distribution_id,
|
||||||
`${formatJustDate(item?.create_date)} (${formatJustTime(
|
`${formatJustDate(item?.create_date)} (${formatJustTime(
|
||||||
item?.create_date
|
item?.create_date,
|
||||||
)})`,
|
)})`,
|
||||||
item?.assigner_organization?.organization +
|
item?.assigner_organization?.organization +
|
||||||
" (" +
|
" (" +
|
||||||
@@ -129,8 +129,8 @@ export const QuotaReportingQuotaDistributions = () => {
|
|||||||
DashboardData?.group === "rural"
|
DashboardData?.group === "rural"
|
||||||
? "روستایی"
|
? "روستایی"
|
||||||
: DashboardData?.group === "industrial"
|
: DashboardData?.group === "industrial"
|
||||||
? "صنعتی"
|
? "صنعتی"
|
||||||
: "عشایری",
|
: "عشایری",
|
||||||
getPersianMonths(DashboardData?.month_choices).join("، "),
|
getPersianMonths(DashboardData?.month_choices).join("، "),
|
||||||
DashboardData?.sale_type === "gov" ? "دولتی" : "آزاد",
|
DashboardData?.sale_type === "gov" ? "دولتی" : "آزاد",
|
||||||
getPersianMonths(DashboardData?.sale_license).join("، "),
|
getPersianMonths(DashboardData?.sale_license).join("، "),
|
||||||
@@ -172,7 +172,7 @@ export const QuotaReportingQuotaDistributions = () => {
|
|||||||
</Typography>
|
</Typography>
|
||||||
<ShowStringList
|
<ShowStringList
|
||||||
strings={DashboardData?.limit_by_organizations?.map(
|
strings={DashboardData?.limit_by_organizations?.map(
|
||||||
(opt: { name: string }) => opt?.name
|
(opt: { name: string }) => opt?.name,
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -190,7 +190,7 @@ export const QuotaReportingQuotaDistributions = () => {
|
|||||||
opt?.livestock_type?.weight_type === "L"
|
opt?.livestock_type?.weight_type === "L"
|
||||||
? "سبک"
|
? "سبک"
|
||||||
: "سنگین"
|
: "سنگین"
|
||||||
}) با سن ${opt?.age_month}`
|
}) با سن ${opt?.age_month}`,
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -199,10 +199,10 @@ export const QuotaReportingQuotaDistributions = () => {
|
|||||||
DashboardData?.pos_sale_type === "all"
|
DashboardData?.pos_sale_type === "all"
|
||||||
? "بر اساس تعداد راس دام و وزن"
|
? "بر اساس تعداد راس دام و وزن"
|
||||||
: DashboardData?.pos_sale_type === "weight"
|
: DashboardData?.pos_sale_type === "weight"
|
||||||
? "بر اساس وزن"
|
? "بر اساس وزن"
|
||||||
: DashboardData?.pos_sale_type === "count"
|
: DashboardData?.pos_sale_type === "count"
|
||||||
? "بر اساس تعداد راس دام"
|
? "بر اساس تعداد راس دام"
|
||||||
: "-",
|
: "-",
|
||||||
<ShowMoreInfo key={DashboardData} title="طرح های تشویقی">
|
<ShowMoreInfo key={DashboardData} title="طرح های تشویقی">
|
||||||
<div className="grid grid-cols-2 gap-1.5 p-2 max-h-[400px] overflow-y-auto w-full">
|
<div className="grid grid-cols-2 gap-1.5 p-2 max-h-[400px] overflow-y-auto w-full">
|
||||||
{DashboardData?.incentive_plan?.map(
|
{DashboardData?.incentive_plan?.map(
|
||||||
@@ -250,12 +250,12 @@ export const QuotaReportingQuotaDistributions = () => {
|
|||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
</Grid>
|
</Grid>
|
||||||
)
|
),
|
||||||
)}
|
)}
|
||||||
</Grid>
|
</Grid>
|
||||||
)}
|
)}
|
||||||
</Grid>
|
</Grid>
|
||||||
)
|
),
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</ShowMoreInfo>,
|
</ShowMoreInfo>,
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
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 { ShowWeight } from "../../components/ShowWeight/ShowWeight";
|
import { ShowWeight } from "../../../components/ShowWeight/ShowWeight";
|
||||||
import ShowStringList from "../../components/ShowStringList/ShowStringList";
|
import ShowStringList from "../../../components/ShowStringList/ShowStringList";
|
||||||
import Divider from "../../components/Divider/Divider";
|
import Divider from "../../../components/Divider/Divider";
|
||||||
import { formatJustDate } from "../../utils/formatTime";
|
import { formatJustDate } from "../../../utils/formatTime";
|
||||||
import { getPersianMonths } from "../../utils/getPersianMonths";
|
import { getPersianMonths } from "../../../utils/getPersianMonths";
|
||||||
|
|
||||||
interface QuotaViewProps {
|
interface QuotaViewProps {
|
||||||
item: any;
|
item: any;
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { formatJustDate } from "../../utils/formatTime";
|
import { formatJustDate } from "../../../utils/formatTime";
|
||||||
import { ShieldCheckIcon } from "@heroicons/react/24/solid";
|
import { ShieldCheckIcon } from "@heroicons/react/24/solid";
|
||||||
import { ShowWeight } from "../../components/ShowWeight/ShowWeight";
|
import { ShowWeight } from "../../../components/ShowWeight/ShowWeight";
|
||||||
import ShowMoreInfo from "../../components/ShowMoreInfo/ShowMoreInfo";
|
import ShowMoreInfo from "../../../components/ShowMoreInfo/ShowMoreInfo";
|
||||||
import ShowStringList from "../../components/ShowStringList/ShowStringList";
|
import ShowStringList from "../../../components/ShowStringList/ShowStringList";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
|
|
||||||
export interface PriceCalculationItem {
|
export interface PriceCalculationItem {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -114,7 +114,7 @@ const getFilteredPriceCalculationData = (
|
|||||||
export const getQuotaTableRowData = (
|
export const getQuotaTableRowData = (
|
||||||
item: any,
|
item: any,
|
||||||
index: number,
|
index: number,
|
||||||
config: QuotaTableConfig
|
config: QuotaTableConfig,
|
||||||
): any[] => {
|
): any[] => {
|
||||||
const rowData: any[] = [];
|
const rowData: any[] = [];
|
||||||
const {
|
const {
|
||||||
@@ -131,7 +131,7 @@ export const getQuotaTableRowData = (
|
|||||||
rowData.push(
|
rowData.push(
|
||||||
pagesInfo.page === 1
|
pagesInfo.page === 1
|
||||||
? index + 1
|
? index + 1
|
||||||
: index + pagesInfo.page_size * (pagesInfo.page - 1) + 1
|
: index + pagesInfo.page_size * (pagesInfo.page - 1) + 1,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ export const getQuotaTableRowData = (
|
|||||||
key={index}
|
key={index}
|
||||||
weight={item?.quota_weight}
|
weight={item?.quota_weight}
|
||||||
type={item?.sale_unit?.unit}
|
type={item?.sale_unit?.unit}
|
||||||
/>
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
// وزن توزیع شده
|
// وزن توزیع شده
|
||||||
@@ -170,7 +170,7 @@ export const getQuotaTableRowData = (
|
|||||||
key={index}
|
key={index}
|
||||||
weight={item?.quota_distributed}
|
weight={item?.quota_distributed}
|
||||||
type={item?.sale_unit?.unit}
|
type={item?.sale_unit?.unit}
|
||||||
/>
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
// وزن باقیمانده سهمیه
|
// وزن باقیمانده سهمیه
|
||||||
@@ -179,7 +179,7 @@ export const getQuotaTableRowData = (
|
|||||||
key={index}
|
key={index}
|
||||||
weight={item?.remaining_weight}
|
weight={item?.remaining_weight}
|
||||||
type={item?.sale_unit?.unit}
|
type={item?.sale_unit?.unit}
|
||||||
/>
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
// وزن فروش رفته
|
// وزن فروش رفته
|
||||||
@@ -188,7 +188,7 @@ export const getQuotaTableRowData = (
|
|||||||
key={index}
|
key={index}
|
||||||
weight={item?.been_sold}
|
weight={item?.been_sold}
|
||||||
type={item?.sale_unit?.unit}
|
type={item?.sale_unit?.unit}
|
||||||
/>
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
// ورود به انبار
|
// ورود به انبار
|
||||||
@@ -197,7 +197,7 @@ export const getQuotaTableRowData = (
|
|||||||
key={index}
|
key={index}
|
||||||
weight={item?.inventory_received}
|
weight={item?.inventory_received}
|
||||||
type={item?.sale_unit?.unit}
|
type={item?.sale_unit?.unit}
|
||||||
/>
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
// مانده انبار
|
// مانده انبار
|
||||||
@@ -206,7 +206,7 @@ export const getQuotaTableRowData = (
|
|||||||
key={index}
|
key={index}
|
||||||
weight={item?.pre_sale_balance}
|
weight={item?.pre_sale_balance}
|
||||||
type={item?.sale_unit?.unit}
|
type={item?.sale_unit?.unit}
|
||||||
/>
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
// تاریخ بایگانی
|
// تاریخ بایگانی
|
||||||
@@ -224,10 +224,10 @@ export const getQuotaTableRowData = (
|
|||||||
group === "rural"
|
group === "rural"
|
||||||
? "روستایی"
|
? "روستایی"
|
||||||
: group === "industrial"
|
: group === "industrial"
|
||||||
? "صنعتی"
|
? "صنعتی"
|
||||||
: "عشایری"
|
: "عشایری",
|
||||||
)
|
)
|
||||||
.join(", ")
|
.join(", "),
|
||||||
);
|
);
|
||||||
|
|
||||||
// مبدا
|
// مبدا
|
||||||
@@ -270,7 +270,7 @@ export const getQuotaTableRowData = (
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
rowData.push(
|
rowData.push(
|
||||||
@@ -286,7 +286,7 @@ export const getQuotaTableRowData = (
|
|||||||
showSearch={false}
|
showSearch={false}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ShowMoreInfo>
|
</ShowMoreInfo>,
|
||||||
);
|
);
|
||||||
|
|
||||||
// سهمیه و مجوز
|
// سهمیه و مجوز
|
||||||
@@ -415,10 +415,10 @@ export const getQuotaTableRowData = (
|
|||||||
item?.pos_sale_type === "all"
|
item?.pos_sale_type === "all"
|
||||||
? "بر اساس تعداد راس دام و وزن"
|
? "بر اساس تعداد راس دام و وزن"
|
||||||
: item?.pos_sale_type === "weight"
|
: item?.pos_sale_type === "weight"
|
||||||
? "بر اساس وزن"
|
? "بر اساس وزن"
|
||||||
: item?.pos_sale_type === "count"
|
: item?.pos_sale_type === "count"
|
||||||
? "بر اساس تعداد راس دام"
|
? "بر اساس تعداد راس دام"
|
||||||
: "-"
|
: "-",
|
||||||
);
|
);
|
||||||
|
|
||||||
// طرح های تشویقی
|
// طرح های تشویقی
|
||||||
@@ -555,7 +555,7 @@ export const getQuotaDashboardRowData = (item: any): any[] => {
|
|||||||
key={item?.id}
|
key={item?.id}
|
||||||
weight={item?.quota_weight}
|
weight={item?.quota_weight}
|
||||||
type={item?.sale_unit?.unit}
|
type={item?.sale_unit?.unit}
|
||||||
/>
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
// وزن توزیع شده
|
// وزن توزیع شده
|
||||||
@@ -564,7 +564,7 @@ export const getQuotaDashboardRowData = (item: any): any[] => {
|
|||||||
key={item?.id}
|
key={item?.id}
|
||||||
weight={item?.quota_distributed}
|
weight={item?.quota_distributed}
|
||||||
type={item?.sale_unit?.unit}
|
type={item?.sale_unit?.unit}
|
||||||
/>
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
// وزن باقیمانده سهمیه
|
// وزن باقیمانده سهمیه
|
||||||
@@ -573,7 +573,7 @@ export const getQuotaDashboardRowData = (item: any): any[] => {
|
|||||||
key={item?.id}
|
key={item?.id}
|
||||||
weight={item?.remaining_weight}
|
weight={item?.remaining_weight}
|
||||||
type={item?.sale_unit?.unit}
|
type={item?.sale_unit?.unit}
|
||||||
/>
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
// وزن فروش رفته
|
// وزن فروش رفته
|
||||||
@@ -582,7 +582,7 @@ export const getQuotaDashboardRowData = (item: any): any[] => {
|
|||||||
key={item?.id}
|
key={item?.id}
|
||||||
weight={item?.been_sold}
|
weight={item?.been_sold}
|
||||||
type={item?.sale_unit?.unit}
|
type={item?.sale_unit?.unit}
|
||||||
/>
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
// ورود به انبار
|
// ورود به انبار
|
||||||
@@ -591,7 +591,7 @@ export const getQuotaDashboardRowData = (item: any): any[] => {
|
|||||||
key={item?.id}
|
key={item?.id}
|
||||||
weight={item?.inventory_received}
|
weight={item?.inventory_received}
|
||||||
type={item?.sale_unit?.unit}
|
type={item?.sale_unit?.unit}
|
||||||
/>
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
// مانده انبار
|
// مانده انبار
|
||||||
@@ -600,7 +600,7 @@ export const getQuotaDashboardRowData = (item: any): any[] => {
|
|||||||
key={item?.id}
|
key={item?.id}
|
||||||
weight={item?.pre_sale_balance}
|
weight={item?.pre_sale_balance}
|
||||||
type={item?.sale_unit?.unit}
|
type={item?.sale_unit?.unit}
|
||||||
/>
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
// واحد فروش
|
// واحد فروش
|
||||||
@@ -613,10 +613,10 @@ export const getQuotaDashboardRowData = (item: any): any[] => {
|
|||||||
group === "rural"
|
group === "rural"
|
||||||
? "روستایی"
|
? "روستایی"
|
||||||
: group === "industrial"
|
: group === "industrial"
|
||||||
? "صنعتی"
|
? "صنعتی"
|
||||||
: "عشایری"
|
: "عشایری",
|
||||||
)
|
)
|
||||||
.join(", ")
|
.join(", "),
|
||||||
);
|
);
|
||||||
|
|
||||||
// مبدا
|
// مبدا
|
||||||
@@ -659,7 +659,7 @@ export const getQuotaDashboardRowData = (item: any): any[] => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
// توزیع
|
// توزیع
|
||||||
@@ -676,7 +676,7 @@ export const getQuotaDashboardRowData = (item: any): any[] => {
|
|||||||
showSearch={false}
|
showSearch={false}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ShowMoreInfo>
|
</ShowMoreInfo>,
|
||||||
);
|
);
|
||||||
|
|
||||||
// سهمیه و مجوز
|
// سهمیه و مجوز
|
||||||
@@ -805,10 +805,10 @@ export const getQuotaDashboardRowData = (item: any): any[] => {
|
|||||||
item?.pos_sale_type === "all"
|
item?.pos_sale_type === "all"
|
||||||
? "بر اساس تعداد راس دام و وزن"
|
? "بر اساس تعداد راس دام و وزن"
|
||||||
: item?.pos_sale_type === "weight"
|
: item?.pos_sale_type === "weight"
|
||||||
? "بر اساس وزن"
|
? "بر اساس وزن"
|
||||||
: item?.pos_sale_type === "count"
|
: item?.pos_sale_type === "count"
|
||||||
? "بر اساس تعداد راس دام"
|
? "بر اساس تعداد راس دام"
|
||||||
: "-"
|
: "-",
|
||||||
);
|
);
|
||||||
|
|
||||||
// طرح های تشویقی
|
// طرح های تشویقی
|
||||||
@@ -2,15 +2,15 @@ import { z } from "zod";
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import { FormApiBasedAutoComplete } from "../../components/FormItems/FormApiBasedAutoComplete";
|
import { FormApiBasedAutoComplete } from "../../../components/FormItems/FormApiBasedAutoComplete";
|
||||||
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
import AutoComplete from "../../../components/AutoComplete/AutoComplete";
|
||||||
import { zValidateAutoComplete } from "../../data/getFormTypeErrors";
|
import { zValidateAutoComplete } from "../../../data/getFormTypeErrors";
|
||||||
import { useApiMutation, useApiRequest } from "../../utils/useApiRequest";
|
import { useApiMutation, useApiRequest } from "../../../utils/useApiRequest";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
|
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
organization: zValidateAutoComplete("سازمان"),
|
organization: zValidateAutoComplete("سازمان"),
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
import AutoComplete from "../../../components/AutoComplete/AutoComplete";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import Checkbox from "../../components/CheckBox/CheckBox";
|
import Checkbox from "../../../components/CheckBox/CheckBox";
|
||||||
import { useApiMutation, useApiRequest } from "../../utils/useApiRequest";
|
import { useApiMutation, useApiRequest } from "../../../utils/useApiRequest";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
@@ -14,7 +14,7 @@ import {
|
|||||||
zValidateString,
|
zValidateString,
|
||||||
zValidateMobile,
|
zValidateMobile,
|
||||||
zValidateNationalCode,
|
zValidateNationalCode,
|
||||||
} from "../../data/getFormTypeErrors";
|
} from "../../../data/getFormTypeErrors";
|
||||||
|
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
first_name: zValidateString("نام"),
|
first_name: zValidateString("نام"),
|
||||||
@@ -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 Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
|
|
||||||
export const OtpVerifyModal = ({ item, getData }: any) => {
|
export const OtpVerifyModal = ({ item, getData }: any) => {
|
||||||
const showToast = useToast();
|
const showToast = useToast();
|
||||||
@@ -1,20 +1,20 @@
|
|||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
zValidateNumber,
|
zValidateNumber,
|
||||||
zValidateNumberOptional,
|
zValidateNumberOptional,
|
||||||
} from "../../data/getFormTypeErrors";
|
} from "../../../data/getFormTypeErrors";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
import { getToastResponse } from "../../data/getToastResponse";
|
import { getToastResponse } from "../../../data/getToastResponse";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../../utils/useApiRequest";
|
||||||
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
import AutoComplete from "../../../components/AutoComplete/AutoComplete";
|
||||||
import Divider from "../../components/Divider/Divider";
|
import Divider from "../../../components/Divider/Divider";
|
||||||
import { useUserProfileStore } from "../../context/zustand-store/userStore";
|
import { useUserProfileStore } from "../../../context/zustand-store/userStore";
|
||||||
|
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
country_code: zValidateNumber("شناسه کشوری"),
|
country_code: zValidateNumber("شناسه کشوری"),
|
||||||
@@ -85,7 +85,7 @@ export const SubmitNewTags = ({ getData, item }: SubmitNewTagsTypeProps) => {
|
|||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,16 +2,16 @@ import { z } from "zod";
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
import { RadioGroup } from "../../components/RadioButton/RadioGroup";
|
import { RadioGroup } from "../../../components/RadioButton/RadioGroup";
|
||||||
import { FormApiBasedAutoComplete } from "../../components/FormItems/FormApiBasedAutoComplete";
|
import { FormApiBasedAutoComplete } from "../../../components/FormItems/FormApiBasedAutoComplete";
|
||||||
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
import AutoComplete from "../../../components/AutoComplete/AutoComplete";
|
||||||
import { zValidateAutoComplete } from "../../data/getFormTypeErrors";
|
import { zValidateAutoComplete } from "../../../data/getFormTypeErrors";
|
||||||
import { useApiMutation, useApiRequest } from "../../utils/useApiRequest";
|
import { useApiMutation, useApiRequest } from "../../../utils/useApiRequest";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import { useModalStore } from "../../context/zustand-store/appStore";
|
import { useModalStore } from "../../../context/zustand-store/appStore";
|
||||||
|
|
||||||
const distributionTypeOptions = [
|
const distributionTypeOptions = [
|
||||||
{ label: "توزیع گروهی", value: "group" },
|
{ label: "توزیع گروهی", value: "group" },
|
||||||
@@ -8,30 +8,30 @@ import {
|
|||||||
StopCircleIcon,
|
StopCircleIcon,
|
||||||
XCircleIcon,
|
XCircleIcon,
|
||||||
} from "@heroicons/react/24/outline";
|
} from "@heroicons/react/24/outline";
|
||||||
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 { 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 { 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 { DeleteButtonForPopOver } from "../../components/PopOverButtons/PopOverButtons";
|
import { DeleteButtonForPopOver } from "../../../components/PopOverButtons/PopOverButtons";
|
||||||
import { SubmitTagDistribution } from "./SubmitTagDistribution";
|
import { SubmitTagDistribution } from "./SubmitTagDistribution";
|
||||||
import { DistributeFromDistribution } from "./DistributeFromDistribution";
|
import { DistributeFromDistribution } from "./DistributeFromDistribution";
|
||||||
import Table from "../../components/Table/Table";
|
import Table from "../../../components/Table/Table";
|
||||||
import { BooleanQuestion } from "../../components/BooleanQuestion/BooleanQuestion";
|
import { BooleanQuestion } from "../../../components/BooleanQuestion/BooleanQuestion";
|
||||||
import { TableButton } from "../../components/TableButton/TableButton";
|
import { TableButton } from "../../../components/TableButton/TableButton";
|
||||||
import { DistributionSpeciesModal } from "./DistributionSpeciesModal";
|
import { DistributionSpeciesModal } from "./DistributionSpeciesModal";
|
||||||
import { OtpAuthModal } from "./OtpAuthModal";
|
import { OtpAuthModal } from "./OtpAuthModal";
|
||||||
import { OtpVerifyModal } from "./OtpVerifyModal";
|
import { OtpVerifyModal } from "./OtpVerifyModal";
|
||||||
import { useNavigate } from "@tanstack/react-router";
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
import { TAG_DISTRIBUTION } from "../../routes/paths";
|
import { TAG_DISTRIBUTION } from "../../../routes/paths";
|
||||||
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 { useUserProfileStore } from "../../context/zustand-store/userStore";
|
import { useUserProfileStore } from "../../../context/zustand-store/userStore";
|
||||||
import { checkAccess } from "../../utils/checkAccess";
|
import { checkAccess } from "../../../utils/checkAccess";
|
||||||
|
|
||||||
export default function TagActiveDistributions() {
|
export default function TagActiveDistributions() {
|
||||||
const { openModal } = useModalStore();
|
const { openModal } = useModalStore();
|
||||||
@@ -5,20 +5,20 @@ import {
|
|||||||
CubeIcon,
|
CubeIcon,
|
||||||
SparklesIcon,
|
SparklesIcon,
|
||||||
} from "@heroicons/react/24/outline";
|
} from "@heroicons/react/24/outline";
|
||||||
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 { 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 { 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 { DeleteButtonForPopOver } from "../../components/PopOverButtons/PopOverButtons";
|
import { DeleteButtonForPopOver } from "../../../components/PopOverButtons/PopOverButtons";
|
||||||
|
|
||||||
import Table from "../../components/Table/Table";
|
import Table from "../../../components/Table/Table";
|
||||||
import { BooleanQuestion } from "../../components/BooleanQuestion/BooleanQuestion";
|
import { BooleanQuestion } from "../../../components/BooleanQuestion/BooleanQuestion";
|
||||||
import { TableButton } from "../../components/TableButton/TableButton";
|
import { TableButton } from "../../../components/TableButton/TableButton";
|
||||||
import { DistributionSpeciesModal } from "./DistributionSpeciesModal";
|
import { DistributionSpeciesModal } from "./DistributionSpeciesModal";
|
||||||
|
|
||||||
export default function TagCanceledDistributions() {
|
export default function TagCanceledDistributions() {
|
||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
MapPinIcon,
|
MapPinIcon,
|
||||||
CubeIcon,
|
CubeIcon,
|
||||||
} from "@heroicons/react/24/outline";
|
} from "@heroicons/react/24/outline";
|
||||||
import { useApiRequest } from "../../utils/useApiRequest";
|
import { useApiRequest } from "../../../utils/useApiRequest";
|
||||||
|
|
||||||
interface TagDetailsProps {
|
interface TagDetailsProps {
|
||||||
tagId: number;
|
tagId: number;
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
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 { Popover } from "../../components/PopOver/PopOver";
|
import { Popover } from "../../../components/PopOver/PopOver";
|
||||||
import { Tooltip } from "../../components/Tooltip/Tooltip";
|
import { Tooltip } from "../../../components/Tooltip/Tooltip";
|
||||||
import { SubmitNewTags } from "../../partials/tagging/SubmitNewTags";
|
import { SubmitNewTags } from "./SubmitNewTags";
|
||||||
import { useNavigate } from "@tanstack/react-router";
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
import { TAGGING } from "../../routes/paths";
|
import { TAGGING } from "../../../routes/paths";
|
||||||
import { DeleteButtonForPopOver } from "../../components/PopOverButtons/PopOverButtons";
|
import { DeleteButtonForPopOver } from "../../../components/PopOverButtons/PopOverButtons";
|
||||||
import { TableButton } from "../../components/TableButton/TableButton";
|
import { TableButton } from "../../../components/TableButton/TableButton";
|
||||||
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
import AutoComplete from "../../../components/AutoComplete/AutoComplete";
|
||||||
|
|
||||||
const speciesMap: Record<number, string> = {
|
const speciesMap: Record<number, string> = {
|
||||||
1: "گاو",
|
1: "گاو",
|
||||||
@@ -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 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 { 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 { TagDetails } from "../../partials/tagging/TagDetails";
|
import { TagDetails } from "./TagDetails";
|
||||||
import { useParams } from "@tanstack/react-router";
|
import { useParams } from "@tanstack/react-router";
|
||||||
import { TableButton } from "../../components/TableButton/TableButton";
|
import { TableButton } from "../../../components/TableButton/TableButton";
|
||||||
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
import AutoComplete from "../../../components/AutoComplete/AutoComplete";
|
||||||
|
|
||||||
const speciesMap: Record<number, string> = {
|
const speciesMap: Record<number, string> = {
|
||||||
1: "گاو",
|
1: "گاو",
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import Typography from "../../components/Typography/Typography";
|
import Typography from "../../../components/Typography/Typography";
|
||||||
import { ProductSummaryItem } from "../../types/transactions";
|
import { ProductSummaryItem } from "../../../types/transactions";
|
||||||
|
|
||||||
const PRODUCT_TYPE_LABELS: Record<string, string> = {
|
const PRODUCT_TYPE_LABELS: Record<string, string> = {
|
||||||
free: "آزاد",
|
free: "آزاد",
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { motion } from "framer-motion";
|
import { motion } from "framer-motion";
|
||||||
import Typography from "../../components/Typography/Typography";
|
import Typography from "../../../components/Typography/Typography";
|
||||||
import { useUserProfileStore } from "../../context/zustand-store/userStore";
|
import { useUserProfileStore } from "../../../context/zustand-store/userStore";
|
||||||
import { formatStampDateTime, formatTime } from "../../utils/formatTime";
|
import { formatStampDateTime, formatTime } from "../../../utils/formatTime";
|
||||||
|
|
||||||
export type TransactionDetailsProps = {
|
export type TransactionDetailsProps = {
|
||||||
transaction: any;
|
transaction: any;
|
||||||
@@ -29,7 +29,7 @@ const TransactionDetails = ({
|
|||||||
const processedShares = shares.map((share) => ({ ...share }));
|
const processedShares = shares.map((share) => ({ ...share }));
|
||||||
|
|
||||||
const mainAccountShares = processedShares.filter(
|
const mainAccountShares = processedShares.filter(
|
||||||
(share) => share?.name === "حساب اصلی"
|
(share) => share?.name === "حساب اصلی",
|
||||||
);
|
);
|
||||||
|
|
||||||
mainAccountShares.forEach((mainShare) => {
|
mainAccountShares.forEach((mainShare) => {
|
||||||
@@ -37,7 +37,7 @@ const TransactionDetails = ({
|
|||||||
(share) =>
|
(share) =>
|
||||||
share?.name !== "حساب اصلی" &&
|
share?.name !== "حساب اصلی" &&
|
||||||
share?.shaba === mainShare?.shaba &&
|
share?.shaba === mainShare?.shaba &&
|
||||||
share?.shaba
|
share?.shaba,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (matchingShare) {
|
if (matchingShare) {
|
||||||
@@ -48,7 +48,7 @@ const TransactionDetails = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
return processedShares.filter(
|
return processedShares.filter(
|
||||||
(share) => share?.name !== "حساب اصلی" || !share._matched
|
(share) => share?.name !== "حساب اصلی" || !share._matched,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -200,20 +200,20 @@ const TransactionDetails = ({
|
|||||||
transaction?.transaction_status === "success"
|
transaction?.transaction_status === "success"
|
||||||
? "text-green-600 dark:text-green-400"
|
? "text-green-600 dark:text-green-400"
|
||||||
: transaction?.transaction_status === "failed"
|
: transaction?.transaction_status === "failed"
|
||||||
? "text-red-600 dark:text-red-400"
|
? "text-red-600 dark:text-red-400"
|
||||||
: "text-orange-600 dark:text-orange-400"
|
: "text-orange-600 dark:text-orange-400"
|
||||||
}`}
|
}`}
|
||||||
className={`font-semibold text-sm `}
|
className={`font-semibold text-sm `}
|
||||||
>
|
>
|
||||||
{transaction?.transaction_status === "waiting"
|
{transaction?.transaction_status === "waiting"
|
||||||
? "درحال انتظار"
|
? "درحال انتظار"
|
||||||
: transaction?.transaction_status === "success"
|
: transaction?.transaction_status === "success"
|
||||||
? "موفق"
|
? "موفق"
|
||||||
: transaction?.transaction_status === "failed"
|
: transaction?.transaction_status === "failed"
|
||||||
? `ناموفق ( ${transaction?.result_text || "-"} ${
|
? `ناموفق ( ${transaction?.result_text || "-"} ${
|
||||||
transaction?.transaction_status_code || ""
|
transaction?.transaction_status_code || ""
|
||||||
} )`
|
} )`
|
||||||
: "-"}
|
: "-"}
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -426,7 +426,7 @@ const TransactionDetails = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
)
|
),
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -488,7 +488,7 @@ const TransactionDetails = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
)
|
),
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
import { useState, useMemo } from "react";
|
import { useState, useMemo } from "react";
|
||||||
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 { BrokerSharingSummary } from "../../types/transactions";
|
import { BrokerSharingSummary } from "../../../types/transactions";
|
||||||
import { convertNumberToPersian } from "../../utils/convertNumberToPersian";
|
import { convertNumberToPersian } from "../../../utils/convertNumberToPersian";
|
||||||
import { MagnifyingGlassIcon } from "@heroicons/react/24/outline";
|
import { MagnifyingGlassIcon } from "@heroicons/react/24/outline";
|
||||||
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
import AutoComplete from "../../../components/AutoComplete/AutoComplete";
|
||||||
import Textfield from "../../components/Textfeild/Textfeild";
|
import Textfield from "../../../components/Textfeild/Textfeild";
|
||||||
|
|
||||||
type TransactionSharingDetailsProps = {
|
type TransactionSharingDetailsProps = {
|
||||||
data?: BrokerSharingSummary[];
|
data?: BrokerSharingSummary[];
|
||||||
@@ -25,28 +25,28 @@ const TransactionSharingDetails = ({
|
|||||||
const [searchTerm, setSearchTerm] = useState<string>("");
|
const [searchTerm, setSearchTerm] = useState<string>("");
|
||||||
const [sortOption, setSortOption] = useState<SortOption>("");
|
const [sortOption, setSortOption] = useState<SortOption>("");
|
||||||
const [selectedSortKeys, setSelectedSortKeys] = useState<(number | string)[]>(
|
const [selectedSortKeys, setSelectedSortKeys] = useState<(number | string)[]>(
|
||||||
[]
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
const filteredData = useMemo(() => {
|
const filteredData = useMemo(() => {
|
||||||
let result =
|
let result =
|
||||||
data?.filter(
|
data?.filter(
|
||||||
(item: BrokerSharingSummary) => item?.name !== "حساب اصلی"
|
(item: BrokerSharingSummary) => item?.name !== "حساب اصلی",
|
||||||
) || [];
|
) || [];
|
||||||
|
|
||||||
if (searchTerm.trim()) {
|
if (searchTerm.trim()) {
|
||||||
result = result.filter((item: BrokerSharingSummary) =>
|
result = result.filter((item: BrokerSharingSummary) =>
|
||||||
item?.name?.toLowerCase().includes(searchTerm.toLowerCase())
|
item?.name?.toLowerCase().includes(searchTerm.toLowerCase()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sortOption === "most-to-least") {
|
if (sortOption === "most-to-least") {
|
||||||
result = [...result].sort(
|
result = [...result].sort(
|
||||||
(a, b) => (b?.total_price || 0) - (a?.total_price || 0)
|
(a, b) => (b?.total_price || 0) - (a?.total_price || 0),
|
||||||
);
|
);
|
||||||
} else if (sortOption === "least-to-most") {
|
} else if (sortOption === "least-to-most") {
|
||||||
result = [...result].sort(
|
result = [...result].sort(
|
||||||
(a, b) => (a?.total_price || 0) - (b?.total_price || 0)
|
(a, b) => (a?.total_price || 0) - (b?.total_price || 0),
|
||||||
);
|
);
|
||||||
} else if (sortOption === "by-count") {
|
} else if (sortOption === "by-count") {
|
||||||
result = [...result].sort((a, b) => (b?.count || 0) - (a?.count || 0));
|
result = [...result].sort((a, b) => (b?.count || 0) - (a?.count || 0));
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import Button from "../../components/Button/Button";
|
import Button from "../../../components/Button/Button";
|
||||||
import { Grid } from "../../components/Grid/Grid";
|
import { Grid } from "../../../components/Grid/Grid";
|
||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
zValidateAutoComplete,
|
zValidateAutoComplete,
|
||||||
zValidateString,
|
zValidateString,
|
||||||
} from "../../data/getFormTypeErrors";
|
} from "../../../data/getFormTypeErrors";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { useApiMutation, useApiRequest } from "../../utils/useApiRequest";
|
import { useApiMutation, useApiRequest } from "../../../utils/useApiRequest";
|
||||||
import { useToast } from "../../hooks/useToast";
|
import { useToast } from "../../../hooks/useToast";
|
||||||
import AutoComplete from "../../components/AutoComplete/AutoComplete";
|
import AutoComplete from "../../../components/AutoComplete/AutoComplete";
|
||||||
import { getToastResponse } from "../../data/getToastResponse";
|
import { getToastResponse } from "../../../data/getToastResponse";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
|
|
||||||
type SettingsType = "purchase_policy" | "service_area";
|
type SettingsType = "purchase_policy" | "service_area";
|
||||||
@@ -108,7 +108,7 @@ export const AddActivityTypeSettings = ({
|
|||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -174,7 +174,7 @@ export const AddActivityTypeSettings = ({
|
|||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
showToast(
|
showToast(
|
||||||
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
error?.response?.data?.message || "خطا در ثبت اطلاعات!",
|
||||||
"error"
|
"error",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user