7-Junio-2023

master
Luis Angel Rendon Arrazola 1 year ago
parent 5cb3585865
commit 344be46504
  1. 2512
      package-lock.json
  2. 11
      package.json
  3. 1
      src/App.tsx
  4. 103
      src/Componentes/AmazonInvoice.tsx
  5. 196
      src/Componentes/AmazonInvoice1.1.tsx
  6. 45
      src/HojasDeEstilo/AmazonInovice.css
  7. 14
      src/Interfaces/Invoice.ts
  8. 7
      src/Interfaces/InvoiceDetail.ts
  9. 46
      src/Interfaces/InvoiceDetail1.1.ts
  10. 15
      src/Interfaces/InvoiceMaster.ts
  11. 901
      yarn.lock

2512
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -11,19 +11,24 @@
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
"@types/node": "^16.18.31",
"@types/react": "^18.2.6",
"@types/react-dom": "^18.2.4",
"ag-grid-community": "^29.3.5",
"ag-grid-react": "^29.3.5",
"axios": "^1.4.0",
"bootstrap": "^5.3.0",
"buffer": "^6.0.3",
"devextreme": "^22.2.4",
"devextreme-react": "^22.2.6",
"jsonwebtoken": "^9.0.0",
"jwt-decode": "^3.1.2",
"react": "^18.2.0",
"react-bootstrap": "^2.7.4",
"react-bootstrap-table-next": "^4.0.3",
"react-data-grid": "^7.0.0-beta.32",
"react-dom": "^18.2.0",
"react-router-dom": "^6.11.2",
"react-scripts": "5.0.1",
"react-table": "^7.8.0",
"typescript": "^5.0.4",
"web-vitals": "^2.1.4"
},
@ -50,5 +55,9 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@types/react": "^18.2.8",
"devextreme-themebuilder": "^22.2.4"
}
}

@ -1,3 +1,4 @@
import 'devextreme/dist/css/dx.light.css';
import React, { useEffect, useState } from 'react';
import { BrowserRouter as Router, Route, Routes, Navigate } from 'react-router-dom';
import axios from 'axios';

@ -1,49 +1,35 @@
import React, { useState } from 'react';
import React, { useState, useEffect } from 'react';
import axios from 'axios';
import '../Interfaces/InvoiceDetail';
import '../Interfaces/Invoice';
import '../HojasDeEstilo/AmazonInovice.css';
import { Invoice } from '../Interfaces/Invoice';
import '../HojasDeEstilo/AmazonInovice.css'
const AmazonInvoice: React.FC = () => {
const [id, setId] = useState('');
const [invoice, setInvoice] = useState<Invoice | null>(null);
const [showDetails, setShowDetails] = useState(false);
const [invoices, setInvoices] = useState<Invoice[]>([]);
const [currentPage, setCurrentPage] = useState(1);
const [itemsPerPage] = useState(20);
const handleIdChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setId(e.target.value);
};
const handleConsultClick = () => {
useEffect(() => {
axios
.get<Invoice[]>(`https://localhost:5051/api/AmazonInvoice/AmazonInvoiceGET?id=${id}`)
.get<Invoice[]>(`https://localhost:5051/api/AmazonInvoice/AmazonInvoiceIdMaster`)
.then((response) => {
const invoiceData: Invoice[] = response.data;
if (invoiceData.length > 0) {
setInvoice(invoiceData[0]);
setShowDetails(true); // Mostrar automáticamente los detalles
} else {
setInvoice(null);
setShowDetails(false);
}
setInvoices(invoiceData);
})
.catch((error) => {
console.log(error);
});
};
}, []);
const indexOfLastItem = currentPage * itemsPerPage;
const indexOfFirstItem = indexOfLastItem - itemsPerPage;
const currentInvoices = invoices.slice(indexOfFirstItem, indexOfLastItem);
const paginate = (pageNumber: number) => setCurrentPage(pageNumber);
return (
<div className="container">
<h1>Amazon Invoice</h1>
<div className="form-group">
<label htmlFor="id">ID:</label>
<input id="id" type="text" value={id} onChange={handleIdChange} className="form-control" />
</div>
<button onClick={handleConsultClick} className="btn btn-primary">Consultar</button>
{invoice && (
<div className="master-grid">
<div className="master-grid-item">
<h2>Master:</h2>
<table className="table table-striped table-dark">
<table className="table table-striped">
<thead>
<tr>
<th>Id</th>
@ -56,47 +42,28 @@ const AmazonInvoice: React.FC = () => {
</tr>
</thead>
<tbody>
<tr>
<td onClick={() => setShowDetails(!showDetails)}>
ID: {invoice.id}
{showDetails && (
<table className="table table-striped">
<thead>
<tr>
<th>Id Header</th>
<th>ID de factura</th>
<th>Amazon Shipment Reference ID</th>
<th>Item ID</th>
<th>Fecha de creación</th>
</tr>
</thead>
<tbody>
{invoice.detail.map((detail, index) => (
<tr key={index}>
<td>{detail.idHeader}</td>
<td>{detail.invoiceNumber}</td>
<td>{detail.amazonShipmentReferenceId}</td>
<td>{detail.itemId}</td>
<td>{detail.fCreacion}</td>
{currentInvoices.map((invoice: Invoice) => (
<tr key={invoice.id}>
<td>{invoice.id}</td>
<td>{invoice.referencia}</td>
<td>{invoice.commercialInvoiceDate}</td>
<td>{invoice.fCreacion}</td>
<td>{invoice.clasificador}</td>
<td>{invoice.estatus}</td>
<td>{invoice.trailerId || 'N/A'}</td>
</tr>
))}
</tbody>
</table>
)}
</td>
<td>Referencia: {invoice.referencia}</td>
<td>Fecha de la factura: {invoice.commercialInvoiceDate}</td>
<td>Fecha de creación: {invoice.fCreacion}</td>
<td>Clasificador: {invoice.clasificador}</td>
<td>Estatus: {invoice.estatus}</td>
<td>Trailer ID: {invoice.trailerId || 'N/A'}</td>
<td></td> {/* Espacio en blanco para alinear correctamente las columnas */}
</tr>
</tbody>
</table>
</div>
</div>
)}
<ul className="pagination">
{Array.from({ length: Math.ceil(invoices.length / itemsPerPage) }).map((_, index) => (
<li key={index} className={`page-item ${currentPage === index + 1 ? 'active' : ''}`}>
<button className="page-link" onClick={() => paginate(index + 1)}>
{index + 1}
</button>
</li>
))}
</ul>
</div>
);
};

@ -1,104 +1,104 @@
import React, { useState } from 'react';
import axios from 'axios';
import '../Interfaces/InvoiceDetail';
import '../Interfaces/Invoice';
import '../HojasDeEstilo/AmazonInovice.css';
// import React, { useState } from 'react';
// import axios from 'axios';
// import '../Interfaces/InvoiceDetail';
// import '../Interfaces/Invoice';
// import '../HojasDeEstilo/AmazonInovice.css';
const AmazonInvoice: React.FC = () => {
const [id, setId] = useState('');
const [invoice, setInvoice] = useState<Invoice | null>(null);
const [showDetails, setShowDetails] = useState(false);
// const AmazonInvoice: React.FC = () => {
// const [id, setId] = useState('');
// const [invoice, setInvoice] = useState<Invoice | null>(null);
// const [showDetails, setShowDetails] = useState(false);
const handleIdChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setId(e.target.value);
};
// const handleIdChange = (e: React.ChangeEvent<HTMLInputElement>) => {
// setId(e.target.value);
// };
const handleConsultClick = () => {
axios
.get<Invoice[]>(`https://localhost:5051/api/AmazonInvoice/AmazonInvoiceGET?id=${id}`)
// .get<Invoice[]>(`https://localhost:5051/api/AmazonInvoice/AmazonInvoiceGETselect?id=${id}`)
.then((response) => {
const invoiceData: Invoice[] = response.data;
if (invoiceData.length > 0) {
setInvoice(invoiceData[0]);
setShowDetails(true); // Mostrar automáticamente los detalles
} else {
setInvoice(null);
setShowDetails(false);
}
})
.catch((error) => {
console.log(error);
});
};
// const handleConsultClick = () => {
// axios
// .get<Invoice[]>(`https://localhost:5051/api/AmazonInvoice/AmazonInvoiceGET?id=${id}`)
// // .get<Invoice[]>(`https://localhost:5051/api/AmazonInvoice/AmazonInvoiceGETselect?id=${id}`)
// .then((response) => {
// const invoiceData: Invoice[] = response.data;
// if (invoiceData.length > 0) {
// setInvoice(invoiceData[0]);
// setShowDetails(true); // Mostrar automáticamente los detalles
// } else {
// setInvoice(null);
// setShowDetails(false);
// }
// })
// .catch((error) => {
// console.log(error);
// });
// };
return (
<div>
<h1>Amazon Invoice</h1>
<label>
ID:
<input type="text" value={id} onChange={handleIdChange} />
</label>
<button onClick={handleConsultClick}>Consultar</button>
{invoice && (
<div>
<h2>Master:</h2>
<table className="table table-striped table-dark">
<thead>
<tr>
<th>Id</th>
<th>Referencia</th>
<th>FechaFactura</th>
<th>FechaCreacion</th>
<th>Clasificador</th>
<th>Estatus</th>
<th>Trailer Id</th>
<th>Detalle</th>
</tr>
</thead>
<tbody>
<tr>
<td onClick={() => setShowDetails(!showDetails)}>ID: {invoice.id}</td>
<td>Referencia: {invoice.referencia}</td>
<td>Fecha de la factura: {invoice.commercialInvoiceDate}</td>
<td>Fecha de creación: {invoice.fCreacion}</td>
<td>Clasificador: {invoice.clasificador}</td>
<td>Estatus: {invoice.estatus}</td>
<td>Trailer ID: {invoice.trailerId || 'N/A'}</td>
<td>
{showDetails && (
<table className="table table-striped">
<thead>
<tr>
<th>Id Header</th>
<th>ID de factura</th>
<th>Amazon Shipment Reference ID</th>
<th>Item ID</th>
<th>Fecha de creación</th>
</tr>
</thead>
<tbody>
{invoice.detail.map((detail, index) => (
<tr key={index}>
<td>{detail.idHeader}</td>
<td>{detail.invoiceNumber}</td>
<td>{detail.amazonShipmentReferenceId}</td>
<td>{detail.itemId}</td>
<td>{detail.fCreacion}</td>
</tr>
))}
</tbody>
</table>
)}
</td>
</tr>
</tbody>
</table>
// return (
// <div>
// <h1>Amazon Invoice</h1>
// <label>
// ID:
// <input type="text" value={id} onChange={handleIdChange} />
// </label>
// <button onClick={handleConsultClick}>Consultar</button>
// {invoice && (
// <div>
// <h2>Master:</h2>
// <table className="table table-striped table-dark">
// <thead>
// <tr>
// <th>Id</th>
// <th>Referencia</th>
// <th>FechaFactura</th>
// <th>FechaCreacion</th>
// <th>Clasificador</th>
// <th>Estatus</th>
// <th>Trailer Id</th>
// <th>Detalle</th>
// </tr>
// </thead>
// <tbody>
// <tr>
// <td onClick={() => setShowDetails(!showDetails)}>ID: {invoice.id}</td>
// <td>Referencia: {invoice.referencia}</td>
// <td>Fecha de la factura: {invoice.commercialInvoiceDate}</td>
// <td>Fecha de creación: {invoice.fCreacion}</td>
// <td>Clasificador: {invoice.clasificador}</td>
// <td>Estatus: {invoice.estatus}</td>
// <td>Trailer ID: {invoice.trailerId || 'N/A'}</td>
// <td>
// {showDetails && (
// <table className="table table-striped">
// <thead>
// <tr>
// <th>Id Header</th>
// <th>ID de factura</th>
// <th>Amazon Shipment Reference ID</th>
// <th>Item ID</th>
// <th>Fecha de creación</th>
// </tr>
// </thead>
// <tbody>
// {invoice.detail.map((detail, index) => (
// <tr key={index}>
// <td>{detail.idHeader}</td>
// <td>{detail.invoiceNumber}</td>
// <td>{detail.amazonShipmentReferenceId}</td>
// <td>{detail.itemId}</td>
// <td>{detail.fCreacion}</td>
// </tr>
// ))}
// </tbody>
// </table>
// )}
// </td>
// </tr>
// </tbody>
// </table>
</div>
)}
</div>
);
};
// </div>
// )}
// </div>
// );
// };
export default AmazonInvoice;
// export default AmazonInvoice;

@ -1,21 +1,60 @@
.table-container {
.container {
margin-top: 20px;
}
.table {
width: 100%;
border-collapse: collapse;
}
.table th {
background-color: #95c030;
color: white;
text-align: center;
padding: 8px;
}
.table td {
text-align: center;
padding: 8px;
}
.pagination-container {
margin-top: 20px;
display: flex;
justify-content: center;
}
.pagination {
display: inline-flex;
list-style: none;
padding: 0;
margin: 0;
}
.pagination li {
margin-right: 5px;
}
h1{
background-color: grey;
.pagination li button {
display: inline-block;
padding: 5px 10px;
border: 1px solid #ddd;
background-color: #f5f5f5;
color: #333;
cursor: pointer;
}
.pagination li button:hover {
background-color: #e9e9e9;
}
.pagination li.active button {
background-color: #95c030;
color: white;
}
h1 {
color: white
}

@ -1,4 +1,6 @@
interface Invoice {
// import { InvoiceDetail , Invoice} from "./InvoiceDetail";
export interface Invoice {
id: number;
referencia: string;
commercialInvoiceDate: string;
@ -7,5 +9,13 @@ interface Invoice {
estatus: number;
trailerId: string | null;
detail: InvoiceDetail[];
}
}
export interface InvoiceDetail {
idHeader: number;
invoiceNumber: string;
amazonShipmentReferenceId: string;
itemId: string;
fCreacion: string;
}

@ -1,7 +1,10 @@
interface InvoiceDetail {
export interface InvoiceDetail {
idHeader: number;
invoiceNumber: string;
amazonShipmentReferenceId: string;
itemId: string;
fCreacion: string;
}
}

@ -1,46 +0,0 @@
interface InvoiceDetail1 {
Id: number;
IdHeader: number;
InvoiceNumber: string;
AmazonShipmentReferenceId: string;
Partida: number;
TrailerId: string;
ItemId: string;
ItemIdType: string;
ItemDescription: string;
PedimentoDescription: string;
DestinationHTSCode: string;
ValidaFraccionOriginal: number;
ConfirmaFraccion: number;
FraccionGEMCO: string;
ConfirmaDescripcion: number;
DescripcionGEMCO: string;
SourceHTSCode: string;
ECCN: string;
LicEx: string;
CountryOfOrigin: string;
ProductGroup: string;
UPC: string;
Brand: string;
Model: string;
ItemQuantityUnitOfMeasure: string;
Quantity: number;
NetWeightUnitOfMeasure: string;
WeightValue: number;
ActualUnitCostChargeOrAllowance: string;
ActualUnitCostCurrencyISOCode: string;
ActualUnitCostMonetaryAmount: number;
TotalUnitValueChargeOrAllowance: string;
TotalUnitValueCurrencyISOCode: string;
TotalUnitValueMonetaryAmount: number;
Archivo: string;
FCreacion: string;
Estatus: number;
Autorizado: boolean;
CumplimientoNormativo: string;
Comentarios: string;
SightLine: boolean;
ComentariosSightLine: string;
Checked: boolean;
Activo: number;
}

@ -1,9 +1,9 @@
interface I2096Detail {
// Define properties for I2096Detail if it has any specific properties
}
// interface I2096Detail {
// // Define properties for I2096Detail if it has any specific properties
// }
interface Invoice1 {
interface InvoiceMaster {
Id: number;
Referencia: string;
CommercialInvoiceDate: string;
@ -26,10 +26,7 @@
FootNote: string;
Archivo: string;
FCreacion: string;
Clasificador: number;
NoVuelta: number;
Estatus: number;
max: boolean;
Detail: I2096Detail[];
// Detail: I2096Detail[];
}

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save