preparing to make items available as document positions
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -4,6 +4,18 @@
|
||||
|
||||
<fieldset {onclick}>
|
||||
<legend>{item.code} | {item.name}</legend>
|
||||
<div>{@html item.description.rendered}</div>
|
||||
<span>{item.unit_price/100} {item.currency} / {item.unit}</span>
|
||||
{#if item.properties}
|
||||
<table>
|
||||
<tbody>
|
||||
{#each Object.entries(item.properties) as [idx,prop]}
|
||||
<tr>
|
||||
<th>{prop.name}</th>
|
||||
<td>{prop.value} {prop.unit}</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
{/if}
|
||||
<!--<div>{@html item.description.rendered}</div> -->
|
||||
<!-- <span>{item.unit_price/100} {item.currency} / {item.unit}</span> -->
|
||||
</fieldset>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
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';
|
||||
|
||||
@@ -15,13 +15,9 @@
|
||||
let items = $state(null);
|
||||
|
||||
async function loadItems(){
|
||||
const url = api('items/list');
|
||||
let data = { company_id: company_id };
|
||||
const resp = await fetch(url,{
|
||||
credentials: 'include',
|
||||
method : 'POST',
|
||||
body : JSON.stringify(data)
|
||||
});
|
||||
const url = api('stock/list');
|
||||
let data = { company_id };
|
||||
const resp = await post(url,data);
|
||||
if (resp.ok){
|
||||
items = await resp.json();
|
||||
yikes();
|
||||
@@ -37,7 +33,7 @@
|
||||
<div>
|
||||
<h1>{t('items')}</h1>
|
||||
{#if items}
|
||||
{#each items as item,id}
|
||||
{#each items as item,idx}
|
||||
<Item item={item} onclick={() => onSelect(item)} />
|
||||
{/each}
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user