1import{_ as E}from"./Badge.vue_vue_type_script_setup_true_lang-DnLNUvZL.js";import{_ as y}from"./index-DpaqgiN6.js";import{_ as M}from"./Input.vue_vue_type_script_setup_true_lang-Dvh77nFq.js";import{_}from"./Skeleton.vue_vue_type_script_setup_true_lang-CL1gPoG9.js";import{f as X}from"./date-CnPP9KSU.js";import{s as Y}from"./pinia-PuRIhcbt.js";import{toast as L}from"./index-BlmKzHgf.js";import{_ as Z,a as ee,b as te}from"./DialogTitle.vue_vue_type_script_setup_true_lang-DQsqysI1.js";import{_ as oe}from"./DialogDescription.vue_vue_type_script_setup_true_lang-Bh9k-J1a.js";import{_ as re}from"./DialogFooter.vue_vue_type_script_setup_true_lang-DCpAYu3V.js";import{_ as se}from"./DialogHeader.vue_vue_type_script_setup_true_lang-CUpexu6X.js";import{_ as Q}from"./Label.vue_vue_type_script_setup_true_lang-UjDFAzoM.js";import{d as R,ao as z,ap as ae,r as D,y as ne,l as N,p as h,k as a,w as d,i as r,u as e,b as i,j as c,f as t,t as l,g as P,m as ie,F as V,q as B}from"./runtime-dom.esm-bundler-xJOdt0Zn.js";import{M as q}from"./mail-BhtMOOLG.js";import{I as de}from"./info-DOTFCyGJ.js";import{C as O}from"./circle-alert-F-UTW-d2.js";import{L as le}from"./loader-circle-DVcAKzXh.js";import{u as me}from"./usePendingPromotersStore-CLJ3NywN.js";import{S as F}from"./search-DiJLjud6.js";import{A as ue}from"./arrow-down-DzO7pWzh.js";import{A as pe}from"./arrow-up-BA14oCi3.js";import{C as ce}from"./check-UoCD0cAg.js";import{I as fe}from"./inbox-DGIJTdBo.js";import{C as ge}from"./chevron-left-BnbnBAKp.js";import{C as ve}from"./chevron-right-BcJfDQli.js";import"./utils-BEHD0UYf.js";import"./index-CmwAFQIR.js";import"./index-CklPxmEV.js";import"./Primitive-Czm4dt8Q.js";import"./index-Cem0xmiw.js";import"./index-CjfaFu96.js";import"./useForwardPropsEmits-D1F_rOP2.js";import"./DialogTitle-Bt7xg-oN.js";import"./useForwardExpose-DUyY_I3n.js";import"./Presence-GKnN0J2y.js";import"./FocusScope-1JWoPTuM.js";import"./ConfigProvider-hNyU-qMf.js";import"./createContext-DU1POGjb.js";import"./defu-cjemX7BB.js";import"./getActiveElement-FUKBWQwh.js";import"./useId-CcfCCSsq.js";import"./Teleport-DKbWa7hL.js";import"./handleAndDispatchCustomEvent-ChOKVcqp.js";import"./utils-BQ9dVBfU.js";import"./DialogPortal-us6Mh--w.js";import"./x-CZxRxIHh.js";import"./createLucideIcon-CjY9-wIx.js";import"./DialogDescription-CLECfl2L.js";import"./useApi-BfWdaryG.js";import"./apiEndpoints-CnLkLktU.js";const be={key:0,class:"grid gap-4 py-2"},xe={class:"grid gap-2"},he={class:"grid gap-2"},_e={key:0,class:"text-xs text-destructive","data-testid":"invite-promoter-name-error"},ye={key:1,class:"text-xs text-muted-foreground"},ke={class:"rounded-lg border border-border bg-muted/40 p-3"},we={class:"text-sm font-medium text-foreground"},$e={key:0,class:"mt-1 text-xs text-muted-foreground"},Ce={class:"flex gap-2 rounded-lg border border-blue-500/30 bg-blue-500/10 p-3 dark:border-blue-400/30 dark:bg-blue-400/10"},Pe={key:1,class:"flex gap-2 rounded-lg border border-destructive/50 bg-destructive/10 p-3"},Se=R({__name:"InvitePromoterDialog",props:z({promoter:{},isSubmitting:{type:Boolean}},{open:{type:Boolean,required:!0},openModifiers:{}}),emits:z(["confirm"],["update:open"]),setup(u,{emit:v}){const k=ae(u,"open"),b=u,S=v,p=D(""),f=D(null);ne(()=>b.promoter,g=>{p.value=g?.promoter_name??"",f.value=null},{immediate:!0});const I=N(()=>{const g=b.promoter?.event_count??0;return g===1?"1 listed event":`${g} listed events`}),w=N(()=>(b.promoter?.artists??[]).map(g=>g.name).join(", ")),$=()=>{if(b.promoter!==null){if(p.value.trim()===""){f.value="Enter the promoter or company name.";return}f.value=null,S("confirm",{email:b.promoter.promoter_email,name:p.value.trim()})}};return(g,s)=>(a(),h(e(te),{open:k.value,"onUpdate:open":s[2]||(s[2]=x=>k.value=x)},{default:d(()=>[r(e(Z),{class:"sm:max-w-lg"},{default:d(()=>[r(e(se),null,{default:d(()=>[r(e(ee),{class:"flex items-center gap-2"},{default:d(()=>[r(e(q),{class:"h-5 w-5 text-primary"}),s[3]||(s[3]=c(" Invite this promoter ",-1))]),_:1}),r(e(oe),null,{default:d(()=>[...s[4]||(s[4]=[c(" Send an invitation to join Promotr. Check the name and email below before sending. ",-1)])]),_:1})]),_:1}
1),u.promoter?(a(),i("div",be,[t("div",xe,[r(e(Q),{for:"invite-promoter-email"},{default:d(()=>[...s[5]||(s[5]=[c("Email address",-1)])]),_:1}),r(e(M),{id:"invite-promoter-email","model-value":u.promoter.promoter_email,readonly:"",class:"bg-muted text-muted-foreground"},null,8,["model-value"]),s[6]||(s[6]=t("p",{class:"text-xs text-muted-foreground"}," Taken from the artist listing and cannot be edited here. ",-1))]),t("div",he,[r(e(Q),{for:"invite-promoter-name"},{default:d(()=>[...s[7]||(s[7]=[c(" Promoter or company name ",-1)])]),_:1}),r(e(M),{id:"invite-promoter-name",modelValue:p.value,"onUpdate:modelValue":s[0]||(s[0]=x=>p.value=x),disabled:u.isSubmitting,placeholder:"Enter the promoter or company name","aria-invalid":f.value!==null,"data-testid":"invite-promoter-name"},null,8,["modelValue","disabled","aria-invalid"]),f.value?(a(),i("p",_e,l(f.value),1)):(a(),i("p",ye," Artists typed this by hand, so correct it if it looks wrong. "))]),t("div",ke,[t("p",we,l(I.value),1),w.value?(a(),i("p",$e," Listed by "+l(w.value),1)):P("",!0)]),t("div",Ce,[r(e(de),{class:"mt-0.5 h-4 w-4 shrink-0 text-blue-600 dark:text-blue-400"}),s[8]||(s[8]=t("p",{class:"text-xs text-blue-900 dark:text-blue-200"}," This creates an unclaimed promoter record and emails an invitation. Accepting it does not publish a public promoter page, and it does not move any events â the artist listings stay exactly as they are until an admin hands them over. ",-1))])])):(a(),i("div",Pe,[r(e(O),{class:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),s[9]||(s[9]=t("p",{class:"text-xs text-destructive"},"No promoter selected.",-1))])),r(e(re),null,{default:d(()=>[r(e(y),{variant:"outline",disabled:u.isSubmitting,onClick:s[1]||(s[1]=x=>k.value=!1)},{default:d(()=>[...s[10]||(s[10]=[c(" Cancel ",-1)])]),_:1},8,["disabled"]),r(e(y),{disabled:u.isSubmitting||u.promoter===null,"data-testid":"invite-promoter-confirm",onClick:$},{default:d(()=>[u.isSubmitting?(a(),h(e(le),{key:0,class:"mr-2 h-4 w-4 animate-spin"})):P("",!0),c(" "+l(u.isSubmitting?"Sending...":"Send invitation"),1)]),_:1},8,["disabled"])]),_:1})]),_:1})]),_:1},8,["open"]))}}),Ie={class:"p-4 sm:p-6 lg:p-8"},De={class:"mx-auto max-w-7xl"},Ne={class:"mb-6 flex flex-wrap items-center gap-3"},Ae={class:"relative min-w-64 flex-1"},Ee={key:0,class:"mb-6 flex gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 p-3 dark:border-amber-400/40 dark:bg-amber-400/10","data-testid":"pending-promoters-partial-notice"},Le={class:"text-xs text-amber-900 dark:text-amber-200"},Ve={key:1,class:"mb-6 rounded-lg border border-destructive/50 bg-destructive/10 p-4","data-testid":"pending-promoters-error"},Be={class:"text-sm text-destructive"},Me={key:2,class:"overflow-hidden rounded-lg border border-border bg-card","data-testid":"pending-promoters-skeleton"},Te={class:"border-b border-border bg-muted/50 px-4 py-3"},Ue={class:"flex-1"},je={key:3,class:"overflow-x-auto rounded-lg border border-border bg-card"},Qe={class:"w-full"},ze={"data-testid":"pending-promoters-table-body"},Fe={class:"px-4 py-3"},Re={class:"font-medium text-foreground"},qe={class:"text-xs text-muted-foreground"},Oe={class:"px-4 py-3"},We={class:"px-4 py-3"},Ge={class:"text-sm text-muted-foreground"},He={class:"px-4 py-3"},Je={key:0,class:"flex flex-wrap gap-1"},Ke={key:1,class:"text-sm text-muted-foreground"},Xe={class:"px-4 py-3 text-right"},Ye={key:4,class:"rounded-lg border border-border bg-card p-12 text-center","data-testid":"pending-promoters-no-matches"},Ze={key:5,class:"rounded-lg border border-border bg-card p-12 text-center","data-testid":"pending-promoters-empty"},et={key:6,class:"mt-4 flex items-center justify-between rounded-lg border border-border bg-card px-4 py-3"},tt={class:"text-sm text-muted-foreground"},ot={class:"flex items-center gap-2"},rt={class:"text-sm text-muted-foreground"},eo=R({__name:"Index",setup(u){const v=me(),{isLoading:k,isInviting:b,error:S,meta:p,searchQuery:f,sortDirection:I,pendingPromoters:w,visiblePendingPromoters:$,isFilteringPartialQueue:g,currentPage:s,lastPage:x}=Y(v),C=D(!1),T=D(null),U=m=>X(m)||"â",W=m=>{const o=U(m.earliest_event_date),n=U(m.latest_event_date);return o===n?o:`${o} â ${n}`},G=N(()=>f.value.trim()!==""),H=N(()=>G.value&&w.value.length>0&&$.value.length===0),j=m=>{m<1||m>x.value||v.fetchPending(m).catch(()=>{})},J=m=>{T.value=m,C.value=!0},K=async m=>{const o=await v.invite(m);if(o.success){L.success(o.message),C.value=!1;return}if(o.conflict){L.warning(o.message),C.value=!1;return}L.error(o.message)};return ie(()=>{v.fetchPending().catch(()=>{})}),(m,o)=>(a(),i("main",Ie,[t("div",De,[o[12]||(o[12]=t("div",{class:"mb-8"},[t("h1",{class:"text-3xl font-bold text-foreground"}," Pending Promoters "),t("p",{class:"mt-2 text-muted-foreground"}
1," Promoters named on artist self-listed events who are not on Promotr yet. Inviting one creates an unclaimed promoter record and emails them â it does not publish a public page or move any events. ")],-1)),t("div",Ne,[t("div",Ae,[r(e(F),{class:"absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r(e(M),{"model-value":e(f),placeholder:"Search by email or name",class:"pl-9","data-testid":"pending-promoters-search","onUpdate:modelValue":o[0]||(o[0]=n=>e(v).setSearchQuery(String(n)))},null,8,["model-value"])]),r(e(y),{variant:"outline","data-testid":"pending-promoters-sort",onClick:o[1]||(o[1]=n=>e(v).toggleSortDirection())},{default:d(()=>[e(I)==="desc"?(a(),h(e(ue),{key:0,class:"mr-2 h-4 w-4"})):(a(),h(e(pe),{key:1,class:"mr-2 h-4 w-4"})),c(" Events "+l(e(I)==="desc"?"high to low":"low to high"),1)]),_:1})]),e(g)&&e(p)?(a(),i("div",Ee,[r(e(O),{class:"mt-0.5 h-4 w-4 shrink-0 text-amber-600 dark:text-amber-400"}),t("p",Le," Showing "+l(e(w).length)+" of "+l(e(p).total)+" pending promoters. Search and s
1ort apply only to the ones loaded on this page. ",1)])):P("",!0),e(S)?(a(),i("div",Ve,[t("p",Be,l(e(S)),1)])):P("",!0),e(k)?(a(),i("div",Me,[t("div",Te,[r(e(_),{class:"h-4 w-40"})]),(a(),i(V,null,B(5,n=>t("div",{key:n,class:"flex items-center gap-4 border-b border-border px-4 py-4 last:border-0"},[t("div",Ue,[r(e(_),{class:"mb-2 h-4 w-56"}),r(e(_),{class:"h-3 w-32"})]),r(e(_),{class:"h-6 w-10"}),r(e(_),{class:"h-4 w-44"}),r(e(_),{class:"h-9 w-24"})])),64))])):e($).length>0?(a(),i("div",je,[t("table",Qe,[o[7]||(o[7]=t("thead",null,[t("tr",{class:"border-b border-border bg-muted/50"},[t("th",{class:"px-4 py-3 text-left text-sm font-medium text-muted-foreground"}," Promoter "),t("th",{class:"px-4 py-3 text-left text-sm font-medium text-muted-foreground"}," Events "),t("th",{class:"px-4 py-3 text-left text-sm font-medium text-muted-foreground"}," Event dates "),t("th",{class:"px-4 py-3 text-left text-sm font-medium text-muted-foreground"}," Listed by "),t("th",{class:"px-4 py-3 text-right text-sm font-medium text-muted-foreground"}," Action ")])],-1)),t("tbody",ze,[(a(!0),i(V,null,B(e($),n=>(a(),i("tr",{key:n.promoter_email,class:"border-b border-border last:border-0 hover:bg-muted/50"},[t("td",Fe,[t("p",Re,l(n.promoter_name??"Name unknown"),1),t("p",qe,l(n.promoter_email),1)]),t("td",Oe,[r(e(E),{variant:"secondary"},{default:d(()=>[c(l(n.event_count),1)]),_:2},1024)]),t("td",We,[t("span",Ge,l(W(n)),1)]),t("td",He,[n.artists.length>0?(a(),i("div",Je,[(a(!0),i(V,null,B(n.artists,A=>(a(),h(e(E),{key:A.id,variant:"outline"},{default:d(()=>[c(l(A.name),1)]),_:2},1024))),128))])):(a(),i("span",Ke," â "))]),t("td",Xe,[n.invite_status==="invited"?(a(),h(e(E),{key:0,variant:"success","data-testid":"pending-promoter-invited-badge"},{default:d(()=>[r(e(ce),{class:"h-3 w-3"}),o[5]||(o[5]=c(" Invited ",-1))]),_:1})):(a(),h(e(y),{key:1,variant:"outline",size:"sm",disabled:e(b),"data-testid":"pending-promoter-invite-button",onClick:A=>J(n)},{default:d(()=>[r(e(q),{class:"mr-2 h-4 w-4"}),o[6]||(o[6]=c(" Invite ",-1))]),_:1},8,["disabled","onClick"]))])]))),128))])])])):H.value?(a(),i("div",Ye,[r(e(F),{class:"mx-auto h-12 w-12 text-muted-foreground"}),o[8]||(o[8]=t("h3",{class:"mt-4 text-lg font-medium text-foreground"}," No promoters match your search ",-1)),o[9]||(o[9]=t("p",{class:"mt-2 text-sm text-muted-foreground"}," Try a different email address or name. ",-1))])):(a(),i("div",Ze,[r(e(fe),{class:"mx-auto h-12 w-12 text-muted-foreground"}),o[10]||(o[10]=t("h3",{class:"mt-4 text-lg font-medium text-foreground"}," No promoters waiting to be invited ",-1)),o[11]||(o[11]=t("p",{class:"mt-2 text-sm text-muted-foreground"}," When an artist self-lists a show and names a promoter who is not on Promotr, they will appear here. ",-1))])),e(p)&&e(p).last_page>1?(a(),i("div",et,[t("p",tt,l(e(p).total)+" promoter(s) waiting to be invited ",1),t("div",ot,[r(e(y),{variant:"outline",size:"icon",disabled:e(s)===1,"data-testid":"pending-promoters-prev-page",onClick:o[2]||(o[2]=n=>j(e(s)-1))},{default:d(()=>[r(e(ge),{class:"h-4 w-4"})]),_:1},8,["disabled"]),t("span",rt," Page "+l(e(s))+" of "+l(e(x)),1),r(e(y),{variant:"outline",size:"icon",disabled:e(s)===e(x),"data-testid":"pending-promoters-next-page",onClick:o[3]||(o[3]=n=>j(e(s)+1))},{default:d(()=>[r(e(ve),{class:"h-4 w-4"})]),_:1},8,["disabled"])])])):P("",!0)]),r(Se,{open:C.value,"onUpdate:open":o[4]||(o[4]=n=>C.value=n),promoter:T.value,"is-submitting":e(b),onConfirm:K},null,8,["open","promoter","is-submitting"])]))}});export{eo as default}; 2//# sourceMappingURL=Index-DkeSddX1.js.map
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.