feat: enhance forms with decimal formatting and validation
- Updated CustomersPage.vue to use decimalString for standard discount percent. - Enhanced IncomingInvoicesPage.vue to format item quantities, unit prices, and tax rates using decimalString. - Improved ItemsPage.vue with new supplier price management and decimal formatting for prices. - Modified OrganizationSetupPage.vue to use a dropdown for default tax rates and ensure numeric input for payment days. - Updated OutgoingInvoicesPage.vue to apply decimal formatting for customer discounts and item details. - Enhanced PriceImportsPage.vue to include additional fields in the import format. - Improved PriceRulesPage.vue to use decimal input for markup percentages. - Updated QuotesPage.vue to apply decimal formatting for customer discounts and item details. - Enhanced SuppliersPage.vue to use decimal input for standard discount percent. - Added a new SQL migration to set default unit for items to 'Stck'. - Introduced format.ts for centralized decimal and currency formatting utilities.
This commit is contained in:
@@ -3,6 +3,7 @@ import { onMounted, reactive, ref, watch } from "vue";
|
||||
import { apiDelete, apiGet, apiPost, apiPut } from "../api";
|
||||
import FormStatus from "../components/FormStatus.vue";
|
||||
import PageHeader from "../components/PageHeader.vue";
|
||||
import { decimalString } from "../format";
|
||||
import { liveUpdateState } from "../realtime";
|
||||
import type { CashDiscountTerm } from "../types";
|
||||
|
||||
@@ -53,9 +54,13 @@ function select(term: CashDiscountTerm) {
|
||||
}
|
||||
|
||||
async function save() {
|
||||
const payload = {
|
||||
...form,
|
||||
discount_percent: decimalString(form.discount_percent)
|
||||
};
|
||||
const result = selectedId.value
|
||||
? await apiPut<CashDiscountTerm>(`/api/v1/cash-discount-terms/${selectedId.value}`, form)
|
||||
: await apiPost<CashDiscountTerm>("/api/v1/cash-discount-terms", form);
|
||||
? await apiPut<CashDiscountTerm>(`/api/v1/cash-discount-terms/${selectedId.value}`, payload)
|
||||
: await apiPost<CashDiscountTerm>("/api/v1/cash-discount-terms", payload);
|
||||
status.value = result.ok ? "Skonto-Regel gespeichert." : result.message;
|
||||
kind.value = result.ok ? "success" : "error";
|
||||
if (result.ok) { selectedId.value = result.data.id; await load(); }
|
||||
@@ -74,7 +79,7 @@ watch(() => liveUpdateState.revision, load);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<PageHeader title="Skonto" description="Zahlungsbedingungen für Kunden, Lieferanten und Belege." />
|
||||
<PageHeader title="Skonto-Regeln" description="Zahlungsbedingungen für Kunden, Lieferanten und Belege." />
|
||||
<div class="workspace-split">
|
||||
<section class="panel list-panel">
|
||||
<div class="section-title"><h2>Regeln</h2><button type="button" @click="createNew">Neu</button></div>
|
||||
@@ -90,7 +95,7 @@ watch(() => liveUpdateState.revision, load);
|
||||
<div class="form-grid">
|
||||
<label class="field"><span>Code</span><input v-model="form.code" required /></label>
|
||||
<label class="field"><span>Name</span><input v-model="form.name" required /></label>
|
||||
<label class="field"><span>Skonto %</span><input v-model="form.discount_percent" type="number" min="0" max="100" step="0.01" required /></label>
|
||||
<label class="field"><span>Skonto %</span><input v-model="form.discount_percent" inputmode="decimal" required /></label>
|
||||
<label class="field"><span>Skontofrist Tage</span><input v-model="form.discount_days" type="number" min="0" required /></label>
|
||||
<label class="field"><span>Nettoziel Tage</span><input v-model="form.net_days" type="number" min="0" /></label>
|
||||
<label class="field"><span>Gültig ab</span><input v-model="form.valid_from" type="date" /></label>
|
||||
|
||||
Reference in New Issue
Block a user