web/src/app/employees/page.jsx

311 lines
11 KiB
React
Raw Normal View History

2023-10-19 11:44:56 +03:30
"use client";
import AppHeader from "@comp/AppHeader/page";
2023-11-14 16:22:32 +03:30
import PositionEmployees from "@comp/EmployeesComponent/Position/page";
2023-10-19 11:44:56 +03:30
import RolesEmployees from "@comp/EmployeesComponent/Roles/page";
import Roles from "@comp/EmployeesComponent/Roles/page";
2023-11-14 16:22:32 +03:30
import SectionEmployees from "@comp/EmployeesComponent/Sections/page";
2023-10-19 11:44:56 +03:30
import UsersEmployees from "@comp/EmployeesComponent/Users/page";
2023-11-14 16:22:32 +03:30
import RoutineEmployees from "@comp/EmployeesComponent/routine/page";
2023-10-19 11:44:56 +03:30
import AppContext from "@ctx/AppContext";
import BottomSheetCreateEmployees from "plugins/BottomSheet/BottomSheetCreateEmployees";
2023-11-14 16:22:32 +03:30
import BottomSheetCreatePosition from "plugins/BottomSheet/BottomSheetCreatePosition";
2023-10-19 11:44:56 +03:30
import BottomSheetCreateRole from "plugins/BottomSheet/BottomSheetCreateRole";
2023-11-14 16:22:32 +03:30
import BottomSheetCreateRoutine from "plugins/BottomSheet/BottomSheetCreateRoutine";
import BottomSheetCreateSection from "plugins/BottomSheet/BottomSheetCreateSection";
2023-10-19 11:44:56 +03:30
import PersianNumber from "plugins/PersianNumber";
2023-11-14 16:22:32 +03:30
import React, { useContext, useEffect, useState } from "react";
2023-10-19 11:44:56 +03:30
// import second from "@img/test.png";
const Employees = (props) => {
const CTX = useContext(AppContext);
2023-11-14 16:22:32 +03:30
const [activeSection, setActiveSection] = useState(0);
2023-10-19 11:44:56 +03:30
useEffect(() => {
CTX.GetRoles();
2023-10-21 11:14:11 +03:30
CTX.GetUsers();
2023-11-14 16:22:32 +03:30
CTX.GetRoutines();
CTX.GetSections();
CTX.GetPositions();
2023-10-19 11:44:56 +03:30
}, []);
2023-11-14 16:22:32 +03:30
const routinesData = CTX.state.routinesData;
const sectionsData = CTX.state.sectionsData;
const usersData = CTX.state.usersData;
const positionsData = CTX.state.positionsData;
2023-10-19 11:44:56 +03:30
return (
<div className="pb-20">
<AppHeader
title=" مدیریت کارکنان و نقش ها"
sub=" شما 12 نفر همکار در مجموعه دارید"
icon2={true}
iconName2="ARROW"
iconHref2="/home"
iconEvent2={() => {
return undefined;
}}
/>
2023-11-14 16:22:32 +03:30
<div className="bg-body-100 relative top-[-30px] rounded-t-3xl overflow-hidden p-3 rtl">
<div>
<div
className="flex justify-between mt-7 bg-white rounded-2xl"
onClick={() => setActiveSection(0)}
>
<div className="flex p-2">
<div className="bg-gray-100 rounded-xl p-3 w-fit">
<p className="mb-0 text-center pt-3">
<PersianNumber number={1} style="text-[30px] " />
</p>
</div>
<div className="m-2">
<h4 className="text-base font-bold">
مدیریت روتین های مجموعه
</h4>
<p className="mb-0 text-[10px] opacity-90 ">
شما
<strong className="mx-1 text-primary-300">
<PersianNumber number={routinesData?.length} />
</strong>
روتین فعال دارید
</p>
</div>
</div>
{activeSection == 0 ? (
<div
className="w-[40px] h-[40px] bg-gray-100 shadow-sm rounded-xl m-[15px] "
onClick={() => CTX.setBottomSheetCreateRoutineOpen(true)}
>
<svg
width="22"
height="22"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
className="mx-auto mt-2 opacity-70"
>
<path
d="M8 1V15M1 8H15"
stroke="#2B2B2B"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</div>
) : (
<div className="w-[10px] h-[10px] bg-gray-200 shadow-sm rounded-xl m-[15px] "></div>
)}
</div>
{activeSection == 0 && <RoutineEmployees />}
</div>
{/* <div className="flex justify-between mt-3">
2023-10-19 11:44:56 +03:30
<div>
<h4 className="text-base font-bold">مدیریت نقش های مجموعه</h4>
2023-11-14 16:22:32 +03:30
<p className="mb-0 text-[10px] opacity-90 ">
2023-10-19 11:44:56 +03:30
شما
<strong className="mx-1 text-primary-300">
2023-11-14 16:22:32 +03:30
<PersianNumber number={rolesData?.length} />
2023-10-19 11:44:56 +03:30
</strong>
نقش فعال دارید
</p>
</div>
<div
className="w-[40px] h-[40px] bg-white shadow-sm rounded-xl "
onClick={() => CTX.setBottomSheetCreateRoleOpen(true)}
>
<svg
width="22"
height="22"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
className="mx-auto mt-2 opacity-70"
>
<path
d="M8 1V15M1 8H15"
stroke="#2B2B2B"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</div>
</div>
2023-11-14 16:22:32 +03:30
<RolesEmployees /> */}
2023-10-19 11:44:56 +03:30
2023-11-14 16:22:32 +03:30
<div>
<div
className="flex justify-between mt-7 bg-white rounded-2xl"
onClick={() => setActiveSection(1)}
>
<div className="flex p-2">
<div className="bg-gray-100 rounded-xl p-3 w-fit">
<p className="mb-0 text-center pt-3">
<PersianNumber number={2} style="text-[30px] " />
</p>
</div>
<div className="m-2">
<h4 className="text-base font-bold">مدیریت سکشن ها مجموعه</h4>
<p className="mb-0 text-[10px] opacity-90 ">
شما
<strong className="mx-1 text-primary-300">
<PersianNumber number={sectionsData?.length} />
</strong>
سکشن فعال دارید
</p>
</div>
</div>
{activeSection == 1 ? (
<div
className="w-[40px] h-[40px] bg-gray-100 shadow-sm rounded-xl m-[15px] "
onClick={() => CTX.setBottomSheetCreateSectionOpen(true)}
>
<svg
width="22"
height="22"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
className="mx-auto mt-2 opacity-70"
>
<path
d="M8 1V15M1 8H15"
stroke="#2B2B2B"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</div>
) : (
<div className="w-[10px] h-[10px] bg-gray-200 shadow-sm rounded-xl m-[15px] "></div>
)}
2023-10-19 11:44:56 +03:30
</div>
2023-11-14 16:22:32 +03:30
{activeSection == 1 && <SectionEmployees />}
</div>
2023-10-19 11:44:56 +03:30
2023-11-14 16:22:32 +03:30
<div>
2023-10-19 11:44:56 +03:30
<div
2023-11-14 16:22:32 +03:30
className="flex justify-between mt-7 bg-white rounded-2xl"
onClick={() => setActiveSection(2)}
2023-10-19 11:44:56 +03:30
>
2023-11-14 16:22:32 +03:30
<div className="flex p-2">
<div className="bg-gray-100 rounded-xl p-3 w-fit">
<p className="mb-0 text-center pt-3">
<PersianNumber number={3} style="text-[30px] " />
</p>
</div>
<div className="m-2">
<h4 className="text-base font-bold">
مدیریت پوزیشن های مجموعه
</h4>
<p className="mb-0 text-[10px] opacity-90 ">
شما
<strong className="mx-1 text-primary-300">
<PersianNumber number={positionsData?.length} />
</strong>
پوزیشن فعال دارید
</p>
</div>
</div>
{activeSection == 2 ? (
<div
className="w-[40px] h-[40px] bg-gray-100 shadow-sm rounded-xl m-[15px] "
onClick={() => CTX.setBottomSheetCreatePositionOpen(true)}
>
<svg
width="22"
height="22"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
className="mx-auto mt-2 opacity-70"
>
<path
d="M8 1V15M1 8H15"
stroke="#2B2B2B"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</div>
) : (
<div className="w-[10px] h-[10px] bg-gray-200 shadow-sm rounded-xl m-[15px] "></div>
)}
2023-10-19 11:44:56 +03:30
</div>
2023-11-14 16:22:32 +03:30
{activeSection == 2 && <PositionEmployees />}
2023-10-19 11:44:56 +03:30
</div>
2023-11-14 16:22:32 +03:30
<div>
<div
className="flex justify-between mt-7 bg-white rounded-2xl"
onClick={() => setActiveSection(3)}
>
<div className="flex p-2">
<div className="bg-gray-100 rounded-xl p-3 w-fit">
<p className="mb-0 text-center pt-3">
<PersianNumber number={4} style="text-[30px] " />
</p>
</div>
<div className="m-2">
<h4 className="text-base font-bold">مدیریت کارکنان مجموعه</h4>
<p className="mb-0 text-[10px] opacity-90 ">
شما
<strong className="mx-1 text-primary-300">
<PersianNumber number={usersData?.length} />
</strong>
کارمند فعال دارید
</p>
</div>
</div>
{activeSection == 3 ? (
<div
className="w-[40px] h-[40px] bg-gray-100 shadow-sm rounded-xl m-[15px] "
onClick={() => CTX.setBottomSheetCreateEmployeesOpen(true)}
>
<svg
width="22"
height="22"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
className="mx-auto mt-2 opacity-70"
>
<path
d="M8 1V15M1 8H15"
stroke="#2B2B2B"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</div>
) : (
<div className="w-[10px] h-[10px] bg-gray-200 shadow-sm rounded-xl m-[15px] "></div>
)}
</div>
{activeSection == 3 && <UsersEmployees />}
</div>
2023-10-19 11:44:56 +03:30
</div>
2023-11-14 16:22:32 +03:30
{/* <BottomSheetCreateRole /> */}
2023-10-19 11:44:56 +03:30
<BottomSheetCreateEmployees />
2023-11-14 16:22:32 +03:30
<BottomSheetCreateSection />
<BottomSheetCreateRoutine />
<BottomSheetCreatePosition />
2023-10-19 11:44:56 +03:30
</div>
);
};
export default Employees;