Skip to content

Commit

Permalink
fix: build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
JustSamuel committed Sep 12, 2024
1 parent bd0dfd9 commit 2b0a573
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 12 deletions.
1 change: 1 addition & 0 deletions apps/dashboard/src/locales/en/common/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"payoutCreated": "Successfully created payout.",
"invoiceDeleted": "Successfully deleted invoice.",
"invoiceUpdated": "Successfully updated invoice.",
"invoiceAmountUpdated": "Successfully updated invoice amount.",
"pointOfSaleDeleted": "Successfully deleted POS.",
"pointOfSaleUpdated": "Successfully updated POS.",
"pointOfSaleCreated": "Successfully created POS.",
Expand Down
5 changes: 4 additions & 1 deletion apps/dashboard/src/locales/en/modules/financial.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"invoice": {
"title": "Invoice overview",
"invoice": "Invoice",
"transfer": "Transfer amount",
"credit": "Credit invoice",
"delete": "Delete invoice",
"confirmDelete": "Are you sure you want to delete this invoice?",
Expand All @@ -35,7 +36,9 @@
"recompile": "Recompile",
"reload": "Reload",
"missingPdf": "PDF is missing or generation failed",
"deleted": "Invoice has been deleted."
"deleted": "Invoice has been deleted.",
"dirty": "Invoice amount does not match transfer amount.",
"total": "The current total on the invoice is {total}"
},
"payout": {
"title": "Payout overview",
Expand Down
1 change: 1 addition & 0 deletions apps/dashboard/src/locales/nl/common/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"payoutCreated": "Uitbetaling succesvol aangemaakt.",
"invoiceDeleted": "Factuur succesvol verwijderd.",
"invoiceUpdated": "Factuur succesvol bijgewerkt.",
"invoiceAmountUpdated": "Factuurbedrag succesvol bijgewerkt.",
"pointOfSaleDeleted": "POS succesvol verwijderd.",
"pointOfSaleUpdated": "POS succesvol bijgewerkt.",
"pointOfSaleCreated": "POS succesvol aangemaakt.",
Expand Down
5 changes: 4 additions & 1 deletion apps/dashboard/src/locales/nl/modules/financial.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"invoice": {
"title": "Factuuroverzicht",
"invoice": "Factuur",
"transfer": "Overboeking",
"credit": "Creditfactuur",
"delete": "Factuur verwijderen",
"confirmDelete": "Weet je zeker dat je deze factuur wilt verwijderen?",
Expand All @@ -35,7 +36,9 @@
"recompile": "Opnieuw samenstellen",
"reload": "Opnieuw laden",
"missingPdf": "PDF ontbreekt of genereren is mislukt",
"deleted": "Factuur is verwijderd."
"deleted": "Factuur is verwijderd.",
"dirty": "De factuurbedrag komt niet overeen met de overboeking.",
"total": "Het huidige totaal op de factuur is {total}"
},
"payout": {
"title": "Uitbetalingsoverzicht",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<FormCard :header="t('c_invoiceInfo.Amount')" v-if="invoice" @cancel="form.context.resetForm"
<FormCard :header="t('modules.financial.invoice.transfer')" v-if="invoice" @cancel="form.context.resetForm"
@update:modelValue="edit = $event" @save="formSubmit" :enableEdit="!deleted">
<div class="flex flex-column justify-content-between gap-2">
<InvoiceAmountForm :invoice="invoice" :form="form" :edit="edit" @update:edit="edit = $event"/>
Expand Down Expand Up @@ -39,7 +39,7 @@ const formSubmit = () => {
};
const updateFieldValues = (p: InvoiceResponse) => {
if (!p) return;
if (!p || !p.transfer) return;
const values = {
amount: p.transfer.amountInclVat.amount / 100,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ const exclVat: Ref<DineroObject> = ref({ amount: 0, precision: 2, currency: 'EUR
const totalEntries: Ref<DineroObject> = ref({ amount: 0, precision: 2, currency: 'EUR' });
const vat: Ref<Record<number, DineroObject>> = ref({});
const inclVat: Ref<DineroObject> = ref({ amount: 0, precision: 2, currency: 'EUR' });
const totalRows: InvoiceEntryResponse[] = [];
const allRows = ref([]);
const totalRows: (InvoiceEntryResponse & { class?: any })[] = [];
const allRows: Ref<(InvoiceEntryResponse & { class?: any })[]> = ref([]);
const totalRowCutoff = ref(0);
Expand Down Expand Up @@ -142,7 +142,7 @@ onMounted(() => {
if (props.invoice.transfer && isDirty(props.invoice)) {
totalRows.push({
description: t('common.transfer'),
description: t('modules.financial.invoice.transfer'),
amount: 1,
vatPercentage: 0,
class: { 'text-red-500': true },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<template>
<div class="flex flex-column justify-content-between gap-2">
<InputSpan :label="t('c_invoiceInfo.Amount')"
<InputSpan :label="t('modules.financial.invoice.transfer')"
:value="form.model.amount.value.value"
:attributes="form.model.amount.attr.value"
@update:value="form.context.setFieldValue('amount', $event)"
:errors="form.context.errors.value.amount"
id="name" placeholder="0" type="currency" :disabled="!edit"/>
The current total on the invoice is {{ formatPrice(entryTotal) }}
<!-- {{ entryTotal }}-->
{{ t('modules.financial.invoice.total', { total: formatPrice(entryTotal) }) }}
</div>
</template>

Expand Down Expand Up @@ -65,8 +64,8 @@ setSubmit(props.form, props.form.context.handleSubmit(async (values) => {
} }).then(() => {
toast.add({
severity: 'success',
summary: t('successMessages.success'),
detail: t('c_invoiceInfo.AmountUpdated'),
summary: t('common.toast.success.success'),
detail: t('common.toast.success.invoiceAmountUpdated'),
life: 3000,
});
emit('update:edit', false);
Expand Down
1 change: 1 addition & 0 deletions apps/dashboard/src/utils/invoiceUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ import type { InvoiceResponse } from "@sudosos/sudosos-client";

export function isDirty(invoice: InvoiceResponse): boolean {
const entryTotal = invoice.invoiceEntries.reduce((sum, entry) => sum + entry.priceInclVat.amount * entry.amount, 0);
if (!invoice.transfer) return false;
return entryTotal !== invoice.transfer.amountInclVat.amount;
}

0 comments on commit 2b0a573

Please sign in to comment.