made all document fields editable
This commit is contained in:
@@ -11,7 +11,6 @@ import com.sun.net.httpserver.HttpExchange;
|
|||||||
import de.srsoftware.tools.Path;
|
import de.srsoftware.tools.Path;
|
||||||
import de.srsoftware.tools.PathHandler;
|
import de.srsoftware.tools.PathHandler;
|
||||||
import de.srsoftware.umbrella.core.exceptions.UmbrellaException;
|
import de.srsoftware.umbrella.core.exceptions.UmbrellaException;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -37,5 +37,5 @@
|
|||||||
{#if editable && editing}
|
{#if editable && editing}
|
||||||
<input bind:value={editValue} onkeyup={typed} autofocus />
|
<input bind:value={editValue} onkeyup={typed} autofocus />
|
||||||
{:else}
|
{:else}
|
||||||
<div onclick={startEdit}>{value}</div>
|
<span onclick={startEdit}>{value}</span>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
50
frontend/src/Components/MultilineEditor.svelte
Normal file
50
frontend/src/Components/MultilineEditor.svelte
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
<script>
|
||||||
|
let { editable = false, value = $bindable(null) } = $props();
|
||||||
|
let editing = $state(false);
|
||||||
|
|
||||||
|
let editValue = $state(value);
|
||||||
|
|
||||||
|
let timer = null;
|
||||||
|
function applyEdit(){
|
||||||
|
value = editValue;
|
||||||
|
editing = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetEdit(){
|
||||||
|
editing = false;
|
||||||
|
editValue = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function startEdit(){
|
||||||
|
editing = editable;
|
||||||
|
}
|
||||||
|
|
||||||
|
function typed(ev){
|
||||||
|
if (ev.keyCode == 13 && ev.ctrlKey) applyEdit();
|
||||||
|
if (ev.keyCode == 27) resetEdit();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
textarea{
|
||||||
|
width: 100%;
|
||||||
|
min-height: 100px;
|
||||||
|
}
|
||||||
|
div{
|
||||||
|
min-width: 40px;
|
||||||
|
min-height: 20px;
|
||||||
|
}
|
||||||
|
div:hover{
|
||||||
|
border: 1px dotted;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
{#if editable && editing}
|
||||||
|
<textarea bind:value={editValue} onkeyup={typed} autofocus></textarea>
|
||||||
|
{:else}
|
||||||
|
<div onclick={startEdit}>
|
||||||
|
{#each value.split("\n") as line}
|
||||||
|
{line}<br/>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
@@ -2,10 +2,12 @@
|
|||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { t } from '../../translations.svelte.js';
|
import { t } from '../../translations.svelte.js';
|
||||||
import { useTinyRouter } from 'svelte-tiny-router';
|
import { useTinyRouter } from 'svelte-tiny-router';
|
||||||
import MarkdownEditor from '../../Components/MarkdownEditor.svelte';
|
import LineEditor from '../../Components/LineEditor.svelte';
|
||||||
import PositionList from './PositionList.svelte';
|
import MarkdownEditor from '../../Components/MarkdownEditor.svelte';
|
||||||
import StateSelector from './StateSelector.svelte';
|
import MultilineEditor from '../../Components/MultilineEditor.svelte';
|
||||||
import TemplateSelector from './TemplateSelector.svelte';
|
import PositionList from './PositionList.svelte';
|
||||||
|
import StateSelector from './StateSelector.svelte';
|
||||||
|
import TemplateSelector from './TemplateSelector.svelte';
|
||||||
let { id } = $props();
|
let { id } = $props();
|
||||||
let error = null;
|
let error = null;
|
||||||
let doc = $state(null);
|
let doc = $state(null);
|
||||||
@@ -47,22 +49,26 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
{#each doc.customer.name.split("\n") as line}
|
<MultilineEditor bind:value={doc.customer.name} editable={editable} />
|
||||||
{line}<br/>
|
|
||||||
{/each}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{t('document.customer_id')}:</th>
|
<th>{t('document.customer_id')}:</th>
|
||||||
<td>{doc.customer.id}</td>
|
<td>
|
||||||
|
<LineEditor bind:value={doc.customer.id} editable={editable} />
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{t('document.tax_id')}:</th>
|
<th>{t('document.tax_id')}:</th>
|
||||||
<td>{doc.customer.tax_id}</td>
|
<td>
|
||||||
|
<LineEditor bind:value={doc.customer.tax_id} editable={editable} />
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{t('document.email')}:</th>
|
<th>{t('document.email')}:</th>
|
||||||
<td>{doc.customer.email}</td>
|
<td>
|
||||||
|
<LineEditor bind:value={doc.customer.email} editable={editable} />
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -73,25 +79,25 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
{#each doc.sender.name.split("\n") as line}
|
<MultilineEditor bind:value={doc.sender.name} editable={editable} />
|
||||||
{line}<br/>
|
|
||||||
{/each}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{t('document.court')}:</th>
|
<th>{t('document.court')}:</th>
|
||||||
<td>{doc.sender.court}</td>
|
<td>
|
||||||
|
<LineEditor bind:value={doc.sender.court} editable={editable} />
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{t('document.tax_id')}:</th>
|
<th>{t('document.tax_id')}:</th>
|
||||||
<td>{doc.sender.tax_id}</td>
|
<td>
|
||||||
|
<LineEditor bind:value={doc.sender.tax_id} editable={editable} />
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{t('document.bank_account')}:</th>
|
<th>{t('document.bank_account')}:</th>
|
||||||
<td>
|
<td>
|
||||||
{#each doc.sender.bank_account.split("\n") as line}
|
<MultilineEditor bind:value={doc.sender.bank_account} editable={editable} />
|
||||||
{line}<br/>
|
|
||||||
{/each}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -99,10 +105,22 @@
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset class="left">
|
<fieldset class="left">
|
||||||
<legend>{t('document.type_'+doc.type)}</legend>
|
<legend>{t('document.type_'+doc.type)}</legend>
|
||||||
<div>{t('document.number')}: {doc.number}</div>
|
<div>
|
||||||
<div>{t('document.state')}: <StateSelector selected={doc.state} onchange={changeState} /></div>
|
{t('document.number')}:
|
||||||
<div>{t('document.date')}: {doc.date}</div>
|
<LineEditor bind:value={doc.number} editable={editable} />
|
||||||
<div>{t('document.delivery')}: {doc.delivery}</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
{t('document.state')}:
|
||||||
|
<StateSelector selected={doc.state} onchange={changeState} />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{t('document.date')}:
|
||||||
|
<LineEditor bind:value={doc.date} editable={editable} />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{t('document.delivery')}:
|
||||||
|
<LineEditor bind:value={doc.delivery} editable={editable} />
|
||||||
|
</div>
|
||||||
<div>{t('document.template')}: <TemplateSelector company={doc.company.id} bind:value={doc.template.id} /></div>
|
<div>{t('document.template')}: <TemplateSelector company={doc.company.id} bind:value={doc.template.id} /></div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset class="clear">
|
<fieldset class="clear">
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
|
/* © SRSoftware 2025 */
|
||||||
package de.srsoftware.umbrella.markdown;
|
package de.srsoftware.umbrella.markdown;
|
||||||
|
|
||||||
|
import static de.srsoftware.tools.MimeType.MIME_HTML;
|
||||||
|
|
||||||
import com.sun.net.httpserver.HttpExchange;
|
import com.sun.net.httpserver.HttpExchange;
|
||||||
import de.srsoftware.tools.Path;
|
import de.srsoftware.tools.Path;
|
||||||
import de.srsoftware.tools.SessionToken;
|
import de.srsoftware.tools.SessionToken;
|
||||||
@@ -8,12 +11,9 @@ import de.srsoftware.umbrella.core.Util;
|
|||||||
import de.srsoftware.umbrella.core.api.UserService;
|
import de.srsoftware.umbrella.core.api.UserService;
|
||||||
import de.srsoftware.umbrella.core.exceptions.UmbrellaException;
|
import de.srsoftware.umbrella.core.exceptions.UmbrellaException;
|
||||||
import de.srsoftware.umbrella.core.model.Token;
|
import de.srsoftware.umbrella.core.model.Token;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import static de.srsoftware.tools.MimeType.MIME_HTML;
|
|
||||||
|
|
||||||
public class MarkdownApi extends BaseHandler {
|
public class MarkdownApi extends BaseHandler {
|
||||||
|
|
||||||
private final UserService users;
|
private final UserService users;
|
||||||
|
|||||||
Reference in New Issue
Block a user