'use strict';

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

const index = require('./index-e0385008.js');

const popoverUserCss = ".popover-user-wrapper{--min-width:300px}popover-user ion-item-divider{--padding-start:0px}popover-user fireenjin-avatar{margin-left:16px}popover-user h5,popover-user p{display:block;--ion-color-step-600:#666666;font-size:0.9em}popover-user ion-button{display:table;margin-left:0px;margin:0 auto}";

const PopoverUser = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.fireenjinFetch = index.createEvent(this, "fireenjinFetch", 7);
    this.user = {};
  }
  onSuccess(event) {
    var _a, _b;
    if (((_a = event.detail) === null || _a === void 0 ? void 0 : _a.endpoint) === "findUser" && ((_b = event.detail) === null || _b === void 0 ? void 0 : _b.data)) {
      console.log(event.detail);
      this.user = { ...this.user, ...event.detail.data };
    }
  }
  componentDidLoad() {
    var _a;
    if (!(index.Build === null || index.Build === void 0 ? void 0 : index.Build.isBrowser))
      return;
    this.fireenjinFetch.emit({
      endpoint: "findUser",
      params: {
        id: (_a = this.user) === null || _a === void 0 ? void 0 : _a.id,
        withFriends: false,
      },
    });
  }
  render() {
    var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
    return (index.h("ion-content", { style: {
        "--background": "var(--ion-color-base)",
      } }, index.h("ion-item-divider", null, index.h("div", { style: { width: "100%" } }, index.h("fireenjin-avatar", { src: (_a = this.user) === null || _a === void 0 ? void 0 : _a.photo, slot: "start", size: "35px", style: { marginRight: "15px", float: "left", marginTop: "15px" }, initials: `${((_b = this.user) === null || _b === void 0 ? void 0 : _b.firstName) ? this.user.firstName.charAt(0) : ""}${((_c = this.user) === null || _c === void 0 ? void 0 : _c.lastName) ? this.user.lastName.charAt(0) : ""}` }), index.h("h4", { style: { marginBottom: "0" } }, (_d = this.user) === null || _d === void 0 ? void 0 :
      _d.firstName, " ", (_e = this.user) === null || _e === void 0 ? void 0 :
      _e.lastName), index.h("ion-grid", null, index.h("ion-row", null, index.h("ion-col", null, ((_f = this.user) === null || _f === void 0 ? void 0 : _f.phone) && (index.h("ion-button", { href: `tel:${(_g = this.user) === null || _g === void 0 ? void 0 : _g.phone}`, fill: "clear", color: "primary", size: "small", expand: "full" }, index.h("ion-icon", { slot: "start", name: "call" }), "Call"))), index.h("ion-col", null, ((_h = this.user) === null || _h === void 0 ? void 0 : _h.address) && (index.h("ion-button", { href: `geo:0,0?q=${(_k = (_j = this.user) === null || _j === void 0 ? void 0 : _j.address) === null || _k === void 0 ? void 0 : _k.full}`, fill: "clear", color: "primary", size: "small", expand: "full" }, index.h("ion-icon", { slot: "start", name: "map" }), "Map"))))))), index.h("ion-list", null, ((_l = this.user) === null || _l === void 0 ? void 0 : _l.email) && (index.h("ion-item", null, index.h("ion-icon", { name: "mail", class: "mail", slot: "start" }), index.h("ion-label", { class: "ion-text-wrap" }, index.h("h5", null, "Email"), index.h("p", null, (_m = this.user) === null || _m === void 0 ? void 0 : _m.email)))), ((_o = this.user) === null || _o === void 0 ? void 0 : _o.slackHandle) && (index.h("ion-item", null, index.h("ion-icon", { name: "logo-slack", class: "slack", slot: "start" }), index.h("ion-label", { class: "ion-text-wrap" }, index.h("h5", null, "Slack Handle "), index.h("p", null, "@", this.user.slackHandle)))), ((_p = this.user) === null || _p === void 0 ? void 0 : _p.company) && (index.h("ion-item", null, index.h("ion-icon", { name: "business", class: "business", slot: "start" }), index.h("ion-label", { class: "ion-text-wrap" }, index.h("h5", null, "Company"), index.h("p", null, (_r = (_q = this.user) === null || _q === void 0 ? void 0 : _q.company) === null || _r === void 0 ? void 0 : _r.name)))), ((_s = this.user) === null || _s === void 0 ? void 0 : _s.location) && (index.h("ion-item", null, index.h("ion-icon", { name: "business", slot: "start" }), index.h("ion-label", { class: "ion-text-wrap" }, index.h("h5", null, "Location"), index.h("p", null, (_u = (_t = this.user) === null || _t === void 0 ? void 0 : _t.location) === null || _u === void 0 ? void 0 : _u.name)))), ((_v = this.user) === null || _v === void 0 ? void 0 : _v.rating) && (index.h("ion-item", null, index.h("ion-icon", { name: "star", class: "star", slot: "start" }), index.h("ion-label", { class: "ion-text-wrap" }, index.h("h5", null, "Rating"), index.h("p", null, (_w = this.user) === null || _w === void 0 ? void 0 :
      _w.rating, " Stars")))), ((_x = this.user) === null || _x === void 0 ? void 0 : _x.birthday) && (index.h("ion-item", null, index.h("ion-icon", { name: "ice-cream", class: "ice-cream", slot: "start" }), index.h("ion-label", { class: "ion-text-wrap" }, index.h("h5", null, "Birthday"), index.h("p", null, (_y = this.user) === null || _y === void 0 ? void 0 : _y.birthday)))), ((_z = this.user) === null || _z === void 0 ? void 0 : _z.referredBy) && (index.h("ion-item", null, index.h("ion-icon", { name: "ear", class: "ear", slot: "start" }), index.h("ion-label", { class: "ion-text-wrap" }, index.h("h5", null, "Referred By"), index.h("p", null, ((_1 = (_0 = this.user) === null || _0 === void 0 ? void 0 : _0.referredBy) === null || _1 === void 0 ? void 0 : _1.firstName)
      ? this.user.referredBy.firstName
      : "", " ", ((_3 = (_2 = this.user) === null || _2 === void 0 ? void 0 : _2.referredBy) === null || _3 === void 0 ? void 0 : _3.firstName)
      ? this.user.referredBy.firstName
      : "")))))));
  }
};
PopoverUser.style = popoverUserCss;

exports.popover_user = PopoverUser;
