1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
|
(window.__wcAdmin_webpackJsonp=window.__wcAdmin_webpackJsonp||[]).push([[11],{483:function(e,t,o){"use strict";o.r(t),o.d(t,"default",(function(){return h}));var r=o(0),c=o(1),a=o.n(c),n=o(533),m=o(510),l=o(2),i=o(4),s=o(21),d=o(120),u=o(13),b=o(12),_=o(19),p=o(506),O=o(501);o(581);class j extends r.Component{constructor(){super(),this.getHeadersContent=this.getHeadersContent.bind(this),this.getRowsContent=this.getRowsContent.bind(this),this.getSummary=this.getSummary.bind(this)}getHeadersContent(){return[{label:Object(l.__)("Date",'woocommerce'),key:"date",required:!0,defaultSort:!0,isLeftAligned:!0,isSortable:!0},{label:Object(l.__)("Order #",'woocommerce'),screenReaderLabel:Object(l.__)("Order Number",'woocommerce'),key:"order_number",required:!0},{label:Object(l.__)("Status",'woocommerce'),key:"status",required:!1,isSortable:!1},{label:Object(l.__)("Customer",'woocommerce'),key:"customer_id",required:!1,isSortable:!1},{label:Object(l.__)("Customer type",'woocommerce'),key:"customer_type",required:!1,isSortable:!1},{label:Object(l.__)("Product(s)",'woocommerce'),screenReaderLabel:Object(l.__)("Products",'woocommerce'),key:"products",required:!1,isSortable:!1},{label:Object(l.__)("Items sold",'woocommerce'),key:"num_items_sold",required:!1,isSortable:!0,isNumeric:!0},{label:Object(l.__)("Coupon(s)",'woocommerce'),screenReaderLabel:Object(l.__)("Coupons",'woocommerce'),key:"coupons",required:!1,isSortable:!1},{label:Object(l.__)("Net sales",'woocommerce'),screenReaderLabel:Object(l.__)("Net sales",'woocommerce'),key:"net_total",required:!0,isSortable:!0,isNumeric:!0}]}getCustomerName(e){const{first_name:t,last_name:o}=e||{};return t||o?[t,o].join(" "):""}getRowsContent(e){const{query:t}=this.props,o=Object(b.getPersistedQuery)(t),c=Object(u.f)("dateFormat",_.defaultTableDateFormat),{render:a,getCurrencyConfig:n}=this.context;return Object(i.map)(e,e=>{const{currency:t,date_created:m,net_total:i,num_items_sold:_,order_id:p,order_number:O,parent_id:j,status:w,customer_type:f}=e,y=e.extended_info||{},{coupons:v,customer:h,products:S}=y,g=S.sort((e,t)=>t.quantity-e.quantity).map(e=>({label:e.name,quantity:e.quantity,href:Object(b.getNewPath)(o,"/analytics/products",{filter:"single_product",products:e.id})})),C=v.map(e=>({label:e.code,href:Object(b.getNewPath)(o,"/analytics/coupons",{filter:"single_coupon",coupons:e.id})}));return[{display:Object(r.createElement)(s.Date,{date:m,visibleFormat:c}),value:m},{display:Object(r.createElement)(s.Link,{href:"post.php?post="+(j||p)+"&action=edit"+(j?"#order_refunds":""),type:"wp-admin"},O),value:O},{display:Object(r.createElement)(s.OrderStatus,{className:"woocommerce-orders-table__status",order:{status:w},orderStatusMap:Object(u.f)("orderStatuses",{})}),value:w},{display:this.getCustomerName(h),value:this.getCustomerName(h)},{display:(x=f,x.charAt(0).toUpperCase()+x.slice(1)),value:f},{display:this.renderList(g.length?[g[0]]:[],g.map(e=>({label:Object(l.sprintf)(Object(l.__)("%s× %s",'woocommerce'),e.quantity,e.label),href:e.href}))),value:g.map(({quantity:e,label:t})=>Object(l.sprintf)(Object(l.__)("%s× %s",'woocommerce'),e,t)).join(", ")},{display:Object(d.formatValue)(n(),"number",_),value:_},{display:this.renderList(C.length?[C[0]]:[],C),value:C.map(e=>e.label).join(", ")},{display:a(i,t),value:i}];var x})}getSummary(e){const{orders_count:t=0,total_customers:o=0,products:r=0,num_items_sold:c=0,coupons_count:a=0,net_revenue:n=0}=e,{formatAmount:m,getCurrencyConfig:i}=this.context,s=i();return[{label:Object(l._n)("Order","Orders",t,'woocommerce'),value:Object(d.formatValue)(s,"number",t)},{label:Object(l._n)(" Customer"," Customers",o,'woocommerce'),value:Object(d.formatValue)(s,"number",o)},{label:Object(l._n)("Product","Products",r,'woocommerce'),value:Object(d.formatValue)(s,"number",r)},{label:Object(l._n)("Item sold","Items sold",c,'woocommerce'),value:Object(d.formatValue)(s,"number",c)},{label:Object(l._n)("Coupon","Coupons",a,'woocommerce'),value:Object(d.formatValue)(s,"number",a)},{label:Object(l.__)("net sales",'woocommerce'),value:m(n)}]}renderLinks(e=[]){return e.m
|