'use strict';

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

const index = require('./index-cba1c3ae.js');
const store = require('./store-140a5df9.js');
require('./getHandlebarsHelpers-7b2b1728.js');
require('./_commonjsHelpers-a5111d61.js');
require('./logic-d8c34975.js');
require('./index-1f381af8.js');
require('./localforage-af1b8c0e.js');

const appPayCss = "";

const AppPay = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.fireenjinFetch = index.createEvent(this, "fireenjinFetch", 7);
    this.user = {};
  }
  async fetchJob() {
    if (!this.jobId)
      return;
    this.fireenjinFetch.emit({
      endpoint: "findJob",
      params: {
        id: this.jobId,
        withPayments: true,
        withUsers: true,
        withSites: true,
        withPayModel: true,
        withPhotos: true,
        withEfiles: true,
        withPayables: false,
        withReadings: true,
      },
    });
  }
  componentDidLoad() {
    if (!(store.state === null || store.state === void 0 ? void 0 : store.state.job) && this.jobId)
      this.fetchJob();
  }
  render() {
    var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
    return [
      index.h("ion-content", { class: "ion-padding" }, index.h("floodteam-title-bar", { back: `/jobs/${this.jobId}`, icon: "logo-usd" }, index.h("ion-router-link", { href: "/payments" }, "Payments")), index.h("floodteam-epay", { jobId: this.jobId, stripeKey: ((_a = store.state === null || store.state === void 0 ? void 0 : store.state.job) === null || _a === void 0 ? void 0 : _a.isFranchise) && ((_d = (_c = (_b = store.state.config) === null || _b === void 0 ? void 0 : _b.franchise) === null || _c === void 0 ? void 0 : _c.stripe) === null || _d === void 0 ? void 0 : _d.key)
          ? store.state.config.franchise.stripe.key
          : (_f = (_e = store.state.config) === null || _e === void 0 ? void 0 : _e.stripe) === null || _f === void 0 ? void 0 : _f.key, dadeKey: ((_g = store.state === null || store.state === void 0 ? void 0 : store.state.job) === null || _g === void 0 ? void 0 : _g.isFranchise) && ((_k = (_j = (_h = store.state.config) === null || _h === void 0 ? void 0 : _h.franchise) === null || _j === void 0 ? void 0 : _j.dade) === null || _k === void 0 ? void 0 : _k.apiKey)
          ? store.state.config.franchise.dade.apiKey
          : (_m = (_l = store.state.config) === null || _l === void 0 ? void 0 : _l.dade) === null || _m === void 0 ? void 0 : _m.apiKey, dadeUrl: ((_o = store.state === null || store.state === void 0 ? void 0 : store.state.job) === null || _o === void 0 ? void 0 : _o.isFranchise) && ((_r = (_q = (_p = store.state.config) === null || _p === void 0 ? void 0 : _p.franchise) === null || _q === void 0 ? void 0 : _q.dade) === null || _r === void 0 ? void 0 : _r.url)
          ? store.state.config.franchise.dade.url
          : (_t = (_s = store.state.config) === null || _s === void 0 ? void 0 : _s.dade) === null || _t === void 0 ? void 0 : _t.url, userId: (_u = store.state === null || store.state === void 0 ? void 0 : store.state.session) === null || _u === void 0 ? void 0 : _u.uid })),
      index.h("floodteam-navigation-footer", null),
    ];
  }
};
AppPay.style = appPayCss;

exports.app_pay = AppPay;
