2 changed files with 36 additions and 1 deletions
@ -0,0 +1,35 @@ |
|||||||
|
<script> |
||||||
|
import {api} from '../../urls.svelte.js' |
||||||
|
import {t} from '../../translations.svelte.js'; |
||||||
|
import LineEditor from '../../Components/LineEditor.svelte'; |
||||||
|
import Multiline from '../../Components/MultilineEditor.svelte'; |
||||||
|
|
||||||
|
async function patch(changeSet){ |
||||||
|
const url = api(`company/${company.id}`) |
||||||
|
const resp = await fetch(url,{ |
||||||
|
credentials : 'include', |
||||||
|
method : 'PATCH', |
||||||
|
body : JSON.stringify(changeSet) |
||||||
|
}); |
||||||
|
if (resp.ok){ |
||||||
|
return true; |
||||||
|
} |
||||||
|
error = await resp.text(); |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
let { company } = $props(); |
||||||
|
</script> |
||||||
|
|
||||||
|
|
||||||
|
{#if company} |
||||||
|
<fieldset> |
||||||
|
<legend>{t('name')}</legend> |
||||||
|
<LineEditor bind:value={company.name} editable={true} onSet={val => patch({name:val})} /> |
||||||
|
</fieldset> |
||||||
|
<fieldset> |
||||||
|
<legend>{t('address')}</legend> |
||||||
|
<Multiline bind:value={company.address} editable={true} onSet={val => patch({address:val})} /> |
||||||
|
</fieldset> |
||||||
|
|
||||||
|
{/if} |
||||||
Loading…
Reference in new issue