import { aj as requireInteropRequireDefault, ak as requireCreateSvgIcon, al as requireJsxRuntime, am as getDefaultExportFromCjs, r as reactExports, j as jsxRuntimeExports, d as Box, G as Grid, aw as Params, B as Button, ap as smetaModals, bv as EditStyle, b2 as defaultFieldInfo, as as dayjs, u as useAtomValue, cx as isAdminAtom, aY as configEnabledAtom, bg as smetaAxios, aN as ObjType, bf as Prefixes, d0 as checkRightsFlag, aM as checkCurrentUserRights, d1 as getCurrentUserRights, a6 as GridLoader, cT as getDateForDateObj, aU as ContextMenu, bw as PostAddIcon, bx as DeleteIcon, cS as GetDocDialogParams, ar as getStyleWindow, cX as getAmountDocTypes, aE as ViewClass, b3 as getDateOfInt, a$ as getObjText, cR as ObjNameFlag, V as isEmptyObject, v as renderMessageBox, aS as Button$1, aT as DlgType, bj as getIntOfStrDate, b7 as selectedSectionAtom, z as currentTheme, bt as animationsAtom, c6 as getMonthInfo, bu as getStaffSettings, c$ as setColor, d2 as DelphiColors, d3 as GetTableLayout, ae as getRightsData, af as parseColumns, x as Grid2, T as Tooltip, I as IconButton, bR as ImgURL, bS as getIcons, ct as Divider, bM as SectionToolsJS, bG as SmetaTabs, bH as SmetaTabItem, ax as SplitterLocal, a3 as Tree, bb as clsx, cy as createRecordSource, cF as getRendHistoryParams, b4 as updateGridData, ba as CheckMultiSelect, d4 as DialogHistory } from "./index-D15x63tD.js";
import { M as MonthYearPicker } from "./MonthYearPicker-CnPllbI6.js";
import { S as SearchPersons } from "./SearchPersons-C1hfxGSb.js";
import { A as Amounts, J as JobHistoryList } from "./Amounts-D9Fd5gdh.js";
import SectionDocumentsChose from "./SectionDocumentsChose-CWNMUy0u.js";
import SectionReports from "./SectionReports-CR4VT6wR.js";
import DialogDoc from "./DialogDoc-BCKCegu0.js";
import DialogDocTabs from "./DialogDocTabs-ExyRNCmU.js";
import DialogOficialStructure from "./DialogOficialStructure-CvZZAODg.js";
import "./LocalParams-Dz-ktk1o.js";
var Forward = {};
var hasRequiredForward;
function requireForward() {
  if (hasRequiredForward) return Forward;
  hasRequiredForward = 1;
  var _interopRequireDefault = requireInteropRequireDefault();
  Object.defineProperty(Forward, "__esModule", {
    value: true
  });
  Forward.default = void 0;
  var _createSvgIcon = _interopRequireDefault(/* @__PURE__ */ requireCreateSvgIcon());
  var _jsxRuntime = requireJsxRuntime();
  Forward.default = (0, _createSvgIcon.default)(/* @__PURE__ */ (0, _jsxRuntime.jsx)("path", {
    d: "M12 8V4l8 8-8 8v-4H4V8z"
  }), "Forward");
  return Forward;
}
var ForwardExports = /* @__PURE__ */ requireForward();
const ForwardIcon = /* @__PURE__ */ getDefaultExportFromCjs(ForwardExports);
function DialogChangeObjParams({ dataParams, onSelect, smetaModalId }) {
  const values = reactExports.useRef({});
  async function handleEditParams(res, data) {
    const shortName = data.record.dataset.shortname;
    values.current[shortName] = {
      ObjRef: res.Values[0].ObjRef,
      DataType: data.record.dataset.datatype,
      Value: res.Values[0].Value,
      CheckState: res.Values[0].CheckState
    };
    Object.keys(values.current[shortName]).forEach((key) => {
      if (values.current[shortName][key] === void 0) delete values.current[shortName][key];
    });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { style: { width: "100%", height: "calc(100% - 40px)" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      Grid,
      {
        style: {
          width: "100%",
          height: "100%",
          border: "1px solid #cccccc",
          position: "relative",
          overflow: "hidden"
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(Params, { data: dataParams, NoTitle: true, onEditParams: handleEditParams, notRefresh: true })
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { style: { height: "35px", width: "100%", marginTop: "5px" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Grid, { container: true, direction: "row", justifyContent: "flex-end", alignItems: "center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { item: true, children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          size: "small",
          variant: "outlined",
          style: { textTransform: "none", marginRight: "10px" },
          value: "1",
          className: "button_Modal_Select",
          onClick: () => {
            onSelect(values.current);
            smetaModals.close(smetaModalId);
          },
          children: "Выбрать"
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          size: "small",
          variant: "outlined",
          style: { textTransform: "none" },
          value: "2",
          className: "button_Modal_Close",
          onClick: () => {
            smetaModals.close(smetaModalId);
          },
          children: "Отмена"
        }
      )
    ] }) }) })
  ] });
}
const recordKeysRendHistory = [
  "ID",
  "RenderingID",
  "PersonID",
  "PersonText",
  "TabNum",
  "RateCount",
  "JobMode",
  "FirstDate",
  "FirstDateInt",
  "FirstMode",
  "Document",
  "DocumentText",
  "LastDate",
  "LastDoc",
  "LastDocText",
  "FinalDate",
  "FinalMode",
  "NextAppointment",
  "NextAppointmentText",
  "NextID",
  "NewNextRndID",
  "RndTabNum"
];
const defaultFieldsRendHistory = [
  { Name: "ID", Title: "ID", Width: "7" },
  { Name: "RenderingID", Title: "RenderingID", Width: "7" },
  { Name: "PersonID", Title: "PersonID", Width: "7" },
  { Name: "PersonText", Title: "PersonText", Width: "7" },
  { Name: "TabNum", Title: "TabNum", Width: "7" },
  { Name: "RateCount", Title: "RateCount", Width: "7" },
  { Name: "JobMode", Title: "JobMode", Width: "7" },
  { Name: "FirstDate", Title: "FirstDate", Width: "7" },
  { Name: "FirstDateInt", Title: "FirstDateInt", Width: "7" },
  { Name: "FirstMode", Title: "FirstMode", Width: "7" },
  { Name: "Document", Title: "Document", Width: "7" },
  { Name: "DocumentText", Title: "DocumentText", Width: "7" },
  { Name: "LastDate", Title: "LastDate", Width: "7" },
  { Name: "LastDoc", Title: "LastDoc", Width: "7" },
  { Name: "LastDocText", Title: "LastDocText", Width: "7" },
  { Name: "FinalDate", Title: "FinalDate", Width: "7" },
  { Name: "FinalMode", Title: "FinalMode", Width: "7" },
  { Name: "NextAppointment", Title: "NextAppointment", Width: "7" },
  { Name: "NextAppointmentText", Title: "NextAppointmentText", Width: "7" },
  { Name: "NextID", Title: "NextID", Width: "7" },
  { Name: "NewNextRndID", Title: "NewNextRndID", Width: "7" },
  { Name: "RndTabNum", Title: "RndTabNum", Width: "7" }
];
const recordKeysAllRendHistory = [
  "RenderingID",
  "PersonID",
  "TabNum",
  "PersonText",
  "AppointmentID",
  "FirstDate",
  "LastDate",
  "DepartmentID",
  "DepartmentText",
  "RateCount",
  "JobMode",
  "JMID",
  "AppointmentText",
  "WorkMode",
  "Status",
  "Information"
];
const defaultFieldsAllRendHistory = [
  {
    Name: "RenderingID",
    Title: "RenderingID",
    Width: "7"
  },
  {
    Name: "PersonID",
    Title: "PersonID",
    Width: "7"
  },
  {
    Name: "TabNum",
    Title: "TabNum",
    Width: "7"
  },
  {
    Name: "PersonText",
    Title: "PersonText",
    Width: "7"
  },
  {
    Name: "AppointmentID",
    Title: "AppointmentID",
    Width: "7"
  },
  {
    Name: "FirstDate",
    Title: "FirstDate",
    Width: "7"
  },
  {
    Name: "LastDate",
    Title: "LastDate",
    Width: "7"
  },
  {
    Name: "DepartmentID",
    Title: "DepartmentID",
    Width: "7"
  },
  {
    Name: "DepartmentText",
    Title: "DepartmentText",
    Width: "7"
  },
  {
    Name: "RateCount",
    Title: "RateCount",
    Width: "7"
  },
  {
    Name: "JobMode",
    Title: "JobMode",
    Width: "7"
  },
  {
    Name: "JMID",
    Title: "JMID",
    Width: "7"
  },
  {
    Name: "AppointmentText",
    Title: "AppointmentText",
    Width: "7"
  },
  {
    Name: "WorkMode",
    Title: "WorkMode",
    Width: "7"
  },
  {
    Name: "Status",
    Title: "Status",
    Width: "7"
  },
  {
    Name: "Information",
    Title: "Information",
    Width: "7"
  }
];
const columnsAllRendHistory = {
  title: [
    {
      fieldName: "PersonText",
      title: "Сотрудники",
      width: 250,
      fieldInfo: { ...defaultFieldInfo, EditStyle: EditStyle.ReadOnly, titleAjust: "0" }
    },
    {
      fieldName: "TabNum",
      title: "Таб. №",
      width: 70,
      fieldInfo: { ...defaultFieldInfo, EditStyle: EditStyle.ReadOnly, titleAjust: "0", textAjust: "1" }
    },
    {
      fieldName: "AppointmentText",
      title: "Должность",
      width: 175,
      fieldInfo: { ...defaultFieldInfo, EditStyle: EditStyle.ReadOnly, titleAjust: "0" }
    },
    {
      fieldName: "DepartmentText",
      title: "Подразделение",
      width: 110,
      fieldInfo: { ...defaultFieldInfo, EditStyle: EditStyle.ReadOnly, titleAjust: "0" }
    },
    {
      fieldName: "JobMode",
      title: "Форма назначения",
      width: 145,
      fieldInfo: { ...defaultFieldInfo, EditStyle: EditStyle.ReadOnly, titleAjust: "0" }
    },
    {
      fieldName: "FirstDate",
      title: "Начало",
      width: 85,
      fieldInfo: { ...defaultFieldInfo, EditStyle: EditStyle.ReadOnly, titleAjust: "0" }
    },
    {
      fieldName: "LastDate",
      title: "Конец",
      width: 85,
      fieldInfo: { ...defaultFieldInfo, EditStyle: EditStyle.ReadOnly, titleAjust: "0" }
    },
    {
      fieldName: "RateCount",
      title: "Ставки",
      width: 65,
      fieldInfo: { ...defaultFieldInfo, EditStyle: EditStyle.ReadOnly, titleAjust: "0" }
    },
    {
      fieldName: "WorkMode",
      title: "График работы",
      width: 110,
      fieldInfo: { ...defaultFieldInfo, EditStyle: EditStyle.ReadOnly, titleAjust: "0" }
    },
    {
      fieldName: "Status",
      title: "Состояние работника",
      width: 110,
      fieldInfo: { ...defaultFieldInfo, EditStyle: EditStyle.ReadOnly, titleAjust: "0" }
    },
    {
      fieldName: "Information",
      title: "Дополнительно",
      width: 110,
      fieldInfo: { ...defaultFieldInfo, EditStyle: EditStyle.ReadOnly, titleAjust: "0" }
    }
  ]
};
const checkNewPeriod = (rendHistoryParams, currentDate) => {
  let newPeriod = null;
  const year = Number(currentDate.year), month = Number(currentDate.month);
  if (rendHistoryParams.ObjLD) {
    let objDate = dayjs(rendHistoryParams.ObjLD), objDateMonth = objDate.month() + 1, objDateYear = objDate.year();
    if (year > objDateYear || year === objDateYear && month > objDateMonth) {
      newPeriod = { year: String(objDateYear), month: String(objDateMonth) };
    } else {
      objDate = dayjs(rendHistoryParams.ObjFD);
      objDateMonth = objDate.month() + 1;
      objDateYear = objDate.year();
      if (year < objDateYear || year === objDateYear && month < objDateMonth)
        newPeriod = { year: String(objDateYear), month: String(objDateMonth) };
    }
  } else {
    const objFD = dayjs(rendHistoryParams.ObjFD), objFDMonth = objFD.month() + 1, objFDYear = objFD.year();
    if (year < objFDYear || year === objFDYear && month < objFDMonth)
      newPeriod = { year: String(objFDYear), month: String(objFDMonth) };
  }
  return newPeriod;
};
const mfEdit$1 = 1, mfDelete$1 = 2;
function RendHistory({
  staffSettings,
  columnsInfo,
  appointmentId,
  groupId,
  selectedPeriod,
  jobModes,
  movableRecords,
  contextMenuHandler,
  paramRights,
  gridPanel,
  mainGridPanel,
  open,
  setPriorHistoryID,
  scrollToSearchResult,
  rendHistoryParamsSearch
}) {
  var _a;
  const records = reactExports.useRef([]);
  const userIsAdmin = useAtomValue(isAdminAtom);
  const configEnabled = useAtomValue(configEnabledAtom);
  const [selectedRendHistoryID, setSelectedRendHistoryID] = reactExports.useState("");
  const [disabledContextMenuButtons, setDisabledContextMenuButtons] = reactExports.useState({
    cut: true,
    paste: true,
    rendHistoryList: true,
    settings: true
  });
  reactExports.useEffect(() => {
    gridPanel.current.updateRecordsRendHistory = getRendHistoryList;
  }, [appointmentId, groupId, selectedPeriod]);
  reactExports.useEffect(() => {
    if (selectedRendHistoryID) {
      smetaAxios.get("GetPriorHistory", {
        prefix: Prefixes.staff,
        params: {
          ObjType: ObjType.RendHistory,
          ObjRef: selectedRendHistoryID,
          PersonID: gridPanel.current.grid.source.getFieldTextSync("PersonID")
        },
        loadMask: true
      }).then((json) => {
        setPriorHistoryID(json.Result || "");
      });
    } else setPriorHistoryID("");
  }, [selectedRendHistoryID]);
  reactExports.useEffect(() => {
    updateDisabledContextMenuButtons();
  }, [paramRights, appointmentId, movableRecords, selectedRendHistoryID]);
  reactExports.useEffect(() => {
    if (open && (appointmentId || groupId) && !rendHistoryParamsSearch.current.appointmentId) {
      getRendHistoryList();
    } else if (!gridPanel.current.grid) {
      rendHistoryGridLoader();
    }
  }, [appointmentId, selectedPeriod, open]);
  reactExports.useEffect(() => {
    if (mainGridPanel && gridPanel.current.grid) {
      gridPanel.current.grid.canModify = canModify;
    }
  }, [mainGridPanel]);
  reactExports.useEffect(() => {
    if (gridPanel.current.grid) {
      const columns = gridPanel.current.grid.columns;
      const newTitle = {
        PersonText: columnsInfo.PersonText || "Сотрудники",
        TabNum: columnsInfo.Number || "Таб. №",
        RateCount: columnsInfo.Count || "Ставки",
        JobMode: columnsInfo.Caption || "Форма назначения",
        FirstDate: columnsInfo.FirstDate || "Назначение",
        LastDate: columnsInfo.LastDate || "Снятие",
        NextAppointmentText: columnsInfo.NextApp || "Новая должность"
      };
      columns.title.forEach((column) => {
        if (column.fieldName && newTitle[column.fieldName] && !column.level) {
          if (column.fieldInfo && column.fieldName === "JobMode") column.fieldInfo.Values = jobModes.current;
          column.title = newTitle[column.fieldName];
        }
      });
      gridPanel.current.grid.updateGridSize();
    }
  }, [columnsInfo]);
  reactExports.useEffect(() => {
    if (gridPanel.current.grid) gridPanel.current.grid.changeGridStyles = changeGridStyles;
  }, [movableRecords]);
  async function updateDisabledContextMenuButtons() {
    const canModifyParamsAppointments = checkRightsFlag(paramRights, mfEdit$1) && await checkCurrentUserRights(ObjType.Appointment, mfEdit$1, true), canModifyParamsRendHistory = checkRightsFlag(paramRights, mfEdit$1) && await checkCurrentUserRights(ObjType.RendHistory, mfEdit$1, true), isEmptyAppointments = !appointmentId, isEmptyRendHistory = !selectedRendHistoryID;
    setDisabledContextMenuButtons({
      cut: !(userIsAdmin || await getCurrentUserRights(ObjType.RendHistory, true) !== "-1" && canModifyParamsAppointments) || isEmptyRendHistory,
      paste: movableRecords.ObjType !== ObjType.RendHistory || isEmptyAppointments,
      rendHistoryList: isEmptyRendHistory,
      settings: !canModifyParamsRendHistory || isEmptyRendHistory
    });
  }
  const createNewRendering = () => {
    let jobMode = gridPanel.current.grid.source.getFieldTextSync("JobMode");
    if (!gridPanel.current.grid.source.getFieldTextSync("LastDate")) {
      jobMode = jobModes.current.findIndex((item) => item.label === jobMode) + 1;
    } else jobMode = 0;
    smetaModals.open(
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        DialogOficialStructure,
        {
          props: {
            jobModes: jobModes.current,
            NewModalWindow: true,
            createNewRendering: true,
            jobModeValueIndex: jobMode,
            firstDateNewRendering: getDateOfInt(selectedPeriod.endDateInt + 1),
            onEdit: async (values) => {
              const paramsNewRendering = values.paramsNewRendering;
              const json = await smetaAxios.get("ChangeRendering", {
                prefix: Prefixes.staff,
                params: {
                  ObjType: ObjType.Appointment,
                  ObjRef: values.tag,
                  FirstDate: paramsNewRendering.FirstDate ? getDateForDateObj(paramsNewRendering.FirstDate) : void 0,
                  LastDate: paramsNewRendering.LastDate ? getDateForDateObj(paramsNewRendering.LastDate) : void 0,
                  PersonID: gridPanel.current.grid.source.getFieldTextSync("PersonID"),
                  NewRendering: paramsNewRendering.NewRendering,
                  RateCount: paramsNewRendering.RateCount,
                  JobMode: paramsNewRendering.JobMode
                },
                loadMask: true
              });
              scrollToSearchResult(json.ObjRef);
            }
          }
        }
      ),
      {
        blockSaveLocation: true,
        hiddenButton: true,
        Title: "Новая должность",
        style: {
          minWidth: "575px",
          minHeight: "420px",
          height: "700px",
          width: "720px"
        },
        setFocus: true
      }
    );
  };
  const documentTextEditButtonClick = async (subData) => {
    const onSelectDocument = (fieldName) => {
      return async (values) => {
        const nameDocument = (await getObjText("documents", ObjType.Document, values.tag || "0", ObjNameFlag.Name)).Text;
        await gridPanel.current.grid.postSomeData(fieldName, { text: nameDocument, id: values.tag });
        gridPanel.current.grid.postExicstedEditRec(true);
      };
    };
    const fieldNameText = subData.props.addInfo.FieldName;
    const docId = gridPanel.current.grid.source.getFieldTextSync(
      fieldNameText.slice(0, fieldNameText.length - 4)
    );
    if (docId) {
      const json = await GetDocDialogParams(ObjType.Document, docId);
      smetaModals.open(
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          DialogDoc,
          {
            props: {
              ...json,
              NewModalWindow: true,
              onEdit: onSelectDocument(fieldNameText),
              setValue: true,
              setInputValue: true
            }
          }
        ),
        {
          Title: json.Title,
          style: getStyleWindow(json.CLSID),
          setFocus: true
        }
      );
    } else {
      const json = await getAmountDocTypes();
      const selectDocument = Object.values(json.Types).map((item) => {
        return { DocCfgID: item.id, Name: item.text };
      });
      smetaModals.open(
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          DialogDocTabs,
          {
            props: {
              CLSID: ViewClass.DocSite,
              SelectDocument: selectDocument,
              NewModalWindow: true,
              onEdit: onSelectDocument(fieldNameText)
            }
          }
        ),
        {
          blockSaveLocation: true,
          style: getStyleWindow(ViewClass.DocSite),
          setFocus: true
        }
      );
    }
  };
  const getColumnsRendHistory = () => {
    return {
      title: [
        {
          fieldName: "PersonText",
          title: columnsInfo.PersonText || "Сотрудники",
          width: 190,
          fieldInfo: {
            ...defaultFieldInfo,
            DataType: ObjType.Person,
            EditStyle: EditStyle.PickList + EditStyle.Ellipsis,
            Module: "persons",
            titleAjust: "0"
          }
        },
        {
          fieldName: "TabNum",
          title: columnsInfo.Number || "Таб. №",
          width: 70,
          fieldInfo: {
            ...defaultFieldInfo,
            titleAjust: "1",
            textAjust: "1",
            EditStyle: staffSettings.UseRndTabNumber === "1" ? "" : EditStyle.ReadOnly
          }
        },
        {
          fieldName: "RateCount",
          title: columnsInfo.Count || "Ставки",
          width: 70,
          fieldInfo: { ...defaultFieldInfo, titleAjust: "1", textAjust: "1" }
        },
        {
          fieldName: "JobMode",
          title: columnsInfo.Caption || "Форма назначения",
          width: 145,
          fieldInfo: { ...defaultFieldInfo, EditStyle: EditStyle.PickList, Values: jobModes.current }
        },
        {
          fieldName: "FirstDate",
          title: columnsInfo.FirstDate || "Назначение",
          width: 100,
          level: 0,
          fieldInfo: { ...defaultFieldInfo, EditStyle: EditStyle.Calendar, titleAjust: "0", textAjust: "1" }
        },
        {
          fieldName: "FirstDate",
          title: "Дата",
          width: 100,
          level: 1,
          fieldInfo: { ...defaultFieldInfo, EditStyle: EditStyle.Calendar, titleAjust: "1", textAjust: "1" }
        },
        {
          fieldName: "FirstMode",
          title: "Статус",
          width: 100,
          level: 1,
          fieldInfo: {
            ...defaultFieldInfo,
            EditStyle: EditStyle.PickList,
            Values: [
              { label: "Назначение", id: 0 },
              { label: "Поступление", id: 1 }
            ]
          }
        },
        {
          fieldName: "DocumentText",
          title: "Документ (приказ)",
          width: 100,
          level: 1,
          fieldInfo: {
            ...defaultFieldInfo,
            onEditButtonClick: documentTextEditButtonClick,
            DataType: ObjType.Document,
            EditStyle: EditStyle.Ellipsis,
            Module: "documents",
            titleAjust: "0"
          }
        },
        {
          fieldName: "LastDate",
          title: columnsInfo.LastDate || "Снятие",
          width: 100,
          level: 0,
          fieldInfo: { ...defaultFieldInfo, EditStyle: EditStyle.Calendar, titleAjust: "0", textAjust: "1" }
        },
        {
          fieldName: "LastDate",
          title: "Официально",
          width: 100,
          level: 1,
          fieldInfo: { ...defaultFieldInfo, EditStyle: EditStyle.Calendar, titleAjust: "0", textAjust: "1" }
        },
        {
          fieldName: "FinalDate",
          title: "Расчет до:",
          width: 100,
          level: 1,
          fieldInfo: { ...defaultFieldInfo, EditStyle: EditStyle.Calendar, titleAjust: "0", textAjust: "1" }
        },
        {
          fieldName: "FinalMode",
          title: "Статус",
          width: 100,
          level: 1,
          fieldInfo: {
            ...defaultFieldInfo,
            EditStyle: EditStyle.PickList,
            Values: [
              { label: "Снятие", id: 0 },
              { label: "Увольнение", id: 1 }
            ],
            titleAjust: "0"
          }
        },
        {
          fieldName: "LastDocText",
          title: "Документ (приказ)",
          width: 100,
          level: 1,
          fieldInfo: {
            ...defaultFieldInfo,
            onEditButtonClick: documentTextEditButtonClick,
            DataType: ObjType.Document,
            EditStyle: EditStyle.Ellipsis,
            Module: "documents",
            titleAjust: "0"
          }
        },
        {
          fieldName: "NextAppointmentText",
          title: columnsInfo.NextApp || "Новая должность",
          width: 185,
          fieldInfo: {
            ...defaultFieldInfo,
            onEditButtonClick: createNewRendering,
            EditStyle: EditStyle.Ellipsis + EditStyle.ReadOnly,
            titleAjust: "0"
          }
        }
      ]
    };
  };
  const changeGridStyles = async (table) => {
    var _a2;
    if (table.classList[0] === "grid-item" && records.current.length) {
      const record = records.current[table.recordIndex] || {};
      const markedMovableRecord = movableRecords.ObjType === ObjType.RendHistory && movableRecords.ID.split(",").includes(record.ID);
      if (record.JobMode && record.JobMode !== ((_a2 = jobModes.current[0]) == null ? void 0 : _a2.label)) table.style.fontStyle = "italic";
      table.querySelectorAll(".grid-td").forEach((cell) => {
        const fieldName = cell.field.fieldName;
        if (fieldName) {
          cell.style.color = "";
          if (fieldName !== "PersonText" && markedMovableRecord) {
            cell.style.color = "gray";
          }
          if (fieldName === "TabNum" && record.RndTabNum === "1") {
            cell.style.color = "#1200ff";
          } else if (fieldName === "NextAppointmentText" && record.NewNextRndID) {
            cell.style.color = "#1200ff";
          }
        }
      });
    }
  };
  const canModify = (flag, column, grid) => {
    if (mainGridPanel.grid.source.recordCount === 0 || !grid.localCanModify(flag, column, grid)) return false;
    if (!checkCurrentUserRights(ObjType.RendHistory, flag)) return false;
    const activeSource = grid.getActiveSource();
    const documentTextEmpty = activeSource.getFieldTextSync("DocumentText") === "";
    const lastDocTextEmpty = activeSource.getFieldTextSync("LastDocText") === "";
    const fieldName = column == null ? void 0 : column.fieldName;
    if (fieldName) {
      const isNewRecord = activeSource.getFieldTextSync("ID") === "0" || activeSource.getFieldTextSync("ID") === "" || activeSource.getState() === 3;
      if ((fieldName === "RateCount" || fieldName === "NextAppointmentText") && isNewRecord) return false;
      if (["FirstDate", "PersonText", "RateCount", "JobMode"].includes(fieldName) && !documentTextEmpty) return false;
      if (fieldName === "LastDate" && !lastDocTextEmpty) return false;
      if ((fieldName === "DocumentText" || fieldName === "LastDocText") && activeSource.getFieldTextSync(fieldName) !== "" && !userIsAdmin && !configEnabled)
        return false;
    }
    if (flag === mfDelete$1 && (!documentTextEmpty || !lastDocTextEmpty)) return false;
    return true;
  };
  const getRecordIndexRefresh = (key) => {
    if (key) {
      const recordIndex = records.current.findIndex((record) => record.RenderingID === key);
      if (recordIndex !== -1) return recordIndex;
    }
    return 0;
  };
  const getFieldText = (request) => {
    return { Text: gridPanel.current.grid.source.getFieldTextSync(request.FieldName) };
  };
  const getParamsRecord = (recordIndex, operation) => {
    const record = records.current[recordIndex];
    const firstDate = record.FirstDate;
    return {
      ObjType: ObjType.Appointment,
      ObjRef: mainGridPanel.grid.source.getFieldTextSync("ID"),
      ObjFD: getDateForDateObj(selectedPeriod.startDate),
      ObjLD: getDateForDateObj(selectedPeriod.endDate),
      ID: record.ID,
      PersonID: record.PersonID,
      PersonText: record.PersonText,
      TabNum: record.TabNum || void 0,
      RateCount: record.RateCount,
      JobMode: record.JobMode,
      FirstDate: getDateForDateObj(firstDate || ""),
      FirstMode: record.FirstMode,
      Document: record.Document,
      DocumentText: record.DocumentText,
      LastDate: record.LastDate ? getDateForDateObj(record.LastDate) : void 0,
      FinalMode: record.FinalMode || void 0,
      LastDoc: record.LastDoc,
      LastDocText: record.LastDocText,
      RenderingID: record.RenderingID,
      FirstDateInt: firstDate ? getIntOfStrDate(firstDate) : void 0,
      NextID: record.NextID || "0",
      NextAppointment: record.NextAppointment || "0",
      RndTabNum: record.RndTabNum === "1" ? "True" : "False",
      Operation: operation
    };
  };
  const onPostRecord = async (request, requestData) => {
    let attributeIndex = 0;
    const requestAttributes = request.RecordSet.Attributes;
    if (request.NewRecord === "1") {
      const newRecord = {
        ID: "0",
        RenderingID: "0",
        RateCount: "1",
        PersonID: "0",
        PersonText: "",
        FirstDate: "",
        JobMode: await gridPanel.current.grid.source.getFieldText("JobMode"),
        FirstMode: ""
      };
      records.current.splice(request.RecordIndex, 0, newRecord);
      const priorities = [3, 4, 7, 9];
      attributeIndex = requestData.length > 10 ? requestData.length - 1 : priorities.find((index) => {
        var _a2, _b;
        return ((_a2 = requestData[index]) == null ? void 0 : _a2.id) || ((_b = requestData[index]) == null ? void 0 : _b.text);
      }) || 6;
    }
    const params = {
      ...getParamsRecord(request.RecordIndex, "Post"),
      WSM: 1
    };
    let modifiedFields = requestAttributes[attributeIndex];
    const modifiedData = requestData[attributeIndex];
    let newValue;
    switch (modifiedFields) {
      case "PersonText":
        let newPersonID = "0";
        if (modifiedData) {
          newPersonID = modifiedData.id;
          newValue = (await getObjText("persons", ObjType.Person, newPersonID, ObjNameFlag.Name)).Text;
        }
        modifiedFields = "PersonID,PersonText";
        params.PersonID = newPersonID;
        params.PersonText = newValue;
        break;
      case "DocumentText":
      case "LastDocText":
        if (modifiedData.id === void 0 && modifiedData.text) return;
        if (modifiedFields === "DocumentText") {
          modifiedFields = "Document,DocumentText";
          params.Document = modifiedData.id || void 0;
          params.DocumentText = modifiedData.text || void 0;
        } else {
          modifiedFields = "LastDoc,LastDocText";
          params.LastDoc = modifiedData.id || void 0;
          params.LastDocText = modifiedData.text || void 0;
        }
        break;
      case "FirstDate":
      case "LastDate":
      case "FinalDate":
        newValue = modifiedData.id ? getDateOfInt(modifiedData.id) : void 0;
        params[modifiedFields] = getDateForDateObj(newValue);
        if (modifiedFields === "FirstDate") params.FirstDateInt = modifiedData.id;
        break;
      default:
        newValue = modifiedData.text;
        params[modifiedFields] = newValue;
        break;
    }
    if (request.NewRecord === "1") {
      if (modifiedFields === "JobMode") {
        params.ModifiedFields = "RateCount,JobMode";
      } else params.ModifiedFields = `RateCount,JobMode,${modifiedFields}`;
    } else params.ModifiedFields = modifiedFields;
    const res = await smetaAxios.get("RendHistoryBeforeOperation", {
      prefix: Prefixes.staff,
      params,
      loadMask: true
    });
    if (!isEmptyObject(res)) {
      if (res.Message) renderMessageBox({ dlgType: DlgType.Warning, buttons: Button$1.Yes, message: res.Message });
      const record = records.current[request.RecordIndex];
      params.ModifiedFields.split(",").forEach((modifiedField) => {
        if (modifiedField === modifiedFields) {
          record[modifiedField] = newValue;
        } else {
          const paramsModifiedField = params[modifiedField];
          record[modifiedField] = typeof paramsModifiedField === "number" ? paramsModifiedField.toString() : paramsModifiedField || "";
        }
      });
      if (["Document,DocumentText", "PersonID,PersonText", "LastDoc,LastDocText"].includes(modifiedFields)) {
        if (record.PersonID && record.FirstDate) {
          rendHistoryParamsSearch.current.renderingId = res.RenderingID;
          await gridPanel.current.updateRecordsRendHistory();
        }
      } else {
        const defaultValues = {
          ID: records.current[request.RecordIndex].ID,
          RenderingID: records.current[request.RecordIndex].RenderingID || "",
          RndTabNum: "",
          TabNum: "",
          FirstMode: "",
          FinalMode: ""
        };
        for (const key of Object.keys(defaultValues)) {
          record[key] = res[key] !== void 0 ? res[key] : defaultValues[key];
        }
      }
      await mainGridPanel.grid.getActiveSource().refreshRecord();
      await mainGridPanel.grid.updateGridSize();
      await gridPanel.current.grid.refreshSource(res.RenderingID);
    }
  };
  const createRecord = () => {
    const index = records.current.length ? gridPanel.current.grid.source.activeRecord + 1 : 0;
    const newRecords = [...records.current];
    const newRecord = {
      ID: "0",
      RenderingID: "0",
      RateCount: "1",
      PersonID: "0",
      PersonText: "",
      FirstDate: "",
      JobMode: jobModes.current[0].label,
      FirstMode: ""
    };
    newRecords.splice(index, 0, newRecord);
    return {
      index,
      records: newRecords,
      keys: Object.keys(newRecord),
      titleKey: ""
    };
  };
  const checkFieldText = async (request) => {
    const val = await getObjText("persons", ObjType.Person, request.ObjRef, ObjNameFlag.Name);
    return { Text: val.Text, ObjRef: request.ObjRef, EditVal: val.Text };
  };
  const deleteRecord = async (request) => {
    if (gridPanel.current.grid.source.getState() !== 3) {
      const params = getParamsRecord(request.RecordIndex, "Delete");
      const json = await smetaAxios.get("RendHistoryBeforeOperation", {
        prefix: Prefixes.staff,
        params,
        loadMask: true
      });
      if (!isEmptyObject(json) || params.ID === "0") {
        records.current.splice(request.RecordIndex, 1);
        await mainGridPanel.grid.getActiveSource().refreshRecord();
        await mainGridPanel.grid.updateGridSize();
        await gridPanel.current.grid.refreshSource();
        return {
          Command: "DeleteRecord",
          RecordIndex: records.current.length === 0 ? 0 : request.RecordIndex - 1,
          RecordCount: records.current.length,
          UpdatesPending: "1",
          RecordKey: {}
        };
      }
    } else {
      return {
        Command: "DeleteRecord",
        RecordIndex: records.current.length === 0 ? 0 : request.RecordIndex - 1,
        RecordCount: records.current.length,
        UpdatesPending: "1",
        RecordKey: {}
      };
    }
  };
  const rendHistoryGridLoader = async () => {
    if (gridPanel.current.grid) {
      await gridPanel.current.grid.refreshSource(rendHistoryParamsSearch.current.renderingId);
      rendHistoryParamsSearch.current = {};
    } else {
      const res = await GridLoader(
        gridPanel.current,
        {},
        {
          localGrid: true,
          changeGridStyles,
          refresh: false,
          Columns: getColumnsRendHistory(),
          defaultFields: defaultFieldsRendHistory,
          keyField: "ID",
          recordKeys: recordKeysRendHistory,
          titleKey: "",
          Rights: await getCurrentUserRights(ObjType.RendHistory, true),
          getRecordIndexRefresh,
          getFieldText,
          canModify,
          onPostRecord,
          createRecord,
          deleteRecord,
          checkFieldText,
          getRecords: () => records.current
        }
      );
      if (res) {
        res.source.onRecordIndexChanged = (source) => {
          setSelectedRendHistoryID(source.getFieldTextSync("ID"));
        };
      }
    }
    setSelectedRendHistoryID(gridPanel.current.grid.source.getFieldTextSync("ID"));
  };
  async function getRendHistoryList() {
    const json = await smetaAxios.get("GetRendHistoryList", {
      prefix: Prefixes.staff,
      params: {
        ObjType: ObjType.Appointment,
        ObjRef: appointmentId || "0",
        GroupID: groupId || "0",
        ObjFD: getDateForDateObj(selectedPeriod.startDate),
        ObjLD: getDateForDateObj(selectedPeriod.endDate)
      },
      loadMask: true
    });
    records.current = Object.values(json).map((item) => {
      const formattedItem = { ...item };
      formattedItem.FirstDate = dayjs(formattedItem.FirstDate).format("DD.MM.YYYY");
      if (formattedItem.FinalDate) formattedItem.FinalDate = dayjs(formattedItem.FinalDate).format("DD.MM.YYYY");
      if (formattedItem.LastDate) formattedItem.LastDate = dayjs(formattedItem.LastDate).format("DD.MM.YYYY");
      return formattedItem;
    });
    records.current.sort((a, b) => {
      if (a.PersonText < b.PersonText) {
        return -1;
      }
      if (a.PersonText > b.PersonText) {
        return 1;
      }
      return 0;
    });
    await rendHistoryGridLoader();
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    ContextMenu,
    {
      for: "grid",
      Menu: {
        Table: [
          {
            Caption: "Перенести назначения",
            value: "cutRendHistories",
            Disabled: disabledContextMenuButtons.cut,
            ShortCutString: "Ctrl + X"
          },
          {
            Caption: "Вставить назначения",
            value: "moveObjects",
            Disabled: disabledContextMenuButtons.paste,
            ShortCutString: "Ctrl + V"
          },
          { Caption: "Divider" },
          {
            Caption: "История назначений",
            value: "rendHistoryList",
            Disabled: disabledContextMenuButtons.rendHistoryList
          },
          { Caption: "Divider" },
          {
            Caption: "Настройки...",
            value: "settingsRendHistory",
            Disabled: disabledContextMenuButtons.settings
          },
          { Caption: "Divider" },
          {
            Caption: "Новая запись",
            value: "Insert",
            Image: /* @__PURE__ */ jsxRuntimeExports.jsx(PostAddIcon, { fontSize: "small" })
          },
          {
            Caption: "Удалить запись",
            value: "Delete",
            Image: /* @__PURE__ */ jsxRuntimeExports.jsx(DeleteIcon, { fontSize: "small" })
          },
          { Caption: "Divider" },
          { Caption: "Режим просмотра", value: "OnlyViewMode" },
          { Caption: "Сохранять отметку", value: "SaveMark", Disabled: true }
        ],
        Header: [{ Caption: "Поиск по столбцу", value: "ColumnFilter" }]
      },
      onMenuItemClick: contextMenuHandler,
      refs: { current: (_a = gridPanel.current) == null ? void 0 : _a.grid },
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        "div",
        {
          onKeyDown: (ev) => {
            if (ev.ctrlKey) {
              if (ev.code === "KeyX") {
                if (!disabledContextMenuButtons.cut) contextMenuHandler({ value: "cutRendHistories" });
              } else if (ev.code === "KeyV") {
                if (!disabledContextMenuButtons.paste) contextMenuHandler({ value: "moveObjects" });
              }
            }
          },
          style: { height: "100%", width: "100%", position: "relative" },
          ref: (ref) => {
            gridPanel.current = ref;
          },
          rcsgrid_panel: ""
        }
      )
    }
  );
}
const mfInsert = 0, mfEdit = 1, mfDelete = 2;
function SectionStaff(props) {
  var _a;
  const selectedSection = useAtomValue(selectedSectionAtom);
  const theme = useAtomValue(currentTheme);
  const animationsOn = useAtomValue(animationsAtom);
  const userIsAdmin = useAtomValue(isAdminAtom);
  const [timerUpdateGrid, setTimerUpdateGrid] = reactExports.useState(void 0);
  const [selectedTabIndex, setSelectedTabIndex] = reactExports.useState(0);
  const [staffSettings, setStaffSettings] = reactExports.useState({});
  const setDocsTabIndex = reactExports.useRef();
  const [collapsedTree, setCollapsedTree] = reactExports.useState(false);
  const treeRef = reactExports.useRef(null);
  const [groupID, setGroupID] = reactExports.useState("");
  const selectedPeriod = reactExports.useRef({ startDate: "0", startDateInt: 0, endDate: "0", endDateInt: 0 });
  const [collapsedSearch, setCollapsedSearch] = reactExports.useState(true);
  const [monthYearSelected, setMonthYearSelected] = reactExports.useState();
  const [collapsedDetail, setCollapsedDetail] = reactExports.useState(false);
  const [showAllRendHistory, setShowAllRendHistory] = reactExports.useState(false);
  const mainGridRef = reactExports.useRef(null);
  const rendHistoryGridPanel = reactExports.useRef(null);
  const [disabledContextMenuButtons, setDisabledContextMenuButtons] = reactExports.useState({
    cut: true,
    paste: true,
    settings: true
  });
  const [inputTariffication, setInputTariffication] = reactExports.useState(false);
  const jobModes = reactExports.useRef([]);
  const [paramRights, setParamRights] = reactExports.useState("");
  const [columnsInfo, setColumnsInfo] = reactExports.useState({});
  const [selectedAppointmentID, setSelectedAppointmentID] = reactExports.useState("");
  const [movableRecords, setMovableRecords] = reactExports.useState({ ID: "", ObjType: 0 });
  const [labelTabRendHistory, setLabelTabRendHistory] = reactExports.useState("");
  const [labelTabBaseAmounts, setLabelTabBaseAmounts] = reactExports.useState("");
  const [indexTabAppointment, setIndexTabAppointment] = reactExports.useState(0);
  const [priorHistoryID, setPriorHistoryID] = reactExports.useState("");
  const rendHistoryParamsSearch = reactExports.useRef({});
  const [selectedRendHistoryID, setSelectedRendHistoryID] = reactExports.useState("");
  const [amountsPersonText, setAmountsPersonText] = reactExports.useState("");
  const recordsAllRendHistory = reactExports.useRef([]);
  const mainSources = reactExports.useRef({});
  reactExports.useEffect(() => {
    updateDisabledContextMenuButtons();
  }, [paramRights, selectedAppointmentID, movableRecords]);
  reactExports.useEffect(() => {
    const currentMonthInfo = getMonthInfo();
    setMonthYearSelected({ year: String(currentMonthInfo.year), month: String(currentMonthInfo.month) });
    selectedPeriod.current = {
      startDate: currentMonthInfo.firstDayStr,
      startDateInt: currentMonthInfo.firstDayInt,
      endDate: currentMonthInfo.lastDayStr,
      endDateInt: currentMonthInfo.lastDayInt
    };
    getStaffSettings(props.sectionId).then((json) => {
      setStaffSettings(json);
    });
  }, []);
  reactExports.useEffect(() => {
    if (props.sectionId === selectedSection.ID) {
      if (selectedSection.Who) {
        if (selectedSection.Who === "Report") {
          setSelectedTabIndex(staffSettings.WithOutDocs === "1" ? 1 : 2);
        } else {
          setSelectedTabIndex(1);
        }
      }
    }
  }, [selectedSection]);
  reactExports.useEffect(() => {
    if (groupID) {
      smetaAxios.get("GetJobModes", {
        prefix: Prefixes.staff,
        params: { ObjType: ObjType.Department, ObjRef: groupID },
        loadMask: true
      }).then((json) => {
        jobModes.current = json.Value.split("\r\n").map((item, index) => ({
          label: item,
          id: index.toString()
        }));
        if (showAllRendHistory) {
          getRenderingsList();
        } else setAppointmentSource();
      });
    }
  }, [groupID]);
  reactExports.useEffect(() => {
    if (mainGridRef.current.grid) mainGridRef.current.grid.changeGridStyles = changeMainGridStyles;
  }, [movableRecords, showAllRendHistory]);
  async function updateDisabledContextMenuButtons() {
    const canModifyParams = checkRightsFlag(paramRights, mfEdit) && await checkCurrentUserRights(ObjType.Appointment, mfEdit, true), isEmptyAppointments = !selectedAppointmentID;
    setDisabledContextMenuButtons({
      cut: !(userIsAdmin || await getCurrentUserRights(ObjType.Appointment, true) !== "-1" && canModifyParams) || isEmptyAppointments,
      paste: movableRecords.ObjType !== ObjType.Appointment,
      settings: !canModifyParams || isEmptyAppointments
    });
  }
  const changeMainGridStyles = async (table) => {
    var _a2, _b;
    if (table.classList[0] === "grid-item") {
      if (showAllRendHistory) {
        const record = recordsAllRendHistory.current[table.recordIndex] || {};
        if (record.JobMode !== ((_a2 = jobModes.current[0]) == null ? void 0 : _a2.label)) table.style.fontStyle = "italic";
      } else {
        const recordId = await mainGridRef.current.grid.source.getFieldText("ID", table.recordIndex);
        if (movableRecords.ObjType === ObjType.Appointment && movableRecords.ID.split(",").includes(recordId)) {
          table.style.color = "gray";
        }
        let firstDate = getIntOfStrDate(
          await mainGridRef.current.grid.source.getFieldText("FirstDate", table.recordIndex)
        );
        let lastDate = getIntOfStrDate(
          await mainGridRef.current.grid.source.getFieldText("LastDate", table.recordIndex)
        );
        if (firstDate === -1) firstDate = Number.MIN_SAFE_INTEGER;
        if (lastDate === -1) {
          lastDate = Number.MAX_SAFE_INTEGER;
        } else {
          const lastDateValue = await mainGridRef.current.grid.source.getFieldValue("LastDate", table.recordIndex);
          const allTd = table.querySelectorAll(".grid-td");
          for (const cell of Object.values(allTd)) {
            if (((_b = cell.field) == null ? void 0 : _b.fieldName) && cell.field.fieldName === "LastDate") {
              cell.style.color = lastDateValue ? "" : setColor(DelphiColors.clGray.toString());
            }
          }
        }
        if (firstDate > selectedPeriod.current.endDateInt || lastDate < selectedPeriod.current.startDateInt) {
          table.style.textDecoration = "line-through";
        }
      }
    }
  };
  const editColumnHistory = (subData) => {
    const fieldInfo = subData.props.addInfo.Field.fieldInfo, grid = mainGridRef.current.grid;
    const shortName = fieldInfo.shortName || subData.props.addInfo.Field.title;
    const paramsRequest = /* @__PURE__ */ new Map();
    paramsRequest.set("prefix", Prefixes.staff).set("ObjType", ObjType.Appointment).set("ShortName", shortName).set("ID", grid.source.getFieldTextSync("ID"));
    smetaModals.open(
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        DialogHistory,
        {
          DataType: fieldInfo.DataType,
          EditStyle: fieldInfo.EditStyle,
          Options: fieldInfo.Options,
          Module: fieldInfo.Module,
          paramsRequest,
          onSelect: async () => {
            await grid.getActiveSource().refreshRecord();
            await grid.updateGridSize();
          }
        }
      ),
      {
        Title: subData.props.addInfo.Field.title,
        hiddenButton: true,
        style: {
          height: "420px",
          width: "570px"
        },
        blockMaximize: true,
        blockSaveLocation: true,
        blockResize: true,
        setFocus: true
      }
    );
  };
  const canModifyAppointmentGrid = (flag, column, grid) => {
    if ((column == null ? void 0 : column.fieldName) === "PersonRates") return false;
    if (!grid.localCanModify(flag, column, grid)) return false;
    if (!checkCurrentUserRights(ObjType.Appointment, flag)) return false;
    const source = grid.getActiveSource();
    switch (flag) {
      case mfDelete:
        return source.getFieldValueSync("CanDelete") === "1";
      case mfInsert:
        return groupID ? groupID !== "0" : false;
      case mfEdit:
        return (column == null ? void 0 : column.fieldName) === "Name" || source.getFieldValueSync("Name");
    }
    return true;
  };
  const checkClsColumn = (columns, json) => {
    var _a2;
    const columnCenter = ["Code", "FirstDate", "LastDate", "RateCount"];
    for (const key in columns) {
      const column = columns[key];
      if (column.fieldInfo) {
        if (column.fieldName === "RateCount" || ((_a2 = column.fieldInfo.options) == null ? void 0 : _a2.period)) {
          column.fieldInfo.shortName = json.Columns[key].ShortName;
          column.fieldInfo.onEditButtonClick = editColumnHistory;
        }
        if (!(column.fieldName === "Name" && columns[key].level === 0)) {
          column.fieldInfo.titleAjust = "1";
        } else {
          column.fieldInfo.titleAjust = "0";
        }
        if (column.fieldName && columnCenter.includes(column.fieldName)) {
          column.fieldInfo.textAjust = "1";
        }
      }
    }
  };
  const сhangeGridColumn = (info, columns, fieldName, defaultTitle) => {
    const newTitle = info || defaultTitle;
    for (const key in columns) {
      if (columns[key].fieldName === fieldName) {
        columns[key].title = newTitle;
        return;
      }
    }
  };
  const onHandleRequestStaff = (request) => smetaAxios.post("HandleTable", request, {
    prefix: Prefixes.staff,
    params: {
      GroupID: groupID,
      ObjType: ObjType.Appointment,
      ObjRef: selectedAppointmentID ? selectedAppointmentID : request.key || "0",
      ObjFD: getDateForDateObj(selectedPeriod.current.startDate),
      ObjLD: getDateForDateObj(selectedPeriod.current.endDate)
    },
    loadMask: true
  });
  async function setAppointmentSource() {
    let grid, source;
    if (!mainGridRef.current.grid) {
      const res = await GridLoader(
        mainGridRef.current,
        { Module: "staff" },
        { changeGridStyles: changeMainGridStyles }
      );
      grid = res.grid;
      source = res.source;
      mainSources.current.appointment = source;
    } else {
      grid = mainGridRef.current.grid;
      source = mainSources.current.appointment;
    }
    const json = await GetTableLayout(
      Prefixes.staff,
      ObjType.Appointment,
      groupID,
      props.sectionId
    );
    if (json) {
      const rights = json.Rights || "-1";
      source.rights = getRightsData(rights);
      setParamRights(json.ParamRights || rights);
      const columns = parseColumns(json);
      checkClsColumn(columns.title, json);
      columns.title = columns.title.filter((column) => column.fieldName !== "SalaryBase");
      const jsonInfo = json.Info;
      setColumnsInfo(jsonInfo || {});
      if (jsonInfo) {
        сhangeGridColumn(jsonInfo.AppName, columns.title, "Name", "Должность");
        сhangeGridColumn(jsonInfo.Count, columns.title, "RateCount", "Ставки");
        сhangeGridColumn(jsonInfo.PersonRates, columns.title, "PersonRates", "Назначения на должность");
        setLabelTabRendHistory(jsonInfo.PersonRates || "Назначения на должность");
        setLabelTabBaseAmounts(jsonInfo.BaseAmounts || "Фонд заработной платы");
      }
      grid.setColumns(columns);
      source.onHandleRequest = onHandleRequestStaff;
      source.onRecordIndexChanged = (source2) => {
        setSelectedAppointmentID(source2.getFieldTextSync("ID"));
      };
      await grid.setSource(source);
      grid.canModify = canModifyAppointmentGrid;
      source.first();
      await grid.refreshSource(rendHistoryParamsSearch.current.appointmentId);
      rendHistoryParamsSearch.current.appointmentId = void 0;
      setSelectedAppointmentID(await grid.source.getFieldText("ID"));
    }
  }
  const getRecordIndexRefresh = (key) => {
    if (key) {
      rendHistoryParamsSearch.current = {};
      const recordIndex = recordsAllRendHistory.current.findIndex((record) => record.RenderingID === key);
      if (recordIndex !== -1) return recordIndex;
    }
    return 0;
  };
  const setAllRendHistorySource = async () => {
    const grid = mainGridRef.current.grid;
    grid.canModify = () => true;
    if (!mainSources.current.allRendHistory) {
      const source = new createRecordSource();
      await GridLoader(
        mainGridRef.current,
        {},
        {
          localGrid: true,
          refresh: true,
          source,
          Columns: columnsAllRendHistory,
          defaultFields: defaultFieldsAllRendHistory,
          keyField: "RenderingID",
          recordKeys: recordKeysAllRendHistory,
          titleKey: "",
          getRecordIndexRefresh,
          getRecords: () => recordsAllRendHistory.current
        }
      );
      source.onRecordIndexChanged = (source2) => {
        setSelectedRendHistoryID(source2.getFieldTextSync("RenderingID"));
        setAmountsPersonText(source2.getFieldTextSync("PersonText"));
      };
      mainSources.current.allRendHistory = source;
    } else grid.setSource(mainSources.current.allRendHistory);
    if (!showAllRendHistory) {
      grid.setColumns(columnsAllRendHistory);
      await grid.updateGridSize();
    }
    await grid.refreshSource(rendHistoryParamsSearch.current.renderingId);
    setSelectedRendHistoryID(await grid.source.getFieldText("RenderingID"));
    setAmountsPersonText(await grid.source.getFieldText("PersonText"));
  };
  async function getRenderingsList() {
    const json = await smetaAxios.get("GetRenderingsList", {
      prefix: Prefixes.staff,
      params: {
        ObjType: ObjType.Appointment,
        ObjRef: groupID,
        ObjFD: getDateForDateObj(selectedPeriod.current.startDate),
        ObjLD: getDateForDateObj(selectedPeriod.current.endDate),
        SectionID: props.sectionId
      },
      loadMask: true
    });
    recordsAllRendHistory.current = Object.values(json).map((item) => {
      const formattedItem = { ...item };
      formattedItem.FirstDate = dayjs(formattedItem.FirstDate).format("DD.MM.YYYY");
      if (formattedItem.LastDate) formattedItem.LastDate = dayjs(formattedItem.LastDate).format("DD.MM.YYYY");
      return formattedItem;
    });
    recordsAllRendHistory.current.sort((a, b) => {
      if (a.PersonText < b.PersonText) {
        return -1;
      }
      if (a.PersonText > b.PersonText) {
        return 1;
      }
      return 0;
    });
    setAllRendHistorySource();
  }
  const periodChange = async (period) => {
    const monthInfo = getMonthInfo(period.year, period.month);
    selectedPeriod.current = {
      startDate: monthInfo.firstDayStr,
      startDateInt: monthInfo.firstDayInt,
      endDate: monthInfo.lastDayStr,
      endDateInt: monthInfo.lastDayInt
    };
    if (staffSettings.UseDepartHisroty === "1")
      await treeRef.current.refreshTree(groupID, { UsedDate: monthInfo.lastDayInt.toString() });
    setMonthYearSelected(period);
  };
  const scrollToSearchResult = async (objRef) => {
    const json = await getRendHistoryParams(objRef);
    const newPeriod = checkNewPeriod(json, monthYearSelected);
    if (newPeriod) await periodChange(newPeriod);
    if (json.DepartmentID === groupID) {
      if (showAllRendHistory) {
        if (newPeriod) {
          rendHistoryParamsSearch.current = { renderingId: json.RenderingID };
          getRenderingsList();
        } else {
          mainGridRef.current.grid.refreshSource(json.RenderingID);
        }
      } else if (selectedAppointmentID === json.AppointmentID) {
        if (newPeriod) {
          rendHistoryParamsSearch.current = { renderingId: json.RenderingID };
          await mainGridRef.current.grid.source.refresh();
          await mainGridRef.current.grid.setSource(mainGridRef.current.grid.source);
          rendHistoryGridPanel.current.updateRecordsRendHistory();
        } else rendHistoryGridPanel.current.grid.refreshSource(json.RenderingID);
      } else {
        rendHistoryParamsSearch.current = { renderingId: json.RenderingID };
        await mainGridRef.current.grid.refreshSource(json.AppointmentID);
        setSelectedAppointmentID(json.AppointmentID);
      }
    } else {
      rendHistoryParamsSearch.current = {
        appointmentId: json.AppointmentID,
        renderingId: indexTabAppointment === 1 ? void 0 : json.RenderingID
      };
      if (!await treeRef.current.selectGroupID(json.DepartmentID)) {
        if (showAllRendHistory) {
          mainGridRef.current.grid.refreshSource(rendHistoryParamsSearch.current.renderingId);
        } else setAppointmentSource();
      }
    }
  };
  const handleTabDocChange = async (index) => {
    setSelectedTabIndex(index);
    const documentButtons = document.getElementById(`buttons_for_section${props.sectionId}`);
    if (index === 1) {
      if (documentButtons) documentButtons.style.display = "";
    } else {
      if (documentButtons) documentButtons.style.display = "none";
    }
    updateGridData(0);
  };
  const onTabReClick = async (index) => {
    var _a2;
    if (index !== 1 || staffSettings.WithOutDocs === "1") return;
    (_a2 = setDocsTabIndex.current) == null ? void 0 : _a2.call(setDocsTabIndex);
  };
  const updateSizeForGrid = () => {
    if (animationsOn) {
      clearTimeout(timerUpdateGrid);
      setTimerUpdateGrid(
        setTimeout(() => {
          updateGridData(0);
        }, 251)
      );
    } else {
      clearTimeout(timerUpdateGrid);
      setTimerUpdateGrid(
        setTimeout(() => {
          updateGridData(0);
        }, 1)
      );
    }
  };
  const handleColapseTree = () => {
    setCollapsedTree(!collapsedTree);
    updateSizeForGrid();
  };
  const handleColapseSearch = () => {
    setCollapsedSearch(!collapsedSearch);
    updateSizeForGrid();
  };
  const handleColapseDetail = () => {
    setCollapsedDetail(!collapsedDetail);
    updateSizeForGrid();
  };
  const handlePeriodChange = async (period) => {
    await periodChange(period);
    if (showAllRendHistory) {
      getRenderingsList();
    } else await mainGridRef.current.grid.refreshSource();
    const currentAppointmentID = mainGridRef.current.grid.source.getFieldTextSync("ID");
    if (currentAppointmentID !== selectedAppointmentID) {
      setSelectedAppointmentID(currentAppointmentID);
    }
  };
  const setStaffObjectValues = async (configSmetaAxios, grid, data) => {
    await smetaAxios.post("SetStaffObjectValues", data, configSmetaAxios);
    await grid.source.refreshRecord();
    await grid.updateGridSize();
  };
  const settingsAppointment = async () => {
    const configSmetaAxios = {
      prefix: Prefixes.staff,
      params: { GroupID: groupID, ObjRef: selectedAppointmentID, ObjType: ObjType.Appointment },
      loadMask: true
    };
    const json = await smetaAxios.get("GetStaffObjectParams", configSmetaAxios);
    smetaModals.open(
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        DialogChangeObjParams,
        {
          dataParams: json,
          onSelect: (data) => setStaffObjectValues(configSmetaAxios, mainGridRef.current.grid, data)
        }
      ),
      {
        Title: json.Caption,
        hiddenButton: true,
        setFocus: true
      }
    );
  };
  const settingsRendHistory = async () => {
    const rendHistoryGrid = rendHistoryGridPanel.current.grid;
    const configSmetaAxios = {
      prefix: Prefixes.staff,
      params: {
        GroupID: groupID,
        ObjRef: rendHistoryGrid.source.getFieldTextSync("ID"),
        ObjType: ObjType.RendHistory
      },
      loadMask: true
    };
    const json = await smetaAxios.get("GetStaffObjectParams", configSmetaAxios);
    smetaModals.open(
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        DialogChangeObjParams,
        {
          dataParams: json,
          onSelect: (data) => setStaffObjectValues(configSmetaAxios, rendHistoryGrid, data)
        }
      ),
      {
        Title: json.Caption,
        hiddenButton: true,
        setFocus: true
      }
    );
  };
  const rendHistoryList = () => {
    const rendHistoryGrid = rendHistoryGridPanel.current.grid;
    smetaModals.open(
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        JobHistoryList,
        {
          personId: rendHistoryGrid.source.getFieldTextSync("PersonID"),
          title: rendHistoryGrid.source.getFieldTextSync("PersonText"),
          onSelect: scrollToSearchResult
        }
      ),
      {
        Title: "История",
        blockMaximize: true,
        blockResize: true,
        blockSaveLocation: true,
        style: getStyleWindow(),
        hiddenButton: true
      }
    );
  };
  const moveObjects = async () => {
    const objType = movableRecords.ObjType;
    await smetaAxios.get("MoveObjects", {
      prefix: Prefixes.staff,
      params: {
        ID: movableRecords.ID,
        GroupID: objType === ObjType.Appointment ? groupID : selectedAppointmentID,
        ObjType: objType
      }
    });
    setMovableRecords({ ID: "", ObjType: 0 });
    if (objType === ObjType.Appointment) {
      const grid = mainGridRef.current.grid;
      await grid.refreshSource();
      setSelectedAppointmentID(await grid.source.getFieldText("ID"));
    } else await rendHistoryGridPanel.current.updateRecordsRendHistory();
    setTimeout(() => {
      const grid = objType === ObjType.Appointment ? mainGridRef.current.grid : rendHistoryGridPanel.current.grid;
      grid.updateGridSize();
    }, 1);
  };
  const contextMenuHandler = async (data) => {
    const updateAllGridSize = () => {
      setTimeout(() => {
        rendHistoryGridPanel.current.grid.updateGridSize();
        mainGridRef.current.grid.updateGridSize();
      }, 1);
    };
    const commandHandlers = {
      settingsAppointment,
      settingsRendHistory,
      rendHistoryList,
      cutAppointments: async () => {
        setMovableRecords({
          ID: await CheckMultiSelect(mainGridRef.current.grid),
          ObjType: ObjType.Appointment
        });
        updateAllGridSize();
      },
      cutRendHistories: async () => {
        setMovableRecords({
          ID: await CheckMultiSelect(rendHistoryGridPanel.current.grid),
          ObjType: ObjType.RendHistory
        });
        updateAllGridSize();
      },
      moveObjects
    };
    const comand = data.value;
    commandHandlers[comand]();
  };
  const handleShowAllRendHistory = () => {
    setIndexTabAppointment(0);
    setShowAllRendHistory(!showAllRendHistory);
    if (showAllRendHistory) {
      setAppointmentSource();
      setInputTariffication(false);
      setAmountsPersonText("");
    } else {
      if (indexTabAppointment === 0)
        rendHistoryParamsSearch.current = {
          renderingId: rendHistoryGridPanel.current.grid.source.getFieldTextSync("RenderingID")
        };
      setSelectedRendHistoryID("");
      setPriorHistoryID("");
      getRenderingsList();
    }
  };
  const handleTabAppointmentChange = async (index) => {
    setIndexTabAppointment(index);
    updateSizeForGrid();
  };
  const defaultButton = selectedTabIndex === 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid2, { style: { display: "flex" }, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { title: "Окно структурных подразделений", arrow: true, enterDelay: 600, children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconButton, { onClick: handleColapseTree, children: ImgURL(getIcons(35)) }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { title: "Панель поиска", arrow: true, enterDelay: 600, children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconButton, { onClick: handleColapseSearch, children: ImgURL(getIcons(12)) }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { title: "Показывать список сотрудников", arrow: true, enterDelay: 600, children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconButton, { onClick: handleShowAllRendHistory, children: ImgURL(getIcons(75)) }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { title: showAllRendHistory ? "Постоянные начисления" : "Назначения и ставки", arrow: true, enterDelay: 600, children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconButton, { onClick: handleColapseDetail, children: showAllRendHistory ? ImgURL(getIcons(116)) : ImgURL(getIcons(34)) }) }),
    showAllRendHistory && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, { orientation: "vertical", flexItem: true }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { title: "Тарификация", arrow: true, enterDelay: 600, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        IconButton,
        {
          onClick: () => {
            setInputTariffication(!inputTariffication);
          },
          children: ImgURL(getIcons(162))
        }
      ) })
    ] })
  ] });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Grid2,
    {
      style: { height: "100%" },
      container: true,
      direction: "column",
      justifyContent: "flex-start",
      alignItems: "flex-start",
      flexWrap: "nowrap",
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(SectionToolsJS, { ID: props.sectionId, defaultButton }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          SmetaTabs,
          {
            style: { height: "100%", width: "100%" },
            onTabIndexChange: handleTabDocChange,
            tabIndex: selectedTabIndex,
            onTabReClick,
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(SmetaTabItem, { label: "Должности и назначения", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Grid2, { container: true, style: { height: "100%", flexDirection: "column" }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
                SplitterLocal,
                {
                  collapsed: collapsedTree,
                  orientation: "vertical",
                  primaryIndex: 1,
                  sizeSecondary: "30%",
                  style: {
                    height: "100%",
                    flex: "1 1"
                  },
                  onCollapse: handleColapseTree,
                  onExpand: handleColapseTree,
                  onResizeEnd: updateSizeForGrid,
                  transitionDuration: 250,
                  children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Tree,
                      {
                        props: {
                          ref: treeRef,
                          Module: "departments",
                          ObjType: ObjType.Department,
                          SectionID: props.sectionId,
                          Info: "0",
                          UsedDate: selectedPeriod.current.endDateInt.toString(),
                          ObjRef: "0",
                          selectID: setGroupID,
                          Current: groupID,
                          defaultMenu: [],
                          noExpandFirst: true
                        }
                      }
                    ),
                    /* @__PURE__ */ jsxRuntimeExports.jsxs(
                      SplitterLocal,
                      {
                        collapsed: collapsedSearch,
                        primaryIndex: 1,
                        sizeSecondary: "265px",
                        orientation: "vertical",
                        onResizeEnd: updateSizeForGrid,
                        hideButtons: true,
                        hideSplitterCollapsed: true,
                        transitionDuration: 250,
                        children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsx(
                            SearchPersons,
                            {
                              module: Prefixes.staff,
                              orientation: "horizontal",
                              sectionId: props.sectionId,
                              objType: ObjType.RendHistory,
                              colapseSearch: handleColapseSearch,
                              selectedPeriod: monthYearSelected,
                              onSelect: scrollToSearchResult
                            }
                          ),
                          /* @__PURE__ */ jsxRuntimeExports.jsxs(
                            "div",
                            {
                              style: {
                                display: "flex",
                                flexDirection: "column"
                              },
                              children: [
                                /* @__PURE__ */ jsxRuntimeExports.jsx(MonthYearPicker, { tooltipOff: true, onChange: handlePeriodChange, value: monthYearSelected }),
                                /* @__PURE__ */ jsxRuntimeExports.jsxs(
                                  SplitterLocal,
                                  {
                                    collapsed: collapsedDetail,
                                    orientation: "horizontal",
                                    primaryIndex: 0,
                                    sizeSecondary: "40%",
                                    style: { width: "calc(100% - 5px)" },
                                    onCollapse: handleColapseDetail,
                                    onExpand: handleColapseDetail,
                                    onResizeEnd: updateSizeForGrid,
                                    transitionDuration: 250,
                                    children: [
                                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                                        ContextMenu,
                                        {
                                          for: showAllRendHistory ? void 0 : "grid",
                                          Menu: {
                                            Table: [
                                              {
                                                Caption: "Перенести должности",
                                                value: "cutAppointments",
                                                Disabled: disabledContextMenuButtons.cut,
                                                ShortCutString: "Ctrl + X"
                                              },
                                              {
                                                Caption: "Вставить должности",
                                                value: "moveObjects",
                                                Disabled: disabledContextMenuButtons.paste,
                                                ShortCutString: "Ctrl + V"
                                              },
                                              {
                                                Caption: "Настройки...",
                                                value: "settingsAppointment",
                                                Disabled: disabledContextMenuButtons.settings
                                              },
                                              { Caption: "Divider" },
                                              {
                                                Caption: "Новая запись",
                                                value: "Insert",
                                                Image: /* @__PURE__ */ jsxRuntimeExports.jsx(PostAddIcon, { fontSize: "small" })
                                              },
                                              {
                                                Caption: "Удалить запись",
                                                value: "Delete",
                                                Image: /* @__PURE__ */ jsxRuntimeExports.jsx(DeleteIcon, { fontSize: "small" })
                                              },
                                              { Caption: "Divider" },
                                              { Caption: "Режим просмотра", value: "OnlyViewMode" },
                                              { Caption: "Сохранять отметку", value: "SaveMark", Disabled: true }
                                            ],
                                            Header: [{ Caption: "Поиск по столбцу", value: "ColumnFilter" }]
                                          },
                                          onMenuItemClick: contextMenuHandler,
                                          refs: { current: (_a = mainGridRef.current) == null ? void 0 : _a.grid },
                                          children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                                            "div",
                                            {
                                              onKeyDown: (ev) => {
                                                if (ev.ctrlKey && !showAllRendHistory) {
                                                  if (ev.code === "KeyX") {
                                                    if (!disabledContextMenuButtons.cut) contextMenuHandler({ value: "cutAppointments" });
                                                  } else if (ev.code === "KeyV") {
                                                    if (!disabledContextMenuButtons.paste) contextMenuHandler({ value: "moveObjects" });
                                                  }
                                                }
                                              },
                                              id: "gridpanelstaff",
                                              style: { height: "100%", width: "100%", position: "relative" },
                                              ref: mainGridRef,
                                              rcsgrid_panel: ""
                                            }
                                          )
                                        }
                                      ),
                                      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { display: "flex", flexDirection: "column-reverse", alignItems: "flex-end" }, children: [
                                        /* @__PURE__ */ jsxRuntimeExports.jsxs(
                                          SmetaTabs,
                                          {
                                            style: { height: "100%", width: "100%" },
                                            position: "bottom",
                                            tabIndex: indexTabAppointment,
                                            onTabIndexChange: handleTabAppointmentChange,
                                            children: [
                                              /* @__PURE__ */ jsxRuntimeExports.jsx(SmetaTabItem, { label: labelTabRendHistory, hidden: showAllRendHistory, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                                                RendHistory,
                                                {
                                                  gridPanel: rendHistoryGridPanel,
                                                  staffSettings,
                                                  appointmentId: selectedAppointmentID,
                                                  groupId: groupID,
                                                  selectedPeriod: selectedPeriod.current,
                                                  columnsInfo,
                                                  jobModes,
                                                  movableRecords,
                                                  contextMenuHandler,
                                                  paramRights,
                                                  open: !collapsedDetail && indexTabAppointment === 0,
                                                  setPriorHistoryID,
                                                  mainGridPanel: mainGridRef.current,
                                                  scrollToSearchResult,
                                                  rendHistoryParamsSearch
                                                }
                                              ) }),
                                              /* @__PURE__ */ jsxRuntimeExports.jsx(
                                                SmetaTabItem,
                                                {
                                                  label: !showAllRendHistory ? labelTabBaseAmounts : "График постоянных начислений",
                                                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                                                    Amounts,
                                                    {
                                                      sectionId: props.sectionId,
                                                      objType: !showAllRendHistory ? ObjType.Appointment : void 0,
                                                      appointmentId: !collapsedDetail && indexTabAppointment === 1 && !showAllRendHistory ? selectedAppointmentID : void 0,
                                                      renderingId: !collapsedDetail && showAllRendHistory ? selectedRendHistoryID : void 0,
                                                      inputTariffication,
                                                      personText: amountsPersonText
                                                    }
                                                  )
                                                }
                                              )
                                            ]
                                          }
                                        ),
                                        /* @__PURE__ */ jsxRuntimeExports.jsx(
                                          IconButton,
                                          {
                                            title: "Предыдущая должность",
                                            onClick: () => scrollToSearchResult(priorHistoryID),
                                            style: {
                                              position: "absolute",
                                              display: priorHistoryID && indexTabAppointment === 0 ? "" : "none",
                                              visibility: priorHistoryID && indexTabAppointment === 0 ? "visible" : "hidden"
                                            },
                                            className: clsx("iconButtonStimate", { light: theme === "light" }),
                                            children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                                              ForwardIcon,
                                              {
                                                fontSize: "small",
                                                style: {
                                                  transform: "rotate(180deg)",
                                                  transformOrigin: "center"
                                                }
                                              }
                                            )
                                          }
                                        )
                                      ] })
                                    ]
                                  }
                                )
                              ]
                            }
                          )
                        ]
                      }
                    )
                  ]
                }
              ) }) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(SmetaTabItem, { label: "Документы", hidden: staffSettings.WithOutDocs === "1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                SectionDocumentsChose,
                {
                  id: props.sectionId,
                  sectionTools: false,
                  setParentFunc: (func) => {
                    setDocsTabIndex.current = func;
                  }
                }
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(SmetaTabItem, { label: "Отчёты", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SectionReports, { CLSID: props.CLSID, id: props.sectionId }) })
            ]
          }
        )
      ]
    }
  );
}
export {
  SectionStaff as default
};
//# sourceMappingURL=SectionStaff-CMk3nPA_.js.map
