diff --git a/src/@fuse/default-settings/FuseDefaultSettings.ts b/src/@fuse/default-settings/FuseDefaultSettings.ts index 56396bd..1975441 100644 --- a/src/@fuse/default-settings/FuseDefaultSettings.ts +++ b/src/@fuse/default-settings/FuseDefaultSettings.ts @@ -171,7 +171,8 @@ export const defaultThemeOptions = { MuiDialog: { styleOverrides: { paper: { - borderRadius: 16 + borderRadius: 10, + padding: 5 } } }, diff --git a/src/app/main/invoice/generateInvoice/GenerateInvoice.tsx b/src/app/main/invoice/generateInvoice/GenerateInvoice.tsx index 4bdfacf..b357dc1 100644 --- a/src/app/main/invoice/generateInvoice/GenerateInvoice.tsx +++ b/src/app/main/invoice/generateInvoice/GenerateInvoice.tsx @@ -1,10 +1,7 @@ -import React from 'react' -import GenerateInvoiceRender from './GenerateInvoiceRender' +import GenerateInvoiceRender from './GenerateInvoiceRender'; -const GenerateInvoice = () => { - return ( - - ) +function GenerateInvoice() { + return ; } -export default GenerateInvoice \ No newline at end of file +export default GenerateInvoice; diff --git a/src/app/main/invoice/generateInvoice/GenerateInvoiceRender.tsx b/src/app/main/invoice/generateInvoice/GenerateInvoiceRender.tsx index 396056b..23f8b72 100644 --- a/src/app/main/invoice/generateInvoice/GenerateInvoiceRender.tsx +++ b/src/app/main/invoice/generateInvoice/GenerateInvoiceRender.tsx @@ -1,103 +1,33 @@ -import FusePageCarded from "@fuse/core/FusePageCarded"; -import FusePageSimple from "@fuse/core/FusePageSimple"; -import { - Autocomplete, - Card, - CardActions, - CardContent, - CardHeader, - Divider, - TextField, - styled, - Button, - Grid, - Box, -} from "@mui/material"; -import { Controller, useFormContext } from "react-hook-form"; -import DataInvoice from "./components/dataInvoice/DataInvoice"; -import DataClient from "./components/dataClient/DataClient"; +import { Card, CardActions, CardContent, CardHeader, Divider, Button } from '@mui/material'; +import DataInvoice from './components/dataInvoice/DataInvoice'; +import DataClient from './components/dataClient/DataClient'; +import DataTransmitter from './components/dataTransmitter/DataTransmitter'; -const Root = styled(FusePageSimple)(({ theme }) => ({ - "& .FusePageSimple-header": { - backgroundColor: theme.palette.background.paper, - boxShadow: `inset 0 0 0 1px ${theme.palette.divider}`, - }, -})); - -const GenerateInvoiceRender = () => { - return ( - - - - - - - - - - - - - - - { - onChange(newValue); - }} */ - renderInput={(params) => ( - - )} - /> - - - - - - Guardar{" "} - - - - ); -}; +function GenerateInvoiceRender() { + return ( + + + + + + + + + + + Guardar{' '} + + + + ); +} export default GenerateInvoiceRender; diff --git a/src/app/main/invoice/generateInvoice/components/dataClient/DataClient.tsx b/src/app/main/invoice/generateInvoice/components/dataClient/DataClient.tsx index d38c5b5..91ee81b 100644 --- a/src/app/main/invoice/generateInvoice/components/dataClient/DataClient.tsx +++ b/src/app/main/invoice/generateInvoice/components/dataClient/DataClient.tsx @@ -1,69 +1,30 @@ -import { - Autocomplete, - Box, - Divider, - Grid, - TextField, - Typography, -} from "@mui/material"; +import { useState } from 'react'; +import DataClientRender from './DataClientRender'; +import { Client } from './DataClientInterfaz'; -const DataClient = () => { - return ( - - - Datos cliente - - - - - { - onChange(newValue); - }} */ - renderInput={(params) => ( - - )} - /> - - +const clientes = [ + { + id: 1, + nombreComercial: 'Andres Alvarez', + razonSocial: 'Andres Alvarez', + identificacion: '1721529707', + direccion: 'Calle oe', + telefono: '0988545102', + correo: 'andres@test.com' + } +]; +function DataClient() { + const [clients, setClients] = useState(clientes); - - - - Razón Social: Jonathan Andres Alvarez Flores - - - Nombre Comercial: Jonathan Andres Alvarez Flores - - - Ruc: 17215785512001 - - - - Dirección: Calle Oe11g y s32 - - - Teléfono: 0988545211 - - - Correo: admin@qsoftec.com - - - - ); -}; + const handleSelectClient = (value) => { + setClients([...clients, value]); + }; + return ( + + ); +} export default DataClient; diff --git a/src/app/main/invoice/generateInvoice/components/dataClient/DataClientInterfaz.ts b/src/app/main/invoice/generateInvoice/components/dataClient/DataClientInterfaz.ts new file mode 100644 index 0000000..903e2c5 --- /dev/null +++ b/src/app/main/invoice/generateInvoice/components/dataClient/DataClientInterfaz.ts @@ -0,0 +1,9 @@ +export interface Client { + id: number; + nombreComercial: string; + razonSocial: string; + identificacion: string; + direccion: string; + telefono: string; + correo: string; +} diff --git a/src/app/main/invoice/generateInvoice/components/dataClient/DataClientRender.tsx b/src/app/main/invoice/generateInvoice/components/dataClient/DataClientRender.tsx new file mode 100644 index 0000000..ad18734 --- /dev/null +++ b/src/app/main/invoice/generateInvoice/components/dataClient/DataClientRender.tsx @@ -0,0 +1,148 @@ +import { useState } from 'react'; +import FuseSvgIcon from '@fuse/core/FuseSvgIcon'; +import { Autocomplete, Box, Divider, Grid, TextField, Typography, Button } from '@mui/material'; +import AddClient from './components/addClient/AddClient'; +import { Client } from './DataClientInterfaz'; + +interface Props { + client: Client[]; + handleSelectClient: (value: Client) => void; +} +function DataClientRender({ client, handleSelectClient }: Props) { + const [openDialog, setOpenDialog] = useState(false); + return ( + + + + + + Datos cliente + + + + setOpenDialog(true)} + startIcon={ + + heroicons-outline:plus + + } + > + Agregar{' '} + + + + + + + option.razonSocial} + noOptionsText="No se encontro un resultado" + size="small" + /* value={value } + onChange={(event, newValue) => { + onChange(newValue); + }} */ + renderInput={(params) => ( + + )} + /> + + + + + + Razón Social: Jonathan Andres Alvarez Flores + + + Nombre Comercial: Jonathan Andres Alvarez Flores + + + Ruc: 17215785512001 + + + + Dirección: Calle Oe11g y s32 + + + Teléfono: 0988545211 + + + Correo: admin@qsoftec.com + + + + ); +} + +export default DataClientRender; diff --git a/src/app/main/invoice/generateInvoice/components/dataClient/components/addClient/AddClient.tsx b/src/app/main/invoice/generateInvoice/components/dataClient/components/addClient/AddClient.tsx new file mode 100644 index 0000000..087b3e3 --- /dev/null +++ b/src/app/main/invoice/generateInvoice/components/dataClient/components/addClient/AddClient.tsx @@ -0,0 +1,16 @@ +import AddClientRender from './AddClientRender'; + +interface Props { + open: boolean; + setOpen: (open: boolean) => void; +} +function AddClient({ open, setOpen }: Props) { + return ( + + ); +} + +export default AddClient; diff --git a/src/app/main/invoice/generateInvoice/components/dataClient/components/addClient/AddClientRender.tsx b/src/app/main/invoice/generateInvoice/components/dataClient/components/addClient/AddClientRender.tsx new file mode 100644 index 0000000..1946b2a --- /dev/null +++ b/src/app/main/invoice/generateInvoice/components/dataClient/components/addClient/AddClientRender.tsx @@ -0,0 +1,118 @@ +import { DialogActions, DialogContent, DialogTitle, Button, Grid, TextField, Dialog } from '@mui/material'; + +interface Props { + open: boolean; + setOpen: (open: boolean) => void; +} +function AddClientRender({ open, setOpen }: Props) { + return ( + + Agregar Cliente + + + + + + + + + + + + + + + + + + + + + + + + setOpen(false)} + color="primary" + variant="contained" + size="small" + > + Cancelar + + setOpen(false)} + color="primary" + autoFocus + variant="contained" + size="small" + > + Aceptar + + + + ); +} + +export default AddClientRender; diff --git a/src/app/main/invoice/generateInvoice/components/dataInvoice/DataInvoice.tsx b/src/app/main/invoice/generateInvoice/components/dataInvoice/DataInvoice.tsx index 73d72b4..443f563 100644 --- a/src/app/main/invoice/generateInvoice/components/dataInvoice/DataInvoice.tsx +++ b/src/app/main/invoice/generateInvoice/components/dataInvoice/DataInvoice.tsx @@ -1,35 +1,28 @@ -import { Box, Grid, Typography, Divider } from "@mui/material"; +import { useState } from 'react'; +import DataInvoiceRender from './DataInvoiceRender'; +import { ItemInvoice } from './DataInvoiceInterface'; -const DataInvoice = () => { - return ( - - - Datos emisor - - - - - Razón Social: Jonathan Andres Alvarez Flores - - - Nombre Comercial: Jonathan Andres Alvarez Flores - - - Ruc: 17215785512001 - +function DataInvoice() { + const [items, setItems] = useState>(); - - Dirección: Calle Oe11g y s32 - - - Contribuyente Especial: NO - - - Obligado Contabilidad: NO - - - - ); -}; + const handleAddItem = () => { + const newItems: ItemInvoice = { + cod: '', + description: '', + amount: 0, + iva: true, + unitValue: 1, + total: 0 + }; + setItems([...items, newItems]); + }; + + return ( + + ); +} export default DataInvoice; diff --git a/src/app/main/invoice/generateInvoice/components/dataInvoice/DataInvoiceInterface.ts b/src/app/main/invoice/generateInvoice/components/dataInvoice/DataInvoiceInterface.ts new file mode 100644 index 0000000..f0eeadf --- /dev/null +++ b/src/app/main/invoice/generateInvoice/components/dataInvoice/DataInvoiceInterface.ts @@ -0,0 +1,14 @@ +export interface Headers { + id: number; + name: string; + style?: string | number; +} + +export interface ItemInvoice { + cod: string; + description: string; + amount: number; + unitValue: number; + iva: boolean; + total: number; +} diff --git a/src/app/main/invoice/generateInvoice/components/dataInvoice/DataInvoiceRender.tsx b/src/app/main/invoice/generateInvoice/components/dataInvoice/DataInvoiceRender.tsx new file mode 100644 index 0000000..a69ffcf --- /dev/null +++ b/src/app/main/invoice/generateInvoice/components/dataInvoice/DataInvoiceRender.tsx @@ -0,0 +1,106 @@ +import { Box, Grid, Typography, Divider, Button } from '@mui/material'; +import FuseSvgIcon from '@fuse/core/FuseSvgIcon'; +import TableInvoice from './components/tableInvoice/TableInvoice'; +import { ItemInvoice } from './DataInvoiceInterface'; + +interface Props { + handleAddItem: () => void; + items: ItemInvoice[]; +} +function DataInvoiceRender({ handleAddItem, items }: Props) { + return ( + + + + + Datos factura + + + + + heroicons-outline:plus + + } + > + Agregar{' '} + + + + + + + + + + + + + + Sub Total: + + + + + $10 + + + + + ); +} + +export default DataInvoiceRender; diff --git a/src/app/main/invoice/generateInvoice/components/dataInvoice/components/tableInvoice/TableInvoice.tsx b/src/app/main/invoice/generateInvoice/components/dataInvoice/components/tableInvoice/TableInvoice.tsx new file mode 100644 index 0000000..c880aed --- /dev/null +++ b/src/app/main/invoice/generateInvoice/components/dataInvoice/components/tableInvoice/TableInvoice.tsx @@ -0,0 +1,17 @@ +import { Headers } from '../../DataInvoiceInterface'; +import TableInvoiceRender from './TableInvoiceRender'; + +function TableInvoice() { + const headers: Array = [ + { id: 1, name: 'Código', style: 100 }, + { id: 2, name: 'Descripción', style: 400 }, + { id: 3, name: 'Cantidad', style: 130 }, + { id: 4, name: 'Valor unitario', style: 130 }, + { id: 5, name: 'Iva', style: 10 }, + { id: 6, name: 'Total', style: 130 }, + { id: 7, name: 'Acción', style: 10 } + ]; + return ; +} + +export default TableInvoice; diff --git a/src/app/main/invoice/generateInvoice/components/dataInvoice/components/tableInvoice/TableInvoiceRender.tsx b/src/app/main/invoice/generateInvoice/components/dataInvoice/components/tableInvoice/TableInvoiceRender.tsx new file mode 100644 index 0000000..68fd7f6 --- /dev/null +++ b/src/app/main/invoice/generateInvoice/components/dataInvoice/components/tableInvoice/TableInvoiceRender.tsx @@ -0,0 +1,136 @@ +import { + Table, + TableCell, + TableHead, + Typography, + TableRow, + TableBody, + TextField, + Autocomplete, + Checkbox +} from '@mui/material'; +import IconButton from '@mui/material/IconButton'; +import FuseSvgIcon from '@fuse/core/FuseSvgIcon'; +import { Headers } from '../../DataInvoiceInterface'; + +interface Props { + headers: Headers[]; +} +function TableInvoiceRender({ headers }: Props) { + return ( + + + + + {headers.map((column) => ( + + + {column.name} + + + ))} + + + + + + + + + { + onChange(newValue); + }} */ + renderInput={(params) => ( + + )} + /> + + + + + + + + + + + + + + + + heroicons-outline:trash + + + + + + + ); +} + +export default TableInvoiceRender; diff --git a/src/app/main/invoice/generateInvoice/components/dataTransmitter/DataTransmitter.tsx b/src/app/main/invoice/generateInvoice/components/dataTransmitter/DataTransmitter.tsx new file mode 100644 index 0000000..679cfd4 --- /dev/null +++ b/src/app/main/invoice/generateInvoice/components/dataTransmitter/DataTransmitter.tsx @@ -0,0 +1,65 @@ +import { Box, Grid, Typography, Divider } from '@mui/material'; + +function DataTransmitter() { + return ( + + + Datos emisor + + + + + Razón Social: Jonathan Andres Alvarez Flores + + + Nombre Comercial: Jonathan Andres Alvarez Flores + + + Ruc: 17215785512001 + + + + Dirección: Calle Oe11g y s32 + + + Contribuyente Especial: NO + + + Obligado Contabilidad: NO + + + + ); +} + +export default DataTransmitter; diff --git a/src/app/main/invoice/listInvoice/ListInvoiceRender.tsx b/src/app/main/invoice/listInvoice/ListInvoiceRender.tsx index 3f5114d..3a48051 100644 --- a/src/app/main/invoice/listInvoice/ListInvoiceRender.tsx +++ b/src/app/main/invoice/listInvoice/ListInvoiceRender.tsx @@ -1,257 +1,265 @@ -import FusePageSimple from "@fuse/core/FusePageSimple"; -import FuseSvgIcon from "@fuse/core/FuseSvgIcon"; -import { - Button, - Paper, - Table, - TableBody, - TableCell, - TableHead, - TableRow, - Typography, - styled, -} from "@mui/material"; -import clsx from "clsx"; -import { format } from "date-fns"; -import { useTranslation } from "react-i18next"; -import { Link } from "react-router-dom"; +import FusePageSimple from '@fuse/core/FusePageSimple'; +import FuseSvgIcon from '@fuse/core/FuseSvgIcon'; +import { Button, Paper, Table, TableBody, TableCell, TableHead, TableRow, Typography, styled } from '@mui/material'; +import clsx from 'clsx'; +import { format } from 'date-fns'; +import { useTranslation } from 'react-i18next'; +import { Link } from 'react-router-dom'; const Root = styled(FusePageSimple)(({ theme }) => ({ - "& .FusePageSimple-header": { - backgroundColor: theme.palette.background.paper, - boxShadow: `inset 0 0 0 1px ${theme.palette.divider}`, - }, + '& .FusePageSimple-header': { + backgroundColor: theme.palette.background.paper, + boxShadow: `inset 0 0 0 1px ${theme.palette.divider}` + } })); -const ListInvoiceRender = () => { - const { t } = useTranslation("invoicePage"); - const columns = [ - "Número factura", - "Fecha", - "Cliente", - "Identificación", - "Valor", - "Estado", - "Acciones", - ]; +function ListInvoiceRender() { + const { t } = useTranslation('invoicePage'); + const columns = ['Número factura', 'Fecha', 'Cliente', 'Identificación', 'Valor', 'Estado', 'Acciones']; - const rows = [ - { - id: "528651571NT", - date: "2019-10-07T22:22:37.274Z", - name: "Morgan Page", - identification: "17215896114", - amount: 1358.75, - status: "completed", - action: true, - }, - { - id: "421436904YT", - date: "2019-12-18T14:51:24.461Z", - name: "Nita Hebert", - identification: "17215896114", - amount: -1042.82, - status: "completed", - action: true, - }, - { - id: "685377421YT", - date: "2019-12-25T17:52:14.304Z", - name: "Marsha Chambers", - identification: "17215896114", - amount: 1828.16, - status: "pending", - action: true, - }, - { - id: "884960091RT", - date: "2019-11-29T06:32:16.111Z", - name: "Charmaine Jackson", - identification: "17215896114", - amount: 1647.55, - status: "completed", - action: true, - }, - { - id: "361402213NT", - date: "2019-11-24T12:13:23.064Z", - name: "Maura Carey", - identification: "17215896114", - amount: -927.43, - status: "completed", - action: true, - }, - { - id: "361402213NT", - date: "2019-11-24T12:13:23.064Z", - name: "Maura Carey", - identification: "17215896114", - amount: -927.43, - status: "completed", - action: true, - }, - { - id: "361402213NT", - date: "2019-11-24T12:13:23.064Z", - name: "Maura Carey", - identification: "17215896114", - amount: -927.43, - status: "completed", - action: true, - }, - { - id: "361402213NT", - date: "2019-11-24T12:13:23.064Z", - name: "Maura Carey", - identification: "17215896114", - amount: -927.43, - status: "completed", - action: true, - }, - ]; + const rows = [ + { + id: '528651571NT', + date: '2019-10-07T22:22:37.274Z', + name: 'Morgan Page', + identification: '17215896114', + amount: 1358.75, + status: 'completed', + action: true + }, + { + id: '421436904YT', + date: '2019-12-18T14:51:24.461Z', + name: 'Nita Hebert', + identification: '17215896114', + amount: -1042.82, + status: 'completed', + action: true + }, + { + id: '685377421YT', + date: '2019-12-25T17:52:14.304Z', + name: 'Marsha Chambers', + identification: '17215896114', + amount: 1828.16, + status: 'pending', + action: true + }, + { + id: '884960091RT', + date: '2019-11-29T06:32:16.111Z', + name: 'Charmaine Jackson', + identification: '17215896114', + amount: 1647.55, + status: 'completed', + action: true + }, + { + id: '361402213NT', + date: '2019-11-24T12:13:23.064Z', + name: 'Maura Carey', + identification: '17215896114', + amount: -927.43, + status: 'completed', + action: true + }, + { + id: '361402213NT', + date: '2019-11-24T12:13:23.064Z', + name: 'Maura Carey', + identification: '17215896114', + amount: -927.43, + status: 'completed', + action: true + }, + { + id: '361402213NT', + date: '2019-11-24T12:13:23.064Z', + name: 'Maura Carey', + identification: '17215896114', + amount: -927.43, + status: 'completed', + action: true + }, + { + id: '361402213NT', + date: '2019-11-24T12:13:23.064Z', + name: 'Maura Carey', + identification: '17215896114', + amount: -927.43, + status: 'completed', + action: true + } + ]; - return ( - - {t("TITLE")} - - } - content={ - - - - - {t("TITLE_TABLE")} - - - 1 pendiente, 4 completadas - - - - - heroicons-outline:plus - - } - > - Nueva factura - - - - - - - - {columns.map((column, index) => ( - - - {column} - - - ))} - - + return ( + + {t('TITLE')} + + } + content={ + + + + + {t('TITLE_TABLE')} + + + 1 pendiente, 4 completadas + + + + + heroicons-outline:plus + + } + > + Nueva factura + + + + + + + + {columns.map((column, index) => ( + + + {column} + + + ))} + + - - {rows.map((row, index) => ( - - {Object.entries(row).map(([key, value]) => { - switch (key) { - case "id": { - return ( - - - {value} - - - ); - } - case "date": { - return ( - - - { - // @ts-ignore - format(new Date(value), "dd/MM/yyyy") - } - - - ); - } - case "amount": { - return ( - - - {value.toLocaleString("en-US", { - style: "currency", - currency: "USD", - })} - - - ); - } - case "status": { - return ( - - - {value} - - - ); - } - case "action": { - return ( - - - Ver - - - ); - } - default: { - return ( - - {value} - - ); - } - } - })} - - ))} - - - - - } - /> - ); -}; + + {rows.map((row, index) => ( + + {Object.entries(row).map(([key, value]) => { + switch (key) { + case 'id': { + return ( + + {value} + + ); + } + case 'date': { + return ( + + + { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + format(new Date(value), 'dd/MM/yyyy') + } + + + ); + } + case 'amount': { + return ( + + + {value.toLocaleString('en-US', { + style: 'currency', + currency: 'USD' + })} + + + ); + } + case 'status': { + return ( + + + {value} + + + ); + } + case 'action': { + return ( + + + Ver + + + ); + } + default: { + return ( + + {value} + + ); + } + } + })} + + ))} + + + + + } + /> + ); +} export default ListInvoiceRender; diff --git a/src/styles/tables.css b/src/styles/tables.css index b0f5dfb..20c36ec 100644 --- a/src/styles/tables.css +++ b/src/styles/tables.css @@ -17,31 +17,31 @@ table.simple { } table.simple thead tr th { - padding: 16px 8px; + /* padding: 16px 16px; */ font-weight: 500; border-bottom: 1px solid rgba(0, 0, 0, 0.12); white-space: nowrap; } table.simple thead tr th:first-child { - padding-left: 24px; + padding-left: 15px; } table.simple thead tr th:last-child { - padding-right: 24px; + padding-right: 0px; } table.simple tbody tr td { - padding: 12px 8px; + padding: 12px 12px; border-bottom: 1px solid rgba(0, 0, 0, 0.12); } table.simple tbody tr td:first-child { - padding-left: 24px; + padding-left: 0px; } table.simple tbody tr td:last-child { - padding-right: 24px; + padding-right: 0px; } table.simple tbody tr:last-child td {