Went through todos

This commit is contained in:
Dennis Eichhorn 2024-05-02 22:54:38 +00:00
parent 26fe6f59a6
commit 8b4715412c
4 changed files with 37 additions and 12 deletions

View File

@ -65,7 +65,7 @@ return [
'active' => true,
'permission' => [
'module' => Controller::NAME,
'type' => PermissionType::READ,
'type' => PermissionType::CREATE,
'state' => PermissionCategory::DRIVER,
],
],
@ -76,7 +76,7 @@ return [
'active' => true,
'permission' => [
'module' => Controller::NAME,
'type' => PermissionType::READ,
'type' => PermissionType::MODIFY,
'state' => PermissionCategory::DRIVER,
],
],
@ -90,8 +90,8 @@ return [
'active' => true,
'permission' => [
'module' => Controller::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::VEHICLE,
'type' => PermissionType::CREATE,
'state' => PermissionCategory::VEHICLE_NOTE,
],
],
[
@ -101,8 +101,8 @@ return [
'active' => true,
'permission' => [
'module' => Controller::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::VEHICLE,
'type' => PermissionType::MODIFY,
'state' => PermissionCategory::VEHICLE_NOTE,
],
],
],
@ -115,8 +115,8 @@ return [
'active' => true,
'permission' => [
'module' => Controller::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::DRIVER,
'type' => PermissionType::CREATE,
'state' => PermissionCategory::DRIVER_NOTE,
],
],
[
@ -126,8 +126,8 @@ return [
'active' => true,
'permission' => [
'module' => Controller::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::DRIVER,
'type' => PermissionType::MODIFY,
'state' => PermissionCategory::DRIVER_NOTE,
],
],
],

View File

@ -21,6 +21,9 @@ namespace Modules\FleetManagement\Controller;
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @question Consider to make FleetManagement rely on EquipmentManagement (especially the attributes)?
* https://github.com/Karaka-Management/oms-FleetManagement/issues/3
*/
final class ApiController extends Controller
{

View File

@ -27,12 +27,15 @@ $driverStatus = DriverStatus::getConstants();
$driver = $this->data['driver'] ?? new NullDriver();
$driverImage = $this->data['driverImage'] ?? new NullMedia();
$isNew = $driver->id === 0;
/**
* @var \phpOMS\Views\View $this
*/
echo $this->data['nav']->render();
?>
<div class="tabview tab-2">
<?php if (!$isNew) : ?>
<div class="box">
<ul class="tab-links">
<li><label for="c-tab-1"><?= $this->getHtml('Driver'); ?></label>
@ -44,12 +47,17 @@ echo $this->data['nav']->render();
<li><label for="c-tab-8"><?= $this->getHtml('Costs'); ?></label>
</ul>
</div>
<?php endif; ?>
<div class="tab-content">
<input type="radio" id="c-tab-1" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
<input type="radio" id="c-tab-1" name="tabular-2"<?= $isNew || $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<form id="iDriverForm"
method="<?= $isNew ? 'PUT' : 'POST'; ?>"
action="<?= UriFactory::build('{/api}fleetmanagement/driver?csrf={$CSRF}'); ?>"
<?= $isNew ? 'data-redirect="' . UriFactory::build('{/base}/fleetmanagement/driver/view') . '?id={/0/response/id}"' : ''; ?>>
<div class="portlet-head"><?= $this->getHtml('Driver'); ?></div>
<div class="portlet-body">
<div class="form-group">
@ -78,6 +86,7 @@ echo $this->data['nav']->render();
<input id="iSaveSubmit" type="Submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
<?php endif; ?>
</div>
</form>
</section>
</div>
@ -93,6 +102,7 @@ echo $this->data['nav']->render();
</div>
</div>
<?php if (!$isNew) : ?>
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
@ -322,5 +332,6 @@ echo $this->data['nav']->render();
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>

View File

@ -28,12 +28,15 @@ $vehicle = $this->data['vehicle'] ?? new NullVehicle();
$vehicleImage = $this->data['vehicleImage'] ?? new NullMedia();
$vehicleTypes = $this->data['types'] ?? [];
$isNew = $vehicle->id === 0;
/**
* @var \phpOMS\Views\View $this
*/
echo $this->data['nav']->render();
?>
<div class="tabview tab-2">
<?php if (!$isNew) : ?>
<div class="box">
<ul class="tab-links">
<li><label for="c-tab-1"><?= $this->getHtml('Vehicle'); ?></label>
@ -45,12 +48,17 @@ echo $this->data['nav']->render();
<li><label for="c-tab-8"><?= $this->getHtml('Costs'); ?></label>
</ul>
</div>
<?php endif; ?>
<div class="tab-content">
<input type="radio" id="c-tab-1" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
<input type="radio" id="c-tab-1" name="tabular-2"<?= $isNew || $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<form id="iDriverForm"
method="<?= $isNew ? 'PUT' : 'POST'; ?>"
action="<?= UriFactory::build('{/api}fleetmanagement/vehicle?csrf={$CSRF}'); ?>"
<?= $isNew ? 'data-redirect="' . UriFactory::build('{/base}/fleetmanagement/vehicle/view') . '?id={/0/response/id}"' : ''; ?>>
<div class="portlet-head"><?= $this->getHtml('Vehicle'); ?></div>
<div class="portlet-body">
<div class="form-group">
@ -123,6 +131,7 @@ echo $this->data['nav']->render();
<input id="iSaveSubmit" type="Submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
<?php endif; ?>
</div>
</form>
</section>
</div>
@ -138,6 +147,7 @@ echo $this->data['nav']->render();
</div>
</div>
<?php if (!$isNew) : ?>
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
@ -381,5 +391,6 @@ echo $this->data['nav']->render();
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>