PageSourceSearch

https://streetfoodexpo.co.uk/assets/AdminEventSettings-D6UcGyUw.js

js streetfoodexpo.co.uk collected 2026-09-30 09:30:50 UTC 25,254 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-ui-BUR-GDUn.js";import{s as u,bR as O,q as V,x as me,y as pe,z as he,V as _e,H as xe,L as J,W as i,I as r,B as v,ao as Z,bS as ee,aV as ge,bv as U,aj as fe,bT as ve,d as je,N as be,A as ye,F as ke}from"./index-B0Fu6ckJ.js";import{r as c,f as Ne}from"./vendor-react-DCbXEM4Z.js";import{a as we,u as ae,d as Fe}from"./vendor-data-CUxnnq7o.js";import"./vendor-charts-BbJn_gn3.js";import"./vendor-editor-CS7TB4mw.js";import"./vendor-dnd-CecOPVzN.js";const Ce=()=>{const x=we(),[j,E]=c.useState(null),[S,b]=c.useState(""),[y,k]=c.useState(null),[g,f]=c.useState(""),[N,P]=c.useState(null),[w,F]=c.useState(""),[L,T]=c.useState(!1),[G,H]=c.useState(""),[A,I]=c.useState(null),[Q,C]=c.useState(""),[q,D]=c.useState(!1),[K,W]=c.useState(""),$=c.useRef(!1),{data:l,isLoading:se}=ae({queryKey:[O.EVENT_SETTINGS],queryFn:ve}),{data:Y=[],refetch:le}=ae({queryKey:["crm-portal-profiles"],queryFn:async()=>{const{data:a}=await u.from("user_roles").select("user_id").eq("role","customer_service");if(!a||a.length===0)return[];const s=a.map(o=>o.user_id),{data:d}=await u.from("user_profiles").select("id, user_id, display_name, email, meeting_url, show_in_portal, show_email, show_calendly").in("user_id",s);return d||[]}}),M=async(a,s,d)=>{const{error:o}=await u.from("user_profiles").update({[s]:d}).eq("id",a);if(o){V.error("Failed to update CRM setting");return}le()},[t,n]=c.useState({event_name:"",tagline:"",event_date:"",location:"",address_line_1:"",address_line_2:"",address_line_3:"",contact_email:"",contact_phone:"",organiser_info:"",copyright_text:"",event_status:"upcoming",portal_domain:"",showguide_listing_deadline:"",space_only_deadline:"",speaker_form_deadline:"",advert_submission_deadline:"",facebook_url:"",twitter_url:"",linkedin_url:"",instagram_url:"",youtube_url:"",tiktok_url:"",ticker_enabled:!1,ticker_text:"",ticker_link_text:"",ticker_link_url:"",popup_enabled:!1,popup_link_url:"",floorplan_url:""});c.useEffect(()=>{l&&!$.current&&($.current=!0,n({event_name:l.event_name||"",tagline:l.tagline||"",event_date:l.event_date||"",location:l.location||"",address_line_1:l.address_line_1||"",address_line_2:l.address_line_2||"",address_line_3:l.address_line_3||"",contact_email:l.contact_email||"",contact_phone:l.contact_phone||"",organiser_info:l.organiser_info||"",copyright_text:l.copyright_text||"",event_status:l.event_status||"upcoming",portal_domain:l.portal_domain||"",showguide_listing_deadline:l.showguide_listing_deadline||"",space_only_deadline:l.space_only_deadline||"",speaker_form_deadline:l.speaker_form_deadline||"",advert_submission_deadline:l.advert_submission_deadline||"",facebook_url:l.facebook_url||"",twitter_url:l.twitter_url||"",linkedin_url:l.linkedin_url||"",instagram_url:l.instagram_url||"",youtube_url:l.youtube_url||"",tiktok_url:l.tiktok_url||"",ticker_enabled:l.ticker_enabled||!1,ticker_text:l.ticker_text||"",ticker_link_text:l.ticker_link_text||"",ticker_link_url:l.ticker_link_url||"",popup_enabled:l.popup_enabled||!1,popup_link_url:l.popup_link_url||"",floorplan_url:l.floorplan_url||""}),b(l.logo_url||""),f(l.thumbnail_url||""),F(l.favicon_url||""),H(l.favicon_url||""),C(l.popup_image_url||""),W(l.popup_image_url||""))},[l]);const z=Fe({mutationFn:async()=>{let a=(l==null?void 0:l.logo_url)||null,s=(l==null?void 0:l.thumbnail_url)||null,d=(l==null?void 0:l.favicon_url)||null,o=(l==null?void 0:l.popup_image_url)||null;if(j){const m=j.name.split(".").pop(),p=`logo-${Date.now()}.${m}`,{error:h}=await u.storage.from("media-library").upload(p,j);if(h)throw h;const{data:{publicUrl:_}}=u.storage.from("media-library").getPublicUrl(p);a=_}if(y){const m=y.name.split(".").pop(),p=`thumbnail-${Date.now()}.${m}`,{error:h}=await u.storage.from("media-library").upload(p,y);if(h)throw h;const{data:{publicUrl:_}}=u.storage.from("media-library").getPublicUrl(p);s=_}if(N){const m=N.name.split(".").pop(),p=`favicon-${Date.now()}.${m}`,{error:h}=await u.storage.from("media-library").upload(p,N);if(h)throw h;const{data:{publicUrl:_}}=u.storage.from("media-library").getPublicUrl(p);d=_}else L&&(d=null);if(A){const m=A.name.split(".").pop(),p=`popup-${Date.now()}.${m}`,{error:h}=await u.storage.from("media-library").upload(p,A);if(h)throw h;const{data:{publicUrl:_}}=u.storage.from("media-library").getPublicUrl(p);o=_}else q&&(o=null);const R=m=>m&&m.trim()!==""?m:null,X={...t,showguide_listing_deadline:R(t.showguide_listing_deadline),space_only_deadline:R(t.space_only_deadline),speaker_form_deadline:R(t.speaker_form_deadline),advert_submission_deadline:R(t.advert_submission_deadline),logo_url:a,thumbnail_url:s,favicon_url:d,popup_image_url:o},B=l!=null&&l.id?await u.from("event_settings").update(X).eq("id",l.id).select().maybeSingle():await u.from("event_settings").insert(X).select().maybeSingle();if(B.error)throw B.error;return B.data},onSuccess:a=>{a&&(x.setQueryData([O.EVENT_SETTINGS],a),$.current=!0,n({event_name:a.event_name||"",tagline:a.tagline||"",event_date:a.event_date||"",location:a.location||"",address_line_1:a.address_line_1||"",address_line_2:a.address_line_2||"",address_line_3:a.address_line_3||"",contact_email:a.contact_email||"",contact_phone:a.contact_phone||"",organiser_info:a.organiser_info||"",copyright_text:a.copyright_text||"",event_status:a.event_status||"upcoming",portal_domain:a.portal_domain||"",showguide_listing_deadline:a.showguide_listing_deadline||"",space_only_deadline:a.space_only_deadline||"",speaker_form_deadline:a.speaker_form_deadline||"",advert_submission_deadline:a.advert_submission_deadline||"",facebook_url:a.facebook_url||"",twitter_url:a.twitter_url||"",linkedin_url:a.linkedin_url||"",instagram_url:a.instagram_url||"",youtube_url:a.youtube_url||"",tiktok_url:a.tiktok_url||"",ticker_enabled:a.ticker_enabled||!1,ticker_text:a.ticker_text||"",ticker_link_text:a.ticker_link_text||"",ticker_link_url:a.ticker_link_url||"",popup_enabled:a.popup_enabled||!1,popup_link_url:a.popup_link_url||"",floorplan_url:a.floorplan_url||""}),b(a.logo_url||""),f(a.thumbnail_url||""),F(a.favicon_url||""),H(a.favicon_url||""),T(!1),C(a.popup_image_url||""),W(a.popup_image_url||""),D(!1)),x.invalidateQueries({queryKey:[O.EVENT_SETTINGS]}),V.success("Event settings updated successfully!"),E(null),k(null),P(null),I(null)},onError:a=>{const s=(a==null?void 0:a.message)||"Failed to update event settings";V.error(s)}}),te=a=>{var d;const s=(d=a.target.files)==null?void 0:d[0];if(s){E(s);const o=new FileReader;o.onloadend=()=>{b(o.result)},o.readAsDataURL(s)}},ie=a=>{var d;const s=(d=a.target.files)==null?void 0:d[0];if(s){k(s);const o=new FileReader;o.onloadend=()=>{f(o.result)},o.readAsDataURL(s)}},ne=a=>{var d;const s=(d=a.target.files)==null?void 0:d[0];if(s){P(s),T(!1);const o=new FileReader;o.onloadend=()=>{F(o.result)},o.readAsDataURL(s)}},re=()=>{T(!0),F(""),P(null)},oe=()=>{T(!1),F(G)},de=a=>{var d;const s=(d=a.target.files)==null?void 0:d[0];if(s){I(s),D(!1);const o=new FileReader;o.onloadend=()=>{C(o.result)},o.readAsDataURL(s)}},ce=()=>{D(!0),C(""),I(null)},ue=()=>{D(!1),C(K)};return e.jsxs(me,{children:[e.jsxs(pe,{children:[e.jsx(he,{children:"Event Information"}),e.jsx(_e,{children:"Update your event information below. All changes will be reflected across the website."})]}),e.jsx(xe,{children:se?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx(J,{className:"h-8 w-8 animate-spin"})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"event_name",children:"Event Name"}),e.jsx(r,{id:"event_name",value:t.event_name,onChange:a=>n(s=>({...s,event_name:a.target.value})),placeholder:"Street Food Business Expo"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"tagline",children:"Tagline"}),e.jsx(r,{id:"tagline",value:t.tagline,onChange:a=>n(s=>({...s,tagline:a.target.value})),placeholder:"The leading Food-To-Go industry event"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"event_date",children:"Event Date"}),e.jsx(r,{id:"event_date",value:t.event_date,onChange:a=>n(s=>({...s,event_date:a.target.value})),placeholder:"29 & 30 September 2026"})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"location",children:"Location"}),e.jsx(r,{id:"location",value:t.location,onChange:a=>n(s=>({...s,location:a.target.value})),placeholder:"ExCel London"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"address_line_1",children:"Address Line 1"}),e.jsx(r,{id:"address_line_1",value:t.address_line_1,onChange:a=>n(s=>({...s,address_line_1:a.target.value})),placeholder:"One Western Gateway"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"address_line_2",children:"Address Line 2"}
1),e.jsx(r,{id:"address_line_2",value:t.address_line_2,onChange:a=>n(s=>({...s,address_line_2:a.target.value})),placeholder:"Royal Victoria Dock"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"address_line_3",children:"Address Line 3 (Postcode)"}),e.jsx(r,{id:"address_line_3",value:t.address_line_3,onChange:a=>n(s=>({...s,address_line_3:a.target.value})),placeholder:"London E16 1XL"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"contact_email",children:"Contact Email"}),e.jsx(r,{id:"contact_email",type:"email",value:t.contact_email,onChange:a=>n(s=>({...s,contact_email:a.target.value})),placeholder:"[email protected]"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"This email will appear in the footer and exhibit page"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"contact_phone",children:"Contact Phone"}),e.jsx(r,{id:"contact_phone",value:t.contact_phone,onChange:a=>n(s=>({...s,contact_phone:a.target.value})),placeholder:"+44 20 1234 5678"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"This phone number will appear in the footer and exhibit page"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"event_status",children:"Event Code"}),e.jsx(r,{id:"event_status",value:t.event_status,onChange:a=>n(s=>({...s,event_status:a.target.value})),placeholder:"e.g., DEHO26"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"portal_domain",children:"Portal Domain"}),e.jsx(r,{id:"portal_domain",value:t.portal_domain,onChange:a=>n(s=>({...s,portal_domain:a.target.value})),placeholder:"e.g., streetfoodbusinessexpo.com"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Used for portal links in transactional emails (without https://)"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"logo",children:"Website Logo"}),e.jsx("div",{className:"flex items-center gap-4",children:e.jsx(r,{id:"logo",type:"file",accept:"image/*",onChange:te,className:"flex-1"})}),S&&e.jsx("div",{className:"mt-2",children:e.jsx("img",{src:S,alt:"Logo preview",className:"h-20 object-contain"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"This logo will appear in the navbar and footer across the website"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"thumbnail",children:"Social Media Thumbnail"}),e.jsx("div",{className:"flex items-center gap-4",children:e.jsx(r,{id:"thumbnail",type:"file",accept:"image/*",onChange:ie,className:"flex-1"})}),g&&e.jsx("div",{className:"mt-2",children:e.jsx("img",{src:g,alt:"Thumbnail preview",className:"h-20 object-contain"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Used when sharing the website on social media platforms"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"favicon",children:"Favicon (Browser Tab Icon)"}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(r,{id:"favicon",type:"file",accept:"image/png,image/x-icon,image/svg+xml,image/ico,.ico,.png,.svg",onChange:ne,className:"flex-1"}),w&&!L&&e.jsx(v,{type:"button",variant:"ghost",size:"icon",onClick:re,title:"Remove favicon",children:e.jsx(Z,{className:"h-4 w-4 text-destructive"})}),L&&G&&e.jsx(v,{type:"button",variant:"ghost",size:"icon",onClick:oe,title:"Undo delete",children:e.jsx(ee,{className:"h-4 w-4"})})]}),w&&e.jsx("div",{className:"mt-2",children:e.jsx("img",{src:w,alt:"Favicon preview",className:"h-10 w-10 object-contain"})}),L&&e.jsx("p",{className:"text-xs text-destructive",children:"Favicon will be removed on save (auto-generated favicon will be used instead)"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Upload a custom favicon (.ico, .png, .svg). If not set, a favicon is auto-generated from the event name."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"organiser_info",children:"Organiser Information"}),e.jsx(ge,{id:"organiser_info",value:t.organiser_info,onChange:a=>n(s=>({...s,organiser_info:a.target.value})),placeholder:"An event organised by Fortem Food And Drink Ltd. Company Registered in England No. 09810978.",rows:2}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"This appears below the copyright text in the footer"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"copyright_text",children:"Copyright Text"}),e.jsx(r,{id:"copyright_text",value:t.copyright_text,onChange:a=>n(s=>({...s,copyright_text:a.target.value})),placeholder:"© 2025 - 2026 {eventName}. All rights reserved."}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Main copyright text that appears in the footer"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"floorplan_url",children:"Floorplan PDF/Viewer URL"}),e.jsx(r,{id:"floorplan_url",type:"url",value:t.floorplan_url,onChange:a=>n(s=>({...s,floorplan_url:a.target.value})),placeholder:"https://example.com/floorplan.pdf"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"URL to the floorplan PDF or interactive viewer. Displays on /view-floorplan page."}),t.floorplan_url&&e.jsxs("div",{className:"mt-4",children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"Preview:"}),e.jsx("div",{className:"relative w-full bg-white rounded-lg border border-border shadow-sm overflow-hidden",style:{paddingBottom:"56.25%"},children:e.jsx("object",{data:t.floorplan_url,type:"application/pdf",className:"absolute inset-0 w-full h-full",title:"Floorplan Preview",children:e.jsx("iframe",{src:`https://docs.google.com/viewer?url=${encodeURIComponent(t.floorplan_url)}&embedded=true`,className:"absolute inset-0 w-full h-full border-0",allowFullScreen:!0,title:"Floorplan Preview Fallback"})})})]})]}),e.jsxs("div",{className:"space-y-4 pt-6 border-t",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-1",children:"Important Deadlines"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Set key dates for exhibitor submissions and requirements"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"showguide_listing_deadline",children:"Showguide Listing Deadline"}),e.jsx(r,{id:"showguide_listing_deadline",type:"date",value:t.showguide_listing_deadline,onChange:a=>n(s=>({...s,showguide_listing_deadline:a.target.value})),className:"bg-white text-gray-700"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"space_only_deadline",children:"Space Only Information Deadline"}),e.jsx(r,{id:"space_only_deadline",type:"date",value:t.space_only_deadline,onChange:a=>n(s=>({...s,space_only_deadline:a.target.value})),className:"bg-white text-gray-700"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"speaker_form_deadline",children:"Speaker Form + Headshot Submission"}),e.jsx(r,{id:"speaker_form_deadline",type:"date",value:t.speaker_form_deadline,onChange:a=>n(s=>({...s,speaker_form_deadline:a.target.value})),className:"bg-white text-gray-700"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"advert_submission_deadline",children:"Advert Submission Deadline"}),e.jsx(r,{id:"advert_submission_deadline",type:"date",value:t.advert_submission_deadline,onChange:a=>n({...t,advert_submission_deadline:a.target.value}),className:"bg-white text-gray-700"})]})]})]}),e.jsxs("div",{className:"space-y-4 pt-6 border-t",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-1",children:"Social Media Accounts"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Add your show's social media URLs to display in the footer"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"facebook_url",children:"Facebook URL"}),e.jsx(r,{id:"facebook_url",type:"url",value:t.facebook_url,onChange:a=>n(s=>({...s,facebook_url:a.target.value})),placeholder:"https://facebook.com/yourpage"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"twitter_url",children:"Twitter/X URL"}),e.jsx(r,{id:"twitter_url",type:"url",value:t.twitter_url,onChange:a=>n(s=>({...s,twitter_url:a.target.value})),placeholder:"https://twitter.com/yourhandle"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"linkedin_url",children:"LinkedIn URL"}),e.jsx(r,{id:"linkedin_url",type:"url",value:t.linkedin_url,onChange:a=>n(s=>({...s,linkedin_url:a.target.value})),placeholder:"https://linkedin.com/company/yourcompany"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"instagram_url",children:"Instagram URL"}),e.jsx(r,{id:"instagram_url",type:"url",value:t.instagram_url,onChange:a=>n(s=>({...s,instagram_url:a.target.value})),placeholder:"https://instagram.com/yourhandle"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"youtube_url",children:"YouTube URL"}),e.jsx(r,{id:"youtube_url",type:"url",value:t.youtube_url,onChange:a=>n(s=>({...s,youtube_url:a.target.value})),placeholder:"https://youtube.com/@yourchannel"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"tiktok_url",children:"TikTok URL"}),e.jsx(r,{id:"tiktok_url",type:"url",value:t.tiktok_url,onChange:a=>n(s=>({...s,tiktok_url:a.target.value})),placeholder:"https://tiktok.com/@yourhandle"})]})]})]}),e.jsxs("div",{className:"space-y-4 pt-6 border-t",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-1",children:"Announcement Ticker Bar"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Display a customizable announcement bar above the navigation"})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(U,{id:"ticker_enabled",checked:t.ticker_enabled,onCheckedChange:a=>n(s=>({...s,ticker_enabled:a}))}),e.jsx(i,{htmlFor:"ticker_enabled",children:"Enable Ticker Bar"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"ticker_text",children:"Ticker Text"}),e.jsx(r,{id:"ticker_text",value:t.ticker_text,onChange:a=>n(s=>({...s,ticker_text:a.target.value})),placeholder:"Enter your announcement message..."})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"ticker_link_text",children:"Link Text (optional)"}),e.jsx(r,{id:"ticker_link_text",value:t.ticker_link_text,onChange:a=>n(s=>({...s,ticker_link_text:a.target.value})),placeholder:"e.g., click here"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"ticker_link_url",children:"Link URL (optional)"}),e.jsx(r,{id:"ticker_link_url",value:t.ticker_link_url,onChange:a=>n(s=>({...s,ticker_link_url:a.target.value})),placeholder:"/registration or https://..."})]})]})]}),e.jsxs("div",{className:"space-y-4 pt-6 border-t",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-1",children:"Announcement Popup"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Display a popup announcement on the homepage when visitors arrive"})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(U,{id:"popup_enabled",checked:t.popup_enabled,onCheckedChange:a=>n(s=>({...s,popup_enabled:a}))}),e.jsx(i,{htmlFor:"popup_enabled",children:"Enable Popup"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"popup_image",children:"Popup Image"}),e.jsx("div",{className:"flex items-center gap-4",children:e.jsx(r,{id:"popup_image",type:"file",accept:"image/*",onChange:de,className:"flex-1"})}),Q&&!q&&e.jsxs("div",{className:"mt-2 relative inline-block",children:[e.jsx("img",{src:Q,alt:"Popup preview",className:"h-32 object-contain rounded-lg border"}),e.jsx(v,{type:"button",variant:"destructive",size:"sm",className:"absolute -top-2 -right-2 h-8 w-8 p-0 rounded-full",onClick:ce,children:e.jsx(Z,{className:"h-4 w-4"})})]}),q&&K&&e.jsxs("div",{className:"mt-2 p-3 bg-destructive/10 border border-destructive/20 rounded-lg flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-destructive",children:"Image will be removed when you save changes"}),e.jsxs(v,{type:"button",variant:"outline",size:"sm",onClick:ue,className:"ml-2",children:[e.jsx(ee,{className:"h-4 w-4 mr-1"}),"Undo"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Upload an image to display in the popup announcement"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"popup_link_url",children:"Link URL (optional)"}),e.jsx(r,{id:"popup_link_url",type:"url",value:t.popup_link_url,onChange:a=>n(s=>({...s,popup_link_url:a.target.value})),placeholder:"/registration or https://example.com"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"If set, clicking the popup image will open this link"})]})]}),e.jsxs("div",{className:"space-y-4 pt-6 border-t",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(fe,{className:"h-5 w-5"}),e.jsx("h3",{className:"text-lg font-semibold",children:"Client Relations Managers"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Control which managers are displayed in the exhibitor portal. Only visible managers will appear to exhibitors."}),Y.length===0?e.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No client relations managers found. Add users with the Customer Service role in Admin → Users."}):e.jsx("div",{className:"space-y-3",children:Y.map(a=>e.jsxs("div",{className:"border rounded-lg p-4 space-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:a.display_name||"Unnamed"}),a.email&&e.jsx("p",{className:"text-sm text-muted-foreground",children:a.email}),a.meeting_url&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Meeting URL configured"})]}),e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(U,{checked:a.show_in_portal,onCheckedChange:s=>M(a.id,"show_in_portal",s)}),e.jsx("span",{className:"text-sm",children:"Show in Portal"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(U,{checked:a.show_email,onCheckedChange:s=>M(a.id,"show_email",s)}),e.jsx("span",{className:"text-sm",children:"Show Email"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(U,{checked:a.show_calendly,onCheckedChange:s=>M(a.id,"show_calendly",s)}),e.jsx("span",{className:"text-sm",children:"Show Calendly"})]})]})]},a.id))})]}),e.jsx(v,{onClick:()=>z.mutate(),disabled:z.isPending,className:"w-full",children:z.isPending?e.jsxs(e.Fragment,{children:[e.jsx(J,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save Changes"})]})})]})},Re=()=>{const x=Ne(),[j,E]=c.useState(!1),[S,b]=c.useState(!0);c.useEffect(()=>{y()},[]);const y=async()=>{const{data:{session:k}}=await u.auth.getSession();if(!k){x("/login");return}const{data:g,error:f}=await u.from("user_roles").select("role").eq("user_id",k.user.id);f&&console.error("Error fetching user roles:",f);const N=["admin","customer_service","project_manager"];(g==null?void 0:g.some(w=>N.includes(w.role)))?E(!0):x("/"),b(!1)};return S?e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}
1):j?e.jsxs(e.Fragment,{children:[e.jsx(je,{titlePrefix:"Event Settings - Admin",noIndex:!0}),e.jsxs("div",{className:"min-h-screen flex flex-col",children:[e.jsx(be,{}),e.jsx("div",{className:"flex-1 bg-muted/30 pt-[168px] pb-16",children:e.jsxs("div",{className:"container mx-auto px-4 max-w-6xl",children:[e.jsxs("div",{className:"mb-6 flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Event Settings"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage your event details, dates, and general information"})]}),e.jsxs(v,{variant:"outline",onClick:()=>x("/admin"),className:"flex-shrink-0",children:[e.jsx(ye,{className:"mr-2 h-4 w-4"}),"Back to Admin"]})]}),e.jsx(Ce,{})]})}),e.jsx(ke,{})]})]}):null};export{Re 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.