PageSourceSearch

https://colara.co/assets/NeedsAttention-BskGZPGW.js

js colara.co collected 2026-10-02 01:20:55 UTC 12,338 bytes, 1 lines download raw bytes

1import{r as x,j as e}from"./vendor-Dz9lJ0A9.js";import{a as U,R as K,Q as Y,e as O,f as B,L as z,B as $,a9 as H,a0 as J,a1 as V,a2 as X,a3 as Z,P as ee,ag as te,aG as se,K as N,m as _,u as ie,J as ne,U as R,am as ae,I as M,H as oe,ax as re}from"./index-BDOD5E4V.js";import{u as de}from"./use-page-edit-permission-CML5S_Fz.js";import{u as le}from"./useSendEmail-VzJS3P-p.js";import{E as me}from"./empty-state-BuhuU5ze.js";import{B as Q}from"./badge-DV7OMou0.js";import{C as ce}from"./checkbox-CKtbmYQK.js";import{P as pe}from"./PageHelper-DlLkbNgT.js";import{A as P,g as ue,d as ge}from"./AttentionCard-B-R1AvL8.js";import{S as A}from"./send-D2ID-sFR.js";import{m as f,A as C}from"./framer-motion-B-6Peltb.js";import{C as he}from"./circle-check-CJ_VUuj_.js";import{C as xe}from"./clock-BGjkcAN7.js";import{C as T}from"./clipboard-list-BdSF-x85.js";import{M as fe}from"./map-pin-NOdPePnm.js";import{C as ye}from"./calendar-check-BrssALxT.js";import{B as je}from"./bell-BVf4PkaI.js";import"./use-subscription-L5b-ZlfW.js";import"./demo-ids-9GOwPNZM.js";import"./platform-fee-BXS45kYa.js";import"./page-keys-CfdTyt9X.js";import"./timeline-plan-DMrHSBzv.js";import"./free-plan-galleries-DRlNoTXr.js";import"./free-tier-pages-BBb825GL.js";import"./EmailPreviewModal-C1KlrKnj.js";import"./input-uKcRzRZU.js";import"./skeleton-Dp0qviHj.js";import"./EmailTemplatePicker-DQTQrg-h.js";import"./popover-DLgxV-6d.js";import"./search-_0AhvJvF.js";import"./trash-2-DB6k7OfX.js";import"./list-BLP47b8F.js";import"./save-C1Cv7VS4.js";import"./braces-3gkFdW37.js";import"./format-TE1zKFYr.js";import"./en-US-B1YEHn5a.js";import"./differenceInCalendarDays-CLfZenBU.js";import"./getTimezoneOffsetInMilliseconds-Dg5lkPpW.js";import"./crm-shortcodes-C9arKWs7.js";import"./client-name-DrkX_Dts.js";import"./currency-D2nl_7x3.js";import"./date-utils-VPArwFdR.js";import"./TimelineRichEditor-CWcsB4h6.js";import"./purify.es-D7kaK67O.js";import"./label-xakz0IwZ.js";import"./textarea-B6S3DUiX.js";import"./use-upload-BhuNLqHD.js";import"./timeline-notes-BAXXUWUX.js";import"./list-ordered-q1jHSUws.js";import"./heading-2-CkGv6oen.js";import"./link-qDdbFJaq.js";import"./text-align-start-DRmXArhb.js";import"./image-CRRQUQpN.js";import"./upload-BLxF6oWs.js";import"./link-2-DxAadr_f.js";import"./command-7zEmp0OB.js";import"./paperclip-C2dgC7YH.js";import"./undo-2-DuE24aMz.js";import"./pen-line-BmI8eKDA.js";import"./mouse-pointer-click-DrhaqtWj.js";import"./check-DtEZOD33.js";import"./use-dismissed-hints-CS8gEuUL.js";import"./circle-question-mark-Bqs4yPi3.js";import"./pin-CvPNoUzR.js";import"./store-BxqE78hz.js";import"./camera-DNX3tEqr.js";(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};i.SENTRY_RELEASE={id:"8dd115ac638cf6a2a2cf5668d0686c96509328ed"};var d=new i.Error().stack;d&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[d]="9b84c600-e819-4916-9f47-8e8f92cb1631",i._sentryDebugIdIdentifier="sentry-dbid-9b84c600-e819-4916-9f47-8e8f92cb1631")}catch{}})();const be={rsvp_deadline:ye,overdue_payment:M,upcoming_payment:M,missing_details:fe,incomplete_website:ae,guest_addresses:R,upcoming_tasks:T,overdue_tasks:T,seating_gaps:R,unsigned_contracts:ne,trial_expiring:xe},ve={info:"border-border/20 bg-muted/15",warning:"border-amber-300/25 bg-amber-50/30 dark:bg-amber-950/10",urgent:"border-red-300/25 bg-red-50/30 dark:bg-red-950/10"}
1,we={info:"bg-foreground/25",warning:"bg-amber-400/60",urgent:"bg-red-400/60"};function Ne(){const[,i]=ie(),{selectedWeddingId:d}=K(),{data:m=[]}=O({queryKey:["/api/dashboard/insights",d],queryFn:async()=>{const n=d?`?weddingId=${d}`:"",a=await _("GET",`/api/dashboard/insights${n}`);return a.ok?a.json():re(a,[])}});if(m.length===0)return null;const g=[...m].sort((n,a)=>{const u={urgent:0,warning:1,info:2};return u[n.severity]-u[a.severity]});return e.jsx("div",{className:"grid gap-2","data-testid":"insights-section",children:g.map(n=>{const a=be[n.type]||je;return e.jsxs("button",{onClick:()=>i(n.actionUrl),className:`w-full text-left group flex items-center gap-3.5 px-4 py-3 rounded-lg border transition-all hover:shadow-sm ${ve[n.severity]}`,"data-testid":`insight-${n.type}`,children:[e.jsxs("div",{className:"relative shrink-0",children:[e.jsx(a,{className:"w-4 h-4 text-foreground/65"}),e.jsx("div",{className:`absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full ${we[n.severity]}`})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-[13px] font-medium text-foreground/85 truncate",children:n.title}),e.jsx("p",{className:"text-[11px] text-foreground/70 mt-0.5 line-clamp-1",children:n.description})]})]},n.type)})})}function Bt(){const{data:i,isLoading:d}=U(),{effectiveRole:m}=de(),{selectedWeddingId:g}=K(),{toast:n}=Y(),[a,u]=x.useState(!1),[h,c]=x.useState(!1),[p,r]=x.useState([]),[k,D]=x.useState(null),y=te(m),j=se(m),{data:L=[],isLoading:F}=O({queryKey:["/api/attention-items"],enabled:!!i}),b=B({mutationFn:t=>_("PATCH",`/api/attention-items/${t}/complete`),onSuccess:()=>{N.refetchQueries({queryKey:["/api/attention-items"]}),N.refetchQueries({queryKey:["/api/attention-items/count"]}),n({title:"Marked as complete"})}}),W=B({mutationFn:t=>_("PATCH",`/api/attention-items/${t}/dismiss`),onSuccess:()=>{N.refetchQueries({queryKey:["/api/attention-items"]}),N.refetchQueries({queryKey:["/api/attention-items/count"]}),n({title:"Item dismissed"})}}),q=le({type:"attention_bundle",params:{weddingId:k??g??0,itemIds:p.join(",")},title:"Send Combined Email",onSent:()=>{c(!1),r([])}}),l=L.filter(t=>t.status==="pending"),v=L.filter(t=>t.status!=="pending"),G=l.reduce((t,s)=>{const o=s.weddingId;return t[o]||(t[o]={weddingId:o,coupleName:s.coupleName||`Wedding #${o}`,items:[]}),t[o].items.push(s),t},{}),I=Object.values(G),S=I.length>1;return d||F?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]","data-testid":"needs-attention-loading",children:e.jsx(z,{className:"h-8 w-8 animate-spin text-primary"})}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"max-w-3xl mx-auto px-4 sm:px-6 py-6 space-y-6","data-testid":"needs-attention-page",children:[e.jsx(pe,{title:"What is this?",description:"Your Needs Attention dashboard highlights everything that requires action across all your clients — overdue tasks, unsigned contracts, unpaid invoices, and upcoming deadlines. Stay on top of your business at a glance.",guideSlug:"crm",storageKey:"needs-attention",steps:["Review items flagged as urgent — they're sorted by priority.","Click any item to jump directly to the client or document that needs action.","Clear items as you handle them to keep your dashboard tidy."]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] tracking-[0.3em] uppercase text-muted-foreground/70 mb-3",children:"Action Items"}),e.jsx("h1",{className:"font-display text-3xl font-light tracking-tight text-foreground mb-2","data-testid":"text-page-title",children:"Needs Attention"}),e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:l.length===0?"You're all caught up — nothing needs your attention right now.":`${l.length} item${l.length!==1?"s":""} waiting${j&&S?` across ${I.length} couples`:""}`})]}),j&&l.length>0&&!S&&e.jsxs($,{variant:"outline",onClick:()=>{r(l.map(t=>t.id)),D(l[0]?.weddingId||null),c(!0)},"data-testid":"button-send-bundle",children:[e.jsx(A,{className:"h-4 w-4 mr-2"}),"Send Combined Email"]})]}),e.jsx(Ne,{}),l.length===0&&e.jsx(f.div,{initial:{opacity:0,y:10}
1,animate:{opacity:1,y:0},children:e.jsx(me,{icon:he,title:"All caught up!",description:y?"When your wedding professional sends you something to complete, it will appear here.":"When you send requests to your couples, their pending items will appear here."})}),j&&S?e.jsx(C,{mode:"popLayout",children:I.map(t=>e.jsx(Ce,{group:t,isPro:j,isCouple:y,onComplete:s=>b.mutate(s),onDismiss:s=>W.mutate(s),completing:b.isPending,onSendBundle:()=>{r(t.items.map(s=>s.id)),D(t.weddingId),c(!0)}},t.weddingId))}):e.jsx(C,{mode:"popLayout",children:Object.entries(l.reduce((t,s)=>(t[s.type]||(t[s.type]=[]),t[s.type].push(s),t),{})).map(([t,s])=>{const o=ue(t),E=o.icon;return e.jsxs(f.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{className:`h-5 w-5 ${o.color}`}),e.jsx("h2",{className:"font-display text-lg text-foreground",children:o.label}),e.jsx(Q,{variant:"secondary",className:"text-xs",children:s.length})]}),s.map(w=>e.jsx(P,{item:w,isCouple:y,onComplete:()=>b.mutate(w.id),onDismiss:()=>W.mutate(w.id),completing:b.isPending},w.id))]},t)})}),v.length>0&&e.jsxs("div",{className:"pt-4",children:[e.jsxs("button",{onClick:()=>u(!a),className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors","data-testid":"button-toggle-completed",children:[e.jsx(H,{className:`h-4 w-4 transition-transform ${a?"rotate-180":""}`}),v.length," completed / dismissed item",v.length!==1?"s":""]}),e.jsx(C,{children:a&&e.jsx(f.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"space-y-2 mt-3 overflow-hidden",children:v.map(t=>e.jsx(P,{item:t,isCouple:y,completed:!0},t.id))})})]}),e.jsx(J,{open:h,onOpenChange:c,children:e.jsxs(V,{className:"max-w-md",children:[e.jsx(X,{children:e.jsx(Z,{className:"font-display",children:"Send Combined Email"})}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Select which pending items to include in a single email to the couple."}),e.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:l.filter(t=>!k||t.weddingId===k).map(t=>e.jsxs("label",{className:"flex items-start gap-3 p-2 rounded-md hover:bg-muted/50 cursor-pointer",children:[e.jsx(ce,{checked:p.includes(t.id),onCheckedChange:s=>{r(o=>s?[...o,t.id]:o.filter(E=>E!==t.id))},"data-testid":`checkbox-bundle-item-${t.id}`}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:t.title}),t.description&&e.jsx("div",{className:"text-xs text-muted-foreground",children:t.description})]})]},t.id))}),e.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[e.jsx($,{variant:"outline",onClick:()=>c(!1),"data-testid":"button-cancel-bundle",children:"Cancel"}),e.jsxs(ee,{disabled:p.length===0,onClick:q.openPreview,"data-testid":"button-confirm-bundle",children:[e.jsx(A,{className:"h-4 w-4 mr-2"}),"Send Email (",p.length," item",p.length!==1?"s":"",")"]})]})]})}),q.modal]})})}function Ce({group:i,isPro:d,isCouple:m,onComplete:g,onDismiss:n,completing:a,onSendBundle:u}){const[h,c]=x.useState(!1),p=Math.max(...i.items.map(r=>ge(r.createdAt)));return e.jsxs(f.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("button",{onClick:()=>c(!h),className:"flex items-center gap-2.5 group","data-testid":`button-toggle-wedding-${i.weddingId}`,children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-primary/8 flex items-center justify-center",children:e.jsx(oe,{className:"w-3.5 h-3.5 text-primary"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("h2",{className:"text-[14px] font-medium tracking-tight text-foreground group-hover:text-primary transition-colors",children:i.coupleName}),e.jsxs("p",{className:"text-[10px] text-muted-foreground/70",children:[i.items.length," pending · oldest ",p,"d ago"]})]}),e.jsx(H,{className:`h-4 w-4 text-muted-foreground/70 transition-transform ml-1 ${h?"-rotate-90":""}`})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Q,{variant:"outline",className:"text-[10px] px-2 py-0.5",children:i.items.length}),d&&e.jsxs($,{variant:"ghost",size:"sm",onClick:u,className:"text-xs","data-testid":`button-send-bundle-${i.weddingId}`,children:[e.jsx(A,{className:"h-3 w-3 mr-1"}),"Nudge"]})]})]}),e.jsx(C,{children:!h&&e.jsx(f.div,{initial:{height:0,opacity:0}
1,animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"space-y-2 overflow-hidden pl-10",children:i.items.map(r=>e.jsx(P,{item:r,isCouple:m,onComplete:()=>g(r.id),onDismiss:()=>n(r.id),completing:a},r.id))})})]})}export{Bt 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.