Compare commits

...

7 Commits

Author SHA1 Message Date
victorAnumudu 02d29023d9 made cancel btn to close the popout modal 2023-05-29 19:50:49 +01:00
ameye 6dbd080f29 Merge branch 'enable-and-active-jobs' of WrenchBoard/Users-Wrench into master 2023-05-29 18:25:27 +00:00
Ebube 97501c6f59 . 2023-05-29 19:11:10 +01:00
Ebube 4a95dec4b8 Merge branch 'master' of https://gitlab.chiefsoft.net/WrenchBoard/Users-Wrench into enable-and-active-jobs 2023-05-29 18:36:43 +01:00
Ebube fe0cd191bc . 2023-05-29 18:36:01 +01:00
ameye 708e9f601a Merge branch 'btn-center' of WrenchBoard/Users-Wrench into master 2023-05-29 17:05:01 +00:00
CHIEFSOFT\ameye 9f01a8e5e4 fix family resouce menu 2023-05-29 12:33:33 -04:00
4 changed files with 119 additions and 77 deletions
+42 -14
View File
@@ -6,7 +6,7 @@ import usersService from "../../services/UsersService";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import { Form, Formik } from "formik"; import { Field, Form, Formik } from "formik";
import * as Yup from "yup"; import * as Yup from "yup";
const validationSchema = Yup.object().shape({ const validationSchema = Yup.object().shape({
@@ -50,7 +50,7 @@ function AddJob() {
const ApiCall = new usersService(); const ApiCall = new usersService();
const navigate = useNavigate(); const navigate = useNavigate();
let {userDetails} = useSelector((state)=> state.userDetails) let { userDetails } = useSelector((state) => state.userDetails);
let [pageLoading, setPageLoading] = useState(true); // State used for knowing when the page is mounting let [pageLoading, setPageLoading] = useState(true); // State used for knowing when the page is mounting
@@ -208,7 +208,7 @@ function AddJob() {
> >
{item[1]} {item[1]}
</option> </option>
) );
} }
})} })}
</> </>
@@ -316,19 +316,34 @@ function AddJob() {
</div> </div>
<div className="field w-full mb-6"> <div className="field w-full mb-6">
<InputCom <div className={`flex items-center justify-between mb-2.5`}>
fieldClass="px-6" <label
label="Timeline" className="input-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold block"
labelClass="tracking-wide" htmlFor="timeline_days"
inputBg="bg-slate-100" >
type="text" Timeline
<span className="text-green-700 text-sm tracking-wide">
- Expected duration of this task
</span>
</label>
</div>
<Field
component="select"
name="timeline_days" name="timeline_days"
spanTag=" - Expected duration of this task" className="input-field p-2 mt-3 rounded-md placeholder:text-base text-dark-gray dark:text-white w-full h-10 bg-slate-100 dark:bg-[#11131F] focus:ring-0 focus:outline-none"
// placeholder="Please Enter Detail Description of Job"
value={props.values.timeline_days} value={props.values.timeline_days}
inputHandler={props.handleChange} >
blurHandler={props.handleBlur} <option value="">Select Duration</option>
/> {publicArray.map(({ name, duration }, idx) => (
<option
className="text-slate-500 text-lg"
value={duration}
>
{name}
</option>
))}
</Field>
{props.errors.timeline_days && {props.errors.timeline_days &&
props.touched.timeline_days && ( props.touched.timeline_days && (
<p className="text-sm text-red-500"> <p className="text-sm text-red-500">
@@ -396,3 +411,16 @@ function AddJob() {
} }
export default AddJob; export default AddJob;
const publicArray = [
{ duration: 1, name: "1 day" },
{ duration: 2, name: "2 days" },
{ duration: 3, name: "3 days" },
{ duration: 4, name: "4 days" },
{ duration: 5, name: "5 days" },
{ duration: 6, name: "6 days" },
{ duration: 7, name: "1 week" },
{ duration: 14, name: "2 weeks" },
{ duration: 21, name: "3 weeks" },
{ duration: 28, name: "4 weeks" },
];
+8 -4
View File
@@ -46,6 +46,8 @@ export default function RightSideBar() {
</div> </div>
<div className="platform-list"> <div className="platform-list">
{userDetails && userDetails?.account_type !== "FAMILY" && (
<>
<div className="item flex space-x-3 items-center mb-4"> <div className="item flex space-x-3 items-center mb-4">
{/* image */} {/* image */}
<div className="w-8 h-8 rounded-full"> <div className="w-8 h-8 rounded-full">
@@ -77,8 +79,7 @@ export default function RightSideBar() {
</div> </div>
{/* action */} {/* action */}
</div> </div>
{userDetails && userDetails?.account_type !== "FAMILY" && (
<>
<div className="item flex space-x-3 items-center mb-4"> <div className="item flex space-x-3 items-center mb-4">
{/* image */} {/* image */}
<div className="w-8 h-8 rounded-full"> <div className="w-8 h-8 rounded-full">
@@ -122,6 +123,10 @@ export default function RightSideBar() {
</p> </p>
</div> </div>
</div> </div>
</>
)}
<div className="item flex space-x-3 items-center mb-4"> <div className="item flex space-x-3 items-center mb-4">
{/* image */} {/* image */}
<div className="w-8 h-8 rounded-full"> <div className="w-8 h-8 rounded-full">
@@ -156,8 +161,7 @@ export default function RightSideBar() {
</p> </p>
</div> </div>
</div> </div>
</>
)}
</div> </div>
</div> </div>
{/*<SideStatistics />*/} {/*<SideStatistics />*/}
+32 -13
View File
@@ -3,12 +3,12 @@ import Detail from "./popoutcomponent/Detail";
import ModalCom from "../Helpers/ModalCom"; import ModalCom from "../Helpers/ModalCom";
import InputCom from "../Helpers/Inputs/InputCom/index"; import InputCom from "../Helpers/Inputs/InputCom/index";
import SiteService from "../../services/SiteService"; import SiteService from "../../services/SiteService";
import { Form, Formik, Field } from "formik"; import { Form, Formik, Field, ErrorMessage } from "formik";
import * as Yup from "yup"; import * as Yup from "yup";
import LoadingSpinner from "../Spinners/LoadingSpinner"; import LoadingSpinner from "../Spinners/LoadingSpinner";
const validationSchema = Yup.object().shape({ const validationSchema = Yup.object().shape({
family: Yup.string().required("THis is required "), family: Yup.string().required("This is required "),
public: Yup.string(), public: Yup.string(),
individual: Yup.string() individual: Yup.string()
.email("Invalid email format") .email("Invalid email format")
@@ -68,18 +68,29 @@ function JobListPopout({ details, onClose, situation }) {
group: "", group: "",
}; };
let [inputs, setInputs] = useState({}); let [textArea, setTextArea] = useState(details?.job_detail);
const [errMsg, setErrMsg] = useState("")
const handleInputChange = ({ target: { name, value } }) => { const handleInputChange = ({ target: { value } }) => {
setInputs((prev) => ({ ...prev, [name]: value })); setTextArea(value);
}; };
const errorHandler = ({target: {name}}) => {
}
const jobFieldHandler = async (values, helpers) => { 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 = { let jobReq = {
job_id, job_id,
job_uid, job_uid,
job_description: job_detail job_description: textArea
}; };
let reqData; let reqData;
@@ -119,16 +130,19 @@ function JobListPopout({ details, onClose, situation }) {
assign_mode: 110033, assign_mode: 110033,
}; };
setLoader({ jobFields: { group: true } }); setLoader({ jobFields: { group: true } });
} else {
setErrMsg("err herre")
return
} }
try { try {
const res = await apiCall.assignJobTask(reqData); const res = await apiCall.assignJobTask(reqData);
let { data } = await res; let { data } = await res;
setLoader({ member: false, jobFields: false }); setLoader({ jobFields: false });
onClose(); onClose();
throw new Response(data); throw new Response(data);
} catch (error) { } catch (error) {
setLoader({ member: false, jobFields: false }); setLoader({ jobFields: false });
throw new Error(error); throw new Error(error);
} }
}; };
@@ -200,11 +214,11 @@ function JobListPopout({ details, onClose, situation }) {
<textarea <textarea
className={`p-1 w-full text-sm text-slate-900 outline-none border border-slate-300 rounded-md`} className={`p-1 w-full text-sm text-slate-900 outline-none border border-slate-300 rounded-md`}
rows="5" rows="5"
name="details"
style={{ resize: "none" }} style={{ resize: "none" }}
value={details.job_detail} value={textArea}
onChange={handleInputChange} onChange={handleInputChange}
/> />
{/* <p>{errMsg}</p> */}
</div> </div>
</div> </div>
@@ -226,9 +240,10 @@ function JobListPopout({ details, onClose, situation }) {
value={props?.values.family} value={props?.values.family}
data={familyList} data={familyList}
btnText="Assign to family" btnText="Assign to family"
optionText="select family" optionText="Select Family"
loader={loader?.jobFields.family} loader={loader?.jobFields.family}
/> />
{/* <p>{errMsg}</p> */}
</Form> </Form>
); );
}} }}
@@ -250,9 +265,10 @@ function JobListPopout({ details, onClose, situation }) {
value={props?.values.public} value={props?.values.public}
data={publicArray} data={publicArray}
btnText="Show Task to Public" btnText="Show Task to Public"
optionText="select duration" optionText="Select Duration"
loader={loader?.jobFields.public} loader={loader?.jobFields.public}
/> />
{/* <p>{errMsg}</p> */}
</Form> </Form>
); );
}} }}
@@ -277,6 +293,7 @@ function JobListPopout({ details, onClose, situation }) {
btnText="Send Offer to Individual" btnText="Send Offer to Individual"
loader={loader?.jobFields.individual} loader={loader?.jobFields.individual}
/> />
{/* <p>{errMsg}</p> */}
</Form> </Form>
); );
}} }}
@@ -300,10 +317,12 @@ function JobListPopout({ details, onClose, situation }) {
optionText="Group" optionText="Group"
loader={loader?.jobFields.group} loader={loader?.jobFields.group}
/> />
{/* <p>{errMsg}</p> */}
</Form> </Form>
); );
}} }}
</Formik> </Formik>
</div> </div>
{/* END OF ACTION SECTION */} {/* END OF ACTION SECTION */}
</div> </div>
+3 -12
View File
@@ -33,10 +33,6 @@ function OfferJobPopout({details, onClose, situation}) {
setRequestStatus({loading: true, status: false, message: '', trigger: 'reject'}) setRequestStatus({loading: true, status: false, message: '', trigger: 'reject'})
reqData.offer_result = 333 reqData.offer_result = 333
} }
if(name == 'cancel'){
setRequestStatus({loading: true, status: false, message: '', trigger: 'cancel'})
reqData.offer_result = 222
}
// API CALL // API CALL
apiUrl.offersResponse(reqData).then(response => { apiUrl.offersResponse(reqData).then(response => {
@@ -191,19 +187,14 @@ function OfferJobPopout({details, onClose, situation}) {
{/* close button */} {/* close button */}
<div className="p-6 flex justify-end"> <div className="p-6 flex justify-end">
{requestStatus.loading && requestStatus.trigger == 'cancel' ?
<LoadingSpinner size={8} color='sky-blue' />
:
<button <button
onClick={handleOffer} onClick={onClose}
disabled={requestStatus.loading} disabled={requestStatus.loading}
type="button" type="button"
name='cancel' className=" border-gradient text-18 tracking-wide px-2 py-2 rounded-full"
className="border border-red-500 text-red-500 text-18 tracking-wide px-2 py-2 rounded-full"
> >
Cancel <span className="text-gradient">Close</span>
</button> </button>
}
</div> </div>
{/* end of close button */} {/* end of close button */}
</div> </div>