diff --git a/src/client/index.ts b/src/client/index.ts index 3dd9453..7fe5743 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -23,9 +23,9 @@ export type { BarcodeTemplateUpdateRequest } from './models/BarcodeTemplateUpdat export type { BarcodeTemplateUpdateResponse } from './models/BarcodeTemplateUpdateResponse'; export type { BaseEnumListSchema } from './models/BaseEnumListSchema'; export type { BaseEnumSchema } from './models/BaseEnumSchema'; -export type { BaseExpenseTagSchema } from './models/BaseExpenseTagSchema'; export type { BaseMarketplaceSchema } from './models/BaseMarketplaceSchema'; export type { BaseShippingWarehouseSchema } from './models/BaseShippingWarehouseSchema'; +export type { BaseTransactionTagSchema } from './models/BaseTransactionTagSchema'; export type { BillPaymentStatus } from './models/BillPaymentStatus'; export type { BillStatusUpdateRequest } from './models/BillStatusUpdateRequest'; export type { Body_upload_passport_image } from './models/Body_upload_passport_image'; @@ -50,7 +50,6 @@ export type { CreateBoxInDealSchema } from './models/CreateBoxInDealSchema'; export type { CreateBoxInPalletSchema } from './models/CreateBoxInPalletSchema'; export type { CreateDealBillRequest } from './models/CreateDealBillRequest'; export type { CreateDealBillResponse } from './models/CreateDealBillResponse'; -export type { CreateExpenseTagRequest } from './models/CreateExpenseTagRequest'; export type { CreateMarketplaceRequest } from './models/CreateMarketplaceRequest'; export type { CreateMarketplaceResponse } from './models/CreateMarketplaceResponse'; export type { CreatePalletResponse } from './models/CreatePalletResponse'; @@ -69,6 +68,7 @@ export type { CreateShippingProductSchema } from './models/CreateShippingProduct export type { CreateShippingWarehouseRequest } from './models/CreateShippingWarehouseRequest'; export type { CreateShippingWarehouseResponse } from './models/CreateShippingWarehouseResponse'; export type { CreateTaskResponse } from './models/CreateTaskResponse'; +export type { CreateTransactionTagRequest } from './models/CreateTransactionTagRequest'; export type { CreateUserRequest } from './models/CreateUserRequest'; export type { CreateUserResponse } from './models/CreateUserResponse'; export type { DealAddKitRequest } from './models/DealAddKitRequest'; @@ -139,8 +139,6 @@ export type { DealUpdateServiceQuantityResponse } from './models/DealUpdateServi export type { DealUpdateServiceRequest } from './models/DealUpdateServiceRequest'; export type { DealUpdateServiceResponse } from './models/DealUpdateServiceResponse'; export type { DeleteBoxResponse } from './models/DeleteBoxResponse'; -export type { DeleteExpenseResponse } from './models/DeleteExpenseResponse'; -export type { DeleteExpenseTagResponse } from './models/DeleteExpenseTagResponse'; export type { DeleteMarketplaceRequest } from './models/DeleteMarketplaceRequest'; export type { DeleteMarketplaceResponse } from './models/DeleteMarketplaceResponse'; export type { DeletePalletResponse } from './models/DeletePalletResponse'; @@ -156,8 +154,8 @@ export type { DeleteShiftResponse } from './models/DeleteShiftResponse'; export type { DeleteShippingProductResponse } from './models/DeleteShippingProductResponse'; export type { DeleteShippingWarehouseRequest } from './models/DeleteShippingWarehouseRequest'; export type { DeleteShippingWarehouseResponse } from './models/DeleteShippingWarehouseResponse'; -export type { ExpenseSchemaBase } from './models/ExpenseSchemaBase'; -export type { ExpenseTagSchema } from './models/ExpenseTagSchema'; +export type { DeleteTransactionResponse } from './models/DeleteTransactionResponse'; +export type { DeleteTransactionTagResponse } from './models/DeleteTransactionTagResponse'; export type { FinishPauseByShiftIdResponse } from './models/FinishPauseByShiftIdResponse'; export type { FinishPauseByUserIdResponse } from './models/FinishPauseByUserIdResponse'; export type { FinishShiftByIdResponse } from './models/FinishShiftByIdResponse'; @@ -166,8 +164,6 @@ export type { GetAllBarcodeTemplateAttributesResponse } from './models/GetAllBar export type { GetAllBarcodeTemplateSizesResponse } from './models/GetAllBarcodeTemplateSizesResponse'; export type { GetAllBarcodeTemplatesResponse } from './models/GetAllBarcodeTemplatesResponse'; export type { GetAllBaseMarketplacesResponse } from './models/GetAllBaseMarketplacesResponse'; -export type { GetAllExpensesResponse } from './models/GetAllExpensesResponse'; -export type { GetAllExpenseTagsResponse } from './models/GetAllExpenseTagsResponse'; export type { GetAllPayRatesResponse } from './models/GetAllPayRatesResponse'; export type { GetAllPayrollSchemeResponse } from './models/GetAllPayrollSchemeResponse'; export type { GetAllPositionsResponse } from './models/GetAllPositionsResponse'; @@ -175,6 +171,9 @@ export type { GetAllPriceCategoriesResponse } from './models/GetAllPriceCategori export type { GetAllRolesResponse } from './models/GetAllRolesResponse'; export type { GetAllServicesKitsResponse } from './models/GetAllServicesKitsResponse'; export type { GetAllShippingWarehousesResponse } from './models/GetAllShippingWarehousesResponse'; +export type { GetAllTransactionsRequest } from './models/GetAllTransactionsRequest'; +export type { GetAllTransactionsResponse } from './models/GetAllTransactionsResponse'; +export type { GetAllTransactionTagsResponse } from './models/GetAllTransactionTagsResponse'; export type { GetAllUsersResponse } from './models/GetAllUsersResponse'; export type { GetBarcodeTemplateByIdRequest } from './models/GetBarcodeTemplateByIdRequest'; export type { GetBarcodeTemplateByIdResponse } from './models/GetBarcodeTemplateByIdResponse'; @@ -196,6 +195,7 @@ export type { GetProfitTableDataResponse } from './models/GetProfitTableDataResp export type { GetServiceKitSchema } from './models/GetServiceKitSchema'; export type { GetTimeTrackingRecordsRequest } from './models/GetTimeTrackingRecordsRequest'; export type { GetTimeTrackingRecordsResponse } from './models/GetTimeTrackingRecordsResponse'; +export type { GetTransactionTagsResponse } from './models/GetTransactionTagsResponse'; export type { GetWorkShiftsResponse } from './models/GetWorkShiftsResponse'; export type { GroupBillRequestSchema } from './models/GroupBillRequestSchema'; export type { HTTPValidationError } from './models/HTTPValidationError'; @@ -266,14 +266,11 @@ export type { SynchronizeMarketplaceRequest } from './models/SynchronizeMarketpl export type { TaskInfoResponse } from './models/TaskInfoResponse'; export type { TimeTrackingData } from './models/TimeTrackingData'; export type { TimeTrackingRecord } from './models/TimeTrackingRecord'; +export type { TransactionSchemaBase } from './models/TransactionSchemaBase'; +export type { TransactionTagSchema } from './models/TransactionTagSchema'; export type { UpdateBoxRequest } from './models/UpdateBoxRequest'; export type { UpdateBoxResponse } from './models/UpdateBoxResponse'; export type { UpdateBoxSchema } from './models/UpdateBoxSchema'; -export type { UpdateExpenseRequest } from './models/UpdateExpenseRequest'; -export type { UpdateExpenseResponse } from './models/UpdateExpenseResponse'; -export type { UpdateExpenseSchema } from './models/UpdateExpenseSchema'; -export type { UpdateExpenseTagRequest } from './models/UpdateExpenseTagRequest'; -export type { UpdateExpenseTagResponse } from './models/UpdateExpenseTagResponse'; export type { UpdateMarketplaceRequest } from './models/UpdateMarketplaceRequest'; export type { UpdateMarketplaceResponse } from './models/UpdateMarketplaceResponse'; export type { UpdatePayRateRequest } from './models/UpdatePayRateRequest'; @@ -290,6 +287,11 @@ export type { UpdateShippingWarehouseRequest } from './models/UpdateShippingWare export type { UpdateShippingWarehouseResponse } from './models/UpdateShippingWarehouseResponse'; export type { UpdateTimeTrackingRecordRequest } from './models/UpdateTimeTrackingRecordRequest'; export type { UpdateTimeTrackingRecordResponse } from './models/UpdateTimeTrackingRecordResponse'; +export type { UpdateTransactionRequest } from './models/UpdateTransactionRequest'; +export type { UpdateTransactionResponse } from './models/UpdateTransactionResponse'; +export type { UpdateTransactionSchema } from './models/UpdateTransactionSchema'; +export type { UpdateTransactionTagRequest } from './models/UpdateTransactionTagRequest'; +export type { UpdateTransactionTagResponse } from './models/UpdateTransactionTagResponse'; export type { UpdateUserRequest } from './models/UpdateUserRequest'; export type { UpdateUserResponse } from './models/UpdateUserResponse'; export type { UploadPassportImageResponse } from './models/UploadPassportImageResponse'; @@ -305,7 +307,6 @@ export { BarcodeService } from './services/BarcodeService'; export { BillingService } from './services/BillingService'; export { ClientService } from './services/ClientService'; export { DealService } from './services/DealService'; -export { ExpenseService } from './services/ExpenseService'; export { MarketplaceService } from './services/MarketplaceService'; export { PayrollService } from './services/PayrollService'; export { PositionService } from './services/PositionService'; @@ -317,5 +318,6 @@ export { ShippingWarehouseService } from './services/ShippingWarehouseService'; export { StatisticsService } from './services/StatisticsService'; export { TaskService } from './services/TaskService'; export { TimeTrackingService } from './services/TimeTrackingService'; +export { TransactionService } from './services/TransactionService'; export { UserService } from './services/UserService'; export { WorkShiftsService } from './services/WorkShiftsService'; diff --git a/src/client/models/BaseExpenseTagSchema.ts b/src/client/models/BaseTransactionTagSchema.ts similarity index 70% rename from src/client/models/BaseExpenseTagSchema.ts rename to src/client/models/BaseTransactionTagSchema.ts index 74d9b3a..46c8ea3 100644 --- a/src/client/models/BaseExpenseTagSchema.ts +++ b/src/client/models/BaseTransactionTagSchema.ts @@ -2,7 +2,8 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -export type BaseExpenseTagSchema = { +export type BaseTransactionTagSchema = { name: string; + isIncome: boolean; }; diff --git a/src/client/models/CreateTransactionTagRequest.ts b/src/client/models/CreateTransactionTagRequest.ts new file mode 100644 index 0000000..cfa2317 --- /dev/null +++ b/src/client/models/CreateTransactionTagRequest.ts @@ -0,0 +1,9 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { BaseTransactionTagSchema } from './BaseTransactionTagSchema'; +export type CreateTransactionTagRequest = { + tag: BaseTransactionTagSchema; +}; + diff --git a/src/client/models/UpdateExpenseResponse.ts b/src/client/models/DeleteTransactionResponse.ts similarity index 80% rename from src/client/models/UpdateExpenseResponse.ts rename to src/client/models/DeleteTransactionResponse.ts index 04bb1e5..2e197ba 100644 --- a/src/client/models/UpdateExpenseResponse.ts +++ b/src/client/models/DeleteTransactionResponse.ts @@ -2,7 +2,7 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -export type UpdateExpenseResponse = { +export type DeleteTransactionResponse = { ok: boolean; message: string; }; diff --git a/src/client/models/DeleteExpenseResponse.ts b/src/client/models/DeleteTransactionTagResponse.ts similarity index 79% rename from src/client/models/DeleteExpenseResponse.ts rename to src/client/models/DeleteTransactionTagResponse.ts index 5dae836..d3621ed 100644 --- a/src/client/models/DeleteExpenseResponse.ts +++ b/src/client/models/DeleteTransactionTagResponse.ts @@ -2,7 +2,7 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -export type DeleteExpenseResponse = { +export type DeleteTransactionTagResponse = { ok: boolean; message: string; }; diff --git a/src/client/models/GetAllExpenseTagsResponse.ts b/src/client/models/GetAllExpenseTagsResponse.ts deleted file mode 100644 index c4b657c..0000000 --- a/src/client/models/GetAllExpenseTagsResponse.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* generated using openapi-typescript-codegen -- do not edit */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ExpenseTagSchema } from './ExpenseTagSchema'; -export type GetAllExpenseTagsResponse = { - tags: Array; -}; - diff --git a/src/client/models/GetAllTransactionTagsResponse.ts b/src/client/models/GetAllTransactionTagsResponse.ts new file mode 100644 index 0000000..0919494 --- /dev/null +++ b/src/client/models/GetAllTransactionTagsResponse.ts @@ -0,0 +1,9 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { TransactionTagSchema } from './TransactionTagSchema'; +export type GetAllTransactionTagsResponse = { + tags: Array; +}; + diff --git a/src/client/models/GetAllTransactionsRequest.ts b/src/client/models/GetAllTransactionsRequest.ts new file mode 100644 index 0000000..cf88699 --- /dev/null +++ b/src/client/models/GetAllTransactionsRequest.ts @@ -0,0 +1,8 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type GetAllTransactionsRequest = { + isIncome: boolean; +}; + diff --git a/src/client/models/GetAllExpensesResponse.ts b/src/client/models/GetAllTransactionsResponse.ts similarity index 60% rename from src/client/models/GetAllExpensesResponse.ts rename to src/client/models/GetAllTransactionsResponse.ts index 11ef82a..0dbcff0 100644 --- a/src/client/models/GetAllExpensesResponse.ts +++ b/src/client/models/GetAllTransactionsResponse.ts @@ -2,10 +2,10 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { ExpenseSchemaBase } from './ExpenseSchemaBase'; import type { PaginationInfoSchema } from './PaginationInfoSchema'; -export type GetAllExpensesResponse = { - expenses: Array; +import type { TransactionSchemaBase } from './TransactionSchemaBase'; +export type GetAllTransactionsResponse = { + transactions: Array; paginationInfo: PaginationInfoSchema; }; diff --git a/src/client/models/GetProfitChartDataRequest.ts b/src/client/models/GetProfitChartDataRequest.ts index 00e3bd1..928008a 100644 --- a/src/client/models/GetProfitChartDataRequest.ts +++ b/src/client/models/GetProfitChartDataRequest.ts @@ -8,6 +8,7 @@ export type GetProfitChartDataRequest = { baseMarketplaceKey: string; dealStatusId: number; managerId: number; - tagId: number; + expenseTagId: number; + incomeTagId: number; }; diff --git a/src/client/models/GetProfitTableDataRequest.ts b/src/client/models/GetProfitTableDataRequest.ts index 9c141ff..1a7c874 100644 --- a/src/client/models/GetProfitTableDataRequest.ts +++ b/src/client/models/GetProfitTableDataRequest.ts @@ -9,7 +9,8 @@ export type GetProfitTableDataRequest = { baseMarketplaceKey: string; dealStatusId: number; managerId: number; - tagId: number; + expenseTagId: number; + incomeTagId: number; groupTableBy: ProfitTableGroupBy; }; diff --git a/src/client/models/GetTransactionTagsResponse.ts b/src/client/models/GetTransactionTagsResponse.ts new file mode 100644 index 0000000..1181b21 --- /dev/null +++ b/src/client/models/GetTransactionTagsResponse.ts @@ -0,0 +1,9 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { TransactionTagSchema } from './TransactionTagSchema'; +export type GetTransactionTagsResponse = { + tags: Array; +}; + diff --git a/src/client/models/ExpenseSchemaBase.ts b/src/client/models/TransactionSchemaBase.ts similarity index 65% rename from src/client/models/ExpenseSchemaBase.ts rename to src/client/models/TransactionSchemaBase.ts index 7cebe98..e1c91f0 100644 --- a/src/client/models/ExpenseSchemaBase.ts +++ b/src/client/models/TransactionSchemaBase.ts @@ -2,15 +2,16 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { ExpenseTagSchema } from './ExpenseTagSchema'; +import type { TransactionTagSchema } from './TransactionTagSchema'; import type { UserSchema } from './UserSchema'; -export type ExpenseSchemaBase = { +export type TransactionSchemaBase = { id: number; name: string; comment: string; amount: number; createdByUser: UserSchema; spentDate: string; - tags: Array; + isIncome: boolean; + tags: Array; }; diff --git a/src/client/models/ExpenseTagSchema.ts b/src/client/models/TransactionTagSchema.ts similarity index 74% rename from src/client/models/ExpenseTagSchema.ts rename to src/client/models/TransactionTagSchema.ts index 276e9cf..9969cd6 100644 --- a/src/client/models/ExpenseTagSchema.ts +++ b/src/client/models/TransactionTagSchema.ts @@ -2,8 +2,9 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -export type ExpenseTagSchema = { +export type TransactionTagSchema = { name: string; + isIncome: boolean; id: number; }; diff --git a/src/client/models/UpdateExpenseRequest.ts b/src/client/models/UpdateExpenseRequest.ts deleted file mode 100644 index 5dd430f..0000000 --- a/src/client/models/UpdateExpenseRequest.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* generated using openapi-typescript-codegen -- do not edit */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { UpdateExpenseSchema } from './UpdateExpenseSchema'; -export type UpdateExpenseRequest = { - expense: UpdateExpenseSchema; -}; - diff --git a/src/client/models/UpdateExpenseTagRequest.ts b/src/client/models/UpdateExpenseTagRequest.ts deleted file mode 100644 index a114632..0000000 --- a/src/client/models/UpdateExpenseTagRequest.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* generated using openapi-typescript-codegen -- do not edit */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ExpenseTagSchema } from './ExpenseTagSchema'; -export type UpdateExpenseTagRequest = { - tag: ExpenseTagSchema; -}; - diff --git a/src/client/models/UpdateTransactionRequest.ts b/src/client/models/UpdateTransactionRequest.ts new file mode 100644 index 0000000..a4c4b24 --- /dev/null +++ b/src/client/models/UpdateTransactionRequest.ts @@ -0,0 +1,9 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { UpdateTransactionSchema } from './UpdateTransactionSchema'; +export type UpdateTransactionRequest = { + transaction: UpdateTransactionSchema; +}; + diff --git a/src/client/models/UpdateExpenseTagResponse.ts b/src/client/models/UpdateTransactionResponse.ts similarity index 80% rename from src/client/models/UpdateExpenseTagResponse.ts rename to src/client/models/UpdateTransactionResponse.ts index 4b7f023..9368524 100644 --- a/src/client/models/UpdateExpenseTagResponse.ts +++ b/src/client/models/UpdateTransactionResponse.ts @@ -2,7 +2,7 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -export type UpdateExpenseTagResponse = { +export type UpdateTransactionResponse = { ok: boolean; message: string; }; diff --git a/src/client/models/UpdateExpenseSchema.ts b/src/client/models/UpdateTransactionSchema.ts similarity index 81% rename from src/client/models/UpdateExpenseSchema.ts rename to src/client/models/UpdateTransactionSchema.ts index bf3defc..f71d8df 100644 --- a/src/client/models/UpdateExpenseSchema.ts +++ b/src/client/models/UpdateTransactionSchema.ts @@ -2,12 +2,13 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -export type UpdateExpenseSchema = { +export type UpdateTransactionSchema = { id?: (number | null); name: string; comment?: (string | null); amount: number; spentDate: string; + isIncome: boolean; tags?: Array; }; diff --git a/src/client/models/CreateExpenseTagRequest.ts b/src/client/models/UpdateTransactionTagRequest.ts similarity index 50% rename from src/client/models/CreateExpenseTagRequest.ts rename to src/client/models/UpdateTransactionTagRequest.ts index 355d6f9..8c2131f 100644 --- a/src/client/models/CreateExpenseTagRequest.ts +++ b/src/client/models/UpdateTransactionTagRequest.ts @@ -2,8 +2,8 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { BaseExpenseTagSchema } from './BaseExpenseTagSchema'; -export type CreateExpenseTagRequest = { - tag: BaseExpenseTagSchema; +import type { TransactionTagSchema } from './TransactionTagSchema'; +export type UpdateTransactionTagRequest = { + tag: TransactionTagSchema; }; diff --git a/src/client/models/DeleteExpenseTagResponse.ts b/src/client/models/UpdateTransactionTagResponse.ts similarity index 79% rename from src/client/models/DeleteExpenseTagResponse.ts rename to src/client/models/UpdateTransactionTagResponse.ts index 2901793..b5cbde4 100644 --- a/src/client/models/DeleteExpenseTagResponse.ts +++ b/src/client/models/UpdateTransactionTagResponse.ts @@ -2,7 +2,7 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -export type DeleteExpenseTagResponse = { +export type UpdateTransactionTagResponse = { ok: boolean; message: string; }; diff --git a/src/client/services/ExpenseService.ts b/src/client/services/ExpenseService.ts deleted file mode 100644 index bb3b085..0000000 --- a/src/client/services/ExpenseService.ts +++ /dev/null @@ -1,155 +0,0 @@ -/* generated using openapi-typescript-codegen -- do not edit */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { CreateExpenseTagRequest } from '../models/CreateExpenseTagRequest'; -import type { DeleteExpenseResponse } from '../models/DeleteExpenseResponse'; -import type { DeleteExpenseTagResponse } from '../models/DeleteExpenseTagResponse'; -import type { GetAllExpensesResponse } from '../models/GetAllExpensesResponse'; -import type { GetAllExpenseTagsResponse } from '../models/GetAllExpenseTagsResponse'; -import type { UpdateExpenseRequest } from '../models/UpdateExpenseRequest'; -import type { UpdateExpenseResponse } from '../models/UpdateExpenseResponse'; -import type { UpdateExpenseTagRequest } from '../models/UpdateExpenseTagRequest'; -import type { UpdateExpenseTagResponse } from '../models/UpdateExpenseTagResponse'; -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; -export class ExpenseService { - /** - * Get All - * @returns GetAllExpensesResponse Successful Response - * @throws ApiError - */ - public static getAllExpenses({ - page, - itemsPerPage, - }: { - page?: (number | null), - itemsPerPage?: (number | null), - }): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/expense/get-all', - query: { - 'page': page, - 'items_per_page': itemsPerPage, - }, - errors: { - 422: `Validation Error`, - }, - }); - } - /** - * Update Expense - * @returns UpdateExpenseResponse Successful Response - * @throws ApiError - */ - public static updateExpense({ - requestBody, - }: { - requestBody: UpdateExpenseRequest, - }): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/expense/update', - body: requestBody, - mediaType: 'application/json', - errors: { - 422: `Validation Error`, - }, - }); - } - /** - * Delete Expense - * @returns DeleteExpenseResponse Successful Response - * @throws ApiError - */ - public static deleteExpense({ - expenseId, - }: { - expenseId: number, - }): CancelablePromise { - return __request(OpenAPI, { - method: 'DELETE', - url: '/expense/delete/{expense_id}', - path: { - 'expense_id': expenseId, - }, - errors: { - 422: `Validation Error`, - }, - }); - } - /** - * Get All - * @returns GetAllExpenseTagsResponse Successful Response - * @throws ApiError - */ - public static getAllExpenseTags(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/expense/get-all-tags', - }); - } - /** - * Update Expense - * @returns UpdateExpenseTagResponse Successful Response - * @throws ApiError - */ - public static createExpenseTag({ - requestBody, - }: { - requestBody: CreateExpenseTagRequest, - }): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/expense/create-tag', - body: requestBody, - mediaType: 'application/json', - errors: { - 422: `Validation Error`, - }, - }); - } - /** - * Update Expense - * @returns UpdateExpenseTagResponse Successful Response - * @throws ApiError - */ - public static updateExpenseTag({ - requestBody, - }: { - requestBody: UpdateExpenseTagRequest, - }): CancelablePromise { - return __request(OpenAPI, { - method: 'POST', - url: '/expense/update-tag', - body: requestBody, - mediaType: 'application/json', - errors: { - 422: `Validation Error`, - }, - }); - } - /** - * Update Expense - * @returns DeleteExpenseTagResponse Successful Response - * @throws ApiError - */ - public static deleteExpenseTag({ - tagId, - }: { - tagId: number, - }): CancelablePromise { - return __request(OpenAPI, { - method: 'DELETE', - url: '/expense/delete-tag/{tag_id}', - path: { - 'tag_id': tagId, - }, - errors: { - 422: `Validation Error`, - }, - }); - } -} diff --git a/src/client/services/ShippingService.ts b/src/client/services/ShippingService.ts index d79994b..d85149d 100644 --- a/src/client/services/ShippingService.ts +++ b/src/client/services/ShippingService.ts @@ -139,7 +139,7 @@ export class ShippingService { }); } /** - * Generate Deal Qr Code + * Generate Deal Qr Code Pdf * @returns any Successful Response * @throws ApiError */ @@ -160,7 +160,7 @@ export class ShippingService { }); } /** - * Generate Deal Qr Code + * Generate Pallets Pdf * @returns any Successful Response * @throws ApiError */ @@ -180,4 +180,25 @@ export class ShippingService { }, }); } + /** + * Generate Boxes Pdf + * @returns any Successful Response + * @throws ApiError + */ + public static getBoxesPdf({ + dealId, + }: { + dealId: number, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/shipping/pdf/boxes/{deal_id}', + path: { + 'deal_id': dealId, + }, + errors: { + 422: `Validation Error`, + }, + }); + } } diff --git a/src/client/services/TransactionService.ts b/src/client/services/TransactionService.ts new file mode 100644 index 0000000..71167d0 --- /dev/null +++ b/src/client/services/TransactionService.ts @@ -0,0 +1,182 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { CreateTransactionTagRequest } from '../models/CreateTransactionTagRequest'; +import type { DeleteTransactionResponse } from '../models/DeleteTransactionResponse'; +import type { DeleteTransactionTagResponse } from '../models/DeleteTransactionTagResponse'; +import type { GetAllTransactionsRequest } from '../models/GetAllTransactionsRequest'; +import type { GetAllTransactionsResponse } from '../models/GetAllTransactionsResponse'; +import type { GetAllTransactionTagsResponse } from '../models/GetAllTransactionTagsResponse'; +import type { GetTransactionTagsResponse } from '../models/GetTransactionTagsResponse'; +import type { UpdateTransactionRequest } from '../models/UpdateTransactionRequest'; +import type { UpdateTransactionResponse } from '../models/UpdateTransactionResponse'; +import type { UpdateTransactionTagRequest } from '../models/UpdateTransactionTagRequest'; +import type { UpdateTransactionTagResponse } from '../models/UpdateTransactionTagResponse'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; +export class TransactionService { + /** + * Get All + * @returns GetAllTransactionsResponse Successful Response + * @throws ApiError + */ + public static getAllTransactions({ + requestBody, + page, + itemsPerPage, + }: { + requestBody: GetAllTransactionsRequest, + page?: (number | null), + itemsPerPage?: (number | null), + }): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/transaction/get-all', + query: { + 'page': page, + 'items_per_page': itemsPerPage, + }, + body: requestBody, + mediaType: 'application/json', + errors: { + 422: `Validation Error`, + }, + }); + } + /** + * Update Transaction + * @returns UpdateTransactionResponse Successful Response + * @throws ApiError + */ + public static updateTransaction({ + requestBody, + }: { + requestBody: UpdateTransactionRequest, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/transaction/update', + body: requestBody, + mediaType: 'application/json', + errors: { + 422: `Validation Error`, + }, + }); + } + /** + * Delete Transaction + * @returns DeleteTransactionResponse Successful Response + * @throws ApiError + */ + public static deleteTransaction({ + transactionId, + }: { + transactionId: number, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/transaction/delete/{transaction_id}', + path: { + 'transaction_id': transactionId, + }, + errors: { + 422: `Validation Error`, + }, + }); + } + /** + * Get All Transaction Tags + * @returns GetAllTransactionTagsResponse Successful Response + * @throws ApiError + */ + public static getAllTransactionTags(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/transaction/get-all-tags', + }); + } + /** + * Get Transaction Tags + * @returns GetTransactionTagsResponse Successful Response + * @throws ApiError + */ + public static getTransactionTags({ + isIncome, + }: { + isIncome: boolean, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/transaction/get-tags/{is_income}', + path: { + 'is_income': isIncome, + }, + errors: { + 422: `Validation Error`, + }, + }); + } + /** + * Create Transaction Tag + * @returns UpdateTransactionTagResponse Successful Response + * @throws ApiError + */ + public static createTransactionTag({ + requestBody, + }: { + requestBody: CreateTransactionTagRequest, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/transaction/create-tag', + body: requestBody, + mediaType: 'application/json', + errors: { + 422: `Validation Error`, + }, + }); + } + /** + * Update Transaction Tag + * @returns UpdateTransactionTagResponse Successful Response + * @throws ApiError + */ + public static updateTransactionTag({ + requestBody, + }: { + requestBody: UpdateTransactionTagRequest, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/transaction/update-tag', + body: requestBody, + mediaType: 'application/json', + errors: { + 422: `Validation Error`, + }, + }); + } + /** + * Update Transaction Tag + * @returns DeleteTransactionTagResponse Successful Response + * @throws ApiError + */ + public static deleteTransactionTag({ + tagId, + }: { + tagId: number, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/transaction/delete-tag/{tag_id}', + path: { + 'tag_id': tagId, + }, + errors: { + 422: `Validation Error`, + }, + }); + } +} diff --git a/src/modals/modals.ts b/src/modals/modals.ts index 3a17a85..01910ad 100644 --- a/src/modals/modals.ts +++ b/src/modals/modals.ts @@ -22,8 +22,8 @@ import ShippingWarehouseForm from "../pages/ShippingWarehousesPage/modals/Shippi import MarketplaceFormModal from "../pages/MarketplacesPage/modals/MarketplaceFormModal/MarketplaceFormModal.tsx"; import ServicePriceCategoryForm from "../pages/ServicesPage/modals/ServicePriceCategoryForm.tsx"; import ScanningModal from "./ScanningModal/ScanningModal.tsx"; -import ExpenseFormModal from "../pages/AdminPage/tabs/Expenses/modals/ExpenseFormModal.tsx"; -import ExpenseTagsModal from "../pages/AdminPage/tabs/Expenses/modals/ExpenseTagsModal.tsx"; +import TransactionFormModal from "../pages/AdminPage/tabs/Transactions/modals/TransactionFormModal.tsx"; +import TransactionTagsModal from "../pages/AdminPage/tabs/Transactions/modals/TransactionTagsModal.tsx"; import ShippingProductModal from "../pages/LeadsPage/tabs/ShippingTab/modals/ShippingProductModal.tsx"; export const modals = { @@ -51,7 +51,7 @@ export const modals = { marketplaceFormModal: MarketplaceFormModal, servicePriceCategoryForm: ServicePriceCategoryForm, scanningModal: ScanningModal, - expenseFormModal: ExpenseFormModal, - expenseTagsModal: ExpenseTagsModal, + transactionFormModal: TransactionFormModal, + transactionTagsModal: TransactionTagsModal, shippingProductModal: ShippingProductModal, }; diff --git a/src/pages/AdminPage/AdminPage.tsx b/src/pages/AdminPage/AdminPage.tsx index 8d1c3f5..e0351fb 100644 --- a/src/pages/AdminPage/AdminPage.tsx +++ b/src/pages/AdminPage/AdminPage.tsx @@ -15,7 +15,7 @@ import { motion } from "framer-motion"; import FinancesTab from "./tabs/Finances/FinancesTab.tsx"; import WorkTimeTable from "./tabs/WorkTimeTable/ui/WorkTimeTable.tsx"; import { WorkShiftsTab } from "./tabs/WorkShifts/WorkShiftsTab.tsx"; -import { ExpensesTab } from "./tabs/Expenses/ExpensesTab.tsx"; +import { TransactionsTab } from "./tabs/Transactions/TransactionsTab.tsx"; import { useSelector } from "react-redux"; import { RootState } from "../../redux/store.ts"; @@ -62,9 +62,9 @@ const AdminPage = () => { {isAdmin && ( }> - Расходы + Доходы и расходы )} @@ -108,12 +108,12 @@ const AdminPage = () => { - + - + diff --git a/src/pages/AdminPage/hooks/useAllTransactionTagsList.tsx b/src/pages/AdminPage/hooks/useAllTransactionTagsList.tsx new file mode 100644 index 0000000..dbbb1e0 --- /dev/null +++ b/src/pages/AdminPage/hooks/useAllTransactionTagsList.tsx @@ -0,0 +1,10 @@ +import ObjectList from "../../../hooks/objectList.tsx"; +import { TransactionService } from "../../../client"; + +const useAllTransactionTagsList = () => + ObjectList({ + queryFn: () => TransactionService.getAllTransactionTags(), + getObjectsFn: response => response.tags, + queryKey: "getAllTransactionTags", + }); +export default useAllTransactionTagsList; \ No newline at end of file diff --git a/src/pages/AdminPage/hooks/useExpenseTagsList.tsx b/src/pages/AdminPage/hooks/useExpenseTagsList.tsx deleted file mode 100644 index 5f4213f..0000000 --- a/src/pages/AdminPage/hooks/useExpenseTagsList.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import ObjectList from "../../../hooks/objectList.tsx"; -import { ExpenseService } from "../../../client"; - -const useExpenseTagsList = () => - ObjectList({ - queryFn: ExpenseService.getAllExpenseTags, - getObjectsFn: response => response.tags, - queryKey: "getAllExpenseTags", - }); -export default useExpenseTagsList; \ No newline at end of file diff --git a/src/pages/AdminPage/hooks/useExpensesList.tsx b/src/pages/AdminPage/hooks/useExpensesList.tsx deleted file mode 100644 index d29e0a0..0000000 --- a/src/pages/AdminPage/hooks/useExpensesList.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { Pagination } from "../../../types/Pagination.ts"; -import { ObjectListWithPagination } from "../../../hooks/objectList.tsx"; -import { ExpenseService } from "../../../client"; - - -export const useExpensesList = (pagination: Pagination) => - ObjectListWithPagination({ - queryFn: () => ExpenseService.getAllExpenses(pagination), - queryKey: "getExpenses", - getObjectsFn: response => response.expenses, - pagination, - }); diff --git a/src/pages/AdminPage/hooks/useTransactionTagsList.tsx b/src/pages/AdminPage/hooks/useTransactionTagsList.tsx new file mode 100644 index 0000000..d31e9ad --- /dev/null +++ b/src/pages/AdminPage/hooks/useTransactionTagsList.tsx @@ -0,0 +1,16 @@ +import ObjectList from "../../../hooks/objectList.tsx"; +import { TransactionService } from "../../../client"; + +type Props = { + isIncome: boolean; +} + +const useTransactionTagsList = ({ isIncome }: Props) => + ObjectList({ + queryFn: () => TransactionService.getTransactionTags( + { isIncome }, + ), + getObjectsFn: response => response.tags, + queryKey: "getTransactionTags", + }); +export default useTransactionTagsList; \ No newline at end of file diff --git a/src/pages/AdminPage/hooks/useTransactionsList.tsx b/src/pages/AdminPage/hooks/useTransactionsList.tsx new file mode 100644 index 0000000..9c91d53 --- /dev/null +++ b/src/pages/AdminPage/hooks/useTransactionsList.tsx @@ -0,0 +1,21 @@ +import { Pagination } from "../../../types/Pagination.ts"; +import { ObjectListWithPagination } from "../../../hooks/objectList.tsx"; +import { TransactionService } from "../../../client"; + +type TransitionType = { + isIncome: boolean +}; +type Props = Pagination & TransitionType; + +export const useTransactionsList = (props: Props) => + ObjectListWithPagination({ + queryFn: () => TransactionService.getAllTransactions({ + requestBody: { + isIncome: props.isIncome, + }, + ...props, + }), + queryKey: "getTransactions", + getObjectsFn: response => response.transactions, + pagination: props, + }); diff --git a/src/pages/AdminPage/tabs/Expenses/components/ExpenseTagsInput.tsx b/src/pages/AdminPage/tabs/Expenses/components/ExpenseTagsInput.tsx deleted file mode 100644 index 684174d..0000000 --- a/src/pages/AdminPage/tabs/Expenses/components/ExpenseTagsInput.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { TagsInput, TagsInputProps } from "@mantine/core"; -import useExpenseTagsList from "../../../hooks/useExpenseTagsList.tsx"; - - -type Props = Omit; - -const ExpenseTagsInput = (props: Props) => { - const { objects } = useExpenseTagsList(); - return ( - object.name)} - {...props} - label={"Теги"} - placeholder={"Выберите теги"} - /> - ); -}; - -export default ExpenseTagsInput; \ No newline at end of file diff --git a/src/pages/AdminPage/tabs/Expenses/ExpensesTab.tsx b/src/pages/AdminPage/tabs/Transactions/TransactionsTab.tsx similarity index 57% rename from src/pages/AdminPage/tabs/Expenses/ExpensesTab.tsx rename to src/pages/AdminPage/tabs/Transactions/TransactionsTab.tsx index 693ec1f..95dddf4 100644 --- a/src/pages/AdminPage/tabs/Expenses/ExpensesTab.tsx +++ b/src/pages/AdminPage/tabs/Transactions/TransactionsTab.tsx @@ -1,39 +1,44 @@ -import { useExpensesList } from "../../hooks/useExpensesList.tsx"; -import { useExpensesTableColumns } from "./hooks/useExpensesTableColumns.tsx"; -import { ExpenseSchemaBase, ExpenseService } from "../../../../client"; +import { useTransactionsList } from "../../hooks/useTransactionsList.tsx"; +import { useTransactionsTableColumns } from "./hooks/useTransactionsTableColumns.tsx"; +import { TransactionSchemaBase, TransactionService } from "../../../../client"; import { dateToString } from "../../../../types/utils.ts"; import { notifications } from "../../../../shared/lib/notifications.ts"; import { modals } from "@mantine/modals"; import { BaseTable } from "../../../../components/BaseTable/BaseTable.tsx"; -import { Pagination, Flex, rem, Button, Tooltip, ActionIcon } from "@mantine/core"; +import { ActionIcon, Button, Flex, Pagination, rem, Tooltip } from "@mantine/core"; import { useEffect, useState } from "react"; import { IconEdit, IconTrash } from "@tabler/icons-react"; import { MRT_TableOptions } from "mantine-react-table"; -import { Expense } from "./types/Expense.tsx"; +import { Transaction } from "./types/Transaction.tsx"; +import { TransactionsSegmentedControl, TransactionType } from "./components/TransactionsSegmentedControl.tsx"; -export const ExpensesTab = () => { +export const TransactionsTab = () => { + const [transactionType, setTransactionType] = useState(TransactionType.EXPENSE); + const isIncome = transactionType === TransactionType.INCOME; + const [totalPages, setTotalPages] = useState(10); const [page, setPage] = useState(1); const { pagination: paginationInfo, - objects: expenses, + objects: transactions, refetch, - } = useExpensesList({ page: page, itemsPerPage: 10 }); - const columns = useExpensesTableColumns(); + } = useTransactionsList({ page: page, itemsPerPage: 10, isIncome }); + const columns = useTransactionsTableColumns(); useEffect(() => { - if (!paginationInfo ) return; + if (!paginationInfo) return; if (!paginationInfo.totalPages) setTotalPages(0); else setTotalPages(paginationInfo.totalPages); }, [paginationInfo]); - const onUpdate = (expense: Expense) => { - ExpenseService.updateExpense({ + const onUpdate = (transaction: Transaction) => { + TransactionService.updateTransaction({ requestBody: { - expense: { - ...expense, - spentDate: dateToString(new Date(expense.spentDate)) ?? "", + transaction: { + ...transaction, + spentDate: dateToString(new Date(transaction.spentDate)) ?? "", + isIncome, }, }, }) @@ -44,33 +49,37 @@ export const ExpensesTab = () => { .catch(err => console.log(err)); }; + const modalTitleSuffix = isIncome ? "доходах" : "расходах"; + const onCreateClick = () => { modals.openContextModal({ - modal: "expenseFormModal", - title: "Создание записи о расходах", + modal: "transactionFormModal", + title: `Создание записи о ${modalTitleSuffix}`, withCloseButton: false, innerProps: { onCreate: onUpdate, + isIncome, }, }); }; - const onEditClick = (expense: ExpenseSchemaBase) => { - const expenseToEdit = { ...expense, tags: expense.tags.map(tag => tag.name) }; + const onEditClick = (transaction: TransactionSchemaBase) => { + const expenseToEdit = { ...transaction, tags: transaction.tags.map(tag => tag.name) }; modals.openContextModal({ - modal: "expenseFormModal", - title: "Редактирование записи о расходах", + modal: "transactionFormModal", + title: `Редактирование записи о ${modalTitleSuffix}`, withCloseButton: false, innerProps: { - onChange: event => onUpdate(event), + onChange: onUpdate, element: expenseToEdit, + isIncome, }, }); }; - const onDeleteClick = (expense: ExpenseSchemaBase) => { - ExpenseService.deleteExpense({ - expenseId: expense.id, + const onDeleteClick = (transaction: TransactionSchemaBase) => { + TransactionService.deleteTransaction({ + transactionId: transaction.id, }) .then(async ({ ok, message }) => { notifications.guess(ok, { message }); @@ -81,24 +90,48 @@ export const ExpensesTab = () => { const onTagChange = async () => { await refetch(); - } + }; const onTagsEditClick = () => { modals.openContextModal({ - modal: "expenseTagsModal", + modal: "transactionTagsModal", title: "Редактирование тегов", withCloseButton: false, - innerProps: { onChange: onTagChange }, + innerProps: { + onChange: onTagChange, + isIncome, + }, }); - } + }; + + const getCreateTransactionLabel = (): string => { + if (transactionType === TransactionType.EXPENSE) { + return "Создать запись о расходах"; + } + return "Создать запись о доходах"; + }; + + const getEditTagLabel = (): string => { + if (transactionType === TransactionType.EXPENSE) { + return "Редактировать теги для расходов"; + } + return "Редактировать теги для доходов"; + }; return ( + gap={0}> + { + setPage(1); + setTransactionType(parseInt(event)); + }} + /> { ), @@ -138,7 +171,7 @@ export const ExpensesTab = () => { ), - } as MRT_TableOptions + } as MRT_TableOptions } /> {totalPages > 1 && ( diff --git a/src/pages/AdminPage/tabs/Expenses/components/CreateExpenseTagForm.tsx b/src/pages/AdminPage/tabs/Transactions/components/CreateTransactionTagForm.tsx similarity index 52% rename from src/pages/AdminPage/tabs/Expenses/components/CreateExpenseTagForm.tsx rename to src/pages/AdminPage/tabs/Transactions/components/CreateTransactionTagForm.tsx index 9331cf6..334864e 100644 --- a/src/pages/AdminPage/tabs/Expenses/components/CreateExpenseTagForm.tsx +++ b/src/pages/AdminPage/tabs/Transactions/components/CreateTransactionTagForm.tsx @@ -1,31 +1,35 @@ -import { BaseExpenseTagSchema } from "../../../../../client"; +import { BaseTransactionTagSchema } from "../../../../../client"; import { Button, Stack, TextInput } from "@mantine/core"; import { useState } from "react"; import { notifications } from "../../../../../shared/lib/notifications.ts"; type Props = { - onCreate: (tag: BaseExpenseTagSchema) => void; + onCreate: (tag: BaseTransactionTagSchema) => void; + isIncome: boolean; } -const CreateExpenseTagForm = ({ onCreate }: Props) => { - const [expenseTag, setExpenseTag] = useState(""); +const CreateTransactionTagForm = ({ onCreate, isIncome }: Props) => { + const [transactionTag, setTransactionTag] = useState(""); const onCreateClick = () => { - if (expenseTag.length === 0) { + if (transactionTag.length === 0) { notifications.error({ message: "Нельзя добавить тег без названия" }); return; } - onCreate({ name: expenseTag }); - setExpenseTag(""); + onCreate({ + name: transactionTag, + isIncome: isIncome, + }); + setTransactionTag(""); }; return ( setExpenseTag(event.target.value)} + value={transactionTag} + onChange={event => setTransactionTag(event.target.value)} />