From 92caea4ba8667cef49d9e77e4469d1b34f0e6ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Tue, 25 Nov 2025 11:52:10 +0900 Subject: [PATCH] dbmsv4 init...1 --- app/Controllers/AbstractCRUDController.php | 7 ++-- app/Controllers/AbstractWebController.php | 3 +- app/Controllers/Admin/AdminController.php | 6 +-- .../Admin/Customer/ServiceController.php | 6 +-- .../Admin/Equipment/ServerController.php | 1 + app/Controllers/Admin/Home.php | 4 +- app/Entities/Equipment/ServerEntity.php | 2 +- app/Forms/BoardForm.php | 6 +-- app/Forms/CommonForm.php | 42 ++++++++++++------- app/Forms/Customer/ServiceForm.php | 6 +-- app/Forms/Equipment/ServerForm.php | 24 +++++------ app/Forms/Equipment/ServerPartForm.php | 8 ++-- app/Forms/Part/IPForm.php | 8 ++-- app/Forms/Part/PartForm.php | 8 ++-- app/Forms/PaymentForm.php | 6 +-- app/Helpers/Customer/ServiceHelper.php | 8 +++- app/Helpers/Equipment/ServerHelper.php | 20 +++++++++ app/Language/en/Equipment/Server.php | 1 + app/Services/BoardService.php | 3 +- app/Services/CommonService.php | 2 +- app/Services/Customer/AccountService.php | 3 +- app/Services/Customer/ClientService.php | 3 +- app/Services/Customer/CouponService.php | 3 +- app/Services/Customer/PointService.php | 3 +- app/Services/Customer/ServiceService.php | 3 +- app/Services/Equipment/LineService.php | 3 +- app/Services/Equipment/ServerPartService.php | 3 +- app/Services/Equipment/ServerService.php | 18 +++++++- app/Services/MylogService.php | 3 +- app/Services/Part/CPUService.php | 3 +- app/Services/Part/CSService.php | 3 +- app/Services/Part/DISKService.php | 3 +- app/Services/Part/IPService.php | 3 +- app/Services/Part/RAMService.php | 3 +- app/Services/Part/SOFTWAREService.php | 3 +- app/Services/Part/SWITCHService.php | 3 +- app/Services/PaymentService.php | 3 +- app/Services/UserService.php | 3 +- app/Views/cells/server/servicelist.php | 13 ++++++ .../cells/serverpart/partlist_service.php | 31 -------------- .../{partlist_server.php => serverlist.php} | 0 41 files changed, 166 insertions(+), 118 deletions(-) create mode 100644 app/Views/cells/server/servicelist.php delete mode 100644 app/Views/cells/serverpart/partlist_service.php rename app/Views/cells/serverpart/{partlist_server.php => serverlist.php} (100%) diff --git a/app/Controllers/AbstractCRUDController.php b/app/Controllers/AbstractCRUDController.php index 2a66733..0110607 100644 --- a/app/Controllers/AbstractCRUDController.php +++ b/app/Controllers/AbstractCRUDController.php @@ -34,8 +34,9 @@ abstract class AbstractCRUDController extends AbstractWebController { try { $action = __FUNCTION__; - $this->action_init_process($action); - $this->addViewDatas('formDatas', $this->create_form_process()); + $formDatas = $this->create_form_process(); + $this->action_init_process($action, $formDatas); + $this->addViewDatas('formDatas', $formDatas); return $this->create_form_result_process($action); } catch (\Exception $e) { return $this->action_redirect_process('error', "{$this->getTitle()}에서 생성폼 오류:" . $e->getMessage()); @@ -103,7 +104,7 @@ abstract class AbstractCRUDController extends AbstractWebController } $this->addViewDatas('entity', $entity); $action = __FUNCTION__; - $this->action_init_process($action, $entity); + $this->action_init_process($action, [], $entity); return $this->modify_form_result_process($action); } catch (\Exception $e) { return $this->action_redirect_process('error', "{$this->getTitle()}에서 {$uid} 수정폼 오류:" . $e->getMessage()); diff --git a/app/Controllers/AbstractWebController.php b/app/Controllers/AbstractWebController.php index 62f2779..984362f 100644 --- a/app/Controllers/AbstractWebController.php +++ b/app/Controllers/AbstractWebController.php @@ -76,11 +76,10 @@ abstract class AbstractWebController extends Controller /** * 모든 액션 실행 전 공통 초기화 작업 */ - protected function action_init_process(string $action, ?object $entity = null): void + protected function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void { $this->addViewDatas('action', $action); $this->addViewDatas('authContext', $this->getAuthContext()); - // $this->service가 하위 클래스에서 설정되었다고 가정 $this->addViewDatas('classPath', $this->service->getClassPaths(false)); } diff --git a/app/Controllers/Admin/AdminController.php b/app/Controllers/Admin/AdminController.php index 07d1246..0660b3f 100644 --- a/app/Controllers/Admin/AdminController.php +++ b/app/Controllers/Admin/AdminController.php @@ -17,10 +17,10 @@ abstract class AdminController extends CommonController $this->addActionPaths($this->_layout); $this->layouts = LAYOUTS[$this->_layout]; } - protected function action_init_process(string $action, ?object $entity = null): void + protected function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void { - $this->service->action_init_process($action, $entity); - parent::action_init_process($action, $entity); + $this->service->action_init_process($action, $formDatas, $entity); + parent::action_init_process($action, $formDatas, $entity); $this->addViewDatas('layout', $this->layouts); $this->addViewDatas('title', $this->getTitle()); $this->addViewDatas('helper', $this->service->getHelper()); diff --git a/app/Controllers/Admin/Customer/ServiceController.php b/app/Controllers/Admin/Customer/ServiceController.php index 83319ed..9637694 100644 --- a/app/Controllers/Admin/Customer/ServiceController.php +++ b/app/Controllers/Admin/Customer/ServiceController.php @@ -16,17 +16,13 @@ class ServiceController extends CustomerController $this->service = service('customer_serviceservice'); } $this->addActionPaths('service'); + $this->layouts['javascripts'][] = ''; } protected function getEntityClass(): string { return ServiceEntity::class; } //기본 함수 작업 - protected function action_init_process(string $action, ?object $entity = null): void - { - $this->layouts['javascripts'][] = ''; - parent::action_init_process($action, $entity); - } //Custom 추가 함수 public function create_form_process(array $formDatas = []): array { diff --git a/app/Controllers/Admin/Equipment/ServerController.php b/app/Controllers/Admin/Equipment/ServerController.php index 0fbb068..1327838 100644 --- a/app/Controllers/Admin/Equipment/ServerController.php +++ b/app/Controllers/Admin/Equipment/ServerController.php @@ -16,6 +16,7 @@ class ServerController extends EquipmentController $this->service = service('equipment_serverservice'); } $this->addActionPaths('server'); + $this->layouts['javascripts'][] = ''; } protected function getEntityClass(): string { diff --git a/app/Controllers/Admin/Home.php b/app/Controllers/Admin/Home.php index a0068a2..4a61931 100644 --- a/app/Controllers/Admin/Home.php +++ b/app/Controllers/Admin/Home.php @@ -17,10 +17,10 @@ class Home extends AbstractWebController } $this->addActionPaths('home'); } - protected function action_init_process(string $action, ?object $entity = null): void + protected function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void { // $this->service->action_init_process($action, $entity); - parent::action_init_process($action, $entity); + parent::action_init_process($action, $formDatas, $entity); $this->addViewDatas('layout', LAYOUTS['admin']); } //Index,FieldForm관련 diff --git a/app/Entities/Equipment/ServerEntity.php b/app/Entities/Equipment/ServerEntity.php index dbb9e2d..f51efbc 100644 --- a/app/Entities/Equipment/ServerEntity.php +++ b/app/Entities/Equipment/ServerEntity.php @@ -23,7 +23,7 @@ class ServerEntity extends EquipmentEntity //기본기능용 public function getCustomTitle(mixed $title = null): string { - return sprintf("[%s]%s / %s", $this->getCode(), $title ? $title : $this->getIP(), $this->getOS()); + return sprintf("[%s]%s", $this->getCode(), $title ? $title : $this->getIP()); } final public function getCode(): string { diff --git a/app/Forms/BoardForm.php b/app/Forms/BoardForm.php index f552606..7ec0a6c 100644 --- a/app/Forms/BoardForm.php +++ b/app/Forms/BoardForm.php @@ -44,19 +44,19 @@ class BoardForm extends CommonForm } return $rule; } - public function getFormOption(string $action, string $field, ?object $entity = null, array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array + public function getFormOption(string $action, string $field, array $formDatas = [], array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array { $tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"]; switch ($field) { case 'worker_uid': - foreach ($this->getFormOption_process(service('userservice'), $action, $field, $entity) as $tempEntity) { + foreach ($this->getFormOption_process(service('userservice'), $action, $field, $formDatas) as $tempEntity) { $tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle(); // $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; } $options['options'] = $tempOptions; break; default: - $options = parent::getFormOption($action, $field, $entity, $options); + $options = parent::getFormOption($action, $field, $formDatas, $options); break; } return $options; diff --git a/app/Forms/CommonForm.php b/app/Forms/CommonForm.php index 1e21b83..6a9767e 100644 --- a/app/Forms/CommonForm.php +++ b/app/Forms/CommonForm.php @@ -8,6 +8,7 @@ use RuntimeException; abstract class CommonForm { private array $_attributes = []; + private array $_formDatas = []; private array $_formFields = []; private array $_formRules = []; private array $_formFilters = []; @@ -28,6 +29,19 @@ abstract class CommonForm } return $this->_attributes[$key]; } + final public function setFormDatas(array $formDatas): void + { + $this->_formDatas = $formDatas; + } + //$fields 매치된것만 반환, []->전체 + final public function getFormDatas(array $fields = []): array + { + if (empty($fields)) { + return $this->_formDatas; + } + // _formDatas 키를 비교하여 교집합을 반환합니다. $fields에 지정된 필드 정의만 추출됩니다. + return array_intersect_key($this->_formDatas, array_flip($fields)); + } final public function setFormFields(array $fields): void { foreach ($fields as $field) { @@ -57,10 +71,10 @@ abstract class CommonForm } return array_intersect_key($this->_formRules, array_flip($fields)); } - final public function setFormOptions(string $action, array $fields, ?object $entity = null, $formOptions = []): void + final public function setFormOptions(string $action, array $fields, array $formDatas = [], $formOptions = []): void { foreach ($fields as $field) { - $formOptions[$field] = $formOptions[$field] ?? $this->getFormOption($action, $field, $entity); + $formOptions[$field] = $formOptions[$field] ?? $this->getFormOption($action, $field, $formDatas); } $this->_formOptions = $formOptions; } @@ -183,37 +197,35 @@ abstract class CommonForm } return $rule; } - protected function getFormOption_process($service, string $action, string $field, ?object $entity = null): array + protected function getFormOption_process($service, string $action, string $field, array $formDatas = []): array { $entities = []; - switch ($action) { - case 'create_form': - $entities = $service->getEntities(['status' => STATUS['AVAILABLE']]); - break; - case 'modify_form': - $where = sprintf("status = '%s' OR %s='%s'", STATUS['AVAILABLE'], $this->getAttribute('pk_field'), $entity->$field); - $entities = $service->getEntities([$where => null]); - break; + switch ($field) { default: - $entities = $service->getEntities(); + if (array_key_exists($field, $formDatas)) { + $where = sprintf("status = '%s' OR %s='%s'", STATUS['AVAILABLE'], $this->getAttribute('pk_field'), $formDatas[$field]); + $entities = $service->getEntities([$where => null]); + } else { + $entities = $service->getEntities(); + } break; } return $entities; } - public function getFormOption(string $action, string $field, ?object $entity = null, array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array + public function getFormOption(string $action, string $field, array $formDatas = [], array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array { $tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"]; switch ($field) { case 'user_uid': - foreach ($this->getFormOption_process(service('userservice'), $action, $field, $entity) as $entity) { + foreach ($this->getFormOption_process(service('userservice'), $action, $field, $formDatas) as $entity) { $tempOptions[$entity->getPK()] = $entity->getTitle(); // $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())]; } $options['options'] = $tempOptions; break; case 'clientinfo_uid': - foreach ($this->getFormOption_process(service('customer_clientservice'), $action, $field, $entity) as $entity) { + foreach ($this->getFormOption_process(service('customer_clientservice'), $action, $field, $formDatas) as $entity) { $tempOptions[$entity->getPK()] = $entity->getTitle(); // $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())]; } diff --git a/app/Forms/Customer/ServiceForm.php b/app/Forms/Customer/ServiceForm.php index 5520927..c93a979 100644 --- a/app/Forms/Customer/ServiceForm.php +++ b/app/Forms/Customer/ServiceForm.php @@ -46,19 +46,19 @@ class ServiceForm extends CustomerForm return $rule; } - public function getFormOption(string $action, string $field, ?object $entity = null, array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array + public function getFormOption(string $action, string $field, array $formDatas = [], array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array { $tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"]; switch ($field) { case 'serverinfo_uid': - foreach ($this->getFormOption_process(service('equipment_serverservice'), $action, $field, $entity) as $tempEntity) { + foreach ($this->getFormOption_process(service('equipment_serverservice'), $action, $field, $formDatas) as $tempEntity) { $tempOptions[$tempEntity->getPK()] = $tempEntity->getCustomTitle(); // $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; } $options['options'] = $tempOptions; break; default: - $options = parent::getFormOption($action, $field, $entity, $options); + $options = parent::getFormOption($action, $field, $formDatas, $options); break; } return $options; diff --git a/app/Forms/Equipment/ServerForm.php b/app/Forms/Equipment/ServerForm.php index 2ac7443..a3c7d60 100644 --- a/app/Forms/Equipment/ServerForm.php +++ b/app/Forms/Equipment/ServerForm.php @@ -46,38 +46,38 @@ class ServerForm extends EquipmentForm return $rule; } - protected function getFormOption_process($service, string $action, string $field, ?object $entity = null): array + protected function getFormOption_process($service, string $action, string $field, array $formDatas = []): array { $entities = []; - switch ($action) { - case 'modify_form': - if ($field === 'ip') { - $where = sprintf("status = '%s' OR %s='%s'", STATUS['AVAILABLE'], "ip", $entity->$field); + switch ($field) { + case 'ip': + if (array_key_exists($field, $formDatas)) { + $where = sprintf("status = '%s' OR %s='%s'", STATUS['AVAILABLE'], $field, $formDatas[$field]); $entities = $service->getEntities([$where => null]); } else { - $entities = parent::getFormOption_process($service, $action, $field, $entity); + $entities = parent::getFormOption_process($service, $action, $field, $formDatas); } break; default: - $entities = parent::getFormOption_process($service, $action, $field, $entity); + $entities = parent::getFormOption_process($service, $action, $field, $formDatas); break; } return $entities; } - public function getFormOption(string $action, string $field, ?object $entity = null, array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array + public function getFormOption(string $action, string $field, array $formDatas = [], array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array { $tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"]; switch ($field) { case 'serviceinfo_uid': - foreach ($this->getFormOption_process(service('customer_serviceservice'), $action, $field, $entity) as $tempEntity) { + foreach ($this->getFormOption_process(service('customer_serviceservice'), $action, $field, $formDatas) as $tempEntity) { $tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle(); // $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; } $options['options'] = $tempOptions; break; case 'switchinfo_uid': - foreach ($this->getFormOption_process(service('part_switchservice'), $action, $field, $entity) as $tempEntity) { + foreach ($this->getFormOption_process(service('part_switchservice'), $action, $field, $formDatas) as $tempEntity) { $tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle(); // $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; } @@ -85,14 +85,14 @@ class ServerForm extends EquipmentForm // dd($options); break; case 'ip': //key=value이 같음주의 - foreach ($this->getFormOption_process(service('part_ipservice'), $action, $field, $entity) as $tempEntity) { + foreach ($this->getFormOption_process(service('part_ipservice'), $action, $field, $formDatas) as $tempEntity) { $tempOptions[$tempEntity->getTitle()] = $tempEntity->getTitle(); // $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; } $options['options'] = $tempOptions; break; default: - $options = parent::getFormOption($action, $field, $entity, $options); + $options = parent::getFormOption($action, $field, $formDatas, $options); break; } return $options; diff --git a/app/Forms/Equipment/ServerPartForm.php b/app/Forms/Equipment/ServerPartForm.php index d979e51..99b0bb2 100644 --- a/app/Forms/Equipment/ServerPartForm.php +++ b/app/Forms/Equipment/ServerPartForm.php @@ -42,7 +42,7 @@ class ServerPartForm extends EquipmentForm { return service('part_' . strtolower($type) . 'service'); } - public function getFormOption(string $action, string $field, ?object $entity = null, array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array + public function getFormOption(string $action, string $field, array $formDatas = [], array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array { $tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"]; switch ($field) { @@ -58,21 +58,21 @@ class ServerPartForm extends EquipmentForm $options['options'] = $tempOptions; break; case 'serverinfo_uid': - foreach ($this->getFormOption_process(service('equipment_serverservice'), $action, $field, $entity) as $tempEntity) { + foreach ($this->getFormOption_process(service('equipment_serverservice'), $action, $field, $formDatas) as $tempEntity) { $tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle(); // $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; } $options['options'] = $tempOptions; break; case 'serviceinfo_uid': - foreach ($this->getFormOption_process(service('customer_clientservice'), $action, $field, $entity) as $tempEntity) { + foreach ($this->getFormOption_process(service('customer_clientservice'), $action, $field, $formDatas) as $tempEntity) { $tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle(); // $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; } $options['options'] = $tempOptions; break; default: - $options = parent::getFormOption($action, $field, $entity, $options); + $options = parent::getFormOption($action, $field, $formDatas, $options); break; } return $options; diff --git a/app/Forms/Part/IPForm.php b/app/Forms/Part/IPForm.php index 6068ff2..95004b2 100644 --- a/app/Forms/Part/IPForm.php +++ b/app/Forms/Part/IPForm.php @@ -27,19 +27,19 @@ class IPForm extends PartForm } return $rule; } - public function getFormOption(string $action, string $field, ?object $entity = null, array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array + public function getFormOption(string $action, string $field, array $formDatas = [], array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array { $tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"]; switch ($field) { case 'lineinfo_uid': - foreach ($this->getFormOption_process(service('equipment_lineservice'), $action, $field, $entity) as $tempEntity) { + foreach ($this->getFormOption_process(service('equipment_lineservice'), $action, $field, $formDatas) as $tempEntity) { $tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle(); // $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; } $options['options'] = $tempOptions; break; case 'old_clientinfo_uid': - foreach ($this->getFormOption_process(service('customer_clientservice'), $action, $field, $entity) as $tempEntity) { + foreach ($this->getFormOption_process(service('customer_clientservice'), $action, $field, $formDatas) as $tempEntity) { $tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle(); // $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; } @@ -47,7 +47,7 @@ class IPForm extends PartForm $options['options'] = $tempOptions; break; default: - $options = parent::getFormOption($action, $field, $entity, $options); + $options = parent::getFormOption($action, $field, $formDatas, $options); break; } return $options; diff --git a/app/Forms/Part/PartForm.php b/app/Forms/Part/PartForm.php index 1349cd1..b2ff2a2 100644 --- a/app/Forms/Part/PartForm.php +++ b/app/Forms/Part/PartForm.php @@ -35,26 +35,26 @@ abstract class PartForm extends CommonForm } return $rule; } - public function getFormOption(string $action, string $field, ?object $entity = null, array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array + public function getFormOption(string $action, string $field, array $formDatas = [], array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array { $tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"]; switch ($field) { case 'serviceinfo_uid': - foreach ($this->getFormOption_process(service('customer_serviceservice'), $action, $field, $entity) as $tempEntity) { + foreach ($this->getFormOption_process(service('customer_serviceservice'), $action, $field, $formDatas) as $tempEntity) { $tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle(); // $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; } $options['options'] = $tempOptions; break; case 'serverinfo_uid': - foreach ($this->getFormOption_process(service('equipment_serverservice'), $action, $field, $entity) as $tempEntity) { + foreach ($this->getFormOption_process(service('equipment_serverservice'), $action, $field, $formDatas) as $tempEntity) { $tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle(); // $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; } $options['options'] = $tempOptions; break; default: - $options = parent::getFormOption($action, $field, $entity, $options); + $options = parent::getFormOption($action, $field, $formDatas, $options); break; } return $options; diff --git a/app/Forms/PaymentForm.php b/app/Forms/PaymentForm.php index e4cea93..5562b95 100644 --- a/app/Forms/PaymentForm.php +++ b/app/Forms/PaymentForm.php @@ -41,19 +41,19 @@ class PaymentForm extends CommonForm return $rule; } - public function getFormOption(string $action, string $field, ?object $entity = null, array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array + public function getFormOption(string $action, string $field, array $formDatas = [], array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array { $tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"]; switch ($field) { case 'serviceinfo_uid': - foreach ($this->getFormOption_process(service('customer_serviceservice'), $action, $field, $entity) as $tempEntity) { + foreach ($this->getFormOption_process(service('customer_serviceservice'), $action, $field, $formDatas) as $tempEntity) { $tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle(); // $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; } $options['options'] = $tempOptions; break; default: - $options = parent::getFormOption($action, $field, $entity, $options); + $options = parent::getFormOption($action, $field, $formDatas, $options); break; } return $options; diff --git a/app/Helpers/Customer/ServiceHelper.php b/app/Helpers/Customer/ServiceHelper.php index 93e7c85..6544d9e 100644 --- a/app/Helpers/Customer/ServiceHelper.php +++ b/app/Helpers/Customer/ServiceHelper.php @@ -37,8 +37,12 @@ class ServiceHelper extends CustomerHelper { switch ($field) { case 'serverinfo_uid': - $value = $viewDatas['formOptions'][$field]['options'][$value]; - $value = "📋{$value}"; + $value = view_cell("\App\Cells\Equipment\ServerCell::detail", [ + 'serviceEntity' => $viewDatas['entity'], + 'template' => 'servicelist', + ]); + // $value = $viewDatas['formOptions'][$field]['options'][$value]; + // $value = "📋{$value}"; break; case 'amount': case 'sale': diff --git a/app/Helpers/Equipment/ServerHelper.php b/app/Helpers/Equipment/ServerHelper.php index 668a0e9..5bc0242 100644 --- a/app/Helpers/Equipment/ServerHelper.php +++ b/app/Helpers/Equipment/ServerHelper.php @@ -48,6 +48,13 @@ class ServerHelper extends EquipmentHelper case 'format_at': $value = $value ? date("Y-m-d", strtotime($value)) : ""; break; + case 'part': + $value = view_cell("\App\Cells\Equipment\ServerPartCell::parttable", [ + 'serverinfo_uid' => $viewDatas['entity']->getPK(), + 'types' => SERVERPART['SERVER_PARTTYPES'], + 'template' => 'serverlist', + ]); + break; default: $value = parent::getFieldView($field, $value, $viewDatas, $extras); break; @@ -69,6 +76,19 @@ class ServerHelper extends EquipmentHelper } return $filter; } + public function getListLabel(string $field, string $label, array $viewDatas, array $extras = []): string + { + switch ($field) { + case 'part': + $label = parent::getListLabel($field, $label, $viewDatas, $extras); + $label .= "ALL 📋"; + break; + default: + $label = parent::getListLabel($field, $label, $viewDatas, $extras); + break; + } + return $label; + } public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string { switch ($action) { diff --git a/app/Language/en/Equipment/Server.php b/app/Language/en/Equipment/Server.php index 2d23574..753f441 100644 --- a/app/Language/en/Equipment/Server.php +++ b/app/Language/en/Equipment/Server.php @@ -9,6 +9,7 @@ return [ 'switchinfo_uid' => "스위치", 'ip' => "IP", 'os' => "OS", + 'part' => "부품", 'title' => "모델명", 'price' => "기본가", 'manufactur_at' => "입고일", diff --git a/app/Services/BoardService.php b/app/Services/BoardService.php index 5b412ba..e554a44 100644 --- a/app/Services/BoardService.php +++ b/app/Services/BoardService.php @@ -53,7 +53,7 @@ class BoardService extends CommonService } return $this->_helper; } - public function action_init_process(string $action, ?object $entity = null): void + public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void { $fields = [ 'category', @@ -108,6 +108,7 @@ class BoardService extends CommonService ]; break; } + $this->getFormService()->setFormDatas($formDatas); $this->getFormService()->setFormFields($fields); $this->getFormService()->setFormRules($action, $fields); $this->getFormService()->setFormFilters($filters); diff --git a/app/Services/CommonService.php b/app/Services/CommonService.php index 90957a9..88335de 100644 --- a/app/Services/CommonService.php +++ b/app/Services/CommonService.php @@ -30,7 +30,7 @@ abstract class CommonService { return $isArray ? $this->_classPaths : implode($delimeter, $this->_classPaths); } - abstract public function action_init_process(string $action, ?object $entity = null): void; + abstract public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void; /** * 단일 엔티티를 조회합니다. * @return CommonEntity|null CommonEntity 인스턴스 또는 찾지 못했을 경우 null diff --git a/app/Services/Customer/AccountService.php b/app/Services/Customer/AccountService.php index ca9f1a2..a6b4913 100644 --- a/app/Services/Customer/AccountService.php +++ b/app/Services/Customer/AccountService.php @@ -54,7 +54,7 @@ class AccountService extends CustomerService } return $this->_helper; } - public function action_init_process(string $action, ?object $entity = null): void + public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void { $fields = [ "clientinfo_uid", @@ -89,6 +89,7 @@ class AccountService extends CustomerService $fields = [...$fields, 'created_at']; break; } + $this->getFormService()->setFormDatas($formDatas); $this->getFormService()->setFormFields($fields); $this->getFormService()->setFormRules($action, $fields); $this->getFormService()->setFormFilters($filters); diff --git a/app/Services/Customer/ClientService.php b/app/Services/Customer/ClientService.php index f8b7530..42544b8 100644 --- a/app/Services/Customer/ClientService.php +++ b/app/Services/Customer/ClientService.php @@ -54,7 +54,7 @@ class ClientService extends CustomerService } return $this->_helper; } - public function action_init_process(string $action, ?object $entity = null): void + public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void { $fields = [ 'site', @@ -98,6 +98,7 @@ class ClientService extends CustomerService ]; break; } + $this->getFormService()->setFormDatas($formDatas); $this->getFormService()->setFormFields($fields); $this->getFormService()->setFormRules($action, $fields); $this->getFormService()->setFormFilters($filters); diff --git a/app/Services/Customer/CouponService.php b/app/Services/Customer/CouponService.php index 42c578a..f8dc767 100644 --- a/app/Services/Customer/CouponService.php +++ b/app/Services/Customer/CouponService.php @@ -54,7 +54,7 @@ class CouponService extends CustomerService } return $this->_helper; } - public function action_init_process(string $action, ?object $entity = null): void + public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void { $fields = [ "clientinfo_uid", @@ -83,6 +83,7 @@ class CouponService extends CustomerService $fields = [...$fields, 'created_at']; break; } + $this->getFormService()->setFormDatas($formDatas); $this->getFormService()->setFormFields($fields); $this->getFormService()->setFormRules($action, $fields); $this->getFormService()->setFormFilters($filters); diff --git a/app/Services/Customer/PointService.php b/app/Services/Customer/PointService.php index 90e5133..96d5c59 100644 --- a/app/Services/Customer/PointService.php +++ b/app/Services/Customer/PointService.php @@ -54,7 +54,7 @@ class PointService extends CustomerService } return $this->_helper; } - public function action_init_process(string $action, ?object $entity = null): void + public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void { $fields = [ "clientinfo_uid", @@ -83,6 +83,7 @@ class PointService extends CustomerService $fields = [...$fields, 'created_at']; break; } + $this->getFormService()->setFormDatas($formDatas); $this->getFormService()->setFormFields($fields); $this->getFormService()->setFormRules($action, $fields); $this->getFormService()->setFormFilters($filters); diff --git a/app/Services/Customer/ServiceService.php b/app/Services/Customer/ServiceService.php index 38676ff..b4886b1 100644 --- a/app/Services/Customer/ServiceService.php +++ b/app/Services/Customer/ServiceService.php @@ -56,7 +56,7 @@ class ServiceService extends CustomerService } return $this->_helper; } - public function action_init_process(string $action, ?object $entity = null): void + public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void { $fields = [ "site", @@ -115,6 +115,7 @@ class ServiceService extends CustomerService ]; break; } + $this->getFormService()->setFormDatas($formDatas); $this->getFormService()->setFormFields($fields); $this->getFormService()->setFormRules($action, $fields); $this->getFormService()->setFormFilters($filters); diff --git a/app/Services/Equipment/LineService.php b/app/Services/Equipment/LineService.php index cfec547..ead9f9a 100644 --- a/app/Services/Equipment/LineService.php +++ b/app/Services/Equipment/LineService.php @@ -54,7 +54,7 @@ class LineService extends EquipmentService } return $this->_helper; } - public function action_init_process(string $action, ?object $entity = null): void + public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void { $fields = [ "type", @@ -84,6 +84,7 @@ class LineService extends EquipmentService $fields = [...$fields, 'status', 'created_at']; break; } + $this->getFormService()->setFormDatas($formDatas); $this->getFormService()->setFormFields($fields); $this->getFormService()->setFormRules($action, $fields); $this->getFormService()->setFormFilters($filters); diff --git a/app/Services/Equipment/ServerPartService.php b/app/Services/Equipment/ServerPartService.php index f6a7548..e30d8bf 100644 --- a/app/Services/Equipment/ServerPartService.php +++ b/app/Services/Equipment/ServerPartService.php @@ -56,7 +56,7 @@ class ServerPartService extends EquipmentService } return $this->_helper; } - public function action_init_process(string $action, ?object $entity = null): void + public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void { $fields = [ "serverinfo_uid", @@ -93,6 +93,7 @@ class ServerPartService extends EquipmentService $fields = [...$fields, 'created_at']; break; } + $this->getFormService()->setFormDatas($formDatas); $this->getFormService()->setFormFields($fields); $this->getFormService()->setFormRules($action, $fields); $this->getFormService()->setFormFilters($filters); diff --git a/app/Services/Equipment/ServerService.php b/app/Services/Equipment/ServerService.php index d4aa1ab..eeeb9ff 100644 --- a/app/Services/Equipment/ServerService.php +++ b/app/Services/Equipment/ServerService.php @@ -54,7 +54,7 @@ class ServerService extends EquipmentService } return $this->_helper; } - public function action_init_process(string $action, ?object $entity = null): void + public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void { $fields = [ "code", @@ -90,9 +90,23 @@ class ServerService extends EquipmentService break; case 'index': case 'download': - $fields = ['clientinfo_uid', ...$fields, 'status', 'created_at']; + $fields = [ + 'clientinfo_uid', + "code", + "type", + "switchinfo_uid", + "ip", + "title", + "os", + "part", + "price", + "manufactur_at", + "format_at", + 'status', + ]; break; } + $this->getFormService()->setFormDatas($formDatas); $this->getFormService()->setFormFields($fields); $this->getFormService()->setFormRules($action, $fields); $this->getFormService()->setFormFilters($filters); diff --git a/app/Services/MylogService.php b/app/Services/MylogService.php index 22ba425..62b6698 100644 --- a/app/Services/MylogService.php +++ b/app/Services/MylogService.php @@ -42,7 +42,7 @@ class MylogService extends CommonService implements PipelineStepInterface } return $this->_form; } - public function action_init_process(string $action, ?object $entity = null): void + public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void { $fields = ['title', 'content']; $filters = []; @@ -62,6 +62,7 @@ class MylogService extends CommonService implements PipelineStepInterface $fields = [...$fields, 'status', 'created_at']; break; } + $this->getFormService()->setFormDatas($formDatas); $this->getFormService()->setFormFields($fields); $this->getFormService()->setFormRules($action, $fields); $this->getFormService()->setFormFilters($filters); diff --git a/app/Services/Part/CPUService.php b/app/Services/Part/CPUService.php index e6181cd..73f3873 100644 --- a/app/Services/Part/CPUService.php +++ b/app/Services/Part/CPUService.php @@ -54,7 +54,7 @@ class CPUService extends PartService } return $this->_helper; } - public function action_init_process(string $action, ?object $entity = null): void + public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void { $fields = [ "title", @@ -81,6 +81,7 @@ class CPUService extends PartService $fields = [...$fields, 'status', 'created_at']; break; } + $this->getFormService()->setFormDatas($formDatas); $this->getFormService()->setFormFields($fields); $this->getFormService()->setFormRules($action, $fields); $this->getFormService()->setFormFilters($filters); diff --git a/app/Services/Part/CSService.php b/app/Services/Part/CSService.php index d6b76a1..a883298 100644 --- a/app/Services/Part/CSService.php +++ b/app/Services/Part/CSService.php @@ -54,7 +54,7 @@ class CSService extends PartService } return $this->_helper; } - public function action_init_process(string $action, ?object $entity = null): void + public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void { $fields = [ "type", @@ -108,6 +108,7 @@ class CSService extends PartService ]; break; } + $this->getFormService()->setFormDatas($formDatas); $this->getFormService()->setFormFields($fields); $this->getFormService()->setFormRules($action, $fields); $this->getFormService()->setFormFilters($filters); diff --git a/app/Services/Part/DISKService.php b/app/Services/Part/DISKService.php index 628be91..ed10551 100644 --- a/app/Services/Part/DISKService.php +++ b/app/Services/Part/DISKService.php @@ -54,7 +54,7 @@ class DISKService extends PartService } return $this->_helper; } - public function action_init_process(string $action, ?object $entity = null): void + public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void { $fields = [ "title", @@ -82,6 +82,7 @@ class DISKService extends PartService $fields = [...$fields, "format", 'status', 'created_at']; break; } + $this->getFormService()->setFormDatas($formDatas); $this->getFormService()->setFormFields($fields); $this->getFormService()->setFormRules($action, $fields); $this->getFormService()->setFormFilters($filters); diff --git a/app/Services/Part/IPService.php b/app/Services/Part/IPService.php index 9a21c68..9e990a5 100644 --- a/app/Services/Part/IPService.php +++ b/app/Services/Part/IPService.php @@ -54,7 +54,7 @@ class IPService extends PartService } return $this->_helper; } - public function action_init_process(string $action, ?object $entity = null): void + public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void { $fields = [ "lineinfo_uid", @@ -99,6 +99,7 @@ class IPService extends PartService ]; break; } + $this->getFormService()->setFormDatas($formDatas); $this->getFormService()->setFormFields($fields); $this->getFormService()->setFormRules($action, $fields); $this->getFormService()->setFormFilters($filters); diff --git a/app/Services/Part/RAMService.php b/app/Services/Part/RAMService.php index 3a44a20..cd22fe8 100644 --- a/app/Services/Part/RAMService.php +++ b/app/Services/Part/RAMService.php @@ -54,7 +54,7 @@ class RAMService extends PartService } return $this->_helper; } - public function action_init_process(string $action, ?object $entity = null): void + public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void { $fields = [ "title", @@ -81,6 +81,7 @@ class RAMService extends PartService $fields = [...$fields, 'status', 'created_at']; break; } + $this->getFormService()->setFormDatas($formDatas); $this->getFormService()->setFormFields($fields); $this->getFormService()->setFormRules($action, $fields); $this->getFormService()->setFormFilters($filters); diff --git a/app/Services/Part/SOFTWAREService.php b/app/Services/Part/SOFTWAREService.php index 56b45f2..1fd1ce4 100644 --- a/app/Services/Part/SOFTWAREService.php +++ b/app/Services/Part/SOFTWAREService.php @@ -40,7 +40,7 @@ class SOFTWAREService extends PartService } return $this->_form; } - public function action_init_process(string $action, ?object $entity = null): void + public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void { $fields = [ "title", @@ -67,6 +67,7 @@ class SOFTWAREService extends PartService $fields = [...$fields, 'status', 'created_at']; break; } + $this->getFormService()->setFormDatas($formDatas); $this->getFormService()->setFormFields($fields); $this->getFormService()->setFormRules($action, $fields); $this->getFormService()->setFormFilters($filters); diff --git a/app/Services/Part/SWITCHService.php b/app/Services/Part/SWITCHService.php index 3117ecc..7031e05 100644 --- a/app/Services/Part/SWITCHService.php +++ b/app/Services/Part/SWITCHService.php @@ -54,7 +54,7 @@ class SWITCHService extends PartService } return $this->_helper; } - public function action_init_process(string $action, ?object $entity = null): void + public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void { $fields = [ "code", @@ -100,6 +100,7 @@ class SWITCHService extends PartService ]; break; } + $this->getFormService()->setFormDatas($formDatas); $this->getFormService()->setFormFields($fields); $this->getFormService()->setFormRules($action, $fields); $this->getFormService()->setFormFilters($filters); diff --git a/app/Services/PaymentService.php b/app/Services/PaymentService.php index 3cda465..b583a32 100644 --- a/app/Services/PaymentService.php +++ b/app/Services/PaymentService.php @@ -54,7 +54,7 @@ class PaymentService extends CommonService } return $this->_helper; } - public function action_init_process(string $action, ?object $entity = null): void + public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void { $fields = [ "serviceinfo_uid", @@ -119,6 +119,7 @@ class PaymentService extends CommonService ]; break; } + $this->getFormService()->setFormDatas($formDatas); $this->getFormService()->setFormFields($fields); $this->getFormService()->setFormRules($action, $fields); $this->getFormService()->setFormFilters($filters); diff --git a/app/Services/UserService.php b/app/Services/UserService.php index 78ec9f0..fd8572b 100644 --- a/app/Services/UserService.php +++ b/app/Services/UserService.php @@ -54,7 +54,7 @@ class UserService extends CommonService } return $this->_helper; } - public function action_init_process(string $action, ?object $entity = null): void + public function action_init_process(string $action, array $formDatas = [], ?object $entity = null): void { $fields = [ 'id', @@ -84,6 +84,7 @@ class UserService extends CommonService $fields = ['id', 'name', 'email', 'mobile', 'role', 'status', 'created_at']; break; } + $this->getFormService()->setFormDatas($formDatas); $this->getFormService()->setFormFields($fields); $this->getFormService()->setFormRules($action, $fields); $this->getFormService()->setFormFilters($filters); diff --git a/app/Views/cells/server/servicelist.php b/app/Views/cells/server/servicelist.php new file mode 100644 index 0000000..d10dccf --- /dev/null +++ b/app/Views/cells/server/servicelist.php @@ -0,0 +1,13 @@ + + + + getCustomTitle(), + $serverCellDatas['helper']->getFieldView('switchinfo_uid', $entity->getSwitchInfoUID(), $serverCellDatas), + $entity->getIP(), + $entity->getOS() + ) ?> + 📋{$value}" ?> + +", $temps) ?> \ No newline at end of file diff --git a/app/Views/cells/serverpart/partlist_service.php b/app/Views/cells/serverpart/partlist_service.php deleted file mode 100644 index 34e867e..0000000 --- a/app/Views/cells/serverpart/partlist_service.php +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - getFieldView($type, $entity->getPK(), $serverPartCellDatas) ?> - getFieldView($type, $entity->getPK(), $serverPartCellDatas, ['return' => 'onlyText']) ?> - - - -getFieldView('SERVER', "", $serverPartCellDatas), - $serverPartCellDatas['serverEntity']->getIP(), - $serverPartCellDatas['serverEntity']->getSwitch(), - $serverPartCellDatas['serverEntity']->getOS() -] ?> - $datas): ?> -getCode(), - $serverPartCellDatas['serverEntity']->getIP(), - $serverPartCellDatas['serverEntity']->getSwitch(), - $serverPartCellDatas['serverEntity']->getOS() -] ?> - $datas): ?> - -
- 📋 - -
\ No newline at end of file diff --git a/app/Views/cells/serverpart/partlist_server.php b/app/Views/cells/serverpart/serverlist.php similarity index 100% rename from app/Views/cells/serverpart/partlist_server.php rename to app/Views/cells/serverpart/serverlist.php