'use strict';

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

const index = require('./index-3e5ae956.js');
const hardwareBackButton = require('./overlays-b3b752a6.js');
const store = require('./store-c1e254ab.js');
require('./ionic-global-81d6a4bb.js');
require('./helpers-905b0d22.js');
require('./index-b020f7d8.js');
require('./getHandlebarsHelpers-93797155.js');
require('./_commonjsHelpers-a5111d61.js');
require('./index-ba857994.js');
require('./localforage-af1b8c0e.js');

const appJobNewCss = "";

const AppJobNew = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.referring = false;
    this.isAgent = false;
    this.locationId = undefined;
    this.agentId = undefined;
    this.to = undefined;
    this.name = undefined;
  }
  async onSuccess(event) {
    if (event.detail.name === "recommendation") {
      this.to = null;
      this.name = null;
      (await hardwareBackButton.toastController.create({
        message: `Successfully sent recommendation(s).`,
        duration: 3000,
      })).present();
    }
  }
  onBeforeSubmit(formData) {
    var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
    return {
      templateId: "BaGYHYB6q7UBmgvoPATx",
      from: "info@thefloodteam.com",
      emails: ((_b = (_a = formData === null || formData === void 0 ? void 0 : formData.to) === null || _a === void 0 ? void 0 : _a.split) === null || _b === void 0 ? void 0 : _b.call(_a, ",")) || [],
      data: {
        firstName: (formData === null || formData === void 0 ? void 0 : formData.name) || "there",
        url: `${store.state.config.url}?referredBy=${(_c = store.state.profile) === null || _c === void 0 ? void 0 : _c.id}`,
        partner: {
          id: (_d = store.state === null || store.state === void 0 ? void 0 : store.state.session) === null || _d === void 0 ? void 0 : _d.uid,
          name: `${((_e = store.state === null || store.state === void 0 ? void 0 : store.state.profile) === null || _e === void 0 ? void 0 : _e.firstName) || ""} ${((_f = store.state === null || store.state === void 0 ? void 0 : store.state.profile) === null || _f === void 0 ? void 0 : _f.lastName) || ""}`,
          company: ((_h = (_g = store.state === null || store.state === void 0 ? void 0 : store.state.profile) === null || _g === void 0 ? void 0 : _g.company) === null || _h === void 0 ? void 0 : _h.name) || "The Flood Team",
          title: ((_j = store.state === null || store.state === void 0 ? void 0 : store.state.profile) === null || _j === void 0 ? void 0 : _j.type) || "Mitigation Specialist",
          phone: (_k = store.state === null || store.state === void 0 ? void 0 : store.state.profile) === null || _k === void 0 ? void 0 : _k.phone,
          location: (_m = (_l = store.state === null || store.state === void 0 ? void 0 : store.state.profile) === null || _l === void 0 ? void 0 : _l.location) === null || _m === void 0 ? void 0 : _m.name,
        },
      },
    };
  }
  componentDidLoad() {
    if (!(index.Build === null || index.Build === void 0 ? void 0 : index.Build.isBrowser))
      return;
  }
  render() {
    var _a, _b, _c, _d;
    return [
      index.h("ion-content", { class: "ion-padding" }, index.h("floodteam-title-bar", null, index.h("ion-router-link", { href: "/jobs" }, "Jobs")), index.h("ion-card", { style: {
          width: "90%",
          maxWidth: "800px",
          margin: "10% auto",
        } }, index.h("floodteam-book-flow", { agentId: (this.isAgent && this.agentId) || null, referralId: (this.referring && ((_a = store.state === null || store.state === void 0 ? void 0 : store.state.session) === null || _a === void 0 ? void 0 : _a.uid)) || null, googleMapsKey: (_c = (_b = store.state === null || store.state === void 0 ? void 0 : store.state.config) === null || _b === void 0 ? void 0 : _b.firebase) === null || _c === void 0 ? void 0 : _c.apiKey, locationId: this.locationId || ((_d = store.state === null || store.state === void 0 ? void 0 : store.state.claims) === null || _d === void 0 ? void 0 : _d.locationId) }))),
      index.h("floodteam-navigation-footer", null),
    ];
  }
};
AppJobNew.style = appJobNewCss;

exports.app_job_new = AppJobNew;
