From 370ab871c3b18c46c9a903859a11ddaf1e705849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D8=AD=D8=B3=DB=8C=D9=86=20=D9=85=D8=B9=D8=B5=D9=88=D9=85?= =?UTF-8?q?=DB=8C=20=D9=BE=D9=88=D8=B1?= Date: Tue, 23 Apr 2024 23:57:05 +0330 Subject: [PATCH] shift plan Open today && name supervisor --- .env | 6 +- .../BottomSheet/BottomFilterActivities.jsx | 2 + plugins/Chapar/index.js | 8 +- src/app/home/page.jsx | 13 ++- src/app/layout.jsx | 5 + src/app/shifts/page.jsx | 37 +++++-- src/app/tasks/page.jsx | 101 ++++++++++++++---- 7 files changed, 132 insertions(+), 40 deletions(-) diff --git a/.env b/.env index b1e1e52..b8e9d6b 100644 --- a/.env +++ b/.env @@ -1,8 +1,8 @@ NODE_ENV="development" -NEXT_PUBLIC_SERVER_URL=http://192.168.117.123:32769 -NEXT_PUBLIC_PUBLIC_URL=http://192.168.117.123:32769 -NEXT_PUBLIC_API_URL=http://192.168.117.123:32769/api +NEXT_PUBLIC_SERVER_URL=http://192.168.1.12:32768 +NEXT_PUBLIC_PUBLIC_URL=http://192.168.1.12:32768 +NEXT_PUBLIC_API_URL=http://192.168.1.12:32768/api # SECURE_LOCAL_STORAGE_HASH_KEY=f1da2b2c7a4c446934267fea631102ec389b5b99 # NEXT_PUBLIC_API_URL_IMAGE=https://192.168.88.12:49154/Files/ReportImages diff --git a/plugins/BottomSheet/BottomFilterActivities.jsx b/plugins/BottomSheet/BottomFilterActivities.jsx index 66df160..828e899 100644 --- a/plugins/BottomSheet/BottomFilterActivities.jsx +++ b/plugins/BottomSheet/BottomFilterActivities.jsx @@ -9,6 +9,7 @@ import CheckBoxBriz from "plugins/CheckBoxBriz/page"; import Buttonbriz from "plugins/Buttonbriz/page"; import { toast } from "react-toastify"; import moment from "jalali-moment"; +import HasPermission from "plugins/HasPermission/page"; const BottomFilterActivities = (props) => { const CTX = useContext(AppContext); @@ -61,6 +62,7 @@ const BottomFilterActivities = (props) => { >

اکتیویتی های هفته

+ { CTX.setBottomSheetReportOpen(true); }; + console.log( + new Intl.DateTimeFormat("fa-IR-u-nu-latn", { + dateStyle: "full", + timeStyle: "long", + }).format(new Date()) + ); + return (
{ />
- {1 > 0 && ( + {homePageData?.totalStaffToday > 0 && (
@@ -146,7 +153,7 @@ const Home = (props) => {

- + % @@ -210,7 +217,7 @@ const Home = (props) => {

{ setLoading(true); + + console.log("s"); try { const data = await Chapar.post( `${process.env.NEXT_PUBLIC_API_URL}/activity/undone/${id}?undoneReason=${resone}`, @@ -1665,6 +1668,7 @@ export default function RootLayout({ children }) { reportDetail, BottomFilterActivitiesOpen, homePageData, + typeTask, }, setBottomSheetCreateRoleOpen, setBottomSheetCreateEmployeesOpen, @@ -1789,6 +1793,7 @@ export default function RootLayout({ children }) { setBottomFilterActivitiesOpen, setHomePageData, GetHomePageData, + setTypeTask, }} > diff --git a/src/app/shifts/page.jsx b/src/app/shifts/page.jsx index 2c87f23..be4cd38 100644 --- a/src/app/shifts/page.jsx +++ b/src/app/shifts/page.jsx @@ -79,15 +79,6 @@ const Shifts = (props) => { // Check if the planForDate is tomorrow const isTomorrow = planForDate.toDateString() === tomorrow.toDateString(); - console.log( - "today", - isToday, - "yesterday", - isYesterday, - "tomorrow", - isTomorrow - ); - return { today: isToday, yesterday: isYesterday, @@ -103,6 +94,14 @@ const Shifts = (props) => { groupObjectsByPlanFor(shiftplansData); }, [shiftplansData]); + useEffect(() => { + const indextoday = shiftplans.findIndex( + (e) => new Date(e.planFor).toDateString() == new Date().toDateString() + ); + + setShiftPlansSelect(indextoday); + }, [shiftplans]); + console.log(shiftplans[0]?.data[0]?.users); return ( @@ -162,10 +161,20 @@ const Shifts = (props) => { }`} onClick={() => setShiftPlansSelect(index)} > -
+
+ +

+ {checkDateStatus(e.planFor).today ? ( + + (امروز) + + ) : ( + "" + )} +

@@ -203,6 +212,14 @@ const Shifts = (props) => {

))} +
+

+ سوپروایزر :{" "} +

{" "} +

+ {e.supervisorFullName} +

+

))} diff --git a/src/app/tasks/page.jsx b/src/app/tasks/page.jsx index 70067f5..740c7d7 100644 --- a/src/app/tasks/page.jsx +++ b/src/app/tasks/page.jsx @@ -28,8 +28,7 @@ const page = () => { const pageGetActivity = CTX.state.pageGetActivity; const stopGetTasks = CTX.state.stopGetTasks; const stopGetActivities = CTX.state.stopGetActivities; - - const [typeTask, setTypeTask] = useState(1); + const typeTask = CTX.state.typeTask; console.log("pageGetTasks", pageGetTasks); @@ -56,15 +55,6 @@ const page = () => { ); }; - const attrs = useLongPress((e) => console.log(e), { - // onStart: (event) => setSubButtonAction(true), - onFinish: (event) => { - CTX.setBottomFilterActivitiesOpen(true); - }, - // onCancel: (event) => setSubButtonAction(false), - threshold: 500, - }); - console.log(activities.length); return ( @@ -88,18 +78,18 @@ const page = () => { }} /> -
+
{!!HasPermission("ManageTasks", permissions) && ( -
+
setTypeTask(0)} + onClick={() => CTX.setTypeTask(0)} >

تسک های روزانه @@ -107,14 +97,13 @@ const page = () => {

setTypeTask(1)} - {...attrs} + onClick={() => CTX.setTypeTask(1)} >

اکتیویتی های روزانه @@ -123,6 +112,78 @@ const page = () => {

)} +
CTX.setBottomFilterActivitiesOpen(true)} + > +
+
+ + + +
+
+

+ فیلــتر +

+
+
+ +
+
+ + + +
+
+

+ روز خاص + (به زودی) +

+
+
+ +
+
+ + + +
+
+

+ اولویت (به زودی) +

+
+
+
+ {/*

تسک های هفتگی مجموعه