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