mirror of
https://github.com/Karaka-Management/oms-FleetManagement.git
synced 2026-01-31 05:48:41 +00:00
bug fixes and item management improvements
This commit is contained in:
parent
32d786db4c
commit
63a40318d1
|
|
@ -1,4 +1,18 @@
|
|||
[
|
||||
{
|
||||
"type": "type",
|
||||
"name": "vehicle_profile_image",
|
||||
"l11n": [
|
||||
{
|
||||
"title": "Profile image",
|
||||
"lang": "en"
|
||||
},
|
||||
{
|
||||
"title": "Profilbild",
|
||||
"lang": "de"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "collection",
|
||||
"create_directory": true,
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@
|
|||
"children": [
|
||||
{
|
||||
"id": 1003503101,
|
||||
"pid": "/sales",
|
||||
"pid": "/fleet/vehicle/attribute",
|
||||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "Types",
|
||||
|
|
@ -90,7 +90,7 @@
|
|||
},
|
||||
{
|
||||
"id": 1003503201,
|
||||
"pid": "/sales",
|
||||
"pid": "/fleet/vehicle/attribute",
|
||||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "Values",
|
||||
|
|
|
|||
|
|
@ -76,13 +76,6 @@
|
|||
"de": "Moped"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "RV",
|
||||
"l11n": {
|
||||
"en": "Recreational Vehicle",
|
||||
"de": "Wohnmobil"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "tractor",
|
||||
"l11n": {
|
||||
|
|
@ -96,40 +89,5 @@
|
|||
"en": "Forklift",
|
||||
"de": "Gabelstapler"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "skateboard",
|
||||
"l11n": {
|
||||
"en": "Skateboard",
|
||||
"de": "Skateboard"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "snowmobile",
|
||||
"l11n": {
|
||||
"en": "Snowmobile",
|
||||
"de": "Schneemobil"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "jet_ski",
|
||||
"l11n": {
|
||||
"en": "Jet Ski",
|
||||
"de": "Jet Ski"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "quad_bike",
|
||||
"l11n": {
|
||||
"en": "Quad Bike",
|
||||
"de": "Quad Bike"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "golf_cart",
|
||||
"l11n": {
|
||||
"en": "Golf Cart",
|
||||
"de": "Golf Cart"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -536,7 +536,9 @@ final class ApiController extends Controller
|
|||
private function validateVehicleCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['name'] = !$request->hasData('name'))) {
|
||||
if (($val['name'] = !$request->hasData('name'))
|
||||
|| ($val['type'] = !$request->hasData('type'))
|
||||
) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
|
|
@ -1080,7 +1082,7 @@ final class ApiController extends Controller
|
|||
$vehicle->id,
|
||||
$media->id,
|
||||
VehicleMapper::class,
|
||||
'media',
|
||||
'files',
|
||||
'',
|
||||
$request->getOrigin()
|
||||
);
|
||||
|
|
@ -1128,14 +1130,14 @@ final class ApiController extends Controller
|
|||
$vehicle->id,
|
||||
(int) $media,
|
||||
VehicleMapper::class,
|
||||
'media',
|
||||
'files',
|
||||
'',
|
||||
$request->getOrigin()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Media', 'Media added to bill.', [
|
||||
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Media', 'Media added to vehicle.', [
|
||||
'upload' => $uploaded,
|
||||
'media' => $mediaFiles,
|
||||
]);
|
||||
|
|
@ -1154,7 +1156,6 @@ final class ApiController extends Controller
|
|||
{
|
||||
return '/Modules/FleetManagement/Vehicle/'
|
||||
. $this->app->unitId . '/'
|
||||
. $vehicle->createdAt->format('Y/m/d') . '/'
|
||||
. $vehicle->id;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,14 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\FleetManagement\Controller;
|
||||
|
||||
use Modules\FleetManagement\Models\VehicleAttributeTypeL11nMapper;
|
||||
use Modules\FleetManagement\Models\VehicleAttributeTypeMapper;
|
||||
use Modules\FleetManagement\Models\VehicleMapper;
|
||||
use Modules\FleetManagement\Models\VehicleTypeMapper;
|
||||
use Modules\Media\Models\MediaMapper;
|
||||
use Modules\Media\Models\MediaTypeMapper;
|
||||
use phpOMS\Contract\RenderableInterface;
|
||||
use phpOMS\DataStorage\Database\Query\Builder;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Views\View;
|
||||
|
|
@ -30,6 +37,35 @@ use phpOMS\Views\View;
|
|||
*/
|
||||
final class BackendController extends Controller
|
||||
{
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param mixed $data Generic data
|
||||
*
|
||||
* @return RenderableInterface Returns a renderable object
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function viewFleetManagementAttributeTypeList(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/attribute-type-list');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1003503001, $request, $response));
|
||||
|
||||
/** @var \Modules\Attribute\Models\AttributeType[] $attributes */
|
||||
$attributes = VehicleAttributeTypeMapper::getAll()
|
||||
->with('l11n')
|
||||
->where('l11n/language', $response->getLanguage())
|
||||
->execute();
|
||||
|
||||
$view->addData('attributes', $attributes);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
*
|
||||
|
|
@ -49,6 +85,50 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/vehicle-list');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1003502001, $request, $response));
|
||||
|
||||
$list = VehicleMapper::getAll()
|
||||
->with('type')
|
||||
->with('type/l11n')
|
||||
->where('type/l11n/language', $response->getLanguage())
|
||||
->sort('id', 'DESC')
|
||||
->execute();
|
||||
|
||||
$view->setData('vehicles', $list);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param mixed $data Generic data
|
||||
*
|
||||
* @return RenderableInterface
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function viewFleetManagementAttributeType(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/attribute-type');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response));
|
||||
|
||||
/** @var \Modules\Attribute\Models\AttributeType $attribute */
|
||||
$attribute = VehicleAttributeTypeMapper::get()
|
||||
->with('l11n')
|
||||
->where('id', (int) $request->getData('id'))
|
||||
->where('l11n/language', $response->getLanguage())
|
||||
->execute();
|
||||
|
||||
$l11ns = VehicleAttributeTypeL11nMapper::getAll()
|
||||
->where('ref', $attribute->id)
|
||||
->execute();
|
||||
|
||||
$view->addData('attribute', $attribute);
|
||||
$view->addData('l11ns', $l11ns);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
|
|
@ -71,6 +151,52 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/vehicle-profile');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1003502001, $request, $response));
|
||||
|
||||
$vehicle = VehicleMapper::get()
|
||||
->with('attributes')
|
||||
->with('attributes/type')
|
||||
->with('attributes/value')
|
||||
->with('attributes/type/l11n')
|
||||
->with('type')
|
||||
->with('type/l11n')
|
||||
->with('fuelType')
|
||||
->with('fuelType/l11n')
|
||||
->where('id', (int) $request->getData('id'))
|
||||
->where('type/l11n/language', $response->getLanguage())
|
||||
->where('fuelType/l11n/language', $response->getLanguage())
|
||||
->where('attributes/type/l11n/language', $response->getLanguage())
|
||||
->execute();
|
||||
|
||||
$view->setData('vehicle', $vehicle);
|
||||
|
||||
$query = new Builder($this->app->dbPool->get());
|
||||
$results = $query->selectAs(VehicleMapper::HAS_MANY['files']['external'], 'file')
|
||||
->from(VehicleMapper::TABLE)
|
||||
->leftJoin(VehicleMapper::HAS_MANY['files']['table'])
|
||||
->on(VehicleMapper::HAS_MANY['files']['table'] . '.' . VehicleMapper::HAS_MANY['files']['self'], '=', VehicleMapper::TABLE . '.' . VehicleMapper::PRIMARYFIELD)
|
||||
->leftJoin(MediaMapper::TABLE)
|
||||
->on(VehicleMapper::HAS_MANY['files']['table'] . '.' . VehicleMapper::HAS_MANY['files']['external'], '=', MediaMapper::TABLE . '.' . MediaMapper::PRIMARYFIELD)
|
||||
->leftJoin(MediaMapper::HAS_MANY['types']['table'])
|
||||
->on(MediaMapper::TABLE . '.' . MediaMapper::PRIMARYFIELD, '=', MediaMapper::HAS_MANY['types']['table'] . '.' . MediaMapper::HAS_MANY['types']['self'])
|
||||
->leftJoin(MediaTypeMapper::TABLE)
|
||||
->on(MediaMapper::HAS_MANY['types']['table'] . '.' . MediaMapper::HAS_MANY['types']['external'], '=', MediaTypeMapper::TABLE . '.' . MediaTypeMapper::PRIMARYFIELD)
|
||||
->where(VehicleMapper::HAS_MANY['files']['self'], '=', $vehicle->id)
|
||||
->where(MediaTypeMapper::TABLE . '.' . MediaTypeMapper::getColumnByMember('name'), '=', 'vehicle_profile_image');
|
||||
|
||||
$vehicleImage = MediaMapper::get()
|
||||
->with('types')
|
||||
->where('id', $results)
|
||||
->limit(1)
|
||||
->execute();
|
||||
|
||||
$view->addData('vehicleImage', $vehicleImage);
|
||||
|
||||
$vehicleTypes = VehicleTypeMapper::getAll()
|
||||
->with('l11n')
|
||||
->where('l11n/language', $response->getLanguage())
|
||||
->execute();
|
||||
|
||||
$view->addData('types', $vehicleTypes);
|
||||
|
||||
return $view;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ final class NullVehicle extends Vehicle
|
|||
public function __construct(int $id = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -40,12 +40,8 @@ class Vehicle implements \JsonSerializable
|
|||
|
||||
public array $inspections = [];
|
||||
|
||||
public array $attributes = [];
|
||||
|
||||
public array $milage = [];
|
||||
|
||||
public array $media = [];
|
||||
|
||||
public array $notes = [];
|
||||
|
||||
public int $unit = 0;
|
||||
|
|
@ -78,4 +74,7 @@ class Vehicle implements \JsonSerializable
|
|||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
|
||||
use \Modules\Media\Models\MediaListTrait;
|
||||
use \Modules\Attribute\Models\AttributeHolderTrait;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ final class VehicleMapper extends DataMapperFactory
|
|||
'fleetmgmt_vehicle_status' => ['name' => 'fleetmgmt_vehicle_status', 'type' => 'int', 'internal' => 'status'],
|
||||
'fleetmgmt_vehicle_info' => ['name' => 'fleetmgmt_vehicle_info', 'type' => 'string', 'internal' => 'info'],
|
||||
'fleetmgmt_vehicle_unit' => ['name' => 'fleetmgmt_vehicle_unit', 'type' => 'int', 'internal' => 'unit'],
|
||||
'fleetmgmt_vehicle_type' => ['name' => 'fleetmgmt_vehicle_type', 'type' => 'int', 'internal' => 'type'],
|
||||
'fleetmgmt_vehicle_fuel' => ['name' => 'fleetmgmt_vehicle_fuel', 'type' => 'int', 'internal' => 'fuelType'],
|
||||
'fleetmgmt_vehicle_responsible' => ['name' => 'fleetmgmt_vehicle_responsible', 'type' => 'int', 'internal' => 'responsible'],
|
||||
'fleetmgmt_vehicle_created_at' => ['name' => 'fleetmgmt_vehicle_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
|
||||
];
|
||||
|
|
@ -53,7 +55,7 @@ final class VehicleMapper extends DataMapperFactory
|
|||
* @since 1.0.0
|
||||
*/
|
||||
public const HAS_MANY = [
|
||||
'media' => [
|
||||
'files' => [
|
||||
'mapper' => MediaMapper::class,
|
||||
'table' => 'fleetmgmt_vehicle_media',
|
||||
'external' => 'fleetmgmt_vehicle_media_media',
|
||||
|
|
|
|||
|
|
@ -33,4 +33,6 @@ abstract class VehicleStatus extends Enum
|
|||
public const DAMAGED = 3;
|
||||
|
||||
public const OUT_OF_ORDER = 4;
|
||||
|
||||
public const MAINTENANCE = 5;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,4 +14,27 @@ declare(strict_types=1);
|
|||
|
||||
return ['FleetManagement' => [
|
||||
'Vehicle' => 'Vehicle',
|
||||
'Vehicles' => 'Vehicles',
|
||||
'Status' => 'Status',
|
||||
'Name' => 'Name',
|
||||
'Type' => 'Type',
|
||||
'Make' => 'Make',
|
||||
'Model' => 'Model',
|
||||
'Start' => 'Start',
|
||||
'End' => 'End',
|
||||
'Profile' => 'Profile',
|
||||
'Attributes' => 'Attributes',
|
||||
'Files' => 'Files',
|
||||
'Notes' => 'Notes',
|
||||
'Inspections' => 'Inspections',
|
||||
'Drivers' => 'Drivers',
|
||||
'Milage' => 'Milage',
|
||||
'Driver' => 'Driver',
|
||||
'Vin' => 'Vin',
|
||||
'PurchasePrice' => 'Purchase Price',
|
||||
'LeasingFee' => 'Leasing Fee',
|
||||
':status1' => 'Active',
|
||||
':status2' => 'Inactive',
|
||||
':status3' => 'Damaged',
|
||||
':status4' => 'Out of order',
|
||||
]];
|
||||
|
|
|
|||
71
Theme/Backend/attribute-type-list.tpl.php
Executable file
71
Theme/Backend/attribute-type-list.tpl.php
Executable file
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ItemManagement
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
$attributes = $this->getData('attributes');
|
||||
|
||||
echo $this->getData('nav')->render(); ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<section class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('AttributeTypes', 'Attribute', 'Backend'); ?><i class="fa fa-download floatRight download btn"></i></div>
|
||||
<div class="slider">
|
||||
<table id="iAttributeTypeList" class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $this->getHtml('ID', '0', '0'); ?>
|
||||
<label for="iAttributeTypeList-sort-1">
|
||||
<input type="radio" name="iAttributeTypeList-sort" id="iAttributeTypeList-sort-1">
|
||||
<i class="sort-asc fa fa-chevron-up"></i>
|
||||
</label>
|
||||
<label for="iAttributeTypeList-sort-2">
|
||||
<input type="radio" name="iAttributeTypeList-sort" id="iAttributeTypeList-sort-2">
|
||||
<i class="sort-desc fa fa-chevron-down"></i>
|
||||
</label>
|
||||
<label>
|
||||
<i class="filter fa fa-filter"></i>
|
||||
</label>
|
||||
<td class="wf-100"><?= $this->getHtml('Name'); ?>
|
||||
<label for="iAttributeTypeList-sort-2">
|
||||
<input type="radio" name="iAttributeTypeList-sort" id="iAttributeTypeList-sort-2">
|
||||
<i class="sort-asc fa fa-chevron-up"></i>
|
||||
</label>
|
||||
<label for="iAttributeTypeList-sort-3">
|
||||
<input type="radio" name="iAttributeTypeList-sort" id="iAttributeTypeList-sort-3">
|
||||
<i class="sort-desc fa fa-chevron-down"></i>
|
||||
</label>
|
||||
<label>
|
||||
<i class="filter fa fa-filter"></i>
|
||||
</label>
|
||||
<tbody>
|
||||
<?php
|
||||
$count = 0;
|
||||
foreach ($attributes as $key => $value) : ++$count;
|
||||
$url = UriFactory::build('{/base}/fleet/vehicle/attribute/type?{?}&id=' . $value->id);
|
||||
?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td><a href="<?= $url; ?>"><?= $value->id; ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getL11n()); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr><td colspan="2" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
98
Theme/Backend/attribute-type.tpl.php
Executable file
98
Theme/Backend/attribute-type.tpl.php
Executable file
|
|
@ -0,0 +1,98 @@
|
|||
<?php
|
||||
/**
|
||||
* Karaka
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Tasks
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Modules\Attribute\Models\AttributeValueType;
|
||||
use phpOMS\Localization\ISO639Enum;
|
||||
|
||||
$types = AttributeValueType::getConstants();
|
||||
|
||||
$attribute = $this->getData('attribute');
|
||||
$l11ns = $this->getData('l11ns');
|
||||
|
||||
echo $this->getData('nav')->render(); ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-xs-12">
|
||||
<section id="task" class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Attribute', 'Attribute', 'Backend'); ?></div>
|
||||
|
||||
<div class="portlet-body">
|
||||
<div class="form-group">
|
||||
<label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
|
||||
<input type="text" value="<?= $this->printHtml((string) $attribute->id); ?>" disabled>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iName"><?= $this->getHtml('Name', 'Attribute', 'Backend'); ?></label>
|
||||
<input id="iNAme" type="text" value="<?= $this->printHtml($attribute->name); ?>" disabled>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iType"><?= $this->getHtml('Datatype', 'Attribute', 'Backend'); ?></label>
|
||||
<select id="iType" name="type" disabled>
|
||||
<?php foreach ($types as $key => $type) : ?>
|
||||
<option value="<?= $type; ?>"<?= $type === $attribute->datatype ? ' selected' : ''; ?>><?= $this->printHtml($key); ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iPattern"><?= $this->getHtml('Pattern', 'Attribute', 'Backend'); ?></label>
|
||||
<input id="iPattern" type="text" value="<?= $this->printHtml($attribute->validationPAttern); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="checkbox" for="iRequired">
|
||||
<input id="iRequired" type="checkbox" name="required" value="1"<?= $attribute->isRequired ? ' checked' : ''; ?>>
|
||||
<span class="checkmark"></span>
|
||||
<?= $this->getHtml('IsRequired', 'Attribute', 'Backend'); ?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="checkbox" for="iCustom">
|
||||
<input id="iCustom" type="checkbox" name="custom" value="1" <?= $attribute->custom ? ' checked' : ''; ?>>
|
||||
<span class="checkmark"></span>
|
||||
<?= $this->getHtml('CustomValue', 'Attribute', 'Backend'); ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<div class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Language', '0', '0'); ?><i class="fa fa-download floatRight download btn"></i></div>
|
||||
<table class="default">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>
|
||||
<td>
|
||||
<td><?= $this->getHtml('Language', '0', '0'); ?>
|
||||
<td class="wf-100"><?= $this->getHtml('Title', 'Attribute', 'Backend'); ?>
|
||||
<tbody>
|
||||
<?php $c = 0; foreach ($l11ns as $key => $value) : ++$c; ?>
|
||||
<tr>
|
||||
<td><a href="#"><i class="fa fa-times"></i></a>
|
||||
<td><a href="#"><i class="fa fa-cogs"></i></a>
|
||||
<td><?= ISO639Enum::getByName('_' . \strtoupper($value->getLanguage())); ?>
|
||||
<td><?= $value->content; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($c === 0) : ?>
|
||||
<tr><td colspan="3" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -13,7 +13,6 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Modules\Media\Models\NullMedia;
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
|
|
@ -78,21 +77,18 @@ echo $this->getData('nav')->render(); ?>
|
|||
<i class="filter fa fa-filter"></i>
|
||||
</label>
|
||||
<tbody>
|
||||
<?php $count = 0; foreach ($vehicles as $key => $value) : ++$count;
|
||||
$url = UriFactory::build('{/base}/sales/vehicle/profile?{?}&id=' . $value->id);
|
||||
$image = $value->getFileByTypeName('vehicle_profile_image');
|
||||
?>
|
||||
<?php
|
||||
$count = 0;
|
||||
foreach ($vehicles as $key => $value) :
|
||||
++$count;
|
||||
$url = UriFactory::build('{/base}/fleet/vehicle/profile?{?}&id=' . $value->id);
|
||||
?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td><a href="<?= $url; ?>"><img alt="<?= $this->getHtml('IMG_alt_vehicle'); ?>" width="30" loading="lazy" class="item-image"
|
||||
src="<?= $image->id === 0 ?
|
||||
UriFactory::build('Web/Backend/img/user_default_' . \mt_rand(1, 6) .'.png') :
|
||||
UriFactory::build('{/base}/' . $image->getPath()); ?>"></a>
|
||||
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->number); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->profile->account->name1); ?> <?= $this->printHtml($value->profile->account->name2); ?></a>
|
||||
<td data-label="<?= $this->getHtml('City'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->mainAddress->city); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Zip'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->mainAddress->postal); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Address'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->mainAddress->address); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Country'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->mainAddress->getCountry()); ?></a>
|
||||
<td>
|
||||
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml((string) $value->id); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Status'); ?>"><a href="<?= $url; ?>"><?= $this->getHtml(':status' . $value->status); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Type'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->type->getL11n()); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr><td colspan="8" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
|
|
|
|||
|
|
@ -13,17 +13,21 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
use Modules\FleetManagement\Models\NullVehicle;
|
||||
use Modules\Profile\Models\ContactType;
|
||||
use Modules\FleetManagement\Models\VehicleStatus;
|
||||
use Modules\Media\Models\NullMedia;
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
$countryCodes = \phpOMS\Localization\ISO3166TwoEnum::getConstants();
|
||||
$countries = \phpOMS\Localization\ISO3166NameEnum::getConstants();
|
||||
$vehicleStatus = VehicleStatus::getConstants();
|
||||
|
||||
/**
|
||||
* @var \Modules\FleetManagement\Models\Vehicle $vehicle
|
||||
*/
|
||||
$vehicle = $this->getData('vehicle') ?? new NullVehicle();
|
||||
$files = $client->getFiles();
|
||||
$files = $vehicle->getFiles();
|
||||
$vehicleImage = $this->getData('vehicleImage') ?? new NullMedia();
|
||||
$vehicleTypes = $this->getData('types') ?? [];
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
|
|
@ -33,11 +37,11 @@ echo $this->getData('nav')->render();
|
|||
<div class="tabview tab-2">
|
||||
<div class="box">
|
||||
<ul class="tab-links">
|
||||
<li><label for="c-tab-1"><?= $this->getHtml('Profile'); ?></label></li>
|
||||
<li><label for="c-tab-1"><?= $this->getHtml('Profile'); ?></label>
|
||||
<li><label for="c-tab-6"><?= $this->getHtml('Attributes'); ?></label>
|
||||
<li><label for="c-tab-3"><?= $this->getHtml('Files'); ?></label></li>
|
||||
<li><label for="c-tab-3"><?= $this->getHtml('Notes'); ?></label></li>
|
||||
<li><label for="c-tab-4"><?= $this->getHtml('Inspections'); ?></label></li>
|
||||
<li><label for="c-tab-3"><?= $this->getHtml('Files'); ?></label>
|
||||
<li><label for="c-tab-3"><?= $this->getHtml('Notes'); ?></label>
|
||||
<li><label for="c-tab-4"><?= $this->getHtml('Inspections'); ?></label>
|
||||
<li><label for="c-tab-5"><?= $this->getHtml('Drivers'); ?></label>
|
||||
<li><label for="c-tab-6"><?= $this->getHtml('Milage'); ?></label>
|
||||
</ul>
|
||||
|
|
@ -45,69 +49,84 @@ echo $this->getData('nav')->render();
|
|||
<div class="tab-content">
|
||||
<input type="radio" id="c-tab-1" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
|
||||
<div class="tab">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-8">
|
||||
<section class="portlet">
|
||||
<div class="form-group">
|
||||
<label for="iFleetVehicleProfileName"><?= $this->getHtml('Name'); ?></label>
|
||||
<input type="text" id="iFleetVehicleProfileName" name="name" value="<?= $this->printHtml($vehicle->name); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iVehicleEnd"><?= $this->getHtml('Type'); ?></label>
|
||||
<input type="text" id="iVehicleEnd" name="vehicle_type" value="<?= $this->printHtml($vehivle->getAttribute('vehicle_type')->value->getValue()); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iVehicleMake"><?= $this->getHtml('make'); ?></label>
|
||||
<input type="text" id="iVehicleMake" name="make" value="<?= $this->printHtml($vehivle->getAttribute('maker')->value->getValue()); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iVehicleModel"><?= $this->getHtml('Model'); ?></label>
|
||||
<input type="text" id="iVehicleModel" name="vehicle_model" value="<?= $this->printHtml($vehivle->getAttribute('vehicle_model')->value->getValue()); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iVehicleStart"><?= $this->getHtml('Start'); ?></label>
|
||||
<input type="text" id="iVehicleStart" name="ownership_start" value="<?= $vehivle->getAttribute('ownership_start')->value->getValue()->format('Y-m-d'); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iVehicleEnd"><?= $this->getHtml('End'); ?></label>
|
||||
<input type="text" id="iVehicleEnd" name="ownership_end" value="<?= $vehivle->getAttribute('ownership_end')->value->getValue()->format('Y-m-d'); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iVehiclePrice"><?= $this->getHtml('PurchasePrice'); ?></label>
|
||||
<input type="text" id="iVehiclePrice" name="purchase_price" value="<?= $this->printHtml($vehivle->getAttribute('purchase_price')->value->getValue()); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iVehiclePrice"><?= $this->getHtml('LeasingFee'); ?></label>
|
||||
<input type="text" id="iVehiclePrice" name="leasing_fee" value="<?= $this->printHtml($vehivle->getAttribute('leasing_fee')->value->getValue()); ?>">
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-md-4 sm-hidden">
|
||||
<section class="portlet">
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<section class="portlet">
|
||||
<!-- Notes -->
|
||||
<div class="portlet-head"><?= $this->getHtml('Profile'); ?></div>
|
||||
<div class="portlet-body">
|
||||
<div class="form-group">
|
||||
<label for="iFleetVehicleProfileName"><?= $this->getHtml('Name'); ?></label>
|
||||
<input type="text" id="iFleetVehicleProfileName" name="name" value="<?= $this->printHtml($vehicle->name); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iVehicleDriver"><?= $this->getHtml('Driver'); ?></label>
|
||||
<input type="text" id="iVehicleDriver" name="driver" value="" disabled>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iVehicleVin"><?= $this->getHtml('Vin'); ?></label>
|
||||
<input type="text" id="iVehicleVin" name="vin" value="<?= $this->printHtml($vehicle->getAttribute('vin')->value->getValue()); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iVehicleStatus"><?= $this->getHtml('Status'); ?></label>
|
||||
<select id="iVehicleStatus" name="vehicle_status">
|
||||
<?php foreach ($vehicleStatus as $status) : ?>
|
||||
<option value="<?= $status; ?>"<?= $status === $vehicle->status ? ' selected' : ''; ?>><?= $this->getHtml(':status' . $status); ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iVehicleEnd"><?= $this->getHtml('Type'); ?></label>
|
||||
<select id="iVehicleEnd" name="vehicle_type">
|
||||
<?php foreach ($vehicleTypes as $type) : ?>
|
||||
<option value="<?= $type->id; ?>"<?= $vehicle->type->id === $type->id ? ' selected' : ''; ?>><?= $this->printHtml($type->getL11n()); ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iVehicleMake"><?= $this->getHtml('Make'); ?></label>
|
||||
<input type="text" id="iVehicleMake" name="make" value="<?= $this->printHtml($vehicle->getAttribute('maker')->value->getValue()); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iVehicleModel"><?= $this->getHtml('Model'); ?></label>
|
||||
<input type="text" id="iVehicleModel" name="vehicle_model" value="<?= $this->printHtml($vehicle->getAttribute('vehicle_model')->value->getValue()); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iVehicleStart"><?= $this->getHtml('Start'); ?></label>
|
||||
<input type="datetime-local" id="iVehicleStart" name="ownership_start" value="<?= $vehicle->getAttribute('ownership_start')->value->getValue()?->format('Y-m-d\TH:i') ?? $vehicle->createdAt->format('Y-m-d\TH:i'); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iVehicleEnd"><?= $this->getHtml('End'); ?></label>
|
||||
<input type="datetime-local" id="iVehicleEnd" name="ownership_end" value="<?= $vehicle->getAttribute('ownership_end')->value->getValue()?->format('Y-m-d\TH:i'); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iVehiclePrice"><?= $this->getHtml('PurchasePrice'); ?></label>
|
||||
<input type="text" id="iVehiclePrice" name="purchase_price" value="<?= $this->printHtml($vehicle->getAttribute('purchase_price')->value->getValue()); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iVehiclePrice"><?= $this->getHtml('LeasingFee'); ?></label>
|
||||
<input type="text" id="iVehiclePrice" name="leasing_fee" value="<?= $this->printHtml($vehicle->getAttribute('leasing_fee')->value->getValue()); ?>">
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<div class="md-hidden col-md-6">
|
||||
<section class="portlet">
|
||||
<!-- Files/Locations/??? -->
|
||||
<div class="portlet-body">
|
||||
<img width="100%" src="<?= $vehicleImage->id === 0
|
||||
? 'Web/Backend/img/logo_grey.png'
|
||||
: UriFactory::build($vehicleImage->getPath()); ?>"></a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user