Conexon servicios
This commit is contained in:
parent
2018f925cc
commit
3b7faaae03
|
|
@ -57,6 +57,7 @@
|
||||||
"stylis": "4.3.1",
|
"stylis": "4.3.1",
|
||||||
"stylis-plugin-rtl": "2.1.1",
|
"stylis-plugin-rtl": "2.1.1",
|
||||||
"type-fest": "4.9.0",
|
"type-fest": "4.9.0",
|
||||||
|
"uuid": "^9.0.1",
|
||||||
"web-vitals": "3.5.1",
|
"web-vitals": "3.5.1",
|
||||||
"yup": "^1.3.3",
|
"yup": "^1.3.3",
|
||||||
"zod": "3.22.4"
|
"zod": "3.22.4"
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
|
|
@ -32,7 +32,7 @@ function FuseLoading(props: FuseLoadingProps) {
|
||||||
className="-mb-16 text-13 font-medium sm:text-20"
|
className="-mb-16 text-13 font-medium sm:text-20"
|
||||||
color="text.secondary"
|
color="text.secondary"
|
||||||
>
|
>
|
||||||
Loading
|
Cargando
|
||||||
</Typography>
|
</Typography>
|
||||||
<Box
|
<Box
|
||||||
id="spinner"
|
id="spinner"
|
||||||
|
|
|
||||||
|
|
@ -32751,8 +32751,8 @@
|
||||||
"password": "admin",
|
"password": "admin",
|
||||||
"role": "admin",
|
"role": "admin",
|
||||||
"data": {
|
"data": {
|
||||||
"displayName": "Abbott Keitch",
|
"displayName": "Andres Alvarez",
|
||||||
"photoURL": "assets/images/avatars/brian-hughes.jpg",
|
"photoURL": "assets/images/avatars/user.jpg",
|
||||||
"email": "admin@qsoftec.com",
|
"email": "admin@qsoftec.com",
|
||||||
"settings": {
|
"settings": {
|
||||||
"layout": {},
|
"layout": {},
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,20 @@ export type SignInPayload = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export type SignUpPayload = {
|
export type SignUpPayload = {
|
||||||
displayName: string;
|
usuUsuario: string;
|
||||||
|
usuNombre: string;
|
||||||
|
detCodigo: number;
|
||||||
|
empIdentificacion: string;
|
||||||
|
empRazonSocial: string;
|
||||||
|
empNombreComercial: string;
|
||||||
|
empContacto: string;
|
||||||
|
empDireccion: string;
|
||||||
|
empMail: string;
|
||||||
|
empCodContribuyente: string;
|
||||||
|
empDescripcion: string;
|
||||||
|
empLlevaContabilidad: string;
|
||||||
password: string;
|
password: string;
|
||||||
email: string;
|
passwordConfirm: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type AuthContext = {
|
type AuthContext = {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
|
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||||
import { useState, useEffect, useCallback } from 'react';
|
import { useState, useEffect, useCallback } from 'react';
|
||||||
import axios, { AxiosError, AxiosResponse } from 'axios';
|
import axios, { AxiosError, AxiosResponse } from 'axios';
|
||||||
import jwtDecode, { JwtPayload } from 'jwt-decode';
|
import jwtDecode, { JwtPayload } from 'jwt-decode';
|
||||||
import _ from '@lodash';
|
import _ from '@lodash';
|
||||||
import { PartialDeep } from 'type-fest';
|
import { PartialDeep } from 'type-fest';
|
||||||
|
import { loginIn } from 'src/app/services/user.service';
|
||||||
|
|
||||||
const defaultAuthConfig = {
|
const defaultAuthConfig = {
|
||||||
tokenStorageKey: 'jwt_access_token',
|
tokenStorageKey: 'jwt_access_token',
|
||||||
|
|
@ -47,6 +49,10 @@ export type JwtAuth<User, SignInPayload, SignUpPayload> = {
|
||||||
setIsLoading: (isLoading: boolean) => void;
|
setIsLoading: (isLoading: boolean) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type UserLogin = {
|
||||||
|
user: string;
|
||||||
|
password: string;
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* useJwtAuth hook
|
* useJwtAuth hook
|
||||||
* Description: This hook handles the authentication flow using JWT
|
* Description: This hook handles the authentication flow using JWT
|
||||||
|
|
@ -94,8 +100,8 @@ const useJwtAuth = <User, SignInPayload, SignUpPayload>(
|
||||||
/**
|
/**
|
||||||
* Handle sign-in success
|
* Handle sign-in success
|
||||||
*/
|
*/
|
||||||
const handleSignInSuccess = useCallback((userData: User, accessToken: string) => {
|
const handleSignInSuccess = useCallback((userData: User) => {
|
||||||
setSession(accessToken);
|
// setSession(accessToken);
|
||||||
|
|
||||||
setIsAuthenticated(true);
|
setIsAuthenticated(true);
|
||||||
|
|
||||||
|
|
@ -182,7 +188,7 @@ const useJwtAuth = <User, SignInPayload, SignUpPayload>(
|
||||||
|
|
||||||
const userData = response?.data;
|
const userData = response?.data;
|
||||||
|
|
||||||
handleSignInSuccess(userData, accessToken);
|
handleSignInSuccess(userData);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
@ -215,10 +221,19 @@ const useJwtAuth = <User, SignInPayload, SignUpPayload>(
|
||||||
/**
|
/**
|
||||||
* Sign in
|
* Sign in
|
||||||
*/
|
*/
|
||||||
const signIn = async (credentials: SignInPayload) => {
|
const signIn = async (credentials: UserLogin) => {
|
||||||
const response = axios.post(authConfig.signInUrl, credentials);
|
// const response = axios.post(authConfig.signInUrl, credentials);
|
||||||
|
const {error, bodyOut} = await loginIn(credentials.email, credentials.password);
|
||||||
|
|
||||||
response.then(
|
if(error.codigo === '0'){
|
||||||
|
const userData = bodyOut.data[0];
|
||||||
|
|
||||||
|
handleSignInSuccess(userData);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return bodyOut.data[0];
|
||||||
|
/* response.then(
|
||||||
(res: AxiosResponse<{ user: User; access_token: string }>) => {
|
(res: AxiosResponse<{ user: User; access_token: string }>) => {
|
||||||
const userData = res?.data?.user;
|
const userData = res?.data?.user;
|
||||||
const accessToken = res?.data?.access_token;
|
const accessToken = res?.data?.access_token;
|
||||||
|
|
@ -234,9 +249,9 @@ const useJwtAuth = <User, SignInPayload, SignUpPayload>(
|
||||||
|
|
||||||
return axiosError;
|
return axiosError;
|
||||||
}
|
}
|
||||||
);
|
); */
|
||||||
|
|
||||||
return response;
|
// return response;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||||
|
import { v4 as uuidV4 } from 'uuid';
|
||||||
|
|
||||||
|
interface Header {
|
||||||
|
dispositivo: string;
|
||||||
|
canal: string | null;
|
||||||
|
medio: string | null;
|
||||||
|
aplicacion: string;
|
||||||
|
tipoTransaccion: string | null;
|
||||||
|
usuario: string | number;
|
||||||
|
uuid: string;
|
||||||
|
fechaHora: string | null;
|
||||||
|
idioma: string | null;
|
||||||
|
empresa: string | null;
|
||||||
|
geolocalizacion: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface User {
|
||||||
|
usercode: string | number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const user: User = JSON.parse(localStorage.getItem('user'));
|
||||||
|
|
||||||
|
const headerIn: Header = {
|
||||||
|
dispositivo: 'WeLaptop',
|
||||||
|
canal: null,
|
||||||
|
medio: null,
|
||||||
|
aplicacion: 'SINCOARV2',
|
||||||
|
tipoTransaccion: null,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||||
|
usuario: user ? user.usercode : 'user',
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||||
|
uuid: uuidV4(),
|
||||||
|
fechaHora: null,
|
||||||
|
idioma: null,
|
||||||
|
empresa: null,
|
||||||
|
geolocalizacion: null
|
||||||
|
};
|
||||||
|
|
||||||
|
const url = 'http://services.qsoftec.com:18080/inventario-rs-services-1.0-SNAPSHOT/servicios'; // test
|
||||||
|
// let url = 'https://tramitesarmas.ccffaa.mil.ec/sincoar/servicios' //produccion
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
api: url,
|
||||||
|
headerIn
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
||||||
|
|
@ -1,58 +1,57 @@
|
||||||
import { useFormik } from "formik";
|
import { useFormik } from 'formik';
|
||||||
import { Client } from "../../DataClientInterfaz";
|
import * as Yup from 'yup';
|
||||||
import AddClientRender from "./AddClientRender";
|
import { Client } from '../../DataClientInterfaz';
|
||||||
import * as Yup from "yup";
|
import AddClientRender from './AddClientRender';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
setOpen: (open: boolean) => void;
|
setOpen: (open: boolean) => void;
|
||||||
handleSelectClient: (value: Client) => void;
|
handleSelectClient: (value: Client) => void;
|
||||||
}
|
}
|
||||||
function AddClient({ open, setOpen, handleSelectClient }: Props) {
|
function AddClient({ open, setOpen, handleSelectClient }: Props) {
|
||||||
const formik = useFormik<Client>({
|
const formik = useFormik<Client>({
|
||||||
initialValues: {
|
initialValues: {
|
||||||
id: Math.floor(Math.random() * 100),
|
id: Math.floor(Math.random() * 100),
|
||||||
nombreComercial: "",
|
nombreComercial: '',
|
||||||
razonSocial: "",
|
razonSocial: '',
|
||||||
identificacion: "",
|
identificacion: '',
|
||||||
direccion: "",
|
direccion: '',
|
||||||
telefono: "",
|
telefono: '',
|
||||||
correo: "",
|
correo: ''
|
||||||
},
|
},
|
||||||
validationSchema: Yup.object({
|
validationSchema: Yup.object({
|
||||||
nombreComercial: Yup.string().required("El campo es Obligatorio"),
|
nombreComercial: Yup.string().required('El campo es Obligatorio'),
|
||||||
razonSocial: Yup.string().required("El campo es Obligatorio"),
|
razonSocial: Yup.string().required('El campo es Obligatorio'),
|
||||||
identificacion: Yup.string().required("El campo es Obligatorio"),
|
identificacion: Yup.string().required('El campo es Obligatorio'),
|
||||||
direccion: Yup.string().required("El campo es Obligatorio"),
|
direccion: Yup.string().required('El campo es Obligatorio'),
|
||||||
telefono: Yup.string().required("El campo es Obligatorio"),
|
telefono: Yup.string().required('El campo es Obligatorio'),
|
||||||
correo: Yup.string().required("El campo es Obligatorio")
|
correo: Yup.string().required('El campo es Obligatorio').email('Correo no valido')
|
||||||
.email("Correo no valido"),
|
}),
|
||||||
}),
|
onSubmit: (value) => {
|
||||||
onSubmit: (value) => {
|
handleSaveClient(value);
|
||||||
handleSaveClient(value)
|
}
|
||||||
},
|
});
|
||||||
});
|
|
||||||
|
|
||||||
const handleOnChange = ({ target }) => {
|
const handleOnChange = (event: { target: HTMLInputElement }) => {
|
||||||
const { name, value } = target;
|
const { name, value } = event.target;
|
||||||
formik.setFieldValue(name, value);
|
formik.setFieldValue(name, value);
|
||||||
};
|
};
|
||||||
|
|
||||||
//TODO: Guardar cliente en la base de datos y seleccionar
|
// TODO: Guardar cliente en la base de datos y seleccionar
|
||||||
const handleSaveClient = (value) => {
|
const handleSaveClient = (value: Client) => {
|
||||||
handleSelectClient(value)
|
handleSelectClient(value);
|
||||||
formik.resetForm();
|
formik.resetForm();
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
}
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AddClientRender
|
<AddClientRender
|
||||||
open={open}
|
open={open}
|
||||||
setOpen={setOpen}
|
setOpen={setOpen}
|
||||||
formik={formik}
|
formik={formik}
|
||||||
handleOnChange={handleOnChange}
|
handleOnChange={handleOnChange}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default AddClient;
|
export default AddClient;
|
||||||
|
|
|
||||||
|
|
@ -1,181 +1,177 @@
|
||||||
import {
|
import { DialogActions, DialogContent, DialogTitle, Button, Grid, TextField, Dialog } from '@mui/material';
|
||||||
DialogActions,
|
import { FormikProps } from 'formik';
|
||||||
DialogContent,
|
import { Client } from '../../DataClientInterfaz';
|
||||||
DialogTitle,
|
|
||||||
Button,
|
|
||||||
Grid,
|
|
||||||
TextField,
|
|
||||||
Dialog,
|
|
||||||
} from "@mui/material";
|
|
||||||
import { FormikProps } from "formik";
|
|
||||||
import { Client } from "../../DataClientInterfaz";
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
setOpen: (open: boolean) => void;
|
setOpen: (open: boolean) => void;
|
||||||
formik: FormikProps<Client>;
|
formik: FormikProps<Client>;
|
||||||
handleOnChange: (event) => void;
|
handleOnChange: (event) => void;
|
||||||
}
|
}
|
||||||
function AddClientRender({ open, setOpen, formik, handleOnChange }: Props) {
|
function AddClientRender({ open, setOpen, formik, handleOnChange }: Props) {
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} scroll="body" fullWidth maxWidth="md">
|
<Dialog
|
||||||
<DialogTitle id="alert-dialog-title">Agregar Cliente</DialogTitle>
|
open={open}
|
||||||
<DialogContent dividers>
|
scroll="body"
|
||||||
<Grid container spacing={2}>
|
fullWidth
|
||||||
<Grid item md={6} xs={12}>
|
maxWidth="md"
|
||||||
<TextField
|
>
|
||||||
size="small"
|
<DialogTitle id="alert-dialog-title">Agregar Cliente</DialogTitle>
|
||||||
label="Nombre Comercial"
|
<DialogContent dividers>
|
||||||
variant="outlined"
|
<Grid
|
||||||
fullWidth
|
container
|
||||||
name="nombreComercial"
|
spacing={2}
|
||||||
value={formik.values.nombreComercial || ""}
|
>
|
||||||
onChange={handleOnChange}
|
<Grid
|
||||||
onBlur={formik.handleBlur}
|
item
|
||||||
error={
|
md={6}
|
||||||
formik.errors.nombreComercial && formik.touched.nombreComercial
|
xs={12}
|
||||||
? true
|
>
|
||||||
: false
|
<TextField
|
||||||
}
|
size="small"
|
||||||
helperText={
|
label="Nombre Comercial"
|
||||||
formik.errors.nombreComercial && formik.touched.nombreComercial
|
variant="outlined"
|
||||||
? formik.errors.nombreComercial
|
fullWidth
|
||||||
: false
|
name="nombreComercial"
|
||||||
}
|
value={formik.values.nombreComercial || ''}
|
||||||
/>
|
onChange={handleOnChange}
|
||||||
</Grid>
|
onBlur={formik.handleBlur}
|
||||||
<Grid item md={6} xs={12}>
|
error={!!(formik.errors.nombreComercial && formik.touched.nombreComercial)}
|
||||||
<TextField
|
helperText={
|
||||||
size="small"
|
formik.errors.nombreComercial && formik.touched.nombreComercial
|
||||||
label="Razón Social"
|
? formik.errors.nombreComercial
|
||||||
variant="outlined"
|
: false
|
||||||
fullWidth
|
}
|
||||||
name="razonSocial"
|
/>
|
||||||
value={formik.values.razonSocial || ""}
|
</Grid>
|
||||||
onChange={handleOnChange}
|
<Grid
|
||||||
onBlur={formik.handleBlur}
|
item
|
||||||
error={
|
md={6}
|
||||||
formik.errors.razonSocial && formik.touched.razonSocial
|
xs={12}
|
||||||
? true
|
>
|
||||||
: false
|
<TextField
|
||||||
}
|
size="small"
|
||||||
helperText={
|
label="Razón Social"
|
||||||
formik.errors.razonSocial && formik.touched.razonSocial
|
variant="outlined"
|
||||||
? formik.errors.razonSocial
|
fullWidth
|
||||||
: false
|
name="razonSocial"
|
||||||
}
|
value={formik.values.razonSocial || ''}
|
||||||
/>
|
onChange={handleOnChange}
|
||||||
</Grid>
|
onBlur={formik.handleBlur}
|
||||||
<Grid item md={6} xs={12}>
|
error={!!(formik.errors.razonSocial && formik.touched.razonSocial)}
|
||||||
<TextField
|
helperText={
|
||||||
size="small"
|
formik.errors.razonSocial && formik.touched.razonSocial
|
||||||
label="Identificación"
|
? formik.errors.razonSocial
|
||||||
variant="outlined"
|
: false
|
||||||
fullWidth
|
}
|
||||||
name="identificacion"
|
/>
|
||||||
value={formik.values.identificacion || ""}
|
</Grid>
|
||||||
onChange={handleOnChange}
|
<Grid
|
||||||
onBlur={formik.handleBlur}
|
item
|
||||||
error={
|
md={6}
|
||||||
formik.errors.identificacion && formik.touched.identificacion
|
xs={12}
|
||||||
? true
|
>
|
||||||
: false
|
<TextField
|
||||||
}
|
size="small"
|
||||||
helperText={
|
label="Identificación"
|
||||||
formik.errors.identificacion && formik.touched.identificacion
|
variant="outlined"
|
||||||
? formik.errors.identificacion
|
fullWidth
|
||||||
: false
|
name="identificacion"
|
||||||
}
|
value={formik.values.identificacion || ''}
|
||||||
/>
|
onChange={handleOnChange}
|
||||||
</Grid>
|
onBlur={formik.handleBlur}
|
||||||
<Grid item md={6} xs={12}>
|
error={!!(formik.errors.identificacion && formik.touched.identificacion)}
|
||||||
<TextField
|
helperText={
|
||||||
size="small"
|
formik.errors.identificacion && formik.touched.identificacion
|
||||||
label="Dirección"
|
? formik.errors.identificacion
|
||||||
variant="outlined"
|
: false
|
||||||
fullWidth
|
}
|
||||||
name="direccion"
|
/>
|
||||||
value={formik.values.direccion || ""}
|
</Grid>
|
||||||
onChange={handleOnChange}
|
<Grid
|
||||||
onBlur={formik.handleBlur}
|
item
|
||||||
error={
|
md={6}
|
||||||
formik.errors.direccion && formik.touched.direccion
|
xs={12}
|
||||||
? true
|
>
|
||||||
: false
|
<TextField
|
||||||
}
|
size="small"
|
||||||
helperText={
|
label="Dirección"
|
||||||
formik.errors.direccion && formik.touched.direccion
|
variant="outlined"
|
||||||
? formik.errors.direccion
|
fullWidth
|
||||||
: false
|
name="direccion"
|
||||||
}
|
value={formik.values.direccion || ''}
|
||||||
/>
|
onChange={handleOnChange}
|
||||||
</Grid>
|
onBlur={formik.handleBlur}
|
||||||
<Grid item md={6} xs={12}>
|
error={!!(formik.errors.direccion && formik.touched.direccion)}
|
||||||
<TextField
|
helperText={
|
||||||
size="small"
|
formik.errors.direccion && formik.touched.direccion ? formik.errors.direccion : false
|
||||||
label="Teléfono"
|
}
|
||||||
variant="outlined"
|
/>
|
||||||
fullWidth
|
</Grid>
|
||||||
name="telefono"
|
<Grid
|
||||||
value={formik.values.telefono || ""}
|
item
|
||||||
onChange={handleOnChange}
|
md={6}
|
||||||
onBlur={formik.handleBlur}
|
xs={12}
|
||||||
error={
|
>
|
||||||
formik.errors.telefono && formik.touched.telefono ? true : false
|
<TextField
|
||||||
}
|
size="small"
|
||||||
helperText={
|
label="Teléfono"
|
||||||
formik.errors.telefono && formik.touched.telefono
|
variant="outlined"
|
||||||
? formik.errors.telefono
|
fullWidth
|
||||||
: false
|
name="telefono"
|
||||||
}
|
value={formik.values.telefono || ''}
|
||||||
/>
|
onChange={handleOnChange}
|
||||||
</Grid>
|
onBlur={formik.handleBlur}
|
||||||
<Grid item md={6} xs={12}>
|
error={!!(formik.errors.telefono && formik.touched.telefono)}
|
||||||
<TextField
|
helperText={
|
||||||
size="small"
|
formik.errors.telefono && formik.touched.telefono ? formik.errors.telefono : false
|
||||||
label="Correo electrónico"
|
}
|
||||||
variant="outlined"
|
/>
|
||||||
fullWidth
|
</Grid>
|
||||||
name="correo"
|
<Grid
|
||||||
value={formik.values.correo || ""}
|
item
|
||||||
onChange={handleOnChange}
|
md={6}
|
||||||
onBlur={formik.handleBlur}
|
xs={12}
|
||||||
error={
|
>
|
||||||
formik.errors.correo && formik.touched.correo ? true : false
|
<TextField
|
||||||
}
|
size="small"
|
||||||
helperText={
|
label="Correo electrónico"
|
||||||
formik.errors.correo && formik.touched.correo
|
variant="outlined"
|
||||||
? formik.errors.correo
|
fullWidth
|
||||||
: false
|
name="correo"
|
||||||
}
|
value={formik.values.correo || ''}
|
||||||
/>
|
onChange={handleOnChange}
|
||||||
</Grid>
|
onBlur={formik.handleBlur}
|
||||||
</Grid>
|
error={!!(formik.errors.correo && formik.touched.correo)}
|
||||||
</DialogContent>
|
helperText={formik.errors.correo && formik.touched.correo ? formik.errors.correo : false}
|
||||||
<DialogActions className="pr-24">
|
/>
|
||||||
<Button
|
</Grid>
|
||||||
onClick={() => {
|
</Grid>
|
||||||
formik.resetForm();
|
</DialogContent>
|
||||||
setOpen(false);
|
<DialogActions className="pr-24">
|
||||||
}}
|
<Button
|
||||||
color="primary"
|
onClick={() => {
|
||||||
variant="contained"
|
formik.resetForm();
|
||||||
size="small"
|
setOpen(false);
|
||||||
>
|
}}
|
||||||
Cancelar
|
color="primary"
|
||||||
</Button>
|
variant="contained"
|
||||||
<Button
|
size="small"
|
||||||
onClick={formik.submitForm}
|
>
|
||||||
color="primary"
|
Cancelar
|
||||||
autoFocus
|
</Button>
|
||||||
variant="contained"
|
<Button
|
||||||
size="small"
|
onClick={formik.submitForm}
|
||||||
>
|
color="primary"
|
||||||
Aceptar
|
autoFocus
|
||||||
</Button>
|
variant="contained"
|
||||||
</DialogActions>
|
size="small"
|
||||||
</Dialog>
|
>
|
||||||
);
|
Aceptar
|
||||||
|
</Button>
|
||||||
|
</DialogActions>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default AddClientRender;
|
export default AddClientRender;
|
||||||
|
|
|
||||||
|
|
@ -63,13 +63,13 @@ function DataInvoiceRender({ handleAddItem, items }: Props) {
|
||||||
md={2}
|
md={2}
|
||||||
>
|
>
|
||||||
<TextField
|
<TextField
|
||||||
label='Serial'
|
label="Serial"
|
||||||
size='small'
|
size="small"
|
||||||
variant='outlined'
|
variant="outlined"
|
||||||
fullWidth
|
fullWidth
|
||||||
InputLabelProps={{
|
InputLabelProps={{
|
||||||
shrink: true,
|
shrink: true
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid
|
<Grid
|
||||||
|
|
@ -78,14 +78,14 @@ function DataInvoiceRender({ handleAddItem, items }: Props) {
|
||||||
md={2}
|
md={2}
|
||||||
>
|
>
|
||||||
<TextField
|
<TextField
|
||||||
label='Fecha factura'
|
label="Fecha factura"
|
||||||
size='small'
|
size="small"
|
||||||
variant='outlined'
|
variant="outlined"
|
||||||
type='date'
|
type="date"
|
||||||
fullWidth
|
fullWidth
|
||||||
InputLabelProps={{
|
InputLabelProps={{
|
||||||
shrink: true,
|
shrink: true
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid
|
<Grid
|
||||||
|
|
@ -94,14 +94,14 @@ function DataInvoiceRender({ handleAddItem, items }: Props) {
|
||||||
md={2}
|
md={2}
|
||||||
>
|
>
|
||||||
<TextField
|
<TextField
|
||||||
label='Fecha creada'
|
label="Fecha creada"
|
||||||
size='small'
|
size="small"
|
||||||
variant='outlined'
|
variant="outlined"
|
||||||
type='date'
|
type="date"
|
||||||
fullWidth
|
fullWidth
|
||||||
InputLabelProps={{
|
InputLabelProps={{
|
||||||
shrink: true,
|
shrink: true
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import { Button } from '@mui/material';
|
|
||||||
import { Headers } from '../../DataInvoiceInterface';
|
import { Headers } from '../../DataInvoiceInterface';
|
||||||
import TableInvoiceRender from './TableInvoiceRender';
|
import TableInvoiceRender from './TableInvoiceRender';
|
||||||
|
|
||||||
|
|
@ -10,7 +9,7 @@ function TableInvoice() {
|
||||||
{ id: 4, name: 'Valor unitario', style: 130 },
|
{ id: 4, name: 'Valor unitario', style: 130 },
|
||||||
{ id: 5, name: 'Iva', style: 10 },
|
{ id: 5, name: 'Iva', style: 10 },
|
||||||
{ id: 6, name: 'Total', style: 130 },
|
{ id: 6, name: 'Total', style: 130 },
|
||||||
{ id: 7, name: 'Acción', style: 10 },
|
{ id: 7, name: 'Acción', style: 10 }
|
||||||
];
|
];
|
||||||
return <TableInvoiceRender headers={headers} />;
|
return <TableInvoiceRender headers={headers} />;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,11 @@ function TableInvoiceRender({ headers }: Props) {
|
||||||
</Typography>
|
</Typography>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
))}
|
))}
|
||||||
|
{/* <TableCell style={{ width: 5 }}>
|
||||||
|
<IconButton>
|
||||||
|
<FuseSvgIcon>heroicons-outline:plus</FuseSvgIcon>
|
||||||
|
</IconButton>
|
||||||
|
</TableCell> */}
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableHead>
|
</TableHead>
|
||||||
<TableBody>
|
<TableBody>
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,9 @@
|
||||||
import { Controller, useForm } from 'react-hook-form';
|
|
||||||
import Button from '@mui/material/Button';
|
|
||||||
import Checkbox from '@mui/material/Checkbox';
|
|
||||||
import FormControl from '@mui/material/FormControl';
|
|
||||||
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
||||||
import TextField from '@mui/material/TextField';
|
|
||||||
import Typography from '@mui/material/Typography';
|
import Typography from '@mui/material/Typography';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import _ from '@lodash';
|
|
||||||
import Paper from '@mui/material/Paper';
|
import Paper from '@mui/material/Paper';
|
||||||
import FuseSvgIcon from '@fuse/core/FuseSvgIcon';
|
|
||||||
import AvatarGroup from '@mui/material/AvatarGroup';
|
|
||||||
import Avatar from '@mui/material/Avatar';
|
|
||||||
import Box from '@mui/material/Box';
|
import Box from '@mui/material/Box';
|
||||||
import { z } from 'zod';
|
|
||||||
import { zodResolver } from '@hookform/resolvers/zod';
|
|
||||||
import Tabs from '@mui/material/Tabs';
|
|
||||||
import Tab from '@mui/material/Tab';
|
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import JwtLoginTab from './tabs/JwtSignInTab';
|
import JwtLoginTab from './tabs/JwtSignInTab';
|
||||||
import FirebaseSignInTab from './tabs/FirebaseSignInTab';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form Validation Schema
|
* Form Validation Schema
|
||||||
|
|
@ -39,14 +24,9 @@ const tabs = [
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
function SignInPage() {
|
function SignInPage() {
|
||||||
const [selectedTabId, setSelectedTabId] = useState(tabs[0].id);
|
const [selectedTabId, setSelectedTabId] = useState(tabs[0].id);
|
||||||
|
|
||||||
function handleSelectTab(id: string) {
|
|
||||||
setSelectedTabId("jwt");
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex min-w-0 h-screen flex-auto flex-col justify-center items-center sm:justify-center md:p-32">
|
<div className="flex min-w-0 h-screen flex-auto flex-col justify-center items-center sm:justify-center md:p-32">
|
||||||
<Paper className="flex min-h-full w-full overflow-hidden justify-center items-center rounded-0 sm:min-h-auto sm:w-auto sm:rounded-2xl sm:shadow md:w-full md:max-w-6xl">
|
<Paper className="flex min-h-full w-full overflow-hidden justify-center items-center rounded-0 sm:min-h-auto sm:w-auto sm:rounded-2xl sm:shadow md:w-full md:max-w-6xl">
|
||||||
|
|
@ -93,16 +73,17 @@ function SignInPage() {
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</Tabs> */}
|
</Tabs> */}
|
||||||
{selectedTabId === 'jwt' && <JwtLoginTab />}
|
{/* {selectedTabId === 'jwt' && <JwtLoginTab />} */}
|
||||||
|
<JwtLoginTab />
|
||||||
|
|
||||||
{/* {selectedTabId === 'firebase' && <FirebaseSignInTab />} */}
|
{/* {selectedTabId === 'firebase' && <FirebaseSignInTab />} */}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
className="relative hidden h-auto justify-center items-center flex-auto p-64 md:flex lg:px-112"
|
className="relative hidden h-auto justify-center items-center flex-auto p-64 md:flex lg:px-112"
|
||||||
sx={{ backgroundColor: 'primary.main' }}>
|
sx={{ backgroundColor: 'primary.main' }}
|
||||||
|
>
|
||||||
<svg
|
<svg
|
||||||
className="pointer-events-none absolute inset-0"
|
className="pointer-events-none absolute inset-0"
|
||||||
viewBox="0 0 960 540"
|
viewBox="0 0 960 540"
|
||||||
|
|
@ -174,14 +155,20 @@ function SignInPage() {
|
||||||
</div>
|
</div>
|
||||||
<div className="flex overflow-hidden items-center mt-4 text-md leading-none text-gray-400">
|
<div className="flex overflow-hidden items-center mt-4 text-md leading-none text-gray-400">
|
||||||
<div>Soporte técnico: 0967722226</div>
|
<div>Soporte técnico: 0967722226</div>
|
||||||
<a aria-label="Chat WhatsApp" href="https://wa.me/967722226/?text=Hola!%20Necesito%20ayuda%20en%20el%20sistema%20de%20facturación">
|
<a
|
||||||
<img className='w-52' alt="Chat WhatsApp" src="assets/images/logo/WhatsApp-Logo.wine.svg" />
|
aria-label="Chat WhatsApp"
|
||||||
|
href="https://wa.me/967722226/?text=Hola!%20Necesito%20ayuda%20en%20el%20sistema%20de%20facturación"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
className="w-52"
|
||||||
|
alt="Chat WhatsApp"
|
||||||
|
src="assets/images/logo/WhatsApp-Logo.wine.svg"
|
||||||
|
/>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex overflow-hidden mt-2 text-md leading-none text-gray-400">
|
<div className="flex overflow-hidden mt-2 text-md leading-none text-gray-400">
|
||||||
<div>Correo eletrónico: info@qsoftec.com</div>
|
<div>Correo eletrónico: info@qsoftec.com</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</Box>
|
</Box>
|
||||||
</Paper>
|
</Paper>
|
||||||
|
|
@ -189,4 +176,4 @@ function SignInPage() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default SignInPage;
|
export default SignInPage;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import Button from '@mui/material/Button';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { Controller, useForm } from 'react-hook-form';
|
import { Controller, useForm } from 'react-hook-form';
|
||||||
import _ from '@lodash';
|
import _ from '@lodash';
|
||||||
import { AxiosError } from 'axios';
|
import axios, { AxiosError } from 'axios';
|
||||||
import FormControl from '@mui/material/FormControl';
|
import FormControl from '@mui/material/FormControl';
|
||||||
import FormControlLabel from '@mui/material/FormControlLabel';
|
import FormControlLabel from '@mui/material/FormControlLabel';
|
||||||
import Checkbox from '@mui/material/Checkbox';
|
import Checkbox from '@mui/material/Checkbox';
|
||||||
|
|
@ -16,7 +16,7 @@ import { zodResolver } from '@hookform/resolvers/zod';
|
||||||
* Form Validation Schema
|
* Form Validation Schema
|
||||||
*/
|
*/
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
email: z.string().email('Debe ingresar un correo válido').nonempty('Debe ingresar un correo'),
|
email: z.string().nonempty('Debe ingresar un correo'),
|
||||||
password: z
|
password: z
|
||||||
.string()
|
.string()
|
||||||
.min(4, 'La contraseña es muy corta, debe ingresar almenos 4 caracteres.')
|
.min(4, 'La contraseña es muy corta, debe ingresar almenos 4 caracteres.')
|
||||||
|
|
@ -47,13 +47,57 @@ function jwtSignInTab() {
|
||||||
const { isValid, dirtyFields, errors } = formState;
|
const { isValid, dirtyFields, errors } = formState;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setValue('email', 'admin@qsoftec.com', { shouldDirty: true, shouldValidate: true });
|
setValue('email', 'andres', { shouldDirty: true, shouldValidate: true });
|
||||||
setValue('password', 'admin', { shouldDirty: true, shouldValidate: true });
|
setValue('password', '1234567Aa', { shouldDirty: true, shouldValidate: true });
|
||||||
}, [setValue]);
|
}, [setValue]);
|
||||||
|
|
||||||
function onSubmit(formData: FormType) {
|
function onSubmit(formData: FormType) {
|
||||||
const { email, password } = formData;
|
const { email, password } = formData;
|
||||||
|
|
||||||
|
/* const data = JSON.stringify({
|
||||||
|
headerIn: {
|
||||||
|
dispositivo: 'WeLaptop',
|
||||||
|
canal: null,
|
||||||
|
medio: null,
|
||||||
|
aplicacion: 'CardControlWeb',
|
||||||
|
tipoTransaccion: '0101001',
|
||||||
|
usuario: 'ADMIN',
|
||||||
|
uuid: '355b8668e50a06cf894e015c850d5bb9dc58a',
|
||||||
|
fechaHora: null,
|
||||||
|
idioma: null,
|
||||||
|
empresa: null,
|
||||||
|
geolocalizacion: '37.4215452, -122.0837541'
|
||||||
|
},
|
||||||
|
bodyIn: {
|
||||||
|
entidad: 'Usuario',
|
||||||
|
tipoConsulta: 1,
|
||||||
|
parametros: {
|
||||||
|
user: 'Nick',
|
||||||
|
password: '21365'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
method: 'post',
|
||||||
|
maxBodyLength: Infinity,
|
||||||
|
url: 'http://services.qsoftec.com:18080/inventario-rs-services-1.0-SNAPSHOT/servicios/autenticacion',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
data
|
||||||
|
};
|
||||||
|
|
||||||
|
axios
|
||||||
|
.request(config)
|
||||||
|
.then((response) => {
|
||||||
|
console.log(response.headers)
|
||||||
|
//console.log(JSON.stringify(response.data));
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
*/
|
||||||
jwtService
|
jwtService
|
||||||
.signIn({
|
.signIn({
|
||||||
email,
|
email,
|
||||||
|
|
@ -97,7 +141,7 @@ function jwtSignInTab() {
|
||||||
className="mb-24"
|
className="mb-24"
|
||||||
label="Correo electrónico"
|
label="Correo electrónico"
|
||||||
autoFocus
|
autoFocus
|
||||||
type="email"
|
// type="email"
|
||||||
error={!!errors.email}
|
error={!!errors.email}
|
||||||
helperText={errors?.email?.message}
|
helperText={errors?.email?.message}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
|
|
|
||||||
|
|
@ -1,148 +1,134 @@
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from '@mui/material/Typography';
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from 'react-router-dom';
|
||||||
import AvatarGroup from "@mui/material/AvatarGroup";
|
import Box from '@mui/material/Box';
|
||||||
import Avatar from "@mui/material/Avatar";
|
import Paper from '@mui/material/Paper';
|
||||||
import Box from "@mui/material/Box";
|
import JwtSignUpTab from './tabs/JwSignUpTab';
|
||||||
import Paper from "@mui/material/Paper";
|
import FormRegister from './formRegister/FormRegister';
|
||||||
import Tabs from "@mui/material/Tabs";
|
|
||||||
import Tab from "@mui/material/Tab";
|
|
||||||
import { useState } from "react";
|
|
||||||
import _ from "../../../@lodash/@lodash";
|
|
||||||
import JwtSignUpTab from "./tabs/JwSignUpTab";
|
|
||||||
import FirebaseSignUpTab from "./tabs/FirebaseSignUpTab";
|
|
||||||
|
|
||||||
const tabs = [
|
|
||||||
{
|
|
||||||
id: "jwt",
|
|
||||||
title: "JWT",
|
|
||||||
logo: "assets/images/logo/jwt.svg",
|
|
||||||
logoClass: "h-40 p-4 bg-black rounded-12",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "firebase",
|
|
||||||
title: "Firebase",
|
|
||||||
logo: "assets/images/logo/firebase.svg",
|
|
||||||
logoClass: "h-40",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The sign up page.
|
* The sign up page.
|
||||||
*/
|
*/
|
||||||
function SignUpPage() {
|
function SignUpPage() {
|
||||||
const [selectedTabId, setSelectedTabId] = useState(tabs[0].id);
|
return (
|
||||||
|
<div className="flex min-w-0 flex-1 flex-col items-center sm:flex-row sm:justify-center md:items-start md:justify-start">
|
||||||
|
<Paper className="h-full w-full px-16 py-8 ltr:border-r-1 rtl:border-l-1 sm:h-auto sm:w-auto sm:rounded-2xl sm:p-48 sm:shadow md:flex md:h-full md:w-1/2 md:items-center md:justify-end md:rounded-none md:p-64 md:shadow-none">
|
||||||
|
<div className="mx-auto w-full max-w-400 sm:mx-0 sm:w-400">
|
||||||
|
<img
|
||||||
|
className="w-36"
|
||||||
|
src="assets/images/logo/logo1.svg"
|
||||||
|
alt="logo"
|
||||||
|
/>
|
||||||
|
|
||||||
function handleSelectTab(id: string) {
|
<Typography className="mt-32 text-3xl font-extrabold leading-tight tracking-tight">
|
||||||
setSelectedTabId(id);
|
Registrarse
|
||||||
}
|
</Typography>
|
||||||
|
<div className="mt-2 flex items-baseline font-medium">
|
||||||
|
<Typography>Ya tienes cuenta?</Typography>
|
||||||
|
<Link
|
||||||
|
className="ml-4"
|
||||||
|
to="/sign-in"
|
||||||
|
>
|
||||||
|
Inicia sesión
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
<FormRegister />
|
||||||
|
{/* <JwtSignUpTab /> */}
|
||||||
|
</div>
|
||||||
|
</Paper>
|
||||||
|
|
||||||
return (
|
<Box
|
||||||
<div className="flex min-w-0 flex-1 flex-col items-center sm:flex-row sm:justify-center md:items-start md:justify-start">
|
className="relative hidden h-full flex-auto items-center justify-center overflow-hidden p-48 md:flex lg:px-112 w-3/5"
|
||||||
<Paper className="h-full w-full px-16 py-8 ltr:border-r-1 rtl:border-l-1 sm:h-auto sm:w-auto sm:rounded-2xl sm:p-48 sm:shadow md:flex md:h-full md:w-1/2 md:items-center md:justify-end md:rounded-none md:p-64 md:shadow-none">
|
sx={{ backgroundColor: 'primary.main' }}
|
||||||
<div className="mx-auto w-full max-w-320 sm:mx-0 sm:w-320">
|
>
|
||||||
<img className="w-48" src="assets/images/logo/logo1.svg" alt="logo" />
|
<svg
|
||||||
|
className="pointer-events-none absolute inset-0"
|
||||||
|
viewBox="0 0 960 540"
|
||||||
|
width="100%"
|
||||||
|
height="100%"
|
||||||
|
preserveAspectRatio="xMidYMax slice"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<Box
|
||||||
|
component="g"
|
||||||
|
sx={{ color: 'primary.light' }}
|
||||||
|
className="opacity-20"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="100"
|
||||||
|
>
|
||||||
|
<circle
|
||||||
|
r="234"
|
||||||
|
cx="796"
|
||||||
|
cy="23"
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
</svg>
|
||||||
|
<Box
|
||||||
|
component="svg"
|
||||||
|
className="absolute -right-64 -top-64 opacity-20"
|
||||||
|
sx={{ color: 'primary.light' }}
|
||||||
|
viewBox="0 0 220 192"
|
||||||
|
width="220px"
|
||||||
|
height="192px"
|
||||||
|
fill="none"
|
||||||
|
>
|
||||||
|
<defs>
|
||||||
|
<pattern
|
||||||
|
id="837c3e70-6c3a-44e6-8854-cc48c737b659"
|
||||||
|
x="0"
|
||||||
|
y="0"
|
||||||
|
width="20"
|
||||||
|
height="20"
|
||||||
|
patternUnits="userSpaceOnUse"
|
||||||
|
>
|
||||||
|
<rect
|
||||||
|
x="0"
|
||||||
|
y="0"
|
||||||
|
width="4"
|
||||||
|
height="4"
|
||||||
|
fill="currentColor"
|
||||||
|
/>
|
||||||
|
</pattern>
|
||||||
|
</defs>
|
||||||
|
<rect
|
||||||
|
width="220"
|
||||||
|
height="192"
|
||||||
|
fill="url(#837c3e70-6c3a-44e6-8854-cc48c737b659)"
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
|
||||||
<Typography className="mt-32 text-4xl font-extrabold leading-tight tracking-tight">
|
<div className="relative z-10 w-full max-w-2xl">
|
||||||
Registrarse
|
<img
|
||||||
</Typography>
|
className="w-216 "
|
||||||
<div className="mt-2 flex items-baseline font-medium">
|
src="assets/images/empresa/logoAlphaWC.svg"
|
||||||
<Typography>Ya tienes cuenta?</Typography>
|
alt="logo"
|
||||||
<Link className="ml-4" to="/sign-in">
|
/>
|
||||||
Inicia sesión
|
<div className="text-3xl font-bold leading-loose text-gray-100">
|
||||||
</Link>
|
<div>Bienvenido al sistema que se encarga de tu facturación electrónica.</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="flex items-center mt-14 text-md leading-none text-gray-400">
|
||||||
<JwtSignUpTab />
|
<div>¿Necesitas ayuda? Comunícate con nosotros.</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="flex overflow-hidden items-center mt-4 text-md leading-none text-gray-400">
|
||||||
</Paper>
|
<div>Soporte técnico: 0967722226</div>
|
||||||
|
<a
|
||||||
<Box
|
aria-label="Chat WhatsApp"
|
||||||
className="relative hidden h-full flex-auto items-center justify-center overflow-hidden p-64 md:flex lg:px-112"
|
href="https://wa.me/967722226/?text=Hola!%20Necesito%20ayuda%20en%20el%20sistema%20de%20facturación"
|
||||||
sx={{ backgroundColor: "primary.main" }}
|
>
|
||||||
>
|
<img
|
||||||
<svg
|
className="w-52"
|
||||||
className="pointer-events-none absolute inset-0"
|
alt="Chat WhatsApp"
|
||||||
viewBox="0 0 960 540"
|
src="assets/images/logo/WhatsApp-Logo.wine.svg"
|
||||||
width="100%"
|
/>
|
||||||
height="100%"
|
</a>
|
||||||
preserveAspectRatio="xMidYMax slice"
|
</div>
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
<div className="flex overflow-hidden mt-2 text-md leading-none text-gray-400">
|
||||||
>
|
<div>Correo eletrónico: info@qsoftec.com</div>
|
||||||
<Box
|
</div>
|
||||||
component="g"
|
</div>
|
||||||
sx={{ color: "primary.light" }}
|
</Box>
|
||||||
className="opacity-20"
|
</div>
|
||||||
fill="none"
|
);
|
||||||
stroke="currentColor"
|
|
||||||
strokeWidth="100"
|
|
||||||
>
|
|
||||||
<circle r="234" cx="796" cy="23" />
|
|
||||||
</Box>
|
|
||||||
</svg>
|
|
||||||
<Box
|
|
||||||
component="svg"
|
|
||||||
className="absolute -right-64 -top-64 opacity-20"
|
|
||||||
sx={{ color: "primary.light" }}
|
|
||||||
viewBox="0 0 220 192"
|
|
||||||
width="220px"
|
|
||||||
height="192px"
|
|
||||||
fill="none"
|
|
||||||
>
|
|
||||||
<defs>
|
|
||||||
<pattern
|
|
||||||
id="837c3e70-6c3a-44e6-8854-cc48c737b659"
|
|
||||||
x="0"
|
|
||||||
y="0"
|
|
||||||
width="20"
|
|
||||||
height="20"
|
|
||||||
patternUnits="userSpaceOnUse"
|
|
||||||
>
|
|
||||||
<rect x="0" y="0" width="4" height="4" fill="currentColor" />
|
|
||||||
</pattern>
|
|
||||||
</defs>
|
|
||||||
<rect
|
|
||||||
width="220"
|
|
||||||
height="192"
|
|
||||||
fill="url(#837c3e70-6c3a-44e6-8854-cc48c737b659)"
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
|
|
||||||
<div className="relative z-10 w-full max-w-2xl">
|
|
||||||
<img
|
|
||||||
className="w-216 "
|
|
||||||
src="assets/images/empresa/logoAlphaWC.svg"
|
|
||||||
alt="logo"
|
|
||||||
/>
|
|
||||||
<div className="text-3xl font-bold leading-loose text-gray-100">
|
|
||||||
<div>
|
|
||||||
Bienvenido al sistema que se encarga de tu facturación
|
|
||||||
electrónica.
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center mt-14 text-md leading-none text-gray-400">
|
|
||||||
<div>¿Necesitas ayuda? Comunícate con nosotros.</div>
|
|
||||||
</div>
|
|
||||||
<div className="flex overflow-hidden items-center mt-4 text-md leading-none text-gray-400">
|
|
||||||
<div>Soporte técnico: 0967722226</div>
|
|
||||||
<a
|
|
||||||
aria-label="Chat WhatsApp"
|
|
||||||
href="https://wa.me/967722226/?text=Hola!%20Necesito%20ayuda%20en%20el%20sistema%20de%20facturación"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
className="w-52"
|
|
||||||
alt="Chat WhatsApp"
|
|
||||||
src="assets/images/logo/WhatsApp-Logo.wine.svg"
|
|
||||||
/>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div className="flex overflow-hidden mt-2 text-md leading-none text-gray-400">
|
|
||||||
<div>Correo eletrónico: info@qsoftec.com</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Box>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default SignUpPage;
|
export default SignUpPage;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
import { useFormik } from 'formik';
|
||||||
|
import * as Yup from 'yup';
|
||||||
|
import { registerUser } from 'src/app/services/user.service';
|
||||||
|
import { SignUpPayload } from './interface';
|
||||||
|
import FormRegisterRender from './FormRegisterRender';
|
||||||
|
|
||||||
|
function FormRegister() {
|
||||||
|
const formik = useFormik<SignUpPayload>({
|
||||||
|
initialValues: {
|
||||||
|
detCodigo: 0,
|
||||||
|
empCodContribuyente: '',
|
||||||
|
empContacto: '',
|
||||||
|
empDescripcion: '',
|
||||||
|
empDireccion: '',
|
||||||
|
empIdentificacion: '',
|
||||||
|
empLlevaContabilidad: '',
|
||||||
|
empMail: '',
|
||||||
|
empNombreComercial: '',
|
||||||
|
empRazonSocial: '',
|
||||||
|
password: '',
|
||||||
|
passwordConfirm: '',
|
||||||
|
usuNombre: '',
|
||||||
|
usuUsuario: '',
|
||||||
|
rolCodigo: 2
|
||||||
|
},
|
||||||
|
validationSchema: Yup.object({
|
||||||
|
usuUsuario: Yup.string().required('Debe ingresar el usuario'),
|
||||||
|
usuNombre: Yup.string().required('Debe ingresar el nombre de usuario'),
|
||||||
|
detCodigo: Yup.number().test('len', 'Debe Seleccionar una opción', (val: number) => val !== 0),
|
||||||
|
empIdentificacion: Yup.string().required('Debe ingresar el número de identificación'),
|
||||||
|
empRazonSocial: Yup.string().required('Debe ingresar la razón social'),
|
||||||
|
empNombreComercial: Yup.string().required('Debe ingresar el nombre comercial'),
|
||||||
|
empContacto: Yup.string().required('Debe ingresar un contacto'),
|
||||||
|
empDireccion: Yup.string().required('Debe ingresar la dirección'),
|
||||||
|
empMail: Yup.string().email('Debe ingresar un correo válido').required('Debe ingresar un correo'),
|
||||||
|
empCodContribuyente: Yup.string().required('Debe ingresar el codigo'),
|
||||||
|
empDescripcion: Yup.string().required('Debe ingresar una descripción'),
|
||||||
|
empLlevaContabilidad: Yup.string().required('Debe seleccionar una opción'),
|
||||||
|
password: Yup.string()
|
||||||
|
.required('Por favor ingrese su contraseña.')
|
||||||
|
.min(4, 'La contraseña es muy corta, debe ingresar almenos 4 caracteres'),
|
||||||
|
passwordConfirm: Yup.string()
|
||||||
|
.oneOf([Yup.ref('password'), null], 'Las contraseñas no coinciden')
|
||||||
|
.required('Campo Obligatorio')
|
||||||
|
}),
|
||||||
|
onSubmit: (value) => {
|
||||||
|
console.log('first');
|
||||||
|
console.log(value);
|
||||||
|
registerUser(value).then((response) => {
|
||||||
|
console.log(response);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return <FormRegisterRender formik={formik} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default FormRegister;
|
||||||
|
|
@ -0,0 +1,298 @@
|
||||||
|
import { FormikProps } from 'formik';
|
||||||
|
import { Button, MenuItem, TextField } from '@mui/material';
|
||||||
|
import { SignUpPayload } from './interface';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
formik: FormikProps<SignUpPayload>;
|
||||||
|
}
|
||||||
|
|
||||||
|
const tipoEmpresa = [
|
||||||
|
{ detCodigo: 1, detNombre: 'Publica' },
|
||||||
|
{ detCodigo: 3, detNombre: 'Privada' }
|
||||||
|
];
|
||||||
|
function FormRegisterRender({ formik }: Props) {
|
||||||
|
return (
|
||||||
|
<form
|
||||||
|
name="registerForm"
|
||||||
|
noValidate
|
||||||
|
className="mt-20 flex w-full flex-col justify-center"
|
||||||
|
onSubmit={formik.handleSubmit}
|
||||||
|
>
|
||||||
|
<TextField
|
||||||
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
|
label="Usuario"
|
||||||
|
type="text"
|
||||||
|
name="usuUsuario"
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
value={formik.values.usuUsuario}
|
||||||
|
onBlur={formik.handleBlur}
|
||||||
|
error={formik.errors.usuUsuario && formik.touched.usuUsuario}
|
||||||
|
helperText={formik.errors.usuUsuario && formik.touched.usuUsuario ? formik.errors.usuUsuario : false}
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
<TextField
|
||||||
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
|
label="Nombre usuario"
|
||||||
|
type="text"
|
||||||
|
name="usuNombre"
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
value={formik.values.usuNombre}
|
||||||
|
onBlur={formik.handleBlur}
|
||||||
|
error={formik.errors.usuNombre && formik.touched.usuNombre}
|
||||||
|
helperText={formik.errors.usuNombre && formik.touched.usuNombre ? formik.errors.usuNombre : false}
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextField
|
||||||
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
|
label="Razón social"
|
||||||
|
type="text"
|
||||||
|
name="empRazonSocial"
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
value={formik.values.empRazonSocial}
|
||||||
|
onBlur={formik.handleBlur}
|
||||||
|
error={formik.errors.empRazonSocial && formik.touched.empRazonSocial}
|
||||||
|
helperText={
|
||||||
|
formik.errors.empRazonSocial && formik.touched.empRazonSocial ? formik.errors.empRazonSocial : false
|
||||||
|
}
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextField
|
||||||
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
|
label="Nombre comercial"
|
||||||
|
type="text"
|
||||||
|
name="empNombreComercial"
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
value={formik.values.empNombreComercial}
|
||||||
|
onBlur={formik.handleBlur}
|
||||||
|
error={formik.errors.empNombreComercial && formik.touched.empNombreComercial}
|
||||||
|
helperText={
|
||||||
|
formik.errors.empNombreComercial && formik.touched.empNombreComercial
|
||||||
|
? formik.errors.empNombreComercial
|
||||||
|
: false
|
||||||
|
}
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextField
|
||||||
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
|
label="Identificacón"
|
||||||
|
type="text"
|
||||||
|
name="empIdentificacion"
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
value={formik.values.empIdentificacion}
|
||||||
|
onBlur={formik.handleBlur}
|
||||||
|
error={formik.errors.empIdentificacion && formik.touched.empIdentificacion}
|
||||||
|
helperText={
|
||||||
|
formik.errors.empIdentificacion && formik.touched.empIdentificacion
|
||||||
|
? formik.errors.empIdentificacion
|
||||||
|
: false
|
||||||
|
}
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextField
|
||||||
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
|
select
|
||||||
|
label="Tipo de empresa"
|
||||||
|
name="detCodigo"
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
value={formik.values.detCodigo}
|
||||||
|
onBlur={formik.handleBlur}
|
||||||
|
error={formik.errors.detCodigo && formik.touched.detCodigo}
|
||||||
|
helperText={formik.errors.detCodigo && formik.touched.detCodigo ? formik.errors.detCodigo : false}
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
|
<MenuItem value={0}>Seleccione..</MenuItem>
|
||||||
|
{tipoEmpresa.map((option) => (
|
||||||
|
<MenuItem
|
||||||
|
key={option.detCodigo}
|
||||||
|
value={option.detCodigo}
|
||||||
|
>
|
||||||
|
{option.detNombre}
|
||||||
|
</MenuItem>
|
||||||
|
))}
|
||||||
|
</TextField>
|
||||||
|
|
||||||
|
<TextField
|
||||||
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
|
label="Contacto"
|
||||||
|
type="text"
|
||||||
|
name="empContacto"
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
value={formik.values.empContacto}
|
||||||
|
onBlur={formik.handleBlur}
|
||||||
|
error={formik.errors.empContacto && formik.touched.empContacto}
|
||||||
|
helperText={formik.errors.empContacto && formik.touched.empContacto ? formik.errors.empContacto : false}
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextField
|
||||||
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
|
label="Dirección"
|
||||||
|
type="text"
|
||||||
|
name="empDireccion"
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
value={formik.values.empDireccion}
|
||||||
|
onBlur={formik.handleBlur}
|
||||||
|
error={formik.errors.empDireccion && formik.touched.empDireccion}
|
||||||
|
helperText={
|
||||||
|
formik.errors.empDireccion && formik.touched.empDireccion ? formik.errors.empDireccion : false
|
||||||
|
}
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextField
|
||||||
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
|
label="Correo electrónico"
|
||||||
|
type="email"
|
||||||
|
name="empMail"
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
value={formik.values.empMail}
|
||||||
|
onBlur={formik.handleBlur}
|
||||||
|
error={formik.errors.empMail && formik.touched.empMail}
|
||||||
|
helperText={formik.errors.empMail && formik.touched.empMail ? formik.errors.empMail : false}
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextField
|
||||||
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
|
label="Codigo de contribuyente"
|
||||||
|
type="text"
|
||||||
|
name="empCodContribuyente"
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
value={formik.values.empCodContribuyente}
|
||||||
|
onBlur={formik.handleBlur}
|
||||||
|
error={formik.errors.empCodContribuyente && formik.touched.empCodContribuyente}
|
||||||
|
helperText={
|
||||||
|
formik.errors.empCodContribuyente && formik.touched.empCodContribuyente
|
||||||
|
? formik.errors.empCodContribuyente
|
||||||
|
: false
|
||||||
|
}
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextField
|
||||||
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
|
label="Descripción"
|
||||||
|
type="text"
|
||||||
|
name="empDescripcion"
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
value={formik.values.empDescripcion}
|
||||||
|
onBlur={formik.handleBlur}
|
||||||
|
error={formik.errors.empDescripcion && formik.touched.empDescripcion}
|
||||||
|
helperText={
|
||||||
|
formik.errors.empDescripcion && formik.touched.empDescripcion ? formik.errors.empDescripcion : false
|
||||||
|
}
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextField
|
||||||
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
|
select
|
||||||
|
label="Lleva la contabilidad"
|
||||||
|
name="empLlevaContabilidad"
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
value={formik.values.empLlevaContabilidad}
|
||||||
|
onBlur={formik.handleBlur}
|
||||||
|
error={formik.errors.empLlevaContabilidad && formik.touched.empLlevaContabilidad}
|
||||||
|
helperText={
|
||||||
|
formik.errors.empLlevaContabilidad && formik.touched.empLlevaContabilidad
|
||||||
|
? formik.errors.empLlevaContabilidad
|
||||||
|
: false
|
||||||
|
}
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
|
<MenuItem value="0">NO</MenuItem>
|
||||||
|
<MenuItem value="1">SI</MenuItem>
|
||||||
|
</TextField>
|
||||||
|
|
||||||
|
<TextField
|
||||||
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
|
label="Contraseña"
|
||||||
|
type="password"
|
||||||
|
name="password"
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
value={formik.values.password}
|
||||||
|
onBlur={formik.handleBlur}
|
||||||
|
error={formik.errors.password && formik.touched.password}
|
||||||
|
helperText={formik.errors.password && formik.touched.password ? formik.errors.password : false}
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextField
|
||||||
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
|
label="Confirmar contraseña"
|
||||||
|
type="password"
|
||||||
|
name="passwordConfirm"
|
||||||
|
onChange={formik.handleChange}
|
||||||
|
value={formik.values.passwordConfirm}
|
||||||
|
onBlur={formik.handleBlur}
|
||||||
|
error={formik.errors.passwordConfirm && formik.touched.passwordConfirm}
|
||||||
|
helperText={
|
||||||
|
formik.errors.passwordConfirm && formik.touched.passwordConfirm
|
||||||
|
? formik.errors.passwordConfirm
|
||||||
|
: false
|
||||||
|
}
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
variant="contained"
|
||||||
|
color="secondary"
|
||||||
|
className="mt-24 w-full col-span-2"
|
||||||
|
aria-label="Register"
|
||||||
|
// disabled={_.isEmpty(dirtyFields)}
|
||||||
|
type="submit"
|
||||||
|
size="large"
|
||||||
|
>
|
||||||
|
Registrarse
|
||||||
|
</Button>
|
||||||
|
</form>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default FormRegisterRender;
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
export interface SignUpPayload {
|
||||||
|
usuUsuario: string;
|
||||||
|
usuNombre: string;
|
||||||
|
detCodigo: number;
|
||||||
|
empIdentificacion: string;
|
||||||
|
empRazonSocial: string;
|
||||||
|
empNombreComercial: string;
|
||||||
|
empContacto: string;
|
||||||
|
empDireccion: string;
|
||||||
|
empMail: string;
|
||||||
|
empCodContribuyente: string | number;
|
||||||
|
empDescripcion: string;
|
||||||
|
empLlevaContabilidad: string | number;
|
||||||
|
password: string;
|
||||||
|
passwordConfirm: string;
|
||||||
|
rolCodigo: number;
|
||||||
|
}
|
||||||
|
|
@ -1,28 +1,40 @@
|
||||||
import { Controller, useForm } from 'react-hook-form';
|
import { Controller, useForm } from 'react-hook-form';
|
||||||
import TextField from '@mui/material/TextField';
|
import TextField from '@mui/material/TextField';
|
||||||
import FormControl from '@mui/material/FormControl';
|
|
||||||
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
||||||
import Checkbox from '@mui/material/Checkbox';
|
|
||||||
import FormHelperText from '@mui/material/FormHelperText';
|
|
||||||
import Button from '@mui/material/Button';
|
import Button from '@mui/material/Button';
|
||||||
import _ from '@lodash';
|
import _ from '@lodash';
|
||||||
import { zodResolver } from '@hookform/resolvers/zod';
|
import { zodResolver } from '@hookform/resolvers/zod';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { SignUpPayload, useAuth } from '../../../auth/AuthRouteProvider';
|
import { MenuItem } from '@mui/material';
|
||||||
|
import { SignUpPayload } from '../../../auth/AuthRouteProvider';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form Validation Schema
|
* Form Validation Schema
|
||||||
*/
|
*/
|
||||||
|
const tipoEmpresa = [
|
||||||
|
{ detCodigo: 1, detNombre: 'Publica' },
|
||||||
|
{ detCodigo: 2, detNombre: 'Privada' }
|
||||||
|
];
|
||||||
|
|
||||||
const schema = z
|
const schema = z
|
||||||
.object({
|
.object({
|
||||||
displayName: z.string().nonempty('Debe ingresar un nombre de usuario'),
|
usuUsuario: z.string().nonempty('Debe ingresar el usuario'),
|
||||||
email: z.string().email('Debe ingresar un correo válido').nonempty('Debe ingresar un correo'),
|
usuNombre: z.string().nonempty('Debe ingresar el nombre de usuario'),
|
||||||
|
detCodigo: z.number().refine((val) => val !== 0, 'Debe Seleccionar una opción'),
|
||||||
|
empIdentificacion: z.string().nonempty('Debe ingresar el número de identificación'),
|
||||||
|
empRazonSocial: z.string().nonempty('Debe ingresar la razón social'),
|
||||||
|
empNombreComercial: z.string().nonempty('Debe ingresar el nombre comercial'),
|
||||||
|
empContacto: z.string().nonempty('Debe ingresar un contacto'),
|
||||||
|
empDireccion: z.string().nonempty('Debe ingresar la dirección'),
|
||||||
|
empMail: z.string().email('Debe ingresar un correo válido').nonempty('Debe ingresar un correo'),
|
||||||
|
empCodContribuyente: z.string().nonempty('Debe ingresar el codigo'),
|
||||||
|
empDescripcion: z.string().nonempty('Debe ingresar una descripción'),
|
||||||
|
empLlevaContabilidad: z.string().nonempty('Debe seleccionar una opción'),
|
||||||
password: z
|
password: z
|
||||||
.string()
|
.string()
|
||||||
.nonempty('Por favor ingrese su contraseña.')
|
.nonempty('Por favor ingrese su contraseña.')
|
||||||
.min(4, 'La contraseña es muy corta, debe ingresar almenos 4 caracteres'),
|
.min(4, 'La contraseña es muy corta, debe ingresar almenos 4 caracteres'),
|
||||||
passwordConfirm: z.string().nonempty('Debe ingresar su contraseña'),
|
passwordConfirm: z.string().nonempty('Debe ingresar su contraseña')
|
||||||
acceptTermsConditions: z.boolean().refine((val) => val === true, 'Debe aceptar los términos y condiciones')
|
// acceptTermsConditions: z.boolean().refine((val) => val === true, 'Debe aceptar los términos y condiciones')
|
||||||
})
|
})
|
||||||
.refine((data) => data.password === data.passwordConfirm, {
|
.refine((data) => data.password === data.passwordConfirm, {
|
||||||
message: 'Contraseñas no coinciden',
|
message: 'Contraseñas no coinciden',
|
||||||
|
|
@ -30,16 +42,24 @@ const schema = z
|
||||||
});
|
});
|
||||||
|
|
||||||
const defaultValues = {
|
const defaultValues = {
|
||||||
displayName: '',
|
usuUsuario: '',
|
||||||
email: '',
|
usuNombre: '',
|
||||||
|
detCodigo: 0,
|
||||||
|
empIdentificacion: '',
|
||||||
|
empRazonSocial: '',
|
||||||
|
empNombreComercial: '',
|
||||||
|
empContacto: '',
|
||||||
|
empDireccion: '',
|
||||||
|
empMail: '',
|
||||||
|
empCodContribuyente: '',
|
||||||
|
empDescripcion: '',
|
||||||
|
empLlevaContabilidad: '',
|
||||||
password: '',
|
password: '',
|
||||||
passwordConfirm: '',
|
passwordConfirm: ''
|
||||||
acceptTermsConditions: false
|
// acceptTermsConditions: false
|
||||||
};
|
};
|
||||||
|
|
||||||
function JwtSignUpTab() {
|
function JwtSignUpTab() {
|
||||||
const { jwtService } = useAuth();
|
|
||||||
|
|
||||||
const { control, formState, handleSubmit, setError } = useForm({
|
const { control, formState, handleSubmit, setError } = useForm({
|
||||||
mode: 'onChange',
|
mode: 'onChange',
|
||||||
defaultValues,
|
defaultValues,
|
||||||
|
|
@ -49,7 +69,8 @@ function JwtSignUpTab() {
|
||||||
const { isValid, dirtyFields, errors } = formState;
|
const { isValid, dirtyFields, errors } = formState;
|
||||||
|
|
||||||
function onSubmit(formData: SignUpPayload) {
|
function onSubmit(formData: SignUpPayload) {
|
||||||
const { displayName, email, password } = formData;
|
console.log(formData);
|
||||||
|
/* const { displayName, email, password } = formData;
|
||||||
jwtService
|
jwtService
|
||||||
.signUp({
|
.signUp({
|
||||||
displayName,
|
displayName,
|
||||||
|
|
@ -63,28 +84,28 @@ function JwtSignUpTab() {
|
||||||
_errors.forEach(({ message, type }) => {
|
_errors.forEach(({ message, type }) => {
|
||||||
setError(type, { type: 'manual', message });
|
setError(type, { type: 'manual', message });
|
||||||
});
|
});
|
||||||
});
|
}); */
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form
|
<form
|
||||||
name="registerForm"
|
name="registerForm"
|
||||||
noValidate
|
noValidate
|
||||||
className="mt-32 flex w-full flex-col justify-center"
|
className="mt-20 flex w-full flex-col justify-center"
|
||||||
onSubmit={handleSubmit(onSubmit)}
|
onSubmit={handleSubmit(onSubmit)}
|
||||||
>
|
>
|
||||||
<Controller
|
<Controller
|
||||||
name="displayName"
|
name="usuUsuario"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<TextField
|
<TextField
|
||||||
{...field}
|
{...field}
|
||||||
className="mb-24"
|
className="mb-10"
|
||||||
label="Nombre de usuario"
|
size="small"
|
||||||
autoFocus
|
label="Usuario"
|
||||||
type="name"
|
type="text"
|
||||||
error={!!errors.displayName}
|
error={!!errors.usuUsuario}
|
||||||
helperText={errors?.displayName?.message}
|
helperText={errors?.usuUsuario?.message}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
required
|
required
|
||||||
fullWidth
|
fullWidth
|
||||||
|
|
@ -93,16 +114,142 @@ function JwtSignUpTab() {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Controller
|
<Controller
|
||||||
name="email"
|
name="usuNombre"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<TextField
|
<TextField
|
||||||
{...field}
|
{...field}
|
||||||
className="mb-24"
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
|
label="Nombre usuario"
|
||||||
|
type="text"
|
||||||
|
error={!!errors.usuNombre}
|
||||||
|
helperText={errors?.usuNombre?.message}
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Controller
|
||||||
|
name="empRazonSocial"
|
||||||
|
control={control}
|
||||||
|
render={({ field }) => (
|
||||||
|
<TextField
|
||||||
|
{...field}
|
||||||
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
|
label="Razón social"
|
||||||
|
autoFocus
|
||||||
|
type="text"
|
||||||
|
error={!!errors.empRazonSocial}
|
||||||
|
helperText={errors?.empRazonSocial?.message}
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Controller
|
||||||
|
name="empNombreComercial"
|
||||||
|
control={control}
|
||||||
|
render={({ field }) => (
|
||||||
|
<TextField
|
||||||
|
{...field}
|
||||||
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
|
label="Nombre comercial"
|
||||||
|
type="text"
|
||||||
|
error={!!errors.empNombreComercial}
|
||||||
|
helperText={errors?.empNombreComercial?.message}
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Controller
|
||||||
|
name="detCodigo"
|
||||||
|
control={control}
|
||||||
|
render={({ field }) => (
|
||||||
|
<TextField
|
||||||
|
{...field}
|
||||||
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
|
select
|
||||||
|
label="Tipo de empresa"
|
||||||
|
error={!!errors.detCodigo}
|
||||||
|
helperText={errors?.detCodigo?.message}
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
|
<MenuItem value={0}>Seleccione..</MenuItem>
|
||||||
|
{tipoEmpresa.map((option) => (
|
||||||
|
<MenuItem
|
||||||
|
key={option.detCodigo}
|
||||||
|
value={option.detCodigo}
|
||||||
|
>
|
||||||
|
{option.detNombre}
|
||||||
|
</MenuItem>
|
||||||
|
))}
|
||||||
|
</TextField>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Controller
|
||||||
|
name="empContacto"
|
||||||
|
control={control}
|
||||||
|
render={({ field }) => (
|
||||||
|
<TextField
|
||||||
|
{...field}
|
||||||
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
|
label="Contacto"
|
||||||
|
type="text"
|
||||||
|
error={!!errors.empContacto}
|
||||||
|
helperText={errors?.empContacto?.message}
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Controller
|
||||||
|
name="empDireccion"
|
||||||
|
control={control}
|
||||||
|
render={({ field }) => (
|
||||||
|
<TextField
|
||||||
|
{...field}
|
||||||
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
|
label="Dirección"
|
||||||
|
type="text"
|
||||||
|
error={!!errors.empDireccion}
|
||||||
|
helperText={errors?.empDireccion?.message}
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Controller
|
||||||
|
name="empMail"
|
||||||
|
control={control}
|
||||||
|
render={({ field }) => (
|
||||||
|
<TextField
|
||||||
|
{...field}
|
||||||
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
label="Correo electrónico"
|
label="Correo electrónico"
|
||||||
type="email"
|
type="email"
|
||||||
error={!!errors.email}
|
error={!!errors.empMail}
|
||||||
helperText={errors?.email?.message}
|
helperText={errors?.empMail?.message}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
required
|
required
|
||||||
fullWidth
|
fullWidth
|
||||||
|
|
@ -110,49 +257,74 @@ function JwtSignUpTab() {
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<Controller
|
||||||
|
name="empCodContribuyente"
|
||||||
|
control={control}
|
||||||
|
render={({ field }) => (
|
||||||
|
<TextField
|
||||||
|
{...field}
|
||||||
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
|
label="Codigo de contribuyente"
|
||||||
|
type="text"
|
||||||
|
error={!!errors.empCodContribuyente}
|
||||||
|
helperText={errors?.empCodContribuyente?.message}
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Controller
|
||||||
|
name="empDescripcion"
|
||||||
|
control={control}
|
||||||
|
render={({ field }) => (
|
||||||
|
<TextField
|
||||||
|
{...field}
|
||||||
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
|
label="Descripción"
|
||||||
|
type="text"
|
||||||
|
error={!!errors.empDescripcion}
|
||||||
|
helperText={errors?.empDescripcion?.message}
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Controller
|
||||||
|
name="empLlevaContabilidad"
|
||||||
|
control={control}
|
||||||
|
render={({ field }) => (
|
||||||
|
<TextField
|
||||||
|
{...field}
|
||||||
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
|
select
|
||||||
|
label="Lleva la contabilidad"
|
||||||
|
error={!!errors.empLlevaContabilidad}
|
||||||
|
helperText={errors?.empLlevaContabilidad?.message}
|
||||||
|
variant="outlined"
|
||||||
|
required
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
|
<MenuItem value="0">NO</MenuItem>
|
||||||
|
<MenuItem value="1">SI</MenuItem>
|
||||||
|
</TextField>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
<Controller
|
<Controller
|
||||||
name="password"
|
name="password"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<TextField
|
<TextField
|
||||||
{...field}
|
{...field}
|
||||||
className="mb-24"
|
className="mb-10"
|
||||||
label="Contraseña"
|
size="small"
|
||||||
type="password"
|
|
||||||
error={!!errors.password}
|
|
||||||
helperText={errors?.password?.message}
|
|
||||||
variant="outlined"
|
|
||||||
required
|
|
||||||
fullWidth
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Controller
|
|
||||||
name="password"
|
|
||||||
control={control}
|
|
||||||
render={({ field }) => (
|
|
||||||
<TextField
|
|
||||||
{...field}
|
|
||||||
className="mb-24"
|
|
||||||
label="Contraseña"
|
|
||||||
type="password"
|
|
||||||
error={!!errors.password}
|
|
||||||
helperText={errors?.password?.message}
|
|
||||||
variant="outlined"
|
|
||||||
required
|
|
||||||
fullWidth
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Controller
|
|
||||||
name="password"
|
|
||||||
control={control}
|
|
||||||
render={({ field }) => (
|
|
||||||
<TextField
|
|
||||||
{...field}
|
|
||||||
className="mb-24"
|
|
||||||
label="Contraseña"
|
label="Contraseña"
|
||||||
type="password"
|
type="password"
|
||||||
error={!!errors.password}
|
error={!!errors.password}
|
||||||
|
|
@ -170,7 +342,8 @@ function JwtSignUpTab() {
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<TextField
|
<TextField
|
||||||
{...field}
|
{...field}
|
||||||
className="mb-24"
|
className="mb-10"
|
||||||
|
size="small"
|
||||||
label="Confirmar contraseña"
|
label="Confirmar contraseña"
|
||||||
type="password"
|
type="password"
|
||||||
error={!!errors.passwordConfirm}
|
error={!!errors.passwordConfirm}
|
||||||
|
|
@ -182,12 +355,12 @@ function JwtSignUpTab() {
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Controller
|
{/* <Controller
|
||||||
name="acceptTermsConditions"
|
name="acceptTermsConditions"
|
||||||
control={control}
|
control={control}
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormControl
|
<FormControl
|
||||||
className="items-center"
|
className="items-center col-span-2"
|
||||||
error={!!errors.acceptTermsConditions}
|
error={!!errors.acceptTermsConditions}
|
||||||
>
|
>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
|
|
@ -202,14 +375,14 @@ function JwtSignUpTab() {
|
||||||
<FormHelperText>{errors?.acceptTermsConditions?.message}</FormHelperText>
|
<FormHelperText>{errors?.acceptTermsConditions?.message}</FormHelperText>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
)}
|
)}
|
||||||
/>
|
/> */}
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
className="mt-24 w-full"
|
className="mt-24 w-full col-span-2"
|
||||||
aria-label="Register"
|
aria-label="Register"
|
||||||
disabled={_.isEmpty(dirtyFields) || !isValid}
|
disabled={_.isEmpty(dirtyFields)}
|
||||||
type="submit"
|
type="submit"
|
||||||
size="large"
|
size="large"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,177 @@
|
||||||
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||||
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||||
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
|
// import { dispatch } from 'app/store/store';
|
||||||
|
|
||||||
|
import config from 'app/configs/enviroment';
|
||||||
|
// import { displayError } from '../notifications/displayMessage';
|
||||||
|
// import { displayMessage } from 'notifications/displayMessage';
|
||||||
|
// import { logout } from 'store/reducers/auth/auth';
|
||||||
|
|
||||||
|
// eslint-disable-next-line consistent-return
|
||||||
|
const post = (endpoint, body, transId) => {
|
||||||
|
const trama = {
|
||||||
|
headerIn: headerIn(transId),
|
||||||
|
bodyIn: body
|
||||||
|
};
|
||||||
|
const requestOptions = {
|
||||||
|
method: 'POST',
|
||||||
|
headers: header(),
|
||||||
|
body: JSON.stringify(trama),
|
||||||
|
redirect: 'follow'
|
||||||
|
};
|
||||||
|
const apiEndpoints = config.api + endpoint;
|
||||||
|
try {
|
||||||
|
return fetch(apiEndpoints, requestOptions).then(handleResponse);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const postMultipart = (endpoint, body, transId, files) => {
|
||||||
|
const trama = {
|
||||||
|
headerIn: headerIn(transId),
|
||||||
|
bodyIn: body
|
||||||
|
};
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append('0', JSON.stringify(trama));
|
||||||
|
if (files.length > 0) {
|
||||||
|
files.map((file, index) => {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||||
|
formData.append(index + 1, file);
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const requestOptions = {
|
||||||
|
method: 'POST',
|
||||||
|
headers: headerM(),
|
||||||
|
body: formData
|
||||||
|
};
|
||||||
|
|
||||||
|
const apiEndpoints = config.api + endpoint;
|
||||||
|
|
||||||
|
return fetch(apiEndpoints, requestOptions).then(handleResponse);
|
||||||
|
};
|
||||||
|
|
||||||
|
const header = () => {
|
||||||
|
const token = localStorage.getItem('token');
|
||||||
|
const myHeaders = new Headers();
|
||||||
|
// eslint-disable-next-line no-unused-expressions
|
||||||
|
token && myHeaders.append('Authorization', `${token}`);
|
||||||
|
myHeaders.append('Content-Type', 'application/json');
|
||||||
|
return myHeaders;
|
||||||
|
};
|
||||||
|
|
||||||
|
const headerM = () => {
|
||||||
|
const token = localStorage.getItem('token');
|
||||||
|
const myHeaders = new Headers();
|
||||||
|
// eslint-disable-next-line no-unused-expressions
|
||||||
|
token && myHeaders.append('Authorization', `${token}`);
|
||||||
|
// myHeaders.append("Content-Type", "application/json");
|
||||||
|
return myHeaders;
|
||||||
|
};
|
||||||
|
|
||||||
|
const headerIn = (transId) => {
|
||||||
|
const user = JSON.parse(localStorage.getItem('user'));
|
||||||
|
const { headerIn } = config;
|
||||||
|
headerIn.tipoTransaccion = transId;
|
||||||
|
if (user) {
|
||||||
|
// headerIn.usuario = user.usuario;
|
||||||
|
headerIn.usuario = user.usercode;
|
||||||
|
} else {
|
||||||
|
headerIn.usuario = 'user-no';
|
||||||
|
}
|
||||||
|
|
||||||
|
return headerIn;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleResponse = (response) => {
|
||||||
|
response.headers.forEach((item,i) => {
|
||||||
|
console.log(item,i)
|
||||||
|
})
|
||||||
|
if (response.status === 401) {
|
||||||
|
localStorage.removeItem('user');
|
||||||
|
localStorage.removeItem('token');
|
||||||
|
// return dispatch(logout());
|
||||||
|
}
|
||||||
|
if (!response.ok) {
|
||||||
|
messageStatusCode(response.clone());
|
||||||
|
throw response;
|
||||||
|
} else {
|
||||||
|
let isBlod = false;
|
||||||
|
let isHtml = false;
|
||||||
|
response.headers.forEach((val, key) => {
|
||||||
|
if (key === 'content-disposition') isBlod = true;
|
||||||
|
|
||||||
|
if (val.indexOf('text/html') !== -1) isHtml = true;
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||||
|
if (key === 'authorization') localStorage.setItem('accessToken', val);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (isBlod || isHtml) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
messageStatusCode(response.clone());
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||||
|
return response.json().then((data) => data);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function messageStatusCode(response) {
|
||||||
|
const code = response.status;
|
||||||
|
let error = false;
|
||||||
|
// eslint-disable-next-line default-case
|
||||||
|
switch (code) {
|
||||||
|
case 200:
|
||||||
|
response.json().then((data) => {
|
||||||
|
if (data.error && data.error.codigo !== '0') {
|
||||||
|
if (data.error.mensaje) {
|
||||||
|
// "ERROR NO CONTROLADO:
|
||||||
|
if (data.error.mensaje.includes('com.stripe.exception.CardException')) {
|
||||||
|
if (data.error.mensaje.includes('Your card has insufficient funds.; code: card_declined')) {
|
||||||
|
// displayError('La transacción no se pudo realizar, fondos insuficientes');
|
||||||
|
} else if (data.error.mensaje.includes('This transaction requires authentication.')) {
|
||||||
|
// displayError('La transacción no se pudo realizar, su tarjeta requiere autentificación');
|
||||||
|
} else {
|
||||||
|
// displayMessage('error', `Error ${data.error.mensaje}`);
|
||||||
|
// displayError(`Error ${data.error.mensaje}`);
|
||||||
|
}
|
||||||
|
} else if (data.error.codigo !== '1002') {
|
||||||
|
// displayMessage('error', data.error.mensaje);
|
||||||
|
// displayError(data.error.mensaje);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 502:
|
||||||
|
error = true;
|
||||||
|
// displayMessage('error', 'Conexión rechazada');
|
||||||
|
// displayError('Connection refused');
|
||||||
|
break;
|
||||||
|
case 500:
|
||||||
|
error = true;
|
||||||
|
// displayError('Internal Error Server');
|
||||||
|
response.json().then((data) => {
|
||||||
|
console.error('sdfsdfsdfds', data);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 405:
|
||||||
|
error = true;
|
||||||
|
// displayError('Failed to load resource');
|
||||||
|
break;
|
||||||
|
case 404:
|
||||||
|
error = true;
|
||||||
|
// displayError('Page not Found');
|
||||||
|
break;
|
||||||
|
case 401:
|
||||||
|
error = true;
|
||||||
|
// displayError('Cierre sesión, su sesión a caducado');
|
||||||
|
}
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
export { post, postMultipart };
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
import { post } from './dataServices';
|
||||||
|
|
||||||
|
export interface RegisterUser {
|
||||||
|
usuUsuario: string;
|
||||||
|
usuNombre: string;
|
||||||
|
usuDescripcion?: string;
|
||||||
|
usuUrlImagen?: string;
|
||||||
|
detCodigo: number;
|
||||||
|
rolCodigo?: number;
|
||||||
|
empIdentificacion: string;
|
||||||
|
empRazonSocial: string;
|
||||||
|
empNombreComercial: string;
|
||||||
|
empContacto: string;
|
||||||
|
empDireccion: string;
|
||||||
|
empMail: string;
|
||||||
|
empCodContribuyente: string | number;
|
||||||
|
empDescripcion: string;
|
||||||
|
empLlevaContabilidad: number | string;
|
||||||
|
password: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const loginIn = (username: string, password: string) => {
|
||||||
|
const body = {
|
||||||
|
tipoConsulta: 1,
|
||||||
|
entidad: 'Usuario',
|
||||||
|
parametros: {
|
||||||
|
user: username,
|
||||||
|
password
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const endpoint = '/autenticacion';
|
||||||
|
return post(endpoint, body, '0101001');
|
||||||
|
};
|
||||||
|
|
||||||
|
export const registerUser = (data: RegisterUser) => {
|
||||||
|
const body = {
|
||||||
|
tipoAccion: 1,
|
||||||
|
entidad: 'Usuario',
|
||||||
|
entidades: [data]
|
||||||
|
};
|
||||||
|
const endpoint = '/accion';
|
||||||
|
return post(endpoint, body, '0101012');
|
||||||
|
};
|
||||||
|
|
@ -27,7 +27,9 @@ export const addAppMiddleware = dynamicInstance.addMiddleware.withTypes<Config>(
|
||||||
const middlewares: Middleware[] = [apiService.middleware, dynamicMiddleware];
|
const middlewares: Middleware[] = [apiService.middleware, dynamicMiddleware];
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
const logger = createLogger({ collapsed: (getState, action, logEntry) => (logEntry ? !logEntry.error : true) });
|
const logger = createLogger({
|
||||||
|
collapsed: (getState, action, logEntry) => (logEntry ? !logEntry.error : true)
|
||||||
|
});
|
||||||
middlewares.push(logger);
|
middlewares.push(logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -61,6 +63,7 @@ export function configureAppStore(initialState?: RootState) {
|
||||||
const store = configureStore({
|
const store = configureStore({
|
||||||
reducer: rootReducer,
|
reducer: rootReducer,
|
||||||
preloadedState: initialState,
|
preloadedState: initialState,
|
||||||
|
devTools: true,
|
||||||
middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(middlewares)
|
middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(middlewares)
|
||||||
}) as Store<RootState>;
|
}) as Store<RootState>;
|
||||||
|
|
||||||
|
|
@ -108,4 +111,6 @@ export const withAppMiddleware = dynamicInstance.withMiddleware.withTypes<Config
|
||||||
|
|
||||||
const store = configureAppStore();
|
const store = configureAppStore();
|
||||||
|
|
||||||
export default store;
|
const { dispatch } = store;
|
||||||
|
|
||||||
|
export {store, dispatch};
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import { useMemo } from 'react';
|
||||||
import { Provider } from 'react-redux';
|
import { Provider } from 'react-redux';
|
||||||
import ErrorBoundary from '@fuse/utils/ErrorBoundary';
|
import ErrorBoundary from '@fuse/utils/ErrorBoundary';
|
||||||
import AppContext from './AppContext';
|
import AppContext from './AppContext';
|
||||||
import store from './store/store';
|
import { store } from './store/store';
|
||||||
|
|
||||||
type ComponentProps = {
|
type ComponentProps = {
|
||||||
name?: string;
|
name?: string;
|
||||||
|
|
|
||||||
|
|
@ -8872,6 +8872,11 @@ util@0.12.5:
|
||||||
is-typed-array "^1.1.3"
|
is-typed-array "^1.1.3"
|
||||||
which-typed-array "^1.1.2"
|
which-typed-array "^1.1.2"
|
||||||
|
|
||||||
|
uuid@^9.0.1:
|
||||||
|
version "9.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30"
|
||||||
|
integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==
|
||||||
|
|
||||||
v8-compile-cache-lib@^3.0.1:
|
v8-compile-cache-lib@^3.0.1:
|
||||||
version "3.0.1"
|
version "3.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf"
|
resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue