PageSourceSearch

https://www.propora.ai/assets/LocationResearchModules-DmRDowyv.js

js propora.ai collected 2026-10-05 14:31:31 UTC 13,083 bytes, 1 lines download raw bytes

1import{r as w,j as e,K as Y,aq as E,a2 as S,bq as M,bd as R,d5 as $,R as z,d as p,B as x,t as u,Y as b,a9 as f}from"./index-BzAldwSt.js";import{D as L,C as P,P as U}from"./react-beautiful-dnd.esm-CxbV2q_5.js";import{C as G}from"./CustomQuillEditor-BRNHP8zV.js";import{u as V}from"./BusinessSettings-DvvNsC6p.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";import"./FeatureLockWrapper-DfEPkIdL.js";import"./billingStore-C_SenOcV.js";import"./react-BY6lNfys.js";import"./index-Bk_Ga7x4.js";import"./BusinessProfileContext-CIae0Nxa.js";import"./PageHeader-DrXPJ5Ip.js";import"./InlineLoader-Dz1DSjy6.js";function pe({section:m}){const{locationModules:g,setLocationModules:j,assessmentSheetModules:y,setAssessmentSheetModules:v,assessmentReportLegalText:k,setAssessmentReportLegalText:_,resetLocationModulesToDefault:D,resetAssessmentSheetModulesToDefault:A,propertyChecklistItems:l,setPropertyChecklistItems:c,defaultAssessmentSheetModules:T}=V(),[h,N]=w.useState(m||"location");w.useEffect(()=>{m&&N(m)},[m]),w.useEffect(()=>{(async()=>{try{const s=localStorage.getItem("currentUserID")||0,t=await p.get(`${x}/api_new/admin/business/preferences/${s}`,{headers:u()});if(t.data.status==="success")try{_(t.data.data.assessment_report_legal_text||"");try{if(t.data.data.property_checklist_items){const a=JSON.parse(t.data.data.property_checklist_items);Array.isArray(a)&&c(a)}}catch{}if(t.data.data.location_research_modules!==null&&t.data.data.location_research_modules!==""){const a=JSON.parse(t.data.data.location_research_modules);if(Array.isArray(a)){const o=[...g],n=[];a.forEach(i=>{const d=o.find(C=>C.id===i.id);d&&n.push({...d,enabled:i.enabled})}),o.forEach(i=>{n.some(d=>d.id===i.id)||n.push(i)}),j(n)}}else D();if(t.data.data.assessment_sheet_modules!==null&&t.data.data.assessment_sheet_modules!==""){const a=JSON.parse(t.data.data.assessment_sheet_modules);if(Array.isArray(a)){const o=T,n=[];a.forEach(i=>{const d=o.find(C=>C.key===i.key);d&&n.push({...d,enabled:i.enabled})}),o.forEach(i=>{n.some(d=>d.key===i.key)||n.push(i)}),v(n)}}else A()}catch{}}catch{}})()},[]);const F=async()=>{try{const r=g.map(a=>({id:a.id,enabled:a.enabled})),s=JSON.stringify(r),t=localStorage.getItem("currentUserID")||0;await p.patch(`${x}/api_new/admin/business/preferences/${t}`,{location_research_modules:s},{headers:u()}),b("Module configuration saved successfully!")}catch{f("Error saving configuration. Please try again.")}},J=async()=>{try{const r=localStorage.getItem("currentUserID")||0;await p.patch(`${x}/api_new/admin/business/preferences/${r}`,{assessment_report_legal_text:k},{headers:u()}),b("Legal text saved successfully!")}catch{f("Error saving legal text. Please try again.")}},O=async()=>{try{const r=localStorage.getItem("currentUserID")||0;await p.patch(`${x}/api_new/admin/business/preferences/${r}`,{property_checklist_items:JSON.stringify(l)},{headers:u()}),b("Checklist saved successfully!")}catch{f("Error saving checklist. Please try again.")}},B=async()=>{try{const r=y.map(a=>({key:a.key,enabled:a.enabled})),s=JSON.stringify(r),t=localStorage.getItem("currentUserID")||0;await p.patch(`${x}/api_new/admin/business/preferences/${t}`,{assessment_sheet_modules:s},{headers:u()}),b("Module configuration saved successfully!")}catch{f("Error saving module configuration. Please try again.")}},q=r=>{if(!r.destination)return;const s=Array.from(g),[t]=s.splice(r.source.index,1);s.splice(r.destination.index,0,t),j(s)},H=r=>{const s=g.map(t=>t.id===r?{...t,enabled:!t.enabled}:t);j(s)},K=r=>{if(!r.destination)return;const s=Array.from(y),[t]=s.splice(r.source.index,1);s.splice(r.destination.index,0,t),v(s)},Q=r=>{const s=y.map(t=>t.key===r?{...t,enabled:!t.enabled}:t);v(s)};return e.jsxs("div",{className:"animate-fadeIn",children:[!m&&e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"flex items-center gap-4",children:e.jsxs("h2",{className:"text-2xl font-semibold flex items-center",children:[e.jsx(Y,{className:"mr-3 text-teal-500"}),"Client Report Configuration"]})}),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 ${h==="location"?"text-white border-b-2 border-teal-500":"text-gray-400 hover:text-white"}`,onClick:()=>N("location"),children:"Location Research"}),e.jsx("button",{className:`py-2 px-4 text-sm font-medium ${h==="assessment"?"text-white border-b-2 border-teal-500":"text-gray-400 hover:text-white"}`,onClick:()=>N("assessment"),children:"Assessment Sheet"})]})]}),h!=="location"&&e.jsxs("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:"Assessment Report Legal Text"}),e.jsx("p",{className:"text-sm text-gray-400 mb-4",children:"This text will appear in the client assessment report. Leave blank to omit."}),e.jsx("div",{className:"overflow-auto border border-gray-700 rounded-lg",children:e.jsx(G,{value:k,onChange:_,theme:"dark",style:{height:"160px"},placeholder:"Enter any legal disclaimers, disclosures, or notes to include in the client's assessment report..."})}),e.jsx("div",{className:"flex justify-end mt-4",children:e.jsx("button",{onClick:J,className:"btn-primary px-4 py-2 text-white rounded-lg",children:"Save Legal Text"})})]}),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:"Due Diligence Checklist"}),e.jsx("p",{className:"text-sm text-gray-400 mb-4",children:"Configure the categories and checklist items that appear in the client assessment sheet."}),e.jsxs("div",{className:"space-y-4",children:[l.map((r,s)=>e.jsxs("div",{className:"bg-gray-800 border border-gray-700 rounded-lg",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 border-b border-gray-700",children:[e.jsx("input",{type:"text",value:r.name||"",onChange:t=>{const a=[...l];a[s]={...a[s],name:t.target.value},c(a)},placeholder:"Category name",className:"flex-1 mr-3 px-3 py-2 bg-gray-900 border border-gray-700 rounded text-white focus:outline-none focus:ring-2 focus:ring-teal-500"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{className:"p-1.5 hover:bg-gray-700 rounded text-gray-400 hover:text-gray-200 transition-colors",onClick:()=>
1{if(s===0)return;const t=[...l],a=t[s-1];t[s-1]=t[s],t[s]=a,c(t)},"aria-label":"Move category up",children:e.jsx(E,{className:"text-xs"})}),e.jsx("button",{className:"p-1.5 hover:bg-gray-700 rounded text-gray-400 hover:text-gray-200 transition-colors",onClick:()=>{const t=[...l];if(s>=t.length-1)return;const a=t[s+1];t[s+1]=t[s],t[s]=a,c(t)},"aria-label":"Move category down",children:e.jsx(S,{className:"text-xs"})}),e.jsx("button",{className:"p-1.5 hover:bg-red-900/50 rounded text-gray-400 hover:text-red-400 transition-colors",onClick:()=>{const t=l.filter((a,o)=>o!==s);c(t)},"aria-label":"Delete category",children:e.jsx(M,{className:"text-xs"})})]})]}),e.jsxs("div",{className:"p-3 space-y-2",children:[(r.items||[]).map((t,a)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"text",value:t||"",onChange:o=>{const n=[...l],i=Array.isArray(n[s].items)?[...n[s].items]:[];i[a]=o.target.value,n[s]={...n[s],items:i},c(n)},placeholder:`Item ${a+1}`,className:"flex-1 px-3 py-2 bg-gray-900 border border-gray-700 rounded text-white focus:outline-none focus:ring-2 focus:ring-teal-500"}),e.jsx("button",{className:"p-1.5 hover:bg-gray-700 rounded text-gray-400 hover:text-gray-200 transition-colors",onClick:()=>{if(a===0)return;const o=[...l],n=[...o[s].items||[]],i=n[a-1];n[a-1]=n[a],n[a]=i,o[s]={...o[s],items:n},c(o)},"aria-label":"Move item up",children:e.jsx(E,{className:"text-xs"})}),e.jsx("button",{className:"p-1.5 hover:bg-gray-700 rounded text-gray-400 hover:text-gray-200 transition-colors",onClick:()=>{const o=[...l],n=[...o[s].items||[]];if(a>=n.length-1)return;const i=n[a+1];n[a+1]=n[a],n[a]=i,o[s]={...o[s],items:n},c(o)},"aria-label":"Move item down",children:e.jsx(S,{className:"text-xs"})}),e.jsx("button",{className:"p-1.5 hover:bg-red-900/50 rounded text-gray-400 hover:text-red-400 transition-colors",onClick:()=>{const o=[...l],n=(o[s].items||[]).filter((i,d)=>d!==a);o[s]={...o[s],items:n},c(o)},"aria-label":"Delete item",children:e.jsx(M,{className:"text-xs"})})]},a)),e.jsxs("button",{className:"mt-1 px-3 py-1.5 text-sm hover:bg-gray-700 rounded text-gray-400 hover:text-gray-200 inline-flex items-center gap-2 transition-colors",onClick:()=>{const t=[...l],a=Array.isArray(t[s].items)?[...t[s].items]:[];a.push(""),t[s]={...t[s],items:a},c(t)},children:[e.jsx(R,{className:"text-xs"})," ",e.jsx("span",{children:"Add Item"})]})]})]},s)),e.jsxs("button",{className:"px-3 py-2 text-sm hover:bg-gray-800 rounded text-gray-400 hover:text-gray-200 inline-flex items-center gap-2 transition-colors border border-dashed border-gray-700",onClick:()=>c([...l||[],{name:"New Category",items:[""]}]),children:[e.jsx(R,{className:"text-xs"})," ",e.jsx("span",{children:"Add Category"})]})]}),e.jsx("div",{className:"flex justify-end mt-4",children:e.jsx("button",{onClick:O,className:"btn-primary px-4 py-2 text-white rounded-lg",children:"Save Checklist"})})]})]}),e.jsxs("div",{className:"bg-gray-850 mt-8 rounded-lg shadow-md overflow-hidden border border-gray-700",children:[e.jsxs("div",{className:"p-4 bg-gray-800 border-b border-gray-700",children:[e.jsx("h3",{className:"text-lg font-semibold text-white",children:h==="location"?"Location Research Modules":"Assessment Sheet Modules"}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"Drag to reorder, toggle to show or hide sections in the client report."})]}),h==="location"?e.jsxs(e.Fragment,{children:[e.jsx(L,{onDragEnd:q,children:e.jsx(P,{droppableId:"location-modules",children:r=>e.jsxs("div",{...r.droppableProps,ref:r.innerRef,className:"divide-y divide-gray-700",children:[g.map((s,t)=>e.jsx(U,{draggableId:s.id,index:t,children:(a,o)=>e.jsx("div",{ref:a.innerRef,...a.draggableProps,className:`p-4 ${o.isDragging?"bg-gray-700":s.enabled?"bg-gray-800/50":"bg-gray-900/70"} transition-colors`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{...a.dragHandleProps,className:"cursor-move mr-3 text-gray-400 hover:text-gray-200",children:e.jsx($,{})}),e.jsxs("div",{className:"flex items-center",children:[s.icon&&z.createElement(s.icon,{className:"text-teal-400 mr-2"}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-white font-medium",children:s.name}),s.description&&e.jsx("p",{className:"text-xs text-gray-400",children:s.description})]})]})]}),e.jsx("button",{onClick:()=>H(s.id),className:`px-3 py-1 rounded-full text-sm font-medium transition-colors ${s.enabled?"bg-teal-600 hover:bg-teal-500 text-white":"bg-gray-700 hover:bg-gray-600 text-gray-300"}`,children:s.enabled?"Enabled":"Disabled"})]})})},s.id)),r.placeholder]})})}),e.jsxs("div",{className:"p-4 bg-gray-800 border-t border-gray-700 flex justify-between",children:[e.jsx("button",{onClick:D,className:"px-4 py-2 bg-gray-700 hover:bg-gray-600 rounded-lg text-white transition-colors",children:"Reset to Default"}),e.jsx("button",{onClick:F,className:"btn-primary px-4 py-2 text-white rounded-lg",children:"Save Configuration"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(L,{onDragEnd:K,children:e.jsx(P,{droppableId:"assessment-modules",children:r=>e.jsxs("div",{...r.droppableProps,ref:r.innerRef,className:"divide-y divide-gray-700",children:[y.map((s,t)=>e.jsx(U,{draggableId:s.key,index:t,children:(a,o)=>e.jsx("div",{ref:a.innerRef,...a.draggableProps,className:`p-4 ${o.isDragging?"bg-gray-700":s.enabled?"bg-gray-800/50":"bg-gray-900/70"} transition-colors`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{...a.dragHandleProps,className:"cursor-move mr-3 text-gray-400 hover:text-gray-200",children:e.jsx($,{})}),e.jsx("div",{children:e.jsx("h4",{className:"text-white font-medium",children:s.label})})]}),e.jsx("button",{onClick:()=>Q(s.key),className:`px-3 py-1 rounded-full text-sm font-medium transition-colors ${s.enabled?"bg-teal-600 hover:bg-teal-500 text-white":"bg-gray-700 hover:bg-gray-600 text-gray-300"}`,children:s.enabled?"Enabled":"Disabled"})]})})},s.key)),r.placeholder]})})}),e.jsxs("div",{className:"p-4 bg-gray-800 border-t border-gray-700 flex justify-between",children:[e.jsx("button",{onClick:A,className:"px-4 py-2 bg-gray-700 hover:bg-gray-600 rounded-lg text-white transition-colors",children:"Reset to Default"}),e.jsx("button",{onClick:B,className:"btn-primary px-4 py-2 text-white rounded-lg",children:"Save Configuration"})]})]})]})]})}export{pe 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.