Fixed bug of tasks and chores page

This commit is contained in:
2024-03-07 23:44:30 +01:00
parent 723a2a09ab
commit 2ff6ed777f
7 changed files with 474 additions and 292 deletions
+23 -14
View File
@@ -1,10 +1,10 @@
import { Form, Formik } from "formik";
import { useState } from "react";
import { useLocation } from "react-router-dom";
import ModalCom from "../Helpers/ModalCom";
import { Form, Formik } from "formik";
import InputCom from "../Helpers/Inputs/InputCom";
import usersService from "../../services/UsersService";
import Icons from "../Helpers/Icons";
import InputCom from "../Helpers/Inputs/InputCom";
import ModalCom from "../Helpers/ModalCom";
const DEFAULT_IMAGE = require("../../assets/images/family/default.jpg");
const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
@@ -51,7 +51,7 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
};
const handleParentSuggestion = (values) => {
if (suggestedNextStep == "Send Task") {
if (suggestedNextStep === "Send Task") {
let firstName = state?.firstname;
let family_uid = state?.family_uid;
continuePopupData({ ...details, firstName, family_uid });
@@ -59,6 +59,8 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
onClose();
};
console.log(pathname)
return (
<ModalCom action={onClose} situation={situation}>
<div className="logout-modal-wrapper lw-[90%] md:w-[768px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
@@ -122,12 +124,16 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
<div className="field w-full mb-[15px]">
<InputCom
fieldClass={
pathname === "/manage-family" ? "px-2" : "px-6"
pathname ===
"/manage-family"
? "px-2"
: "px-6"
}
label="Title"
labelClass="tracking-wide"
inputBg={
pathname === "/manage-family"
pathname ===
"/manage-family"
? "bg-white"
: "bg-slate-100"
}
@@ -164,7 +170,8 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
id="description"
rows="5"
className={`input-field pt-2 placeholder:text-base text-dark-gray dark:text-white w-full ${
pathname === "/manage-family"
pathname ===
"/manage-family"
? "px-2 h-[110px]"
: "bg-slate-100 px-3 dark:bg-[#11131F] focus:ring-0 focus:outline-[#dce4e9] rounded-[10px] h-[130px]"
}`}
@@ -177,7 +184,8 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
</div>
{/* Radio buttons for family */}
{pathname === "/manage-family" ? (
{pathname ===
"/manage-family" ? (
<div className="h-[20px] w-full border-t dark:border-[#5356fb29] border-light-purple relative">
<div id="my-radio-group" className="sr-only">
Parent suggested next step
@@ -212,9 +220,9 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
id={`parent-suggested-${idx}`}
name="parent-suggested"
className={`ml-1 ${
title == "Not Now"
title === "Not Now"
? "text-red-500"
: title == "Duplicate"
: title === "Duplicate"
? "text-purple"
: "text-black"
} font-semibold`}
@@ -243,19 +251,20 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
disabled={props.isSubmitting}
className="text-white primary-gradient text-18 tracking-wide px-4 py-3 rounded-full transition duration-150 ease-in-out flex items-center"
>
{pathname !== "/manage-family" ? (
{pathname !==
"/manage-family" ? (
<>
{submitTask.loading
? "Submitting Task"
: submitTask.state == "success"
: submitTask.state === "success"
? "Task Submitted"
: submitTask.state == "bad"
: submitTask.state === "bad"
? "An Error Occurred"
: "Send to Parents"}
</>
) : (
<>
{suggestedNextStep == "Send Task" ? (
{suggestedNextStep === "Send Task" ? (
<>
Continue <Icons name="chevron-right" />
</>