parent
c1251d3332
commit
2033572c83
@ -1,5 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
|
GroupContactService,
|
||||||
RunnerOrganizationService,
|
RunnerOrganizationService,
|
||||||
RunnerTeamService,
|
RunnerTeamService,
|
||||||
} from "@odit/lfk-client-js";
|
} from "@odit/lfk-client-js";
|
||||||
@ -9,14 +10,15 @@
|
|||||||
import ImportRunnerModal from "./ImportRunnerModal.svelte";
|
import ImportRunnerModal from "./ImportRunnerModal.svelte";
|
||||||
import PromiseError from "./PromiseError.svelte";
|
import PromiseError from "./PromiseError.svelte";
|
||||||
import ConfirmTeamDeletion from "./ConfirmTeamDeletion.svelte";
|
import ConfirmTeamDeletion from "./ConfirmTeamDeletion.svelte";
|
||||||
export let params;
|
let [teamdata, original, delete_team, orgs, contacts, modal_open] = [
|
||||||
let [teamdata, original, delete_team, orgs, modal_open] = [
|
|
||||||
{},
|
{},
|
||||||
{},
|
{},
|
||||||
{},
|
{},
|
||||||
[],
|
[],
|
||||||
|
[],
|
||||||
false,
|
false,
|
||||||
];
|
];
|
||||||
|
export let params;
|
||||||
export let import_modal_open = false;
|
export let import_modal_open = false;
|
||||||
$: delete_triggered = false;
|
$: delete_triggered = false;
|
||||||
$: save_enabled = !data_changed;
|
$: save_enabled = !data_changed;
|
||||||
@ -27,12 +29,20 @@
|
|||||||
params.teamid
|
params.teamid
|
||||||
).then((value) => {
|
).then((value) => {
|
||||||
data_loaded = true;
|
data_loaded = true;
|
||||||
|
if (value.contact) {
|
||||||
|
if (value.contact !== "null") {
|
||||||
|
value.contact = value.contact.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
teamdata = Object.assign(teamdata, value);
|
teamdata = Object.assign(teamdata, value);
|
||||||
original = Object.assign(original, value);
|
original = Object.assign(original, value);
|
||||||
});
|
});
|
||||||
RunnerOrganizationService.runnerOrganizationControllerGetAll().then((val) => {
|
RunnerOrganizationService.runnerOrganizationControllerGetAll().then((val) => {
|
||||||
orgs = val;
|
orgs = val;
|
||||||
});
|
});
|
||||||
|
GroupContactService.groupContactControllerGetAll().then((val) => {
|
||||||
|
contacts = val;
|
||||||
|
});
|
||||||
function deleteTeam() {
|
function deleteTeam() {
|
||||||
RunnerTeamService.runnerTeamControllerRemove(original.id, false)
|
RunnerTeamService.runnerTeamControllerRemove(original.id, false)
|
||||||
.then((resp) => {
|
.then((resp) => {
|
||||||
@ -55,7 +65,9 @@
|
|||||||
duration: 2500,
|
duration: 2500,
|
||||||
}).showToast();
|
}).showToast();
|
||||||
teamdata.parentGroup = teamdata.parentGroup.id;
|
teamdata.parentGroup = teamdata.parentGroup.id;
|
||||||
RunnerTeamService.runnerTeamControllerPut(original.id, teamdata)
|
let postdata = teamdata;
|
||||||
|
postdata.contact = postdata.contact === "null" ? null : postdata.contact;
|
||||||
|
RunnerTeamService.runnerTeamControllerPut(original.id, postdata)
|
||||||
.then((resp) => {
|
.then((resp) => {
|
||||||
Object.assign(original, teamdata);
|
Object.assign(original, teamdata);
|
||||||
original = teamdata;
|
original = teamdata;
|
||||||
@ -68,7 +80,6 @@
|
|||||||
}).showToast();
|
}).showToast();
|
||||||
})
|
})
|
||||||
.catch((err) => {});
|
.catch((err) => {});
|
||||||
} else {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -216,13 +227,19 @@
|
|||||||
<label
|
<label
|
||||||
for="contact"
|
for="contact"
|
||||||
class="font-medium text-gray-700">{$_('contact')}</label>
|
class="font-medium text-gray-700">{$_('contact')}</label>
|
||||||
<input
|
<select
|
||||||
autocomplete="off"
|
name="org"
|
||||||
placeholder={$_('contact')}
|
|
||||||
type="text"
|
|
||||||
bind:value={teamdata.contact}
|
bind:value={teamdata.contact}
|
||||||
name="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">
|
||||||
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>
|
||||||
<div class="text-sm w-full">
|
<div class="text-sm w-full">
|
||||||
<label for="org" class="font-medium text-gray-700">Parent Organization</label>
|
<label for="org" class="font-medium text-gray-700">Parent Organization</label>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user