debug province head expert
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {REJECT_NAVGAV_PROVINCE_MANAGER} from "@/core/data/apiRoutes";
|
||||
import {REJECT_NAVGAN_PROVINCE_MANAGER} from "@/core/data/apiRoutes";
|
||||
import {
|
||||
Button,
|
||||
Dialog,
|
||||
@@ -46,7 +46,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
formData.append("expert_description", values.description);
|
||||
if (values.reject_img != null) formData.append("attachment", values.reject_img);
|
||||
|
||||
requestServer(`${REJECT_NAVGAV_PROVINCE_MANAGER}/${rowId}`, 'post', {
|
||||
requestServer(`${REJECT_NAVGAN_PROVINCE_MANAGER}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
}).then((response) => {
|
||||
mutate(fetchUrl)
|
||||
|
||||
@@ -35,7 +35,7 @@ const Confirm = ({rowId, fetchUrl, mutate}) => {
|
||||
},
|
||||
onSubmit: (values, {setSubmitting}) => {
|
||||
const formData = new FormData();
|
||||
if (values.description != "") formData.append("expert_description", values.description);
|
||||
if (values.description != "") formData.append("description", values.description);
|
||||
if (values.confirm_img != null) formData.append("attachment", values.confirm_img);
|
||||
|
||||
requestServer(`${CONFIRM_PROVINCE_HEAD_EXPERT}/${rowId}`, 'post', {
|
||||
|
||||
@@ -43,7 +43,7 @@ const Reject = ({rowId, fetchUrl, mutate}) => {
|
||||
validationSchema,
|
||||
onSubmit: (values, {setSubmitting}) => {
|
||||
const formData = new FormData();
|
||||
formData.append("expert_description", values.description);
|
||||
formData.append("description", values.description);
|
||||
if (values.reject_img != null) formData.append("attachment", values.reject_img);
|
||||
|
||||
requestServer(`${REJECT_PROVINCE_HEAD_EXPERT}/${rowId}`, 'post', {
|
||||
|
||||
@@ -11,23 +11,29 @@ import {
|
||||
TextField,
|
||||
Tooltip,
|
||||
} from "@mui/material";
|
||||
import ThumbUpAltIcon from "@mui/icons-material/ThumbUpAlt";
|
||||
import EditIcon from '@mui/icons-material/Edit';
|
||||
import {useFormik} from "formik";
|
||||
import {REVISE_PROVINCE_HEAD_EXPERT} from "@/core/data/apiRoutes";
|
||||
import useRequest from "@/lib/app/hooks/useRequest";
|
||||
import * as Yup from "yup";
|
||||
|
||||
const Revise = ({rowId, fetchUrl, mutate}) => {
|
||||
const t = useTranslations();
|
||||
const [openConfirmDialog, setOpenConfirmDialog] = useState(false);
|
||||
const requestServer = useRequest({auth: true})
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
description: Yup.string().required(t("RejectDialog.description_error")),
|
||||
});
|
||||
|
||||
const formik = useFormik({
|
||||
initialValues: {
|
||||
description: "",
|
||||
},
|
||||
validationSchema,
|
||||
onSubmit: (values, {setSubmitting}) => {
|
||||
const formData = new FormData();
|
||||
if (values.description != "") formData.append("expert_description", values.description);
|
||||
if (values.description != "") formData.append("description", values.description);
|
||||
|
||||
requestServer(`${REVISE_PROVINCE_HEAD_EXPERT}/${rowId}`, 'post', {
|
||||
data: formData,
|
||||
@@ -46,19 +52,19 @@ const Revise = ({rowId, fetchUrl, mutate}) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Tooltip title={t("ReviseDialog.confirm")}>
|
||||
<Tooltip title={t("ReviseDialog.revise")}>
|
||||
<IconButton
|
||||
color="primary"
|
||||
onClick={() => {
|
||||
setOpenConfirmDialog(true)
|
||||
}}
|
||||
>
|
||||
<ThumbUpAltIcon/>
|
||||
<EditIcon/>
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<Dialog fullWidth open={openConfirmDialog}
|
||||
PaperProps={{sx: {boxShadow: 'rgba(60, 64, 67, 0.3) 0px 1px 16px 0px, rgba(60, 64, 67, 0.15) 0px 1px 10px 0px'}}}>
|
||||
<DialogTitle>{t("ReviseDialog.confirm")}</DialogTitle>
|
||||
<DialogTitle>{t("ReviseDialog.revise")}</DialogTitle>
|
||||
<DialogContent>
|
||||
<Stack spacing={2}>
|
||||
<Stack>
|
||||
@@ -66,10 +72,14 @@ const Revise = ({rowId, fetchUrl, mutate}) => {
|
||||
name="description"
|
||||
multiline
|
||||
rows={8}
|
||||
label={<>
|
||||
<span>{t("ReviseDialog.description")}</span><small>{t("ReviseDialog.optional")}</small></>}
|
||||
label={t("ReviseDialog.description")}
|
||||
value={formik.values.description}
|
||||
onChange={handleDescriptionChange}
|
||||
onBlur={formik.handleBlur("description")}
|
||||
error={
|
||||
formik.touched.description && Boolean(formik.errors.description)
|
||||
}
|
||||
helperText={formik.touched.description && formik.errors.description}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
sx={{mt: 1}}
|
||||
|
||||
@@ -161,37 +161,37 @@ function DashboardProvinceHeadExpertComponent() {
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.navgan_id,
|
||||
id: "navgan_id",
|
||||
header: t("ProvinceHeadExpert.navgan_id"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "numeric",
|
||||
filterFn: "equals",
|
||||
columnFilterModeOptions: [
|
||||
"equals",
|
||||
"notEquals",
|
||||
"contains",
|
||||
"lessThan",
|
||||
"greaterThan",
|
||||
"between",
|
||||
],
|
||||
Cell: ({renderedCellValue}) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.vehicle_type,
|
||||
id: "vehicle_type",
|
||||
header: t("ProvinceHeadExpert.vehicle_type"),
|
||||
enableColumnFilter: true,
|
||||
datatype: "text",
|
||||
filterFn: "contains",
|
||||
columnFilterModeOptions: ["contains", "equals", "notEquals"],
|
||||
Cell: ({renderedCellValue}) => (
|
||||
<Typography variant="body2">{renderedCellValue}</Typography>
|
||||
),
|
||||
},
|
||||
// {
|
||||
// accessorFn: (row) => row.navgan_id,
|
||||
// id: "navgan_id",
|
||||
// header: t("ProvinceHeadExpert.navgan_id"),
|
||||
// enableColumnFilter: true,
|
||||
// datatype: "numeric",
|
||||
// filterFn: "equals",
|
||||
// columnFilterModeOptions: [
|
||||
// "equals",
|
||||
// "notEquals",
|
||||
// "contains",
|
||||
// "lessThan",
|
||||
// "greaterThan",
|
||||
// "between",
|
||||
// ],
|
||||
// Cell: ({renderedCellValue}) => (
|
||||
// <Typography variant="body2">{renderedCellValue}</Typography>
|
||||
// ),
|
||||
// },
|
||||
// {
|
||||
// accessorFn: (row) => row.vehicle_type,
|
||||
// id: "vehicle_type",
|
||||
// header: t("ProvinceHeadExpert.vehicle_type"),
|
||||
// enableColumnFilter: true,
|
||||
// datatype: "text",
|
||||
// filterFn: "contains",
|
||||
// columnFilterModeOptions: ["contains", "equals", "notEquals"],
|
||||
// Cell: ({renderedCellValue}) => (
|
||||
// <Typography variant="body2">{renderedCellValue}</Typography>
|
||||
// ),
|
||||
// },
|
||||
{
|
||||
accessorFn: (row) => row.state_name,
|
||||
id: "state_id",
|
||||
|
||||
Reference in New Issue
Block a user