"use client";

import AppHeader from "@comp/AppHeader/page";
import RolesEmployees from "@comp/EmployeesComponent/Roles/page";
import Roles from "@comp/EmployeesComponent/Roles/page";
import UsersEmployees from "@comp/EmployeesComponent/Users/page";
import AppContext from "@ctx/AppContext";
import BottomSheetCreateEmployees from "plugins/BottomSheet/BottomSheetCreateEmployees";
import BottomSheetCreateRole from "plugins/BottomSheet/BottomSheetCreateRole";
import PersianNumber from "plugins/PersianNumber";
import React, { useContext, useEffect } from "react";

// import second from "@img/test.png";

const Employees = (props) => {
  const CTX = useContext(AppContext);

  useEffect(() => {
    CTX.GetRoles();
    CTX.GetUsers();
  }, []);

  return (
    <div className="pb-20">
      <AppHeader
        title="  مدیریت کارکنان و نقش ها"
        sub=" شما 12 نفر همکار در مجموعه دارید"
        icon2={true}
        iconName2="ARROW"
        iconHref2="/home"
        iconEvent2={() => {
          return undefined;
        }}
      />

      <div className="bg-body-100 relative top-[-30px] rounded-t-3xl overflow-hidden p-5 rtl">
        <div className="flex justify-between mt-3">
          <div>
            <h4 className="text-base  font-bold">مدیریت نقش های مجموعه</h4>
            <p className="mb-0 text-sm">
              شما
              <strong className="mx-1 text-primary-300">
                <PersianNumber number={24} />
              </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>

        <RolesEmployees />

        <div className="flex justify-between mt-7">
          <div>
            <h4 className="text-base  font-bold">مدیریت کارکنان مجموعه</h4>
            <p className="mb-0 text-sm">
              شما
              <strong className="mx-1 text-primary-300">
                <PersianNumber number={24} />
              </strong>
              کارمند فعال دارید
            </p>
          </div>

          <div
            className="w-[40px] h-[40px] bg-white shadow-sm rounded-xl "
            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>

        <UsersEmployees />
      </div>
      <BottomSheetCreateRole />
      <BottomSheetCreateEmployees />
    </div>
  );
};

export default Employees;
