PageSourceSearch

https://prosurfingtools.com/assets/organisation-profile-CPJzmklJ.js

js prosurfingtools.com collected 2026-10-02 01:40:38 UTC 6,605 bytes, 1 lines download raw bytes

1import{u as G,j as e,a as $,f as ee,r as l,h as A,R as b,b as d,L as D,x as ae,n as p,K as se,N as ne,Q as te,B as ie,F as n,U as re,V as v,E as le}from"./index-DKr66--M.js";import{u as oe,I as ce,R as de}from"./use-image-upload-D4NW5seQ.js";import{uploadBytesResumable as me,getDownloadURL as ue}from"./index.esm-DoTe_umu.js";import{O as pe}from"./organisation-page-shell-CLYs31MB.js";import{O as ge}from"./organisation-card-Ca56sEb-.js";import{C as xe}from"./customer-portal-BXoOYupD.js";import{B as C}from"./Button-bkW_oL3h.js";import"./with-email-verification-Bxiu_3A2.js";import"./index.esm-DYJTQ7me.js";import"./index.esm-Bx7IgcZT.js";const he=({firebase:c,orgId:i,isOwner:m})=>{const{t:s}=G(),T=$(),w=ee(),[t,y]=l.useState(null),[o,z]=l.useState(null),[_,F]=l.useState(!0),[g,O]=l.useState(!1),[S,u]=l.useState(null),[x,P]=l.useState(""),[h,I]=l.useState(""),[j,L]=l.useState(""),[f,k]=l.useState(""),[R,U]=l.useState(!1),{src:B,file:E,crop:M,setSrc:W,handleChangeImage:q,onImageLoaded:H,onCropComplete:K,onCropChange:Q}=oe();l.useEffect(()=>{c.cloud("getOrganizationInfo")({orgId:i}).then(a=>{const r=a.data;y(r),P(r.name||""),I(r.description||""),L(r.website||""),k(r.contactEmail||""),F(!1)}),c.cloud("getOrgMembers")({orgId:i}).then(a=>{z((a.data||[]).find(r=>r.isOwner)||null)})},[c,i]);const V=async a=>{a.preventDefault(),O(!0),u(null);try{await c.cloud("updateOrganizationInfo")({orgId:i,name:x,description:h,website:j,contactEmail:f,imageUrl:t.imageUrl||""}),w(p(v,i))}catch(r){u(r.message),O(!1)}},J=async()=>{U(!0),u(null);try{const a=await c.uploadImage(i,"org-logos"),r=me(a,E,{contentType:"image/jpeg"});await new Promise((N,Z)=>{r.on("state_changed",null,Z,N)});const X=await ue(a),Y=await c.cloud("updateOrganizationInfo")({orgId:i,name:x,description:h,website:j,contactEmail:f,imageUrl:X});y(N=>({...N,...Y.data})),W(null)}catch(a){u(a.message)}finally{U(!1)}};return _?e.jsx("div",{className:"text-center py-5",children:e.jsx(A,{animation:"border"})}):t?e.jsxs(b,{className:"g-4",children:[e.jsxs(d,{xs:12,md:3,children:[e.jsx(ge,{organization:t,children:e.jsxs("div",{className:"d-flex gap-2",children:[e.jsxs(D,{to:p(v,i),className:"btn btn-outline-secondary profile-action-btn",children:[e.jsx(ae,{})," ",s("organisation.dashboard")]}),e.jsx(D,{to:p(le,i),className:"btn btn-outline-secondary profile-action-btn",children:s("organisation.publicProfile")})]})}),m&&e.jsxs("div",{className:"training-block-wrap surfer-stripe-wrap",children:[e.jsxs("div",{className:"surfer-section-header",children:[e.jsx(se,{className:"training-card-icon"}),e.jsx("span",{className:"training-card-title",children:s("surfer.subscription")}),e.jsx(ne,{...T,className:"ms-auto"})]}),e.jsx("div",{className:"team-panel-body text-center",children:e.jsx(xe,{})})]})]}),e.jsx(d,{xs:12,md:6,children:m?e.jsxs("div",{className:"training-block-wrap",children:[e.jsxs("div",{className:"team-panel-header team-list-header",children:[e.jsxs("div",{className:"d-flex align-items-center gap-2",children:[e.jsx(te,{className:"team-panel-icon"}),e.jsx("span",{className:"team-panel-title",children:s("organisation.editProfile")})]}),(t.updated||t.createdAt)&&e.jsxs("span",{className:"surfer-updated-text",children:[s("surfer.updated")," ",ie(t.updated||t.createdAt).fromNow()]})]}),e.jsx("div",{className:"team-panel-body",children:e.jsxs(n,{onSubmit:V,children:[e.jsxs(n.Group,{className:"form-element",controlId:"orgProfileName",children:[e.jsx(n.Label,{children:s("organisationNew.name")}
1),e.jsx(n.Control,{required:!0,value:x,onChange:a=>P(a.target.value)})]}),e.jsxs(n.Group,{className:"form-element",controlId:"orgProfileDescription",children:[e.jsx(n.Label,{children:s("organisationNew.description")}),e.jsx(n.Control,{as:"textarea",rows:3,value:h,onChange:a=>I(a.target.value)})]}),e.jsxs(n.Group,{className:"form-element",controlId:"orgProfileWebsite",children:[e.jsx(n.Label,{children:s("organisationNew.website")}),e.jsx(n.Control,{type:"url",value:j,onChange:a=>L(a.target.value)})]}),e.jsxs(n.Group,{className:"form-element",controlId:"orgProfileContactEmail",children:[e.jsx(n.Label,{children:s("organisationNew.contactEmail")}),e.jsx(n.Control,{type:"email",value:f,onChange:a=>k(a.target.value)})]}),e.jsxs(n.Group,{controlId:"orgProfileLogo",children:[e.jsxs(b,{children:[e.jsxs(d,{xs:12,md:6,className:"p-0",children:[e.jsx(n.Label,{children:s("organisationNew.logo")}),e.jsx(n.Control,{type:"file",accept:"image/*",onChange:q})]}),e.jsx(d,{xs:12,md:6,className:"pt-3",children:t.imageUrl&&e.jsx(ce,{height:"100",src:t.imageUrl,rounded:!0,alt:t.name,className:"profile-img"})})]}),B&&e.jsxs(b,{className:"pt-2",children:[e.jsx(d,{xs:12,md:10,className:"p-0",children:e.jsx(de,{src:B,crop:M,circularCrop:!0,locked:!0,onImageLoaded:H,onComplete:K,onChange:Q})}),e.jsx(d,{xs:12,md:2,className:"pt-3",children:e.jsx(C,{variant:"primary",type:"button",onClick:J,disabled:R||!E,children:s(R?"surfer.uploading":"surfer.upload")})})]})]}),S&&e.jsx("p",{className:"text-danger",children:S}),e.jsxs("div",{className:"d-flex gap-2 mt-2",children:[e.jsx(C,{variant:"primary",type:"submit",disabled:g,children:g?e.jsx(A,{as:"span",animation:"border",size:"sm",role:"status"}):s("organisation.save")}),e.jsx(C,{variant:"outline-secondary",type:"button",disabled:g,onClick:()=>w(p(v,i)),children:s("organisation.cancel")})]})]})})]}):e.jsxs("div",{className:"training-block-wrap",children:[e.jsx("div",{className:"team-panel-header",children:e.jsx("span",{className:"team-panel-title",children:t.name})}),e.jsx("div",{className:"team-panel-body",children:t.description&&e.jsx("p",{children:t.description})})]})}),e.jsx(d,{xs:12,md:3,children:e.jsxs("div",{className:"training-block-wrap training-block-mb",children:[e.jsxs("div",{className:"surfer-section-header",children:[e.jsx(re,{className:"training-card-icon"}),e.jsx("span",{className:"training-card-title",children:s("organisation.owner")})]}),e.jsx("div",{className:"team-panel-body",children:o&&e.jsxs("div",{className:"d-flex align-items-center gap-2",children:[e.jsx("img",{src:o.picture||"/default-profile.png",alt:[o.name,o.surname].filter(Boolean).join(" "),title:[o.name,o.surname].filter(Boolean).join(" "),className:"surfer-avatar-img surfer-avatar-img-sm"}),e.jsxs("div",{children:[e.jsx("div",{className:"fw-bold",children:[o.name,o.surname].filter(Boolean).join(" ")}),e.jsx("div",{className:"text-muted small",children:o.email})]})]})})]})})]}):null},Pe=()=>{const{t:c}=G();return e.jsx(pe,{title:c("organisation.editProfile"),children:({firebase:i,orgId:m,isOwner:s})=>e.jsx(he,{firebase:i,orgId:m,isOwner:s})})};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.