'use strict';

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

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

const styleCss = ".sc-ig-customer-balance-h{display:block;padding-top:.5em}[hidden].sc-ig-customer-balance-h{display:none}.sc-ig-customer-balance-h>section.sc-ig-customer-balance>ig-items-list.sc-ig-customer-balance{padding-top:1em}.sc-ig-customer-balance-h>section.sc-ig-customer-balance:first-of-type{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}.sc-ig-customer-balance-h>section.sc-ig-customer-balance:last-of-type{display:block}ig-future-due-dates.sc-ig-customer-balance{min-width:13em}ig-orders-table.sc-ig-customer-balance{border:1px solid rgb(var(--smoothly-medium-color));margin-top:1em}main.sc-ig-customer-balance{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}main.sc-ig-customer-balance>*.sc-ig-customer-balance{width:-webkit-min-content;width:-moz-min-content;width:min-content}";

const IntergiroCustomerBalance = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
  }
  componentWillLoad() {
    this.filterOrders();
  }
  filterOrders() {
    const orders = this.orders
      ? this.orders.filter(o => o.payment.type == "customer" || o.payment.type == "card" ? o.payment.charge == "balance" : false)
      : undefined;
    this.ordersFiltered = orders;
  }
  render() {
    return [
      index.h("section", null, index.h("main", null, index.h("ig-schedule", { schedule: this.customer.schedule }), this.customer.limit ? index.h("ig-customer-limit", { customer: this.customer }) : []), index.h("ig-future-due-dates", { dates: index$1.Schedule.calculateDueDates(this.customer.schedule, 4) })),
      index.h("section", null, this.customer.balance.length > 0 ? index.h("ig-items-list", { items: this.customer.balance }) : [], this.ordersFiltered && this.ordersFiltered.length > 0 ? (index.h("ig-orders-table", { display: true, orders: this.ordersFiltered })) : ([])),
    ];
  }
  static get watchers() { return {
    "orders": ["filterOrders"]
  }; }
};
IntergiroCustomerBalance.style = styleCss;

exports.ig_customer_balance = IntergiroCustomerBalance;
