10 lines
35 KiB
JavaScript
10 lines
35 KiB
JavaScript
import{j as e,r as j,a as Be,b as We,J as Ve,K as ae}from"./ui-Z445SNHD.js";import{K as X,W as Ke,Y as Xe,u as Y,X as Ye,L as q,I as ce,o as _,V as de,t as U,c as H,Z as Ze,e as M,_ as Qe,$ as et,a0 as tt,a1 as rt,a2 as ue,a3 as he,d as K,a4 as st,a5 as me,a6 as fe,a7 as nt,a as at,a8 as it,a9 as ot,g as pe,aa as lt,ab as ct,ac as ge,ad as xe,x as s,F as dt,ae as ut,af as oe,r as Oe,ag as je,H as ht,s as mt,v as ft,w as pt}from"./app-BJfYyIIX.js";import{T as ve}from"./textarea-Am1DxbQR.js";import{S as be,a as ye,b as Ce,c as we,d as Z}from"./select-v6HfP-lT.js";import{R as gt}from"./react-country-flag.esm-Bs2jngHP.js";import{l as xt}from"./language-BbwPiY59.js";import{S as Se,B as jt,F as vt,a as bt}from"./sparkles-DiRyEFzz.js";import{L as yt}from"./loader-circle-BSOgoX7W.js";import{C as Ne}from"./copy-C-oQ_m_8.js";import{C as Ae,D as Ct,a as wt,b as St,e as Nt,d as Ie,f as At,c as ke,L as It}from"./CookieConsentBanner-C38N4PTk.js";import{C as te}from"./chevron-up-C77P-Xnl.js";import{C as Q}from"./chevron-right-C_sLmqOC.js";import{L as Le}from"./layout-grid-CoeIbdlV.js";import{B as Ee}from"./briefcase-XD6VuWqm.js";import{C as Pe}from"./credit-card-7DJJO-Xg.js";import{S as re}from"./settings-iEK2zkZs.js";import{G as Te}from"./gift-BfcFhtsh.js";import{U as Me}from"./users-TIev6QWg.js";import{C as Re}from"./calendar-CbSq6zTy.js";import{C as kt}from"./calendar-days-C8NX5zeY.js";import{C as Lt}from"./clock-Dx30a3fw.js";import{T as Et}from"./timer-BEVp3YT6.js";import{D as Pt}from"./dollar-sign-GjiaL2_k.js";import{C as Tt}from"./coins-Bsoy02xu.js";import{c as Mt}from"./index-BFT_C1pH.js";import{U as Rt}from"./user-DLrpac_w.js";import{L as Dt}from"./log-out-BMSBi6tX.js";function Ft({variant:t="header",children:n,...o}){const{position:l}=X();return t==="sidebar"?e.jsx(Ke,{...o,children:e.jsx("div",{dir:l==="right"?"rtl":"ltr",children:n})}):e.jsx("main",{className:"mx-auto flex h-full w-full max-w-7xl flex-1 flex-col gap-4 rounded-xl",...o,children:e.jsx("div",{dir:l==="right"?"rtl":"ltr",children:n})})}function _t(t,n){const{registerModal:o,unregisterModal:l,getZIndex:v}=Xe(),[i]=j.useState(()=>t),[r,u]=j.useState(!1),p=n!==void 0?n:r;j.useEffect(()=>(p?o(i):l(i),()=>l(i)),[p,i,o,l]);const f=v(i);return{modalId:i,isOpen:p,setIsOpen:u,zIndex:f,open:()=>u(!0),close:()=>u(!1),toggle:()=>u(y=>!y)}}function $t({isOpen:t,onClose:n,onGenerate:o,title:l="AI Content Generator",placeholder:v="Describe what you want to generate..."}){const{t:i}=Y();_t("chatgpt-modal",t);const[r,u]=j.useState(""),[p,f]=j.useState(""),[y,m]=j.useState(!1),[b,a]=j.useState("en"),[g,c]=j.useState("medium"),[S,N]=j.useState(1),[k,L]=j.useState(150),[R,D]=j.useState(""),[T,E]=j.useState(!1);j.useEffect(()=>{if(t){const d=()=>{document.body.removeAttribute("inert"),document.documentElement.removeAttribute("inert"),document.querySelectorAll("[inert]").forEach(w=>w.removeAttribute("inert"))};d();const A=setInterval(d,100);return()=>clearInterval(A)}},[t]);const x=async()=>{var d;if(!r.trim()){U.error(i("Please enter a prompt"));return}m(!0);try{const A=await fetch(route("chatgpt.generate"),{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-TOKEN":((d=document.querySelector('meta[name="csrf-token"]'))==null?void 0:d.getAttribute("content"))||""},body:JSON.stringify({prompt:r,language:b,creativity:g,num_results:S,max_length:k})}),I=await A.json();if(A.ok&&I.success!==!1)f(I.content),U.success(i("Content generated successfully"));else{const w=I.message||i("Failed to generate content");U.error(w)}}catch(A){const I=A instanceof Error?A.message:i("Error connecting to AI service");U.error(I)}finally{m(!1)}},J=()=>{p&&(o(p),$())},$=()=>{u(""),f(""),D(""),E(!1),n()},h=async d=>{try{await navigator.clipboard.writeText(d),E(!0),U.success(i("Copied to clipboard")),setTimeout(()=>E(!1),2e3)}catch{U.error(i("Failed to copy"))}},P=()=>{const d=document.getElementById("generated-content");if(d){const A=d.selectionStart,I=d.selectionEnd,w=d.value.substring(A,I);D(w)}};if(!t)return null;const C=e.jsxs("div",{className:"fixed inset-0 flex items-center justify-center",style:{zIndex:99999},"data-chatgpt-modal":!0,onClick:d=>{d.target===d.currentTarget&&$()},children:[e.jsx("div",{className:"fixed inset-0 bg-black/30"}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-2xl w-full mx-4 border relative",style:{zIndex:1e5},onClick:d=>d.stopPropagation(),children:[e.jsxs("div",{className:"p-6 border-b flex items-center justify-between",children:[e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(Se,{className:"h-5 w-5 text-blue-500"}),i(l)]}),e.jsx("button",{onClick:$,className:"p-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-full transition-colors",children:e.jsx(Ye,{className:"h-5 w-5"})})]}),e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(q,{children:i("Language")}),e.jsxs(be,{value:b,onValueChange:a,children:[e.jsx(ye,{children:e.jsx(Ce,{})}),e.jsx(we,{style:{zIndex:100010},children:xt.map(d=>e.jsxs(Z,{value:d.code,children:[e.jsx(gt,{countryCode:d.countryCode,svg:!0,style:{width:"1em",height:"1em",marginRight:"8px"}}),d.name]},d.code))})]})]}),e.jsxs("div",{children:[e.jsx(q,{children:i("AI Creativity")}),e.jsxs(be,{value:g,onValueChange:c,children:[e.jsx(ye,{children:e.jsx(Ce,{})}),e.jsxs(we,{style:{zIndex:100010},children:[e.jsxs(Z,{value:"low",children:[i("Low")," (0.3)"]}),e.jsxs(Z,{value:"medium",children:[i("Medium")," (0.7)"]}),e.jsxs(Z,{value:"high",children:[i("High")," (0.9)"]})]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(q,{children:i("Number of Results")}),e.jsx(ce,{type:"number",value:S,onChange:d=>N(Number(d.target.value)),min:1,max:5})]}),e.jsxs("div",{children:[e.jsx(q,{children:i("Max Result Length")}),e.jsx(ce,{type:"number",value:k,onChange:d=>L(Number(d.target.value)),min:50,max:500})]})]}),e.jsxs("div",{children:[e.jsx(q,{htmlFor:"prompt",children:i("Add Text")}),e.jsx(ve,{id:"prompt",value:r,onChange:d=>u(d.target.value),placeholder:i(v),rows:3,className:"mt-1"})]}),e.jsx(_,{onClick:x,disabled:y||!r.trim(),className:"w-full",children:y?e.jsxs(e.Fragment,{children:[e.jsx(yt,{className:"h-4 w-4 mr-2 animate-spin"}),i("Generating...")]}):e.jsxs(e.Fragment,{children:[e.jsx(Se,{className:"h-4 w-4 mr-2"}),i("Generate")]})}),p&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx(q,{htmlFor:"generated",children:i("Output Text")}),e.jsxs("div",{className:"flex gap-2",children:[R&&e.jsxs(_,{size:"sm",variant:"outline",onClick:()=>h(R),children:[T?e.jsx(de,{className:"h-4 w-4"}):e.jsx(Ne,{className:"h-4 w-4"}),i("Copy Selected")]}),e.jsxs(_,{size:"sm",variant:"outline",onClick:()=>h(p),children:[T?e.jsx(de,{className:"h-4 w-4"}):e.jsx(Ne,{className:"h-4 w-4"}),i("Copy Text")]})]})]}),e.jsx(ve,{id:"generated-content",value:p,onChange:d=>f(d.target.value),onSelect:P,rows:6,className:"mt-1"}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(_,{onClick:J,className:"flex-1",children:i("Use This Content")}),e.jsx(_,{variant:"outline",onClick:x,disabled:y,children:i("Regenerate")})]})]})]})]})]});return typeof window<"u"?Be.createPortal(C,document.body):null}function ie(){var g,c,S,N,k,L,R,D,T,E;const{t}=Y(),{auth:n}=H().props,{position:o}=X(),[l,v]=j.useState(!1),[i,r]=j.useState(""),p=(((g=n==null?void 0:n.roles)==null?void 0:g[0])||((c=n==null?void 0:n.user)==null?void 0:c.type))==="superadmin"||((S=n==null?void 0:n.user)==null?void 0:S.type)==="superadmin",f=((N=n==null?void 0:n.user)==null?void 0:N.type)==="company";let y=!1;if(p)y=!0;else if(f)y=((k=n==null?void 0:n.user)==null?void 0:k.plan_is_active)===1&&((L=n==null?void 0:n.user)==null?void 0:L.plan)&&((D=(R=n==null?void 0:n.user)==null?void 0:R.plan)==null?void 0:D.enable_chatgpt)==="on";else{const x=(T=n==null?void 0:n.user)==null?void 0:T.creator;y=(x==null?void 0:x.plan_is_active)===1&&(x==null?void 0:x.plan)&&((E=x==null?void 0:x.plan)==null?void 0:E.enable_chatgpt)==="on"}if(!y)return null;j.useEffect(()=>{},[l]);const m=x=>{r(x)},b=()=>{v(!0)},a=()=>{v(!1)};return Be.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`fixed bottom-6 z-[80000] pointer-events-auto ${o==="right"?"left-6":"right-6"}`,"data-chatgpt-button":!0,style:{pointerEvents:"auto",zIndex:8e4},onClickCapture:x=>{x.preventDefault(),x.stopPropagation(),x.nativeEvent.stopImmediatePropagation(),b()},onMouseDownCapture:x=>{x.preventDefault(),x.stopPropagation()},onClick:x=>{x.preventDefault(),x.stopPropagation()},children:e.jsx(_,{onClick:x=>{x.preventDefault(),x.stopPropagation(),b()},className:"h-14 w-14 rounded-full shadow-lg hover:shadow-xl transition-shadow pointer-events-auto",size:"lg","data-chatgpt-button":!0,style:{pointerEvents:"auto"},children:e.jsx(jt,{className:"h-6 w-6"})})}),e.jsx($t,{isOpen:l,onClose:a,onGenerate:m,title:t("AI Assistant"),placeholder:t("What would you like me to help you generate?")})]}),document.body)}function Bt({children:t,variant:n="header"}){const[o,l]=j.useState(()=>typeof window<"u"?localStorage.getItem("sidebar")!=="false":!0),v=r=>{l(r),typeof window<"u"&&localStorage.setItem("sidebar",String(r))};if(n==="header")return e.jsxs("div",{className:"flex min-h-screen w-full flex-col",children:[t,e.jsx(ie,{}),e.jsx(Ae,{})]});const{position:i}=X();return e.jsx(Ze,{defaultOpen:o,open:o,onOpenChange:v,children:e.jsxs("div",{className:M("flex w-full",i==="right"?"flex-row-reverse":"flex-row"),children:[t,e.jsx(ie,{}),e.jsx(Ae,{})]})})}const De="nav_expanded_items";function Ot({items:t=[],position:n}){const o=H(),{state:l}=Qe(),v=document.documentElement.dir==="rtl",[i,r]=j.useState({}),u=v?n==="left"?"right":"left":n;j.useEffect(()=>{const a={},g=(c,S)=>{c.forEach(N=>{const k=y(N.href),L=N.children&&m(N.children);S&&(k||L)&&(a[S]=!0),N.children&&(k||L||N.defaultOpen===!0)&&(a[N.title]=!0,g(N.children,N.title)),N.children&&p(N.children,1,a)})};g(t),r(a);try{localStorage.setItem(De,JSON.stringify(a))}catch(c){console.error("Error saving navigation state:",c)}},[o.url,t]);const p=(a,g,c)=>{a.forEach(S=>{const N=`${g}-${S.title}`,k=y(S.href),L=S.children&&m(S.children);S.children&&(k||L)&&(c[N]=!0,p(S.children,g+1,c))})},f=a=>{const g={...i,[a]:!i[a]};r(g);try{localStorage.setItem(De,JSON.stringify(g))}catch(c){console.error("Error saving navigation state:",c)}},y=a=>{if(!a)return!1;const g=a.startsWith("http")?new URL(a).pathname:a,c=o.url.split("?")[0].split("#")[0],S=g.replace(/\/$/,""),N=c.replace(/\/$/,"");return!!(N===S||N.startsWith(S+"/"))},m=a=>a?a.some(g=>y(g.href)||m(g.children)):!1,b=(a,g=1)=>e.jsx(st,{children:a.map(c=>e.jsx("div",{children:c.children?e.jsxs(e.Fragment,{children:[e.jsx(me,{children:e.jsx(fe,{isActive:m(c.children),onClick:()=>f(`${g}-${c.title}`),className:"cursor-pointer",children:e.jsxs("div",{className:`flex items-center gap-2 ${u==="right"?"justify-end text-right":"justify-start text-left"}`,children:[e.jsx("span",{children:c.title}),l!=="collapsed"&&(i[`${g}-${c.title}`]?e.jsx(te,{className:"h-3 w-3 ml-auto"}):e.jsx(Q,{className:"h-3 w-3 ml-auto"}))]})})}),i[`${g}-${c.title}`]&&b(c.children,g+1)]}):e.jsx(me,{children:e.jsx(fe,{asChild:!0,isActive:y(c.href),children:c.target==="_blank"?e.jsx("a",{href:c.href||"#",target:"_blank",rel:"noopener noreferrer",className:`flex items-center gap-2 ${u==="right"?"justify-end text-right":"justify-start text-left"}`,children:e.jsx("span",{children:c.title})}):e.jsx(K,{href:c.href||"#",prefetch:!0,className:`flex items-center gap-2 ${u==="right"?"justify-end text-right":"justify-start text-left"}`,children:e.jsx("span",{children:c.title})})})})},c.title))});return e.jsxs(et,{className:"px-1.5 py-0",children:[e.jsx(tt,{className:`flex w-full text-xs ${u==="right"?"justify-end":"justify-start"}`}),e.jsx(rt,{children:t.map(a=>e.jsx("div",{children:a.children?e.jsxs(e.Fragment,{children:[e.jsx(ue,{children:e.jsx(he,{isActive:m(a.children),tooltip:{children:a.title},onClick:()=>f(a.title),className:"cursor-pointer",children:e.jsx("div",{className:`flex items-center gap-2 w-full ${u==="right"?"justify-end text-right":"justify-start text-left"}`,children:u==="right"?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:l!=="collapsed"?a.title:""}),a.icon&&e.jsx(a.icon,{className:"h-4 w-4"}),l!=="collapsed"&&(i[a.title]?e.jsx(te,{className:"h-3 w-3"}):e.jsx(Q,{className:"h-3 w-3"}))]}):e.jsxs(e.Fragment,{children:[a.icon&&e.jsx(a.icon,{className:"h-4 w-4"}),e.jsxs("div",{className:"flex items-center gap-1",children:[l!=="collapsed"&&e.jsx("span",{children:a.title}),l!=="collapsed"&&a.badge&&e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] font-medium rounded-full bg-primary text-white",children:a.badge.label})]}),l!=="collapsed"&&(i[a.title]?e.jsx(te,{className:"h-3 w-3 ml-auto"}):e.jsx(Q,{className:"h-3 w-3 ml-auto"}))]})})})}),l!=="collapsed"&&i[a.title]&&b(a.children)]}):e.jsx(ue,{children:e.jsx(he,{asChild:!0,isActive:y(a.href),tooltip:{children:a.title},children:a.target==="_blank"?e.jsx("a",{href:a.href||"#",target:"_blank",rel:"noopener noreferrer",className:`flex items-center gap-2 ${u==="right"?"justify-end text-right":"justify-start text-left"}`,children:u==="right"?e.jsxs(e.Fragment,{children:[l!=="collapsed"&&e.jsx("span",{children:a.title}),a.icon&&e.jsx(a.icon,{className:"h-4 w-4"})]}):e.jsxs(e.Fragment,{children:[a.icon&&e.jsx(a.icon,{className:"h-4 w-4"}),l!=="collapsed"&&e.jsx("span",{children:a.title})]})}):e.jsx(K,{href:a.href||"#",prefetch:!0,className:`flex items-center gap-2 ${u==="right"?"justify-end text-right":"justify-start text-left"}`,children:u==="right"?e.jsxs(e.Fragment,{children:[l!=="collapsed"&&e.jsx("span",{children:a.title}),a.icon&&e.jsx(a.icon,{className:"h-4 w-4"})]}):e.jsxs(e.Fragment,{children:[a.icon&&e.jsx(a.icon,{className:"h-4 w-4"}),l!=="collapsed"&&e.jsx("span",{children:a.title})]})})})})},a.title))})]})}function Gt(){var J,$;const{t,i18n:n}=Y(),{auth:o,globalSettings:l,companySlug:v}=H().props,i=((J=o.user)==null?void 0:J.type)||(($=o.user)==null?void 0:$.role),r=(o==null?void 0:o.permissions)||[],u=l==null?void 0:l.is_saas;document.documentElement.dir;const y=i==="superadmin"?[{title:t("Dashboard"),href:route("dashboard"),icon:Le},{title:t("Companies"),href:route("companies.index"),icon:Ee},{title:t("Media Library"),href:route("media-library"),icon:ge},{title:t("Plans"),icon:Pe,children:[{title:t("Plan"),href:route("plans.index")},{title:t("Plan Request"),href:route("plan-requests.index")},{title:t("Plan Orders"),href:route("plan-orders.index")}]},{title:t("Coupons"),href:route("coupons.index"),icon:re},{title:t("Referral Program"),href:route("referral.index"),icon:Te},{title:t("Landing Page"),icon:xe,children:[{title:t("Landing Page"),href:route("landing-page")},{title:t("Custom Pages"),href:route("landing-page.custom-pages.index")},...s(r,"manage-contacts")?[{title:t("Contact Inquiries"),href:route("contacts.index")}]:[],...s(r,"manage-newsletters")?[{title:t("Newsletter"),href:route("newsletters.index")}]:[]]},{title:t("Settings"),href:route("settings"),icon:re}]:(()=>{const h=[];s(r,"manage-dashboard")&&h.push({title:t("Dashboard"),href:route("dashboard"),icon:Le});const P=[];s(r,"manage-users")&&P.push({title:t("Users"),href:route("users.index")}),s(r,"manage-roles")&&P.push({title:t("Roles"),href:route("roles.index")}),P.length>0&&h.push({title:t("Staff"),icon:Me,children:P});const C=[];s(r,"manage-branches")&&C.push({title:t("Branches"),href:route("hr.branches.index")}),s(r,"manage-departments")&&C.push({title:t("Departments"),href:route("hr.departments.index")}),s(r,"manage-designations")&&C.push({title:t("Designations"),href:route("hr.designations.index")}),s(r,"manage-document-types")&&C.push({title:t("Document Types"),href:route("hr.document-types.index")}),s(r,"manage-employees")&&C.push({title:t("Employees"),href:route("hr.employees.index")}),s(r,"manage-award-types")&&C.push({title:t("Award Types"),href:route("hr.award-types.index")}),s(r,"manage-awards")&&C.push({title:t("Awards"),href:route("hr.awards.index")}),s(r,"manage-promotions")&&C.push({title:t("Promotions"),href:route("hr.promotions.index")});const d=[];s(r,"manage-performance-indicator-categories")&&d.push({title:t("Indicator Categories"),href:route("hr.performance.indicator-categories.index")}),s(r,"manage-performance-indicators")&&d.push({title:t("Indicators"),href:route("hr.performance.indicators.index")}),s(r,"manage-goal-types")&&d.push({title:t("Goal Types"),href:route("hr.performance.goal-types.index")}),s(r,"manage-employee-goals")&&d.push({title:t("Employee Goals"),href:route("hr.performance.employee-goals.index")}),s(r,"manage-review-cycles")&&d.push({title:t("Review Cycles"),href:route("hr.performance.review-cycles.index")}),s(r,"manage-employee-reviews")&&d.push({title:t("Employee Reviews"),href:route("hr.performance.employee-reviews.index")}),d.length>0&&C.push({title:t("Performance"),children:d}),s(r,"manage-resignations")&&C.push({title:t("Resignations"),href:route("hr.resignations.index")}),s(r,"manage-terminations")&&C.push({title:t("Terminations"),href:route("hr.terminations.index")}),s(r,"manage-warnings")&&C.push({title:t("Warnings"),href:route("hr.warnings.index")}),s(r,"manage-trips")&&C.push({title:t("Trips"),href:route("hr.trips.index")}),s(r,"manage-complaints")&&C.push({title:t("Complaints"),href:route("hr.complaints.index")}),s(r,"manage-employee-transfers")&&C.push({title:t("Transfers"),href:route("hr.transfers.index")}),s(r,"manage-holidays")&&C.push({title:t("Holidays"),href:route("hr.holidays.index")}),s(r,"manage-announcements")&&C.push({title:t("Announcements"),href:route("hr.announcements.index")});const A=[];s(r,"manage-asset-types")&&A.push({title:t("Asset Types"),href:route("hr.asset-types.index")}),s(r,"manage-assets")&&A.push({title:t("Assets"),href:route("hr.assets.index")}),s(r,"manage-assets")&&A.push({title:t("Dashboard"),href:route("hr.assets.dashboard")}),s(r,"manage-assets")&&A.push({title:t("Depreciation"),href:route("hr.assets.depreciation-report")}),A.length>0&&C.push({title:t("Asset Management"),children:A});const I=[];s(r,"manage-training-types")&&I.push({title:t("Training Types"),href:route("hr.training-types.index")}),s(r,"manage-training-programs")&&I.push({title:t("Training Programs"),href:route("hr.training-programs.index")}),s(r,"manage-training-sessions")&&I.push({title:t("Training Sessions"),href:route("hr.training-sessions.index")}),s(r,"manage-employee-trainings")&&I.push({title:t("Employee Trainings"),href:route("hr.employee-trainings.index")}),I.length>0&&C.push({title:t("Training"),children:I}),C.length>0&&h.push({title:t("HR Management"),icon:Ee,children:C});const w=[];s(r,"manage-job-categories")&&w.push({title:t("Job Categories"),href:route("hr.recruitment.job-categories.index")}),s(r,"manage-job-types")&&w.push({title:t("Job Types"),href:route("hr.recruitment.job-types.index")}),s(r,"manage-job-locations")&&w.push({title:t("Job Locations"),href:route("hr.recruitment.job-locations.index")}),s(r,"manage-custom-questions")&&w.push({title:t("Custom Questions"),href:route("hr.recruitment.custom-questions.index")}),s(r,"manage-job-postings")&&w.push({title:t("Job Postings"),href:route("hr.recruitment.job-postings.index")}),s(r,"manage-candidate-sources")&&w.push({title:t("Candidate Sources"),href:route("hr.recruitment.candidate-sources.index")}),s(r,"manage-candidates")&&w.push({title:t("Candidates"),href:route("hr.recruitment.candidates.index")}),s(r,"manage-interview-types")&&w.push({title:t("Interview Types"),href:route("hr.recruitment.interview-types.index")}),s(r,"manage-interview-rounds")&&w.push({title:t("Interview Rounds"),href:route("hr.recruitment.interview-rounds.index")}),s(r,"manage-interviews")&&w.push({title:t("Interviews"),href:route("hr.recruitment.interviews.index")}),s(r,"manage-interview-feedback")&&w.push({title:t("Interview Feedback"),href:route("hr.recruitment.interview-feedback.index")}),s(r,"manage-candidate-assessments")&&w.push({title:t("Candidate Assessments"),href:route("hr.recruitment.candidate-assessments.index")}),s(r,"manage-offer-templates")&&w.push({title:t("Offer Templates"),href:route("hr.recruitment.offer-templates.index")}),s(r,"manage-offers")&&w.push({title:t("Offers"),href:route("hr.recruitment.offers.index")}),s(r,"manage-onboarding-checklists")&&w.push({title:t("Onboarding Checklists"),href:route("hr.recruitment.onboarding-checklists.index")}),s(r,"manage-checklist-items")&&w.push({title:t("Checklist Items"),href:route("hr.recruitment.checklist-items.index")}),s(r,"manage-candidate-onboarding")&&w.push({title:t("Candidate Onboarding"),href:route("hr.recruitment.candidate-onboarding.index")}),s(r,"manage-career-page")&&v&&w.push({title:t("Career"),href:route("career.index",v),target:"_blank"}),w.length>0&&h.push({title:t("Recruitment"),icon:Me,children:w});const W=[];s(r,"manage-contract-types")&&W.push({title:t("Contract Types"),href:route("hr.contracts.contract-types.index")}),s(r,"manage-employee-contracts")&&W.push({title:t("Employee Contracts"),href:route("hr.contracts.employee-contracts.index")}),s(r,"manage-contract-templates")&&W.push({title:t("Contract Templates"),href:route("hr.contracts.contract-templates.index")}),W.length>0&&h.push({title:t("Contract Management"),icon:dt,children:W});const B=[];s(r,"manage-document-categories")&&B.push({title:t("Document Categories"),href:route("hr.documents.document-categories.index")}),s(r,"manage-hr-documents")&&B.push({title:t("HR Documents"),href:route("hr.documents.hr-documents.index")}),s(r,"manage-document-acknowledgments")&&B.push({title:t("Acknowledgments"),href:route("hr.documents.document-acknowledgments.index")}),s(r,"manage-document-templates")&&B.push({title:t("Document Templates"),href:route("hr.documents.document-templates.index")}),B.length>0&&h.push({title:t("Document Management"),icon:vt,children:B});const F=[];s(r,"manage-meeting-types")&&F.push({title:t("Meeting Types"),href:route("meetings.meeting-types.index")}),s(r,"manage-meeting-rooms")&&F.push({title:t("Meeting Rooms"),href:route("meetings.meeting-rooms.index")}),s(r,"manage-meetings")&&F.push({title:t("Meetings"),href:route("meetings.meetings.index")}),s(r,"manage-meeting-attendees")&&F.push({title:t("Meeting Attendees"),href:route("meetings.meeting-attendees.index")}),s(r,"manage-meeting-minutes")&&F.push({title:t("Meeting Minutes"),href:route("meetings.meeting-minutes.index")}),s(r,"manage-action-items")&&F.push({title:t("Action Items"),href:route("meetings.action-items.index")}),F.length>0&&h.push({title:t("Meetings"),icon:Re,children:F}),(s(r,"view-calendar")||s(r,"manage-calendar"))&&h.push({title:t("Calendar"),href:route("calendar.index"),icon:Re}),s(r,"manage-media")&&h.push({title:t("Media Library"),href:route("media-library"),icon:ge});const O=[];s(r,"manage-leave-types")&&O.push({title:t("Leave Types"),href:route("hr.leave-types.index")}),s(r,"manage-leave-policies")&&O.push({title:t("Leave Policies"),href:route("hr.leave-policies.index")}),s(r,"manage-leave-applications")&&O.push({title:t("Leave Applications"),href:route("hr.leave-applications.index")}),s(r,"manage-leave-balances")&&O.push({title:t("Leave Balances"),href:route("hr.leave-balances.index")}),O.length>0&&h.push({title:t("Leave Management"),icon:kt,children:O});const G=[];s(r,"manage-shifts")&&G.push({title:t("Shifts"),href:route("hr.shifts.index")}),s(r,"manage-attendance-policies")&&G.push({title:t("Attendance Policies"),href:route("hr.attendance-policies.index")}),s(r,"manage-attendance-records")&&G.push({title:t("Attendance Records"),href:route("hr.attendance-records.index")}),s(r,"manage-attendance-regularizations")&&G.push({title:t("Attendance Regularizations"),href:route("hr.attendance-regularizations.index")}),G.length>0&&h.push({title:t("Attendance"),icon:Lt,children:G}),s(r,"manage-biometric-attendance")&&h.push({title:t("Biometric Attendance"),href:route("hr.biometric-attendance.index"),icon:bt});const ee=[];s(r,"manage-time-entries")&&ee.push({title:t("Time Entries"),href:route("hr.time-entries.index")}),ee.length>0&&h.push({title:t("Time Tracking"),icon:Et,children:ee});const z=[];s(r,"manage-salary-components")&&z.push({title:t("Salary Components"),href:route("hr.salary-components.index")}),s(r,"manage-employee-salaries")&&z.push({title:t("Employee Salaries"),href:route("hr.employee-salaries.index")}),s(r,"manage-payroll-runs")&&z.push({title:t("Payroll Runs"),href:route("hr.payroll-runs.index")}),s(r,"manage-payslips")&&z.push({title:t("Payslips"),href:route("hr.payslips.index")}),z.length>0&&h.push({title:t("Payroll Management"),icon:Pt,children:z});const V=[];return s(r,"manage-plans")&&V.push({title:t("Plans"),href:route("plans.index")}),s(r,"view-plan-requests")&&V.push({title:t("Plan Requests"),href:route("plan-requests.index")}),s(r,"view-plan-orders")&&V.push({title:t("Plan Orders"),href:route("plan-orders.index")}),V.length>0&&h.push({title:t("Plans"),icon:Pe,children:V}),s(r,"manage-referral")&&h.push({title:t("Referral Program"),href:route("referral.index"),icon:Te}),!u&&s(r,"manage-currencies")&&h.push({title:t("Currency"),href:route("currencies.index"),icon:Tt}),!u&&s(r,"manage-landing-page")&&h.push({title:t("Landing Page"),icon:xe,children:[{title:t("Landing Page"),href:route("landing-page")},{title:t("Custom Pages"),href:route("landing-page.custom-pages.index")},...s(r,"manage-contacts")?[{title:t("Contact Inquiries"),href:route("contacts.index")}]:[],...s(r,"manage-newsletters")?[{title:t("Newsletter"),href:route("newsletters.index")}]:[]]}),s(r,"manage-settings")&&h.push({title:t("Settings"),href:route("settings"),icon:re}),h})(),{position:m,effectivePosition:b}=X(),{variant:a,collapsible:g,style:c}=nt(),{logoLight:S,logoDark:N,favicon:k,titleText:L,updateBrandSettings:R}=at(),[D,T]=j.useState({});j.useEffect(()=>{T(c==="colored"?{backgroundColor:"var(--primary)",color:"white"}:c==="gradient"?{background:"linear-gradient(to bottom, var(--primary), color-mix(in srgb, var(--primary), transparent 20%))",color:"white"}:{})},[c]);const E=y,x=()=>{if(E.length===0)return route("dashboard");const h=E[0];return h.href?h.href:h.children&&h.children.length>0&&h.children[0].href||route("dashboard")};return e.jsxs(it,{side:b,collapsible:g,variant:a,className:c!=="plain"?"sidebar-custom-style":"",children:[e.jsx(ot,{className:c!=="plain"?"sidebar-styled":"",style:D,children:e.jsx("div",{className:"flex justify-center items-center p-2",children:e.jsxs(K,{href:x(),prefetch:!0,className:"flex items-center justify-center",children:[e.jsx("div",{className:"group-data-[collapsible=icon]:hidden flex items-center",children:(()=>{const h=document.documentElement.classList.contains("dark"),P=h?S:N,C=pe(P)??P;return C?e.jsx("img",{src:C,alt:"Logo",className:"w-auto transition-all duration-200",onError:()=>R({[h?"logoLight":"logoDark"]:""})},`${P}-${Date.now()}`):e.jsx("div",{className:"h-12 text-inherit font-semibold flex items-center text-lg tracking-tight",children:L||"WorkDo"})})()}),e.jsx("div",{className:"h-8 w-8 hidden group-data-[collapsible=icon]:block",children:(()=>{const h=k?pe(k):"";return h?e.jsx("img",{src:h,alt:"Icon",className:"h-8 w-8 transition-all duration-200",onError:()=>R({favicon:""})},`${k}-${Date.now()}`):e.jsx("div",{className:"h-8 w-8 bg-primary text-white rounded flex items-center justify-center font-bold shadow-sm",children:(L==null?void 0:L.charAt(0))||"W"})})()})]})})}),e.jsx(lt,{children:e.jsx("div",{style:D,className:`h-full ${c!=="plain"?"sidebar-styled":""}`,children:e.jsx(Ot,{items:E,position:b})})}),e.jsx(ct,{})]})}function zt({...t}){return e.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...t})}function qt({className:t,...n}){return e.jsx("ol",{"data-slot":"breadcrumb-list",className:M("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",t),...n})}function Ut({className:t,...n}){return e.jsx("li",{"data-slot":"breadcrumb-item",className:M("inline-flex items-center gap-1.5",t),...n})}function Ht({asChild:t,className:n,...o}){const l=t?ut:"a";return e.jsx(l,{"data-slot":"breadcrumb-link",className:M("hover:text-foreground transition-colors cursor-pointer",n),...o})}function Jt({className:t,...n}){return e.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:M("text-foreground font-normal",t),...n})}function Wt({children:t,className:n,...o}){return e.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:M("[&>svg]:size-3.5",n),...o,children:t??e.jsx(Q,{})})}function Vt({items:t}){return e.jsx(e.Fragment,{children:t&&t.length>0&&e.jsx(zt,{children:e.jsx(qt,{children:t.map((n,o)=>{const l=o===t.length-1;return e.jsxs(j.Fragment,{children:[e.jsx(Ut,{children:l?e.jsx(Jt,{children:n.label}):e.jsx(Ht,{asChild:!0,children:e.jsx(K,{href:n.href||"#",children:n.label})})}),!l&&e.jsx(Wt,{})]},o)})})})})}var se={exports:{}},ne={};/**
|
|
* @license React
|
|
* use-sync-external-store-shim.production.js
|
|
*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/var Fe;function Kt(){if(Fe)return ne;Fe=1;var t=We();function n(m,b){return m===b&&(m!==0||1/m===1/b)||m!==m&&b!==b}var o=typeof Object.is=="function"?Object.is:n,l=t.useState,v=t.useEffect,i=t.useLayoutEffect,r=t.useDebugValue;function u(m,b){var a=b(),g=l({inst:{value:a,getSnapshot:b}}),c=g[0].inst,S=g[1];return i(function(){c.value=a,c.getSnapshot=b,p(c)&&S({inst:c})},[m,a,b]),v(function(){return p(c)&&S({inst:c}),m(function(){p(c)&&S({inst:c})})},[m]),r(a),a}function p(m){var b=m.getSnapshot;m=m.value;try{var a=b();return!o(m,a)}catch{return!0}}function f(m,b){return b()}var y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:u;return ne.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:y,ne}var _e;function Xt(){return _e||(_e=1,se.exports=Kt()),se.exports}var Yt=Xt();function Zt(){return Yt.useSyncExternalStore(Qt,()=>!0,()=>!1)}function Qt(){return()=>{}}var le="Avatar",[er]=Mt(le),[tr,Ge]=er(le),ze=j.forwardRef((t,n)=>{const{__scopeAvatar:o,...l}=t,[v,i]=j.useState("idle");return e.jsx(tr,{scope:o,imageLoadingStatus:v,onImageLoadingStatusChange:i,children:e.jsx(oe.span,{...l,ref:n})})});ze.displayName=le;var qe="AvatarImage",Ue=j.forwardRef((t,n)=>{const{__scopeAvatar:o,src:l,onLoadingStatusChange:v=()=>{},...i}=t,r=Ge(qe,o),u=rr(l,i),p=Ve(f=>{v(f),r.onImageLoadingStatusChange(f)});return ae(()=>{u!=="idle"&&p(u)},[u,p]),u==="loaded"?e.jsx(oe.img,{...i,ref:n,src:l}):null});Ue.displayName=qe;var He="AvatarFallback",Je=j.forwardRef((t,n)=>{const{__scopeAvatar:o,delayMs:l,...v}=t,i=Ge(He,o),[r,u]=j.useState(l===void 0);return j.useEffect(()=>{if(l!==void 0){const p=window.setTimeout(()=>u(!0),l);return()=>window.clearTimeout(p)}},[l]),r&&i.imageLoadingStatus!=="loaded"?e.jsx(oe.span,{...v,ref:n}):null});Je.displayName=He;function $e(t,n){return t?n?(t.src!==n&&(t.src=n),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function rr(t,{referrerPolicy:n,crossOrigin:o}){const l=Zt(),v=j.useRef(null),i=l?(v.current||(v.current=new window.Image),v.current):null,[r,u]=j.useState(()=>$e(i,t));return ae(()=>{u($e(i,t))},[i,t]),ae(()=>{const p=m=>()=>{u(m)};if(!i)return;const f=p("loaded"),y=p("error");return i.addEventListener("load",f),i.addEventListener("error",y),n&&(i.referrerPolicy=n),typeof o=="string"&&(i.crossOrigin=o),()=>{i.removeEventListener("load",f),i.removeEventListener("error",y)}},[i,o,n]),r}var sr=ze,nr=Ue,ar=Je;function ir({className:t,...n}){return e.jsx(sr,{"data-slot":"avatar",className:M("relative flex size-8 shrink-0 overflow-hidden rounded-full",t),...n})}function or({className:t,...n}){return e.jsx(nr,{"data-slot":"avatar-image",className:M("aspect-square size-full",t),...n})}function lr({className:t,...n}){return e.jsx(ar,{"data-slot":"avatar-fallback",className:M("bg-muted flex size-full items-center justify-center rounded-full",t),...n})}function cr(){const{t}=Y(),{auth:n}=H().props,o=n==null?void 0:n.user,l=()=>{Oe.post(route("logout"))},v=o!=null&&o.name?o.name.split(" ").map(i=>i[0]).join("").toUpperCase():"U";return e.jsxs(Ct,{children:[e.jsx(wt,{asChild:!0,children:e.jsxs(_,{variant:"ghost",className:"flex items-center gap-2 h-8 rounded-md",children:[e.jsx("span",{className:"text-sm font-medium hidden md:inline-block",children:o==null?void 0:o.name}),e.jsxs(ir,{className:"h-8 w-8",children:[e.jsx(or,{src:(o==null?void 0:o.avatar)||""}),e.jsx(lr,{children:v})]})]})}),e.jsxs(St,{className:"w-56",align:"end",forceMount:!0,children:[e.jsx(Nt,{className:"font-normal",children:e.jsxs("div",{className:"flex flex-col space-y-1",children:[e.jsx("p",{className:"text-sm font-medium leading-none",children:o==null?void 0:o.name}),e.jsx("p",{className:"text-xs leading-none text-muted-foreground",children:o==null?void 0:o.email})]})}),e.jsx(Ie,{}),e.jsx(At,{children:e.jsx(ke,{asChild:!0,children:e.jsxs(K,{href:route("profile"),children:[e.jsx(Rt,{className:"mr-2 h-4 w-4"}),e.jsx("span",{children:t("Profile")})]})})}),e.jsx(Ie,{}),e.jsxs(ke,{onClick:l,children:[e.jsx(Dt,{className:"mr-2 h-4 w-4"}),e.jsx("span",{children:t("Log out")})]})]})]})}function dr({breadcrumbs:t=[]}){const{t:n}=Y(),{position:o}=X();return e.jsx(e.Fragment,{children:e.jsx("header",{className:"border-sidebar-border/50 flex h-14 shrink-0 items-center gap-2 border-b px-4 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12 md:px-3",children:e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[o==="left"&&e.jsx(je,{className:"-ml-1"}),e.jsx(Vt,{items:t.map(l=>({label:l.title,href:l.href}))})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[H().props.isImpersonating&&e.jsx("button",{onClick:()=>Oe.post(route("impersonate.leave")),className:"bg-red-500 text-white px-2 py-1 rounded text-xs hover:bg-red-600 cursor-pointer",children:n("Return Back")}),e.jsx(It,{}),e.jsx(cr,{}),o==="right"&&e.jsx(je,{className:"-mr-1"})]})]})})})}function ur({children:t,breadcrumbs:n=[]}){return e.jsxs(Bt,{variant:"sidebar",children:[e.jsx(Gt,{}),e.jsxs(Ft,{variant:"sidebar",children:[e.jsx(dr,{breadcrumbs:n}),t]})]})}const hr=({children:t,breadcrumbs:n,...o})=>e.jsx(ur,{breadcrumbs:n,...o,children:t});function Or({title:t,description:n,url:o,actions:l,children:v,noPadding:i=!1,breadcrumbs:r}){var p;const u=r||[{title:t,href:o}];return e.jsxs(hr,{breadcrumbs:u,children:[e.jsx(ht,{title:`${t} - ${((p=H().props.globalSettings)==null?void 0:p.titleText)||"HRM"}`}),e.jsxs("div",{className:"flex h-full flex-1 flex-col gap-4 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"text-xl font-semibold",children:t}),l&&l.length>0&&e.jsx("div",{className:"flex items-center gap-2",children:l.map((f,y)=>{const m=f.label&&f.label.trim()!=="",b=m?"sm":"icon",a=e.jsxs(_,{variant:f.variant||"outline",size:b,onClick:f.onClick,className:"cursor-pointer",children:[f.icon&&!m&&f.icon,f.icon&&m&&f.icon,m&&f.label]});return f.tooltip&&f.tooltip.trim()!==""?e.jsxs(mt,{children:[e.jsx(ft,{asChild:!0,children:a}),e.jsx(pt,{children:e.jsx("p",{children:f.tooltip})})]},y):e.jsx("span",{children:a},y)})})]}),e.jsx("div",{className:i?"":"rounded-xl border p-6",children:v})]}),e.jsx(ie,{})]})}export{ir as A,$t as C,Or as P,or as a,lr as b,Xt as r};
|