1import{a as b,b as r,j as e,L as l,c as n,r as f}from"./app-CA5WS0_0.js";import{A as j}from"./AppShell-QAd3lJ2d.js";import"./createLucideIcon-Bk8C-Oy5.js";import"./users-round-D_BAR1t5.js";import"./calendar-days-B5dt_BJo.js";import"./x-B7ErT5eW.js";import"./chevron-down-D89hnrhd.js";import"./chevron-left-lQBZdP_T.js";function G({staff:t,search:u,exceptions:h}){const s=b().props.auth.user.hr_preview,[o,x]=r.useState(u),[c,i]=r.useState(null),[d,m]=r.useState(""),p=a=>{a.preventDefault(),f.get(n("/hr/geofencing"),{search:o},{preserveState:!0})},g=a=>{s||f.patch(n(`/hr/employees/${a.id}/geofencing`),{geofence_required:!a.geofence_required},{preserveScroll:!0,onStart:()=>{i(a.id),m("")},onFinish:()=>i(null),onError:()=>m("Could not save this rule. Refresh and try again.")})};return e.jsxs(j,{title:"Attendance location rules",breadcrumb:"HR & Workforce / Geofencing",children:[e.jsxs("div",{className:"mb-5",children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Attendance location rules"}),e.jsx("p",{className:"mt-2 text-sm text-slate-600",children:"Geofencing is on by default. Turn it off only for staff allowed to clock in and out from anywhere. GPS and a photo are still required, and they can add a location remark."}),e.jsxs("p",{className:"mt-2 font-semibold text-brand-800",children:[h," staff allowed to clock in from anywhere"]}),e.jsx(l,{href:n("/hr/attendance"),className:"mt-3 inline-block font-semibold text-brand-700",children:"Back to attendance overview"})]}),e.jsxs("form",{onSubmit:p,className:"mb-5 flex flex-wrap gap-2",children:[e.jsxs("label",{className:"min-w-0 flex-1 text-sm font-semibold",children:["Find staff",e.jsx("input",{className:"field mt-1",value:o,onChange:a=>x(a.target.value),placeholder:"Name or staff ID"})]}),e.jsx("button",{className:"btn-primary self-end",children:"Search"})]}),d&&e.jsx("p",{role:"alert",className:"mb-4 text-red-700",children:d}),e.jsx("div",{className:"space-y-3",children:t.data.map(a=>e.jsxs("article",{className:"flex flex-wrap items-center justify-between gap-4 rounded-xl border border-slate-200 bg-white p-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{className:"break-words font-bold",children:a.full_name}),e.jsxs("p",{className:"mt-1 text-sm text-slate-600",children:[a.employee_number??"No staff ID"," · ",a.workforce_category==="office"?"Management / office":"Cleaner / site staff"," · ",a.employment_status.replaceAll("_"," ")]}),e.jsx("p",{className:`mt-2 text-sm font-semibold ${a.geofence_required?"text-emerald-800":"text-amber-800"}`,children:a.geofence_required?"Geofence on â must be within the selected location":"Geofence off â can clock in from anywhere"})]}),e.jsx("button",{type:"button",role:"switch","aria-checked":a.geofence_required,"aria-label":`Geofence for ${a.full_name}`,disabled:s||c!==null,onClick:()=>g(a),className:"btn-secondary min-h-11",children:c===a.id?"Savingâ¦":a.geofence_required?"Turn geofence off":"Turn geofence on"})]},a.id))}),!t.data.length&&e.jsx("p",{className:"rounded-xl bg-white p-5",children:"No staff found."}),e.jsxs("nav",{"aria-label":"Staff pages",className:"mt-5 flex flex-wrap items-center gap-4",children:[t.prev_page_url&&e.jsx(l,{href:t.prev_page_url,className:"btn-secondary",children:"Previous"}),e.jsxs("span",{children:["Page ",t.current_page," of ",t.last_page]}),t.next_page_url&&e.jsx(l,{href:t.next_page_url,className:"btn-secondary",children:"Next"})]})]})}export{G as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.