ledger balance
This commit is contained in:
+1
-1
@@ -24,7 +24,7 @@ const hideSidebar = computed(() => {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "tailwindcss";
|
||||
@reference "@/style.css";
|
||||
|
||||
div.main-container {
|
||||
@apply px-4 sm:ml-64;
|
||||
|
||||
@@ -61,7 +61,7 @@ useEventListener('keyup', e => {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "tailwindcss";
|
||||
@reference "@/style.css";
|
||||
|
||||
.chevron {
|
||||
@apply w-4 h-4 me-1;
|
||||
|
||||
@@ -35,7 +35,7 @@ useEventListener('keyup', e => {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "tailwindcss";
|
||||
@reference "@/style.css";
|
||||
.fade-enter-from, .fade-leave-to {
|
||||
@apply opacity-0;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ const submit = () => {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "tailwindcss";
|
||||
@reference "@/style.css";
|
||||
.fake-input {
|
||||
@apply flex border bg-slate-500 rounded px-1 py-0.5;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ const modelValue = defineModel({ default: false });
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "tailwindcss";
|
||||
@reference "@/style.css";
|
||||
input:checked ~ span:last-child {
|
||||
--tw-translate-x: 1.25rem;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ const emit = defineEmits<Emit>();
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "tailwindcss";
|
||||
@reference "@/style.css";
|
||||
.sort-header {
|
||||
@apply relative h-8 pe-3;
|
||||
}
|
||||
|
||||
@@ -68,11 +68,18 @@ const itemHeightStyle = computed(() => {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "tailwindcss";
|
||||
@reference "@/style.css";
|
||||
|
||||
div.table-container {
|
||||
@apply bg-slate-600;
|
||||
max-height: calc(100vh - v-bind(ypx));
|
||||
:deep(>div) {
|
||||
|
||||
&::-webkit-scrollbar-track {
|
||||
margin-top: v-bind(computedHeaderHeight);
|
||||
margin-bottom: v-bind(computedFooterHeight);
|
||||
}
|
||||
}
|
||||
div.table-container:deep(>div) {
|
||||
@apply bg-slate-800;
|
||||
>table {
|
||||
>thead {
|
||||
@@ -88,9 +95,4 @@ div.table-container {
|
||||
}
|
||||
}
|
||||
}
|
||||
&::-webkit-scrollbar-track {
|
||||
margin-top: v-bind(computedHeaderHeight);
|
||||
margin-bottom: v-bind(computedFooterHeight);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -136,7 +136,7 @@ defineExpose({ open });
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "tailwindcss";
|
||||
@reference "@/style.css";
|
||||
|
||||
button.switch {
|
||||
@apply flex items-center px-4 rounded-md bg-slate-600;
|
||||
|
||||
@@ -26,7 +26,7 @@ const ledgerId = computed({
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "tailwindcss";
|
||||
@reference "@/style.css";
|
||||
|
||||
.system-ledger {
|
||||
@apply text-emerald-400;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
BalanceResponse,
|
||||
CombinedLedgerResponse,
|
||||
CombinedLedgerResponseTypeEnum,
|
||||
CreateCombinedLedgerRequest,
|
||||
@@ -75,7 +76,10 @@ export const useLedgersStore = defineStore('ledgers', () => {
|
||||
return {ledgers, findById, findAllById, createMain, createCombined, updateMain, updateCombined, refresh};
|
||||
})
|
||||
|
||||
export const findAllTransactionInLeger = (ledger: Ledger | string): Promise<TransactionResponse[]> => transactionApi.finAllTransactionsInLedger(typeof ledger == 'string' ? ledger : ledger.ledgerId).then(response => response.data)
|
||||
const getLedgerId = (ledger: Ledger | string): string => typeof ledger == 'string' ? ledger : ledger.ledgerId;
|
||||
|
||||
export const findAllTransactionInLeger = (ledger: Ledger | string): Promise<TransactionResponse[]> => transactionApi.finAllTransactionsInLedger(getLedgerId(ledger)).then(response => response.data)
|
||||
export const getLedgerBalance = (ledger: Ledger | string): Promise<BalanceResponse> => ledgerApi.findBalanceByLedgerId(getLedgerId(ledger)).then(response => response.data)
|
||||
|
||||
export const useLedgerParam = () => {
|
||||
const {findById} = useLedgersStore();
|
||||
|
||||
@@ -75,7 +75,7 @@ watchEffect(async () => {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "tailwindcss";
|
||||
@reference "@/style.css";
|
||||
|
||||
.tooltip {
|
||||
@apply ms-auto;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import {SortableHeader, useSort, VirtualScrollTable} from '@/components/table';
|
||||
import { formatEveDate, formatIsk, percentFormater } from '@/formaters';
|
||||
import {MarketType, MarketTypeLabel, TaxInput, useMarketTaxStore} from "@/market";
|
||||
import {MinusIcon, PlusIcon} from '@heroicons/vue/24/outline';
|
||||
import {useStorage} from '@vueuse/core';
|
||||
@@ -246,7 +245,7 @@ const total = computed(() => {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "tailwindcss";
|
||||
@reference "@/style.css";
|
||||
div.end {
|
||||
@apply justify-self-end ms-2;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ const { brokerFee, scc } = storeToRefs(useMarketTaxStore());
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "tailwindcss";
|
||||
@reference "@/style.css";
|
||||
div.end {
|
||||
@apply justify-self-end ms-2;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import {SliderCheckbox} from '@/components';
|
||||
import {SortableHeader, useSort, VirtualScrollTable} from '@/components/table';
|
||||
import { formatIsk, percentFormater } from '@/formaters';
|
||||
import {getHistoryQuartils, MarketType, MarketTypeLabel, TaxInput, useMarketTaxStore} from "@/market";
|
||||
import {BookmarkSlashIcon, ShoppingCartIcon} from '@heroicons/vue/24/outline';
|
||||
import {useStorage} from '@vueuse/core';
|
||||
@@ -168,7 +167,7 @@ const getLineColor = (result: Result) => {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "tailwindcss";
|
||||
@reference "@/style.css";
|
||||
div.end {
|
||||
@apply justify-self-end ms-2;
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ watchEffect(async () => {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "tailwindcss";
|
||||
@reference "@/style.css";
|
||||
.fake-input {
|
||||
@apply w-96 flex border bg-slate-500 rounded px-1 py-0.5;
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
import {ClipboardButton} from '@/components';
|
||||
import {InformationCircleIcon} from '@heroicons/vue/24/outline';
|
||||
import {routeNames} from '@/routes';
|
||||
import {computedAsync} from "@vueuse/core";
|
||||
import {getMarketType} from "@/market";
|
||||
|
||||
|
||||
interface Props {
|
||||
@@ -10,29 +12,39 @@ interface Props {
|
||||
hideCopy?: boolean;
|
||||
}
|
||||
|
||||
withDefaults(defineProps<Props>(), {
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
name: "",
|
||||
id: 0,
|
||||
hideCopy: false
|
||||
});
|
||||
|
||||
const computedName = computedAsync<string>(async () => {
|
||||
if (props.name) {
|
||||
return props.name;
|
||||
} else if (props.id) {
|
||||
return await getMarketType(props.id).then(marketType => marketType.name);
|
||||
}
|
||||
return "";
|
||||
}, "");
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="id || name" class="flex flex-row">
|
||||
<div v-if="id || computedName" class="flex flex-row">
|
||||
<img v-if="id" :src="`https://images.evetech.net/types/${id}/icon?size=32`" class="inline-block w-5 h-5 me-1 mt-1" alt="" />
|
||||
<template v-if="name">
|
||||
{{ name }}
|
||||
<RouterLink v-if="id" :to="{ name: routeNames.marketTypes, params: { type: id } }" class="button btn-icon ms-1 me-1 mt-1" title="Show item info">
|
||||
<template v-if="computedName">
|
||||
{{ computedName }}
|
||||
<RouterLink v-if="id" :to="{ name: routeNames.marketTypes, params: { type: id } }" class="btn-icon ms-1 me-1 mt-1" title="Show item info">
|
||||
<InformationCircleIcon />
|
||||
</RouterLink>
|
||||
<ClipboardButton v-if="!hideCopy" :value="name" />
|
||||
<ClipboardButton v-if="!hideCopy" :value="computedName" />
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "tailwindcss";
|
||||
button:deep(>svg), .button:deep(>svg) {
|
||||
@reference "@/style.css";
|
||||
|
||||
button:deep(>svg), .btn-icon:deep(>svg) {
|
||||
@apply !w-4 !h-4;
|
||||
}
|
||||
</style>
|
||||
@@ -6,7 +6,7 @@ import {TransactionResponse} from "@/generated/mammon";
|
||||
import {formatEveDate} from "@/formaters.ts";
|
||||
import {IskLabel} from "@/market";
|
||||
|
||||
const {ledgerId, ledger} = useLedgerParam();
|
||||
const {ledgerId} = useLedgerParam();
|
||||
|
||||
const transactions = computedAsync<TransactionResponse[]>(async () => {
|
||||
if (ledgerId.value) {
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
import {EditLedgerModal, LedgerLabel, useLedgersStore} from "@/ledger";
|
||||
import {EditLedgerModal, Ledger, LedgerLabel, useLedgersStore} from "@/ledger";
|
||||
import {storeToRefs} from "pinia";
|
||||
import {nextTick, ref} from "vue";
|
||||
import {PencilSquareIcon} from "@heroicons/vue/24/outline";
|
||||
import {IskLabel} from "@/market";
|
||||
import {SortableHeader, useSort, VirtualScrollTable} from "@/components/table";
|
||||
|
||||
const {ledgers} = storeToRefs(useLedgersStore());
|
||||
|
||||
const { sortedArray, headerProps } = useSort<Ledger>(ledgers)
|
||||
|
||||
const editModal = ref<typeof EditLedgerModal>();
|
||||
const editingLedgerId = ref("");
|
||||
|
||||
@@ -21,13 +24,35 @@ const openEdit = async (ledgerId: string) => {
|
||||
|
||||
<template>
|
||||
<div class="mt-4">
|
||||
<div v-for="ledger in ledgers" :key="ledger.ledgerId" class="flex items-center mb-2">
|
||||
<LedgerLabel :ledger="ledger" :link="true" />
|
||||
<div class="flex grow">
|
||||
<IskLabel class="ms-2" :amount="ledger.balance" />
|
||||
</div>
|
||||
<button class="btn-icon ms-2" @click="openEdit(ledger.ledgerId)"><PencilSquareIcon /></button>
|
||||
<VirtualScrollTable :list="sortedArray" :itemHeight="33" bottom="1rem">
|
||||
<template #default="{ list }">
|
||||
<thead>
|
||||
<tr>
|
||||
<SortableHeader v-bind="headerProps" sortKey="name">Ledger</SortableHeader>
|
||||
<SortableHeader v-bind="headerProps" sortKey="balance">Isk Balance</SortableHeader>
|
||||
<SortableHeader v-bind="headerProps" sortKey="buttons" unsortable />
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="l in list" :key="l.data.ledgerId">
|
||||
<td>
|
||||
<LedgerLabel :ledger="l.data" :link="true" />
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<IskLabel class="ms-2" :amount="l.data.balance" />
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<button class="btn-icon ms-2" @click="openEdit(l.data.ledgerId)"><PencilSquareIcon /></button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</template>
|
||||
<template #empty>
|
||||
<div class="text-center mt-4">
|
||||
<span>No ledgers found</span>
|
||||
</div>
|
||||
</template>
|
||||
</VirtualScrollTable>
|
||||
</div>
|
||||
<EditLedgerModal ref="editModal" :ledger-id="editingLedgerId" />
|
||||
</template>
|
||||
|
||||
@@ -1,11 +1,28 @@
|
||||
<script setup lang="ts">
|
||||
import {useLedgerParam} from "@/ledger";
|
||||
import {getLedgerBalance, useLedgerParam} from "@/ledger";
|
||||
import {computedAsync} from "@vueuse/core";
|
||||
import {BalanceResponse} from "@/generated/mammon";
|
||||
import {IskLabel, MarketTypeLabel} from "@/market";
|
||||
|
||||
const {ledgerId, ledger} = useLedgerParam();
|
||||
const {ledgerId} = useLedgerParam();
|
||||
|
||||
const balance = computedAsync<BalanceResponse>(async () => {
|
||||
if (ledgerId.value) {
|
||||
return await getLedgerBalance(ledgerId.value);
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="mt-4">
|
||||
<div v-if="balance" class="mt-4">
|
||||
<div class="border-b-1">
|
||||
<IskLabel class="mb-2" :amount="balance.iskBalance" />
|
||||
</div>
|
||||
<div v-for="item in balance.itemBalances" :key="item.typeId" class="mt-2 flex gap-2">
|
||||
<MarketTypeLabel :id="item.typeId" />
|
||||
<span>{{item.quantity}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -115,7 +115,7 @@ watch(useRoute(), async route => {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "tailwindcss";
|
||||
@reference "@/style.css";
|
||||
|
||||
img.type-image {
|
||||
width: 64px;
|
||||
|
||||
@@ -108,7 +108,7 @@ watch(useRoute(), async route => {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "tailwindcss";
|
||||
@reference "@/style.css";
|
||||
|
||||
.rule-dropdown :deep(>button) {
|
||||
@apply bg-slate-800 hover:bg-slate-800 border-none flex items-center w-full;
|
||||
|
||||
@@ -13,7 +13,7 @@ const modelValue = defineModel({ default: false });
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "tailwindcss";
|
||||
@reference "@/style.css";
|
||||
input:checked ~ span:last-child {
|
||||
--tw-translate-x: 1.75rem;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ watch(ledgerRefsWithSystem, (newVal, oldVal) => {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "tailwindcss";
|
||||
@reference "@/style.css";
|
||||
|
||||
.system-ledger {
|
||||
@apply text-emerald-400;
|
||||
|
||||
@@ -60,7 +60,7 @@ useSortable(sortableContainer, clauses, { handle: '.sortable-handle'});
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "tailwindcss";
|
||||
@reference "@/style.css";
|
||||
|
||||
.sortable-handle {
|
||||
@apply cursor-grab;
|
||||
|
||||
@@ -49,7 +49,7 @@ const logout = async () => {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
@reference "tailwindcss";
|
||||
@reference "@/style.css";
|
||||
|
||||
.sidebar-button {
|
||||
@apply flex items-center rounded-md hover:bg-slate-800 cursor-pointer;
|
||||
|
||||
+7
-4
@@ -2,6 +2,12 @@
|
||||
|
||||
@custom-variant search-cancel (&::-webkit-search-cancel-button);
|
||||
|
||||
@utility btn-icon {
|
||||
@apply p-0 border-none bg-transparent hover:text-slate-400 hover:bg-transparent cursor-pointer;
|
||||
> svg {
|
||||
@apply w-6 h-6;
|
||||
}
|
||||
}
|
||||
@layer base {
|
||||
span, table, input, th, tr, td, button, a.button, div, hr {
|
||||
@apply border-slate-600 text-slate-100 placeholder-slate-400;
|
||||
@@ -72,10 +78,7 @@
|
||||
}
|
||||
|
||||
.btn-icon {
|
||||
@apply p-0 border-none bg-transparent hover:text-slate-400 hover:bg-transparent cursor-pointer;
|
||||
> svg {
|
||||
@apply w-6 h-6;
|
||||
}
|
||||
@apply btn-icon;
|
||||
}
|
||||
|
||||
a.tab {
|
||||
|
||||
Reference in New Issue
Block a user