12 changed files with 207 additions and 20 deletions
@ -0,0 +1,37 @@ |
|||||||
|
<script> |
||||||
|
import {onMount} from 'svelte'; |
||||||
|
import {t} from '../translations.svelte.js'; |
||||||
|
let { caption, onselect = (company) => console.log('selected '+company.name) } = $props(); |
||||||
|
let message = t('loading'); |
||||||
|
let companies = $state(null); |
||||||
|
let value = 0; |
||||||
|
|
||||||
|
async function loadCompanies(){ |
||||||
|
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/company/list`; |
||||||
|
var resp = await fetch(url,{ credentials: 'include'}); |
||||||
|
if (resp.ok){ |
||||||
|
companies = await resp.json(); |
||||||
|
} else { |
||||||
|
message = await resp.text(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
function select(){ |
||||||
|
onselect(companies[value]); |
||||||
|
} |
||||||
|
|
||||||
|
onMount(loadCompanies) |
||||||
|
|
||||||
|
</script> |
||||||
|
|
||||||
|
{#if companies} |
||||||
|
<select onchange={select} bind:value> |
||||||
|
<option value={0}>{caption}</option> |
||||||
|
{#each companies as company,idx} |
||||||
|
<option value={idx}>{company.name}</option> |
||||||
|
{/each} |
||||||
|
</select> |
||||||
|
{:else} |
||||||
|
<span>{message}</span> |
||||||
|
{/if} |
||||||
|
|
||||||
@ -0,0 +1,13 @@ |
|||||||
|
<script> |
||||||
|
import {t} from '../../translations.svelte.js'; |
||||||
|
|
||||||
|
let { settings = $bindable() } = $props(); |
||||||
|
|
||||||
|
</script> |
||||||
|
<fieldset> |
||||||
|
<legend>{t('settings')}</legend> |
||||||
|
<label> |
||||||
|
<input type="checkbox" bind:checked={settings.show_closed} /> |
||||||
|
{t('display_closed_tasks')} |
||||||
|
</label> |
||||||
|
</fieldset> |
||||||
Loading…
Reference in new issue