42 lines
1.2 KiB
PHP
42 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Cells\Equipment;
|
|
|
|
|
|
use App\Services\Equipment\ServerPartService;
|
|
|
|
class ServerPartCell extends EquipmentCell
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct(new ServerPartService());
|
|
}
|
|
|
|
public function parttable(array $params): string
|
|
{
|
|
$this->getService()->setAction(__FUNCTION__);
|
|
$this->getService()->setFormFields();
|
|
$this->getService()->setFormFilters();
|
|
$this->getService()->setFormRules();
|
|
$this->getService()->setFormOptions();
|
|
$serverPartEntities = $this->getService()->getEntities(['serverinfo_uid' => $params['serverinfo_uid']]);
|
|
$entities = [];
|
|
foreach ($serverPartEntities as $entity) {
|
|
if (!array_key_exists($entity->getType(), $entities)) {
|
|
$entities[$entity->getType()] = [];
|
|
}
|
|
$entities[$entity->getType()][] = $entity;
|
|
}
|
|
$template = array_key_exists('template', $params) ? $params['template'] : __FUNCTION__;
|
|
return view('cells/serverpart/' . $template, [
|
|
'serverPartCellDatas' => [
|
|
'control' => $this->getService()->getControlDatas(),
|
|
'service' => $this->getService(),
|
|
'entities' => $entities,
|
|
'serverinfo_uid' => $params['serverinfo_uid'],
|
|
'types' => $params['types'],
|
|
]
|
|
]);
|
|
}
|
|
}
|