add taxes

This commit is contained in:
2023-10-02 09:52:11 +02:00
parent 0026cba23d
commit 2b513a91b0
8 changed files with 54 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import { formatIsk, percentFormater } from '@/formaters';
import { MarketType, MarketTypeLabel } from "@/market";
import { MarketType, MarketTypeLabel, TaxInput, useMarketTaxStore } from "@/market";
import { SortableHeader, useSort } from '@/table';
import { MinusIcon, PlusIcon } from '@heroicons/vue/24/outline';
import { useStorage } from '@vueuse/core';
@@ -33,12 +33,14 @@ const props = withDefaults(defineProps<Props>(), {
});
defineEmits<Emits>();
const marketTaxStore = useMarketTaxStore();
const threshold = useStorage('market-track-threshold', 10);
const filter = ref("");
const { sortedArray, headerProps } = useSort<Result>(computed(() => props.items
.filter(r => r.type.name.toLowerCase().includes(filter.value.toLowerCase()))
.map(r => {
const precentProfit = (r.sell / r.averagePrice) - 1;
const precentProfit = marketTaxStore.calculateProfit(r.averagePrice, r.sell);
return {
type: r.type,
@@ -68,6 +70,7 @@ const getLineColor = (result: Result) => {
<template>
<div class="flex">
<div class="flex justify-self-end mb-2 mt-4 ms-auto">
<TaxInput />
<div class="end">
<span>Profit Threshold: </span>
<input type="number" min="0" max="1000" step="1" v-model="threshold" />