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

View File

@@ -41,6 +41,9 @@ const addItem = async () => {
} }
addOrRelaod(type); 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))); watch(items, async itms => markeyScanStore.setTypes(itms.map(i => i.type.id)));
@@ -72,7 +75,7 @@ watch(() => markeyScanStore.types, async t => {
</div> </div>
<template v-if="items.length > 0"> <template v-if="items.length > 0">
<hr /> <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" /> <BuyModal ref="buyModal" />
</template> </template>
</template> </template>