push rasad front on new repo

This commit is contained in:
2026-01-18 14:32:49 +03:30
commit 4fe6e70525
2139 changed files with 303150 additions and 0 deletions

1076
src/pages/AccessDashboard.js Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,32 @@
import React from "react";
import { CityManageHatchings } from "../features/city/components/city-manage-hatchings/CityManageHatchings";
import { Grid } from "../components/grid/Grid";
import { Box } from "@mui/material";
import { useParams } from "react-router-dom";
import { CityHatchingShowTableDetail } from "../features/city/components/city-hatching-show-table-detail/CityHatchingShowTableDetail";
const AdminHatchings = () => {
const { key } = useParams();
return (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
mt={4}
>
{key ? (
<CityHatchingShowTableDetail keyItem={key} />
) : (
<CityManageHatchings />
)}
</Grid>
</Box>
);
};
export default AdminHatchings;

View File

@@ -0,0 +1,77 @@
import { Box, Card } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { useLocation } from "react-router-dom";
import { AvicultureNewRequest } from "../features/aviculture/components/aviculture-new-request/AvicultureNewRequest";
import { AvicultureActiveRequests } from "../features/aviculture/components/aviculture-active-requests/AvicultureActiveRequests";
import { useDispatch } from "react-redux";
import { useEffect } from "react";
import { avicultureGetRequests } from "../features/aviculture/services/aviculture-requests";
import { AvicultureRejectedRequests } from "../features/aviculture/components/aviculture-rejected-requests/AvicultureRejectedRequests";
import { AvicultureArchivedRequests } from "../features/aviculture/components/aviculture-archived-requests/AvicultureArchivedRequests";
import { RequestsAwaitingPayment } from "../components/requests-awaiting-payment/RequestsAwaitingPayment";
import { RequestsAwaitingInspections } from "../components/requests-awaiting-inspections/RequestsAwaitingInspections";
import {
ROUTE_ADMIN_ARCHIVED_REQUESTS,
ROUTE_ADMIN_AWAITING_INSPECTION_REQUESTS,
ROUTE_ADMIN_AWAITING_PAYMENT_REQUESTS,
ROUTE_ADMIN_CREATE_NEW_REQUEST,
ROUTE_ADMIN_HATCHING,
ROUTE_ADMIN_REJECTED_REQUESTS,
ROUTE_ADMIN_REQUESTS,
} from "../routes/routes";
import { AdminRequestsOperations } from "../features/admin/components/requests-operations/AdminRequestsOperations";
import { AdminHatching } from "../features/admin/components/admin-hatching/AdminHatching";
const AdminRequests = () => {
const { pathname } = useLocation();
const dispatch = useDispatch();
useEffect(() => {
dispatch(avicultureGetRequests());
}, []);
return (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid justifyContent="center" my={SPACING.MEDIUM}>
<Card>
<AdminRequestsOperations />
</Card>
</Grid>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
{pathname === ROUTE_ADMIN_CREATE_NEW_REQUEST && (
<AvicultureNewRequest />
)}
{pathname === ROUTE_ADMIN_HATCHING && <AdminHatching />}
{pathname === ROUTE_ADMIN_REQUESTS && <AvicultureActiveRequests />}
{pathname === ROUTE_ADMIN_REJECTED_REQUESTS && (
<AvicultureRejectedRequests />
)}
{pathname === ROUTE_ADMIN_ARCHIVED_REQUESTS && (
<AvicultureArchivedRequests />
)}
{pathname === ROUTE_ADMIN_AWAITING_PAYMENT_REQUESTS && (
<RequestsAwaitingPayment />
)}
{pathname === ROUTE_ADMIN_AWAITING_INSPECTION_REQUESTS && (
<RequestsAwaitingInspections />
)}
</Grid>
</Grid>
</Grid>
</Box>
);
};
export default AdminRequests;

View File

@@ -0,0 +1,60 @@
import { Box, Typography } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import {
ROUTE_ADMINX_SETTLEMENTS,
ROUTE_SUPER_ADMIN_SETTLEMENTS,
ROUTE_PROVINCE_FINANCIAL_SETTLEMENT,
ROUTE_PROVINCE_SETTLEMENTS,
} from "../routes/routes";
import { useLocation } from "react-router-dom";
import ProvinceSettlement from "../features/province/components/province-settlement/ProvinceSettlement";
import { BackButton } from "../components/back-button/BackButton";
import { SPACING } from "../data/spacing";
const AdminSettlement = () => {
const { pathname } = useLocation();
return (
<Box
display={"flex"}
alignItems="center"
justifyContent="center"
direction="column"
>
<Grid
container
display={"flex"}
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
{pathname === ROUTE_PROVINCE_SETTLEMENTS ||
pathname === ROUTE_PROVINCE_FINANCIAL_SETTLEMENT ||
pathname === ROUTE_SUPER_ADMIN_SETTLEMENTS ||
pathname === ROUTE_ADMINX_SETTLEMENTS ? (
<>
<BackButton />
<Grid justifyContent="center" alignItems="center">
<ProvinceSettlement />
</Grid>
</>
) : (
<>
<Grid mt={SPACING.MEDIUM}>
<Typography variant="h6">تسویه حساب</Typography>
</Grid>
<Grid justifyContent="center" alignItems="center">
<ProvinceSettlement />
</Grid>
</>
)}
</Grid>
</Box>
);
};
export default AdminSettlement;

View File

@@ -0,0 +1,208 @@
import { Box, Chip, Divider } from "@mui/material";
import React, { useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import ChartBar from "../components/chart-bar/ChartBar";
import ChartLinear from "../components/chart-linear/ChartLenear";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { adminGetCharts } from "../features/admin/services/admin-get-charts";
import { LOADING_START, LOADING_END } from "../lib/redux/slices/appSlice";
import ChartPolarArea from "../components/chart-polar-area/ChartPolarArea";
import ChartRadar from "../components/chart-radar/ChartRadar";
import { AdminHatchingByPeriod } from "../features/admin/components/admin-hatching-by-period/AdminHatchingByPeriod";
import AdminStaticInfoInBox from "../features/admin/components/admin-static-info-in-box/AdminStaticInfoInBox";
import { formatJustDate } from "../utils/formatTime";
const AdminStatics = () => {
const [ageChickenData, setAgeChickenData] = useState({ datasets: [] });
const [chickenPriceData, setChickenPriceData] = useState({ datasets: [] });
const [polarData, setPolarData] = useState({ datasets: [] });
const [radarData, setRadarData] = useState({ datasets: [] });
const dispatch = useDispatch();
const { statics } = useSelector((state) => state.adminSlice);
useEffect(() => {
dispatch(LOADING_START());
dispatch(adminGetCharts()).then(() => {
dispatch(LOADING_END());
});
}, []);
const [chickenPriceInfo, setChickenPriceInfo] = useState();
const [chickenlist, setChickenList] = useState();
const [infoData, setInfoData] = useState();
useEffect(() => {
statics?.map((item) => {
if (Object.keys(item)[0] === "poultryHatching") {
setChickenList(Object.values(item)[0]);
} else if (Object.keys(item)[0] === "box") {
setInfoData(Object.values(item)[0]);
} else if (Object.keys(item)[0] === "priceList") {
setChickenPriceInfo(Object.values(item)[0]);
}
return null;
});
}, [statics]);
useEffect(() => {
setAgeChickenData({
labels: chickenlist?.map((data) => data?.type?.replace("_", "-")),
datasets: [
{
label: "تعداد",
backgroundColor: ["rgba(33, 72, 214, 0.7)"],
data: chickenlist?.map((data) => data?.quantity),
borderRadius: 5,
},
{
label: "تلفات",
backgroundColor: ["rgba(100, 130, 160, 0.7)"],
data: chickenlist?.map((data) => data?.losses),
borderRadius: 5,
},
{
type: "line",
label: "مقدار استاندارد",
backgroundColor: ["rgba(0, 120, 10, 0.7)"],
data: [
2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500,
2500,
],
},
],
});
setChickenPriceData({
labels: chickenPriceInfo?.map((data) => formatJustDate(data?.date)),
datasets: [
{
label: "قیمت",
backgroundColor: ["rgba(33, 72, 214, 0.7)"],
data: chickenPriceInfo?.map((data) => data?.price),
borderRadius: 5,
},
],
});
setPolarData({
labels: chickenlist?.map((data) => data?.type?.replace("_", "-")),
datasets: [
{
backgroundColor: [
"rgba(158, 0, 87, 0.5)",
"rgba(255, 65, 249, 0.5)",
"rgba(130, 150, 214, 0.5)",
"rgba(255, 135, 155, 0.5)",
"rgba(33, 189, 155, 0.5)",
"rgba(33, 46, 214, 0.5)",
],
label: "تعداد",
data: chickenlist?.map((data) => data?.quantity),
},
{
backgroundColor: [
"rgba(255, 0, 87, 0.5)",
"rgba(255, 0, 249, 0.5)",
"rgba(33, 72, 214, 0.5)",
"rgba(255, 135, 155, 0.5)",
"rgba(33, 200, 155, 0.5)",
"rgba(33, 72, 214, 0.5)",
],
label: "تلفات",
data: chickenlist?.map((data) => data?.losses),
},
],
});
setRadarData({
labels: chickenlist?.map((data) => data?.type?.replace("_", "-")),
datasets: [
{
label: "جوجه",
data: [65, 59, 90, 81, 56, 55, 40, 56, 70, 90, 91, 88],
fill: true,
backgroundColor: "rgba(255, 99, 132, 0.2)",
borderColor: "rgb(255, 99, 132)",
pointBackgroundColor: "rgb(255, 99, 132)",
pointBorderColor: "#fff",
pointHoverBackgroundColor: "#fff",
pointHoverBorderColor: "rgb(255, 99, 132)",
},
{
label: "تلفات",
data: [69, 75, 84, 60, 96, 95, 90, 80, 68, 75, 60, 88],
fill: true,
backgroundColor: "rgba(54, 162, 235, 0.2)",
borderColor: "rgb(54, 162, 235)",
pointBackgroundColor: "rgb(54, 162, 235)",
pointBorderColor: "#fff",
pointHoverBackgroundColor: "#fff",
pointHoverBorderColor: "rgb(54, 162, 235)",
},
],
});
}, [statics, chickenlist]);
return (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
my={SPACING.MEDIUM}
>
<Grid xs={12} sm={12} md={12} lg={12} container justifyContent="center">
<Grid xs={10} sm={10} md={10} lg={6}>
<Divider mb={SPACING.SMALL}>
<Chip
size="small"
label="گزارش موجودی مرغ بر اساس بازه سنی (نمودار میله ای)"
/>
</Divider>
<ChartBar chartData={ageChickenData} />
</Grid>
<Grid xs={10} sm={10} md={10} lg={6}>
<Divider mb={SPACING.SMALL}>
<Chip
size="small"
label="گزارش تغییرات قیمت مرغ زنده (نمودار خطی)"
/>
</Divider>
<ChartLinear chartData={chickenPriceData} />
</Grid>
<AdminStaticInfoInBox infoData={infoData} />
<Grid mt={SPACING.MEDIUM} xs={10} sm={10} md={10} lg={6}>
<Divider mb={SPACING.SMALL}>
<Chip
size="small"
label="گزارش موجودی مرغ بر اساس بازه سنی (نمودار قطبی)"
/>
</Divider>
<ChartPolarArea chartData={polarData} />
</Grid>
<Grid mt={SPACING.MEDIUM} xs={10} sm={10} md={10} lg={6}>
<Divider mb={SPACING.SMALL}>
<Chip
size="small"
label="گزارش موجودی مرغ بر اساس بازه سنی (نمودار راداری)"
/>
</Divider>
<ChartRadar chartData={radarData} />
</Grid>
<AdminHatchingByPeriod
statics={statics}
ageChickenData={ageChickenData}
/>
</Grid>
</Grid>
</Box>
);
};
export default AdminStatics;

272
src/pages/AdminStatics.js Normal file
View File

@@ -0,0 +1,272 @@
import { Box } from "@mui/system";
import { Grid } from "../components/grid/Grid";
import { FarmsStats } from "../features/stats/FarmsStats";
import { UsersStats } from "../features/stats/UserStats";
import { HatchingStock } from "../features/stats/HatchingStock";
import { HatchingStockAge } from "../features/stats/HatchingStockAge";
import { HatchingStockCity } from "../features/stats/HatchingStockCity";
import { HatchingStockCityRemain } from "../features/stats/HatchingStockCityRemain";
import { KillRequestsStats } from "../features/stats/KillRequestsStats";
import { NumberOfKills } from "../features/stats/NumberOfKills";
import { SPACING } from "../data/spacing";
import { ChickenPriceStats } from "../features/stats/ChickenPriceStats";
import { NumberOfKillsByWeight } from "../features/stats/NumberOfKillsByWeight";
import { KillFilesStats } from "../features/stats/KillFilesStats";
import { KillProcessKillRequestStats } from "../features/stats/KillProcessKillRequestStats";
import { KillProcessAllocationStats } from "../features/stats/KillProcessAllocationStats";
import { KillProcessVetFarmStats } from "../features/stats/KillProcessVetFarmStats";
import { KillProcessKillhouseVetStats } from "../features/stats/KillProcessKillhouseVetStats";
import { HatchingRemainPredictionStats } from "../features/stats/HatchingRemainPredictionStats";
import {
Button,
FormControl,
FormHelperText,
InputLabel,
MenuItem,
Select,
Typography,
} from "@mui/material";
import { format } from "date-fns-jalali";
import { useScreenshot } from "use-react-screenshot";
import { createRef, useEffect } from "react";
import DownloadIcon from "@mui/icons-material/Download";
import { KillProcessStats } from "../features/province/components/kill-process-stats/KillProcessStats";
import { useFormik } from "formik";
import { getListOfProvinces } from "../utils/getListOfProvinces";
import { getRoleFromUrl } from "../utils/getRoleFromUrl";
import { DistributeOfCarcasses } from "../features/stats/DistributeOfCarcasses";
import { useSelector } from "react-redux";
const AdminStatics = () => {
const ref = createRef(null);
const [image, takeScreenshot] = useScreenshot();
const getImage = () => takeScreenshot(ref.current);
const userPath = useSelector((item) => item.userSlice.userPath);
useEffect(() => {
if (image) {
const downloadLink = document.createElement("a");
downloadLink.href = image;
downloadLink.setAttribute("download", "report.png");
downloadLink.click();
}
}, [image]);
const formik = useFormik({
initialValues: {
province: userPath,
},
});
useEffect(() => {
formik.validateForm();
}, []);
const isMobile = window.innerWidth <= 600;
return (
<Box
style={{
display: "flex",
alignItems: "center",
justifyContent: "center",
marginTop: "10px",
flexDirection: "column",
}}
>
<Grid
style={{ marginBottom: "10px" }}
container
xs={10}
mt={SPACING.SMALL}
justifyContent="flex-end"
>
<Grid xs={6} lg={2} md={4} sm={2}>
{(getRoleFromUrl() === "Observatory" ||
getRoleFromUrl() === "AdminX") && (
<FormControl>
<InputLabel id="demo-simple-select-label">
انتخاب استان
</InputLabel>
<Select
size="small"
displayEmpty
labelId="demo-simple-select-label"
id="province"
value={formik.values.province}
error={
formik.touched.province
? Boolean(formik.errors.province)
: null
}
onChange={(e) => {
formik.setFieldValue("province", e.target.value);
}}
onBlur={formik.handleBlur}
>
{getListOfProvinces().map((item) => {
return (
<MenuItem key={item.link} value={item.link}>
{item.name}
</MenuItem>
);
})}
</Select>
<FormHelperText>
{formik.touched.province && Boolean(formik.errors.province)
? formik.errors.province
: null}
</FormHelperText>
</FormControl>
)}
</Grid>
<Grid xs={4} lg={2} md={4} sm={2}>
<Button startIcon={<DownloadIcon />} onClick={getImage}>
دانلود آمار
</Button>
</Grid>
</Grid>
{}
{}
{}
<Box
ref={ref}
style={{
display: "flex",
alignItems: "center",
justifyContent: "center",
marginTop: "10px",
paddingBottom: "50px",
flexDirection: "column",
}}
>
<Box
sx={{ boxShadow: 4, borderRadius: "20px", padding: "20px" }}
width="80%"
mt={SPACING.SMALL}
mb={SPACING.SMALL}
>
<Grid container xs={12} justifyContent="space-between">
<Grid xs={12} md={12} sm={12} lg={3}>
<KillRequestsStats province={formik.values.province} />
</Grid>
<Grid xs={12} md={12} sm={12} lg={2}>
<KillFilesStats province={formik.values.province} />
</Grid>
<Grid xs={12} md={12} sm={12} lg={3}>
<FarmsStats province={formik.values.province} />
</Grid>
<Grid xs={12} md={12} sm={12} lg={2}>
<UsersStats province={formik.values.province} />
</Grid>
<Grid xs={12} md={12} sm={12} lg={2}>
<ChickenPriceStats province={formik.values.province} />
</Grid>
</Grid>
</Box>
<Box
style={{
width: "80%",
display: "flex",
justifyContent: "space-between",
marginTop: "40px",
flexDirection: "column",
alignItems: "start",
}}
>
<Grid
container
width="100%"
justifyContent="space-between"
alignItems="center"
>
<Typography>
روند کشتار امروز مورخ {format(new Date(), "yyyy/MM/dd")}
</Typography>
<KillProcessStats province={formik.values.province} />
</Grid>
<Box
mb={SPACING.MEDIUM}
gap={SPACING.TINY}
style={{
display: "flex",
justifyContent: "space-between",
marginTop: "20px",
width: "100%",
}}
>
<KillProcessKillRequestStats province={formik.values.province} />
<KillProcessAllocationStats province={formik.values.province} />
<KillProcessVetFarmStats province={formik.values.province} />
<KillProcessKillhouseVetStats province={formik.values.province} />
<DistributeOfCarcasses province={formik.values.province} />
</Box>
</Box>
<Box
style={{
width: isMobile ? "40%" : "80%",
display: "flex",
justifyContent: "space-between",
flexDirection: "column",
gap: SPACING.MEDIUM,
}}
>
{}
<HatchingStock province={formik.values.province} />
<br />
{}
{}
<HatchingStockAge province={formik.values.province} />
{}
</Box>
<Box
style={{
width: "80%",
display: "flex",
justifyContent: "space-between",
marginTop: "40px",
}}
>
<Box style={{ width: "48%" }}>
<HatchingStockCity province={formik.values.province} />
</Box>
<Box style={{ width: "48%" }}>
<HatchingStockCityRemain province={formik.values.province} />
</Box>
</Box>
<Box
style={{
width: "80%",
display: "flex",
justifyContent: "space-between",
marginTop: "40px",
}}
>
<Box style={{ width: "48%" }}>
<NumberOfKills province={formik.values.province} />
</Box>
<Box style={{ width: "48%" }}>
<NumberOfKillsByWeight province={formik.values.province} />
</Box>
</Box>
<Box
style={{
width: "80%",
display: "flex",
justifyContent: "space-between",
marginTop: "40px",
}}
>
<HatchingRemainPredictionStats province={formik.values.province} />
</Box>
</Box>
</Box>
);
};
export default AdminStatics;

View File

@@ -0,0 +1,7 @@
import React from "react";
const AdminXDashboard = () => {
return <div>AdminXDashboard</div>;
};
export default AdminXDashboard;

View File

@@ -0,0 +1,26 @@
import React from "react";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { Box } from "@mui/material";
import { AdminCExcelStatus } from "../features/admix-x/components/admin-x-excel-status/AdminCExcelStatus";
const AdminXExcelCheck = () => {
return (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
my={SPACING.MEDIUM}
>
<AdminCExcelStatus />
</Grid>
</Box>
);
};
export default AdminXExcelCheck;

35
src/pages/Auction.js Normal file
View File

@@ -0,0 +1,35 @@
import { Box } from "@mui/system";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { AuctionsBids } from "../features/auction/components/auction-bids/AuctionBids";
import { AuctionsView } from "../features/auction/components/auctions-view/AuctionsView";
import useUserProfile from "../features/authentication/hooks/useUserProfile";
import { getRoleFromUrl } from "../utils/getRoleFromUrl";
const Auction = () => {
const [roles] = useUserProfile();
return (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<AuctionsView />
</Grid>
{getRoleFromUrl() === "KillHouse" && roles.includes("KillHouse") && (
<Grid justifyContent="center" my={SPACING.MEDIUM}>
<AuctionsBids />
</Grid>
)}
</Grid>
</Box>
);
};
export default Auction;

640
src/pages/Auth.js Normal file
View File

@@ -0,0 +1,640 @@
import { Box } from "@mui/system";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import {
Button,
IconButton,
InputAdornment,
TextField,
Typography,
} from "@mui/material";
import Captcha from "../components/captcha/Captcha";
import {
CLOSE_MODAL,
LOADING_END,
LOADING_START,
OPEN_MODAL,
} from "../lib/redux/slices/appSlice";
import {
checkActiveUsers,
checkUserPath,
loginWithPassword,
} from "../features/authentication/services/login";
import { Yup } from "../lib/yup/yup";
import { useFormik } from "formik";
import { useDispatch } from "react-redux";
import { useContext, useEffect, useState } from "react";
import { AppContext } from "../contexts/AppContext";
import Visibility from "@mui/icons-material/Visibility";
import VisibilityOff from "@mui/icons-material/VisibilityOff";
import { getUserMovingTextsService } from "../features/authentication/services/getUserMovingTexts";
import { slaughterGetPermisionState } from "../features/slaughter-house/services/slaughter-get-permision";
import { getUserAnnouncement } from "../features/authentication/services/get-announcement";
import bgImg from "../assets/images/login-rasadyar.png";
import loginLogo from "../assets/images/login-logo.png";
import icon from "../assets/images/logo.png";
import { motion } from "framer-motion";
import { getUserProfile } from "../features/authentication/services/getUserProfile";
import { AuthPrivacyText } from "../features/authentication/components/auth-privacy-text/AuthProvacyText";
const modalContentStyle = {
backgroundColor: "#ffffff",
padding: "20px",
borderRadius: "4px",
outline: "none",
minWidth: "300px",
maxWidth: "600px",
textAlign: "center",
};
const descriptionStyle = {
marginBottom: "10px",
};
const buttonStyle = {
marginTop: "10px",
};
const containerVariants = {
hidden: { opacity: 0, scale: 0.9 },
visible: { opacity: 1, scale: 1, transition: { duration: 0.5 } },
};
const itemVariants = {
hidden: { opacity: 0, y: 20 },
visible: { opacity: 1, y: 0, transition: { duration: 0.3 } },
};
const Auth = () => {
const [activeUsers, setActiveUsers] = useState(0);
const [openNotif] = useContext(AppContext);
const [isValidCaptcha, setIsValidCaptcha] = useState(false);
const dispatch = useDispatch();
const [isValidMobile, setIsValidMobile] = useState(false);
const [isValidMobileChecked, setIsValidMobileChecked] = useState(false);
const formik = useFormik({
initialValues: {
mobile: "",
captcha: "",
password: "",
},
validationSchema: Yup.object({
mobile: Yup.number()
.required("این فیلد اجباری است!")
.typeError("لطفا اعداد انگلیسی وارد کنید!")
.test("len", "شماره تلفن باید 11 رقم باشد!", (val, context) => {
return context.originalValue && context.originalValue.length === 11;
}),
password: Yup.mixed().required("این فیلد اجباری است!"),
}),
});
useEffect(() => {
formik.validateForm();
dispatch(checkActiveUsers()).then((r) => {
const currentTime = new Date();
const hours = currentTime.getHours();
if (hours >= 20 || hours < 5) {
setActiveUsers(r.payload.data?.numberOfActiveUsers);
} else {
setActiveUsers(r.payload.data?.numberOfActiveUsers + 320);
}
});
}, []);
useEffect(() => {
if (formik.values.mobile.length === 11) {
dispatch(checkUserPath({ mobile: formik.values.mobile, state: "" })).then(
(r) => {
if (r.error) {
formik.setFieldValue("mobile", "");
openNotif({
vertical: "top",
horizontal: "center",
msg: "لطفا اتصال به اینترنت را چک کنید!",
severity: "error",
});
} else {
const notValid = !!r.error;
setIsValidMobileChecked(true);
if (notValid) {
setIsValidMobile(false);
} else {
setIsValidMobile(true);
}
}
}
);
}
}, [formik.values.mobile]);
const getUserMovingTexts = () => {
dispatch(getUserMovingTextsService());
};
const [showPassword, setShowPassword] = useState(false);
const handleClickShowPassword = () => {
setShowPassword(!showPassword);
};
const handleMouseDownPassword = (event) => {
event.preventDefault();
};
const getSlaughterState = (role) => {
dispatch(slaughterGetPermisionState());
dispatch(getUserAnnouncement(role)).then((r) => {
if (r.payload.data?.active) {
dispatch(
OPEN_MODAL({
title: "اطلاعیه سیستم",
content: (
<Grid style={modalContentStyle}>
<Typography
variant="body1"
color="secondary"
style={descriptionStyle}
>
{r.payload.data?.description}
</Typography>
<Grid container justifyContent="center">
<Grid item xs={12}>
<Button
color="secondary"
variant="outlined"
onClick={() => dispatch(CLOSE_MODAL())}
style={buttonStyle}
>
متوجه شدم
</Button>
</Grid>
</Grid>
</Grid>
),
})
);
}
});
};
const submitForm = (e) => {
e.preventDefault();
if (isValidMobile) {
dispatch(LOADING_START());
dispatch(
loginWithPassword({
mobile: formik.values.mobile,
password: formik.values.password,
})
).then((r) => {
dispatch(getUserProfile());
if (r.payload?.data?.role?.includes("KillHouse")) {
getSlaughterState("KillHouse");
} else if (r.payload?.data?.role?.includes("CityOperator")) {
getSlaughterState("CityOperator");
}
if (r.error) {
openNotif({
vertical: "top",
horizontal: "center",
msg: "نام کاربری یا رمز اشتباه است!",
severity: "error",
});
}
dispatch(LOADING_END());
});
} else {
openNotif({
vertical: "top",
horizontal: "center",
msg: "شماره موبایل در سامانه وجود ندارد!",
severity: "error",
});
}
};
return (
<Box
display="flex"
justifyContent="center"
sx={{
height: "100vh",
backgroundImage: `url(${bgImg})`,
backgroundSize: "cover",
backgroundPosition: "center",
}}
>
<Grid
container
justifyContent="center"
gap={SPACING.SMALL}
alignItems="center"
height="100vh"
xs={12}
>
<motion.div
initial="hidden"
animate="visible"
variants={containerVariants}
>
<motion.div
variants={itemVariants}
style={{
display: "flex",
justifyContent: "center",
}}
>
<Grid
container
justifyContent="center"
alignItems="center"
xs={12}
sx={{ maxWidth: "1200px" }}
>
<Grid
container
justifyContent="center"
alignItems="center"
p={6}
xs={12}
md={6}
borderRadius={{ xs: "15px", md: "15px 0px 0px 15px" }}
sx={{
backgroundColor: "white",
height: "650px",
borderStyle: "solid",
borderWidth: "1px",
borderColor: "#8F8F8F",
}}
>
<Grid container justifyContent="center" my={2}>
<Grid
container
xs={12}
justifyContent="center"
alignItems="center"
spacing={4}
>
<img
src={icon}
alt="icon"
style={{ width: "130px", userSelect: "none" }}
/>
</Grid>
<Grid
container
justifyContent="center"
xs={12}
alignItems="center"
spacing={6}
my={"20px"}
>
<Grid container>
<motion.div
animate={{ opacity: [1, 0.7, 1] }}
transition={{ duration: 5, repeat: Infinity }}
>
<Typography
style={{
fontSize: "18px",
color: "#717171",
fontWeight: "700",
}}
>
سامانه رصدیار
</Typography>
{/* <Typography variant="body1">
شماره موبایل تان را وارد کنید.
</Typography> */}
</motion.div>
</Grid>
</Grid>
<Grid
container
xs={12}
justifyContent="center"
alignItems="center"
>
<form onSubmit={submitForm}>
<Grid>
<TextField
id="mobile"
label="شماره تلفن"
variant="outlined"
sx={{ width: "100%" }}
value={formik.values.mobile}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
/>
</Grid>
<Grid mt={"16px"}>
<TextField
type={showPassword ? "text" : "password"}
id="password"
label="رمزعبور"
variant="outlined"
onChange={formik.handleChange}
value={formik.values.password}
onBlur={formik.handleBlur}
onKeyDown={(e) => {
if (
e.key === "Enter" &&
isValidCaptcha &&
isValidMobileChecked
) {
if (isValidMobile) {
dispatch(LOADING_START());
dispatch(
loginWithPassword({
mobile: formik.values.mobile,
password: formik.values.password,
})
).then((r) => {
dispatch(getUserProfile());
if (
r.payload?.data?.role?.includes(
"CityOperator"
) ||
r.payload?.data?.role?.includes(
"KillHouse"
) ||
r.payload?.data?.role?.includes(
"CityJahad"
) ||
r.payload?.data?.role?.includes(
"ProvinceSupervisor"
) ||
r.payload?.data?.role?.includes(
"ProvinceOperator"
)
) {
getUserMovingTexts();
}
if (
r.payload?.data?.role?.includes("KillHouse")
) {
getSlaughterState("KillHouse");
} else if (
r.payload?.data?.role?.includes(
"CityOperator"
)
) {
getSlaughterState("CityOperator");
}
if (r.error) {
openNotif({
vertical: "top",
horizontal: "center",
msg: "رمزعبور اشتباه است!",
severity: "error",
});
}
dispatch(LOADING_END());
});
} else {
openNotif({
vertical: "top",
horizontal: "center",
msg: "شماره موبایل در سامانه وجود ندارد!",
severity: "error",
});
}
}
}}
fullWidth
InputProps={{
endAdornment: (
<InputAdornment position="end">
<IconButton
tabIndex={-1}
aria-label="نمایش رمز عبور"
onClick={handleClickShowPassword}
edge="end"
onMouseDown={handleMouseDownPassword}
>
{showPassword ? (
<VisibilityOff />
) : (
<Visibility />
)}
</IconButton>
</InputAdornment>
),
}}
/>
</Grid>
<Grid
container
justifyContent="space-between"
flexWrap="nowrap"
sx={{
flexDirection: { xs: "column", sm: "row" },
}}
gap={SPACING.SMALL}
mt={SPACING.SMALL}
>
<Captcha
onChange={(status) => setIsValidCaptcha(status)}
/>
</Grid>
<Grid
container
justifyContent="space-between"
gap={SPACING.MEDIUM}
direction="row"
mt={SPACING.SMALL}
>
<Grid flexGrow="2">
<Button
sx={{ height: "48px" }}
variant="contained"
fullWidth
type="submit"
disabled={
!(isValidCaptcha && formik.isValid) ||
!isValidMobileChecked
}
onSubmit={submitForm}
>
ورود
</Button>
</Grid>
</Grid>
</form>
</Grid>
<Typography
variant="body2"
mt={2}
sx={{ fontWeight: 500, color: "#555" }}
>
مطالعه بیانیه{" "}
<Typography
component="span"
sx={{
color: "#1976d2",
fontWeight: 600,
cursor: "pointer",
position: "relative",
transition: "color 0.3s",
"&::after": {
content: '""',
position: "absolute",
left: 0,
bottom: -2,
width: "100%",
height: "2px",
backgroundColor: "#1976d2",
transform: "scaleX(0)",
transition: "transform 0.3s ease-in-out",
},
"&:hover": { color: "#125699" },
"&:hover::after": { transform: "scaleX(1)" },
}}
onClick={() =>
dispatch(
OPEN_MODAL({
title: "حریم خصوصی",
content: <AuthPrivacyText />,
})
)
}
>
حریم خصوصی
</Typography>
</Typography>
</Grid>
</Grid>
<Grid
container
justifyContent="center"
alignItems="center"
p={6}
display={{ xs: "none", md: "flex" }}
xs={6}
sx={{
backgroundImage:
"linear-gradient(to bottom, #163A5C, #0D2538)",
height: "650px",
borderRadius: "0px 15px 15px 0px",
borderStyle: "solid",
borderWidth: "1px",
borderColor: "#8F8F8F",
flexDirection: "column",
textAlign: "center",
}}
>
{/* Logo Image */}
<Box
component="img"
src={loginLogo}
alt="سامانه رصد یار"
sx={{ width: 360 }}
/>
{/* Text Content */}
<Typography
variant="body1"
color="white"
fontWeight="bold"
sx={{ fontSize: "16px" }}
>
سامانه رصد و پایش زنجیره تامین، تولید و توزیع کالای اساسی
</Typography>
<Typography
variant="body1"
color="white"
mt={2}
sx={{ textAlign: "justify" }}
>
از اینکه از سامانه برای بررسی و مدیریت کالاهای اساسی استفاده
میکنید، بسیار خرسندیم. امیدواریم که تجربهی شما با این
سامانه، مفید و کارآمد باشد. در صورت نیاز به راهنمایی یا
پرسشهای بیشتر، تیم پشتیبانی ما همواره آمادهی پاسخگویی به
شماست.
</Typography>
<Typography
variant="body1"
color="white"
fontWeight="bold"
mt={4}
>
با تشکر از همراهی شما
<br />
سامانه رصد یار
</Typography>
<Typography variant="body2" color="white" mt={1}>
تلفن پشتیبانی : 28421237-021
</Typography>
</Grid>
<Grid
container
justifyContent="center"
style={{
backgroundColor: "transparent",
borderRadius: "10px",
}}
mt={2}
xs={12}
>
{/* eslint-disable-next-line react/jsx-no-target-blank */}
<a
referrerPolicy="origin"
// rel="noreferrer"
target="_blank"
href="https://trustseal.enamad.ir/?id=548910&Code=IOzppvkTQHlCeBeP2Gz5VsnXqqra2Gq7"
>
<img
id="IOzppvkTQHlCeBeP2Gz5VsnXqqra2Gq7"
referrerPolicy="origin"
src="https://Trustseal.eNamad.ir/logo.aspx?id=548910&Code=IOzppvkTQHlCeBeP2Gz5VsnXqqra2Gq7"
// src={enamad}
alt="icon"
style={{
width: "100px",
userSelect: "none",
borderStyle: "solid",
borderWidth: "1px",
borderColor: "#8F8F8F",
borderRadius: "16px",
}}
/>
</a>
</Grid>
</Grid>
</motion.div>
<Grid container xs={12} mt={2} sx={{ justifyContent: "center" }}>
<Box
sx={{
backgroundColor: "white",
color: "white",
padding: "8px 16px",
borderRadius: "8px",
display: "inline-flex",
alignItems: "center",
alignSelf: "center",
// boxShadow: "0px 4px 6px rgba(0, 0, 0, 0.3)",
zIndex: {
xs: 0,
sm: 10,
},
}}
>
<Typography
variant="body1"
sx={{ fontSize: "16px", color: "#5B5B5B" }}
>
کاربران آنلاین: {activeUsers} نفر
</Typography>
</Box>
</Grid>
</motion.div>
</Grid>
</Box>
);
};
export default Auth;

View File

@@ -0,0 +1,24 @@
import { Box } from "@mui/system";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { ViewBankAccount } from "../features/aviculture/components/view-bank-account/ViewBankAccount";
import { ViewProfile } from "../features/aviculture/components/view-profile/ViewProfile";
const AvicultureDashboard = () => {
return (
<Box display={"flex"} justifyContent="center">
<Grid container direction="column" justifyContent="center">
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12} md={12} lg={7}>
<ViewProfile />
</Grid>
<Grid xs={12} md={12} lg={4.5}>
<ViewBankAccount />
</Grid>
</Grid>
</Grid>
</Box>
);
};
export default AvicultureDashboard;

View File

@@ -0,0 +1,156 @@
import { IconButton, Typography } from "@mui/material";
import React, { useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
import { useNavigate, useParams } from "react-router-dom";
import { avicultureGetHallInspects } from "../features/aviculture/services/aviculture-get-hall-inspects";
import { LOADING_END, LOADING_START } from "../lib/redux/slices/appSlice";
import NavigateNextIcon from "@mui/icons-material/NavigateNext";
import { Grid } from "../components/grid/Grid";
import {
Timeline,
TimelineConnector,
TimelineDot,
TimelineItem,
TimelineOppositeContent,
TimelineSeparator,
} from "@mui/lab";
import { SPACING } from "../data/spacing";
import { SimpleTable } from "../components/simple-table/SimpleTable";
import { formatJustDate, formatJustTime } from "../utils/formatTime";
import { Box } from "@mui/system";
const AvicultureHallInspects = () => {
const { avicultureHallInspects } = useSelector(
(state) => state.avicultureSlice
);
const dispatch = useDispatch();
const navigate = useNavigate();
const { key } = useParams();
const { hall } = useParams();
useEffect(() => {
dispatch(LOADING_START());
dispatch(avicultureGetHallInspects(key + "&hall=" + hall)).then(() => {
dispatch(LOADING_END());
});
}, []);
return (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
<Grid mt={SPACING.MEDIUM}>
<Grid container alignItems="center">
<IconButton
aria-label="delete"
color="primary"
onClick={() => navigate(-1)}
>
<NavigateNextIcon />
<Typography>بازگشت</Typography>
</IconButton>
</Grid>
<Timeline
sx={{
gap: SPACING.MEDIUM,
}}
>
{avicultureHallInspects?.map((item) => {
return (
<TimelineItem
key={item.id}
sx={{ alignSelf: "flex-start", width: "100%" }}
>
<TimelineSeparator>
<TimelineDot />
<TimelineConnector />
</TimelineSeparator>
<Grid
container
direction="column"
flexWrap="nowrap"
flex="1"
>
<Grid container>
<Grid>
<TimelineOppositeContent>
<Typography variant="body1" fontWeight="bold">
بازرسی مورخ {formatJustDate(item.createDate)}{" "}
ساعت {formatJustTime(item.createDate)}
</Typography>
</TimelineOppositeContent>
</Grid>
</Grid>
<Grid container xs={12}>
<Grid xs={12}>
<SimpleTable
columns={[
"موضوع بازرسی",
"توضیحات",
"تلفات",
"تصویر",
]}
data={[
[
item.topic,
item.description,
item.Losses,
item.image.length
? item.image.map((imageUrl) => {
return [
<Grid
display="inline-flex"
key={imageUrl}
>
<a href={imageUrl} alt="دانلود">
<img
src={imageUrl}
width="80"
height="80"
alt="دانلود"
style={{
marginRight: "10px",
borderRadius: "5px",
}}
/>
</a>
</Grid>,
];
})
: "بدون پیوست",
],
]}
/>
</Grid>
</Grid>
</Grid>
</TimelineItem>
);
})}
{!avicultureHallInspects?.length && (
<Typography variant="body1" component="span">
برای این سالن بازرسی ثبت نشده است.
</Typography>
)}
</Timeline>
</Grid>
</Grid>
</Grid>
</Grid>
</Box>
);
};
export default AvicultureHallInspects;

View File

@@ -0,0 +1,85 @@
import { Box, IconButton } from "@mui/material";
import React, { useEffect, useState } from "react";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { useDispatch, useSelector } from "react-redux";
import { avicultureGetHallsInfo } from "../features/aviculture/services/aviculture-get-halls-info";
import { LOADING_END, LOADING_START } from "../lib/redux/slices/appSlice";
import { ROUTE_AVICULTURE_INSPECTS } from "../routes/routes";
import { useNavigate } from "react-router-dom";
import { format } from "date-fns-jalali";
import ResponsiveTable from "../components/responsive-table/ResponsiveTable";
import TaskAltIcon from "@mui/icons-material/TaskAlt";
const AvicultureHalls = () => {
const dispatch = useDispatch();
const { avicultureHallsInfo } = useSelector((state) => state.avicultureSlice);
const [dataTable, setDataTable] = useState([]);
const navigate = useNavigate();
useEffect(() => {
dispatch(LOADING_START());
dispatch(avicultureGetHallsInfo()).then(() => {
dispatch(LOADING_END());
});
}, []);
useEffect(() => {
const d = avicultureHallsInfo?.map((item) => {
return [
item.hall,
item.hatchingState === "active" ? "دارد" : "ندارد",
format(new Date(item?.hatchingDate), "yyyy/MM/dd"),
item.inspections,
<IconButton
disabled={item.inspections === 0}
key={1}
aria-label="delete"
color="primary"
className="avicultureActiveRequestsBtn"
onClick={() =>
navigate(
ROUTE_AVICULTURE_INSPECTS + item.poultryKey + "/" + item.hall
)
}
>
<TaskAltIcon />
</IconButton>,
];
});
setDataTable(d);
}, [avicultureHallsInfo]);
return (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid justifyContent="center" my={SPACING.MEDIUM}>
<ResponsiveTable
paginated
title="لیست سالن ها"
columns={[
"شماره سالن",
"جوجه ریزی فعال",
"تاریخ آخرین جوجه ریزی",
"تعداد بازرسی ها",
"سوابق بازرسی",
]}
data={dataTable}
/>
</Grid>
</Grid>
</Box>
);
};
export default AvicultureHalls;

View File

@@ -0,0 +1,101 @@
import { Box, Card, IconButton } from "@mui/material";
import React, { useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { useNavigate } from "react-router-dom";
import { AdvancedTable } from "../components/advanced-table/AdvancedTable";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { avicultureGetReports } from "../features/aviculture/services/aviculture-get-reports";
import PlagiarismIcon from "@mui/icons-material/Plagiarism";
import { ROUTE_AVICULTURE_FILE } from "../routes/routes";
import { AvicultureReportsCharts } from "../features/aviculture/components/aviculture-reports-charts/AvicultureReportsCharts";
import { format } from "date-fns-jalali";
const AvicultureReports = () => {
const dispatch = useDispatch();
const { reports } = useSelector((state) => state.avicultureSlice);
const [tableData, setTableData] = useState();
const navigate = useNavigate();
useEffect(() => {
dispatch(avicultureGetReports());
}, []);
useEffect(() => {
const d = reports?.table.map((item, i) => {
return [
i + 1,
item.hatchingPeriod,
format(new Date(item?.hatchingDate), "yyyy/MM/dd"),
item.hatchingChickenBreed,
item.age,
item.quantity,
item.weightOfSuffering,
item.averageFee,
item.averageWeight,
item.salesPrice.toLocaleString(),
item.totalAmount.toLocaleString(),
item.paidState === "paid"
? "پرداخت شده"
: item.paidState === "pending"
? "در انتظار پرداخت"
: "ندارد",
<IconButton
key={i}
aria-label="delete"
color="primary"
className="avicultureActiveRequestsBtn"
onClick={() => navigate(ROUTE_AVICULTURE_FILE + item?.requestId)}
>
<PlagiarismIcon />
</IconButton>,
];
});
setTableData(d);
}, [reports]);
return (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid xs={12} mt={SPACING.SMALL}>
<Grid width="100%" className="avicultureActiveRequestsView">
<Card>
<AdvancedTable
name={"گزارش مرغدار"}
columns={[
"ردیف",
"دوره جوجه ریزی",
"تاریخ جوجه ریزی",
"نژاد",
"سن",
"تعداد",
// "تلفات",
"رنج وزن",
"قیمت رنج",
"میانگین وزن شما",
"قیمت فروش",
"جمع مبلغ به تومان",
"تراکنش مالی",
"نمایش پرونده",
]}
data={tableData}
/>
</Card>
</Grid>
<AvicultureReportsCharts data={reports} />
</Grid>
</Grid>
</Box>
);
};
export default AvicultureReports;

View File

@@ -0,0 +1,84 @@
import { Box, Typography } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { RequestsOperations } from "../features/aviculture/components/requests-operations/RequestsOperations";
import { useLocation } from "react-router-dom";
import {
ROUTE_AVICULTURE_ARCHIVED_REQUESTS,
ROUTE_AVICULTURE_REJECTED_REQUESTS,
ROUTE_AVICULTURE_REQUESTS,
ROUTE_AVICULTURE_HATCHING,
ROUTE_AVICULTURE_CREATE_NEW_REQUEST,
ROUTE_AVICULTURE_AWAITING_PAYMENT_REQUESTS,
ROUTE_AVICULTURE_AWAITING_INSPECTION_REQUESTS,
ROUTE_AVICULTURE_SUBMIT_REQUEST,
ROUTE_AVICULTURE_GIVE_PERMISSION,
} from "../routes/routes";
import { AvicultureNewRequest } from "../features/aviculture/components/aviculture-new-request/AvicultureNewRequest";
import { AvicultureActiveRequests } from "../features/aviculture/components/aviculture-active-requests/AvicultureActiveRequests";
import { AvicultureRejectedRequests } from "../features/aviculture/components/aviculture-rejected-requests/AvicultureRejectedRequests";
import { AvicultureArchivedRequests } from "../features/aviculture/components/aviculture-archived-requests/AvicultureArchivedRequests";
import { AvicultureHatching } from "../features/aviculture/components/aviculture-hatching/AvicultureHatching";
import { RequestsAwaitingPayment } from "../components/requests-awaiting-payment/RequestsAwaitingPayment";
import { RequestsAwaitingInspections } from "../components/requests-awaiting-inspections/RequestsAwaitingInspections";
import { BackButton } from "../components/back-button/BackButton";
import { AvicultureGivePermission } from "../features/aviculture/components/aviculture-give-permission/AvicultureGivePermission";
const AvicultureRequests = () => {
const { pathname } = useLocation();
return (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
{pathname === ROUTE_AVICULTURE_REQUESTS ? (
<>
<Grid mt={SPACING.MEDIUM}>
<Typography variant="h6">صفحه درخواست های مرغدار</Typography>
</Grid>
<Grid justifyContent="center" alignItems="center">
<RequestsOperations />
</Grid>
</>
) : (
<BackButton />
)}
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
{pathname === ROUTE_AVICULTURE_CREATE_NEW_REQUEST && (
<AvicultureNewRequest />
)}
{pathname === ROUTE_AVICULTURE_HATCHING && <AvicultureHatching />}
{pathname === ROUTE_AVICULTURE_SUBMIT_REQUEST && (
<AvicultureActiveRequests />
)}
{pathname === ROUTE_AVICULTURE_REJECTED_REQUESTS && (
<AvicultureRejectedRequests />
)}
{pathname === ROUTE_AVICULTURE_ARCHIVED_REQUESTS && (
<AvicultureArchivedRequests />
)}
{pathname === ROUTE_AVICULTURE_AWAITING_PAYMENT_REQUESTS && (
<RequestsAwaitingPayment />
)}
{pathname === ROUTE_AVICULTURE_AWAITING_INSPECTION_REQUESTS && (
<RequestsAwaitingInspections />
)}
{pathname === ROUTE_AVICULTURE_GIVE_PERMISSION && (
<AvicultureGivePermission />
)}
</Grid>
</Grid>
</Grid>
</Box>
);
};
export default AvicultureRequests;

30
src/pages/BarInfos.js Normal file
View File

@@ -0,0 +1,30 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import {} from "../routes/routes";
import { ProvinceBarInfos } from "../features/province/components/province-bar-infos/ProvinceBarInfos";
const BarInfos = () => {
return (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
my={SPACING.MEDIUM}
>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
<ProvinceBarInfos />
</Grid>
</Grid>
</Grid>
</Box>
);
};
export default BarInfos;

View File

@@ -0,0 +1,117 @@
import { Box, Button } from "@mui/material";
import React from "react";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { BackButton } from "../components/back-button/BackButton";
import ResponsiveTable from "../components/responsive-table/ResponsiveTable";
const BarSquareTransactions = () => {
const data = [
[
"1",
"1404/2/17",
"پرداخت شده",
"1,150,000",
<Button
href="https://miran.storage.c2.liara.space/factor/1.pdf"
size="small"
variant="contained"
key="ee"
>
دانلود
</Button>,
],
[
"2",
"1404/2/16",
"پرداخت شده",
"830,000",
<Button
href="https://miran.storage.c2.liara.space/factor/2.pdf"
size="small"
variant="contained"
key="ee"
>
دانلود
</Button>,
],
[
"3",
"1404/2/16",
"پرداخت شده",
"12,000,000",
<Button
href="https://miran.storage.c2.liara.space/factor/3.pdf"
size="small"
variant="contained"
key="ee"
>
دانلود
</Button>,
],
[
"4",
"1404/2/15",
"پرداخت شده",
"120,000",
<Button
href="https://miran.storage.c2.liara.space/factor/4.pdf"
size="small"
variant="contained"
key="ee"
>
دانلود
</Button>,
],
[
"5",
"1404/2/14",
"پرداخت شده",
"8,100,000",
<Button
href="https://miran.storage.c2.liara.space/factor/5.pdf"
size="small"
variant="contained"
key="ee"
>
دانلود
</Button>,
],
];
return (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
my={SPACING.MEDIUM}
>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12} container>
<BackButton />
</Grid>
<Grid xs={12}>
<ResponsiveTable
paginated
title="تراکنش ها"
data={data}
columns={[
"ردیف",
"تاریخ",
"وضعیت",
"مبلغ تراکنش",
"جزئیات محصولات",
]}
/>
</Grid>
</Grid>
</Grid>
</Box>
);
};
export default BarSquareTransactions;

View File

@@ -0,0 +1,47 @@
import { Box } from "@mui/system";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import SlaughterAgentShare from "../pages/SlaughterAgentShare";
import { BroadcastManagementOperations } from "../features/province/components/broadcast-management-operations/BroadcastManagementOperations";
import {
ROUTE_ADMINX_BROADCAST_MANAGEMENT,
ROUTE_ADMINX_ROUTE_AGENT_SHARE,
ROUTE_PROVINCE_ROUTE_AGENT_SHARE,
ROUTE_PROVINCEـBROADCAST_MANAGEMENT,
ROUTE_SUPER_ADMIN_BROADCAST_MANAGEMENT,
ROUTE_SUPER_ADMIN_ROUTE_AGENT_SHARE,
} from "../routes/routes";
import { useLocation } from "react-router-dom";
const BroadcastManagement = () => {
const { pathname } = useLocation();
return (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
my={SPACING.MEDIUM}
xs={12}
sm={12}
md={10}
lg={10}
>
{(pathname === ROUTE_PROVINCEـBROADCAST_MANAGEMENT ||
pathname === ROUTE_SUPER_ADMIN_BROADCAST_MANAGEMENT ||
pathname === ROUTE_ADMINX_BROADCAST_MANAGEMENT) && (
<BroadcastManagementOperations />
)}
{(pathname === ROUTE_PROVINCE_ROUTE_AGENT_SHARE ||
pathname === ROUTE_SUPER_ADMIN_ROUTE_AGENT_SHARE ||
pathname === ROUTE_ADMINX_ROUTE_AGENT_SHARE) && (
<SlaughterAgentShare />
)}
</Grid>
</Box>
);
};
export default BroadcastManagement;

View File

@@ -0,0 +1,34 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { ProvinceManageCars } from "../features/province/components/province-manage-cars/ProvinceManageCars";
const CarManagement = () => {
return (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
my={SPACING.MEDIUM}
>
{/* <Grid justifyContent="center" my={SPACING.MEDIUM}>
<Card>
<SlaughterOperations />
</Card>
</Grid> */}
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
<ProvinceManageCars />
</Grid>
</Grid>
</Grid>
</Box>
);
};
export default CarManagement;

47
src/pages/Cars.js Normal file
View File

@@ -0,0 +1,47 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { useLocation } from "react-router-dom";
import {
ROUTE_SLAUGHTER_ADD_CAR,
ROUTE_SLAUGHTER_CAR_MANAGEMENT,
} from "../routes/routes";
import { SlaughterNewCar } from "../features/slaughter-house/components/slaughter-new-car/SlaughterNewCar";
import { SlaughterManageCars } from "../features/slaughter-house/components/slaughter-manage-cars/SlaughterManageCars";
const Cars = () => {
const { pathname } = useLocation();
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
my={SPACING.MEDIUM}
>
{/* <Grid justifyContent="center" my={SPACING.MEDIUM}>
<Card>
<SlaughterOperations />
</Card>
</Grid> */}
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
{pathname === ROUTE_SLAUGHTER_ADD_CAR && <SlaughterNewCar />}
{pathname === ROUTE_SLAUGHTER_CAR_MANAGEMENT && (
<SlaughterManageCars />
)}
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default Cars;

45
src/pages/ChainCompany.js Normal file
View File

@@ -0,0 +1,45 @@
import { Box } from "@mui/material";
import React from "react";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { ChainCompanyActiveChains } from "../features/chain-company/components/chain-company-active-chains/ChainCompanyActiveChains";
import { useLocation } from "react-router-dom";
import {
ROUTE_CHAIN_COMPANY_MANAGE_BARS,
ROUTE_CHAIN_COMPANY_POULTRIES,
} from "../routes/routes";
import { ChainBarManagement } from "../features/province/components/chain-bar-management/ChainBarManagement";
const ChainCompany = () => {
const { pathname } = useLocation();
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
my={SPACING.MEDIUM}
>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
{pathname === ROUTE_CHAIN_COMPANY_POULTRIES && (
<ChainCompanyActiveChains />
)}
{pathname === ROUTE_CHAIN_COMPANY_MANAGE_BARS && (
<ChainBarManagement />
)}
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default ChainCompany;

View File

@@ -0,0 +1,76 @@
import {
Button,
Divider,
InputAdornment,
TextField,
Typography,
} from "@mui/material";
import { Box } from "@mui/system";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import SearchIcon from "@mui/icons-material/Search";
import StockMarketStickyOperations from "../features/chickenStockMarket/components/stock-market-sticky-operations/StockMarketStickyOperations";
// import { StockMarketAvicultureRequests } from "../features/chickenStockMarket/components/stock-market-aviculture-requests-list/StockMarketAvicultureRequests";
// import { StockMarketSlaughterRequests } from "../features/chickenStockMarket/components/stock-market-slaughter-requests-list/StockMarketSlaughterRequests";
const ChickenStockMarket = () => {
return (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
my={SPACING.MEDIUM}
xs={12}
sm={12}
md={10}
lg={10}
p={SPACING.TINY}
>
<Grid p={SPACING.TINY} display="flex" justifyContent="space-between">
<Typography display="flex">پنل فروش مرغ گوشتی</Typography>
<Button variant="outlined">ثبت کشار جدید</Button>
</Grid>
<Grid display="flex" justifyContent="space-between">
<TextField
id="outlined-basic"
label="جستجو"
variant="outlined"
InputProps={{
startAdornment: (
<InputAdornment position="start">
<SearchIcon />
</InputAdornment>
),
}}
/>
<Typography color="secondary" display="flex">
تاریخ: ۱۴۰۱.۰۶.۰۲
</Typography>
</Grid>
<Divider sx={{ marginTop: "10px" }} />
<Grid justifyContent="space-between" display="flex" mt={SPACING.SMALL}>
<Typography color="secondary" display="flex">
درخواست کشتار مرغدار
</Typography>
<Typography variant="body2" color="primary" display="flex">
قیمت میانگین : ۴۰۳.۰۰۰ ریال
</Typography>
</Grid>
<Grid>{/* <StockMarketAvicultureRequests /> */}</Grid>
<Grid justifyContent="space-between" display="flex" mt={SPACING.MEDIUM}>
<Typography color="secondary" display="flex">
درخواست کشتار مرغدار
</Typography>
<Typography variant="body2" color="primary" display="flex">
قیمت میانگین : ۴۰۳.۰۰۰ ریال
</Typography>
</Grid>
<Grid>{/* <StockMarketSlaughterRequests /> */}</Grid>
{/* bottom Menu */}
</Grid>
<StockMarketStickyOperations />
</Box>
);
};
export default ChickenStockMarket;

View File

@@ -0,0 +1,42 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { useLocation } from "react-router-dom";
import { ROUTE_CITY_POULTRY_FARMS } from "../routes/routes";
import { useDispatch } from "react-redux";
import { useEffect } from "react";
import { avicultureGetRequests } from "../features/aviculture/services/aviculture-requests";
import { CityPoultryFarms } from "../features/city/components/city-poultry-farms/CityPoultryFarms";
const CityAvicultureFarms = () => {
const { pathname } = useLocation();
const dispatch = useDispatch();
useEffect(() => {
dispatch(avicultureGetRequests());
}, []);
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
{pathname === ROUTE_CITY_POULTRY_FARMS && <CityPoultryFarms />}
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default CityAvicultureFarms;

83
src/pages/CityRequests.js Normal file
View File

@@ -0,0 +1,83 @@
import { Box, Typography } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { CityOperations } from "../features/city/components/city-operations/CityOperations";
import { useLocation } from "react-router-dom";
import {
ROUTE_CITY_ACTIVE_REQUESTS,
ROUTE_CITY_ARCHIVED_REQUESTS,
ROUTE_CITY_REJECTED_REQUESTS,
ROUTE_CITY_REQUESTS,
ROUTE_CITY_AWAITING_PAYMENT_REQUESTS,
ROUTE_CITY_AWAITING_INSPECTION_REQUESTS,
ROUTE_CITY_NEW_REQUESTS,
ROUTE_CITY_FREE_SALES_REQUESTS,
} from "../routes/routes";
import { CityNewRequests } from "../features/city/components/city-new-requests/CityNewRequests";
import { AvicultureArchivedRequests } from "../features/aviculture/components/aviculture-archived-requests/AvicultureArchivedRequests";
import { CityActiveRequests } from "../features/city/components/city-active-requests/CityActiveRequests";
import { CityRejectedRequests } from "../features/city/components/city-rejected-requests/CityRejectedRequests";
import { RequestsAwaitingInspections } from "../components/requests-awaiting-inspections/RequestsAwaitingInspections";
import { RequestsAwaitingPayment } from "../components/requests-awaiting-payment/RequestsAwaitingPayment";
import { BackButton } from "../components/back-button/BackButton";
import { ProvinceFreeSales } from "../features/province/components/province-free-sales/ProvinceFreeSales";
const CityRequests = () => {
const { pathname } = useLocation();
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
{pathname === ROUTE_CITY_REQUESTS ? (
<Grid justifyContent="center" my={SPACING.MEDIUM}>
<Grid>
<Typography variant="h6">
صفحه مدیریت درخواست ها (شهرستان)
</Typography>
</Grid>
<CityOperations />
</Grid>
) : (
<BackButton />
)}
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
{pathname === ROUTE_CITY_NEW_REQUESTS && <CityNewRequests />}
{pathname === ROUTE_CITY_ACTIVE_REQUESTS && (
<CityActiveRequests />
)}
{pathname === ROUTE_CITY_REJECTED_REQUESTS && (
<CityRejectedRequests />
)}
{pathname === ROUTE_CITY_ARCHIVED_REQUESTS && (
<AvicultureArchivedRequests />
)}
{pathname === ROUTE_CITY_AWAITING_PAYMENT_REQUESTS && (
<RequestsAwaitingPayment />
)}
{pathname === ROUTE_CITY_AWAITING_INSPECTION_REQUESTS && (
<RequestsAwaitingInspections />
)}
{pathname === ROUTE_CITY_FREE_SALES_REQUESTS && (
<ProvinceFreeSales />
)}
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default CityRequests;

33
src/pages/CityUserFile.js Normal file
View File

@@ -0,0 +1,33 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { useLocation } from "react-router-dom";
import { ROUTE_CITY_USER_FILE } from "../routes/routes";
import { CityUserFileInfo } from "../features/city/components/city-user-file-info/CityUserFileInfo";
const CityUserFile = () => {
const { pathname } = useLocation();
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
{pathname.includes(ROUTE_CITY_USER_FILE) && <CityUserFileInfo />}
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default CityUserFile;

View File

@@ -0,0 +1,34 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { useLocation } from "react-router-dom";
import { ROUTE_CITY_USER_MANAGEMENT } from "../routes/routes";
import { CityUsers } from "../features/city/components/city-users/CityUsers";
const CityUserManagement = () => {
const { pathname } = useLocation();
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
{pathname === ROUTE_CITY_USER_MANAGEMENT && <CityUsers />}
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default CityUserManagement;

50
src/pages/Commerce.js Normal file
View File

@@ -0,0 +1,50 @@
import { Box, Typography } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import {
ROUTE_COMMERCE_REQUESTS,
ROUTE_PROVINCE_SUPERVISOR_REQUESTS,
} from "../routes/routes";
import { useLocation } from "react-router-dom";
import { BackButton } from "../components/back-button/BackButton";
import { CommerceOperations } from "../features/commerce/components/commerce-operations/CommerceOperations";
const Commerce = () => {
const { pathname } = useLocation();
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
{pathname === ROUTE_COMMERCE_REQUESTS ||
pathname === ROUTE_PROVINCE_SUPERVISOR_REQUESTS ? (
<Grid justifyContent="center" my={SPACING.MEDIUM}>
<Grid>
<Typography variant="h6">
صفحه مدیریت درخواست ها (معاونت بازرگانی)
</Typography>
</Grid>
<CommerceOperations />
</Grid>
) : (
<BackButton />
)}
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}></Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default Commerce;

View File

@@ -0,0 +1,990 @@
import {
Box,
Paper,
Typography,
Divider,
Card,
CardContent,
TextField,
Chip,
Button,
} from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { BackButton } from "../components/back-button/BackButton";
import { ButtonWithIcon } from "../components/button-with-icon/ButtonWithIcon";
import { Timer } from "../components/timer/Timer";
import { LineWithText } from "../components/line-with-text/LineWithText";
import CustomCard from "../components/custom-card/CustomCard";
import Captcha from "../components/captcha/Captcha";
import { DialogAlert } from "../components/dialog-alert/DialogAlert";
import { SimpleTable } from "../components/simple-table/SimpleTable";
import ResponsiveTable from "../components/responsive-table/ResponsiveTable";
import ChartBar from "../components/chart-bar/ChartBar";
import ChartPie from "../components/chart-pie/ChartPie";
import ChartLinear from "../components/chart-linear/ChartLenear";
import ChartDoughnut from "../components/chart-doughnut/ChartDoughnut";
// Icons
import HomeIcon from "@mui/icons-material/Home";
import AddIcon from "@mui/icons-material/Add";
import SearchIcon from "@mui/icons-material/Search";
import DeleteIcon from "@mui/icons-material/Delete";
import EditIcon from "@mui/icons-material/Edit";
import SaveIcon from "@mui/icons-material/Save";
import SettingsIcon from "@mui/icons-material/Settings";
import PersonIcon from "@mui/icons-material/Person";
import { useState, useContext } from "react";
import { AppContext } from "../contexts/AppContext";
import { useDispatch } from "react-redux";
import { OPEN_MODAL } from "../lib/redux/slices/appSlice";
const ComponentsCatalog = () => {
const [searchTerm, setSearchTerm] = useState("");
const [captchaValid, setCaptchaValid] = useState(false);
const [openNotif] = useContext(AppContext);
const dispatch = useDispatch();
// Sample data for charts
const chartBarData = {
labels: ["فروردین", "اردیبهشت", "خرداد", "تیر", "مرداد", "شهریور"],
datasets: [
{
label: "فروش",
backgroundColor: ["rgba(33, 72, 214, 0.7)"],
data: [65, 59, 80, 81, 56, 55],
borderRadius: 5,
},
{
label: "خرید",
backgroundColor: ["rgba(100, 130, 160, 0.7)"],
data: [45, 49, 60, 71, 46, 35],
borderRadius: 5,
},
],
};
const chartPieData = {
labels: ["فعال", "غیرفعال", "در حال بررسی", "رد شده"],
datasets: [
{
label: "تعداد",
data: [300, 50, 100, 40],
backgroundColor: [
"rgba(75, 192, 192, 0.7)",
"rgba(255, 99, 132, 0.7)",
"rgba(255, 205, 86, 0.7)",
"rgba(201, 203, 207, 0.7)",
],
},
],
};
const chartLineData = {
labels: ["هفته 1", "هفته 2", "هفته 3", "هفته 4"],
datasets: [
{
label: "روند رشد",
fill: false,
borderColor: "rgb(75, 192, 192)",
tension: 0.1,
data: [12, 19, 13, 25],
},
],
};
// Sample data for table
const tableColumns = ["ردیف", "نام", "نام خانوادگی", "شهر", "وضعیت"];
const tableData = [
[1, "احمد", "محمدی", "تهران", "فعال"],
[2, "فاطمه", "رضایی", "اصفهان", "فعال"],
[3, "حسین", "کریمی", "مشهد", "غیرفعال"],
[4, "مریم", "احمدی", "شیراز", "فعال"],
[5, "علی", "حسینی", "تبریز", "در حال بررسی"],
];
// Sample data for responsive table
const responsiveTableColumns = [
"ردیف",
"کد درخواست",
"نام متقاضی",
"تاریخ ثبت",
"مقدار (کیلوگرم)",
"قیمت کل (ریال)",
"وضعیت",
];
const responsiveTableData = [
[
1,
"REQ-1001",
"احمد محمدی",
"1402/09/15",
"1,250",
"62,500,000",
"تایید شده",
],
[
2,
"REQ-1002",
"فاطمه رضایی",
"1402/09/16",
"2,100",
"105,000,000",
"در انتظار",
],
[3, "REQ-1003", "حسین کریمی", "1402/09/17", "850", "42,500,000", "رد شده"],
[
4,
"REQ-1004",
"مریم احمدی",
"1402/09/18",
"3,200",
"160,000,000",
"تایید شده",
],
[
5,
"REQ-1005",
"علی حسینی",
"1402/09/19",
"1,750",
"87,500,000",
"در انتظار",
],
[
6,
"REQ-1006",
"زهرا کاظمی",
"1402/09/20",
"950",
"47,500,000",
"تایید شده",
],
[
7,
"REQ-1007",
"محمد تقی‌زاده",
"1402/09/21",
"2,450",
"122,500,000",
"تایید شده",
],
[
8,
"REQ-1008",
"سارا موسوی",
"1402/09/22",
"1,100",
"55,000,000",
"در انتظار",
],
[
9,
"REQ-1009",
"رضا نوری",
"1402/09/23",
"3,800",
"190,000,000",
"تایید شده",
],
[
10,
"REQ-1010",
"نرگس احمدی",
"1402/09/24",
"1,450",
"72,500,000",
"رد شده",
],
[
11,
"REQ-1011",
"امیر حسینی",
"1402/09/25",
"2,650",
"132,500,000",
"تایید شده",
],
[
12,
"REQ-1012",
"لیلا کریمی",
"1402/09/26",
"890",
"44,500,000",
"در انتظار",
],
];
const components = [
{
category: "🧭 Navigation",
items: [
{
name: "BackButton",
description: "دکمه بازگشت با آیکون",
path: "components/back-button/BackButton.js",
component: <BackButton />,
},
],
},
{
category: "🔘 Buttons & Actions",
items: [
{
name: "ButtonWithIcon",
description: "دکمه با آیکون - انواع مختلف",
path: "components/button-with-icon/ButtonWithIcon.js",
component: (
<Grid container gap={2} flexWrap="wrap">
<ButtonWithIcon
Icon={HomeIcon}
title="صفحه اصلی"
onClick={() => alert("کلیک روی صفحه اصلی")}
/>
<ButtonWithIcon
Icon={AddIcon}
title="افزودن"
onClick={() => alert("کلیک روی افزودن")}
/>
<ButtonWithIcon
Icon={SearchIcon}
title="جستجو"
onClick={() => alert("کلیک روی جستجو")}
/>
<ButtonWithIcon
Icon={DeleteIcon}
title="حذف"
onClick={() => alert("کلیک روی حذف")}
/>
<ButtonWithIcon
Icon={EditIcon}
title="ویرایش"
onClick={() => alert("کلیک روی ویرایش")}
/>
<ButtonWithIcon
Icon={SaveIcon}
title="ذخیره"
onClick={() => alert("کلیک روی ذخیره")}
/>
<ButtonWithIcon
Icon={SettingsIcon}
title="تنظیمات"
onClick={() => alert("کلیک روی تنظیمات")}
/>
<ButtonWithIcon
Icon={PersonIcon}
title="پروفایل"
onClick={() => alert("کلیک روی پروفایل")}
/>
</Grid>
),
},
],
},
{
category: "🎴 Cards & Display",
items: [
{
name: "CustomCard",
description: "کارت سفارشی با گرادیانت و تصویر پس‌زمینه",
path: "components/custom-card/CustomCard.js",
component: (
<Grid container gap={2} flexWrap="wrap">
<CustomCard title="آمار کل درخواست‌ها" value="۱,۲۳۴" />
<CustomCard title="کاربران فعال" value="۵۶۷" />
<CustomCard title="پرونده‌های باز" value="۸۹" />
<CustomCard title="تراکنش‌های امروز" value="۱۲۳" />
</Grid>
),
},
],
},
{
category: "📐 Layout & Structure",
items: [
{
name: "LineWithText",
description: "خط تقسیم کننده با متن و گرادیانت رنگی",
path: "components/line-with-text/LineWithText.js",
component: (
<Box>
<LineWithText text="بخش اطلاعات کاربری" />
<Typography variant="body2" mb={2}>
محتوای بخش اول
</Typography>
<LineWithText text="بخش تنظیمات" />
<Typography variant="body2" mb={2}>
محتوای بخش دوم
</Typography>
<LineWithText text="بخش گزارش‌ها" />
</Box>
),
},
],
},
{
category: "⏱️ Time & Counters",
items: [
{
name: "Timer",
description: "تایمر شمارش معکوس با فرمت‌های مختلف",
path: "components/timer/Timer.js",
component: (
<Grid container gap={3} direction="column">
<Box>
<Typography variant="subtitle2" mb={1}>
تایمر ساعتی (HH:MM:SS):
</Typography>
<Paper sx={{ p: 2, display: "inline-block" }}>
<Timer seconds={3665} />
</Paper>
</Box>
<Box>
<Typography variant="subtitle2" mb={1}>
تایمر روزانه (DD:HH:MM:SS):
</Typography>
<Paper sx={{ p: 2, display: "inline-block" }}>
<Timer seconds={186400} isFilePaymentTime={true} />
</Paper>
</Box>
</Grid>
),
},
],
},
{
category: "📝 Forms & Inputs",
items: [
{
name: "Captcha",
description: "کد امنیتی (کپچا) با قابلیت تولید مجدد و پخش صوتی",
path: "components/captcha/Captcha.js",
component: (
<Box>
<Captcha onChange={(isValid) => setCaptchaValid(isValid)} />
<Typography variant="caption" color="text.secondary" mt={1}>
وضعیت: {captchaValid ? "✅ معتبر" : "❌ نامعتبر"}
</Typography>
</Box>
),
},
],
},
{
category: "🔔 Modals & Dialogs",
items: [
{
name: "Modal (Global)",
description: "سیستم مودال سراسری با Redux",
path: "components/modal/Modal.js",
component: (
<Box>
<Grid container gap={2} direction="column">
<Button
variant="contained"
onClick={() =>
dispatch(
OPEN_MODAL({
title: "عنوان مودال",
content: (
<Box p={2}>
<Typography>
این یک مودال سراسری است که از Redux استفاده میکند
</Typography>
</Box>
),
})
)
}
>
باز کردن مودال معمولی
</Button>
<Button
variant="contained"
color="success"
onClick={() =>
dispatch(
OPEN_MODAL({
title: "success",
content: null,
})
)
}
>
مودال موفقیت
</Button>
<Button
variant="contained"
color="error"
onClick={() =>
dispatch(
OPEN_MODAL({
title: "error",
content: null,
})
)
}
>
مودال خطا
</Button>
</Grid>
<Typography variant="caption" color="text.secondary" mt={2}>
این کامپوننت از Redux (appSlice) استفاده میکند
</Typography>
</Box>
),
},
{
name: "DialogAlert",
description: "دیالوگ با دکمه تریگر داخلی",
path: "components/dialog-alert/DialogAlert.js",
component: (
<Box>
<DialogAlert
btnTitle="مشاهده قوانین و مقررات"
title="قوانین و مقررات سیستم"
content="لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است. چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است."
isAccepted={false}
actions={[
<Button key="accept" variant="contained" color="primary">
پذیرفتم
</Button>,
<Button key="reject" variant="outlined">
نمیپذیرم
</Button>,
]}
/>
<Typography variant="caption" color="text.secondary" mt={2}>
این کامپوننت دکمه تریگر خود را دارد (چکباکس + متن)
</Typography>
</Box>
),
},
],
},
{
category: "📢 Notifications",
items: [
{
name: "Notif (Global)",
description: "سیستم نوتیفیکیشن سراسری",
path: "components/notif/Notif.js",
component: (
<Grid container gap={2} direction="column">
<Button
variant="contained"
color="success"
onClick={() =>
openNotif({
vertical: "top",
horizontal: "center",
msg: "عملیات با موفقیت انجام شد!",
severity: "success",
})
}
>
نوتیفیکیشن موفقیت
</Button>
<Button
variant="contained"
color="error"
onClick={() =>
openNotif({
vertical: "top",
horizontal: "center",
msg: "خطایی رخ داده است!",
severity: "error",
})
}
>
نوتیفیکیشن خطا
</Button>
<Button
variant="contained"
color="warning"
onClick={() =>
openNotif({
vertical: "top",
horizontal: "center",
msg: "توجه: این یک هشدار است",
severity: "warning",
})
}
>
نوتیفیکیشن هشدار
</Button>
<Button
variant="contained"
color="info"
onClick={() =>
openNotif({
vertical: "top",
horizontal: "center",
msg: "این یک پیام اطلاعاتی است",
severity: "info",
})
}
>
نوتیفیکیشن اطلاعات
</Button>
<Typography variant="caption" color="text.secondary">
این کامپوننت از AppContext استفاده میکند
</Typography>
</Grid>
),
},
],
},
{
category: "📊 Charts",
items: [
{
name: "ChartBar",
description: "نمودار میله‌ای با داده‌های واقعی",
path: "components/chart-bar/ChartBar.js",
component: (
<Box sx={{ height: 300, width: "100%" }}>
<ChartBar
chartData={chartBarData}
options={{
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
position: "top",
},
title: {
display: true,
text: "نمودار فروش و خرید ماهانه",
},
},
}}
/>
</Box>
),
},
{
name: "ChartPie",
description: "نمودار دایره‌ای",
path: "components/chart-pie/ChartPie.js",
component: (
<Box sx={{ height: 300, width: "100%" }}>
<ChartPie
chartData={chartPieData}
options={{
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
position: "top",
},
title: {
display: true,
text: "توزیع وضعیت درخواست‌ها",
},
},
}}
/>
</Box>
),
},
{
name: "ChartLinear",
description: "نمودار خطی",
path: "components/chart-linear/ChartLinear.js",
component: (
<Box sx={{ height: 300, width: "100%" }}>
<ChartLinear
chartData={chartLineData}
options={{
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
position: "top",
},
title: {
display: true,
text: "روند رشد هفتگی",
},
},
}}
/>
</Box>
),
},
{
name: "ChartDoughnut",
description: "نمودار دونات",
path: "components/chart-doughnut/ChartDoughnut.js",
component: (
<Box sx={{ height: 300, width: "100%" }}>
<ChartDoughnut
chartData={chartPieData}
options={{
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
position: "top",
},
title: {
display: true,
text: "نمودار دونات وضعیت‌ها",
},
},
}}
/>
</Box>
),
},
{
name: "Other Charts",
description: "سایر نمودارهای موجود",
path: "components/chart-*/",
component: (
<Box>
<Typography variant="body2" mb={2}>
نمودارهای دیگر موجود:
</Typography>
<Grid container gap={1} flexWrap="wrap">
{[
"ChartRadar",
"ChartPolarArea",
"ChartBubble",
"ChartScatter",
"AdvancedChart",
].map((name) => (
<Chip
key={name}
label={name}
variant="outlined"
color="primary"
/>
))}
</Grid>
</Box>
),
},
],
},
{
category: "📋 Tables",
items: [
{
name: "SimpleTable",
description: "جدول ساده با داده‌های واقعی",
path: "components/simple-table/SimpleTable.js",
component: (
<Box sx={{ width: "100%" }}>
<SimpleTable
name="لیست کاربران"
columns={tableColumns}
data={tableData}
/>
</Box>
),
},
{
name: "ResponsiveTable",
description: "جدول پیشرفته با فیلتر، مرتب‌سازی و صفحه‌بندی",
path: "components/responsive-table/ResponsiveTable.js",
component: (
<Box sx={{ width: "100%", overflowX: "auto" }}>
<ResponsiveTable
title="لیست درخواست‌های خرید"
columns={responsiveTableColumns}
data={responsiveTableData}
paginated={true}
customColors={[
{ name: "ردیف", color: "#e8f4f8" },
{ name: "کد درخواست", color: "#e1f5e1" },
{ name: "وضعیت", color: "#fff4e6" },
{ rest: true, color: "#f5f5f5" },
]}
/>
<Typography variant="caption" color="text.secondary" mt={2}>
قابلیتها: مرتبسازی کلیک روی هدر، فیلتر ستونها، جستجو،
صفحهبندی، و محاسبه مجموع
</Typography>
</Box>
),
},
{
name: "Other Tables",
description: "سایر جداول موجود در سیستم",
path: "components/table-*/",
component: (
<Box>
<Typography variant="body2" mb={2}>
کامپوننتهای جدول موجود:
</Typography>
<Grid container gap={1} flexWrap="wrap">
{[
"ModernTable",
"AdvancedTable",
"ResponsiveTable",
"MuiTable",
"MyTable",
"FlexTable",
"PageTable",
"PageTableApi",
"AdvancedTablePage",
].map((name) => (
<Chip
key={name}
label={name}
variant="outlined"
color="secondary"
/>
))}
</Grid>
<Typography variant="caption" color="text.secondary" mt={2}>
این کامپوننتها نیاز به دادههای جدولی دارند
</Typography>
</Box>
),
},
],
},
{
category: "📤 File Upload (Documentation Only)",
items: [
{
name: "Upload Components",
description: "کامپوننت‌های آپلود فایل",
path: "components/file-uploader/",
component: (
<Box>
<Typography variant="body2" mb={2}>
کامپوننتهای آپلود موجود:
</Typography>
<Grid container gap={1} flexWrap="wrap">
{[
"FileUploader",
"ImageUpload",
"ImgUploader",
"ExcelUploadButton",
].map((name) => (
<Chip
key={name}
label={name}
variant="outlined"
color="info"
/>
))}
</Grid>
<Typography variant="caption" color="text.secondary" mt={2}>
این کامپوننتها برای آپلود فایلهای مختلف استفاده میشوند
</Typography>
</Box>
),
},
],
},
{
category: "🎯 Specialized (Documentation Only)",
items: [
{
name: "Other Components",
description: "سایر کامپوننت‌های تخصصی سیستم",
path: "components/",
component: (
<Box>
<Typography variant="body2" mb={2}>
کامپوننتهای تخصصی:
</Typography>
<Grid container gap={1} flexWrap="wrap">
{[
"StateStepper",
"ChatSystem",
"TicketSummary",
"Dashboard",
"Map",
"ShowImage",
"ExcelLink",
"CheckClearanceCode",
"BoxList",
"LinkItem",
"BankCard",
"CarPelak",
"DatePicker",
"SelectCheck",
"AutocompleteSelect",
"TextInput",
"NumberFormatCustom",
"RequestsAwaitingPayment",
"RequestsAwaitingInspections",
"Drawer",
"Backdrop",
"ErrorFallback",
"TimeToLogout",
].map((name) => (
<Chip
key={name}
label={name}
variant="outlined"
size="small"
/>
))}
</Grid>
<Typography variant="caption" color="text.secondary" mt={2}>
این کامپوننتها برای موارد خاص سیستم طراحی شدهاند
</Typography>
</Box>
),
},
],
},
];
const filteredComponents = components
.map((category) => ({
...category,
items: category.items.filter(
(item) =>
item.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
item.description.includes(searchTerm)
),
}))
.filter((category) => category.items.length > 0);
return (
<Box sx={{ minHeight: "100vh", backgroundColor: "#f5f5f5", py: 4 }}>
<Grid container justifyContent="center">
<Grid xs={11} md={10} lg={9}>
{/* Header */}
<Paper elevation={3} sx={{ p: 3, mb: 3 }}>
<Typography
variant="h4"
gutterBottom
sx={{ fontWeight: 700, color: "primary.main" }}
>
📚 کاتالوگ کامپوننتهای سیستم رصدیار
</Typography>
<Typography variant="body1" color="text.secondary" gutterBottom>
نمایش زنده و تعاملی تمامی کامپوننتهای قابل استفاده در پروژه
</Typography>
<Divider sx={{ my: 2 }} />
{/* Search Box */}
<TextField
fullWidth
placeholder="جستجوی کامپوننت..."
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
InputProps={{
startAdornment: (
<SearchIcon sx={{ mr: 1, color: "text.secondary" }} />
),
}}
/>
{/* Stats */}
<Grid container gap={2} mt={2}>
<Chip
label={`تعداد کل: ${components.reduce(
(acc, cat) => acc + cat.items.length,
0
)} کامپوننت`}
color="primary"
variant="outlined"
/>
<Chip
label={`${components.length} دسته‌بندی`}
color="secondary"
variant="outlined"
/>
</Grid>
</Paper>
{/* Components List */}
{filteredComponents.map((category, catIndex) => (
<Paper key={catIndex} elevation={2} sx={{ p: 3, mb: 3 }}>
<Typography
variant="h5"
gutterBottom
sx={{ fontWeight: 600, color: "secondary.main", mb: 3 }}
>
{category.category}
</Typography>
{category.items.map((component, compIndex) => (
<Card
key={compIndex}
sx={{ mb: 3, border: "1px solid #e0e0e0" }}
>
<CardContent>
<Grid container spacing={2}>
{/* Component Info */}
<Grid xs={12}>
<Typography
variant="h6"
sx={{ fontWeight: 600, color: "primary.main" }}
>
{component.name}
</Typography>
<Typography
variant="body2"
color="text.secondary"
gutterBottom
>
{component.description}
</Typography>
<Typography
variant="caption"
sx={{
color: "text.disabled",
fontFamily: "monospace",
}}
>
📁 {component.path}
</Typography>
</Grid>
{/* Live Component Render */}
<Grid xs={12}>
<Divider sx={{ my: 2 }} />
<Typography
variant="subtitle2"
sx={{ mb: 2, fontWeight: 600 }}
>
🎨 نمایش زنده:
</Typography>
<Box
sx={{
p: 3,
backgroundColor: "#ffffff",
borderRadius: 2,
border: "2px dashed #1976d2",
minHeight: "80px",
display: "flex",
alignItems: "center",
justifyContent: "center",
}}
>
{component.component}
</Box>
</Grid>
</Grid>
</CardContent>
</Card>
))}
</Paper>
))}
{filteredComponents.length === 0 && (
<Paper elevation={2} sx={{ p: 5, textAlign: "center" }}>
<Typography variant="h6" color="text.secondary">
کامپوننتی با این عبارت جستجو پیدا نشد
</Typography>
</Paper>
)}
</Grid>
</Grid>
</Box>
);
};
export default ComponentsCatalog;

View File

@@ -0,0 +1,31 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { useLocation } from "react-router-dom";
import {
ROUTE_ADMINX_DASHBOARD,
ROUTE_PROVINCE_DASHBOARD,
ROUTE_PROVINCE_SUPERVISOR_DASHBOARD,
ROUTE_SUPER_ADMIN_DASHBOARD,
} from "../routes/routes";
import { DashboardTab } from "../features/dashboard/components/dashboard-tab/DashboardTab";
import { BackButton } from "../components/back-button/BackButton";
const DashboardPage = () => {
const { pathname } = useLocation();
return (
<Box display="flex" justifyContent="center" pb={20}>
<Grid container xs={12} sm={12} md={10} lg={10}>
<BackButton />
{(pathname.includes(ROUTE_ADMINX_DASHBOARD) ||
pathname.includes(ROUTE_SUPER_ADMIN_DASHBOARD) ||
pathname.includes(ROUTE_PROVINCE_DASHBOARD) ||
pathname.includes(ROUTE_PROVINCE_SUPERVISOR_DASHBOARD)) && (
<DashboardTab />
)}
</Grid>
</Box>
);
};
export default DashboardPage;

View File

@@ -0,0 +1,74 @@
import { Box } from "@mui/material";
import { useLocation } from "react-router-dom";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import {
ROUTE_ADMINX_DIFFRENCE_KILLER,
ROUTE_ADMINX_DIFFRENCE_KILLER_SLAUGHTER,
ROUTE_ADMINX_INCREASE_HATCHING,
ROUTE_CITY_DIFFRENCE_KILLER,
ROUTE_CITY_DIFFRENCE_KILLER_SLAUGHTER,
ROUTE_CITY_INCREASE_HATCHING,
ROUTE_PROVINCE_DIFFRENCE_KILLER,
ROUTE_PROVINCE_DIFFRENCE_KILLER_SLAUGHTER,
ROUTE_PROVINCE_INCREASE_HATCHING,
ROUTE_SUPER_ADMIN_DIFFRENCE_KILLER,
ROUTE_SUPER_ADMIN_DIFFRENCE_KILLER_SLAUGHTER,
ROUTE_SUPER_ADMIN_INCREASE_HATCHING,
} from "../routes/routes";
import { CityManageDiffrenceKillerOperation } from "../features/city/components/city_manage-diffrence-killer-operation/CityManageDiffrenceKillerOperation";
import { ProvinceBarDifference } from "../features/province/components/province-bar-difference/ProvinceBarDifference";
import { BackButton } from "../components/back-button/BackButton";
import { CityIncreaseHatching } from "../features/city/components/city-increase-hatching/CityIncreaseHatching";
const DiffrenceKillerPage = () => {
const { pathname } = useLocation();
return (
<>
<Box display="flex" justifyContent="center" xs={12}>
<Grid container xs={12} md={10}>
<Grid container xs={12} gap={SPACING.SMALL}>
<Grid xs={12} justifyContent="center">
{pathname === ROUTE_ADMINX_DIFFRENCE_KILLER ||
pathname === ROUTE_SUPER_ADMIN_DIFFRENCE_KILLER ||
pathname === ROUTE_CITY_DIFFRENCE_KILLER ||
pathname === ROUTE_PROVINCE_DIFFRENCE_KILLER ? (
<>
{" "}
<Grid item xs={12} mb={2} justifyContent="center">
<BackButton />
</Grid>
<CityManageDiffrenceKillerOperation />
</>
) : (
<BackButton />
)}
</Grid>
</Grid>
<Grid xs={12} sm={12}>
{(pathname.includes(ROUTE_ADMINX_DIFFRENCE_KILLER_SLAUGHTER) ||
pathname.includes(ROUTE_SUPER_ADMIN_DIFFRENCE_KILLER_SLAUGHTER) ||
pathname.includes(ROUTE_PROVINCE_DIFFRENCE_KILLER_SLAUGHTER) ||
pathname.includes(ROUTE_CITY_DIFFRENCE_KILLER_SLAUGHTER)) && (
<ProvinceBarDifference />
)}
{(pathname.includes(ROUTE_PROVINCE_INCREASE_HATCHING) ||
pathname.includes(ROUTE_ADMINX_INCREASE_HATCHING) ||
pathname.includes(ROUTE_CITY_INCREASE_HATCHING) ||
pathname.includes(ROUTE_SUPER_ADMIN_INCREASE_HATCHING)) && (
<CityIncreaseHatching />
)}
</Grid>
</Grid>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}></Grid>
</Grid>
</Box>
</>
);
};
export default DiffrenceKillerPage;

View File

@@ -0,0 +1,7 @@
import React from "react";
const DispenserDashboard = () => {
return <div>DispenserDashboard</div>;
};
export default DispenserDashboard;

186
src/pages/DownloadReport.js Normal file
View File

@@ -0,0 +1,186 @@
import React, { useEffect, useRef, useState } from "react";
import { Box, Divider, Typography } from "@mui/material";
import { useParams } from "react-router-dom";
import { useReactToPrint } from "react-to-print";
import { useDispatch } from "react-redux";
import moment from "moment";
import ProvinceSendLetterFactorReport from "../features/province/components/province-send-letter-factor-report/ProvinceSendLetterFactorReport";
import { provinceGetAllocationLetterReport } from "../features/province/services/province-get-allocation-letter-report";
import { Grid } from "../components/grid/Grid";
const DownloadReport = () => {
const styles = {
container: {
display: "flex",
flexDirection: "column",
alignItems: "center",
},
box: {
border: "1px solid #ccc",
borderRadius: "4px",
padding: "10px",
marginBottom: "20px",
},
innerBox: {
border: "1px solid #eee",
borderRadius: "4px",
padding: "5px",
marginBottom: "5px",
backgroundColor: "#fbfbea",
},
};
const { name } = useParams();
const componentRef = useRef();
const [factorData, setFactorData] = useState(null);
const dispatch = useDispatch();
const handleDownloadFactorDailySlaughter = () => {
try {
const result = dispatch(
provinceGetAllocationLetterReport(
moment(new Date()).format("YYYY-MM-DD")
)
);
setFactorData(result);
} catch (error) {
console.error(error);
}
};
const printPDF = useReactToPrint({
content: () => componentRef.current,
documentTitle: "گزارش کشتار روزانه",
});
// useEffect(() => {
// if (factorData) {
// printPDF();
// }
// }, [factorData, printPDF]);
useEffect(() => {
if (name === "ds") {
handleDownloadFactorDailySlaughter();
}
}, []);
return (
<Box
// sx={{
// justifyContent: "center",
// alignItems: "center",
// height: "100vh",
// backgroundColor: "#f0f0f0",
// paddingTop: "15%",
// }}
>
<div style={{ marginTop: "10px" }}>
<h4
style={{
textDecoration: "underline",
color: "blue",
cursor: "pointer",
}}
onClick={() => {
printPDF();
}}
>
جهت دانلود گزارش بصورت فایل پی دی اف کلیک کنید.
</h4>
<Grid container xs={12} justifyContent="center">
<Grid container xs={10} spacing={2} justifyContent="start">
{factorData?.payload?.data?.allocation?.map((item, i) => (
<Grid key={i} xs={12} sm={3} lg={2}>
<Box style={styles.box}>
<Typography color="primary" variant="h6">
ردیف: {i + 1}
</Typography>
<Typography>نام خریدار: {item?.name}</Typography>
<Typography>
تلفن: {item?.killHouseOperator?.user?.mobile}
</Typography>
<Typography>
شهر: {item?.killHouseOperator?.user?.city?.cityName}
</Typography>
<Typography>تعداد کل: {item?.totalQuantity}</Typography>
<Divider />
<Typography color="error" variant="subtitle1">
جزئیات سفارش
</Typography>
{item?.provinceKillRequest?.map((pkRequest, pkIndex) => (
<Box key={pkIndex} style={styles.innerBox}>
<Typography>مرغدار: {pkRequest?.poultry}</Typography>
<Typography>
تلفن مرغدار: {pkRequest?.poultryMobile}
</Typography>
<Typography>تعداد: {pkRequest?.quantity}</Typography>
<Typography>
میانگین وزن: {pkRequest?.IndexWeight}
</Typography>
</Box>
))}
</Box>
</Grid>
))}
{factorData?.payload?.data?.outProvince?.map((item, i) => (
<Grid key={i} xs={12} sm={3} lg={2}>
<Box style={styles.box}>
<Typography color="primary" variant="h6">
ردیف: {factorData?.payload?.data?.allocation.length + i + 1}
</Typography>
<Typography color="error" variant="subtitle1">
فروش خارج از استان
</Typography>
<Divider />
<Typography>
نام مرغدار: {item?.poultry?.unitName} (
{item?.poultry?.user?.mobile})
</Typography>
<Typography>
نام خریدار: {item?.buyer?.firstName} {item?.buyer?.lastName}
</Typography>
<Typography>تلفن: {item?.buyer?.mobile}</Typography>
<Typography>شهر: {item?.buyer?.city}</Typography>
<Typography>میانگین وزن: {item?.IndexWeight}</Typography>
<Typography>تعداد کل: {item?.quantity}</Typography>
<Typography>
نوع: {item?.freezing ? "انجماد" : "معمولی"}
</Typography>
</Box>
</Grid>
))}
</Grid>
</Grid>
<div
style={{
visibility: "hidden",
position: "absolute",
overflow: "hidden",
width: 0,
height: 0,
}}
>
<div style={{ width: "100%" }}>
<ProvinceSendLetterFactorReport
ref={componentRef}
sDate={moment(new Date()).format("YYYY-MM-DD")}
date={moment(new Date()).format("YYYY-MM-DD hh:mm:ss")}
fnumber={moment(new Date()).format("YYYYMMDD")}
receiver={
"معاونت محترم بهبود تولیدات دامی سازمان جهاد کشاورزی استان "
}
item={factorData?.payload?.data?.allocation}
itemOutProvince={factorData?.payload?.data?.outProvince}
/>
</div>
</div>
</div>
</Box>
);
};
export default DownloadReport;

42
src/pages/Driver.js Normal file
View File

@@ -0,0 +1,42 @@
import { Box, Card } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { DriverOperations } from "../features/driver/components/driver-operations/DriverOperations";
import { useLocation } from "react-router-dom";
import { ROUTE_DRIVER_CARS, ROUTE_DRIVER_REQUESTS } from "../routes/routes";
import { DriverRequests } from "../features/driver/components/driver-requests/DriverRequests";
import { DriverCars } from "../features/driver/components/driver-cars/DriverCars";
const Driver = () => {
const { pathname } = useLocation();
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid justifyContent="center" my={SPACING.MEDIUM}>
<Card>
<DriverOperations />
</Card>
</Grid>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
{pathname === ROUTE_DRIVER_REQUESTS && <DriverRequests />}
{pathname === ROUTE_DRIVER_CARS && <DriverCars />}
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default Driver;

690
src/pages/File.js Normal file
View File

@@ -0,0 +1,690 @@
import Timeline from "@mui/lab/Timeline";
import TimelineItem from "@mui/lab/TimelineItem";
import TimelineSeparator from "@mui/lab/TimelineSeparator";
import TimelineConnector from "@mui/lab/TimelineConnector";
import TimelineContent from "@mui/lab/TimelineContent";
import TimelineDot from "@mui/lab/TimelineDot";
import TimelineOppositeContent, {
timelineOppositeContentClasses,
} from "@mui/lab/TimelineOppositeContent";
import { Card, IconButton, Typography } from "@mui/material";
import { Box } from "@mui/system";
import { SPACING } from "../data/spacing";
import { PropTypes } from "prop-types";
import React, { useEffect } from "react";
import { Grid } from "../components/grid/Grid";
import { useParams } from "react-router-dom";
import { formatTime } from "../utils/formatTime";
import { FileInformation } from "../features/file/components/file-information/FileInformation";
import { CityInformation } from "../features/file/components/city-information/CityInformation";
import CityFileOperations from "../features/file/components/city-file-operations/CityFileOperations";
import ProvinceCheckRequest from "../features/file/components/province-check-request/ProvinceCheckRequest";
import { ProvinceInformation } from "../features/file/components/province-information/ProvinceInformation";
import useRequestFile from "../features/file/hooks/useRequestFile";
import { ProvinceAllocation } from "../features/file/components/province-allocation/ProvinceAllocation";
import SlaughterCheckRequest from "../features/file/components/slaughter-check-request/SlaughterCheckRequest";
import SlaughterAssignCar from "../features/file/components/slaughter-assign-car/SlaughterAssignCar";
import useGetAllocationInformation from "../features/file/hooks/useGetAllocationInformation";
import { SlaughterEnterBarWeight } from "../features/file/components/slaughter-enter-bar-weight/SlaughterEnterBarWeight";
// import { useSlaughterAllocatedRequests } from "../features/file/hooks/useSlaughterAllocatedRequests";
import FinancialCheckRequestInformation from "../features/file/components/financial-check-request-information/FinancialCheckRequestInformation";
import useUserProfile from "../features/authentication/hooks/useUserProfile";
import { FinancialCheckRequestOperation } from "../features/file/components/financial-check-request-operation/FinancialCheckRequestOperation";
import { getRoleFromUrl } from "../utils/getRoleFromUrl";
import { SlaughterPayProvinceFactorForm } from "../features/file/components/slaughter-pay-province-factor-form/SlaughterPayProvinceFactorForm";
import SlaughterPaymentFactor from "../features/file/components/slaughter-payment-factor/SlaughterPaymentFactor";
import ProvinceFinancialSlaughterCheckRequest from "../features/file/components/province-financial-slaughter-check-request/ProvinceFinancialSlaughterCheckRequest";
import { Factor } from "../features/province-finacial/components/factor/Factor";
import FileAuctionStatus from "../features/file/components/file-auction-status/FileAuctionStatus";
import { FileAuctionWinner } from "../features/file/components/file-auction-winner/FileAuctionWinner";
import { ProvinceAllocationInformation } from "../features/file/components/province-allocation-information/ProvinceAllocationInformation";
import { InspectorRequestOperations } from "../features/file/components/inspector-request-operations/InspectorRequestOperations";
import { useAcceptedSlaughterRequest } from "../features/file/hooks/useAcceptedSlaughterRequest";
import SlaughterHouseVetCheckRequest from "../features/file/components/slaughter-house-vet-check-request/SlaughterHouseVetCheckRequest";
// import { useAcceptedSlaughterRequest } from "../features/file/hooks/useAcceptedSlaughterRequest";
import NavigateNextIcon from "@mui/icons-material/NavigateNext";
import { useNavigate } from "react-router-dom";
import { useDispatch } from "react-redux";
import { cleanFile } from "../lib/redux/slices/fileSlice";
// import { Timer } from "../components/timer/Timer";
// import moment from "moment";
import { getMonthlyPercent } from "../features/file/services/get-monthly-percent";
import { SlaughterPayPoultryFactorForm } from "../features/file/components/slaughter-pay-poultry-factor-form/SlaughterPayPoultryFactorForm";
import { SlaughterPaymentFactorPoultry } from "../features/file/components/slaughter-payment-factor-poultry/SlaughterPaymentFactorPoultry";
const File = () => {
const navigate = useNavigate();
const dispatch = useDispatch();
const { id } = useParams();
const myFile = useRequestFile(id);
const [roles] = useUserProfile();
// const slaughterAllocatedRequests = useSlaughterAllocatedRequests(id);
const process = myFile?.file?.process;
const { quantity, provinceAssignments } = useGetAllocationInformation(
process?.poultry?.poultryRequestKey
);
useEffect(() => {
dispatch(getMonthlyPercent());
}, []);
const provinceKillRequests = process?.provinceKillRequests;
const acceptedSlaughterRequests = useAcceptedSlaughterRequest(id);
const showEnterBarInfo = process?.auction
? !!process?.auction?.filter((item) => item.barInfo === null).length
: provinceKillRequests?.some((killRequest, i) => {
const { killHouseRequests } = killRequest;
if (killHouseRequests) {
return !!killHouseRequests?.filter(
(item) =>
item.barInfo === null ||
item.barInfo?.killHouseAssignmentState === "rejected"
).length;
}
return false;
});
const showSlaughterHouseVetCheckRequest = process?.auction
? !!process?.auction?.filter((item) => item.barInfo === null).length
: provinceKillRequests?.some((killRequest, i) => {
const { killHouseRequests } = killRequest;
if (killHouseRequests) {
return !!killHouseRequests?.filter((item) => item.barInfo === null)
.length;
}
return false;
});
useEffect(() => {
return () => {
dispatch(cleanFile());
};
}, []);
const sellType = process?.filePaymentType;
// const paymentPrice = "123000000";
// const paymentDate = moment(new Date(2022, 11, 24, 10, 33, 30, 0));
// const currentDate = moment();
// const diff = paymentDate.diff(currentDate);
// let paymentRemainedSeconds = moment.duration(diff).asSeconds();
return (
<>
{process && (
<Box mt={SPACING.MEDIUM} display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid container alignItems="center">
<IconButton
aria-label="delete"
color="primary"
onClick={() => navigate(-1)}
>
<NavigateNextIcon />
<Typography>بازگشت</Typography>
</IconButton>
</Grid>
<Card>
<Grid
container
px={SPACING.SMALL}
alignItems="center"
gap={SPACING.TINY}
justifyContent="space-between"
>
<Grid container direction="column">
<Grid container>
<Typography variant="h6">
مشخصات پرونده با کد سفارش{" "}
{process?.poultry?.poultryOrderCode}
</Typography>
</Grid>
<Grid container gap={SPACING.TINY}>
<Grid>
{!process?.poultry?.poultryAuction ? (
<Typography variant="body2" color="secondary">
(فروش از طریق اتحادیه)
</Typography>
) : (
<Typography variant="body2" color="secondary">
(فروش از طریق مزایده)
</Typography>
)}
</Grid>
<Grid>
{sellType === "cash" && (
<Typography
variant="body2"
color={(prop) => prop.palette.warning.dark}
>
(فروش نقدی)
</Typography>
)}
{sellType === "credit" && (
<Typography
variant="body2"
color={(prop) => prop.palette.warning.dark}
>
(فروش زمان دار - تا یک ماه)
</Typography>
)}
{sellType === "cash_credit" && (
<Typography
variant="body2"
color={(prop) => prop.palette.warning.dark}
>
(فروش بصورت نقدی و زمان دار)
</Typography>
)}
</Grid>
</Grid>
</Grid>
<Grid container direction="column" alignItems="end">
{/* <Typography
variant="body1"
color={(prop) => prop.palette.action.dark}
>
مبلغ قابل پرداخت ={" "}
{paymentPrice.toLocaleString() + " ریال "}× 3% ماهانه
</Typography> */}
{/* <Grid container direction="column" gap={SPACING.TINY}>
<Typography>سررسید نزدیکترین قابل پرداخت</Typography>
<Timer
isFilePaymentTime={true}
seconds={paymentRemainedSeconds}
/>
</Grid> */}
{/* <Grid>
<Typography
variant="body1"
color={(prop) => prop.palette.action.dark}
>
مبلغ قابل پرداخت ={" "}
{paymentPrice.toLocaleString() + " ریال "}× 3% ماهانه
</Typography>
</Grid> */}
</Grid>
</Grid>
<Timeline
sx={{
gap: SPACING.MEDIUM,
[`& .${timelineOppositeContentClasses.root}`]: {
// flex: 0.2,
},
}}
>
<TimelineItem sx={{ alignSelf: "flex-start", width: "100%" }}>
<TimelineSeparator>
<TimelineDot />
<TimelineConnector />
</TimelineSeparator>
<Grid container direction="column" flexWrap="nowrap" flex="1">
<Grid container alignItems="flex-start">
<Grid>
<TimelineOppositeContent>
<Typography variant="body1" fontWeight="bold">
مشخصات درخواست
</Typography>
</TimelineOppositeContent>
</Grid>
<Grid>
<TimelineContent color="textSecondary">
<Grid container gap={SPACING.SMALL}>
<Typography
variant="body2"
display="flex"
gap={SPACING.SMALL}
>
درخواست در تاریخ
</Typography>
<Typography variant="body2" fontWeight="bold">
{formatTime(
process?.poultry?.poultryRegisterDate
)}
</Typography>
<Typography
variant="body2"
display="flex"
gap={SPACING.SMALL}
>
ثبت شده است.
</Typography>
</Grid>
</TimelineContent>
</Grid>
</Grid>
<Grid>
<Grid xs={12}>
<FileInformation file={process} />
</Grid>
</Grid>
</Grid>
</TimelineItem>
<CityInformation file={process} />
{(getRoleFromUrl() === "CityOperator" ||
getRoleFromUrl() === "ProvinceOperator") &&
process.city === null && (
<CityFileOperations file={process} />
)}
{process.auctionsList && process?.poultry?.poultryAuction && (
<FileAuctionStatus file={process} />
)}
{process.killHouseWinner && (
<FileAuctionWinner file={process} />
)}
{!process.auctionsList &&
!process.killHouseWinner &&
process?.city &&
process.city.cityState === "accept" && (
<ProvinceInformation quantity={quantity} file={process} />
)}
{!process.killHouseWinner &&
getRoleFromUrl() === "ProvinceOperator" &&
roles.includes("ProvinceOperator") &&
process?.city &&
process?.province?.provinceState !== "reject" &&
process?.province?.provinceState !== "accept" && (
<ProvinceCheckRequest file={process} />
)}
{!process.auctionsList &&
getRoleFromUrl() === "ProvinceOperator" &&
roles.includes("ProvinceOperator") &&
process?.city &&
process?.province?.provinceState === "accept" &&
quantity !== 0 && <ProvinceAllocation file={process} />}
{!process.killHouseWinner &&
provinceAssignments &&
!!provinceKillRequests?.length &&
provinceAssignments?.map((item, i) => {
return (
<Grid key={"ProvinceAllocationInformation" + i}>
<Grid>
<ProvinceAllocationInformation item={item} i={i} />
</Grid>
<Grid>
{!process.killHouseWinner &&
getRoleFromUrl() === "KillHouse" &&
roles.includes("KillHouse") &&
Boolean(
provinceKillRequests?.filter(
(item) =>
item.provinceKillReqState !== "accepted"
).length
) &&
item.provinceKillRequestState === "pending" && (
<SlaughterCheckRequest
key={"SlaughterCheckRequest" + i}
item={item}
i={i}
poultryRequestKey={
process?.poultry?.poultryRequestKey
}
/>
)}
</Grid>
</Grid>
);
})}
{/* {!process.killHouseWinner &&
getRoleFromUrl() === "KillHouse" &&
roles.includes("KillHouse") &&
Boolean(
provinceKillRequests?.filter(
(item) => item.provinceKillReqState !== "accepted"
).length
) && <SlaughterCheckRequest file={process} />} */}
{getRoleFromUrl() === "KillHouse" &&
roles.includes("KillHouse") &&
(acceptedSlaughterRequests.some(
(item) => item.quantity > 0
) ||
(process.killHouseWinner &&
process.killHouseWinner.quantity > 0)) && (
<SlaughterAssignCar
file={process}
provinceAllocationLimit={
provinceAssignments
? provinceAssignments[0]?.quantity
: 0
}
/>
)}
{showSlaughterHouseVetCheckRequest && (
<SlaughterHouseVetCheckRequest file={process} />
)}
{(getRoleFromUrl() === "KillHouse" ||
getRoleFromUrl() === "Poultry" ||
getRoleFromUrl() === "ProvinceFinancial") &&
(roles.includes("KillHouse") ||
roles.includes("Poultry") ||
roles.includes("ProvinceFinancial")) &&
!!showEnterBarInfo && (
<SlaughterEnterBarWeight file={process} />
)}
{!process.killHouseWinner &&
provinceKillRequests?.map((killRequest, i) => {
const { killHouseRequests } = killRequest;
const d = killHouseRequests
?.filter((item) => item.barInfo !== null)
.map((item, i) => {
const showSlaughterFactorForm =
(item.barInfo &&
item.provinceFactorToKillHouse &&
(!item.killHouseFactorToProvince ||
item.killHouseFactorToProvince.factorState ===
"rejected")) ||
(item.provinceFactorToKillHouseForPoultry &&
!item.killHouseFactorToPoultry) ||
item.killHouseFactorToPoultry?.factorState ===
"rejected";
const data = [
[
item.barcod,
`${item.killHouseName} (${item.killHouseUserProvince}/${item.killHouseUserCity})`,
item.quantity + " قطعه",
item.car?.driverName +
` (${item.car?.driverMobile})`,
`${item.car?.typeCar} با پلاک ${item.car?.pelak}`,
item.barInfo.killHouseNetWeight + " کیلوگرم",
item.fee + " ریال",
<a
href={item.barInfo.killHouseImageWithoutLoad}
alt="دانلود سند خودرو بدون بار"
key="provinceKillRequests"
>
<img
src={item.barInfo.killHouseImageWithoutLoad}
width="100"
height="100"
alt="بدون بار"
className="images-file"
/>
</a>,
<a
href={item.barInfo.killHouseImageWithLoad}
alt="دانلود سند خودرو با بار"
key="provinceKillRequests"
>
<img
src={item.barInfo.killHouseImageWithLoad}
width="100"
height="100"
alt="بدون بار"
className="images-file"
key="provinceKillRequests"
/>
</a>,
],
];
return (
<Grid key={"killHouseRequests" + i}>
<FinancialCheckRequestInformation
item={data}
data={item}
auction={false}
/>
{getRoleFromUrl() === "ProvinceFinancial" &&
roles.includes("ProvinceFinancial") &&
!item.provinceFactorToKillHouse &&
item.barInfo.killHouseAssignmentState ===
"pending" && (
<FinancialCheckRequestOperation
item={item}
file={process}
/>
)}
{(getRoleFromUrl() === "KillHouse" ||
getRoleFromUrl() === "ProvinceFinancial") &&
(roles.includes("KillHouse") ||
roles.includes("ProvinceFinancial")) &&
showSlaughterFactorForm && (
<>
{!item.killHouseFactorToProvince && (
<SlaughterPayProvinceFactorForm
key={`SlaughterPayProvinceFactorForm${i}`}
factorKey={
item.provinceFactorToKillHouse
?.provinceFactorKey
}
price={
item.provinceFactorToKillHouse?.cost
}
provinceFactorToKillHouse={
item.provinceFactorToKillHouse
}
isRejected={
item?.killHouseFactorToProvince
?.factorState === "rejected"
}
killHouseFactorToProvince={
item.killHouseFactorToProvince
}
/>
)}
{item.provinceFactorToKillHouseForPoultry &&
!item.killHouseFactorToPoultry && (
<SlaughterPayPoultryFactorForm
key={`SlaughterPayPoultryFactorForm${i}`}
factorKey={
item
.provinceFactorToKillHouseForPoultry
?.provinceFactorKey
}
price={
item
.provinceFactorToKillHouseForPoultry
?.cost
}
provinceFactorToPoultry={
item.provinceFactorToKillHouseForPoultry
}
isRejected={
item?.killHouseFactorToPoultry
?.factorState === "rejected"
}
killHouseFactorToPoultry={
item.killHouseFactorToPoultry
}
/>
)}
</>
)}
</Grid>
);
});
return d;
})}
{process.killHouseWinner &&
process.auction
?.filter((item) => item.barInfo !== null)
.map((item, i) => {
return (
<Grid key={"killHouseRequests" + i}>
<FinancialCheckRequestInformation
data={item}
auction={true}
/>
{getRoleFromUrl() === "ProvinceFinancial" &&
roles.includes("ProvinceFinancial") &&
!item.provinceFactorToKillHouse && (
<FinancialCheckRequestOperation item={item} />
)}
</Grid>
);
})}
{process.killHouseWinner &&
process.auction &&
process.auction
?.filter(
(item) =>
item.barInfo &&
!item.killHouseFactorToProvince &&
item.provinceFactorToKillHouse
)
.map((item, i) => {
return (
<>
<FinancialCheckRequestInformation
data={item}
auction={true}
/>
{getRoleFromUrl() === "KillHouse" &&
roles.includes("KillHouse") && (
<SlaughterPayProvinceFactorForm
key={`SlaughterPayProvinceFactorForm${i}`}
factorKey={
item.provinceFactorToKillHouse
?.provinceFactorKey
}
price={item.provinceFactorToKillHouse?.cost}
provinceFactorToKillHouse={
item.provinceFactorToKillHouse
}
/>
)}
</>
);
})}
{provinceKillRequests?.map((killRequest, i) => {
const { killHouseRequests } = killRequest;
return killHouseRequests
?.filter(
(item) =>
item.barInfo &&
(item.killHouseFactorToProvince ||
item.killHouseFactorToPoultry)
)
.map((item, i) => {
return (
<>
{item?.killHouseFactorToProvince && (
<SlaughterPaymentFactor
key={`SlaughterPaymentFactor${i}`}
data={item.killHouseFactorToProvince}
barCode={item.barcod}
/>
)}
{getRoleFromUrl() === "ProvinceFinancial" &&
roles.includes("ProvinceFinancial") &&
item?.killHouseFactorToProvince &&
item.killHouseFactorToProvince.factorState ===
"pending" && (
<>
<ProvinceFinancialSlaughterCheckRequest
factorKey={
item.killHouseFactorToProvince?.factorKey
}
factorType="province"
/>
</>
)}
{item?.killHouseFactorToPoultry && (
<SlaughterPaymentFactorPoultry
key={`SlaughterPaymentFactor${i}`}
data={item.killHouseFactorToPoultry}
barCode={item.barcod}
/>
)}
{item?.killHouseFactorToPoultry &&
getRoleFromUrl() === "ProvinceFinancial" &&
roles.includes("ProvinceFinancial") &&
item.killHouseFactorToPoultry.factorState ===
"pending" && (
<ProvinceFinancialSlaughterCheckRequest
factorKey={
item.killHouseFactorToPoultry?.factorKey
}
factorType="poultry"
/>
)}
</>
);
});
})}
{process.killHouseWinner &&
process.auction
?.filter(
(item) => item.barInfo && item.killHouseFactorToProvince
)
.map((item, i) => {
return (
<>
<SlaughterPaymentFactor
key={`SlaughterPaymentFactor${i}`}
data={item.killHouseFactorToProvince}
barCode={item.barcod}
/>
{getRoleFromUrl() === "ProvinceFinancial" &&
roles.includes("ProvinceFinancial") &&
item.killHouseFactorToProvince.factorState ===
"pending" && (
<ProvinceFinancialSlaughterCheckRequest
factorKey={
item.killHouseFactorToProvince?.factorKey
}
/>
)}
</>
);
})}
{process.allocation && (
<Grid xs={12}>
<Factor process={process} />
</Grid>
)}
{getRoleFromUrl() === "ProvinceInspector" &&
roles.includes("ProvinceInspector") &&
process.allocation &&
process?.poultry?.poultryRequestFinalState === "archive" && (
<Grid>
<Grid xs={12}>
<InspectorRequestOperations process={process} />
</Grid>
</Grid>
)}
</Timeline>
</Card>
</Grid>
</Box>
)}
</>
);
};
File.propTypes = {
id: PropTypes.number,
};
export default File;

30
src/pages/FilesState.js Normal file
View File

@@ -0,0 +1,30 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { ProvinceFilesState } from "../features/province/components/province-files-state/ProvinceFilesState";
const FilesState = () => {
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
<ProvinceFilesState />
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default FilesState;

View File

@@ -0,0 +1,299 @@
import { Card } from "@mui/material";
import { Box } from "@mui/system";
import { useLocation } from "react-router-dom";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { BasicProfileInformation } from "../features/authentication/components/basic-profile-information/BasicProfileInformation";
import { GeneralDashboardOperations } from "../features/authentication/components/general-dashboard-operations/GeneralDashboardOperations";
import {
ROUTE_AVICULTURE_USER_PROFILE,
ROUTE_CITY_USER_PROFILE,
ROUTE_GENERAL_USER_PROFILE,
ROUTE_PROVINCE_USER_PROFILE,
ROUTE_SLAUGHTER_USER_PROFILE,
ROUTE_INSPECTOR_USER_PROFILE,
ROUTE_VETFARM_USER_PROFILE,
DRIVER_USER_PROFILE,
ROUTE_PROVINCE_FINANCIAL_USER_PROFILE,
ROUTE_SLAUGHTER_HOUSE_VET_USER_PROFILE,
ROUTE_STEWARD_USER_PROFILE,
ROUTE_CITYVET_USER_PROFILE,
ROUTE_LIVE_STOCK_USER_PROFILE,
ROUTE_CHAIN_COMPANY_USER_PROFILE,
} from "../routes/routes";
import useUserProfile from "../features/authentication/hooks/useUserProfile";
import { CityProfile } from "../features/city/components/city-profile/CityProfile";
import { ProvinceProfile } from "../features/province/components/province-profile/ProvinceProfile";
import { VetFarmProfile } from "../features/vet-farm/components/ver-farm-profile/VetFarmProfile";
import { AvicultureProfile } from "../features/aviculture/components/aviculture-profile/AvicultureProfile";
import { DriverProfile } from "../features/driver/components/driver-profile/DriverProfile";
import { InspectorProfile } from "../features/inspector/components/inspector-profile/InspectorProfile";
import { SlaughterProfile } from "../features/slaughter-house/components/slaughter-profile/SlaughterProfile";
import { ProvinceFinancialProfile } from "../features/province-finacial/components/province-financial-profile/ProvinceFinancialProfile";
import { SlaughterHouseVetProfile } from "../features/slaughter-house-vet/components/slaughter-house-vet-profile/SlaughterHouseVetProfile";
import { GuildProfile } from "../features/guild/components/GuildProfile";
import { CityVetProfile } from "../features/city-vet/components/CityVetProfile";
import LiveStockProfile from "../features/live-stock-support/components/live-stock-profile/LiveStockProfile";
import { ChainCompanyProfile } from "../features/chain-company/components/chain-company-profile/ChainCompanyProfile";
import { BackButton } from "../components/back-button/BackButton";
import AccessDashboardV2 from "./AcessDashboardV2";
const GeneralDashboard = () => {
const { pathname } = useLocation();
const [roles] = useUserProfile();
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
{pathname === ROUTE_GENERAL_USER_PROFILE && (
<Grid my={SPACING.MEDIUM}>
<Card>
<GeneralDashboardOperations />
</Card>
</Grid>
)}
{pathname === ROUTE_GENERAL_USER_PROFILE && (
<Grid
container
justifyContent="space-between"
gap={SPACING.SMALL}
pb={SPACING.MEDIUM}
>
<Grid xs={12} mb={SPACING.MEDIUM}>
<BasicProfileInformation />
</Grid>
{/* <Grid xs={12} justifyContent="space-between" gap={SPACING.SMALL}>
<ChangeCardInfo />
</Grid> */}
</Grid>
)}
{pathname === "/" ? (
<Grid container my={SPACING.MEDIUM} xs={12}>
<AccessDashboardV2 />
</Grid>
) : (
<Grid xs={12}>
{window.location.pathname !== "/dashboard/profile" && (
<BackButton />
)}
<Grid xs={12} mt={2}>
{roles.map((role, i) => {
switch (role) {
case "CityOperator":
return (
pathname === ROUTE_CITY_USER_PROFILE && (
<Grid
container
key={role + i}
justifyContent="space-between"
gap={SPACING.SMALL}
>
<Grid xs={12} md={12}>
<CityProfile />
</Grid>
</Grid>
)
);
case "Poultry":
return (
pathname === ROUTE_AVICULTURE_USER_PROFILE && (
<Grid
key={role + i}
container
justifyContent="space-between"
gap={SPACING.SMALL}
>
<Grid xs={12} md={12}>
<AvicultureProfile />
</Grid>
</Grid>
)
);
case "ProvinceOperator":
return (
pathname === ROUTE_PROVINCE_USER_PROFILE && (
<Grid
key={role + i}
container
justifyContent="space-between"
gap={SPACING.SMALL}
>
<Grid xs={12} md={12}>
<ProvinceProfile />
</Grid>
</Grid>
)
);
case "ProvinceFinancial":
return (
pathname === ROUTE_PROVINCE_FINANCIAL_USER_PROFILE && (
<Grid
key={role + i}
container
justifyContent="space-between"
gap={SPACING.SMALL}
>
<Grid xs={12} md={12}>
<ProvinceFinancialProfile />
</Grid>
</Grid>
)
);
case "ProvinceInspector":
return (
pathname === ROUTE_INSPECTOR_USER_PROFILE && (
<Grid
key={role + i}
container
justifyContent="space-between"
gap={SPACING.SMALL}
>
<Grid xs={12} md={12}>
<InspectorProfile />
</Grid>
</Grid>
)
);
case "KillHouse":
return (
pathname === ROUTE_SLAUGHTER_USER_PROFILE && (
<Grid
key={role + i}
container
justifyContent="space-between"
gap={SPACING.SMALL}
>
<Grid xs={12} md={12}>
<SlaughterProfile />
</Grid>
</Grid>
)
);
case "KillHouseVet":
return (
pathname === ROUTE_SLAUGHTER_HOUSE_VET_USER_PROFILE && (
<Grid
key={role + i}
container
justifyContent="space-between"
gap={SPACING.SMALL}
>
<Grid xs={12} md={12}>
<SlaughterHouseVetProfile />
</Grid>
</Grid>
)
);
case "VetFarm":
return (
pathname === ROUTE_VETFARM_USER_PROFILE && (
<Grid
key={role + i}
container
justifyContent="space-between"
gap={SPACING.SMALL}
>
<Grid xs={12} md={12}>
<VetFarmProfile />
</Grid>
</Grid>
)
);
case "Driver":
return (
pathname === DRIVER_USER_PROFILE && (
<Grid
key={role + i}
container
justifyContent="space-between"
gap={SPACING.SMALL}
>
<Grid xs={12} md={12}>
<DriverProfile />
</Grid>
</Grid>
)
);
case "Guilds":
return (
pathname === ROUTE_STEWARD_USER_PROFILE && (
<Grid
key={role + i}
container
justifyContent="space-between"
gap={SPACING.SMALL}
>
<Grid xs={12} md={12}>
<GuildProfile />
</Grid>
</Grid>
)
);
case "CityVet":
return (
pathname === ROUTE_CITYVET_USER_PROFILE && (
<Grid
key={role + i}
container
justifyContent="space-between"
gap={SPACING.SMALL}
>
<Grid xs={12} md={12}>
<CityVetProfile />
</Grid>
</Grid>
)
);
case "ChainCompany":
return (
pathname === ROUTE_CHAIN_COMPANY_USER_PROFILE && (
<Grid
key={role + i}
container
justifyContent="space-between"
gap={SPACING.SMALL}
>
<Grid xs={12} md={12}>
<ChainCompanyProfile />
</Grid>
</Grid>
)
);
case "LiveStockSupport":
return (
pathname === ROUTE_LIVE_STOCK_USER_PROFILE && (
<Grid
key={role + i}
container
justifyContent="space-between"
gap={SPACING.SMALL}
>
<Grid xs={12} md={12}>
<LiveStockProfile />
</Grid>
</Grid>
)
);
default:
return null;
}
})}
</Grid>
</Grid>
)}
</Grid>
</Box>
</>
);
};
export default GeneralDashboard;

View File

@@ -0,0 +1,36 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { useLocation } from "react-router-dom";
import GuildMaangeGuilds from "../features/guild/components/GuildManageGuilds";
import { ROUTE_STEWARD_MANAGE_GUILDS } from "../routes/routes";
const GuildManageGuildsPage = () => {
const { pathname } = useLocation();
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
{pathname === ROUTE_STEWARD_MANAGE_GUILDS && (
<GuildMaangeGuilds />
)}
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default GuildManageGuildsPage;

259
src/pages/Guilds.js Normal file
View File

@@ -0,0 +1,259 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { useLocation } from "react-router-dom";
import {
ROUTE_ADMINX_ROUTE_GUILDS,
ROUTE_ADMINX_ROUTE_IN_PROVINCE_GUILDS_DISTRIBUTIONS,
ROUTE_ADMINX_ROUTE_IN_PROVINCE_GUILDS_REQUESTS,
ROUTE_ADMINX_ROUTE_GUILDS_SETTINGS,
ROUTE_ADMINX_ROUTE_IN_PROVINCE_GUILDS,
ROUTE_ADMINX_ROUTE_MANAGE_GUILDS,
ROUTE_ADMINX_ROUTE_OUT_PROVINCE_GUILDS,
ROUTE_ADMINX_ROUTE_IN_PROVINCE_STEWARDS,
ROUTE_CITY_JIHAD_ROUTE_GUILDS,
ROUTE_CITY_JIHAD_ROUTE_MANAGE_GUILDS,
ROUTE_CITY_JIHAD_ROUTE_STEWARDS,
ROUTE_CITY_POULTRY_ROUTE_GUILDS,
ROUTE_CITY_POULTRY_ROUTE_MANAGE_GUILDS,
ROUTE_CITY_POULTRY_ROUTE_STEWARDS,
ROUTE_COMMERCE_ROUTE_GUILDS,
ROUTE_COMMERCE_ROUTE_GUILDS_SETTINGS,
ROUTE_COMMERCE_ROUTE_MANAGE_GUILDS,
ROUTE_COMMERCE_ROUTE_STEWARDS,
ROUTE_GUILD_ROOM_ROUTE_GUILDS,
ROUTE_GUILD_ROOM_ROUTE_GUILDS_REQUESTS,
ROUTE_GUILD_ROOM_ROUTE_MANAGE_GUILDS,
ROUTE_GUILD_ROOM_ROUTE_STEWARDS,
ROUTE_PROVINCE_ROUTE_GUILDS,
ROUTE_PROVINCE_ROUTE_IN_PROVINCE_GUILDS_REQUESTS,
ROUTE_PROVINCE_ROUTE_GUILDS_SETTINGS,
ROUTE_PROVINCE_ROUTE_IN_PROVINCE_GUILDS,
ROUTE_PROVINCE_ROUTE_MANAGE_GUILDS,
ROUTE_PROVINCE_ROUTE_OUT_PROVINCE_GUILDS,
ROUTE_PROVINCE_ROUTE_IN_PROVINCE_STEWARDS,
ROUTE_PROVINCE_SUPERVISOR_ROUTE_GUILDS,
ROUTE_PROVINCE_SUPERVISOR_ROUTE_GUILDS_SETTINGS,
ROUTE_PROVINCE_SUPERVISOR_ROUTE_MANAGE_GUILDS,
ROUTE_PROVINCE_SUPERVISOR_ROUTE_STEWARDS,
ROUTE_SUPER_ADMIN_ROUTE_GUILDS,
ROUTE_SUPER_ADMIN_ROUTE_IN_PROVINCE_GUILDS_DISTRIBUTIONS,
ROUTE_SUPER_ADMIN_ROUTE_IN_PROVINCE_GUILDS_REQUESTS,
ROUTE_SUPER_ADMIN_ROUTE_GUILDS_SETTINGS,
ROUTE_SUPER_ADMIN_ROUTE_IN_PROVINCE_GUILDS,
ROUTE_SUPER_ADMIN_ROUTE_MANAGE_GUILDS,
ROUTE_SUPER_ADMIN_ROUTE_OUT_PROVINCE_GUILDS,
ROUTE_SUPER_ADMIN_ROUTE_IN_PROVINCE_STEWARDS,
ROUTE_SUPER_ADMIN_ROUTE_IN_PROVINCE_TRUE_GUILDS,
ROUTE_ADMINX_ROUTE_IN_PROVINCE_TRUE_GUILDS,
ROUTE_PROVINCE_ROUTE_IN_PROVINCE_TRUE_GUILDS,
ROUTE_SUPER_ADMIN_ROUTE_OUT_PROVINCE_TRUE_GUILDS,
ROUTE_ADMINX_ROUTE_OUT_PROVINCE_TRUE_GUILDS,
ROUTE_PROVINCE_ROUTE_OUT_PROVINCE_TRUE_GUILDS,
ROUTE_SUPER_ADMIN_ROUTE_IN_PROVINCE_LEGAL_GUILDS,
ROUTE_ADMINX_ROUTE_IN_PROVINCE_LEGAL_GUILDS,
ROUTE_PROVINCE_ROUTE_IN_PROVINCE_LEGAL_GUILDS,
ROUTE_SUPER_ADMIN_ROUTE_OUT_PROVINCE_LEGAL_GUILDS,
ROUTE_ADMINX_ROUTE_OUT_PROVINCE_LEGAL_GUILDS,
ROUTE_PROVINCE_ROUTE_OUT_PROVINCE_LEGAL_GUILDS,
} from "../routes/routes";
import { BackButton } from "../components/back-button/BackButton";
import { GuildsOperations } from "../features/province/components/guilds-operations/GuildsOperations";
import { ManageStewards } from "../features/province/components/manage-stewards/ManageStewards";
import { GuildsSettings } from "../features/province/components/guilds-settings/GuildsSettings";
import { GuildsOperationsCommerce } from "../features/commerce/components/guilds-operations-commerce/GuildsOperationsCommerce";
import { getRoleFromUrl } from "../utils/getRoleFromUrl";
import { ManageGuildsRequests } from "../features/province/components/manage-guilds-requests/ManageGuildsRequests";
import { GuildsOperationsCityJihad } from "../features/city-jihad/components/guilds-operations-city-jihad/GuildsOperationsCityJihad";
import { GuildRoomOperations } from "../features/guild-room/components/guild-room-operations/GuildRoomOperations";
import { ManageTab } from "../features/province/components/manage-tab/ManageTab";
import { ManageGuildDistributions } from "../features/province/components/manage-guild-distributions/ManageGuildDistributions";
import { ProvinceTrueGuildsOutProvince } from "../features/province/components/province-true-guilds-out-province/ProvinceTrueGuildsOutProvince";
import { ProvinceLegalGuildsInProvince } from "../features/province/components/province-legal-guilds-in-province/ProvinceLegalGuildsInProvince";
import { ProvinceLegalGuildsOutProvince } from "../features/province/components/province-legal-guilds-out-province/ProvinceLegalGuildsOutProvince";
const MANAGE_ROUTES = [
ROUTE_PROVINCE_ROUTE_MANAGE_GUILDS,
ROUTE_COMMERCE_ROUTE_MANAGE_GUILDS,
ROUTE_PROVINCE_SUPERVISOR_ROUTE_MANAGE_GUILDS,
ROUTE_GUILD_ROOM_ROUTE_MANAGE_GUILDS,
ROUTE_CITY_JIHAD_ROUTE_MANAGE_GUILDS,
ROUTE_CITY_POULTRY_ROUTE_MANAGE_GUILDS,
ROUTE_SUPER_ADMIN_ROUTE_MANAGE_GUILDS,
ROUTE_ADMINX_ROUTE_MANAGE_GUILDS,
ROUTE_SUPER_ADMIN_ROUTE_IN_PROVINCE_GUILDS,
ROUTE_ADMINX_ROUTE_IN_PROVINCE_GUILDS,
ROUTE_PROVINCE_ROUTE_IN_PROVINCE_GUILDS,
ROUTE_SUPER_ADMIN_ROUTE_OUT_PROVINCE_GUILDS,
ROUTE_ADMINX_ROUTE_OUT_PROVINCE_GUILDS,
ROUTE_PROVINCE_ROUTE_OUT_PROVINCE_GUILDS,
];
const GUILDS_OPERATIONS_ROUTES = [
ROUTE_PROVINCE_ROUTE_MANAGE_GUILDS,
ROUTE_SUPER_ADMIN_ROUTE_MANAGE_GUILDS,
ROUTE_ADMINX_ROUTE_MANAGE_GUILDS,
ROUTE_SUPER_ADMIN_ROUTE_IN_PROVINCE_GUILDS,
ROUTE_ADMINX_ROUTE_IN_PROVINCE_GUILDS,
ROUTE_PROVINCE_ROUTE_IN_PROVINCE_GUILDS,
ROUTE_SUPER_ADMIN_ROUTE_OUT_PROVINCE_GUILDS,
ROUTE_ADMINX_ROUTE_OUT_PROVINCE_GUILDS,
ROUTE_PROVINCE_ROUTE_OUT_PROVINCE_GUILDS,
];
const GUILDS_OPERATIONS_COMMERCE_ROUTES = [
ROUTE_COMMERCE_ROUTE_MANAGE_GUILDS,
ROUTE_PROVINCE_SUPERVISOR_ROUTE_MANAGE_GUILDS,
];
const GUILDS_OPERATIONS_CITY_JIHAD_ROUTES = [
ROUTE_CITY_JIHAD_ROUTE_MANAGE_GUILDS,
ROUTE_CITY_POULTRY_ROUTE_MANAGE_GUILDS,
];
const MANAGE_TAB_ROUTES = [
ROUTE_PROVINCE_ROUTE_GUILDS,
ROUTE_SUPER_ADMIN_ROUTE_GUILDS,
ROUTE_ADMINX_ROUTE_GUILDS,
ROUTE_COMMERCE_ROUTE_GUILDS,
ROUTE_GUILD_ROOM_ROUTE_GUILDS,
ROUTE_PROVINCE_SUPERVISOR_ROUTE_GUILDS,
ROUTE_CITY_JIHAD_ROUTE_GUILDS,
ROUTE_CITY_POULTRY_ROUTE_GUILDS,
ROUTE_PROVINCE_ROUTE_IN_PROVINCE_TRUE_GUILDS,
ROUTE_ADMINX_ROUTE_IN_PROVINCE_TRUE_GUILDS,
ROUTE_SUPER_ADMIN_ROUTE_IN_PROVINCE_TRUE_GUILDS,
];
const STEWARDS_ROUTES = [
ROUTE_PROVINCE_ROUTE_IN_PROVINCE_STEWARDS,
ROUTE_SUPER_ADMIN_ROUTE_IN_PROVINCE_STEWARDS,
ROUTE_ADMINX_ROUTE_IN_PROVINCE_STEWARDS,
ROUTE_COMMERCE_ROUTE_STEWARDS,
ROUTE_GUILD_ROOM_ROUTE_STEWARDS,
ROUTE_PROVINCE_SUPERVISOR_ROUTE_STEWARDS,
ROUTE_CITY_POULTRY_ROUTE_STEWARDS,
ROUTE_CITY_JIHAD_ROUTE_STEWARDS,
];
const GUILDS_SETTINGS_ROUTES = [
ROUTE_PROVINCE_ROUTE_GUILDS_SETTINGS,
ROUTE_SUPER_ADMIN_ROUTE_GUILDS_SETTINGS,
ROUTE_ADMINX_ROUTE_GUILDS_SETTINGS,
ROUTE_PROVINCE_SUPERVISOR_ROUTE_GUILDS_SETTINGS,
ROUTE_COMMERCE_ROUTE_GUILDS_SETTINGS,
];
const GUILDS_REQUESTS_ROUTES = [
ROUTE_PROVINCE_ROUTE_IN_PROVINCE_GUILDS_REQUESTS,
ROUTE_SUPER_ADMIN_ROUTE_IN_PROVINCE_GUILDS_REQUESTS,
ROUTE_ADMINX_ROUTE_IN_PROVINCE_GUILDS_REQUESTS,
ROUTE_GUILD_ROOM_ROUTE_GUILDS_REQUESTS,
];
const GUILDS_DISTRIBUTIONS_ROUTES = [
ROUTE_SUPER_ADMIN_ROUTE_IN_PROVINCE_GUILDS_DISTRIBUTIONS,
ROUTE_ADMINX_ROUTE_IN_PROVINCE_GUILDS_DISTRIBUTIONS,
];
const TRUE_GUILDS_OUT_PROVINCE_ROUTES = [
ROUTE_SUPER_ADMIN_ROUTE_OUT_PROVINCE_TRUE_GUILDS,
ROUTE_ADMINX_ROUTE_OUT_PROVINCE_TRUE_GUILDS,
ROUTE_PROVINCE_ROUTE_OUT_PROVINCE_TRUE_GUILDS,
];
const LEGAL_GUILDS_IN_PROVINCE_ROUTES = [
ROUTE_SUPER_ADMIN_ROUTE_IN_PROVINCE_LEGAL_GUILDS,
ROUTE_ADMINX_ROUTE_IN_PROVINCE_LEGAL_GUILDS,
ROUTE_PROVINCE_ROUTE_IN_PROVINCE_LEGAL_GUILDS,
];
const LEGAL_GUILDS_OUT_PROVINCE_ROUTES = [
ROUTE_SUPER_ADMIN_ROUTE_OUT_PROVINCE_LEGAL_GUILDS,
ROUTE_ADMINX_ROUTE_OUT_PROVINCE_LEGAL_GUILDS,
ROUTE_PROVINCE_ROUTE_OUT_PROVINCE_LEGAL_GUILDS,
];
const isPathnameIn = (pathname, routes) => routes.includes(pathname);
const isPathnameIncludes = (pathname, routes) =>
routes.some((route) => pathname.includes(route));
const Guilds = () => {
const { pathname } = useLocation();
const role = getRoleFromUrl();
const isKillHouse = role === "KillHouse";
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
{isPathnameIn(pathname, MANAGE_ROUTES) ? (
<Grid justifyContent="center" my={SPACING.MEDIUM}>
{isPathnameIn(pathname, GUILDS_OPERATIONS_ROUTES) && (
<GuildsOperations />
)}
{isPathnameIn(pathname, GUILDS_OPERATIONS_COMMERCE_ROUTES) && (
<GuildsOperationsCommerce />
)}
{isPathnameIn(pathname, GUILDS_OPERATIONS_CITY_JIHAD_ROUTES) && (
<GuildsOperationsCityJihad />
)}
{pathname === ROUTE_GUILD_ROOM_ROUTE_MANAGE_GUILDS && (
<GuildRoomOperations />
)}
</Grid>
) : (
<BackButton />
)}
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
{(isPathnameIn(pathname, MANAGE_TAB_ROUTES) || isKillHouse) && (
<ManageTab />
)}
{isPathnameIncludes(pathname, STEWARDS_ROUTES) && (
<ManageStewards />
)}
{isPathnameIn(pathname, GUILDS_SETTINGS_ROUTES) && (
<GuildsSettings />
)}
{isPathnameIn(pathname, GUILDS_REQUESTS_ROUTES) && (
<ManageGuildsRequests />
)}
{isPathnameIn(pathname, GUILDS_DISTRIBUTIONS_ROUTES) && (
<ManageGuildDistributions />
)}
{isPathnameIn(pathname, TRUE_GUILDS_OUT_PROVINCE_ROUTES) && (
<ProvinceTrueGuildsOutProvince />
)}
{isPathnameIn(pathname, LEGAL_GUILDS_IN_PROVINCE_ROUTES) && (
<ProvinceLegalGuildsInProvince />
)}
{isPathnameIn(pathname, LEGAL_GUILDS_OUT_PROVINCE_ROUTES) && (
<ProvinceLegalGuildsOutProvince />
)}
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default Guilds;

32
src/pages/Hatching.js Normal file
View File

@@ -0,0 +1,32 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { BackButton } from "../components/back-button/BackButton";
import { HatchingDetails } from "../features/commerce/components/hatching-details/HatchingDetails";
const HatchingPage = () => {
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<BackButton />
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
<HatchingDetails />
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default HatchingPage;

240
src/pages/Inspection.js Normal file
View File

@@ -0,0 +1,240 @@
import { useContext, useEffect, useState } from "react";
import { useDispatch } from "react-redux";
import moment from "moment";
import { Button, TextField, Tooltip, IconButton, Box } from "@mui/material";
import { DatePicker } from "@mui/x-date-pickers";
import { RiSearchLine, RiFileExcel2Fill } from "react-icons/ri";
import axios from "axios";
import { AppContext } from "../contexts/AppContext";
import {
LOADING_END,
LOADING_START,
OPEN_MODAL,
} from "../lib/redux/slices/appSlice";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import ResponsiveTable from "../components/responsive-table/ResponsiveTable";
import { BackButton } from "../components/back-button/BackButton";
import { inspectorGetPoultryScienceReport } from "../features/inspector/services/inspector-get-poultry-science-report";
import { InspectionDetailsModal } from "../components/inspection-details-modal/InspectionDetailsModal";
import VisibilityIcon from "@mui/icons-material/Visibility";
import { formatJustDate } from "../utils/formatTime";
const Inspection = () => {
const dispatch = useDispatch();
const [textValue, setTextValue] = useState("");
const [totalRows, setTotalRows] = useState(0);
const [perPage, setPerPage] = useState(10);
const [data, setData] = useState([]);
const [tableData, setTableData] = useState([]);
const [page, setPage] = useState(1);
const [, , selectedDate1, setSelectedDate1, selectedDate2, setSelectedDate2] =
useContext(AppContext);
const [openNotif] = useContext(AppContext);
useEffect(() => {
const currentDate = moment(new Date()).format("YYYY-MM-DD");
setSelectedDate1(currentDate);
setSelectedDate2(currentDate);
}, []);
const handleTextChange = (event) => {
setTextValue(event.target.value);
};
const fetchApiData = async (page) => {
dispatch(LOADING_START());
try {
const response = await inspectorGetPoultryScienceReport(page, perPage);
setData(response.results || []);
setTotalRows(response.count || 0);
} catch (error) {
console.error("Error fetching inspection data:", error);
setData([]);
setTotalRows(0);
}
dispatch(LOADING_END());
};
const handlePageChange = (page) => {
fetchApiData(page);
setPage(page);
};
const handlePerRowsChange = (perRows) => {
setPerPage(perRows);
setPage(1);
fetchApiData(1);
};
const handleSubmit = async (event) => {
event.preventDefault();
setPage(1);
fetchApiData(1);
};
const handleViewDetails = (item) => {
dispatch(
OPEN_MODAL({
title: "جزئیات",
size: 1280,
content: <InspectionDetailsModal item={item} />,
})
);
};
const getInspectionStatus = (item) => {
if (item?.state === "pending") {
return "در انتظار تایید";
} else if (item?.state === "accepted") {
return "تایید شده";
} else if (item?.state === "rejected") {
return "رد شده";
}
};
useEffect(() => {
const d = data?.map((item, i) => {
return [
page === 1 ? i + 1 : i + perPage * (page - 1) + 1,
formatJustDate(item?.date) || "-",
item?.reportId || "-",
item?.hatching?.poultry?.unitName || "-",
item?.hatching?.poultry?.breedingUniqueId || "-",
item?.hatching?.licenceNumber || "-",
item?.hatching?.poultry?.user?.city?.name || "-",
formatJustDate(item?.hatching?.date) || "-",
item?.hatching?.quantity?.toLocaleString() || "-",
getInspectionStatus(item) || "-",
<Box key={`details-${i}`} display="flex" justifyContent="center">
<IconButton
color="primary"
onClick={() => handleViewDetails(item)}
size="small"
>
<VisibilityIcon />
</IconButton>
</Box>,
];
});
setTableData(d || []);
}, [data, page, perPage]);
useEffect(() => {
fetchApiData(1);
}, [selectedDate1, selectedDate2, perPage]);
return (
<Box display="flex" justifyContent="center">
<Grid
container
direction="column"
flexWrap="nowrap"
xs={12}
sm={12}
md={10}
lg={10}
>
<BackButton />
<Grid
xs={12}
container
alignItems="center"
gap={SPACING.SMALL}
justifyContent="flex-start"
mb={SPACING.SMALL}
mt={SPACING.SMALL}
>
<form onSubmit={handleSubmit}>
<Grid container alignItems="center" gap={SPACING.SMALL}>
<Grid style={{ width: "150px" }}>
<DatePicker
label="از تاریخ"
id="date"
renderInput={(params) => <TextField {...params} />}
value={selectedDate1}
onChange={(e) => {
setSelectedDate1(moment(e).format("YYYY-MM-DD"));
}}
/>
</Grid>
<Grid style={{ width: "150px" }}>
<DatePicker
label="تا تاریخ"
id="date"
renderInput={(params) => <TextField {...params} />}
value={selectedDate2}
onChange={(e) => {
setSelectedDate2(moment(e).format("YYYY-MM-DD"));
}}
/>
</Grid>
<TextField
autoComplete="off"
size="small"
label="جستجو"
variant="outlined"
style={{ width: 250 }}
onChange={handleTextChange}
value={textValue}
/>
<Button
type="submit"
onClick={handleSubmit}
endIcon={<RiSearchLine />}
>
جستجو
</Button>
<Tooltip title="خروجی اکسل">
<IconButton
color="success"
onClick={() => {
openNotif({
vertical: "top",
horizontal: "center",
msg: "فایل اکسل در حال دانلود می باشد، این عملیات ممکن است زمان بر باشد لطفا صبر کنید.",
severity: "success",
});
// TODO: Replace with actual Excel export endpoint
const link = `${axios.defaults.baseURL}inspection_excel/?date1=${selectedDate1}&date2=${selectedDate2}&search=filter&value=${textValue}`;
window.location.href = link;
}}
>
<RiFileExcel2Fill size={32} />
</IconButton>
</Tooltip>
</Grid>
</form>
</Grid>
<ResponsiveTable
data={tableData}
columns={[
"ردیف",
"تاریخ بازرسی",
"شناسه بازرسی",
"نام فارم",
"شناسه یکتا",
"شناسه جوجه ریزی",
"شهرستان",
"تاریخ جوجه ریزی",
"تعداد جوجه ریزی",
"وضعیت بازرسی",
"مشاهده جزییات",
]}
handlePageChange={handlePageChange}
totalRows={totalRows}
page={page}
perPage={perPage}
handlePerRowsChange={handlePerRowsChange}
paginated={true}
title="بازرسی"
/>
</Grid>
</Box>
);
};
export default Inspection;

77
src/pages/Inspector.js Normal file
View File

@@ -0,0 +1,77 @@
import { Box, Typography } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import {
ROUTE_INSPECTOR_ARCHIVED_REQUESTS,
ROUTE_INSPECTOR_REJECTED_REQUESTS,
ROUTE_INSPECTOR_REQUESTS,
ROUTE_INSPECTOR_REQUESTS_NEW_REQUESTS,
ROUTE_PROVINCE_INSPECTOR_AWAITING_INSPECTION_REQUESTS,
ROUTE_PROVINCE_INSPECTOR_AWAITING_PAYMENT_REQUESTS,
} from "../routes/routes";
import { useLocation } from "react-router-dom";
import { InspectorNewRequests } from "../features/inspector/components/inspector-new-requests/InspectorNewRequests";
import { InspectorOperations } from "../features/inspector/components/inspector-operations/InspectorOperations";
import { InspectorRejectedRequests } from "../features/inspector/components/inspector-rejected-requests/InspectorRejectedRequests";
import { InspectorArchivedRequests } from "../features/inspector/components/inspector-archived-requests/InspectorArchivedRequests";
import { RequestsAwaitingPayment } from "../components/requests-awaiting-payment/RequestsAwaitingPayment";
import { RequestsAwaitingInspections } from "../components/requests-awaiting-inspections/RequestsAwaitingInspections";
import { BackButton } from "../components/back-button/BackButton";
const Inspector = () => {
const { pathname } = useLocation();
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
{pathname === ROUTE_INSPECTOR_REQUESTS ? (
<Grid justifyContent="center" my={SPACING.MEDIUM}>
<Grid>
<Typography variant="h6">
صفحه مدیریت درخواست ها (بازرس)
</Typography>
</Grid>
<InspectorOperations />
</Grid>
) : (
<BackButton />
)}
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
{pathname === ROUTE_INSPECTOR_REQUESTS_NEW_REQUESTS && (
<InspectorNewRequests />
)}
{pathname === ROUTE_INSPECTOR_REJECTED_REQUESTS && (
<InspectorRejectedRequests />
)}
{pathname === ROUTE_INSPECTOR_ARCHIVED_REQUESTS && (
<InspectorArchivedRequests />
)}
{pathname ===
ROUTE_PROVINCE_INSPECTOR_AWAITING_PAYMENT_REQUESTS && (
<RequestsAwaitingPayment />
)}
{pathname ===
ROUTE_PROVINCE_INSPECTOR_AWAITING_INSPECTION_REQUESTS && (
<RequestsAwaitingInspections />
)}
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default Inspector;

View File

@@ -0,0 +1,765 @@
import {
Accordion,
AccordionDetails,
AccordionSummary,
Box,
Button,
Divider,
FormControl,
FormHelperText,
InputLabel,
MenuItem,
Select,
TextField,
Typography,
} from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
import { useFormik } from "formik";
import { Yup } from "../lib/yup/yup";
import { useContext, useEffect, useState } from "react";
import { useDispatch } from "react-redux";
import { inspectorGetReporting } from "../features/inspector/services/inspector-get-reporting";
import { LOADING_END, LOADING_START } from "../lib/redux/slices/appSlice";
import AddIcon from "@mui/icons-material/Add";
import RemoveIcon from "@mui/icons-material/Remove";
import SearchIcon from "@mui/icons-material/Search";
import { AdvancedTable } from "../components/advanced-table/AdvancedTable";
import { AppContext } from "../contexts/AppContext";
import { DatePicker } from "@mui/x-date-pickers";
import moment from "moment";
import { format } from "date-fns-jalali";
const InspectorReporting = () => {
const [reportData, setReportData] = useState();
const [tableData, setTableData] = useState();
const dispatch = useDispatch();
const [openNotif] = useContext(AppContext);
const formik = useFormik({
initialValues: {
mobile: "",
fname: "",
lname: "",
nationalCode: "",
nationalId: "",
address: "",
unitName: "",
gisCode: "",
operationNumber: "",
halls: "",
economicCode: "",
systemCode: "",
epidemiologicalCode: "",
capacity: "",
licenseNumber: "",
healthCode: "",
orderCode: "",
race: "",
},
validationSchema: Yup.object({
mobile: Yup.number().typeError("لطفا عدد وارد کنید!"),
fname: Yup.string().typeError("فیلد را به درستی وارد کنید!"),
lname: Yup.string().typeError("فیلد را به درستی وارد کنید!"),
nationalCode: Yup.number().typeError("لطفا عدد وارد کنید!"),
nationalId: Yup.number().typeError("لطفا عدد وارد کنید!"),
address: Yup.string().typeError("فیلد را به درستی وارد کنید!"),
unitName: Yup.string().typeError("فیلد را به درستی وارد کنید!"),
race: Yup.string().typeError("فیلد را به درستی وارد کنید!"),
gisCode: Yup.number().typeError("لطفا عدد وارد کنید!"),
operationNumber: Yup.number().typeError("لطفا عدد وارد کنید!"),
halls: Yup.number().typeError("لطفا عدد وارد کنید!"),
economicCode: Yup.number().typeError("لطفا عدد وارد کنید!"),
systemCode: Yup.number().typeError("لطفا عدد وارد کنید!"),
epidemiologicalCode: Yup.number().typeError("لطفا عدد وارد کنید!"),
capacity: Yup.number().typeError("لطفا عدد وارد کنید!"),
licenseNumber: Yup.number().typeError("لطفا عدد وارد کنید!"),
healthCode: Yup.number().typeError("لطفا عدد وارد کنید!"),
orderCode: Yup.number().typeError("لطفا عدد وارد کنید!"),
}),
});
const formikHatching = useFormik({
initialValues: {
hatchingDateFrom: "",
hatchingDateTo: "",
},
validationSchema: Yup.object({
hatchingDateFrom: Yup.string().typeError("فیلد را به درستی وارد کنید!"),
hatchingDateTo: Yup.string().typeError("فیلد را به درستی وارد کنید!"),
}),
});
useEffect(() => {
formik.validateForm();
formikHatching.validateForm();
}, []);
const handleValidForm = () => {
if (formik.isValid && formikHatching.isValid) {
if (
Object.values(formik.values).filter((item) => item.length > 0)
.length === 0 &&
Object.values(formikHatching.values).filter((item) => item.length > 0)
.length !== 2
) {
return true;
} else {
return false;
}
} else {
return true;
}
};
const [expanded, setExpanded] = useState(true);
const handleChange = () => {
setExpanded(!expanded);
};
const handleClick = () => {
let values = Object.values(formik.values).filter((item) => item.length > 0);
let finalValue = "";
for (let index = 0; index < values.length; index++) {
finalValue = finalValue + values[index] + ",";
}
finalValue = finalValue.substring(0, finalValue.length - 1);
if (formikHatching.values.hatchingDateFrom) {
finalValue =
finalValue +
"&double_hatching_date=" +
formikHatching.values.hatchingDateFrom +
"," +
formikHatching.values.hatchingDateTo;
}
if (formik.values) dispatch(LOADING_START());
dispatch(inspectorGetReporting(finalValue)).then((r) => {
dispatch(LOADING_END());
if (r.error) {
openNotif({
vertical: "top",
horizontal: "center",
msg: "مشکلی پیش آمده است!",
severity: "error",
});
} else {
setReportData(r?.payload.data);
}
});
};
useEffect(() => {
if (reportData) {
const d = reportData.map((item, i) => {
return [
i + 1,
item.unitName,
item.userprofile?.fullName,
item.breedingUniqueId,
item.numberOfHalls,
item.totalCapacity,
item.userprofile?.mobile,
item.userprofile?.province,
item.userprofile?.city,
item.hatching?.length,
item.numberOfParty,
format(new Date(item?.lastPartyDate), "yyyy/MM/dd"),
item.gisCode,
item.economicCode,
item.samasatUserCode,
item.unitStatus,
];
});
setTableData(d);
}
}, [reportData]);
const [addFilter, setAddFilter] = useState(false);
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
xs={12}
sm={12}
md={10}
lg={10}
mt={SPACING.MEDIUM}
>
<Accordion xs={12} expanded={expanded} onChange={handleChange}>
<AccordionSummary
expandIcon={<ExpandMoreIcon />}
aria-controls="panel1a-content"
id="panel1a-header"
>
<Typography>جستجو</Typography>
</AccordionSummary>
<AccordionDetails>
<Grid container justifyContent="center" gap={SPACING.SMALL}>
<Grid justifyContent="start" container gap={SPACING.SMALL}>
<Grid>
<TextField
size="small"
id="mobile"
label="موبایل"
value={formik.values.mobile}
error={
formik.touched.mobile
? Boolean(formik.errors.mobile)
: null
}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
helperText={
formik.touched.mobile && Boolean(formik.errors.mobile)
? formik.errors.mobile
: null
}
autoComplete="current-password"
variant="outlined"
/>
</Grid>
<Grid>
<TextField
size="small"
id="fname"
label="نام"
value={formik.values.fname}
error={
formik.touched.fname
? Boolean(formik.errors.fname)
: null
}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
helperText={
formik.touched.fname && Boolean(formik.errors.fname)
? formik.errors.fname
: null
}
autoComplete="current-password"
variant="outlined"
/>
</Grid>
<Grid>
<TextField
size="small"
id="lname"
label="نام خانوادگی"
value={formik.values.lname}
error={
formik.touched.lname
? Boolean(formik.errors.lname)
: null
}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
helperText={
formik.touched.lname && Boolean(formik.errors.lname)
? formik.errors.lname
: null
}
autoComplete="current-password"
variant="outlined"
/>
</Grid>
<Grid>
<TextField
size="small"
id="nationalCode"
label="کد ملی"
value={formik.values.nationalCode}
error={
formik.touched.nationalCode
? Boolean(formik.errors.nationalCode)
: null
}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
helperText={
formik.touched.nationalCode &&
Boolean(formik.errors.nationalCode)
? formik.errors.nationalCode
: null
}
autoComplete="current-password"
variant="outlined"
/>
</Grid>
<Grid>
<TextField
size="small"
id="nationalId"
label="شماره شناسنامه"
value={formik.values.nationalId}
error={
formik.touched.nationalId
? Boolean(formik.errors.nationalId)
: null
}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
helperText={
formik.touched.nationalId &&
Boolean(formik.errors.nationalId)
? formik.errors.nationalId
: null
}
autoComplete="current-password"
variant="outlined"
/>
</Grid>
<Grid>
<TextField
size="small"
id="address"
label="آدرس"
value={formik.values.address}
error={
formik.touched.address
? Boolean(formik.errors.address)
: null
}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
helperText={
formik.touched.address && Boolean(formik.errors.address)
? formik.errors.address
: null
}
autoComplete="current-password"
variant="outlined"
/>
</Grid>
<Grid>
<TextField
size="small"
id="unitName"
label="نام واحد"
value={formik.values.unitName}
error={
formik.touched.unitName
? Boolean(formik.errors.unitName)
: null
}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
helperText={
formik.touched.unitName &&
Boolean(formik.errors.unitName)
? formik.errors.unitName
: null
}
autoComplete="current-password"
variant="outlined"
/>
</Grid>
<Grid minWidth={230}>
<FormControl size="small">
<InputLabel id="demo-simple-select-label">
نژاد مرغ
</InputLabel>
<Select
labelId="demo-simple-select-label"
id="race"
label="نژاد مرغ"
value={formik.values.race}
error={
formik.touched.race
? Boolean(formik.errors.race)
: null
}
onChange={(e) => {
formik.setFieldValue("race", e.target.value);
}}
onBlur={formik.handleBlur}
>
<MenuItem value={""}>همه</MenuItem>
<MenuItem value={"آرین"}>آرین</MenuItem>
<MenuItem value={"راس"}>راس</MenuItem>
<MenuItem value={"آربراکرز (آپلاس)"}>
آربراکرز (آپلاس)
</MenuItem>
<MenuItem value={"کاب"}>کاب</MenuItem>
<MenuItem value={"هوبارد"}>هوبارد</MenuItem>
<MenuItem value={"ترکیبی"}>ترکیبی</MenuItem>
<MenuItem value={"وارداتی"}>وارداتی</MenuItem>
</Select>
<FormHelperText>
{formik.touched.race && Boolean(formik.errors.race)
? formik.errors.race
: null}
</FormHelperText>
</FormControl>
</Grid>
{addFilter && (
<>
<Grid>
<TextField
size="small"
id="gisCode"
label="کد gis"
value={formik.values.gisCode}
error={
formik.touched.gisCode
? Boolean(formik.errors.gisCode)
: null
}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
helperText={
formik.touched.gisCode &&
Boolean(formik.errors.gisCode)
? formik.errors.gisCode
: null
}
autoComplete="current-password"
variant="outlined"
/>
</Grid>
<Grid>
<TextField
size="small"
id="operationNumber"
label="شماره گواهی عملیاتی"
value={formik.values.operationNumber}
error={
formik.touched.operationNumber
? Boolean(formik.errors.operationNumber)
: null
}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
helperText={
formik.touched.operationNumber &&
Boolean(formik.errors.operationNumber)
? formik.errors.operationNumber
: null
}
autoComplete="current-password"
variant="outlined"
/>
</Grid>
<Grid>
<TextField
size="small"
id="halls"
label="تعداد سالن"
value={formik.values.halls}
error={
formik.touched.halls
? Boolean(formik.errors.halls)
: null
}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
helperText={
formik.touched.halls && Boolean(formik.errors.halls)
? formik.errors.halls
: null
}
autoComplete="current-password"
variant="outlined"
/>
</Grid>
<Grid>
<TextField
size="small"
id="economicCode"
label="کد اکونومی"
value={formik.values.economicCode}
error={
formik.touched.economicCode
? Boolean(formik.errors.economicCode)
: null
}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
helperText={
formik.touched.economicCode &&
Boolean(formik.errors.economicCode)
? formik.errors.economicCode
: null
}
autoComplete="current-password"
variant="outlined"
/>
</Grid>
<Grid>
<TextField
size="small"
id="systemCode"
label="کد سیستمی"
value={formik.values.systemCode}
error={
formik.touched.systemCode
? Boolean(formik.errors.systemCode)
: null
}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
helperText={
formik.touched.systemCode &&
Boolean(formik.errors.systemCode)
? formik.errors.systemCode
: null
}
autoComplete="current-password"
variant="outlined"
/>
</Grid>
<Grid>
<TextField
size="small"
id="epidemiologicalCode"
label="کد اپیدمیولوژیک"
value={formik.values.epidemiologicalCode}
error={
formik.touched.epidemiologicalCode
? Boolean(formik.errors.epidemiologicalCode)
: null
}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
helperText={
formik.touched.epidemiologicalCode &&
Boolean(formik.errors.epidemiologicalCode)
? formik.errors.epidemiologicalCode
: null
}
autoComplete="current-password"
variant="outlined"
/>
</Grid>
<Grid>
<TextField
size="small"
id="capacity"
label="ظرفیت کل"
value={formik.values.capacity}
error={
formik.touched.capacity
? Boolean(formik.errors.capacity)
: null
}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
helperText={
formik.touched.capacity &&
Boolean(formik.errors.capacity)
? formik.errors.capacity
: null
}
autoComplete="current-password"
variant="outlined"
/>
</Grid>
<Grid>
<TextField
size="small"
id="licenseNumber"
label="شماره مجوز"
value={formik.values.licenseNumber}
error={
formik.touched.licenseNumber
? Boolean(formik.errors.licenseNumber)
: null
}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
helperText={
formik.touched.licenseNumber &&
Boolean(formik.errors.licenseNumber)
? formik.errors.licenseNumber
: null
}
autoComplete="current-password"
variant="outlined"
/>
</Grid>
<Grid>
<TextField
size="small"
id="healthCode"
label="کد بهداشتی"
value={formik.values.healthCode}
error={
formik.touched.healthCode
? Boolean(formik.errors.healthCode)
: null
}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
helperText={
formik.touched.healthCode &&
Boolean(formik.errors.healthCode)
? formik.errors.healthCode
: null
}
autoComplete="current-password"
variant="outlined"
/>
</Grid>
<Grid>
<TextField
size="small"
id="orderCode"
label="کد سفارش"
value={formik.values.orderCode}
error={
formik.touched.orderCode
? Boolean(formik.errors.orderCode)
: null
}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
helperText={
formik.touched.orderCode &&
Boolean(formik.errors.orderCode)
? formik.errors.orderCode
: null
}
autoComplete="current-password"
variant="outlined"
/>
</Grid>
<Grid maxWidth={230}>
<DatePicker
label="جوجه ریزی از"
id="hatchingDateFrom"
renderInput={(params) => (
<TextField size="small" {...params} error={false} />
)}
value={formikHatching.values.hatchingDateFrom}
error={
formikHatching.touched.hatchingDateFrom
? Boolean(formikHatching.errors.hatchingDateFrom)
: null
}
onChange={(e) => {
formikHatching.setFieldValue(
"hatchingDateFrom",
moment(e).format("YYYY-MM-DD")
);
}}
onBlur={formikHatching.handleBlur}
helperText={
formikHatching.touched.hatchingDateFrom &&
Boolean(formikHatching.errors.hatchingDateFrom)
? formikHatching.errors.hatchingDateFrom
: null
}
/>
</Grid>
<Grid maxWidth={230}>
<DatePicker
label="تا"
id="hatchingDateTo"
renderInput={(params) => (
<TextField size="small" {...params} error={false} />
)}
value={formikHatching.values.hatchingDateTo}
error={
formikHatching.touched.hatchingDateTo
? Boolean(formikHatching.errors.hatchingDateTo)
: null
}
onChange={(e) => {
formikHatching.setFieldValue(
"hatchingDateTo",
moment(e).format("YYYY-MM-DD")
);
}}
onBlur={formikHatching.handleBlur}
helperText={
formikHatching.touched.hatchingDateTo &&
Boolean(formikHatching.errors.hatchingDateTo)
? formikHatching.errors.hatchingDateTo
: null
}
/>
</Grid>
</>
)}
</Grid>
<Divider sx={{ width: "100%" }} />
<Grid>
<Button
size="small"
endIcon={<SearchIcon />}
variant="contained"
disabled={handleValidForm(formik, formikHatching)}
onClick={handleClick}
>
جستجو
</Button>
</Grid>
<Grid>
<Button
variant="contained"
endIcon={addFilter ? <RemoveIcon /> : <AddIcon />}
onClick={() => {
setAddFilter(!addFilter);
}}
size="small"
>
{addFilter ? <>کاهش فیلتر</> : <>افزودن فیلتر</>}
</Button>
</Grid>
</Grid>
</AccordionDetails>
</Accordion>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
<AdvancedTable
name="گزارشات"
columns={[
"ردیف",
"نام واحد",
"نام مرغدار",
"شناسه یکتا",
"تعداد سالن",
"ظرفیت",
"موبایل",
"استان",
"شهرستان",
"تعداد جوجه ریزی",
"تعداد پارتی",
"تاریخ آخرین پارتی",
"کد gis",
"کد اکونومی",
"کد سماصط",
"وضعیت واحد",
]}
data={tableData}
/>
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default InspectorReporting;

View File

@@ -0,0 +1,30 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { JahadIllegalKillingComponent } from "../features/jahad/components/jahad-illegal-killing/JahadIllegalKillingComponent";
const JahadIllegalKilling = () => {
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
<JahadIllegalKillingComponent />
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default JahadIllegalKilling;

View File

@@ -0,0 +1,30 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { JahadKillStatsComponent } from "../features/jahad/components/jahad-kill-stats/JahadKillStatsComponent";
const JahadKillStats = () => {
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
<JahadKillStatsComponent />
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default JahadKillStats;

View File

@@ -0,0 +1,30 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { ProvinceKillerManagment } from "../features/province/components/province-killer-managment/ProvinceKillerManagment";
const KillerManagment = () => {
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
<ProvinceKillerManagment />
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default KillerManagment;

View File

@@ -0,0 +1,34 @@
import { Box } from "@mui/material";
import React from "react";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { LiveStockColdHouseComponent } from "../features/live-stock-support/components/live-stock-cold-house/LiveStockColdHouse";
const LiveStockColdHouse = () => {
return (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid
container
justifyContent="space-between"
gap={SPACING.SMALL}
mt={2}
>
<Grid xs={12}>
<LiveStockColdHouseComponent />
</Grid>
</Grid>
</Grid>
</Box>
);
};
export default LiveStockColdHouse;

View File

@@ -0,0 +1,34 @@
import { Box } from "@mui/material";
import React from "react";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { LiveStockAllFreezingRequests } from "../features/live-stock-support/components/live-stock-all-freezing-requests/LiveStockAllFreezingRequests";
const LiveStockFreezingRequests = () => {
return (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid
container
justifyContent="space-between"
gap={SPACING.SMALL}
mt={2}
>
<Grid xs={12}>
<LiveStockAllFreezingRequests />
</Grid>
</Grid>
</Grid>
</Box>
);
};
export default LiveStockFreezingRequests;

View File

@@ -0,0 +1,34 @@
import React from "react";
import { ProvinceCases } from "../features/province/components/province-cases/ProvinceCases";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { Box } from "@mui/material";
const LiveStockSupportCases = () => {
return (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid
container
justifyContent="space-between"
gap={SPACING.SMALL}
mt={2}
>
<Grid xs={12}>
<ProvinceCases />
</Grid>
</Grid>
</Grid>
</Box>
);
};
export default LiveStockSupportCases;

View File

@@ -0,0 +1,8 @@
import React from "react";
import { VetFarmOperation } from "../features/vet-farm/components/vet-farm-operation/VetFarmOperation";
const LiveStockSupportManageBars = () => {
return <VetFarmOperation />;
};
export default LiveStockSupportManageBars;

30
src/pages/ManageFarm.js Normal file
View File

@@ -0,0 +1,30 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { ManageFarmComponent } from "../features/inspector/components/manage-farm-component/ManageFarmComponent";
const ManageFarm = () => {
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
<ManageFarmComponent />
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default ManageFarm;

164
src/pages/ManageProcess.js Normal file
View File

@@ -0,0 +1,164 @@
import { Box, Typography } from "@mui/material";
import { useLocation } from "react-router-dom";
import { BackButton } from "../components/back-button/BackButton";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { ProvinceManageBuyReq } from "../features/province/components/province-manage-buy-req/ProvinceManageBuyReq";
import { ProvinceManageProcessOperation } from "../features/province/components/province-manage-process-operation/ProvinceManageProcessOperation";
import { ProvinceManageSlaughterKillplace } from "../features/province/components/province-manage-slaughter-killplace/ProvinceManageSlaughterKillplace";
import { ProvinceManageSlaughters } from "../features/province/components/province-manage-slaughters/ProvinceManageSlaughters";
import { ProvincePolicyCouncil } from "../features/province/components/province-policy-council/ProvincePolicyCouncil";
import {
ROUTE_ADMINX_ROUTE_ACCOUNTS,
ROUTE_ADMINX_ROUTE_CRONJOB,
ROUTE_ADMINX_ROUTE_Sms_Submission_Management,
ROUTE_ADMINX_ROUTE_MANAGE_PROCESS,
ROUTE_ADMINX_ROUTE_MANAGE_PROCESS_BUY_REQ,
ROUTE_ADMINX_ROUTE_MANAGE_PROCESS_DOCUMENT_STATES,
ROUTE_ADMINX_ROUTE_MANAGE_PROCESS_KILLPLACE,
ROUTE_ADMINX_ROUTE_MANAGE_PROCESS_POLICY_COUNCIL,
ROUTE_ADMINX_ROUTE_MANAGE_PROCESS_SLAUGHTER,
ROUTE_ADMINX_ROUTE_TICKET_PERMISSION,
ROUTE_PROVINCE_ROUTE_MANAGE_PROCESS,
ROUTE_PROVINCE_ROUTE_MANAGE_PROCESS_BUY_REQ,
ROUTE_PROVINCE_ROUTE_MANAGE_PROCESS_KILLPLACE,
ROUTE_PROVINCE_ROUTE_MANAGE_PROCESS_POLICY_COUNCIL,
ROUTE_PROVINCE_ROUTE_MANAGE_PROCESS_SLAUGHTER,
ROUTE_SUPER_ADMIN_ROUTE_MANAGE_PROCESS,
ROUTE_SUPER_ADMIN_ROUTE_MANAGE_PROCESS_BUY_REQ,
ROUTE_SUPER_ADMIN_ROUTE_MANAGE_PROCESS_DOCUMENT_STATES,
ROUTE_SUPER_ADMIN_ROUTE_MANAGE_PROCESS_KILLPLACE,
ROUTE_SUPER_ADMIN_ROUTE_MANAGE_PROCESS_POLICY_COUNCIL,
ROUTE_SUPER_ADMIN_ROUTE_MANAGE_PROCESS_SLAUGHTER,
ROUTE_SUPER_ADMIN_ROUTE_TICKET_PERMISSION,
ROUTE_SUPER_ADMIN_ROUTE_SLAUGHTER_TRADE_PANEL,
ROUTE_ADMINX_ROUTE_SLAUGHTER_TRADE_PANEL,
ROUTE_ADMINX_ROUTE_WEIGHT_RANGE,
ROUTE_ADMINX_ROUTE_WEIGHT_CATEGORY,
ROUTE_SUPER_ADMIN_ROUTE_WEIGHT_CATEGORY,
ROUTE_SUPER_ADMIN_ROUTE_WEIGHT_RANGE,
ROUTE_SUPER_ADMIN_ROUTE_PENALTY,
ROUTE_ADMINX_ROUTE_PENALTY,
ROUTE_ADMINX_ROUTE_MANAGE_DISTRIBUTIONS,
ROUTE_SUPER_ADMIN_ROUTE_MANAGE_DISTRIBUTIONS,
ROUTE_ADMINX_ROUTE_RESTRICTION_OF_CARCASS_DISTRIBUTION,
ROUTE_SUPER_ADMIN_ROUTE_RESTRICTION_OF_CARCASS_DISTRIBUTION,
} from "../routes/routes";
import { ProvincePolicyDocumentStates } from "../features/province/components/province-policy-document-states/ProvincePolicyDocumentStates";
import { ProvincePolicyAccounts } from "../features/province/components/province-policy-accounts/ProvincePolicyAccounts";
import { ProvincePolicyTicketPermission } from "../features/province/components/province-policy-ticket-permission/ProvincePolicyTicketPermission";
import ProcincePolicyKronjob from "../features/province/components/province-policey-kronjon/ProcincePolicyKronjob";
import { ProvinceSmsSubmissionManagement } from "../features/province/components/province-sms-submission-management/provinceSmsSubmissionManagement";
import { ProvinceManageTrades } from "../features/province/components/province-manage-trades/ProvinceManageTrades";
import { ProvincePolicyManageWeightRange } from "../features/province/components/province-policy-manage-weight-range/ProvincePolicyManageWeightRange";
import { ProvincePolicyManageWeightCategory } from "../features/province/components/province-policy-manage-weight-category/ProvincePolicyManageWeightCategory";
import { ProvincePolicyManagePenalty } from "../features/province/components/province-policy-manage-penalty/provincePolicyManagePenalty";
import { ProvinceManageDistributions } from "../features/province/components/province-manage-distributions/ProvinceManageDistributions";
import { ProvinceRestrictionCarcassDistribution } from "../features/province/components/province-restriction-carcass-distribution/ProvinceRestrictionCarcassDistribution";
const ManageProcess = () => {
const { pathname } = useLocation();
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
{pathname === ROUTE_PROVINCE_ROUTE_MANAGE_PROCESS ||
pathname === ROUTE_SUPER_ADMIN_ROUTE_MANAGE_PROCESS ||
pathname === ROUTE_ADMINX_ROUTE_MANAGE_PROCESS ? (
<Grid justifyContent="center" my={SPACING.MEDIUM}>
<Grid>
<Typography variant="h6">مدیریت فرآیند</Typography>
</Grid>
<ProvinceManageProcessOperation />
</Grid>
) : (
<BackButton />
)}
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid mt={SPACING.SMALL} xs={12}>
{(pathname ===
ROUTE_PROVINCE_ROUTE_MANAGE_PROCESS_POLICY_COUNCIL ||
pathname ===
ROUTE_SUPER_ADMIN_ROUTE_MANAGE_PROCESS_POLICY_COUNCIL ||
pathname ===
ROUTE_ADMINX_ROUTE_MANAGE_PROCESS_POLICY_COUNCIL) && (
<ProvincePolicyCouncil />
)}
{(pathname === ROUTE_SUPER_ADMIN_ROUTE_SLAUGHTER_TRADE_PANEL ||
pathname === ROUTE_ADMINX_ROUTE_SLAUGHTER_TRADE_PANEL) && (
<ProvinceManageTrades />
)}
{(pathname === ROUTE_ADMINX_ROUTE_MANAGE_DISTRIBUTIONS ||
pathname === ROUTE_SUPER_ADMIN_ROUTE_MANAGE_DISTRIBUTIONS) && (
<ProvinceManageDistributions />
)}
{(pathname === ROUTE_PROVINCE_ROUTE_MANAGE_PROCESS_SLAUGHTER ||
pathname === ROUTE_SUPER_ADMIN_ROUTE_MANAGE_PROCESS_SLAUGHTER ||
pathname === ROUTE_ADMINX_ROUTE_MANAGE_PROCESS_SLAUGHTER) && (
<ProvinceManageSlaughters />
)}
{(pathname === ROUTE_PROVINCE_ROUTE_MANAGE_PROCESS_KILLPLACE ||
pathname === ROUTE_SUPER_ADMIN_ROUTE_MANAGE_PROCESS_KILLPLACE ||
pathname === ROUTE_ADMINX_ROUTE_MANAGE_PROCESS_KILLPLACE) && (
<ProvinceManageSlaughterKillplace />
)}
{(pathname === ROUTE_PROVINCE_ROUTE_MANAGE_PROCESS_BUY_REQ ||
pathname === ROUTE_SUPER_ADMIN_ROUTE_MANAGE_PROCESS_BUY_REQ ||
pathname === ROUTE_ADMINX_ROUTE_MANAGE_PROCESS_BUY_REQ) && (
<ProvinceManageBuyReq />
)}
{(pathname ===
ROUTE_SUPER_ADMIN_ROUTE_MANAGE_PROCESS_DOCUMENT_STATES ||
pathname ===
ROUTE_ADMINX_ROUTE_MANAGE_PROCESS_DOCUMENT_STATES) && (
<ProvincePolicyDocumentStates />
)}
{pathname === ROUTE_ADMINX_ROUTE_ACCOUNTS && (
<ProvincePolicyAccounts />
)}
{(pathname === ROUTE_ADMINX_ROUTE_TICKET_PERMISSION ||
pathname === ROUTE_SUPER_ADMIN_ROUTE_TICKET_PERMISSION) && (
<ProvincePolicyTicketPermission />
)}
{pathname === ROUTE_ADMINX_ROUTE_CRONJOB && (
<ProcincePolicyKronjob />
)}
{pathname === ROUTE_ADMINX_ROUTE_Sms_Submission_Management && (
<ProvinceSmsSubmissionManagement />
)}
{(pathname === ROUTE_ADMINX_ROUTE_WEIGHT_RANGE ||
pathname === ROUTE_SUPER_ADMIN_ROUTE_WEIGHT_RANGE) && (
<ProvincePolicyManageWeightRange />
)}
{(pathname === ROUTE_ADMINX_ROUTE_WEIGHT_CATEGORY ||
pathname === ROUTE_SUPER_ADMIN_ROUTE_WEIGHT_CATEGORY) && (
<ProvincePolicyManageWeightCategory />
)}
{(pathname === ROUTE_ADMINX_ROUTE_PENALTY ||
pathname === ROUTE_SUPER_ADMIN_ROUTE_PENALTY) && (
<ProvincePolicyManagePenalty />
)}
{(pathname ===
ROUTE_ADMINX_ROUTE_RESTRICTION_OF_CARCASS_DISTRIBUTION ||
pathname ===
ROUTE_SUPER_ADMIN_ROUTE_RESTRICTION_OF_CARCASS_DISTRIBUTION) && (
<ProvinceRestrictionCarcassDistribution />
)}
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default ManageProcess;

View File

@@ -0,0 +1,33 @@
import { Box } from "@mui/material";
import { BackButton } from "../components/back-button/BackButton";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import ProvincePolicyWagesSetup from "../features/province/components/province-policy-wage-setup/ProvincePolicyWagesSetup";
const ManageProcessWageFractions = () => {
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<BackButton />
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid mt={SPACING.SMALL} xs={12}>
<ProvincePolicyWagesSetup />
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default ManageProcessWageFractions;

97
src/pages/Messages.js Normal file
View File

@@ -0,0 +1,97 @@
import { Box, Chip, Divider, Typography } from "@mui/material";
import { useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import MessagesRecivers from "../features/messages/components/messages-recivers/MessagesRecivers";
import MessagesSenders from "../features/messages/components/messages-senders/MessagesSenders";
import { messagesGetReciverMessages } from "../features/messages/services/messages-get-reciver-messages";
import { messagesGetSenderMessages } from "../features/messages/services/messages-get-sender-messages";
const Messages = () => {
const { senderMessages } = useSelector((state) => state.messageSlice);
const { reciverMessages } = useSelector((state) => state.messageSlice);
const dispatch = useDispatch();
useEffect(() => {
dispatch(messagesGetSenderMessages());
dispatch(messagesGetReciverMessages());
}, []);
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid justifyContent="center" my={SPACING.MEDIUM}>
{!senderMessages?.length && !reciverMessages?.length && (
<Typography variant="body1" color="primary">
در حال حاضر پیامی جهت نمایش وجود ندارد!
</Typography>
)}
{senderMessages?.length ? (
<Divider>
<Chip label="پیام های همگانی" />
</Divider>
) : (
""
)}
<Grid p={SPACING.SMALL}>
{senderMessages?.map((item, i) => {
return (
<MessagesSenders
key={i}
number={i}
heading={item.heading}
message={item.message}
link={item.link}
linkText={item.linkText}
image={item.image}
time={item.time}
/>
);
})}
</Grid>
</Grid>
<Grid justifyContent="center">
{reciverMessages?.length ? (
<Divider>
<Chip label="پیام های شما" />
</Divider>
) : (
""
)}
<Grid p={SPACING.SMALL}>
{reciverMessages?.map((item, i) => {
return (
<MessagesRecivers
key={i}
number={i}
heading={item.heading}
message={item.message}
link={item.link}
linkText={item.linkText}
image={item.image}
time={item.time}
/>
);
})}
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default Messages;

53
src/pages/NationalInfo.js Normal file
View File

@@ -0,0 +1,53 @@
import { Box } from "@mui/material";
import React from "react";
import { Grid } from "../components/grid/Grid";
import { NationalInfo } from "../features/city/components/national-info/NationalInfo";
import { useLocation, useParams } from "react-router-dom";
import { NationalInfoHatchingDetails } from "../features/city/components/national-info-hatching-details/NationalInfoHatchingDetails";
import {
ROUTE_ADMINX_ROUTE_NATIONAL_INFO_SLAUGHTER,
ROUTE_PROVINCE_SUPERVISOR_ROUTE_NATIONAL_INFO_SLAUGHTER,
ROUTE_SUPER_ADMIN_ROUTE_NATIONAL_INFO_SLAUGHTER,
} from "../routes/routes";
import { NationalInfoTransports } from "../features/city/components/national-info-bars/NationalInfoTransports";
import { ProvinceChickenDistributionsAndSalesDetails } from "../features/province/components/province-chicken-distribution-and-sales-details/ProvinceChickenDistributionsAndSalesDetails";
const NationalInfoPage = () => {
const { key, name, type } = useParams();
const { pathname } = useLocation();
const isSlaughterDetailsRoute =
pathname.includes(ROUTE_ADMINX_ROUTE_NATIONAL_INFO_SLAUGHTER) ||
pathname.includes(
ROUTE_PROVINCE_SUPERVISOR_ROUTE_NATIONAL_INFO_SLAUGHTER
) ||
pathname.includes(ROUTE_SUPER_ADMIN_ROUTE_NATIONAL_INFO_SLAUGHTER);
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
mt={4}
>
{type ? (
<ProvinceChickenDistributionsAndSalesDetails />
) : isSlaughterDetailsRoute ? (
<NationalInfoTransports />
) : key || name ? (
<NationalInfoHatchingDetails />
) : (
<NationalInfo />
)}
</Grid>
</Box>
</>
);
};
export default NationalInfoPage;

1439
src/pages/NewFile.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,91 @@
import { Box } from "@mui/material";
import { useLocation } from "react-router-dom";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { CityHatching } from "../features/city/components/city-new-hatching/CityHatching";
import { CityNewRequest } from "../features/city/components/city-new-request/CityNewRequest";
import {
ROUTE_ADMINX_HATCHING,
ROUTE_ADMINX_NEW_REQUEST,
ROUTE_ADMINX_ROUTE_NATIONAL_INFO,
ROUTE_ADMINX_ROUTE_NATIONAL_INFO_FARM,
ROUTE_CITY_HATCHING,
ROUTE_CITY_NEW_REQUEST,
ROUTE_CITY_POULTRY_HATCHING,
ROUTE_PROVINCE_HATCHING,
ROUTE_PROVINCE_NEW_REQUEST,
ROUTE_PROVINCE_SUPERVISOR_ROUTE_NATIONAL_INFO,
ROUTE_PROVINCE_SUPERVISOR_ROUTE_NATIONAL_INFO_FARM,
ROUTE_SUPER_ADMIN_HATCHING,
ROUTE_SUPER_ADMIN_NEW_REQUEST,
ROUTE_SUPER_ADMIN_ROUTE_NATIONAL_INFO,
ROUTE_SUPER_ADMIN_ROUTE_NATIONAL_INFO_FARM,
ROUTE_VETFARM_ROUTE_HATCHING,
} from "../routes/routes";
import { ProvinceNationalInfo } from "../features/province/components/province-national-info/ProvinceNationalInfo";
import { ProvinceNationalInfoFarm } from "../features/province/components/province-national-info-farm/ProvinceNationalInfoFarm";
const OperatorNewHatching = () => {
const { pathname } = useLocation();
// console.log(
// "fdloklofd",
// pathname.includes(ROUTE_CITY_VISOR_STATICSـHATCHINGS_DETAILS)
// );
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={11}
sm={11}
md={10}
lg={10}
>
{/* <Grid justifyContent="center" my={SPACING.MEDIUM}>
<Card>
<CityHatchingOperations />
</Card>
</Grid> */}
<Grid
container
justifyContent="space-between"
mt={SPACING.MEDIUM}
gap={SPACING.SMALL}
>
<Grid xs={12}>
{(pathname === ROUTE_CITY_HATCHING ||
pathname === ROUTE_PROVINCE_HATCHING ||
pathname === ROUTE_VETFARM_ROUTE_HATCHING ||
pathname === ROUTE_ADMINX_HATCHING ||
pathname === ROUTE_CITY_POULTRY_HATCHING ||
pathname === ROUTE_SUPER_ADMIN_HATCHING) && <CityHatching />}
{(pathname === ROUTE_CITY_NEW_REQUEST ||
pathname === ROUTE_PROVINCE_NEW_REQUEST ||
pathname === ROUTE_ADMINX_NEW_REQUEST ||
pathname === ROUTE_SUPER_ADMIN_NEW_REQUEST) && (
<CityNewRequest />
)}
{(pathname.includes(ROUTE_ADMINX_ROUTE_NATIONAL_INFO) ||
pathname.includes(ROUTE_SUPER_ADMIN_ROUTE_NATIONAL_INFO) ||
pathname.includes(
ROUTE_PROVINCE_SUPERVISOR_ROUTE_NATIONAL_INFO
)) && <ProvinceNationalInfo />}
{(pathname.includes(ROUTE_ADMINX_ROUTE_NATIONAL_INFO_FARM) ||
pathname.includes(ROUTE_SUPER_ADMIN_ROUTE_NATIONAL_INFO_FARM) ||
pathname.includes(
ROUTE_PROVINCE_SUPERVISOR_ROUTE_NATIONAL_INFO_FARM
)) && <ProvinceNationalInfoFarm />}
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default OperatorNewHatching;

View File

@@ -0,0 +1,73 @@
import React, { useState } from "react";
import { Box, FormControl, MenuItem, Select, Grid } from "@mui/material";
import { BackButton } from "../components/back-button/BackButton";
import { SPACING } from "../data/spacing";
import { useLocation } from "react-router-dom";
import {
ROUTE_PARENT_COMPANY_ALLOCATIONS,
ROUTE_PARENT_COMPANY_PAYING_FEES_REQUESTS,
} from "../routes/routes";
import { ParentCompanyPaymentByWeightOverviewTable } from "../features/province/components/parent-company-payment-by-weight-overview/ParentCompanyPaymentByWeightOverview";
import { ParentCompanyVetFarmOperation } from "../features/vet-farm/components/parent-company-vet-farm-operation/ParentCompanyVetFarmOperation";
const PROVINCES = [
{ label: "استان مرکزی", value: "https://mabackend.rasadyar.com/" },
{ label: "استان همدان", value: "https://habackend.rasadyar.com/" },
{ label: "استان بوشهر", value: "https://bubackend.rasadyar.com/" },
];
const ParentCompany = () => {
const [province, setProvince] = useState("https://mabackend.rasadyar.com/");
const { pathname } = useLocation();
const handleChange = (event) => setProvince(event.target.value);
const renderContent = () => {
if (pathname.includes(ROUTE_PARENT_COMPANY_PAYING_FEES_REQUESTS)) {
return <ParentCompanyPaymentByWeightOverviewTable province={province} />;
}
if (pathname.includes(ROUTE_PARENT_COMPANY_ALLOCATIONS)) {
return <ParentCompanyVetFarmOperation province={province} />;
}
return null;
};
return (
<Box display="flex" justifyContent="center" sx={{ p: SPACING.SMALL }}>
<Grid
container
direction="column"
justifyContent="center"
xs={12}
md={10}
>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<BackButton />
<Box sx={{ width: 160 }}>
<FormControl fullWidth>
<Select
labelId="province-select-label"
id="province-select"
value={province}
onChange={handleChange}
>
{PROVINCES.map((province) => (
<MenuItem key={province.value} value={province.value}>
{province.label}
</MenuItem>
))}
</Select>
</FormControl>
</Box>
</Grid>
<Grid container sx={{ mt: SPACING.MEDIUM }}>
{renderContent()}
</Grid>
</Grid>
</Box>
);
};
export default ParentCompany;

25
src/pages/Payment.js Normal file
View File

@@ -0,0 +1,25 @@
import { Box } from "@mui/system";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { PaymentResult } from "../features/payment/components/PaymentResult";
const Payment = () => {
return (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
my={SPACING.MEDIUM}
xs={12}
sm={12}
md={10}
lg={10}
>
<PaymentResult />
</Grid>
</Box>
);
};
export default Payment;

View File

@@ -0,0 +1,79 @@
import { Box, Tab, Tabs } from "@mui/material";
import { BackButton } from "../components/back-button/BackButton";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { SLaughterPaymentOverview } from "../features/slaughter-house/components/slaughter-payment-overview/SLaughterPaymentOverview";
import { useState } from "react";
import { TabContext, TabPanel } from "@mui/lab";
import { SlaughterPaymentByWeight } from "../features/slaughter-house/components/slaughter-payment-by-weight/SlaughterPaymentByWeight";
import { SlaughterPayingFees } from "../features/slaughter-house/components/slaughter-paying-fees/SlaughterPayingFees";
const PaymentOfFees = () => {
const [tabValue, setTabValue] = useState("1");
const handleTabChange = (event, newValue) => {
setTabValue(newValue);
};
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
ml={4}
// sm={12}
// md={10}
// lg={10}
>
<Grid ml={4}>
<BackButton />
</Grid>
<Grid xs={12} container alignItems="center" justifyContent="center">
<Tabs
scrollButtons="auto"
variant="scrollable"
allowScrollButtonsMobile
value={tabValue}
onChange={handleTabChange}
>
<Tab label="جزئیات" value="1" />
<Tab label="پرداخت" value="2" />
</Tabs>
</Grid>
<TabContext value={tabValue}>
<TabPanel value="1">
<Grid
container
justifyContent="space-between"
gap={SPACING.SMALL}
direction="column"
>
<Grid ml={4} mr={4}>
<SLaughterPaymentOverview />
</Grid>
<Grid>
<SlaughterPayingFees />
</Grid>
</Grid>
</TabPanel>
<TabPanel value="2" style={{ width: "100%" }}>
<Grid
container
justifyContent="space-between"
gap={SPACING.SMALL}
direction="column"
>
<Grid xs={12} style={{ width: "100%" }}>
<SlaughterPaymentByWeight />
</Grid>
</Grid>
</TabPanel>
</TabContext>
</Grid>
</Box>
</>
);
};
export default PaymentOfFees;

View File

@@ -0,0 +1,68 @@
import { Box } from "@mui/material";
import { useLocation } from "react-router-dom";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { PolicyKillhouseDirectBuy } from "../features/province/components/policy-killhouse-direct-buy/PolicyKillhouseDirectBuy";
import { PolicyKillhouseGuilds } from "../features/province/components/policy-killhouse-guilds/PolicyKillhouseGuilds";
import { PolicyPoultryChooseSlaughter } from "../features/province/components/policy-poultry-choose-slaughter/PolicyPoultryChooseSlaughter";
import { PolicyPoultryFreeSale } from "../features/province/components/policy-poultry-free-sale/PolicyPoultryFreeSale";
import {
ROUTE_ADMINX_ROUTE_POLICY_COUNCIL_DIRECT_BUY,
ROUTE_ADMINX_ROUTE_POLICY_COUNCIL_FREE_SALE,
ROUTE_ADMINX_ROUTE_POLICY_COUNCIL_KILLHOUSE_GUILDS,
ROUTE_PROVINCE_ROUTE_POLICY_COUNCIL_DIRECT_BUY,
ROUTE_PROVINCE_ROUTE_POLICY_COUNCIL_FREE_SALE,
ROUTE_PROVINCE_ROUTE_POLICY_COUNCIL_KILLHOUSE_GUILDS,
ROUTE_PROVINCE_ROUTE_POLICY_COUNCIL_POULTRY_CHOOSE_SLAUGHTER,
ROUTE_SUPER_ADMIN_ROUTE_POLICY_COUNCIL_DIRECT_BUY,
ROUTE_SUPER_ADMIN_ROUTE_POLICY_COUNCIL_FREE_SALE,
ROUTE_SUPER_ADMIN_ROUTE_POLICY_COUNCIL_KILLHOUSE_GUILDS,
} from "../routes/routes";
const PolicyCouncil = () => {
const { pathname } = useLocation();
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid mt={SPACING.SMALL} xs={12}>
{pathname ===
ROUTE_PROVINCE_ROUTE_POLICY_COUNCIL_POULTRY_CHOOSE_SLAUGHTER && (
<PolicyPoultryChooseSlaughter />
)}
{(pathname === ROUTE_PROVINCE_ROUTE_POLICY_COUNCIL_FREE_SALE ||
pathname === ROUTE_SUPER_ADMIN_ROUTE_POLICY_COUNCIL_FREE_SALE ||
pathname === ROUTE_ADMINX_ROUTE_POLICY_COUNCIL_FREE_SALE) && (
<PolicyPoultryFreeSale />
)}
{(pathname === ROUTE_PROVINCE_ROUTE_POLICY_COUNCIL_DIRECT_BUY ||
ROUTE_SUPER_ADMIN_ROUTE_POLICY_COUNCIL_DIRECT_BUY ||
ROUTE_ADMINX_ROUTE_POLICY_COUNCIL_DIRECT_BUY) && (
<PolicyKillhouseDirectBuy />
)}
{(pathname ===
ROUTE_PROVINCE_ROUTE_POLICY_COUNCIL_KILLHOUSE_GUILDS ||
pathname ===
ROUTE_SUPER_ADMIN_ROUTE_POLICY_COUNCIL_KILLHOUSE_GUILDS ||
pathname ===
ROUTE_ADMINX_ROUTE_POLICY_COUNCIL_KILLHOUSE_GUILDS) && (
<PolicyKillhouseGuilds />
)}
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default PolicyCouncil;

20
src/pages/Poultries.js Normal file
View File

@@ -0,0 +1,20 @@
import { Grid } from "../components/grid/Grid";
import { ManagePoultries } from "../features/province/components/manage-poultries/ManagePoultries";
// import { VetFarmOperations } from "../features/vet-farm/components/vet-farm-operations/VetFarmOperations";
const Poultries = () => {
return (
<>
<Grid
container
direction="column"
alignItems="center"
justifyContent="center"
xs={12}
>
<ManagePoultries />
</Grid>
</>
);
};
export default Poultries;

View File

@@ -0,0 +1,18 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { PoultriesDetails } from "../features/province/components/poultries-details/PoultriesDetails";
import { BackButton } from "../components/back-button/BackButton";
const PoultriesDetailsPage = () => {
return (
<Box display={"flex"} justifyContent="center">
<Grid container direction="column" xs={12} sm={12} md={10} lg={10}>
<Grid>
<BackButton />
</Grid>
<PoultriesDetails />
</Grid>
</Box>
);
};
export default PoultriesDetailsPage;

View File

@@ -0,0 +1,36 @@
import { Box } from "@mui/material";
import React from "react";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { ProvincePoultryScienceExperts } from "../features/province/components/province-poultry-science-experts/ProvincePoultryScienceExperts";
const PoultryScienceExperts = () => {
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid
container
justifyContent="space-between"
mt={SPACING.MEDIUM}
gap={SPACING.SMALL}
>
<Grid xs={12}>
<ProvincePoultryScienceExperts />
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default PoultryScienceExperts;

View File

@@ -0,0 +1,40 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { ProvinceCaseStatusComponent } from "../features/province/components/province-case-status/ProvinceCaseStatusComponent";
const ProvinceCaseStatus = () => {
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
{/* <Grid justifyContent="center" my={SPACING.MEDIUM}>
<Card>
<CityHatchingOperations />
</Card>
</Grid> */}
<Grid
container
justifyContent="space-between"
mt={SPACING.MEDIUM}
gap={SPACING.SMALL}
>
<Grid xs={12}>
<ProvinceCaseStatusComponent />
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default ProvinceCaseStatus;

View File

@@ -0,0 +1,60 @@
import React from "react";
import {
ROUTE_ADMINX_COLD_HOUSES,
ROUTE_ADMINX_COLD_HOUSES_MANAGEMENT,
ROUTE_PROVINCE_COLD_HOUSES,
ROUTE_PROVINCE_COLD_HOUSES_MANAGEMENT,
ROUTE_SUPER_ADMIN_COLD_HOUSES,
ROUTE_SUPER_ADMIN_COLD_HOUSES_MANAGEMENT,
} from "../routes/routes";
import { SPACING } from "../data/spacing";
import { Grid } from "../components/grid/Grid";
import { Box, Typography } from "@mui/material";
import { useLocation, useParams } from "react-router-dom";
import { BackButton } from "../components/back-button/BackButton";
import { ProvinceColdHousesOperations } from "../features/province/components/province-cold-houses-operations/ProvinceColdHousesOperations";
import { ProvinceColdHousesList } from "../features/province/components/province-cold-houses-list/ProvinceColdHousesList";
import { ProvinceStewardShowColdHousesList } from "../features/province/components/province-steward-show-cold-houses-list/ProvinceStewardShowColdHousesList";
const ProvinceColdHousesPage = () => {
const { pathname } = useLocation();
const { key } = useParams();
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
{pathname === ROUTE_PROVINCE_COLD_HOUSES ||
pathname === ROUTE_ADMINX_COLD_HOUSES ||
pathname === ROUTE_SUPER_ADMIN_COLD_HOUSES ? (
<Grid justifyContent="center" my={SPACING.MEDIUM}>
<Grid>
<Typography variant="h6">داشبورد مدیریت سردخانه ها </Typography>
</Grid>
<ProvinceColdHousesOperations />
</Grid>
) : (
<BackButton />
)}
{(pathname === ROUTE_PROVINCE_COLD_HOUSES_MANAGEMENT ||
pathname === ROUTE_ADMINX_COLD_HOUSES_MANAGEMENT ||
pathname === ROUTE_SUPER_ADMIN_COLD_HOUSES_MANAGEMENT) && (
<ProvinceColdHousesList />
)}
{key && <ProvinceStewardShowColdHousesList />}
</Grid>
</Box>
</>
);
};
export default ProvinceColdHousesPage;

112
src/pages/ProvinceFees.js Normal file
View File

@@ -0,0 +1,112 @@
import { Box } from "@mui/material";
import { useParams } from "react-router-dom";
import { BackButton } from "../components/back-button/BackButton";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { ProvinceKillhousePaidFee } from "../features/province/components/province-killhouse-paid-fee/ProvinceKillhousePaidFee";
import { ProvincePaymentByWeight } from "../features/province/components/province-payment-by-weight/ProvincePaymentByWeight";
import { ProvinceKillhouseFee } from "../features/province/components/province-killhouse-fee/ProvinceKillhouseFee";
import { ProvinceDailyBarsDetails } from "../features/province/components/province-daily-bars-details/ProvinceDailyBarsDetails";
import { ProvincePaymentLiveChickenDetails } from "../features/province/components/province-payment-live-chicken-detail/ProvincePaymentLiveChickenDetails";
import { ProvincePaymentChainDetails } from "../features/province/components/province-payment-chain-detail/ProvincePaymentChainDetails";
const ProvinceFees = () => {
const params = useParams();
const getDetailComponent = () => {
let component;
switch (params.type) {
case "unpaid":
component = <ProvinceKillhouseFee killhouseKey={params.key} />;
break;
case "kill_house_key":
component = (
<ProvinceKillhousePaidFee
killhouseKey={params.key}
type={params.type}
/>
);
break;
case "chain_company_key":
component = (
<ProvinceKillhousePaidFee
killhouseKey={params.key}
type={params.type}
/>
);
break;
case "daily_bar":
component = (
<ProvinceDailyBarsDetails
killhouseKey={params.key}
type={params.type}
/>
);
break;
case "live_chicken":
component = (
<ProvincePaymentLiveChickenDetails
killhouseKey={params.key}
type={"live"}
/>
);
break;
case "carcassess":
component = (
<ProvincePaymentLiveChickenDetails
killhouseKey={params.key}
type={"carcass"}
/>
);
break;
case "chain":
component = <ProvincePaymentChainDetails killhouseKey={params.key} />;
break;
default:
component = (
<ProvinceKillhousePaidFee
killhouseKey={params.key}
type={params.type}
/>
);
break;
}
return component;
};
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid
container
justifyContent="space-between"
gap={SPACING.SMALL}
direction="column"
>
<BackButton />
{params.type ? (
<>{getDetailComponent()}</>
) : (
<Grid>
<ProvincePaymentByWeight />
</Grid>
)}
</Grid>
</Grid>
</Box>
</>
);
};
export default ProvinceFees;

View File

@@ -0,0 +1,97 @@
import { Box, Typography } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { useLocation } from "react-router-dom";
import {
ROUTE_PROVINCE_FINANCIAL_ACTIVE_REQUESTS,
ROUTE_PROVINCE_FINANCIAL_ARCHIVED_REQUESTS,
ROUTE_PROVINCE_FINANCIAL_AWAITING_INSPECTION_REQUESTS,
ROUTE_PROVINCE_FINANCIAL_AWAITING_PAYMENT_REQUESTS,
ROUTE_PROVINCE_FINANCIAL_CHECK_PAYED_FACTOR_REQUESTS,
ROUTE_PROVINCE_FINANCIAL_FINAL_FACTORS_REQUESTS,
ROUTE_PROVINCE_FINANCIAL_NEW_REQUESTS,
ROUTE_PROVINCE_FINANCIAL_PENDING_REQUESTS,
ROUTE_PROVINCE_FINANCIAL_REQUESTS,
} from "../routes/routes";
import { ProvinceFinancialOperations } from "../features/province-finacial/components/province-financial-operations/ProvinceFinancialOperations";
import { ProvinceFinancialActiveRequests } from "../features/province-finacial/components/province-financial-active-requests/ProvinceFinancialActiveRequests";
import { AvicultureArchivedRequests } from "../features/aviculture/components/aviculture-archived-requests/AvicultureArchivedRequests";
import { ProvinceFinancialNewRequests } from "../features/province-finacial/components/province-financial-new-requests/ProvinceFinancialNewRequests";
import { RequestsAwaitingPayment } from "../components/requests-awaiting-payment/RequestsAwaitingPayment";
import { RequestsAwaitingInspections } from "../components/requests-awaiting-inspections/RequestsAwaitingInspections";
import { ProvinceFinancialPendingRequests } from "../features/province-finacial/components/province-financial-pending-requests/ProvinceFinancialPendingRequests";
import { ProvinceFinancialCheckPayedFactorRequests } from "../features/province-finacial/components/province-financial-check-payed-factor-requests/ProvinceFinancialCheckPayedFactorRequests";
import { FinalFactorsRequests } from "../features/province-finacial/components/final-factors-requests/FinalFactorsRequests";
import { BackButton } from "../components/back-button/BackButton";
const ProvinceFinancial = () => {
const { pathname } = useLocation();
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
{pathname === ROUTE_PROVINCE_FINANCIAL_REQUESTS ? (
<Grid justifyContent="center" my={SPACING.MEDIUM}>
<Grid>
<Typography variant="h6">
صفحه مدیریت درخواست ها (اپراتور مالی)
</Typography>
</Grid>
<ProvinceFinancialOperations />
</Grid>
) : (
<BackButton />
)}
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
{pathname === ROUTE_PROVINCE_FINANCIAL_PENDING_REQUESTS && (
<ProvinceFinancialPendingRequests />
)}
{pathname === ROUTE_PROVINCE_FINANCIAL_ACTIVE_REQUESTS && (
<ProvinceFinancialActiveRequests />
)}
{pathname === ROUTE_PROVINCE_FINANCIAL_ARCHIVED_REQUESTS && (
<AvicultureArchivedRequests />
)}
{pathname === ROUTE_PROVINCE_FINANCIAL_NEW_REQUESTS && (
<ProvinceFinancialNewRequests />
)}
{pathname ===
ROUTE_PROVINCE_FINANCIAL_AWAITING_PAYMENT_REQUESTS && (
<RequestsAwaitingPayment />
)}
{pathname ===
ROUTE_PROVINCE_FINANCIAL_AWAITING_INSPECTION_REQUESTS && (
<RequestsAwaitingInspections />
)}
{pathname ===
ROUTE_PROVINCE_FINANCIAL_CHECK_PAYED_FACTOR_REQUESTS && (
<ProvinceFinancialCheckPayedFactorRequests />
)}
{pathname === ROUTE_PROVINCE_FINANCIAL_FINAL_FACTORS_REQUESTS && (
<FinalFactorsRequests />
)}
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default ProvinceFinancial;

View File

@@ -0,0 +1,93 @@
import { IconButton } from "@mui/material";
import { Box } from "@mui/system";
import React, { useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { useNavigate } from "react-router-dom";
import { Grid } from "../components/grid/Grid";
import { SimpleTable } from "../components/simple-table/SimpleTable";
import { SPACING } from "../data/spacing";
import { provinceFinancialGetRegisteredComplaints } from "../features/province-finacial/services/province-financial-get-registered-compaints";
import { LOADING_END, LOADING_START } from "../lib/redux/slices/appSlice";
import { ROUTE_PROVINCE_FINANCIAL_FILE } from "../routes/routes";
import PlagiarismIcon from "@mui/icons-material/Plagiarism";
import { formatJustDate } from "../utils/formatTime";
const ProvinceFinancialComplaints = () => {
const [dataTable, setDataTable] = useState();
const navigate = useNavigate();
const dispatch = useDispatch();
const { registeredComplaints } = useSelector(
(state) => state.provinceFinancialSlice
);
useEffect(() => {
dispatch(LOADING_START());
dispatch(provinceFinancialGetRegisteredComplaints()).then((r) => {
dispatch(LOADING_END());
});
}, []);
useEffect(() => {
const d = registeredComplaints?.map((item, i) => {
return [
item.title,
item.description,
formatJustDate(item?.createDate),
item.state === "pending"
? "در حال بررسی"
: item.state === "accepted"
? "تایید شده"
: "رد شده",
<IconButton
key={i}
aria-label="delete"
color="primary"
className="avicultureActiveRequestsBtn"
onClick={() =>
navigate(ROUTE_PROVINCE_FINANCIAL_FILE + item.poultryRequestId)
}
>
<PlagiarismIcon />
</IconButton>,
];
});
setDataTable(d);
}, []);
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
<Grid mt={SPACING.SMAll}>
<SimpleTable
name="شکایات ثبت شده"
columns={[
" موضوع",
" توضیحات",
" تاریخ ثبت",
" وضعیت",
" پرونده",
]}
data={dataTable}
/>
</Grid>
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default ProvinceFinancialComplaints;

View File

@@ -0,0 +1,66 @@
import { Box, Button } from "@mui/material";
import React from "react";
import { useDispatch } from "react-redux";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { DRAWER } from "../lib/redux/slices/appSlice";
import AttachMoneyIcon from "@mui/icons-material/AttachMoney";
import { SimpleTable } from "../components/simple-table/SimpleTable";
import { ProvinceFinancialRegisterDebt } from "../features/province-finacial/components/province-financial-register-debt/ProvinceFinancialRegisterDebt";
const ProvinceFinancialDebts = () => {
const dispatch = useDispatch();
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid justifyContent="center" my={SPACING.MEDIUM}>
<Grid
container
xs={12}
alignItems={"start"}
gap={SPACING.SMALL}
direction={"column"}
>
<Button
startIcon={<AttachMoneyIcon />}
className="first-step"
variant={"contained"}
onClick={() => {
dispatch(
DRAWER({
title: "ثبت اطلاعات جوجه ریزی",
right: !(window.innerWidth <= 600),
bottom: window.innerWidth <= 600,
content: <ProvinceFinancialRegisterDebt />,
})
);
}}
>
ثبت بدهی جدید
</Button>
</Grid>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid width="100%" mt={SPACING.MEDIUM}>
<SimpleTable
columns={["نام مرغدار", "مبلغ", "توضیحات", "سند"]}
data={[["ssss"]]}
/>
</Grid>
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default ProvinceFinancialDebts;

View File

@@ -0,0 +1,43 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { useLocation } from "react-router-dom";
import {
ROUTE_PROVINCE_FINANCIAL_DOCUMENT_REGISTRATION,
ROUTE_PROVINCE__FINANCIAL_USER_FINACIAL_FILE,
} from "../routes/routes";
import { ProvinceFinancialDocumentRegistration } from "../features/province-finacial/components/province-financial-document-register/ProvinceFinancialDocumentRegister";
import ProvinceFinancialUserFinancial from "../features/province-finacial/components/province-financial-user-financial/ProvinceFinancialUserFinancial";
const ProvinceFinancialDocumentRegister = () => {
const { pathname } = useLocation();
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
{pathname.includes(
ROUTE_PROVINCE_FINANCIAL_DOCUMENT_REGISTRATION
) && <ProvinceFinancialDocumentRegistration />}
{pathname.includes(
ROUTE_PROVINCE__FINANCIAL_USER_FINACIAL_FILE
) && <ProvinceFinancialUserFinancial />}
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default ProvinceFinancialDocumentRegister;

View File

@@ -0,0 +1,74 @@
import { Box, IconButton } from "@mui/material";
import React, { useEffect, useState } from "react";
import { Grid } from "../components/grid/Grid";
import { useDispatch } from "react-redux";
import { getStewards } from "../features/province/services/provinceGetStewards";
import { AdvancedTable } from "../components/advanced-table/AdvancedTable";
import ReceiptIcon from "@mui/icons-material/Receipt";
import { DRAWER } from "../lib/redux/slices/appSlice";
import MainPlaceFullInfo from "../features/province/components/province-place-full-info/MainPlaceInfo";
import { useProvinceName } from "../utils/getProvinceName";
const ProvinceGuildsTransactions = () => {
const dispatch = useDispatch();
const [transactions, setTransactions] = useState();
const [tableData, settableData] = useState();
const provinceName = useProvinceName();
useEffect(() => {
dispatch(getStewards(provinceName)).then((r) => {
setTransactions(r.payload.data);
});
}, []);
useEffect(() => {
const d = transactions?.map((item, i) => {
return [
i + 1,
item?.guild_info.fullname,
item?.guild_info.mobile,
item?.ware_house_info.quantity.toLocaleString(),
<IconButton
key={i}
aria-label="delete"
color="primary"
onClick={() => {
dispatch(
DRAWER({
title: "مشخصات کامل محل",
right: false,
bottom: true,
content: <MainPlaceFullInfo item={item} />,
})
);
}}
>
<ReceiptIcon />
</IconButton>,
];
});
settableData(d);
}, [transactions]);
return (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
{" "}
<AdvancedTable
name="لیست اصناف"
data={tableData}
columns={["ردیف", "نام کامل", "موبایل", "موجودی", "مشاهده تراکنش ها"]}
/>
</Grid>
</Box>
);
};
export default ProvinceGuildsTransactions;

View File

@@ -0,0 +1,141 @@
import { Box } from "@mui/material";
import React, { useState, useEffect } from "react";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { useLocation } from "react-router-dom";
import {
ROUTE_COOPERATIVE_PRODUCT_DISTRIBUTION,
ROUTE_COOPERATIVE_PRODUCT_DISTRIBUTION_ALLOCATION,
ROUTE_COOPERATIVE_PRODUCT_DISTRIBUTION_POLICY,
ROUTE_COOPERATIVE_PRODUCT_TRANSACTIONS,
ROUTE_COOPERATIVE_HERDS,
ROUTE_COOPERATIVE_RANCHERS,
ROUTE_COOPERATIVE_USERS,
ROUTE_PROVINCE_JAHAD_PRODUCT_DISTRIBUTION,
ROUTE_PROVINCE_JAHAD_PRODUCT_DISTRIBUTION_ALLOCATION,
ROUTE_PROVINCE_JAHAD_PRODUCT_DISTRIBUTION_POLICY,
ROUTE_PROVINCE_JAHAD_PRODUCT_SHARES,
ROUTE_PROVINCE_JAHAD_PRODUCT_TRANSACTIONS,
ROUTE_PROVINCE_JAHAD_COOPERATIVES,
ROUTE_PROVINCE_JAHAD_HERDS,
ROUTE_PROVINCE_JAHAD_RANCHERS,
ROUTE_PROVINCE_JAHAD_SELL_REPORT,
ROUTE_PROVINCE_JAHAD_UNIONS,
ROUTE_PROVINCE_JAHAD_USERS,
ROUTE_UNION_PRODUCT_DISTRIBUTION,
ROUTE_UNION_PRODUCT_DISTRIBUTION_ALLOCATION,
ROUTE_UNION_PRODUCT_DISTRIBUTION_POLICY,
ROUTE_UNION_PRODUCT_TRANSACTIONS,
ROUTE_UNION_COOPERATIVES,
ROUTE_UNION_HERDS,
ROUTE_UNION_RANCHERS,
ROUTE_UNION_SELL_REPORT,
ROUTE_UNION_USERS,
} from "../routes/routes";
import { ProvinceJahadUnions } from "../features/province-jahad/components/province-jahad-unions/ProvinceJahadUnions";
import { ProvinceJahadCooperatives } from "../features/province-jahad/components/province-jahad-cooperatives/ProvinceJahadCooperatives";
import { ProvinceJahadHerds } from "../features/province-jahad/components/province-jahad-herds/ProvinceJahadHerds";
import { ProvinceJahadRanchers } from "../features/province-jahad/components/province-jahad-ranchers/ProvinceJahadRanchers";
import { ProvinceJahadUsers } from "../features/province-jahad/components/province-jahad-users/ProvinceJahadUsers";
import { ProvinceJahadBranDistributions } from "../features/province-jahad/components/province-jahad-bran-distributions/ProvinceJahadBranDistributions";
import { BackButton } from "../components/back-button/BackButton";
import { ProvinceJahadBranDistributionsAllocation } from "../features/province-jahad/components/province-jahad-bran-distributions-allocation/ProvinceJahadBranDistributionsAllocation";
import { ProvinceJahadBranDistributionsPolicy } from "../features/province-jahad/components/province-jahad-bran-distributions-policy/ProvinceJahadBranDistributionsPolicy";
import { ProvinceJahadShares } from "../features/province-jahad/components/province-jahad-shares/ProvinceJahadShares";
import { ProvinceJahadTransactions } from "../features/province-jahad/components/province-jahad-transactions/ProvinceJahadTransactions";
import { ProvinceJahadSellReport } from "../features/province-jahad/components/province-jahad-sell-report/ProvinceJahadSellReport";
import ProductSelector from "../features/province-jahad/components/product-selector/ProductSelector";
const LOCAL_STORAGE_KEY = "selectedProduct";
const ProvinceJahadRequests = () => {
const { pathname } = useLocation();
const saved = localStorage.getItem(LOCAL_STORAGE_KEY);
let initialProduct;
try {
initialProduct = saved ? JSON.parse(saved) : { key: "bran", label: "سبوس" };
} catch {
initialProduct = { key: "bran", label: "سبوس" };
}
const [selectedProduct, setSelectedProduct] = useState(initialProduct);
useEffect(() => {
localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(selectedProduct));
}, [selectedProduct]);
return (
<Box display="flex" justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
my={SPACING.MEDIUM}
>
<BackButton />
{pathname === ROUTE_PROVINCE_JAHAD_UNIONS && <ProvinceJahadUnions />}
{(pathname === ROUTE_PROVINCE_JAHAD_COOPERATIVES ||
pathname === ROUTE_UNION_COOPERATIVES) && (
<ProvinceJahadCooperatives />
)}
{(pathname === ROUTE_PROVINCE_JAHAD_RANCHERS ||
pathname === ROUTE_UNION_RANCHERS ||
pathname === ROUTE_COOPERATIVE_RANCHERS) && <ProvinceJahadRanchers />}
{(pathname === ROUTE_PROVINCE_JAHAD_HERDS ||
pathname === ROUTE_UNION_HERDS ||
pathname === ROUTE_COOPERATIVE_HERDS) && <ProvinceJahadHerds />}
{(pathname === ROUTE_PROVINCE_JAHAD_USERS ||
pathname === ROUTE_UNION_USERS ||
pathname === ROUTE_COOPERATIVE_USERS) && <ProvinceJahadUsers />}
{(pathname === ROUTE_PROVINCE_JAHAD_PRODUCT_DISTRIBUTION ||
pathname === ROUTE_UNION_PRODUCT_DISTRIBUTION ||
pathname === ROUTE_COOPERATIVE_PRODUCT_DISTRIBUTION) && (
<>
<ProductSelector onSelect={(p) => setSelectedProduct(p)} />
<ProvinceJahadBranDistributions product={selectedProduct} />
</>
)}
{(pathname === ROUTE_PROVINCE_JAHAD_PRODUCT_DISTRIBUTION_ALLOCATION ||
pathname === ROUTE_UNION_PRODUCT_DISTRIBUTION_ALLOCATION ||
pathname === ROUTE_COOPERATIVE_PRODUCT_DISTRIBUTION_ALLOCATION) && (
<ProvinceJahadBranDistributionsAllocation product={selectedProduct} />
)}
{(pathname === ROUTE_PROVINCE_JAHAD_PRODUCT_DISTRIBUTION_POLICY ||
pathname === ROUTE_UNION_PRODUCT_DISTRIBUTION_POLICY ||
pathname === ROUTE_COOPERATIVE_PRODUCT_DISTRIBUTION_POLICY) && (
<ProvinceJahadBranDistributionsPolicy product={selectedProduct} />
)}
{(pathname === ROUTE_PROVINCE_JAHAD_PRODUCT_TRANSACTIONS ||
pathname === ROUTE_UNION_PRODUCT_TRANSACTIONS ||
pathname === ROUTE_COOPERATIVE_PRODUCT_TRANSACTIONS) && (
<ProvinceJahadTransactions product={selectedProduct} />
)}
{pathname === ROUTE_PROVINCE_JAHAD_PRODUCT_SHARES && (
<ProvinceJahadShares product={selectedProduct} />
)}
{(pathname === ROUTE_UNION_SELL_REPORT ||
pathname === ROUTE_PROVINCE_JAHAD_SELL_REPORT) && (
<ProvinceJahadSellReport product={selectedProduct} />
)}
</Grid>
</Box>
);
};
export default ProvinceJahadRequests;

View File

@@ -0,0 +1,245 @@
import React, { useEffect, useState } from "react";
import { Grid } from "../components/grid/Grid";
import { BackButton } from "../components/back-button/BackButton";
import { Box, Button } from "@mui/material";
import { useParams } from "react-router-dom";
import { useDispatch, useSelector } from "react-redux";
import { provincePaymentGetKillersOfKillhousesInfo } from "../features/province/services/province-payment-get-killers-of-killhouses-info";
import ResponsiveTable from "../components/responsive-table/ResponsiveTable";
import { OPEN_MODAL } from "../lib/redux/slices/appSlice";
import { SimpleTable } from "../components/simple-table/SimpleTable";
const ProvinceKillersWages = () => {
const { key } = useParams();
const [tableData, setTableData] = useState();
const dispatch = useDispatch();
useEffect(() => {
dispatch(
provincePaymentGetKillersOfKillhousesInfo({ kill_house_key: key })
);
}, []);
const { provincePaymentByWeightOverview } = useSelector(
(item) => item.provinceSlice
);
const { provincePaymentKillersOfKillhouses } = useSelector(
(item) => item.provinceSlice
);
const getKillHouseShares = (shares, name) => {
// if (!shares || shares.length === 0) {
// return (
// <Button size="small" variant="outlined" disabled>
// بدون سهم‌بندی
// </Button>
// );
// }
const shareData = shares.map((share, i) => [
i + 1,
share?.name,
share?.provinceKillRequestWage?.toLocaleString() || "0",
share?.freeSellCarcassesWage?.toLocaleString() || "0",
share?.freeBuyingCarcassesWage?.toLocaleString() || "0",
share?.freeBuyingLiveWage?.toLocaleString() || "0",
(
(share?.provinceKillRequestWage || 0) +
(share?.freeSellCarcassesWage || 0) +
(share?.freeBuyingCarcassesWage || 0) +
(share?.freeBuyingLiveWage || 0)
)?.toLocaleString(),
share?.totalPaidWage?.toLocaleString() || "0",
share?.totalUnpaidWage?.toLocaleString() || "0",
]);
return (
<Button
size="small"
variant="outlined"
color="success"
onClick={() => {
dispatch(
OPEN_MODAL({
title: "سهم بندی تعرفه کشتارگاه " + name,
size: 1000,
content: (
<Grid container xs={12} justifyContent="center">
<SimpleTable
data={shareData}
columns={[
"ردیف",
"سهم",
`${
provincePaymentByWeightOverview?.wageInfo
?.wageCountingType === "live"
? "تعرفه کشتار داخل استان (ریال)"
: " تعرفه توزیع لاشه داخل استان (ریال)"
}`,
"تعرفه توزیع لاشه خارج استان (ریال)",
"تعرفه لاشه ورودی به استان (ریال)",
"تعرفه مرغ زنده ورودی به استان (ریال)",
"تعرفه کل (ریال)",
"تعرفه پرداخت شده (ریال)",
"تعرفه پرداخت نشده (ریال)",
]}
/>
</Grid>
),
})
);
}}
>
مشاهده
</Button>
);
};
useEffect(() => {
if (provincePaymentByWeightOverview) {
const d = provincePaymentKillersOfKillhouses?.map((item, i) => {
if (
provincePaymentByWeightOverview?.wageInfo?.wageCountingType === "live"
) {
return [
item?.name,
Math.ceil(item?.wageInfo?.totalWage)?.toLocaleString(),
Math.ceil(item?.wageInfo?.totalPaidWage)?.toLocaleString(),
Math.ceil(item?.wageInfo?.off)?.toLocaleString(),
Math.ceil(item?.wageInfo?.totalUnpaidWage)?.toLocaleString(),
Math.ceil(
item?.wageInfo?.totalProvinceLiveWeight
)?.toLocaleString(),
Math.ceil(
item?.wageInfo?.provinceKillRequestsTotalWage
)?.toLocaleString(),
Math.ceil(
item?.wageInfo?.freeBarsOutProvinceCarcasesTotalWeight
)?.toLocaleString(),
Math.ceil(
item?.wageInfo?.freeBarsOutProvinceCarcasesTotalWage
)?.toLocaleString(),
Math.ceil(
item?.wageInfo?.freeBarsCarcasesTotalWeight
)?.toLocaleString(),
Math.ceil(
item?.wageInfo?.freeBarsCarcasesTotalWage
)?.toLocaleString(),
Math.ceil(
item?.wageInfo?.freeBarsLiveTotalWeight
)?.toLocaleString(),
Math.ceil(item?.wageInfo?.freeBarsLiveTotalWage)?.toLocaleString(),
getKillHouseShares(item?.wageInfo?.shares, item?.name),
];
} else {
return [
item?.name,
Math.ceil(item?.wageInfo?.totalWage)?.toLocaleString(),
Math.ceil(item?.wageInfo?.totalPaidWage)?.toLocaleString(),
Math.ceil(item?.wageInfo?.off)?.toLocaleString(),
Math.ceil(item?.wageInfo?.totalUnpaidWage)?.toLocaleString(),
Math.ceil(
item?.wageInfo?.totalProvinceLiveWeight
)?.toLocaleString(),
Math.ceil(
item?.wageInfo?.totalProvinceCarcassesWeight
)?.toLocaleString(),
Math.ceil(
item?.wageInfo?.provinceKillRequestsTotalWeight
)?.toLocaleString(),
Math.ceil(
item?.wageInfo?.provinceKillRequestsTotalWage
)?.toLocaleString(),
Math.ceil(
item?.wageInfo?.freeBarsOutProvinceCarcasesTotalWeight
)?.toLocaleString(),
Math.ceil(
item?.wageInfo?.freeBarsOutProvinceCarcasesTotalWage
)?.toLocaleString(),
Math.ceil(
item?.wageInfo?.freeBarsCarcasesTotalWeight
)?.toLocaleString(),
Math.ceil(
item?.wageInfo?.freeBarsCarcasesTotalWage
)?.toLocaleString(),
Math.ceil(
item?.wageInfo?.freeBarsLiveTotalWeight
)?.toLocaleString(),
Math.ceil(item?.wageInfo?.freeBarsLiveTotalWage)?.toLocaleString(),
getKillHouseShares(item?.wageInfo?.shares, item?.name),
];
}
});
setTableData(d);
}
}, [provincePaymentKillersOfKillhouses, provincePaymentByWeightOverview]);
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<BackButton />
<Grid container xs={12} justifyContent="center">
<Grid container justifyContent="center" xs={12} mt={1}>
<ResponsiveTable
paginated
columns={
provincePaymentByWeightOverview?.wageInfo
?.wageCountingType === "live"
? [
"نام کشتارکن",
"کل تعرفه (ریال)",
"کل تعرفه پرداخت شده (ریال)",
"تخفیف (ریال)",
"کل تعرفه پرداخت نشده (ریال)",
"کل وزن زنده کشتار داخل استان (کیلوگرم)",
"تعرفه کشتار داخل استان (ریال)",
"وزن توزیع لاشه به خارج استان (کیلوگرم)",
"تعرفه توزیع لاشه خارج استان (ریال)",
"وزن لاشه ورودی به استان (کیلوگرم)",
"تعرفه لاشه ورودی به استان (ریال)",
"وزن مرغ زنده ورودی به استان (کیلوگرم)",
"تعرفه مرغ زنده ورودی به استان (ریال)",
"سهم بندی",
]
: [
"نام کشتارکن",
"کل تعرفه (ریال)",
"کل تعرفه پرداخت شده (ریال)",
"تخفیف (ریال)",
"کل تعرفه پرداخت نشده (ریال)",
"کل وزن زنده کشتار داخل استان (کیلوگرم)",
"وزن لاشه کشتار داخل استان (کیلوگرم)",
"وزن توزیع لاشه داخل استان (کیلوگرم)",
"تعرفه توزیع لاشه داخل استان (ریال)",
"وزن توزیع لاشه به خارج استان (کیلوگرم)",
"تعرفه توزیع لاشه خارج استان (ریال)",
"وزن لاشه ورودی به استان (کیلوگرم)",
"تعرفه لاشه ورودی به استان (ریال)",
"وزن مرغ زنده ورودی به استان (کیلوگرم)",
"تعرفه مرغ زنده ورودی به استان (ریال)",
"سهم بندی",
]
}
data={tableData}
/>
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default ProvinceKillersWages;

View File

@@ -0,0 +1,41 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
// import { ProvincePricingOperations } from "../features/province/components/province-pricing-operations/ProvincePricingOperations";
import { ProvincePricing } from "../features/province/components/province-pricing/ProvincePricing";
const ProvinceManagePricing = () => {
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
{/* <Grid justifyContent="center" my={SPACING.MEDIUM}>
<Card>
<ProvincePricingOperations />
</Card>
</Grid> */}
<Grid
container
justifyContent="space-between"
gap={SPACING.SMALL}
mt={SPACING.SMALL}
>
<Grid width="100%">
<ProvincePricing />
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default ProvinceManagePricing;

View File

@@ -0,0 +1,92 @@
import { SPACING } from "../data/spacing";
import { NavLink } from "../components/nav-link/NavLink";
import { useLocation } from "react-router-dom";
import LinkItem from "../components/link-item/LinkItem";
import { MdCorporateFare } from "react-icons/md";
import { BackButton } from "../components/back-button/BackButton";
import { Grid } from "../components/grid/Grid";
import {
ROUTE_ADMINX_ROUTE_MANAGE_STEWARDS,
ROUTE_PROVINCE_SUPERVISOR_ROUTE_MANAGE_STEWARDS,
ROUTE_SUPER_ADMIN_ROUTE_MANAGE_STEWARDS,
} from "../routes/routes";
const ProvinceManageStewards = () => {
const { pathname } = useLocation();
return (
<>
{["reza"].includes(pathname) && <BackButton />}
<Grid
container
gap={SPACING.SMALL}
p={SPACING.SMALL}
direction={"row"}
justifyContent="center"
xs={12}
>
{(ROUTE_ADMINX_ROUTE_MANAGE_STEWARDS === pathname ||
ROUTE_SUPER_ADMIN_ROUTE_MANAGE_STEWARDS === pathname ||
ROUTE_PROVINCE_SUPERVISOR_ROUTE_MANAGE_STEWARDS === pathname) && (
<>
<NavLink to={"reza"}>
<LinkItem
icon={<MdCorporateFare size={30} color="#244CCC" />}
title="مباشرین داخل استان"
/>
</NavLink>
<NavLink to={"reza"}>
<LinkItem
icon={<MdCorporateFare size={30} color="#244CCC" />}
title="مباشرین خارج استان"
/>
</NavLink>
</>
)}
{["reza"].includes(pathname) && (
<>
<NavLink to={"reza"}>
<LinkItem
icon={<MdCorporateFare size={30} color="#244CCC" />}
title="درخواست های ثبت صنف"
/>
</NavLink>
<NavLink to={"reza"}>
<LinkItem
icon={<MdCorporateFare size={30} color="#244CCC" />}
title="اصناف حقیقی"
/>
</NavLink>
<NavLink to={"reza"}>
<LinkItem
icon={<MdCorporateFare size={30} color="#244CCC" />}
title="اصناف حقوقی"
/>
</NavLink>
</>
)}
{["reza"].includes(pathname) && (
<>
<NavLink to={"reza"}>
<LinkItem
icon={<MdCorporateFare size={30} color="#244CCC" />}
title="اصناف حقیقی"
/>
</NavLink>
<NavLink to={"reza"}>
<LinkItem
icon={<MdCorporateFare size={30} color="#244CCC" />}
title="اصناف حقوقی"
/>
</NavLink>
</>
)}
</Grid>
</>
);
};
export default ProvinceManageStewards;

View File

@@ -0,0 +1,199 @@
import { Box, Button, Switch, Typography } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { useContext, useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { provinceGetProducts } from "../features/province/services/province-get-producrs";
import { SimpleTable } from "../components/simple-table/SimpleTable";
import { OPEN_MODAL } from "../lib/redux/slices/appSlice";
import { ProvinceSubmitProductPrice } from "../features/province/components/province-submit-product-price/ProvinceSubmitProductPrice";
import { provinceSubmitProductPrice } from "../features/province/services/province-submit-product-price";
import { AppContext } from "../contexts/AppContext";
const ProvinceProducts = () => {
const [openNotif] = useContext(AppContext);
const dispatch = useDispatch();
useEffect(() => {
dispatch(provinceGetProducts());
}, []);
const handleRespose = (r) => {
if (r.error) {
openNotif({
vertical: "top",
horizontal: "center",
msg: "مشکلی پیش آمده است!",
severity: "error",
});
} else {
openNotif({
vertical: "top",
horizontal: "center",
msg: "عملیات با موفقیت انجام شد.",
severity: "success",
});
dispatch(provinceGetProducts());
}
};
const { provinceProductList } = useSelector((item) => item.provinceSlice);
const [tableData, setTableData] = useState([]);
useEffect(() => {
const d = provinceProductList?.map((item, i) => [
i + 1,
item?.name,
<Switch
key={i}
checked={item?.sellingApprovedPrice}
onClick={() => {
dispatch(
provinceSubmitProductPrice({
product_key: item?.key,
selling_free_price: item?.sellingFreePrice,
selling_approved_price:
item?.sellingApprovedPrice === true ? false : true,
selling_more_than_inventory: item?.sellingMoreThanInventory,
selling_other_products: item?.sellingOtherProducts,
price: item?.price,
})
).then((r) => {
handleRespose(r);
});
}}
/>,
<Switch
key={i}
checked={item?.sellingFreePrice}
onClick={() => {
dispatch(
provinceSubmitProductPrice({
product_key: item?.key,
selling_free_price:
item?.sellingFreePrice === true ? false : true,
selling_approved_price: item?.sellingApprovedPrice,
selling_more_than_inventory: item?.sellingMoreThanInventory,
selling_other_products: item?.sellingOtherProducts,
price: item?.price,
})
).then((r) => {
handleRespose(r);
});
}}
/>,
<Switch
key={i}
checked={item?.sellingMoreThanInventory}
onClick={() => {
dispatch(
provinceSubmitProductPrice({
product_key: item?.key,
selling_free_price: item?.sellingFreePrice,
selling_approved_price: item?.sellingApprovedPrice,
selling_more_than_inventory:
item?.sellingMoreThanInventory === true ? false : true,
selling_other_products: item?.sellingOtherProducts,
price: item?.price,
})
).then((r) => {
handleRespose(r);
});
}}
/>,
<Switch
key={i}
checked={item?.sellingOtherProducts}
onClick={() => {
dispatch(
provinceSubmitProductPrice({
product_key: item?.key,
selling_free_price: item?.sellingFreePrice,
selling_approved_price: item?.sellingApprovedPrice,
selling_more_than_inventory: item?.sellingMoreThanInventory,
selling_other_products:
item?.sellingOtherProducts === true ? false : true,
price: item?.price,
})
).then((r) => {
handleRespose(r);
});
}}
/>,
<a href={item?.image} alt="دانلود تصویر محصول" key="productPicture">
<img
src={item?.image}
width="50"
height="50"
alt="بدون بار"
className="images-file"
/>
</a>,
<Grid key={i} container justifyContent="center">
<Typography mr={2}>{item?.price}</Typography>
<Button
disabled={!item?.sellingApprovedPrice}
size="small"
variant="contained"
onClick={() => {
dispatch(
OPEN_MODAL({
title: "ثبت قیمت",
content: <ProvinceSubmitProductPrice item={item} />,
})
);
}}
>
ثبت
</Button>
</Grid>,
]);
setTableData(d);
}, [provinceProductList]);
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid
container
justifyContent="space-between"
gap={SPACING.SMALL}
mt={SPACING.SMALL}
>
<Grid width="100%">
<Grid mt={SPACING.SMALL} mb={SPACING.SMALL}>
<Typography variant="body1">محصولات</Typography>
</Grid>
<SimpleTable
data={tableData}
columns={[
"ردیف",
"نام محصول",
"قیمت به قیمت دولتی",
"فروش به قیمت آزاد",
"فروش بیشتر از انبار",
"فروش سایر محصولات",
"تصویر",
"قیمت",
]}
/>
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default ProvinceProducts;

View File

@@ -0,0 +1,354 @@
import { Box, TextField, Typography } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { BackButton } from "../components/back-button/BackButton";
import { useContext, useState } from "react";
import { AppContext } from "../contexts/AppContext";
import { DatePicker } from "@mui/x-date-pickers";
import moment from "moment";
import axios from "axios";
import { getRoleFromUrl } from "../utils/getRoleFromUrl";
import { useSelector } from "react-redux";
import { RiFileExcel2Fill, RiTicket2Line } from "react-icons/ri";
import { ImFilePdf } from "react-icons/im";
import { motion } from "framer-motion";
const ProvinceRequests = () => {
const [, , selectedDate1, setSelectedDate1, selectedDate2, setSelectedDate2] =
useContext(AppContext);
useContext(AppContext);
const [openNotif] = useContext(AppContext);
const authToken = useSelector((state) => state.userSlice.authToken);
const userInfo = useSelector((state) => state.userSlice);
const [textValue, setTextValue] = useState("");
const handleDownload = (link, isTicket = false) => {
if (!isTicket) {
openNotif({
vertical: "top",
horizontal: "center",
msg: "فایل در حال دانلود می باشد، این عملیات ممکن است زمان بر باشد لطفا صبر کنید.",
severity: "success",
});
window.location.href = link;
}
};
const handleTicketClick = async (link) => {
try {
const response = await axios.get(link);
if (response.status === 200) {
openNotif({
vertical: "top",
horizontal: "center",
msg: "تیکت با موفقیت ارسال شد",
severity: "success",
});
}
} catch (error) {
openNotif({
vertical: "top",
horizontal: "center",
msg: "خطا در ارسال تیکت",
severity: "error",
});
}
};
const reportList = [
{
title: "گزارش تحلیلی",
description: "گزارش تحلیلی از زنجیره مرغ گوشتی در استان",
link: `${axios.defaults.baseURL}management_all_poultry_and_warehouse_pdf/?date1=${selectedDate1}&date2=${selectedDate2}`,
icon: <ImFilePdf size={24} color="red" />,
},
{
title: "تیکت وضعیت سند بار ها",
description: "تیکت وضعیت سند بار ها",
link: `${axios.defaults.baseURL}send_bar_info_from_ticket/?key=${userInfo?.userProfile?.key}&date1=${selectedDate1}&date2=${selectedDate2}`,
icon: <RiTicket2Line size={24} color="#FFFFFF" />,
isTicket: true,
},
{
title: "مغایرت قرنطینه",
description: "مغایرت قرنطینه",
link: `${axios.defaults.baseURL}send_clearance_code_to_rsi/?date1=${selectedDate1}&date2=${selectedDate2}`,
},
{
title: "گزارش جامع کشتار",
description: "اطلاعات کلی از کشتار تا صنف",
link: `${
axios.defaults.baseURL
}detail_of_killing_excel/?date1=${selectedDate1}&date2=${selectedDate2}&role=${getRoleFromUrl()}&key=${
userInfo?.userProfile?.key
}`,
},
{
title: "گزارش پایش کشتارگاه ها",
description: "پایش کلی کشتارگاه ها",
link: `${axios.defaults.baseURL}comprehensive_report_of_the_slaughterhouse_excel/?date1=${selectedDate1}&date2=${selectedDate2}`,
},
{
title: "اطلاعات بارها",
description: "جزئیات بارهای ایجاد شده",
link: `${
axios.defaults.baseURL
}bar_excel/?start=${selectedDate1}&end=${selectedDate2}&key=${
userInfo?.userProfile?.key
}&role=${getRoleFromUrl()}`,
},
{
title: "گزارش پایش تعاونی ها",
description: "جزئیات جوجه ریزی و کشتار تعاونی ها",
link: `${
axios.defaults.baseURL
}general_city_operator/?date1=${selectedDate1}&date2=${selectedDate2}&key=${
userInfo?.userProfile?.key
}&role=${getRoleFromUrl()}`,
},
{
title: "گزارش کلی خریداران",
description: "گزارش تخصیص و پخش خریداران",
link: `${axios.defaults.baseURL}kill_house_user_excel/?date1=${selectedDate1}&date2=${selectedDate2}`,
},
{
title: "درخواست مرغداران",
description: "درخواست های کتشار ثبت شده توسط مرغداران",
link: `${
axios.defaults.baseURL
}poultry_kill_request_excel/?start=${selectedDate1}&end=${selectedDate1}&role=${getRoleFromUrl()}&token=${authToken}`,
},
{
title: "اعلام نیاز خریداران",
description: "اعلام نیاز کشتار از طرف خریداران",
link: `${axios.defaults.baseURL}kill_house_excel/?start=${selectedDate1}&end=${selectedDate2}`,
},
{
title: "جوجه ریزی های فعال",
description: "اطلاعات تکمیلی جوجه ریزی",
link: `${axios.defaults.baseURL}0/hatching_excel`,
},
{
title: "جوجه ریزی های بایگانی شده",
description: "اطلاعات تکمیلی جوجه ریزی",
link: `${axios.defaults.baseURL}archive_hatching_excel/?key=${userInfo?.userProfile?.key}`,
},
{
title: "درخواست های کشتار",
description: "جزئیات درخواست مرغداران تا تحویلی کشتارگاه",
link: `${axios.defaults.baseURL}poultry_request_report_excel/?start=${selectedDate1}&end=${selectedDate2}&key=${userInfo?.userProfile?.key}`,
},
{
title: "اصناف",
description: "اطلاعات اصناف ثبت شده",
link: `${axios.defaults.baseURL}guilds_excel/?key=${userInfo?.userProfile?.key}`,
},
{
title: "کاربران",
description: "اطلاعات کاربران ثبت شده",
link: `${axios.defaults.baseURL}get_all_user_excel/`,
},
{
title: "تخصیصات",
description: "جزئیات تخصیص به خریداران",
link: `${axios.defaults.baseURL}allocated_excel/?start=${selectedDate1}&end=${selectedDate2}`,
},
{
title: "گزارش پخش روزانه",
description: "کشتارگاه به مباشر/صنف",
link: `${axios.defaults.baseURL}all_inventory_excel/?date1=${selectedDate1}&date2=${selectedDate2}`,
},
{
title: "گزارش پخش روزانه",
description: "مباشر به صنف",
link: `${axios.defaults.baseURL}steward_ware_house_total_report_daily_excel/?date1=${selectedDate1}&date2=${selectedDate2}`,
},
{
title: "آمار جوجه ریزی",
description: "جزئیات جوجه ریزی",
link: `${axios.defaults.baseURL}hatching_date_range_excel/?date1=${selectedDate1}&date2=${selectedDate2}`,
},
{
title: "بارهای تکمیل شده",
description: "جزئیات بارهای تکمیل شده",
link: `${axios.defaults.baseURL}bar-management-kill-house-excel/?key=${userInfo?.userProfile?.key}&date1=${selectedDate1}&date2=${selectedDate2}`,
},
];
return (
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
>
<Box display="flex" justifyContent="center" alignItems="center">
<Grid container direction="column" xs={12} sm={12} md={10} lg={10}>
<BackButton />
<Grid
container
alignItems="center"
gap={SPACING.SMALL}
sx={{ color: "#727272" }}
px={2}
>
<Grid
xs={12}
container
mt={1}
alignItems="center"
spacing={1}
mb={SPACING.SMALL}
>
<Grid>
<Typography sx={{ fontSize: "14px", color: "black" }}>
تاریخ گزارش:
</Typography>
</Grid>
<Grid
container
direction={"row"}
mr={1}
mt={{ xs: 2, md: 0 }}
mb={{ xs: 1, md: 0 }}
>
<DatePicker
label="از تاریخ"
renderInput={(params) => (
<TextField
{...params}
style={{ width: "160px" }}
size="small"
/>
)}
value={selectedDate1}
onChange={(newValue) => {
setSelectedDate1(moment(newValue).format("YYYY-MM-DD"));
}}
/>
<Grid mx={0.5}></Grid>
<DatePicker
label="تا تاریخ"
renderInput={(params) => (
<TextField
{...params}
style={{ width: "160px" }}
size="small"
/>
)}
value={selectedDate2}
onChange={(newValue) => {
setSelectedDate2(moment(newValue).format("YYYY-MM-DD"));
}}
/>
</Grid>
<Grid>
<TextField
sx={{ minWidth: "250px" }}
id="outlined-basic"
size="small"
label="جستجو"
variant="outlined"
value={textValue}
onChange={(e) => {
setTextValue(e.target.value);
}}
/>
</Grid>
</Grid>
</Grid>
<Grid
container
xs={12}
rowSpacing={SPACING.SMALL}
justifyContent="center"
mb={2}
px={1}
>
{reportList
?.filter((option) => option?.title.includes(textValue))
?.map((item, i) => (
<Grid item xs={6} sm={4} md={4} lg={2} key={i} px={1}>
<a
style={{ outline: "none", color: "#727272" }}
href={!item.isTicket ? item?.link : "#"}
rel="noreferrer"
onClick={(e) => {
if (item.isTicket) {
e.preventDefault();
handleTicketClick(item.link);
} else {
e.preventDefault();
handleDownload(item.link, item.isTicket);
}
}}
>
<motion.div
whileHover={{ scale: 1.05 }}
whileTap={{ scale: 0.9 }}
>
<Box
p={SPACING.MEDIUM}
border="1px solid #E6E6E6"
borderRadius={SPACING.SMALL}
bgcolor="#FCFCFC"
display="flex"
flexDirection="column"
alignItems="center"
sx={{ cursor: "pointer" }}
minHeight="11rem"
maxHeight="11rem"
>
<Box
sx={{
width: 60,
minWidth: 60,
height: 60,
minHeight: 60,
borderRadius: "50%",
backgroundColor: "#244CCC",
display: "flex",
justifyContent: "center",
alignItems: "center",
marginBottom: SPACING.SMALL,
}}
>
{item.icon || (
<RiFileExcel2Fill size={24} color="#FFFFFF" />
)}
</Box>
<Typography
variant="body1"
mt={SPACING.SMALL}
sx={{
color: "#727272",
fontWeight: { xs: 500, md: 600 },
fontSize: { xs: "12px", md: "16px" },
}}
>
{item?.title}
</Typography>
<Typography
mt={SPACING.SMALL}
sx={{ color: "#727272", fontSize: "10px" }}
>
{item?.description}
</Typography>
</Box>
</motion.div>
</a>
</Grid>
))}
</Grid>
</Grid>
</Box>
</motion.div>
);
};
export default ProvinceRequests;

View File

@@ -0,0 +1,196 @@
import { Box, Typography } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { useLocation } from "react-router-dom";
import { ProvinceRequestsOperations } from "../features/province/components/province-requests-operations/ProvinceRequestsOperations";
import { ProvinceNewRequests } from "../features/province/components/province-new-requests/ProvinceNewRequests";
import {
ROUTE_ADMINX_REQUESTS,
ROUTE_ADMINX_CITY_NEW_REQUESTS,
ROUTE_ADMINX_STATEMENTـOFـNEED_REQUESTS,
ROUTE_ADMINX_ALLOCATION_REQUESTS,
ROUTE_ADMINX_FREE_SALES_REQUESTS,
ROUTE_ADMINX_AWAITING_PAYMENT_REQUESTS,
ROUTE_ADMINX_AWAITING_INSPECTION_REQUESTS,
ROUTE_ADMINX_AUTO_ALLOCATION_REQUESTS,
ROUTE_ADMINX_CHAINS,
ROUTE_ADMINX_ALLOCATED_REQUESTS,
ROUTE_ADMINX_ISSUANCE_OF_LETTER,
ROUTE_ADMINX_EXPORT,
ROUTE_PROVINCE_ACTIVE_REQUESTS,
ROUTE_PROVINCE_ALLOCATED_REQUESTS,
ROUTE_PROVINCE_ALLOCATION_REQUESTS,
ROUTE_PROVINCE_ARCHIVED_REQUESTS,
ROUTE_PROVINCE_AUTO_ALLOCATION_REQUESTS,
ROUTE_PROVINCE_AWAITING_INSPECTION_REQUESTS,
ROUTE_PROVINCE_AWAITING_PAYMENT_REQUESTS,
ROUTE_PROVINCE_CHAINS,
ROUTE_PROVINCE_CITY_NEW_REQUESTS,
ROUTE_PROVINCE_FREE_SALES_REQUESTS,
ROUTE_PROVINCE_ISSUANCE_OF_LETTER,
ROUTE_PROVINCE_NEW_REQUESTS,
ROUTE_PROVINCE_REJECTED_REQUESTS,
ROUTE_PROVINCE_REQUESTS,
ROUTE_PROVINCE_STATEMENTـOFـNEED_REQUESTS,
ROUTE_PROVINCEـEXPORT,
ROUTE_PROVINCEـFREE_BUY,
ROUTE_SUPER_ADMIN_ACTIVE_REQUESTS,
ROUTE_SUPER_ADMIN_ALLOCATED_REQUESTS,
ROUTE_SUPER_ADMIN_ALLOCATION_REQUESTS,
ROUTE_SUPER_ADMIN_ARCHIVED_REQUESTS,
ROUTE_SUPER_ADMIN_AUTO_ALLOCATION_REQUESTS,
ROUTE_SUPER_ADMIN_AWAITING_INSPECTION_REQUESTS,
ROUTE_SUPER_ADMIN_AWAITING_PAYMENT_REQUESTS,
ROUTE_SUPER_ADMIN_CHAINS,
ROUTE_SUPER_ADMIN_CITY_NEW_REQUESTS,
ROUTE_SUPER_ADMIN_EXPORT,
ROUTE_SUPER_ADMIN_FREE_SALES_REQUESTS,
ROUTE_SUPER_ADMIN_ISSUANCE_OF_LETTER,
ROUTE_SUPER_ADMIN_REJECTED_REQUESTS,
ROUTE_SUPER_ADMIN_REQUESTS,
ROUTE_SUPER_ADMIN_STATEMENTـOFـNEED_REQUESTS,
ROUT_SUPER_ADMIN_FREE_BUY,
ROUTE_ADMINX_ARCHIVED_REQUESTS,
ROUTE_ADMINX_ACTIVE_REQUESTS,
ROUT_ADMINX_FREE_BUY,
} from "../routes/routes";
import { ProvinceRejectedRequests } from "../features/province/components/province-rejected-requests/ProvinceRejectedRequests";
import { AvicultureArchivedRequests } from "../features/aviculture/components/aviculture-archived-requests/AvicultureArchivedRequests";
import { ProvinceCityNewRequests } from "../features/province/components/province-city-new-requests/ProvinceCityNewRequests";
import { RequestsAwaitingPayment } from "../components/requests-awaiting-payment/RequestsAwaitingPayment";
import { RequestsAwaitingInspections } from "../components/requests-awaiting-inspections/RequestsAwaitingInspections";
import { BackButton } from "../components/back-button/BackButton";
import { ProvinceNeedRequests } from "../features/province/components/province-need-requests/ProvinceNeedRequests";
import { ProvinceAllocateRequests } from "../features/province/components/province-allocate-requests/ProvinceAllocateRequests";
import { ProvinceActiveRequests } from "../features/province/components/province-active-requests/ProvinceActiveRequests";
import { ProvinceFreeSales } from "../features/province/components/province-free-sales/ProvinceFreeSales";
import { ProvinceAutoAllocation } from "../features/province/components/province-auto-allocation/ProvinceAutoAllocation";
import { ProvinceAllocatedRequests } from "../features/province/components/province-allocated-requests/ProvinceAllocatedRequests";
import { SlaughterFreeBuy } from "../features/slaughter-house/components/slaughter-free-buy/SlaughterFreeBuy";
import { ProvinceSendLetter } from "../features/province/components/province-send-letter/ProvinceSendLetter";
import { getRoleFromUrl } from "../utils/getRoleFromUrl";
import { SuperAdminRequestsOperations } from "../features/super-admin/components/super-admin-requests-operations/SuperAdminRequestsOperations";
import { ProvinceChains } from "../features/province/components/chains/ProvinceChains";
import { ProvinceExport } from "../features/province/components/province-export/ProvinceExport";
const ProvinceRequests = () => {
const { pathname } = useLocation();
return (
<Box display={"flex"} justifyContent="center">
<Grid container xs={12} lg={10}>
{pathname === ROUTE_PROVINCE_REQUESTS ||
pathname === ROUTE_SUPER_ADMIN_REQUESTS ||
pathname === ROUTE_ADMINX_REQUESTS ? (
<Grid justifyContent="start" alignItems="start" my={SPACING.MEDIUM}>
{getRoleFromUrl() === "SuperAdmin" ||
getRoleFromUrl() === "AdminX" ? (
<>
<Grid>
{getRoleFromUrl() === "SuperAdmin" ? (
<Typography textAlign={"center"} variant="h6">
داشبورد ادمین کل
</Typography>
) : (
<Typography textAlign={"center"} variant="h6">
داشبورد ادمین ایکس
</Typography>
)}
</Grid>
<SuperAdminRequestsOperations />
</>
) : (
<>
<Grid>
<Typography textAlign={"center"} variant="h6">
داشبورد تخصیص استان
</Typography>
</Grid>
<ProvinceRequestsOperations />
</>
)}
</Grid>
) : (
<BackButton />
)}
<Grid xs={12} container>
{(pathname === ROUTE_PROVINCE_CITY_NEW_REQUESTS ||
pathname === ROUTE_SUPER_ADMIN_CITY_NEW_REQUESTS ||
pathname === ROUTE_ADMINX_CITY_NEW_REQUESTS) && (
<ProvinceCityNewRequests />
)}
{(pathname === ROUTE_PROVINCE_STATEMENTـOFـNEED_REQUESTS ||
pathname === ROUTE_SUPER_ADMIN_STATEMENTـOFـNEED_REQUESTS ||
pathname === ROUTE_ADMINX_STATEMENTـOFـNEED_REQUESTS) && (
<ProvinceNeedRequests />
)}
{pathname === ROUTE_PROVINCE_NEW_REQUESTS && <ProvinceNewRequests />}
{(pathname === ROUTE_PROVINCE_ALLOCATION_REQUESTS ||
pathname === ROUTE_SUPER_ADMIN_ALLOCATION_REQUESTS ||
pathname === ROUTE_ADMINX_ALLOCATION_REQUESTS) && (
<ProvinceAllocateRequests />
)}
{(pathname === ROUTE_PROVINCE_ACTIVE_REQUESTS ||
pathname === ROUTE_SUPER_ADMIN_ACTIVE_REQUESTS ||
pathname === ROUTE_ADMINX_ACTIVE_REQUESTS) && (
<ProvinceActiveRequests />
)}
{(pathname === ROUTE_PROVINCE_FREE_SALES_REQUESTS ||
pathname === ROUTE_SUPER_ADMIN_FREE_SALES_REQUESTS ||
pathname === ROUTE_ADMINX_FREE_SALES_REQUESTS) && (
<ProvinceFreeSales />
)}
{(pathname === ROUTE_PROVINCE_REJECTED_REQUESTS ||
pathname === ROUTE_SUPER_ADMIN_REJECTED_REQUESTS ||
pathname === ROUTE_PROVINCE_REJECTED_REQUESTS) && (
<ProvinceRejectedRequests />
)}
{(pathname === ROUTE_PROVINCE_ARCHIVED_REQUESTS ||
pathname === ROUTE_SUPER_ADMIN_ARCHIVED_REQUESTS ||
pathname === ROUTE_ADMINX_ARCHIVED_REQUESTS) && (
<AvicultureArchivedRequests />
)}
{(pathname === ROUTE_PROVINCE_AWAITING_PAYMENT_REQUESTS ||
pathname === ROUTE_SUPER_ADMIN_AWAITING_PAYMENT_REQUESTS ||
pathname === ROUTE_ADMINX_AWAITING_PAYMENT_REQUESTS) && (
<RequestsAwaitingPayment />
)}
{(pathname === ROUTE_PROVINCE_AWAITING_INSPECTION_REQUESTS ||
pathname === ROUTE_SUPER_ADMIN_AWAITING_INSPECTION_REQUESTS ||
pathname === ROUTE_ADMINX_AWAITING_INSPECTION_REQUESTS) && (
<RequestsAwaitingInspections />
)}
{(pathname === ROUTE_PROVINCE_AUTO_ALLOCATION_REQUESTS ||
pathname === ROUTE_SUPER_ADMIN_AUTO_ALLOCATION_REQUESTS ||
pathname === ROUTE_ADMINX_AUTO_ALLOCATION_REQUESTS) && (
<ProvinceAutoAllocation />
)}
{(pathname === ROUTE_PROVINCE_CHAINS ||
pathname === ROUTE_SUPER_ADMIN_CHAINS ||
pathname === ROUTE_ADMINX_CHAINS) && <ProvinceChains />}
{(pathname === ROUTE_PROVINCE_ALLOCATED_REQUESTS ||
pathname === ROUTE_SUPER_ADMIN_ALLOCATED_REQUESTS ||
pathname === ROUTE_ADMINX_ALLOCATED_REQUESTS) && (
<ProvinceAllocatedRequests />
)}
{(pathname === ROUTE_PROVINCEـFREE_BUY ||
pathname === ROUT_SUPER_ADMIN_FREE_BUY ||
pathname === ROUT_ADMINX_FREE_BUY) && <SlaughterFreeBuy />}
{(pathname === ROUTE_PROVINCE_ISSUANCE_OF_LETTER ||
pathname === ROUTE_SUPER_ADMIN_ISSUANCE_OF_LETTER ||
pathname === ROUTE_ADMINX_ISSUANCE_OF_LETTER) && (
<ProvinceSendLetter />
)}
{(pathname === ROUTE_SUPER_ADMIN_EXPORT ||
pathname === ROUTE_PROVINCEـEXPORT ||
pathname === ROUTE_ADMINX_EXPORT) && <ProvinceExport />}
</Grid>
</Grid>
</Box>
);
};
export default ProvinceRequests;

View File

@@ -0,0 +1,93 @@
import { Box, Button, Chip, Divider, Typography } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import * as React from "react";
import { DRAWER } from "../lib/redux/slices/appSlice";
import ProvinceSubmitMessage from "../features/province/components/province-submit-message/ProvinceSubmitMessage";
import { useDispatch, useSelector } from "react-redux";
import { messagesGetSenderMessages } from "../features/messages/services/messages-get-sender-messages";
import { useEffect } from "react";
import MessagesSenders from "../features/messages/components/messages-senders/MessagesSenders";
import { provinceGetUserProfiles } from "../features/province/services/province-get-user-profiles";
// import { useState } from "react";
const ProvinceSendMessage = () => {
const dispatch = useDispatch();
const { senderMessages } = useSelector((state) => state.messageSlice);
useEffect(() => {
dispatch(messagesGetSenderMessages());
dispatch(provinceGetUserProfiles());
}, []);
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
my={SPACING.MEDIUM}
>
<Grid container mt={SPACING.MEDIUM}>
<Button
className="first-step"
variant={"contained"}
onClick={() => {
dispatch(
DRAWER({
title: "ارسال پیام جدید",
right: !(window.innerWidth <= 600),
bottom: window.innerWidth <= 600,
content: <ProvinceSubmitMessage />,
})
);
}}
>
ثبت پیام جدید
</Button>
</Grid>
<Divider>
<Chip size="small" label="پیام های استان" />
</Divider>
{!senderMessages?.length && (
<Grid mt={SPACING.SMALL}>
<Typography variant="body1" color="primary">
در حال حاضر پیامی جهت نمایش وجود ندارد!
</Typography>
</Grid>
)}
<Grid p={SPACING.SMALL}>
{senderMessages?.map((item, i) => {
return [
<MessagesSenders
key={i}
number={i}
heading={item.heading}
message={item.message}
link={item.link}
linkText={item.linkText}
image={item.image}
time={item.time}
/>,
];
})}
</Grid>
</Grid>
</Box>
</>
);
};
export default ProvinceSendMessage;

View File

@@ -0,0 +1,33 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { ProvinceFinancialSettlementSlaughter } from "../features/province-finacial/components/province-financial-settlement-slaughter/ProvinceFinancialSettlementSlaughter";
import { ROUTE_PROVINCE_FINANCIAL_SETTLEMENT } from "../routes/routes";
const ProvinceSettlementPage = () => {
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
{ROUTE_PROVINCE_FINANCIAL_SETTLEMENT && (
<ProvinceFinancialSettlementSlaughter />
)}
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default ProvinceSettlementPage;

View File

@@ -0,0 +1,29 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { ProvinceUserFileInfo } from "../features/inspector/components/province-user-file-info/ProvinceUserFileInfo";
const ProvinceUserFile = () => {
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
<ProvinceUserFileInfo />
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default ProvinceUserFile;

View File

@@ -0,0 +1,30 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { ProvinceUsers } from "../features/inspector/components/province-users/ProvinceUsers";
const ProvinceUserManagement = () => {
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
<ProvinceUsers />
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default ProvinceUserManagement;

76
src/pages/PspCompany.js Normal file
View File

@@ -0,0 +1,76 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { useLocation } from "react-router-dom";
import {
ROUTE_PSP_COMPANY_ROUTE_ACTIVE_SESSION,
ROUTE_PSP_COMPANY_ROUTE_GUILDS,
ROUTE_PSP_COMPANY_ROUTE_DEVICES,
ROUTE_SUPER_ADMIN_COMPANY_ROUTE_GUILDS,
ROUTE_ADMINX_COMPANY_ROUTE_GUILDS,
ROUTE_SUPER_ADMIN_COMPANY_ROUTE_ACTIVE_SESSION,
ROUTE_ADMINX_COMPANY_ROUTE_ACTIVE_SESSION,
ROUTE_SUPER_ADMIN_COMPANY_ROUTE_DEVICES,
ROUTE_ADMINX_COMPANY_ROUTE_DEVICES,
ROUTE_ADMINX_ROUTE_PSP_COMPANIES,
ROUTE_SUPER_ADMIN_ROUTE_PSP_COMPANIES,
ROUTE_PSP_ROUTE_COMPANY_PSP_COMPANIES,
} from "../routes/routes";
import { BackButton } from "../components/back-button/BackButton";
import { PspOperations } from "../features/psp-company/components/psp-operations/PspOperations";
import { PspManageGuilds } from "../features/psp-company/components/psp-manage-guilds/PspManageGuilds";
import { PspActiveSession } from "../features/psp-company/components/psp-active-session/PspActiveSession";
import { PspDevices } from "../features/psp-company/components/psp-devices/PspDevices";
const PspCompanyManagement = () => {
const { pathname } = useLocation();
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
{[
ROUTE_PSP_ROUTE_COMPANY_PSP_COMPANIES,
ROUTE_SUPER_ADMIN_ROUTE_PSP_COMPANIES,
ROUTE_ADMINX_ROUTE_PSP_COMPANIES,
].includes(pathname) ? (
<Grid justifyContent="center" my={SPACING.MEDIUM}>
<PspOperations />
</Grid>
) : (
<BackButton />
)}
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
{[
ROUTE_PSP_COMPANY_ROUTE_GUILDS,
ROUTE_SUPER_ADMIN_COMPANY_ROUTE_GUILDS,
ROUTE_ADMINX_COMPANY_ROUTE_GUILDS,
].includes(pathname) && <PspManageGuilds />}
{[
ROUTE_PSP_COMPANY_ROUTE_ACTIVE_SESSION,
ROUTE_SUPER_ADMIN_COMPANY_ROUTE_ACTIVE_SESSION,
ROUTE_ADMINX_COMPANY_ROUTE_ACTIVE_SESSION,
].includes(pathname) && <PspActiveSession />}
{[
ROUTE_PSP_COMPANY_ROUTE_DEVICES,
ROUTE_SUPER_ADMIN_COMPANY_ROUTE_DEVICES,
ROUTE_ADMINX_COMPANY_ROUTE_DEVICES,
].includes(pathname) && <PspDevices />}
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default PspCompanyManagement;

View File

@@ -0,0 +1,33 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { BackButton } from "../components/back-button/BackButton";
import { ProvinceReturnPurchases } from "../features/province/components/province-return-purchases/ProvinceReturnPurchases";
const ProvinceRequests = () => {
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<BackButton />
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
<ProvinceReturnPurchases />
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default ProvinceRequests;

284
src/pages/SendMassage.js Normal file
View File

@@ -0,0 +1,284 @@
import { Box, Typography } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import LinkItem from "../components/link-item/LinkItem";
import { SPACING } from "../data/spacing";
import { ProvinceSmsComponent } from "../features/province/components/province-sms/province-sms-component";
import { FaComments, FaEnvelope, FaNewspaper, FaSms } from "react-icons/fa";
import { NavLink, useLocation } from "react-router-dom";
import {
ROUTE_ADMINX_DASHBOARD_NEWS,
ROUTE_ADMINX_ROUTE_AGE_MESSAGE,
ROUTE_ADMINX_ROUTE_MANAGE_PROCESS_MOBILE_MESSAGE,
ROUTE_ADMINX_ROUTE_SMS,
ROUTE_ADMINX_ROUTE_SMS_MANAGE,
ROUTE_ADMINX_ROUTE_SMS_SEND,
ROUTE_ADMINX_SEND_ANNOUNCEMENT,
ROUTE_ADMINX_SEND_MESSAGE,
ROUTE_ADMINX_SEND_REPORT,
ROUTE_PROVINCE_DASHBOARD_NEWS,
ROUTE_PROVINCE_ROUTE_SMS,
ROUTE_PROVINCE_ROUTE_SMS_MANAGE,
ROUTE_PROVINCE_ROUTE_SMS_SEND,
ROUTE_PROVINCE_SEND_ANNOUNCEMENT,
ROUTE_PROVINCE_SEND_MESSAGE,
ROUTE_PROVINCE_SEND_REPORT,
ROUTE_SUPER_ADMIN_DASHBOARD_NEWS,
ROUTE_SUPER_ADMIN_ROUTE_AGE_MESSAGE,
ROUTE_SUPER_ADMIN_ROUTE_MANAGE_PROCESS_MOBILE_MESSAGE,
ROUTE_SUPER_ADMIN_ROUTE_SMS,
ROUTE_SUPER_ADMIN_ROUTE_SMS_MANAGE,
ROUTE_SUPER_ADMIN_ROUTE_SMS_SEND,
ROUTE_SUPER_ADMIN_SEND_ANNOUNCEMENT,
ROUTE_SUPER_ADMIN_SEND_MESSAGE,
ROUTE_SUPER_ADMIN_SEND_REPORT,
} from "../routes/routes";
import { BackButton } from "../components/back-button/BackButton";
import { ProvinceSmsManageComponent } from "../features/province/components/province-sms-manage/ProvinceSmsManage";
import { ProvinceSmsAnnouncement } from "../features/province/components/province-sms-announcement/ProvinceSmsAnnouncement";
import { getRoleFromUrl } from "../utils/getRoleFromUrl";
import { ProvinceSendReport } from "../features/province/components/province-send-report/ProvinceSendReport";
import { ProvincePolicyMobileMessage } from "../features/province/components/province-policy-mobile-message/ProvincePolicyMobileMessage";
import { ProvinceAgeMessage } from "../features/province/components/province-age-message/ProvinceAgeMessage";
import { ProvinceDashboardNews } from "../features/province/components/province-dashboard-news/ProvinceDashboardNews";
const SendMassage = () => {
const { pathname } = useLocation();
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
{pathname === ROUTE_PROVINCE_ROUTE_SMS ||
pathname === ROUTE_SUPER_ADMIN_ROUTE_SMS ||
pathname === ROUTE_ADMINX_ROUTE_SMS ? (
<Grid
container
direction="column"
justifyContent="center"
alignItems="center"
my={SPACING.MEDIUM}
>
<Grid mb={SPACING.SMALL}>
<Typography variant="h5" color="textSecondary">
پیامک ها
</Typography>
</Grid>
<Grid
container
gap={SPACING.SMALL}
xs={12}
justifyContent="center"
>
<NavLink
to={
getRoleFromUrl() === "SuperAdmin"
? ROUTE_SUPER_ADMIN_ROUTE_SMS_SEND
: getRoleFromUrl() === "AdminX"
? ROUTE_ADMINX_ROUTE_SMS_SEND
: ROUTE_PROVINCE_ROUTE_SMS_SEND
}
active={
pathname === ROUTE_PROVINCE_ROUTE_SMS_SEND ? "true" : null
}
>
<LinkItem
icon={<FaSms size={30} color="#244CCC" />}
title="ارسال پیامک"
description="ارسال پیامک برای نقش ها و کاربران مختلف"
/>
</NavLink>
<NavLink
to={
getRoleFromUrl() === "SuperAdmin"
? ROUTE_SUPER_ADMIN_ROUTE_SMS_MANAGE
: getRoleFromUrl() === "AdminX"
? ROUTE_ADMINX_ROUTE_SMS_MANAGE
: ROUTE_PROVINCE_ROUTE_SMS_MANAGE
}
active={
pathname === ROUTE_PROVINCE_ROUTE_SMS_MANAGE ? "true" : null
}
>
<LinkItem
icon={<FaComments size={30} color="#244CCC" />}
title="مدیریت پیامک اطلاع رسانی"
description="تعیین گزینه های اطلاع رسانی برای نقش ها و مراحل مختلف"
/>
</NavLink>
<NavLink
to={
getRoleFromUrl() === "SuperAdmin"
? ROUTE_SUPER_ADMIN_SEND_MESSAGE
: getRoleFromUrl() === "AdminX"
? ROUTE_ADMINX_SEND_MESSAGE
: ROUTE_PROVINCE_SEND_MESSAGE
}
active={
pathname === ROUTE_PROVINCE_SEND_MESSAGE ? "true" : null
}
>
<LinkItem
icon={<FaComments size={30} color="#244CCC" />}
title="مدیریت پیام های سیستمی"
description="تعیین گزینه های اطلاع رسانی برای نقش ها و مراحل مختلف"
/>
</NavLink>
<NavLink
to={
getRoleFromUrl() === "SuperAdmin"
? ROUTE_SUPER_ADMIN_SEND_ANNOUNCEMENT
: getRoleFromUrl() === "AdminX"
? ROUTE_ADMINX_SEND_ANNOUNCEMENT
: ROUTE_PROVINCE_SEND_ANNOUNCEMENT
}
active={
pathname === ROUTE_PROVINCE_SEND_ANNOUNCEMENT
? "true"
: null
}
>
<LinkItem
icon={<FaComments size={30} color="#244CCC" />}
title="اعلانات"
description="تعیین گزینه های اطلاع رسانی برای نقش ها و مراحل مختلف"
/>
</NavLink>
{getRoleFromUrl() === "SuperAdmin" && (
<NavLink
to={
getRoleFromUrl() === "SuperAdmin"
? ROUTE_SUPER_ADMIN_SEND_REPORT
: getRoleFromUrl() === "AdminX"
? ROUTE_ADMINX_SEND_REPORT
: ROUTE_PROVINCE_SEND_REPORT
}
active={
pathname === ROUTE_PROVINCE_SEND_REPORT ? "true" : null
}
>
<LinkItem
icon={<FaComments size={30} color="#244CCC" />}
title="گزارش دهی"
description="تعیین گزینه های اطلاع رسانی برای نقش ها و مراحل مختلف"
/>
</NavLink>
)}
{(getRoleFromUrl() === "SuperAdmin" ||
getRoleFromUrl() === "AdminX") && (
<NavLink
to={
getRoleFromUrl() === "SuperAdmin"
? ROUTE_SUPER_ADMIN_ROUTE_MANAGE_PROCESS_MOBILE_MESSAGE
: ROUTE_ADMINX_ROUTE_MANAGE_PROCESS_MOBILE_MESSAGE
}
active={
pathname ===
ROUTE_SUPER_ADMIN_ROUTE_MANAGE_PROCESS_MOBILE_MESSAGE
? "true"
: null
}
>
<LinkItem
icon={<FaEnvelope size={30} color="#244CCC" />}
title="پیغام متحرک"
/>
</NavLink>
)}
{(getRoleFromUrl() === "SuperAdmin" ||
getRoleFromUrl() === "AdminX") && (
<NavLink
to={
getRoleFromUrl() === "SuperAdmin"
? ROUTE_SUPER_ADMIN_ROUTE_AGE_MESSAGE
: ROUTE_ADMINX_ROUTE_AGE_MESSAGE
}
active={
pathname === ROUTE_SUPER_ADMIN_ROUTE_AGE_MESSAGE
? "true"
: null
}
>
<LinkItem
icon={<FaSms size={30} color="#244CCC" />}
title="پیغام بازه سنی"
/>
</NavLink>
)}
{(getRoleFromUrl() === "SuperAdmin" ||
getRoleFromUrl() === "AdminX") && (
<NavLink
to={
getRoleFromUrl() === "SuperAdmin"
? ROUTE_SUPER_ADMIN_DASHBOARD_NEWS
: getRoleFromUrl() === "AdminX"
? ROUTE_ADMINX_DASHBOARD_NEWS
: ROUTE_PROVINCE_DASHBOARD_NEWS
}
active={
pathname === ROUTE_SUPER_ADMIN_DASHBOARD_NEWS
? "true"
: null
}
>
<LinkItem
icon={<FaNewspaper size={30} color="#244CCC" />}
title="اطلاعیه داشبورد"
/>
</NavLink>
)}
</Grid>
</Grid>
) : (
<BackButton />
)}
{(pathname === ROUTE_PROVINCE_ROUTE_SMS_SEND ||
pathname === ROUTE_SUPER_ADMIN_ROUTE_SMS_SEND ||
pathname === ROUTE_ADMINX_ROUTE_SMS_SEND) && (
<ProvinceSmsComponent />
)}
{(pathname === ROUTE_PROVINCE_ROUTE_SMS_MANAGE ||
pathname === ROUTE_SUPER_ADMIN_ROUTE_SMS_MANAGE ||
pathname === ROUTE_ADMINX_ROUTE_SMS_MANAGE) && (
<ProvinceSmsManageComponent />
)}
{(pathname === ROUTE_PROVINCE_SEND_ANNOUNCEMENT ||
pathname === ROUTE_SUPER_ADMIN_SEND_ANNOUNCEMENT ||
pathname === ROUTE_ADMINX_SEND_ANNOUNCEMENT) && (
<ProvinceSmsAnnouncement />
)}
{(pathname === ROUTE_PROVINCE_SEND_REPORT ||
pathname === ROUTE_SUPER_ADMIN_SEND_REPORT ||
pathname === ROUTE_ADMINX_SEND_REPORT) && <ProvinceSendReport />}
{(pathname ===
ROUTE_SUPER_ADMIN_ROUTE_MANAGE_PROCESS_MOBILE_MESSAGE ||
pathname === ROUTE_ADMINX_ROUTE_MANAGE_PROCESS_MOBILE_MESSAGE) && (
<ProvincePolicyMobileMessage />
)}
{(pathname === ROUTE_SUPER_ADMIN_ROUTE_AGE_MESSAGE ||
pathname === ROUTE_ADMINX_ROUTE_AGE_MESSAGE) && (
<ProvinceAgeMessage />
)}
{(pathname === ROUTE_SUPER_ADMIN_DASHBOARD_NEWS ||
pathname === ROUTE_ADMINX_DASHBOARD_NEWS ||
pathname === ROUTE_PROVINCE_DASHBOARD_NEWS) && (
<ProvinceDashboardNews />
)}
</Grid>
</Box>
</>
);
};
export default SendMassage;

View File

@@ -0,0 +1,55 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { useLocation } from "react-router-dom";
import { BackButton } from "../components/back-button/BackButton";
import { SenfInventoryOperation } from "../features/senf/components/SenfInventoryOperation";
import {
ROUTE_SENF_INVENTORY,
ROUTE_SENF_INVENTORY_ENTER,
ROUTE_SENF_INVENTORY_SEGMENTATION,
ROUTE_SENF_INVENTORY_STOCK,
} from "../routes/routes";
import { SenfStock } from "../features/senf/components/SenfStock";
import { SenfSegmentaion } from "../features/senf/components/SenfSegmentaion";
import { SenfEnterToWarehouse } from "../features/senf/components/SenfEnterToWarehouse";
const SenfInventoryPage = () => {
const { pathname } = useLocation();
return (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<BackButton />
{pathname === ROUTE_SENF_INVENTORY && (
<Grid
container
direction="column"
justifyContent="center"
alignItems="center"
my={SPACING.MEDIUM}
>
<SenfInventoryOperation />
</Grid>
)}
{pathname.includes(ROUTE_SENF_INVENTORY_STOCK) && <SenfStock />}
{pathname.includes(ROUTE_SENF_INVENTORY_SEGMENTATION) && (
<SenfSegmentaion />
)}
{pathname.includes(ROUTE_SENF_INVENTORY_ENTER) && (
<SenfEnterToWarehouse />
)}
</Grid>
</Box>
);
};
export default SenfInventoryPage;

View File

@@ -0,0 +1,44 @@
import { Box } from "@mui/material";
import React from "react";
import { Grid } from "../components/grid/Grid";
import { useLocation, useParams } from "react-router-dom";
import { ProvinceBuyersAllocations } from "../features/province/components/province-buyers-allocations/ProvinceBuyersAllocations";
import { ProvinceBuyerStewardAllocation } from "../features/province/components/province-buyer-steward-allocation/ProvinceBuyerStewardAllocation";
import { SPACING } from "../data/spacing";
import { BackButton } from "../components/back-button/BackButton";
import { ROUTE_PROVINCE_ROUTE_STEWARD_SHARE } from "../routes/routes";
import { ProvinceGuildAllocation } from "../features/province/components/province-guild-allocation.js/ProvinceGuildAllocation";
const SlaughterAgentShare = () => {
const params = useParams();
const buyerId = params?.id;
const { pathname } = useLocation();
return (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
mt={SPACING.SMALL}
>
<BackButton />
{pathname === ROUTE_PROVINCE_ROUTE_STEWARD_SHARE ? (
<ProvinceGuildAllocation />
) : (
<>
{!buyerId && <ProvinceBuyersAllocations />}
{buyerId && <ProvinceBuyerStewardAllocation />}
</>
)}
</Grid>
</Box>
);
};
export default SlaughterAgentShare;

View File

@@ -0,0 +1,427 @@
import {
Accordion,
AccordionDetails,
AccordionSummary,
Box,
Button,
Chip,
Divider,
Typography,
} from "@mui/material";
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
import { useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { Grid } from "../components/grid/Grid";
import { SimpleTable } from "../components/simple-table/SimpleTable";
import { Timer } from "../components/timer/Timer";
import { SPACING } from "../data/spacing";
import { SlaughterHouseNewComplaint } from "../features/slaughter-house/components/slaughter-house-new-conmplaint/SlaughterHouseNewComplaint";
import { slaughterGetComplaints } from "../features/slaughter-house/services/slaughter-get-complaints";
import { slaughterGetRegisteredComplaints } from "../features/slaughter-house/services/slaughter-get-registered-complaints";
import {
DRAWER,
LOADING_END,
LOADING_START,
} from "../lib/redux/slices/appSlice";
import { getRemainedSeconds } from "../utils/getRemainedSeconds";
import { getRoleFromUrl } from "../utils/getRoleFromUrl";
import { AdvancedTable } from "../components/advanced-table/AdvancedTable";
import { formatJustDate } from "../utils/formatTime";
const SlaughterComplaints = () => {
const [dataTable, setDataTable] = useState();
const [expanded, setExpanded] = useState(false);
const handleChange = () => {
setExpanded(!expanded);
};
const dispatch = useDispatch();
const { slaughterHouseComplaints } = useSelector(
(state) => state.slaughterSlice
);
const role = getRoleFromUrl();
const { slaughterHouseRegisteredComplaints } = useSelector(
(state) => state.slaughterSlice
);
useEffect(() => {
dispatch(LOADING_START());
dispatch(slaughterGetComplaints());
dispatch(slaughterGetRegisteredComplaints()).then((r) => {
dispatch(LOADING_END());
});
}, []);
useEffect(() => {
const d = slaughterHouseRegisteredComplaints?.map((item, i) => {
return [
item.title,
item.description ? item.description : "بدون توضیحات",
formatJustDate(item?.createDate),
item.state === "pending"
? "در حال بررسی"
: item.state === "accepted"
? "تایید شده"
: "رد شده",
item.percent,
item.image?.length
? item.image?.map((item, i) => {
return [
<Grid
display="inline-flex"
key={`SlaughterPaymentFactorImage${i}`}
>
<a href={item} alt="دانلود">
<img
src={item}
width="80"
height="80"
alt="دانلود"
style={{
marginRight: "10px",
borderRadius: "5px",
}}
/>
</a>
</Grid>,
];
})
: "بدون پیوست",
];
});
setDataTable(d);
}, [slaughterHouseRegisteredComplaints]);
const [filteredAvalableCompaints, setFilteredAvalableCompaints] = useState(
[]
);
const [filteredArchievedCompaints, setFilteredArchievedCompaints] = useState(
[]
);
useEffect(() => {
setFilteredAvalableCompaints(
slaughterHouseComplaints?.filter(
(item) => getRemainedSeconds(item.protestTime) > 0
)
);
setFilteredArchievedCompaints(
slaughterHouseComplaints?.filter(
(item) => getRemainedSeconds(item.protestTime) < 1
)
);
}, [slaughterHouseComplaints]);
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12} mt={SPACING.MEDIUM}>
<Accordion xs={12} expanded={expanded} onChange={handleChange}>
<AccordionSummary
expandIcon={<ExpandMoreIcon />}
aria-controls="panel1a-content"
id="panel1a-header"
>
<Typography>شکایات ثبت شده</Typography>
</AccordionSummary>
<AccordionDetails>
<Grid>
<AdvancedTable
columns={[
" موضوع",
" توضیحات",
" تاریخ ثبت",
" وضعیت",
"درصد تلفات",
"پیوست تصویر",
]}
data={dataTable}
/>
</Grid>
</AccordionDetails>
</Accordion>
<Grid xs={12} mt={SPACING.MEDIUM}>
{filteredAvalableCompaints?.length > 0 && (
<Divider>
<Chip label="بارهای تخصیص یافته" />
</Divider>
)}
{filteredAvalableCompaints?.map((item, i) => {
let remainedSeconds = getRemainedSeconds(item.protestTime);
const requestedSellTypeCash = item.cellType?.cash
? "نقدی"
: null;
const requestedSellTypeCredit = item?.cellType?.credit
? "زمان دار"
: null;
const requestedSellType = [
requestedSellTypeCash,
requestedSellTypeCredit,
]
.filter((item) => item)
.join(" یا ");
return (
<>
<SimpleTable
key={i}
name="کد سفارش"
columns={[
"کد سفارش",
"نام مرغدار",
"تلفن",
"تاریخ درخواست کشتار",
"استان",
"شهرستان",
"تاریخ جوجه ریزی",
"تعداد",
"جمع تلفات",
"وزن تقریبی هر مرغ",
"سن مرغ",
"نژاد",
"نحوه فروش",
]}
data={[
[
item.orderCode,
item.fullName,
item.mobile,
formatJustDate(item?.sendDate),
item.province,
item.city,
formatJustDate(item?.hatchingDate),
item.totalQuantity,
item.losses,
item.indexWeight,
item.age,
item.chickenBreed,
requestedSellType,
],
]}
/>
<SimpleTable
key={i}
name="خودروهای دارای کد بار"
columns={[
"کشتارگاه",
"نام راننده",
"ماشین",
"نوع خرید",
"سند خودرو بدون بار",
"سند خودرو با بار",
"تعداد",
"وزن بار",
"میانگین وزن",
"مهلت ثبت شکایت",
"عملیات",
]}
data={[
[
item.killHouse,
item.driverName,
item.car,
item.buyType === "cash" ? "نقد" : "نسیه",
<a
href={item.killHouseImageWithoutLoad}
alt="دانلود سند خودرو بدون بار"
key="provinceKillRequests"
>
<img
src={item.killHouseImageWithoutLoad}
width="50"
height="50"
alt="بدون بار"
className="images-file"
/>
</a>,
<a
href={item.killHouseImageWithLoad}
alt="دانلود سند خودرو بدون بار"
key="provinceKillRequests"
>
<img
src={item.killHouseImageWithLoad}
width="50"
height="50"
alt="بدون بار"
className="images-file"
/>
</a>,
item.killHouseRequestQuantity,
item.killHouseNetWeight,
Math.round(
(item.killHouseNetWeight /
item.killHouseRequestQuantity) *
100
) / 100,
<Timer key={i} seconds={remainedSeconds} />,
<Button
disabled={remainedSeconds < 1}
key="test"
className="avicultureNewRequestBtn"
variant={"contained"}
onClick={() => {
dispatch(
DRAWER({
right: !(window.innerWidth <= 600),
bottom: window.innerWidth <= 600,
title: "ثبت شکایت جدید",
content: (
<SlaughterHouseNewComplaint
barKey={item.killHouseAssignmentKey}
role={role}
/>
),
})
);
}}
>
ثبت شکایت
</Button>,
item.averageWeight,
],
]}
/>
</>
);
})}
</Grid>
</Grid>
<Grid xs={12}>
{filteredArchievedCompaints?.length > 0 && (
<Divider>
<Chip label="بارهای بایگانی شده" />
</Divider>
)}
{filteredArchievedCompaints?.map((item, i) => {
const requestedSellTypeCash = item.cellType?.cash
? "نقدی"
: null;
const requestedSellTypeCredit = item?.cellType?.credit
? "زمان دار"
: null;
const requestedSellType = [
requestedSellTypeCash,
requestedSellTypeCredit,
]
.filter((item) => item)
.join(" یا ");
return (
<>
<SimpleTable
key={i}
name="کد سفارش"
columns={[
"کد سفارش",
"نام مرغدار",
"تلفن",
"تاریخ درخواست کشتار",
"استان",
"شهرستان",
"تاریخ جوجه ریزی",
"تعداد",
"جمع تلفات",
"وزن تقریبی هر مرغ",
"سن مرغ",
"نژاد",
"نحوه فروش",
]}
data={[
[
item.orderCode,
item.fullName,
item.mobile,
formatJustDate(item?.sendDate),
item.province,
item.city,
formatJustDate(item?.hatchingDate),
item.totalQuantity,
item.losses,
item.indexWeight,
item.age,
item.chickenBreed,
requestedSellType,
],
]}
/>
<SimpleTable
key={i}
name="خودروهای دارای کد بار"
columns={[
"کشتارگاه",
"نام راننده",
"ماشین",
"نوع خرید",
"سند خودرو بدون بار",
"سند خودرو با بار",
"تعداد",
"وزن بار",
"میانگین وزن",
]}
data={[
[
item.killHouse,
item.driverName,
item.car,
item.buyType === "cash" ? "نقد" : "نسیه",
<a
href={item.killHouseImageWithoutLoad}
alt="دانلود سند خودرو بدون بار"
key="provinceKillRequests"
>
<img
src={item.killHouseImageWithoutLoad}
width="50"
height="50"
alt="بدون بار"
className="images-file"
/>
</a>,
<a
href={item.killHouseImageWithLoad}
alt="دانلود سند خودرو بدون بار"
key="provinceKillRequests"
>
<img
src={item.killHouseImageWithLoad}
width="50"
height="50"
alt="بدون بار"
className="images-file"
/>
</a>,
item.killHouseRequestQuantity,
item.killHouseNetWeight,
Math.round(
(item.killHouseNetWeight /
item.killHouseRequestQuantity) *
100
) / 100,
],
]}
/>
</>
);
})}
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default SlaughterComplaints;

View File

@@ -0,0 +1,38 @@
import { Box } from "@mui/material";
import React from "react";
import { Grid } from "../components/grid/Grid";
import { useLocation } from "react-router-dom";
import { BackButton } from "../components/back-button/BackButton";
import {
ROUTE_SLAUGHTER_HOUSE_VET_FREE_BUY_ROUTE,
ROUTE_SLAUGHTER_OUT_PROVINCE_BUY,
} from "../routes/routes";
import { SlaughterFreeBuyBars } from "../features/slaughter-house/components/slaughter-free-buy-bars/SlaughterFreeBuyBars";
const SlaughterFreeBuy = () => {
const { pathname } = useLocation();
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<BackButton />
{(pathname === ROUTE_SLAUGHTER_OUT_PROVINCE_BUY ||
pathname === ROUTE_SLAUGHTER_HOUSE_VET_FREE_BUY_ROUTE) && (
<SlaughterFreeBuyBars />
)}
</Grid>
</Box>
</>
);
};
export default SlaughterFreeBuy;

View File

@@ -0,0 +1,214 @@
import { Box, Typography } from "@mui/material";
import React from "react";
import { Grid } from "../components/grid/Grid";
import { useLocation, useParams } from "react-router-dom";
import {
ROUTE_ADMINX_DELEGATES_MANAGEMENT,
ROUTE_ADMINX_DISPENSERS,
ROUTE_ADMINX_DISPENSERS_INVENTORY,
ROUTE_ADMINX_DISPENSERS_KILLHOUSES,
ROUTE_ADMINX_DISPENSERS_MANAGEMENT,
ROUTE_ADMINX_DISPENSERS_MANAGEMENT_V2,
ROUTE_ADMINX_DISPENSERS_SELL_CARCASS,
ROUTE_ADMINX_DISPENSERS_STEWARDS,
ROUTE_ADMINX_DISPENSER_DETAILS,
ROUTE_ADMINX_SALE_DESTRIBUTION_DETAILS,
ROUTE_CITY_DISPENSERS,
ROUTE_CITY_DISPENSERS_INVENTORY,
ROUTE_CITY_JIHAD_DISPENSERS,
ROUTE_CITY_JIHAD_DISPENSERS_INVENTORY,
ROUTE_CITY_JIHAD_DISPENSERS_KILLHOUSES,
ROUTE_CITY_JIHAD_DISPENSERS_MANAGEMENT,
ROUTE_CITY_JIHAD_DISPENSERS_SELL_CARCASS,
ROUTE_CITY_JIHAD_DISPENSERS_STEWARDS,
ROUTE_CITY_JIHAD_DISPENSER_DETAILS_VIEW,
ROUTE_CITY_JIHAD_SALE_DESTRIBUTION_DETAILS,
ROUTE_CITY_REQUEST_DISTRIBUTION,
// ROUTE_ADMINX_SALE_DESTRIBUTION_DETAILS,
ROUTE_PROVINCE_DISPENSERS,
ROUTE_PROVINCE_DISPENSERS_INVENTORY,
ROUTE_PROVINCE_DISPENSERS_KILLHOUSES,
ROUTE_PROVINCE_DISPENSERS_MANAGEMENT,
ROUTE_PROVINCE_DISPENSERS_SELL_CARCASS,
ROUTE_PROVINCE_DISPENSERS_STEWARDS,
ROUTE_PROVINCE_DISPENSER_DETAILS,
ROUTE_PROVINCE_SALE_DESTRIBUTION_DETAILS,
ROUTE_PROVINCE_SUPERVISOR_DISPENSERS,
ROUTE_PROVINCE_SUPERVISOR_DISPENSERS_INVENTORY,
ROUTE_PROVINCE_SUPERVISOR_DISPENSERS_KILLHOUSES,
ROUTE_PROVINCE_SUPERVISOR_DISPENSERS_MANAGEMENT,
ROUTE_PROVINCE_SUPERVISOR_DISPENSERS_SELL_CARCASS,
ROUTE_PROVINCE_SUPERVISOR_DISPENSERS_STEWARDS,
ROUTE_PROVINCE_SUPERVISOR_DISPENSER_DETAILS_VIEW,
ROUTE_PROVINCE_SUPERVISOR_REQUEST_DISTRIBUTION,
ROUTE_PROVINCE_SUPERVISOR_SALE_DESTRIBUTION_DETAILS,
// ROUTE_PROVINCE_SALE_DESTRIBUTION_DETAILS,
ROUTE_SLAUGHTER_DISPENSERS,
ROUTE_SLAUGHTER_DISPENSERS_KILLHOUSES,
ROUTE_SLAUGHTER_DISPENSERS_MANAGEMENT,
ROUTE_SLAUGHTER_DISPENSERS_STEWARDS,
ROUTE_SLAUGHTER_DISPENSER_DETAILS,
ROUTE_SUPER_ADMIN_DESTRIBUTION_DETAILS,
// ROUTE_SUPER_ADMIN_DESTRIBUTION_DETAILS,
ROUTE_SUPER_ADMIN_DISPENSERS,
ROUTE_SUPER_ADMIN_DISPENSERS_INVENTORY,
ROUTE_SUPER_ADMIN_DISPENSERS_KILLHOUSES,
ROUTE_SUPER_ADMIN_DISPENSERS_MANAGEMENT,
ROUTE_SUPER_ADMIN_DISPENSERS_SELL_CARCASS,
ROUTE_SUPER_ADMIN_DISPENSERS_STEWARDS,
ROUTE_SUPER_ADMIN_DISPENSER_DETAILS,
} from "../routes/routes";
import { SPACING } from "../data/spacing";
import { SlaughterHouseDispensersOperations } from "../features/slaughter-house/components/slaughter-house-dispensers-operations/SlaughterHouseDispensersOperations";
import { BackButton } from "../components/back-button/BackButton";
import { SlaughterHouseDispensers } from "../features/slaughter-house/components/slaughter-house-dispensers/SlaughterHouseDispensers";
import { SlaughterHouseDispenserDetails } from "../features/slaughter-house/components/slaughter-house-dispenser-details/SlaughterHouseDispenserDetails";
import { ProvinceDispenserStewards } from "../features/province/components/province-dispenser-stewards/ProvinceDispenserStewards";
import { ProvinceDispenserKillhouses } from "../features/province/components/province-dispenser-killhouses/ProvinceDispenserKillhouses";
import { ProvinceDispensersSellCarcass } from "../features/province/components/province-dispensers-sell-carcass/ProvinceDispensersSellCarcass";
import { ProvinceDispensersKillhouses } from "../features/province/components/province-dispensers-killhouses/ProvinceDispensersKillhouses";
import { ProvinceDispensersViewKillHouse } from "../features/province/components/province-dispensers-view-killhouse/ProvinceDispensersViewKillHouse";
import { ProvinceDispencerSaleDistribution } from "../features/province/components/province-dispencer-sale-distribution/ProvinceDispencerSaleDistribution";
import { SlaughterHouseDispensersV2 } from "../features/slaughter-house/components/slaughter-house-dispensers-v2/SlaughterHouseDispensers";
import { SlaughterHouseDelegates } from "../features/slaughter-house/components/slaughter-house-delegates/SlaughterHouseDelegates";
// import { ProvinceDispencerSaleDistribution } from "../features/province/components/province-dispencer-sale-distribution/ProvinceDispencerSaleDistribution";
const DashboardTitle = () => (
<Grid justifyContent="center" my={SPACING.MEDIUM}>
<Grid>
<Typography variant="h6">داشبورد مدیریت توزیع</Typography>
</Grid>
</Grid>
);
const renderComponentBasedOnPath = (pathname) => {
const managementRoutes = [
ROUTE_SLAUGHTER_DISPENSERS_MANAGEMENT,
ROUTE_ADMINX_DISPENSERS_MANAGEMENT,
ROUTE_PROVINCE_DISPENSERS_MANAGEMENT,
ROUTE_SUPER_ADMIN_DISPENSERS_MANAGEMENT,
ROUTE_CITY_JIHAD_DISPENSERS_MANAGEMENT,
ROUTE_PROVINCE_SUPERVISOR_DISPENSERS_MANAGEMENT,
];
const detailsRoutes = [
ROUTE_ADMINX_DISPENSER_DETAILS,
ROUTE_SLAUGHTER_DISPENSER_DETAILS,
ROUTE_PROVINCE_DISPENSER_DETAILS,
ROUTE_SUPER_ADMIN_DISPENSER_DETAILS,
ROUTE_CITY_JIHAD_DISPENSER_DETAILS_VIEW,
ROUTE_PROVINCE_SUPERVISOR_DISPENSER_DETAILS_VIEW,
];
const stewardsRoutes = [
ROUTE_SLAUGHTER_DISPENSERS_STEWARDS,
ROUTE_ADMINX_DISPENSERS_STEWARDS,
ROUTE_SUPER_ADMIN_DISPENSERS_STEWARDS,
ROUTE_PROVINCE_DISPENSERS_STEWARDS,
ROUTE_CITY_JIHAD_DISPENSERS_STEWARDS,
ROUTE_PROVINCE_SUPERVISOR_DISPENSERS_STEWARDS,
];
const killhousesRoutes = [
ROUTE_SLAUGHTER_DISPENSERS_KILLHOUSES,
ROUTE_ADMINX_DISPENSERS_KILLHOUSES,
ROUTE_SUPER_ADMIN_DISPENSERS_KILLHOUSES,
ROUTE_PROVINCE_DISPENSERS_KILLHOUSES,
ROUTE_CITY_JIHAD_DISPENSERS_KILLHOUSES,
ROUTE_PROVINCE_SUPERVISOR_DISPENSERS_KILLHOUSES,
];
const sellCarcassRoutes = [
ROUTE_PROVINCE_DISPENSERS_SELL_CARCASS,
ROUTE_SUPER_ADMIN_DISPENSERS_SELL_CARCASS,
ROUTE_ADMINX_DISPENSERS_SELL_CARCASS,
ROUTE_CITY_JIHAD_DISPENSERS_SELL_CARCASS,
ROUTE_PROVINCE_SUPERVISOR_DISPENSERS_SELL_CARCASS,
];
const inventoryRoutes = [
ROUTE_ADMINX_DISPENSERS_INVENTORY,
ROUTE_SUPER_ADMIN_DISPENSERS_INVENTORY,
ROUTE_PROVINCE_DISPENSERS_INVENTORY,
ROUTE_CITY_DISPENSERS_INVENTORY,
ROUTE_CITY_JIHAD_DISPENSERS_INVENTORY,
ROUTE_PROVINCE_SUPERVISOR_DISPENSERS_INVENTORY,
];
const distribution = [
ROUTE_ADMINX_SALE_DESTRIBUTION_DETAILS,
ROUTE_SUPER_ADMIN_DESTRIBUTION_DETAILS,
ROUTE_PROVINCE_SALE_DESTRIBUTION_DETAILS,
ROUTE_CITY_REQUEST_DISTRIBUTION,
ROUTE_CITY_JIHAD_SALE_DESTRIBUTION_DETAILS,
ROUTE_PROVINCE_SUPERVISOR_SALE_DESTRIBUTION_DETAILS,
ROUTE_PROVINCE_SUPERVISOR_REQUEST_DISTRIBUTION,
];
const managementRoutesV2 = [ROUTE_ADMINX_DISPENSERS_MANAGEMENT_V2];
const managementRoutesDelegates = [ROUTE_ADMINX_DELEGATES_MANAGEMENT];
if (managementRoutes.includes(pathname)) return <SlaughterHouseDispensers />;
if (managementRoutesV2.includes(pathname))
return <SlaughterHouseDispensersV2 />;
if (managementRoutesDelegates.includes(pathname))
return <SlaughterHouseDelegates />;
if (distribution.includes(pathname))
return <ProvinceDispencerSaleDistribution />;
if (detailsRoutes.some((route) => pathname.includes(route)))
return <SlaughterHouseDispenserDetails />;
if (stewardsRoutes.some((route) => pathname.includes(route)))
return <ProvinceDispenserStewards />;
if (killhousesRoutes.some((route) => pathname.includes(route)))
return <ProvinceDispenserKillhouses />;
if (sellCarcassRoutes.some((route) => pathname.includes(route)))
return <ProvinceDispensersSellCarcass />;
if (inventoryRoutes.some((route) => pathname.includes(route)))
return <ProvinceDispensersKillhouses />;
return null;
};
const SlaughterHouseDispenserDashboard = () => {
const { pathname } = useLocation();
const { key, name } = useParams();
const isDashboardRoute = [
ROUTE_SLAUGHTER_DISPENSERS,
ROUTE_ADMINX_DISPENSERS,
ROUTE_SUPER_ADMIN_DISPENSERS,
ROUTE_PROVINCE_DISPENSERS,
ROUTE_CITY_DISPENSERS,
ROUTE_CITY_JIHAD_DISPENSERS,
ROUTE_PROVINCE_SUPERVISOR_DISPENSERS,
].includes(pathname);
return (
<Box display="flex" justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
{isDashboardRoute ? (
<>
<DashboardTitle />
<SlaughterHouseDispensersOperations />
</>
) : (
<BackButton />
)}
{!key && renderComponentBasedOnPath(pathname)}
{key && <ProvinceDispensersViewKillHouse key={key} name={name} />}
</Grid>
</Box>
);
};
export default React.memo(SlaughterHouseDispenserDashboard);

View File

@@ -0,0 +1,67 @@
import { Box, Typography } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import {
// ROUTE_SLAUGHTER_HOUSE_VET_ARCHIVED_REQUESTS,
ROUTE_SLAUGHTER_HOUSE_VET_COMPLAINTS,
ROUTE_SLAUGHTER_HOUSE_VET_ENTER_BAR_INFO,
ROUTE_SLAUGHTER_HOUSE_VET_NEW_REQUESTS,
ROUTE_SLAUGHTER_HOUSE_VET_REQUESTS,
} from "../routes/routes";
import { useLocation } from "react-router-dom";
import { SlaughterHouseVetOperations } from "../features/slaughter-house-vet/components/slaughter-house-vet-operations/SlaughterHouseVetOperations";
import { SlaughterHouseVetNewRequests } from "../features/slaughter-house-vet/components/slaughter-house-vet-new-requests/SlaughterHouseVetNewRequests";
// import { AvicultureArchivedRequests } from "../features/aviculture/components/aviculture-archived-requests/AvicultureArchivedRequests";
import { BackButton } from "../components/back-button/BackButton";
import { SlaughterHouseVetComplaints } from "../pages/SlaughterHouseVetComplaints";
import { SalughterEnterBarInfo } from "../features/slaughter-house/components/slaughter-enter-bar-info/SlaghterEnterBarInfo";
const SlaughterHouseVet = () => {
const { pathname } = useLocation();
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
{pathname === ROUTE_SLAUGHTER_HOUSE_VET_REQUESTS ? (
<Grid justifyContent="center" my={SPACING.MEDIUM}>
<Grid>
<Typography variant="h6">داشبورد (دامپزشک کشتارگاه)</Typography>
</Grid>
<SlaughterHouseVetOperations />
</Grid>
) : (
<BackButton />
)}
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
{pathname === ROUTE_SLAUGHTER_HOUSE_VET_NEW_REQUESTS && (
<SlaughterHouseVetNewRequests />
)}
{pathname === ROUTE_SLAUGHTER_HOUSE_VET_ENTER_BAR_INFO && (
<SalughterEnterBarInfo />
)}
{/* {pathname === ROUTE_SLAUGHTER_HOUSE_VET_ARCHIVED_REQUESTS && (
<AvicultureArchivedRequests />
)} */}
{pathname === ROUTE_SLAUGHTER_HOUSE_VET_COMPLAINTS && (
<SlaughterHouseVetComplaints />
)}
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default SlaughterHouseVet;

View File

@@ -0,0 +1,429 @@
import {
Accordion,
AccordionDetails,
AccordionSummary,
Box,
Button,
Chip,
Divider,
Typography,
} from "@mui/material";
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
import { useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { Grid } from "../components/grid/Grid";
import { SimpleTable } from "../components/simple-table/SimpleTable";
import { Timer } from "../components/timer/Timer";
import { SPACING } from "../data/spacing";
import { SlaughterHouseNewComplaint } from "../features/slaughter-house/components/slaughter-house-new-conmplaint/SlaughterHouseNewComplaint";
import { slaughterGetComplaints } from "../features/slaughter-house/services/slaughter-get-complaints";
import { slaughterGetRegisteredComplaints } from "../features/slaughter-house/services/slaughter-get-registered-complaints";
import {
DRAWER,
LOADING_END,
LOADING_START,
} from "../lib/redux/slices/appSlice";
import { getRemainedSeconds } from "../utils/getRemainedSeconds";
import { getRoleFromUrl } from "../utils/getRoleFromUrl";
import { AdvancedTable } from "../components/advanced-table/AdvancedTable";
import { format } from "date-fns-jalali";
import { formatJustDate } from "../utils/formatTime";
export const SlaughterHouseVetComplaints = () => {
const [dataTable, setDataTable] = useState();
const [expanded, setExpanded] = useState(false);
const handleChange = () => {
setExpanded(!expanded);
};
const dispatch = useDispatch();
const { slaughterHouseComplaints } = useSelector(
(state) => state.slaughterSlice
);
const role = getRoleFromUrl();
const { slaughterHouseRegisteredComplaints } = useSelector(
(state) => state.slaughterSlice
);
useEffect(() => {
dispatch(LOADING_START());
dispatch(slaughterGetComplaints());
dispatch(slaughterGetRegisteredComplaints()).then((r) => {
dispatch(LOADING_END());
});
}, []);
useEffect(() => {
const d = slaughterHouseRegisteredComplaints?.map((item, i) => {
return [
item.title,
item.description ? item.description : "بدون توضیحات",
formatJustDate(item?.createDate),
item.state === "pending"
? "در حال بررسی"
: item.state === "accepted"
? "تایید شده"
: "رد شده",
item.percent,
item.image?.length
? item.image?.map((item, i) => {
return [
<Grid
display="inline-flex"
key={`SlaughterPaymentFactorImage${i}`}
>
<a href={item} alt="دانلود">
<img
src={item}
width="80"
height="80"
alt="دانلود"
style={{
marginRight: "10px",
borderRadius: "5px",
}}
/>
</a>
</Grid>,
];
})
: "بدون پیوست",
];
});
setDataTable(d);
}, [slaughterHouseRegisteredComplaints]);
const [filteredAvalableCompaints, setFilteredAvalableCompaints] = useState(
[]
);
const [filteredArchievedCompaints, setFilteredArchievedCompaints] = useState(
[]
);
useEffect(() => {
setFilteredAvalableCompaints(
slaughterHouseComplaints?.filter(
(item) => getRemainedSeconds(item.protestTime) > 0
)
);
setFilteredArchievedCompaints(
slaughterHouseComplaints?.filter(
(item) => getRemainedSeconds(item.protestTime) < 1
)
);
}, [slaughterHouseComplaints]);
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12} mt={SPACING.MEDIUM}>
<Accordion xs={12} expanded={expanded} onChange={handleChange}>
<AccordionSummary
expandIcon={<ExpandMoreIcon />}
aria-controls="panel1a-content"
id="panel1a-header"
>
<Typography>شکایات ثبت شده</Typography>
</AccordionSummary>
<AccordionDetails>
<Grid>
<AdvancedTable
columns={[
" موضوع",
" توضیحات",
" تاریخ ثبت",
" وضعیت",
"درصد تلفات",
"پیوست تصویر",
]}
data={dataTable}
/>
</Grid>
</AccordionDetails>
</Accordion>
<Grid xs={12} mt={SPACING.MEDIUM}>
{filteredAvalableCompaints?.length > 0 && (
<Divider>
<Chip label="بارهای تخصیص یافته" />
</Divider>
)}
{filteredAvalableCompaints?.map((item, i) => {
let remainedSeconds = getRemainedSeconds(item.protestTime);
const requestedSellTypeCash = item.cellType?.cash
? "نقدی"
: null;
const requestedSellTypeCredit = item?.cellType?.credit
? "زمان دار"
: null;
const requestedSellType = [
requestedSellTypeCash,
requestedSellTypeCredit,
]
.filter((item) => item)
.join(" یا ");
return (
<>
<SimpleTable
key={i}
name="کد سفارش"
columns={[
"کد سفارش",
"نام مرغدار",
"تلفن",
"تاریخ درخواست کشتار",
"استان",
"شهرستان",
"تاریخ جوجه ریزی",
"تعداد",
"جمع تلفات",
"وزن تقریبی هر مرغ",
"سن مرغ",
"نژاد",
"نحوه فروش",
]}
data={[
[
item.orderCode,
item.fullName,
item.mobile,
format(new Date(item?.sendDate), "yyyy/MM/dd"),
item.province,
item.city,
format(new Date(item?.hatchingDate), "yyyy/MM/dd"),
item.totalQuantity,
item.losses,
item.indexWeight,
item.age,
item.chickenBreed,
requestedSellType,
],
]}
/>
<SimpleTable
key={i}
name="خودروهای دارای کد بار"
columns={[
"کشتارگاه",
"نام راننده",
"ماشین",
"نوع خرید",
"سند خودرو بدون بار",
"سند خودرو با بار",
"تعداد",
"وزن بار",
"میانگین وزن",
"مهلت ثبت شکایت",
"عملیات",
]}
data={[
[
item.killHouse,
item.driverName,
item.car,
item.buyType === "cash" ? "نقد" : "نسیه",
<a
href={item.killHouseImageWithoutLoad}
alt="دانلود سند خودرو بدون بار"
key="provinceKillRequests"
>
<img
src={item.killHouseImageWithoutLoad}
width="50"
height="50"
alt="بدون بار"
className="images-file"
/>
</a>,
<a
href={item.killHouseImageWithLoad}
alt="دانلود سند خودرو بدون بار"
key="provinceKillRequests"
>
<img
src={item.killHouseImageWithLoad}
width="50"
height="50"
alt="بدون بار"
className="images-file"
/>
</a>,
item.killHouseRequestQuantity,
item.killHouseNetWeight,
Math.round(
(item.killHouseNetWeight /
item.killHouseRequestQuantity) *
100
) / 100,
<Timer key={i} seconds={remainedSeconds} />,
<Button
disabled={remainedSeconds < 1}
key="test"
className="avicultureNewRequestBtn"
variant={"contained"}
onClick={() => {
dispatch(
DRAWER({
right: !(window.innerWidth <= 600),
bottom: window.innerWidth <= 600,
title: "ثبت شکایت جدید",
content: (
<SlaughterHouseNewComplaint
barKey={item.killHouseAssignmentKey}
role={role}
/>
),
})
);
}}
>
ثبت شکایت
</Button>,
item.averageWeight,
],
]}
/>
</>
);
})}
</Grid>
</Grid>
<Grid xs={12}>
{filteredArchievedCompaints?.length > 0 && (
<Divider>
<Chip label="بارهای بایگانی شده" />
</Divider>
)}
{filteredArchievedCompaints?.map((item, i) => {
// let remainedSeconds = getRemainedSeconds(item.protestTime);
const requestedSellTypeCash = item.cellType?.cash
? "نقدی"
: null;
const requestedSellTypeCredit = item?.cellType?.credit
? "زمان دار"
: null;
const requestedSellType = [
requestedSellTypeCash,
requestedSellTypeCredit,
]
.filter((item) => item)
.join(" یا ");
return (
<>
<SimpleTable
key={i}
name="کد سفارش"
columns={[
"کد سفارش",
"نام مرغدار",
"تلفن",
"تاریخ درخواست کشتار",
"استان",
"شهرستان",
"تاریخ جوجه ریزی",
"تعداد",
"جمع تلفات",
"وزن تقریبی هر مرغ",
"سن مرغ",
"نژاد",
"نحوه فروش",
]}
data={[
[
item.orderCode,
item.fullName,
item.mobile,
format(new Date(item?.sendDate), "yyyy/MM/dd"),
item.province,
item.city,
format(new Date(item?.hatchingDate), "yyyy/MM/dd"),
item.totalQuantity,
item.losses,
item.indexWeight,
item.age,
item.chickenBreed,
requestedSellType,
],
]}
/>
<SimpleTable
key={i}
name="خودروهای دارای کد بار"
columns={[
"کشتارگاه",
"نام راننده",
"ماشین",
"نوع خرید",
"سند خودرو بدون بار",
"سند خودرو با بار",
"تعداد",
"وزن بار",
"میانگین وزن",
]}
data={[
[
item.killHouse,
item.driverName,
item.car,
item.buyType === "cash" ? "نقد" : "نسیه",
<a
href={item.killHouseImageWithoutLoad}
alt="دانلود سند خودرو بدون بار"
key="provinceKillRequests"
>
<img
src={item.killHouseImageWithoutLoad}
width="50"
height="50"
alt="بدون بار"
className="images-file"
/>
</a>,
<a
href={item.killHouseImageWithLoad}
alt="دانلود سند خودرو بدون بار"
key="provinceKillRequests"
>
<img
src={item.killHouseImageWithLoad}
width="50"
height="50"
alt="بدون بار"
className="images-file"
/>
</a>,
item.killHouseRequestQuantity,
item.killHouseNetWeight,
Math.round(
(item.killHouseNetWeight /
item.killHouseRequestQuantity) *
100
) / 100,
],
]}
/>
</>
);
})}
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};

View File

@@ -0,0 +1,289 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { useLocation } from "react-router-dom";
import {
ROUTE_STEWARD_INVENTORY,
ROUTE_SLAUGHTER_INVENTORY,
ROUTE_SLAUGHTER_INVENTORY_SELL_CARCASS_IN_PROVINCE,
ROUTE_SLAUGHTER_INVENTORY_SELL_CARCASS_OUT_PROVINCE,
ROUTE_SLAUGHTER_INVENTORY_STOCK,
ROUTE_SLAUGHTER_DAILY_LIST,
ROUTE_SLAUGHTER_SEGMENTATION,
ROUTE_SLAUGHTER_ORDERS,
ROUTE_SLAUGHTER_OUT_PROVINCE_BUY,
} from "../routes/routes";
import { BackButton } from "../components/back-button/BackButton";
import { SlaughterStockWrapper } from "../features/slaughter-house/components/slaughter-stock-wrapper/SlaughterStockWrapper";
import { SlaughterSellCarcass } from "../features/slaughter-house/components/slaughter-sell-carcass/SlaughterSellCarcass";
import { SlaughterSellCarcassOutProvincePage } from "../features/slaughter-house/components/slaughter-sell-carcass-out-province/SlaughterSellCarcassOutProvince";
import { useDispatch, useSelector } from "react-redux";
import { useEffect } from "react";
import { SlaughterDailyList } from "../features/slaughter-house/components/slaughter-daily-list/SlaughterDailyList";
import { SlaughterSegmentation } from "../features/slaughter-house/components/slaughter-segmentation/SlaughterSegmentation";
import { SlaughterOrders } from "../features/slaughter-house/components/slaughter-orders/SlaughterOrders";
import { SlaughterInventorySummary } from "../features/slaughter-house/components/slaughter-inventory-summary/SlaughterInventorySummary";
import { fetchSlaughterBroadcastAndProducts } from "../features/slaughter-house/services/handle-fetch-slaughter-products";
import { getKillhouseApprovedPriceState } from "../features/province/services/get-approved-price-state";
import { SPACING } from "../data/spacing";
import { NavLink } from "../components/nav-link/NavLink";
import LinkItem from "../components/link-item/LinkItem";
import WarehouseIcon from "@mui/icons-material/Warehouse";
import StoreIcon from "@mui/icons-material/Store";
import PublicIcon from "@mui/icons-material/Public";
import ContentCutIcon from "@mui/icons-material/ContentCut";
import { SlaughterFreeBuyBars } from "../features/slaughter-house/components/slaughter-free-buy-bars/SlaughterFreeBuyBars";
import { checkPathStartsWith } from "../utils/checkPathStartsWith";
// import { Grading } from "@mui/icons-material";
const SlaughterInventoryPage = () => {
const { pathname } = useLocation();
const dispatch = useDispatch();
const { distributionInfo, priceInfo } = useSelector(
(state) => state.slaughterSlice
);
const selectedSubUser = useSelector(
(state) => state.userSlice.selectedSubUser
);
useEffect(() => {
if (
[
ROUTE_SLAUGHTER_INVENTORY,
ROUTE_SLAUGHTER_INVENTORY_SELL_CARCASS_OUT_PROVINCE,
].includes(pathname)
) {
dispatch(
fetchSlaughterBroadcastAndProducts({
role_key: checkPathStartsWith("slaughter")
? selectedSubUser?.key || ""
: "",
})
);
dispatch(
getKillhouseApprovedPriceState({
role_key: checkPathStartsWith("slaughter")
? selectedSubUser?.key || ""
: "",
})
);
}
}, [pathname, selectedSubUser?.key]);
return (
<>
<Box display={"flex"} justifyContent="center">
{pathname === ROUTE_SLAUGHTER_INVENTORY && (
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<BackButton />
<SlaughterInventorySummary priceInfo={priceInfo} />
</Grid>
)}
</Box>
{/* )} */}
{(pathname === ROUTE_SLAUGHTER_INVENTORY ||
pathname === ROUTE_STEWARD_INVENTORY) && (
<Grid
container
gap={SPACING.SMALL}
p={SPACING.SMALL}
justifyContent="center"
mt={SPACING.MEDIUM}
xs={12}
alignItems="center"
width="1040px"
mx="auto"
>
{/* <NavLink to={ROUTE_SLAUGHTER_INVENTORY_SUMMARY}>
<LinkItem
icon={<AssessmentIcon sx={{ fontSize: 30, color: "#244CCC" }} />}
title="خلاصه انبار"
/>
</NavLink> */}
<NavLink to={ROUTE_SLAUGHTER_INVENTORY_STOCK}>
<LinkItem
icon={<WarehouseIcon sx={{ fontSize: 30, color: "#244CCC" }} />}
title="ورود به انبار"
/>
</NavLink>
<NavLink to={ROUTE_SLAUGHTER_INVENTORY_SELL_CARCASS_IN_PROVINCE}>
<LinkItem
icon={<StoreIcon sx={{ fontSize: 30, color: "#244CCC" }} />}
title="فروش داخل استان"
/>
</NavLink>
<NavLink to={ROUTE_SLAUGHTER_INVENTORY_SELL_CARCASS_OUT_PROVINCE}>
<LinkItem
icon={<PublicIcon sx={{ fontSize: 30, color: "#244CCC" }} />}
title="فروش به خارج استان"
/>
</NavLink>
<NavLink to={ROUTE_SLAUGHTER_OUT_PROVINCE_BUY}>
<LinkItem
icon={<PublicIcon sx={{ fontSize: 30, color: "#244CCC" }} />}
title="خرید خارج از استان"
/>
</NavLink>
<NavLink to={ROUTE_SLAUGHTER_SEGMENTATION}>
<LinkItem
icon={<ContentCutIcon sx={{ fontSize: 30, color: "#244CCC" }} />}
title="قطعه بندی"
/>
</NavLink>
{/* <NavLink to={ROUTE_SLAUGHTER_DAILY_LIST}>
<LinkItem
icon={<ListAltIcon sx={{ fontSize: 30, color: "#244CCC" }} />}
title="لیست روزانه"
/>
</NavLink> */}
{/* <NavLink to={ROUTE_SLAUGHTER_ORDERS}>
<LinkItem
icon={<Grading sx={{ fontSize: 30, color: "#244CCC" }} />}
title="سفارشات"
/>
</NavLink> */}
</Grid>
)}
{/* {pathname.includes(ROUTE_SLAUGHTER_INVENTORY_SUMMARY) && ( */}
{pathname.includes(ROUTE_SLAUGHTER_INVENTORY_STOCK) && (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<BackButton />
<SlaughterStockWrapper />
</Grid>
</Box>
)}
{pathname.includes(
ROUTE_SLAUGHTER_INVENTORY_SELL_CARCASS_OUT_PROVINCE
) && (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<BackButton />
<SlaughterSellCarcassOutProvincePage />
</Grid>
</Box>
)}
{pathname.includes(ROUTE_SLAUGHTER_DAILY_LIST) && (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<BackButton />
<SlaughterDailyList />
</Grid>
</Box>
)}
{pathname.includes(
ROUTE_SLAUGHTER_INVENTORY_SELL_CARCASS_IN_PROVINCE
) && (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<BackButton />
<SlaughterSellCarcass distributionInfo={distributionInfo} />
</Grid>
</Box>
)}
{pathname.includes(ROUTE_SLAUGHTER_SEGMENTATION) && (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<BackButton />
<SlaughterSegmentation />
</Grid>
</Box>
)}
{pathname.includes(ROUTE_SLAUGHTER_ORDERS) && (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<BackButton />
<SlaughterOrders />
</Grid>
</Box>
)}
{pathname.includes(ROUTE_SLAUGHTER_OUT_PROVINCE_BUY) && (
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<BackButton />
<SlaughterFreeBuyBars />
</Grid>
</Box>
)}
</>
);
};
export default SlaughterInventoryPage;

View File

@@ -0,0 +1,25 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SlaughterBars } from "../features/slaughter-house/components/slaughter-bars/SlaughterBars";
const SlaughterManageBars = () => {
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<SlaughterBars />
</Grid>
</Box>
</>
);
};
export default SlaughterManageBars;

View File

@@ -0,0 +1,131 @@
import React, { useEffect, useState } from "react";
import { Grid } from "../components/grid/Grid";
import { Box, IconButton } from "@mui/material";
import ResponsiveTable from "../components/responsive-table/ResponsiveTable";
import { useDispatch, useSelector } from "react-redux";
import {
slaughterGetMorgueDashboardService,
slaughterGetMorguesService,
} from "../features/slaughter-house/services/slaughetr-morgue-services";
import { useNavigate, useParams } from "react-router-dom";
import { SlaughterMorgueView } from "../features/slaughter-house/components/slaughter-morgue-view/SlaughterMorgueView";
import { ROUTE_SLAUGHTER_MORGUE } from "../routes/routes";
import { BackButton } from "../components/back-button/BackButton";
import VisibilityIcon from "@mui/icons-material/Visibility";
import { checkPathStartsWith } from "../utils/checkPathStartsWith";
const SlaughterMorgue = () => {
const dispatch = useDispatch();
const [dashboardData, setDashboardData] = useState([]);
const [tableData, setTableData] = useState([]);
const selectedSubUser = useSelector(
(state) => state.userSlice.selectedSubUser
);
const navigate = useNavigate();
const { key } = useParams();
useEffect(() => {
if (!key) {
dispatch(
slaughterGetMorgueDashboardService({
role_key: checkPathStartsWith("slaughter")
? selectedSubUser?.key || ""
: "",
})
).then((r) => {
setDashboardData(r.payload.data);
});
dispatch(slaughterGetMorguesService()).then((r) => {
const d = r.payload.data?.coldHouses?.map((item, i) => {
return [
i + 1,
item?.name,
item?.totalInputWeight?.toLocaleString(),
item?.totalAllocatedWeight?.toLocaleString(),
item?.totalRemainWeight?.toLocaleString(),
<IconButton
key={i}
color="success"
onClick={() => {
navigate(ROUTE_SLAUGHTER_MORGUE + "/" + item?.key);
}}
>
<VisibilityIcon />
</IconButton>,
];
});
setTableData(d);
});
}
}, [dispatch, key, selectedSubUser?.key]);
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
<BackButton />
{!key ? (
<Grid container justifyContent="space-between" alignItems="center">
<Grid container mb={4} isDashboard xs={12}>
<ResponsiveTable
noPagination
isDashboard
columns={[
"تعداد سردخانه ها",
"وزن تخصیص داده شده",
"کل وزن وارد شده",
"وزن باقیمانده",
]}
data={[
[
dashboardData?.totalColdHouses?.toLocaleString(),
dashboardData?.totalAllocatedWeight?.toLocaleString(),
dashboardData?.totalInputWeight?.toLocaleString(),
dashboardData?.totalRemainWeight?.toLocaleString(),
],
]}
title={"خلاصه اطلاعات"}
/>
</Grid>
<Grid
container
xs={12}
justifyContent="center"
alignItems="cented"
>
<ResponsiveTable
title="سردخانه ها"
paginated
columns={[
"ردیف",
"نام سردخانه",
"وزن وارد شده",
"وزن خارج شده",
"وزن باقیمانده",
"نمایش",
]}
data={tableData}
/>
</Grid>
</Grid>
) : (
<Grid container justifyContent="start" alignItems="center" xs={12}>
<SlaughterMorgueView />
</Grid>
)}
</Grid>
</Box>
</>
);
};
export default SlaughterMorgue;

View File

@@ -0,0 +1,131 @@
import { Box, Typography } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { useLocation } from "react-router-dom";
import {
ROUTE_SLAUGHTER_ACTIVE_REQUESTS,
ROUTE_SLAUGHTER_ALLOCATE_CAR_REQUESTS,
ROUTE_SLAUGHTER_ALLOCATION_REQUESTS,
ROUTE_SLAUGHTER_ARCHIVED_REQUESTS,
ROUTE_SLAUGHTER_ENTER_BAR_INFO,
ROUTE_SLAUGHTER_FACTORS,
ROUTE_SLAUGHTER_FINAL_FACTORS,
ROUTE_SLAUGHTER_NEW_REQUESTS,
ROUTE_SLAUGHTER_PAY_FACTORS_REQUESTS,
ROUTE_SLAUGHTER_PENDING_REQUESTS,
ROUTE_SLAUGHTER_REJECTED_REQUESTS,
ROUTE_SLAUGHTER_REQUESTS,
ROUTE_SLAUGHTER_SELL_CARCASS,
ROUTE_SLAUGHTERـEXPORT,
ROUTE_SLAUGHTERـFREE_BUY,
} from "../routes/routes";
import { SlaughterRequests } from "../features/slaughter-house/components/slaughter-requests/SlaughterRequests";
import { SlaughterRequestsOperations } from "../features/slaughter-house/components/slaughter-requests-operations/SlaughterRequestsOperations";
import { SlaughterActiveRequests } from "../features/slaughter-house/components/slaughter-active-requests/SlaughterActiveRequests";
import { SlaughterRejectedRequests } from "../features/slaughter-house/components/slaughter-rejected-requests/SlaughterRejectedRequests";
import { SlaughterArchivedRequests } from "../features/slaughter-house/components/slaughter-archived-requests/SlaughterArchivedRequests";
import { TourProvider } from "@reactour/tour";
import { slaughterRequestsTourSteps } from "../features/slaughter-house/components/slaughter-requests/tour";
import { SlaughterAllocatedCheckRequests } from "../features/slaughter-house/components/slaughter-allocated-check-requests/SlaughterAllocatedCheckRequests";
import { SlaughterAllocateCarToRequests } from "../features/slaughter-house/components/slaughter-allocate-car-to-requests/SlaughterAllocateCarToRequests";
import { SalughterEnterBarInfo } from "../features/slaughter-house/components/slaughter-enter-bar-info/SlaghterEnterBarInfo";
import { SlaughterPayFactorRequests } from "../features/slaughter-house/components/slaughter-pay-factor-requests/SlaughterPayFactorRequests";
import { BackButton } from "../components/back-button/BackButton";
import { SlaughterFactorsComponent } from "../features/slaughter-house/components/slaughter-factors/SlaughterFactors";
import { SlaughterFinalFactorsComponent } from "../features/slaughter-house/components/slaughter-final-factors/SlaughterFinalFactors";
import { SlaughterFreeBuy } from "../features/slaughter-house/components/slaughter-free-buy/SlaughterFreeBuy";
import { useSelector } from "react-redux";
import { SlaughterExport } from "../features/slaughter-house/components/slaughter-export/SlaughterExport";
import { ProvinceAllocatedRequests } from "../features/province/components/province-allocated-requests/ProvinceAllocatedRequests";
import { SlaughterSellCarcass } from "../features/slaughter-house/components/slaughter-sell-carcass/SlaughterSellCarcass";
const SlaughterRequestsPage = () => {
const { pathname } = useLocation();
const { slaughterPermissionState } = useSelector(
(item) => item.slaughterSlice
);
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
{pathname === ROUTE_SLAUGHTER_REQUESTS ? (
<Grid justifyContent="center" my={SPACING.MEDIUM}>
<Grid>
<Typography variant="h6">
صفحه مدیریت درخواست های کشتارگاه
</Typography>
</Grid>
<SlaughterRequestsOperations
hasPermission={slaughterPermissionState}
/>
</Grid>
) : (
<BackButton />
)}
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
{pathname === ROUTE_SLAUGHTER_NEW_REQUESTS && (
<TourProvider
steps={slaughterRequestsTourSteps}
disableDotsNavigation={true}
showButtons={false}
>
<SlaughterRequests />
</TourProvider>
)}
{pathname === ROUTE_SLAUGHTER_ACTIVE_REQUESTS && (
<SlaughterActiveRequests />
)}
{pathname === ROUTE_SLAUGHTER_PENDING_REQUESTS && (
<SlaughterAllocatedCheckRequests />
)}
{pathname === ROUTE_SLAUGHTER_ALLOCATE_CAR_REQUESTS && (
<SlaughterAllocateCarToRequests />
)}
{pathname === ROUTE_SLAUGHTER_REJECTED_REQUESTS && (
<SlaughterRejectedRequests />
)}{" "}
{pathname === ROUTE_SLAUGHTER_ARCHIVED_REQUESTS && (
<SlaughterArchivedRequests />
)}
{pathname === ROUTE_SLAUGHTER_ENTER_BAR_INFO && (
<SalughterEnterBarInfo />
)}
{pathname === ROUTE_SLAUGHTER_SELL_CARCASS && (
<SlaughterSellCarcass />
)}
{pathname === ROUTE_SLAUGHTER_PAY_FACTORS_REQUESTS && (
<SlaughterPayFactorRequests />
)}
{pathname === ROUTE_SLAUGHTER_FACTORS && (
<SlaughterFactorsComponent />
)}
{pathname === ROUTE_SLAUGHTER_FINAL_FACTORS && (
<SlaughterFinalFactorsComponent />
)}
{pathname === ROUTE_SLAUGHTERـFREE_BUY && <SlaughterFreeBuy />}
{pathname === ROUTE_SLAUGHTERـEXPORT && <SlaughterExport />}
</Grid>
{pathname === ROUTE_SLAUGHTER_ALLOCATION_REQUESTS && (
<ProvinceAllocatedRequests />
)}
</Grid>
</Grid>
</Box>
</>
);
};
export default SlaughterRequestsPage;

View File

@@ -0,0 +1,66 @@
import { Box, Grid } from "@mui/material";
import { BackButton } from "../components/back-button/BackButton";
import { NavLink } from "../components/nav-link/NavLink";
import LinkItem from "../components/link-item/LinkItem";
import { SPACING } from "../data/spacing";
import {
ROUTE_SLAUGHTER_ROUTE_MANAGE_DISPENSERS,
ROUTE_SLAUGHTER_ROUTE_MANAGE_DELEGATES,
ROUTE_STEWARD_ROUTE_MANAGE_DELEGATES,
ROUTE_STEWARD_ROUTE_MANAGE_DISPENSERS,
} from "../routes/routes";
import { VscPerson } from "react-icons/vsc";
import BadgeIcon from "@mui/icons-material/Badge";
import { getRoleFromUrl } from "../utils/getRoleFromUrl";
const SlaughterSubUnits = () => {
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid container xs={12} md={10}>
<BackButton />
<Grid
container
xs={12}
gap={SPACING.SMALL}
p={SPACING.SMALL}
justifyContent="center"
>
<NavLink
to={
getRoleFromUrl() === "KillHouse"
? ROUTE_SLAUGHTER_ROUTE_MANAGE_DELEGATES
: getRoleFromUrl() === "Steward"
? ROUTE_STEWARD_ROUTE_MANAGE_DELEGATES
: null
}
>
<LinkItem
icon={<BadgeIcon fontSize="large" sx={{ color: "#244CCC" }} />}
title="نمایندگان"
description="مدیریت نمایندگان"
/>
</NavLink>
<NavLink
to={
getRoleFromUrl() === "KillHouse"
? ROUTE_SLAUGHTER_ROUTE_MANAGE_DISPENSERS
: getRoleFromUrl() === "Steward"
? ROUTE_STEWARD_ROUTE_MANAGE_DISPENSERS
: null
}
>
<LinkItem
icon={<VscPerson size={30} color="#244CCC" />}
title="توزیع کنندگان"
description="مدیریت توزیع کنندگان"
/>
</NavLink>
</Grid>
</Grid>
</Box>
</>
);
};
export default SlaughterSubUnits;

69
src/pages/Slaughters.js Normal file
View File

@@ -0,0 +1,69 @@
import { Box, Typography } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { useLocation } from "react-router-dom";
import {
ROUTE_ADMINX_SLAUGHTERS,
ROUTE_ADMINX_SLAUGHTERS_MANAGE,
ROUTE_ADMINX_SLAUGHTERS_MONITORING_BUYERS,
ROUTE_PROVINCE_SLAUGHTERS,
ROUTE_PROVINCE_SLAUGHTERS_MANAGE,
ROUTE_PROVINCE_SLAUGHTERS_MONITORING_BUYERS,
ROUTE_SUPER_ADMIN_SLAUGHTERS,
ROUTE_SUPER_ADMIN_SLAUGHTERS_MANAGE,
ROUTE_SUPER_ADMIN_SLAUGHTERS_MONITORING_BUYERS,
} from "../routes/routes";
import { SlaughterActiveRequests } from "../features/slaughter-house/components/slaughter-active-requests/SlaughterActiveRequests";
import { BackButton } from "../components/back-button/BackButton";
import { ProvinceSlaughterOperations } from "../features/province/components/province-slaughter-operations/ProvinceSlaughterOperations";
import { MonitoringBuyers } from "../features/province/components/monitoring-buyers/MonitoringBuyers";
const Slaughters = () => {
const { pathname } = useLocation();
return (
<>
<Box display={"flex"} justifyContent="center">
<Grid
container
direction="column"
justifyContent="center"
xs={12}
sm={12}
md={10}
lg={10}
>
{pathname === ROUTE_PROVINCE_SLAUGHTERS ||
pathname === ROUTE_SUPER_ADMIN_SLAUGHTERS ||
pathname === ROUTE_ADMINX_SLAUGHTERS ? (
<Grid justifyContent="center" my={SPACING.MEDIUM}>
<Grid>
<Typography variant="h6">مدیریت خریداران</Typography>
</Grid>
<ProvinceSlaughterOperations />
</Grid>
) : (
<BackButton />
)}
<Grid container justifyContent="space-between" gap={SPACING.SMALL}>
<Grid xs={12}>
{(pathname === ROUTE_PROVINCE_SLAUGHTERS_MANAGE ||
pathname === ROUTE_SUPER_ADMIN_SLAUGHTERS_MANAGE ||
pathname === ROUTE_ADMINX_SLAUGHTERS_MANAGE) && (
<SlaughterActiveRequests />
)}
{(pathname === ROUTE_PROVINCE_SLAUGHTERS_MONITORING_BUYERS ||
pathname === ROUTE_SUPER_ADMIN_SLAUGHTERS_MONITORING_BUYERS ||
pathname === ROUTE_ADMINX_SLAUGHTERS_MONITORING_BUYERS) && (
<MonitoringBuyers />
)}
</Grid>
</Grid>
</Grid>
</Box>
</>
);
};
export default Slaughters;

View File

@@ -0,0 +1,186 @@
import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { useLocation } from "react-router-dom";
import {
ROUTE_STEWARD_INVENTORY,
ROUTE_STEWARD_SALE_IN_PROVINCE,
ROUTE_STEWARD_INVENTORY_STOCK,
ROUTE_STEWARD_DAILY_LIST,
ROUTE_STEWARD_PURCHASE_OUT_PROVINCE,
ROUTE_STEWARD_SALE_OUT_PROVINCE,
ROUTE_STEWARD_SEGMENT,
} from "../routes/routes";
import { BackButton } from "../components/back-button/BackButton";
import { useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
import { GuildInventoryOperation } from "../features/guild/components/GuildInventoryOperation";
import ResponsiveTable from "../components/responsive-table/ResponsiveTable";
import { StewardDailyList } from "../features/guild/components/StewardDailyList";
import { StewardSegmant } from "../features/guild/components/StewardSegmant";
import { StewardShowProducts } from "../features/steward/components/steward-show-products/StewardShowProducts";
import { fetchStewardBroadcastAndProducts } from "../features/steward/services/handle-fetch-steward-products";
import { StewardStock } from "../features/steward/components/steward-stock/StewardStock";
import { StewardPurchaseOutProvince } from "../features/steward/components/steward-purchase-out-province/StewardPurchaseOutProvince";
import { StewardSellOutOfProvince } from "../features/steward/components/steward-sell-out-of-province/StewardSellOutOfProvince";
import { StewardSellInProvince } from "../features/steward/components/steward-sell-in-province/StewardSellInProvince";
import { checkPathStartsWith } from "../utils/checkPathStartsWith";
const StewardInventoryPage = () => {
const { pathname } = useLocation();
const dispatch = useDispatch();
const selectedSubUser = useSelector(
(state) => state.userSlice.selectedSubUser
);
const { distributionInfo } = useSelector((state) => state.stewardSlice);
useEffect(() => {
if (
[
ROUTE_STEWARD_PURCHASE_OUT_PROVINCE,
ROUTE_STEWARD_INVENTORY,
ROUTE_STEWARD_SALE_OUT_PROVINCE,
].includes(pathname)
) {
dispatch(
fetchStewardBroadcastAndProducts({
role_key: checkPathStartsWith("steward") ? selectedSubUser?.key : "",
})
);
}
}, [dispatch, pathname, selectedSubUser?.key]);
return (
<>
<Box display={"flex"} justifyContent="center" pb={12}>
<Grid container xs={12} sm={12} md={10} lg={10}>
<BackButton />
{pathname === ROUTE_STEWARD_INVENTORY ? (
<Grid
container
direction="column"
justifyContent="center"
alignItems="center"
>
<Grid
container
width="100%"
mb={2}
gap={SPACING.SMALL}
px={SPACING.SMALL}
>
<StewardShowProducts />
<ResponsiveTable
title="اطلاعات پخش"
noPagination
isDashboard
data={[
[
(
distributionInfo?.totalGovernmentalInputWeight ?? 0
).toLocaleString(),
(
distributionInfo?.totalFreeInputWeight ?? 0
).toLocaleString(),
(
distributionInfo?.totalGovernmentalOutputWeight ?? 0
).toLocaleString(),
(
distributionInfo?.totalFreeOutputWeight ?? 0
).toLocaleString(),
(
distributionInfo?.totalStewardInProvinceAllocationsWeight ??
0
).toLocaleString(),
(
distributionInfo?.totalStewardFreeSaleBarCarcassesWeight ??
0
).toLocaleString(),
(
distributionInfo?.segmentationsWeight ?? 0
).toLocaleString(),
(
distributionInfo?.totalGovernmentalRemainWeight ?? 0
).toLocaleString(),
(
distributionInfo?.totalFreeRemainWeight ?? 0
).toLocaleString(),
],
]}
columns={[
"وزن دولتی (کیلوگرم)",
"وزن آزاد (کیلوگرم)",
"فروش دولتی (کیلوگرم)",
"فروش آزاد (کیلوگرم)",
"فروش و توزیع داخل استان (کیلوگرم)",
"فروش و توزیع خارج استان (کیلوگرم)",
"وزن قطعه بندی (کیلوگرم)",
"مانده دولتی (کیلوگرم)",
"مانده آزاد (کیلوگرم)",
]}
/>
<ResponsiveTable
title="تعهدات"
noPagination
isDashboard
data={[
[
(
distributionInfo?.totalCommitmentSellingInProvinceGovernmentalWeight ??
0
).toLocaleString(),
(
distributionInfo?.totalSellingInProvinceGovernmentalWeight ??
0
).toLocaleString(),
(
distributionInfo?.totalCommitmentSellingInProvinceGovernmentalRemainWeight ??
0
).toLocaleString(),
(
distributionInfo?.totalCommitmentSellingInProvinceFreeWeight ??
0
).toLocaleString(),
(
distributionInfo?.totalSellingInProvinceFreeWeight ?? 0
).toLocaleString(),
(
distributionInfo?.totalCommitmentSellingInProvinceFreeRemainWeight ??
0
).toLocaleString(),
],
]}
columns={[
"تعهد دولتی توزیع داخل استان",
"توزیع دولتی داخل استان",
"باقیمانده تعهد دولتی توزیع داخل استان",
"تعهد آزاد توزیع داخل استان",
"توزیع آزاد داخل استان",
"باقیمانده تعهد آزاد توزیع داخل استان",
]}
allColors={{ color: "green", text: "#332a3d" }}
/>
</Grid>
<GuildInventoryOperation />
</Grid>
) : null}
{pathname.includes(ROUTE_STEWARD_INVENTORY_STOCK) && <StewardStock />}
{pathname.includes(ROUTE_STEWARD_SALE_IN_PROVINCE) && (
<StewardSellInProvince />
)}
{pathname.includes(ROUTE_STEWARD_PURCHASE_OUT_PROVINCE) && (
<StewardPurchaseOutProvince />
)}
{pathname.includes(ROUTE_STEWARD_DAILY_LIST) && <StewardDailyList />}
{pathname.includes(ROUTE_STEWARD_SALE_OUT_PROVINCE) && (
<StewardSellOutOfProvince />
)}
{pathname.includes(ROUTE_STEWARD_SEGMENT) && <StewardSegmant />}
</Grid>
</Box>
</>
);
};
export default StewardInventoryPage;

Some files were not shown because too many files have changed in this diff Show More