(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-559bbc36"],{9433:function(e,t,a){},c592:function(e,t,a){"use strict";a.r(t);var o=a("7a23");const c=e=>(Object(o["pushScopeId"])("data-v-9e46b860"),e=e(),Object(o["popScopeId"])(),e),n={class:"box"},l=c(()=>Object(o["createElementVNode"])("div",{class:"box-header"},[Object(o["createElementVNode"])("div",{class:"box-header-item"},[Object(o["createElementVNode"])("p",{class:"is-size-5 has-text-weight-bold"},"Merchant Level Overview")])],-1)),s={class:"box-body"},i={class:"box-body-item"},r={class:"company-search"},d={class:"company-search-item is-expanded"},m=c(()=>Object(o["createElementVNode"])("label",{class:"label"},"Company Name",-1)),b={class:"input is-outlined",disabled:""},p={class:"company-search-item control"},u=c(()=>Object(o["createElementVNode"])("label",{for:"",class:"label"},"From Date",-1)),_=["max"],h={class:"company-search-item control"},y=c(()=>Object(o["createElementVNode"])("label",{for:"",class:"label"},"To Date",-1)),O=["min","max"],f={class:"company-search-item"},j=["disabled"],g={class:"company-search-item"},v={key:0,class:"box-body-item"},w={class:"dropdown is-right is-hoverable"},N=c(()=>Object(o["createElementVNode"])("div",{class:"dropdown-trigger"},[Object(o["createElementVNode"])("button",{class:"button is-light is-link","aria-haspopup":"true","aria-controls":"dropdown-menu"},[Object(o["createElementVNode"])("span",null,"Export/Print"),Object(o["createElementVNode"])("span",{class:"icon is-small"},[Object(o["createElementVNode"])("i",{class:"fas fa-angle-down","aria-hidden":"true"})])])],-1)),E={class:"dropdown-menu",id:"dropdown-menu",role:"menu"},V={class:"dropdown-content"},k=c(()=>Object(o["createElementVNode"])("span",{class:"icon"},[Object(o["createElementVNode"])("i",{class:"fas fa-file-csv"})],-1)),D=Object(o["createTextVNode"])("CSV "),x=[k,D],$=c(()=>Object(o["createElementVNode"])("span",{class:"icon"},[Object(o["createElementVNode"])("i",{class:"fas fa-file-pdf"})],-1)),T=Object(o["createTextVNode"])("PDF "),C=[$,T],F=c(()=>Object(o["createElementVNode"])("hr",{class:"dropdown-divider"},null,-1)),L=c(()=>Object(o["createElementVNode"])("span",{class:"icon"},[Object(o["createElementVNode"])("i",{class:"fas fa-print"})],-1)),S=Object(o["createTextVNode"])("Print "),B=[L,S],M={key:0,class:"table-wrapper"},I={key:1,class:"box-body-item"},R={class:"is-size-6 has-text-grey-light"},P={key:0},U={key:1};function z(e,t,a,c,k,D){var $;const T=Object(o["resolveComponent"])("b-table");return Object(o["openBlock"])(),Object(o["createElementBlock"])("div",n,[l,Object(o["createElementVNode"])("div",s,[Object(o["createElementVNode"])("div",i,[Object(o["createElementVNode"])("div",r,[Object(o["createElementVNode"])("div",d,[m,Object(o["createElementVNode"])("div",b,Object(o["toDisplayString"])(e.companyName),1)]),Object(o["createElementVNode"])("div",p,[u,Object(o["withDirectives"])(Object(o["createElementVNode"])("input",{type:"date",class:"input","onUpdate:modelValue":t[0]||(t[0]=e=>k.selected_company.date_range.from=e),max:k.selected_company.date_range.to||k.today_date},null,8,_),[[o["vModelText"],k.selected_company.date_range.from]])]),Object(o["createElementVNode"])("div",h,[y,Object(o["withDirectives"])(Object(o["createElementVNode"])("input",{type:"date",class:"input","onUpdate:modelValue":t[1]||(t[1]=e=>k.selected_company.date_range.to=e),min:k.selected_company.date_range.from,max:k.today_date},null,8,O),[[o["vModelText"],k.selected_company.date_range.to]])]),Object(o["createElementVNode"])("div",f,[Object(o["createElementVNode"])("button",{class:Object(o["normalizeClass"])(["button is-primary",{"is-loading":k.table_state.is_searching}]),disabled:null===e.companyId||!k.selected_company.date_range.from||!k.selected_company.date_range.to,onClick:t[2]||(t[2]=(...e)=>D.filterOverviewDetails&&D.filterOverviewDetails(...e))}," Search ",10,j)]),Object(o["createElementVNode"])("div",g,[Object(o["createElementVNode"])("button",{class:"button is-white",onClick:t[3]||(t[3]=(...e)=>D.resetForm&&D.resetForm(...e))},"Reset")])])]),null!==($=k.table_data)&&void 0!==$&&$.length&&e.companyId>=0?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",v,[Object(o["createElementVNode"])("div",w,[N,Object(o["createElementVNode"])("div",E,[Object(o["createElementVNode"])("div",V,[Object(o["createElementVNode"])("a",{href:"#",class:"dropdown-item",onClick:t[4]||(t[4]=e=>D.exportFile("csv"))},x),Object(o["createElementVNode"])("a",{class:"dropdown-item",onClick:t[5]||(t[5]=e=>D.exportFile("pdf"))},C),F,Object(o["createElementVNode"])("a",{href:"#",class:"dropdown-item",onClick:t[6]||(t[6]=e=>D.exportFile("print"))},B)])])]),k.table_state.is_empty?Object(o["createCommentVNode"])("",!0):(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",M,[Object(o["createVNode"])(T,{ref:"table",loading:k.table_state.is_searching,config:k.table_config,box:!0,data:k.table_data,sortable:"",onSort:t[7]||(t[7]=t=>e.sortDepartments(t))},{default:Object(o["withCtx"])(({row:e})=>[Object(o["createElementVNode"])("tr",null,[Object(o["createElementVNode"])("td",null,Object(o["toDisplayString"])(e.register_count),1),Object(o["createElementVNode"])("td",null,Object(o["toDisplayString"])(e.signin_count),1),Object(o["createElementVNode"])("td",null,Object(o["toDisplayString"])(e.orders_count),1),Object(o["createElementVNode"])("td",null,Object(o["toDisplayString"])(e.documents_count),1),Object(o["createElementVNode"])("td",null,Object(o["toDisplayString"])(e.communication_count),1),Object(o["createElementVNode"])("td",null,Object(o["toDisplayString"])(e.relocate_count),1),Object(o["createElementVNode"])("td",null,Object(o["toDisplayString"])(e.new_registration_count),1),Object(o["createElementVNode"])("td",null,Object(o["toDisplayString"])(e.update_registration_count),1)])]),_:1},8,["loading","config","data"])]))])):Object(o["createCommentVNode"])("",!0),k.table_state.is_empty?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",I,[Object(o["createElementVNode"])("div",R,[k.table_state.is_searching?(Object(o["openBlock"])(),Object(o["createElementBlock"])("p",P,"Searching...")):(Object(o["openBlock"])(),Object(o["createElementBlock"])("p",U,"No result found"))])])):Object(o["createCommentVNode"])("",!0)])])}var H=a("bc3a"),Y=a.n(H),J=a("023f"),q=a("5502"),W=a("4b44"),A={components:{BTable:J["a"]},data(){return{table_data:[],currency:"$",today_date:(new Date).toISOString().slice(0,10),selected_company:{logo:"",name:"",address1:"",address2:"",id:null,date:0,date_range:{from:"",to:""}},base_file_name:"merchant_overview_",table_config:[{key:"register_count",title:"Profiles Created",class:"",width:""},{key:"signin_count",title:"Profiles SignedIn",class:"",width:""},{key:"orders_count",title:"Orders",class:"",width:""},{key:"documents_count",title:"Forms and Documents",class:"",width:""},{key:"communication_count",title:"Communication Requests",class:"",width:""},{key:"relocate_count",title:"Move-in / Move-out",class:"",width:""},{key:"new_registration_count",title:"New Registrations",class:"",width:""},{key:"update_registration_count",title:"Updated Registrations",class:"",width:""}],dates:[{value:0,label:"Today"},{value:7,label:"Last 7 Days"},{value:14,label:"Last 14 Days"},{value:30,label:"Last 30 Days"},{value:60,label:"Last 60 Days"},{value:90,label:"Last 90 Days"},{value:180,label:"Last 6 Months"},{value:365,label:"Last 1 Year"},{value:9999,label:"Custom range"}],table_state:{is_searching:!1,is_onload:!0,is_empty:!1}}},computed:{...Object(q["c"])(["companyName","companyId"])},methods:{filterOverviewDetails(){let{date:e,date_range:t}={...this.selected_company},a=this.companyId;Y.a.get(`municipality/reports/consolidated?company_id=${a}&selected_range=${e}&from_date=${null===t||void 0===t?void 0:t.from}&to_date=${null===t||void 0===t?void 0:t.to}&report_type=merchant`).then(e=>{if(0===e.data.length)return this.table_state.is_empty=!0,this.table_state.is_searching=!1,void(this.table_data=[]);this.table_data[0]=e.data,this.table_state.is_searching=!1,this.table_state.is_empty=!1}).catch(e=>{this.table_state.is_searching=!1,this.runToast(e.response.data.msg[0],!1)})},exportFile(e){let t=e.toLowerCase(),{date:a,date_range:o}={...this.selected_company},c=this.companyId;switch(t){case"csv":Y.a.get(`municipality/reports/export?to=${e}&report_name=consolidated&company_id=${c}&selected_range=${a}&from_date=${null===o||void 0===o?void 0:o.from}&to_date=${null===o||void 0===o?void 0:o.to}&from_user=municipality`,{responseType:"arraybuffer"}).then(e=>{let t=new Blob([e.data],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),a=document.createElement("a");a.href=window.URL.createObjectURL(t),a.download=this.getDownloadFilename("csv"),a.click()}).catch(e=>{403===e.response.status&&this.runToast("You are not authorized to perform this action",!1)});break;case"pdf":Y.a.get(`municipality/reports/export?to=${e}&report_name=consolidated&company_id=${c}&selected_range=${a}&from_date=${null===o||void 0===o?void 0:o.from}&to_date=${null===o||void 0===o?void 0:o.to}&from_user=municipality`,{responseType:"arraybuffer"}).then(e=>{let t=new Blob([e.data],{type:"application/pdf"}),a=document.createElement("a");a.href=window.URL.createObjectURL(t),a.download=this.getDownloadFilename("pdf"),a.click()}).catch(e=>{403===e.response.status&&this.runToast("You are not authorized to perform this action",!1)});break;case"print":Y.a.get(`municipality/reports/export?to=${e}&report_name=consolidated&company_id=${c}&selected_range=${a}&from_date=${null===o||void 0===o?void 0:o.from}&to_date=${null===o||void 0===o?void 0:o.to}&from_user=municipality`,{responseType:"arraybuffer"}).then(e=>{this.printDownloadedPDF(e.data)}).catch(e=>{403===e.response.status&&this.runToast("You are not authorized to perform this action",!1)});break;default:break}},runToast(e,t){W["toast"]({position:"top-center",message:e,type:t?"is-success":"is-danger",closeOnClick:!0,pauseOnHover:!0,opacity:1,duration:5e3})},resetForm(){this.search_filter="",this.table_state={is_searching:!1,is_onload:!0,is_empty:!1},this.date_range={from:null,to:null},this.selected_company={logo:"",name:"",address:"",id:null,date:0,date_range:{from:"",to:""}},this.table_data=[]},downloadPDF(){this.outerHTML=this.$refs.table.$el.outerHTML,this.$nextTick(()=>{this.$refs.downloadPDF.run(),this.outerHTML=null})},printDownloadedPDF(e){var t=new Blob([e],{type:"application/pdf"}),a=URL.createObjectURL(t);let o=document.createElement("iframe");document.body.appendChild(o),o.style.display="none",o.src=a,o.onload=function(){setTimeout((function(){o.focus(),o.contentWindow.print()}),1)}},getDownloadFilename(e){let t,a=new Date,o=a.getDate(),c=a.getMonth()+1,n=a.getFullYear(),l=a.getHours(),s=a.getMinutes();switch(e){case"csv":t=this.base_file_name+c+"_"+o+"_"+n+"_"+l+"_"+s+"."+e;break;case"pdf":t=this.base_file_name+c+"_"+o+"_"+n+"_"+l+"_"+s;break;default:break}return t}}},G=(a("fcd7"),a("6b0d")),K=a.n(G);const Q=K()(A,[["render",z],["__scopeId","data-v-9e46b860"]]);t["default"]=Q},fcd7:function(e,t,a){"use strict";a("9433")}}]);