'use strict';

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

const index = require('./index-fd2bbf0b.js');
const store = require('./store-f2110833.js');
const getParameter = require('./getParameter-d4ebbfe2.js');
const hardwareBackButton = require('./overlays-de05dc6a.js');
require('./index-81aa1bcb.js');
require('./getCache-c039a6ae.js');
require('./ionic-global-1340f737.js');
require('./helpers-c2496722.js');

const appJobNewCss = "";

let AppJobNew = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.referring = false;
  }
  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;
    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-grid", null, index.h("ion-row", null, index.h("ion-col", { size: "12", sizeMd: "6" }, index.h("h1", { class: "title" }, this.referring ? "Refer A Flood" : "Add Job"), index.h("floodteam-book-now", { referring: this.referring, referralId: (_a = store.state === null || store.state === void 0 ? void 0 : store.state.session) === null || _a === void 0 ? void 0 : _a.uid, token: getParameter.getParameter("token"), locationId: getParameter.getParameter("location") })), index.h("ion-col", { size: "12", sizeMd: "6" }, index.h("h1", { class: "title" }, "Recommend Us"), index.h("ion-card", null, index.h("ion-card-content", { class: "ion-padding" }, index.h("p", null, "Enter the email or phone of the person you would like to recommend The Flood Team water damage restoration services to and we will send them an email detailing how we can help."), index.h("br", null), index.h("fireenjin-form", { hideControls: true, name: "recommendation", endpoint: "sendTemplateEmail", disableEnterButton: true, beforeSubmit: this.onBeforeSubmit.bind(this) }, index.h("ion-grid", null, index.h("ion-row", null, index.h("ion-col", null, index.h("fireenjin-input", { name: "name", placeholder: "Customer's Name", value: this.name }), index.h("fireenjin-input", { name: "to", placeholder: "Customer's Email", value: this.to }))), index.h("ion-row", null, index.h("ion-col", null, index.h("ion-button", { size: "default", expand: "block", type: "submit" }, "Send", index.h("ion-icon", { name: "send", slot: "end" })))))))))))),
      index.h("floodteam-navigation-footer", null),
    ];
  }
};
AppJobNew.style = appJobNewCss;

exports.app_job_new = AppJobNew;

//# sourceMappingURL=app-job-new.cjs.entry.js.map