PageSourceSearch

https://crm-flow-academy-global.vercel.app/_next/static/chunks/pages/dashboard/quotations-7633f9f7150f017e.js

js crm-flow-academy-global.vercel.app collected 2026-10-03 06:43:00 UTC 35,835 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1498],{19621:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/dashboard/quotations",function(){return a(57869)}])},23946:(e,t,a)=>{"use strict";a.d(t,{A:()=>r});var s=a(14232);let r=s.forwardRef(function(e,t){let{title:a,titleId:r,...l}=e;return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":r},l),a?s.createElement("title",{id:r},a):null,s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 0 1-.659 1.591l-5.432 5.432a2.25 2.25 0 0 0-.659 1.591v2.927a2.25 2.25 0 0 1-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 0 0-.659-1.591L3.659 7.409A2.25 2.25 0 0 1 3 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0 1 12 3Z"}))})},57869:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>L});var s=a(37876),r=a(14232),l=a(89099),n=a(94246),i=a(41762),o=a(62125),c=a(28567),d=a(32764),x=a(78769),u=a(11659),m=a(31452),h=a(34572),g=a(41833),p=a(37596),f=a(29454),j=a(14534),b=a(54254),y=a(35765),v=a(96668),w=a(3244),N=a(55792),k=a(63393),A=a(46476),C=a(74550),S=a(47043),q=a(23946),z=a(93751),E=a(88462),P=a(610),_=a(83283),T=a(78620),D=a(49539),F=a(11629),$=a(99204),M=a(68560),R=a(98999),V=a(69673);let L=()=>{var e,t,a,L,O,B,U;let Q=(0,l.useRouter)(),{query:W,isReady:Z}=Q,{user:G,loading:I}=(0,n.A)(),[H,J]=(0,r.useState)(1),[X,K]=(0,r.useState)(""),[Y,ee]=(0,r.useState)("all"),[et,ea]=(0,r.useState)("all"),[es,er]=(0,r.useState)("all"),[el,en]=(0,r.useState)("list"),[ei,eo]=(0,r.useState)(!1),[ec,ed]=(0,r.useState)(null),[ex,eu]=(0,r.useState)(!1),[em,eh]=(0,r.useState)(null),[eg,ep]=(0,r.useState)(!1),[ef,ej]=(0,r.useState)(!1),[eb,ey]=(0,r.useState)(!1),[ev,ew]=(0,r.useState)(null),[eN,ek]=(0,r.useState)(!1),[eA,eC]=(0,r.useState)(null),[eS,eq]=(0,r.useState)(new Set),[ez,eE]=(0,r.useState)(!1),[eP,e_]=(0,r.useState)(null),[eT,eD]=(0,r.useState)(""),[eF,e$]=(0,r.useState)(!1),[eM,eR]=(0,r.useState)(!1),[eV,eL]=(0,r.useState)({type:"success",title:"",message:""}),[eO,eB]=(0,r.useState)(!1),[eU,eQ]=(0,r.useState)({title:"",message:"",onConfirm:null,type:"danger",confirmText:"Confirm",cancelText:"Cancel"}),eW=null==G?void 0:G.role,eZ=(0,h.FI)(eW),eG=(0,h.MS)(eW),eI=(0,r.useCallback)(e=>{let t={...W};Object.keys(e).forEach(a=>{null===e[a]||""===e[a]||void 0===e[a]||!1===e[a]?delete t[a]:t[a]=e[a]}),Q.replace({pathname:Q.pathname,query:t},void 0,{shallow:!0})},[Q,W]);(0,r.useEffect)(()=>{if(!Z)return;let{search:e,status:t,industry:a,client:s,viewMode:r,page:l}=W;e&&K(e),t&&ee(t),a&&ea(a),s&&er(s),r&&("list"===r||"grid"===r)&&en(r),l&&J(parseInt(l)),ej(!0)},[Z,W]),(0,r.useEffect)(()=>{if(!ef||!Z)return;let e=setTimeout(()=>{let e=W.search||"",t=W.status||"all",a=W.industry||"all",s=W.client||"all",r=W.viewMode||"list";(X!==e||Y!==t||et!==a||es!==s||el!==r)&&eI({search:X||null,status:"all"!==Y?Y:null,industry:"all"!==et?et:null,client:"all"!==es?es:null,viewMode:"list"!==el?el:null})},500*!!X);return()=>clearTimeout(e)},[X,Y,et,es,el,ef,Z,W,eI]),(0,r.useEffect)(()=>{ef&&Z&&H!==(W.page?parseInt(W.page):1)&&eI({page:H>1?H.toString():null})},[H,ef,Z,W.page,eI]),(0,r.useEffect)(()=>{ef&&J(1)},[X,Y,et,es]);let eH=(0,r.useCallback)(async e=>{let t=f.A.get("tkn"),a=await fetch(e,{headers:{Authorization:"Bearer ".concat(t),"Content-Type":"application/json"}});if(!a.ok)throw Error((await a.json()).error||"Failed to fetch data");return a.json()},[]),{data:eJ,error:eX,mutate:eK}=(0,p.Ay)("/api/quotations?".concat((()=>{let e=new URLSearchParams;return e.append("page",H.toString()),X&&e.append("search",X),"all"!==Y&&e.append("status",Y),"all"!==et&&e.append("industry",et),"all"!==es&&e.append("client",es),e.toString()})()),eH),{data:eY}=(0,p.Ay)("/api/clients",eH),{data:e0}=(0,p.Ay)("/api/leads",eH);(0,r.useEffect)(()=>{(async()=>{try{let e=f.A.get("tkn"),t=await fetch("/api/business/get",{headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"}});if(t.ok){let e=await t.json();eC(e.business||null)}}catch(e){console.error("Error fetching business data:",e)}})()},[]);let e2=async e=>{eu(!0),eh(null);try{let t=f.A.get("tkn"),a=ec?"/api/quotations/".concat(ec._id):"/api/quotations",s=ec?"PUT":"POST",r=await fetch(a,{method:s,headers:{Authorization:"Bearer ".concat(t),"Content-Type":"application/json"},body:JSON.stringify(e)}),l=await r.json();if(!r.ok)throw Error(l.error||"Failed to save quotation");await eK(),eo(!1),ed(null)}catch(e){console.error("Error saving quotation:",e),eh(e.message)}finally{eu(!1)}},e4=e=>{switch(e){case"draft":return{variant:"secondary",icon:j.A,label:"Draft"};case"sent":return{variant:"primary",icon:b.A,label:"Sent"};case"viewed":return{variant:"primary",icon:y.A,label:"Viewed"};case"accepted":return{variant:"success",icon:v.A,label:"Accepted"};case"rejected":return{variant:"danger",icon:w.A,label:"Rejected"};case"expired":return{variant:"secondary",icon:b.A,label:"Expired"};case"converted":return{variant:"success",icon:v.A,label:"Converted"};default:return{variant:"default",icon:N.A,label:e}}},e1=e=>{let t=e4(e).icon;return(0,s.jsx)(t,{className:"w-4 h-4"})},e5=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"\xa3";
1return"".concat(t).concat(parseFloat(e||0).toLocaleString("en-GB",{minimumFractionDigits:2,maximumFractionDigits:2}))},e3=e=>e?new Date(e).toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"}):"N/A",e6=e=>{var t,a,s,r;return(null==e||null==(t=e.clientRef)?void 0:t.companyName)?e.clientRef.companyName:(null==e||null==(a=e.clientRef)?void 0:a.contactPerson)?e.clientRef.contactPerson:(null==e||null==(s=e.client)?void 0:s.name)?e.client.name:(null==e||null==(r=e.client)?void 0:r.company)?e.client.company:"N/A"},e9=async e=>{if(e){ek(!0),eh(null);try{let t=f.A.get("tkn"),a=await fetch("/api/quotations/".concat(e._id),{headers:{Authorization:"Bearer ".concat(t),"Content-Type":"application/json"}});if(!a.ok)throw Error("Failed to fetch quotation data");let s=(await a.json()).quotation,r=await (0,$.A_)(s,eA);ew(r),e_(s),ey(!0)}catch(e){console.error("Error generating PDF:",e),eh("Failed to generate PDF preview")}finally{ek(!1)}}},e7=async()=>{if(0===eS.size)return void eh("Please select at least one quotation");eE(!0),eh(null);try{let e=f.A.get("tkn"),t=Array.from(eS).map(async t=>{let a=await fetch("/api/quotations/".concat(t),{headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"}});if(!a.ok)throw Error("Failed to fetch quotation ".concat(t));return(await a.json()).quotation}),a=await Promise.all(t);for(let e=0;e<a.length;e++){let t=a[e];try{let s=await (0,$.A_)(t,eA),r=t.quotationNumber||"N/A",l=e6(t).replace(/[^a-z0-9]/gi,"_")||"N/A",n="".concat(r,"_").concat(l,".pdf"),i=s.output("blob"),o=URL.createObjectURL(i),c=document.createElement("a");c.href=o,c.download=n,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(o),e<a.length-1&&await new Promise(e=>setTimeout(e,500))}catch(e){console.error("Error generating PDF for quotation ".concat(t.quotationNumber,":"),e)}}eL({type:"success",title:"PDFs Generated Successfully",message:"Successfully generated ".concat(a.length," PDF(s)!")}),eR(!0),eq(new Set)}catch(e){console.error("Error generating bulk PDFs:",e),eh("Failed to generate PDFs. Please try again.")}finally{eE(!1)}},e8=e=>{let t=new Set(eS);t.has(e)?t.delete(e):t.add(e),eq(t)},te=async()=>{if(0===eS.size)return void eh("Please select at least one quotation to delete");eu(!0),eh(null),eB(!1);try{let e=f.A.get("tkn"),t=Array.from(eS);for(let a of t)try{let t=await fetch("/api/quotations/".concat(a),{method:"DELETE",headers:{Authorization:"Bearer ".concat(e),"Content-Type":"application/json"}});if(!t.ok){let e=await t.json().catch(()=>({}));console.error("Failed to delete quotation",a,e)}}catch(e){console.error("Error deleting quotation",a,e)}await eK(),eq(new Set),eL({type:"success",title:"Quotations Deleted",message:"Successfully deleted ".concat(t.length," quotation(s).")}),eR(!0)}catch(e){console.error("Error during bulk quotation delete:",e),eh("Failed to delete selected quotations. Please try again.")}finally{eu(!1)}},tt=async e=>{if(0===eS.size)return void eh("Please select at least one quotation to update");if(!e)return void eh("Please select a status");e$(!0),eh(null),eB(!1);try{let t=f.A.get("tkn"),a=Array.from(eS),s=await fetch("/api/quotations/bulk",{method:"PATCH",headers:{Authorization:"Bearer ".concat(t),"Content-Type":"application/json"},body:JSON.stringify({quotationIds:a,status:e})}),r=await s.json();if(!s.ok)throw Error(r.error||"Failed to update quotation statuses");await eK(),eq(new Set),eD(""),eL({type:"success",title:"Status Updated",message:r.message||"Successfully updated ".concat(a.length,' quotation(s) to "').concat(e,'".')}),eR(!0)}catch(e){console.error("Error updating quotation statuses:",e),eh(e.message||"Failed to update quotation statuses. Please try again.")}finally{e$(!1)}};return I?(0,s.jsx)("div",{children:"Loading..."}):G?eZ?eX?(0,s.jsx)(i.A,{children:(0,s.jsxs)(x.F,{variant:"danger",children:[(0,s.jsx)(k.A,{className:"h-5 w-5"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"font-medium",children:"Error"}),(0,s.jsx)("p",{className:"text-sm",children:eX.message})]})]})}):(0,s.jsxs)(i.A,{children:[(0,s.jsxs)("div",{className:"space-y-6 mt-2 mb-2",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:justify-between sm:items-center",children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("h1",{className:"text-xl sm:text-2xl font-bold text-gray-900 dark:text-white truncate",children:"Quotations"}),(0,s.jsx)("p",{className:"text-sm sm:text-base text-gray-600 dark:text-gray-400 mt-1",children:"Manage your quotations and proposals"})]}),(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2 sm:gap-3",children:[eS.size>0&&(0,s.jsxs)(o.$,{variant:"outline",onClick:e7,loading:ez,className:"w-full sm:w-auto text-sm",size:"sm",children:[(0,s.jsx)(A.A,{className:"w-4 h-4 mr-2"}),(0,s.jsxs)("span",{className:"hidden sm:inline",children:["Generate PDFs (",eS.size,")"]}),(0,s.jsxs)("span",{className:"sm:hidden",children:["PDFs (",eS.size,")"]})]}),!1,eG&&(0,s.jsxs)(o.$,{onClick:()=>eo(!0),className:"w-full sm:w-auto text-sm",size:"sm",children:[(0,s.jsx)(C.A,{className:"w-4 h-4 mr-2"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:"Create Quotation"}),(0,s.jsx)("span",{className:"sm:hidden",children:"Create"})]})]})]}),eS.size>0&&(0,s.jsx)(c.Zp,{children:(0,s.jsx)(c.Wu,{className:"p-4",children:(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-3",children:[(0,s.jsx)("div",{className:"flex items-center gap-2",children:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:[eS.size," quotation",1!==eS.size?"s":""," selected"]})}),(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2 w-full sm:w-auto",children:[(0,s.jsx)(o.$,{variant:"outline",size:"sm",onClick:()=>{eq(new Set)},className:"text-sm",children:"Clear Selection"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)("select",{value:eT,onChange:e=>eD(e.target.value),className:"px-3 py-2 border border-gray-200 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white text-sm focus:ring-2 focus:ring-gray-900 dark:focus:ring-white focus:border-transparent min-w-[140px]",children:[(0,s.jsx)("option",{value:"",children:"Bulk Actions"}),(0,s.jsx)("option",{value:"draft",children:"Mark as Draft"}),(0,s.jsx)("option",{value:"sent",children:"Mark as Sent"}
1),(0,s.jsx)("option",{value:"viewed",children:"Mark as Viewed"}),(0,s.jsx)("option",{value:"accepted",children:"Mark as Accepted"}),(0,s.jsx)("option",{value:"rejected",children:"Mark as Rejected"}),(0,s.jsx)("option",{value:"expired",children:"Mark as Expired"}),(0,s.jsx)("option",{value:"converted",children:"Mark as Converted"})]}),eT&&(0,s.jsx)(o.$,{variant:"outline",size:"sm",onClick:()=>{eQ({title:'Update Status to "'.concat(eT,'"'),message:"This will update the status of ".concat(eS.size," quotation").concat(1!==eS.size?"s":"",' to "').concat(eT,'". Continue?'),onConfirm:()=>tt(eT),type:"info",confirmText:"Update",cancelText:"Cancel"}),eB(!0)},loading:eF,disabled:eF,className:"text-sm",children:"Apply"})]}),(0,s.jsxs)(o.$,{variant:"outline",size:"sm",onClick:e7,loading:ez,className:"text-sm",children:[(0,s.jsx)(A.A,{className:"w-4 h-4 mr-2"}),"Generate PDFs"]}),(0,s.jsx)(o.$,{variant:"outline",size:"sm",onClick:()=>{eQ({title:"Delete Selected Quotations",message:"This will delete ".concat(eS.size," quotation").concat(1!==eS.size?"s":"",". This action cannot be undone. Continue?"),onConfirm:te,type:"danger",confirmText:"Delete",cancelText:"Cancel"}),eB(!0)},loading:ex,disabled:ex,className:"text-sm text-red-600 border-red-200 hover:bg-red-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Delete Selected"})]})]})})}),(0,s.jsx)(c.Zp,{children:(0,s.jsxs)(c.Wu,{className:"p-4",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsx)("div",{className:"flex-1",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(S.A,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-5 w-5 text-gray-400"}),(0,s.jsx)(u.p,{placeholder:"Search quotations, clients, or project names...",value:X,onChange:e=>K(e.target.value),className:"pl-10"})]})}),(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2 items-stretch sm:items-center",children:[(0,s.jsxs)("select",{value:Y,onChange:e=>ee(e.target.value),className:"w-full sm:w-auto px-3 py-2.5 border border-gray-200 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-gray-900 dark:focus:ring-white focus:border-transparent min-w-[140px] text-sm",children:[(0,s.jsx)("option",{value:"all",children:"All Status"}),(0,s.jsx)("option",{value:"draft",children:"Draft"}),(0,s.jsx)("option",{value:"sent",children:"Sent"}),(0,s.jsx)("option",{value:"viewed",children:"Viewed"}),(0,s.jsx)("option",{value:"accepted",children:"Accepted"}),(0,s.jsx)("option",{value:"rejected",children:"Rejected"}),(0,s.jsx)("option",{value:"expired",children:"Expired"}),(0,s.jsx)("option",{value:"converted",children:"Converted"})]}),(0,s.jsxs)("select",{value:et,onChange:e=>ea(e.target.value),className:"w-full sm:w-auto px-3 py-2.5 border border-gray-200 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-gray-900 dark:focus:ring-white focus:border-transparent min-w-[140px] text-sm",children:[(0,s.jsx)("option",{value:"all",children:"All Industries"}),(0,s.jsx)("option",{value:"pr",children:"Public Relations"}),(0,s.jsx)("option",{value:"branding",children:"Branding & Design"}),(0,s.jsx)("option",{value:"media",children:"Media & Advertising"}),(0,s.jsx)("option",{value:"digital",children:"Digital Marketing"}),(0,s.jsx)("option",{value:"events",children:"Events & Experiential"}),(0,s.jsx)("option",{value:"consulting",children:"Consulting"}),(0,s.jsx)("option",{value:"other",children:"Other"})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)(o.$,{variant:"outline",onClick:()=>ep(!eg),className:"flex-1 sm:flex-none",size:"sm",children:[(0,s.jsx)(q.A,{className:"w-4 h-4 mr-2"}),(0,s.jsx)("span",{className:"hidden xs:inline",children:"Filters"}),(0,s.jsx)("span",{className:"xs:hidden",children:"Filter"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-1 bg-gray-100 dark:bg-gray-700 rounded-lg p-0.5",children:[(0,s.jsx)(o.$,{variant:"list"===el?"default":"ghost",size:"sm",onClick:()=>{en("list"),eI({viewMode:"list"})},className:"px-2 sm:px-3 py-1.5 sm:py-1.5 min-h-[36px]",title:"List View",children:(0,s.jsx)(z.A,{className:"h-4 w-4"})}),(0,s.jsx)(o.$,{variant:"grid"===el?"default":"ghost",size:"sm",onClick:()=>{en("grid"),eI({viewMode:"grid"})},className:"px-2 sm:px-3 py-1.5 sm:py-1.5 min-h-[36px]",title:"Grid View",children:(0,s.jsx)(E.A,{className:"h-4 w-4"})})]})]})]})]}),eg&&(0,s.jsx)("div",{className:"mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Client"}),(0,s.jsxs)("select",{value:es,onChange:e=>er(e.target.value),className:"w-full px-3 py-2 border border-gray-200 dark:border-gray-600 rounded-xl bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-gray-900 dark:focus:ring-white focus:border-transparent",children:[(0,s.jsx)("option",{value:"all",children:"All Clients"}),null==eY||null==(e=eY.clients)?void 0:e.map(e=>(0,s.jsx)("option",{value:e._id,children:e.name},e._id))]})]})})})]})}),(null==eJ||null==(t=eJ.quotations)?void 0:t.length)===0?(0,s.jsx)(c.Zp,{children:(0,s.jsxs)(c.Wu,{className:"p-8 text-center",children:[(0,s.jsx)(N.A,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),(0,s.jsx)("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"No quotations foun
1d"}),(0,s.jsx)("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:"Get started by creating your first quotation."}),eG&&(0,s.jsxs)(o.$,{onClick:()=>eo(!0),children:[(0,s.jsx)(C.A,{className:"w-4 h-4 mr-2"}),"Create Quotation"]})]})}):"list"===el?(0,s.jsx)(c.Zp,{children:(0,s.jsxs)(c.Wu,{className:"p-0",children:[(0,s.jsxs)("div",{className:"hidden sm:grid grid-cols-12 gap-4 px-4 py-3 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 text-xs font-semibold text-gray-600 dark:text-gray-400 uppercase tracking-wider",children:[(0,s.jsx)("div",{className:"col-span-1 flex items-center",children:(0,s.jsx)("input",{type:"checkbox",checked:eS.size===(null==eJ||null==(a=eJ.quotations)?void 0:a.length)&&(null==eJ||null==(L=eJ.quotations)?void 0:L.length)>0,onChange:()=>{var e,t;eS.size===(null==eJ||null==(e=eJ.quotations)?void 0:e.length)?eq(new Set):eq(new Set((null==eJ||null==(t=eJ.quotations)?void 0:t.map(e=>e._id))||[]))},className:"w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500"})}),(0,s.jsxs)("div",{className:"col-span-2 flex items-center gap-2",children:[(0,s.jsx)(N.A,{className:"w-4 h-4"}),"Quotation Number"]}),(0,s.jsxs)("div",{className:"col-span-2 flex items-center gap-2",children:[(0,s.jsx)(P.A,{className:"w-4 h-4"}),"Client"]}),(0,s.jsxs)("div",{className:"col-span-2 flex items-center gap-2",children:[(0,s.jsx)(_.A,{className:"w-4 h-4"}),"Total Value"]}),(0,s.jsxs)("div",{className:"col-span-2 flex items-center gap-2",children:[(0,s.jsx)(T.A,{className:"w-4 h-4"}),"Valid Until"]}),(0,s.jsx)("div",{className:"col-span-2 flex items-center gap-2",children:"Status"}),(0,s.jsx)("div",{className:"col-span-1 text-right",children:"Actions"})]}),(0,s.jsx)("div",{className:"hidden sm:block divide-y divide-gray-200 dark:divide-gray-700",children:null==eJ||null==(O=eJ.quotations)?void 0:O.map(e=>{let t=e4(e.status);return(0,s.jsxs)("div",{className:"grid grid-cols-12 gap-4 px-4 py-0 items-center hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",style:{minHeight:"50px",height:"50px"},children:[(0,s.jsx)("div",{className:"col-span-1 flex items-center",children:(0,s.jsx)("input",{type:"checkbox",checked:eS.has(e._id),onChange:()=>e8(e._id),className:"w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500"})}),(0,s.jsxs)("div",{className:"col-span-2 flex items-center gap-2 min-w-0",children:[(0,s.jsx)(N.A,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),(0,s.jsx)("button",{onClick:()=>Q.push("/dashboard/quotations/".concat(e._id)),className:"font-semibold text-gray-900 dark:text-white truncate text-sm hover:text-blue-600 dark:hover:text-blue-400 transition-colors text-left cursor-pointer",title:"View ".concat(e.quotationNumber),children:e.quotationNumber})]}),(0,s.jsxs)("div",{className:"col-span-2 flex items-center gap-2 min-w-0",children:[(0,s.jsx)(P.A,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),(0,s.jsx)("span",{className:"text-sm text-gray-700 dark:text-gray-300 truncate",children:e6(e)})]}),(0,s.jsxs)("div",{className:"col-span-2 flex items-center gap-2 min-w-0",children:[(0,s.jsx)(_.A,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),(0,s.jsx)("span",{className:"font-medium text-sm text-gray-900 dark:text-white truncate",children:e5(e.total,e.currency||"\xa3")})]}),(0,s.jsxs)("div",{className:"col-span-2 flex items-center gap-2 min-w-0",children:[(0,s.jsx)(T.A,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),(0,s.jsx)("span",{className:"text-sm text-gray-700 dark:text-gray-300 truncate",children:e3(e.validUntil)})]}),(0,s.jsx)("div",{className:"col-span-2 flex items-center gap-2 min-w-0",children:(0,s.jsxs)(d.E,{variant:t.variant,className:"flex items-center gap-1 text-xs",children:[e1(e.status),(0,s.jsx)("span",{className:"capitalize",children:t.label})]})}),(0,s.jsxs)("div",{className:"col-span-1 flex items-center justify-end gap-1",children:[(0,s.jsx)(o.$,{variant:"ghost",size:"sm",onClick:()=>e9(e),loading:eN,className:"h-8 w-8 p-0",title:"Preview PDF",children:(0,s.jsx)(A.A,{className:"w-4 h-4"})}),(0,s.jsx)(o.$,{variant:"ghost",size:"sm",onClick:()=>Q.push("/dashboard/quotations/".concat(e._id)),className:"h-8 w-8 p-0",title:"View",children:(0,s.jsx)(y.A,{className:"w-4 h-4"})}),eG&&(0,s.jsx)(o.$,{variant:"ghost",size:"sm",onClick:()=>{ed(e),eo(!0)},className:"h-8 w-8 p-0",title:"Edit",children:(0,s.jsx)(D.A,{className:"w-4 h-4"})})]})]},e._id)})}),(0,s.jsx)("div",{className:"sm:hidden divide-y divide-gray-200 dark:divide-gray-700",children:null==eJ||null==(B=eJ.quotations)?void 0:B.map(e=>{let t=e4(e.status);return(0,s.jsxs)("div",{className:"p-4 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[(0,s.jsx)("input",{type:"checkbox",checked:eS.has(e._id
1),onChange:()=>e8(e._id),className:"w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500 flex-shrink-0 mt-1"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("button",{onClick:()=>Q.push("/dashboard/quotations/".concat(e._id)),className:"flex items-center gap-2 mb-2 group w-full",children:[(0,s.jsx)(N.A,{className:"w-5 h-5 text-gray-400 flex-shrink-0"}),(0,s.jsx)("span",{className:"font-semibold text-base text-gray-900 dark:text-white group-hover:text-blue-600 dark:group-hover:text-blue-400 transition-colors truncate",children:e.quotationNumber})]}),(0,s.jsx)("p",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2 truncate",children:e.title}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(P.A,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),(0,s.jsx)("span",{className:"text-sm text-gray-700 dark:text-gray-300 truncate",children:e6(e)})]})]})]}),(0,s.jsxs)(d.E,{variant:t.variant,className:"flex items-center gap-1 flex-shrink-0 ml-2",children:[e1(e.status),(0,s.jsx)("span",{className:"capitalize text-xs",children:t.label})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3 mb-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(_.A,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Total Value"}),(0,s.jsx)("p",{className:"font-semibold text-sm text-gray-900 dark:text-white",children:e5(e.total,e.currency||"\xa3")})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(T.A,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Valid Until"}),(0,s.jsx)("p",{className:"font-medium text-sm text-gray-700 dark:text-gray-300",children:e3(e.validUntil)})]})]})]}),(0,s.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-3 border-t border-gray-200 dark:border-gray-700",children:[(0,s.jsx)(o.$,{variant:"outline",size:"sm",onClick:()=>e9(e),loading:eN,className:"px-3",title:"Preview PDF",children:(0,s.jsx)(A.A,{className:"w-4 h-4"})}),(0,s.jsxs)(o.$,{variant:"outline",size:"sm",onClick:()=>Q.push("/dashboard/quotations/".concat(e._id)),className:"flex-1",children:[(0,s.jsx)(y.A,{className:"w-4 h-4 mr-1"}),"View"]}
1),eG&&(0,s.jsx)(o.$,{variant:"outline",size:"sm",onClick:()=>{ed(e),eo(!0)},className:"px-3",children:(0,s.jsx)(D.A,{className:"w-4 h-4"})})]})]},e._id)})})]})}):(0,s.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:null==eJ||null==(U=eJ.quotations)?void 0:U.map(e=>{let t=e4(e.status);return(0,s.jsx)(c.Zp,{hover:!0,className:"flex flex-col",children:(0,s.jsxs)(c.Wu,{className:"p-4 flex flex-col flex-1",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[(0,s.jsx)("input",{type:"checkbox",checked:eS.has(e._id),onChange:()=>e8(e._id),className:"w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500 flex-shrink-0"}),(0,s.jsx)(N.A,{className:"w-5 h-5 text-gray-400 flex-shrink-0"}),(0,s.jsx)("button",{onClick:()=>Q.push("/dashboard/quotations/".concat(e._id)),className:"font-semibold text-gray-900 dark:text-white truncate text-sm hover:text-blue-600 dark:hover:text-blue-400 transition-colors text-left cursor-pointer",title:"View ".concat(e.quotationNumber),children:e.quotationNumber})]}),(0,s.jsxs)(d.E,{variant:t.variant,className:"flex items-center gap-1 flex-shrink-0",children:[e1(e.status),(0,s.jsx)("span",{className:"capitalize text-xs",children:t.label})]})]}),(0,s.jsx)("p",{className:"font-medium text-sm text-gray-900 dark:text-white mb-3 line-clamp-2",children:e.title}),(0,s.jsxs)("div",{className:"space-y-2 mb-4 flex-1",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(P.A,{className:"w-4 h-4 text-gray-400"}),(0,s.jsx)("span",{className:"text-sm text-gray-700 dark:text-gray-300 truncate",children:e6(e)})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(_.A,{className:"w-4 h-4 text-gray-400"}),(0,s.jsx)("span",{className:"font-semibold text-sm text-gray-900 dark:text-white",children:e5(e.total,e.currency||"\xa3")})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(T.A,{className:"w-4 h-4 text-gray-400"}),(0,s.jsxs)("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:["Valid: ",e3(e.validUntil)]})]})]}),(0,s.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-3 border-t border-gray-200 dark:border-gray-700",children:[(0,s.jsx)(o.$,{variant:"outline",size:"sm",onClick:()=>e9(e),loading:eN,className:"px-3",title:"Preview PDF",children:(0,s.jsx)(A.A,{className:"w-4 h-4"})}),(0,s.jsxs)(o.$,{variant:"outline",size:"sm",onClick:()=>Q.push("/dashboard/quotations/".concat(e._id)),className:"flex-1",children:[(0,s.jsx)(y.A,{className:"w-4 h-4 mr-1"}),"View"]}
1),eG&&(0,s.jsx)(o.$,{variant:"outline",size:"sm",onClick:()=>{ed(e),eo(!0)},children:(0,s.jsx)(D.A,{className:"w-4 h-4"})})]})]})},e._id)})}),(null==eJ?void 0:eJ.pagination)&&eJ.pagination.totalPages>1&&(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row sm:justify-between sm:items-center gap-3 sm:gap-4 pt-4 sm:pt-6 border-t border-gray-200 dark:border-gray-700",children:[(0,s.jsxs)("div",{className:"text-xs sm:text-sm text-gray-600 dark:text-gray-400 text-center sm:text-left",children:[(0,s.jsxs)("span",{className:"block sm:inline",children:["Page ",eJ.pagination.currentPage," of"," ",eJ.pagination.totalPages]}),(0,s.jsxs)("span",{className:"hidden sm:inline",children:[" ","(",eJ.pagination.total," total)"]}),(0,s.jsxs)("span",{className:"block sm:hidden text-xs",children:["(",eJ.pagination.total," quotations)"]})]}),(0,s.jsxs)("div",{className:"flex gap-2 justify-center sm:justify-end",children:[(0,s.jsx)(o.$,{variant:"outline",size:"sm",disabled:1===H,onClick:()=>{let e=H-1;J(e),eI({page:e>1?e.toString():null}),window.scrollTo({top:0,behavior:"smooth"})},className:"flex-1 sm:flex-none min-h-[40px] sm:min-h-0",children:"Previous"}),(0,s.jsx)(o.$,{variant:"outline",size:"sm",disabled:H===eJ.pagination.totalPages,onClick:()=>{let e=H+1;J(e),eI({page:e.toString()}),window.scrollTo({top:0,behavior:"smooth"})},className:"flex-1 sm:flex-none min-h-[40px] sm:min-h-0",children:"Next"})]})]})]}),ei&&(0,s.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",children:(0,s.jsxs)(c.Zp,{className:"w-full max-w-6xl max-h-[90vh] overflow-y-auto",children:[(0,s.jsx)(c.aR,{children:(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(c.ZB,{children:ec?"Edit Quotation":"Create New Quotation"}),(0,s.jsx)(o.$,{variant:"ghost",size:"sm",onClick:()=>{eo(!1),ed(null)},children:(0,s.jsx)(F.A,{className:"w-5 h-5"})})]})}),(0,s.jsx)(c.Wu,{children:(0,s.jsx)(g.A,{quotation:ec,onSubmit:e2,onCancel:()=>{eo(!1),ed(null)},isSubmitting:ex,error:em,clients:(null==eY?void 0:eY.clients)||[],leads:(null==e0?void 0:e0.leads)||[]})})]})}),(0,s.jsx)(M.A,{isOpen:eb,onClose:()=>{ey(!1),ew(null),e_(null)},pdfDoc:ev,title:eP?"Quotation ".concat(eP.quotationNumber):"PDF Preview",filename:eP?"Quotation_".concat(eP.quotationNumber,"_").concat(new Date().toISOString().split("T")[0],".pdf"):"quotation.pdf",onPrint:e=>{let t=window.open(e,"_blank");t&&(t.onload=()=>{t.print()})},onDownload:(e,t)=>{let a=document.createElement("a");a.href=e,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a)}}),(0,s.jsx)(R.A,{isOpen:eM,onClose:()=>eR(!1),type:eV.type,title:eV.title,message:eV.message}),(0,s.jsx)(V.A,{isOpen:eO,onClose:()=>{eB(!1)},onConfirm:()=>{eU.onConfirm&&eU.onConfirm()},title:eU.title,message:eU.message,type:eU.type,confirmText:eU.confirmText,cancelText:eU.cancelText,loading:ex})]}):(0,s.jsx)(i.A,{children:(0,s.jsx)("div",{className:"space-y-6 mt-2 mb-2",children:(0,s.jsx)(m.A,{title:"Access Denied",message:"You don't have permission to access the quotations section.",requiredRoles:"Admin, Manager, or Project Manager",redirectPath:"/dashboard",redirectText:"Back to Dashboard"})})}):(Q.push("/auth/login"),null)}},69673:(e,t,a)=>{"use strict";a.d(t,{A:()=>i});var s=a(37876);a(14232);var r=a(63393),l=a(986),n=a(62125);function i(e){let{isOpen:t,onClose:a,onConfirm:i,title:o,message:c,type:d="danger",confirmText:x="Confirm",cancelText:u="Cancel",loading:m=!1}=e;return t?(0,s.jsx)("div",{className:"fixed inset-0 bg-black/50 dark:bg-black/70 z-50 flex justify-center items-center backdrop-blur-sm p-4",onClick:a,children:(0,s.jsxs)("div",{className:"w-full max-w-md transform transition-all duration-300 scale-100 ".concat((()=>{switch(d){case"danger":return"bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800";case"warning":return"bg-yellow-50 dark:bg-yellow-900/20 border-yellow-200 dark:border-yellow-800";default:return"bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800"}})()," rounded-xl shadow-xl border overflow-hidden"),onClick:e=>e.stopPropagation(),children:[(0,s.jsx)("div",{className:"px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(()=>{switch(d){case"danger":return(0,s.jsx)(r.A,{className:"h-6 w-6 text-red-600 dark:text-red-400"});case"warning":return(0,s.jsx)(r.A,{className:"h-6 w-6 text-yellow-600 dark:text-yellow-400"});default:return(0,s.jsx)(l.A,{className:"h-6 w-6 text-blue-600 dar
1k:text-blue-400"})}})(),(0,s.jsx)("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:o||"Confirm Action"})]})}),(0,s.jsx)("div",{className:"px-6 py-4",children:(0,s.jsx)("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:c})}),(0,s.jsxs)("div",{className:"px-6 py-4 bg-gray-50 dark:bg-gray-800/50 flex justify-end gap-3",children:[(0,s.jsx)(n.$,{variant:"outline",onClick:a,disabled:m,size:"sm",children:u}),(0,s.jsx)(n.$,{variant:(()=>{switch(d){case"danger":return"danger";case"warning":return"warning";default:return"default"}})(),onClick:i,loading:m,size:"sm",children:x})]})]})}):null}},86419:(e,t,a)=>{"use strict";a.d(t,{A:()=>r});var s=a(14232);let r=s.forwardRef(function(e,t){let{title:a,titleId:r,...l}=e;return s.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":r},l),a?s.createElement("title",{id:r},a):null,s.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"}))})},98999:(e,t,a)=>{"use strict";a.d(t,{A:()=>o});var s=a(37876);a(14232);var r=a(96668),l=a(3244),n=a(63393),i=a(986);function o(e){let{isOpen:t,onClose:a,title:o,message:c,type:d="success"}=e;return t?(0,s.jsx)("div",{className:"fixed inset-0 bg-black/50 dark:bg-black/70 z-50 flex justify-center items-center backdrop-blur-sm",onClick:a,children:(0,s.jsxs)("div",{className:"w-[90%] max-w-md transform transition-all duration-300 scale-100 ".concat((()=>{switch(d){case"success":return"bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800";case"error":return"bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800";case"warning":return"bg-yellow-50 dark:bg-yellow-900/20 border-yellow-200 dark:border-yellow-800";default:return"bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800"}})()," rounded-xl shadow-xl border overflow-hidden"),onClick:e=>e.stopPropagation(),children:[(0,s.jsx)("div",{className:"px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(()=>{switch(d){case"success":return(0,s.jsx)(r.A,{className:"h-6 w-6 text-green-600 dark:text-green-400"});case"error":return(0,s.jsx)(l.A,{className:"h-6 w-6 text-red-600 dark:text-red-400"});case"warning":return(0,s.jsx)(n.A,{className:"h-6 w-6 text-yellow-600 dark:text-yellow-400"});default:return(0,s.jsx)(i.A,{className:"h-6 w-6 text-blue-600 dark:text-blue-400"})}})(),(0,s.jsx)("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:o||("success"===d?"Success":"error"===d?"Error":"warning"===d?"Warning":"Information")})]})}),(0,s.jsx)("div",{className:"px-6 py-4",children:(0,s.jsx)("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:c})}),(0,s.jsx)("div",{className:"px-6 py-4 bg-gray-50 dark:bg-gray-800/50 flex justify-end",children:(0,s.jsx)("button",{onClick:a,className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 ".concat((()=>{switch(d){case"success":return"bg-green-600 hover:bg-green-700 dark:bg-green-700 dark:hover:bg-green-800 focus:ring-green-500";case"error":return"bg-red-600 hover:bg-red-700 dark:bg-red-700 dark:hover:bg-red-800 focus:ring-red-500";case"warning":return"bg-yellow-600 hover:bg-yellow-700 dark:bg-yellow-700 dark:hover:bg-yellow-800 focus:ring-yellow-500";default:return"bg-blue-600 hover:bg-blue-700 dark:bg-blue-700 dark:hover:bg-blue-800 focus:ring-blue-500"}})()),children:"OK"})})]})}):null}}},e=>{e.O(0,[7725,347,2858,3,5885,1762,6167,720,1560,1833,636,6593,8792],()=>e(e.s=19621)),_N_E=e.O()}]);

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.