1import{u as H,a as c,e as V,j as e}from"./vendor-query-B-_nDQQY.js";import{C as p,a as N,c as v,d as g,q as r,I as l,h as W,i as $,j as Q,k as J,l as o,B as n,a4 as y,t as w,b as D}from"./index-D8ww6b7J.js";import{b as K}from"./vendor-react-BUIlT3ms.js";import{S as C}from"./shield-check-BAeEGIHA.js";import{F as X}from"./file-pen-line-Cf5esZdC.js";import{C as E}from"./camera-B5zm8J-v.js";import{R as Z}from"./rotate-ccw-DfQYrjIS.js";import{A as ee}from"./arrow-right-BeikyhzV.js";import{C as F}from"./circle-check-big-4Ew-rpqG.js";import"./vendor-three-1K-S22da.js";import"./vendor-charts-i-522T5A.js";import"./vendor-pdf-Bwkk3Ew0.js";import"./vendor-radix-X0WMATEu.js";function ge(){const _=K(),L=H(),d=c.useRef(null),k=c.useRef(null),[u,m]=c.useState("form"),[t,i]=c.useState({name:"",role:"",state:"",phone:"",email:"",address:"",cost_per_hour:"",weekly_hours_cap:"40",tax_rate_pct:"15"}),[j,S]=c.useState(""),[h,I]=c.useState(null),[R,U]=c.useState(""),[x,M]=c.useState(""),[f,A]=c.useState(""),B=new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),P=async()=>{try{const s=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user",width:{ideal:1280},height:{ideal:720}}});d.current&&(d.current.srcObject=s)}catch{U("Camera access denied. Please allow camera permissions.")}},T=()=>{var s;(s=d.current)!=null&&s.srcObject&&d.current.srcObject.getTracks().forEach(a=>a.stop())},O=()=>{if(!d.current||!k.current)return;const s=d.current,a=k.current;a.width=s.videoWidth,a.height=s.videoHeight,a.getContext("2d").drawImage(s,0,0),I(a.toDataURL("image/jpeg",.8)),T()},b=V({mutationFn:async()=>{var a;let s=null;if(h){const G=await(await fetch(h)).blob(),z=new File([G],`selfie-${t.name}-${Date.now()}.jpg`,{type:"image/jpeg"});s=(await D.integrations.Core.UploadFile({file:z})).file_url}return D.entities.Employee.create({name:t.name,role:t.role||null,state:((a=t.state)==null?void 0:a.toUpperCase())||null,phone:t.phone||null,email:t.email||null,address:t.address||null,cost_per_hour:t.cost_per_hour?parseFloat(t.cost_per_hour):null,weekly_hours_cap:parseFloat(t.weekly_hours_cap)||40,tax_rate_pct:parseFloat(t.tax_rate_pct)||15,selfie_url:s,profile_photo_url:s,selfie_verified:!!s,kiosk_pin:x||null,kiosk_enabled:!!x,tracking_consent_signed:!0,tracking_consent_signature:j,tracking_consent_date:new Date().toISOString(),registered_date:new Date().toISOString()})},onSuccess:()=>{L.invalidateQueries({queryKey:["employees"]}),m("done"),w.success("Registration complete! You can now clock in.")},onError:()=>w.error("Registration failed. Please try again.")}),q=()=>{if(!t.name.trim()){w.error("Name is required");return}m("consent")},Y=()=>{m("selfie"),setTimeout(P,200)};return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-md",children:[u==="form"&&e.jsxs(p,{children:[e.jsxs(N,{children:[e.jsx(v,{className:"text-center text-xl",children:"Employee Registration"}),e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"Fill in your details to join the team"})]}),e.jsxs(g,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(r,{className:"text-xs",children:"Full Name *"}),e.jsx(l,{value:t.name,onChange:s=>i(a=>({...a,name:s.target.value})),placeholder:"John Smith"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(r,{className:"text-xs",children:"Role"}),e.jsxs(W,{value:t.role,onValueChange:s=>i(a=>({...a,role:s})),children:[e.jsx($,{children:e.jsx(Q,{placeholder:"Select..."})}),e.jsxs(J,{children:[e.jsx(o,{value:"Installer",children:"Installer"}),e.jsx(o,{value:"Template",children:"Template"}),e.jsx(o,{value:"Cutter",children:"Cutter"}),e.jsx(o,{value:"Polisher",children:"Polisher"}),e.jsx(o,{value:"Driver",children:"Driver"}),e.jsx(o,{value:"Sales",children:"Sales"}),e.jsx(o,{value:"Manager",children:"Manager"}),e.jsx(o,{value:"Other",children:"Other"})]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(r,{className:"text-xs",children:"State"}),e.jsx(l,{value:t.state,onChange:s=>i(a=>({...a,state:s.target.value.toUpperCase()})),placeholder:"FL",maxLength:2})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(r,{className:"text-xs",children:"Phone"}),e.jsx(l,{value:t.phone,onChange:s=>i(a=>({...a,phone:s.target.value})),placeholder:"(555) 123-4567"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(r,{className:"text-xs",children:"Email"}),e.jsx(l,{value:t.email,onChange:s=>i(a=>({...a,email:s.target.value})),placeholder:"[email protected]"})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(r,{className:"text-xs",children:"Address"}),e.jsx(l,{value:t.address,onChange:s=>i(a=>({...a,address:s.target.value})),placeholder:"123 Main St, Miami, FL"})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(r,{className:"text-xs",children:"Hourly Rate ($)"}
1),e.jsx(l,{type:"number",value:t.cost_per_hour,onChange:s=>i(a=>({...a,cost_per_hour:s.target.value})),placeholder:"25"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(r,{className:"text-xs",children:"Weekly Cap (hrs)"}),e.jsx(l,{type:"number",value:t.weekly_hours_cap,onChange:s=>i(a=>({...a,weekly_hours_cap:s.target.value}))})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(r,{className:"text-xs",children:"Tax Rate %"}),e.jsx(l,{type:"number",step:"0.1",value:t.tax_rate_pct,onChange:s=>i(a=>({...a,tax_rate_pct:s.target.value}))})]})]}),e.jsxs(n,{className:"w-full h-12 gap-2",onClick:q,children:[e.jsx(C,{className:"w-5 h-5"})," Continue to Consent"]}),e.jsxs(n,{variant:"ghost",className:"w-full",onClick:()=>_("/clock-in"),children:[e.jsx(y,{className:"w-4 h-4 mr-1"})," Back to Clock In"]})]})]}),u==="consent"&&e.jsxs(p,{children:[e.jsxs(N,{children:[e.jsxs(v,{className:"text-center text-xl flex items-center justify-center gap-2",children:[e.jsx(X,{className:"w-5 h-5"})," Tracking Consent Agreement"]}),e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"Please read and sign before continuing"})]}),e.jsxs(g,{className:"space-y-4",children:[e.jsxs("div",{className:"max-h-64 overflow-y-auto rounded-lg border border-border bg-muted/30 p-4 text-xs text-muted-foreground leading-relaxed space-y-3",children:[e.jsx("p",{className:"font-semibold text-foreground",children:"Employee Tracking & Data Consent"}),e.jsxs("p",{children:["Date: ",e.jsx("span",{className:"font-medium text-foreground",children:B})]}),e.jsxs("p",{children:["By signing below, I, ",e.jsx("span",{className:"font-medium text-foreground",children:t.name}),", acknowledge and consent to the following:"]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-semibold text-foreground",children:"1. Location Tracking."})," I authorize the company to track my GPS location during work hours, including while clocked in, traveling to job sites, and performing work-related duties. This data may be used for route optimization, job assignment, and attendance verification."]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-semibold text-foreground",children:"2. Time & Attendance."})," I consent to the electronic tracking of my work hours, including clock-in/out times, breaks, and total hours worked. This data will be used for payroll calculation and labor cost reporting."]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-semibold text-foreground",children:"3. Photo Verification."})," I consent to the use of my selfie photo captured during registration for identity verification when clocking in and out of shifts."]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-semibold text-foreground",children:"4. Data Storage & Retention."})," I understand that GPS coordinates and biometric photos will be automatically deleted 90 days after collection. Time and payroll records (hours, dates, pay amounts) will be retained for 3 years as required by labor and tax laws, then permanently deleted."]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-semibold text-foreground",children:"5. Right to Revoke."})," I understand I may revoke this consent at any time by contacting management, which may affect my ability to perform work duties."]}),e.jsx("p",{className:"italic",children:"This consent is provided voluntarily as a condition of employment and is executed electronically in accordance with the E-SIGN Act (15 U.S.C. § 7001)."})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("input",{type:"checkbox",checked:!!j,onChange:s=>S(s.target.checked?t.name:""),className:"mt-1 w-4 h-4 accent-primary"}),e.jsx(r,{className:"text-xs leading-relaxed cursor-pointer",onClick:()=>S(j?"":t.name),children:"I have read and agree to the tracking consent above. I understand this authorizes the company to track my location, time, and photo for work purposes."})]}),e.jsxs(n,{className:"w-full h-12 gap-2",onClick:()=>{if(!j){w.error("Please check the box to consent");return}Y()},children:[e.jsx(C,{className:"w-5 h-5"})," I Agree â Continue"]}),e.jsxs(n,{variant:"ghost",className:"w-full",onClick:()=>m("form"),children:[e.jsx(y,{className:"w-4 h-4 mr-1"})," Back to Details"]}
1)]})]}),u==="selfie"&&e.jsxs(p,{children:[e.jsxs(N,{children:[e.jsxs(v,{className:"text-center text-xl flex items-center justify-center gap-2",children:[e.jsx(E,{className:"w-5 h-5"})," Take Your Selfie"]}),e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"This photo will be used to verify your identity when clocking in and out"})]}),e.jsxs(g,{className:"space-y-4",children:[R&&e.jsx("div",{className:"p-3 bg-destructive/10 border border-destructive/30 rounded-lg text-xs text-destructive",children:R}),e.jsxs("div",{className:"relative bg-black rounded-lg overflow-hidden",children:[h?e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:h,alt:"Selfie",className:"w-full h-64 object-cover"}),e.jsx("div",{className:"absolute inset-0 border-2 border-green-500/50 rounded-lg"})]}):e.jsxs(e.Fragment,{children:[e.jsx("video",{ref:d,autoPlay:!0,playsInline:!0,className:"w-full h-64 object-cover"}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:e.jsx("div",{className:"w-32 h-40 border-2 border-white/50 rounded-full"})})]}),e.jsx("canvas",{ref:k,className:"hidden"})]}),h?e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(n,{variant:"outline",className:"flex-1 h-12 gap-2",onClick:()=>{I(null),P()},children:[e.jsx(Z,{className:"w-5 h-5"})," Retake"]}),e.jsxs(n,{className:"flex-1 h-12 gap-2 bg-green-600 hover:bg-green-700",onClick:()=>m("pin"),children:["Continue ",e.jsx(ee,{className:"w-5 h-5"})]})]}):e.jsxs(n,{className:"w-full h-12 gap-2",onClick:O,children:[e.jsx(E,{className:"w-5 h-5"})," Capture Photo"]}),e.jsxs(n,{variant:"ghost",className:"w-full",onClick:()=>{m("form"),T()},children:[e.jsx(y,{className:"w-4 h-4 mr-1"})," Back to Details"]})]})]}),u==="pin"&&e.jsxs(p,{children:[e.jsxs(N,{children:[e.jsxs(v,{className:"text-center text-xl flex items-center justify-center gap-2",children:[e.jsx(C,{className:"w-5 h-5"})," Create Your Clock-In PIN"]}),e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"Use this 4-digit PIN at the kiosk to clock in and out quickly"})]}),e.jsxs(g,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(r,{className:"text-xs",children:"Enter 4-digit PIN"}),e.jsx(l,{type:"password",inputMode:"numeric",maxLength:4,value:x,onChange:s=>M(s.target.value.replace(/\D/g,"")),placeholder:"â¢â¢â¢â¢",className:"text-center text-2xl tracking-[0.5em] h-12"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(r,{className:"text-xs",children:"Confirm PIN"}),e.jsx(l,{type:"password",inputMode:"numeric",maxLength:4,value:f,onChange:s=>A(s.target.value.replace(/\D/g,"")),placeholder:"â¢â¢â¢â¢",className:"text-center text-2xl tracking-[0.5em] h-12"})]}),x.length===4&&f.length===4&&x!==f&&e.jsx("p",{className:"text-xs text-destructive text-center",children:"PINs do not match"}),e.jsxs(n,{className:"w-full h-12 gap-2 bg-green-600 hover:bg-green-700",disabled:b.isPending||x.length!==4||x!==f,onClick:()=>b.mutate(),children:[e.jsx(F,{className:"w-5 h-5"})," ",b.isPending?"Registering...":"Complete Registration"]}),e.jsxs(n,{variant:"ghost",className:"w-full",onClick:()=>m("selfie"),children:[e.jsx(y,{className:"w-4 h-4 mr-1"})," Back to Selfie"]})]})]}),u==="done"&&e.jsx(p,{children:e.jsxs(g,{className:"pt-8 pb-8 text-center space-y-4",children:[e.jsx("div",{className:"w-20 h-20 rounded-full bg-green-100 dark:bg-green-900/30 mx-auto flex items-center justify-center",children:e.jsx(F,{className:"w-10 h-10 text-green-600"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold",children:"Registration Complete!"}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Welcome, ",t.name,"!"]})]}),h&&e.jsx("img",{src:h,alt:"Your selfie",className:"w-24 h-24 rounded-full object-cover mx-auto border-4 border-primary/20"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Your selfie will be used to verify your identity at clock in"}),e.jsx(n,{className:"w-full h-12",onClick:()=>_("/clock-in"),children:"Go to Clock In"})]})})]})})}export{ge 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.