From 0bfef0806b26cd7ecb0c50e5dbc9fe3150938b85 Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Fri, 30 Jan 2026 16:23:57 +0100 Subject: [PATCH] Fix for #73 --- frontend/stores/data.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/frontend/stores/data.js b/frontend/stores/data.js index 924be1a..153c06e 100644 --- a/frontend/stores/data.js +++ b/frontend/stores/data.js @@ -912,10 +912,11 @@ export const useDataStore = defineStore('data', () => { inputType: "number", inputTrailing: "EUR", inputChangeFunction: function (row) { + console.log(row) if(row.markup_percentage) { - row.seling_price = (row.purchase_price * (1+row.markup_percentage/100)).toFixed(4) + row.selling_price = (row.purchase_price * (1+row.markup_percentage/100)).toFixed(4) } else { - row.seling_price = row.purchase_price.toFixed(4) + row.selling_price = Number(row.purchase_price.toFixed(4)) } } },{ @@ -924,12 +925,13 @@ export const useDataStore = defineStore('data', () => { inputType: "number", inputTrailing: "%", inputChangeFunction: function (row) { - if(row.purchase_price && ! row.seling_price) { - row.seling_price = (row.purchase_price * (1+row.markup_percentage/100)).toFixed(4) - } else if(row.seling_price && !row.purchase_price) { - row.purchase_price = (row.seling_price / (1+row.markup_percentage/100)).toFixed(4) + console.log(row) + if(row.purchase_price && ! row.selling_price) { + row.selling_price = (row.purchase_price * (1+row.markup_percentage/100)).toFixed(4) + } else if(row.selling_price && !row.purchase_price) { + row.purchase_price = (row.selling_price / (1+row.markup_percentage/100)).toFixed(4) } else { - row.seling_price = (row.purchase_price * (1+row.markup_percentage/100)).toFixed(4) + row.selling_price = (row.purchase_price * (1+row.markup_percentage/100)).toFixed(4) } } },{ @@ -940,6 +942,7 @@ export const useDataStore = defineStore('data', () => { inputType: "number", inputTrailing: "EUR", inputChangeFunction: function (row) { + console.log(row) if(row.purchase_price ) { row.markup_percentage = ((row.selling_price / row.purchase_price - 1) * 100 ).toFixed(2) } else{