System.register(["./index-c820db66.system.js","./index-542a2c72.system.js","./index-dc84aac6.system.js","./index-2d937df8.system.js","./_commonjsHelpers-c8881874.system.js","./index-9ceb7f8c.system.js","./index-b0fe4e4c.system.js"],(function(e){"use strict";var t,o,r,s,n,i,c,d;return{setters:[function(e){t=e.r;o=e.h;r=e.g},function(e){s=e.d},function(e){n=e.I;i=e.C;c=e.O},function(e){d=e.d},function(){},function(){},function(){}],execute:function(){var l={"Selected Count":"Antal utvalda","Selected Amount":"Summa för utvalda","Total Amount":"Totalsumma","Total Count":"Totalt antal","Download order report":"Ladda ner orderrapport"};function a(e){return d.create({sv:l},e)}var u=".sc-ig-orders-footer-h{display:block;margin:auto;border:1px solid rgb(var(--smoothly-medium-color))}[hidden].sc-ig-orders-footer-h{display:none}.sc-ig-orders-footer-h>footer.sc-ig-orders-footer>button.sc-ig-orders-footer{float:right;margin-right:0.5em;margin-bottom:-0.2em}.sc-ig-orders-footer-h>footer.sc-ig-orders-footer>button.sc-ig-orders-footer:focus{outline:none}.sc-ig-orders-footer-h>footer.sc-ig-orders-footer>td.sc-ig-orders-footer{display:inline-block;padding-top:0.2em}.sc-ig-orders-footer-h>footer.sc-ig-orders-footer>td.sc-ig-orders-footer>smoothly-display-amount.sc-ig-orders-footer,.sc-ig-orders-footer-h>footer.sc-ig-orders-footer>td.sc-ig-orders-footer>span.sc-ig-orders-footer{display:inline-block;margin-left:0.4em;margin-right:0.6em}.sc-ig-orders-footer-h>footer.sc-ig-orders-footer>td.sc-ig-orders-footer>span.tabbed.sc-ig-orders-footer{margin-left:2em}";var f=e("ig_orders_footer",function(){function e(e){t(this,e);this.allSelected=false;this.opened={}}e.prototype.componentWillLoad=function(){this.t=a(this.element)};e.prototype.sumSelected=function(){var e={};for(var t=0,o=Object.keys(this.selected);t<o.length;t++){var r=o[t];var s=this.selected[r];if(s)if(Object.keys(e).includes(s.currency))e[s.currency]+=n.amount(s.items);else e[s.currency]=n.amount(s.items)}return e};e.prototype.sumAll=function(){var e={};if(this.orders)for(var t=0,o=this.orders;t<o.length;t++){var r=o[t];if(Object.keys(e).includes(r.currency))e[r.currency]+=n.amount(r.items);else e[r.currency]=n.amount(r.items)}return e};e.prototype.downloadCsv=function(){var e=!i.user?undefined:Array.isArray(i.user.merchant)?i.user.merchant[0]:i.user.merchant;var t=(e?e.name+" ":"orders ")+s.DateTime.now().substring(0,10)+".csv";var o=Object.keys(this.selected).length>0?Object.values(this.selected).filter((function(e){return e!=undefined})):this.orders;var r=o?c.toCsv(o):"";var n=document.createElement("a");n.setAttribute("href","data:text/csv;charset=utf-8,"+encodeURIComponent(r));n.setAttribute("download",t);n.style.display="none";document.body.appendChild(n);n.click();n.remove()};e.prototype.render=function(){var e=this;var t=this.t;var r;if(!this.orders)r=[];else{r=o("footer",null,this.selected&&Object.keys(this.selected).length>0?o("td",null,o("span",null," ",t("Selected Count"),":"),o("span",null,Object.keys(this.selected).length),o("span",{class:"tabbed"},t("Selected Amount"),":"),Object.keys(this.sumSelected()).map((function(t){return o("smoothly-display-amount",{amount:e.sumSelected()[t],currency:t})}))):o("td",null,o("span",null,t("Total Count"),":"),o("span",null,this.orders.length),o("span",{class:"tabbed"},t("Total Amount"),":"),Object.keys(this.sumAll()).map((function(t){return o("smoothly-display-amount",{amount:e.sumAll()[t],currency:t})}))),o("button",{onClick:function(){return e.downloadCsv()}},o("smoothly-icon",{color:"light",toolTip:t("Download order report"),name:"cloud-download"})))}return r};Object.defineProperty(e.prototype,"element",{get:function(){return r(this)},enumerable:false,configurable:true});return e}());f.style=u}}}));