1import{a as D,b as _}from"./chunk-BR76FPYH.js";import"./chunk-YXQDB7OZ.js";import{a as T}from"./chunk-V3EWXRVW.js";import"./chunk-OZE2ZF3K.js";import"./chunk-GFNC4BR6.js";import"./chunk-P43N2WSC.js";import"./chunk-BEMEOE3T.js";import"./chunk-3CRMQN4H.js";import"./chunk-IKZGUT6V.js";import"./chunk-OQVWGQGP.js";import{a as f,b as u}from"./chunk-AIPAFGDF.js";import"./chunk-EY4MG7NF.js";import{c as L}from"./chunk-YKLYEIJW.js";import{a as y}from"./chunk-BAF42QJH.js";import{b}from"./chunk-P7FHJ2SR.js";import"./chunk-DUKSTT3K.js";import"./chunk-LT4OIP3L.js";import"./chunk-CRMXGBPR.js";import"./chunk-TUADE3SK.js";import{$ as a,$a as l,B as o,Nb as r,Ob as c,Pb as d,Qb as m,ad as h,bc as p,rb as g}from"./chunk-VUZ2JQ7U.js";import"./chunk-JGDRNPQP.js";var C=class s{subs=new y;isLoading=!1;filter={search:"",training:[],category:[],from_date:"",to_date:""};tableLimit=10;page=1;totalCount;trainingLeadList=[];tableSettings=[];categoryOptions=L;filterOption={filter:!0,column:!1,action:!0,search:!0,sort:!0,export:!0};cdr=a(h);trainingService=a(T);commonService=a(u);toast=a(b);download=a(f);ngOnInit(){window.scrollTo({top:0,behavior:"smooth"}),this.isLoading=!0,this.activeTableSettings(),this.loadTableData(),this.getTrainingList()}activeTableSettings(){this.tableSettings=[{key:"full_name",title:"Name",type:"custom"},{key:"email",title:"Email",type:"custom"},{key:"company",title:"Company",type:"custom"},{key:"training_title",title:"Training Name",type:"custom"},{key:"training",title:"Training Name",type:"custom",filterType:"select",filterData:[],filterDataList:[],filterNameField:"title",selectData:[],check:!1},{key:"category",title:"Category Name",type:"custom",filterType:"select",filterData:[],filterDataList:[],filterNameField:"name",selectData:this.categoryOptions,check:!1},{key:"phone",title:"Phone Number",type:"custom"},{key:"created_date",title:"Created Date",type:"date"},{key:"from_date",title:"Created From",filterType:"date",filterData:"",filterNameField:"name",selectData:[],check:!1},{key:"to_date",title:"Created To",filterType:"date",filterData:"",filterNameField:"name",selectData:[],check:!1}]}getTrainingList(){let t={pagination_type:"none"};this.subs.add(this.trainingService.getTrainingListApi(t).subscribe(e=>{e&&this.commonService.assignTableFilterDropOption(this.tableSettings,"training",e),this.cdr.detectChanges()}))}loadTableData(){this.isLoading=!0;let t={search:this.filter?.search??"",limit:this.tableLimit,offset:(this.page-1)*this.tableLimit,category:this.filter?.category?.length?this.filter?.category:"",training:this.filter?.training?.length?this.filter?.training:"",from_date:this.filter?.from_date??"",to_date:this.filter?.to_date??""};this.subs.add(this.trainingService.getTrainingLeadListApi(t).pipe(o(()=>(this.isLoading=!1,this.cdr.detectChanges(),""))).subscribe(e=>{e?(this.totalCount=this.commonService.getTableTotalPageCount(e?.count,this.tableLimit),this.isLoading=!1,e?.results?.forEach(i=>{i.phone=`${i?.code} ${i?.phone_no}`}),this.trainingLeadList=e?.results??[],this.cdr.detectChanges()):(this.trainingLeadList=[],this.isLoading=!1)}))}pageChange(t){t?.action==="page"?this.page=t?.page:(this.tableLimit=t?.pageLimit,this.page=1),this.loadTableData()}filterChange(t){switch(t?.type){case"filter":this.page=1,this.filter.search=t?.filteredData?.q||"",this.filter.category=t?.filteredData?.category||[],this.filter.training=t?.filteredData?.training||[],this.filter.from_date=t?.otherFilterArray?.from_date||"",this.filter.to_date=t?.otherFilterArray?.to_date||"",this.loadTableData();break;case"search":this.page=1,this.filter.search=t?.filteredData?.q||"",this.loadTableData();break;case"export":this.exportTableData();break;default:break}}exportTableData(){let t={search:this.filter?.search??"",limit:this.tableLimit,offset:(this.page-1)*this.tableLimit,category:this.filter?.category?.length?this.filter?.category:"",training:this.filter?.training?.length?this.filter?.training:"",from_date:this.filter?.from_date??"",to_date:this.filter?.to_date??"",export_format:"excel"};this.subs.add(this.trainingService.getTrainingLeadListExportApi(t).subscribe(e=>{this.download.createATagAndClickDownload(e?.data,{name:e?.filename}),this.toast.success(`${e?.filename} downloaded successfully!`)}))}ngOnDestroy(){this.subs.unsubscribe()}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=g({type:s,selectors:[["bnx-training-leads"]],decls:2,vars:6,consts:[[3,"title"],[3,"pageChange","filterChange","isLoading","tableData","tableDataSettings","totalCount","filterOption"]],template:function(e,i){e&1&&(m(0,"bnx-admin-common-heading",0),c(1,"bnx-table-view",1),p("pageChange",function(n){return i.pageChange(n)})("filterChange",function(n){return i.filterChange(n)}),d()),e&2&&(r("title","Training Lead List"),l(),r("isLoading",i.isLoading)("tableData",i.trainingLeadList)("tableDataSettings",i.tableSettings)("totalCount",i.totalCount)("filterOption",i.filterOption))},dependencies:[_,D],encapsulation:2})};export{C as TrainingLeadsComponent};
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.