dbms_init...1
This commit is contained in:
parent
0464a2904a
commit
5034d870cd
@ -77,15 +77,6 @@ class ServiceController extends CustomerController
|
||||
'fields' => ['clientinfo_uid', 'type', 'billing_at', 'rack', 'LINE', 'SERVER', 'IP', 'CPU', 'RAM', 'DISK', 'SOFTWARE', 'DEFENCE', 'start_at', 'status'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
// $this->modal_type = 'modal_fetch_v2'; //기본은 modal_iframe임
|
||||
return parent::index_process();
|
||||
// $entities = [];
|
||||
// foreach (parent::index_process() as $entity) {
|
||||
// $entity->setPartEntities("CPU", $this->getCpuService()->getPartEntities($entity));
|
||||
// $entity->setPartEntities("RAM", $this->getRamService()->getPartEntities($entity));
|
||||
// $entity->setPartEntities("DISK", $this->getDiskService()->getPartEntities($entity));
|
||||
// $entities[] = $entity;
|
||||
// }
|
||||
// return $entities;
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,9 +71,9 @@ class ServerController extends EquipmentController
|
||||
// $this->modal_type = 'modal_fetch_v2'; //기본은 modal_iframe임
|
||||
$entities = [];
|
||||
foreach (parent::index_process() as $entity) {
|
||||
$entity->setPartEntities("CPU", $this->getCpuService()->getPartEntities($entity));
|
||||
$entity->setPartEntities("RAM", $this->getRamService()->getPartEntities($entity));
|
||||
$entity->setPartEntities("DISK", $this->getDiskService()->getPartEntities($entity));
|
||||
$entity->setPartEntities("CPU", $this->getCpuService()->getAdapterEntities($entity));
|
||||
$entity->setPartEntities("RAM", $this->getRamService()->getAdapterEntities($entity));
|
||||
$entity->setPartEntities("DISK", $this->getDiskService()->getAdapterEntities($entity));
|
||||
$entities[] = $entity;
|
||||
}
|
||||
return $entities;
|
||||
|
||||
@ -2,24 +2,10 @@
|
||||
|
||||
namespace App\Entities\Customer;
|
||||
|
||||
use App\Entities\Equipment\PartEntity;
|
||||
use App\Models\Customer\ServiceModel;
|
||||
|
||||
class ServiceEntity extends CustomerEntity
|
||||
{
|
||||
const PK = ServiceModel::PK;
|
||||
const TITLE = ServiceModel::TITLE;
|
||||
|
||||
public function getPartEntities(string $type): array
|
||||
{
|
||||
return $this->attributes[$type] ?? [];
|
||||
}
|
||||
public function setPartEntities(string $type, array $partEntities): void
|
||||
{
|
||||
if (!isset($this->attributes[$type])) {
|
||||
$this->attributes[$type] = [];
|
||||
}
|
||||
$this->attributes[$type] = $partEntities;
|
||||
// $this->attributes[$type] = array_unique($this->attributes[$type], SORT_REGULAR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,39 +13,4 @@ class ServiceHelper extends CustomerHelper
|
||||
parent::__construct($request);
|
||||
$this->setTitleField(field: ServiceModel::TITLE);
|
||||
}
|
||||
public function getFieldView(string $field, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
$value = $viewDatas['entity']->$field ?? "";
|
||||
switch ($field) {
|
||||
case "LINE":
|
||||
case "SERVER":
|
||||
case "IP":
|
||||
case "CPU":
|
||||
case "RAM":
|
||||
case "DISK":
|
||||
case "DEFENCE":
|
||||
case "SOFTWARE":
|
||||
$temps = [];
|
||||
foreach ($viewDatas['entity']->getPartEntities($field) as $partEntity) {
|
||||
$temps[] = "<div>" . $partEntity->getTitle() . "</div>";
|
||||
}
|
||||
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
|
||||
$temps[] = form_label(
|
||||
'변경',
|
||||
$field,
|
||||
[
|
||||
"data-src" => "/admin/customer/link/" . strtolower($field) . "?&serviceinfo_uid={$viewDatas['entity']->getPK()}",
|
||||
"data-bs-toggle" => "modal",
|
||||
"data-bs-target" => "#index_action_form",
|
||||
...$extras
|
||||
]
|
||||
);
|
||||
$value = implode("", $temps);
|
||||
break;
|
||||
default:
|
||||
$value = parent::getFieldView($field, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,11 +17,11 @@ abstract class LinkService extends EquipmentService
|
||||
}
|
||||
abstract protected function getAdapterService(): mixed;
|
||||
abstract protected function getAdapterField(): string;
|
||||
final public function getPartEntities(ServerEntity $serverEntity): array
|
||||
final public function getAdapterEntities(ServerEntity $serverEntity): array
|
||||
{
|
||||
$entities = [];
|
||||
foreach ($this->getEntities(['serverinfo_uid' => $serverEntity->getPK()]) as $entity) {
|
||||
$entities[] = $this->getAdapterService()->getEntity($entity->getPartInfoUID());
|
||||
$entities[] = $this->getAdapterService()->getEntity($entity->getAdapterInfoUID());
|
||||
}
|
||||
return $entities;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user