-
+
+
+
setActiveSection(0)}
+ >
+
+
+
+
+ مدیریت روتین های مجموعه
+
+
+ شما
+
+
+
+ روتین فعال دارید
+
+
+
+
+ {activeSection == 0 ? (
+
CTX.setBottomSheetCreateRoutineOpen(true)}
+ >
+
+
+ ) : (
+
+ )}
+
+
+ {activeSection == 0 &&
}
+
+
+ {/*
مدیریت نقش های مجموعه
-
+
شما
-
+
نقش فعال دارید
@@ -69,47 +140,169 @@ const Employees = (props) => {
-
-
-
-
-
مدیریت کارکنان مجموعه
-
- شما
-
-
-
- کارمند فعال دارید
-
-
+
*/}
+
CTX.setBottomSheetCreateEmployeesOpen(true)}
+ className="flex justify-between mt-7 bg-white rounded-2xl"
+ onClick={() => setActiveSection(1)}
>
-
+
+
+
+
مدیریت سکشن ها مجموعه
+
+ شما
+
+
+
+ سکشن فعال دارید
+
+
+
+ {activeSection == 1 ? (
+
CTX.setBottomSheetCreateSectionOpen(true)}
+ >
+
+
+ ) : (
+
+ )}
+ {activeSection == 1 &&
}
-
+
+
setActiveSection(2)}
+ >
+
+
+
+
+ مدیریت پوزیشن های مجموعه
+
+
+ شما
+
+
+
+ پوزیشن فعال دارید
+
+
+
+ {activeSection == 2 ? (
+
CTX.setBottomSheetCreatePositionOpen(true)}
+ >
+
+
+ ) : (
+
+ )}
+
+ {activeSection == 2 &&
}
+
+
+
+
setActiveSection(3)}
+ >
+
+
+
+
مدیریت کارکنان مجموعه
+
+ شما
+
+
+
+ کارمند فعال دارید
+
+
+
+
+ {activeSection == 3 ? (
+
CTX.setBottomSheetCreateEmployeesOpen(true)}
+ >
+
+
+ ) : (
+
+ )}
+
+ {activeSection == 3 &&
}
+
-
+ {/*
*/}
+
+
+
);
};
diff --git a/src/app/home/page.jsx b/src/app/home/page.jsx
index 3208ed5..6f9dc8b 100644
--- a/src/app/home/page.jsx
+++ b/src/app/home/page.jsx
@@ -1,7 +1,7 @@
"use client";
import AppHeader from "@comp/AppHeader/page";
-import TaskCard from "@comp/TaskCard/page";
+// import TaskCard from "@comp/TaskCard/page";
import AppContext from "@ctx/AppContext";
import Link from "next/link";
import { useRouter } from "next/navigation";
@@ -9,7 +9,7 @@ import { getToken } from "plugins/Chapar";
import { ParseJwt } from "plugins/ParseJwt/page";
import PersianNumber from "plugins/PersianNumber";
import React, { useContext, useEffect } from "react";
-import { Swiper, SwiperSlide } from "swiper/react";
+// import { Swiper, SwiperSlide } from "swiper/react";
const Home = (props) => {
const CTX = useContext(AppContext);
@@ -53,203 +53,7 @@ const Home = (props) => {
/>
-
-
-
تسک های هفتگی مجموعه
-
- امروز
-
-
-
- تسک فعال دارید
-
-
-
-
-
-
-
console.log("slide change")}
- onSwiper={(swiper) => console.log(swiper)}
- >
-
-
-
-
- اهمیت بالا{" "}
-
-
- شیفت صبح
-
-
-
-
-
- کارگاه بدنسازی در خانه برای رستوران توگک
-
-
-
-
-
-
-
-
- +
-
-
-
- نفر دیگر
-
-
-
-
-
-
-
- دوشنبه
-
-
-
- اردیبهشت
-
-
-
-
-
-
-
-
-
-
-
-
-
- اهمیت بالا{" "}
-
-
- شیفت صبح
-
-
-
-
-
- کارگاه بدنسازی در خانه برای رستوران توگک
-
-
-
-
-
-
-
-
- +
-
-
-
- نفر دیگر
-
-
-
-
-
-
-
- دوشنبه
-
-
-
- اردیبهشت
-
-
-
-
-
-
-
-
-
-
-
-
-
تسک های امروز
-
- امروز
-
-
-
- تسک فعال دارید
-
-
-
-
-
-
-
-
+ اینجا برای مدیریت میشه همون چارت ها و ...
);
diff --git a/src/app/layout.jsx b/src/app/layout.jsx
index 27ecc0c..3dade48 100644
--- a/src/app/layout.jsx
+++ b/src/app/layout.jsx
@@ -38,6 +38,13 @@ export default function RootLayout({ children }) {
useState(false);
const [BottomManageShiftOpen, setBottomManageShiftOpen] = useState(false);
+ const [BottomSheetCreateRoutineOpen, setBottomSheetCreateRoutineOpen] =
+ useState(false);
+ const [BottomSheetCreateSectionOpen, setBottomSheetCreateSectionOpen] =
+ useState(false);
+
+ const [BottomSheetCreatePositionOpen, setBottomSheetCreatePositionOpen] =
+ useState(false);
// BigPlus
const [BigPlusOpen, setBigPlusOpen] = useState(false);
@@ -70,7 +77,28 @@ export default function RootLayout({ children }) {
const [goToEditUser, setGoToEditUser] = useState(false);
const [idEditUser, setIdEditUser] = useState(null);
+ // createsection/ section
+ const [sectionsData, setSectionsData] = useState([]);
+ const [sectionData, setSectionData] = useState([]);
+ const [goToEditSection, setGoToEditSection] = useState(false);
+ const [idEditSection, setIdEditSection] = useState(null);
+
+ // createroutine/ routine
+ const [routinesData, setRoutinesData] = useState([]);
+ const [routineData, setRoutineData] = useState([]);
+ const [goToEditRoutine, setGoToEditRoutine] = useState(false);
+ const [idEditRoutine, setIdEditRoutine] = useState(null);
+
+ // createPosition/ Position
+ const [positionsData, setPositionsData] = useState([]);
+ const [positionData, setPositionData] = useState([]);
+ const [goToEditPosition, setGoToEditPosition] = useState(false);
+ const [idEditPosition, setIdEditPosition] = useState(null);
+ const [sectionIdChoose, setSectionIdChoose] = useState([]);
+
// shift
+ const [dayOfWeeksChoose, setDayOfWeeksChoose] = useState([]);
+
const [startAtTimeShift, setStartAtTimeShift] = useState(["00", "00"]);
const [endAtTimeShift, setEndAtTimeShift] = useState(["00", "00"]);
const [shiftsData, setShiftsData] = useState([null]);
@@ -205,6 +233,7 @@ export default function RootLayout({ children }) {
setLoading(false);
}
};
+
const CreateRole = async (body) => {
setLoading(true);
try {
@@ -333,6 +362,7 @@ export default function RootLayout({ children }) {
setLoading(false);
}
};
+
const CreateUser = async (body) => {
setLoading(true);
try {
@@ -461,6 +491,7 @@ export default function RootLayout({ children }) {
setLoading(false);
}
};
+
const CreateShift = async (body) => {
setLoading(true);
try {
@@ -589,6 +620,394 @@ export default function RootLayout({ children }) {
setLoading(false);
}
};
+
+ const CreateSection = async (body) => {
+ setLoading(true);
+ try {
+ const data = await Chapar.post(
+ `${process.env.NEXT_PUBLIC_API_URL}/section`,
+ JSON.stringify(body),
+ {
+ headers: {
+ Authorization: getToken(),
+ },
+ }
+ );
+ toast.success(`سکشن ساخته شد`, {
+ position: "bottom-right",
+ closeOnClick: true,
+ });
+ setBottomSheetCreateSectionOpen(false);
+ setLoading(false);
+ GetSections();
+ } catch ({ error, status }) {
+ toast.error(`${error.response.data.message}`, {
+ position: "bottom-right",
+ closeOnClick: true,
+ });
+ setLoading(false);
+ }
+ };
+ const UpdateSection = async (body) => {
+ setLoading(true);
+ try {
+ const data = await Chapar.put(
+ `${process.env.NEXT_PUBLIC_API_URL}/section`,
+ body,
+
+ {
+ headers: {
+ Authorization: getToken(),
+ },
+ }
+ );
+ toast.success(`سکشن ویرایش شد`, {
+ position: "bottom-right",
+ closeOnClick: true,
+ });
+
+ setBottomSheetCreateSectionOpen(false);
+ setLoading(false);
+ GetSections();
+ } catch ({ error, status }) {
+ toast.error(`${error.response.data.message}`, {
+ position: "bottom-right",
+ closeOnClick: true,
+ });
+ setLoading(false);
+ }
+ };
+ const GetSections = async () => {
+ setLoading(true);
+ try {
+ const data = await Chapar.get(
+ `${process.env.NEXT_PUBLIC_API_URL}/section?page=0`,
+
+ {
+ headers: {
+ Authorization: getToken(),
+ },
+ }
+ );
+ console.log("GetSection", data);
+
+ setSectionsData(data);
+ setLoading(false);
+ } catch ({ error, status }) {
+ toast.error(`${error.response.data.message}`, {
+ position: "bottom-right",
+ closeOnClick: true,
+ });
+ setLoading(false);
+ }
+ };
+ const GetSection = async (id) => {
+ setLoading(true);
+ try {
+ const data = await Chapar.get(
+ `${process.env.NEXT_PUBLIC_API_URL}/section/${id}`,
+
+ {
+ headers: {
+ Authorization: getToken(),
+ },
+ }
+ );
+ console.log("GetShift", data);
+
+ setSectionData(data);
+ setLoading(false);
+ } catch ({ error, status }) {
+ toast.error(`${error.response.data.message}`, {
+ position: "bottom-right",
+ closeOnClick: true,
+ });
+ setLoading(false);
+ }
+ };
+ const DeleteSection = async (id) => {
+ setLoading(true);
+ try {
+ const data = await Chapar.delete(
+ `${process.env.NEXT_PUBLIC_API_URL}/section/${id}`,
+
+ {
+ headers: {
+ Authorization: getToken(),
+ },
+ }
+ );
+ setBottomSheetCreateSectionOpen(false);
+
+ setLoading(false);
+ GetSections();
+ } catch ({ error, status }) {
+ toast.error(`${error.response.data.message}`, {
+ position: "bottom-right",
+ closeOnClick: true,
+ });
+ setLoading(false);
+ }
+ };
+
+ const CreateRoutine = async (body) => {
+ setLoading(true);
+ try {
+ const data = await Chapar.post(
+ `${process.env.NEXT_PUBLIC_API_URL}/routine`,
+ JSON.stringify(body),
+ {
+ headers: {
+ Authorization: getToken(),
+ },
+ }
+ );
+ toast.success(`روتین ساخته شد`, {
+ position: "bottom-right",
+ closeOnClick: true,
+ });
+ setBottomSheetCreateRoutineOpen(false);
+ setLoading(false);
+ GetRoutines();
+ } catch ({ error, status }) {
+ toast.error(`${error.response.data.message}`, {
+ position: "bottom-right",
+ closeOnClick: true,
+ });
+ setLoading(false);
+ }
+ };
+ const UpdateRoutine = async (body) => {
+ setLoading(true);
+ try {
+ const data = await Chapar.put(
+ `${process.env.NEXT_PUBLIC_API_URL}/routine`,
+ body,
+
+ {
+ headers: {
+ Authorization: getToken(),
+ },
+ }
+ );
+ toast.success(`روتین ویرایش شد`, {
+ position: "bottom-right",
+ closeOnClick: true,
+ });
+
+ setBottomSheetCreateRoutineOpen(false);
+ setLoading(false);
+ GetRoutines();
+ } catch ({ error, status }) {
+ toast.error(`${error.response.data.message}`, {
+ position: "bottom-right",
+ closeOnClick: true,
+ });
+ setLoading(false);
+ }
+ };
+ const GetRoutines = async () => {
+ setLoading(true);
+ try {
+ const data = await Chapar.get(
+ `${process.env.NEXT_PUBLIC_API_URL}/routine?page=0`,
+
+ {
+ headers: {
+ Authorization: getToken(),
+ },
+ }
+ );
+ console.log("GetRoutines", GetRoutines);
+
+ setRoutinesData(data);
+ setLoading(false);
+ } catch ({ error, status }) {
+ toast.error(`${error.response.data.message}`, {
+ position: "bottom-right",
+ closeOnClick: true,
+ });
+ setLoading(false);
+ }
+ };
+ const GetRoutine = async (id) => {
+ setLoading(true);
+ try {
+ const data = await Chapar.get(
+ `${process.env.NEXT_PUBLIC_API_URL}/routine/${id}`,
+
+ {
+ headers: {
+ Authorization: getToken(),
+ },
+ }
+ );
+ console.log("GetRoutine", GetRoutine);
+
+ setRoutineData(data);
+ setLoading(false);
+ } catch ({ error, status }) {
+ toast.error(`${error.response.data.message}`, {
+ position: "bottom-right",
+ closeOnClick: true,
+ });
+ setLoading(false);
+ }
+ };
+ const DeleteRoutine = async (id) => {
+ setLoading(true);
+ try {
+ const data = await Chapar.delete(
+ `${process.env.NEXT_PUBLIC_API_URL}/routine/${id}`,
+
+ {
+ headers: {
+ Authorization: getToken(),
+ },
+ }
+ );
+ setBottomSheetCreateRoutineOpen(false);
+
+ setLoading(false);
+ GetRoutines();
+ } catch ({ error, status }) {
+ toast.error(`${error.response.data.message}`, {
+ position: "bottom-right",
+ closeOnClick: true,
+ });
+ setLoading(false);
+ }
+ };
+
+ const CreatePosition = async (body) => {
+ setLoading(true);
+ try {
+ const data = await Chapar.post(
+ `${process.env.NEXT_PUBLIC_API_URL}/position`,
+ JSON.stringify(body),
+ {
+ headers: {
+ Authorization: getToken(),
+ },
+ }
+ );
+ toast.success(`پوزیشن ساخته شد`, {
+ position: "bottom-right",
+ closeOnClick: true,
+ });
+ setBottomSheetCreatePositionOpen(false);
+ setLoading(false);
+ GetPositions();
+ } catch ({ error, status }) {
+ toast.error(`${error.response.data.message}`, {
+ position: "bottom-right",
+ closeOnClick: true,
+ });
+ setLoading(false);
+ }
+ };
+ const UpdatePosition = async (body) => {
+ setLoading(true);
+ try {
+ const data = await Chapar.put(
+ `${process.env.NEXT_PUBLIC_API_URL}/position`,
+ body,
+
+ {
+ headers: {
+ Authorization: getToken(),
+ },
+ }
+ );
+ toast.success(`پوزیشن ویرایش شد`, {
+ position: "bottom-right",
+ closeOnClick: true,
+ });
+
+ setBottomSheetCreatePositionOpen(false);
+ setLoading(false);
+ GetPositions();
+ } catch ({ error, status }) {
+ toast.error(`${error.response.data.message}`, {
+ position: "bottom-right",
+ closeOnClick: true,
+ });
+ setLoading(false);
+ }
+ };
+ const GetPositions = async () => {
+ setLoading(true);
+ try {
+ const data = await Chapar.get(
+ `${process.env.NEXT_PUBLIC_API_URL}/position?page=0`,
+
+ {
+ headers: {
+ Authorization: getToken(),
+ },
+ }
+ );
+ console.log("GetPositions", data);
+
+ setPositionsData(data);
+ setLoading(false);
+ } catch ({ error, status }) {
+ toast.error(`${error.response.data.message}`, {
+ position: "bottom-right",
+ closeOnClick: true,
+ });
+ setLoading(false);
+ }
+ };
+ const GetPosition = async (id) => {
+ setLoading(true);
+ try {
+ const data = await Chapar.get(
+ `${process.env.NEXT_PUBLIC_API_URL}/position/${id}`,
+
+ {
+ headers: {
+ Authorization: getToken(),
+ },
+ }
+ );
+ console.log("GetPosition", data);
+
+ setPositionData(data);
+ setLoading(false);
+ } catch ({ error, status }) {
+ toast.error(`${error.response.data.message}`, {
+ position: "bottom-right",
+ closeOnClick: true,
+ });
+ setLoading(false);
+ }
+ };
+ const DeletePosition = async (id) => {
+ setLoading(true);
+ try {
+ const data = await Chapar.delete(
+ `${process.env.NEXT_PUBLIC_API_URL}/position/${id}`,
+
+ {
+ headers: {
+ Authorization: getToken(),
+ },
+ }
+ );
+ setBottomSheetCreatePositionOpen(false);
+
+ setLoading(false);
+ GetPositions();
+ } catch ({ error, status }) {
+ toast.error(`${error.response.data.message}`, {
+ position: "bottom-right",
+ closeOnClick: true,
+ });
+ setLoading(false);
+ }
+ };
+
const CheckUser = async () => {
setLoading(true);
try {
@@ -655,6 +1074,23 @@ export default function RootLayout({ children }) {
profile,
searchUserChoose,
BottomManageShiftOpen,
+ idEditSection,
+ goToEditSection,
+ sectionData,
+ sectionsData,
+ BottomSheetCreateSectionOpen,
+ BottomSheetCreateRoutineOpen,
+ idEditRoutine,
+ goToEditRoutine,
+ routineData,
+ routinesData,
+ dayOfWeeksChoose,
+ idEditPosition,
+ goToEditPosition,
+ positionData,
+ positionsData,
+ BottomSheetCreatePositionOpen,
+ sectionIdChoose,
},
setBottomSheetCreateRoleOpen,
setBottomSheetCreateEmployeesOpen,
@@ -694,21 +1130,50 @@ export default function RootLayout({ children }) {
UpdateUser,
setOpenTimePicker,
setEndAtTimeShift,
- setStartAtTimeShift,
- setTimePickerOrder,
- setShiftsData,
- CreateShift,
- GetShifts,
setIdEditShift,
setGoToEditShift,
- setShiftData,
+ setStartAtTimeShift,
+ setBottomManageShiftOpen,
+ GetShifts,
+ DeleteShift,
GetShift,
UpdateShift,
- DeleteShift,
- setProfile,
- CheckUser,
+ CreateShift,
+ setIdEditSection,
+ setGoToEditSection,
+ setSectionData,
+ setSectionsData,
+ setBottomSheetCreateSectionOpen,
+ DeleteSection,
+ GetSection,
+ GetSections,
+ UpdateSection,
+ CreateSection,
+ setBottomSheetCreateRoutineOpen,
+ setIdEditRoutine,
+ setGoToEditRoutine,
+ setRoutineData,
+ setRoutinesData,
+ DeleteRoutine,
+ GetRoutine,
+ GetRoutines,
+ UpdateRoutine,
+ CreateRoutine,
+ setDayOfWeeksChoose,
+ setShiftData,
+ setTimePickerOrder,
setSearchUserChoose,
- setBottomManageShiftOpen,
+ setIdEditPosition,
+ setGoToEditPosition,
+ setPositionData,
+ setPositionsData,
+ setBottomSheetCreatePositionOpen,
+ DeletePosition,
+ GetPosition,
+ GetPositions,
+ UpdatePosition,
+ CreatePosition,
+ setSectionIdChoose,
}}
>
diff --git a/src/app/routine/page.jsx b/src/app/routine/page.jsx
new file mode 100644
index 0000000..0dbe7db
--- /dev/null
+++ b/src/app/routine/page.jsx
@@ -0,0 +1,244 @@
+"use client";
+
+import AppHeader from "@comp/AppHeader/page";
+import AppContext from "@ctx/AppContext";
+import BottomSheetCreateRoutine from "plugins/BottomSheet/BottomSheetCreateRoutine";
+import PersianNumber from "plugins/PersianNumber";
+import React, { useContext } from "react";
+import { Swiper, SwiperSlide } from "swiper/react";
+import TaskCard from "@comp/TaskCard/page";
+import Link from "next/link";
+
+const page = () => {
+ const CTX = useContext(AppContext);
+
+ const routinesData = CTX.state.routinesData;
+
+ // const goToEditRole = (id) => {
+ // CTX.setGoToEditRole(true);
+ // CTX.setBottomSheetCreateRoleOpen(true);
+ // CTX.setIdEditRole(id);
+ // };
+
+ return (
+
+
CTX.setBottomSheetCreateRoutineOpen(true)}
+ icon2={true}
+ iconName2="ARROW"
+ iconHref2="/home"
+ iconEvent2={() => {
+ return undefined;
+ }}
+ />
+
+
+
+
تسک های هفتگی مجموعه
+
+ امروز
+
+
+
+ تسک فعال دارید
+
+
+
+
+
+
+
console.log("slide change")}
+ onSwiper={(swiper) => console.log(swiper)}
+ >
+
+
+
+
+ اهمیت بالا{" "}
+
+
+ شیفت صبح
+
+
+
+
+
+ کارگاه بدنسازی در خانه برای رستوران توگک
+
+
+
+
+
+
+
+
+ +
+
+
+
+ نفر دیگر
+
+
+
+
+
+
+
+ دوشنبه
+
+
+
+ اردیبهشت
+
+
+
+
+
+
+
+
+
+
+
+
+
+ اهمیت بالا{" "}
+
+
+ شیفت صبح
+
+
+
+
+
+ کارگاه بدنسازی در خانه برای رستوران توگک
+
+
+
+
+
+
+
+
+ +
+
+
+
+ نفر دیگر
+
+
+
+
+
+
+
+ دوشنبه
+
+
+
+ اردیبهشت
+
+
+
+
+
+
+
+
+
+
+
+
+
تسک های امروز
+
+ امروز
+
+
+
+ تسک فعال دارید
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default page;
diff --git a/src/app/shifts/manage-shift/page.jsx b/src/app/shifts/manage-shift/page.jsx
index 4ddbe5a..9bddff4 100644
--- a/src/app/shifts/manage-shift/page.jsx
+++ b/src/app/shifts/manage-shift/page.jsx
@@ -232,14 +232,10 @@ const Calendar = () => {
}
}}
style="text-right"
- // validatorData={validator.current.message(
- // "phoneNumber",
- // phoneNumber,
- // "required"
- // )}
select={true}
selectData={manageShiftEmployeesData}
theme={1}
+ defaultValue={"انتخاب کنید"}
/>
diff --git a/src/app/shifts/page.jsx b/src/app/shifts/page.jsx
index c7b0cf6..61c060d 100644
--- a/src/app/shifts/page.jsx
+++ b/src/app/shifts/page.jsx
@@ -3,13 +3,17 @@
import AppHeader from "@comp/AppHeader/page";
import ShiftCard from "@comp/ShiftComponent/ShiftCard/page";
import AppContext from "@ctx/AppContext";
+import Image from "next/image";
import Link from "next/link";
+import { useRouter } from "next/navigation";
+
import BottomSheetCreateShifts from "plugins/BottomSheet/BottomSheetCreateShifts";
import PersianNumber from "plugins/PersianNumber";
import React, { useContext, useEffect } from "react";
const Shifts = (props) => {
const CTX = useContext(AppContext);
+ const router = useRouter();
useEffect(() => {
CTX.GetShifts();
@@ -24,7 +28,9 @@ const Shifts = (props) => {
icon1={true}
iconName1="PLUS"
iconHref1="#"
- iconEvent1={() => CTX.setBottomSheetCreateShiftsOpen(true)}
+ iconEvent1={() => {
+ CTX.setBottomSheetCreateShiftsOpen(true);
+ }}
icon2={true}
iconName2="ARROW"
iconHref2="/home"
@@ -33,32 +39,37 @@ const Shifts = (props) => {
}}
/>
-