diff --git a/src/features/slaughter-house/components/slaughter-free-buy/SlaughterFreeBuy.js b/src/features/slaughter-house/components/slaughter-free-buy/SlaughterFreeBuy.js index 605f3bb..e5b9402 100644 --- a/src/features/slaughter-house/components/slaughter-free-buy/SlaughterFreeBuy.js +++ b/src/features/slaughter-house/components/slaughter-free-buy/SlaughterFreeBuy.js @@ -181,6 +181,7 @@ export const SlaughterFreeBuy = () => { item?.createDate ? formatTime(item?.createDate) : "-", item?.reciveDate ? formatJustDate(item?.reciveDate) : "-", `${item.killHouse.name} (${item.killHouse.killHouseOperator.user.mobile})`, + item?.freezing ? "انجماد" : "عادی", item?.freeDirectBuying ? "آزاد" : "دولتی", item?.slaughterHouse ? item?.slaughterHouse?.name @@ -192,7 +193,6 @@ export const SlaughterFreeBuy = () => { item.IndexWeight, (item.IndexWeight * item.killCapacity)?.toLocaleString(), item?.amount?.toLocaleString(), - {item?.directBuyingState === "pending" && item?.finalAccept === true && @@ -380,6 +380,7 @@ export const SlaughterFreeBuy = () => { "تاریخ ثبت درخواست", "تاریخ کشتار", "خریدار", + "کشتار", "نوع خرید", "محل کشتار", "مرغدار (تلفن)", diff --git a/src/features/slaughter-house/components/slaughter-inventory-free-buy-bars-alives/SlaughterInventoryFreeBuyBarsAlives.js b/src/features/slaughter-house/components/slaughter-inventory-free-buy-bars-alives/SlaughterInventoryFreeBuyBarsAlives.js index 2dd29bb..f494be6 100644 --- a/src/features/slaughter-house/components/slaughter-inventory-free-buy-bars-alives/SlaughterInventoryFreeBuyBarsAlives.js +++ b/src/features/slaughter-house/components/slaughter-inventory-free-buy-bars-alives/SlaughterInventoryFreeBuyBarsAlives.js @@ -20,6 +20,7 @@ import { CheckCleanceCode } from "../../../../components/check-clearance-code/Ch import { SlaughterFreeBarsAlivesOperations } from "../slaughter-free-bars-alives-operations/SlaughterFreeBarsAlivesOperations"; import { AppContext } from "../../../../contexts/AppContext"; import { checkPathStartsWith } from "../../../../utils/checkPathStartsWith"; +import { fetchSlaughterBroadcastAndProducts } from "../../services/handle-fetch-slaughter-products"; export const SlaughterInventoryFreeBuyBarsAlives = ({ title, @@ -87,6 +88,13 @@ export const SlaughterInventoryFreeBuyBarsAlives = ({ const updateTable = () => { fetchApiData(page !== 0 ? page : 1); fetchDashboardData(); + dispatch( + fetchSlaughterBroadcastAndProducts({ + role_key: checkPathStartsWith("slaughter") + ? selectedSubUser?.key || "" + : "", + }) + ); }; useEffect(() => { diff --git a/src/features/slaughter-house/components/slaughter-inventory-free-buy-bars/SlaughterInventoryFreeBuyBars.js b/src/features/slaughter-house/components/slaughter-inventory-free-buy-bars/SlaughterInventoryFreeBuyBars.js index 23584f4..bc9e8c9 100644 --- a/src/features/slaughter-house/components/slaughter-inventory-free-buy-bars/SlaughterInventoryFreeBuyBars.js +++ b/src/features/slaughter-house/components/slaughter-inventory-free-buy-bars/SlaughterInventoryFreeBuyBars.js @@ -27,6 +27,7 @@ import ToggleOffOutlinedIcon from "@mui/icons-material/ToggleOffOutlined"; import ToggleOnIcon from "@mui/icons-material/ToggleOn"; import { SlaughterInventoryFreeBuyBarsAlives } from "../slaughter-inventory-free-buy-bars-alives/SlaughterInventoryFreeBuyBarsAlives"; import { checkPathStartsWith } from "../../../../utils/checkPathStartsWith"; +import { fetchSlaughterBroadcastAndProducts } from "../../services/handle-fetch-slaughter-products"; export const SlaughterInventoryFreeBuyBars = () => { const dispatch = useDispatch(); @@ -102,6 +103,13 @@ export const SlaughterInventoryFreeBuyBars = () => { setPage(1); fetchApiData(1); fetchDashboardData(); + dispatch( + fetchSlaughterBroadcastAndProducts({ + role_key: checkPathStartsWith("slaughter") + ? selectedSubUser?.key || "" + : "", + }) + ); }; const fetchDashboardData = () => { diff --git a/src/features/slaughter-house/components/slaughter-submit-free-bar/SlaughterSubmitFreeBar.js b/src/features/slaughter-house/components/slaughter-submit-free-bar/SlaughterSubmitFreeBar.js index 6d087ae..0a84d47 100644 --- a/src/features/slaughter-house/components/slaughter-submit-free-bar/SlaughterSubmitFreeBar.js +++ b/src/features/slaughter-house/components/slaughter-submit-free-bar/SlaughterSubmitFreeBar.js @@ -450,6 +450,13 @@ export const SlaughterSubmitFreeBar = ({ item, updateTable }) => { } else { if (updateTable) { updateTable(); + // dispatch( + // fetchSlaughterBroadcastAndProducts({ + // role_key: checkPathStartsWith("slaughter") + // ? selectedSubUser?.key + // : "", + // }) + // ); } dispatch(DRAWER({ right: false, bottom: false, content: null })); openNotif({ diff --git a/src/features/slaughter-house/components/slaughter-submit-free-buy/SlaughterSubmitFreeBuy.js b/src/features/slaughter-house/components/slaughter-submit-free-buy/SlaughterSubmitFreeBuy.js index b221f0d..81ca62f 100644 --- a/src/features/slaughter-house/components/slaughter-submit-free-buy/SlaughterSubmitFreeBuy.js +++ b/src/features/slaughter-house/components/slaughter-submit-free-buy/SlaughterSubmitFreeBuy.js @@ -39,6 +39,7 @@ import FilterAltIcon from "@mui/icons-material/FilterAlt"; import { provincePolicyGetWeightRange } from "../../../province/services/province-policy-get-weight-range"; import { isValidIndexWeight } from "../../../../utils/isValidIndexWeight"; import { checkPathStartsWith } from "../../../../utils/checkPathStartsWith"; +import { provinceGetSellForFreezingStatus } from "../../../province/services/province-get-sell-for-freezing-status"; export const SlaughterSubmitFreeBuy = ({ edit, updateTable }) => { const dispatch = useDispatch(); @@ -48,6 +49,7 @@ export const SlaughterSubmitFreeBuy = ({ edit, updateTable }) => { const [selectedAge2, setSelectedAge2] = useState(1); const [showSearchFields, setShowSearchFields] = useState(false); const [editPoultry, setEditPoultry] = useState(false); + const [sellForFreezing, setSellForFreezing] = useState(false); const selectedSubUser = useSelector( (state) => state.userSlice.selectedSubUser ); @@ -110,6 +112,9 @@ export const SlaughterSubmitFreeBuy = ({ edit, updateTable }) => { : "", }) ); + dispatch(provinceGetSellForFreezingStatus()).then((r) => { + setSellForFreezing(r.payload.data.permission); + }); fetchData(); }, [selectedSubUser?.key]); @@ -130,6 +135,7 @@ export const SlaughterSubmitFreeBuy = ({ edit, updateTable }) => { poultryPrice: edit ? edit.amount : 0, hatching_key: edit?.poultryHatching?.key || null, paymentDeadlineDays: edit?.paymentDeadlineDays?.key, + freezing: false, }; const onSubmit = (values) => { if (!paymentDeadlineDays && values.paymentDeadlineDays === 0) { @@ -165,6 +171,7 @@ export const SlaughterSubmitFreeBuy = ({ edit, updateTable }) => { chicken_breed: selectedPolutry?.chickenBreed, cash: true, credit: false, + freezing: values.freezing, sms_payment: false, kill_house_key: values.killhouse, killer_kill_house_key: values.killerPlace ? values.killerPlace : null, @@ -1049,6 +1056,15 @@ export const SlaughterSubmitFreeBuy = ({ edit, updateTable }) => { /> )} + {sellForFreezing && ( + + + انجماد + + )} {!edit && (