Acquisitions in typeinfo
This commit is contained in:
@@ -22,6 +22,7 @@ type Result = {
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
items?: AcquiredType[];
|
items?: AcquiredType[];
|
||||||
|
infoOnly?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Emits {
|
interface Emits {
|
||||||
@@ -30,7 +31,8 @@ interface Emits {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
items: () => []
|
items: () => [],
|
||||||
|
infoOnly: false
|
||||||
});
|
});
|
||||||
defineEmits<Emits>();
|
defineEmits<Emits>();
|
||||||
|
|
||||||
@@ -69,7 +71,7 @@ const getLineColor = (result: Result) => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="flex">
|
<div class="flex" v-if="!infoOnly">
|
||||||
<div class="flex justify-self-end mb-2 mt-4 ms-auto">
|
<div class="flex justify-self-end mb-2 mt-4 ms-auto">
|
||||||
<TaxInput />
|
<TaxInput />
|
||||||
<div class="end">
|
<div class="end">
|
||||||
@@ -92,7 +94,7 @@ const getLineColor = (result: Result) => {
|
|||||||
<SortableHeader v-bind="headerProps" sortKey="count">Bought Amount</SortableHeader>
|
<SortableHeader v-bind="headerProps" sortKey="count">Bought Amount</SortableHeader>
|
||||||
<SortableHeader v-bind="headerProps" sortKey="precentProfit">Profit (%)</SortableHeader>
|
<SortableHeader v-bind="headerProps" sortKey="precentProfit">Profit (%)</SortableHeader>
|
||||||
<SortableHeader v-bind="headerProps" sortKey="iskProfit">Profit (ISK)</SortableHeader>
|
<SortableHeader v-bind="headerProps" sortKey="iskProfit">Profit (ISK)</SortableHeader>
|
||||||
<th></th>
|
<th v-if="!infoOnly"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -109,7 +111,7 @@ const getLineColor = (result: Result) => {
|
|||||||
<td class="text-right">{{ r.count }}</td>
|
<td class="text-right">{{ r.count }}</td>
|
||||||
<td class="text-right">{{ percentFormater.format(r.precentProfit) }}</td>
|
<td class="text-right">{{ percentFormater.format(r.precentProfit) }}</td>
|
||||||
<td class="text-right">{{ formatIsk(r.iskProfit) }}</td>
|
<td class="text-right">{{ formatIsk(r.iskProfit) }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right" v-if="!infoOnly">
|
||||||
<button class="btn-icon me-1" @click="$emit('buy', r.type, r.price, r.buy, r.sell)"><PlusIcon /></button>
|
<button class="btn-icon me-1" @click="$emit('buy', r.type, r.price, r.buy, r.sell)"><PlusIcon /></button>
|
||||||
<button class="btn-icon me-1" @click="$emit('sell', r.type)"><MinusIcon /></button>
|
<button class="btn-icon me-1" @click="$emit('sell', r.type)"><MinusIcon /></button>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ClipboardButton } from '@/components';
|
import { ClipboardButton } from '@/components';
|
||||||
import { MarketType, MarketTypeInput, getMarketType, useApraisalStore } from "@/market";
|
import { MarketType, MarketTypeInput, getMarketType, useApraisalStore } from "@/market";
|
||||||
import { BuyModal } from '@/market/acquisition';
|
import { AcquisitionResultTable, BuyModal, useAcquiredTypesStore } from '@/market/acquisition';
|
||||||
import { TrackingResultTable, createResult, useMarketTrackingStore } from '@/market/tracking';
|
import { TrackingResultTable, createResult, useMarketTrackingStore } from '@/market/tracking';
|
||||||
import { BookmarkIcon, BookmarkSlashIcon, ShoppingCartIcon } from '@heroicons/vue/24/outline';
|
import { BookmarkIcon, BookmarkSlashIcon, ShoppingCartIcon } from '@heroicons/vue/24/outline';
|
||||||
import { computedAsync } from '@vueuse/core/index.cjs';
|
import { computedAsync } from '@vueuse/core/index.cjs';
|
||||||
@@ -20,8 +20,21 @@ const apraisalStore = useApraisalStore();
|
|||||||
const price = computedAsync(() => item.value ? apraisalStore.getPrice(item.value) : undefined);
|
const price = computedAsync(() => item.value ? apraisalStore.getPrice(item.value) : undefined);
|
||||||
const marketTrackingStore = useMarketTrackingStore();
|
const marketTrackingStore = useMarketTrackingStore();
|
||||||
const result = computedAsync(async () => item.value && price.value ? await createResult(item.value?.id, price.value) : undefined);
|
const result = computedAsync(async () => item.value && price.value ? await createResult(item.value?.id, price.value) : undefined);
|
||||||
|
const acquiredTypesStore = useAcquiredTypesStore();
|
||||||
|
|
||||||
const isTracked = computed(() => item.value ? marketTrackingStore.types.includes(item.value.id) : false);
|
const isTracked = computed(() => item.value ? marketTrackingStore.types.includes(item.value.id) : false);
|
||||||
|
const acquisitions = computed(() => {
|
||||||
|
const p = price.value;
|
||||||
|
|
||||||
|
return !p ?[] : acquiredTypesStore.types
|
||||||
|
.filter(t => t.type === item.value?.id)
|
||||||
|
.map(i => ({
|
||||||
|
...i,
|
||||||
|
type: p.type,
|
||||||
|
buy: p.buy,
|
||||||
|
sell: p.sell
|
||||||
|
}));
|
||||||
|
});
|
||||||
const toogleTracking = () => {
|
const toogleTracking = () => {
|
||||||
if (!item.value) {
|
if (!item.value) {
|
||||||
return;
|
return;
|
||||||
@@ -88,7 +101,14 @@ watch(useRoute(), async route => {
|
|||||||
<p v-if="item.description" class="text-sm">{{ item.description }}</p>
|
<p v-if="item.description" class="text-sm">{{ item.description }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<TrackingResultTable v-if="result" :items="[result]" infoOnly />
|
<div v-if="result" class="mb-4">
|
||||||
|
<span>Market Info:</span>
|
||||||
|
<TrackingResultTable :items="[result]" infoOnly />
|
||||||
|
</div>
|
||||||
|
<div v-if="acquisitions">
|
||||||
|
<span>Acquisitions:</span>
|
||||||
|
<AcquisitionResultTable :items="acquisitions" infoOnly />
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<BuyModal ref="buyModal" />
|
<BuyModal ref="buyModal" />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user