.
This commit is contained in:
@@ -3,12 +3,12 @@ import Detail from "./popoutcomponent/Detail";
|
||||
import ModalCom from "../Helpers/ModalCom";
|
||||
import InputCom from "../Helpers/Inputs/InputCom/index";
|
||||
import SiteService from "../../services/SiteService";
|
||||
import { Form, Formik, Field } from "formik";
|
||||
import { Form, Formik, Field, ErrorMessage } from "formik";
|
||||
import * as Yup from "yup";
|
||||
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
family: Yup.string().required("THis is required "),
|
||||
family: Yup.string().required("This is required "),
|
||||
public: Yup.string(),
|
||||
individual: Yup.string()
|
||||
.email("Invalid email format")
|
||||
@@ -68,18 +68,29 @@ function JobListPopout({ details, onClose, situation }) {
|
||||
group: "",
|
||||
};
|
||||
|
||||
let [inputs, setInputs] = useState({});
|
||||
let [textArea, setTextArea] = useState(details?.job_detail);
|
||||
const [errMsg, setErrMsg] = useState("")
|
||||
|
||||
const handleInputChange = ({ target: { name, value } }) => {
|
||||
setInputs((prev) => ({ ...prev, [name]: value }));
|
||||
const handleInputChange = ({ target: { value } }) => {
|
||||
setTextArea(value);
|
||||
};
|
||||
|
||||
const errorHandler = ({target: {name}}) => {
|
||||
|
||||
}
|
||||
|
||||
const jobFieldHandler = async (values, helpers) => {
|
||||
let { job_id, job_uid, job_detail } = details;
|
||||
let { job_id, job_uid } = details;
|
||||
|
||||
if(!textArea) {
|
||||
setErrMsg("delivery detail is required!")
|
||||
return
|
||||
}
|
||||
|
||||
let jobReq = {
|
||||
job_id,
|
||||
job_uid,
|
||||
job_description: job_detail
|
||||
job_description: textArea
|
||||
};
|
||||
let reqData;
|
||||
|
||||
@@ -119,16 +130,19 @@ function JobListPopout({ details, onClose, situation }) {
|
||||
assign_mode: 110033,
|
||||
};
|
||||
setLoader({ jobFields: { group: true } });
|
||||
} else {
|
||||
setErrMsg("err herre")
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await apiCall.assignJobTask(reqData);
|
||||
let { data } = await res;
|
||||
setLoader({ member: false, jobFields: false });
|
||||
setLoader({ jobFields: false });
|
||||
onClose();
|
||||
throw new Response(data);
|
||||
} catch (error) {
|
||||
setLoader({ member: false, jobFields: false });
|
||||
setLoader({ jobFields: false });
|
||||
throw new Error(error);
|
||||
}
|
||||
};
|
||||
@@ -200,11 +214,11 @@ function JobListPopout({ details, onClose, situation }) {
|
||||
<textarea
|
||||
className={`p-1 w-full text-sm text-slate-900 outline-none border border-slate-300 rounded-md`}
|
||||
rows="5"
|
||||
name="details"
|
||||
style={{ resize: "none" }}
|
||||
value={details.job_detail}
|
||||
value={textArea}
|
||||
onChange={handleInputChange}
|
||||
/>
|
||||
{/* <p>{errMsg}</p> */}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -226,9 +240,10 @@ function JobListPopout({ details, onClose, situation }) {
|
||||
value={props?.values.family}
|
||||
data={familyList}
|
||||
btnText="Assign to family"
|
||||
optionText="select family"
|
||||
optionText="Select Family"
|
||||
loader={loader?.jobFields.family}
|
||||
/>
|
||||
{/* <p>{errMsg}</p> */}
|
||||
</Form>
|
||||
);
|
||||
}}
|
||||
@@ -250,9 +265,10 @@ function JobListPopout({ details, onClose, situation }) {
|
||||
value={props?.values.public}
|
||||
data={publicArray}
|
||||
btnText="Show Task to Public"
|
||||
optionText="select duration"
|
||||
optionText="Select Duration"
|
||||
loader={loader?.jobFields.public}
|
||||
/>
|
||||
{/* <p>{errMsg}</p> */}
|
||||
</Form>
|
||||
);
|
||||
}}
|
||||
@@ -277,6 +293,7 @@ function JobListPopout({ details, onClose, situation }) {
|
||||
btnText="Send Offer to Individual"
|
||||
loader={loader?.jobFields.individual}
|
||||
/>
|
||||
{/* <p>{errMsg}</p> */}
|
||||
</Form>
|
||||
);
|
||||
}}
|
||||
@@ -300,10 +317,12 @@ function JobListPopout({ details, onClose, situation }) {
|
||||
optionText="Group"
|
||||
loader={loader?.jobFields.group}
|
||||
/>
|
||||
{/* <p>{errMsg}</p> */}
|
||||
</Form>
|
||||
);
|
||||
}}
|
||||
</Formik>
|
||||
|
||||
</div>
|
||||
{/* END OF ACTION SECTION */}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user