System.register(["./index-c820db66.system.js","./index-2d937df8.system.js","./_commonjsHelpers-c8881874.system.js"],(function(e){"use strict";var t,s,i,o,r;return{setters:[function(e){t=e.r;s=e.j;i=e.h;o=e.g},function(e){r=e.d},function(){}],execute:function(){var l={"Customer number":"Kundnummer",Contact:"Kontakt",Method:"Metod",Orders:"Ordrar",Subscription:"Prenumeration",Balance:"Saldo","Select all customers":"Markera alla kunder","Deselect all customers":"Avmarkera alla kunder","Loading customers from server.":"Laddar kunder från servern.","There are no customers to display.":"Det finns inga kunder att visa.","Load more customers":"Ladda in fler kunder"};function c(e){return r.create({sv:l},e)}var n=".sc-ig-customers-table-h{display:block;width:100%;max-width:90em;margin:auto;border:1px solid rgb(var(--smoothly-medium-color))}[hidden].sc-ig-customers-table-h{display:none}.sc-ig-customers-table-h>p.sc-ig-customers-table{padding-left:.5em}.sc-ig-customers-table-h>table.sc-ig-customers-table{width:100%}.sc-ig-customers-table-h>table.sc-ig-customers-table>thead.sc-ig-customers-table>tr.sc-ig-customers-table{display:table-row;font-weight:bold;height:2em}.sc-ig-customers-table-h>table.sc-ig-customers-table>thead.sc-ig-customers-table>tr.sc-ig-customers-table>*.sc-ig-customers-table{display:table-cell;padding-right:.5em;padding-left:.3em;vertical-align:middle;position:-webkit-sticky;position:sticky;top:1.55cm;z-index:1;text-align:left}.sc-ig-customers-table-h>table.sc-ig-customers-table>thead.sc-ig-customers-table>tr.sc-ig-customers-table>*.sc-ig-customers-table>smoothly-icon.sc-ig-customers-table{vertical-align:-50%;margin-left:.1em}.sc-ig-customers-table-h>table.sc-ig-customers-table>td.sc-ig-customers-table{text-align:center}.sc-ig-customers-table-h>table.sc-ig-customers-table>td.sc-ig-customers-table>button.sc-ig-customers-table>smoothly-icon.sc-ig-customers-table{cursor:pointer}";var a=e("ig_customers_table",function(){function e(e){t(this,e);this.selectedChanged=s(this,"selectedChanged",7);this.selected={};this.count=100;this.opened={}}e.prototype.componentWillLoad=function(){this.t=c(this.element)};e.prototype.onChecked=function(e){this.selected={};if(e.detail.selected&&this.customers)for(var t=0,s=this.customers;t<s.length;t++){var i=s[t];this.selected[i.id]=i}this.selectedChanged.emit(this.selected);e.stopPropagation();e.preventDefault()};e.prototype.handleToggle=function(e){var t=Object.assign({},this.selected);if(e.detail.checked)t[e.detail.customer.id]=e.detail.customer;else delete t[e.detail.customer.id];this.selectedChanged.emit(this.selected=t)};e.prototype.toggleColumn=function(e){var t=Object.assign({},this.opened);if(e.detail["id"]&&t[e.detail.id]==e.detail.column)delete t[e.detail.id];else t[e.detail.id]=e.detail.column;this.opened=t};e.prototype.render=function(){var e=this;var t=this.t;var s;if(!this.customers)s=i("p",null,t("Loading customers from server."));else if(this.customers.length<=0)s=i("p",null,t("There are no customers to display."));else{s=[i("table",null,i("thead",null,i("tr",null,i("th",{style:{width:"5%"},color:"light"},i("smoothly-checkbox",{"select-all":true})),i("th",{color:"light"},t("Customer number")),i("th",{color:"light"},t("Contact")),i("th",{color:"light"},t("Orders")),this.whitelist?i("th",{color:"light"},t("Subscription")):[],i("th",{color:"light"},t("Method")),this.whitelist?i("th",{color:"light"},t("Balance")):[],i("th",{color:"light"},t("Login")),i("th",{color:"light"},t("Status")))),this.customers?this.customers.slice(0,this.count).map((function(t){var s,o;return[i("ig-customer-table-row",{customer:t,whitelist:e.whitelist,orders:e.orders?e.orders[t.id]:undefined,opened:(s=e.opened[t.id])!==null&&s!==void 0?s:"",selected:e.selected.hasOwnProperty.call(e.selected,t.id)}),i("ig-customer-details",{opened:(o=e.opened[t.id])!==null&&o!==void 0?o:"",orders:e.orders?e.orders[t.id]:undefined,whitelist:e.whitelist,customer:t})]})):null,i("td",{colSpan:8},this.count<this.customers.length&&i("button",{onClick:function(){return e.count+=100}},i("smoothly-icon",{name:"chevron-down-circle",size:"large",toolTip:this.t("Load more customers")}))))]}return s};Object.defineProperty(e.prototype,"element",{get:function(){return o(this)},enumerable:false,configurable:true});return e}());a.style=n}}}));