Merge branch 'dev' into feature/69-translation-keys
# Conflicts: # src/components/orgs/OrgDetail.svelte # src/components/runners/RunnersOverview.svelte
This commit is contained in:
		@@ -31,7 +31,7 @@
 | 
			
		||||
    isEmailValid &&
 | 
			
		||||
    isPhoneValidOrEmpty &&
 | 
			
		||||
    ((isAddress1Valid && iszipcodevalid && iscityvalid) ||
 | 
			
		||||
      address_checked === false);
 | 
			
		||||
    editable.address_checked === false);
 | 
			
		||||
  const promise = GroupContactService.groupContactControllerGetOne(
 | 
			
		||||
    params.contact
 | 
			
		||||
  ).then((data) => {
 | 
			
		||||
@@ -42,6 +42,15 @@
 | 
			
		||||
    original_data.groups = original_data.groups.map((g) => g.id);
 | 
			
		||||
    editable.address_checked = editable.address.address1 !== null;
 | 
			
		||||
    original_data.address_checked = editable.address.address1 !== null;
 | 
			
		||||
    if(editable.address_checked===false){
 | 
			
		||||
      editable.address = {
 | 
			
		||||
        address1: "",
 | 
			
		||||
        address2: "",
 | 
			
		||||
        city: "",
 | 
			
		||||
        postalcode: "",
 | 
			
		||||
        country: ""
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  });
 | 
			
		||||
  RunnerOrganizationService.runnerOrganizationControllerGetAll().then((val) => {
 | 
			
		||||
    orgs = val;
 | 
			
		||||
@@ -64,7 +73,7 @@
 | 
			
		||||
      }).showToast();
 | 
			
		||||
      editable.address.country = "DE";
 | 
			
		||||
      if (editable.address_checked === false) {
 | 
			
		||||
        editable.address = {};
 | 
			
		||||
        editable.address = null;
 | 
			
		||||
      }
 | 
			
		||||
      if (editable.email) editable.email = editable.email;
 | 
			
		||||
      if (editable.phone) editable.phone = editable.phone;
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,24 @@
 | 
			
		||||
  $: name = "";
 | 
			
		||||
  $: processed_last_submit = true;
 | 
			
		||||
  $: isOrgnameValid = name.trim().length !== 0;
 | 
			
		||||
  $: createbtnenabled = isOrgnameValid;
 | 
			
		||||
  $: isAddress1Valid = address_input1_value.trim().length !== 0;
 | 
			
		||||
  $: iszipcodevalid = address_zipcode_value.trim().length !== 0;
 | 
			
		||||
  $: iscityvalid = address_city_value.trim().length !== 0;
 | 
			
		||||
  $: createbtnenabled =
 | 
			
		||||
    isOrgnameValid &&
 | 
			
		||||
    ((isAddress1Valid && iszipcodevalid && iscityvalid) ||
 | 
			
		||||
      address_checked === false);
 | 
			
		||||
  $: address_input1_value = "";
 | 
			
		||||
  $: address_input2_value = "";
 | 
			
		||||
  $: address_zipcode_value = "";
 | 
			
		||||
  $: address_city_value = "";
 | 
			
		||||
  $: address_checked = true;
 | 
			
		||||
 | 
			
		||||
  let address_input1;
 | 
			
		||||
  let address_input2;
 | 
			
		||||
  let address_zipcode;
 | 
			
		||||
  let address_city;
 | 
			
		||||
 | 
			
		||||
  (() => {
 | 
			
		||||
    document.onkeydown = (e) => {
 | 
			
		||||
      e = e || window.event;
 | 
			
		||||
@@ -35,9 +52,19 @@
 | 
			
		||||
        text: $_("organization-is-being-added"),
 | 
			
		||||
        duration: -1,
 | 
			
		||||
      }).showToast();
 | 
			
		||||
      let address = {};
 | 
			
		||||
      if (address_checked === true) {
 | 
			
		||||
        address = {
 | 
			
		||||
          address1: address_input1_value,
 | 
			
		||||
          address2: address_input2_value || "",
 | 
			
		||||
          postalcode: address_zipcode_value,
 | 
			
		||||
          city: address_city_value,
 | 
			
		||||
          country: "DE",
 | 
			
		||||
        };
 | 
			
		||||
      }
 | 
			
		||||
      RunnerOrganizationService.runnerOrganizationControllerPost({
 | 
			
		||||
        name,
 | 
			
		||||
        address: undefined,
 | 
			
		||||
        address: address,
 | 
			
		||||
        contact: undefined,
 | 
			
		||||
      })
 | 
			
		||||
        .then((result) => {
 | 
			
		||||
@@ -128,7 +155,105 @@
 | 
			
		||||
                    </span>
 | 
			
		||||
                  {/if}
 | 
			
		||||
                </div>
 | 
			
		||||
              </div>
 | 
			
		||||
                <div class="flex items-start">
 | 
			
		||||
                  <div class="flex items-center h-5">
 | 
			
		||||
                    <input
 | 
			
		||||
                      bind:checked={address_checked}
 | 
			
		||||
                      id="comments"
 | 
			
		||||
                      name="comments"
 | 
			
		||||
                      type="checkbox"
 | 
			
		||||
                      class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded" />
 | 
			
		||||
                  </div>
 | 
			
		||||
                  <div class="ml-3 text-sm">
 | 
			
		||||
                    <label
 | 
			
		||||
                      for="comments"
 | 
			
		||||
                      class="font-medium text-gray-700">Address</label>
 | 
			
		||||
                  </div>
 | 
			
		||||
                </div>
 | 
			
		||||
              {#if address_checked === true}
 | 
			
		||||
                <div class="col-span-6">
 | 
			
		||||
                  <label
 | 
			
		||||
                    for="address1"
 | 
			
		||||
                    class="block text-sm font-medium text-gray-700">Address</label>
 | 
			
		||||
                  <input
 | 
			
		||||
                    autocomplete="off"
 | 
			
		||||
                    placeholder="Address"
 | 
			
		||||
                    class:border-red-500={!isAddress1Valid}
 | 
			
		||||
                    class:focus:border-red-500={!isAddress1Valid}
 | 
			
		||||
                    class:focus:ring-red-500={!isAddress1Valid}
 | 
			
		||||
                    bind:value={address_input1_value}
 | 
			
		||||
                    bind:this={address_input1}
 | 
			
		||||
                    type="text"
 | 
			
		||||
                    name="address1"
 | 
			
		||||
                    class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" />
 | 
			
		||||
                  {#if !isAddress1Valid}
 | 
			
		||||
                    <span
 | 
			
		||||
                      class="flex items-center font-medium tracking-wide text-red-500 text-xs mt-1 ml-1">
 | 
			
		||||
                      Address is required
 | 
			
		||||
                    </span>
 | 
			
		||||
                  {/if}
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="col-span-6">
 | 
			
		||||
                  <label
 | 
			
		||||
                    for="address2"
 | 
			
		||||
                    class="block text-sm font-medium text-gray-700">Apartment,
 | 
			
		||||
                    suite, etc.</label>
 | 
			
		||||
                  <input
 | 
			
		||||
                    autocomplete="off"
 | 
			
		||||
                    placeholder="Apartment, suite, etc."
 | 
			
		||||
                    bind:value={address_input2_value}
 | 
			
		||||
                    bind:this={address_input2}
 | 
			
		||||
                    type="text"
 | 
			
		||||
                    name="address2"
 | 
			
		||||
                    class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" />
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="col-span-6">
 | 
			
		||||
                  <label
 | 
			
		||||
                    for="zipcode"
 | 
			
		||||
                    class="block text-sm font-medium text-gray-700">ZIP/ postal
 | 
			
		||||
                    code</label>
 | 
			
		||||
                  <input
 | 
			
		||||
                    autocomplete="off"
 | 
			
		||||
                    placeholder="ZIP/ postal code"
 | 
			
		||||
                    class:border-red-500={!iszipcodevalid}
 | 
			
		||||
                    class:focus:border-red-500={!iszipcodevalid}
 | 
			
		||||
                    class:focus:ring-red-500={!iszipcodevalid}
 | 
			
		||||
                    bind:value={address_zipcode_value}
 | 
			
		||||
                    bind:this={address_zipcode}
 | 
			
		||||
                    type="text"
 | 
			
		||||
                    name="zipcode"
 | 
			
		||||
                    class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" />
 | 
			
		||||
                  {#if !iszipcodevalid}
 | 
			
		||||
                    <span
 | 
			
		||||
                      class="flex items-center font-medium tracking-wide text-red-500 text-xs mt-1 ml-1">
 | 
			
		||||
                      Valid zipcode/ postal code is required
 | 
			
		||||
                    </span>
 | 
			
		||||
                  {/if}
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="col-span-6">
 | 
			
		||||
                  <label
 | 
			
		||||
                    for="city"
 | 
			
		||||
                    class="block text-sm font-medium text-gray-700">City</label>
 | 
			
		||||
                  <input
 | 
			
		||||
                    autocomplete="off"
 | 
			
		||||
                    placeholder="City"
 | 
			
		||||
                    class:border-red-500={!iscityvalid}
 | 
			
		||||
                    class:focus:border-red-500={!iscityvalid}
 | 
			
		||||
                    class:focus:ring-red-500={!iscityvalid}
 | 
			
		||||
                    bind:value={address_city_value}
 | 
			
		||||
                    bind:this={address_city}
 | 
			
		||||
                    type="text"
 | 
			
		||||
                    name="city"
 | 
			
		||||
                    class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" />
 | 
			
		||||
                  {#if !iscityvalid}
 | 
			
		||||
                    <span
 | 
			
		||||
                      class="flex items-center font-medium tracking-wide text-red-500 text-xs mt-1 ml-1">
 | 
			
		||||
                      Valid city is required
 | 
			
		||||
                    </span>
 | 
			
		||||
                  {/if}
 | 
			
		||||
                </div>
 | 
			
		||||
              {/if}
 | 
			
		||||
            </div>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,258 +1,361 @@
 | 
			
		||||
<script>
 | 
			
		||||
  import {
 | 
			
		||||
    GroupContactService,
 | 
			
		||||
    RunnerOrganizationService,
 | 
			
		||||
  } from "@odit/lfk-client-js";
 | 
			
		||||
  import { _ } from "svelte-i18n";
 | 
			
		||||
  import Toastify from "toastify-js";
 | 
			
		||||
  import store from "../../store";
 | 
			
		||||
  import ConfirmOrgDeletion from "./ConfirmOrgDeletion.svelte";
 | 
			
		||||
  import ImportRunnerModal from "../runners/ImportRunnerModal.svelte";
 | 
			
		||||
  import PromiseError from "../base/PromiseError.svelte";
 | 
			
		||||
  $: delete_triggered = false;
 | 
			
		||||
  $: save_enabled = !data_changed;
 | 
			
		||||
  export let params;
 | 
			
		||||
  let orgdata = {};
 | 
			
		||||
  let original = {};
 | 
			
		||||
  let contacts = [];
 | 
			
		||||
  $: data_loaded = false;
 | 
			
		||||
  $: data_changed = JSON.stringify(orgdata) === JSON.stringify(original);
 | 
			
		||||
  const promise = RunnerOrganizationService.runnerOrganizationControllerGetOne(
 | 
			
		||||
    params.orgid
 | 
			
		||||
  ).then((value) => {
 | 
			
		||||
    data_loaded = true;
 | 
			
		||||
    if (value.contact) {
 | 
			
		||||
      if (value.contact !== "null") {
 | 
			
		||||
        value.contact = value.contact.id;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    orgdata = Object.assign(orgdata, value);
 | 
			
		||||
    original = Object.assign(original, value);
 | 
			
		||||
  });
 | 
			
		||||
  GroupContactService.groupContactControllerGetAll().then((val) => {
 | 
			
		||||
    contacts = val;
 | 
			
		||||
  });
 | 
			
		||||
  let modal_open = false;
 | 
			
		||||
  let delete_org = {};
 | 
			
		||||
  function deleteOrganization() {
 | 
			
		||||
    RunnerOrganizationService.runnerOrganizationControllerRemove(
 | 
			
		||||
      original.id,
 | 
			
		||||
      false
 | 
			
		||||
    )
 | 
			
		||||
      .then((resp) => {
 | 
			
		||||
        Toastify({
 | 
			
		||||
          text: $_("organization-deleted"),
 | 
			
		||||
          duration: 500,
 | 
			
		||||
          backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
 | 
			
		||||
        }).showToast();
 | 
			
		||||
        location.replace("./");
 | 
			
		||||
      })
 | 
			
		||||
      .catch((err) => {
 | 
			
		||||
        modal_open = true;
 | 
			
		||||
        delete_org = original;
 | 
			
		||||
      });
 | 
			
		||||
  }
 | 
			
		||||
  function submit() {
 | 
			
		||||
    if (data_loaded === true && save_enabled) {
 | 
			
		||||
      Toastify({
 | 
			
		||||
        text: $_("updating-organization"),
 | 
			
		||||
        duration: 2500,
 | 
			
		||||
      }).showToast();
 | 
			
		||||
      let postdata = orgdata;
 | 
			
		||||
      postdata.contact = postdata.contact === "null" ? null : postdata.contact;
 | 
			
		||||
      RunnerOrganizationService.runnerOrganizationControllerPut(
 | 
			
		||||
        original.id,
 | 
			
		||||
        postdata
 | 
			
		||||
      )
 | 
			
		||||
        .then((resp) => {
 | 
			
		||||
          Object.assign(original, orgdata);
 | 
			
		||||
          original = orgdata;
 | 
			
		||||
          Object.assign(original, orgdata);
 | 
			
		||||
          Toastify({
 | 
			
		||||
            text: $_("updated-organization"),
 | 
			
		||||
            duration: 2500,
 | 
			
		||||
            backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
 | 
			
		||||
          }).showToast();
 | 
			
		||||
        })
 | 
			
		||||
        .catch((err) => {});
 | 
			
		||||
    } else {
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  export let import_modal_open = false;
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<ImportRunnerModal
 | 
			
		||||
  on:cancelDelete={(event) => {
 | 
			
		||||
    import_modal_open = false;
 | 
			
		||||
  }}
 | 
			
		||||
  current_runners={[]}
 | 
			
		||||
  passed_team={{}}
 | 
			
		||||
  passed_orgs={[]}
 | 
			
		||||
  passed_org={orgdata}
 | 
			
		||||
  opened_from="OrgDetail"
 | 
			
		||||
  bind:import_modal_open />
 | 
			
		||||
<ConfirmOrgDeletion bind:modal_open bind:delete_org />
 | 
			
		||||
{#if data_loaded}
 | 
			
		||||
  <section class="container p-5">
 | 
			
		||||
    <div class="mb-8 text-3xl font-extrabold leading-tight">
 | 
			
		||||
      {original.name}
 | 
			
		||||
      <span data-id="org_actions_${orgdata.id}">
 | 
			
		||||
        {#if store.state.jwtinfo.userdetails.permissions.includes('RUNNER:IMPORT')}
 | 
			
		||||
          <button
 | 
			
		||||
            on:click={() => {
 | 
			
		||||
              import_modal_open = true;
 | 
			
		||||
            }}
 | 
			
		||||
            type="button"
 | 
			
		||||
            class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm">
 | 
			
		||||
            {$_('import-runners')}
 | 
			
		||||
          </button>
 | 
			
		||||
        {/if}
 | 
			
		||||
        {#if store.state.jwtinfo.userdetails.permissions.includes('USER:DELETE')}
 | 
			
		||||
          {#if delete_triggered}
 | 
			
		||||
            <button
 | 
			
		||||
              on:click={deleteOrganization}
 | 
			
		||||
              class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm">{$_('confirm-delete')}</button>
 | 
			
		||||
            <button
 | 
			
		||||
              on:click={() => {
 | 
			
		||||
                delete_triggered = !delete_triggered;
 | 
			
		||||
              }}
 | 
			
		||||
              class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-400 text-base font-medium text-white sm:w-auto sm:text-sm">{$_('cancel')}</button>
 | 
			
		||||
          {/if}
 | 
			
		||||
          {#if !delete_triggered}
 | 
			
		||||
            <button
 | 
			
		||||
              on:click={() => {
 | 
			
		||||
                delete_triggered = true;
 | 
			
		||||
              }}
 | 
			
		||||
              type="button"
 | 
			
		||||
              class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm">{$_('delete-organization')}</button>
 | 
			
		||||
          {/if}
 | 
			
		||||
        {/if}
 | 
			
		||||
        {#if !delete_triggered}
 | 
			
		||||
          <button
 | 
			
		||||
            on:click={submit}
 | 
			
		||||
            disabled={!save_enabled}
 | 
			
		||||
            class:opacity-50={!save_enabled}
 | 
			
		||||
            type="button"
 | 
			
		||||
            class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm">{$_('save-changes')}</button>
 | 
			
		||||
        {/if}
 | 
			
		||||
      </span>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="flex flex-row mb-4">
 | 
			
		||||
      <div class="w-full">
 | 
			
		||||
        <nav class="w-full flex">
 | 
			
		||||
          <ol class="list-none flex flex-row items-center justify-start">
 | 
			
		||||
            <li class="mr-2 flex items-center">
 | 
			
		||||
              <svg
 | 
			
		||||
                stroke="currentColor"
 | 
			
		||||
                fill="none"
 | 
			
		||||
                stroke-width="2"
 | 
			
		||||
                viewBox="0 0 24 24"
 | 
			
		||||
                stroke-linecap="round"
 | 
			
		||||
                stroke-linejoin="round"
 | 
			
		||||
                class="h-3 w-3 stroke-current"
 | 
			
		||||
                height="1em"
 | 
			
		||||
                width="1em"
 | 
			
		||||
                xmlns="http://www.w3.org/2000/svg"><path
 | 
			
		||||
                  d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" />
 | 
			
		||||
                <polyline points="9 22 9 12 15 12 15 22" /></svg>
 | 
			
		||||
            </li>
 | 
			
		||||
            <li class="flex items-center">
 | 
			
		||||
              <a class="mr-2" href="/">{$_('home')}</a><svg
 | 
			
		||||
                stroke="currentColor"
 | 
			
		||||
                fill="none"
 | 
			
		||||
                stroke-width="2"
 | 
			
		||||
                viewBox="0 0 24 24"
 | 
			
		||||
                stroke-linecap="round"
 | 
			
		||||
                stroke-linejoin="round"
 | 
			
		||||
                class="h-3 w-3 mr-2 stroke-current"
 | 
			
		||||
                height="1em"
 | 
			
		||||
                width="1em"
 | 
			
		||||
                xmlns="http://www.w3.org/2000/svg"><line
 | 
			
		||||
                  x1="5"
 | 
			
		||||
                  y1="12"
 | 
			
		||||
                  x2="19"
 | 
			
		||||
                  y2="12" />
 | 
			
		||||
                <polyline points="12 5 19 12 12 19" /></svg>
 | 
			
		||||
            </li>
 | 
			
		||||
            <li class="mr-2 flex items-center">
 | 
			
		||||
              <svg
 | 
			
		||||
                xmlns="http://www.w3.org/2000/svg"
 | 
			
		||||
                viewBox="0 0 24 24"
 | 
			
		||||
                width="24"
 | 
			
		||||
                height="24"><path fill="none" d="M0 0h24v24H0z" />
 | 
			
		||||
                <path
 | 
			
		||||
                  d="M21 20h2v2H1v-2h2V3a1 1 0 0 1 1-1h16a1 1 0 0 1 1 1v17zm-2 0V4H5v16h14zM8 11h3v2H8v-2zm0-4h3v2H8V7zm0 8h3v2H8v-2zm5 0h3v2h-3v-2zm0-4h3v2h-3v-2zm0-4h3v2h-3V7z" /></svg>
 | 
			
		||||
            </li>
 | 
			
		||||
            <li class="flex items-center">
 | 
			
		||||
              <a class="mr-2" href="./">{$_('organizations')}</a><svg
 | 
			
		||||
                stroke="currentColor"
 | 
			
		||||
                fill="none"
 | 
			
		||||
                stroke-width="2"
 | 
			
		||||
                viewBox="0 0 24 24"
 | 
			
		||||
                stroke-linecap="round"
 | 
			
		||||
                stroke-linejoin="round"
 | 
			
		||||
                class="h-3 w-3 mr-2 stroke-current"
 | 
			
		||||
                height="1em"
 | 
			
		||||
                width="1em"
 | 
			
		||||
                xmlns="http://www.w3.org/2000/svg"><line
 | 
			
		||||
                  x1="5"
 | 
			
		||||
                  y1="12"
 | 
			
		||||
                  x2="19"
 | 
			
		||||
                  y2="12" />
 | 
			
		||||
                <polyline points="12 5 19 12 12 19" /></svg>
 | 
			
		||||
            </li>
 | 
			
		||||
            <li class="flex items-center">
 | 
			
		||||
              <span class="mr-2">Org-Details #{params.orgid}</span>
 | 
			
		||||
            </li>
 | 
			
		||||
          </ol>
 | 
			
		||||
        </nav>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="text-sm w-full">
 | 
			
		||||
      <label for="name" class="font-medium text-gray-700">{$_('name')}</label>
 | 
			
		||||
      <input
 | 
			
		||||
        autocomplete="off"
 | 
			
		||||
        placeholder={$_('name')}
 | 
			
		||||
        type="text"
 | 
			
		||||
        bind:value={orgdata.name}
 | 
			
		||||
        name="name"
 | 
			
		||||
        class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" />
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="text-sm w-full">
 | 
			
		||||
      <label
 | 
			
		||||
        for="contact"
 | 
			
		||||
        class="font-medium text-gray-700">{$_('contact')}</label>
 | 
			
		||||
      <select
 | 
			
		||||
        name="contact"
 | 
			
		||||
        bind:value={orgdata.contact}
 | 
			
		||||
        class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2">
 | 
			
		||||
        <option value="null">no contact</option>
 | 
			
		||||
        {#each contacts as c}
 | 
			
		||||
          <option value={c.id}>
 | 
			
		||||
            {c.firstname}
 | 
			
		||||
            {c.middlename || ''}
 | 
			
		||||
            {c.lastname}
 | 
			
		||||
          </option>
 | 
			
		||||
        {/each}
 | 
			
		||||
      </select>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="text-sm w-full">
 | 
			
		||||
      <label
 | 
			
		||||
        for="address"
 | 
			
		||||
        class="font-medium text-gray-700">{$_('address')}</label>
 | 
			
		||||
      <input
 | 
			
		||||
        autocomplete="off"
 | 
			
		||||
        placeholder={$_('address')}
 | 
			
		||||
        type="text"
 | 
			
		||||
        bind:value={orgdata.address}
 | 
			
		||||
        name="address"
 | 
			
		||||
        class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" />
 | 
			
		||||
    </div>
 | 
			
		||||
  </section>
 | 
			
		||||
{:else}
 | 
			
		||||
  {#await promise}
 | 
			
		||||
    {$_('organization-detail-is-being-loaded')}
 | 
			
		||||
  {:catch error}
 | 
			
		||||
    <PromiseError />
 | 
			
		||||
  {/await}
 | 
			
		||||
{/if}
 | 
			
		||||
<script>
 | 
			
		||||
  import {
 | 
			
		||||
    GroupContactService,
 | 
			
		||||
    RunnerOrganizationService,
 | 
			
		||||
  } from "@odit/lfk-client-js";
 | 
			
		||||
  import { _ } from "svelte-i18n";
 | 
			
		||||
  import Toastify from "toastify-js";
 | 
			
		||||
  import store from "../../store";
 | 
			
		||||
  import ConfirmOrgDeletion from "./ConfirmOrgDeletion.svelte";
 | 
			
		||||
  import ImportRunnerModal from "../runners/ImportRunnerModal.svelte";
 | 
			
		||||
  import PromiseError from "../base/PromiseError.svelte";
 | 
			
		||||
  $: delete_triggered = false;
 | 
			
		||||
  $: address_valid_or_none =
 | 
			
		||||
    (isAddress1Valid && iszipcodevalid && iscityvalid) ||
 | 
			
		||||
    editable.address_checked === false;
 | 
			
		||||
  $: save_enabled = data_changed && address_valid_or_none;
 | 
			
		||||
  let original = "";
 | 
			
		||||
  let original_object = {};
 | 
			
		||||
  let contacts = [];
 | 
			
		||||
  export let params;
 | 
			
		||||
  $: editable = {};
 | 
			
		||||
  $: data_loaded = false;
 | 
			
		||||
  $: data_changed = !(JSON.stringify(editable) === original);
 | 
			
		||||
  $: isAddress1Valid = editable.address?.address1?.trim().length !== 0;
 | 
			
		||||
  $: iszipcodevalid = editable.address?.postalcode?.trim().length !== 0;
 | 
			
		||||
  $: iscityvalid = editable.address?.city?.trim().length !== 0;
 | 
			
		||||
 | 
			
		||||
  const promise = RunnerOrganizationService.runnerOrganizationControllerGetOne(
 | 
			
		||||
    params.orgid
 | 
			
		||||
  ).then((value) => {
 | 
			
		||||
    data_loaded = true;
 | 
			
		||||
    if (value.contact) {
 | 
			
		||||
      if (value.contact !== "null") {
 | 
			
		||||
        value.contact = value.contact.id;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    value.address_checked = value.address.address1 !== null;
 | 
			
		||||
    if(value.address_checked===false){
 | 
			
		||||
      value.address = {
 | 
			
		||||
        address1: "",
 | 
			
		||||
        address2: "",
 | 
			
		||||
        city: "",
 | 
			
		||||
        postalcode: "",
 | 
			
		||||
        country: ""
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    editable = Object.assign(editable, value);
 | 
			
		||||
    editable = editable;
 | 
			
		||||
    original_object = Object.assign(editable, value);
 | 
			
		||||
    original = JSON.stringify(value);
 | 
			
		||||
  });
 | 
			
		||||
  GroupContactService.groupContactControllerGetAll().then((val) => {
 | 
			
		||||
    contacts = val;
 | 
			
		||||
  });
 | 
			
		||||
  let modal_open = false;
 | 
			
		||||
  let delete_org = {};
 | 
			
		||||
  function deleteOrganization() {
 | 
			
		||||
    RunnerOrganizationService.runnerOrganizationControllerRemove(
 | 
			
		||||
      original_object.id,
 | 
			
		||||
      false
 | 
			
		||||
    )
 | 
			
		||||
      .then((resp) => {
 | 
			
		||||
        Toastify({
 | 
			
		||||
          text: $_("organization-deleted"),
 | 
			
		||||
          duration: 500,
 | 
			
		||||
          backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
 | 
			
		||||
        }).showToast();
 | 
			
		||||
        location.replace("./");
 | 
			
		||||
      })
 | 
			
		||||
      .catch((err) => {
 | 
			
		||||
        modal_open = true;
 | 
			
		||||
        delete_org = original_object;
 | 
			
		||||
      });
 | 
			
		||||
  }
 | 
			
		||||
  function submit() {
 | 
			
		||||
    if (data_loaded === true && save_enabled) {
 | 
			
		||||
      Toastify({
 | 
			
		||||
        text: $_("updating-organization"),
 | 
			
		||||
        duration: 2500,
 | 
			
		||||
      }).showToast();
 | 
			
		||||
      let postdata = Object.assign({}, editable);
 | 
			
		||||
      if (postdata.address_checked === false) {
 | 
			
		||||
        postdata.address = null;
 | 
			
		||||
      }
 | 
			
		||||
      console.log(postdata)
 | 
			
		||||
      postdata.contact = postdata.contact === "null" ? null : postdata.contact;
 | 
			
		||||
      RunnerOrganizationService.runnerOrganizationControllerPut(
 | 
			
		||||
        original_object.id,
 | 
			
		||||
        postdata
 | 
			
		||||
      )
 | 
			
		||||
        .then((resp) => {
 | 
			
		||||
          original = JSON.stringify(editable);
 | 
			
		||||
          Toastify({
 | 
			
		||||
            text: $_("updated-organization"),
 | 
			
		||||
            duration: 2500,
 | 
			
		||||
            backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
 | 
			
		||||
          }).showToast();
 | 
			
		||||
        })
 | 
			
		||||
        .catch((err) => {});
 | 
			
		||||
    } else {
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  export let import_modal_open = false;
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<ImportRunnerModal
 | 
			
		||||
  on:cancelDelete={(event) => {
 | 
			
		||||
    import_modal_open = false;
 | 
			
		||||
  }}
 | 
			
		||||
  current_runners={[]}
 | 
			
		||||
  passed_team={{}}
 | 
			
		||||
  passed_orgs={[]}
 | 
			
		||||
  passed_org={editable}
 | 
			
		||||
  opened_from="OrgDetail"
 | 
			
		||||
  bind:import_modal_open />
 | 
			
		||||
<ConfirmOrgDeletion bind:modal_open bind:delete_org />
 | 
			
		||||
{#if data_loaded}
 | 
			
		||||
  <section class="container p-5">
 | 
			
		||||
    <div class="mb-8 text-3xl font-extrabold leading-tight">
 | 
			
		||||
      {original_object.name}
 | 
			
		||||
      <span data-id="org_actions_${editable.id}">
 | 
			
		||||
        {#if store.state.jwtinfo.userdetails.permissions.includes('RUNNER:IMPORT')}
 | 
			
		||||
          <button
 | 
			
		||||
            on:click={() => {
 | 
			
		||||
              import_modal_open = true;
 | 
			
		||||
            }}
 | 
			
		||||
            type="button"
 | 
			
		||||
            class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm">
 | 
			
		||||
            {$_('import-runners')}
 | 
			
		||||
          </button>
 | 
			
		||||
        {/if}
 | 
			
		||||
        {#if store.state.jwtinfo.userdetails.permissions.includes('USER:DELETE')}
 | 
			
		||||
          {#if delete_triggered}
 | 
			
		||||
            <button
 | 
			
		||||
              on:click={deleteOrganization}
 | 
			
		||||
              class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm">{$_('confirm-delete')}</button>
 | 
			
		||||
            <button
 | 
			
		||||
              on:click={() => {
 | 
			
		||||
                delete_triggered = !delete_triggered;
 | 
			
		||||
              }}
 | 
			
		||||
              class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-400 text-base font-medium text-white sm:w-auto sm:text-sm">{$_('cancel')}</button>
 | 
			
		||||
          {/if}
 | 
			
		||||
          {#if !delete_triggered}
 | 
			
		||||
            <button
 | 
			
		||||
              on:click={() => {
 | 
			
		||||
                delete_triggered = true;
 | 
			
		||||
              }}
 | 
			
		||||
              type="button"
 | 
			
		||||
              class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm">{$_('delete-organization')}</button>
 | 
			
		||||
          {/if}
 | 
			
		||||
        {/if}
 | 
			
		||||
        {#if !delete_triggered}
 | 
			
		||||
          <button
 | 
			
		||||
            on:click={submit}
 | 
			
		||||
            disabled={!save_enabled}
 | 
			
		||||
            class:opacity-50={!save_enabled}
 | 
			
		||||
            type="button"
 | 
			
		||||
            class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm">{$_('save-changes')}</button>
 | 
			
		||||
        {/if}
 | 
			
		||||
      </span>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="flex flex-row mb-4">
 | 
			
		||||
      <div class="w-full">
 | 
			
		||||
        <nav class="w-full flex">
 | 
			
		||||
          <ol class="list-none flex flex-row items-center justify-start">
 | 
			
		||||
            <li class="mr-2 flex items-center">
 | 
			
		||||
              <svg
 | 
			
		||||
                stroke="currentColor"
 | 
			
		||||
                fill="none"
 | 
			
		||||
                stroke-width="2"
 | 
			
		||||
                viewBox="0 0 24 24"
 | 
			
		||||
                stroke-linecap="round"
 | 
			
		||||
                stroke-linejoin="round"
 | 
			
		||||
                class="h-3 w-3 stroke-current"
 | 
			
		||||
                height="1em"
 | 
			
		||||
                width="1em"
 | 
			
		||||
                xmlns="http://www.w3.org/2000/svg"><path
 | 
			
		||||
                  d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" />
 | 
			
		||||
                <polyline points="9 22 9 12 15 12 15 22" /></svg>
 | 
			
		||||
            </li>
 | 
			
		||||
            <li class="flex items-center">
 | 
			
		||||
              <a class="mr-2" href="/">{$_('home')}</a><svg
 | 
			
		||||
                stroke="currentColor"
 | 
			
		||||
                fill="none"
 | 
			
		||||
                stroke-width="2"
 | 
			
		||||
                viewBox="0 0 24 24"
 | 
			
		||||
                stroke-linecap="round"
 | 
			
		||||
                stroke-linejoin="round"
 | 
			
		||||
                class="h-3 w-3 mr-2 stroke-current"
 | 
			
		||||
                height="1em"
 | 
			
		||||
                width="1em"
 | 
			
		||||
                xmlns="http://www.w3.org/2000/svg"><line
 | 
			
		||||
                  x1="5"
 | 
			
		||||
                  y1="12"
 | 
			
		||||
                  x2="19"
 | 
			
		||||
                  y2="12" />
 | 
			
		||||
                <polyline points="12 5 19 12 12 19" /></svg>
 | 
			
		||||
            </li>
 | 
			
		||||
            <li class="mr-2 flex items-center">
 | 
			
		||||
              <svg
 | 
			
		||||
                xmlns="http://www.w3.org/2000/svg"
 | 
			
		||||
                viewBox="0 0 24 24"
 | 
			
		||||
                width="24"
 | 
			
		||||
                height="24"><path fill="none" d="M0 0h24v24H0z" />
 | 
			
		||||
                <path
 | 
			
		||||
                  d="M21 20h2v2H1v-2h2V3a1 1 0 0 1 1-1h16a1 1 0 0 1 1 1v17zm-2 0V4H5v16h14zM8 11h3v2H8v-2zm0-4h3v2H8V7zm0 8h3v2H8v-2zm5 0h3v2h-3v-2zm0-4h3v2h-3v-2zm0-4h3v2h-3V7z" /></svg>
 | 
			
		||||
            </li>
 | 
			
		||||
            <li class="flex items-center">
 | 
			
		||||
              <a class="mr-2" href="./">{$_('organizations')}</a><svg
 | 
			
		||||
                stroke="currentColor"
 | 
			
		||||
                fill="none"
 | 
			
		||||
                stroke-width="2"
 | 
			
		||||
                viewBox="0 0 24 24"
 | 
			
		||||
                stroke-linecap="round"
 | 
			
		||||
                stroke-linejoin="round"
 | 
			
		||||
                class="h-3 w-3 mr-2 stroke-current"
 | 
			
		||||
                height="1em"
 | 
			
		||||
                width="1em"
 | 
			
		||||
                xmlns="http://www.w3.org/2000/svg"><line
 | 
			
		||||
                  x1="5"
 | 
			
		||||
                  y1="12"
 | 
			
		||||
                  x2="19"
 | 
			
		||||
                  y2="12" />
 | 
			
		||||
                <polyline points="12 5 19 12 12 19" /></svg>
 | 
			
		||||
            </li>
 | 
			
		||||
            <li class="flex items-center">
 | 
			
		||||
              <span class="mr-2">Org-Details #{params.orgid}</span>
 | 
			
		||||
            </li>
 | 
			
		||||
          </ol>
 | 
			
		||||
        </nav>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="text-sm w-full">
 | 
			
		||||
      <label for="name" class="font-medium text-gray-700">{$_('name')}</label>
 | 
			
		||||
      <input
 | 
			
		||||
        autocomplete="off"
 | 
			
		||||
        placeholder={$_('name')}
 | 
			
		||||
        type="text"
 | 
			
		||||
        bind:value={editable.name}
 | 
			
		||||
        name="name"
 | 
			
		||||
        class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" />
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="text-sm w-full">
 | 
			
		||||
      <label
 | 
			
		||||
        for="contact"
 | 
			
		||||
        class="font-medium text-gray-700">{$_('contact')}</label>
 | 
			
		||||
      <select
 | 
			
		||||
        name="contact"
 | 
			
		||||
        bind:value={editable.contact}
 | 
			
		||||
        class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2">
 | 
			
		||||
        <option value="null">no contact</option>
 | 
			
		||||
        {#each contacts as c}
 | 
			
		||||
          <option value={c.id}>
 | 
			
		||||
            {c.firstname}
 | 
			
		||||
            {c.middlename || ''}
 | 
			
		||||
            {c.lastname}
 | 
			
		||||
          </option>
 | 
			
		||||
        {/each}
 | 
			
		||||
      </select>
 | 
			
		||||
    </div>
 | 
			
		||||
    <!--  -->
 | 
			
		||||
    <div class="flex items-start mt-2">
 | 
			
		||||
      <div class="flex items-center h-5">
 | 
			
		||||
        <input
 | 
			
		||||
          bind:checked={editable.address_checked}
 | 
			
		||||
          id="comments"
 | 
			
		||||
          name="comments"
 | 
			
		||||
          type="checkbox"
 | 
			
		||||
          class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded" />
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="ml-3 text-sm">
 | 
			
		||||
        <label
 | 
			
		||||
          for="comments"
 | 
			
		||||
          class="font-medium text-gray-700">{$_('address')}</label>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    {#if editable.address_checked === true}
 | 
			
		||||
      <div class="col-span-6">
 | 
			
		||||
        <label
 | 
			
		||||
          for="address1"
 | 
			
		||||
          class="block text-sm font-medium text-gray-700">{$_('address')}</label>
 | 
			
		||||
        <input
 | 
			
		||||
          autocomplete="off"
 | 
			
		||||
          placeholder="Address"
 | 
			
		||||
          class:border-red-500={!isAddress1Valid}
 | 
			
		||||
          class:focus:border-red-500={!isAddress1Valid}
 | 
			
		||||
          class:focus:ring-red-500={!isAddress1Valid}
 | 
			
		||||
          bind:value={editable.address.address1}
 | 
			
		||||
          type="text"
 | 
			
		||||
          name="address1"
 | 
			
		||||
          class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" />
 | 
			
		||||
        {#if !isAddress1Valid}
 | 
			
		||||
          <span
 | 
			
		||||
            class="flex items-center font-medium tracking-wide text-red-500 text-xs mt-1 ml-1">
 | 
			
		||||
            {$_('address-is-required')}
 | 
			
		||||
          </span>
 | 
			
		||||
        {/if}
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="col-span-6">
 | 
			
		||||
        <label
 | 
			
		||||
          for="address2"
 | 
			
		||||
          class="block text-sm font-medium text-gray-700">{$_('apartment-suite-etc')}</label>
 | 
			
		||||
        <input
 | 
			
		||||
          autocomplete="off"
 | 
			
		||||
          placeholder={$_('apartment-suite-etc')}
 | 
			
		||||
          bind:value={editable.address.address2}
 | 
			
		||||
          type="text"
 | 
			
		||||
          name="address2"
 | 
			
		||||
          class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" />
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="col-span-6">
 | 
			
		||||
        <label
 | 
			
		||||
          for="zipcode"
 | 
			
		||||
          class="block text-sm font-medium text-gray-700">{$_('zip-postal-code')}</label>
 | 
			
		||||
        <input
 | 
			
		||||
          autocomplete="off"
 | 
			
		||||
          placeholder={$_('zip-postal-code')}
 | 
			
		||||
          class:border-red-500={!iszipcodevalid}
 | 
			
		||||
          class:focus:border-red-500={!iszipcodevalid}
 | 
			
		||||
          class:focus:ring-red-500={!iszipcodevalid}
 | 
			
		||||
          bind:value={editable.address.postalcode}
 | 
			
		||||
          type="text"
 | 
			
		||||
          name="zipcode"
 | 
			
		||||
          class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" />
 | 
			
		||||
        {#if !iszipcodevalid}
 | 
			
		||||
          <span
 | 
			
		||||
            class="flex items-center font-medium tracking-wide text-red-500 text-xs mt-1 ml-1">
 | 
			
		||||
            {$_('valid-zipcode-postal-code-is-required')}
 | 
			
		||||
          </span>
 | 
			
		||||
        {/if}
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="col-span-6">
 | 
			
		||||
        <label
 | 
			
		||||
          for="city"
 | 
			
		||||
          class="block text-sm font-medium text-gray-700">{$_('city')}</label>
 | 
			
		||||
        <input
 | 
			
		||||
          autocomplete="off"
 | 
			
		||||
          placeholder={$_('city')}
 | 
			
		||||
          class:border-red-500={!iscityvalid}
 | 
			
		||||
          class:focus:border-red-500={!iscityvalid}
 | 
			
		||||
          class:focus:ring-red-500={!iscityvalid}
 | 
			
		||||
          bind:value={editable.address.city}
 | 
			
		||||
          type="text"
 | 
			
		||||
          name="city"
 | 
			
		||||
          class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" />
 | 
			
		||||
        {#if !iscityvalid}
 | 
			
		||||
          <span
 | 
			
		||||
            class="flex items-center font-medium tracking-wide text-red-500 text-xs mt-1 ml-1">
 | 
			
		||||
            {$_('valid-city-is-required')}
 | 
			
		||||
          </span>
 | 
			
		||||
        {/if}
 | 
			
		||||
      </div>
 | 
			
		||||
    {/if}
 | 
			
		||||
  </section>
 | 
			
		||||
{:else}
 | 
			
		||||
  {#await promise}
 | 
			
		||||
    {$_('organization-detail-is-being-loaded')}
 | 
			
		||||
  {:catch error}
 | 
			
		||||
    <PromiseError />
 | 
			
		||||
  {/await}
 | 
			
		||||
{/if}
 | 
			
		||||
 
 | 
			
		||||
@@ -88,9 +88,13 @@
 | 
			
		||||
                    <div class="flex items-center">
 | 
			
		||||
                      <div class="ml-4">
 | 
			
		||||
                        <div class="text-sm font-medium text-gray-900">
 | 
			
		||||
                          {#if o.address}
 | 
			
		||||
                            {JSON.stringify(o.address)}
 | 
			
		||||
                          {:else}no address specified{/if}
 | 
			
		||||
                          {#if o.address.address1 !== null}
 | 
			
		||||
                            {o.address.address1}<br />
 | 
			
		||||
                            {o.address.address2 || ''}<br />
 | 
			
		||||
                            {o.address.postalcode}
 | 
			
		||||
                            {o.address.city}
 | 
			
		||||
                            {o.address.country}
 | 
			
		||||
                          {/if}
 | 
			
		||||
                        </div>
 | 
			
		||||
                      </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
 
 | 
			
		||||
@@ -135,49 +135,56 @@
 | 
			
		||||
                        </div>
 | 
			
		||||
                      </div>
 | 
			
		||||
                    </td>
 | 
			
		||||
                    <td class="px-6 py-4 whitespace-nowrap">
 | 
			
		||||
                      {#if runner.email}
 | 
			
		||||
                        <div class="text-sm text-gray-500">{runner.email}</div>
 | 
			
		||||
                      {/if}
 | 
			
		||||
                      {#if runner.phone}
 | 
			
		||||
                        <div class="text-sm text-gray-500">{runner.phone}</div>
 | 
			
		||||
                      {/if}
 | 
			
		||||
                    </td>
 | 
			
		||||
                    <td class="px-6 py-4 whitespace-nowrap">
 | 
			
		||||
                      {#if runner.group.responseType === 'RUNNERTEAM'}
 | 
			
		||||
                        <a
 | 
			
		||||
                          href="../teams/{runner.group.id}"
 | 
			
		||||
                          class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800">{runner.group.name}</a>
 | 
			
		||||
                      {/if}
 | 
			
		||||
                      {#if runner.group.responseType === 'RUNNERORGANIZATION'}
 | 
			
		||||
                        <a
 | 
			
		||||
                          href="../orgs/{runner.group.id}"
 | 
			
		||||
                          class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800">{runner.group.name}</a>
 | 
			
		||||
                      {/if}
 | 
			
		||||
                    </td>
 | 
			
		||||
                    <td class="px-6 py-4 whitespace-nowrap">
 | 
			
		||||
                      {runner.distance}
 | 
			
		||||
                    </td>
 | 
			
		||||
                    {#if active_deletes[runner.id] === true}
 | 
			
		||||
                      <td
 | 
			
		||||
                        class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
 | 
			
		||||
                        <button
 | 
			
		||||
                          on:click={() => {
 | 
			
		||||
                            active_deletes[runner.id] = false;
 | 
			
		||||
                          }}
 | 
			
		||||
                          tabindex="0"
 | 
			
		||||
                          class="ml-4 text-indigo-600 hover:text-indigo-900 cursor-pointer">Cancel
 | 
			
		||||
                          Delete</button>
 | 
			
		||||
                        <button
 | 
			
		||||
                          on:click={() => {
 | 
			
		||||
                            RunnerService.runnerControllerRemove(runner.id, true)
 | 
			
		||||
                              .then((resp) => {
 | 
			
		||||
                                current_runners = current_runners.filter((obj) => obj.id !== runner.id);
 | 
			
		||||
                              })
 | 
			
		||||
                              .catch((err) => {});
 | 
			
		||||
                          }}
 | 
			
		||||
                          tabindex="0"
 | 
			
		||||
                          class="ml-4 text-red-600 hover:text-red-900 cursor-pointer">{$_('confirm-delete')}</button>
 | 
			
		||||
                  <td class="px-6 py-4 whitespace-nowrap">
 | 
			
		||||
                    {#if runner.email}
 | 
			
		||||
                      <div class="text-sm text-gray-500">{runner.email}</div>
 | 
			
		||||
                    {/if}
 | 
			
		||||
                    {#if runner.phone}
 | 
			
		||||
                      <div class="text-sm text-gray-500">{runner.phone}</div>
 | 
			
		||||
                    {/if}
 | 
			
		||||
                    {#if runner.address.address1 !== null}
 | 
			
		||||
                      {runner.address.address1}<br />
 | 
			
		||||
                      {runner.address.address2 || ''}<br />
 | 
			
		||||
                      {runner.address.postalcode}
 | 
			
		||||
                      {runner.address.city}
 | 
			
		||||
                      {runner.address.country}
 | 
			
		||||
                    {/if}
 | 
			
		||||
                  </td>
 | 
			
		||||
                  <td class="px-6 py-4 whitespace-nowrap">
 | 
			
		||||
                    {#if runner.group.responseType === 'RUNNERTEAM'}
 | 
			
		||||
                      <a
 | 
			
		||||
                        href="../teams/{runner.group.id}"
 | 
			
		||||
                        class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800">{runner.group.name}</a>
 | 
			
		||||
                    {/if}
 | 
			
		||||
                    {#if runner.group.responseType === 'RUNNERORGANIZATION'}
 | 
			
		||||
                      <a
 | 
			
		||||
                        href="../orgs/{runner.group.id}"
 | 
			
		||||
                        class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800">{runner.group.name}</a>
 | 
			
		||||
                    {/if}
 | 
			
		||||
                  </td>
 | 
			
		||||
                  <td class="px-6 py-4 whitespace-nowrap">{runner.distance}</td>
 | 
			
		||||
                  {#if active_deletes[runner.id] === true}
 | 
			
		||||
                    <td
 | 
			
		||||
                      class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
 | 
			
		||||
                      <button
 | 
			
		||||
                        on:click={() => {
 | 
			
		||||
                          active_deletes[runner.id] = false;
 | 
			
		||||
                        }}
 | 
			
		||||
                        tabindex="0"
 | 
			
		||||
                        class="ml-4 text-indigo-600 hover:text-indigo-900 cursor-pointer">Cancel
 | 
			
		||||
                        Delete</button>
 | 
			
		||||
                      <button
 | 
			
		||||
                        on:click={() => {
 | 
			
		||||
                          RunnerService.runnerControllerRemove(runner.id, true)
 | 
			
		||||
                            .then((resp) => {
 | 
			
		||||
                              current_runners = current_runners.filter((obj) => obj.id !== runner.id);
 | 
			
		||||
                            })
 | 
			
		||||
                            .catch((err) => {
 | 
			
		||||
                              // error deleting user
 | 
			
		||||
                            });
 | 
			
		||||
                        }}
 | 
			
		||||
                        tabindex="0"
 | 
			
		||||
                        class="ml-4 text-red-600 hover:text-red-900 cursor-pointer">{$_('confirm-delete')}</button>
 | 
			
		||||
                      </td>
 | 
			
		||||
                    {:else}
 | 
			
		||||
                      <td
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user