parent
01c01a46fa
commit
93249258c6
@ -6,7 +6,7 @@
|
||||
import Toastify from "toastify-js";
|
||||
export let modal_open;
|
||||
export let current_organizations;
|
||||
let firstname_input;
|
||||
let name_input_dom;
|
||||
function focus(el) {
|
||||
el.focus();
|
||||
}
|
||||
@ -14,8 +14,8 @@
|
||||
$: processed_last_submit = true;
|
||||
$: isOrgnameValid = name.trim().length !== 0;
|
||||
$: createbtnenabled = isOrgnameValid;
|
||||
(function () {
|
||||
document.onkeydown = function (e) {
|
||||
(() => {
|
||||
document.onkeydown = (e) => {
|
||||
e = e || window.event;
|
||||
if (e.key === "Escape") {
|
||||
modal_open = false;
|
||||
@ -36,7 +36,7 @@
|
||||
duration: -1,
|
||||
}).showToast();
|
||||
RunnerOrganisationService.runnerOrganisationControllerPost({
|
||||
name: "ORG." + Date.now(),
|
||||
name,
|
||||
address: undefined,
|
||||
contact: undefined,
|
||||
})
|
||||
@ -123,7 +123,7 @@
|
||||
class:focus:border-red-500={!isOrgnameValid}
|
||||
class:focus:ring-red-500={!isOrgnameValid}
|
||||
bind:value={name}
|
||||
bind:this={firstname_input}
|
||||
bind:this={name_input_dom}
|
||||
type="text"
|
||||
name="firstname"
|
||||
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" />
|
||||
|
@ -1,6 +1,7 @@
|
||||
<script>
|
||||
import { RunnerOrganisationService } from "@odit/lfk-client-js";
|
||||
import { _ } from "svelte-i18n";
|
||||
import Toastify from "toastify-js";
|
||||
import store from "../store";
|
||||
import PromiseError from "./PromiseError.svelte";
|
||||
$: delete_triggered = false;
|
||||
@ -27,6 +28,31 @@
|
||||
})
|
||||
.catch((err) => {});
|
||||
}
|
||||
function submit() {
|
||||
if (data_loaded === true && save_enabled) {
|
||||
Toastify({
|
||||
text: "updating organization",
|
||||
duration: 2500,
|
||||
}).showToast();
|
||||
RunnerOrganisationService.runnerOrganisationControllerPut(
|
||||
original.id,
|
||||
orgdata
|
||||
)
|
||||
.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 {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if data_loaded}
|
||||
@ -56,6 +82,7 @@
|
||||
{/if}
|
||||
{#if !delete_triggered}
|
||||
<button
|
||||
on:click={submit}
|
||||
disabled={!save_enabled}
|
||||
class:opacity-50={!save_enabled}
|
||||
type="button"
|
||||
|
Loading…
x
Reference in New Issue
Block a user