ledger balance

This commit is contained in:
Sirttas
2026-05-23 14:29:25 +02:00
parent 2970f48e65
commit 4fbced2c70
5 changed files with 121 additions and 18 deletions
+98
View File
@@ -26,6 +26,7 @@ import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError, operationServerM
export interface CombinedLedgerResponse extends LedgerResponse { export interface CombinedLedgerResponse extends LedgerResponse {
'ledgerId': string; 'ledgerId': string;
'name': string; 'name': string;
'balance': number;
'memberLedgerIds': Array<string>; 'memberLedgerIds': Array<string>;
'type'?: CombinedLedgerResponseTypeEnum; 'type'?: CombinedLedgerResponseTypeEnum;
} }
@@ -62,6 +63,7 @@ export type LedgerResponseTypeEnum = typeof LedgerResponseTypeEnum[keyof typeof
export interface MainLedgerResponse extends LedgerResponse { export interface MainLedgerResponse extends LedgerResponse {
'ledgerId': string; 'ledgerId': string;
'name': string; 'name': string;
'balance': number;
'type'?: MainLedgerResponseTypeEnum; 'type'?: MainLedgerResponseTypeEnum;
} }
@@ -79,6 +81,102 @@ export interface UpdateMainLedgerRequest {
'name': string; 'name': string;
} }
/**
* ActivityControllerApi - axios parameter creator
*/
export const ActivityControllerApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
*
* @param {number} characterId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
fetchNewActivitiesForCharacter: async (characterId: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'characterId' is not null or undefined
assertParamExists('fetchNewActivitiesForCharacter', 'characterId', characterId)
const localVarPath = `/activity/fetch/{characterId}`
.replace('{characterId}', encodeURIComponent(String(characterId)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};
/**
* ActivityControllerApi - functional programming interface
*/
export const ActivityControllerApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = ActivityControllerApiAxiosParamCreator(configuration)
return {
/**
*
* @param {number} characterId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async fetchNewActivitiesForCharacter(characterId: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.fetchNewActivitiesForCharacter(characterId, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['ActivityControllerApi.fetchNewActivitiesForCharacter']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
}
};
/**
* ActivityControllerApi - factory interface
*/
export const ActivityControllerApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = ActivityControllerApiFp(configuration)
return {
/**
*
* @param {number} characterId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
fetchNewActivitiesForCharacter(characterId: number, options?: RawAxiosRequestConfig): AxiosPromise<void> {
return localVarFp.fetchNewActivitiesForCharacter(characterId, options).then((request) => request(axios, basePath));
},
};
};
/**
* ActivityControllerApi - object-oriented interface
*/
export class ActivityControllerApi extends BaseAPI {
/**
*
* @param {number} characterId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
public fetchNewActivitiesForCharacter(characterId: number, options?: RawAxiosRequestConfig) {
return ActivityControllerApiFp(this.configuration).fetchNewActivitiesForCharacter(characterId, options).then((request) => request(this.axios, this.basePath));
}
}
/** /**
* LedgerControllerApi - axios parameter creator * LedgerControllerApi - axios parameter creator
*/ */
+1 -1
View File
@@ -49,7 +49,7 @@ const open = () => {
} }
const canSave = computed(() => name.value.trim().length > 0); const canSave = computed(() => name.value.trim().length > 0);
const isCreating = computed(() => props.ledgerId) const isCreating = computed(() => props.ledgerId === undefined || props.ledgerId.length === 0);
const title = computed(() => { const title = computed(() => {
if (isCreating.value) { if (isCreating.value) {
return `Creating ${type.value === LedgerTypes.Main ? 'Main' : 'Combined'} Ledger` return `Creating ${type.value === LedgerTypes.Main ? 'Main' : 'Combined'} Ledger`
+2 -1
View File
@@ -1,6 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
const addCharacter = () => { const addCharacter = () => {
// TODO window.location.replace("http://localhost:8080/oauth2/authorization/esi");
} }
</script> </script>
+7 -3
View File
@@ -4,13 +4,14 @@ import {CreateLedgerModal, LedgerLabel, useLedgersStore} from "@/ledger";
import {storeToRefs} from "pinia"; import {storeToRefs} from "pinia";
import {nextTick, ref} from "vue"; import {nextTick, ref} from "vue";
import {PencilSquareIcon} from "@heroicons/vue/24/outline"; import {PencilSquareIcon} from "@heroicons/vue/24/outline";
import {formatIsk} from "@/formaters.ts";
const {ledgers} = storeToRefs(useLedgersStore()); const {ledgers} = storeToRefs(useLedgersStore());
const editModal = ref<typeof CreateLedgerModal>(); const editModal = ref<typeof CreateLedgerModal>();
const editingLedgerId = ref(0); const editingLedgerId = ref("");
const openEdit = async (ledgerId: number) => { const openEdit = async (ledgerId: string) => {
editingLedgerId.value = ledgerId; editingLedgerId.value = ledgerId;
await nextTick(); await nextTick();
editModal.value?.open(); editModal.value?.open();
@@ -21,7 +22,10 @@ const openEdit = async (ledgerId: number) => {
<template> <template>
<div class="mt-4"> <div class="mt-4">
<div v-for="ledger in ledgers" :key="ledger.ledgerId" class="flex items-center mb-2"> <div v-for="ledger in ledgers" :key="ledger.ledgerId" class="flex items-center mb-2">
<LedgerLabel class="grow" :ledger="ledger" /> <LedgerLabel :ledger="ledger" />
<div class="flex grow">
<span class="ms-2">{{ formatIsk(ledger.balance) }}</span>
</div>
<button class="btn-icon ms-2" @click="openEdit(ledger.ledgerId)"><PencilSquareIcon /></button> <button class="btn-icon ms-2" @click="openEdit(ledger.ledgerId)"><PencilSquareIcon /></button>
</div> </div>
</div> </div>
+13 -13
View File
@@ -59,21 +59,21 @@ const logout = async () => {
.user-dropdown { .user-dropdown {
@apply w-full; @apply w-full;
}
:deep(>div) { .user-dropdown :deep(>div) {
@apply w-full; @apply w-full;
> div { > div {
@apply w-full bg-slate-800; @apply w-full bg-slate-800;
}
}
:deep(>button) {
@apply bg-slate-700 hover:bg-slate-800 border-none flex items-center w-full;
}
&.dropdown-open:deep(>button) {
@apply bg-slate-800 rounded-b-none;
} }
} }
.user-dropdown :deep(>button) {
@apply bg-slate-700 hover:bg-slate-800 border-none flex items-center w-full;
}
.user-dropdown.dropdown-open :deep(>button) {
@apply bg-slate-800 rounded-b-none;
}
</style> </style>