added GUI files
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
35
frontend/src/routes/company/Editor.svelte
Normal file
35
frontend/src/routes/company/Editor.svelte
Normal file
@@ -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}
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
<tr onclick={e => showDetail(cid)}>
|
<tr onclick={e => showDetail(cid)}>
|
||||||
<td>{company.name}</td>
|
<td>{company.name}</td>
|
||||||
<td>{company.email}</td>
|
<td>{company.email}</td>
|
||||||
<td>{company.address.replace('\r','').replace('\n',' / ')}</td>
|
<td>{company.address.replace('\r','').replaceAll('\n',' / ')}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{#if selected==cid}
|
{#if selected==cid}
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user