2022-10-24 18:40:37 +02:00
|
|
|
<?php include '_header.html.php' ?>
|
|
|
|
|
|
|
|
<br>
|
2022-10-25 15:47:31 +02:00
|
|
|
<h2>Welcome to Address Book</h2>
|
2022-10-24 18:40:37 +02:00
|
|
|
|
2022-10-25 15:47:31 +02:00
|
|
|
<?php if(!empty($addresses)): ?>
|
|
|
|
<form method="POST">
|
|
|
|
<table id="address_table">
|
|
|
|
<tr>
|
|
|
|
<th id="first" onclick="sortBy('first')">First</th>
|
|
|
|
<th id="last" onclick="sortBy('last')">Last</th>
|
|
|
|
<th id="street" onclick="sortBy('street')">Street</th>
|
|
|
|
<th id="zip" onclick="sortBy('zip')">Zip</th>
|
|
|
|
<th id="city" onclick="sortBy('city')">City</th>
|
|
|
|
<th id="phone" onclick="sortBy('phone')">Phone</th>
|
|
|
|
<th colspan="2"> </th>
|
|
|
|
</tr>
|
|
|
|
<?php foreach ($addresses as $address): ?>
|
|
|
|
<?php $id = $address->getId(); ?>
|
|
|
|
<tr id="row_<?= $id ?>">
|
2022-10-27 15:38:33 +02:00
|
|
|
<td><input type="text" id="first_<?= $id ?>" value="<?= $address->getFirst(); ?>" maxlength="80" disabled></td>
|
|
|
|
<td><input type="text" id="last_<?= $id ?>" value="<?= $address->getLast(); ?>" maxlength="80" disabled></td>
|
|
|
|
<td><input type="text" id="street_<?= $id ?>" value="<?= $address->getStreet(); ?>" maxlength="80" disabled></td>
|
|
|
|
<td><input type="text" id="zip_<?= $id ?>" value="<?= $address->getZip(); ?>" maxlength="10" disabled></td>
|
|
|
|
<td><input type="text" id="city_<?= $id ?>" value="<?= $address->getCity(); ?>" maxlength="80" disabled></td>
|
|
|
|
<td><input type="text" id="phone_<?= $id ?>" value="<?= $address->getPhone(); ?>" maxlength="30" disabled></td>
|
2022-10-25 15:47:31 +02:00
|
|
|
<td>
|
2022-10-26 11:13:04 +02:00
|
|
|
<input type="button" value="Edit" id="edit_button_<?= $id ?>" onclick="editAddress('<?= $id ?>')">
|
2022-10-25 15:47:31 +02:00
|
|
|
</td>
|
|
|
|
<td>
|
2022-10-26 11:13:04 +02:00
|
|
|
<input type="button" value="Delete" onclick="deleteAddress('<?= $id ?>')">
|
2022-10-25 15:47:31 +02:00
|
|
|
<input type="hidden" id="owner_<?= $id ?>" value="<?= $id ?>">
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<?php endforeach; ?>
|
|
|
|
<tr style="display:none;">
|
2022-10-26 12:13:42 +02:00
|
|
|
<td id="first_sort">desc</td>
|
|
|
|
<td id="last_sort">desc</td>
|
|
|
|
<td id="street_sort">desc</td>
|
|
|
|
<td id="zip_sort">desc</td>
|
|
|
|
<td id="city_sort">desc</td>
|
|
|
|
<td id="phone_sort">desc</td>
|
2022-10-25 15:47:31 +02:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</form>
|
|
|
|
|
2022-10-26 11:11:58 +02:00
|
|
|
<?php $addAddress = $router->path('address_add'); ?>
|
|
|
|
<input type="button" value="Add Address" onclick="addAddress('<?= $addAddress ?>')">
|
2022-10-25 15:47:31 +02:00
|
|
|
<?php else: ?>
|
2022-10-26 11:11:58 +02:00
|
|
|
Your addresses will be listed soon …
|
2022-10-25 15:47:31 +02:00
|
|
|
<?php endif; ?>
|
2022-10-24 20:29:34 +02:00
|
|
|
|
2022-10-24 18:40:37 +02:00
|
|
|
<?php include '_footer.html.php' ?>
|