'use strict';

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

const index = require('./index-ee190ee0.js');
const store = require('./store-27073b3b.js');
require('./index-4901314f.js');
require('./getHandlebarsHelpers-8ef28401.js');
require('./_commonjsHelpers-a5111d61.js');
require('./index-ba857994.js');
require('./localforage-af1b8c0e.js');

const appInventoryListCss = "";

const AppInventoryList = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.query = undefined;
  }
  onSearchInput(event) {
    this.query = event.target.value;
  }
  componentDidLoad() {
    if (!(index.Build === null || index.Build === void 0 ? void 0 : index.Build.isBrowser))
      return;
  }
  render() {
    var _a, _b, _c, _d, _e, _f;
    return [
      index.h("ion-content", { class: "ion-padding" }, index.h("div", { class: "ion-padding" }, index.h("fireenjin-search-bar", { ref: (el) => (this.filterBarEl = el), paginationEl: this.paginationEl, filters: ((_a = store.state === null || store.state === void 0 ? void 0 : store.state.claims) === null || _a === void 0 ? void 0 : _a.tester) || ((_b = store.state === null || store.state === void 0 ? void 0 : store.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 = store.state === null || store.state === void 0 ? void 0 : store.state.locations) === null || _c === void 0 ? void 0 : _c.length)
                ? store.state.locations.map((location) => ({
                  label: location.name,
                  value: location.id,
                }))
                : [],
              value: ((_d = store.state === null || store.state === void 0 ? void 0 : store.state.claims) === null || _d === void 0 ? void 0 : _d.tester) && ((_f = (_e = store.state === null || store.state === void 0 ? void 0 : store.state.profile) === null || _e === void 0 ? void 0 : _e.location) === null || _f === void 0 ? void 0 : _f.id)
                ? store.state.profile.location.id
                : null,
            },
          ]
          : null }), index.h("fireenjin-pagination", { ref: (el) => (this.paginationEl = el), name: "inventories", resultsKey: "inventories", disableVirtualScroll: true, removeDuplicates: true, listEl: ({ result: inventory }) => (index.h("ion-item", { href: `/inventory/${inventory.id}`, detail: true, lines: "full" }, index.h("ion-grid", null, index.h("ion-row", { class: "ion-align-items-center ion-justify-content-between" }, index.h("ion-col", null, index.h("ion-label", null, index.h("h2", null, inventory.name || "No name", " "))))))), endpoint: "listInventories", limit: 20, display: "list", query: this.query }))),
      index.h("floodteam-navigation-footer", null, index.h("floodteam-title-bar", { back: "/dashboard" }, index.h("ion-breadcrumbs", null, index.h("ion-breadcrumb", { href: "/inventory" }, index.h("ion-icon", { class: "ft-icon-style", slot: "start", name: "barcode-outline" }), "Inventory")), index.h("ion-buttons", { slot: "end" }, index.h("ion-button", { fill: "solid", color: "primary", href: "/inventory/new" }, "Add")))),
    ];
  }
};
AppInventoryList.style = appInventoryListCss;

exports.app_inventory_list = AppInventoryList;
