Re-implemented guessing of next document id.

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2025-11-24 23:24:31 +01:00
parent 6bb03f4e04
commit 2cd53b19cb
10 changed files with 72 additions and 135 deletions

View File

@@ -45,8 +45,7 @@
description : description,
amount : 1,
unit : t('pieces'),
unit_price : unit_price,
tax : 0
unit_price : unit_price
});
}

View File

@@ -1,8 +1,8 @@
<script>
import {onMount} from 'svelte';
import {onMount} from 'svelte';
import {api} from '../../urls.svelte.js';
import {t} from '../../translations.svelte.js';
import {api, post} from '../../urls.svelte.js';
import {t} from '../../translations.svelte.js';
let {
caption,
@@ -16,11 +16,7 @@
async function loadTemplates(){
const url = api('document/templates');
var resp = await fetch(url,{
credentials : 'include',
method : 'POST',
body : JSON.stringify({company:company})
});
var resp = await post(url,{company:company});
if (resp.ok){
templates = await resp.json();
} else {

View File

@@ -2,7 +2,7 @@
import { onMount } from 'svelte';
import { useTinyRouter } from 'svelte-tiny-router';
import {api} from '../../urls.svelte.js';
import { api, post } from '../../urls.svelte.js';
import { error, yikes } from '../../warn.svelte';
import { t } from '../../translations.svelte.js';
import { user } from '../../user.svelte.js';
@@ -29,11 +29,7 @@
async function addPosition(selected){
const url = api(`document/${doc.id}/position`);
const resp = await fetch(url,{
method : 'POST',
credentials : 'include',
body : JSON.stringify(selected)
});
const resp = await post(url,selected);
if (resp.ok){
doc.positions = await resp.json();
yikes();