Fix: change services for submit and also change the table content for stewards
This commit is contained in:
@@ -120,9 +120,8 @@ export const ProvinceTrueGuildsOutProvince = ({ userType }) => {
|
|||||||
const req = entry?.requests_info ?? entry?.requestsInfo ?? {};
|
const req = entry?.requests_info ?? entry?.requestsInfo ?? {};
|
||||||
return [
|
return [
|
||||||
idx + 1,
|
idx + 1,
|
||||||
entry?.fullname ?? "-",
|
entry?.stewards?.name ?? "-",
|
||||||
entry?.mobile ?? "-",
|
entry?.mobile ?? "-",
|
||||||
entry?.unit_name ?? entry?.unitName ?? "-",
|
|
||||||
entry?.province ?? "-",
|
entry?.province ?? "-",
|
||||||
entry?.city ?? "-",
|
entry?.city ?? "-",
|
||||||
(
|
(
|
||||||
@@ -146,7 +145,6 @@ export const ProvinceTrueGuildsOutProvince = ({ userType }) => {
|
|||||||
"ردیف",
|
"ردیف",
|
||||||
"نام و نام خانوادگی",
|
"نام و نام خانوادگی",
|
||||||
"موبایل",
|
"موبایل",
|
||||||
"نام واحد",
|
|
||||||
"استان",
|
"استان",
|
||||||
"شهر",
|
"شهر",
|
||||||
"تعداد درخواست",
|
"تعداد درخواست",
|
||||||
|
|||||||
@@ -2,15 +2,9 @@ import { useState } from "react";
|
|||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
import { Grid } from "../../../../components/grid/Grid";
|
import { Grid } from "../../../../components/grid/Grid";
|
||||||
import TuneIcon from "@mui/icons-material/Tune";
|
import TuneIcon from "@mui/icons-material/Tune";
|
||||||
import { Button, IconButton, Popover, Tooltip } from "@mui/material";
|
import { IconButton, Popover, Tooltip } from "@mui/material";
|
||||||
import {
|
import { DRAWER } from "../../../../lib/redux/slices/appSlice";
|
||||||
CLOSE_MODAL,
|
|
||||||
DRAWER,
|
|
||||||
OPEN_MODAL,
|
|
||||||
} from "../../../../lib/redux/slices/appSlice";
|
|
||||||
import EditIcon from "@mui/icons-material/Edit";
|
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";
|
import { StewardAddBuyer } from "../../../steward/components/steward-add-buyer/StewardAddBuyer";
|
||||||
|
|
||||||
export const ProvinceTrueGuildsOutProvinceOperations = ({
|
export const ProvinceTrueGuildsOutProvinceOperations = ({
|
||||||
@@ -34,19 +28,19 @@ export const ProvinceTrueGuildsOutProvinceOperations = ({
|
|||||||
const open = Boolean(anchorEl);
|
const open = Boolean(anchorEl);
|
||||||
const id = open ? "popover" : undefined;
|
const id = open ? "popover" : undefined;
|
||||||
|
|
||||||
const deleteGuild = () => {
|
// const deleteGuild = () => {
|
||||||
const buyerKey = item?.key;
|
// const buyerKey = item?.key;
|
||||||
if (buyerKey)
|
// if (buyerKey)
|
||||||
dispatch(
|
// dispatch(
|
||||||
deleteOutProvinceTrueGuilds({
|
// deleteOutProvinceTrueGuilds({
|
||||||
buyer_key: buyerKey,
|
// buyer_key: buyerKey,
|
||||||
buyer_type: IS_STEWARD ? "Steward" : "Guilds",
|
// buyer_type: IS_STEWARD ? "Steward" : "Guilds",
|
||||||
})
|
// })
|
||||||
).then(() => {
|
// ).then(() => {
|
||||||
updateTable();
|
// updateTable();
|
||||||
dispatch(CLOSE_MODAL());
|
// dispatch(CLOSE_MODAL());
|
||||||
});
|
// });
|
||||||
};
|
// };
|
||||||
return (
|
return (
|
||||||
<Grid container>
|
<Grid container>
|
||||||
<IconButton
|
<IconButton
|
||||||
@@ -105,7 +99,7 @@ export const ProvinceTrueGuildsOutProvinceOperations = ({
|
|||||||
<EditIcon />
|
<EditIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip title="حذف" placement="right">
|
{/* <Tooltip title="حذف" placement="right">
|
||||||
<IconButton
|
<IconButton
|
||||||
color="error"
|
color="error"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -150,7 +144,7 @@ export const ProvinceTrueGuildsOutProvinceOperations = ({
|
|||||||
>
|
>
|
||||||
<DeleteIcon />
|
<DeleteIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip> */}
|
||||||
</Grid>
|
</Grid>
|
||||||
</div>
|
</div>
|
||||||
</Popover>
|
</Popover>
|
||||||
|
|||||||
@@ -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 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import SearchIcon from "@mui/icons-material/Search";
|
|||||||
import { extractProvinceFromAddress } from "../../../../utils/address";
|
import { extractProvinceFromAddress } from "../../../../utils/address";
|
||||||
import { getCarcassesBuyerInfoService } from "../../../steward/services/get-carcasses-buyer-info";
|
import { getCarcassesBuyerInfoService } from "../../../steward/services/get-carcasses-buyer-info";
|
||||||
import {
|
import {
|
||||||
slaughterEditBuyerDataService,
|
baseOutProvinceCarcassesEditBuyerService,
|
||||||
slaughterSubmitBuyerDataService,
|
slaughterSubmitBuyerDataService,
|
||||||
} from "../../../slaughter-house/services/slaughter-house-submit-buyer";
|
} from "../../../slaughter-house/services/slaughter-house-submit-buyer";
|
||||||
export const validationSchemaForAdminAddBuyer = (isEdit, isRealPerson) =>
|
export const validationSchemaForAdminAddBuyer = (isEdit, isRealPerson) =>
|
||||||
@@ -74,7 +74,7 @@ export const handleSubmitForAdminAddBuyer = (
|
|||||||
kill_house_keys: formik.values.kill_house_keys || [],
|
kill_house_keys: formik.values.kill_house_keys || [],
|
||||||
};
|
};
|
||||||
|
|
||||||
dispatch(slaughterEditBuyerDataService(submitData)).then((r) => {
|
dispatch(baseOutProvinceCarcassesEditBuyerService(submitData)).then((r) => {
|
||||||
updateTable();
|
updateTable();
|
||||||
if (r.payload.error) {
|
if (r.payload.error) {
|
||||||
openNotif({
|
openNotif({
|
||||||
@@ -429,7 +429,6 @@ export const AdminAddBuyerForm = ({
|
|||||||
id="nationalId"
|
id="nationalId"
|
||||||
name="nationalId"
|
name="nationalId"
|
||||||
label={!isRealPerson ? "شناسه ملی حقوقی" : "کد ملی"}
|
label={!isRealPerson ? "شناسه ملی حقوقی" : "کد ملی"}
|
||||||
disabled={true}
|
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
value={formik.values.nationalId}
|
value={formik.values.nationalId}
|
||||||
onChange={formik.handleChange}
|
onChange={formik.handleChange}
|
||||||
@@ -579,11 +578,16 @@ export const AdminAddBuyerForm = ({
|
|||||||
? cityData.map((i) => ({ id: i.name, label: i.name }))
|
? 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) => {
|
onChange={(e, value) => {
|
||||||
formik.setFieldValue("city", value ? value.id : "");
|
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) => (
|
renderInput={(params) => (
|
||||||
<TextField {...params} label="شهر را انتخاب کنید" />
|
<TextField {...params} label="شهر را انتخاب کنید" />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
ROUTE_ADMINX_ROUTE_OUT_PROVINCE_LEGAL_GUILDS,
|
ROUTE_ADMINX_ROUTE_OUT_PROVINCE_LEGAL_GUILDS,
|
||||||
ROUTE_ADMINX_ROUTE_OUT_PROVINCE_TRUE_GUILDS,
|
ROUTE_ADMINX_ROUTE_OUT_PROVINCE_TRUE_GUILDS,
|
||||||
ROUTE_SLAUGHTER_INVENTORY_SELL_CARCASS_OUT_PROVINCE,
|
ROUTE_SLAUGHTER_INVENTORY_SELL_CARCASS_OUT_PROVINCE,
|
||||||
|
ROUTE_SLAUGHTER_MANAGE_GUILDS_OUT_PROVINCE_LEGAL,
|
||||||
ROUTE_SLAUGHTER_MANAGE_GUILDS_OUT_PROVINCE_TRUE,
|
ROUTE_SLAUGHTER_MANAGE_GUILDS_OUT_PROVINCE_TRUE,
|
||||||
ROUTE_STEWARD_SALE_OUT_PROVINCE,
|
ROUTE_STEWARD_SALE_OUT_PROVINCE,
|
||||||
} from "../../../../routes/routes";
|
} from "../../../../routes/routes";
|
||||||
@@ -64,7 +65,10 @@ const getCurrentPage = (role, pathname) => {
|
|||||||
if (pathname === ROUTE_SLAUGHTER_INVENTORY_SELL_CARCASS_OUT_PROVINCE) {
|
if (pathname === ROUTE_SLAUGHTER_INVENTORY_SELL_CARCASS_OUT_PROVINCE) {
|
||||||
return PAGE_SLAUGHTER;
|
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;
|
return PAGE_SLAUGHTER_MANAGE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user