'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index$1 = require('./index-df541290.js');
const index = require('./index-b7493032.js');
require('./_commonjsHelpers-10109b76.js');

const sv = {
  Number: "Nummer",
  Amount: "Summa",
  Schedule: "Schema",
  Start: "Påbörjar",
  End: "Upphör",
  Due: "Nästa betalning",
  "There are no subscriptions to display.": "Det finns inga prenummerationer att visa.",
};

function create(language) {
  return index.dist.create({
    sv,
  }, language);
}

const styleCss = ".sc-ig-subscription-table-h{display:block;width:100%;max-width:90em;margin:auto}[hidden].sc-ig-subscription-table-h{display:none}.sc-ig-subscription-table-h>p.sc-ig-subscription-table{padding-left:1em}.sc-ig-subscription-table-h>table.sc-ig-subscription-table{width:100%}.sc-ig-subscription-table-h>table.sc-ig-subscription-table>thead.sc-ig-subscription-table>tr.sc-ig-subscription-table{display:table-row;font-weight:bold;height:2em}.sc-ig-subscription-table-h>table.sc-ig-subscription-table>thead.sc-ig-subscription-table>tr.sc-ig-subscription-table>*.sc-ig-subscription-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-subscription-table-h>table.sc-ig-subscription-table>td.sc-ig-subscription-table{text-align:center}";

const IntergiroSubscriptionTable = class {
  constructor(hostRef) {
    index$1.registerInstance(this, hostRef);
    this.opened = {};
  }
  componentWillLoad() {
    this.t = create(this.element);
  }
  toggleColumn(e) {
    const opened = Object.assign({}, this.opened);
    if (e.detail["id"] && opened[e.detail.id] == e.detail.column)
      delete opened[e.detail.id];
    else
      opened[e.detail.id] = e.detail.column;
    this.opened = opened;
  }
  render() {
    return [
      this.subscriptions ? ([
        index$1.h("table", null, index$1.h("thead", null, index$1.h("tr", null, index$1.h("th", { color: "light" }, this.t("Number")), index$1.h("th", { color: "light" }, this.t("Amount")), index$1.h("th", { color: "light" }, this.t("Schedule")), index$1.h("th", { color: "light" }, this.t("Start")), index$1.h("th", { color: "light" }, this.t("End")), index$1.h("th", { color: "light" }, this.t("Due")))), this.subscriptions.map(s => {
          var _a;
          return [
            index$1.h("ig-subscription-table-row", { opened: this.opened[s.id], subscription: s }),
            index$1.h("ig-subscription-details", { opened: (_a = this.opened[s.id]) !== null && _a !== void 0 ? _a : "", subscription: s, customer: this.customer }),
          ];
        })),
      ]) : (index$1.h("p", null, this.t("There are no subscriptions to display."))),
    ];
  }
  get element() { return index$1.getElement(this); }
};
IntergiroSubscriptionTable.style = styleCss;

exports.ig_subscription_table = IntergiroSubscriptionTable;
