diff --git a/src/app/layout.jsx b/src/app/layout.jsx
index 7860c76..a570845 100644
--- a/src/app/layout.jsx
+++ b/src/app/layout.jsx
@@ -984,11 +984,11 @@ export default function RootLayout({ children }) {
setLoading(false);
}
};
- const GetShifPlans = async (page) => {
+ const GetShifPlans = async (page, dataFilter) => {
setLoading(true);
try {
const data = await Chapar.get(
- `${process.env.NEXT_PUBLIC_API_URL}/shift/plan?page=${page}`,
+ `${process.env.NEXT_PUBLIC_API_URL}/shift/plan?page=${page}&dateFilter=${dataFilter}`,
{
headers: {
Authorization: "Bearer " + localStorage.getItem("token"),
@@ -1312,7 +1312,7 @@ export default function RootLayout({ children }) {
}
);
- if (data.length < 14) {
+ if (data.length < 19) {
setStopGetActivities(true);
}
@@ -1584,9 +1584,9 @@ export default function RootLayout({ children }) {
`);
const token = localStorage.getItem("token");
- if (!token) {
- router.push("/login");
- }
+ // if (!token) {
+ // router.push("/login");
+ // }
if (profile.length <= 0 && token) CheckUser();
}, []);
diff --git a/src/app/shifts/complete-shift/page.jsx b/src/app/shifts/complete-shift/page.jsx
index ccd5150..a97ca46 100644
--- a/src/app/shifts/complete-shift/page.jsx
+++ b/src/app/shifts/complete-shift/page.jsx
@@ -21,6 +21,7 @@ const CompleteShift = () => {
const [closeShiftScore, setCloseShiftScore] = useState(50);
const [activeShifPlan, setActiveShifPlan] = useState(-1);
const [selectDayForShift, setSelectDayForShift] = useState(-1);
+
const currentDate = new Date();
const siftsData = CTX.state.shiftsData;
@@ -70,6 +71,8 @@ const CompleteShift = () => {
};
const handleOpenShift = (isCompleted, id, index, hasCurrentShiftPlan) => {
+ CTX.setStopGetActivities(false);
+ CTX.setPageGetActivity(0);
if (isCompleted) {
toast.warning(`شیفت بسته شده است `, {
position: "bottom-right",
@@ -132,6 +135,7 @@ const CompleteShift = () => {
CTX.CloseShift(body, siftsData[activeShifPlan]?.currentShiftPlanId);
setActiveShifPlan(-1);
handleDayCloseShift(1);
+ CTX.GetShifts(moment().locale("fa").startOf("day").unix() * 1000);
},
[siftsData[activeShifPlan]?.currentShiftPlanId],
body
@@ -170,13 +174,34 @@ const CompleteShift = () => {
const handleInfiniteNextFetchActivity = () => {
CTX.setPageGetActivity((e) => e + 1);
- CTX.GetActivity(
- moment().locale("fa").startOf("day").unix() * 1000,
- null,
- pageGetActivity + 1
- );
+
+ if (selectDayForShift == 0) {
+ CTX.GetActivity(
+ moment().locale("fa").subtract(1, "day")?.unix() * 1000,
+ siftsData[activeShifPlan].id,
+ pageGetActivity + 1
+ );
+ } else if (selectDayForShift == 1) {
+ CTX.GetActivity(
+ moment().locale("fa").startOf("day").unix() * 1000,
+ siftsData[activeShifPlan].id,
+ pageGetActivity + 1
+ );
+ } else if (selectDayForShift == 2) {
+ CTX.GetActivity(
+ moment().locale("fa").add(1, "day").unix() * 1000,
+ siftsData[activeShifPlan].id,
+ pageGetActivity + 1
+ );
+ }
};
+ console.log(siftsData[activeShifPlan]);
+ console.log(
+ "getYesterdayPersianDate",
+ moment().locale("fa").subtract(1, "day")?.unix() * 1000
+ );
+
return (
{
{activeShifPlan == index && (
<>
diff --git a/src/app/shifts/page.jsx b/src/app/shifts/page.jsx
index be4cd38..e1da83f 100644
--- a/src/app/shifts/page.jsx
+++ b/src/app/shifts/page.jsx
@@ -18,9 +18,15 @@ const Shifts = (props) => {
const [shiftplans, setShiftplans] = useState([]);
const [shiftPlansSelect, setShiftPlansSelect] = useState(0);
+ const [shifilterShifPlaneSelect, setFilterShifPlaneSelect] = useState(0);
const shiftplansData = CTX.state.shiftPlansData;
+ const handleFilterGetShifPlane = (num, index) => {
+ setFilterShifPlaneSelect(index);
+ CTX.GetShifPlans(0, num);
+ };
+
const groupObjectsByPlanFor = (responseData) => {
const groupedData = {};
@@ -87,7 +93,8 @@ const Shifts = (props) => {
}
useEffect(() => {
- CTX.GetShifPlans(0);
+ CTX.GetShifPlans(0, 12);
+ setFilterShifPlaneSelect(1);
}, []);
useEffect(() => {
@@ -128,7 +135,7 @@ const Shifts = (props) => {
{HasPermission("ManageShiftPlans", permissions) && (
<>
-
+
شیفت بندی هفته{" "}
@@ -136,6 +143,100 @@ const Shifts = (props) => {
>
)}
+
+
handleFilterGetShifPlane(12, 1)}
+ >
+
+
+ شیفت های هفته{" "}
+
+
+
+
+
handleFilterGetShifPlane(22, 6)}
+ >
+
+
+ شیفت های ماه{" "}
+
+
+
+
+
handleFilterGetShifPlane(11, 2)}
+ >
+
+
+ شیفت های هفته بعد{" "}
+
+
+
+
+
handleFilterGetShifPlane(10, 3)}
+ >
+
+
+ شیفت های هفته قبل{" "}
+
+
+
+
+
handleFilterGetShifPlane(20, 4)}
+ >
+
+
+ شیفت های ماه قبل{" "}
+
+
+
+
+
handleFilterGetShifPlane(21, 5)}
+ >
+
+
+ شیفت های ماه بعد{" "}
+
+
+
+
{shiftplans.length <= 0 ? (
diff --git a/src/app/tasks/page.jsx b/src/app/tasks/page.jsx
index 740c7d7..2356f5b 100644
--- a/src/app/tasks/page.jsx
+++ b/src/app/tasks/page.jsx
@@ -112,11 +112,11 @@ const page = () => {
)}
-
CTX.setBottomFilterActivitiesOpen(true)}
- >
-
+
+
CTX.setBottomFilterActivitiesOpen(true)}
+ >