You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
2.8 KiB
PHP

<?php
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
require_once __DIR__ . "/../required.php";
redirectIfNotLoggedIn();
$customers = $database->select('customers', ['customerid (id)', 'name', 'email', 'phone', 'address', 'notes']);
?>
<div class="btn-toolbar">
<a href="app.php?page=editcustomer" class="btn btn-success"><i class="fas fa-user-plus"></i> <?php $Strings->get("new customer"); ?></a>
</div>
<table id="customertable" class="table table-bordered table-hover table-sm">
<thead>
<tr>
<th data-priority="0"></th>
<th data-priority="1"><?php $Strings->get('actions'); ?></th>
<th data-priority="1"><i class="fas fa-fw fa-user d-none d-md-inline"></i> <?php $Strings->get('name'); ?></th>
<th data-priority="2"><i class="fas fa-fw fa-phone d-none d-md-inline"></i> <?php $Strings->get('phone'); ?></th>
<th data-priority="3"><i class="fas fa-fw fa-at d-none d-md-inline"></i> <?php $Strings->get('email'); ?></th>
<th data-priority="4"><i class="fas fa-fw fa-map-marker d-none d-md-inline"></i> <?php $Strings->get('address'); ?></th>
<th data-priority="5"><i class="fas fa-fw fa-sticky-note d-none d-md-inline"></i> <?php $Strings->get('notes'); ?></th>
</tr>
</thead>
<tbody>
<?php
foreach ($customers as $c) {
?>
<tr>
<td></td>
<td>
<a class="btn btn-primary btn-sm" href="app.php?page=editcustomer&id=<?php echo $c['id']; ?>"><i class="fas fa-edit"></i> <?php $Strings->get("edit"); ?></a>
</td>
<td><?php echo $c['name']; ?></td>
<td><?php echo $c['phone']; ?></td>
<td><?php echo $c['email']; ?></td>
<td><?php echo $c['address']; ?></td>
<td><?php echo $c['notes']; ?></td>
</tr>
<?php
}
?>
</tbody>
<tfoot>
<tr>
<th data-priority="0"></th>
<th data-priority="1"><?php $Strings->get('actions'); ?></th>
<th data-priority="1"><i class="fas fa-fw fa-user d-none d-md-inline"></i> <?php $Strings->get('name'); ?></th>
<th data-priority="2"><i class="fas fa-fw fa-phone d-none d-md-inline"></i> <?php $Strings->get('phone'); ?></th>
<th data-priority="3"><i class="fas fa-fw fa-at d-none d-md-inline"></i> <?php $Strings->get('email'); ?></th>
<th data-priority="4"><i class="fas fa-fw fa-map-marker d-none d-md-inline"></i> <?php $Strings->get('address'); ?></th>
<th data-priority="5"><i class="fas fa-fw fa-sticky-note d-none d-md-inline"></i> <?php $Strings->get('notes'); ?></th>
</tr>
</tfoot>
</table>