Merge branch 'main' of https://git.vnfco.ir/Brizco/web
commit
cc02701fd9
|
@ -1,6 +1,7 @@
|
||||||
"use client";
|
"use client";
|
||||||
import AppContext from "@ctx/AppContext";
|
import AppContext from "@ctx/AppContext";
|
||||||
import Avatar from "boring-avatars";
|
import Avatar from "boring-avatars";
|
||||||
|
import BottomFilterActivities from "plugins/BottomSheet/BottomFilterActivities";
|
||||||
import Buttonbriz from "plugins/Buttonbriz/page";
|
import Buttonbriz from "plugins/Buttonbriz/page";
|
||||||
import Input from "plugins/Input/page";
|
import Input from "plugins/Input/page";
|
||||||
import React, { useContext, useRef, useState } from "react";
|
import React, { useContext, useRef, useState } from "react";
|
||||||
|
@ -47,6 +48,7 @@ const ActivityCard = ({ data }) => {
|
||||||
CTX.DoneActivity(data.id);
|
CTX.DoneActivity(data.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log("data", data);
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={` p-2 overflow-hidden ${
|
className={` p-2 overflow-hidden ${
|
||||||
|
@ -78,6 +80,9 @@ const ActivityCard = ({ data }) => {
|
||||||
{data?.shiftTitle}
|
{data?.shiftTitle}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className=" w-fit relative text-[11px] rounded-full bg-gray-300 text-black px-2 h-fit">
|
||||||
|
{data?.userFullName}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "brizco",
|
"name": "brizco",
|
||||||
"version": "0.2.3",
|
"version": "0.2.5",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import React, { useContext, useEffect, useRef, useState } from "react";
|
||||||
|
import { BottomSheet } from "react-spring-bottom-sheet";
|
||||||
|
import Input from "plugins/Input/page";
|
||||||
|
import AppContext from "@ctx/AppContext";
|
||||||
|
import SimpleReactValidator from "simple-react-validator";
|
||||||
|
import CheckBoxBriz from "plugins/CheckBoxBriz/page";
|
||||||
|
import Buttonbriz from "plugins/Buttonbriz/page";
|
||||||
|
import { toast } from "react-toastify";
|
||||||
|
import moment from "jalali-moment";
|
||||||
|
|
||||||
|
const BottomFilterActivities = (props) => {
|
||||||
|
const CTX = useContext(AppContext);
|
||||||
|
const [typeFilter, setTypeFilter] = useState(0);
|
||||||
|
|
||||||
|
const handleFilterActivity = (num) => {
|
||||||
|
setTypeFilter(num);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleChangeFilter = () => {
|
||||||
|
CTX.GetActivity(null, null, 0, typeFilter);
|
||||||
|
CTX.setBottomFilterActivitiesOpen(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<BottomSheet
|
||||||
|
// onSpringStart={(e) => handleBottomSheetCreateRole(e)}
|
||||||
|
open={CTX.state.BottomFilterActivitiesOpen}
|
||||||
|
onDismiss={() => CTX.setBottomFilterActivitiesOpen(false)}
|
||||||
|
blocking={false}
|
||||||
|
>
|
||||||
|
<div className="text-center py-2 bg-primary-300 ">
|
||||||
|
<p className="mb-0 text-white relative top-[-5px]">فیلتر اکتیویتی</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="bg-body-100 p-3 ">
|
||||||
|
<div
|
||||||
|
className={`rounded-xl border-[1px] border-gray-200 p-5 m-2 tr03 ${
|
||||||
|
typeFilter == 0 ? " bg-primary-100" : "bg-gray-100 "
|
||||||
|
}`}
|
||||||
|
onClick={() => handleFilterActivity(0)}
|
||||||
|
>
|
||||||
|
<p className="mb-0 text-right">اکتیویتی های امروز</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
className={`rounded-xl border-[1px] border-gray-200 p-5 m-2 tr03 ${
|
||||||
|
typeFilter == 1 ? " bg-primary-100" : "bg-gray-100 "
|
||||||
|
}`}
|
||||||
|
onClick={() => handleFilterActivity(1)}
|
||||||
|
>
|
||||||
|
<p className="mb-0 text-right">اکتیویتی های فردا</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
className={`rounded-xl border-[1px] border-gray-200 p-5 m-2 tr03 ${
|
||||||
|
typeFilter == 2 ? " bg-primary-100" : "bg-gray-100 "
|
||||||
|
}`}
|
||||||
|
onClick={() => handleFilterActivity(2)}
|
||||||
|
>
|
||||||
|
<p className="mb-0 text-right">اکتیویتی های هفته</p>
|
||||||
|
</div>
|
||||||
|
<Buttonbriz
|
||||||
|
title="اعمال فیلتر"
|
||||||
|
color="PRIMARY"
|
||||||
|
icon="CHECK"
|
||||||
|
buttonEvent={() => handleChangeFilter()}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</BottomSheet>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default BottomFilterActivities;
|
|
@ -40,6 +40,8 @@ export default function RootLayout({ children }) {
|
||||||
useState(false);
|
useState(false);
|
||||||
|
|
||||||
const [BottomManageShiftOpen, setBottomManageShiftOpen] = useState(false);
|
const [BottomManageShiftOpen, setBottomManageShiftOpen] = useState(false);
|
||||||
|
const [BottomFilterActivitiesOpen, setBottomFilterActivitiesOpen] =
|
||||||
|
useState(false);
|
||||||
const [BottomSheetCreateRoutineOpen, setBottomSheetCreateRoutineOpen] =
|
const [BottomSheetCreateRoutineOpen, setBottomSheetCreateRoutineOpen] =
|
||||||
useState(false);
|
useState(false);
|
||||||
const [BottomSheetCreateSectionOpen, setBottomSheetCreateSectionOpen] =
|
const [BottomSheetCreateSectionOpen, setBottomSheetCreateSectionOpen] =
|
||||||
|
@ -1289,13 +1291,15 @@ export default function RootLayout({ children }) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const GetActivity = async (date, shift, page) => {
|
const GetActivity = async (date, shift, page, dateQueryFilter) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
const data = await Chapar.get(
|
const data = await Chapar.get(
|
||||||
`${process.env.NEXT_PUBLIC_API_URL}/activity?page=${page}${
|
`${process.env.NEXT_PUBLIC_API_URL}/activity?page=${page}${
|
||||||
date ? `&selectedDate=${date}` : ""
|
date ? `&selectedDate=${date}` : ""
|
||||||
}${shift ? `&selectedShift=${shift}` : ""}`,
|
}${shift ? `&selectedShift=${shift}` : ""}${
|
||||||
|
dateQueryFilter != null ? `&dateQueryFilter=${dateQueryFilter}` : ""
|
||||||
|
}`,
|
||||||
|
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -1631,6 +1635,7 @@ export default function RootLayout({ children }) {
|
||||||
shiftPlansData,
|
shiftPlansData,
|
||||||
BottomSheetReportOpen,
|
BottomSheetReportOpen,
|
||||||
reportDetail,
|
reportDetail,
|
||||||
|
BottomFilterActivitiesOpen,
|
||||||
},
|
},
|
||||||
setBottomSheetCreateRoleOpen,
|
setBottomSheetCreateRoleOpen,
|
||||||
setBottomSheetCreateEmployeesOpen,
|
setBottomSheetCreateEmployeesOpen,
|
||||||
|
@ -1752,6 +1757,7 @@ export default function RootLayout({ children }) {
|
||||||
setReportDetail,
|
setReportDetail,
|
||||||
ReportShiftPlan,
|
ReportShiftPlan,
|
||||||
ReportTask,
|
ReportTask,
|
||||||
|
setBottomFilterActivitiesOpen,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
|
@ -65,6 +65,8 @@ const Shifts = (props) => {
|
||||||
groupObjectsByPlanFor(shiftplansData);
|
groupObjectsByPlanFor(shiftplansData);
|
||||||
}, [shiftplansData]);
|
}, [shiftplansData]);
|
||||||
|
|
||||||
|
console.log(shiftplans[0]?.data[0]?.users);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="pb-20">
|
<div className="pb-20">
|
||||||
|
@ -142,12 +144,29 @@ const Shifts = (props) => {
|
||||||
{shiftPlansSelect == index && (
|
{shiftPlansSelect == index && (
|
||||||
<>
|
<>
|
||||||
{e.data.map((e) => (
|
{e.data.map((e) => (
|
||||||
|
<div className="">
|
||||||
|
<div className="flex justify-between">
|
||||||
<div className="ml-2 rounded-xl mt-3 p-2">
|
<div className="ml-2 rounded-xl mt-3 p-2">
|
||||||
<p className="text-sm mb-0 text-gray-700 font-medium">
|
<p className="text-sm mb-0 text-gray-700 font-medium">
|
||||||
{" "}
|
{" "}
|
||||||
{e.shiftTitle}
|
{e.shiftTitle}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex flex-wrap">
|
||||||
|
{e.users.map((i) => (
|
||||||
|
<div className="flex bg-primary-100 p-1 rounded-full w-fit m-1">
|
||||||
|
<p className="mb-0 text-[12px] font-medium">
|
||||||
|
{i.positionName} :{" "}
|
||||||
|
</p>{" "}
|
||||||
|
<p className="mb-0 text-[12px] mr-1">
|
||||||
|
{i.userFullName}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
))}
|
))}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -14,6 +14,8 @@ import HasPermission from "plugins/HasPermission/page";
|
||||||
import GoBack from "plugins/GoBack/page";
|
import GoBack from "plugins/GoBack/page";
|
||||||
import InfiniteScroll from "react-infinite-scroll-component";
|
import InfiniteScroll from "react-infinite-scroll-component";
|
||||||
import Loading from "plugins/Loading/page";
|
import Loading from "plugins/Loading/page";
|
||||||
|
import { useLongPress } from "@uidotdev/usehooks";
|
||||||
|
import BottomFilterActivities from "plugins/BottomSheet/BottomFilterActivities";
|
||||||
|
|
||||||
const page = () => {
|
const page = () => {
|
||||||
const CTX = useContext(AppContext);
|
const CTX = useContext(AppContext);
|
||||||
|
@ -63,6 +65,15 @@ const page = () => {
|
||||||
CTX.setBottomSheetReportOpen(true);
|
CTX.setBottomSheetReportOpen(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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);
|
console.log(activities.length);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -126,6 +137,7 @@ const page = () => {
|
||||||
typeTask == 1 ? "bg-secondary-100" : ""
|
typeTask == 1 ? "bg-secondary-100" : ""
|
||||||
} `}
|
} `}
|
||||||
onClick={() => setTypeTask(1)}
|
onClick={() => setTypeTask(1)}
|
||||||
|
{...attrs}
|
||||||
>
|
>
|
||||||
<p
|
<p
|
||||||
className={`mb-0 text-center text-sm ${
|
className={`mb-0 text-center text-sm ${
|
||||||
|
@ -213,6 +225,7 @@ const page = () => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<BottomSheetCreateRoutine />
|
<BottomSheetCreateRoutine />
|
||||||
|
<BottomFilterActivities />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue