1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[72100],{72100:(e,t,r)=>{r.r(t),r.d(t,{default:()=>I});var s=r(95155),a=r(12115),d=r(73321),n=r(50910),l=r(44923),o=r(46302),i=r(1613),c=r(96493),u=r(33851),m=r(26089),x=r(78474),p=r(88227),h=r(77806),y=r(53885),g=r(49965),b=r(90949),f=r(41159),v=r(41641),C=r(98981),j=r(57657),N=r(68189),k=r(70733),S=r(2614),w=r(99393),M=r(55938),A=r(54199),E=r(57350),$=r(18101);let P="__none__";function R({status:e,t}){return e?(0,s.jsx)(E.A,{tone:$.Wy[e]||"gray",children:t(`status.${e}`)}):null}function D({store:e}){let{attributes:t,listeners:r,setNodeRef:a,isDragging:d}=(0,l.PM)({id:`store:${e.StoreCode}`,data:{type:"store",store:e}});return(0,s.jsxs)("button",{ref:a,type:"button",...r,...t,style:{touchAction:"none",opacity:d?.4:1},className:"flex w-full items-start gap-2 rounded-lg border border-border bg-card p-2 text-left shadow-sm transition hover:border-primary hover:shadow",children:[(0,s.jsx)(f.A,{className:"mt-0.5 h-4 w-4 shrink-0 text-primary"}),(0,s.jsxs)("span",{className:"min-w-0",children:[(0,s.jsx)("span",{className:"block truncate text-xs font-semibold text-foreground",children:e.StoreName}),(0,s.jsxs)("span",{className:"block truncate text-[10px] text-muted-foreground",children:[e.StoreCode," \xb7 ",e.ZoneCode]})]})]})}function T({dayKey:e,label:t,dateNum:r,isToday:a,visits:d,onSelect:n,onQuickAdd:o,t:i}){let{setNodeRef:c,isOver:u}=(0,l.zM)({id:`day:${e}`,data:{type:"day",dayKey:e}});return(0,s.jsxs)("div",{className:"flex min-w-0 flex-col",children:[(0,s.jsxs)("div",{className:`mb-2 rounded-md px-2 py-1 text-center ${a?"bg-primary/10 text-primary":"text-muted-foreground"}`,children:[(0,s.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-wide",children:t}),(0,s.jsx)("div",{className:"text-sm font-bold",children:r})]}),(0,s.jsxs)("div",{ref:c,onClick:()=>o(e),className:`flex min-h-[12rem] flex-1 cursor-pointer flex-col gap-2 rounded-lg border-2 border-dashed p-2 transition ${u?"border-primary bg-primary/5":"border-border bg-muted/50 hover:border-primary/50"}`,children:[0===d.length&&(0,s.jsx)("div",{className:"flex flex-1 items-center justify-center text-[10px] text-muted-foreground",children:u?i("visits.calendar.dropHere"):""}),d.map(e=>(0,s.jsxs)("button",{type:"button",onClick:t=>{t.stopPropagation(),n(e)},className:"rounded-lg border border-border bg-card p-2 text-left shadow-sm transition hover:border-primary hover:shadow",children:[(0,s.jsxs)("div",{className:"mb-1 flex items-center justify-between gap-1",children:[(0,s.jsx)(R,{status:e.Status,t:i}),e.__optimistic&&(0,s.jsx)("span",{className:"text-[9px] font-medium text-primary",children:i("visits.calendar.saving")})]}),(0,s.jsx)("div",{className:"truncate text-xs font-semibold text-foreground",children:e.StoreName||e.StoreCode}),(0,s.jsx)("div",{className:"truncate text-[10px] text-muted-foreground",children:e.AgentName||e.AgentC
1ode||i("visits.calendar.unassignedAgent")})]},e.VisitCode))]})]})}function V({dayKey:e,dateNum:t,isToday:r,isOutsideMonth:a,visits:d,onSelect:n,onQuickAdd:o,t:i}){let{setNodeRef:c,isOver:u}=(0,l.zM)({id:`day:${e}`,data:{type:"day",dayKey:e}});return(0,s.jsxs)("div",{ref:c,onClick:()=>o(e),className:`min-h-[5rem] cursor-pointer rounded border bg-card p-1 transition hover:border-primary/50 ${a?"opacity-40":""} ${r?"ring-1 ring-primary":""} ${u?"border-primary bg-primary/5":"border-border"}`,children:[(0,s.jsxs)("div",{className:"mb-1 flex items-center justify-between",children:[(0,s.jsx)("span",{className:`text-xs ${r?"font-bold text-primary":"text-muted-foreground"}`,children:t}),d.length>3&&(0,s.jsxs)("span",{className:"rounded bg-muted px-1 text-[9px] text-muted-foreground",children:["+",d.length-3]})]}),(0,s.jsx)("div",{className:"space-y-0.5",children:d.slice(0,3).map(e=>(0,s.jsxs)("button",{type:"button",onClick:t=>{t.stopPropagation(),n(e)},className:`flex w-full items-center gap-1 truncate rounded px-1 py-0.5 text-left text-[10px] ${$.zS[e.Status]||"bg-muted text-foreground"}`,title:e.StoreName||e.StoreCode,children:[(0,s.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-current opacity-70"}),(0,s.jsx)("span",{className:"truncate",children:e.StoreName||e.StoreCode})]},e.VisitCode))})]})}function _({open:e,store:t,dayKey:r,taskForms:d,agents:n=[],stores:l=[],showStorePicker:o=!1,onCancel:i,onConfirm:c,t:u}){let[m,x]=(0,a.useState)("ONE_TIME"),[p,h]=(0,a.useState)([]),[y,g]=(0,a.useState)(1),[b,f]=(0,a.useState)(!1),[v,C]=(0,a.useState)([[]]),[S,w]=(0,a.useState)(""),[M,A]=(0,a.useState)(""),[E,R]=(0,a.useState)(""),D=o?l.find(e=>e.StoreCode===E)||null:t;(0,a.useEffect)(()=>{var s;if(!e)return;x("ONE_TIME");let a=(0,$.u)(`${r}T12:00:00.000Z`),d=a?[a.getUTCDay()]:[];h(d),g(1),f(!1),C([d]),R(""),w(o?"":(s=t?.ClusterCode,$.Ri[s]||"")),A("")},[e,t,r,o]),(0,a.useEffect)(()=>{if(o){var e;w(D?(e=D.ClusterCode,$.Ri[e]||""):"")}},[E,o]);let T="RECURRING"===m,V=o&&!D||T&&(b?v.every(e=>0===e.length):0===p.length);return(0,s.jsx)(j.Dialog,{open:e,onOpenChange:e=>{e||i()},children:(0,s.jsxs)(j.DialogContent,{className:"max-w-md",children:[(0,s.jsxs)(j.DialogHeader,{children:[(0,s.jsx)(j.DialogTitle,{children:o?u("visits.calendar.quickAdd.title"):u("visits.calendar.scheduleVisit")}),(0,s.jsx)(j.DialogDescription,{children:o?r:D?.StoreName||D?.StoreCode})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[o&&(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"mb-1 block text-xs font-semibold text-muted-foreground",children:u("visits.calendar.quickAdd.selectStore")}),0===l.length?(0,s.jsx)("p",{className:"rounded-lg border border-dashed border-border p-2 text-xs text-muted-foreground",children:u("visits.calendar.quickAdd.noStores")}):(0,s.jsxs)(k.l6,{value:E,onValueChange:R,children:[(0,s.jsx)(k.bq,{className:"w-full rounded-lg border-border bg-card",children:(0,s.jsx)(k.yv,{placeholder:u("visits.calendar.quickAdd.selectStorePlaceholder")})}),(0,s.jsx)(k.gC,{children:l.map(e=>(0,s.jsx)(k.eb,{value:e.StoreCode,children:e.StoreName||e.StoreCode},e.StoreCode))})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"mb-1 block text-xs font-semibold text-muted-foreground",children:u("visits.calendar.recurrence")}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("button",{type:"button",onClick:()=>x("ONE_TIME"),className:`flex-1 rounded-lg border px-3 py-2 text-sm font-medium transition ${!T?"border-primary bg-primary/5 text-primary":"border-border text-muted-foreground hover:border-primary"}`,children:u("visits.calendar.oneTime")}),(0,s.jsx)("button",{type:"button",onClick:()=>x("RECURRING"),className:`flex-1 rounded-lg border px-3 py-2 text-sm font-medium transition ${T?"border-primary bg-primary/5 text-primary":"border-border text-muted-foreground hover:border-primary"}`,children:u("visits.calendar.recurring")})]}),T&&(0,s.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:u("visits.calendar.frequency")}),(0,s.jsxs)(k.l6,{value:String(y),onValueChange:e=>{var t;g(t=Number(e)),b&&C(e=>{let r=e.slice(0,t);for(;r.length<t;)r.push([]);return r})},children:[(0,s.jsx)(k.bq,{className:"h-auto w-auto rounded-md border-border bg-background px-2 py-1 text-xs",children:(0,s.jsx)(k.yv,{})}),(0,s.jsxs)(k.gC,{children:[(0,s.jsx)(k.eb,{value:"1",children:u("visits.calendar.everyWeek")}),(0,s.jsx)(k.eb,{value:"2",children:u("visits.calendar.everyNWeeks",{n:2})}),(0,s.jsx)(k.eb,{value:"3",children:u("visits.calendar.everyNWeeks",{n:3})}),(0,s.jsx)(k.eb,{value:"4",children:u("visits.calendar.everyNWeeks",{n:4})})]})]}),y>1&&(0,s.jsxs)("label",{className:"ml-auto flex items-center gap-1 text-xs text-muted-foreground",children:[(0,s.jsx)("input",{type:"checkbox",checked:b,onChange:e=>{var t;f(t=e.target.checked),t&&C(()=>{let e=[];for(let t=0;t<y;t++)e.push(0===t?[...p]:[]);return e})},className:"h-3.5 w-3.5"}),u("visits.calendar.rotationPattern")]})]}),b?(0,s.jsx)("div",{className:"space-y-2 rounded-lg border border-dashed border-border p-2",children:v.map((e,t)=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"w-16 shrink-0 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:u("visits.calendar.weekN",{n:t+1})}
1),(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:$.w4.map(r=>(0,s.jsx)("button",{type:"button",onClick:()=>{let e;return e=r.value,C(r=>r.map((r,s)=>s===t?r.includes(e)?r.filter(t=>t!==e):[...r,e]:r))},className:`rounded border px-1.5 py-0.5 text-[10px] font-medium transition ${e.includes(r.value)?"border-primary bg-primary/10 text-primary":"border-border text-muted-foreground hover:border-primary"}`,children:u(`visits.calendar.weekdays.${r.key}`)},r.value))})]},t))}):(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:$.w4.map(e=>(0,s.jsx)("button",{type:"button",onClick:()=>{let t;return t=e.value,h(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:`rounded-md border px-2 py-1 text-xs font-medium transition ${p.includes(e.value)?"border-primary bg-primary/10 text-primary":"border-border text-muted-foreground hover:border-primary"}`,children:u(`visits.calendar.weekdays.${e.key}`)},e.value))})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"mb-1 block text-xs font-semibold text-muted-foreground",children:u("visits.calendar.checklist")}),(0,s.jsxs)(k.l6,{value:S||P,onValueChange:e=>w(e===P?"":e),children:[(0,s.jsx)(k.bq,{className:"w-full rounded-lg border-border bg-card",children:(0,s.jsx)(k.yv,{placeholder:u("visits.calendar.selectChecklist")})}),(0,s.jsxs)(k.gC,{children:[(0,s.jsx)(k.eb,{value:P,children:u("visits.calendar.selectChecklist")}),d.map(e=>(0,s.jsx)(k.eb,{value:e.taskCode,children:e.name},e.taskCode))]})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"mb-1 block text-xs font-semibold text-muted-foreground",children:u("visits.calendar.assignAgent")}),(0,s.jsxs)(k.l6,{value:M||P,onValueChange:e=>A(e===P?"":e),children:[(0,s.jsx)(k.bq,{className:"w-full rounded-lg border-border bg-card",children:(0,s.jsx)(k.yv,{placeholder:u("visits.calendar.unassignedAgent")})}),(0,s.jsxs)(k.gC,{children:[(0,s.jsx)(k.eb,{value:P,children:u("visits.calendar.unassignedAgent")}),n&&n.length>0?n.map(e=>(0,s.jsxs)(k.eb,{value:e.Code,children:[e.Name," (",e.Code,")",e.RoleCode?` \xb7 ${e.RoleCode}`:""]},e.Code)):$.DW.map(e=>(0,s.jsx)(k.eb,{value:e,children:e},e))]})]})]})]}),(0,s.jsxs)(j.DialogFooter,{children:[(0,s.jsx)(N.Button,{variant:"outline",onClick:i,children:u("visits.calendar.cancel")}),(0,s.jsx)(N.Button,{onClick:()=>{c({recurrence:T?b?{type:"RECURRING",intervalWeeks:y,pattern:v.map(e=>[...e].sort((e,t)=>e-t))}:{type:"RECURRING",intervalWeeks:y,weekdays:[...p].sort((e,t)=>e-t)}:{type:"ONE_TIME"},taskCode:S||null,agentCode:M||null,store:o?D:null})},disabled:V,children:o?u("visits.calendar.quickAdd.create"):u("visits.calendar.confirm")})]})]})})}function I({initialVisits:e=[],unassignedStores:t=[],stores:j=[],initialPanel
1Visit:k=null,agents:E=[]}){let P=(0,n.c)("applications.scout"),R=(0,d.useRouter)(),K=(0,d.usePathname)(),G=(0,d.useSearchParams)(),[O,W]=(0,a.useState)(e),[q,Z]=(0,a.useState)(t);(0,a.useEffect)(()=>{W(t=>{let r=t.filter(e=>e.__optimistic);if(0===r.length)return e;let s=new Set(e.map(e=>e.VisitCode));return[...e,...r.filter(e=>!s.has(e.VisitCode))]})},[e]),(0,a.useEffect)(()=>Z(t),[t]);let U=G.get("agentCode")||"",z=G.get("zoneCode")||"",[F,B]=(0,a.useState)([]);(0,a.useEffect)(()=>{let e=!0;return(0,w.n)().then(t=>{e&&!t?.Error&&B(t?.Data??[])}).catch(()=>{}),()=>{e=!1}},[]);let[H,J]=(0,a.useState)(null),[L,Q]=(0,a.useState)(null),[Y,X]=(0,a.useState)(()=>new Date),[ee,et]=(0,a.useState)("week"),[er,es]=(0,a.useState)(null),[ea,ed]=(0,a.useState)(null);(0,a.useEffect)(()=>{k&&ed(k)},[]);let en=()=>{ed(null);let e=new URLSearchParams(G.toString());if(e.has("panel")){e.delete("panel");let t=e.toString();R.replace(t?`${K}?${t}`:K,{scroll:!1})}},el=(0,l.MS)(l.cA,{activationConstraint:{distance:8}}),eo=(0,l.MS)(l.IG,{activationConstraint:{distance:8}}),ei=(0,l.FR)(el,eo),ec=(0,a.useMemo)(()=>(0,o.k)(Y,{weekStartsOn:1}),[Y]),eu=(0,a.useMemo)(()=>(0,i.$)(Y,{weekStartsOn:1}),[Y]),em=(0,a.useMemo)(()=>Array.from({length:7},(e,t)=>{let r=(0,c.f)(ec,t);return{date:r,dayKey:(0,u.GP)(r,"yyyy-MM-dd"),label:(0,u.GP)(r,"EEE"),dateNum:(0,u.GP)(r,"d"),isToday:(0,m.r)(r,new Date)}}),[ec]),ex=(0,a.useMemo)(()=>{let e=(0,x.w)(Y),t=(0,p.p)(Y),r=(0,o.k)(e,{weekStartsOn:1}),s=(0,i.$)(t,{weekStartsOn:1}),a=new Date;return(0,h.k)({start:r,end:s}).map(e=>({date:e,dayKey:(0,u.GP)(e,"yyyy-MM-dd"),dateNum:(0,u.GP)(e,"d"),isToday:(0,m.r)(e,a),isOutsideMonth:!(0,y.t)(e,Y)}))},[Y]),ep=(0,a.useMemo)(()=>O.filter(e=>(!U||e.AgentCode===U)&&(!z||e.ZoneCode===z)),[O,U,z]),eh=(0,a.useMemo)(()=>q.filter(e=>!z||e.ZoneCode===z),[q,z]),ey=(0,a.useMemo)(()=>{let e={};for(let t of"month"===ee?ex:em)e[t.dayKey]=[];for(let t of ep){let r=null;if(t.CheckInAt){let e=(0,$.u)(t.CheckInAt);e&&(r=(0,u.GP)(e,"yyyy-MM-dd"))}if(!r){let e=t.PlannedWindowStart||t.WeekStart;e&&(r=String(e).slice(0,10))}r&&e[r]&&e[r].push(t)}return e},[ep,em,ex,ee]),eg=async(e,{agentCode:t,taskCode:r,date:s,notes:a})=>{let d=e.CheckInAt;if(s){let t=(0,$.u)(e.CheckInAt);if(t){let e=new Date(t),[r,a,n]=s.split("-").map(e=>parseInt(e,10));e.setUTCFullYear(r,a-1,n),d=e.toISOString()}else d=`${s}T12:00:00.000Z`}let n=(0,$.u)(d),l=!!s&&n&&(n<ec||n>eu),o=E.find(e=>e.Code===t)?.Name??t??null;W(s=>s.map(s=>s.VisitCode===e.VisitCode?{...s,AgentCode:t||null,AgentName:o,TaskCode:r||null,CheckInAt:d,Notes:a??s.Notes??""}:s)),en(),l&&S.toast.info(P("visits.calendar.visitMovedToWeek",{date:(0,u.GP)(n,"dd MMM yyyy")}));try{let s=await (0,M.P)({storeCode:e.StoreCode,storeName:e.StoreName,agentCode:t||null,zoneCode:e.ZoneCode,date:d,taskCode:r||null,recurrence:e.Recurrence||null,notes:a??""});if(s?.Error)throw Error(s?.Message||"assign failed");S.toast.success(P("visits.calendar.saveSuccess",{store:e.StoreName||e.StoreCode||""}))}catch{S.toast.error(P("visits.calendar.assignError"))}},eb=async e=>{if(e?.VisitCode){W(t=>t.filter(t=>t.VisitCode!==e.VisitCode)),en();try{let{deleteVisit:t}=await r.e(3487).then(r.bind(r,3487)),s=await t({visitCode:e.VisitCode});if(s?.Error)throw Error(s?.Message||"delete failed");S.toast.success(P("visits.calendar.deleteSuccess"))}catch{W(O),S.toast.error(P("visits.calendar.deleteError"))}}},ef=e=>Q({dayKey:e}),ev=async(e,t,{recurrence:r,taskCode:s,agentCode:a},{onRailRemove:d=()=>{},onRailRestore:n=()=>{}}={})=>{let l=[t];if(r?.type==="RECURRING"){let e=new Set(r.weekdays||[]),s=em.filter(t=>e.has(t.date.getUTCDay())).map(e=>e.dayKey);l=s.length?Array.from(new Set([...s])):[t]}let o=E.find(e=>e.Code===a)?.Name??a??null,i=Date.now(),c=l.map((e,t)=>({tempCode:`VST-TMP-${i}-${t}`,dayKey:e,isoDate:`${e}T12:00:00.000Z`})),u=c.map(t=>({VisitCode:t.tempCode,StoreCode:e.StoreCode,StoreName:e.StoreName,AgentCode:a||null,AgentName:o,ZoneCode:e.ZoneCode,CheckInAt:t.isoDate,CheckOutAt:null,Status:"PLANNED",ComplianceScore:null,TaskCode:s||null,Recurrence:r||null,Notes:"",Attributes:{},Photos:[],__optimistic:!0}));d(),W(e=>[...e,...u]);try{let t=await Promise.all(c.map(t=>(0,M.P)({storeCode:e.StoreCode,storeName:e.StoreName,agentCode:a||null,agentName:o,zoneCode:e.ZoneCode,date:t.isoDate,taskCode:s||null,recurrence:r||null})));if(t.some(e=>e?.Error))throw Error("assign failed");W(e=>e.map(e=>{let r=c.findIndex(t=>t.tempCode===e.VisitCode);
1if(-1===r)return e;let s=t[r]?.Data;return{...e,...s,__optimistic:!1}}))}catch{let e=new Set(c.map(e=>e.tempCode));W(t=>t.filter(t=>!e.has(t.VisitCode))),n(),S.toast.error(P("visits.calendar.assignError"))}},eC=async({recurrence:e,taskCode:t,agentCode:r})=>{if(J(null),!H)return;let{store:s,dayKey:a}=H;await ev(s,a,{recurrence:e,taskCode:t,agentCode:r},{onRailRemove:()=>Z(e=>e.filter(e=>e.StoreCode!==s.StoreCode)),onRailRestore:()=>Z(e=>[s,...e])})},ej=async({recurrence:e,taskCode:t,agentCode:r,store:s})=>{Q(null),L&&s&&await ev(s,L.dayKey,{recurrence:e,taskCode:t,agentCode:r})};return(0,s.jsxs)(l.Mp,{sensors:ei,collisionDetection:l.fp,onDragStart:({active:e})=>{es(e?.data?.current?.store||null)},onDragEnd:({active:e,over:t})=>{es(null);let r=e?.data?.current?.store;r&&t&&t?.data?.current?.type==="day"&&J({store:r,dayKey:t.data.current.dayKey})},onDragCancel:()=>es(null),children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-[16rem_1fr]",children:[(0,s.jsxs)("aside",{className:"rounded-lg border bg-card p-3",children:[(0,s.jsxs)("h2",{className:"mb-3 text-sm font-semibold",children:[P("visits.calendar.unassignedStores")," (",eh.length,")"]}),(0,s.jsx)("div",{className:"space-y-2",children:0===eh.length?(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:P("visits.calendar.allAssigned")}):eh.map(e=>(0,s.jsx)(D,{store:e},e.StoreCode))})]}),(0,s.jsxs)("div",{className:"min-w-0 rounded-lg border bg-card p-4",children:[(0,s.jsxs)("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-2",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold",children:"week"===ee?`${(0,u.GP)(ec,"dd MMM")} â ${(0,u.GP)(eu,"dd MMM yyyy")}`:(0,u.GP)(Y,"MMMM yyyy")}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsxs)("div",{className:"inline-flex rounded-md border bg-card p-0.5",children:[(0,s.jsx)("button",{type:"button",onClick:()=>et("week"),className:`rounded px-2 py-1 text-xs ${"week"===ee?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"}`,children:P("visits.calendar.weekView")}),(0,s.jsx)("button",{type:"button",onClick:()=>et("month"),className:`rounded px-2 py-1 text-xs ${"month"===ee?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"}`,children:P("visits.calendar.monthView")})]}),(0,s.jsx)(N.Button,{variant:"outline",size:"sm",onClick:()=>X(new Date),children:P("visits.calendar.today")}),(0,s.jsx)("button",{type:"button",onClick:()=>X(e=>"week"===ee?(0,g.J)(e,-1):(0,b.P)(e,-1)),"aria-label":"week"===ee?P("visits.calendar.prevWeek"):P("visits.calendar.prevMonth"),className:"rounded-md border p-1.5 hover:bg-muted",children:(0,s.jsx)(v.A,{className:"h-4 w-4"})}),(0,s.jsx)("button",{type:"button",onClick:()=>X(e=>"week"===ee?(0,g.J)(e,1):(0,b.P)(e,1)),"aria-label":"week"===ee?P("visits.calendar.nextWeek"):P("visits.calendar.nextMonth"),className:"rounded-md border p-1.5 hover:bg-muted",children:(0,s.jsx)(C.A,{className:"h-4 w-4"})})]})]}),"week"===ee?(0,s.jsx)("div",{className:"grid grid-cols-7 gap-2",children:em.map(e=>(0,s.jsx)(T,{dayKey:e.dayKey,label:e.label,dateNum:e.dateNum,isToday:e.isToday,visits:ey[e.dayKey]||[],onSelect:ed,onQuickAdd:ef,t:P},e.dayKey))}):(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("div",{className:"grid grid-cols-7 gap-1 text-center text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:$.w4.map(e=>(0,s.jsx)("div",{children:P(`visits.calendar.weekdays.${e.key}`)},e.key))}),(0,s.jsx)("div",{className:"grid grid-cols-7 gap-1",children:ex.map(e=>(0,s.jsx)(V,{dayKey:e.dayKey,dateNum:e.dateNum,isToday:e.isToday,isOutsideMonth:e.isOutsideMonth,visits:ey[e.dayKey]||[],onSelect:ed,onQuickAdd:ef,t:P},e.dayKey))})]})]})]}),(0,s.jsx)(l.Hd,{children:er?(0,s.jsxs)("div",{className:"flex items-center gap-2 rounded-lg border border-primary bg-card p-2 shadow-lg",children:[(0,s.jsx)(f.A,{className:"h-4 w-4 text-primary"}),(0,s.jsx)("span",{className:"text-xs font-semibold text-foreground",children:er.StoreName})]}):null}),(0,s.jsx)(A.A,{visit:ea,open:!!ea,onClose:en,taskForms:F,onSave:eg,agents:E,onDelete:eb}),(0,s.jsx)(_,{open:!!H,store:H?.store,dayKey:H?.dayKey,taskForms:F,agents:E,onCancel:()=>J(null),onConfirm:eC,t:P}),(0,s.jsx)(_,{open:!!L,dayKey:L?.dayKey,taskForms:F,agents:E,stores:j,showStorePicker:!0,onCancel:()=>Q(null),onConfirm:ej,t:P})]})}}}]);
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.