(window.webpackJsonp=window.webpackJsonp||[]).push([[36,133,145],{295:function(t,e,r){"use strict";r.r(e);var n=r(0),o=r(2);r(8),r(35),r(10);function l(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function c(t){for(var e=1;e({items:[],pagination:{},fetching:!0,itemCreatedMessage:"¡Enviado correctamente!",itemUpdatedMessage:"¡Actualizado correctamente!"}),watchQuery:["page","s"],methods:{onItemCreated(data){this.$notify(this.itemCreatedMessage),this.items.unshift(data),this.items.length>this.pagination.per_page&&(this.pagination.current_page===this.pagination.last_page&&this.pagination.last_page++,this.items.splice(this.items.length-1,1))},onItemUpdated(t){var{item:e,data:data}=t;this.$notify(this.itemUpdatedMessage),Object.assign(e,data)},onItemDeleted(t){var{item:e,index:r}=t;this.pagination.total--,this.items.splice(r,1);var{current_page:n,last_page:o,per_page:l}=this.pagination;n===o&&this.pagination.to--,n1&&this.updateQueryString(c(c({},this.$route.query),{},{page:n-1}))},onPaginate(t){var e;this.fetching="start"===t.status,null!==(e=t.data)&&void 0!==e&&e.data&&(this.items=t.data.data,this.pagination=t.data.meta)},updateQueryString(t){var e=arguments,r=this;return Object(n.a)(function*(){var n={};for(var o of t=Array.isArray(t)?t:[...e])"object"==typeof o?Object.assign(n,o):n[o]=r[o]||void 0;r.fetching=!0;try{yield r.$router.push({name:r.$route.name,query:n})}catch(t){}})()},fetchItems(t){var e=this;return Object(n.a)(function*(){e.fetching=!0;try{var data=yield e.$axios.$get(e.serverAction,{params:t});e.items=data.data,e.pagination=data.meta}catch(t){}e.fetching=!1})()}}}},346:function(t,e,r){"use strict";r.r(e);r(19);var n=r(4),o={mixins:[r(87).default],props:{format:{type:String,default:()=>"pdf",validator:t=>["xlsx","pdf"].includes(t)}},data:t=>({type:"all",form:t.$vform.make({format:null,init_date:"",end_date:"",include_products:1})}),computed:{formIsValid(){return"all"===this.type||Boolean(this.form.init_date&&this.form.end_date)},title(){return"xlsx"===this.format?"Exportar Excel Seleccione una opción":"Exportar PDF"},method:()=>"get",action:()=>"/admin/orders/report"},watch:{format:{immediate:!0,handler:function(t){this.form.format=t,"pdf"===t&&(this.type="range")}},type(t){this.form.init_date="",this.form.end_date=""}},methods:{onFormSuccess(t){Object(n.e)(t),this.$notify({timeout:1e4,message:"Reporte generado, su archivo se descargará automaticamente."}),this.clearForm()},onFormFailed(t){var e;409===(null==t||null===(e=t.response)||void 0===e?void 0:e.status)&&this.$notify({color:"error",message:"No hay elementos para mostrar."})}}},l=r(1),component=Object(l.a)(o,function(){var t=this,e=t._self._c;return e("app-form",t._g({attrs:{"use-blob":"",form:t.form,title:t.title,action:t.action,method:t.method,readonly:t.readonly,disabled:t.form.busy},on:{success:t.onFormSuccess,cancel:t.onFormCancelled,failed:t.onFormFailed},scopedSlots:t._u([{key:"actions.save",fn:function(){return[e("v-btn",{attrs:{dark:"",small:"",color:"green",type:"submit",disabled:!t.formIsValid,loading:t.form.busy}},[t._v("\n Enviar\n ")])]},proxy:!0}],null,!0)},t.$listeners),[e("v-col",{staticClass:"pa-1",attrs:{cols:"12",md:"4"}},[e("v-checkbox",{attrs:{color:"red","hide-details":"","true-value":1,"false-value":0,label:"Incluir productos en el reporte"},model:{value:t.form.include_products,callback:function(e){t.$set(t.form,"include_products",e)},expression:"form.include_products"}})],1),t._v(" "),"pdf"!==t.form.format?e("v-col",{staticClass:"pa-1",attrs:{cols:"12",md:"4"}},[e("v-radio-group",{attrs:{row:""},model:{value:t.type,callback:function(e){t.type=e},expression:"type"}},[e("v-radio",{attrs:{label:"Todo",value:"all"}}),t._v(" "),e("v-radio",{attrs:{label:"Rango de Fecha",value:"range"}})],1)],1):t._e(),t._v(" "),e("v-col",{staticClass:"pa-0",attrs:{cols:"12"}}),t._v(" "),"range"===t.type?[e("v-col",{staticClass:"pa-1",attrs:{cols:"12",md:"6"}},[e("app-date-input",{attrs:{label:"Fecha de inicio",outlined:!1,readonly:t.readonly,error:t.form.errors.has("init_date"),"error-messages":t.form.errors.get("init_date")},model:{value:t.form.init_date,callback:function(e){t.$set(t.form,"init_date",e)},expression:"form.init_date"}})],1),t._v(" "),e("v-col",{staticClass:"pa-1",attrs:{cols:"12",md:"6"}},[e("app-date-input",{attrs:{label:"Fecha de final",outlined:!1,readonly:t.readonly,error:t.form.errors.has("end_date"),"error-messages":t.form.errors.get("end_date")},model:{value:t.form.end_date,callback:function(e){t.$set(t.form,"end_date",e)},expression:"form.end_date"}})],1)]:t._e()],2)},[],!1,null,null,null);e.default=component.exports},426:function(t,e,r){"use strict";r.r(e);var n=r(2),o=r(0),l=(r(8),r(43),r(305),r(55),r(707),r(10),r(681)),c=r(346),d=r(295);function m(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function v(t){for(var e=1;eObject(o.a)(function*(){var{$axios:e,query:r}=t,n=r.status||null,o=r.origin||null,c=r.medio_pago||null,d=r.date_from||null,m=r.date_to||null;try{var{data:{data:v,meta:h}}=yield e.get("/admin/orders",{params:r});return{items:v.map(t=>new l.a(t)),pagination:h,fetching:!1,selectedStatus:n,selectedOrigin:o,selectedPaymentMethod:c,selectedDateFrom:d,selectedDateTo:m}}catch(t){}return{fetching:!1,selectedStatus:n,selectedOrigin:o,selectedPaymentMethod:c,selectedDateFrom:d,selectedDateTo:m}})(),data:()=>({exporting:null,dialogReport:!1,serverAction:"/admin/orders",selectedStatus:null,selectedOrigin:null,selectedPaymentMethod:null,selectedDateFrom:null,selectedDateTo:null,orderStatuses:[{value:null,label:"Todos"}].concat(Object.values(l.a.STATUSES)),orderOrigins:[{value:null,label:"Todos"},{value:"web",label:"Web"},{value:"price-list",label:"Lista de precios"},{value:"callcenter",label:"Call center"},{value:"webbox",label:"Webbox"}],paymentMethods:[{value:null,label:"Todos"},{value:"flow",label:"Flow"},{value:"transfer",label:"Transferencia"},{value:"etpay",label:"Etpay"}],headers:[{text:"ID",value:"id",width:80},{text:"Fecha Pedido",value:"created_at"},{text:"Cliente",value:"cliente"},{text:"Entrega",value:"fechaent"},{text:"Comuna / Direccion",value:"comunaenvio"},{text:"Origen",value:"origin",sortable:!1},{text:"Pago",value:"medio_pago",sortable:!1},{text:"Cupón",value:"coupon",sortable:!1},{text:"Total",value:"total",align:"end"},{text:"Estado",value:"status",sortable:!1}]}),head:()=>({title:"Pedidos"}),computed:{dialogWith(){return this.$isMobile()?"100%":"70%"},chartHeight(){return this.$vuetify.breakpoint.smAndDown?250:280},totalOnPage(){return this.items.reduce((t,e)=>t+Number(e.total||0),0)},couponOrdersCount(){return this.items.filter(t=>this.hasCoupon(t)).length},couponSavingsOnPage(){return this.items.reduce((t,e)=>t+this.couponBenefit(e),0)},statusCounts(){return this.items.reduce((t,e)=>{var r=null==e?void 0:e.status;return t[r]||(t[r]=0),t[r]+=1,t},{billed:0,pending:0,denied:0,cancelled:0,not_processed:0})},statusChartSeries(){return[{name:"Pedidos",data:this.statusChartRows.map(t=>t.value)}]},statusChartHasData(){return this.statusChartRows.some(t=>Number(t.value||0)>0)},statusChartRows(){return[{key:"billed",label:"Pagados",value:this.statusCounts.billed},{key:"pending",label:"Pendientes",value:this.statusCounts.pending},{key:"cancelled",label:"Anulados",value:this.statusCounts.cancelled},{key:"denied",label:"Cancelados",value:this.statusCounts.denied},{key:"not_processed",label:"Sin proc.",value:this.statusCounts.not_processed}]},statusChartOptions(){return{chart:{type:"bar",toolbar:{show:!1}},colors:["#0d6a8a"],plotOptions:{bar:{horizontal:!0,borderRadius:4,barHeight:"55%"}},xaxis:{categories:this.statusChartRows.map(t=>t.label),labels:{formatter:t=>this.number(t)}},dataLabels:{enabled:!0,formatter:t=>this.number(t)},grid:{borderColor:"#e6eef2",strokeDashArray:4},tooltip:{y:{formatter:t=>"".concat(this.number(t)," pedidos")}}}},paymentChartRows(){var t=this.items.reduce((t,e)=>{var r=(null==e?void 0:e.medio_pago)||"unknown";return t[r]=(t[r]||0)+1,t},{});return Object.keys(t).map(e=>({key:e,label:this.paymentMethodLabel(e),value:t[e]}))},paymentChartSeries(){return this.paymentChartRows.map(t=>t.value)},paymentChartHasData(){return this.paymentChartSeries.some(t=>Number(t||0)>0)},paymentChartOptions(){return{labels:this.paymentChartRows.map(t=>t.label),chart:{type:"donut",toolbar:{show:!1}},colors:["#0d6a8a","#2f80ed","#7e57c2","#26a69a","#78909c"],legend:{position:"bottom",horizontalAlign:"center",fontSize:"12px",itemMargin:{horizontal:10,vertical:4}},stroke:{width:1,colors:["#ffffff"]},dataLabels:{enabled:!0,formatter:t=>"".concat(Math.round(t),"%")},plotOptions:{pie:{customScale:.9,donut:{size:"58%",labels:{show:!0,total:{show:!0,label:"Pedidos",formatter:()=>this.number(this.items.length)}}}}},tooltip:{y:{formatter:t=>"".concat(this.number(t)," pedidos")}},noData:{text:"Sin datos"}}},salesByDayRows(){var t=this.items.reduce((t,e)=>{var r=this.dateKey(e.created_at);return r?(t[r]=(t[r]||0)+Number(e.total||0),t):t},{});return Object.keys(t).sort((a,b)=>new Date(a)-new Date(b)).map(e=>({key:e,value:t[e]}))},salesByDayChartSeries(){return[{name:"Ventas",data:this.salesByDayRows.map(t=>Number(t.value||0))}]},salesByDayChartHasData(){return this.salesByDayChartSeries[0].data.some(t=>Number(t||0)>0)},salesByDayChartOptions(){return{chart:{type:"area",toolbar:{show:!1},zoom:{enabled:!1}},colors:["#00897b"],stroke:{curve:"smooth",width:3},fill:{type:"gradient",gradient:{shadeIntensity:1,opacityFrom:.35,opacityTo:.05,stops:[0,90,100]}},xaxis:{categories:this.salesByDayRows.map(t=>this.shortDate(t.key))},yaxis:{labels:{formatter:t=>this.$toCurrency(t||0)}},dataLabels:{enabled:!1},tooltip:{y:{formatter:t=>this.$toCurrency(t||0)}},noData:{text:"Sin ventas para graficar"}}},activeFilterChips(){var t=[];return this.selectedStatus&&t.push({key:"status",text:"Estado: ".concat(this.statusLabel(this.selectedStatus))}),this.selectedOrigin&&t.push({key:"origin",text:"Origen: ".concat(this.originLabel(this.selectedOrigin))}),this.selectedPaymentMethod&&t.push({key:"payment",text:"Pago: ".concat(this.paymentMethodLabel(this.selectedPaymentMethod))}),this.selectedDateFrom&&t.push({key:"date_from",text:"Desde: ".concat(this.selectedDateFrom)}),this.selectedDateTo&&t.push({key:"date_to",text:"Hasta: ".concat(this.selectedDateTo)}),t}},watchQuery:[...d.default.watchQuery,"status","origin","medio_pago","date_from","date_to"],methods:{openReportDialog(t){this.exporting=t,this.dialogReport=!0},clear(){this.dialog=!1,this.dialogReport=!1,this.item=null,this.exporting=null},number:t=>Number(t||0).toLocaleString("es-CL"),statusLabel(t){var e;return(null===(e=l.a.STATUSES[t])||void 0===e?void 0:e.label)||"Sin estado"},statusColor(t){switch(t){case"billed":return"green";case"pending":return"orange";case"denied":return"deep-orange";case"cancelled":return"red";case"not_processed":return"blue-grey";default:return"grey"}},paymentMethodLabel:t=>({flow:"Flow",transfer:"Transferencia",etpay:"Etpay"}[t]||(t?t.toString().toUpperCase():"Sin dato")),paymentMethodColor:t=>({flow:"teal",transfer:"indigo",etpay:"purple"}[t]||"blue-grey"),originLabel:t=>({web:"Web","price-list":"Lista precios",callcenter:"Call center",webbox:"Webbox"}[t]||t||"Sin dato"),originColor:t=>({web:"cyan darken-2","price-list":"blue darken-2",callcenter:"deep-purple",webbox:"brown"}[t]||"blue-grey"),formatDeliveryDate(t){return t?this.str_to_date(t):"--"},deliverySlot:t=>t.am?"AM":t.pm?"PM":"--",hasCoupon(t){return Boolean(this.couponCode(t))},couponCode:t=>(null==t?void 0:t.discount_code)||(null==t?void 0:t.coddesc)||null,couponBenefit(t){var e=Number((null==t?void 0:t.discountAmount)||(null==t?void 0:t.discount_amount)||0);return Number.isFinite(e)?Math.max(e,0):0},couponBenefitLabel(t){if(!this.hasCoupon(t))return"Sin cupón aplicado";var e=this.couponBenefit(t);return e>0?"Ahorro ".concat(this.$toCurrency(e)):"Cupón aplicado"},dateKey(t){if(!t)return null;var e=new Date(t);return Number.isNaN(e.getTime())?null:e.toISOString().slice(0,10)},shortDate(t){var e=new Date(t);if(Number.isNaN(e.getTime()))return t||"--";var r=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0");return"".concat(r,"/").concat(n)},sendOrderEmailNotification(t){var e=this;return Object(o.a)(function*(){try{yield e.$swal.confirm({method:"get",url:"/admin/orders/".concat(t.id,"/send-summary-notificacion"),title:"¿Esta seguro?",text:"De reenviar el correo del pedido N° ".concat(t.id)})}catch(t){}})()},buildFiltersQuery(){return v(v({},this.$route.query),{},{page:1,status:this.selectedStatus||void 0,origin:this.selectedOrigin||void 0,medio_pago:this.selectedPaymentMethod||void 0,date_from:this.selectedDateFrom||void 0,date_to:this.selectedDateTo||void 0})},onFilter(t){return this.fetching=!0,this.$router.push({name:this.$route.name,query:this.buildFiltersQuery()}).then(()=>{"function"==typeof t&&t()}).catch(()=>{this.fetching=!1})},clearFilters(t){return this.selectedStatus=null,this.selectedOrigin=null,this.selectedPaymentMethod=null,this.selectedDateFrom=null,this.selectedDateTo=null,this.onFilter(t)},removeFilter(t){return"status"===t&&(this.selectedStatus=null),"origin"===t&&(this.selectedOrigin=null),"payment"===t&&(this.selectedPaymentMethod=null),"date_from"===t&&(this.selectedDateFrom=null),"date_to"===t&&(this.selectedDateTo=null),this.onFilter()},onPaginate(t){var e;this.fetching="start"===t.status,null!==(e=t.data)&&void 0!==e&&e.data&&(this.items=t.data.data.map(t=>new l.a(t)),this.pagination=t.data.meta)}}},f=(r(843),r(1)),component=Object(f.a)(h,function(){var t=this,e=t._self._c;return e("div",{staticClass:"orders-page"},[e("v-row",{staticClass:"mb-2"},[e("v-col",{attrs:{cols:"12",sm:"6",lg:"3"}},[e("v-card",{staticClass:"summary-card",attrs:{outlined:""}},[e("v-card-text",[e("div",{staticClass:"summary-label"},[t._v("\n Pedidos visibles\n ")]),t._v(" "),e("div",{staticClass:"summary-value"},[t._v("\n "+t._s(t.number(t.items.length))+"\n ")]),t._v(" "),e("div",{staticClass:"summary-caption"},[t._v("\n De "+t._s(t.number(t.pagination.total||0))+" registros totales\n ")])])],1)],1),t._v(" "),e("v-col",{attrs:{cols:"12",sm:"6",lg:"3"}},[e("v-card",{staticClass:"summary-card",attrs:{outlined:""}},[e("v-card-text",[e("div",{staticClass:"summary-label"},[t._v("\n Monto visible\n ")]),t._v(" "),e("div",{staticClass:"summary-value"},[t._v("\n "+t._s(t.$toCurrency(t.totalOnPage))+"\n ")]),t._v(" "),e("div",{staticClass:"summary-caption"},[t._v("\n Suma de la pagina actual\n ")])])],1)],1),t._v(" "),e("v-col",{attrs:{cols:"12",sm:"6",lg:"3"}},[e("v-card",{staticClass:"summary-card",attrs:{outlined:""}},[e("v-card-text",[e("div",{staticClass:"summary-label"},[t._v("\n Pagados visibles\n ")]),t._v(" "),e("div",{staticClass:"summary-value green--text text--darken-2"},[t._v("\n "+t._s(t.number(t.statusCounts.billed))+"\n ")]),t._v(" "),e("div",{staticClass:"summary-caption"},[t._v("\n Pedidos con estado pagado\n ")])])],1)],1),t._v(" "),e("v-col",{attrs:{cols:"12",sm:"6",lg:"3"}},[e("v-card",{staticClass:"summary-card",attrs:{outlined:""}},[e("v-card-text",[e("div",{staticClass:"summary-label"},[t._v("\n Pendientes / incidencias\n ")]),t._v(" "),e("div",{staticClass:"summary-value orange--text text--darken-2"},[t._v("\n "+t._s(t.number(t.statusCounts.pending+t.statusCounts.cancelled+t.statusCounts.denied+t.statusCounts.not_processed))+"\n ")]),t._v(" "),e("div",{staticClass:"summary-caption"},[t._v("\n Pendiente, anulado, cancelado o sin procesar\n ")])])],1)],1),t._v(" "),e("v-col",{attrs:{cols:"12",sm:"6",lg:"3"}},[e("v-card",{staticClass:"summary-card",attrs:{outlined:""}},[e("v-card-text",[e("div",{staticClass:"summary-label"},[t._v("\n Pedidos con cupón\n ")]),t._v(" "),e("div",{staticClass:"summary-value indigo--text text--darken-2"},[t._v("\n "+t._s(t.number(t.couponOrdersCount))+"\n ")]),t._v(" "),e("div",{staticClass:"summary-caption"},[t._v("\n Ahorro visible: "+t._s(t.$toCurrency(t.couponSavingsOnPage))+"\n ")])])],1)],1)],1),t._v(" "),e("app-data-table",{attrs:{name:"orders",items:t.items,"item-name":"order",headers:t.headers,loading:t.fetching,heading:"Pedidos",actions:["show"],pagination:t.pagination,"server-action":t.serverAction,"dialog-form-component-path":"auth/OrderDetails","dialog-form-props":{width:t.dialogWith},filters:{enabled:!0,menu:{bottom:!0}}},on:{paginating:t.onPaginate,"item-created":t.onItemCreated,"item-updated":t.onItemUpdated,"item-deleted":t.onItemDeleted},scopedSlots:t._u([{key:"append-top-actions",fn:function(){return[e("v-chip",{staticClass:"mr-2 mb-1",attrs:{small:"",outlined:"",color:"fishboxColor"}},[t._v("\n Total registros: "+t._s(t.pagination.total||0)+"\n ")]),t._v(" "),t._l(t.activeFilterChips,function(r){return e("v-chip",{key:r.key,staticClass:"mr-2 mb-1",attrs:{small:"",close:"",outlined:"",color:"blue-grey"},on:{"click:close":function(e){return t.removeFilter(r.key)}}},[t._v("\n "+t._s(r.text)+"\n ")])}),t._v(" "),e("v-btn",{staticClass:"mb-1",attrs:{dark:"",small:"",color:"green"},on:{click:function(e){return t.openReportDialog("xlsx")}}},[e("v-icon",{staticClass:"mr-1"},[t._v("\n fas fa-file-excel\n ")]),t._v(" "),e("strong",[t._v("\n Excel\n ")])],1),t._v(" "),e("v-btn",{staticClass:"mx-1 mb-1",attrs:{dark:"",small:"",color:"red"},on:{click:function(e){return t.openReportDialog("pdf")}}},[e("v-icon",{staticClass:"mr-1"},[t._v("\n fas fa-file-pdf\n ")]),t._v(" "),e("strong",[t._v("\n PDF\n ")])],1)]},proxy:!0},{key:"item.id",fn:function(r){var{item:n}=r;return[e("v-chip",{staticClass:"font-weight-bold",attrs:{"x-small":"",outlined:"",color:"fishboxColor"}},[t._v("\n #"+t._s(n.id)+"\n ")])]}},{key:"item.created_at",fn:function(e){var{item:r}=e;return[t._v("\n "+t._s(t.str_to_date(r.created_at,"created_at"))+"\n ")]}},{key:"item.cliente",fn:function(r){var{item:n}=r;return[e("div",{staticClass:"font-weight-medium"},[t._v("\n "+t._s(n.cliente||"Sin nombre")+"\n ")]),t._v(" "),e("div",{staticClass:"text-caption blue-grey--text text--darken-1"},[t._v("\n "+t._s(n.telefono||"--")+"\n ")]),t._v(" "),e("div",{staticClass:"text-caption blue-grey--text text--darken-1 text-truncate order-email"},[t._v("\n "+t._s(n.email||"Sin correo")+"\n ")])]}},{key:"item.fechaent",fn:function(r){var{item:n}=r;return[e("div",{staticClass:"font-weight-medium"},[t._v("\n "+t._s(t.formatDeliveryDate(n.fechaent))+"\n ")]),t._v(" "),e("div",{staticClass:"text-caption blue-grey--text text--darken-1"},[t._v("\n "+t._s(t.deliverySlot(n))+"\n ")])]}},{key:"item.comunaenvio",fn:function(r){var{item:n}=r;return[e("div",{staticClass:"font-weight-medium"},[t._v("\n "+t._s(n.comunaenvio||"--")+"\n ")]),t._v(" "),e("div",{staticClass:"text-caption blue-grey--text text--darken-1 text-truncate order-address"},[t._v("\n "+t._s(n.direccionenvio||"--")+"\n ")])]}},{key:"item.origin",fn:function(r){var{item:n}=r;return[e("v-chip",{attrs:{"x-small":"",dark:"",color:t.originColor(n.origin)}},[t._v("\n "+t._s(t.originLabel(n.origin))+"\n ")])]}},{key:"item.medio_pago",fn:function(r){var{item:n}=r;return[e("v-chip",{attrs:{"x-small":"",dark:"",color:t.paymentMethodColor(n.medio_pago)}},[t._v("\n "+t._s(t.paymentMethodLabel(n.medio_pago))+"\n ")])]}},{key:"item.coupon",fn:function(r){var{item:n}=r;return[e("div",{staticClass:"font-weight-medium"},[t._v("\n "+t._s(t.couponCode(n)||"--")+"\n ")]),t._v(" "),e("div",{staticClass:"text-caption blue-grey--text text--darken-1"},[t._v("\n "+t._s(t.couponBenefitLabel(n))+"\n ")])]}},{key:"item.total",fn:function(r){var{item:n}=r;return[e("strong",[t._v("\n "+t._s(t.$toCurrency(n.total||0))+"\n ")])]}},{key:"item.status",fn:function(r){var{item:n}=r;return[e("v-chip",{attrs:{"x-small":"",dark:"",color:t.statusColor(n.status)}},[t._v("\n "+t._s(t.statusLabel(n.status))+"\n ")])]}},{key:"append-actions",fn:function(r){var{item:n}=r;return[n.isBilled&&t.$canAny(["orders.index","orders.show","orders.report"])?e("v-tooltip",{attrs:{bottom:""},scopedSlots:t._u([{key:"activator",fn:function(r){var{on:o}=r;return[e("v-btn",t._g({attrs:{icon:"",small:"",disabled:t.fetching},on:{click:function(e){return t.sendOrderEmailNotification(n)}}},o),[e("v-icon",[t._v("\n fa-envelope\n ")])],1)]}}],null,!0)},[t._v(" "),e("span",[t._v("\n Reenviar correo\n ")])]):t._e()]}},{key:"filters.items",fn:function(r){var{close:n}=r;return[e("v-card-text",[e("v-row",{attrs:{dense:""}},[e("v-col",{attrs:{cols:"12",sm:"6",md:"4"}},[e("app-select",{attrs:{label:"Estado","item-text":"label","item-value":"value",items:t.orderStatuses,disabled:t.fetching},model:{value:t.selectedStatus,callback:function(e){t.selectedStatus=e},expression:"selectedStatus"}})],1),t._v(" "),e("v-col",{attrs:{cols:"12",sm:"6",md:"4"}},[e("app-select",{attrs:{label:"Origen","item-text":"label","item-value":"value",items:t.orderOrigins,disabled:t.fetching},model:{value:t.selectedOrigin,callback:function(e){t.selectedOrigin=e},expression:"selectedOrigin"}})],1),t._v(" "),e("v-col",{attrs:{cols:"12",sm:"6",md:"4"}},[e("app-select",{attrs:{label:"Medio de pago","item-text":"label","item-value":"value",items:t.paymentMethods,disabled:t.fetching},model:{value:t.selectedPaymentMethod,callback:function(e){t.selectedPaymentMethod=e},expression:"selectedPaymentMethod"}})],1),t._v(" "),e("v-col",{attrs:{cols:"12",sm:"6",md:"4"}},[e("v-text-field",{attrs:{type:"date",label:"Desde",disabled:t.fetching,"hide-details":"auto",outlined:"",dense:""},model:{value:t.selectedDateFrom,callback:function(e){t.selectedDateFrom=e},expression:"selectedDateFrom"}})],1),t._v(" "),e("v-col",{attrs:{cols:"12",sm:"6",md:"4"}},[e("v-text-field",{attrs:{type:"date",label:"Hasta",disabled:t.fetching,"hide-details":"auto",outlined:"",dense:""},model:{value:t.selectedDateTo,callback:function(e){t.selectedDateTo=e},expression:"selectedDateTo"}})],1)],1)],1),t._v(" "),e("v-card-actions",{staticClass:"px-4 pb-4 pt-0"},[e("v-btn",{attrs:{small:"",dark:"",color:"fishboxColor",disabled:t.fetching},on:{click:function(e){return t.onFilter(n)}}},[t._v("\n Aplicar filtros\n ")]),t._v(" "),e("v-btn",{attrs:{small:"",text:"",disabled:t.fetching},on:{click:function(e){return t.clearFilters(n)}}},[t._v("\n Limpiar\n ")])],1)]}},{key:"no-data",fn:function(){return[e("v-icon",[t._v("\n fas fa-times\n ")]),t._v(" "),e("strong",[t._v("\n No hay pedidos registrados\n ")])]},proxy:!0}],null,!0)}),t._v(" "),e("v-dialog",{attrs:{persistent:"",width:t.dialogWith},model:{value:t.dialogReport,callback:function(e){t.dialogReport=e},expression:"dialogReport"}},[e("order-report-form",{attrs:{format:t.exporting},on:{success:t.clear,cancel:t.clear}})],1)],1)},[],!1,null,"21fdf7c3",null);e.default=component.exports},681:function(t,e,r){"use strict";r.d(e,"a",function(){return n});r(8),r(10);class n{constructor(data){for(var t of Object.keys(data))this[t]=data[t]}get statusLabel(){var t;return null===(t=n.STATUSES[this.status])||void 0===t?void 0:t.label}get isBilled(){return this.status===n.STATUSES.billed.value}get isCancelled(){return this.status===n.STATUSES.cancelled.value}get isPending(){return this.status===n.STATUSES.pending.value}get isNotProcessed(){return this.status===n.STATUSES.not_processed.value}get paymentAmount(){return Math.round(this.untaxedTotal)+this.propina+this.iva}get iva(){return.19*this.untaxedTotal}get untaxedTotal(){var t,e,r=null!==(t=null===(e=this.giftCard||this.gift_card)||void 0===e?void 0:e.amount)&&void 0!==t?t:0;return(this.total-this.discountAmount+r+this.freight)/1.19}get discountAmount(){if(!this.discount_value&&!this.fixed_points&&!this.percentage_points)return 0;var t=this.calculateDiscountAmount();return this.discount_limit_value>0&&t>this.discount_limit_value?this.discount_limit_value:t}calculateDiscountAmount(){var t=1===this.discount_type?this.total_wo_offers*this.discount_value/100+this.fixed_points:this.discount_value+this.fixed_points;return!t&&this.percentage_points?this.total_wo_offers*this.percentage_points/100:this.percentage_points?t+this.total_wo_offers*this.percentage_points/100:t}}n.STATUSES=Object.freeze({pending:{value:"pending",label:"Pendiente"},denied:{value:"denied",label:"Cancelado"},billed:{value:"billed",label:"Pagado"},cancelled:{value:"cancelled",label:"Anulado"},not_processed:{value:"not_processed",label:"Sin procesar"}})},707:function(t,e,r){"use strict";var n=r(13),o=r(714).start;n({target:"String",proto:!0,forced:r(715)},{padStart:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},714:function(t,e,r){"use strict";var n=r(6),o=r(63),l=r(20),c=r(330),d=r(28),m=n(c),v=n("".slice),h=Math.ceil,f=function(t){return function(e,r,n){var c,f,y=l(d(e)),_=o(r),x=y.length,C=void 0===n?" ":l(n);return _<=x||""===C?y:((f=m(C,h((c=_-x)/C.length))).length>c&&(f=v(f,0,c)),t?y+f:f+y)}};t.exports={start:f(!1),end:f(!0)}},715:function(t,e,r){"use strict";var n=r(46);t.exports=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(n)},782:function(t,e,r){t.exports={}},843:function(t,e,r){"use strict";r(782)}}]);