Files
2026-06-27 15:23:25 -05:00

69 lines
2.8 KiB
PHP

<?php
/**
* Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
* SPDX-License-Identifier: GPL-3.0-or-later
* Authored-by: Moko Consulting
*/
defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Router\Route;
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$statusBadges = [
'pending' => 'secondary',
'confirmed' => 'info',
'assigned' => 'warning',
'picked_up' => 'primary',
'in_transit' => 'primary',
'delivered' => 'success',
'failed' => 'danger',
'cancelled' => 'danger',
'returned' => 'dark',
];
?>
<form action="<?php echo Route::_('index.php?option=com_mokosuitelogistics&view=orders'); ?>" method="post" name="adminForm" id="adminForm">
<div id="j-main-container">
<table class="table table-striped">
<thead>
<tr>
<th style="width:1%">#</th>
<th><?php echo HTMLHelper::_('searchtools.sort', 'Order Ref', 'o.order_ref', $listDirn, $listOrder); ?></th>
<th>Status</th>
<th>Customer</th>
<th>Driver</th>
<th>Pickup</th>
<th><?php echo HTMLHelper::_('searchtools.sort', 'Delivery Fee', 'o.delivery_fee', $listDirn, $listOrder); ?></th>
<th><?php echo HTMLHelper::_('searchtools.sort', 'Created', 'o.created', $listDirn, $listOrder); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($this->items as $i => $item) :
$badge = $statusBadges[$item->status] ?? 'secondary';
?>
<tr>
<td><?php echo $this->pagination->getRowOffset($i); ?></td>
<td><strong><?php echo $this->escape($item->order_ref); ?></strong></td>
<td><span class="badge bg-<?php echo $badge; ?>"><?php echo $this->escape($item->status); ?></span></td>
<td><?php echo $this->escape($item->customer_name); ?></td>
<td><?php echo $this->escape($item->driver_name ?? ''); ?></td>
<td><?php echo $this->escape($item->pickup_address); ?></td>
<td><?php echo $item->delivery_fee ? number_format((float) $item->delivery_fee, 2) : '-'; ?></td>
<td><?php echo HTMLHelper::_('date', $item->created, 'Y-m-d H:i'); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php echo $this->pagination->getListFooter(); ?>
<input type="hidden" name="task" value="">
<input type="hidden" name="boxchecked" value="0">
<?php echo HTMLHelper::_('form.token'); ?>
</div>
</form>