ledger list and modal

This commit is contained in:
Sirttas
2026-05-17 19:19:01 +02:00
parent f9ae0d142a
commit 8005e7a45b
19 changed files with 843 additions and 95 deletions
+2
View File
@@ -23,3 +23,5 @@ docker-compose.yml
*.njsproj
*.sln
*.sw?
generated/mammon/
+270
View File
@@ -0,0 +1,270 @@
/* tslint:disable */
/* eslint-disable */
/**
* OpenAPI definition
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: v0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import type { Configuration } from './configuration';
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction, replaceWithSerializableTypeIfNeeded } from './common';
import type { RequestArgs } from './base';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError, operationServerMap } from './base';
export interface CombiningLedgerDto extends LedgerDto {
'ledgerId': number;
'name': string;
'memberLedgerIds': Array<number>;
}
export interface CreateCombiningLedgerCommand {
'name': string;
'memberLedgerIds': Array<number>;
}
export interface CreateMainLedgerCommand {
'name': string;
}
/**
* @type FindAll200ResponseInner
*/
export type FindAll200ResponseInner = CombiningLedgerDto | MainLedgerDto;
export interface LedgerDto {
'type': string;
}
export interface MainLedgerDto extends LedgerDto {
'ledgerId': number;
'name': string;
}
/**
* LegerControllerApi - axios parameter creator
*/
export const LegerControllerApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
*
* @param {CreateCombiningLedgerCommand} createCombiningLedgerCommand
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createCombiningLedger: async (createCombiningLedgerCommand: CreateCombiningLedgerCommand, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'createCombiningLedgerCommand' is not null or undefined
assertParamExists('createCombiningLedger', 'createCombiningLedgerCommand', createCombiningLedgerCommand)
const localVarPath = `/ledgers/combining`;
// 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;
localVarHeaderParameter['Content-Type'] = 'application/json';
localVarHeaderParameter['Accept'] = '*/*';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(createCombiningLedgerCommand, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @param {CreateMainLedgerCommand} createMainLedgerCommand
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createMainLedger: async (createMainLedgerCommand: CreateMainLedgerCommand, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'createMainLedgerCommand' is not null or undefined
assertParamExists('createMainLedger', 'createMainLedgerCommand', createMainLedgerCommand)
const localVarPath = `/ledgers/main`;
// 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;
localVarHeaderParameter['Content-Type'] = 'application/json';
localVarHeaderParameter['Accept'] = '*/*';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(createMainLedgerCommand, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
findAll: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/ledgers`;
// 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: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
localVarHeaderParameter['Accept'] = '*/*';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};
/**
* LegerControllerApi - functional programming interface
*/
export const LegerControllerApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = LegerControllerApiAxiosParamCreator(configuration)
return {
/**
*
* @param {CreateCombiningLedgerCommand} createCombiningLedgerCommand
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async createCombiningLedger(createCombiningLedgerCommand: CreateCombiningLedgerCommand, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CombiningLedgerDto>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.createCombiningLedger(createCombiningLedgerCommand, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['LegerControllerApi.createCombiningLedger']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
*
* @param {CreateMainLedgerCommand} createMainLedgerCommand
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async createMainLedger(createMainLedgerCommand: CreateMainLedgerCommand, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<MainLedgerDto>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.createMainLedger(createMainLedgerCommand, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['LegerControllerApi.createMainLedger']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async findAll(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<FindAll200ResponseInner>>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.findAll(options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['LegerControllerApi.findAll']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
}
};
/**
* LegerControllerApi - factory interface
*/
export const LegerControllerApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = LegerControllerApiFp(configuration)
return {
/**
*
* @param {CreateCombiningLedgerCommand} createCombiningLedgerCommand
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createCombiningLedger(createCombiningLedgerCommand: CreateCombiningLedgerCommand, options?: RawAxiosRequestConfig): AxiosPromise<CombiningLedgerDto> {
return localVarFp.createCombiningLedger(createCombiningLedgerCommand, options).then((request) => request(axios, basePath));
},
/**
*
* @param {CreateMainLedgerCommand} createMainLedgerCommand
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createMainLedger(createMainLedgerCommand: CreateMainLedgerCommand, options?: RawAxiosRequestConfig): AxiosPromise<MainLedgerDto> {
return localVarFp.createMainLedger(createMainLedgerCommand, options).then((request) => request(axios, basePath));
},
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
findAll(options?: RawAxiosRequestConfig): AxiosPromise<Array<FindAll200ResponseInner>> {
return localVarFp.findAll(options).then((request) => request(axios, basePath));
},
};
};
/**
* LegerControllerApi - object-oriented interface
*/
export class LegerControllerApi extends BaseAPI {
/**
*
* @param {CreateCombiningLedgerCommand} createCombiningLedgerCommand
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
public createCombiningLedger(createCombiningLedgerCommand: CreateCombiningLedgerCommand, options?: RawAxiosRequestConfig) {
return LegerControllerApiFp(this.configuration).createCombiningLedger(createCombiningLedgerCommand, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @param {CreateMainLedgerCommand} createMainLedgerCommand
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
public createMainLedger(createMainLedgerCommand: CreateMainLedgerCommand, options?: RawAxiosRequestConfig) {
return LegerControllerApiFp(this.configuration).createMainLedger(createMainLedgerCommand, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
public findAll(options?: RawAxiosRequestConfig) {
return LegerControllerApiFp(this.configuration).findAll(options).then((request) => request(this.axios, this.basePath));
}
}
+62
View File
@@ -0,0 +1,62 @@
/* tslint:disable */
/* eslint-disable */
/**
* OpenAPI definition
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: v0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import type { Configuration } from './configuration';
// Some imports not used depending on template conditions
// @ts-ignore
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
export const BASE_PATH = "http://localhost:8080".replace(/\/+$/, "");
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
export interface RequestArgs {
url: string;
options: RawAxiosRequestConfig;
}
export class BaseAPI {
protected configuration: Configuration | undefined;
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
if (configuration) {
this.configuration = configuration;
this.basePath = configuration.basePath ?? basePath;
}
}
};
export class RequiredError extends Error {
constructor(public field: string, msg?: string) {
super(msg);
this.name = "RequiredError"
}
}
interface ServerMap {
[key: string]: {
url: string,
description: string,
}[];
}
export const operationServerMap: ServerMap = {
}
+127
View File
@@ -0,0 +1,127 @@
/* tslint:disable */
/* eslint-disable */
/**
* OpenAPI definition
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: v0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import type { Configuration } from "./configuration";
import type { RequestArgs } from "./base";
import type { AxiosInstance, AxiosResponse } from 'axios';
import { RequiredError } from "./base";
export const DUMMY_BASE_URL = 'https://example.com'
/**
*
* @throws {RequiredError}
*/
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
if (paramValue === null || paramValue === undefined) {
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
}
}
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
if (configuration && configuration.apiKey) {
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
? await configuration.apiKey(keyParamName)
: await configuration.apiKey;
object[keyParamName] = localVarApiKeyValue;
}
}
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
if (configuration && (configuration.username || configuration.password)) {
object["auth"] = { username: configuration.username, password: configuration.password };
}
}
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
if (configuration && configuration.accessToken) {
const accessToken = typeof configuration.accessToken === 'function'
? await configuration.accessToken()
: await configuration.accessToken;
object["Authorization"] = "Bearer " + accessToken;
}
}
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
? await configuration.accessToken(name, scopes)
: await configuration.accessToken;
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
}
}
function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
if (parameter == null) return;
if (typeof parameter === "object") {
if (Array.isArray(parameter) || parameter instanceof Set) {
(parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
}
else {
Object.keys(parameter).forEach(currentKey =>
setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`)
);
}
}
else {
if (urlSearchParams.has(key)) {
urlSearchParams.append(key, parameter);
}
else {
urlSearchParams.set(key, parameter);
}
}
}
export const setSearchParams = function (url: URL, ...objects: any[]) {
const searchParams = new URLSearchParams(url.search);
setFlattenedQueryParams(searchParams, objects);
url.search = searchParams.toString();
}
/**
* JSON serialization helper function which replaces instances of unserializable types with serializable ones.
* This function will run for every key-value pair encountered by JSON.stringify while traversing an object.
* Converting a set to a string will return an empty object, so an intermediate conversion to an array is required.
*/
// @ts-ignore
export const replaceWithSerializableTypeIfNeeded = function(key: string, value: any) {
if (value instanceof Set) {
return Array.from(value);
} else {
return value;
}
}
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
const nonString = typeof value !== 'string';
const needsSerialization = nonString && configuration && configuration.isJsonMime
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
: nonString;
return needsSerialization
? JSON.stringify(value !== undefined ? value : {}, replaceWithSerializableTypeIfNeeded)
: (value || "");
}
export const toPathString = function (url: URL) {
return url.pathname + url.search + url.hash
}
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url};
return axios.request<T, R>(axiosRequestArgs);
};
}
+121
View File
@@ -0,0 +1,121 @@
/* tslint:disable */
/**
* OpenAPI definition
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: v0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
interface AWSv4Configuration {
options?: {
region?: string
service?: string
}
credentials?: {
accessKeyId?: string
secretAccessKey?: string,
sessionToken?: string
}
}
export interface ConfigurationParameters {
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
username?: string;
password?: string;
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
awsv4?: AWSv4Configuration;
basePath?: string;
serverIndex?: number;
baseOptions?: any;
formDataCtor?: new () => any;
}
export class Configuration {
/**
* parameter for apiKey security
* @param name security name
*/
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
/**
* parameter for basic security
*/
username?: string;
/**
* parameter for basic security
*/
password?: string;
/**
* parameter for oauth2 security
* @param name security name
* @param scopes oauth2 scope
*/
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
/**
* parameter for aws4 signature security
* @param {Object} AWS4Signature - AWS4 Signature security
* @param {string} options.region - aws region
* @param {string} options.service - name of the service.
* @param {string} credentials.accessKeyId - aws access key id
* @param {string} credentials.secretAccessKey - aws access key
* @param {string} credentials.sessionToken - aws session token
* @memberof Configuration
*/
awsv4?: AWSv4Configuration;
/**
* override base path
*/
basePath?: string;
/**
* override server index
*/
serverIndex?: number;
/**
* base options for axios calls
*/
baseOptions?: any;
/**
* The FormData constructor that will be used to create multipart form data
* requests. You can inject this here so that execution environments that
* do not support the FormData class can still run the generated client.
*
* @type {new () => FormData}
*/
formDataCtor?: new () => any;
constructor(param: ConfigurationParameters = {}) {
this.apiKey = param.apiKey;
this.username = param.username;
this.password = param.password;
this.accessToken = param.accessToken;
this.awsv4 = param.awsv4;
this.basePath = param.basePath;
this.serverIndex = param.serverIndex;
this.baseOptions = {
...param.baseOptions,
headers: {
...param.baseOptions?.headers,
},
};
this.formDataCtor = param.formDataCtor;
}
/**
* Check if the given MIME is a JSON MIME.
* JSON MIME examples:
* application/json
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
* @param mime - MIME (Multipurpose Internet Mail Extensions)
* @return True if the given MIME is JSON, false otherwise.
*/
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = /^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$/i;
return mime !== null && jsonMime.test(mime);
}
}
+18
View File
@@ -0,0 +1,18 @@
/* tslint:disable */
/* eslint-disable */
/**
* OpenAPI definition
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: v0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
export * from "./api";
export * from "./configuration";
+73
View File
@@ -0,0 +1,73 @@
<script setup lang="ts">
import {ref} from "vue";
import {COMBINING_LEDGER, Ledger, LedgerType, MAIN_LEDGER, useLedgersStore} from "./ledger";
import {Modal} from "@/components";
import LedgerLine from "@/ledger/LedgerLine.vue";
const modalOpen = ref<boolean>(false);
const type = ref<LedgerType>(MAIN_LEDGER);
const name = ref("");
const members = ref<Ledger[]>([]);
const {ledgers, createMain, createCombining} = useLedgersStore();
const open = () => modalOpen.value = true;
const create = () => {
if (type.value === MAIN_LEDGER) {
createMain({ name: name.value })
} else {
createCombining({ name: name.value, memberLedgerIds: members.value.map(l => l.ledgerId) })
}
modalOpen.value = false;
}
defineExpose({ open });
</script>
<template>
<Modal v-model:open="modalOpen">
<div class="bg-slate-800 rounded pb-4">
<span class="m-2">Creating {{ type === MAIN_LEDGER ? 'Main' : 'Combining' }} Ledger</span>
<hr />
<div class="mt-4">
<div class="flex justify-center">
<div class="flex bg-slate-600 rounded-s-md p-1">
<button class="switch" :class="{active: type === MAIN_LEDGER}" @click="type = MAIN_LEDGER">Main</button>
</div>
<div class="switch flex bg-slate-600 rounded-e-md p-1">
<button class="switch" :class="{active: type === COMBINING_LEDGER}" @click="type = COMBINING_LEDGER">Combining</button>
</div>
</div>
<div class="m-4">
Name:
<input type="text" v-model="name" />
</div>
</div>
<div v-if="type === COMBINING_LEDGER" class="mb-4">
Member Ledgers:
<div v-for="ledger in members">
<LedgerLine ledger="ledger" />
</div>
<select>
<option v-for="ledger in ledgers">{{ ledger.name}}</option>
</select>
</div>
<div class="flex justify-end">
<button class="me-4" @click="create">Create</button>
</div>
</div>
</Modal>
</template>
<style scoped>
@reference "tailwindcss";
button.switch {
@apply flex items-center px-4 rounded-md bg-slate-600;
&.active {
@apply bg-emerald-500;
}
}
</style>
+19
View File
@@ -0,0 +1,19 @@
<script setup lang="ts">
import {COMBINING_LEDGER, Ledger} from "@/ledger/ledger.ts";
import {FolderOpenIcon} from '@heroicons/vue/24/outline';
interface Props {
ledger: Ledger;
}
const props = defineProps<Props>();
</script>
<template>
<div class="flex">
<FolderOpenIcon v-if="ledger.type === COMBINING_LEDGER" class="w-6" />
<div v-else class="w-6"/>
<span>{{ ledger.name }}</span>
</div>
</template>
+4
View File
@@ -0,0 +1,4 @@
export * from './ledger';
export {default as LedgerLine} from './LedgerLine.vue';
export {default as CreateLedgerModal} from './CreateLedgerModal.vue';
+34
View File
@@ -0,0 +1,34 @@
import {CreateCombiningLedgerCommand, CreateMainLedgerCommand, FindAll200ResponseInner} from "@/generated/mammon";
import {defineStore} from "pinia";
import {ref} from "vue";
import {ledgerControllerApi} from "@/mammon";
export const MAIN_LEDGER = "MAIN";
export const COMBINING_LEDGER = "COMBINING";
export type LedgerType = typeof MAIN_LEDGER | typeof COMBINING_LEDGER;
export type Ledger = FindAll200ResponseInner;
export const useLedgersStore = defineStore('ledgers', () => {
const ledgers = ref<Ledger[]>([]);
const createMain = (ledger: CreateMainLedgerCommand) => ledgerControllerApi.createMainLedger(ledger).then(response => {
const ledger = response.data;
ledgers.value.push(ledger);
return ledger;
});
const createCombining = (ledger: CreateCombiningLedgerCommand) => ledgerControllerApi.createCombiningLedger(ledger).then(response => {
const ledger = response.data;
ledgers.value.push(ledger);
return ledger;
});
const refresh = () => ledgerControllerApi.findAll().then(response => ledgers.value = response.data);
refresh();
return {ledgers, createMain, createCombining, refresh};
})
+1
View File
@@ -0,0 +1 @@
export * from './mammonService'
+5 -2
View File
@@ -1,7 +1,8 @@
import { logResource } from "@/service";
import {logResource} from "@/service";
import axios from "axios";
import {LegerControllerApi} from "@/generated/mammon";
export const mammonAxiosInstance = axios.create({
const mammonAxiosInstance = axios.create({
baseURL: import.meta.env.VITE_MAMMON_URL,
headers: {
'Accept': 'application/json',
@@ -9,3 +10,5 @@ export const mammonAxiosInstance = axios.create({
},
})
logResource(mammonAxiosInstance)
export const ledgerControllerApi = new LegerControllerApi(undefined, import.meta.env.VITE_MAMMON_URL, mammonAxiosInstance);
+5 -6
View File
@@ -1,10 +1,9 @@
<script setup lang="ts">
import { Modal } from '@/components';
import { formatIsk } from '@/formaters';
import { MarketType, MarketTypeLabel } from '@/market';
import { ref } from 'vue';
import { useAcquiredTypesStore } from './acquisition';
import {Modal} from '@/components';
import {formatIsk} from '@/formaters';
import {MarketType, MarketTypeLabel} from '@/market';
import {ref} from 'vue';
import {useAcquiredTypesStore} from './acquisition';
const acquiredTypesStore = useAcquiredTypesStore();
+17
View File
@@ -0,0 +1,17 @@
<script setup lang="ts">
import {RouterView} from 'vue-router';
import {CreateLedgerModal} from "@/ledger";
import {ref} from "vue";
const createLedgerModal = ref<typeof CreateLedgerModal>();
</script>
<template>
<div class="mt-4">
<div class="mb-4 border-b-1 flex justify-end">
<button class="mb-2" @click="createLedgerModal?.open()">New Ledger</button>
</div>
<CreateLedgerModal ref="createLedgerModal" />
<RouterView />
</div>
</template>
-23
View File
@@ -1,23 +0,0 @@
<script setup lang="ts">
import { RouterLink, RouterView } from 'vue-router';
</script>
<template>
<div class="mt-4">
<div class="flex border-b-2 border-emerald-500">
</div>
<RouterView />
</div>
</template>
<style scoped>
@reference "tailwindcss";
a.tab {
@apply flex items-center px-4 me-2 rounded-t-md bg-slate-600 hover:bg-slate-700;
&.router-link-active {
@apply bg-emerald-500 hover:bg-emerald-700;
}
}
</style>
+13
View File
@@ -0,0 +1,13 @@
<script setup lang="ts">
import {LedgerLine, useLedgersStore} from "@/ledger";
const {ledgers} = useLedgersStore();
</script>
<template>
<div class="mt-4">
<LedgerLine v-for="leger in ledgers" :ledger="leger"/>
</div>
</template>
+18 -14
View File
@@ -1,20 +1,24 @@
import { RouteRecordRaw } from 'vue-router';
import {RouteRecordRaw} from 'vue-router';
export const routes: RouteRecordRaw[] = [
{ path: '/', name: 'home', component: () => import('@/pages/Index.vue') },
{ path: '/callback', name: 'callback', component: () => import('@/pages/Index.vue') },
{ path: '/ledger', component: () => import('@/pages/Ledgers.vue') },
{ path: '/market', component: () => import('@/pages/Market.vue'), children: [
{ path: '', redirect: '/market/types' },
{ path: 'types/:type?', name: 'market-types', component: () => import('@/pages/market/TypeInfo.vue') },
{ path: 'tracking', component: () => import('@/pages/market/Tracking.vue') },
{ path: 'acquisitions', component: () => import('@/pages/market/Acquisitions.vue') },
] },
{path: '/', name: 'home', component: () => import('@/pages/Index.vue')},
{path: '/callback', name: 'callback', component: () => import('@/pages/Index.vue')},
{ path: '/reprocess', component: () => import('@/pages/Reprocess.vue') },
{path: '/ledgers', component: () => import('@/pages/Ledger.vue'), children: [
{path: '', component: () => import('./pages/ledger/ListLedgers.vue')},
]},
{ path: '/tools', component: () => import('@/pages/Tools.vue') },
{path: '/market', component: () => import('@/pages/Market.vue'), children: [
{path: '', redirect: '/market/types'},
{path: 'types/:type?', name: 'market-types', component: () => import('@/pages/market/TypeInfo.vue')},
{path: 'tracking', component: () => import('@/pages/market/Tracking.vue')},
{path: 'acquisitions', component: () => import('@/pages/market/Acquisitions.vue')},
]},
{ path: '/characters', component: () => import('@/pages/Characters.vue') },
{ path: '/about', name: 'about', component: () => import('@/pages/About.vue') },
{path: '/reprocess', component: () => import('@/pages/Reprocess.vue')},
{path: '/tools', component: () => import('@/pages/Tools.vue')},
{path: '/characters', component: () => import('@/pages/Characters.vue')},
{path: '/about', name: 'about', component: () => import('@/pages/About.vue')},
];
+51 -47
View File
@@ -1,12 +1,12 @@
<script setup lang="ts">
import { Dropdown } from '@/components';
import { RouterLink } from 'vue-router';
import {Dropdown} from '@/components';
import {RouterLink} from 'vue-router';
const links = [
{ name: "Ledger", path: "/legers" },
{ name: "Market", path: "/market" },
{ name: "Reprocess", path: "/reprocess" },
{ name: "Tools", path: "/tools" }
{name: "Ledger", path: "/ledgers"},
{name: "Market", path: "/market"},
{name: "Reprocess", path: "/reprocess"},
{name: "Tools", path: "/tools"}
];
@@ -15,35 +15,35 @@ const logout = async () => {
</script>
<template>
<aside class="fixed top-0 left-0 w-64 h-screen transition-transform -translate-x-full sm:translate-x-0">
<div class="h-full px-3 py-4 overflow-y-auto bg-slate-700 flex flex-col">
<div class="mb-2 border-b-2 border-emerald-500">
<Dropdown class="mb-2 user-dropdown">
<template #button>
<span>NAME</span>
</template>
<ul>
<li>
<RouterLink class="sidebar-button py-0.5 px-2" to="/characters">Characters</RouterLink>
</li>
<li>
<RouterLink class="sidebar-button py-0.5 px-2" :to="{name: 'about'}">About EVE Online</RouterLink>
</li>
<li>
<a class="sidebar-button py-0.5 px-2 text-amber-700" @click="logout">Logout</a>
</li>
</ul>
</Dropdown>
</div>
<ul class="space-y-2 font-medium">
<li v-for="link in links" :key="link.name">
<RouterLink :to="link.path" class="sidebar-button p-2">
<span>{{ link.name }}</span>
</RouterLink>
</li>
</ul>
</div>
</aside>
<aside class="fixed top-0 left-0 w-64 h-screen transition-transform -translate-x-full sm:translate-x-0">
<div class="h-full px-3 py-4 overflow-y-auto bg-slate-700 flex flex-col">
<div class="mb-2 border-b-2 border-emerald-500">
<Dropdown class="mb-2 user-dropdown">
<template #button>
<span>NAME</span>
</template>
<ul>
<li>
<RouterLink class="sidebar-button py-0.5 px-2" to="/characters">Characters</RouterLink>
</li>
<li>
<RouterLink class="sidebar-button py-0.5 px-2" :to="{name: 'about'}">About EVE Online</RouterLink>
</li>
<li>
<a class="sidebar-button py-0.5 px-2 text-amber-700" @click="logout">Logout</a>
</li>
</ul>
</Dropdown>
</div>
<ul class="space-y-2 font-medium">
<li v-for="link in links" :key="link.name">
<RouterLink :to="link.path" class="sidebar-button p-2">
<span>{{ link.name }}</span>
</RouterLink>
</li>
</ul>
</div>
</aside>
</template>
<style scoped>
@@ -54,22 +54,26 @@ const logout = async () => {
}
.router-link-active {
@apply bg-emerald-500 hover:bg-emerald-700;
@apply bg-emerald-500 hover:bg-emerald-700;
}
.user-dropdown {
@apply w-full;
:deep(>div) {
@apply w-full;
:deep(>div) {
@apply w-full;
>div {
@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;
> div {
@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;
}
}
</style>
+2 -2
View File
@@ -3,7 +3,7 @@
@custom-variant search-cancel (&::-webkit-search-cancel-button);
@layer base {
span, table, input, th, tr, td, button, div, hr {
span, table, input, th, tr, td, button, a.button, div, hr {
@apply border-slate-600 text-slate-100 placeholder-slate-400;
}
@@ -11,7 +11,7 @@
@apply bg-slate-800;
}
button {
button, a.button {
@apply py-0.5 px-2 border rounded bg-slate-600 hover:bg-slate-700;
}
input {