From 11708086c66460f132e8e4b68f9bd03dedd7a1bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Fri, 28 Nov 2025 17:09:59 +0900 Subject: [PATCH] dbmsv4 init...1 --- app/Config/Constants.php | 3 +++ .../Admin/Customer/ServiceController.php | 6 +++--- .../Admin/Equipment/ServerController.php | 2 +- app/Forms/Customer/ServiceForm.php | 8 ++++++-- app/Forms/Equipment/ServerPartForm.php | 8 ++++++-- app/Helpers/CommonHelper.php | 15 +++++++++++++-- app/Helpers/Customer/ServiceHelper.php | 6 +++++- app/Helpers/Equipment/ServerPartHelper.php | 4 ++-- app/Views/layouts/admin.php | 1 + app/Views/layouts/empty.php | 1 + app/Views/layouts/front.php | 1 + public/js/admin/service.js | 1 - 12 files changed, 42 insertions(+), 14 deletions(-) diff --git a/app/Config/Constants.php b/app/Config/Constants.php index 36c8c43..9a86fa0 100644 --- a/app/Config/Constants.php +++ b/app/Config/Constants.php @@ -302,6 +302,7 @@ define('LAYOUTS', [ 'javascripts' => [ '', ], + 'footerScripts' => [] ], 'front' => [ 'title' => KEYWORD, @@ -333,6 +334,7 @@ define('LAYOUTS', [ '', '', ], + 'footerScripts' => [] ], 'admin' => [ 'title' => '관리자화면', @@ -368,6 +370,7 @@ define('LAYOUTS', [ '', '' ], + 'footerScripts' => [] ], ]); diff --git a/app/Controllers/Admin/Customer/ServiceController.php b/app/Controllers/Admin/Customer/ServiceController.php index b42833d..7b891e7 100644 --- a/app/Controllers/Admin/Customer/ServiceController.php +++ b/app/Controllers/Admin/Customer/ServiceController.php @@ -2,7 +2,6 @@ namespace App\Controllers\Admin\Customer; -use App\Entities\Customer\ServiceEntity; use CodeIgniter\HTTP\RedirectResponse; use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; @@ -16,8 +15,9 @@ class ServiceController extends CustomerController if ($this->service === null) { $this->service = service('customer_serviceservice'); } - $this->addActionPaths('service'); - $this->layouts['javascripts'][] = ''; + $this->addActionPaths(path: 'service'); + $this->layouts['footerScripts'][] = ''; + $this->layouts['footerScripts'][] = ''; } //기본 함수 작업 //Custom 추가 함수 diff --git a/app/Controllers/Admin/Equipment/ServerController.php b/app/Controllers/Admin/Equipment/ServerController.php index d5a8e52..c424bb7 100644 --- a/app/Controllers/Admin/Equipment/ServerController.php +++ b/app/Controllers/Admin/Equipment/ServerController.php @@ -17,7 +17,7 @@ class ServerController extends EquipmentController $this->service = service('equipment_serverservice'); } $this->addActionPaths('server'); - $this->layouts['javascripts'][] = ''; + $this->layouts['footerScripts'][] = ''; } //기본 함수 작업 //Custom 추가 함수 diff --git a/app/Forms/Customer/ServiceForm.php b/app/Forms/Customer/ServiceForm.php index c93a979..fb76489 100644 --- a/app/Forms/Customer/ServiceForm.php +++ b/app/Forms/Customer/ServiceForm.php @@ -52,8 +52,12 @@ class ServiceForm extends CustomerForm switch ($field) { case 'serverinfo_uid': 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())]; + $tempOptions[$tempEntity->getPK()] = [ + 'value' => $tempEntity->getPK(), + 'text' => $tempEntity->getTitle(), + 'data-title' => $tempEntity->getTitle(), + 'data-price' => $tempEntity->getPrice() + ]; } $options['options'] = $tempOptions; break; diff --git a/app/Forms/Equipment/ServerPartForm.php b/app/Forms/Equipment/ServerPartForm.php index 3ce71c5..be973db 100644 --- a/app/Forms/Equipment/ServerPartForm.php +++ b/app/Forms/Equipment/ServerPartForm.php @@ -51,8 +51,12 @@ class ServerPartForm extends EquipmentForm $partService = $this->getPartService($type); $tempOptions[$type] = [lang("{$this->getAttribute('class_path')}.TYPE.{$type}") . " 선택"]; foreach ($this->getFormOption_process($partService, $action, $field, $formDatas) as $tempEntity) { - $tempOptions[$type][$tempEntity->getPK()] = $tempEntity->getTitle(); - // $options['attributes'][$type][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())]; + $tempOptions[$type][$tempEntity->getPK()] = [ + 'value' => $tempEntity->getPK(), + 'text' => $tempEntity->getTitle(), + 'data-title' => $tempEntity->getTitle(), + 'data-price' => $tempEntity->getPrice() + ]; } } $options['options'] = $tempOptions; diff --git a/app/Helpers/CommonHelper.php b/app/Helpers/CommonHelper.php index c4288a8..3f2133f 100644 --- a/app/Helpers/CommonHelper.php +++ b/app/Helpers/CommonHelper.php @@ -47,8 +47,12 @@ abstract class CommonHelper * @param string $extra 태그 */ - public function form_dropdown_custom(string $name = '', array $options = [], $selected = null, string $extra = ''): string + final public function form_dropdown_custom(string $name = '', array $options = [], $selected = null, array $extras = []): string { + $extra = ""; + foreach ($extras as $extras_key => $extras_value) { + $extra .= " " . esc($extras_key) . '="' . esc($extras_value) . '"'; + } $select = '\n"; return $select; } - + protected function getFieldForm_process(string $field, array $viewDatas, string $form): string + { + switch ($field) { + default: + break; + } + return $form; + } public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string { switch ($field) { diff --git a/app/Helpers/Customer/ServiceHelper.php b/app/Helpers/Customer/ServiceHelper.php index 31c857c..057b023 100644 --- a/app/Helpers/Customer/ServiceHelper.php +++ b/app/Helpers/Customer/ServiceHelper.php @@ -18,7 +18,11 @@ class ServiceHelper extends CustomerHelper break; case 'serverinfo_uid': $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; - $form = form_dropdown($field, $viewDatas['formOptions'][$field]['options'], $value, $extras); + $extras['onChange'] = "document.querySelector('input[name=\'amount\']').value = this.options[this.selectedIndex].getAttribute('data-price')"; + if (array_key_exists('extras', $viewDatas['formOptions'][$field])) { + $extras = array_merge($extras, $viewDatas['formOptions'][$field]['extras']); + } + $form = $this->form_dropdown_custom($field, $viewDatas['formOptions'][$field]['options'], $value, $extras); break; case 'clientinfo_uid': $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; diff --git a/app/Helpers/Equipment/ServerPartHelper.php b/app/Helpers/Equipment/ServerPartHelper.php index e0dfc5d..a47a2af 100644 --- a/app/Helpers/Equipment/ServerPartHelper.php +++ b/app/Helpers/Equipment/ServerPartHelper.php @@ -23,11 +23,11 @@ class ServerPartHelper extends EquipmentHelper // dd($viewDatas); $type = array_key_exists('entity', $viewDatas) ? $viewDatas['entity']->getType() : $viewDatas['formDatas']['type']; $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; - $extras['onChange'] = "document.querySelector('input[name=\'title\']').value = this.options[this.selectedIndex].getAttribute('data-title'); document.querySelector('input[name=\'amount\']').value = this.options[this.selectedIndex].getAttribute('data-price')"; + $extras['onChange'] = "document.querySelector('input[name=\'amount\']').value = this.options[this.selectedIndex].getAttribute('data-price')"; if (array_key_exists('extras', $viewDatas['formOptions'][$field])) { $extras = array_merge($extras, $viewDatas['formOptions'][$field]['extras']); } - $form = form_dropdown($field, $viewDatas['formOptions'][$field]['options'][$type], $value, $extras); + $form = $this->form_dropdown_custom($field, $viewDatas['formOptions'][$field]['options'][$type], $value, $extras); break; default: $form = parent::getFieldForm($field, $value, $viewDatas, $extras); diff --git a/app/Views/layouts/admin.php b/app/Views/layouts/admin.php index fe581ea..9925553 100644 --- a/app/Views/layouts/admin.php +++ b/app/Views/layouts/admin.php @@ -20,5 +20,6 @@ renderSection('content') ?> + \ No newline at end of file diff --git a/app/Views/layouts/empty.php b/app/Views/layouts/empty.php index b33d79a..b042c07 100644 --- a/app/Views/layouts/empty.php +++ b/app/Views/layouts/empty.php @@ -20,5 +20,6 @@ getHelper()->alertTrait($error) ?>
renderSection('content') ?>
+ \ No newline at end of file diff --git a/app/Views/layouts/front.php b/app/Views/layouts/front.php index d430d57..c0b6623 100644 --- a/app/Views/layouts/front.php +++ b/app/Views/layouts/front.php @@ -20,5 +20,6 @@ getHelper()->alertTrait($error) ?> renderSection('content') ?> + \ No newline at end of file diff --git a/public/js/admin/service.js b/public/js/admin/service.js index ae87457..a461ffe 100644 --- a/public/js/admin/service.js +++ b/public/js/admin/service.js @@ -30,6 +30,5 @@ if (serverSelect) { } }); } - //페이지 로드 시 초기 실행 document.addEventListener("DOMContentLoaded", updateAmount); \ No newline at end of file