woocommerce/packages/woocommerce-admin/dist/chunks/analytics-report-taxes.js

1 line
7.1 KiB
JavaScript
Raw Normal View History

2021-12-10 12:03:04 +00:00
(window.__wcAdmin_webpackJsonp=window.__wcAdmin_webpackJsonp||[]).push([[15],{485:function(e,t,r){"use strict";r.r(t);var a=r(0),o=r(1),c=r.n(o),n=r(2),i=r(535),s=r(510),d=r(508),l=r(511),m=r(4),u=r(21),b=r(12),_=r(120),p=r(503),y=r(506),x=r(501);class h extends a.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(n.__)("Tax code",'woocommerce'),key:"tax_code",required:!0,isLeftAligned:!0,isSortable:!0},{label:Object(n.__)("Rate",'woocommerce'),key:"rate",isSortable:!0,isNumeric:!0},{label:Object(n.__)("Total tax",'woocommerce'),key:"total_tax",isSortable:!0},{label:Object(n.__)("Order tax",'woocommerce'),key:"order_tax",isSortable:!0},{label:Object(n.__)("Shipping tax",'woocommerce'),key:"shipping_tax",isSortable:!0},{label:Object(n.__)("Orders",'woocommerce'),key:"orders_count",required:!0,defaultSort:!0,isSortable:!0,isNumeric:!0}]}getRowsContent(e){const{render:t,formatDecimal:r,getCurrencyConfig:o}=this.context;return Object(m.map)(e,e=>{const{query:c}=this.props,{order_tax:n,orders_count:i,tax_rate:s,tax_rate_id:d,total_tax:l,shipping_tax:m}=e,y=Object(p.a)(e),x=Object(b.getPersistedQuery)(c),h=Object(b.getNewPath)(x,"/analytics/orders",{filter:"advanced",tax_rate_includes:d});return[{display:Object(a.createElement)(u.Link,{href:h,type:"wc-admin"},y),value:y},{display:s.toFixed(2)+"%",value:s},{display:t(l),value:r(l)},{display:t(n),value:r(n)},{display:t(m),value:r(m)},{display:Object(_.formatValue)(o(),"number",i),value:i}]})}getSummary(e){const{tax_codes:t=0,total_tax:r=0,order_tax:a=0,shipping_tax:o=0,orders_count:c=0}=e,{formatAmount:i,getCurrencyConfig:s}=this.context,d=s();return[{label:Object(n._n)("tax code","tax codes",t,'woocommerce'),value:Object(_.formatValue)(d,"number",t)},{label:Object(n.__)("total tax",'woocommerce'),value:i(r)},{label:Object(n.__)("order tax",'woocommerce'),value:i(a)},{label:Object(n.__)("shipping tax",'woocommerce'),value:i(o)},{label:Object(n._n)("order","orders",c,'woocommerce'),value:Object(_.formatValue)(d,"number",c)}]}render(){const{advancedFilters:e,filters:t,isRequesting:r,query:o}=this.props;return Object(a.createElement)(y.a,{compareBy:"taxes",endpoint:"taxes",getHeadersContent:this.getHeadersContent,getRowsContent:this.getRowsContent,getSummary:this.getSummary,summaryFields:["tax_codes","total_tax","order_tax","shipping_tax","orders_count"],isRequesting:r,itemIdField:"tax_rate_id",query:o,searchBy:"taxes",tableQuery:{orderby:o.orderby||"tax_rate_id"},title:Object(n.__)("Taxes",'woocommerce'),columnPrefsKey:"taxes_report_columns",filters:t,advancedFilters:e})}}h.contextType=x.a;var f=h,O=r(505);class j extends a.Component{getChartMeta(){const{query:e}=this.props,t="compare-taxes"===e.filter?"item-comparison":"time-comparison";return{itemsLabel:Object(n.__)("%d taxes",'woocommerce'),mode:t}}render(){const{isRequesting:e,query:t,path:r}=this.props,{mode:o,itemsLabel:c}=this.getChartMeta(),n={...t};return"item-comparison"===o&&(n.segmentby="tax_rate_id"),Object(a.createElement)(a.Fragment,null,Object(a.createElement)(O.a,{query:t,path:r,filters:i.c,advancedFilters:i.a,report:"taxes"}),Object(a.createElement)(l.a,{charts:i.b,endpoint:"taxes",isRequesting:e,query:n,selectedChart:Object(s.a)(t.chart,i.b),filters:i.c,advancedFilters:i.a}),Object(a.createElement)(d.a,{charts:i.b,filters:i.c,advancedFilters:i.a,mode:o,endpoint:"taxes",query:n,path:r,isRequesting:e,itemsLabel:c,selectedChart:Object(s.a)(t.chart,i.b)}),Object(a.createElement)(f,{isRequesting:e,query:t,filters:i.c,advancedFilters:i.a}))}}j.propTypes={query:c.a.object.isRequired};t.default=j},502:function(e,t,r){"use strict";r.d(t,"e",(function(){return m})),r.d(t,"a",(function(){return u})),r.d(t,"b",(function(){return b})),r.d(t,"c",(function(){return _})),r.d(t,"d",(function(){return p})),r.d(t,"f",(function(){return y})),r.d(t,"h",(function(){return x})),r.d(t,"g",(function(){return h}));var a=r(15),o=r(17),c=r.n(o),n=r(4),i=r(12),s=r(11),d