PageSourceSearch

https://incommand.ai/assets/Proposals-xTH635Gt.js

js incommand.ai collected 2026-10-05 15:01:11 UTC 25,281 bytes, 5 lines download raw bytes

1import{j as e}from"./vendor-radix-BnNg3BH5.js";import{E as Ve}from"./empty-state-hBdOL6aT.js";import{r as l,d as Pe}from"./vendor-react-67mgcWXU.js";import{M as Z}from"./metric-DK0Tcl4m.js";import{u as ne,b as le,s as d,F as J,B as I,a6 as $e,U as Ue,V as We,W as je,I as qe,w as ze,x as Ke,y as Be,z as Re,A as L,Y as _e,L as O}from"./index-Epr9psQo.js";import{C as P,a as He,b as Ge,c as Qe,d as M}from"./card-DpKBVi42.js";import{S as N}from"./skeleton-CXDkv5zX.js";import{B as q}from"./badge-Cl7apleB.js";import{D as ve,a as we,b as Ne,e as m}from"./dropdown-menu-Duf4NJvQ.js";import{T as Ye,a as Ze,b as te,c as E,d as Je,e as D}from"./table-023rHGnC.js";import{u as Xe,V as es}from"./usePersistedView-DQR3z3CM.js";import{S as W}from"./sortable-header-Cy2vre1w.js";import{A as ss,a as ts,b as as,c as rs,d as is,e as ns,f as ls,g as os}from"./alert-dialog-D6zmf4Qa.js";import{L as cs,P as ds}from"./ProposalFormDialog-B7mFJFmu.js";import{u as ms}from"./useIsAdmin-Ctpj3Dh2.js";import{u as us}from"./useConvertProposalToProject-D5JklOes.js";import{u as xs}from"./proposalTemplates-Cp4cu4Wh.js";import{S as ie}from"./sparkles-BcySMUTB.js";import{U as ps}from"./upload-2-rh2XwF.js";import{W as hs}from"./wand-sparkles-CP9Guegx.js";import{A as gs}from"./arrow-right-LjC5fuTq.js";import{m as fs}from"./vendor-motion-CSzk-Fqg.js";import{P as ye}from"./plus-DRTmwF2W.js";import{T as js}from"./trending-up-CXZcoU_y.js";import{C as ae}from"./circle-check-Cv8aCTuA.js";import{D as _s}from"./dollar-sign-CC-jyV1q.js";import{F as re}from"./folder-open-CP9JKzSm.js";import{S as vs}from"./search-BnpyGpZl.js";import{T as ws}from"./triangle-alert-C6ISfBPd.js";import{S as Ns}from"./shield-BI9NGrnO.js";import{C as ys}from"./calendar-Ce69BthR.js";import{E as be}from"./ellipsis-C6BfvtHH.js";import{F as Ce}from"./folder-plus-BajeVryu.js";import{D as Se}from"./download-CDzT20jl.js";import{C as De}from"./copy-C-Qie2rJ.js";import{s as bs}from"./startOfMonth-DSkvSDwv.js";import{e as Cs}from"./endOfMonth-BJH_LSY0.js";import{i as Ss}from"./isWithinInterval-iv8YYnTs.js";import"./vendor-supabase-CTlrDMdV.js";import"./vendor-charts-Dck3qfzI.js";import"./vendor-query-PMAhJHCS.js";import"./chevron-right-DQtszqux.js";import"./circle-CPv7M1K7.js";import"./layout-grid-ShDyZi0i.js";import"./list-Cd7HYcio.js";import"./arrow-down-B8ohBotC.js";import"./arrow-up-down-tiE00tys.js";import"./useFormPersistence-DFchkFzQ.js";import"./scroll-area-OnGFamwr.js";import"./filter-idQrjp7H.js";import"./ellipsis-vertical-_YAO8fyL.js";import"./pen-BjcYRxrI.js";import"./trash-2-EIFrPvgK.js";import"./star-Bi_oSCUH.js";import"./clock-BYWbH6MV.js";import"./formatDistanceToNow--Gw1Xv78.js";import"./constructNow-LutmP3uJ.js";import"./en-US-DJiZ5LCQ.js";import"./differenceInMonths-ODK8TVL-.js";import"./differenceInCalendarMonths-CBq9QhqA.js";import"./endOfDay-CV7hhp0x.js";import"./differenceInMilliseconds-BS2m-4UB.js";import"./pen-line-DWItyULb.js";function Ds(){const[x,k]=l.useState(!1),{toast:v}=ne(),{currentTenant:y}=le();return{cloneProposal:async r=>{if(!y?.id)return v({title:"Error",description:"No tenant context available",variant:"destructive"}),null;k(!0);try{const{data:{user:b}}=await d.auth.getUser();if(!b)throw new Error("Not authenticated");const{data:p,error:T}=await d.from("proposals").insert({title:`${r.title} (Copy)`,description:r.description,tenant_id:y.id,user_id:b.id,client_id:r.client_id,prospect_id:r.prospect_id,workstreams:r.workstreams,deliverables_list:r.deliverables_list,key_personnel:r.key_personnel,assumptions:r.assumptions,timeline:r.timeline,msa_content:r.msa_content,msa_sections:r.msa_sections,msa_variables:r.msa_variables,total_value:r.total_value,commercial_model:r.commercial_model,project_cap:r.project_cap,net_terms_days:r.net_terms_days,billing_timing:r.billing_timing,monthly_retainer_amount:r.monthly_retainer_amount,approval_threshold_percent:r.approval_threshold_percent,estimated_duration:r.estimated_duration,client_legal_name:r.client_legal_name,client_entity_type:r.client_entity_type,client_state:r.client_state,client_dba:r.client_dba,client_address:r.client_address,signatory_name:r.signatory_name,signatory_title:r.signatory_title,signatory_email:r.signatory_email,prospect_logo_url:r.prospect_logo_url,prospect_logo_source:r.prospect_logo_source,provider_logo_url:r.provider_logo_url,status:"draft",proposal_status:"draft",version_number:1,valid_until:new Date(Date.now()+30*24*60*60*1e3).toISOString().split("T")[0],effective_date:null,sent_at:null,viewed_at:null,signed_at:null,first_signed_at:null,all_signed_at:null,locked_at:null,locked_by:null,is_locked:!1,msa_locked:!1,content_locked:!1,final_pdf_url:null,final_pdf_hash:null,required_signers_count:0,completed_signers_count:0,pending_redlines_count:0,reminder_count:0,last_reminder_sent_at:null,expired_at:null,cloned_from_id:r.id,linked_project_id:null,project_lead_id:r.project_lead_id,source_service_ids:r.source_service_ids}).select("id").single();if(T)throw T;const{data:h}=await d.from("proposal_signers").select("*").eq("proposal_id",r.id);if(h&&h.length>0){const C=h.map(f=>({proposal_id:p.id,signer_name:f.signer_name,signer_title:f.signer_title,signer_email:f.signer_email,signer_role:f.signer_role,signer_company:f.signer_company,signing_order:f.signing_order,status:"pending",signed_at:null,signature_id:null}));await d.from("proposal_signers").insert(C)}return v({title:"Proposal Cloned",description:`"${r.title}" has been duplicated as a new draft.`}),p.id}catch(b){return console.error("Error cloning proposal:",b),v({title:"Clone Failed",description:"Could not duplicate the proposal. Please try again.",variant:"destructive"}),null}finally{k(!1)}}
1,isCloning:x}}function Ps({onTemplateCreated:x}){const k=Pe(),{toast:v}=ne(),{currentTenant:y}=le(),{templates:w,isLoading:r}=xs(),[b,p]=l.useState(!1),[T,h]=l.useState(!1);if(r||w.length>0)return null;const C=async n=>{if(y?.id){p(!0);try{const g=await n.text(),{data:o,error:S}=await d.functions.invoke("parse-sow-to-template",{body:{content:g.slice(0,15e3),fileName:n.name,tenantId:y.id}});if(S)throw S;o?.template&&(v({title:"SOW imported successfully",description:`Created template "${o.template.name}" with ${o.template.workstreams?.length||0} workstreams.`}),x?.())}catch(g){console.error("SOW import error:",g),v({title:"Import failed",description:"Could not parse the document. Try the manual template wizard instead.",variant:"destructive"})}finally{p(!1)}}},f=n=>{n.preventDefault(),h(!1);const g=n.dataTransfer.files[0];g&&C(g)};return e.jsxs(P,{className:"border-dashed border-2 border-primary/30 bg-primary/5",children:[e.jsxs(He,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{className:"h-5 w-5 text-primary"}),e.jsx(Ge,{className:"text-lg",children:"Get Started with Templates"})]}),e.jsx(Qe,{children:"No proposal templates found. Create one from your service catalog or import a historical SOW."})]}),e.jsx(M,{className:"space-y-4",children:e.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:`relative rounded-lg border-2 border-dashed p-6 text-center transition-colors cursor-pointer ${T?"border-primary bg-primary/10":"border-muted-foreground/25 hover:border-primary/50"}`,onDragOver:n=>{n.preventDefault(),h(!0)},onDragLeave:()=>h(!1),onDrop:f,onClick:()=>{const n=document.createElement("input");n.type="file",n.accept=".pdf,.doc,.docx,.txt",n.onchange=g=>{const o=g.target.files?.[0];o&&C(o)},n.click()},children:[e.jsx(ps,{className:"h-8 w-8 mx-auto mb-3 text-muted-foreground"}),e.jsx("h4",{className:"font-medium text-sm mb-1",children:"Import Historical SOW"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Drop a past SOW/proposal here and AI will extract workstreams, deliverables & pricing."}),e.jsxs(q,{variant:"secondary",className:"mt-2 text-xs",children:[e.jsx(hs,{className:"h-3 w-3 mr-1"})," AI-Powered"]})]}),e.jsxs("div",{className:"rounded-lg border p-6 text-center cursor-pointer hover:border-primary/50 transition-colors",onClick:()=>k("/proposals/templates/new"),children:[e.jsx(J,{className:"h-8 w-8 mx-auto mb-3 text-muted-foreground"}),e.jsx("h4",{className:"font-medium text-sm mb-1",children:"Create from Service Catalog"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Pick a service and auto-populate template with workstreams, deliverables & pricing model."}),e.jsxs(I,{variant:"outline",size:"sm",className:"mt-2",children:["Open Wizard ",e.jsx(gs,{className:"h-3 w-3 ml-1"})]})]})]})})]})}const ks={draft:"bg-muted text-muted-foreground",sent:"bg-primary/10 text-primary",accepted:"bg-success/10 text-success",declined:"bg-destructive/10 text-destructive",expired:"bg-warning/10 text-warning"},Ts={draft:"secondary",sent:"default",accepted:"default",declined:"destructive",expired:"secondary"},As=["draft","sent","accepted","declined","expired"];function Wt(){const[x,k]=l.useState([]),[v,y]=l.useState(!0),[w,r]=l.useState(""),[b,p]=l.useState(!1),[T,h]=l.useState(null),[C,f]=Xe("proposals-view"),[n,g]=l.useState(null),[o,S]=l.useState(null),[ke,X]=l.useState(!1),[j,oe]=l.useState(null),[V,Te]=l.useState("active"),[z,Ae]=l.useState("all"),_=Pe(),{isAdmin:Fe}=ms(),{toast:A}=ne(),{currentTenant:K}=le(),{cloneProposal:Le,isCloning:B}=Ds(),{convertToProject:Oe,isConverting:R}=us(),ce=async(t,i)=>{i.stopPropagation();const s=await Oe(t);s&&(F(),_(`/projects/${s}`))},de=async(t,i)=>{i.stopPropagation();const s=await Le(t);s&&(F(),_(`/proposals/${s}`))},$=t=>{n===t?o==="asc"?S("desc"):o==="desc"?(g(null),S(null)):S("asc"):(g(t),S("asc"))},me=(t,i)=>{switch(i){case"title":return t.title?.toLowerCase();case"client":return(t.clients?.name||t.prospects?.company_name||"")?.toLowerCase();case"status":return As.indexOf(t.status||"draft");case"value":return t.total_value||0;case"date":return t.valid_until?new Date(t.valid_until):null;default:return null}};l.useEffect(()=>{K?.id&&F()},[K?.id]);const F=async()=>
1{if(K?.id)try{const{data:t,error:i}=await d.from("proposals").select(`
2          *,
3          clients (name),
4          prospects (company_name)
5        `).eq("tenant_id",K.id).order("created_at",{ascending:!1});if(i)throw i;k(t||[])}catch(t){console.error("Error loading proposals:",t)}finally{y(!1)}},c=l.useMemo(()=>t=>t.proposal_status==="signed"||!!t.signed_at,[]),ue=t=>{if(c(t)&&!Fe){A({title:"Permission Denied",description:"Only administrators can delete signed proposals.",variant:"destructive"});return}oe(t),X(!0)},Ee=async()=>{if(!j)return;const t=j.id;try{await Promise.all([d.from("client_documents").update({linked_proposal_id:null}).eq("linked_proposal_id",t),d.from("meeting_decisions").update({proposal_id:null}).eq("proposal_id",t),d.from("pricing_rationales").delete().eq("proposal_id",t),d.from("projects").update({source_proposal_id:null}).eq("source_proposal_id",t),d.from("proposals").update({cloned_from_id:null}).eq("cloned_from_id",t),d.from("slack_decision_traces").update({proposal_id:null}).eq("proposal_id",t),d.from("staffing_decisions").update({proposal_id:null}).eq("proposal_id",t)]);const{error:i}=await d.from("proposals").delete().eq("id",t);if(i){console.error("Error deleting proposal:",i),A({title:"Failed to delete proposal",description:i.message,variant:"destructive"});return}A({title:"Proposal deleted successfully"}),F()}catch(i){console.error("Error deleting proposal:",i),A({title:"Failed to delete proposal",variant:"destructive"})}finally{X(!1),oe(null)}},[H,xe]=l.useState(null),pe=async(t,i)=>{i.stopPropagation();const s=async a=>{try{const Y=await(await fetch(a)).blob(),fe=URL.createObjectURL(Y),U=document.createElement("a");U.href=fe,U.download=`${t.title.replace(/[^a-zA-Z0-9-_ ]/g,"")}-Signed.pdf`,document.body.appendChild(U),U.click(),document.body.removeChild(U),URL.revokeObjectURL(fe)}catch{window.open(a,"_blank")}};xe(t.id);try{const{data:a,error:u}=await d.functions.invoke("generate-signed-pdf",{body:{proposalId:t.id}});if(u)throw u;A({title:"PDF Generated",description:"Your signed agreement PDF is ready."}),a?.pdfUrl&&(await s(a.pdfUrl),F())}catch(a){console.error("Error generating PDF:",a),A({title:"Error",description:"Failed to generate PDF. Please try again.",variant:"destructive"})}finally{xe(null)}},G=l.useMemo(()=>x.filter(t=>!c(t)),[x,c]),ee=l.useMemo(()=>x.filter(t=>c(t)),[x,c]),he=V==="active"?G:ee,se=l.useMemo(()=>he.filter(t=>{const i=t.title.toLowerCase().includes(w.toLowerCase())||(t.clients?.name||"").toLowerCase().includes(w.toLowerCase())||(t.prospects?.company_name||"").toLowerCase().includes(w.toLowerCase()),s=z==="all"||t.status===z;return i&&s}),[he,w,z]),Q=l.useMemo(()=>!n||!o?se:[...se].sort((t,i)=>{const s=me(t,n),a=me(i,n);if(s==null&&a==null)return 0;if(s==null)return 1;if(a==null)return-1;let u=0;return typeof s=="string"?u=s.localeCompare(a):s instanceof Date?u=s.getTime()-a.getTime():u=s>a?1:-1,o==="desc"?-u:u}),[se,n,o]),Ie=G.reduce((t,i)=>t+(i.total_value||0),0);x.reduce((t,i)=>t+(i.total_value||0),0);const Me=l.useMemo(()=>{const t=new Date,i=bs(t),s=Cs(t);return x.filter(a=>{if(!(a.proposal_status==="signed"||!!a.signed_at))return!1;const Y=a.signed_at?new Date(a.signed_at):null;return Y?Ss(Y,{start:i,end:s}):!1}).reduce((a,u)=>a+(u.total_value||0),0)},[x]),ge=()=>{const t=V==="active"?"No active proposals found":"No signed proposals yet",i=V==="active"&&e.jsxs(I,{className:"mt-4",onClick:()=>p(!0),children:[e.jsx(ye,{className:"h-4 w-4 mr-2"}),"Create your first proposal"]});return C==="card"?e.jsxs("div",{className:"grid gap-4",children:[Q.map(s=>e.jsx(P,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>_(`/proposals/${s.id}`),children:e.jsx(M,{className:"p-6",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("h3",{className:"text-lg font-semibold truncate",children:s.title}),e.jsx(q,{className:ks[s.status||"draft"],children:s.status}),c(s)&&e.jsxs(q,{className:"bg-success/10 text-success border-success/20",children:[e.jsx(ae,{className:"h-3 w-3 mr-1"}),"Signed"]})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:s.clients?.n
5ame||s.prospects?.company_name||"No client"}),s.description&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:s.description}),c(s)&&s.signed_at&&e.jsxs("p",{className:"text-xs text-success mt-2",children:["Signed on ",new Date(s.signed_at).toLocaleDateString()]})]}),e.jsxs("div",{className:"flex items-center gap-4 ml-6",children:[e.jsxs("div",{className:"text-right",children:[e.jsxs("p",{className:"text-xl font-bold",children:["$",((s.total_value||0)/1e3).toFixed(0),"K"]}),!c(s)&&s.valid_until&&e.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1 justify-end mt-1",children:[e.jsx(ys,{className:"h-3 w-3"}),"Valid until ",new Date(s.valid_until).toLocaleDateString()]})]}),e.jsxs(ve,{children:[e.jsx(we,{asChild:!0,onClick:a=>a.stopPropagation(),children:e.jsx(I,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"More options",children:e.jsx(be,{className:"h-4 w-4"})})}),e.jsxs(Ne,{align:"end",children:[e.jsx(m,{onClick:a=>{a.stopPropagation(),h(s),p(!0)},children:"Edit"}),e.jsxs(m,{onClick:a=>{a.stopPropagation(),_(`/proposals/${s.id}`)},children:[e.jsx(ie,{className:"h-4 w-4 mr-2"}),"Open Builder"]}),s.linked_project_id?e.jsxs(m,{onClick:a=>{a.stopPropagation(),_(`/projects/${s.linked_project_id}`)},children:[e.jsx(re,{className:"h-4 w-4 mr-2"}),"View Project"]}):c(s)&&e.jsxs(m,{onClick:a=>ce(s,a),disabled:R,children:[R?e.jsx(O,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(Ce,{className:"h-4 w-4 mr-2"}),"Convert to Project"]}),c(s)&&e.jsxs(m,{onClick:a=>pe(s,a),disabled:H===s.id,children:[H===s.id?e.jsx(O,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(Se,{className:"h-4 w-4 mr-2"}),"Download PDF"]}),e.jsxs(m,{onClick:a=>de(s,a),disabled:B,children:[B?e.jsx(O,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(De,{className:"h-4 w-4 mr-2"}),"Duplicate"]}),e.jsx(m,{className:"text-destructive",onClick:a=>{a.stopPropagation(),ue(s)},children:"Delete"})]})]})]})]})})},s.id)),Q.length===0&&e.jsx(Ve,{icon:e.jsx(J,{}),title:t,action:i})]}):e.jsx(P,{children:e.jsxs(Ye,{children:[e.jsx(Ze,{children:e.jsxs(te,{children:[e.jsx(E,{children:e.jsx(W,{label:"Title",sortKey:"title",currentSort:n,currentDirection:o,onSort:$})}),e.jsx(E,{children:e.jsx(W,{label:"Client",sortKey:"client",currentSort:n,currentDirection:o,onSort:$})}),e.jsx(E,{children:e.jsx(W,{label:"Status",sortKey:"status",currentSort:n,currentDirection:o,onSort:$})}),e.jsx(E,{className:"text-right",children:e.jsx(W,{label:"Value",sortKey:"value",currentSort:n,currentDirection:o,onSort:$,className:"justify-end"})}),e.jsx(E,{children:V==="active"?e.jsx(W,{label:"Valid Until",sortKey:"date",currentSort:n,currentDirection:o,onSort:$}):"Signed Date"}),e.jsx(E,{className:"w-[50px]"})]})}),e.jsx(Je,{children:Q.length===0?e.jsx(te,{children:e.jsx(D,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:t})}):Q.map(s=>e.jsxs(te,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>_(`/proposals/${s.id}`),children:[e.jsx(D,{className:"font-medium",children:e.jsxs("div",{className:"flex items-center gap-2",children:[s.title,c(s)&&e.jsx(q,{className:"bg-success/10 text-success border-success/20 text-xs",children:e.jsx(ae,{className:"h-3 w-3"})})]})}),e.jsx(D,{className:"text-muted-foreground",children:s.clients?.name||s.prospects?.company_name||"-"}),e.jsx(D,{children:e.jsx(q,{variant:Ts[s.status||"draft"],children:s.status})}),e.jsxs(D,{className:"text-right font-medium",children:["$",((s.total_value||0)/1e3).toFixed(0),"K"]}),e.jsx(D,{className:"text-muted-foreground",children:c(s)&&s.signed_at?new Date(s.signed_at).toLocaleDateString():s.valid_until?new Date(s.valid_until).toLocaleDateString():"-"}),e.jsx(D,{onClick:a=>a.stopPropagation(),children:e.jsxs(ve,{children:[e.jsx(we,{asChild:!0,onClick:a=>a.stopPropagation(),children:e.jsx(I,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":"More options",children:e.jsx(be,{className:"h-4 w-4"})})}),e.jsxs(Ne,{align:"end",children:[e.jsx(m,{onClick:a=>{a.stopPropagation(),h(s),p(!0)},children:"Edit"}),e.jsxs(m,{onClick:a=>{a.stopPropagation(),_(`/proposals/${s.id}`)},children:[e.jsx(ie,{className:"h-4 w-4 mr-2"}),"Open Builder"]}),s.linked_project_id?e.jsxs(m,{onClick:a=>{a.stopPropagation(),_(`/projects/${s.linked_project_id}`)},children:[e.jsx(re,{className:"h-4 w-4 mr-2"}),"View Project"]}):c(s)&&e.jsxs(m,{onClick:a=>ce(s,a),disabled:R,children:[R?e.jsx(O,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(Ce,{className:"h-4 w-4 mr-2"}),"Convert to Project"]}),c(s)&&e.jsxs(m,{onClick:a=>pe(s,a),disabled:H===s.id,children:[H===s.id?e.jsx(O,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(Se,{className:"h-4 w-4 mr-2"}),"Download PDF"]}),e.jsxs(m,{onClick:a=>de(s,a),disabled:B,children:[B?e.jsx(O,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(De,{className:"h-4 w-4 mr-2"}),"Duplicate"]}),e.jsx(m,{className:"text-destructive",onClick:a=>{a.stopPropagation(),ue(s)},children:"Delete"})]})]})})]},s.id))})]})})};return v?e.jsxs("div",{className:"space-y-6 p-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(N,{className:"h-8 w-36"}),e.jsx(N,{className:"h-9 w-32"})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:Array.from({length:4}).map((t,i)=>e.jsxs("div",{className:"border rounded-lg p-4 space-y-2",children:[e.jsx(N,{className:"h-3 w-20"}),e.jsx(N,{className:"h-7 w-16"})]},i))}),e.jsx("div",{className:"space-y-3",children:Array.from({length:5}).map((t,i)=>e.jsxs("div",{className:"border rounded-lg p-4 flex items-center gap-4",children:[e.jsx(N,{className:"h-5 w-1/4"}),e.jsx(N,{className:"h-4 w-1/6"}),e.jsx(N,{className:"h-4 w-1/6"}),e.jsx(N,{className:"h-6 w-16"})]},i))})]}):e.jsxs(fs.div,{initial:{opacity:0}
5,animate:{opacity:1},className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4","data-tour":"proposals-header",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Proposals"}),e.jsx("p",{className:"text-muted-foreground",children:"Create and manage client proposals"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(I,{variant:"outline",onClick:()=>_("/proposals/templates/new"),className:"gap-2",children:[e.jsx(cs,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Manage Templates"})]}),e.jsxs(I,{onClick:()=>{h(null),p(!0)},"data-tour":"create-proposal-button",children:[e.jsx(ye,{className:"h-4 w-4 mr-2"}),"New Proposal"]})]})]}),e.jsx(Ps,{onTemplateCreated:()=>{}}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[e.jsx(P,{children:e.jsx(M,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-lg bg-primary/10",children:e.jsx(J,{className:"h-6 w-6 text-primary"})}),e.jsxs("div",{children:[e.jsx(Z,{size:"md",children:G.length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Active Proposals"})]})]})})}),e.jsx(P,{children:e.jsx(M,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-lg bg-primary/10",children:e.jsx(js,{className:"h-6 w-6 text-primary"})}),e.jsxs("div",{children:[e.jsx(Z,{size:"md",children:$e(Ie)}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Pipeline Value"})]})]})})}),e.jsx(P,{children:e.jsx(M,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-lg bg-success/10",children:e.jsx(ae,{className:"h-6 w-6 text-success"})}),e.jsxs("div",{children:[e.jsx(Z,{size:"md",children:ee.length}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Signed SOWs"})]})]})})}),e.jsx(P,{children:e.jsx(M,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-lg bg-success/10",children:e.jsx(_s,{className:"h-6 w-6 text-success"})}),e.jsxs("div",{children:[e.jsxs(Z,{size:"md",children:["$",(Me/1e3).toFixed(0),"K"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Accepted This Month"})]})]})})})]}),e.jsxs(Ue,{value:V,onValueChange:t=>Te(t),className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs(We,{children:[e.jsxs(je,{value:"active",className:"gap-2",children:[e.jsx(J,{className:"h-4 w-4"}),"Active (",G.length,")"]}),e.jsxs(je,{value:"signed",className:"gap-2",children:[e.jsx(re,{className:"h-4 w-4"}),"Signed (",ee.length,")"]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx(vs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(qe,{placeholder:"Search proposals...",value:w,onChange:t=>r(t.target.value),className:"pl-10"})]}),e.jsxs(ze,{value:z,onValueChange:Ae,children:[e.jsx(Ke,{className:"w-[140px]",children:e.jsx(Be,{placeholder:"Status"})}),e.jsxs(Re,{children:[e.jsx(L,{value:"all",children:"All Statuses"}),e.jsx(L,{value:"draft",children:"Draft"}),e.jsx(L,{value:"sent",children:"Sent"}),e.jsx(L,{value:"accepted",children:"Accepted"}),e.jsx(L,{value:"declined",children:"Declined"}),e.jsx(L,{value:"expired",children:"Expired"})]})]}),e.jsx(es,{view:C,onViewChange:f})]})]}),e.jsx(_e,{value:"active",className:"space-y-4 mt-0",children:ge()}),e.jsx(_e,{value:"signed",className:"space-y-4 mt-0",children:ge()})]}),e.jsx(ds,{open:b,onOpenChange:p,onSuccess:F,proposal:T}),e.jsx(ss,{open:ke,onOpenChange:X,children:e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(rs,{className:"flex items-center gap-2",children:j&&c(j)?e.jsxs(e.Fragment,{children:[e.jsx(ws,{className:"h-5 w-5 text-destructive"}),"Delete Signed Proposal?"]}):"Delete Proposal?"}),e.jsx(is,{className:"space-y-3",children:j&&c(j)?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-destructive/10 border border-destructive/20",children:[e.jsx(Ns,{className:"h-5 w-5 text-destructive flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-destructive",children:"Warning: This is a legally binding document"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"This proposal has been signed and may have legal implications. Deleting it will also remove all signature records and audit history."})]})]}),e.jsxs("p",{children:['Are you sure you want to permanently delete "',j?.title,'"? This action cannot be undone.']})]}):e.jsxs("p",{children:['Are you sure you want to delete "',j?.title,'"? This action cannot be undone.']})})]}),e.jsxs(ns,{children:[e.jsx(ls,{children:"Cancel"}),e.jsx(os,{onClick:Ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:j&&c(j)?"Delete Signed Proposal":"Delete"})]})]})})]})}export{Wt 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.