diff --git a/src/features/province/components/province-true-guilds-out-province/ProvinceTrueGuildsOutProvince.js b/src/features/province/components/province-true-guilds-out-province/ProvinceTrueGuildsOutProvince.js index 93c583e..dc6d515 100644 --- a/src/features/province/components/province-true-guilds-out-province/ProvinceTrueGuildsOutProvince.js +++ b/src/features/province/components/province-true-guilds-out-province/ProvinceTrueGuildsOutProvince.js @@ -120,9 +120,8 @@ export const ProvinceTrueGuildsOutProvince = ({ userType }) => { const req = entry?.requests_info ?? entry?.requestsInfo ?? {}; return [ idx + 1, - entry?.fullname ?? "-", + entry?.stewards?.name ?? "-", entry?.mobile ?? "-", - entry?.unit_name ?? entry?.unitName ?? "-", entry?.province ?? "-", entry?.city ?? "-", ( @@ -146,7 +145,6 @@ export const ProvinceTrueGuildsOutProvince = ({ userType }) => { "ردیف", "نام و نام خانوادگی", "موبایل", - "نام واحد", "استان", "شهر", "تعداد درخواست", diff --git a/src/features/province/components/province-true-guilds-out-province/ProvinceTrueGuildsOutProvinceOperations.js b/src/features/province/components/province-true-guilds-out-province/ProvinceTrueGuildsOutProvinceOperations.js index e8c94f7..7966758 100644 --- a/src/features/province/components/province-true-guilds-out-province/ProvinceTrueGuildsOutProvinceOperations.js +++ b/src/features/province/components/province-true-guilds-out-province/ProvinceTrueGuildsOutProvinceOperations.js @@ -2,15 +2,9 @@ import { useState } from "react"; import { useDispatch } from "react-redux"; import { Grid } from "../../../../components/grid/Grid"; import TuneIcon from "@mui/icons-material/Tune"; -import { Button, IconButton, Popover, Tooltip } from "@mui/material"; -import { - CLOSE_MODAL, - DRAWER, - OPEN_MODAL, -} from "../../../../lib/redux/slices/appSlice"; +import { IconButton, Popover, Tooltip } from "@mui/material"; +import { DRAWER } from "../../../../lib/redux/slices/appSlice"; import EditIcon from "@mui/icons-material/Edit"; -import DeleteIcon from "@mui/icons-material/Delete"; -import { deleteOutProvinceTrueGuilds } from "../../services/delete-out-province-true-guilds"; import { StewardAddBuyer } from "../../../steward/components/steward-add-buyer/StewardAddBuyer"; export const ProvinceTrueGuildsOutProvinceOperations = ({ @@ -34,19 +28,19 @@ export const ProvinceTrueGuildsOutProvinceOperations = ({ const open = Boolean(anchorEl); const id = open ? "popover" : undefined; - const deleteGuild = () => { - const buyerKey = item?.key; - if (buyerKey) - dispatch( - deleteOutProvinceTrueGuilds({ - buyer_key: buyerKey, - buyer_type: IS_STEWARD ? "Steward" : "Guilds", - }) - ).then(() => { - updateTable(); - dispatch(CLOSE_MODAL()); - }); - }; + // const deleteGuild = () => { + // const buyerKey = item?.key; + // if (buyerKey) + // dispatch( + // deleteOutProvinceTrueGuilds({ + // buyer_key: buyerKey, + // buyer_type: IS_STEWARD ? "Steward" : "Guilds", + // }) + // ).then(() => { + // updateTable(); + // dispatch(CLOSE_MODAL()); + // }); + // }; return ( - + {/* { @@ -150,7 +144,7 @@ export const ProvinceTrueGuildsOutProvinceOperations = ({ > - + */} diff --git a/src/features/slaughter-house/services/slaughter-house-submit-buyer.js b/src/features/slaughter-house/services/slaughter-house-submit-buyer.js index 51e85c9..22633f9 100644 --- a/src/features/slaughter-house/services/slaughter-house-submit-buyer.js +++ b/src/features/slaughter-house/services/slaughter-house-submit-buyer.js @@ -49,3 +49,21 @@ export const slaughterEditBuyerDataService = createAsyncThunk( } } ); + +export const baseOutProvinceCarcassesEditBuyerService = createAsyncThunk( + "BASE_OUT_PROVINCE_CARCASSES_EDIT_BUYER_SERVICE", + async (d, { dispatch }) => { + try { + dispatch(LOADING_START()); + const { data, status } = await axios.put( + "base-out-province-carcasses-buyer/0/", + d + ); + dispatch(LOADING_END()); + return { data, status }; + } catch (e) { + dispatch(LOADING_END()); + return { error: e.response?.data?.result ?? e.message }; + } + } +); diff --git a/src/features/steward/components/steward-add-buyer/InquiryForAdminAddBuyer.js b/src/features/steward/components/steward-add-buyer/InquiryForAdminAddBuyer.js index 6cb3c57..e7fe013 100644 --- a/src/features/steward/components/steward-add-buyer/InquiryForAdminAddBuyer.js +++ b/src/features/steward/components/steward-add-buyer/InquiryForAdminAddBuyer.js @@ -10,7 +10,7 @@ import SearchIcon from "@mui/icons-material/Search"; import { extractProvinceFromAddress } from "../../../../utils/address"; import { getCarcassesBuyerInfoService } from "../../../steward/services/get-carcasses-buyer-info"; import { - slaughterEditBuyerDataService, + baseOutProvinceCarcassesEditBuyerService, slaughterSubmitBuyerDataService, } from "../../../slaughter-house/services/slaughter-house-submit-buyer"; export const validationSchemaForAdminAddBuyer = (isEdit, isRealPerson) => @@ -74,7 +74,7 @@ export const handleSubmitForAdminAddBuyer = ( kill_house_keys: formik.values.kill_house_keys || [], }; - dispatch(slaughterEditBuyerDataService(submitData)).then((r) => { + dispatch(baseOutProvinceCarcassesEditBuyerService(submitData)).then((r) => { updateTable(); if (r.payload.error) { openNotif({ @@ -429,7 +429,6 @@ export const AdminAddBuyerForm = ({ id="nationalId" name="nationalId" label={!isRealPerson ? "شناسه ملی حقوقی" : "کد ملی"} - disabled={true} variant="outlined" value={formik.values.nationalId} onChange={formik.handleChange} @@ -579,11 +578,16 @@ export const AdminAddBuyerForm = ({ ? cityData.map((i) => ({ id: i.name, label: i.name })) : [] } - isOptionEqualToValue={(option, value) => option.id === value.id} + getOptionLabel={(option) => option?.label ?? ""} + isOptionEqualToValue={(option, value) => option?.id === value?.id} onChange={(e, value) => { formik.setFieldValue("city", value ? value.id : ""); }} - value={cityData.find((i) => i.name === formik.values.city)?.name} + value={ + formik.values.city + ? { id: formik.values.city, label: formik.values.city } + : null + } renderInput={(params) => ( )} diff --git a/src/features/steward/components/steward-add-buyer/StewardAddBuyer.js b/src/features/steward/components/steward-add-buyer/StewardAddBuyer.js index 07457d8..d667cfe 100644 --- a/src/features/steward/components/steward-add-buyer/StewardAddBuyer.js +++ b/src/features/steward/components/steward-add-buyer/StewardAddBuyer.js @@ -13,6 +13,7 @@ import { ROUTE_ADMINX_ROUTE_OUT_PROVINCE_LEGAL_GUILDS, ROUTE_ADMINX_ROUTE_OUT_PROVINCE_TRUE_GUILDS, ROUTE_SLAUGHTER_INVENTORY_SELL_CARCASS_OUT_PROVINCE, + ROUTE_SLAUGHTER_MANAGE_GUILDS_OUT_PROVINCE_LEGAL, ROUTE_SLAUGHTER_MANAGE_GUILDS_OUT_PROVINCE_TRUE, ROUTE_STEWARD_SALE_OUT_PROVINCE, } from "../../../../routes/routes"; @@ -64,7 +65,10 @@ const getCurrentPage = (role, pathname) => { if (pathname === ROUTE_SLAUGHTER_INVENTORY_SELL_CARCASS_OUT_PROVINCE) { return PAGE_SLAUGHTER; } - if (pathname === ROUTE_SLAUGHTER_MANAGE_GUILDS_OUT_PROVINCE_TRUE) { + if ( + pathname === ROUTE_SLAUGHTER_MANAGE_GUILDS_OUT_PROVINCE_TRUE || + pathname === ROUTE_SLAUGHTER_MANAGE_GUILDS_OUT_PROVINCE_LEGAL + ) { return PAGE_SLAUGHTER_MANAGE; } }