remove scan

This commit is contained in:
2023-09-23 11:50:28 +02:00
parent 2c728c7037
commit 575d4dc5ab
2 changed files with 7 additions and 2 deletions

View File

@@ -2,7 +2,7 @@
import { formatIsk, percentFormater } from '@/formaters';
import { MarketType, MarketTypeLabel } from "@/market";
import { SortableHeader, useSort } from '@/table';
import { ShoppingCartIcon } from '@heroicons/vue/24/outline';
import { ShoppingCartIcon, TrashIcon } from '@heroicons/vue/24/outline';
import { useStorage } from '@vueuse/core';
import { computed, ref } from 'vue';
import { ScanResult, getHistoryQuartils } from '.';
@@ -25,6 +25,7 @@ interface Props {
interface Emits {
(e: 'buy', type: MarketType, buy: number, sell: number): void;
(e: 'remove', type: MarketType): void;
}
const props = withDefaults(defineProps<Props>(), {
@@ -110,6 +111,7 @@ const getLineColor = (result: Result) => {
<td class="text-right">{{ percentFormater.format(r.profit) }}</td>
<td class="text-right">
<button class="btn-icon-stroke me-1" @click="$emit('buy', r.type, r.buy, r.sell)"><ShoppingCartIcon /></button>
<button class="btn-icon-stroke me-1" @click="$emit('remove', r.type)"><TrashIcon /></button>
</td>
</tr>
</tbody>

View File

@@ -41,6 +41,9 @@ const addItem = async () => {
}
addOrRelaod(type);
}
const removeItem = (type: MarketType) => {
items.value = items.value.filter(i => i.type.id !== type.id);
}
watch(items, async itms => markeyScanStore.setTypes(itms.map(i => i.type.id)));
@@ -72,7 +75,7 @@ watch(() => markeyScanStore.types, async t => {
</div>
<template v-if="items.length > 0">
<hr />
<ScanResultTable :items="items" @buy="(type, buy, sell) => buyModal?.open(type, { 'Buy': buy, 'Sell': sell })" />
<ScanResultTable :items="items" @buy="(type, buy, sell) => buyModal?.open(type, { 'Buy': buy, 'Sell': sell })" @remove="removeItem" />
<BuyModal ref="buyModal" />
</template>
</template>