now uses datasets to store data for opening locker; location column
This commit is contained in:
parent
9e56b6d168
commit
0ccacd4588
|
@ -43,13 +43,29 @@ window.addEventListener("load", () => {
|
||||||
const table = document.querySelector("tbody")!;
|
const table = document.querySelector("tbody")!;
|
||||||
res.forEach((shipment: Package) => {
|
res.forEach((shipment: Package) => {
|
||||||
let row = table.insertRow();
|
let row = table.insertRow();
|
||||||
let checkbox = row.insertCell(0);
|
let id = row.insertCell(0);
|
||||||
let id = row.insertCell(1);
|
let sender = row.insertCell(1);
|
||||||
let sender = row.insertCell(2);
|
let status = row.insertCell(2);
|
||||||
let status = row.insertCell(3);
|
let locker = row.insertCell(3);
|
||||||
|
let openAction = row.insertCell(4);
|
||||||
|
|
||||||
|
row.dataset.lat = shipment.pickupPoint.location.latitude.toString();
|
||||||
|
row.dataset.lon = shipment.pickupPoint.location.longitude.toString();
|
||||||
|
row.dataset.openCode = shipment.openCode;
|
||||||
|
row.dataset.id = shipment.shipmentNumber;
|
||||||
|
|
||||||
id.innerText = shipment.shipmentNumber;
|
id.innerText = shipment.shipmentNumber;
|
||||||
sender.innerText = shipment.senderName;
|
sender.innerText = shipment.senderName;
|
||||||
status.innerText = shipment.status;
|
status.innerText = shipment.status;
|
||||||
|
locker.innerText =
|
||||||
|
shipment.pickupPoint.name + " - " + shipment.pickupPoint.description;
|
||||||
|
openAction.innerHTML = "Open";
|
||||||
|
openAction.addEventListener("click", (event) => {
|
||||||
|
console.log(
|
||||||
|
((event.target as Element).parentNode as HTMLElement).dataset
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
// console.log(shipment);
|
// console.log(shipment);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -67,6 +83,8 @@ interface Locker {
|
||||||
name: string;
|
name: string;
|
||||||
status: string;
|
status: string;
|
||||||
description: string;
|
description: string;
|
||||||
|
location: Location;
|
||||||
|
address: Address;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Address {
|
interface Address {
|
||||||
|
@ -79,7 +97,7 @@ interface Address {
|
||||||
|
|
||||||
interface Location {
|
interface Location {
|
||||||
latitude: number;
|
latitude: number;
|
||||||
longtitude: number;
|
longitude: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum PackageStatus {
|
enum PackageStatus {
|
||||||
|
|
|
@ -41,11 +41,11 @@
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th></th>
|
|
||||||
<th>Package number</th>
|
<th>Package number</th>
|
||||||
<th>Sender</th>
|
<th>Sender</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th>Action</th>
|
<th>Location</th>
|
||||||
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody></tbody>
|
<tbody></tbody>
|
||||||
|
|
Loading…
Reference in a new issue