PageSourceSearch

https://stone-profit-flow.base44.app/assets/ClockIn-BJS_tGRy.js

js stone-profit-flow.base44.app collected 2026-10-03 03:09:56 UTC 12,107 bytes, 1 lines download raw bytes

1import{a as n,d as D,j as e}from"./vendor-query-B-_nDQQY.js";import{n as W,U as A,J as N,s as O,_ as Y,b as f,t as J}from"./index-D8ww6b7J.js";import{D as z,K as G}from"./KioskStatusBoard-CJfAv8ix.js";/* empty css                */import"./vendor-leaflet-CQpbWEOL.js";import{f as p}from"./format-C2V2JF1Z.js";import"./textarea-Bhj0eADY.js";import"./dialog-BQWtAG_x.js";import{E as Q,B}from"./EmployeeWorkPortal-DdccBb7h.js";import{E as $}from"./EmployeeRatingBadge-BunfZe-B.js";import{L as P}from"./vendor-react-BUIlT3ms.js";import{U as H}from"./user-CHo1Apvy.js";import"./vendor-three-1K-S22da.js";import"./vendor-charts-i-522T5A.js";import"./vendor-pdf-Bwkk3Ew0.js";import"./vendor-radix-X0WMATEu.js";import"./constants-yGZMfuMC.js";import"./tabs-DfRYzyJY.js";import"./differenceInMinutes-DsMRFadK.js";import"./differenceInMilliseconds-C_4QHjWc.js";import"./package-kgQR05VR.js";import"./phone-CA5yr35z.js";import"./layers-De-P0_bF.js";import"./circle-check-BXjz6L8_.js";import"./car-D_76LGWF.js";import"./hammer-Burg9xO0.js";import"./camera-B5zm8J-v.js";import"./upload-DN-6vN7H.js";import"./circle-check-big-4Ew-rpqG.js";import"./CustomerSurvey-DmMjX4IH.js";import"./index-BgPuGWoM.js";import"./heart-9N54jtiF.js";import"./vendor-framer-DvY-ewtn.js";import"./pen-tool-BEizwLls.js";import"./send-DJBvsBZ5.js";import"./banknote-u4qSGFU6.js";import"./credit-card-CDUARo9S.js";import"./shield-check-BAeEGIHA.js";import"./rotate-ccw-DfQYrjIS.js";import"./sticky-note-CAvkSZuA.js";import"./pen-line-B9s7pdJm.js";import"./JobMessageSender-BIBMTBKh.js";import"./TemplateChecklist-BD0Cmjkg.js";import"./checkbox-DYv8y0li.js";import"./plus-MQo5wr8n.js";import"./trash-2-LBknmkIl.js";import"./file-up-RkSzzIhR.js";import"./eye-DQ9YWbv-.js";import"./save-d5GEALD8.js";import"./image-W2HJP6c8.js";import"./clipboard-check-DuD3x8o8.js";import"./useBarcodeScanner--vex2EA0.js";import"./scan-line-pHKVaVqS.js";import"./circle-x-CIIBFH3_.js";import"./square-B1YMa_kL.js";import"./pause-BQpgIWpH.js";import"./play-BjyPRiaQ.js";p(new Date,"yyyy-MM-dd");function X(h){const l=new Date(h),a=l.getDay(),o=l.getDate()-a+(a===0?-6:1);return l.setDate(o),l.toISOString().split("T")[0]}function st({embedded:h=!1}){var I,L;const[l,a]=n.useState(""),[o,u]=n.useState(null),[g,v]=n.useState(""),[M,b]=n.useState(!1),[d,m]=n.useState(null),[w,x]=n.useState(!1),[k,_]=n.useState(null),[S,q]=n.useState(new Date);n.useEffect(()=>{const t=setInterval(()=>q(new Date),1e3);return()=>clearInterval(t)},[]);const{data:c=[]}=D({queryKey:["employees"],queryFn:()=>f.entities.Employee.list()}),s=c.find(t=>t.id===g),j=X(new Date),{data:F=[],refetch:Z}=D({queryKey:["kiosk-entries-clockin",j],queryFn:()=>f.entities.TimeEntry.filter({week_start:j}),refetchInterval:15e3}),y=t=>F.find(r=>r.employee_id===t&&!r.clock_out_time),K=c.filter(t=>y(t.id)),R=t=>{const r=c.find(i=>i.kiosk_pin===t);if(!r){J.error("Invalid PIN"),a("");return}u(r),a("")},C=t=>{if(l.length<4){const r=l+t;a(r),r.length===4&&setTimeout(()=>R(r),200)}},U=()=>a(l.slice(0,-1)),T=t=>{const r=c.find(i=>i.id===t);m(r),x(!0)},E=async({photo:t})=>{_(t);const r=d;v(r.id),x(!1),m(null);try{(await f.entities.TimeEntry.filter({employee_id:r.id,clock_out_time:null})).length===0&&await f.entities.TimeEntry.create({employee_id:r.id,employee_name:r.name,entry_type:"on_site",clock_in_time:new Date().toISOString(),week_start:j,job_label:"General"})}catch(i){console.error("Auto punch-in failed:",i)}},V=()=>{v(""),_(null),m(null),b(!1),u(null),a("")};return g?e.jsxs("div",{className:h?"flex flex-col items-center justify-start py-4 sm:py-6":"min-h-screen bg-background flex flex-col items-center justify-start p-3 sm:p-4 pt-8 sm:pt-10",children:[e.jsxs("div",{className:"w-full max-w-sm space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between bg-primary/10 rounded-xl px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-12 h-12 rounded-full overflow-hidden border-2 border-primary bg-muted",children:s!=null&&s.selfie_url?e.jsx("img",{src:s.selfie_url,alt:s.name,className:"w-full h-full object-cover"}):s!=null&&s.profile_photo_url?e.jsx("img",{src:s.profile_photo_url,alt:s.name,className:"w-full h-full object-cover"}):k?e.jsx("img",{src:k,alt:"Selfie",className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-lg font-bold text-muted-foreground",children:(L=(I=s==null?void 0:s.name)==null?void 0:I[0])==null?void 0:L.toUpperCase()})}),(s==null?void 0:s.selfie_verified)&&e.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 w-5 h-5 bg-green-500 rounded-full border-2 border-card flex items-center justify-center",children:e.jsx("svg",{className:"w-3 h-3 text-white",f
1ill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-sm",children:s==null?void 0:s.name}),e.jsx("p",{className:"text-xs text-green-600 font-medium",children:"✓ Clocked In"})]})]}),e.jsx("button",{onClick:V,className:"text-xs text-muted-foreground hover:text-foreground underline",children:"Switch"})]}),e.jsx(Q,{employeeId:g,employeeName:(s==null?void 0:s.name)??"",mode:"kiosk"})]}),w&&d&&e.jsx(B,{employeeName:d.name,onVerified:E,onClose:()=>{x(!1),m(null)}})]}):e.jsxs("div",{className:"min-h-screen bg-background text-foreground flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary flex items-center justify-center",children:e.jsx(W,{className:"w-6 h-6 text-primary-foreground"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-bold",children:"Employee Time Clock"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter your PIN to clock in and see your jobs"})]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-3xl font-bold font-mono tabular-nums",children:p(S,"h:mm:ss a")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:p(S,"EEEE, MMMM d, yyyy")})]})]}),e.jsxs("div",{className:"flex-1 flex flex-col lg:flex-row gap-6 p-6 overflow-auto",children:[e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center max-w-md mx-auto w-full",children:M?e.jsxs("div",{className:"w-full space-y-2",children:[e.jsx("button",{onClick:()=>b(!1),className:"text-sm text-muted-foreground hover:text-foreground flex items-center gap-1 mb-4",children:"← Back to PIN pad"}),e.jsx("label",{className:"text-sm font-medium",children:"Who are you?"}),e.jsx("div",{className:"flex flex-col gap-2",children:c.map(t=>{var r,i;return e.jsxs("button",{onClick:()=>T(t.id),className:"flex items-center gap-3 p-3 rounded-xl border border-border bg-card hover:border-primary hover:bg-primary/5 transition-all text-left w-full",children:[e.jsxs("div",{className:"w-12 h-12 rounded-full bg-muted overflow-hidden shrink-0 border-2 border-border relative",children:[t.selfie_url||t.profile_photo_url?e.jsx("img",{src:t.selfie_url||t.profile_photo_url,alt:t.name,className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-lg font-bold text-muted-foreground",children:(i=(r=t.name)==null?void 0:r[0])==null?void 0:i.toUpperCase()}),t.selfie_verified&&e.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 w-4 h-4 bg-green-500 rounded-full border-2 border-card flex items-center justify-center",children:e.jsx("svg",{className:"w-2.5 h-2.5 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-medium text-sm truncate",children:t.name}),t.role&&e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:t.role})]})]},t.id)})}),e.jsx("p",{className:"text-xs text-muted-foreground text-center mt-2",children:"A selfie will be required to verify your identity"}),e.jsx(P,{to:"/register-as-employee",className:"text-xs text-primary hover:underline text-center font-medium block mt-2",children:"Not registered yet? Register here"})]}):o?e.jsx("div",{className:"text-center w-full",children:(()=>{const t=y(o.id),r=!!t;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-28 h-28 rounded-full mx-auto mb-4 overflow-hidden border-4 border-primary",children:o.profile_photo_url||o.selfie_url?e.jsx("img",{src:o.profile_photo_url||o.selfie_url,alt:o.name,className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full bg-muted flex items-center justify-center",children:e.jsx(H,{className:"w-12 h-12 text-muted-foreground"})})}),e.jsx("h2",{className:"text-3xl font-bold mb-1",children:o.name}),e.jsx("p",{className:"text-muted-foreground mb-2",children:o.role||"Employee"}),e.jsx("div",{className:"mb-4",children:e.jsx($,{employee:o,size:"lg"})}),e.jsxs("div",{className:N("inline-flex items-center gap-2 px-4 py-1.5 rounded-full text-sm font-semibold mb-8",r?"bg-green-100 text-green-700":"bg-muted text-muted-foreground"),children:[e.jsx("div",{className:N("w-2 h-2 rounded-full",r?"bg-green-500 animate-pulse":"bg-muted-foreground
1/50")}),r?`Clocked in since ${p(new Date(t.clock_in_time),"h:mm a")}`:"Ready to clock in"]}),e.jsxs("button",{onClick:()=>{m(o),x(!0),u(null)},className:"px-10 py-6 rounded-2xl text-xl font-bold transition-all flex flex-col items-center gap-2 min-w-[240px] mx-auto bg-primary hover:bg-primary/90 text-primary-foreground",children:[e.jsx(Y,{className:"w-8 h-8"}),r?"VERIFY & VIEW JOBS":"VERIFY & CLOCK IN"]}),e.jsx("button",{onClick:()=>u(null),className:"mt-6 text-sm text-muted-foreground hover:text-foreground",children:"Cancel"})]})})()}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-6 text-center",children:[e.jsx(A,{className:"w-12 h-12 text-primary mx-auto mb-2"}),e.jsx("h2",{className:"text-2xl font-bold",children:"Enter Your PIN"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Type your 4-digit code to clock in and see your jobs"})]}),e.jsx("div",{className:"flex gap-3 mb-8",children:[0,1,2,3].map(t=>e.jsx("div",{className:N("w-6 h-6 rounded-full border-2 transition-colors",t<l.length?"bg-primary border-primary":"border-border")},t))}),e.jsxs("div",{className:"grid grid-cols-3 gap-3 w-full max-w-xs",children:[[1,2,3,4,5,6,7,8,9].map(t=>e.jsx("button",{onClick:()=>C(String(t)),className:"aspect-square rounded-xl bg-card hover:bg-muted active:bg-primary active:text-primary-foreground text-2xl font-bold transition-colors border border-border",children:t},t)),e.jsx("div",{}),e.jsx("button",{onClick:()=>C("0"),className:"aspect-square rounded-xl bg-card hover:bg-muted active:bg-primary active:text-primary-foreground text-2xl font-bold transition-colors border border-border",children:"0"}),e.jsx("button",{onClick:U,className:"aspect-square rounded-xl bg-card hover:bg-destructive/10 text-muted-foreground hover:text-destructive text-xl font-bold transition-colors border border-border flex items-center justify-center",children:e.jsx(z,{className:"w-6 h-6"})})]}),e.jsxs("div",{className:"mt-6 flex flex-col items-center gap-2",children:[e.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(O,{className:"w-3 h-3"}),"Don't have a PIN? Use selfie verification instead"]}),e.jsx("button",{onClick:()=>b(!0),className:"text-xs text-primary hover:underline font-medium",children:"Use selfie verification →"}),e.jsx(P,{to:"/register-as-employee",className:"text-xs text-muted-foreground hover:text-foreground mt-1",children:"Not registered yet? Register here"})]})]})}),e.jsx("div",{className:"lg:w-96",children:e.jsx(G,{employees:c,clockedInEmployees:K,getActiveEntry:y})})]}),w&&d&&e.jsx(B,{employeeName:d.name,onVerified:E,onClose:()=>{x(!1),m(null)}})]})}export{st 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.