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