<template>
  <div>
    <div v-if="formState.ready">
      <gz-error :error-box-message="formState.errorBoxMessage"></gz-error>
      <v-form ref="form">
        <v-row dense>
          <v-col cols="12">
            <div class="text-h4 primary--text">
              {{ $sock.t("BusinessSettings") }}
            </div>
          </v-col>

          <!-- --------------COMPANY ADDRESS ETC ---------------- -->

          <v-col cols="12">
            <div class="text-h4 primary--text">
              {{ $sock.t("CompanyInformation") }}
            </div>
          </v-col>
          <v-col cols="12" sm="6" lg="4" xl="3">
            <gz-url
              ref="webAddress"
              v-model="obj.webAddress"
              :readonly="formState.readOnly"
              :label="$sock.t('WebAddress')"
              data-cy="webAddress"
              :error-messages="form().serverErrors(this, 'webAddress')"
              @input="fieldValueChanged('webAddress')"
            ></gz-url>
          </v-col>

          <v-col cols="12" sm="6" lg="4" xl="3">
            <gz-email
              ref="emailAddress"
              v-model="obj.emailAddress"
              :readonly="formState.readOnly"
              :label="$sock.t('CompanyEmail')"
              data-cy="emailAddress"
              :error-messages="form().serverErrors(this, 'emailAddress')"
              @input="fieldValueChanged('emailAddress')"
            ></gz-email>
          </v-col>

          <v-col cols="12" sm="6" lg="4" xl="3">
            <gz-phone
              ref="phone1"
              v-model="obj.phone1"
              :readonly="formState.readOnly"
              :label="$sock.t('CompanyPhone1')"
              data-cy="phone1"
              :error-messages="form().serverErrors(this, 'phone1')"
              @input="fieldValueChanged('phone1')"
            ></gz-phone>
          </v-col>

          <v-col cols="12" sm="6" lg="4" xl="3">
            <gz-phone
              ref="phone2"
              v-model="obj.phone2"
              :readonly="formState.readOnly"
              :label="$sock.t('CompanyPhone2')"
              data-cy="phone2"
              :error-messages="form().serverErrors(this, 'phone2')"
              @input="fieldValueChanged('phone2')"
            ></gz-phone>
          </v-col>

          <v-col cols="12">
            <span class="text-subtitle-1">
              {{ $sock.t("AddressTypePhysical") }}</span
            >
          </v-col>
          <v-col cols="12" sm="6" lg="4" xl="3">
            <v-text-field
              ref="address"
              v-model="obj.address"
              dense
              :readonly="formState.readOnly"
              :label="$sock.t('AddressDeliveryAddress')"
              data-cy="address"
              :error-messages="form().serverErrors(this, 'address')"
              @input="fieldValueChanged('address')"
            ></v-text-field>
          </v-col>

          <v-col cols="12" sm="6" lg="4" xl="3">
            <v-text-field
              ref="city"
              v-model="obj.city"
              dense
              :readonly="formState.readOnly"
              :label="$sock.t('AddressCity')"
              data-cy="city"
              :error-messages="form().serverErrors(this, 'city')"
              @input="fieldValueChanged('city')"
            ></v-text-field>
          </v-col>

          <v-col cols="12" sm="6" lg="4" xl="3">
            <v-text-field
              ref="region"
              v-model="obj.region"
              dense
              :readonly="formState.readOnly"
              :label="$sock.t('AddressStateProv')"
              data-cy="region"
              :error-messages="form().serverErrors(this, 'region')"
              @input="fieldValueChanged('region')"
            ></v-text-field>
          </v-col>

          <v-col cols="12" sm="6" lg="4" xl="3">
            <v-text-field
              ref="country"
              v-model="obj.country"
              dense
              :readonly="formState.readOnly"
              :label="$sock.t('AddressCountry')"
              data-cy="country"
              :error-messages="form().serverErrors(this, 'country')"
              @input="fieldValueChanged('country')"
            ></v-text-field>
          </v-col>

          <v-col cols="12" sm="6" lg="4" xl="3">
            <v-text-field
              ref="addressPostal"
              v-model="obj.addressPostal"
              dense
              :readonly="formState.readOnly"
              :label="$sock.t('AddressPostal')"
              data-cy="addressPostal"
              :error-messages="form().serverErrors(this, 'addressPostal')"
              @input="fieldValueChanged('addressPostal')"
            ></v-text-field>
          </v-col>

          <v-col cols="12" sm="6" lg="4" xl="3">
            <gz-decimal
              ref="latitude"
              v-model="obj.latitude"
              :readonly="formState.readOnly"
              :label="$sock.t('AddressLatitude')"
              data-cy="latitude"
              :rules="[form().decimalValid(this, 'latitude')]"
              :error-messages="form().serverErrors(this, 'latitude')"
              :precision="6"
              @input="fieldValueChanged('latitude')"
            ></gz-decimal>
          </v-col>

          <v-col cols="12" sm="6" lg="4" xl="3">
            <gz-decimal
              ref="longitude"
              v-model="obj.longitude"
              :readonly="formState.readOnly"
              :label="$sock.t('AddressLongitude')"
              data-cy="longitude"
              :rules="[form().decimalValid(this, 'longitude')]"
              :error-messages="form().serverErrors(this, 'longitude')"
              :precision="6"
              @input="fieldValueChanged('longitude')"
            ></gz-decimal>
          </v-col>

          <v-col cols="12">
            <span class="text-subtitle-1">
              {{ $sock.t("AddressTypePostal") }}</span
            >
          </v-col>

          <v-col cols="12" sm="6" lg="4" xl="3">
            <v-text-field
              ref="postAddress"
              v-model="obj.postAddress"
              dense
              :readonly="formState.readOnly"
              :label="$sock.t('AddressPostalDeliveryAddress')"
              data-cy="postAddress"
              :error-messages="form().serverErrors(this, 'postAddress')"
              @input="fieldValueChanged('postAddress')"
            ></v-text-field>
          </v-col>

          <v-col cols="12" sm="6" lg="4" xl="3">
            <v-text-field
              ref="postCity"
              v-model="obj.postCity"
              dense
              :readonly="formState.readOnly"
              :label="$sock.t('AddressPostalCity')"
              data-cy="postCity"
              :error-messages="form().serverErrors(this, 'postCity')"
              @input="fieldValueChanged('postCity')"
            ></v-text-field>
          </v-col>

          <v-col cols="12" sm="6" lg="4" xl="3">
            <v-text-field
              ref="postRegion"
              v-model="obj.postRegion"
              dense
              :readonly="formState.readOnly"
              :label="$sock.t('AddressPostalStateProv')"
              data-cy="postRegion"
              :error-messages="form().serverErrors(this, 'postRegion')"
              @input="fieldValueChanged('postRegion')"
            ></v-text-field>
          </v-col>

          <v-col cols="12" sm="6" lg="4" xl="3">
            <v-text-field
              ref="postCountry"
              v-model="obj.postCountry"
              dense
              :readonly="formState.readOnly"
              :label="$sock.t('AddressPostalCountry')"
              data-cy="postCountry"
              :error-messages="form().serverErrors(this, 'postCountry')"
              @input="fieldValueChanged('postCountry')"
            ></v-text-field>
          </v-col>

          <v-col cols="12" sm="6" lg="4" xl="3">
            <v-text-field
              ref="postCode"
              v-model="obj.postCode"
              dense
              :readonly="formState.readOnly"
              :label="$sock.t('AddressPostalPostal')"
              data-cy="postCode"
              :error-messages="form().serverErrors(this, 'postCode')"
              @input="fieldValueChanged('postCode')"
            ></v-text-field>
          </v-col>

          <!-- -------------------- /ADDRESS CONTACT INFO ------------------------------ -->

          <v-col cols="12" class="mt-8">
            <span class="text-h4 primary--text">
              {{ $sock.t("UserInterfaceSettings") }}</span
            >
          </v-col>
          <v-col cols="12" sm="6" lg="4" xl="3">
            <v-btn to="adm-global-logo">{{ $sock.t("GlobalLogo") }}</v-btn>
          </v-col>
          <v-col cols="12" sm="6" lg="4" xl="3">
            <v-btn to="adm-global-select-templates">{{
              $sock.t("PickListTemplates")
            }}</v-btn></v-col
          >
          <!-- ######################################################## -->
          <v-col cols="12" class="mt-8">
            <span class="text-h4 primary--text"> Email templates</span>
          </v-col>

          <v-col cols="12">
            <v-textarea
              ref="v7NewKey"
              v-model="obj.v7NewKey"
              :readonly="formState.readOnly"
              :label="$sock.t('GlobalV7NewKey')"
              :error-messages="form().serverErrors(this, 'v7NewKey')"
              data-cy="v7NewKey"
              auto-grow
              @input="fieldValueChanged('v7NewKey')"
            ></v-textarea>
          </v-col>

          <v-col cols="12">
            <v-textarea
              ref="v7AddOnKey"
              v-model="obj.v7AddOnKey"
              :readonly="formState.readOnly"
              :label="$sock.t('GlobalV7AddOnKey')"
              :error-messages="form().serverErrors(this, 'v7AddOnKey')"
              data-cy="v7AddOnKey"
              auto-grow
              @input="fieldValueChanged('v7AddOnKey')"
            ></v-textarea>
          </v-col>

          <v-col cols="12">
            <v-textarea
              ref="v7TemporaryTrial"
              v-model="obj.v7TemporaryTrial"
              :readonly="formState.readOnly"
              :label="$sock.t('GlobalV7TemporaryTrial')"
              :error-messages="form().serverErrors(this, 'v7TemporaryTrial')"
              data-cy="v7TemporaryTrial"
              auto-grow
              @input="fieldValueChanged('v7TemporaryTrial')"
            ></v-textarea>
          </v-col>

          <v-col cols="12">
            <v-textarea
              ref="ravenNewKeyAvailable"
              v-model="obj.ravenNewKeyAvailable"
              :readonly="formState.readOnly"
              :label="$sock.t('GlobalRavenNewKeyAvailable')"
              :error-messages="
                form().serverErrors(this, 'ravenNewKeyAvailable')
              "
              data-cy="ravenNewKeyAvailable"
              auto-grow
              @input="fieldValueChanged('ravenNewKeyAvailable')"
            ></v-textarea>
          </v-col>

          <v-col cols="12">
            <v-textarea
              ref="validateEmail"
              v-model="obj.validateEmail"
              :readonly="formState.readOnly"
              :label="$sock.t('GlobalValidateEmail')"
              :error-messages="form().serverErrors(this, 'validateEmail')"
              data-cy="validateEmail"
              auto-grow
              @input="fieldValueChanged('validateEmail')"
            ></v-textarea>
          </v-col>

          <v-col cols="12">
            <v-textarea
              ref="ravenTrialApproved"
              v-model="obj.ravenTrialApproved"
              :readonly="formState.readOnly"
              :label="$sock.t('GlobalRavenTrialApproved')"
              :error-messages="form().serverErrors(this, 'ravenTrialApproved')"
              data-cy="ravenTrialApproved"
              auto-grow
              @input="fieldValueChanged('ravenTrialApproved')"
            ></v-textarea>
          </v-col>

          <v-col cols="12">
            <v-textarea
              ref="ravenTrialRejected"
              v-model="obj.ravenTrialRejected"
              :readonly="formState.readOnly"
              :label="$sock.t('GlobalRavenTrialRejected')"
              :error-messages="form().serverErrors(this, 'ravenTrialRejected')"
              data-cy="ravenTrialRejected"
              auto-grow
              @input="fieldValueChanged('ravenTrialRejected')"
            ></v-textarea>
          </v-col>

          <!-- ######################################################## -->
          <v-col cols="12" class="mt-8">
            <div class="text-h4 primary--text">
              {{ $sock.t("CustomerAccessSettings") }}
            </div>
          </v-col>

          <v-col cols="12">
            <v-expansion-panels>
              <v-expansion-panel key="3">
                <v-expansion-panel-header>
                  <span class="text-h6">
                    {{ $sock.t("UserSettings") }}
                  </span>
                </v-expansion-panel-header>
                <v-expansion-panel-content>
                  <v-row dense>
                    <v-col cols="12" sm="6" lg="2">
                      <v-checkbox
                        ref="customerAllowUserSettings"
                        v-model="obj.customerAllowUserSettings"
                        dense
                        :readonly="formState.readOnly"
                        :label="$sock.t('Active')"
                        data-cy="customerAllowUserSettings"
                        :error-messages="
                          form().serverErrors(this, 'customerAllowUserSettings')
                        "
                        @change="fieldValueChanged('customerAllowUserSettings')"
                      ></v-checkbox>
                    </v-col>
                    <template v-if="obj.customerAllowUserSettings">
                      <v-col cols="12" sm="6" lg="10">
                        <gz-tag-picker
                          ref="customerAllowUserSettingsInTags"
                          v-model="obj.customerAllowUserSettingsInTags"
                          :readonly="formState.readOnly"
                          :label="
                            $sock.t('ContactCustomerHeadOfficeTaggedWith')
                          "
                          data-cy="customerAllowUserSettingsInTags"
                          :error-messages="
                            form().serverErrors(
                              this,
                              'customerAllowUserSettingsInTags'
                            )
                          "
                          @input="
                            fieldValueChanged('customerAllowUserSettingsInTags')
                          "
                        ></gz-tag-picker>
                      </v-col>
                    </template>
                  </v-row>
                </v-expansion-panel-content>
              </v-expansion-panel>
              <v-expansion-panel key="4">
                <v-expansion-panel-header>
                  <span class="text-h6">
                    {{ $sock.t("NotifySubscriptionList") }}
                  </span>
                </v-expansion-panel-header>
                <v-expansion-panel-content>
                  <v-row dense>
                    <v-col cols="12" sm="6" lg="3">
                      <v-checkbox
                        ref="customerAllowNotifyServiceImminent"
                        v-model="obj.customerAllowNotifyServiceImminent"
                        dense
                        :readonly="formState.readOnly"
                        :label="$sock.t('NotifyEventCustomerServiceImminent')"
                        data-cy="customerAllowNotifyServiceImminent"
                        :error-messages="
                          form().serverErrors(
                            this,
                            'customerAllowNotifyServiceImminent'
                          )
                        "
                        @change="
                          fieldValueChanged(
                            'customerAllowNotifyServiceImminent'
                          )
                        "
                      ></v-checkbox>
                    </v-col>

                    <v-col
                      v-if="obj.customerAllowNotifyServiceImminent"
                      cols="12"
                      sm="6"
                      lg="9"
                    >
                      <gz-tag-picker
                        ref="customerAllowNotifyServiceImminentInTags"
                        v-model="obj.customerAllowNotifyServiceImminentInTags"
                        :readonly="formState.readOnly"
                        :label="$sock.t('ContactCustomerHeadOfficeTaggedWith')"
                        data-cy="customerAllowNotifyServiceImminentInTags"
                        :error-messages="
                          form().serverErrors(
                            this,
                            'customerAllowNotifyServiceImminentInTags'
                          )
                        "
                        @input="
                          fieldValueChanged(
                            'customerAllowNotifyServiceImminentInTags'
                          )
                        "
                      ></gz-tag-picker>
                    </v-col>
                  </v-row>
                </v-expansion-panel-content>
              </v-expansion-panel>
            </v-expansion-panels>
          </v-col>
          <!-- **************************************************** -->
        </v-row>
      </v-form>
    </div>
    <v-overlay :value="!formState.ready || formState.loading">
      <v-progress-circular indeterminate :size="64" />
    </v-overlay>
  </div>
</template>
<script>
const FORM_KEY = "global-settings-edit";
const API_BASE_URL = "global-biz-setting/";
export default {
  data() {
    return {
      obj: {
        id: 0,
        concurrency: 0,
        filterCaseSensitive: false,
        customerAllowUserSettings: false,
        customerAllowUserSettingsInTags: [],
        v7NewKey: null,
        v7AddOnKey: null,
        v7TemporaryTrial: null,
        ravenNewKeyAvailable: null,
        validateEmail: null,
        ravenTrialApproved: null,
        ravenTrialRejected: null
      },
      formState: {
        ready: false,
        dirty: false,
        valid: true,
        readOnly: false,
        loading: true,
        errorBoxMessage: null,
        appError: null,
        serverError: {}
      },
      rights: window.$gz.role.defaultRightsObject(),
      sockType: window.$gz.type.Project,
      listgroupitems: []
    };
  },
  watch: {
    formState: {
      handler: function(val) {
        if (this.formState.loading) {
          return;
        }

        if (val.dirty && val.valid && !val.readOnly) {
          window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":save");
        } else {
          window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":save");
        }
      },
      deep: true
    }
  },
  async created() {
    const vm = this;
    try {
      await initForm();
      vm.rights = window.$gz.role.getRights(window.$gz.type.Global);
      vm.formState.readOnly = !vm.rights.change;
      window.$gz.eventBus.$on("menu-click", clickHandler);
      //NOTE: slightly different in this form as there is only ever a single global object so no need for a bunch of code
      //is there already an obj from a prior operation?
      if (this.$route.params.obj) {
        //yes, no need to fetch it
        this.obj = this.$route.params.obj;
        window.$gz.form.setFormState({
          vm: vm,
          loading: false
        });
      } else {
        await vm.getDataFromApi();
      }
      window.$gz.form.setFormState({
        vm: vm,
        dirty: false,
        valid: true
      });
      generateMenu(vm);
    } catch (error) {
      window.$gz.errorHandler.handleFormError(error, vm);
    } finally {
      vm.formState.ready = true;
    }
  },
  async beforeRouteLeave(to, from, next) {
    if (!this.formState.dirty) {
      next();
      return;
    }
    if ((await window.$gz.dialog.confirmLeaveUnsaved()) === true) {
      next();
    } else {
      next(false);
    }
  },
  beforeDestroy() {
    window.$gz.eventBus.$off("menu-click", clickHandler);
  },
  methods: {
    canSave: function() {
      return this.formState.valid && this.formState.dirty;
    },
    sockTypes: function() {
      return window.$gz.type;
    },
    form() {
      return window.$gz.form;
    },
    fieldValueChanged(ref) {
      if (
        this.formState.ready &&
        !this.formState.loading &&
        !this.formState.readOnly
      ) {
        window.$gz.form.fieldValueChanged(this, ref);
      }
    },
    async getDataFromApi() {
      const vm = this;
      window.$gz.form.setFormState({
        vm: vm,
        loading: true
      });
      try {
        window.$gz.form.deleteAllErrorBoxErrors(vm);
        const res = await window.$gz.api.get(API_BASE_URL);
        if (res.error) {
          if (res.error.code == "2010") {
            window.$gz.form.handleObjectNotFound(vm);
          }
          vm.formState.serverError = res.error;
          window.$gz.form.setErrorBoxErrors(vm);
        } else {
          vm.obj = res.data;
          generateMenu(vm);
          window.$gz.form.setFormState({
            vm: vm,
            dirty: false,
            valid: true,
            loading: false
          });
        }
      } catch (error) {
        window.$gz.errorHandler.handleFormError(error, vm);
      } finally {
        window.$gz.form.setFormState({
          vm: vm,
          loading: false
        });
      }
    },
    async submit() {
      const vm = this;
      if (vm.canSave == false) {
        return;
      }
      try {
        window.$gz.form.setFormState({
          vm: vm,
          loading: true
        });
        window.$gz.form.deleteAllErrorBoxErrors(vm);
        const res = await window.$gz.api.put(API_BASE_URL, vm.obj);
        if (res.error) {
          vm.formState.serverError = res.error;
          window.$gz.form.setErrorBoxErrors(vm);
        } else {
          //PUT
          vm.obj.concurrency = res.data.concurrency;
          window.$gz.form.setFormState({
            vm: vm,
            dirty: false,
            valid: true
          });
          //refresh the local global settings cache so user can try their settings right away
          //get the client version of the global settings object values
          const gsets = await window.$gz.api.get("global-biz-setting/client");
          if (!gsets.error) {
            window.$gz.store.commit("setGlobalSettings", gsets.data);
          }
        }
      } catch (ex) {
        window.$gz.errorHandler.handleFormError(ex, vm);
      } finally {
        window.$gz.form.setFormState({
          vm: vm,
          loading: false
        });
      }
    },
    async erase() {
      const vm = this;

      try {
        if (this.dbIsEmpty != true) {
          let dialogResult = await window.$gz.dialog.confirmGeneric(
            "AdminEraseDatabaseWarning",
            "dire"
          );
          if (dialogResult == false) {
            return;
          }

          dialogResult = await window.$gz.dialog.confirmGeneric(
            "AdminEraseDatabaseLastWarning",
            "dire"
          );
          if (dialogResult == false) {
            return;
          }
        }
        //call erase
        window.$gz.erasingDatabase = true; //suspend notify polling
        await window.$gz.api.upsert(
          API_BASE_URL + "permanently-erase-all-data",
          "I bloody understand"
        );

        vm.$router.push("/login");
      } catch (error) {
        window.$gz.errorHandler.handleFormError(error, vm);
      }
    },
    async import() {
      const vm = this;

      try {
        if (this.dbIsEmpty != true) {
          let dialogResult = await window.$gz.dialog.confirmGeneric(
            "Import",
            "warning"
          );
          if (dialogResult == false) {
            return;
          }
        }

        window.$gz.erasingDatabase = true; //suspend notify polling
        await window.$gz.api.upsert(API_BASE_URL + "import-rockfish");

        //vm.$router.push("/login");
      } catch (error) {
        window.$gz.errorHandler.handleFormError(error, vm);
      }
    }
  }
};

/////////////////////////////
//
//
async function clickHandler(menuItem) {
  if (!menuItem) {
    return;
  }
  const m = window.$gz.menu.parseMenuItem(menuItem);
  if (m.owner == FORM_KEY && !m.disabled) {
    switch (m.key) {
      case "save":
        m.vm.submit();
        break;
      case "erase":
        m.vm.erase();
        break;
      case "import-rockfish":
        m.vm.import();
        break;
      default:
        window.$gz.eventBus.$emit(
          "notify-warning",
          FORM_KEY + "::context click: [" + m.key + "]"
        );
    }
  }
}

//////////////////////
//
//
function generateMenu(vm) {
  const menuOptions = {
    isMain: false,
    readOnly: vm.formState.readOnly,
    icon: "$sockiCogs",
    title: "AdministrationGlobalSettings",
    helpUrl: "adm-global-settings",
    formData: {
      sockType: window.$gz.type.Project,
      recordId: vm.$route.params.recordid,
      recordName: vm.$sock.t("AdministrationGlobalSettings")
    },
    menuItems: []
  };
  if (vm.rights.change) {
    menuOptions.menuItems.push({
      title: "Save",
      icon: "$sockiSave",
      surface: true,
      key: FORM_KEY + ":save",
      vm: vm
    });
  }
  menuOptions.menuItems.push({ divider: true, inset: false });
  menuOptions.menuItems.push({
    title: "AdminEraseDatabase",
    icon: "$sockiSkullCrossbones",
    key: FORM_KEY + ":erase",
    vm: vm
  });
  menuOptions.menuItems.push({
    title: "Import",
    icon: "$sockiFileImport",
    key: FORM_KEY + ":import-rockfish",
    vm: vm
  });
  menuOptions.menuItems.push({ divider: true, inset: false });
  menuOptions.menuItems.push({ divider: true, inset: false });
  window.$gz.eventBus.$emit("menu-change", menuOptions);
}

/////////////////////////////////
//
//
async function initForm() {
  await fetchTranslatedText();
}

//////////////////////////////////////////////////////////
//
// Ensures UI translated text is available
//
async function fetchTranslatedText() {
  await window.$gz.translation.cacheTranslations([
    "DefaultReport",
    "ContactCustomerHeadOfficeTaggedWith",
    "WorkOrderCustomerTaggedWith",
    "WorkOrderContactCustomerHeadOfficeTaggedWith",
    "CustomerServiceRequestList",
    "WorkOrderList",
    "UserSettings",
    "UserInterfaceSettings",
    "BusinessSettings",
    "CustomerAccessSettings",
    "PickListTemplates",
    "GlobalLogo",
    "GlobalUseInventory",
    "GlobalFilterCaseSensitive",
    "GlobalTaxPartPurchaseID",
    "GlobalTaxPartSaleID",
    "GlobalTaxRateSaleID",
    "GlobalWorkOrderCompleteByAge",
    "GlobalLaborSchedUserDfltTimeSpan",
    "GlobalTravelDfltTimeSpan",
    "CustomerAccessWorkOrderWiki",
    "CustomerAccessWorkOrderAttachments",
    "NotifySubscriptionList",
    "NotifyEventCustomerServiceImminent",
    "NotifyEventCSRAccepted",
    "NotifyEventCSRRejected",
    "NotifyEventWorkorderCreatedForCustomer",
    "NotifyEventWorkorderCompleted",
    "CustomerAccessWorkOrderReport",
    "CSRInfoText",
    "CustomerAllowCreateUnit",
    "CustomerSignature",
    "GlobalSignatureFooter",
    "GlobalSignatureHeader",
    "GlobalSignatureTitle",
    "GlobalAllowScheduleConflicts",
    "CompanyInformation",
    "CompanyEmail",
    "CompanyPhone1",
    "CompanyPhone2",
    "WebAddress",
    "AddressTypePhysical",
    "AddressTypePostal",
    "Address",
    "AddressPostalDeliveryAddress",
    "AddressPostalCity",
    "AddressPostalStateProv",
    "AddressPostalCountry",
    "AddressPostalPostal",
    "AddressDeliveryAddress",
    "AddressCity",
    "AddressStateProv",
    "AddressCountry",
    "AddressPostal",
    "AddressLatitude",
    "AddressLongitude",
    "AdminEraseDatabaseWarning",
    "AdminEraseDatabase",
    "AdminEraseDatabaseLastWarning",
    "GlobalV7NewKey",
    "GlobalV7AddOnKey",
    "GlobalV7TemporaryTrial",
    "GlobalRavenNewKeyAvailable",
    "GlobalValidateEmail",
    "GlobalRavenTrialApproved",
    "GlobalRavenTrialRejected"
  ]);
}
</script>
