PageSourceSearch

https://www.propora.ai/assets/PreferencesTab-ByGoZLs_.js

js propora.ai collected 2026-10-05 14:31:29 UTC 32,738 bytes, 1 lines download raw bytes

1import{r as c,B as i,t as d,d as o,j as e,cL as lt,fq as ct,bJ as ye,Y as w,a9 as u,bU as it,aj as je,bq as we}from"./index-BzAldwSt.js";import{D as dt,C as ot,P as ht}from"./react-beautiful-dnd.esm-CxbV2q_5.js";import{C as mt}from"./CustomQuillEditor-BRNHP8zV.js";import"./inheritsLoose-Dh9mjS0Z.js";import"./defineProperty-DbXIQDXj.js";import"./typeof-QjJsDpFa.js";import"./tiny-invariant-CopsF_GD.js";import"./quill.snow-FxEw-Ia8.js";import"./isEqual-DzSeg6ii.js";import"./editorImageUpload-DQ0rSbGc.js";function kt({section:F,isLoading:l,showWelcomePopup:T,setShowWelcomePopup:G,welcomeVideoUrl:Y,setWelcomeVideoUrl:Ne,welcomeMessage:K,setWelcomeMessage:ve,requireCMAcceptance:ke,setRequireCMAcceptance:Q,requireCMPropertyApproval:_e,setRequireCMPropertyApproval:X,requireBriefApproval:Ce,setRequireBriefApproval:Z,autoBriefMatchEnabled:Ie,setAutoBriefMatchEnabled:P,clientSelfApprove:De,setClientSelfApprove:L,clientSelfAddOffer:$e,setClientSelfAddOffer:V,pipelineStageHoursToPerform:y,setPipelineStageHoursToPerform:Ee,communicationNotificationSettings:m,setCommunicationNotificationSettings:H,ddStages:x,setDdStages:E,ddStageHoursToPerform:h,setDdStageHoursToPerform:N,addFirstDdStageOnShortlist:U,setAddFirstDdStageOnShortlist:Ue,requireComparableSoldDetails:J,setRequireComparableSoldDetails:Ae,defaultDdStages:xt,ddStagesInitializedRef:ee,ddStagesSaveTimeoutRef:v,addFirstDdStageOnShortlistInitializedRef:te,addFirstDdStageOnShortlistSaveTimeoutRef:k,requireComparableSoldDetailsInitializedRef:se,requireComparableSoldDetailsSaveTimeoutRef:_}){const[j,C]=c.useState("welcome"),[re,ae]=c.useState(!1),[ne,le]=c.useState(!1),[ce,ie]=c.useState(!1),[de,oe]=c.useState(""),[I,O]=c.useState(null),[he,A]=c.useState(""),[B,Me]=c.useState([]),[Fe,me]=c.useState(!1),[xe,pe]=c.useState(""),[W,ue]=c.useState(""),[Je,q]=c.useState(!1),[g,R]=c.useState(null),[D,M]=c.useState("");c.useEffect(()=>{S()},[]);const S=async()=>{me(!0),pe("");try{const t=await fetch(`${i}/api_new/admin/tags`,{headers:d()});if(!t.ok){const r=await t.text();throw new Error(`Error: ${t.status} ${t.statusText}`)}const s=await t.json();if(s.success&&s.data)Me(s.data);else throw new Error(s.message||"Failed to fetch tags data")}catch(t){pe(t.message||"An unexpected error occurred while fetching tags.")}me(!1)},Oe=async()=>{if(!W.trim()){u("Please enter a tag name");return}try{const t=await fetch(`${i}/api_new/admin/tags`,{method:"POST",headers:d(!1),body:JSON.stringify({name:W.trim(),description:""})});if(!t.ok){const r=await t.text();throw new Error(`Error: ${t.status} ${t.statusText}`)}const s=await t.json();if(s.success)w("Tag added successfully"),ue(""),S();else throw new Error(s.message||"Failed to add tag")}catch(t){u(t.message||"An unexpected error occurred while adding the tag.")}},Be=(t,s)=>{R({id:t,name:s}),M(""),q(!0)},We=async()=>{if(g)try{const t=D?{tag_id_to_merge:parseInt(D)}:{},s=await fetch(`${i}/api_new/admin/tags/${g.id}`,{method:"DELETE",headers:d(!1),body:JSON.stringify(t)});if(!s.ok){const a=await s.text();throw new Error(`Error: ${s.status} ${s.statusText}`)}const r=await s.json();if(r.success)r.data.merged?w(`Tag "${g.name}" removed and ${r.data.mergedContactsCount} contacts merged successfully`):w("Tag removed successfully"),S(),q(!1),R(null),M("");else throw new Error(r.message||"Failed to remove tag")}catch(t){u(t.message||"An unexpected error occurred while removing the tag.")}},qe=()=>{q(!1),R(null),M("")},Re=async t=>{try{G(t);const s=localStorage.getItem("currentUserID")||0;await o.patch(`${i}/api_new/admin/business/preferences/${s}`,{show_welcome_popup:t},{headers:d()})}catch{G(!t)}},Se=async t=>{try{Ne(t);const s=localStorage.getItem("currentUserID")||0;await o.patch(`${i}/api_new/admin/business/preferences/${s}`,{welcome_video_url:t},{headers:d()})}catch{}},ze=async t=>{try{ve(t);const s=localStorage.getItem("currentUserID")||0;await o.patch(`${i}/api_new/admin/business/preferences/${s}`,{welcome_message:t},{headers:d()})}catch{}},Te=async t=>{try{Q(t);const s=localStorage.getItem("currentUserID")||0;await o.patch(`${i}/api_new/admin/business/preferences/${s}`,{require_cm_acceptance:t},{headers:d()})}catch{Q(!t)}},Ge=async t=>{try{X(t);const s=localStorage.getItem("currentUserID")||0;await o.patch(`${i}/api_new/admin/business/preferences/${s}`,{require_cm_property_approval:t},{headers:d()})}catch{X(!t)}},Ye=async t=>{try{Z(t);const s=localStorage.getItem("currentUserID")||0;await o.patch(`${i}/api_new/admin/business/preferences/${s}`,{require_brief_approval:t},{headers:d()})}catch{Z(!t)}},Ke=async t=>{try{P(t);const s=localStorage.getItem("currentUserID")||0;await o.patch(`${i}/api_new/admin/business/preferences/${s}`,{auto_brief_match_enabled:t},{headers:d()})}catch{P(!t)}},Qe=async t=>{try{L(t);const s=localStorage.getItem("currentUserID")||0;await o.patch(`${i}/api_new/admin/business/preferences/${s}`,{client_self_approve:t},{headers:d()})}catch{L(!t)}},Xe=async t=>{try{V(t);const s=localStorage.getItem("currentUserID")||0;await o.patch(`${i}/api_new/admin/business/preferences/${s}`,{client_self_add_offer:t},{headers:d()})}catch{V(!t)}},Ze=[{key:"channels",label:"Channels"},{key:"smart_conversations",label:"Smart Conversations"},{key:"prospect_inquiries",label:"Prospect Inquiries"},{key:"purchases",label:"Purchases"},{key:"direct_messages",label:"Direct Messages"}],ge=async(t,s,r,a)=>{var f;const n=m,p={...m||{},[t]:{...(m==null?void 0:m[t])||{},[s]:{...((f=m==null?void 0:m[t])==null?void 0:f[s])||{},[r]:a}}};try{H(p);const b=localStorage.getItem("currentUserID")||0;await o.patch(`${i}/api_new/admin/business/preferences/${b}`,{communication_notification_settings:JSON.stringify(p)},{headers:d()})}catch{H(n),u("Failed to save communication notification setting")}},fe=[{code:4,label:"Engaged"},{code:5,label:"Booked"},{code:91,label:"CM Acceptance"},{code:6,label:"Searching"},{code:7,label:"Decision"},{code:8,label:"DD Pending"},{code:9,label:"Offer Made"},{code:10,label:"Exchanged"},{code:13,label:"Building & Pest"},{code:11,label:"Unconditional"}],Pe=(t,s)=>{const a=(s===""?"":String(s)).replace(/^0+(?=\d)/,""),n=a===""?0:parseInt(a,10);if(!Number.isInteger(n)||n<0||n>240){u("Hours to perform must be an integer between 0 and 240");return}Ee(p=>({...p||{},[String(t)]:n}))},Le=async()=>{try{const t=localStorage.getItem("currentUserID")||0;ie(!0);const s={};fe.forEach(({code:r})=>{const a=y==null?void 0:y[String(r)],n=Number.isFinite(Number(a))?parseInt(a,10):0;s[String(r)]=Math.min(240,Math.max(0,n))}),await o.patch(`${i}/api_new/admin/business/preferences/${t}`,{pipeline_stage_hours_to_perform:JSON.stringify(s)},{headers:d()}),w("Pipeline stage hours saved successfully")}catch{u("Failed to save pipeline stage hours")}finally{ie(!1)}},z=(t,s)=>{const r=s&&typeof s=="object"?s:{},a={};
1return(t||[]).forEach(n=>{const p=String(n||""),f=r[p],b=Number.isFinite(Number(f))?parseInt(f,10):0,nt=Math.min(240,Math.max(0,b));a[p]=nt}),a},Ve=t=>{if(!t.destination)return;const s=Array.from(x),[r]=s.splice(t.source.index,1);s.splice(t.destination.index,0,r),E(s)},He=()=>{const t=de.trim();if(!t){u("Please enter a stage name");return}E(s=>[...s,t]),N(s=>({...s,[t]:0})),oe("")},et=t=>{O(t),A(x[t]||"")},be=()=>{O(null),A("")},tt=()=>{const t=he.trim();if(!t){u("Stage name cannot be empty");return}const s=x[I]||"";E(r=>r.map((a,n)=>n===I?t:a)),N(r=>{const a={...r||{}},n=Number.isFinite(Number(a[s]))?parseInt(a[s],10):0;return delete a[s],a[t]=n,a}),O(null),A("")},st=t=>{const s=x[t];E(r=>r.filter((a,n)=>n!==t)),N(r=>{const a={...r||{}};return delete a[s],a}),I===t&&be()},rt=(t,s)=>{const a=(s===""?"":String(s)).replace(/^0+(?=\d)/,""),n=a===""?0:parseInt(a,10);if(!Number.isInteger(n)||n<0||n>240){u("Hours to perform must be an integer between 0 and 240");return}N(p=>({...p||{},[t]:n}))},at=async()=>{try{const t=localStorage.getItem("currentUserID")||0;le(!0),await o.patch(`${i}/api_new/admin/business/preferences/${t}`,{dd_stages:JSON.stringify(x),dd_stage_hours_to_perform:JSON.stringify(z(x,h)),add_first_dd_stage_on_shortlist:U},{headers:d()}),w("DD stages saved successfully")}catch{u("Failed to save DD stages")}finally{le(!1)}};c.useEffect(()=>{if(!l){if(!ee.current){ee.current=!0;return}return v.current&&clearTimeout(v.current),v.current=setTimeout(async()=>{try{const t=localStorage.getItem("currentUserID")||0;await o.patch(`${i}/api_new/admin/business/preferences/${t}`,{dd_stages:JSON.stringify(x),dd_stage_hours_to_perform:JSON.stringify(z(x,h))},{headers:d()})}catch{}},600),()=>{v.current&&clearTimeout(v.current)}}},[x,h,l]),c.useEffect(()=>{if(l)return;const t=z(x,h),s=JSON.stringify(h||{}),r=JSON.stringify(t);s!==r&&N(t)},[x,h,l]),c.useEffect(()=>{if(!l){if(!te.current){te.current=!0;return}return k.current&&clearTimeout(k.current),k.current=setTimeout(async()=>{try{const t=localStorage.getItem("currentUserID")||0;await o.patch(`${i}/api_new/admin/business/preferences/${t}`,{add_first_dd_stage_on_shortlist:U},{headers:d()})}catch{}},600),()=>{k.current&&clearTimeout(k.current)}}},[U,l]),c.useEffect(()=>{if(!l){if(!se.current){se.current=!0;return}return _.current&&clearTimeout(_.current),_.current=setTimeout(async()=>{try{const t=localStorage.getItem("currentUserID")||0;await o.patch(`${i}/api_new/admin/business/preferences/${t}`,{require_comparable_sold_details:J},{headers:d()})}catch{}},600),()=>{_.current&&clearTimeout(_.current)}}},[J,l]);const $=F||j;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"animate-fadeIn",children:[!F&&e.jsxs(e.Fragment,{children:[e.jsxs("h2",{className:"text-2xl font-semibold mb-6 flex items-center",children:[e.jsx(lt,{className:"mr-3 text-teal-500"}),"User Preferences"]}),e.jsxs("div",{className:"mt-6 flex border-b border-gray-700",children:[e.jsx("button",{className:`py-2 px-4 text-sm font-medium ${j==="welcome"?"text-white border-b-2 border-teal-500":"text-gray-400 hover:text-white"}`,onClick:()=>C("welcome"),children:"Welcome"}),e.jsx("button",{className:`py-2 px-4 text-sm font-medium ${j==="communications"?"text-white border-b-2 border-teal-500":"text-gray-400 hover:text-white"}`,onClick:()=>C("communications"),children:"Communications"}),e.jsx("button",{className:`py-2 px-4 text-sm font-medium ${j==="dd-stages"?"text-white border-b-2 border-teal-500":"text-gray-400 hover:text-white"}`,onClick:()=>C("dd-stages"),children:"DD Stages"}),e.jsx("button",{className:`py-2 px-4 text-sm font-medium ${j==="tags"?"text-white border-b-2 border-teal-500":"text-gray-400 hover:text-white"}`,onClick:()=>C("tags"),children:"Tags"}),e.jsx("button",{className:`py-2 px-4 text-sm font-medium ${j==="pipeline"?"text-white border-b-2 border-teal-500":"text-gray-400 hover:text-white"}`,onClick:()=>C("pipeline"),children:"Pipeline"})]})]}),e.jsxs("div",{className:F?"":"mt-8",children:[$==="welcome"&&e.jsxs("div",{className:"bg-gray-850 p-6 rounded-lg border border-gray-700 shadow-md",children:[e.jsx("h3",{className:"text-lg font-semibold text-white mb-1",children:"Client Welcome Message"}),e.jsx("p",{className:"text-sm text-gray-400 mb-4",children:"Configure the welcome popup shown to new clients on first login."}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-medium",children:"Display Welcome Popup to New Client"}),e.jsx("p",{className:"text-sm text-gray-400",children:'Popup will show until the client clicks "Do not show this message again".'})]}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",checked:T,onChange:t=>Re(t.target.checked),disabled:l}),e.jsx("div",{className:"w-11 h-6 bg-gray-700 rounded-full peer peer-checked:bg-gradient-to-r from-teal-600 to-blue-700 peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all"})]})]})}),!!T&&e.jsxs("div",{children:[e.jsxs("div",{className:"mt-6 space-y-6 border-t border-gray-700 pt-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"block text-sm font-medium text-white",children:[e.jsx(ct,{className:"inline mr-2 text-teal-400"}),"Welcome Video URL (YouTube)"]}),e.jsx("input",{type:"url",value:Y,onChange:t=>Se(t.target.value),placeholder:"https://www.youtube.com/watch?v=...",className:"w-full px-4 py-2 bg-gray-700 border border-gray-600 rounded-lg text-white placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-teal-500 focus:border-transparent"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Enter a YouTube URL to embed a welcome video in the popup"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"block text-sm font-medium text-white",children:[e.jsx(ye,{className:"inline mr-2 text-teal-400"}),"Welcome Message"]}),e.jsx("div",{className:"bg-gray-700 rounded-lg border border-gray-600 h-[250px]",children:e.jsx(mt,{value:K,onChange:ze,placeholder:"Enter your welcome message for new clients...",theme:"dark",style:{height:"177px"},modules:{toolbar:[[{header:[1,2,3,!1]}],["bold","italic","underline"],[{list:"ordered"},{list:"bullet"}],["link"],["clean"]]}})}),e.jsx("p",{className:"text-xs text-gray-400",children:"Create a personalized welcome message that will be shown to new clients"})]})]}),e.jsx("div",{className:"mt-6",children:e.jsx("button",{onClick:async()=>{try{const t=localStorage.getItem("currentUserID")||0;ae(!0),await o.patch(`${i}/api_new/admin/business/preferences/${t}`,{welcome_video_url:Y,welcome_message:K},{headers:d()}),w("Welcome settings saved successfully")}catch{u("Failed to save welcome settings")}finally{ae(!1)}},className:"btn-primary px-4 py-2 text-white rounded-lg",disabled:re,children:re?"Saving...":"Save Welcome Settings"})})]})]}),$==="communications"&&e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"bg-gray-850 p-6 rounded-lg border border-gray-700 shadow-md",children:[e.jsx("h3",{className:"text-lg font-semibold text-white mb-1",children:"Communication Notifications"}),e.jsx("p",{className:"text-sm text-gray-400 mb-4",children:"Configure default email and SMS notifications for new messages by channel type."}),e.jsx("div",{className:"space-y-5",children:Ze.map(({key:t,label:s})=>e.jsxs("div",{className:"rounded-lg border border-gray-700 bg-gray-800/40 p-4",children:[e.jsx("h4",{className:"text-white font-semibold mb-4",children:s}),e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:["client","staff"].map(r=>{var a,n,p,f;return e.jsxs("div",{className:"rounded-lg border border-gray-700/80 bg-gray-900/30 p-4",children:[e.jsx("p",{className:"text-sm font-semibold text-gray-200 capitalize mb-3",children:r}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center gap-4",children:[e.jsx("div",{children:e.jsxs("p",{className:"text-white font-medium",children:[r==="client"?"Client":"Staff"," receives an email notification of a new message in this type of channel"]})}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer shrink-0",children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",checked:!!((n=(a=m==null?void 0:m[t])==null?void 0:a[r])!=null&&n.email),onChange:b=>ge(t,r,"email",b.target.checked),disabled:l}),e.jsx("div",{className:"w-11 h-6 bg-gray-700 rounded-full peer peer-checked:bg-gradient-to-r from-teal-600 to-blue-700 peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all"})]})]}),e.jsxs("div",{className:"flex justify-between items-center gap-4",children:[e.jsx("div",{children:e.jsxs("p",{className:"text-white font-medium",children:[r==="client"?"Client":"Staff"," receives an SMS notification of a new message in this type of channel"]})}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer shrink-0",children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",checked:!!((f=(p=m==null?void 0:m[t])==null?void 0:p[r])!=null&&f.sms),onChange:b=>ge(t,r,"sms",b.target.checked),disabled:l}),e.jsx("div",{className:"w-11 h-6 bg-gray-700 rounded-full peer peer-checked:bg-gradient-to-r from-teal-600 to-blue-700 peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all"})]})]})]})]},`${t}-${r}`)})})]},t))})]})}),$==="dd-stages"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-gray-850 p-6 rounded-lg border border-gray-700 shadow-md mb-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-white mb-1",children:"Preferences"}),e.jsx("p",{className:"text-sm text-gray-400 mb-4",children:"Business-wide preferences for the Due Diligence workflow."}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-medium",children:"Require sold price & date on comparables"}),e.jsx("p",{className:"text-sm text-gray-400",children:"When on, staff must enter a sold price and sold date before saving a comparable property."})]}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",checked:J,onChange:t=>Ae(t.target.checked),disabled:l}),e.jsx("div",{className:"w-11 h-6 bg-gray-700 rounded-full peer peer-checked:bg-gradient-to-r from-teal-600 to-blue-700 peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all"})]})]})]}),e.jsxs("div",{className:"bg-gray-850 p-6 rounded-lg border border-gray-700 shadow-md",children:[e.jsx("h3",{className:"text-lg font-semibold text-white mb-1",children:"Property DD Stages"}),e.jsx("p",{className:"text-sm text-gray-400 mb-4",children:"Configure the ordered Due Diligence stage list used across your business."}),e.jsx("div",{className:"mb-6",children:e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-medium",children:"Auto add first DD stage on shortlist"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Automatically sets the first DD stage on a property when it is shortlisted."})]}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",checked:U,onChange:t=>Ue(t.target.checked),disabled:l}),e.jsx("div",{className:"w-11 h-6 bg-gray-700 rounded-full peer peer-checked:bg-gradient-to-r from-teal-600 to-blue-700 peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all"})]})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",placeholder:"Add new stage",value:de,onChange:t=>oe(t.target.value),className:"flex-1 px-3 py-2 bg-gray-700 border border-gray-600 rounded-lg text-white placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-teal-500 focus:border-transparent"}),e.jsx("button",{onClick:He,className:"btn-primary px-3 py-2 text-white rounded-lg",children:"Add"})]}),e.jsx(dt,{onDragEnd:Ve,children:e.jsx(ot,{droppableId:"dd-stages",children:t=>e.jsxs("div",{ref:t.innerRef,...t.droppableProps,className:"space-y-2",children:[x.map((s,r)=>e.jsx(ht,{draggableId:`dd-stage-${r}`,index:r,children:a=>e.jsxs("div",{ref:a.innerRef,...a.draggableProps,className:"flex items-center justify-between bg-gray-700 text-white px-4 py-3 rounded-lg border border-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("div",{...a.dragHandleProps,className:"p-2 bg-gray-600 rounded-lg cursor-grab active:cursor-grabbing",title:"Drag to reorder",children:e.jsx(it,{className:"text-white text-sm"})}),e.jsxs("div",{className:"text-gray-400 text-sm w-6",children:[r+1,"."]}),e.jsx("div",{className:"flex-1 min-w-0",children:I===r?e.jsx("input",{type:"text",value:he,onCh
1ange:n=>A(n.target.value),className:"w-full px-3 py-2 bg-gray-800 border border-gray-600 rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-teal-500 focus:border-transparent"}):e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-medium truncate",children:s}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[e.jsx("label",{className:"text-xs text-gray-400",children:"Hours to perform"}),e.jsx("input",{type:"number",min:0,max:240,step:1,value:(h==null?void 0:h[s])??0,onChange:n=>rt(s,n.target.value),onFocus:n=>{((h==null?void 0:h[s])??0)===0&&n.target.select()},className:"w-24 px-2 py-1 bg-gray-800 border border-gray-600 rounded text-white text-sm focus:outline-none focus:ring-2 focus:ring-teal-500 focus:border-transparent"}),((h==null?void 0:h[s])??0)===0&&e.jsx("span",{className:"text-xs text-gray-400",children:"No Limit Applied"})]})]})})]}),e.jsx("div",{className:"flex items-center gap-2 ml-3",children:I===r?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:tt,className:"text-teal-300 hover:text-teal-200 hover:bg-teal-900/20 p-2 rounded transition-colors",title:"Save",children:e.jsx(je,{className:"text-sm"})}),e.jsx("button",{onClick:be,className:"text-gray-300 hover:text-white hover:bg-gray-800 p-2 rounded transition-colors",title:"Cancel",children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>et(r),className:"text-gray-300 hover:text-white hover:bg-gray-800 p-2 rounded transition-colors",title:"Edit",children:e.jsx(ye,{className:"text-sm"})}),e.jsx("button",{onClick:()=>st(r),className:"text-red-400 hover:text-red-300 hover:bg-red-900/20 p-2 rounded transition-colors",title:"Remove",children:e.jsx(we,{className:"text-sm"})})]})})]})},`dd-stage-${r}`)),t.placeholder]})})}),e.jsx("div",{children:e.jsx("button",{onClick:at,className:"btn-primary px-4 py-2 text-white rounded-lg",disabled:ne,children:ne?"Saving...":"Save DD Stages"})})]})]})]}),$==="tags"&&e.jsxs("div",{className:"bg-gray-850 p-6 rounded-lg border border-gray-700 shadow-md",children:[e.jsx("h3",{className:"text-lg font-semibold text-white mb-1",children:"Contact Tags"}),e.jsx("p",{className:"text-sm text-gray-400 mb-4",children:"Manage tags used to categorise and filter your contacts."}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("input",{type:"text",placeholder:"Add new tag",value:W,onChange:t=>ue(t.target.value),className:"flex-1 px-3 py-2 bg-gray-700 border border-gray-600 rounded-lg text-white placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-teal-500 focus:border-transparent"}),e.jsx("button",{onClick:Oe,className:"btn-primary px-3 py-2 text-white rounded-lg",children:"Add Tag"})]}),Fe?e.jsx("p",{className:"text-sm text-gray-400 text-center py-4",children:"Loading tags..."}):xe?e.jsxs("p",{className:"text-sm text-red-400",children:["Error fetching tags: ",xe]}):B.length===0?e.jsx("p",{className:"text-sm text-gray-400 text-center py-6",children:"No tags yet. Add one above."}):e.jsx("div",{className:"space-y-2",children:B.map(t=>e.jsxs("div",{className:"flex items-center justify-between bg-gray-700 text-white px-4 py-3 rounded-lg border border-gray-600",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-medium",children:t.name}),t.description&&e.jsx("p",{className:"text-sm text-gray-400",children:t.description})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-xs text-gray-400 bg-gray-600 px-2 py-1 rounded",children:[t.contact_count," contact",t.contact_count!==1?"s":""]}),e.jsx("button",{onClick:()=>Be(t.id,t.name),className:"text-gray-400 hover:text-red-400 hover:bg-red-900/30 p-2 rounded transition-colors",title:`Remove ${t.name} tag`,children:e.jsx(we,{className:"text-sm"})})]})]},t.id))})]})]}),$==="pipeline"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-gray-850 p-6 rounded-lg border border-gray-700 shadow-md",children:[e.jsx("h3",{className:"text-lg font-semibold text-white mb-1",children:"Client Pipeline Settings"}),e.jsx("p",{className:"text-sm text-gray-400 mb-4",children:"Configure client pipeline behaviour and approval requirements."}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-medium",children:"Require Client Manager to Accept Client"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Client manager must approve new clients"})]}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",checked:ke,onChange:t=>Te(t.target.checked),disabled:l}),e.jsx("div",{className:"w-11 h-6 bg-gray-700 rounded-full peer peer-checked:bg-gradient-to-r from-teal-600 to-blue-700 peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all"})]})]}),e.jsxs("div",{className:"flex justify-between items-center mt-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-medium",children:"Require Client Manager to Approve Property"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Client manager must approve a property before the client is notified of assignment"})]}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",checked:_e,onChange:t=>Ge(t.target.checked),disabled:l}),e.jsx("div",{className:"w-11 h-6 bg-gray-700 rounded-full peer peer-checked:bg-gradient-to-r from-teal-600 to-blue-700 peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all"})]})]}),e.jsxs("div",{className:"flex justify-between items-center mt-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-medium",children:"Require Brief Approval By Manager"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Manager must approve brief before a client manager can be assigned to a client."})]}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",checked:Ce,onChange:t=>Ye(t.target.checked),disabled:l}),e.jsx("div",{className:"w-11 h-6 bg-gray-700 rounded-full peer peer-checked:bg-gradient-to-r from-teal-600 to-blue-700 peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all"})]})]}),e.jsxs("div",{className:"flex justify-between items-center mt-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-medium",children:"Automatic Brief Matching"}),e.jsx("p",{className:"text-sm text-gray-400",children:"When on, an assigned property is automatically checked against the client's approved brief and a notification is scheduled on a match. Manual Brief Met overrides are unaffected."})]}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",checked:Ie,onCh
1ange:t=>Ke(t.target.checked),disabled:l}),e.jsx("div",{className:"w-11 h-6 bg-gray-700 rounded-full peer peer-checked:bg-gradient-to-r from-teal-600 to-blue-700 peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all"})]})]}),e.jsxs("div",{className:"flex justify-between items-center mt-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-medium",children:"Client can self Approve/Reject properties"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Allow clients to approve or reject assigned properties"})]}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",checked:De,onChange:t=>Qe(t.target.checked),disabled:l}),e.jsx("div",{className:"w-11 h-6 bg-gray-700 rounded-full peer peer-checked:bg-gradient-to-r from-teal-600 to-blue-700 peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all"})]})]}),e.jsxs("div",{className:"flex justify-between items-center mt-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-medium",children:"Client can self Add an Offer on their assigned properties"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Allow clients to add offers on properties they have been assigned"})]}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",checked:$e,onChange:t=>Xe(t.target.checked),disabled:l}),e.jsx("div",{className:"w-11 h-6 bg-gray-700 rounded-full peer peer-checked:bg-gradient-to-r from-teal-600 to-blue-700 peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:rounded-full after:h-5 after:w-5 after:transition-all"})]})]})]})]}),e.jsxs("div",{className:"bg-gray-850 p-6 rounded-lg border border-gray-700 shadow-md mt-6",children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Pipeline Stage Hours to Perform"}),e.jsxs("button",{onClick:Le,disabled:ce,className:"btn-primary px-4 py-2 text-sm text-white rounded-lg flex items-center gap-2 disabled:opacity-50",children:[e.jsx(je,{className:"text-xs"}),ce?"Saving...":"Save"]})]}),e.jsx("p",{className:"text-sm text-gray-400 mb-4",children:"Set how many hours each pipeline stage should take. Transactions exceeding this limit will be flagged as overdue."}),e.jsx("div",{className:"space-y-3",children:fe.map(({code:t,label:s})=>e.jsxs("div",{className:"flex items-center justify-between bg-gray-700 px-4 py-3 rounded-lg border border-gray-600",children:[e.jsx("span",{className:"text-white font-medium",children:s}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"number",min:"0",max:"240",placeholder:"0",value:(y==null?void 0:y[String(t)])||"",onChange:r=>Pe(t,r.target.value),className:"w-20 px-2 py-1.5 bg-gray-800 border border-gray-600 rounded text-white text-sm text-center focus:outline-none focus:ring-2 focus:ring-teal-500 focus:border-transparent"}),e.jsx("span",{className:"text-xs text-gray-400",children:"hrs"})]})]},t))}),e.jsx("p",{className:"text-xs text-gray-500 mt-3",children:"Set to 0 to disable the overdue check for that stage."})]})]})]})]}),Je&&e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-gray-800 rounded-lg p-6 w-full max-w-md mx-4",children:[e.jsxs("h3",{className:"text-lg font-semibold text-white mb-4",children:['Remove Tag: "',g==null?void 0:g.name,'"']}),e.jsx("p",{className:"text-gray-300 mb-4",children:"Are you sure you want to remove this tag? This action cannot be undone."}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-300 mb-2",children:"Optional: Merge c
1ontacts to another tag before removal"}),e.jsxs("select",{value:D,onChange:t=>M(t.target.value),className:"w-full px-3 py-2 bg-gray-700 border border-gray-600 rounded-md text-white focus:outline-none focus:ring-2 focus:ring-teal-500",children:[e.jsx("option",{value:"",children:"No merge - just remove tag"}),B.filter(t=>t.id!==(g==null?void 0:g.id)).map(t=>e.jsxs("option",{value:t.id,children:[t.name," (",t.contact_count," contacts)"]},t.id))]}),D&&e.jsx("p",{className:"text-sm text-teal-400 mt-2",children:"Contacts will be moved to the selected tag before removal."})]}),e.jsxs("div",{className:"flex justify-end space-x-3",children:[e.jsx("button",{onClick:qe,className:"px-4 py-2 text-gray-300 bg-gray-700 rounded-md hover:bg-gray-600 transition-colors",children:"Cancel"}),e.jsx("button",{onClick:We,className:"px-4 py-2 text-white bg-red-600 rounded-md hover:bg-red-700 transition-colors",children:D?"Merge & Remove":"Remove Tag"})]})]})})]})}export{kt 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.