pre login user
parent
e21571d5f8
commit
9cff169537
16
.env
16
.env
|
@ -1,16 +1,20 @@
|
|||
NODE_ENV="development"
|
||||
|
||||
NEXT_PUBLIC_SERVER_URL=http://192.168.88.12:32769
|
||||
NEXT_PUBLIC_PUBLIC_URL=http://192.168.88.12:32769
|
||||
NEXT_PUBLIC_API_URL=http://192.168.88.12:32769/api
|
||||
# NEXT_PUBLIC_SERVER_URL=http://192.168.88.12:32769
|
||||
# NEXT_PUBLIC_PUBLIC_URL=http://192.168.88.12:32769
|
||||
# NEXT_PUBLIC_API_URL=http://192.168.88.12:32769/api
|
||||
# SECURE_LOCAL_STORAGE_HASH_KEY=f1da2b2c7a4c446934267fea631102ec389b5b99
|
||||
# NEXT_PUBLIC_API_URL_IMAGE=https://192.168.88.12:49154/Files/ReportImages
|
||||
# NEXT_PUBLIC_API_URL_BackUp=https://192.168.88.12:49154/Files/BackUps
|
||||
|
||||
NEXT_PUBLIC_SERVER_URL=https://j3884z97-32769.euw.devtunnels.ms
|
||||
NEXT_PUBLIC_PUBLIC_URL=https://j3884z97-32769.euw.devtunnels.ms
|
||||
NEXT_PUBLIC_API_URL=https://j3884z97-32769.euw.devtunnels.ms/api
|
||||
|
||||
|
||||
NEXT_PUBLIC_SERVER_URL=https://api.brizco.io
|
||||
NEXT_PUBLIC_PUBLIC_URL=https://api.brizco.io
|
||||
NEXT_PUBLIC_API_URL=https://api.brizco.io/api
|
||||
|
||||
# NEXT_PUBLIC_SERVER_URL=https://api.brizco.io
|
||||
# NEXT_PUBLIC_PUBLIC_URL=https://api.brizco.io
|
||||
# NEXT_PUBLIC_API_URL=https://api.brizco.io/api
|
||||
# NEXT_PUBLIC_API_URL_IMAGE=https://api.macsonline.ir/Files/ReportImages
|
||||
# NEXT_PUBLIC_API_URL_BackUp=https://api.macsonline.ir/Files/BackUps
|
|
@ -14,8 +14,10 @@ const AppHeader = ({
|
|||
iconName2,
|
||||
iconHref2,
|
||||
iconEvent2,
|
||||
iconEvent3,
|
||||
userIcon,
|
||||
userIconData,
|
||||
userRole,
|
||||
}) => {
|
||||
const icons = [
|
||||
{
|
||||
|
@ -94,6 +96,9 @@ const AppHeader = ({
|
|||
},
|
||||
];
|
||||
|
||||
// console.log("title", title);
|
||||
// console.log("sub", sub);
|
||||
|
||||
return (
|
||||
<div className=" bg-primary-300 flex justify-between rtl pt-4 px-4 pb-[50px] w-full">
|
||||
<div className="flex">
|
||||
|
@ -115,33 +120,42 @@ const AppHeader = ({
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex mt-2">
|
||||
{icon1 ? (
|
||||
<Link href={iconHref1}>
|
||||
<div
|
||||
className="w-[40px] h-[40px] bg-white rounded-full mx-1 pt-[3px]"
|
||||
onClick={iconEvent1}
|
||||
>
|
||||
{icons.find((e) => e.iconName == iconName1)?.icon}
|
||||
</div>
|
||||
</Link>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{!userRole ? (
|
||||
<div className="flex mt-2">
|
||||
{icon1 ? (
|
||||
<Link href={iconHref1}>
|
||||
<div
|
||||
className="w-[40px] h-[40px] bg-white rounded-full mx-1 pt-[3px]"
|
||||
onClick={iconEvent1}
|
||||
>
|
||||
{icons.find((e) => e.iconName == iconName1)?.icon}
|
||||
</div>
|
||||
</Link>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
|
||||
{icon2 ? (
|
||||
<Link href={iconHref2}>
|
||||
<div
|
||||
className="w-[40px] h-[40px] bg-white rounded-full mx-1 pt-[3px]"
|
||||
onClick={iconEvent2}
|
||||
>
|
||||
{icons.find((e) => e.iconName == iconName2)?.icon}
|
||||
</div>
|
||||
</Link>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</div>
|
||||
{icon2 ? (
|
||||
<Link href={iconHref2}>
|
||||
<div
|
||||
className="w-[40px] h-[40px] bg-white rounded-full mx-1 pt-[3px]"
|
||||
onClick={iconEvent2}
|
||||
>
|
||||
{icons.find((e) => e.iconName == iconName2)?.icon}
|
||||
</div>
|
||||
</Link>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<div
|
||||
className="w-fit h-fit bg-white rounded-full mx-1 "
|
||||
onClick={iconEvent3}
|
||||
>
|
||||
<p className="mb-0 p-2 px-4">{userRole && userRole[0]?.roleName}</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
"use client";
|
||||
|
||||
import React, { useContext } from "react";
|
||||
import { BottomSheet } from "react-spring-bottom-sheet";
|
||||
import AppContext from "@ctx/AppContext";
|
||||
import Buttonbriz from "plugins/Buttonbriz/page";
|
||||
|
||||
const BottomSheetChangeRole = (props) => {
|
||||
const CTX = useContext(AppContext);
|
||||
|
||||
const roles = CTX.state.profile.roles;
|
||||
|
||||
return (
|
||||
<BottomSheet
|
||||
open={CTX.state.BottomSheetChangeRoleOpen}
|
||||
onDismiss={() => CTX.setBottomSheetChangeRoleOpen(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 ">
|
||||
{roles?.map((e) => (
|
||||
<div className="bg-gray-100 rounded-xl border-[1px] border-gray-200 p-5 m-2">
|
||||
<p className="mb-0 text-right">{e.roleName}</p>
|
||||
</div>
|
||||
))}
|
||||
<Buttonbriz
|
||||
title="ثبت نقش"
|
||||
color="PRIMARY"
|
||||
icon="CHECK"
|
||||
// buttonEvent={() => handleCreateRoutine()}
|
||||
/>
|
||||
</div>
|
||||
</BottomSheet>
|
||||
);
|
||||
};
|
||||
|
||||
export default BottomSheetChangeRole;
|
|
@ -282,7 +282,7 @@ const BottomSheetCreateEmployees = (props) => {
|
|||
lable="شماره تماس"
|
||||
id="phoneNumber-id"
|
||||
name="phoneNumber"
|
||||
type={"text"}
|
||||
type={"number"}
|
||||
value={phoneNumber}
|
||||
inputEvent={(e) => {
|
||||
setPhoneNumber(e.target.value);
|
||||
|
|
|
@ -215,6 +215,7 @@ const BottomSheetCreateShifts = (props) => {
|
|||
startAtTimeShift,
|
||||
"required"
|
||||
)}
|
||||
readOnly={true}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import React, { useContext, useEffect } from "react";
|
|||
// import { Swiper, SwiperSlide } from "swiper/react";
|
||||
import { Chart as ChartJS, ArcElement, Tooltip, Legend } from "chart.js";
|
||||
import { Doughnut, Pie } from "react-chartjs-2";
|
||||
import BottomSheetChangeRole from "plugins/BottomSheet/BottomSheetChangeRole";
|
||||
|
||||
ChartJS.register(ArcElement, Tooltip, Legend);
|
||||
|
||||
|
@ -62,25 +63,17 @@ const Home = (props) => {
|
|||
}
|
||||
}, []);
|
||||
|
||||
console.log(profile);
|
||||
|
||||
return (
|
||||
<div className="pb-20">
|
||||
<AppHeader
|
||||
title={profile?.firstName + " " + profile?.lastName}
|
||||
sub={profile.selectedComplexName}
|
||||
icon1={true}
|
||||
iconName1="ACOUNT"
|
||||
iconHref1="/acount"
|
||||
iconEvent1={() => {
|
||||
return undefined;
|
||||
}}
|
||||
icon2={true}
|
||||
iconName2="NINJA"
|
||||
iconHref2="#"
|
||||
iconEvent2={() => {
|
||||
return undefined;
|
||||
}}
|
||||
title={profile?.user?.firstName + " " + profile?.user?.lastName}
|
||||
sub={profile?.user?.selectedRoleName}
|
||||
userIcon={true}
|
||||
userIconData={profile.firstName}
|
||||
userIconData={profile?.user?.firstName}
|
||||
userRole={profile?.roles}
|
||||
iconEvent3={() => CTX.setBottomSheetChangeRoleOpen(true)}
|
||||
/>
|
||||
|
||||
<div className="bg-body-100 relative top-[-30px] rounded-t-3xl overflow-hidden p-5 rtl">
|
||||
|
@ -117,7 +110,7 @@ const Home = (props) => {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div className="bg-white rounded-2xl p-3">
|
||||
<div className=" rounded-2xl p-3">
|
||||
<div className="flex justify-between ">
|
||||
<div>
|
||||
<div className="flex mt-3">
|
||||
|
@ -148,6 +141,8 @@ const Home = (props) => {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<BottomSheetChangeRole />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -51,6 +51,9 @@ export default function RootLayout({ children }) {
|
|||
setBottomSheetAddUserToPositionShiftPlanOpen,
|
||||
] = useState(false);
|
||||
|
||||
const [BottomSheetChangeRoleOpen, setBottomSheetChangeRoleOpen] =
|
||||
useState(false);
|
||||
|
||||
// BigPlus
|
||||
const [BigPlusOpen, setBigPlusOpen] = useState(false);
|
||||
const [BigPlusRotateIcon, setBigPlusRotateIcon] = useState(false);
|
||||
|
@ -60,8 +63,10 @@ export default function RootLayout({ children }) {
|
|||
const [verifyCode, setVerifyCode] = useState("");
|
||||
const [stepLogin, setStepLogin] = useState(0);
|
||||
const [tokenForStorage, setTokenForStorage] = useState(null);
|
||||
const [profile, setProfile] = useState([]);
|
||||
|
||||
// loading
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
//auth
|
||||
|
@ -121,6 +126,9 @@ export default function RootLayout({ children }) {
|
|||
const [goToEditTask, setGoToEditTask] = useState(false);
|
||||
const [idEditTask, setIdEditTask] = useState(null);
|
||||
|
||||
// activity
|
||||
const [activitiesData, setActivitiesData] = useState([null]);
|
||||
|
||||
// shift manage-shift
|
||||
const [searchUserChoose, setSearchUserChoose] = useState([]);
|
||||
|
||||
|
@ -128,8 +136,6 @@ export default function RootLayout({ children }) {
|
|||
const [openTimePicker, setOpenTimePicker] = useState(false);
|
||||
const [TimePickerOrder, setTimePickerOrder] = useState(null);
|
||||
|
||||
const [profile, setProfile] = useState([]);
|
||||
|
||||
const pathname = usePathname();
|
||||
const router = useRouter();
|
||||
const hiddenUrls = ["/login", "/"];
|
||||
|
@ -174,7 +180,7 @@ export default function RootLayout({ children }) {
|
|||
if (data.user.signUpStatus == 1) {
|
||||
setStepLogin(2);
|
||||
} else if (data.user.signUpStatus == 2) {
|
||||
setProfile(data.user);
|
||||
setProfile(data);
|
||||
toast.success(` ${data.user.firstName} جان خوش اومدی `, {
|
||||
position: "bottom-right",
|
||||
closeOnClick: true,
|
||||
|
@ -202,10 +208,12 @@ export default function RootLayout({ children }) {
|
|||
},
|
||||
}
|
||||
);
|
||||
|
||||
console.log("SignUpLogin", SignUpLogin);
|
||||
setLoading(false);
|
||||
|
||||
if (data.user.signUpStatus == 2 || data.user.signUpStatus == 3) {
|
||||
setProfile(data.user);
|
||||
setProfile(data);
|
||||
|
||||
toast.success(` ${data.user.firstName} جان خوش اومدی `, {
|
||||
position: "bottom-right",
|
||||
|
@ -1209,6 +1217,31 @@ export default function RootLayout({ children }) {
|
|||
}
|
||||
};
|
||||
|
||||
const GetActivity = async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const data = await Chapar.get(
|
||||
`${process.env.NEXT_PUBLIC_API_URL}/activity?page=0`,
|
||||
|
||||
{
|
||||
headers: {
|
||||
Authorization: getToken(),
|
||||
},
|
||||
}
|
||||
);
|
||||
console.log("GetActivity", data);
|
||||
|
||||
setActivitiesData(data);
|
||||
setLoading(false);
|
||||
} catch ({ error, status }) {
|
||||
toast.error(`${error.response.data.message}`, {
|
||||
position: "bottom-right",
|
||||
closeOnClick: true,
|
||||
});
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const CheckUser = async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
|
@ -1224,6 +1257,7 @@ export default function RootLayout({ children }) {
|
|||
console.log("CheckUser", data);
|
||||
|
||||
setProfile(data);
|
||||
|
||||
setLoading(false);
|
||||
} catch ({ error, status }) {
|
||||
toast.error(`${error.response.data.message}`, {
|
||||
|
@ -1302,6 +1336,8 @@ export default function RootLayout({ children }) {
|
|||
tasksData,
|
||||
routineShiftPlan,
|
||||
BottomSheetAddUserToPositionShiftPlanOpen,
|
||||
BottomSheetChangeRoleOpen,
|
||||
activitiesData,
|
||||
},
|
||||
setBottomSheetCreateRoleOpen,
|
||||
setBottomSheetCreateEmployeesOpen,
|
||||
|
@ -1402,6 +1438,9 @@ export default function RootLayout({ children }) {
|
|||
GetRoutineShiftPlan,
|
||||
setBottomSheetAddUserToPositionShiftPlanOpen,
|
||||
CreateShifPlan,
|
||||
setBottomSheetChangeRoleOpen,
|
||||
setActivitiesData,
|
||||
GetActivity,
|
||||
}}
|
||||
>
|
||||
<html lang="en">
|
||||
|
|
|
@ -153,6 +153,9 @@ const Calendar = () => {
|
|||
/>
|
||||
|
||||
<div className="bg-body-100 relative top-[-30px] rounded-t-3xl overflow-hidden p-4 rtl">
|
||||
<div className="font-bold text-right">
|
||||
<p className="mb-0">روتین را انتخاب کنید</p>
|
||||
</div>
|
||||
<div
|
||||
className="flex overflow-auto whitespace-nowrap mb-5"
|
||||
id="swich-shifts"
|
||||
|
@ -186,100 +189,112 @@ const Calendar = () => {
|
|||
</div>
|
||||
|
||||
{shiftPlanSteps >= 1 && (
|
||||
<Swiper
|
||||
spaceBetween={10}
|
||||
slidesPerView={4.3}
|
||||
onSlideChange={() => console.log("slide change")}
|
||||
onSwiper={(swiper) => console.log(swiper)}
|
||||
>
|
||||
{daysUntilWeek?.map((e, index) => (
|
||||
<SwiperSlide>
|
||||
<div
|
||||
className={`h-[70px] tr03 ${
|
||||
selectDay == index ? "bg-white rounded-xl" : " opacity-70"
|
||||
}`}
|
||||
key={index}
|
||||
onClick={() => {
|
||||
setSelectDay(index);
|
||||
setShiftPlanSteps(2);
|
||||
console.log(index);
|
||||
}}
|
||||
>
|
||||
<div className="py-2">
|
||||
<p className="mb-0 text-center ">
|
||||
<PersianNumber
|
||||
number={e.date}
|
||||
style={`text-[20px] ${
|
||||
selectDay == index
|
||||
? "font-bold"
|
||||
: !!holidays.y1402?.find(
|
||||
(b) => b.date == e.checkDay
|
||||
)
|
||||
? "text-red-500"
|
||||
: ""
|
||||
} `}
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<>
|
||||
<div className="font-bold text-right mt-3">
|
||||
<p className="mb-0">تاریخ را انتخاب کنید</p>
|
||||
</div>
|
||||
<Swiper
|
||||
spaceBetween={10}
|
||||
slidesPerView={4.3}
|
||||
onSlideChange={() => console.log("slide change")}
|
||||
onSwiper={(swiper) => console.log(swiper)}
|
||||
>
|
||||
{daysUntilWeek?.map((e, index) => (
|
||||
<SwiperSlide>
|
||||
<div
|
||||
className={`w-fit mx-auto sahdow px-1 rounded-full ${
|
||||
className={`h-[70px] tr03 ${
|
||||
selectDay == index
|
||||
? "bg-secondary-100 text-gray-100"
|
||||
: !!holidays.y1402?.find((b) => b.date == e.checkDay)
|
||||
? "bg-transparent text-red-500"
|
||||
: "bg-white text-gray-500"
|
||||
? "bg-white rounded-xl"
|
||||
: " opacity-70"
|
||||
}`}
|
||||
key={index}
|
||||
onClick={() => {
|
||||
setSelectDay(index);
|
||||
setShiftPlanSteps(2);
|
||||
console.log(index);
|
||||
}}
|
||||
>
|
||||
<p className="mb-0 text-center text-sm ">
|
||||
{/* {PersianD.find((i) => i == e.dayOfWeek)} */}
|
||||
{e.dayOfWeek}
|
||||
</p>
|
||||
<div className="py-2">
|
||||
<p className="mb-0 text-center ">
|
||||
<PersianNumber
|
||||
number={e.date}
|
||||
style={`text-[20px] ${
|
||||
selectDay == index
|
||||
? "font-bold"
|
||||
: !!holidays.y1402?.find(
|
||||
(b) => b.date == e.checkDay
|
||||
)
|
||||
? "text-red-500"
|
||||
: ""
|
||||
} `}
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className={`w-fit mx-auto sahdow px-1 rounded-full ${
|
||||
selectDay == index
|
||||
? "bg-secondary-100 text-gray-100"
|
||||
: !!holidays.y1402?.find((b) => b.date == e.checkDay)
|
||||
? "bg-transparent text-red-500"
|
||||
: "bg-white text-gray-500"
|
||||
}`}
|
||||
>
|
||||
<p className="mb-0 text-center text-sm ">
|
||||
{/* {PersianD.find((i) => i == e.dayOfWeek)} */}
|
||||
{e.dayOfWeek}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</SwiperSlide>
|
||||
))}
|
||||
</Swiper>
|
||||
</SwiperSlide>
|
||||
))}
|
||||
</Swiper>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{shiftPlanSteps >= 2 && (
|
||||
<div className="bg-body-100 relative top-[-30px] rounded-t-3xl overflow-hidden rtl">
|
||||
<>
|
||||
{!!routineShiftPlan?.find(
|
||||
(e) => e?.day == daysUntilWeek[selectDay]?.value
|
||||
) && shiftsData.length > 0 ? (
|
||||
<div
|
||||
className="flex overflow-auto whitespace-nowrap"
|
||||
id="swich-shifts"
|
||||
>
|
||||
{shiftsPlan?.map((e, index) => (
|
||||
<div
|
||||
className={` shadow-sm relative block max-w-fit mx-2 rounded-full mt-2 px-4 py-2 tr03 ${
|
||||
selectShift == index
|
||||
? "bg-secondary-100 text-white w-full"
|
||||
: "bg-white opacity-60 "
|
||||
}`}
|
||||
onClick={() => {
|
||||
setselectShift(index);
|
||||
setShiftPlanSteps(3);
|
||||
}}
|
||||
>
|
||||
<p className="mb-0">{e?.title}</p>
|
||||
</div>
|
||||
))}
|
||||
<>
|
||||
<div className="bg-body-100 relative top-[-40px] rounded-t-3xl overflow-hidden px-4 rtl">
|
||||
<>
|
||||
<div className="font-bold text-right mt-3">
|
||||
<p className="mb-0">شیفت را انتخاب کنید</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex justify-center ">
|
||||
<div className="bg-gray-300 mt-5 w-fit rounded-full p-2 !px-4">
|
||||
<p className="mb-0 text-gray-600 text-sm">
|
||||
شما شیفتی دراین روز ندارید
|
||||
</p>
|
||||
{!!routineShiftPlan?.find(
|
||||
(e) => e?.day == daysUntilWeek[selectDay]?.value
|
||||
) && shiftsData.length > 0 ? (
|
||||
<div
|
||||
className="flex overflow-auto whitespace-nowrap"
|
||||
id="swich-shifts"
|
||||
>
|
||||
{shiftsPlan?.map((e, index) => (
|
||||
<div
|
||||
className={` shadow-sm relative block max-w-fit mx-2 rounded-full mt-2 px-4 py-2 tr03 ${
|
||||
selectShift == index
|
||||
? "bg-secondary-100 text-white w-full"
|
||||
: "bg-white opacity-60 "
|
||||
}`}
|
||||
onClick={() => {
|
||||
setselectShift(index);
|
||||
setShiftPlanSteps(3);
|
||||
}}
|
||||
>
|
||||
<p className="mb-0">{e?.title}</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex justify-center ">
|
||||
<div className="bg-gray-300 mt-5 w-fit rounded-full p-2 !px-4">
|
||||
<p className="mb-0 text-gray-600 text-sm">
|
||||
شما شیفتی دراین روز ندارید
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{shiftPlanSteps >= 3 && (
|
||||
|
|
|
@ -19,6 +19,7 @@ const page = () => {
|
|||
|
||||
useEffect(() => {
|
||||
CTX.GetTasks();
|
||||
CTX.GetActivity();
|
||||
}, []);
|
||||
return (
|
||||
<div className="pb-20">
|
||||
|
|
Loading…
Reference in New Issue