From 8005e7a45b673890f5d8f1908fe173859ae310f0 Mon Sep 17 00:00:00 2001 From: Sirttas Date: Sun, 17 May 2026 19:19:01 +0200 Subject: [PATCH] ledger list and modal --- .gitignore | 2 + src/generated/mammon/api.ts | 270 ++++++++++++++++++++++++++ src/generated/mammon/base.ts | 62 ++++++ src/generated/mammon/common.ts | 127 ++++++++++++ src/generated/mammon/configuration.ts | 121 ++++++++++++ src/generated/mammon/index.ts | 18 ++ src/ledger/CreateLedgerModal.vue | 73 +++++++ src/ledger/LedgerLine.vue | 19 ++ src/ledger/index.ts | 4 + src/ledger/ledger.ts | 34 ++++ src/mammon/index.ts | 1 + src/mammon/mammonService.ts | 9 +- src/market/acquisition/BuyModal.vue | 11 +- src/pages/Ledger.vue | 17 ++ src/pages/Ledgers.vue | 23 --- src/pages/ledger/ListLedgers.vue | 13 ++ src/routes.ts | 32 +-- src/sidebar/Sidebar.vue | 98 +++++----- src/style.css | 4 +- 19 files changed, 843 insertions(+), 95 deletions(-) create mode 100644 src/generated/mammon/api.ts create mode 100644 src/generated/mammon/base.ts create mode 100644 src/generated/mammon/common.ts create mode 100644 src/generated/mammon/configuration.ts create mode 100644 src/generated/mammon/index.ts create mode 100644 src/ledger/CreateLedgerModal.vue create mode 100644 src/ledger/LedgerLine.vue create mode 100644 src/ledger/index.ts create mode 100644 src/ledger/ledger.ts create mode 100644 src/mammon/index.ts create mode 100644 src/pages/Ledger.vue delete mode 100644 src/pages/Ledgers.vue create mode 100644 src/pages/ledger/ListLedgers.vue diff --git a/.gitignore b/.gitignore index 90060fe..ba69567 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,5 @@ docker-compose.yml *.njsproj *.sln *.sw? + +generated/mammon/ \ No newline at end of file diff --git a/src/generated/mammon/api.ts b/src/generated/mammon/api.ts new file mode 100644 index 0000000..81d7dae --- /dev/null +++ b/src/generated/mammon/api.ts @@ -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; +} +export interface CreateCombiningLedgerCommand { + 'name': string; + 'memberLedgerIds': Array; +} +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 => { + // 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 => { + // 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 => { + 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> { + 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> { + 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>> { + 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 { + 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 { + return localVarFp.createMainLedger(createMainLedgerCommand, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findAll(options?: RawAxiosRequestConfig): AxiosPromise> { + 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)); + } +} + + + diff --git a/src/generated/mammon/base.ts b/src/generated/mammon/base.ts new file mode 100644 index 0000000..4185f42 --- /dev/null +++ b/src/generated/mammon/base.ts @@ -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 = { +} diff --git a/src/generated/mammon/common.ts b/src/generated/mammon/common.ts new file mode 100644 index 0000000..fa4e171 --- /dev/null +++ b/src/generated/mammon/common.ts @@ -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 >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); + }; +} diff --git a/src/generated/mammon/configuration.ts b/src/generated/mammon/configuration.ts new file mode 100644 index 0000000..5938949 --- /dev/null +++ b/src/generated/mammon/configuration.ts @@ -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 | ((name: string) => string) | ((name: string) => Promise); + username?: string; + password?: string; + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + 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 | ((name: string) => string) | ((name: string) => Promise); + /** + * 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 | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * 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); + } +} diff --git a/src/generated/mammon/index.ts b/src/generated/mammon/index.ts new file mode 100644 index 0000000..f24c3c1 --- /dev/null +++ b/src/generated/mammon/index.ts @@ -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"; + diff --git a/src/ledger/CreateLedgerModal.vue b/src/ledger/CreateLedgerModal.vue new file mode 100644 index 0000000..7c52a0a --- /dev/null +++ b/src/ledger/CreateLedgerModal.vue @@ -0,0 +1,73 @@ + + + + + \ No newline at end of file diff --git a/src/ledger/LedgerLine.vue b/src/ledger/LedgerLine.vue new file mode 100644 index 0000000..edf40e2 --- /dev/null +++ b/src/ledger/LedgerLine.vue @@ -0,0 +1,19 @@ + + + diff --git a/src/ledger/index.ts b/src/ledger/index.ts new file mode 100644 index 0000000..cf9f933 --- /dev/null +++ b/src/ledger/index.ts @@ -0,0 +1,4 @@ +export * from './ledger'; + +export {default as LedgerLine} from './LedgerLine.vue'; +export {default as CreateLedgerModal} from './CreateLedgerModal.vue'; \ No newline at end of file diff --git a/src/ledger/ledger.ts b/src/ledger/ledger.ts new file mode 100644 index 0000000..2809c8e --- /dev/null +++ b/src/ledger/ledger.ts @@ -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([]); + + 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}; +}) \ No newline at end of file diff --git a/src/mammon/index.ts b/src/mammon/index.ts new file mode 100644 index 0000000..e75c2b3 --- /dev/null +++ b/src/mammon/index.ts @@ -0,0 +1 @@ +export * from './mammonService' \ No newline at end of file diff --git a/src/mammon/mammonService.ts b/src/mammon/mammonService.ts index 4027853..f92e3de 100644 --- a/src/mammon/mammonService.ts +++ b/src/mammon/mammonService.ts @@ -1,11 +1,14 @@ -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', "Content-Type": "application/json", }, }) -logResource(mammonAxiosInstance) \ No newline at end of file +logResource(mammonAxiosInstance) + +export const ledgerControllerApi = new LegerControllerApi(undefined, import.meta.env.VITE_MAMMON_URL, mammonAxiosInstance); diff --git a/src/market/acquisition/BuyModal.vue b/src/market/acquisition/BuyModal.vue index 2f99e78..137da90 100644 --- a/src/market/acquisition/BuyModal.vue +++ b/src/market/acquisition/BuyModal.vue @@ -1,10 +1,9 @@ + + diff --git a/src/pages/Ledgers.vue b/src/pages/Ledgers.vue deleted file mode 100644 index 24c909b..0000000 --- a/src/pages/Ledgers.vue +++ /dev/null @@ -1,23 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/pages/ledger/ListLedgers.vue b/src/pages/ledger/ListLedgers.vue new file mode 100644 index 0000000..fb93fe8 --- /dev/null +++ b/src/pages/ledger/ListLedgers.vue @@ -0,0 +1,13 @@ + + + \ No newline at end of file diff --git a/src/routes.ts b/src/routes.ts index 8377b39..5248b33 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -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')}, ]; \ No newline at end of file diff --git a/src/sidebar/Sidebar.vue b/src/sidebar/Sidebar.vue index 13720e9..5ab93fc 100644 --- a/src/sidebar/Sidebar.vue +++ b/src/sidebar/Sidebar.vue @@ -1,12 +1,12 @@ diff --git a/src/style.css b/src/style.css index a736220..26f943f 100644 --- a/src/style.css +++ b/src/style.css @@ -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 {