From 9cd3ef273b307b18aaa0d57ed0ed35554480b928 Mon Sep 17 00:00:00 2001 From: Ebube Date: Mon, 29 May 2023 23:58:55 +0100 Subject: [PATCH 1/4] . --- src/components/jobPopout/JobListPopout.jsx | 75 ++++++++++++++++------ 1 file changed, 54 insertions(+), 21 deletions(-) diff --git a/src/components/jobPopout/JobListPopout.jsx b/src/components/jobPopout/JobListPopout.jsx index cdb37da..507222d 100644 --- a/src/components/jobPopout/JobListPopout.jsx +++ b/src/components/jobPopout/JobListPopout.jsx @@ -69,28 +69,49 @@ function JobListPopout({ details, onClose, situation }) { }; let [textArea, setTextArea] = useState(details?.job_detail); - const [errMsg, setErrMsg] = useState("") + const [errMsg, setErrMsg] = useState({ + deliveryDetail: "", + jobFields: { + family: "", + public: "", + individual: "", + group: "", + }, + }); const handleInputChange = ({ target: { value } }) => { setTextArea(value); }; - const errorHandler = ({target: {name}}) => { - - } + const errorHandler = ({ target: { name } }) => { + try { + if (name === "family") + setErrMsg({ jobFields: { family: "please select a family member" } }); + else if (name === "public") + setErrMsg({ jobFields: { public: "please select duration" } }); + else if (name === "individual") + setErrMsg({ jobFields: { individual: "please enter email" } }); + else if (name === "group") + setErrMsg({ jobFields: { group: "please select a family member" } }); + } finally { + setTimeout(() => { + setErrMsg({ jobFields: "" }); + }, 3000); + } + }; const jobFieldHandler = async (values, helpers) => { let { job_id, job_uid } = details; - if(!textArea) { - setErrMsg("delivery detail is required!") - return + if (!textArea) { + setErrMsg({ deliveryDetail: "delivery detail is required!" }); + return; } let jobReq = { job_id, job_uid, - job_description: textArea + job_description: textArea, }; let reqData; @@ -131,8 +152,7 @@ function JobListPopout({ details, onClose, situation }) { }; setLoader({ jobFields: { group: true } }); } else { - setErrMsg("err herre") - return + return; } try { @@ -218,7 +238,7 @@ function JobListPopout({ details, onClose, situation }) { value={textArea} onChange={handleInputChange} /> - {/*

{errMsg}

*/} +

{errMsg.deliveryDetail}

@@ -231,7 +251,7 @@ function JobListPopout({ details, onClose, situation }) { > {(props) => { return ( -
+ {/* Assign to Family */} - {/*

{errMsg}

*/} + {props?.values.family === "" && ( +

{errMsg.jobFields.family}

+ )} ); }} @@ -256,7 +279,7 @@ function JobListPopout({ details, onClose, situation }) { > {(props) => { return ( -
+ {/* Offer this job to public input */} - {/*

{errMsg}

*/} + {props?.values.public === "" && ( +

{errMsg.jobFields.public}

+ )} ); }} @@ -281,7 +307,7 @@ function JobListPopout({ details, onClose, situation }) { > {(props) => { return ( -
+ {/* Offer this job to individual input */} - {/*

{errMsg}

*/} + {props?.values.individual === "" && ( +

{errMsg.jobFields.individual}

+ )} ); }} @@ -306,7 +335,7 @@ function JobListPopout({ details, onClose, situation }) { > {(props) => { return ( -
+ {/* Offer this job to your group input */} - {/*

{errMsg}

*/} + {props?.values.group === "" && ( +

{errMsg.jobFields.group}

+ )} ); }} - {/* END OF ACTION SECTION */} @@ -346,11 +377,12 @@ const JobFieldInput = ({ btnText, parentClass, optionText, + errorHandler, loader, data, }) => { return ( -
+
{select && ( <>
@@ -421,6 +453,7 @@ const JobFieldInput = ({
-
+
    {tabs.map(({ name, id }) => ( @@ -213,7 +214,9 @@ function ProfileInfo({ function Account({ familyDetails }) { return ( -
    +
    +
    +

    Username: {familyDetails?.username} @@ -222,6 +225,18 @@ function Account({ familyDetails }) { Pin: {familyDetails?.pin}

    + + or + +
    +

    scan the code from mobile app

    +qr-sample +
    +
    +
    + +
    +
    ); } diff --git a/src/components/jobPopout/EditJobPopout.jsx b/src/components/jobPopout/EditJobPopout.jsx index a65e54f..8801227 100644 --- a/src/components/jobPopout/EditJobPopout.jsx +++ b/src/components/jobPopout/EditJobPopout.jsx @@ -1,6 +1,6 @@ import React, { useCallback, useEffect, useMemo, useState } from "react"; import ModalCom from "../Helpers/ModalCom"; -import { Form, Formik } from "formik"; +import { Field, Form, Formik } from "formik"; import * as Yup from "yup"; import InputCom from "../Helpers/Inputs/InputCom"; import LoadingSpinner from "../Spinners/LoadingSpinner"; @@ -245,20 +245,34 @@ const EditJobPopOut = ({ details, onClose, situation, country }) => {
    - +
    + +
    + + + + {publicArray.map(({ name, duration }, idx) => ( + + ))} + {props.errors.timeline_days && props.touched.timeline_days && (

    @@ -316,3 +330,16 @@ const EditJobPopOut = ({ details, onClose, situation, country }) => { }; export default EditJobPopOut; + +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" }, +]; diff --git a/src/components/jobPopout/JobListPopout.jsx b/src/components/jobPopout/JobListPopout.jsx index 507222d..0933920 100644 --- a/src/components/jobPopout/JobListPopout.jsx +++ b/src/components/jobPopout/JobListPopout.jsx @@ -168,7 +168,7 @@ function JobListPopout({ details, onClose, situation }) { }; return ( - +

    @@ -264,9 +264,12 @@ function JobListPopout({ details, onClose, situation }) { loader={loader?.jobFields.family} errorHandler={errorHandler} /> - {props?.values.family === "" && ( -

    {errMsg.jobFields.family}

    - )} +

    + {" "} + {props?.values.family === "" && ( + {errMsg.jobFields.family} + )} +

    {" "} ); }} @@ -292,9 +295,12 @@ function JobListPopout({ details, onClose, situation }) { loader={loader?.jobFields.public} errorHandler={errorHandler} /> - {props?.values.public === "" && ( -

    {errMsg.jobFields.public}

    - )} +

    + {" "} + {props?.values.public === "" && ( + {errMsg.jobFields.public} + )} +

    {" "} ); }} @@ -320,9 +326,12 @@ function JobListPopout({ details, onClose, situation }) { loader={loader?.jobFields.individual} errorHandler={errorHandler} /> - {props?.values.individual === "" && ( -

    {errMsg.jobFields.individual}

    - )} +

    + {" "} + {props?.values.individual === "" && ( + {errMsg.jobFields.individual} + )} +

    {" "} ); }} @@ -347,9 +356,12 @@ function JobListPopout({ details, onClose, situation }) { loader={loader?.jobFields.group} errorHandler={errorHandler} /> - {props?.values.group === "" && ( -

    {errMsg.jobFields.group}

    - )} +

    + {" "} + {props?.values.group === "" && ( + {errMsg.jobFields.group} + )} +

    ); }} diff --git a/src/index.css b/src/index.css index 5a4e0ee..6b1a5b1 100644 --- a/src/index.css +++ b/src/index.css @@ -787,4 +787,8 @@ TODO: Responsive =========================== .edit-popup{ top: 75px; +} + +.job-popup{ + top: 55px; } \ No newline at end of file From 42c3676bcf034c2a45c1ff8308de4878916a327c Mon Sep 17 00:00:00 2001 From: Ebube Date: Tue, 30 May 2023 02:11:51 +0100 Subject: [PATCH 3/4] . --- src/components/FamilyAcc/FamilyManageTabs.jsx | 81 +++++++++++++++---- 1 file changed, 64 insertions(+), 17 deletions(-) diff --git a/src/components/FamilyAcc/FamilyManageTabs.jsx b/src/components/FamilyAcc/FamilyManageTabs.jsx index 355708c..fc32640 100644 --- a/src/components/FamilyAcc/FamilyManageTabs.jsx +++ b/src/components/FamilyAcc/FamilyManageTabs.jsx @@ -131,7 +131,12 @@ export default function FamilyManageTabs({ ) : ( <> - {name === "Tasks" && } + {name === "Tasks" && ( + + )} {name === "Account" && ( )} @@ -213,29 +218,71 @@ function ProfileInfo({ } function Account({ familyDetails }) { + const handlePrint = () => { + const printableContent = ` + + + + + +
    +

    Family member details

    +

    Username: ${familyDetails?.username}

    +

    Password: ${familyDetails?.pin}

    + QR Code + + + `; + + const printWindow = window.open('', '', 'width=800,height=700'); + printWindow.document.open(); + printWindow.document.write(printableContent); + printWindow.document.close(); + + printWindow.onload = () => { + printWindow.print(); + }; + }; + return (
    -
    -

    - Username: {familyDetails?.username} -

    -

    - Pin: {familyDetails?.pin} -

    -
    +
    +

    + Username:{" "} + + {familyDetails?.username} + +

    +

    + Pin:{" "} + {familyDetails?.pin} +

    +
    - or + + or + -
    -

    scan the code from mobile app

    -qr-sample -
    +
    +

    + Scan the code from mobile app +

    + qr-sample +
    +
    +
    +
    -
    - -
    ); From f5bf5997d605ddfc609d60f3df1a86f0a738dec5 Mon Sep 17 00:00:00 2001 From: Ebube Date: Tue, 30 May 2023 02:20:58 +0100 Subject: [PATCH 4/4] addded email fix --- src/components/jobPopout/JobListPopout.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/jobPopout/JobListPopout.jsx b/src/components/jobPopout/JobListPopout.jsx index 0933920..caedf82 100644 --- a/src/components/jobPopout/JobListPopout.jsx +++ b/src/components/jobPopout/JobListPopout.jsx @@ -451,7 +451,7 @@ const JobFieldInput = ({ fieldClass="px-6" label={label} labelClass="tracking-wide" - type="text" + type="email" name={inputName} placeholder={placeholder} value={value}