diff --git a/app/Controllers/Admin/AdminController.php b/app/Controllers/Admin/AdminController.php index f1bd757..07d1246 100644 --- a/app/Controllers/Admin/AdminController.php +++ b/app/Controllers/Admin/AdminController.php @@ -10,18 +10,18 @@ use Psr\Log\LoggerInterface; abstract class AdminController extends CommonController { private $_layout = 'admin'; + protected $layouts = []; public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { parent::initController($request, $response, $logger); $this->addActionPaths($this->_layout); + $this->layouts = LAYOUTS[$this->_layout]; } protected function action_init_process(string $action, ?object $entity = null): void { $this->service->action_init_process($action, $entity); parent::action_init_process($action, $entity); - $layouts = LAYOUTS[$this->_layout]; - array_push($layouts['javascripts'], ''); - $this->addViewDatas('layout', $layouts); + $this->addViewDatas('layout', $this->layouts); $this->addViewDatas('title', $this->getTitle()); $this->addViewDatas('helper', $this->service->getHelper()); $this->addViewDatas('formFields', $this->service->getFormService()->getFormFields()); diff --git a/app/Controllers/Admin/Customer/ServiceController.php b/app/Controllers/Admin/Customer/ServiceController.php index ad73ec9..83319ed 100644 --- a/app/Controllers/Admin/Customer/ServiceController.php +++ b/app/Controllers/Admin/Customer/ServiceController.php @@ -22,6 +22,11 @@ class ServiceController extends CustomerController 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/Forms/BoardForm.php b/app/Forms/BoardForm.php index bed8275..f552606 100644 --- a/app/Forms/BoardForm.php +++ b/app/Forms/BoardForm.php @@ -49,9 +49,9 @@ class BoardForm extends CommonForm $tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"]; switch ($field) { case 'worker_uid': - foreach ($this->getFormOption_process(service('userservice'), $action, $field, $entity) as $entity) { - $tempOptions[$entity->getPK()] = $entity->getTitle(); - // $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())]; + foreach ($this->getFormOption_process(service('userservice'), $action, $field, $entity) as $tempEntity) { + $tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle(); + // $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; } $options['options'] = $tempOptions; break; diff --git a/app/Forms/Customer/ServiceForm.php b/app/Forms/Customer/ServiceForm.php index 6b39045..5520927 100644 --- a/app/Forms/Customer/ServiceForm.php +++ b/app/Forms/Customer/ServiceForm.php @@ -51,9 +51,9 @@ class ServiceForm extends CustomerForm $tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"]; switch ($field) { case 'serverinfo_uid': - foreach ($this->getFormOption_process(service('equipment_serverservice'), $action, $field, $entity) as $entity) { - $tempOptions[$entity->getPK()] = $entity->getCustomTitle(); - // $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())]; + foreach ($this->getFormOption_process(service('equipment_serverservice'), $action, $field, $entity) as $tempEntity) { + $tempOptions[$tempEntity->getPK()] = $tempEntity->getCustomTitle(); + // $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; } $options['options'] = $tempOptions; break; diff --git a/app/Forms/Equipment/ServerForm.php b/app/Forms/Equipment/ServerForm.php index 1cebcdd..7ac1083 100644 --- a/app/Forms/Equipment/ServerForm.php +++ b/app/Forms/Equipment/ServerForm.php @@ -50,9 +50,24 @@ class ServerForm extends EquipmentForm $tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"]; switch ($field) { case 'serviceinfo_uid': - foreach ($this->getFormOption_process(service('customer_serviceservice'), $action, $field, $entity) as $entity) { - $tempOptions[$entity->getPK()] = $entity->getTitle(); - // $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())]; + foreach ($this->getFormOption_process(service('customer_serviceservice'), $action, $field, $entity) as $tempEntity) { + $tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle(); + // $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; + } + $options['options'] = $tempOptions; + break; + case 'switch': + foreach ($this->getFormOption_process(service('part_switchservice'), $action, $field, $entity) as $tempEntity) { + $tempOptions[$tempEntity->getTitle()] = $tempEntity->getTitle(); + // $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; + } + $options['options'] = $tempOptions; + // dd($options); + break; + case 'ip': + foreach ($this->getFormOption_process(service('part_ipservice'), $action, $field, $entity) as $tempEntity) { + $tempOptions[$tempEntity->getTitle()] = $tempEntity->getTitle(); + // $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; } $options['options'] = $tempOptions; break; diff --git a/app/Forms/Equipment/ServerPartForm.php b/app/Forms/Equipment/ServerPartForm.php index b630e76..d979e51 100644 --- a/app/Forms/Equipment/ServerPartForm.php +++ b/app/Forms/Equipment/ServerPartForm.php @@ -50,24 +50,24 @@ class ServerPartForm extends EquipmentForm foreach (SERVERPART['ALL_PARTTYPES'] as $type) { $partService = $this->getPartService($type); $tempOptions[$type] = [lang("{$this->getAttribute('class_path')}.TYPE.{$type}") . " 선택"]; - foreach ($partService->getEntities(['status' => STATUS['AVAILABLE']]) as $entity) { - $tempOptions[$type][$entity->getPK()] = $entity->getTitle(); - // $options['attributes'][$type][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())]; + foreach ($partService->getEntities(['status' => STATUS['AVAILABLE']]) as $tempEntity) { + $tempOptions[$type][$tempEntity->getPK()] = $tempEntity->getTitle(); + // $options['attributes'][$type][$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 $entity) { - $tempOptions[$entity->getPK()] = $entity->getTitle(); - // $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())]; + foreach ($this->getFormOption_process(service('equipment_serverservice'), $action, $field, $entity) 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 $entity) { - $tempOptions[$entity->getPK()] = $entity->getTitle(); - // $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())]; + foreach ($this->getFormOption_process(service('customer_clientservice'), $action, $field, $entity) as $tempEntity) { + $tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle(); + // $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; } $options['options'] = $tempOptions; break; diff --git a/app/Forms/Part/IPForm.php b/app/Forms/Part/IPForm.php index db186bf..6068ff2 100644 --- a/app/Forms/Part/IPForm.php +++ b/app/Forms/Part/IPForm.php @@ -32,16 +32,16 @@ class IPForm extends PartForm $tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"]; switch ($field) { case 'lineinfo_uid': - foreach ($this->getFormOption_process(service('equipment_lineservice'), $action, $field, $entity) as $entity) { - $tempOptions[$entity->getPK()] = $entity->getTitle(); - // $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())]; + foreach ($this->getFormOption_process(service('equipment_lineservice'), $action, $field, $entity) 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 $entity) { - $tempOptions[$entity->getPK()] = $entity->getTitle(); - // $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())]; + foreach ($this->getFormOption_process(service('customer_clientservice'), $action, $field, $entity) as $tempEntity) { + $tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle(); + // $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; } // dd($tempOptions); $options['options'] = $tempOptions; diff --git a/app/Forms/Part/PartForm.php b/app/Forms/Part/PartForm.php index 0b8c76f..1349cd1 100644 --- a/app/Forms/Part/PartForm.php +++ b/app/Forms/Part/PartForm.php @@ -40,16 +40,16 @@ abstract class PartForm extends CommonForm $tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"]; switch ($field) { case 'serviceinfo_uid': - foreach ($this->getFormOption_process(service('customer_serviceservice'), $action, $field, $entity) as $entity) { - $tempOptions[$entity->getPK()] = $entity->getTitle(); - // $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())]; + foreach ($this->getFormOption_process(service('customer_serviceservice'), $action, $field, $entity) 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 $entity) { - $tempOptions[$entity->getPK()] = $entity->getTitle(); - // $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())]; + foreach ($this->getFormOption_process(service('equipment_serverservice'), $action, $field, $entity) as $tempEntity) { + $tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle(); + // $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; } $options['options'] = $tempOptions; break; diff --git a/app/Forms/PaymentForm.php b/app/Forms/PaymentForm.php index 998ee00..e4cea93 100644 --- a/app/Forms/PaymentForm.php +++ b/app/Forms/PaymentForm.php @@ -46,9 +46,9 @@ class PaymentForm extends CommonForm $tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"]; switch ($field) { case 'serviceinfo_uid': - foreach ($this->getFormOption_process(service('customer_serviceservice'), $action, $field, $entity) as $entity) { - $tempOptions[$entity->getPK()] = $entity->getTitle(); - // $options['attributes'][$entity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $entity->getRole())]; + foreach ($this->getFormOption_process(service('customer_serviceservice'), $action, $field, $entity) as $tempEntity) { + $tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle(); + // $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; } $options['options'] = $tempOptions; break; diff --git a/app/Helpers/CommonHelper.php b/app/Helpers/CommonHelper.php index b3216fe..350965b 100644 --- a/app/Helpers/CommonHelper.php +++ b/app/Helpers/CommonHelper.php @@ -184,7 +184,8 @@ abstract class CommonHelper if (in_array($field, $viewDatas['formFilters'])) { if ($value) { if (!array_key_exists($value, $viewDatas['formOptions'][$field]['options'])) { - // dd($viewDatas['formOptions'][$field]['options']); + echo "VALUE:{$value}"; + dd($viewDatas['formOptions'][$field]['options']); throw new \Exception(__METHOD__ . "에서 오류발생: {$field}에서 {$value}에 해당하는 값이 존재하지 않습니다."); } $value = !$value ? "" : $viewDatas['formOptions'][$field]['options'][$value]; @@ -197,6 +198,12 @@ abstract class CommonHelper public function getListFilter(string $field, mixed $value, array $viewDatas, array $extras = []): string { switch ($field) { + case 'user_uid': + case 'clientinfo_uid': + case 'serverinfo_uid': + $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; + $filter = form_dropdown($field, $viewDatas['formOptions'][$field]['options'], $value, $extras); + break; default: $filter = ""; if (in_array($field, $viewDatas['formFilters'])) { diff --git a/app/Helpers/Customer/ServiceHelper.php b/app/Helpers/Customer/ServiceHelper.php index e4585e0..be53d56 100644 --- a/app/Helpers/Customer/ServiceHelper.php +++ b/app/Helpers/Customer/ServiceHelper.php @@ -20,6 +20,11 @@ class ServiceHelper extends CustomerHelper $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; $form = form_dropdown($field, $viewDatas['formOptions'][$field]['options'], $value, $extras); break; + case 'clientinfo_uid': + $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; + $form = form_dropdown($field, $viewDatas['formOptions'][$field]['options'], $value, $extras); + break; + case 'amount': $form = form_input($field, 0, ["readonly" => "readonly", ...$extras]); break; @@ -34,7 +39,7 @@ class ServiceHelper extends CustomerHelper switch ($field) { case 'serverinfo_uid': $value = $viewDatas['formOptions'][$field]['options'][$value]; - $value = "')\" text-data=\"{$value}\">📋{$value}"; + $value = "📋{$value}"; break; case 'amount': case 'sale': diff --git a/app/Helpers/Equipment/ServerHelper.php b/app/Helpers/Equipment/ServerHelper.php index 5e74073..55fb9ef 100644 --- a/app/Helpers/Equipment/ServerHelper.php +++ b/app/Helpers/Equipment/ServerHelper.php @@ -19,34 +19,17 @@ class ServerHelper extends EquipmentHelper $form .= form_hidden($field, (string)$value); } break; - case 'ip': //값 그대료 표시 - $form = "
"; - $form .= form_input($field, $value ?? "", [ - 'id' => 'ipInput', - "list" => "ipList", - "placeholder" => "예: 27.125.207.100", - "autocomplete" => "off", - ...$extras - ]); - $form .= ""; - $form .= "
"; - break; - case 'switch': //값 그대료 표시 - $form = "
"; - $form .= form_input($field, $value ?? "", [ - 'id' => 'switchInput', - "placeholder" => "Switch 코드 입력", - "autocomplete" => "off", - ...$extras - ]); - $form .= ""; - $form .= "
"; - break; case 'manufactur_at': case 'format_at': $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' calender' : 'calender'; $form = form_input($field, $value ?? "", $extras); break; + case 'switch': + case 'ip': + case 'title': + $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; + $form = parent::getFieldForm($field, $value, $viewDatas, $extras); + break; default: $form = parent::getFieldForm($field, $value, $viewDatas, $extras); break; @@ -74,12 +57,24 @@ class ServerHelper extends EquipmentHelper } return $value; } + + public function getListFilter(string $field, mixed $value, array $viewDatas, array $extras = []): string + { + switch ($field) { + case 'switch': + case 'ip': + case 'title': + $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; + $filter = parent::getListFilter($field, $value, $viewDatas, $extras); + default: + $filter = parent::getListFilter($field, $value, $viewDatas, $extras); + break; + } + return $filter; + } public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string { switch ($action) { - case 'modify': - $action = parent::getListButton($action, $viewDatas['entity']->getCode(), $viewDatas, $extras); - break; case 'history': $action = $label ? $label : form_label( $label ? $label : ICONS['HISTORY'], diff --git a/app/Helpers/Part/SWITCHHelper.php b/app/Helpers/Part/SWITCHHelper.php index f46f08b..6c1838b 100644 --- a/app/Helpers/Part/SWITCHHelper.php +++ b/app/Helpers/Part/SWITCHHelper.php @@ -8,16 +8,4 @@ class SWITCHHelper extends PartHelper { parent::__construct(); } - public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string - { - switch ($action) { - case 'modify': - $action = parent::getListButton($action, $viewDatas['entity']->getCode(), $viewDatas, $extras); - break; - default: - $action = parent::getListButton($action, $label, $viewDatas, $extras); - break; - } - return $action; - } } diff --git a/app/Services/Equipment/ServerService.php b/app/Services/Equipment/ServerService.php index a965b2f..0c6f643 100644 --- a/app/Services/Equipment/ServerService.php +++ b/app/Services/Equipment/ServerService.php @@ -61,8 +61,8 @@ class ServerService extends EquipmentService "type", "switch", "ip", - "os", "title", + "os", "price", "manufactur_at", "format_at", @@ -71,11 +71,13 @@ class ServerService extends EquipmentService "clientinfo_uid", 'title', 'type', + 'switch', + 'ip', 'os', "status", ]; $indexFilter = $filters; - $batchjobFilters = ['type', 'title', 'os', 'status']; + $batchjobFilters = ['type', 'title', 'switch', 'ip', 'os', 'status']; switch ($action) { case 'create': case 'create_form': @@ -84,11 +86,11 @@ class ServerService extends EquipmentService $fields = [...$fields, 'status']; break; case 'view': - $fields = [...$fields, 'status', 'created_at']; + $fields = ['clientinfo_uid', ...$fields, 'status', 'created_at']; break; case 'index': case 'download': - $fields = [...$fields, 'status', 'created_at']; + $fields = ['clientinfo_uid', ...$fields, 'status', 'created_at']; break; } $this->getFormService()->setFormFields($fields);