PageSourceSearch

https://www.clarionlabs.ai/assets/CRMCalendar-9LJOMwgN-1790978053425.js

js clarionlabs.ai collected 2026-10-05 13:51:18 UTC 10,076 bytes, 1 lines download raw bytes

1import{e as q,r as l,j as e}from"./react-vendor-CWwlbjRo-1790978053425.js";import"./CreateLeadModal-BSWhBK9--1790978053425.js";import{b0 as F,C as Q,Z as V,m as X,az as L,b1 as E,_ as ee}from"./index-DsAuDdHa-1790978053425.js";import"./crm-multiselect-field-uHspvH-j-1790978053425.js";import"./ben-CbEv7h_G-1790978053425.js";import"./SettingsShell-CdMucJZR-1790978053425.js";/* empty css                                     */import{g as te,a as se}from"./CRMLayout-Bqsl90uv-1790978053425.js";import{e as ae,C as ne,a as re}from"./CrmSettingsStates-FvwA5pep-1790978053425.js";/* empty css                                          *//* empty css                                        *//* empty css                                   */import{C as y}from"./circle-check-CMk7dTHi-1790978053425.js";import"./mail-DKnD_OIn-1790978053425.js";import"./FilterSelect-D6djYx78-1790978053425.js";import"./SearchableSelect-fd2SkgrT-1790978053425.js";import"./shellPaths-BtLch0ST-1790978053425.js";import"./useLayoutConfig-zkwSCOgf-1790978053425.js";import"./onboardingV2Api-bWnONEh1-1790978053425.js";import"./useSFTransition-BYP_ti7v-1790978053425.js";import"./trophy-CW1gdJoH-1790978053425.js";import"./circle-user-round-DDy3ZngB-1790978053425.js";import"./clipboard-check-C5A1FNIV-1790978053425.js";import"./calendar-days-C_OVIfuQ-1790978053425.js";import"./gauge-V69bakM3-1790978053425.js";import"./wand-sparkles--0av4RCp-1790978053425.js";import"./boxes-Drr6M8uU-1790978053425.js";import"./user-cog-HjeqZ7Uq-1790978053425.js";const le=(i,x)=>{const o=new Date(i,x,1).getDay(),p=new Date(i,x+1,0).getDate(),r=[];let n=Array(o).fill(null);for(let d=1;d<=p;d++)n.push(d),n.length===7&&(r.push(n),n=[]);if(n.length>0){for(;n.length<7;)n.push(null);r.push(n)}return r},B=["January","February","March","April","May","June","July","August","September","October","November","December"],ie=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],w=i=>`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`,oe={high:"badge badge-alert",medium:"badge badge-warn",low:"badge badge-mute"},Pe=()=>{const i=q(),x=te(),c=new Date,[o,p]=l.useState(c.getFullYear()),[r,n]=l.useState(c.getMonth()),[d,P]=l.useState([]),[v,R]=l.useState([]),[_,S]=l.useState(!0),[C,$]=l.useState(null),[Y,I]=l.useState(0),[b,M]=l.useState(w(c));l.useEffect(()=>{let t=!1;return(async()=>{S(!0),$(null);try{const[s,a]=await Promise.all([F.getMyTasks({pageSize:200,includeDone:!0}),F.getMyLeads({page_size:200})]);if(t)return;P(Array.isArray(s==null?void 0:s.tasks)?s.tasks:[]),R((Array.isArray(a==null?void 0:a.leads)?a.leads:[]).filter(m=>m.next_follow_up_at))}catch(s){t||$(ae(s,"Could not load your tasks and follow-ups."))}finally{t||S(!1)}})(),()=>{t=!0}},[Y]);const O=l.useMemo(()=>le(o,r),[o,r]),T=l.useMemo(()=>{const t={};for(const s of d){if(!s.due_date)continue;const a=s.due_date.slice(0,10);t[a]||(t[a]=[]),t[a].push(s)}return t},[d]),D=l.useMemo(()=>{const t={};for(const s of v){if(!s.next_follow_up_at)continue;const a=s.next_follow_up_at.slice(0,10);t[a]||(t[a]=[]),t[a].push(s)}return t},[v]),U=()=>{r===0?(p(o-1),n(11)):n(r-1)},z=()=>{r===11?(p(o+1),n(0)):n(r+1)},J=()=>{p(c.getFullYear()),n(c.getMonth()),M(w(c))},N=w(c),f=T[b]||[],g=D[b]||[],K=b<N;return e.jsx(se,{title:"Calendar",subtitle:"Tasks and follow-ups",children:e.jsx("div",{className:"crm-settings settings-shell py-6",children:e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-[minmax(0,1fr)_380px] gap-6 items-start",children:[e.jsxs("div",{className:"card",children:[e.jsxs("div",{className:"card-head",children:[e.jsx("div",{className:"card-icon",children:e.jsx(Q,{className:"w-5 h-5"})}),e.jsxs("div",{className:"card-titles",children:[e.jsx("div",{className:"card-eyebrow",children:"Month"}),e.jsxs("h3",{className:"card-title",children:[B[r]," ",e.jsx("span",{className:"tabular-nums",children:o})]}),e.jsx("p",{className:"card-sub",children:"Pick a day to see the tasks and follow-ups scheduled on it."})]}),e.jsx("div",{className:"card-aside",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{type:"button",onClick:J,className:"btn btn-secondary btn-sm",children:"Today"}),e.jsx("button",{type:"button",onClick:U,className:"btn btn-ghost btn-sm btn-icon","aria-label":"Previous month",children:e.jsx(V,{className:"w-4 h-4"})}),e.jsx("button",{type:"button",onClick:z,className:"btn btn-ghost btn-sm btn-icon","aria-label":"Next month",children:e.jsx(X,{className:"w-4 h-4"})})]})})]}),C?e.jsx(ne,{title:"Couldn’t load the calendar",detail:C,onRetry:()=>I(t=>t+1)}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:ie.map(t=>e.jsx("div",{className:"text-center text-[10px] font-mono font-bold uppercase tracking-[0.16em] text-(--ink-mute) py-1",children:t},t))}),e.jsx("div",{"aria-busy":_,children:O.map((t,s)=>e.jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:t.map((a,m)=>{if(a===null)return e.jsx("div",{className:"h-[86px]"},m);const u=`${o}-${String(r+1).padStart(2,"0")}-${String(a).padStart(2,"0")}`,k=u===N,A=u===b,h=T[u]||[],j=D[u]||[],G=h.filter(Z=>Z.status!=="done").length,H=u<N&&G>0,W=h.length+j.length;return e.jsxs("button",{type:"button",onClick:()=>M(u),"aria-pressed":A,"aria-current":k?"date":void 0,"aria-label":`${B[r]} ${a}, ${o} — ${h.length} task${h.length===1?"":"s"}, ${j.length} follow-up${j.length===1?"":"s"}`,className:`h-[86px] rounded-(--r-md) border text-left p-2 transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--accent) ${A?"border-(--accent-line) bg-(--accent-soft)":k?"border-(--accent-line) bg-(--surface-2) hover:bg-(--surface-3)":"border-(--hairline) bg-(--surface) hover:bg-(--surface-2)"}`,children:[e.jsx("span",{className:`text-[13px] font-semibold tabular-nums ${k?"text-(--accent-text)":"text-(--ink)"}`,children:a}),W>0&&e.jsxs("div",{className:"mt-1.5 flex flex-col gap-1",children:[h.length>0&&e.jsxs("span",{className:`inline-flex items-center gap-1 text-xs tabular-nums ${H?"text-(--crit)":"text-(--ink-soft)"}`,children:[e.jsx(L,{className:"w-3 h-3 shrink-0","aria-hidden":!0}),h.length]}),j.length>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs tabular-nums text-(--ink-soft)",children:[e.jsx(E,{className:"w-3 h-3 shrink-0","aria-hidden":!0}),j.length]})]})]},m)})},s))}),_&&e.jsx("p",{className:"mt-3 text-xs text-(--ink-mute)",role:"status","aria-live":"polite",children:"Loading tasks and follow-ups…"})]})]}),e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"card-head",children:e.jsxs("div",{className:"card-titles",children:[e.jsx("div",{className:"card-eyebrow",children:"Day"}),e.jsx("h3",{className:"card-title",children:new Date(b+"T12:00:00").toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"})}),e.jsxs("p",{className:"card-sub tabular-nums",children:[f.length," task",f.length!==1?"s":""," ·"," ",g.length," follow-up",g.length!==1?"s":""]})]})}),e.jsx("div",{className:"max-h-[calc(100vh-330px)] overflow-y-auto",children:f.length===0&&g.length===0?e.jsx(re,{title:"Nothing scheduled",sub:"Tasks with a due date and leads with a follow-up date appear here. Add a task from a lead’s Tasks tab to schedule one.",icon:e.jsx(y,{className:"w-5 h-5"})}):e.jsxs(e.Fragment,{children:[f.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-[10px] font-mono font-bold uppercase tracking-[0.18em] text-(--ink-mute) mb-2 flex items-center gap-1.5",children:[e.jsx(L,{className:"w-3 h-3","aria-hidden":!0})," Tasks"]}),e.jsx("ul",{className:"mb-5",children:f.map(t=>{const s=t.status==="done",a=K&&!s,m=!!t.lead_id;return e.jsx("li",{className:"border-b border-(--hairline) last:border-b-0",children:e.jsxs("button",{type:"button",disabled:!m,onClick:()=>t.lead_id&&i(`${x}/prospects/${t.lead_id}?tab=tasks`),className:"w-full text-left py-2.5 px-1 flex items-start gap-2.5 rounded-(--r-sm) transition-colors enabled:hover:bg-(--surface-2) disabled:cursor-default focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-(--accent)",children:[s?e.jsx(y,{className:"w-4 h-4 mt-0.5 text-(--ok) shrink-0","aria-hidden":!0}):a?e.jsx(ee,{className:"w-4 h-4 mt-0.5 text-(--crit) shrink-0","aria-hidden":!0}):e.jsx(y,{className:"w-4 h-4 mt-0.5 text-(--ink-mute) shrink-0","aria-hidden":!0}),e.jsxs("span",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:`block text-[13px] truncate ${s?"line-through text-(--ink-mute)":"text-(--ink)"}`,children:t.task_text}),e.jsxs("span",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[t.lead_name&&e.jsx("span",{className:"text-xs text-(--accent-text) truncate",children:t.lead_name}),t.priority&&e.jsx("span",{className:oe[t.priority]??"badge badge-mute",children:t.priority}),a&&e.jsx("span",{className:"badge bg-(--crit-soft) text-(--crit) border border-(--crit-line)",children:"Overdue"})]})]})]})},t.id)})})]}),g.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-[10px] font-mono font-bold uppercase tracking-[0.18em] text-(--ink-mute) mb-2 flex items-center gap-1.5",children:[e.jsx(E,{className:"w-3 h-3","aria-hidden":!0})," Lead follow-ups"]}),e.jsx("ul",{children:g.map(t=>e.jsx("li",{className:"border-b border-(--hairline) last:border-b-0",children:e.jsxs("button",{type:"button",onClick:()=>i(`${x}/prospects/${t.id}`),className:"w-full text-left py-2.5 px-1 rounded-(--r-sm) transition-colors hover:bg-(--surface-2) focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-(--accent)",children:[e.jsx("span",{className:"block text-[13px] font-medium text-(--ink) truncate",children:t.contact_name||`Lead ${t.lead_id??t.id}`}),e.jsxs("span",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[t.facility_name&&e.jsx("span",{className:"text-xs text-(--ink-soft) truncate",children:t.facility_name}),t.contact_phone&&e.jsx("span",{className:"text-xs text-(--ink-mute) tabular-nums",children:t.contact_phone})]})]})},t.id))})]})]})})]})]})})})};export{Pe as CRMCalendar};

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.