rename combining ledger to combined
This commit is contained in:
+42
-42
@@ -23,20 +23,20 @@ import type { RequestArgs } from './base';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError, operationServerMap } from './base';
|
import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError, operationServerMap } from './base';
|
||||||
|
|
||||||
export interface CombiningLedgerResponse extends LedgerResponse {
|
export interface CombinedLedgerResponse extends LedgerResponse {
|
||||||
'ledgerId': string;
|
'ledgerId': string;
|
||||||
'name': string;
|
'name': string;
|
||||||
'memberLedgerIds': Array<string>;
|
'memberLedgerIds': Array<string>;
|
||||||
'type'?: CombiningLedgerResponseTypeEnum;
|
'type'?: CombinedLedgerResponseTypeEnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const CombiningLedgerResponseTypeEnum = {
|
export const CombinedLedgerResponseTypeEnum = {
|
||||||
Combining: 'COMBINING',
|
Combined: 'COMBINED',
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export type CombiningLedgerResponseTypeEnum = typeof CombiningLedgerResponseTypeEnum[keyof typeof CombiningLedgerResponseTypeEnum];
|
export type CombinedLedgerResponseTypeEnum = typeof CombinedLedgerResponseTypeEnum[keyof typeof CombinedLedgerResponseTypeEnum];
|
||||||
|
|
||||||
export interface CreateCombiningLedgerRequest {
|
export interface CreateCombinedLedgerRequest {
|
||||||
'name': string;
|
'name': string;
|
||||||
'memberLedgerIds': Array<string>;
|
'memberLedgerIds': Array<string>;
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,7 @@ export interface CreateMainLedgerRequest {
|
|||||||
/**
|
/**
|
||||||
* @type FindAll200ResponseInner
|
* @type FindAll200ResponseInner
|
||||||
*/
|
*/
|
||||||
export type FindAll200ResponseInner = CombiningLedgerResponse | MainLedgerResponse;
|
export type FindAll200ResponseInner = CombinedLedgerResponse | MainLedgerResponse;
|
||||||
|
|
||||||
export interface LedgerResponse {
|
export interface LedgerResponse {
|
||||||
'type'?: LedgerResponseTypeEnum;
|
'type'?: LedgerResponseTypeEnum;
|
||||||
@@ -54,7 +54,7 @@ export interface LedgerResponse {
|
|||||||
|
|
||||||
export const LedgerResponseTypeEnum = {
|
export const LedgerResponseTypeEnum = {
|
||||||
Main: 'MAIN',
|
Main: 'MAIN',
|
||||||
Combining: 'COMBINING',
|
Combined: 'COMBINED',
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export type LedgerResponseTypeEnum = typeof LedgerResponseTypeEnum[keyof typeof LedgerResponseTypeEnum];
|
export type LedgerResponseTypeEnum = typeof LedgerResponseTypeEnum[keyof typeof LedgerResponseTypeEnum];
|
||||||
@@ -71,7 +71,7 @@ export const MainLedgerResponseTypeEnum = {
|
|||||||
|
|
||||||
export type MainLedgerResponseTypeEnum = typeof MainLedgerResponseTypeEnum[keyof typeof MainLedgerResponseTypeEnum];
|
export type MainLedgerResponseTypeEnum = typeof MainLedgerResponseTypeEnum[keyof typeof MainLedgerResponseTypeEnum];
|
||||||
|
|
||||||
export interface UpdateCombiningLedgerRequest {
|
export interface UpdateCombinedLedgerRequest {
|
||||||
'name': string;
|
'name': string;
|
||||||
'memberLedgerIds': Array<string>;
|
'memberLedgerIds': Array<string>;
|
||||||
}
|
}
|
||||||
@@ -86,14 +86,14 @@ export const LedgerControllerApiAxiosParamCreator = function (configuration?: Co
|
|||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {CreateCombiningLedgerRequest} createCombiningLedgerRequest
|
* @param {CreateCombinedLedgerRequest} createCombinedLedgerRequest
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
createCombiningLedger: async (createCombiningLedgerRequest: CreateCombiningLedgerRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
createCombinedLedger: async (createCombinedLedgerRequest: CreateCombinedLedgerRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||||
// verify required parameter 'createCombiningLedgerRequest' is not null or undefined
|
// verify required parameter 'createCombinedLedgerRequest' is not null or undefined
|
||||||
assertParamExists('createCombiningLedger', 'createCombiningLedgerRequest', createCombiningLedgerRequest)
|
assertParamExists('createCombinedLedger', 'createCombinedLedgerRequest', createCombinedLedgerRequest)
|
||||||
const localVarPath = `/ledgers/combining`;
|
const localVarPath = `/ledgers/combined`;
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
let baseOptions;
|
let baseOptions;
|
||||||
@@ -111,7 +111,7 @@ export const LedgerControllerApiAxiosParamCreator = function (configuration?: Co
|
|||||||
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
localVarRequestOptions.data = serializeDataIfNeeded(createCombiningLedgerRequest, localVarRequestOptions, configuration)
|
localVarRequestOptions.data = serializeDataIfNeeded(createCombinedLedgerRequest, localVarRequestOptions, configuration)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: toPathString(localVarUrlObj),
|
url: toPathString(localVarUrlObj),
|
||||||
@@ -217,16 +217,16 @@ export const LedgerControllerApiAxiosParamCreator = function (configuration?: Co
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {string} ledgerId
|
* @param {string} ledgerId
|
||||||
* @param {UpdateCombiningLedgerRequest} updateCombiningLedgerRequest
|
* @param {UpdateCombinedLedgerRequest} updateCombinedLedgerRequest
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
updateCombiningLedger: async (ledgerId: string, updateCombiningLedgerRequest: UpdateCombiningLedgerRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
updateCombinedLedger: async (ledgerId: string, updateCombinedLedgerRequest: UpdateCombinedLedgerRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||||
// verify required parameter 'ledgerId' is not null or undefined
|
// verify required parameter 'ledgerId' is not null or undefined
|
||||||
assertParamExists('updateCombiningLedger', 'ledgerId', ledgerId)
|
assertParamExists('updateCombinedLedger', 'ledgerId', ledgerId)
|
||||||
// verify required parameter 'updateCombiningLedgerRequest' is not null or undefined
|
// verify required parameter 'updateCombinedLedgerRequest' is not null or undefined
|
||||||
assertParamExists('updateCombiningLedger', 'updateCombiningLedgerRequest', updateCombiningLedgerRequest)
|
assertParamExists('updateCombinedLedger', 'updateCombinedLedgerRequest', updateCombinedLedgerRequest)
|
||||||
const localVarPath = `/ledgers/combining/{ledgerId}`
|
const localVarPath = `/ledgers/combined/{ledgerId}`
|
||||||
.replace('{ledgerId}', encodeURIComponent(String(ledgerId)));
|
.replace('{ledgerId}', encodeURIComponent(String(ledgerId)));
|
||||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||||
@@ -245,7 +245,7 @@ export const LedgerControllerApiAxiosParamCreator = function (configuration?: Co
|
|||||||
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
||||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
localVarRequestOptions.data = serializeDataIfNeeded(updateCombiningLedgerRequest, localVarRequestOptions, configuration)
|
localVarRequestOptions.data = serializeDataIfNeeded(updateCombinedLedgerRequest, localVarRequestOptions, configuration)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url: toPathString(localVarUrlObj),
|
url: toPathString(localVarUrlObj),
|
||||||
@@ -301,14 +301,14 @@ export const LedgerControllerApiFp = function(configuration?: Configuration) {
|
|||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {CreateCombiningLedgerRequest} createCombiningLedgerRequest
|
* @param {CreateCombinedLedgerRequest} createCombinedLedgerRequest
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async createCombiningLedger(createCombiningLedgerRequest: CreateCombiningLedgerRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CombiningLedgerResponse>> {
|
async createCombinedLedger(createCombinedLedgerRequest: CreateCombinedLedgerRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CombinedLedgerResponse>> {
|
||||||
const localVarAxiosArgs = await localVarAxiosParamCreator.createCombiningLedger(createCombiningLedgerRequest, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.createCombinedLedger(createCombinedLedgerRequest, options);
|
||||||
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
||||||
const localVarOperationServerBasePath = operationServerMap['LedgerControllerApi.createCombiningLedger']?.[localVarOperationServerIndex]?.url;
|
const localVarOperationServerBasePath = operationServerMap['LedgerControllerApi.createCombinedLedger']?.[localVarOperationServerIndex]?.url;
|
||||||
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@@ -349,14 +349,14 @@ export const LedgerControllerApiFp = function(configuration?: Configuration) {
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {string} ledgerId
|
* @param {string} ledgerId
|
||||||
* @param {UpdateCombiningLedgerRequest} updateCombiningLedgerRequest
|
* @param {UpdateCombinedLedgerRequest} updateCombinedLedgerRequest
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
async updateCombiningLedger(ledgerId: string, updateCombiningLedgerRequest: UpdateCombiningLedgerRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CombiningLedgerResponse>> {
|
async updateCombinedLedger(ledgerId: string, updateCombinedLedgerRequest: UpdateCombinedLedgerRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CombinedLedgerResponse>> {
|
||||||
const localVarAxiosArgs = await localVarAxiosParamCreator.updateCombiningLedger(ledgerId, updateCombiningLedgerRequest, options);
|
const localVarAxiosArgs = await localVarAxiosParamCreator.updateCombinedLedger(ledgerId, updateCombinedLedgerRequest, options);
|
||||||
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
||||||
const localVarOperationServerBasePath = operationServerMap['LedgerControllerApi.updateCombiningLedger']?.[localVarOperationServerIndex]?.url;
|
const localVarOperationServerBasePath = operationServerMap['LedgerControllerApi.updateCombinedLedger']?.[localVarOperationServerIndex]?.url;
|
||||||
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@@ -383,12 +383,12 @@ export const LedgerControllerApiFactory = function (configuration?: Configuratio
|
|||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {CreateCombiningLedgerRequest} createCombiningLedgerRequest
|
* @param {CreateCombinedLedgerRequest} createCombinedLedgerRequest
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
createCombiningLedger(createCombiningLedgerRequest: CreateCombiningLedgerRequest, options?: RawAxiosRequestConfig): AxiosPromise<CombiningLedgerResponse> {
|
createCombinedLedger(createCombinedLedgerRequest: CreateCombinedLedgerRequest, options?: RawAxiosRequestConfig): AxiosPromise<CombinedLedgerResponse> {
|
||||||
return localVarFp.createCombiningLedger(createCombiningLedgerRequest, options).then((request) => request(axios, basePath));
|
return localVarFp.createCombinedLedger(createCombinedLedgerRequest, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -419,12 +419,12 @@ export const LedgerControllerApiFactory = function (configuration?: Configuratio
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {string} ledgerId
|
* @param {string} ledgerId
|
||||||
* @param {UpdateCombiningLedgerRequest} updateCombiningLedgerRequest
|
* @param {UpdateCombinedLedgerRequest} updateCombinedLedgerRequest
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
updateCombiningLedger(ledgerId: string, updateCombiningLedgerRequest: UpdateCombiningLedgerRequest, options?: RawAxiosRequestConfig): AxiosPromise<CombiningLedgerResponse> {
|
updateCombinedLedger(ledgerId: string, updateCombinedLedgerRequest: UpdateCombinedLedgerRequest, options?: RawAxiosRequestConfig): AxiosPromise<CombinedLedgerResponse> {
|
||||||
return localVarFp.updateCombiningLedger(ledgerId, updateCombiningLedgerRequest, options).then((request) => request(axios, basePath));
|
return localVarFp.updateCombinedLedger(ledgerId, updateCombinedLedgerRequest, options).then((request) => request(axios, basePath));
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -445,12 +445,12 @@ export const LedgerControllerApiFactory = function (configuration?: Configuratio
|
|||||||
export class LedgerControllerApi extends BaseAPI {
|
export class LedgerControllerApi extends BaseAPI {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {CreateCombiningLedgerRequest} createCombiningLedgerRequest
|
* @param {CreateCombinedLedgerRequest} createCombinedLedgerRequest
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
public createCombiningLedger(createCombiningLedgerRequest: CreateCombiningLedgerRequest, options?: RawAxiosRequestConfig) {
|
public createCombinedLedger(createCombinedLedgerRequest: CreateCombinedLedgerRequest, options?: RawAxiosRequestConfig) {
|
||||||
return LedgerControllerApiFp(this.configuration).createCombiningLedger(createCombiningLedgerRequest, options).then((request) => request(this.axios, this.basePath));
|
return LedgerControllerApiFp(this.configuration).createCombinedLedger(createCombinedLedgerRequest, options).then((request) => request(this.axios, this.basePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -485,12 +485,12 @@ export class LedgerControllerApi extends BaseAPI {
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {string} ledgerId
|
* @param {string} ledgerId
|
||||||
* @param {UpdateCombiningLedgerRequest} updateCombiningLedgerRequest
|
* @param {UpdateCombinedLedgerRequest} updateCombinedLedgerRequest
|
||||||
* @param {*} [options] Override http request option.
|
* @param {*} [options] Override http request option.
|
||||||
* @throws {RequiredError}
|
* @throws {RequiredError}
|
||||||
*/
|
*/
|
||||||
public updateCombiningLedger(ledgerId: string, updateCombiningLedgerRequest: UpdateCombiningLedgerRequest, options?: RawAxiosRequestConfig) {
|
public updateCombinedLedger(ledgerId: string, updateCombinedLedgerRequest: UpdateCombinedLedgerRequest, options?: RawAxiosRequestConfig) {
|
||||||
return LedgerControllerApiFp(this.configuration).updateCombiningLedger(ledgerId, updateCombiningLedgerRequest, options).then((request) => request(this.axios, this.basePath));
|
return LedgerControllerApiFp(this.configuration).updateCombinedLedger(ledgerId, updateCombinedLedgerRequest, options).then((request) => request(this.axios, this.basePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import {computed, ref} from "vue";
|
import {computed, ref} from "vue";
|
||||||
import {storeToRefs} from "pinia";
|
import {storeToRefs} from "pinia";
|
||||||
import {isCombining, Ledger, LedgerType, LedgerTypes, useLedgersStore} from "./ledger";
|
import {isCombined, Ledger, LedgerType, LedgerTypes, useLedgersStore} from "./ledger";
|
||||||
import {Modal} from "@/components";
|
import {Modal} from "@/components";
|
||||||
import LedgerLabel from "./LedgerLabel.vue";
|
import LedgerLabel from "./LedgerLabel.vue";
|
||||||
import {PlusIcon, TrashIcon} from '@heroicons/vue/24/outline';
|
import {PlusIcon, TrashIcon} from '@heroicons/vue/24/outline';
|
||||||
@@ -15,7 +15,7 @@ const props = defineProps<Props>();
|
|||||||
|
|
||||||
const ledgersStore = useLedgersStore();
|
const ledgersStore = useLedgersStore();
|
||||||
const {ledgers} = storeToRefs(ledgersStore);
|
const {ledgers} = storeToRefs(ledgersStore);
|
||||||
const {findById, findAllById, createMain, createCombining, updateMain, updateCombining} = ledgersStore;
|
const {findById, findAllById, createMain, createCombined, updateMain, updateCombined} = ledgersStore;
|
||||||
|
|
||||||
const modalOpen = ref<boolean>(false);
|
const modalOpen = ref<boolean>(false);
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ const open = () => {
|
|||||||
if (ledger) {
|
if (ledger) {
|
||||||
type.value = ledger.type;
|
type.value = ledger.type;
|
||||||
name.value = ledger.name;
|
name.value = ledger.name;
|
||||||
members.value = isCombining(ledger) ? findAllById(ledger.memberLedgerIds) : [];
|
members.value = isCombined(ledger) ? findAllById(ledger.memberLedgerIds) : [];
|
||||||
} else {
|
} else {
|
||||||
type.value = LedgerTypes.Main;
|
type.value = LedgerTypes.Main;
|
||||||
name.value = "";
|
name.value = "";
|
||||||
@@ -52,7 +52,7 @@ const canSave = computed(() => name.value.trim().length > 0);
|
|||||||
const isCreating = computed(() => props.ledgerId)
|
const isCreating = computed(() => props.ledgerId)
|
||||||
const title = computed(() => {
|
const title = computed(() => {
|
||||||
if (isCreating.value) {
|
if (isCreating.value) {
|
||||||
return `Creating ${type.value === LedgerTypes.Main ? 'Main' : 'Combining'} Ledger`
|
return `Creating ${type.value === LedgerTypes.Main ? 'Main' : 'Combined'} Ledger`
|
||||||
}
|
}
|
||||||
return `Updating ${name.value}`
|
return `Updating ${name.value}`
|
||||||
})
|
})
|
||||||
@@ -61,7 +61,7 @@ const create = () => {
|
|||||||
if (type.value === LedgerTypes.Main) {
|
if (type.value === LedgerTypes.Main) {
|
||||||
createMain({name: name.value})
|
createMain({name: name.value})
|
||||||
} else {
|
} else {
|
||||||
createCombining({name: name.value, memberLedgerIds: members.value.map(l => l.ledgerId)})
|
createCombined({name: name.value, memberLedgerIds: members.value.map(l => l.ledgerId)})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ const update = () => {
|
|||||||
if (type.value === LedgerTypes.Main) {
|
if (type.value === LedgerTypes.Main) {
|
||||||
updateMain(props.ledgerId, {name: name.value})
|
updateMain(props.ledgerId, {name: name.value})
|
||||||
} else {
|
} else {
|
||||||
updateCombining(props.ledgerId, {name: name.value, memberLedgerIds: members.value.map(l => l.ledgerId)})
|
updateCombined(props.ledgerId, {name: name.value, memberLedgerIds: members.value.map(l => l.ledgerId)})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ defineExpose({ open });
|
|||||||
<button class="switch" :class="{active: type === LedgerTypes.Main}" @click="type = LedgerTypes.Main">Main</button>
|
<button class="switch" :class="{active: type === LedgerTypes.Main}" @click="type = LedgerTypes.Main">Main</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="switch flex bg-slate-600 rounded-e-md p-1">
|
<div class="switch flex bg-slate-600 rounded-e-md p-1">
|
||||||
<button class="switch" :class="{active: type === LedgerTypes.Combining}" @click="type = LedgerTypes.Combining">Combining</button>
|
<button class="switch" :class="{active: type === LedgerTypes.Combined}" @click="type = LedgerTypes.Combined">Combined</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="m-4">
|
<div class="m-4">
|
||||||
@@ -110,7 +110,7 @@ defineExpose({ open });
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="type === LedgerTypes.Combining" class="ms-4 mb-4">
|
<div v-if="type === LedgerTypes.Combined" class="ms-4 mb-4">
|
||||||
Member Ledgers:
|
Member Ledgers:
|
||||||
<div v-for="ledger in members" :key="ledger.ledgerId" class="flex">
|
<div v-for="ledger in members" :key="ledger.ledgerId" class="flex">
|
||||||
<LedgerLabel class="flex grow mb-2" :ledger="ledger" />
|
<LedgerLabel class="flex grow mb-2" :ledger="ledger" />
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|
||||||
import {isCombining, Ledger} from "@/ledger/ledger.ts";
|
import {isCombined, Ledger} from "@/ledger/ledger.ts";
|
||||||
import {FolderOpenIcon} from '@heroicons/vue/24/outline';
|
import {FolderOpenIcon} from '@heroicons/vue/24/outline';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -12,7 +12,7 @@ const props = defineProps<Props>();
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<FolderOpenIcon v-if="isCombining(ledger)" class="w-4 me-1" />
|
<FolderOpenIcon v-if="isCombined(ledger)" class="w-4 me-1" />
|
||||||
<div v-else class="w-4 me-1"/>
|
<div v-else class="w-4 me-1"/>
|
||||||
<span>{{ ledger.name }}</span>
|
<span>{{ ledger.name }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+11
-11
@@ -1,12 +1,12 @@
|
|||||||
import {
|
import {
|
||||||
CombiningLedgerResponse,
|
CombinedLedgerResponse,
|
||||||
CombiningLedgerResponseTypeEnum,
|
CombinedLedgerResponseTypeEnum,
|
||||||
CreateCombiningLedgerRequest,
|
CreateCombinedLedgerRequest,
|
||||||
CreateMainLedgerRequest,
|
CreateMainLedgerRequest,
|
||||||
LedgerResponseTypeEnum,
|
LedgerResponseTypeEnum,
|
||||||
MainLedgerResponse,
|
MainLedgerResponse,
|
||||||
MainLedgerResponseTypeEnum,
|
MainLedgerResponseTypeEnum,
|
||||||
UpdateCombiningLedgerRequest,
|
UpdateCombinedLedgerRequest,
|
||||||
UpdateMainLedgerRequest
|
UpdateMainLedgerRequest
|
||||||
} from "@/generated/mammon";
|
} from "@/generated/mammon";
|
||||||
import {defineStore} from "pinia";
|
import {defineStore} from "pinia";
|
||||||
@@ -17,14 +17,14 @@ export const LedgerTypes = LedgerResponseTypeEnum;
|
|||||||
|
|
||||||
export type LedgerType = LedgerResponseTypeEnum;
|
export type LedgerType = LedgerResponseTypeEnum;
|
||||||
export type MainLedger = MainLedgerResponse & {type: MainLedgerResponseTypeEnum}
|
export type MainLedger = MainLedgerResponse & {type: MainLedgerResponseTypeEnum}
|
||||||
export type CombiningLedger = CombiningLedgerResponse & {type: CombiningLedgerResponseTypeEnum}
|
export type CombinedLedger = CombinedLedgerResponse & {type: CombinedLedgerResponseTypeEnum}
|
||||||
export type Ledger = MainLedger | CombiningLedger;
|
export type Ledger = MainLedger | CombinedLedger;
|
||||||
|
|
||||||
export const isMain = (ledger: Ledger): ledger is MainLedger => {
|
export const isMain = (ledger: Ledger): ledger is MainLedger => {
|
||||||
return ledger.type === LedgerTypes.Main;
|
return ledger.type === LedgerTypes.Main;
|
||||||
}
|
}
|
||||||
export const isCombining = (ledger: Ledger): ledger is CombiningLedger => {
|
export const isCombined = (ledger: Ledger): ledger is CombinedLedger => {
|
||||||
return ledger.type === LedgerTypes.Combining;
|
return ledger.type === LedgerTypes.Combined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useLedgersStore = defineStore('ledgers', () => {
|
export const useLedgersStore = defineStore('ledgers', () => {
|
||||||
@@ -50,14 +50,14 @@ export const useLedgersStore = defineStore('ledgers', () => {
|
|||||||
const findAllById = (ledgerIds: string[]): Ledger[] => ledgerIds.map(findById).filter((x): x is Ledger => x !== undefined)
|
const findAllById = (ledgerIds: string[]): Ledger[] => ledgerIds.map(findById).filter((x): x is Ledger => x !== undefined)
|
||||||
|
|
||||||
const createMain = (ledger: CreateMainLedgerRequest) => ledgerControllerApi.createMainLedger(ledger).then(response => addLedger(response.data as Ledger));
|
const createMain = (ledger: CreateMainLedgerRequest) => ledgerControllerApi.createMainLedger(ledger).then(response => addLedger(response.data as Ledger));
|
||||||
const createCombining = (ledger: CreateCombiningLedgerRequest) => ledgerControllerApi.createCombiningLedger(ledger).then(response => addLedger(response.data as Ledger));
|
const createCombined = (ledger: CreateCombinedLedgerRequest) => ledgerControllerApi.createCombinedLedger(ledger).then(response => addLedger(response.data as Ledger));
|
||||||
const updateMain = (ledgerId: string, ledger: UpdateMainLedgerRequest) => ledgerControllerApi.updateMainLedger(ledgerId, ledger).then(response => replaceLedger(response.data as Ledger));
|
const updateMain = (ledgerId: string, ledger: UpdateMainLedgerRequest) => ledgerControllerApi.updateMainLedger(ledgerId, ledger).then(response => replaceLedger(response.data as Ledger));
|
||||||
const updateCombining = (ledgerId: string, ledger: UpdateCombiningLedgerRequest) => ledgerControllerApi.updateCombiningLedger(ledgerId, ledger).then(response => replaceLedger(response.data as Ledger));
|
const updateCombined = (ledgerId: string, ledger: UpdateCombinedLedgerRequest) => ledgerControllerApi.updateCombinedLedger(ledgerId, ledger).then(response => replaceLedger(response.data as Ledger));
|
||||||
|
|
||||||
const refresh = () => ledgerControllerApi.findAll().then(response => ledgers.value = response.data as Ledger[]);
|
const refresh = () => ledgerControllerApi.findAll().then(response => ledgers.value = response.data as Ledger[]);
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
return {ledgers, findById, findAllById, createMain, createCombining, updateMain, updateCombining, refresh};
|
return {ledgers, findById, findAllById, createMain, createCombined, updateMain, updateCombined, refresh};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user