1import{a as se,b as me,c as de,d as ce}from"./chunk-7MBJQLEZ.js";import{h as R}from"./chunk-GVF74V3Q.js";import"./chunk-4ETRF4RK.js";import{Ac as I,Bd as oe,Cd as re,Dd as ae,Eb as v,Fb as C,Gb as x,Gc as V,Hb as O,Ia as r,Jc as k,Jd as le,Kb as P,Lc as B,Mc as W,Nc as A,Oc as U,Pa as f,Pc as j,Ua as E,Uc as G,Vc as Y,Wc as q,Xa as d,Y as T,Za as F,Zc as J,_c as K,aa as z,ab as w,cd as Q,db as L,dd as X,eb as M,f as D,fb as e,fc as b,fd as Z,gb as t,hb as p,hd as $,id as ee,ka as h,la as g,lb as _,ld as te,mb as u,nb as c,nd as ie,rd as ne,vb as n,wb as S,xb as y,yb as H,zb as N}from"./chunk-N6N6CUJ7.js";var ue=(l,a)=>a.value,fe=(l,a)=>a.formType+":"+a.id,he=(l,a)=>["/admin/form-submissions",l,a];function ge(l,a){if(l&1&&(e(0,"option",17),n(1),t()),l&2){let i=a.$implicit;d("value",i.value),r(),S(i.label)}}function Se(l,a){if(l&1){let i=_();e(0,"div",14)(1,"label",31),n(2,"Recommendation"),t(),e(3,"select",32),x("ngModelChange",function(s){h(i);let m=c();return C(m.recommendationCode,s)||(m.recommendationCode=s),g(s)}),u("ngModelChange",function(){h(i);let s=c();return g(s.onFilterChange())}),e(4,"option",22),n(5,"All"),t(),e(6,"option",33),n(7,"ClearOne"),t(),e(8,"option",34),n(9,"ClearGroup"),t(),e(10,"option",35),n(11,"Custom 20+"),t(),e(12,"option",36),n(13,"ClearOne + ClearGroup"),t(),e(14,"option",37),n(15,"ClearOne + Custom 20+"),t()()()}if(l&2){let i=c();r(3),v("ngModel",i.recommendationCode)}}function ve(l,a){l&1&&(e(0,"div",30)(1,"div",38),p(2,"app-lucide-icon",39),e(3,"span",40),n(4,"Loading submissions\u2026"),t()()()),l&2&&(r(2),d("size",24))}function Ce(l,a){if(l&1){let i=_();e(0,"div",30)(1,"div",41),p(2,"app-lucide-icon",42),e(3,"h3",43),n(4,"Could not load submissions"),t(),e(5,"p",40),n(6),t(),e(7,"button",44),u("click",function(){h(i);let s=c();return g(s.load())}),n(8," Try again "),t()()()}if(l&2){let i=c();r(2),d("size",32),r(4),S(i.error())}}function xe(l,a){l&1&&(e(0,"div",30)(1,"div",41),p(2,"app-lucide-icon",45),e(3,"h3",46),n(4,"No submissions yet"),t(),e(5,"p",40),n(6," Public website form submissions will appear here after someone submits a form. "),t()()()),l&2&&(r(2),d("size",32))}function _e(l,a){if(l&1&&(e(0,"tr",50)(1,"td",56),n(2),t(),e(3,"td",57),n(4),t(),e(5,"td",58),n(6),t(),e(7,"td",57)(8,"span",59),n(9),t()(),e(10,"td",60),n(11),t(),e(12,"td",57)(13,"span",61),n(14),t()(),e(15,"td",57)(16,"a",62),n(17," View "),t()()()),l&2){let i=a.$implicit,o=c(2);r(2),S(o.formatDate(i.submittedAt)),r(2),S(i.displayName||i.firstName||"\u2014"),r(2),S(i.email||"\u2014"),r(3),y(" ",i.formTypeLabel||o.labelForFormType(i.formType)," "),r(2),y(" ",i.headline||i.recommendationTitle||i.recommendationCode||"\u2014"," "),r(2),d("variant",o.statusVariant(i.emailDeliveryStatus)),r(),y(" ",i.emailDeliveryStatus," "),r(2),d("routerLink",P(8,he,i.formType,i.id))}}function ye(l,a){if(l&1){let i=_();e(0,"div",47)(1,"table",48)(2,"thead",49)(3,"tr",50)(4,"th",51),n(5,"Date"),t(),e(6,"th",51),n(7,"Name"),t(),e(8,"th",51),n(9,"Email"),t(),e(10,"th",51),n(11,"Form"),t(),e(12,"th",51),n(13,"Summary"),t(),e(14,"th",51),n(15,"Email status"),t(),p(16,"th",51),t()(),e(17,"tbody",52),L(18,_e,18,11,"tr",50,fe),t()()(),e(20,"div",53)(21,"p",40),n(22),t(),e(23,"div",54)(24,"button",55),u("click",function(){h(i);let s=c();return g(s.prevPage())}),n(25," Previous "),t(),e(26,"button",55),u("click",function(){h(i);let s=c();return g(s.nextPage())}),n(27," Next "),t()()()}if(l&2){let i=c();r(18),M(i.items()),r(4),N(" Showing ",i.rangeStart(),"\u2013",i.rangeEnd()," of ",i.total()," "),r(2),d("disabled",i.offset()===0||i.loading()),r(2),d("disabled",!i.hasNext()||i.loading())}}var pe=class l{service=T(me);toast=T(J);formTypeOptions=de;items=f([]);total=f(0);offset=f(0);pageSize=f(25);loading=f(!1);error=f(null);formType="";search="";recommendationCode="";emailStatus="";filterTimer=null;showRecommendationFilter=f(!1);rangeStart=b(()=>this.total()===0?0:this.offset()+1);rangeEnd=b(()=>Math.min(this.offset()+this.items().length,this.total()));hasNext=b(()=>this.offset()+this.pageSize()<this.total());ngOnInit(){this.showRecommendationFilter.set(this.formType==="best-fit"),this.load()}onFormTypeChange(){this.showRecommendationFilter.set(this.formType==="best-fit"),this.formType!=="best-fit"&&(this.recommendationCode=""),this.onFilterChange()}onFilterChange(){this.filterTimer&&clearTimeout(this.filterTimer),this.filterTimer=setTimeout(()=>{this.offset.set(0),this.load()},300)}load(){return D(this,null,function*(){this.loading.set(!0),this.error.set(null);try{let a=yield this.service.listFormSubmissions({formType:this.formType||void 0,search:this.search.trim()||void 0,recommendationCode:this.formType==="best-fit"&&this.recommendationCode?this.recommendationCode:void 0,emailStatus:this.emailStatus||void 0,pageSize:this.pageSize(),offset:this.offset()});this.items.set(a.items||[]),this.total.set(a.total||0),this.offset.set(a.offset||0),this.pageSize.set(a.pageSize||25)}catch(a){let i=se(a);this.error.set(i),this.items.set([]),this.total.set(0),this.toast.error(i)}finally{this.loading.set(!1)}})}prevPage(){this.offset.set(Math.max(0,this.offset()-this.pageSize())),this.load()}nextPage(){this.hasNext()&&(this.offset.set(this.offset()+this.pageSize()),this.load())}formatDate(a){if(!a)return"\u2014";let i=new Date(a);
1return Number.isNaN(i.getTime())?"\u2014":i.toLocaleString()}labelForFormType(a){return ce(a)}statusVariant(a){switch(a){case"sent":return"default";case"failed":return"destructive";case"partial":case"pending":return"secondary";default:return"outline"}}static \u0275fac=function(i){return new(i||l)};static \u0275cmp=z({type:l,selectors:[["app-form-submissions-list"]],standalone:!0,features:[O],decls:58,vars:18,consts:[[1,"container","max-w-6xl","mx-auto","p-6","space-y-6"],[1,"flex","flex-col","sm:flex-row","sm:items-center","sm:justify-between","gap-4"],[1,"flex","items-center","gap-4"],["name","mail",1,"text-primary",3,"size"],[1,"text-3xl","font-bold","text-foreground"],[1,"text-muted-foreground"],["hlmBtn","","variant","ghost","size","sm","type","button",3,"click","disabled"],["name","refresh-ccw",3,"size"],["hlmCard","",1,"bg-card","border","border-border","shadow-sm"],["hlmCardHeader","",1,"pb-4"],["hlmCardTitle","",1,"flex","items-center","gap-4"],["name","filter",1,"text-primary",3,"size"],["hlmCardContent","",1,"pt-0"],[1,"grid","grid-cols-1","sm:grid-cols-2","gap-4"],["hlmFormField","",1,"space-y-2"],["hlmLabel","","for","formType"],["hlmSelect","","id","formType",1,"w-full",3,"ngModelChange","ngModel"],[3,"value"],["hlmLabel","","for","search"],["hlmInput","","id","search","type","search","placeholder","Search\u2026",1,"w-full",3,"ngModelChange","ngModel"],["hlmLabel","","for","emailStatus"],["hlmSelect","","id","emailStatus",1,"w-full",3,"ngModelChange","ngModel"],["value",""],["value","sent"],["value","partial"],["value","failed"],["value","pending"],["name","file-text",1,"text-primary",3,"size"],["hlmCardTitle","",1,"text-xl"],["hlmCardDescription",""],[1,"flex","justify-center","py-12"],["hlmLabel","","for","recommendation"],["hlmSelect","","id","recommendation",1,"w-full",3,"ngModelChange","ngModel"],["value","CLEARONE"],["value","CLEARGROUP"],["value","CUSTOM20"],["value","CLEARONE_CLEARGROUP"],["value","CLEARONE_CUSTOM20"],[1,"flex","flex-col","items-center","gap-3"],["name","loader-2",1,"animate-spin","text-primary",3,"size"],[1,"text-sm","text-muted-foreground"],[1,"flex","flex-col","items-center","gap-3","max-w-md","text-center"],["name","alert-circle",1,"text-destructive",3,"size"],[1,"text-lg","font-semibold","text-destructive"],["hlmBtn","","variant","ghost","size","sm","type","button",3,"click"],["name","mail",1,"text-muted-foreground",3,"size"],[1,"text-lg","font-semibold","text-foreground"],[1,"overflow-x-auto"],["hlmTable","",1,"w-full"],["hlmTrHead",""],["hlmTr",""],["hlmTh",""],["hlmTrBody",""],[1,"flex","items-center","justify-between","gap-4","pt-4"],[1,"flex","gap-2"],["hlmBtn","","variant","outline","size","sm","type","button",3,"click","disabled"],["hlmTd","",1,"whitespace-nowrap"],["hlmTd",""],["hlmTd","",1,"max-w-[220px]","truncate"],["hlmBadge","","variant","secondary"],["hlmTd","",1,"max-w-[240px]","truncate"],["hlmBadge","",3,"variant"],["hlmBtn","","variant","ghost","size","sm",3,"routerLink"]],template:function(i,o){i&1&&(e(0,"div",0)(1,"div",1)(2,"div",2),p(3,"app-lucide-icon",3),e(4,"div")(5,"h1",4),n(6,"Form Submissions"),t(),e(7,"p",5),n(8," Website public form inbox (Best Fit, Contact Us, and more) "),t()()(),e(9,"button",6),u("click",function(){return o.load()}),p(10,"app-lucide-icon",7),n(11," Refresh "),t()(),e(12,"div",8)(13,"div",9)(14,"h3",10),p(15,"app-lucide-icon",11),n(16," Filters "),t()(),e(17,"div",12)(18,"div",13)(19,"div",14)(20,"label",15),n(21,"Form type"),t(),e(22,"select",16),x("ngModelChange",function(m){return C(o.formType,m)||(o.formType=m),m}),u("ngModelChange",function(){return o.onFormTypeChange()}),L(23,ge,2,2,"option",17,ue),t()(),e(25,"div",14)(26,"label",18),n(27,"Search name or email"),t(),e(28,"input",19),x("ngModelChange",function(m){return C(o.search,m)||(o.search=m),m}),u("ngModelChange",function(){return o.onFilterChange()}),t()(),E(29,Se,16,1,"div",14),e(30,"div",14)(31,"label",20),n(32,"Email status"),t(),e(33,"select",21),x("ngModelChange",function(m){return C(o.emailStatus,m)||(o.emailStatus=m),m}),u("ngModelChange",function(){return o.onFilterChange()}),e(34,"option",22),n(35,"All"),t(),e(36,"option",23),n(37,"Sent"),t(),e(38,"option",24),n(39,"Partial"),t(),e(40,"option",25),n(41,"Failed"),t(),e(42,"option",26),n(43,"Pending"),t()()()()()(),e(44,"div",8)(45,"div",9)(46,"div",2),p(47,"app-lucide-icon",27),e(48,"div")(49,"h2",28),n(50,"Website submissions"),t(),e(51,"p",29),n(52),t()()()(),e(53,"div",12),E(54,ve,5,
11,"div",30)(55,Ce,9,2,"div",30)(56,xe,7,1,"div",30)(57,ye,28,5),t()()()),i&2&&(r(3),d("size",28),r(6),d("disabled",o.loading()),r(),F("animate-spin",o.loading()),d("size",16),r(5),d("size",18),r(3),F("lg:grid-cols-4",o.showRecommendationFilter())("lg:grid-cols-3",!o.showRecommendationFilter()),r(4),v("ngModel",o.formType),r(),M(o.formTypeOptions),r(5),v("ngModel",o.search),r(),w(o.showRecommendationFilter()?29:-1),r(4),v("ngModel",o.emailStatus),r(14),d("size",24),r(5),H("",o.total()," result",o.total()===1?"":"s",""),r(2),w(o.loading()?54:o.error()?55:o.items().length===0?56:57))},dependencies:[I,le,re,ae,te,oe,ie,ne,R,k,V,j,U,B,W,A,q,G,Y,Q,X,ee,Z,$,K],encapsulation:2,changeDetection:0})};export{pe as FormSubmissionsListComponent};
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.