import { r as registerInstance, B as Build, h } from './index-31949dc5.js';
import { s as state } from './store-cca1abc6.js';
import './index-afdf7f54.js';
import './getHandlebarsHelpers-ae9bfed4.js';
import './_commonjsHelpers-44457d8d.js';
import './index-e6b3332e.js';
import './localforage-394b59fa.js';

const appInventoryListCss = "";

const AppInventoryList = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.paginationEl = undefined;
  }
  componentDidLoad() {
    if (!(Build === null || Build === void 0 ? void 0 : Build.isBrowser))
      return;
  }
  render() {
    var _a, _b, _c, _d, _e, _f;
    return [
      h("ion-content", { class: "ion-padding" }, h("floodteam-title-bar", null, h("ion-router-link", { href: "/inventory" }, "Inventory"), h("ion-buttons", { slot: "end" }, h("ion-button", { fill: "solid", color: "primary", href: "/inventory/new" }, "Add"))), h("fireenjin-search-bar", { paginationEl: this.paginationEl, filters: ((_a = state === null || state === void 0 ? void 0 : state.claims) === null || _a === void 0 ? void 0 : _a.tester) || ((_b = state === null || state === void 0 ? void 0 : state.claims) === null || _b === void 0 ? void 0 : _b.admin)
          ? [
            {
              name: "tags",
              label: "Tags",
              icon: "pricetags",
              multiple: true,
              options: [
                {
                  label: "Imported",
                  value: "imported",
                },
              ],
            },
            {
              name: "locationId",
              label: "Location",
              icon: "business",
              options: ((_c = state === null || state === void 0 ? void 0 : state.locations) === null || _c === void 0 ? void 0 : _c.length)
                ? state.locations.map((location) => ({
                  label: location.name,
                  value: location.id,
                }))
                : [],
              value: ((_d = state === null || state === void 0 ? void 0 : state.claims) === null || _d === void 0 ? void 0 : _d.tester) && ((_f = (_e = state === null || state === void 0 ? void 0 : state.profile) === null || _e === void 0 ? void 0 : _e.location) === null || _f === void 0 ? void 0 : _f.id)
                ? state.profile.location.id
                : null,
            },
          ]
          : null }), h("fireenjin-pagination", { ref: (el) => (this.paginationEl = el), listEl: ({ result }) => (h("ion-item", { href: `/inventory/${result.id}`, detail: true }, h("ion-label", null, h("h2", null, result.name ? result.name : "", " ")))), endpoint: "listInventories", limit: 20, resultsKey: "inventories", name: "inventories" })),
    ];
  }
};
AppInventoryList.style = appInventoryListCss;

export { AppInventoryList as app_inventory_list };
