'use strict';

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

const index = require('./index-cba1c3ae.js');
const hardwareBackButton = require('./overlays-7ec575fc.js');
require('./ionic-global-01cd0200.js');
require('./helpers-c2496722.js');

const appAlertListCss = "";

const AppAlertList = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.alerts = [];
    this.filters = {};
  }
  async componentDidLoad() {
    if (!(index.Build === null || index.Build === void 0 ? void 0 : index.Build.isBrowser))
      return;
    (await hardwareBackButton.modalController.create({
      component: "modal-flow",
      componentProps: {
        headerTitle: "Add an Alert",
        steps: [
          {
            fields: [
              {
                beforeHTML: "<h1>What is the subject of the email?</h1>",
                name: "subject",
              },
            ],
          },
          {
            fields: [
              {
                beforeHTML: "<h1>What is the type of alert?</h1>",
                name: "type",
                type: "radios",
                value: "email",
                options: [
                  {
                    label: "Email",
                    value: "email",
                  },
                  {
                    label: "Feed Card",
                    value: "feed",
                  },
                ],
              },
            ],
          },
        ],
      },
    })).present();
  }
  render() {
    return [
      index.h("ion-content", { class: "ion-padding" }, index.h("floodteam-title-bar", null, index.h("ion-router-link", { href: "/alerts" }, "Alerts"), index.h("ion-buttons", { slot: "end" }, index.h("ion-button", { fill: "solid", color: "primary", href: "/alerts/new" }, "Add"))), index.h("div", { class: "ion-padding" }, index.h("fireenjin-search-bar", { ref: (el) => (this.filterBarEl = el), paginationEl: this.paginationEl, filters: [
          {
            name: "locationId",
            label: "Location",
            endpoint: "listLocations",
            value: this.locationId,
            icon: "business",
            resultsKey: "locations",
          },
        ] })), index.h("ion-card", { class: "list-card" }, index.h("ion-card-content", null, index.h("ion-list", null, this.alerts.map((alert) => {
        var _a, _b, _c, _d, _e;
        return (index.h("ion-item", null, index.h("div", { slot: "start" }, ((_a = alert === null || alert === void 0 ? void 0 : alert.types) === null || _a === void 0 ? void 0 : _a.includes("email")) ? (index.h("ion-icon", { name: "mail" })) : null), index.h("ion-label", null, index.h("h2", null, (_b = alert === null || alert === void 0 ? void 0 : alert.template) === null || _b === void 0 ? void 0 : _b.subject), index.h("p", null, "Sent to", " ", ((_c = alert === null || alert === void 0 ? void 0 : alert.emails) === null || _c === void 0 ? void 0 : _c.length)
          ? `${alert.emails.length} Emails`
          : "", " ", ((_d = alert === null || alert === void 0 ? void 0 : alert.userIds) === null || _d === void 0 ? void 0 : _d.length)
          ? `${((_e = alert === null || alert === void 0 ? void 0 : alert.emails) === null || _e === void 0 ? void 0 : _e.length) ? "and " : ""}${alert.userIds.length} Users`
          : ""))));
      }))))),
      index.h("floodteam-navigation-footer", null),
    ];
  }
};
AppAlertList.style = appAlertListCss;

exports.app_alert_list = AppAlertList;
