3 Junio-2023

master
Luis Angel Rendon Arrazola 1 year ago
parent 833160ae41
commit 5cb3585865
  1. 124
      src/Componentes/AmazonInvoice.tsx

@ -15,8 +15,7 @@ const AmazonInvoice: React.FC = () => {
const handleConsultClick = () => { const handleConsultClick = () => {
axios axios
.get<Invoice[]>(`https://localhost:5051/api/AmazonInvoice/AmazonInvoiceGET?id=${id}`) .get<Invoice[]>(`https://localhost:5051/api/AmazonInvoice/AmazonInvoiceGET?id=${id}`)
//.get<Invoice[]>(`https://localhost:5051/api/AmazonInvoice/AmazonInvoiceGETselect?id=${id}`)
.then((response) => { .then((response) => {
const invoiceData: Invoice[] = response.data; const invoiceData: Invoice[] = response.data;
if (invoiceData.length > 0) { if (invoiceData.length > 0) {
@ -33,68 +32,69 @@ const AmazonInvoice: React.FC = () => {
}; };
return ( return (
<div> <div className="container">
<h1>Amazon Invoice</h1> <h1>Amazon Invoice</h1>
<label> <div className="form-group">
ID: <label htmlFor="id">ID:</label>
<input type="text" value={id} onChange={handleIdChange} /> <input id="id" type="text" value={id} onChange={handleIdChange} className="form-control" />
</label> </div>
<button onClick={handleConsultClick}>Consultar</button> <button onClick={handleConsultClick} className="btn btn-primary">Consultar</button>
{invoice && ( {invoice && (
<div> <div className="master-grid">
<h2>Master:</h2> <div className="master-grid-item">
<table className="table table-striped table-dark"> <h2>Master:</h2>
<thead> <table className="table table-striped table-dark">
<tr> <thead>
<th>Id</th> <tr>
<th>Referencia</th> <th>Id</th>
<th>FechaFactura</th> <th>Referencia</th>
<th>FechaCreacion</th> <th>FechaFactura</th>
<th>Clasificador</th> <th>FechaCreacion</th>
<th>Estatus</th> <th>Clasificador</th>
<th>Trailer Id</th> <th>Estatus</th>
<th>Trailer Id</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td onClick={() => setShowDetails(!showDetails)}> <td onClick={() => setShowDetails(!showDetails)}>
ID: {invoice.id} ID: {invoice.id}
{showDetails && ( {showDetails && (
<table className="table table-striped"> <table className="table table-striped">
<thead> <thead>
<tr> <tr>
<th>Id Header</th> <th>Id Header</th>
<th>ID de factura</th> <th>ID de factura</th>
<th>Amazon Shipment Reference ID</th> <th>Amazon Shipment Reference ID</th>
<th>Item ID</th> <th>Item ID</th>
<th>Fecha de creación</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> </tr>
))} </thead>
</tbody> <tbody>
</table> {invoice.detail.map((detail, index) => (
)} <tr key={index}>
</td> <td>{detail.idHeader}</td>
<td>Referencia: {invoice.referencia}</td> <td>{detail.invoiceNumber}</td>
<td>Fecha de la factura: {invoice.commercialInvoiceDate}</td> <td>{detail.amazonShipmentReferenceId}</td>
<td>Fecha de creación: {invoice.fCreacion}</td> <td>{detail.itemId}</td>
<td>Clasificador: {invoice.clasificador}</td> <td>{detail.fCreacion}</td>
<td>Estatus: {invoice.estatus}</td> </tr>
<td>Trailer ID: {invoice.trailerId || 'N/A'}</td> ))}
<td></td> {/* Espacio en blanco para alinear correctamente las columnas */} </tbody>
</tr> </table>
</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> </div>
)} )}
</div> </div>
@ -102,5 +102,3 @@ const AmazonInvoice: React.FC = () => {
}; };
export default AmazonInvoice; export default AmazonInvoice;

Loading…
Cancel
Save