PageSourceSearch

https://procontent.renewedvision.com/js/procontent/assets/SearchModal-D3qSIKlK.js

js renewedvision.com collected 2026-09-24 17:47:37 UTC 5,978 bytes, 1 lines download raw bytes

1import{r as i,c as C,j as r}from"./app-BeGqF6ux.js";import{M,b as P}from"./Tooltip-DYcxt1UG.js";import{S as E}from"./SearchInput-BpopGZxf.js";import"./index-Dkf2GVy1.js";import"./dayjs-BlgjZc9C.js";import{a as A,I as _,C as z,u as k,b as H}from"./browser-CUP66tSQ.js";import{p as T,a as L,c as O}from"./animation-DR5N1PjO.js";import"./button.styles-7lPNyjJO.js";import"./iconBase-CN8tsjra.js";import"./useTranslation-kJHeU9i8.js";import"./helpers-CgA5RTdO.js";import"./Input-CzZXrXpb.js";var f=function(){return f=Object.assign||function(e){for(var n,a=1,t=arguments.length;a<t;a++){n=arguments[a];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},f.apply(this,arguments)},I=function(e,n){var a={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(a[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,t=Object.getOwnPropertySymbols(e);s<t.length;s++)n.indexOf(t[s])<0&&Object.prototype.propertyIsEnumerable.call(e,t[s])&&(a[t[s]]=e[t[s]]);return a},w=L("MoonLoader","100% {transform: rotate(360deg)}","moon");function R(e){var n=e.loading,a=n===void 0?!0:n,t=e.color,s=t===void 0?"#000000":t,c=e.speedMultiplier,o=c===void 0?1:c,d=e.cssOverride,h=d===void 0?{}:d,j=e.size,u=j===void 0?60:j,b=I(e,["loading","color","speedMultiplier","cssOverride","size"]),y=T(u),m=y.value,x=y.unit,p=m/7,v=f({display:"inherit",position:"relative",width:"".concat("".concat(m+p*2).concat(x)),height:"".concat("".concat(m+p*2).concat(x)),animation:"".concat(w," ").concat(.6/o,"s 0s infinite linear"),animationFillMode:"forwards"},h),N=function(g){return{width:O(g),height:O(g),borderRadius:"100%"}},S=f(f({},N(p)),{backgroundColor:"".concat(s),opacity:"0.8",position:"absolute",top:"".concat("".concat(m/2-p/2).concat(x)),animation:"".concat(w," ").concat(.6/o,"s 0s infinite linear"),animationFillMode:"forwards"}),l=f(f({},N(m)),{border:"".concat(p,"px solid ").concat(s),opacity:"0.1",boxSizing:"content-box",position:"absolute"});return a?i.createElement("span",f({style:v},b),i.createElement("span",{style:S}),i.createElement("span",{style:l})):null}const B=({setResult:e,setSearching:n,currentOrgId:a})=>{const{results:t,status:s}=H();return i.useEffect(()=>{n(s==="loading")},[s,n]),i.useEffect(()=>{if(t?.hits&&Array.isArray(t.hits)){const c=t.hits.filter(o=>o.id!==a);e(o=>o.length===c.length&&o.every((d,h)=>d.id===c[h].id)?o:c)}else e([])},[t,e,a]),null},D=({searchInput:e,setSearchInput:n})=>{const{query:a,refine:t}=k(),s=i.useRef(null),c=i.useRef(!0);i.useEffect(()=>{c.current&&e&&(t(e),c.current=!1)},[]);const o=d=>{n(d),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{t(d)},1e3)};return i.useEffect(()=>{a!==e&&!s.current&&n(a)},[a,e,n]),i.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]),r.jsxs("form",{onSubmit:d=>{d.preventDefault(),t(e)},className:"relative",children:[r.jsx(E,{hideLabel:!0,placeholder:"Search Organizations...",value:e,onChange:o,caption:'Press "Enter" to search'}),r.jsx("button",{type:"submit",className:"sr-only",children:"Search"})]})};function Z({show:e,onClose:n,organizationId:a}){const{props:t}=C(),[s,c]=i.useState(""),[o,d]=i.useState([]),[h,j]=i.useState(!1),[u,b]=i.useState(null);i.useEffect(()=>{e||b(null)},[e]);const y=()=>{n(),b(null),d([]),c("")},{appId:m="",searchKey:x="",organizationIndexName:p=""}=t?.search||{},v=i.useMemo(()=>A(m,x),[m,x]),N=i.useMemo(()=>({...v,search:async l=>{if(l.every(({params:g})=>!g?.query))return Promise.resolve({results:l.map(()=>({hits:[],nbHits:0,nbPages:0,page:0,processingTimeMS:0,hitsPerPage:0,exhaustiveNbHits:!0,query:"",params:""}))});try{return await v.search(l)}catch(g){return console.error("Algolia search error:",g),Promise.resolve({results:l.map(()=>({hits:[],nbHits:0,nbPages:0,page:0,processingTimeMS:0,hitsPerPage:0,exhaustiveNbHits:!0,query:"",params:""}))})}}}),[v]),S=()=>{if(u?.id){const l=route("admin.organization.merge",{toOrganization:a,fromOrganization:u.id});window.location.href=l}};return r.jsxs(M,{open:e,onClose:y,size:"lg",header:{title:"Search Organizations"}
1,footer:{primaryAction:{label:"Continue",disabled:!u?.id,onClick:S},secondaryAction:{label:"Cancel",variant:"secondary",onClick:y}},children:[r.jsxs("p",{className:"py-4 text-subtitle-md",children:["Select the organization you'd like to merge into"," ",r.jsx("span",{className:"text-subtitle-md-bold",children:t.organization?.name})]}),r.jsx("div",{className:"flex flex-col gap-4",children:r.jsxs("div",{className:"flex flex-row gap-4",children:[r.jsx("div",{className:"flex-1 grow",children:r.jsxs(_,{searchClient:N,indexName:p,children:[r.jsx(z,{hitsPerPage:10}),r.jsx(D,{searchInput:s,setSearchInput:c}),r.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[h&&r.jsx(R,{size:16}),r.jsx("p",{className:"text-subtitle-sm",children:h?"Searching...":o.length>0?`${o.length} results found`:"No results found"})]}),r.jsx(B,{setResult:d,setSearching:j,currentOrgId:a}),o.length>0&&r.jsx("div",{className:"my-2 max-h-48 w-full overflow-y-scroll rounded-md border shadow-md",children:o.map(l=>r.jsxs("button",{type:"button",onClick:()=>b(l),className:"flex w-full items-center justify-between p-sm px-2 hover:bg-utility-stroke-tertiary",children:[r.jsxs("div",{className:"text-left",children:[r.jsx("p",{className:"text-paragraph-2",children:l.name}),r.jsx("p",{className:"text-subtitle-2 text-type-black-secondary",children:l.id})]}),u?.id===l.id&&r.jsx(P,{name:"HiMiniCheck",size:"xs"})]},l.id))})]})}),u&&r.jsxs("div",{className:"p mr-4 flex-1 grow rounded-md border border-utility-stroke-secondary bg-surface-base-+1 p-2",children:[r.jsx("p",{className:"text-paragraph-1-bold",children:u.name||"N/A"}),r.jsxs("p",{className:"text-subtitle-sm",children:["Org ID: ",u.id||"N/A"]}),r.jsxs("p",{className:"mt-2 text-subtitle-sm",children:["Owner Name: ",u.owner_name||"N/A"]}),r.jsxs("p",{className:"text-subtitle-sm",children:["Address: ",u.full_address||"N/A"]})]})]})})]})}export{Z 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.