PageSourceSearch

https://app.pooldial.com/static/js/4694.eba5fa43.chunk.js

js pooldial.com collected 2026-10-02 10:01:38 UTC 14,920 bytes, 2 lines download raw bytes

1"use strict";(globalThis.webpackChunkadmin_dashboard=globalThis.webpackChunkadmin_dashboard||[]).push([[4694],{16892(e,s,a){a.d(s,{A:()=>u});a(65043);var t=a(33023),n=a(81911),i=a(78776),l=a(91449),r=a(55895),o=a(85877),d=a(12097),c=a(80172),x=a(70579);const u=e=>{let{open:s,title:a,description:u,recipientCount:h,actionLabel:p,loading:m=!1,onCancel:b,onConfirm:A}=e;return(0,x.jsxs)(t.A,{open:s,onClose:m?void 0:b,maxWidth:"sm",fullWidth:!0,children:[(0,x.jsx)(n.A,{children:a}),(0,x.jsxs)(i.A,{children:[(0,x.jsxs)(l.A,{severity:"warning",sx:{mb:2},children:["This action will contact ",h," ",1===h?"customer":"customers","."]}),(0,x.jsx)(r.A,{variant:"body2",color:"text.secondary",children:u})]}),(0,x.jsxs)(o.A,{children:[(0,x.jsx)(d.A,{onClick:b,disabled:m,children:"Cancel"}),(0,x.jsx)(d.A,{variant:"contained",color:"primary",disableElevation:!0,onClick:A,disabled:m,children:m?(0,x.jsx)(c.A,{size:20}):p})]})]})}},74694(e,s,a){a.r(s),a.d(s,{default:()=>H});var t=a(65043),n=a(73216),i=a(53969),l=a(80172),r=a(12097),o=a(55895),d=a(91244),c=a(16128),x=a(10256),u=a(79067),h=a(67203),p=a(47471),m=a(24343),b=a(82485),A=a(83759),j=a(33023),f=a(81911),v=a(78776),g=a(94527),y=a(1725),C=a(38865),S=a(85877),w=a(58315),k=a(17171),T=a(22672),W=a(27496),I=a(49982),R=a(17347),z=a(97250),B=a(41704),F=a(69423),D=a(59994),N=a(37494),E=a(16892),P=a(16058),U=a(81765),V=a(64293),$=a(70579);const q=["active","inactive","lead"],L=["residential","commercial"],O=["current","overdue","suspended"],H=()=>{var e,s;const{id:a}=(0,n.g)(),H=(0,n.Zp)(),_=(0,n.zy)(),{user:M}=(0,B.A)(),{showToast:Y}=(0,F.d)(),Z="active"===(null===M||void 0===M||null===(e=M.account)||void 0===e?void 0:e.status),G=_.state,[J,K]=(0,t.useState)(""),[Q,X]=(0,t.useState)(""),[ee,se]=(0,t.useState)(""),[ae,te]=(0,t.useState)({status:["active"]}),[ne,ie]=(0,t.useState)(null),[le,re]=(0,t.useState)([]),[oe,de]=(0,t.useState)([]),[ce,xe]=(0,t.useState)(null),[ue,he]=(0,t.useState)(!1),[pe,me]=(0,t.useState)(!1),[be,Ae]=(0,t.useState)(!1),[je,fe]=(0,t.useState)(!1),[ve,ge]=(0,t.useState)(!1),[ye,Ce]=(0,t.useState)(!1),[Se,we]=(0,t.useState)(!1),[ke,Te]=(0,t.useState)("");(0,t.useEffect)(()=>{(async()=>{he(!0);try{const[e,s]=await Promise.all([D.A.getTemplates(),N.O.getRoutes()]);if(re(e),de(s.data),a){const e=await D.A.getBroadcast(a);ie(e),K(e.subject),X(e.body),se(e.templateId||""),te(e.filters||{status:["active"]})}else(null!==G&&void 0!==G&&G.prefillSubject||null!==G&&void 0!==G&&G.prefillBody)&&(G.prefillSubject&&K(G.prefillSubject),G.prefillBody&&X(G.prefillBody))}catch(e){Y("Failed to load data",{variant:"error"})}finally{he(!1)}})()},[a,Y,G]),(0,t.useEffect)(()=>{const e=setTimeout(async()=>{try{const{excludedCustomerIds:e,...s}=ae,a=await D.A.previewRecipients(s);xe(a)}catch(e){}},500);return()=>clearTimeout(e)},[ae]);const We=Math.max(0,((null===ce||void 0===ce?void 0:ce.totalCount)||0)-((null===(s=ae.excludedCustomerIds)||void 0===s?void 0:s.length)||0)),Ie=(e,s)=>{te(a=>({...a,[e]:s.length>0?s:void 0}))},Re=()=>J.trim()?!!(0,U.tf)(Q)||(Y("Email body is required",{variant:"error"}),!1):(Y("Subject is required",{variant:"error"}),!1),ze=async()=>{if(Re()){me(!0);try{const e={subject:J,body:Q,templateId:ee||void 0,filters:ae};if(a&&ne)await D.A.updateBroadcast(a,e),Y("Broadcast saved",{variant:"success"});else{const s=await D.A.createBroadcast(e);Y("Broadcast created",{variant:"success"}),H(`/broadcasts/compose/${s.id}`,{replace:!0})}}catch(e){Y(e.message||"Failed to save broadcast",{variant:"error"})}finally{me(!1)}}};return ue?(0,$.jsx)(i.A,{sx:{display:"flex",justifyContent:"center",py:8},children:(0,$.jsx)(l.A,{})}):(0,$.jsxs)(i.A,{sx:{display:"flex",flexDirection:"column",gap:1.25,flex:1},children:[(0,$.jsx)(i.A,{sx:{position:"relative",borderRadius:1,padding:{xs:3,md:4},backgroundColor:"#ffffff",border:"none",flexShrink:0},children:(0,$.jsxs)(i.A,{sx:{display:"flex",alignItems:"center",gap:2},children:[(0,$.jsx)(r.A,{startIcon:(0,$.jsx)(w.A,{}),onClick:()=>H("/broadcasts"),disableRipple:!0,sx:{textTransform:"none",transition:"none","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)"}},children:"Back"}),(0,$.jsxs)(i.A,{children:[(0,$.jsx)(o.A,{variant:"h4",component:"h1",sx:{fontWeight:700,fontSize:"1.5rem"},children:a?"Edit Broadcast":"New Broadcast"}),(0,$.jsx)(o.A,{variant:"body1",sx:{color:"rgba(44, 42, 41, 0.7)",fontSize:"0.875rem"},children:"Compose and send emails to your customers"})]})]})}),(0,$.jsxs)(i.A,{sx:{display:"grid",gridTemplateColumns:{xs:"minmax(0, 1fr)",md:"minmax(0, 2fr) minmax(0, 1fr)"},gap:1.25,flex:1,minHeight:0},children:[(0,$.jsxs)(i.A,{sx:{display:"flex",flexDirection:"column",gap:1.25,minWidth:0},children:[(0,$.jsx)(d.A,{sx:{borderRadius:1,boxShadow:"none"},children:(0,$.jsx)(c.A,{children:(0,$.jsxs)(x.A,{fullWidth:!0,size:"small",children:[(0,$.jsx)(u.A,{children:"Use Template (optional)"}),(0,$.jsxs)(h.A,{value:ee,label:"Use Template (optional)",onChange:e=>{const s=e.target.value;if(se(s),s){const e=le.find(e=>e.id===s);e&&(K(e.subject),X(e.body))}},disabled:be,children:[(0,$.jsx)(p.A,{value:"",children:(0,$.jsx)("em",{children:"None"})}),le.map(e=>(0,$.jsx)(p.A,{value:e.id,children:e.name},e.id))]})]})})}),(0,$.jsx)(d.A,{sx:{borderRadius:1,boxShadow:"none",flex:1,minWidth:0},children:(0,$.jsxs)(c.A,{children:[(0,$.jsx)(o.A,{variant:"subtitle2",sx:{mb:2},children:"Email Content"}),(0,$.jsx)(m.A,{fullWidth:!0,label:"Subject",value:J,onChange:e=>K(e.target.value),sx:{mb:2}}),(0,$.jsx)(P.A,{label:"Body",value:Q,onChange:X,onUploadingChange:Ae,disabled:pe||je,rows:12,placeholder:"Write your message, format your text, or paste a picture\u2026"}),(0,$.jsxs)(i.A,{sx:{mt:2,p:2.5,bgcolor:"#f8fafc",border:"1px solid #e2e8f0",borderRadius:2},children:[(0,$.jsxs)(i.A,{sx:{display:"flex",alignItems:"center",gap:1,mb:2},children:[(0,$.jsx)(R.A,{sx:{fontSize:20,color:"#016ec3"}}),(0,$.jsx)(o.A,{variant:"subtitle2",sx:{fontWeight:600,color:"#1e293b"},children:"Personalization Variables"})]}),(0,$.jsx)(i.A,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",lg:"1fr 1fr"},gap:1.5,fontSize:"0.875rem"},children:V.x.map(e=>{let{token:s,description:a}=e;return(0,$.jsxs)(i.A,{sx:{display:"flex",alignItems:"center",gap:1}
1,children:[(0,$.jsx)(i.A,{component:"code",sx:{px:1,py:.5,bgcolor:"white",border:"1px solid #cbd5e1",borderRadius:.75,fontSize:"0.8125rem",fontFamily:"monospace",color:"#016ec3",fontWeight:600,whiteSpace:"nowrap"},children:s}),(0,$.jsx)(o.A,{variant:"body2",sx:{color:"#64748b",fontSize:"0.8125rem"},children:a})]},s)})})]})]})})]}),(0,$.jsxs)(i.A,{sx:{display:"flex",flexDirection:"column",gap:1.25,minWidth:0},children:[(0,$.jsx)(d.A,{sx:{borderRadius:1,boxShadow:"none",flex:1,minWidth:0},children:(0,$.jsxs)(c.A,{children:[(0,$.jsxs)(i.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:2},children:[(0,$.jsx)(o.A,{variant:"subtitle2",children:"Recipients"}),ce&&(0,$.jsxs)(r.A,{size:"small",startIcon:(0,$.jsx)(I.A,{}),onClick:()=>ge(!0),disableRipple:!0,sx:{textTransform:"none",transition:"none","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)"}},children:[We," customer",1!==We?"s":""]})]}),(0,$.jsxs)(x.A,{fullWidth:!0,size:"small",sx:{mb:2},children:[(0,$.jsx)(u.A,{children:"Customer Status"}),(0,$.jsx)(h.A,{multiple:!0,value:ae.status||[],onChange:e=>Ie("status",e.target.value),input:(0,$.jsx)(b.A,{label:"Customer Status"}),renderValue:e=>(0,$.jsx)(i.A,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:e.map(e=>(0,$.jsx)(A.A,{label:e,size:"small"},e))}),children:q.map(e=>(0,$.jsx)(p.A,{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),(0,$.jsxs)(x.A,{fullWidth:!0,size:"small",sx:{mb:2},children:[(0,$.jsx)(u.A,{children:"Customer Type"}),(0,$.jsx)(h.A,{multiple:!0,value:ae.customerType||[],onChange:e=>Ie("customerType",e.target.value),input:(0,$.jsx)(b.A,{label:"Customer Type"}),renderValue:e=>(0,$.jsx)(i.A,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:e.map(e=>(0,$.jsx)(A.A,{label:e,size:"small"},e))}),children:L.map(e=>(0,$.jsx)(p.A,{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),(0,$.jsxs)(x.A,{fullWidth:!0,size:"small",sx:{mb:2},children:[(0,$.jsx)(u.A,{children:"Payment Status"}),(0,$.jsx)(h.A,{multiple:!0,value:ae.paymentStatus||[],onChange:e=>Ie("paymentStatus",e.target.value),input:(0,$.jsx)(b.A,{label:"Payment Status"}),renderValue:e=>(0,$.jsx)(i.A,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:e.map(e=>(0,$.jsx)(A.A,{label:e,size:"small"},e))}),children:O.map(e=>(0,$.jsx)(p.A,{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),(0,$.jsxs)(x.A,{fullWidth:!0,size:"small",children:[(0,$.jsx)(u.A,{children:"Routes"}),(0,$.jsx)(h.A,{multiple:!0,value:ae.routeIds||[],onChange:e=>Ie("routeIds",e.target.value),input:(0,$.jsx)(b.A,{label:"Routes"}),renderValue:e=>(0,$.jsx)(i.A,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:e.map(e=>{const s=oe.find(s=>s.id===e);return(0,$.jsx)(A.A,{label:(null===s||void 0===s?void 0:s.name)||e,size:"small"},e)})}),children:oe.map(e=>(0,$.jsx)(p.A,{value:e.id,children:e.defaultTechnician&&`${e.defaultTechnician.firstName||""} ${e.defaultTechnician.lastName||""}`.trim()||e.name},e.id))})]})]})}),(0,$.jsx)(d.A,{sx:{borderRadius:1,boxShadow:"none"},children:(0,$.jsxs)(c.A,{children:[(0,$.jsx)(o.A,{variant:"subtitle2",sx:{mb:2},children:"Actions"}),!Z&&(0,$.jsxs)(i.A,{sx:{display:"flex",alignItems:"center",gap:1.5,mb:2,p:1.5,backgroundColor:"#FFF8E1",border:"1px solid #FFE082",borderRadius:1},children:[(0,$.jsx)(z.A,{sx:{color:"#F9A825",fontSize:20}}),(0,$.jsxs)(i.A,{sx:{flex:1},children:[(0,$.jsx)(o.A,{variant:"caption",sx:{fontWeight:600,display:"block"},children:"Subscription required to send"}),(0,$.jsx)(r.A,{size:"small",onClick:()=>H("/settings/subscription"),disableRipple:!0,sx:{textTransform:"none",transition:"none",p:0,minWidth:0,fontSize:"0.75rem","&:hover":{backgroundColor:"transparent",textDecoration:"underline"}},children:"Start Subscription"})]})]}),(0,$.jsxs)(i.A,{sx:{display:"flex",flexDirection:"column",gap:1},children:[(0,$.jsx)(r.A,{variant:"outlined",startIcon:(0,$.jsx)(T.A,{}),onClick:ze,disabled:pe||be,fullWidth:!0,disableRipple:!0,sx:{textTransform:"none",transition:"none","&:hover":{backgroundColor:"rgba(1, 110, 195, 0.08)"}},children:pe?"Saving...":"Save Draft"}),a&&(0,$.jsx)(r.A,{variant:"outlined",startIcon:(0,$.jsx)(W.A,{}),onClick:()=>Ce(!0),disabled:!Z||be,fullWidth:!0,disableRipple:!0,sx:{textTransform:"none",transition:"none","&:hover":{backgroundColor:"rgba(1, 110, 195, 0.08)"}},children:"Schedule"}),(0,$.jsx)(r.A,{variant:"contained",startIcon:(0,$.jsx)(k.A,{}),onClick:async()=>{Re()&&(a?ce&&0!==We?we(!0):Y("No recipients match the selected filters",{variant:"error"}):await ze())},disabled:!Z||be||je||!ce||0===We,fullWidth:!0,disableRipple:!0,sx:{textTransform:"none",transition:"none",boxShadow:"none","&:hover":{boxShadow:"none"}},children:je?"Sending...":"Send Now"})]})]})})]})]}),(0,$.jsxs)(j.A,{open:ve,onClose:()=>ge(!1),maxWidth:"sm",fullWidth:!0,children:[(0,$.jsx)(f.A,{children:"Recipients Preview"}),(0,$.jsx)(v.A,{children:ce&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(i.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:[(0,$.jsxs)(o.A,{variant:"body2",color:"text.secondary",children:[We," of ",ce.totalCount," customer",1!==ce.totalCount?"s":""," selected",ce.totalCount>100&&" (showing first 100)"]}),(0,$.jsxs)(i.A,{sx:{display:"flex",gap:1},children:[(0,$.jsx)(r.A,{size:"small",onClick:()=>{te(e=>({...e,excludedCustomerIds:void 0}))},disableRipple:!0,sx:{textTransform:"none",fontSize:"0.8125rem",transition:"none","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)"}},children:"Select All"}),(0,$.jsx)(r.A,{size:"small",onClick:()=>{ce&&te(e=>({...e,excludedCustomerIds:ce.recipients.map(e=>e.id)}))},disableRipple:!0,sx:{textTransform:"none",fontSize:"0.8125rem",transition:"none","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)"}},children:"Deselect All"})]})]}),(0,$.jsx)(g.A,{sx:{mb:1}}),(0,$.jsx)(i.A,{sx:{maxHeight:400,overflowY:"auto"},children:ce.recipients.map(e=>{var s;const a=null===(s=ae.excludedCustomerIds)||void 0===s?void 0:s.includes(e.id);return(0,$.jsx)(y.A,{control:(0,$.jsx)(C.A,{checked:!a,onChange:()=>{return s=e.id,void te(e=>{const a=e.excludedCustomerIds||[],t=a.includes(s);return{...e,excludedCustomerIds:t?a.filter(e=>e!==s):[...a,s]}});var s},disableRipple:!0,sx:{"&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)"}}}),label:(0,$.jsxs)(i.A,{children:[(0,$.jsxs)(o.A,{variant:"body2",children:[e.firstName," ",e.lastName,e.companyName&&` (${e.companyName})`]}),(0,$.jsx)(o.A,{variant:"caption",color:"text.secondary",children:e.email})]}),sx:{width:"100%",py:1,borderBottom:"1px solid",borderColor:"divider",margin:0,"&:hover":{backgroundColor:"rgba(0, 0, 0, 0.02)"}}},e.id)})})]})}),(0,$.jsx)(S.A,{children:(0,$.jsx)(r.A,{onClick:()=>ge(!1),disableRipple:!0,sx:{textTransform:"none",transition:"none",color:"rgba(44, 42, 41, 0.84)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)"}},children:"Close"})})]}),(0,$.jsxs)(j.A,{open:ye,onClose:()=>Ce(!1),children:[(0,$.jsx)(f.A,{children:"Schedule Broadcast"}),(0,$.jsxs)(v.A,{children:[(0,$.jsxs)(o.A,{variant:"body2",color:"text.secondary",sx:{mb:2},children:["Choose when to send this broadcast to"," ",We," customer",1!==We?"s":"",". Selecting Schedule confirms the future delivery."]}),(0,$.jsx)(m.A,{label:"Send At",type:"datetime-local",value:ke,onChange:e=>Te(e.target.value),inputProps:{min:(new Date).toISOString().slice(0,16)},InputLabelProps:{shrink:!0},fullWidth:!0})]}),(0,$.jsxs)(S.A,{children:[(0,$.jsx)(r.A,{onClick:()=>Ce(!1),disableRipple:!0,sx:{textTransform:"none",transition:"none",color:"rgba(44, 42, 41, 0.84)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)"}},children:"Cancel"}),(0,$.jsx)(r.A,{onClick:async()=>
1{if(a&&ke&&Re())try{await D.A.updateBroadcast(a,{subject:J,body:Q,templateId:ee||void 0,filters:ae}),await D.A.scheduleBroadcast(a,new Date(ke).toISOString()),Y("Broadcast scheduled",{variant:"success"}),Ce(!1),H("/broadcasts")}catch(e){Y(e.message||"Failed to schedule broadcast",{variant:"error"})}},variant:"contained",disabled:!ke,disableRipple:!0,sx:{textTransform:"none",transition:"none",boxShadow:"none","&:hover":{boxShadow:"none"}},children:"Schedule"})]})]}),(0,$.jsx)(E.A,{open:Se,title:"Send this broadcast now?",description:`Pool Dial will send \u201c${J}\u201d to every selected recipient. Review the subject, content, and recipient list before continuing.`,recipientCount:We,actionLabel:"Send Broadcast",loading:je,onCancel:()=>we(!1),onConfirm:()=>{(async()=>{if(a){fe(!0);try{await D.A.updateBroadcast(a,{subject:J,body:Q,templateId:ee||void 0,filters:ae}),await D.A.sendBroadcast(a),Y("Broadcast sent successfully",{variant:"success"}),H("/broadcasts")}catch(e){Y(e.message||"Failed to send broadcast",{variant:"error"})}finally{fe(!1),we(!1)}}})()}})]})}}}]);
2//# sourceMappingURL=4694.eba5fa43.chunk.js.map

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.