관리-도구
편집 파일: Inactive_Customers_Report.1a5c97a32ce998b7.js
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[1015],{33490:(t,e,r)=>{r.r(e),r.d(e,{default:()=>u});var a=r(5947),s=r.n(a);function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,a)}return r}function i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach((function(e){l(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function l(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var a=r.call(t,e||"default");if("object"!=n(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const c={metaInfo:{title:"Inactive Customers Report"},data:function(){return{isLoading:!0,serverParams:{sort:{field:"days_inactive",type:"desc"},page:1,perPage:10},limit:"10",search:"",totalRows:0,clients:[],rows:[{total_sales:"Total",children:[]}],period:30,periodOptions:[{value:30,text:this.$t("Last_30_days")},{value:60,text:this.$t("Last_60_days")},{value:90,text:this.$t("Last_90_days")}]}},computed:i(i({},(0,r(95353).L8)(["currentUser"])),{},{columns:function(){return[{label:this.$t("CustomerName"),field:"name",tdClass:"text-left",thClass:"text-left",sortable:!0},{label:this.$t("Phone"),field:"phone",tdClass:"text-left",thClass:"text-left",sortable:!0},{label:this.$t("TotalSales"),field:"total_sales",type:"number",headerField:this.sumCountSales,tdClass:"text-left",thClass:"text-left",sortable:!0},{label:this.$t("LastPurchase"),field:"last_sale_at",tdClass:"text-left",thClass:"text-left",sortable:!0},{label:this.$t("DaysInactive"),field:"days_inactive",type:"number",tdClass:"text-left",thClass:"text-left",sortable:!0},{label:this.$t("Action"),field:"actions",html:!0,tdClass:"text-right",thClass:"text-right",sortable:!1}]}}),methods:{sumCountSales:function(t){var e=0;if(!t||!t.children||!Array.isArray(t.children))return e;for(var r=0;r<t.children.length;r++){var a=t.children[r].total_sales;"number"==typeof a&&(e+=a)}return e},Download_PDF:function(t,e){s().start(),s().set(.1),axios.get("report/client_pdf/"+e,{responseType:"blob",headers:{"Content-Type":"application/json"}}).then((function(e){var r=window.URL.createObjectURL(new Blob([e.data])),a=document.createElement("a");a.href=r,a.setAttribute("download","report-"+t.name+".pdf"),document.body.appendChild(a),a.click(),setTimeout((function(){return s().done()}),500)})).catch((function(){return setTimeout((function(){return s().done()}),500)}))},updateParams:function(t){this.serverParams=Object.assign({},this.serverParams,t)},onPageChange:function(t){var e=t.currentPage;this.serverParams.page!==e&&(this.updateParams({page:e}),this.Get_Inactive_Customers_Report(e))},onPerPageChange:function(t){var e=t.currentPerPage;this.limit!==e&&(this.limit=e,this.updateParams({page:1,perPage:e}),this.Get_Inactive_Customers_Report(1))},onSortChange:function(t){this.updateParams({sort:{type:t[0].type,field:t[0].field}}),this.Get_Inactive_Customers_Report(this.serverParams.page)},onSearch:function(t){this.search=t.searchTerm,this.Get_Inactive_Customers_Report(this.serverParams.page)},Get_Inactive_Customers_Report:function(t){var e=this;s().start(),s().set(.1),axios.get("report/inactive_customers?page="+t+"&SortField="+this.serverParams.sort.field+"&SortType="+this.serverParams.sort.type+"&search="+encodeURIComponent(this.search||"")+"&limit="+this.limit+"&period="+this.period).then((function(t){e.clients=t.data.report,e.totalRows=t.data.totalRows,e.rows[0].children=e.clients,s().done(),e.isLoading=!1})).catch((function(){s().done(),setTimeout((function(){e.isLoading=!1}),500)}))},onPeriodChange:function(){this.updateParams({page:1}),this.Get_Inactive_Customers_Report(1)},formatNumber:function(t,e){var r=("string"==typeof t?t:t.toString()).split(".");if(e<=0)return r[0];var a=r[1]||"";if(a.length>e)return"".concat(r[0],".").concat(a.substr(0,e));for(;a.length<e;)a+="0";return"".concat(r[0],".").concat(a)}},created:function(){this.Get_Inactive_Customers_Report(1)}};const u=(0,r(14486).A)(c,(function(){var t=this,e=t._self._c;return e("div",{staticClass:"main-content"},[e("breadcumb",{attrs:{page:t.$t("Inactive_Customers_Report"),folder:t.$t("Reports")}}),t._v(" "),t.isLoading?e("div",{staticClass:"loading_page spinner spinner-primary mr-3"}):t._e(),t._v(" "),t.isLoading?t._e():e("b-card",{staticClass:"wrapper"},[e("div",{staticClass:"d-flex align-items-center mb-2"},[e("label",{staticClass:"mb-0 mr-2"},[t._v(t._s(t.$t("Period"))+":")]),t._v(" "),e("b-form-select",{staticClass:"w-auto",attrs:{options:t.periodOptions,size:"sm"},on:{change:t.onPeriodChange},model:{value:t.period,callback:function(e){t.period=e},expression:"period"}})],1),t._v(" "),e("vue-good-table",{attrs:{mode:"remote",columns:t.columns,totalRows:t.totalRows,rows:t.rows,"group-options":{enabled:!0,headerPosition:"bottom"},"search-options":{placeholder:t.$t("Search_this_table"),enabled:!0},"pagination-options":{enabled:!0,mode:"records",nextLabel:"next",prevLabel:"prev"},styleClass:"tableOne table-hover vgt-table mt-3"},on:{"on-page-change":t.onPageChange,"on-per-page-change":t.onPerPageChange,"on-sort-change":t.onSortChange,"on-search":t.onSearch},scopedSlots:t._u([{key:"table-row",fn:function(r){return["last_sale_at"===r.column.field?e("span",[t._v("\n "+t._s(r.row.last_sale_at?r.row.last_sale_at:"—")+"\n ")]):"days_inactive"===r.column.field?e("span",[r.row.last_sale_at?e("span",[t._v(t._s(r.row.days_inactive))]):e("b-badge",{attrs:{variant:"warning"}},[t._v("\n "+t._s(t.$t("Never_Purchased"))+"\n ")])],1):"actions"===r.column.field?e("span",[e("router-link",{attrs:{title:"Report",to:"/app/reports/detail_customer/"+r.row.id}},[e("i",{staticClass:"i-Eye text-25 text-info"})])],1):e("span",[t._v("\n "+t._s(r.formattedRow[r.column.field])+"\n ")])]}}],null,!1,1271655972)})],1)],1)}),[],!1,null,null,null).exports}}]);