import { Build, h, } from "@stencil/core";
import state from "../../../store";
export class AppMaterial {
  constructor() {
    this.eventIconMap = {
      alert: "notifications",
      notion: "./assets/svg/notion.svg",
    };
    this.query = undefined;
  }
  onSearchInput(event) {
    this.query = event.target.value;
  }
  componentDidLoad() {
    if (!(Build === null || Build === void 0 ? void 0 : Build.isBrowser))
      return;
    // Get Data
  }
  render() {
    var _a;
    return [
      h("ion-content", { class: "ion-padding" }, h("div", { class: "ion-padding" }, h("fireenjin-search-bar", { ref: (el) => (this.filterBarEl = el), paginationEl: this.paginationEl }), h("fireenjin-pagination", { ref: (el) => (this.paginationEl = el), name: "materials", resultsKey: "materials", disableVirtualScroll: true, removeDuplicates: true, listEl: ({ result: material }) => (h("ion-item", { href: `/materials/${material.id}`, detail: true, lines: "full" }, h("ion-grid", null, h("ion-row", { class: "ion-align-items-center ion-justify-content-between" }, h("ion-col", null, h("ion-label", null, h("h2", null, material.name))))))), display: "list", endpoint: "listMaterials", limit: 20, query: this.query }))),
      h("floodteam-navigation-footer", null, h("floodteam-title-bar", { back: "/dashboard" }, h("ion-breadcrumbs", null, h("ion-breadcrumb", { onClick: () => this.fireenjinTrigger.emit({
          name: "pin",
          payload: {
            icon: "flash",
            href: `/materials`,
            name: "Materials",
          },
        }) }, h("ion-icon", { color: ((_a = ((state === null || state === void 0 ? void 0 : state.pins) || [])
          .map((pin) => pin === null || pin === void 0 ? void 0 : pin.href)) === null || _a === void 0 ? void 0 : _a.includes(`/materials`))
          ? "primary"
          : null, slot: "start", name: "pin" }), "Materials")), h("ion-buttons", { slot: "end" }, h("ion-button", { fill: "solid", color: "primary", href: "/materials/new" }, "Add")))),
    ];
  }
  static get is() { return "app-material-list"; }
  static get originalStyleUrls() {
    return {
      "$": ["app-material-list.css"]
    };
  }
  static get styleUrls() {
    return {
      "$": ["app-material-list.css"]
    };
  }
  static get states() {
    return {
      "query": {}
    };
  }
  static get events() {
    return [{
        "method": "fireenjinTrigger",
        "name": "fireenjinTrigger",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": ""
        },
        "complexType": {
          "original": "FireEnjinTriggerInput",
          "resolved": "FireEnjinTriggerInput<any>",
          "references": {
            "FireEnjinTriggerInput": {
              "location": "import",
              "path": "@fireenjin/sdk"
            }
          }
        }
      }, {
        "method": "fireenjinSubmit",
        "name": "fireenjinSubmit",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": ""
        },
        "complexType": {
          "original": "FireEnjinSubmitEvent",
          "resolved": "FireEnjinSubmitEvent",
          "references": {
            "FireEnjinSubmitEvent": {
              "location": "import",
              "path": "@fireenjin/sdk"
            }
          }
        }
      }];
  }
  static get listeners() {
    return [{
        "name": "ionInput",
        "method": "onSearchInput",
        "target": undefined,
        "capture": false,
        "passive": false
      }];
  }
}
