From 5a3b04a0e91b5a4d62cdd3856474fbe141f5d3b8 Mon Sep 17 00:00:00 2001 From: "choi.jh" Date: Mon, 15 Sep 2025 14:04:19 +0900 Subject: [PATCH] dbmsv2 init...1 --- app/Cells/Equipment/ServerPartCell.php | 64 +++++++++++++------ .../Admin/Customer/ServiceController.php | 1 + app/Helpers/Customer/ServiceHelper.php | 5 -- app/Helpers/Equipment/ServerPartHelper.php | 26 ++++---- app/Services/Equipment/EquipmentService.php | 3 +- app/Views/admin/server/index.php | 6 +- app/Views/admin/server/view.php | 5 +- app/Views/admin/service/index.php | 43 +++++++++++-- app/Views/admin/service/view.php | 5 +- app/Views/admin/welcome/new_service.php | 6 +- app/Views/cells/serverpart/part_service.php | 10 ++- app/Views/cells/service/detail.php | 6 +- 12 files changed, 127 insertions(+), 53 deletions(-) diff --git a/app/Cells/Equipment/ServerPartCell.php b/app/Cells/Equipment/ServerPartCell.php index 8196002..4430514 100644 --- a/app/Cells/Equipment/ServerPartCell.php +++ b/app/Cells/Equipment/ServerPartCell.php @@ -4,38 +4,60 @@ namespace App\Cells\Equipment; use App\Services\Equipment\ServerPartService; +use App\Services\Equipment\ServerService; class ServerPartCell extends EquipmentCell { + private ?ServerService $_serverService = null; public function __construct() { parent::__construct(new ServerPartService()); } + final public function getServerService(): ServerService + { + if (!$this->_serverService) { + $this->_serverService = new ServerService(); + } + return $this->_serverService; + } + 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()] = []; + $result = ""; + if (array_key_exists('serverinfo_uid', $params)) { + $this->getService()->setAction(__FUNCTION__); + $this->getService()->setFormFields(); + $this->getService()->setFormFilters(); + $this->getService()->setFormRules(); + $this->getService()->setFormOptions(); + // dd($params); + //서버정보 + $serverEntity = $this->getServerService()->getEntity($params['serverinfo_uid']); + if (!$serverEntity) { + return "[{$params['serverinfo_uid']}]에 해당하는 서버정보가 지정되지 않았거나 존재하지 않습니다."; } - $entities[$entity->getType()][] = $entity; + //서버파트정보 + $serverPartEntities = $this->getService()->getEntities(['serverinfo_uid' => $serverEntity->getPK(),]); + $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__; + $result = view('cells/serverpart/' . $template, [ + 'serverPartCellDatas' => [ + 'control' => $this->getService()->getControlDatas(), + 'service' => $this->getService(), + 'serverinfo_uid' => $params['serverinfo_uid'], + 'entities' => $entities, + 'serverEntity' => $serverEntity, + 'types' => $params['types'], + ], + ]); } - $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'], - ] - ]); + return $result; } } diff --git a/app/Controllers/Admin/Customer/ServiceController.php b/app/Controllers/Admin/Customer/ServiceController.php index 1d26eed..a540a26 100644 --- a/app/Controllers/Admin/Customer/ServiceController.php +++ b/app/Controllers/Admin/Customer/ServiceController.php @@ -41,6 +41,7 @@ class ServiceController extends CustomerController { switch ($this->getService()->getAction()) { case 'view': + case 'index': $this->service = $this->getService(); $this->control = $this->getService()->getControlDatas(); $this->getService()->getHelper()->setViewDatas($this->getViewDatas()); diff --git a/app/Helpers/Customer/ServiceHelper.php b/app/Helpers/Customer/ServiceHelper.php index 004171f..613c5e8 100644 --- a/app/Helpers/Customer/ServiceHelper.php +++ b/app/Helpers/Customer/ServiceHelper.php @@ -68,11 +68,6 @@ class ServiceHelper extends CustomerHelper case 'clientinfo_uid': $value = "" . $viewDatas['control']['field_optons'][$field][$value]->getTitle() . ""; break; - case 'serverinfo_uid': - $value = $viewDatas['entity']->getServerEntity()->getCode(); - $value .= " /" . view_cell("\App\Cells\Equipment\ServerPartCell::parttable", ['serverinfo_uid' => $viewDatas['entity']->getServerEntity()->getPK(), 'types' => SERVERPART['SERVICE_PARTTYPES'], 'template' => 'part_service']); - $value .= "
COPY
"; - break; case 'billing_at': if (array_key_exists('unPaids', $viewDatas)) { if (array_key_exists($viewDatas['entity']->getPK(), $viewDatas['unPaids'])) { diff --git a/app/Helpers/Equipment/ServerPartHelper.php b/app/Helpers/Equipment/ServerPartHelper.php index 7beb9ef..ee8f690 100644 --- a/app/Helpers/Equipment/ServerPartHelper.php +++ b/app/Helpers/Equipment/ServerPartHelper.php @@ -88,17 +88,21 @@ class ServerPartHelper extends EquipmentHelper $title = $entity->getTitle(); $title .= $entity->getCnt() > 1 ? "*" . $entity->getCnt() . "개" : ""; $title .= $entity->getExtra() !== "" ? "/" . $entity->getExtra() : ""; - $temps[] = form_label( - $title, - $field, - [ - "data-src" => "/admin/equipment/serverpart/modify/{$entity->getPK()}?type={$entity->getType()}&ActionTemplate=popup", - "data-bs-toggle" => "modal", - "data-bs-target" => "#index_action_form", - "class" => "btn btn-sm btn-outline btn-circle", - "target" => "_self" - ] - ); + if (array_key_exists('return_type', $extras) && $extras['return_type'] === 'text') { + $temps[] = $title; + } else { + $temps[] = form_label( + $title, + $field, + [ + "data-src" => "/admin/equipment/serverpart/modify/{$entity->getPK()}?type={$entity->getType()}&ActionTemplate=popup", + "data-bs-toggle" => "modal", + "data-bs-target" => "#index_action_form", + "class" => "btn btn-sm btn-outline btn-circle", + "target" => "_self" + ] + ); + } } $value = implode(",", $temps); break; diff --git a/app/Services/Equipment/EquipmentService.php b/app/Services/Equipment/EquipmentService.php index 2b670bf..684dbb7 100644 --- a/app/Services/Equipment/EquipmentService.php +++ b/app/Services/Equipment/EquipmentService.php @@ -11,7 +11,6 @@ use App\Services\Customer\ClientService; use App\Services\Customer\ServiceService; use App\Services\Equipment\ServerService; use App\Services\UserService; -use CodeIgniter\Model; abstract class EquipmentService extends CommonService { @@ -80,7 +79,7 @@ abstract class EquipmentService extends CommonService { $entity = $this->getClientService()->getEntity($uid); if (!$entity) { - throw new \Exception("{$uid}에 해당하는 고객정보가 존재하지 않습니다. uid: {$uid}"); + throw new \Exception("{$uid}에 해당하는 고객정보가 존재하지 않습니다."); } return $entity; } diff --git a/app/Views/admin/server/index.php b/app/Views/admin/server/index.php index 1d14b81..b020f9e 100644 --- a/app/Views/admin/server/index.php +++ b/app/Views/admin/server/index.php @@ -73,7 +73,11 @@ getHelper()->getFieldView('title', $entity->getTitle(), $viewDatas) ?> - $entity->getPK(), 'types' => SERVERPART['SERVER_PARTTYPES'], 'template' => 'part_server']) ?> + $entity->getPK(), + 'types' => SERVERPART['SERVER_PARTTYPES'], + 'template' => 'part_server' + ]) ?> getHelper()->getFieldView('price', $entity->price, $viewDatas) ?> diff --git a/app/Views/admin/server/view.php b/app/Views/admin/server/view.php index a5fbd10..24ab460 100644 --- a/app/Views/admin/server/view.php +++ b/app/Views/admin/server/view.php @@ -24,7 +24,10 @@ - $viewDatas['entity']->getPK(), 'types' => SERVERPART['PARTTYPES']]) ?>> + $viewDatas['entity']->getPK(), + 'types' => SERVERPART['PARTTYPES'] + ]) ?>>
"btn btn-outline btn-primary")); ?>
diff --git a/app/Views/admin/service/index.php b/app/Views/admin/service/index.php index 17fe273..0f20c91 100644 --- a/app/Views/admin/service/index.php +++ b/app/Views/admin/service/index.php @@ -47,9 +47,8 @@ getHelper()->getListLabel('clientinfo_uid', lang("{$viewDatas['class_path']}.label.clientinfo_uid"), $viewDatas) ?> - getHelper()->getListLabel('serverinfo_uid', lang("{$viewDatas['class_path']}.label.serverinfo_uid"), $viewDatas) ?> + 서버정보
All COPY
- 부품정보 getHelper()->getListLabel('billing_at', lang("{$viewDatas['class_path']}.label.billing_at"), $viewDatas) ?> @@ -84,10 +83,11 @@ getHelper()->getFieldView('clientinfo_uid', $entity->clientinfo_uid, $viewDatas) ?> - getHelper()->getFieldView('serverinfo_uid', $entity->serverinfo_uid, $viewDatas) ?> - - - $entity->getServerEntity()->getPK(), 'types' => SERVERPART['SERVICE_PARTTYPES'], 'template' => 'part_service']) ?> + $entity->getServerEntity()->getPK(), + 'types' => SERVERPART['SERVICE_PARTTYPES'], + 'template' => 'part_service' + ]) ?> getHelper()->getFieldView('billing_at', $entity->billing_at, $viewDatas) ?> @@ -120,4 +120,35 @@
include(LAYOUTS[$viewDatas['layout']]['path'] . '/bottom'); ?>
+ endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/service/view.php b/app/Views/admin/service/view.php index 41cf6ff..9249e3b 100644 --- a/app/Views/admin/service/view.php +++ b/app/Views/admin/service/view.php @@ -22,7 +22,10 @@ - $viewDatas['entity']->getServerEntity()->getPK(), 'types' => SERVERPART['PARTTYPES']]) ?> + $viewDatas['entity']->getServerEntity()->getPK(), + 'types' => SERVERPART['PARTTYPES'] + ]) ?>
include("templates/{$viewDatas['layout']}/form_content_bottom"); ?>
diff --git a/app/Views/admin/welcome/new_service.php b/app/Views/admin/welcome/new_service.php index daafdbc..387f5ac 100644 --- a/app/Views/admin/welcome/new_service.php +++ b/app/Views/admin/welcome/new_service.php @@ -27,7 +27,11 @@ getHelper()->getFieldView('clientinfo_uid', $entity->getClientInfoUID(), $viewDatas) ?> getHelper()->getFieldView('type', $entity->getType(), $viewDatas) ?> getHelper()->getFieldView('serveripinfo_uid', $entity->getServerEntity()->getCode(), $viewDatas) ?> - $entity->getServerEntity()->getPK(), 'types' => SERVERPART['SERVICE_PARTTYPES'], 'template' => 'part_service']) ?> + $entity->getServerEntity()->getPK(), + 'types' => SERVERPART['SERVICE_PARTTYPES'], + 'template' => 'part_service' + ]) ?> getHelper()->getFieldView('user_uid', $entity->getUserUID(), $viewDatas) ?> diff --git a/app/Views/cells/serverpart/part_service.php b/app/Views/cells/serverpart/part_service.php index 5444649..85eea13 100644 --- a/app/Views/cells/serverpart/part_service.php +++ b/app/Views/cells/serverpart/part_service.php @@ -1,5 +1,9 @@ - +getCode()] ?> - getHelper()->getListButton($type, '', $serverPartCellDatas) . $serverPartCellDatas['service']->getHelper()->getFieldView($type, "", $serverPartCellDatas) ?> + getHelper()->getFieldView($type, '', $serverPartCellDatas, ['return_type' => 'text']); ?> + getHelper()->getListButton($type, '', $serverPartCellDatas) ?> + getHelper()->getFieldView($type, '', $serverPartCellDatas) ?> - \ No newline at end of file + + +
COPY
\ No newline at end of file diff --git a/app/Views/cells/service/detail.php b/app/Views/cells/service/detail.php index 366172e..73e1374 100644 --- a/app/Views/cells/service/detail.php +++ b/app/Views/cells/service/detail.php @@ -30,7 +30,11 @@
getHelper()->getFieldView('location', $entity->getLocation(), $serviceCellDatas) ?>
getHelper()->getFieldView('type', $entity->getType(), $serviceCellDatas) ?>
- $entity->getServerEntity()->getPK(), 'types' => SERVERPART['SERVICE_PARTTYPES'], 'template' => 'part_detail']) ?> + $entity->getServerEntity()->getPK(), + 'types' => SERVERPART['SERVICE_PARTTYPES'], + 'template' => 'part_detail' + ]) ?> getPK()}?return_url=" . urlencode(current_url()), ['method' => "post"]) ?>