diff --git a/app/Controllers/Admin/Customer/CustomerController.php b/app/Controllers/Admin/Customer/CustomerController.php index d0fdaa2..c1eca2e 100644 --- a/app/Controllers/Admin/Customer/CustomerController.php +++ b/app/Controllers/Admin/Customer/CustomerController.php @@ -7,12 +7,14 @@ use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; use Psr\Log\LoggerInterface; +use App\Services\Customer\ServiceService; use App\Services\Customer\AccountService; use App\Services\Customer\CouponService; use App\Services\Customer\PointService; abstract class CustomerController extends AdminController { + private ?ServiceService $_serviceService = null; private ?AccountService $_accountService = null; private ?CouponService $_couponService = null; private ?PointService $_pointService = null; @@ -22,6 +24,14 @@ abstract class CustomerController extends AdminController $this->uri_path .= 'customer/'; // $this->view_path .= "customer" . DIRECTORY_SEPARATOR; } + + final public function getServiceService(): ServiceService + { + if (!$this->_serviceService) { + $this->_serviceService = new ServiceService($this->request); + } + return $this->_serviceService; + } final public function getAccountService(): AccountService { if (!$this->_accountService) { diff --git a/app/Controllers/Admin/Customer/ServiceController.php b/app/Controllers/Admin/Customer/ServiceController.php index 72d0ff3..e6f6031 100644 --- a/app/Controllers/Admin/Customer/ServiceController.php +++ b/app/Controllers/Admin/Customer/ServiceController.php @@ -2,23 +2,28 @@ namespace App\Controllers\Admin\Customer; -use App\Services\Equipment\ServerService; use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; -use CodeIgniter\Validation\Validation; use Psr\Log\LoggerInterface; -use App\Entities\Customer\ServicePartEntity; -use App\Services\Customer\ServicePartService; +use App\Entities\Customer\ServiceEntity; use App\Helpers\Customer\ServiceHelper; use App\Services\Customer\ServiceService; + +use App\Services\Equipment\ServerService; +use App\Entities\Customer\ServiceServerEntity; +use App\Services\Customer\ServiceServerService; use App\Services\Equipment\PartService; +use App\Services\Customer\ServicePartService; use App\Services\Equipment\IpService; + class ServiceController extends CustomerController { private ?ServerService $_serverService = null; + private ?ServiceServerService $_serviceServerService = null; private ?PartService $_partService = null; + private ?ServicePartService $_servicePartService = null; private ?IpService $_ipService = null; public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { @@ -28,8 +33,8 @@ class ServiceController extends CustomerController $this->class_path = $this->getService()->getClassPath(); $this->title = lang("{$this->getService()->getClassPath()}.title"); $this->helper = $this->getHelper(); - $this->individualStylesheets = ['server_partinfo.css']; - $this->individualScripts = ['server_partinfo.js']; + // $this->individualStylesheets = ['server_partinfo.css']; + // $this->individualScripts = ['server_partinfo.js']; } public function getService(): ServiceService { @@ -52,6 +57,13 @@ class ServiceController extends CustomerController } return $this->_serverService; } + final public function getServiceServerService(): ServiceServerService + { + if (!$this->_serviceServerService) { + $this->_serviceServerService = new ServiceServerService($this->request); + } + return $this->_serviceServerService; + } final public function getPartService(): PartService { if (!$this->_partService) { @@ -59,6 +71,13 @@ class ServiceController extends CustomerController } return $this->_partService; } + final public function getServicePartService(): ServicePartService + { + if (!$this->_servicePartService) { + $this->_servicePartService = new ServicePartService($this->request); + } + return $this->_servicePartService; + } final public function getIpService(): IpService { if (!$this->_ipService) { @@ -81,7 +100,7 @@ class ServiceController extends CustomerController protected function index_process(): array { $fields = [ - 'fields' => ['type', 'model', 'IP', 'SERVER', 'CPU', 'RAM', 'DISK', 'status'], + 'fields' => ['type', 'billing_at', 'rack', 'SERVER', 'IP', 'CPU', 'RAM', 'DISK', 'SOFTWARE', 'DEFENCE', 'start_at', 'status'], ]; $this->init('index', $fields); $this->modal_type = 'modal_iframe'; diff --git a/app/Controllers/Admin/Customer/ServicePartController.php b/app/Controllers/Admin/Customer/ServicePartController.php index 2ee9427..b45bab1 100644 --- a/app/Controllers/Admin/Customer/ServicePartController.php +++ b/app/Controllers/Admin/Customer/ServicePartController.php @@ -46,7 +46,7 @@ class ServicePartController extends CustomerController protected function getFormFieldOption(string $field, array $options = []): array { switch ($field) { - case 'serverinfo_uid': + case 'serviceinfo_uid': $options[$field] = $this->getServiceService()->getFormFieldOption($field); break; case 'partinfo_uid': @@ -78,13 +78,13 @@ class ServicePartController extends CustomerController protected function setOrderByForList() { //OrderBy 처리 - $this->getService()->getModel()->orderBy('serverinfo_uid', 'ASC', false); + $this->getService()->getModel()->orderBy('serviceinfo_uid', 'ASC', false); parent::setOrderByForList(); } protected function index_process(): array { $fields = [ - 'fields' => ['serverinfo_uid', 'type', 'partinfo_uid'], + 'fields' => ['serviceinfo_uid', 'type', 'partinfo_uid'], ]; $this->init('index', $fields); $this->modal_type = 'modal_iframe'; diff --git a/app/Controllers/Admin/Equipment/EquipmentController.php b/app/Controllers/Admin/Equipment/EquipmentController.php index 99881bc..c5c7df8 100644 --- a/app/Controllers/Admin/Equipment/EquipmentController.php +++ b/app/Controllers/Admin/Equipment/EquipmentController.php @@ -13,7 +13,6 @@ use App\Services\Equipment\ServerService; abstract class EquipmentController extends AdminController { private ?ServerService $_serverService = null; - private ?LineService $_lineService = null; public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { parent::initController($request, $response, $logger); @@ -27,26 +26,5 @@ abstract class EquipmentController extends AdminController } return $this->_serverService; } - final public function getLineService(): LineService - { - if (!$this->_lineService) { - $this->_lineService = new LineService($this->request); - } - return $this->_lineService; - } //Index,FieldForm관련 - protected function getFormFieldOption(string $field, array $options = []): array - { - switch ($field) { - case 'lineinfo_uid': - $options[$field] = $this->getLineService()->getFormFieldOption($field); - // echo $this->getUserModel()->getLastQuery(); - // dd($options); - break; - default: - $options = parent::getFormFieldOption($field, $options); - break; - } - return $options; - } } diff --git a/app/Controllers/Admin/Equipment/ServerController.php b/app/Controllers/Admin/Equipment/ServerController.php index 86af257..46fe935 100644 --- a/app/Controllers/Admin/Equipment/ServerController.php +++ b/app/Controllers/Admin/Equipment/ServerController.php @@ -6,13 +6,11 @@ use App\Entities\Equipment\ServerEntity; use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; use Psr\Log\LoggerInterface; -use CodeIgniter\Validation\Validation; use App\Helpers\Equipment\ServerHelper; use App\Services\Equipment\ServerService; use App\Services\Equipment\PartService; use App\Services\Equipment\ServerPartService; -use App\Entities\Equipment\ServerPartEntity; class ServerController extends EquipmentController { @@ -26,8 +24,8 @@ class ServerController extends EquipmentController $this->class_path = $this->getService()->getClassPath(); $this->title = lang("{$this->getService()->getClassPath()}.title"); $this->helper = $this->getHelper(); - $this->individualStylesheets = ['server_partinfo.css']; - $this->individualScripts = ['server_partinfo.js']; + // $this->individualStylesheets = ['server_partinfo.css']; + // $this->individualScripts = ['server_partinfo.js']; } public function getService(): ServerService { diff --git a/app/Database/erp2.vuerd.json b/app/Database/erp2.vuerd.json index 9f9a86c..67699b9 100644 --- a/app/Database/erp2.vuerd.json +++ b/app/Database/erp2.vuerd.json @@ -4,9 +4,9 @@ "settings": { "width": 4000, "height": 4000, - "scrollTop": -2252.9128, - "scrollLeft": -992.9859, - "zoomLevel": 0.88, + "scrollTop": -1517.2462, + "scrollLeft": -620.6366, + "zoomLevel": 0.73, "show": 511, "database": 4, "databaseName": "", @@ -385,6 +385,7 @@ "columnIds": [ "nb5CGzskl3_LIRA0yyede", "sscrxOdwLlx94tx1j_MrH", + "jN2378kieoBKN-G1x8myT", "iM3NfWTfO6qrXv94EUFgk", "lwr6RuK8OGKJNLdd70NGS", "qnVCOfUyejx2ToAQhkmu0", @@ -400,6 +401,7 @@ "JXFtN33CEiVr8DDSQay0k", "CY-ZAs3Ns1YhoxL9UiCee", "UKMpq-uPW9JhNhwRMtBmC", + "jN2378kieoBKN-G1x8myT", "iM3NfWTfO6qrXv94EUFgk", "CITRNBpXOZqGM6gHy5MlB", "lwr6RuK8OGKJNLdd70NGS", @@ -421,7 +423,7 @@ "color": "" }, "meta": { - "updateAt": 1747727821087, + "updateAt": 1747733939677, "createAt": 1745819764139 } }, @@ -2155,7 +2157,7 @@ "widthDefault": 60 }, "meta": { - "updateAt": 1747125258424, + "updateAt": 1747733895712, "createAt": 1745819764139 } }, @@ -5006,7 +5008,7 @@ "comment": "종료일", "dataType": "DATE", "default": "", - "options": 0, + "options": 5, "ui": { "keys": 0, "widthName": 60, @@ -5015,7 +5017,7 @@ "widthDefault": 60 }, "meta": { - "updateAt": 1747371193639, + "updateAt": 1747733901576, "createAt": 1747277755303 } }, @@ -6418,6 +6420,26 @@ "updateAt": 1747638862777, "createAt": 1747632565731 } + }, + "jN2378kieoBKN-G1x8myT": { + "id": "jN2378kieoBKN-G1x8myT", + "tableId": "kc1EFvFhlBSc0B0bDgX28", + "name": "rack", + "comment": "Rack번호", + "dataType": "VARCHAR(10)", + "default": "", + "options": 8, + "ui": { + "keys": 0, + "widthName": 60, + "widthComment": 60, + "widthDataType": 75, + "widthDefault": 60 + }, + "meta": { + "updateAt": 1747733996079, + "createAt": 1747733912998 + } } }, "relationshipEntities": { @@ -6469,7 +6491,7 @@ "sscrxOdwLlx94tx1j_MrH" ], "x": 686.1378, - "y": 1674.3461, + "y": 1678.488957142857, "direction": 2 }, "meta": { @@ -6488,7 +6510,7 @@ "nb5CGzskl3_LIRA0yyede" ], "x": 686.1378, - "y": 1810.3461, + "y": 1847.631814285714, "direction": 2 }, "end": { @@ -6516,7 +6538,7 @@ "nb5CGzskl3_LIRA0yyede" ], "x": 686.1378, - "y": 1844.3461, + "y": 1889.9175285714282, "direction": 2 }, "end": { @@ -6572,7 +6594,7 @@ "nb5CGzskl3_LIRA0yyede" ], "x": 686.1378, - "y": 1776.3461, + "y": 1805.3460999999998, "direction": 2 }, "end": { @@ -6737,9 +6759,9 @@ "columnIds": [ "nb5CGzskl3_LIRA0yyede" ], - "x": 686.1378, - "y": 1912.3461, - "direction": 2 + "x": 432.13779999999997, + "y": 1953.3461, + "direction": 8 }, "end": { "tableId": "gYqhvNLZjWrQk8LNKH3il", @@ -6878,7 +6900,7 @@ "nb5CGzskl3_LIRA0yyede" ], "x": 686.1378, - "y": 1742.3461, + "y": 1763.0603857142855, "direction": 2 }, "end": { @@ -6934,7 +6956,7 @@ "nb5CGzskl3_LIRA0yyede" ], "x": 686.1378, - "y": 1708.3461, + "y": 1720.7746714285713, "direction": 2 }, "end": { @@ -7018,7 +7040,7 @@ "nb5CGzskl3_LIRA0yyede" ], "x": 686.1378, - "y": 1878.3461, + "y": 1932.2032428571424, "direction": 2 }, "end": { diff --git a/app/Entities/Customer/ServiceEntity.php b/app/Entities/Customer/ServiceEntity.php index c474eb8..083e7b6 100644 --- a/app/Entities/Customer/ServiceEntity.php +++ b/app/Entities/Customer/ServiceEntity.php @@ -2,10 +2,24 @@ 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 addPartEntity(string $type, PartEntity $partEntity): void + { + if (!isset($this->attributes[$type])) { + $this->attributes[$type] = []; + } + $this->attributes[$type][] = $partEntity; + // $this->attributes[$type] = array_unique($this->attributes[$type], SORT_REGULAR); + } } diff --git a/app/Entities/Customer/ServicePartEntity.php b/app/Entities/Customer/ServicePartEntity.php index 9c31136..099eca8 100644 --- a/app/Entities/Customer/ServicePartEntity.php +++ b/app/Entities/Customer/ServicePartEntity.php @@ -11,7 +11,7 @@ class ServicePartEntity extends CustomerEntity public function getServiceInfo() { - return $this->attributes['erviceinfo_uid']; + return $this->attributes['serviceinfo_uid']; } public function getPartInfo() diff --git a/app/Entities/Customer/ServiceServerEntity.php b/app/Entities/Customer/ServiceServerEntity.php new file mode 100644 index 0000000..b9602b6 --- /dev/null +++ b/app/Entities/Customer/ServiceServerEntity.php @@ -0,0 +1,21 @@ +attributes['serviceinfo_uid']; + } + + public function getServerInfo() + { + return $this->attributes['serverinfo_uid']; + } +} diff --git a/app/Helpers/Customer/ServiceHelper.php b/app/Helpers/Customer/ServiceHelper.php index 3843342..e9c86e4 100644 --- a/app/Helpers/Customer/ServiceHelper.php +++ b/app/Helpers/Customer/ServiceHelper.php @@ -13,43 +13,38 @@ class ServiceHelper extends CustomerHelper parent::__construct($request); $this->setTitleField(field: ServiceModel::TITLE); } - public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string + public function getFieldView(string $field, array $viewDatas, array $extras = []): string { - if (in_array($viewDatas['action'], ['create', 'modify'])) { - $extras = (strpos($viewDatas['field_rules'][$field], 'required') !== false) ? ["class" => "form-control", "required" => "", ...$extras] : ["class" => "form-control", ...$extras]; - } + $value = $viewDatas['entity']->$field ?? ""; switch ($field) { - case 'CPU': - case 'RAM': - case 'DISK': - if (!is_array($viewDatas['field_options'][$field])) { - throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다."); - } - if (in_array($viewDatas['action'], ['create_form', 'modify_form'])) { - $form = " "; - $form .= "