import{r as h,j as e,f as r}from"./app-Bup04Qnx.js";import{M as o}from"./WithModal-CbKxT3eW.js";import{A as j}from"./AuthenticatedLayout-BdDF4YYO.js";import{k as x}from"./format-CisCU4Rs.js";import b from"./CompanyModal-DqInHDl0.js";import p from"./DepartmentModal-C2ZRugrB.js";import"./index-DdNKWgRS.js";import"./clsx-B-dksMZM.js";import"./index-CtjruoRR.js";import"./floating-ui.dom-CwWDmSD9.js";import"./Select-Cs0aMrtU.js";import"./BaseForm-wkPKZ5Eg.js";function B(a){var t,i,n,m,d;return h.useEffect(()=>{var l,c;return a.company||document.getElementById("modal_company").click(),a.company&&((l=a.companies)!=null&&l.find(s=>s.value==a.company.id)||x("company_id",{onSuccess:()=>{r.visit("/admin/dashboard")}})),a.department&&((c=a.departments)!=null&&c.find(s=>s.value==a.department.id)||x("department_id",{onSuccess:()=>{r.visit("/admin/dashboard")}})),()=>{}},[]),e.jsxs(j,{title:a.title,children:[e.jsxs("div",{className:"flex flex-wrap items-stretch justify-start gap-4 pt-8 ml-2",children:[e.jsxs(f,{label:"",icon:"fa-building",children:[e.jsx("div",{className:"flex gap-4",children:e.jsxs("div",{className:"",children:[e.jsx("p",{className:"text-sm",children:"Perusahaan Aktif"}),e.jsx("p",{className:"font-semibold text-lg",children:((t=a.company)==null?void 0:t.name)??"-"})]})}),e.jsx("div",{className:"text-end mt-2",children:e.jsx(o,{id:"company",className:"btn btn-sm btn-outline mr-2",children:"Ganti Perusahaan"})})]}),["user","manager","director"].includes((n=(i=a==null?void 0:a.auth)==null?void 0:i.user)==null?void 0:n.role)&&e.jsxs(f,{label:"",icon:"fa-sitemap",children:[e.jsx("div",{className:"flex gap-4",children:e.jsxs("div",{className:"",children:[e.jsx("p",{className:"text-sm",children:"Departemen Aktif"}),e.jsx("p",{className:"font-semibold text-lg",children:((m=a.department)==null?void 0:m.name)??"-"})]})}),e.jsx("div",{className:"text-end mt-2",children:e.jsx(o,{id:"department",disabled:!((d=a==null?void 0:a.company)!=null&&d.id),className:"btn btn-sm btn-outline mr-2",children:"Ganti Departemen"})})]})]}),e.jsx(b,{}),e.jsx(p,{})]})}const f=({children:a,label:t,icon:i})=>e.jsxs("div",{className:"border bg-blue-100 shadow-lg border-blue-200 bg-opacity-80 px-4 py-2 rounded-lg flex gap-2 w-full sm:w-max",children:[e.jsx("i",{className:`fas fa-3x opacity-80 ${i}`}),e.jsxs("div",{className:"",children:[e.jsx("p",{className:"opacity-90",children:t}),a]})]});export{B as default};
