From db03242886065eb88be49fda1144cae9e5137ba4 Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Tue, 6 Jun 2023 15:51:36 +0100 Subject: [PATCH 1/6] active task header count down added --- src/components/MyActiveJobs/ActiveJobs.jsx | 74 +++++++++------------- 1 file changed, 30 insertions(+), 44 deletions(-) diff --git a/src/components/MyActiveJobs/ActiveJobs.jsx b/src/components/MyActiveJobs/ActiveJobs.jsx index b46ad91..e1c365f 100644 --- a/src/components/MyActiveJobs/ActiveJobs.jsx +++ b/src/components/MyActiveJobs/ActiveJobs.jsx @@ -5,6 +5,8 @@ import { useNavigate } from "react-router-dom"; import ActiveJobMessage from "./ActiveJobMessage"; import LoadingSpinner from "../Spinners/LoadingSpinner"; +import CountDown from "../Helpers/CountDown"; + import usersService from "../../services/UsersService"; function ActiveJobs(props) { @@ -148,7 +150,7 @@ function ActiveJobs(props) { return ( -
+
{/* job title */}
@@ -172,20 +174,14 @@ function ActiveJobs(props) {
-
-
-

- {props.details?.contract && props.details.contract} -

-

- {userDetails.firstname && userDetails.firstname} -

-
- -

- Description: - {props.details?.description && props.details.description} +

+

+ {userDetails.firstname && userDetails.firstname}

+
+

Description:

+

{props.details?.description && props.details.description}

+
{/* end of job title */} @@ -193,19 +189,27 @@ function ActiveJobs(props) { {/* job details */}

Delivery Detail

-
-

- Due: - {props.details?.delivery_date && - props.details.delivery_date.split(" ")[0]} -

-

- {props.details?.delivery_date && - props.details.delivery_date.split(" ")[1]} -

-

- {props.details?.timeline_days && props.details.timeline_days} day(s) +

+

Due:

+
+

+

+
+ Hrs + Min + Sec +
+
+
+ +
+ Duration: + {props.details?.timeline_days && props.details.timeline_days} day(s) +
+
+ No: + {props.details?.contract && props.details.contract}
{/* end of job details */} @@ -293,24 +297,6 @@ function ActiveJobs(props) { {/* Buttons Sections */}
- {/*
- {tab == 'files' && - ( - - ) - } -
*/} -
- [BUTTON HERE] + [ {props.itemData.button_text} ]
-- 2.34.1 From b72d9ccc35d0fc38d04df2fea02366deb81b008b Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Tue, 6 Jun 2023 12:34:18 -0400 Subject: [PATCH 4/6] past due jobs --- src/components/MyActiveJobs/MyPastDueJobs.jsx | 43 +++++++++++++++++++ src/views/MyPastDueJobsPage.jsx | 5 ++- 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 src/components/MyActiveJobs/MyPastDueJobs.jsx diff --git a/src/components/MyActiveJobs/MyPastDueJobs.jsx b/src/components/MyActiveJobs/MyPastDueJobs.jsx new file mode 100644 index 0000000..0390f10 --- /dev/null +++ b/src/components/MyActiveJobs/MyPastDueJobs.jsx @@ -0,0 +1,43 @@ +import React, { useState } from "react"; +import { Link } from "react-router-dom"; +import Layout from "../Partials/Layout"; +import CommonHead from "../UserHeader/CommonHead"; +import MyActiveJobTable from "./MyActiveJobTable"; + +export default function MyPastDueJobs(props) { + const [selectTab, setValue] = useState("today"); + const filterHandler = (value) => { + setValue(value); + }; + console.log("AMEYE LOC1", props.MyJobList); + return ( + + +
+
+ {/* heading */} +
+
+

+ + Pass Due Job(s) + +

+
+
+
filterHandler("today")} + className="relative" + >
+
+
+ +
+
+
+ ); +} diff --git a/src/views/MyPastDueJobsPage.jsx b/src/views/MyPastDueJobsPage.jsx index d603a17..926228b 100644 --- a/src/views/MyPastDueJobsPage.jsx +++ b/src/views/MyPastDueJobsPage.jsx @@ -1,7 +1,8 @@ import React, { useContext,useState, useEffect } from "react"; import usersService from "../services/UsersService"; //import MyJobs from "../components/MyJobs"; -import MyActiveJobs from "../components/MyActiveJobs"; +//import MyActiveJobs from "../components/MyActiveJobs"; +import MyPastDueJobs from "../components/MyActiveJobs/MyPastDueJobs"; export default function MyPastDueJobsPage() { const commonHeadData =()=>{ @@ -26,7 +27,7 @@ export default function MyPastDueJobsPage() { // debugger; return ( <> - -- 2.34.1 From 835b5830565e8c44d0e281bef287a68bec67917a Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Tue, 6 Jun 2023 13:33:43 -0400 Subject: [PATCH 5/6] past due pages --- src/services/UsersService.js | 14 ++++++++++++++ src/views/MyPastDueJobsPage.jsx | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/services/UsersService.js b/src/services/UsersService.js index 86eb0de..37cf02d 100644 --- a/src/services/UsersService.js +++ b/src/services/UsersService.js @@ -219,6 +219,7 @@ class usersService { uid: localStorage.getItem("uid"), member_id: localStorage.getItem("member_id"), sessionid: localStorage.getItem("session_token"), + job_mode: "ACTIVE", limit: 30, offset: 0, action: 13008, @@ -244,6 +245,7 @@ class usersService { uuid: localStorage.getItem("uid"), member_id: localStorage.getItem("member_id"), sessionid: localStorage.getItem("session_token"), + job_mode: "ACTIVE", page: 0, offset: 0, limit: 100, @@ -251,6 +253,18 @@ class usersService { return this.postAuxEnd("/jobmanageractive", postData); } + getMyPastDueJobList() { + var postData = { + uuid: localStorage.getItem("uid"), + member_id: localStorage.getItem("member_id"), + sessionid: localStorage.getItem("session_token"), + job_mode: "PASTDUE", + page: 0, + offset: 0, + limit: 100, + }; + return this.postAuxEnd("/jobmanageractive", postData); + } getMyPendingJobList() { var postData = { uuid: localStorage.getItem("uid"), diff --git a/src/views/MyPastDueJobsPage.jsx b/src/views/MyPastDueJobsPage.jsx index 926228b..b50c9ce 100644 --- a/src/views/MyPastDueJobsPage.jsx +++ b/src/views/MyPastDueJobsPage.jsx @@ -14,7 +14,7 @@ export default function MyPastDueJobsPage() { //TARGET ENDPOINT[POST]http://10.204.5.100:9083/en/wrench/api/v1/jobmanageractive const getMyJobList = async () => { try { - const res = await api.getMyActiveJobList(); + const res = await api.getMyPastDueJobList(); setMyJobList(res.data); } catch (error) { console.log("Error getting mode"); -- 2.34.1 From 06549bf9bb228e066ab9f2c523bb028eda2dfb26 Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Tue, 6 Jun 2023 20:52:15 +0100 Subject: [PATCH 6/6] Displays countdown if task is yet to pass due, else displays due time --- src/components/MyActiveJobs/ActiveJobs.jsx | 74 +++++++++++++++++----- 1 file changed, 58 insertions(+), 16 deletions(-) diff --git a/src/components/MyActiveJobs/ActiveJobs.jsx b/src/components/MyActiveJobs/ActiveJobs.jsx index e1c365f..7cb2cca 100644 --- a/src/components/MyActiveJobs/ActiveJobs.jsx +++ b/src/components/MyActiveJobs/ActiveJobs.jsx @@ -4,16 +4,17 @@ import Layout from "../Partials/Layout"; import { useNavigate } from "react-router-dom"; import ActiveJobMessage from "./ActiveJobMessage"; import LoadingSpinner from "../Spinners/LoadingSpinner"; - import CountDown from "../Helpers/CountDown"; import usersService from "../../services/UsersService"; function ActiveJobs(props) { const ApiCall = new usersService() + let navigate = useNavigate() let { userDetails } = useSelector((state) => state.userDetails); - let navigate = useNavigate() + + let [passDue, setPassDue] = useState(new Date() > new Date(props.details?.delivery_date)) // STATE TO KNOW IF TASK IS PASSED DUE TIME let [messageToSend, setMessageToSend] = useState('') // State to hold the value of message to be sent @@ -147,10 +148,33 @@ function ActiveJobs(props) { } } + + // FUNCTION TO CHECK IF TASK PASS DUE IS REACHED + let isPassedDue = () => { + // console.log('TESTING',new Date() > new Date(props.details?.delivery_date) ) + if(new Date() > new Date(props.details?.delivery_date)){ + setPassDue(true) + }else{ + setPassDue(false) + } + } + + + useEffect(()=>{ + if(!passDue){ + let passDueInterval = setInterval(()=>{ + isPassedDue() + },1000) + return ()=>{ + clearInterval(passDueInterval) + } + } + },[passDue]) + return ( -
+
{/* job title */}
@@ -175,9 +199,9 @@ function ActiveJobs(props) {
-

- {userDetails.firstname && userDetails.firstname} -

+

+ {userDetails.firstname && userDetails.firstname} +

Description:

{props.details?.description && props.details.description}

@@ -189,19 +213,37 @@ function ActiveJobs(props) { {/* job details */}

Delivery Detail

-
-

Due:

-
-

- + {passDue ? + ( +

+

+ Due: + {props.details?.delivery_date && + props.details.delivery_date.split(" ")[0]}

-
- Hrs - Min - Sec +

+ {props.details?.delivery_date && + props.details.delivery_date.split(" ")[1]} +

+
+ ) + : + ( +
+

Due:

+
+

+ +

+
+ Hrs + Min + Sec +
-
+ ) + }
Duration: -- 2.34.1