addressbook/templates/index.html.php

46 lines
2.0 KiB
PHP
Raw Permalink Normal View History

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">&nbsp;</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; ?>
</table>
</form>
<?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: ?>
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' ?>