From a440f954ad6c295f889c9062d6a6224fab0a3273 Mon Sep 17 00:00:00 2001 From: Luis Felipe Cadavid Date: Mon, 30 Sep 2024 15:19:20 -0500 Subject: [PATCH] feat: add Service api with interface --- next.config.mjs | 24 ++-- package.json | 14 ++- package/config/ApiPath.tsx | 2 + package/config/api/Admin/auth/Login/page.tsx | 14 +-- .../Customer/Customer/GetCustomer/page.tsx | 53 +++++++++ .../Customer/Customer/SaveCustomer/page.tsx | 52 +++++++++ .../api/Customer/TypeDNI/GetTypeDNI/page.tsx | 48 ++++++++ .../api/Customer/TypeDNI/SaveTypeDNI/page.tsx | 44 +++++++ .../TypeValidation/GetTypeValidation/page.tsx | 45 ++++++++ .../SaveTypeValidation/page.tsx | 42 +++++++ .../api/Sale/Transaction/AddProducts/page.tsx | 50 ++++++++ .../api/Sale/Transaction/EndSale/page.tsx | 63 +++++++++++ .../api/Sale/Transaction/GetSale/page.tsx | 44 +++++++ .../api/Sale/Transaction/StartSale/page.tsx | 55 +++++++++ .../Customer/GetCustomerOutputInterface.tsx | 19 ++++ .../Customer/GetTypeDNIOutputInterface.tsx | 13 +++ .../GetTypeValidationOutputInrerface.tsx | 10 ++ .../Customer/SaveCustomerOutputInterface.tsx | 18 +++ .../Customer/SaveTypeDniOutputInterface.tsx | 10 ++ .../SaveTypeValidationOutputInterface.tsx | 8 ++ .../Sale/AddProductsOutputInterfae.tsx | 15 +++ .../Sale/EndSaleOutputInterface.tsx | 30 +++++ .../Sale/GetSaleOutputInterface.tsx | 7 ++ .../Sale/RemoveProductsOutputInterface.tsx | 15 +++ .../Sale/StartSaleOutputInterface.tsx | 17 +++ .../Auth/UserResponseInterface.tsx | 23 ++++ .../Customer/CustomerResponseInterface.tsx | 47 ++++++++ .../Customer/DNITypeResponseInterface.tsx | 27 +++++ .../TypeValidationResponseInterface.tsx | 25 ++++ .../Sale/AddProductsResponseInterface.tsx | 39 +++++++ .../Sale/EndSaleResponseInterface.tsx | 15 +++ .../Sale/GetSaleResponseInterface.tsx | 107 ++++++++++++++++++ .../Sale/RemoveProductsResponseInterface.tsx | 41 +++++++ .../Sale/StartSaleResponseInterface.tsx | 11 ++ tsconfig.json | 3 + 35 files changed, 1027 insertions(+), 23 deletions(-) create mode 100644 package/config/api/Customer/Customer/GetCustomer/page.tsx create mode 100644 package/config/api/Customer/Customer/SaveCustomer/page.tsx create mode 100644 package/config/api/Customer/TypeDNI/GetTypeDNI/page.tsx create mode 100644 package/config/api/Customer/TypeDNI/SaveTypeDNI/page.tsx create mode 100644 package/config/api/Customer/TypeValidation/GetTypeValidation/page.tsx create mode 100644 package/config/api/Customer/TypeValidation/SaveTypeValidation/page.tsx create mode 100644 package/config/api/Sale/Transaction/AddProducts/page.tsx create mode 100644 package/config/api/Sale/Transaction/EndSale/page.tsx create mode 100644 package/config/api/Sale/Transaction/GetSale/page.tsx create mode 100644 package/config/api/Sale/Transaction/StartSale/page.tsx create mode 100644 package/interfaces/OutputInterfaces/Customer/GetCustomerOutputInterface.tsx create mode 100644 package/interfaces/OutputInterfaces/Customer/GetTypeDNIOutputInterface.tsx create mode 100644 package/interfaces/OutputInterfaces/Customer/GetTypeValidationOutputInrerface.tsx create mode 100644 package/interfaces/OutputInterfaces/Customer/SaveCustomerOutputInterface.tsx create mode 100644 package/interfaces/OutputInterfaces/Customer/SaveTypeDniOutputInterface.tsx create mode 100644 package/interfaces/OutputInterfaces/Customer/SaveTypeValidationOutputInterface.tsx create mode 100644 package/interfaces/OutputInterfaces/Sale/AddProductsOutputInterfae.tsx create mode 100644 package/interfaces/OutputInterfaces/Sale/EndSaleOutputInterface.tsx create mode 100644 package/interfaces/OutputInterfaces/Sale/GetSaleOutputInterface.tsx create mode 100644 package/interfaces/OutputInterfaces/Sale/RemoveProductsOutputInterface.tsx create mode 100644 package/interfaces/OutputInterfaces/Sale/StartSaleOutputInterface.tsx create mode 100644 package/interfaces/ResponseInterfaces/Auth/UserResponseInterface.tsx create mode 100644 package/interfaces/ResponseInterfaces/Customer/CustomerResponseInterface.tsx create mode 100644 package/interfaces/ResponseInterfaces/Customer/DNITypeResponseInterface.tsx create mode 100644 package/interfaces/ResponseInterfaces/Customer/TypeValidationResponseInterface.tsx create mode 100644 package/interfaces/ResponseInterfaces/Sale/AddProductsResponseInterface.tsx create mode 100644 package/interfaces/ResponseInterfaces/Sale/EndSaleResponseInterface.tsx create mode 100644 package/interfaces/ResponseInterfaces/Sale/GetSaleResponseInterface.tsx create mode 100644 package/interfaces/ResponseInterfaces/Sale/RemoveProductsResponseInterface.tsx create mode 100644 package/interfaces/ResponseInterfaces/Sale/StartSaleResponseInterface.tsx diff --git a/next.config.mjs b/next.config.mjs index 31adba2..5df3e31 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,11 +1,11 @@ -import withBundleAnalyzer from "@next/bundle-analyzer" -import withPlugins from "next-compose-plugins" -import { env } from "./env.mjs" +import withBundleAnalyzer from "@next/bundle-analyzer"; +import withPlugins from "next-compose-plugins"; +import { env } from "./env.mjs"; /** * @type {import('next').NextConfig} */ -const config = withPlugins([[withBundleAnalyzer({ enabled: env.ANALYZE })]], { +const nextConfig = { reactStrictMode: true, experimental: { instrumentationHook: false }, env: { @@ -14,15 +14,23 @@ const config = withPlugins([[withBundleAnalyzer({ enabled: env.ANALYZE })]], { REACT_APP_API_KEY: process.env.REACT_APP_API_KEY, NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL, }, - rewrites() { return [ { source: "/healthz", destination: "/api/health" }, { source: "/api/healthz", destination: "/api/health" }, { source: "/health", destination: "/api/health" }, { source: "/ping", destination: "/api/health" }, - ] + ]; }, -}) +}; -export default config +export default withPlugins( + [ + [ + withBundleAnalyzer({ + enabled: env.ANALYZE === "true", + }), + ], + ], + nextConfig +); diff --git a/package.json b/package.json index 432a8f9..61bfc3b 100644 --- a/package.json +++ b/package.json @@ -25,10 +25,10 @@ "dependencies": { "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0", - "@mui/icons-material": "^6.1.0", - "@mui/material": "^6.1.0", + "@mui/icons-material": "^6.1.1", + "@mui/material": "^6.1.1", "@mui/system": "^6.1.0", - "@next/bundle-analyzer": "^14.0.3", + "@next/bundle-analyzer": "^14.2.13", "@opentelemetry/exporter-trace-otlp-http": "^0.53.0", "@opentelemetry/exporter-trace-otlp-proto": "^0.53.0", "@radix-ui/react-accordion": "^1.1.2", @@ -59,12 +59,14 @@ "crypto-js": "^4.2.0", "i18next": "^23.15.1", "jaeger-client": "^3.19.0", + "jotai": "^2.10.0", "lodash": "^4.17.21", "next": "^14.0.3", "next-compose-plugins": "^2.2.1", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "react-i18next": "^15.0.1", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "react-i18next": "^15.0.2", + "recharts": "^2.12.7", "tailwind-merge": "^2.0.0", "zod": "^3.22.4" }, diff --git a/package/config/ApiPath.tsx b/package/config/ApiPath.tsx index 16961c4..625593e 100644 --- a/package/config/ApiPath.tsx +++ b/package/config/ApiPath.tsx @@ -1,4 +1,6 @@ export const BASE_URL_AUTHENTICATION = "/AUTHENTICATION-SERVICE/rhi-bpc/" export const BASE_URL_ADMINISTRATION = '/ADMINISTRATION-SERVICE/rhi-bpc/v2/' +export const BASE_URL_CUSTOMER = '/CUSTOMER-SERVICE/rhi-bpc/v2/customer/' export const BASE_URL_CUSTOMER_VALIDATION = '/CUSTOMER-SERVICE/rhi-bpc/v2/customer-type-validation-method/' export const BASE_URL_CUSTOMER_TYPEDNI = '/CUSTOMER-SERVICE/rhi-bpc/v2/type-customer-dni/' +export const BASE_URL_SALE = '/SALE-SERVICE/rhi-bpc/v2/sale/' \ No newline at end of file diff --git a/package/config/api/Admin/auth/Login/page.tsx b/package/config/api/Admin/auth/Login/page.tsx index 4070d9b..f9f139d 100644 --- a/package/config/api/Admin/auth/Login/page.tsx +++ b/package/config/api/Admin/auth/Login/page.tsx @@ -1,3 +1,4 @@ +import { LoginResponse } from '@interfaces/ResponseInterfaces/Auth/UserResponseInterface'; import { GetToken } from '@package/config/api/Admin/auth/GetToken/page'; import { BASE_URL_ADMINISTRATION } from '@package/config/ApiPath'; import { FetchData } from '@package/config/FetchData'; @@ -5,12 +6,7 @@ import { ReturnService } from '@package/config/ReturnService'; import i18n from '@package/utils/language/i18n'; import { deleteKeyApi, deleteUser, encrypt, setKeyApi, setUser } from '@package/utils/Utilities'; -interface LoginResponse { - correct?: boolean; - success: boolean; - message: string; - errorCode?: number; -} + /** * Authenticates a user by their username and password. @@ -26,7 +22,7 @@ async function Login(ae_user: string, ae_password: string): Promise ({ + sku: item.sku ?? '', + value: item.value ?? 0, + })), + }) + } + + let data: AddProductsResponseInterface = await FetchData(BASE_URL_SALE, 'addProducts', options) + + if (data.correct) { + return data.object + } + + return data +} + + +export default AddProducts \ No newline at end of file diff --git a/package/config/api/Sale/Transaction/EndSale/page.tsx b/package/config/api/Sale/Transaction/EndSale/page.tsx new file mode 100644 index 0000000..97e1308 --- /dev/null +++ b/package/config/api/Sale/Transaction/EndSale/page.tsx @@ -0,0 +1,63 @@ +import { EndSaleOutputInterface } from "@interfaces/OutputInterfaces/Sale/EndSaleOutputInterface"; +import { EndSaleResponseInterface } from "@interfaces/ResponseInterfaces/Sale/EndSaleResponseInterface"; +import { BASE_URL_SALE } from "@package/config/ApiPath"; +import { FetchData } from "@package/config/FetchData"; +import { ReturnService } from "@package/config/ReturnService" +import { BASE_URL_LANGUAGE } from "@utils/Constants" +import i18n from "@utils/language/i18n"; +import { getKeyApi } from "@utils/Utilities" + + +async function EndSale(ae_object: EndSaleOutputInterface) { + const token = getKeyApi() + if (token === '') { + return new ReturnService('', false, i18n.t('errorTokenAPI'), 102) + } + + const options: RequestInit = { + method: 'post', + mode: 'cors', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer ' + token, + lng: BASE_URL_LANGUAGE, + }, + body: JSON.stringify({ + idTransaction: ae_object.idTransaction ?? '', + storeNumber: ae_object.storeNumber ?? '', + idSubsidiary: ae_object.idSubsidiary ?? 0, + idUser: ae_object.idUser ?? '', + localDate: ae_object.localDate ?? '', + pos: ae_object.pos ?? '', + comment: ae_object.comment ?? '', + payment: ae_object.payment.map((item) => ({ + type: item.type ?? '', + approvalCode: item.approvalCode ?? '', + receiptNumber: item.receiptNumber ?? '', + value: item.value ?? 0, + cardNumber: item.cardNumber ?? '', + cardType: item.cardType ?? '', + comment: item.comment ?? '', + })), + infoPos: { + addressPos: ae_object.infoPos.addressPos ?? '', + codeMunPos: ae_object.infoPos.codeMunPos ?? '', + nameMunPos: ae_object.infoPos.nameMunPos ?? '', + codeDepPos: ae_object.infoPos.codeDepPos ?? '', + nameDepPos: ae_object.infoPos.nameDepPos ?? '', + pos: ae_object.infoPos.pos ?? '', + }, + }), + }; + + let data : EndSaleResponseInterface = await FetchData(BASE_URL_SALE, 'endSale', options) + + if (data.correct) { + return data.object + } + + return data +} + + +export default EndSale \ No newline at end of file diff --git a/package/config/api/Sale/Transaction/GetSale/page.tsx b/package/config/api/Sale/Transaction/GetSale/page.tsx new file mode 100644 index 0000000..1797e2c --- /dev/null +++ b/package/config/api/Sale/Transaction/GetSale/page.tsx @@ -0,0 +1,44 @@ +import { GetSaleOutputInterface } from "@interfaces/OutputInterfaces/Sale/GetSaleOutputInterface"; +import { GetSaleResponseInterface } from "@interfaces/ResponseInterfaces/Sale/GetSaleResponseInterface"; +import { BASE_URL_SALE } from "@package/config/ApiPath"; +import { FetchData } from "@package/config/FetchData"; +import { ReturnService } from "@package/config/ReturnService" +import { BASE_URL_LANGUAGE } from "@utils/Constants" +import i18n from "@utils/language/i18n"; +import { getKeyApi } from "@utils/Utilities" + +async function GetSale(ae_object: GetSaleOutputInterface) { + const token = getKeyApi() + if (token === '') { + return new ReturnService('', false, i18n.t('errorTokenAPI'), 102) + } + + const options: RequestInit = { + method: 'post', + mode: 'cors', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer ' + token, + lng: BASE_URL_LANGUAGE + }, + body: JSON.stringify({ + idTransaction: ae_object.idTransaction ?? '', + storeNumber: ae_object.storeNumber ?? 0, + idSubsidiary: ae_object.idSubsidiary ?? '', + idUser: ae_object.idUser ?? '', + pos: ae_object.pos ?? '', + + }) + } + + let data: GetSaleResponseInterface = await FetchData(BASE_URL_SALE, 'addProducts', options) + + if (data.correct) { + return data.object + } + + return data +} + + +export default GetSale \ No newline at end of file diff --git a/package/config/api/Sale/Transaction/StartSale/page.tsx b/package/config/api/Sale/Transaction/StartSale/page.tsx new file mode 100644 index 0000000..444b68f --- /dev/null +++ b/package/config/api/Sale/Transaction/StartSale/page.tsx @@ -0,0 +1,55 @@ +import { StartSaleOutputInterface } from "@interfaces/OutputInterfaces/Sale/StartSaleOutputInterface"; +import { StartSaleResponseInterface } from "@interfaces/ResponseInterfaces/Sale/StartSaleResponseInterface"; +import { BASE_URL_SALE } from "@package/config/ApiPath"; +import { FetchData } from "@package/config/FetchData"; +import { ReturnService } from "@package/config/ReturnService" +import { BASE_URL_LANGUAGE } from "@utils/Constants" +import i18n from "@utils/language/i18n"; +import { getKeyApi } from "@utils/Utilities" + + +async function StartSale(ae_object: StartSaleOutputInterface) { + const token = getKeyApi() + if (token === '') { + return new ReturnService('', false, i18n.t('errorTokenAPI'), 102) + } + + const options: RequestInit = { + method: 'post', + mode: 'cors', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer ' + token, + lng: BASE_URL_LANGUAGE + }, + body: JSON.stringify({ + storeNumber: ae_object.storeNumber ?? '', + idSubsidiary: ae_object.idSubsidiary ?? 0, + idClient: ae_object.idClient ?? '', + clientDni: ae_object.clientDni ?? '', + idType: ae_object.idType ?? '', + idGroup: ae_object.idGroup ?? '', + invoiceName: ae_object.invoiceName ?? '', + invoiceTypeNit: ae_object.invoiceTypeNit ?? '', + invoiceNit: ae_object.invoiceNit ?? '', + invoiceDirection: ae_object.invoiceDirection ?? '', + invoiceCellPhone: ae_object.invoiceCellPhone ?? '', + invoiceEmail: ae_object.invoiceEmail ?? '', + idUser: ae_object.idUser ?? '', + localDate: ae_object.localDate ?? '', + pos: ae_object.pos ?? '', + + }) + } + + let data : StartSaleResponseInterface = await FetchData(BASE_URL_SALE, 'addProducts', options) + + if (data.correct) { + return data.object + } + + return data +} + + +export default StartSale \ No newline at end of file diff --git a/package/interfaces/OutputInterfaces/Customer/GetCustomerOutputInterface.tsx b/package/interfaces/OutputInterfaces/Customer/GetCustomerOutputInterface.tsx new file mode 100644 index 0000000..2b539c2 --- /dev/null +++ b/package/interfaces/OutputInterfaces/Customer/GetCustomerOutputInterface.tsx @@ -0,0 +1,19 @@ +export interface GetCustomerOutputInterface { + id?: string; + idCompany?: string; + idSubsidiary?: number; + name?: string; + lastname?: string; + idTypeCustomer?: string; + dni?: string; + idGender?: string; + idMaritalStatus?: string; + address?: string; + mail?: string; + phone?: string; + idUser?: string; + status?: any; + validateOnline?: boolean; + size?: number; + page?: number; + } \ No newline at end of file diff --git a/package/interfaces/OutputInterfaces/Customer/GetTypeDNIOutputInterface.tsx b/package/interfaces/OutputInterfaces/Customer/GetTypeDNIOutputInterface.tsx new file mode 100644 index 0000000..31d8c98 --- /dev/null +++ b/package/interfaces/OutputInterfaces/Customer/GetTypeDNIOutputInterface.tsx @@ -0,0 +1,13 @@ +export interface GetTypeDNIOutputInterface { + id?: string; + name?: string; + alias?: string; + longitude?: string; + status?: any; + idMethodValidation?: string; + nameMethodValidation?: string; + idUser?: string; + dataType?: string; + size?: number; + page?: number; + } \ No newline at end of file diff --git a/package/interfaces/OutputInterfaces/Customer/GetTypeValidationOutputInrerface.tsx b/package/interfaces/OutputInterfaces/Customer/GetTypeValidationOutputInrerface.tsx new file mode 100644 index 0000000..4276173 --- /dev/null +++ b/package/interfaces/OutputInterfaces/Customer/GetTypeValidationOutputInrerface.tsx @@ -0,0 +1,10 @@ +export interface GetTypeValidationOutputInrerface { + id?: string; + idCountry?: string; + name?: string; + alias?: string; + status?: string | null; + idUser?: string; + page?: number; + size?: number; + } \ No newline at end of file diff --git a/package/interfaces/OutputInterfaces/Customer/SaveCustomerOutputInterface.tsx b/package/interfaces/OutputInterfaces/Customer/SaveCustomerOutputInterface.tsx new file mode 100644 index 0000000..8569f34 --- /dev/null +++ b/package/interfaces/OutputInterfaces/Customer/SaveCustomerOutputInterface.tsx @@ -0,0 +1,18 @@ +export interface SaveCustomerOutputInteface { + id?: string; + idCompany?: string; + idSubsidiary?: string; + name?: string; + secondName?: string; + firstSurname?: string; + secondSurname?: string; + idTypeCustomer?: string; + dni?: string; + idGender?: string; + idMaritalStatus?: string; + address?: string; + mail?: string; + phone?: string; + idUser?: string; + status?: any; + } \ No newline at end of file diff --git a/package/interfaces/OutputInterfaces/Customer/SaveTypeDniOutputInterface.tsx b/package/interfaces/OutputInterfaces/Customer/SaveTypeDniOutputInterface.tsx new file mode 100644 index 0000000..5933264 --- /dev/null +++ b/package/interfaces/OutputInterfaces/Customer/SaveTypeDniOutputInterface.tsx @@ -0,0 +1,10 @@ +export interface SaveTypeDniOutputInterface { + id?: string; + name?: string; + alias?: string; + longitude?: number; + status?: any; + idMethodValidation?: string; + idUser?: string; + dataType?: string; + } \ No newline at end of file diff --git a/package/interfaces/OutputInterfaces/Customer/SaveTypeValidationOutputInterface.tsx b/package/interfaces/OutputInterfaces/Customer/SaveTypeValidationOutputInterface.tsx new file mode 100644 index 0000000..40be12c --- /dev/null +++ b/package/interfaces/OutputInterfaces/Customer/SaveTypeValidationOutputInterface.tsx @@ -0,0 +1,8 @@ +export interface SaveTypeValidationOutputInterface { + id?: string; + idCountry?: string; + name?: string; + alias?: string; + status?: any; + idUser?: string; + } \ No newline at end of file diff --git a/package/interfaces/OutputInterfaces/Sale/AddProductsOutputInterfae.tsx b/package/interfaces/OutputInterfaces/Sale/AddProductsOutputInterfae.tsx new file mode 100644 index 0000000..2f73278 --- /dev/null +++ b/package/interfaces/OutputInterfaces/Sale/AddProductsOutputInterfae.tsx @@ -0,0 +1,15 @@ +interface Product { + sku: string; + value: number; +} + +export interface AddProductsOutputInterface { + idTransaction?: string; + storeNumber?: string; + idSubsidiary?: number; + clientNit?: string; + idUser?: string; + localDate?: Date; + pos?: string; + products: Product[]; +} diff --git a/package/interfaces/OutputInterfaces/Sale/EndSaleOutputInterface.tsx b/package/interfaces/OutputInterfaces/Sale/EndSaleOutputInterface.tsx new file mode 100644 index 0000000..ecc0bf2 --- /dev/null +++ b/package/interfaces/OutputInterfaces/Sale/EndSaleOutputInterface.tsx @@ -0,0 +1,30 @@ +export interface Payment { + type: string; + approvalCode: string; + receiptNumber: string; + value: number; + cardNumber: string; + cardType: string; + comment: string; + } + + export interface InfoPos { + addressPos: string; + codeMunPos: string; + nameMunPos: string; + codeDepPos: string; + nameDepPos: string; + pos: string; + } + + export interface EndSaleOutputInterface { + idTransaction: string; + storeNumber: string; + idSubsidiary: number; + idUser: string; + localDate: string; + pos: string; + comment: string; + payment: Payment[]; + infoPos: InfoPos; + } \ No newline at end of file diff --git a/package/interfaces/OutputInterfaces/Sale/GetSaleOutputInterface.tsx b/package/interfaces/OutputInterfaces/Sale/GetSaleOutputInterface.tsx new file mode 100644 index 0000000..d0bcd55 --- /dev/null +++ b/package/interfaces/OutputInterfaces/Sale/GetSaleOutputInterface.tsx @@ -0,0 +1,7 @@ +export interface GetSaleOutputInterface { + idTransaction?: string; + storeNumber?: number; + idSubsidiary?: string; + idUser?: string; + pos?: string; +} \ No newline at end of file diff --git a/package/interfaces/OutputInterfaces/Sale/RemoveProductsOutputInterface.tsx b/package/interfaces/OutputInterfaces/Sale/RemoveProductsOutputInterface.tsx new file mode 100644 index 0000000..457bf24 --- /dev/null +++ b/package/interfaces/OutputInterfaces/Sale/RemoveProductsOutputInterface.tsx @@ -0,0 +1,15 @@ +export interface Product { + sku: string; + value: number; +} + +export interface Transaction { + idTransaction: string; + storeNumber: string; + idSubsidiary: number; + clientNit: string; + idUser: string; + localDate: string; + pos: string; + products: Product[]; +} \ No newline at end of file diff --git a/package/interfaces/OutputInterfaces/Sale/StartSaleOutputInterface.tsx b/package/interfaces/OutputInterfaces/Sale/StartSaleOutputInterface.tsx new file mode 100644 index 0000000..8974487 --- /dev/null +++ b/package/interfaces/OutputInterfaces/Sale/StartSaleOutputInterface.tsx @@ -0,0 +1,17 @@ +export interface StartSaleOutputInterface { + storeNumber?: string; + idSubsidiary?: number; + idClient?: string; + clientDni?: string; + idType?: string; + idGroup?: string; + invoiceName?: string; + invoiceTypeNit?: string; + invoiceNit?: string; + invoiceDirection?: string; + invoiceCellPhone?: string; + invoiceEmail?: string; + idUser?: string; + localDate?: string; + pos?: string; +} \ No newline at end of file diff --git a/package/interfaces/ResponseInterfaces/Auth/UserResponseInterface.tsx b/package/interfaces/ResponseInterfaces/Auth/UserResponseInterface.tsx new file mode 100644 index 0000000..ae8de3e --- /dev/null +++ b/package/interfaces/ResponseInterfaces/Auth/UserResponseInterface.tsx @@ -0,0 +1,23 @@ +export interface UserResposeInterface { + id: string; + idSubsidiary: number; + subsidiaryName: string; + idCompany: string; + companyName: string; + name: string; + lastName: string; + email: string; + cellphone: string; + idTypeUser: string; + typeName: string; + isActive: boolean; + isAdmin: boolean; + } + +export interface LoginResponse { + correct?: boolean; + message: string; + errorCode?: number; + object: UserResposeInterface | null; + } + diff --git a/package/interfaces/ResponseInterfaces/Customer/CustomerResponseInterface.tsx b/package/interfaces/ResponseInterfaces/Customer/CustomerResponseInterface.tsx new file mode 100644 index 0000000..5687d8f --- /dev/null +++ b/package/interfaces/ResponseInterfaces/Customer/CustomerResponseInterface.tsx @@ -0,0 +1,47 @@ +export interface CustomerResponseInterface { + correct: boolean; + message: string; + errorCode: number; + object: CustomerObjectInterface; +} + +export interface CustomerObjectInterface { + page: number; + size: number; + totalPage: number; + list: CustomerInterface[]; +} + +export interface CustomerInterface { + id?: string; + idCompany?: string; + companyName?: string; + idSubsidiary?: number; + nameSubsidiary?: string; + externalClientId?: string | null; + name?: string; + secondName?: string; + firstSurname?: string; + secondSurname?: string; + idTypeCustomer: string; + nameTypeCustomer?: string; + dni: string; + idGender?: string; + nameGender?: string; + idMaritalStatus?: string | null; + nameMaritalStatus?: string | null; + address: string; + idCity?: string | null; + nameCity?: string | null; + idCountry?: string | null; + nameCountry?: string | null; + mail: string; + phone: string; + idUser?: string; + nameUser?: string; + status: boolean; + birthdate?: string | null; + group: any[]; + NameSurname?: string; + SurnameName?: string; +} diff --git a/package/interfaces/ResponseInterfaces/Customer/DNITypeResponseInterface.tsx b/package/interfaces/ResponseInterfaces/Customer/DNITypeResponseInterface.tsx new file mode 100644 index 0000000..fd7eb6d --- /dev/null +++ b/package/interfaces/ResponseInterfaces/Customer/DNITypeResponseInterface.tsx @@ -0,0 +1,27 @@ +export interface CustomerDniTypeResponseInterface { + correct: boolean; + message: string; + errorCode: number; + object: CustomerDniTypeObjectInterface; + } + + export interface CustomerDniTypeObjectInterface { + page: number; + size: number; + totalPage: number; + list: CustomerDniTypeInterface[]; + } + + export interface CustomerDniTypeInterface { + id: string; + name: string; + alias: string; + longitude: string; + status: boolean; + idMethodValidation: string; + nameMethodValidation: string; + dataType: string | null; + idUser: string; + nameUser: string; + } + \ No newline at end of file diff --git a/package/interfaces/ResponseInterfaces/Customer/TypeValidationResponseInterface.tsx b/package/interfaces/ResponseInterfaces/Customer/TypeValidationResponseInterface.tsx new file mode 100644 index 0000000..b89a7d4 --- /dev/null +++ b/package/interfaces/ResponseInterfaces/Customer/TypeValidationResponseInterface.tsx @@ -0,0 +1,25 @@ +export interface CustomerTypeValidationResponseInterface { + correct: boolean; + message: string; + errorCode: number; + object: CustomerTypeValidationObjectInterface; + } + + export interface CustomerTypeValidationObjectInterface { + page: number; + size: number; + totalPage: number; + list: CustomerTypeValidationInterface[]; + } + + export interface CustomerTypeValidationInterface { + id: string; + idCountry: string; + nameCountry: string; + name: string; + alias: string; + status: boolean; + idUser: string; + nameUser: string; + } + \ No newline at end of file diff --git a/package/interfaces/ResponseInterfaces/Sale/AddProductsResponseInterface.tsx b/package/interfaces/ResponseInterfaces/Sale/AddProductsResponseInterface.tsx new file mode 100644 index 0000000..27118fd --- /dev/null +++ b/package/interfaces/ResponseInterfaces/Sale/AddProductsResponseInterface.tsx @@ -0,0 +1,39 @@ +export interface Tax { + id: string; + idSaleDetail: string; + idProduct: string; + idTax: string; + name: string; + alias: string; + percent: number; + totalPriceBeforeTaxes: number; + taxValue: number; + taxUnitValue: number | null; + taxIncluded: boolean; +} + +export interface ItemObject { + id: string; + itemIdentifier: string; + regularUnitPrice: number; + totalTaxes: number; + extendedPrice: number; + name: string; + idDepartment: string | null; + departmentNumber: string | null; + description: string; + longDescription: string; + quantity: number; + restrictedAge: number; + taxableFlag: boolean; + weight: number | null; + taxes: Tax[]; + weighable: boolean; +} + +export interface AddProductsResponseInterface { + correct: boolean; + message: string | null; + errorCode: number; + object: ItemObject; +} diff --git a/package/interfaces/ResponseInterfaces/Sale/EndSaleResponseInterface.tsx b/package/interfaces/ResponseInterfaces/Sale/EndSaleResponseInterface.tsx new file mode 100644 index 0000000..5cbebdb --- /dev/null +++ b/package/interfaces/ResponseInterfaces/Sale/EndSaleResponseInterface.tsx @@ -0,0 +1,15 @@ +export interface TransactionObject { + StatusCV: boolean; + QRCode: string; + description: string; + numFac: string; + status: string; + cufe: string; +} + +export interface EndSaleResponseInterface { + correct: boolean; + message: string; + errorCode: number; + object: TransactionObject; +} \ No newline at end of file diff --git a/package/interfaces/ResponseInterfaces/Sale/GetSaleResponseInterface.tsx b/package/interfaces/ResponseInterfaces/Sale/GetSaleResponseInterface.tsx new file mode 100644 index 0000000..82c0e29 --- /dev/null +++ b/package/interfaces/ResponseInterfaces/Sale/GetSaleResponseInterface.tsx @@ -0,0 +1,107 @@ + +export interface Tax { + id: string; + idSaleDetail: string; + idProduct: string; + idTax: string; + name: string; + alias: string; + percent: number; + totalPriceBeforeTaxes: number; + taxValue: number; + taxUnitValue: number | null; + taxIncluded: boolean; +} + +export interface SaleDetail { + idDetail: string; + idTransaction: string; + id: string; + itemIdentifier: string; + name: string; + unitMeasurement: string; + idDepartment: string | null; + departmentNumber: string | null; + description: string; + quantity: number; + weight: number | null; + regularUnitPrice: number; + originalUnitPrice: number; + discount: number; + totalTaxes: number; + taxableFlag: boolean; + restrictedAge: number; + idSaleState: number; + idUser: string; + creation: string; + lastUpdate: string; + taxes: Tax[]; + active: boolean; + weighable: boolean; + extendedPrice: number; +} + +export interface CustomerPromotion { + groupId: string; + customerId: string; + percentageDiscount: number | null; +} + +export interface ItemPromotion { + index: number; + code: string; + quantity: number; + unitPrice: number; + attribute: string | null; + promotionTrace: string | null; + resultPercentDiscount: number | null; + weighable: boolean; +} + +export interface Promotions { + customer: CustomerPromotion; + items: ItemPromotion[]; + total: number; + listPromotion: any[]; // Assuming this is an empty array, can adjust if more data is provided +} + +export interface SaleTransactionObject { + id: string; + idCompany: string; + idSubsidiary: number; + transactionNumber: string; + idClient: string; + clientName: string; + clientDni: string; + idType: string; + totalSale: number; + totalTaxes: number; + totalWithPromotion: number; + idGroup: string; + group: string; + invoiceCode: string | null; + invoiceName: string; + invoiceTypeDni: string; + invoiceDni: string; + invoiceDirection: string; + invoiceCellPhone: string; + invoiceEmail: string; + idUser: string; + idSaleState: number; + numberStore: string; + pos: string; + posLocalTimeStart: string; + posLocalTimeEnd: string | null; + localDateTime: string | null; + creation: string; + lastUpdate: string; + list: SaleDetail[]; + promotions: Promotions; +} + +export interface GetSaleResponseInterface { + correct: boolean; + message: string | null; + errorCode: number; + object: SaleTransactionObject; +} diff --git a/package/interfaces/ResponseInterfaces/Sale/RemoveProductsResponseInterface.tsx b/package/interfaces/ResponseInterfaces/Sale/RemoveProductsResponseInterface.tsx new file mode 100644 index 0000000..3a01d46 --- /dev/null +++ b/package/interfaces/ResponseInterfaces/Sale/RemoveProductsResponseInterface.tsx @@ -0,0 +1,41 @@ +// interfaces/ProductDetails.ts + +export interface Tax { + id: string; + idSaleDetail: string; + idProduct: string; + idTax: string; + name: string; + alias: string; + percent: number; + totalPriceBeforeTaxes: number; + taxValue: number; + taxUnitValue: number | null; + taxIncluded: boolean; +} + +export interface ProductObject { + id: string; + itemIdentifier: string; + regularUnitPrice: number; + totalTaxes: number; + extendedPrice: number; + name: string; + idDepartment: string | null; + departmentNumber: string | null; + description: string; + longDescription: string; + quantity: number; + restrictedAge: number; + taxableFlag: boolean; + weight: number | null; + taxes: Tax[]; + weighable: boolean; +} + +export interface RemoveProductsResponseInterface { + correct: boolean; + message: string | null; + errorCode: number; + object: ProductObject; +} diff --git a/package/interfaces/ResponseInterfaces/Sale/StartSaleResponseInterface.tsx b/package/interfaces/ResponseInterfaces/Sale/StartSaleResponseInterface.tsx new file mode 100644 index 0000000..312d7ce --- /dev/null +++ b/package/interfaces/ResponseInterfaces/Sale/StartSaleResponseInterface.tsx @@ -0,0 +1,11 @@ +export interface TransactionObject { + id: string; + transactionNumber: string; +} + +export interface StartSaleResponseInterface { + correct: boolean; + message: string; + errorCode: number; + object: TransactionObject; +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 88c5c90..9d7854a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -30,6 +30,9 @@ "@organisms/*": ["./package/components/organisms/*"], "@layouts/*": ["./package/components/layouts/*"], "@styles/*": ["./package/styles/*"], + "@utils/*": ["./package/utils/*"], + "@hooks/*": ["./package/hooks/*"], + "@interfaces/*": ["./package/interfaces/*"], "@package/*": ["./package/*"], "@app/*": ["./app/*"], "@public/*": ["./public/*"]