diff --git a/app/Controllers/Admin/Customer/ServiceController.php b/app/Controllers/Admin/Customer/ServiceController.php index fecb849..7ac96bb 100644 --- a/app/Controllers/Admin/Customer/ServiceController.php +++ b/app/Controllers/Admin/Customer/ServiceController.php @@ -40,6 +40,8 @@ class ServiceController extends CustomerController protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string { switch ($this->getService()->getAction()) { + case 'create_form': + case 'modify_form': case 'view': case 'index': $this->service = $this->getService(); @@ -67,6 +69,8 @@ class ServiceController extends CustomerController { $formDatas = $this->getService()->getFormDatas(); $formDatas['location'] = 'chiba'; + $formDatas['rack'] = '100000'; + $formDatas['line'] = '300000'; $formDatas['type'] = 'normal'; $formDatas['billing_at'] = date("Y-m-d"); $formDatas['start_at'] = date("Y-m-d"); diff --git a/app/Database/dbmsv2.vuerd.json b/app/Database/dbmsv2.vuerd.json index 752f3d2..26845bc 100644 --- a/app/Database/dbmsv2.vuerd.json +++ b/app/Database/dbmsv2.vuerd.json @@ -4,9 +4,9 @@ "settings": { "width": 3000, "height": 3000, - "scrollTop": -660.4768, - "scrollLeft": -1800, - "zoomLevel": 0.76, + "scrollTop": -1061.8503, + "scrollLeft": -1473.857, + "zoomLevel": 0.79, "show": 511, "database": 4, "databaseName": "", @@ -667,8 +667,10 @@ "N-2m8O_JzS6-sDEcL5zTv", "1ZM86qoxmCcoKnqOpE2oj", "mIkGBA96-a6Rh6AoRddl7", - "50a08OnwVq9SXAXX5pq6s", "ptLUIGfIqm89XGRz_V2ww", + "50a08OnwVq9SXAXX5pq6s", + "MPV_aB_fuEXdco5eTWdEP", + "SrCfFg0KgEamhUOVqGiPE", "hQ5EOPiUpDbVpWQwawtw4", "hK2hK1Xs1GrDW5nUTroIR", "9o7wfPp7WK2nZoxkDZ9Y1", @@ -712,8 +714,10 @@ "6ffdAfFg_xnuxULuBa6fP", "hGJn_WXZRUZizXnV1q1mp", "0LanT5cVJX_uBb0Foh2NM", - "50a08OnwVq9SXAXX5pq6s", "ptLUIGfIqm89XGRz_V2ww", + "50a08OnwVq9SXAXX5pq6s", + "MPV_aB_fuEXdco5eTWdEP", + "SrCfFg0KgEamhUOVqGiPE", "SGWWOOHjCF81V4O5tUiJu", "uuDbJDSDQLey7Km1W9hlJ", "Gb6fmS40Q3wvnvD1HMTqR", @@ -734,15 +738,15 @@ "2fzVlWt1Skh-391N_z9Ci" ], "ui": { - "x": 2012.6399, - "y": 1161.1469, + "x": 2040.2715, + "y": 1063.7785, "zIndex": 2395, "widthName": 60, "widthComment": 62, "color": "" }, "meta": { - "updateAt": 1756961453341, + "updateAt": 1758256335552, "createAt": 1748485662214 } }, @@ -8408,6 +8412,46 @@ "updateAt": 1758175486130, "createAt": 1758175348505 } + }, + "MPV_aB_fuEXdco5eTWdEP": { + "id": "MPV_aB_fuEXdco5eTWdEP", + "tableId": "B8haiEbPc1lRBWTv1g25G", + "name": "rack", + "comment": "상면비용", + "dataType": "INT", + "default": "0", + "options": 8, + "ui": { + "keys": 0, + "widthName": 60, + "widthComment": 60, + "widthDataType": 60, + "widthDefault": 60 + }, + "meta": { + "updateAt": 1758256199541, + "createAt": 1758255884544 + } + }, + "SrCfFg0KgEamhUOVqGiPE": { + "id": "SrCfFg0KgEamhUOVqGiPE", + "tableId": "B8haiEbPc1lRBWTv1g25G", + "name": "line", + "comment": "회선비용", + "dataType": "INT", + "default": "0", + "options": 8, + "ui": { + "keys": 0, + "widthName": 60, + "widthComment": 60, + "widthDataType": 60, + "widthDefault": 60 + }, + "meta": { + "updateAt": 1758256191111, + "createAt": 1758255959769 + } } }, "relationshipEntities": { @@ -8458,8 +8502,8 @@ "columnIds": [ "Vf3bNvvEPfu1zCs4rcHTU" ], - "x": 2121.473233333333, - "y": 1161.1469, + "x": 2149.1048333333333, + "y": 1063.7785, "direction": 4 }, "meta": { @@ -8766,8 +8810,8 @@ "columnIds": [ "N-2m8O_JzS6-sDEcL5zTv" ], - "x": 2012.6399, - "y": 1234.4802333333334, + "x": 2040.2715, + "y": 1145.1118333333332, "direction": 1 }, "meta": { @@ -8785,8 +8829,8 @@ "columnIds": [ "nNWsAWbHfKWqx8EwxvuM1" ], - "x": 2556.806566666666, - "y": 1161.1469, + "x": 2584.4381666666663, + "y": 1063.7785, "direction": 4 }, "end": { @@ -8869,8 +8913,8 @@ "columnIds": [ "nNWsAWbHfKWqx8EwxvuM1" ], - "x": 2012.6399, - "y": 1527.813566666667, + "x": 2040.2715, + "y": 1470.4451666666666, "direction": 1 }, "end": { @@ -9009,8 +9053,8 @@ "columnIds": [ "nNWsAWbHfKWqx8EwxvuM1" ], - "x": 2012.6399, - "y": 1381.1469000000002, + "x": 2040.2715, + "y": 1307.7785, "direction": 1 }, "end": { @@ -9037,8 +9081,8 @@ "columnIds": [ "nNWsAWbHfKWqx8EwxvuM1" ], - "x": 2339.1398999999997, - "y": 1161.1469, + "x": 2366.7715, + "y": 1063.7785, "direction": 4 }, "end": { @@ -9065,8 +9109,8 @@ "columnIds": [ "nNWsAWbHfKWqx8EwxvuM1" ], - "x": 2175.8899, - "y": 1601.1469, + "x": 2203.5215, + "y": 1551.7785, "direction": 8 }, "end": { @@ -9093,8 +9137,8 @@ "columnIds": [ "nNWsAWbHfKWqx8EwxvuM1" ], - "x": 2502.3899, - "y": 1601.1469, + "x": 2530.0215, + "y": 1551.7785, "direction": 8 }, "end": { diff --git a/app/Entities/Customer/ServiceEntity.php b/app/Entities/Customer/ServiceEntity.php index ae4aca0..d940687 100644 --- a/app/Entities/Customer/ServiceEntity.php +++ b/app/Entities/Customer/ServiceEntity.php @@ -58,6 +58,14 @@ class ServiceEntity extends CustomerEntity { return $this->attributes['amount'] ?? 0; } + final public function getRack(): int + { + return $this->attributes['rack'] ?? 0; + } + final public function getLine(): int + { + return $this->attributes['line'] ?? 0; + } public function getHistory(): string { return $this->attributes['history'] ?? ""; diff --git a/app/Helpers/Customer/ClientHelper.php b/app/Helpers/Customer/ClientHelper.php index d72db93..72fe29f 100644 --- a/app/Helpers/Customer/ClientHelper.php +++ b/app/Helpers/Customer/ClientHelper.php @@ -16,7 +16,7 @@ class ClientHelper extends CustomerHelper switch ($field) { case "email": case "phone": - $value = !$this->getMyAuth()->isAccessRole(['security']) ? "***********" : parent::getFieldView($field, $value, $viewDatas, $extras); + $value = $this->getMyAuth()->isAccessRole(['security']) ? parent::getFieldView($field, $value, $viewDatas, $extras) : "***********"; break; case 'account_balance': $extras = ["class" => "btn btn-link", "target" => "_self", ...$extras]; @@ -70,17 +70,13 @@ class ClientHelper extends CustomerHelper { switch ($action) { case 'modify': - if (!$this->getMyAuth()->isAccessRole(['security'])) { - $action = $viewDatas['entity']->getCode(); - } else { - $action = parent::getListButton($action, $label, $viewDatas, $extras); - } + $action = $this->getMyAuth()->isAccessRole(['security']) ? parent::getListButton($action, $label, $viewDatas, $extras) : $label; break; case 'create': case 'delete': case 'batchjob': case 'batchjob_delete': - $action = !$this->getMyAuth()->isAccessRole(['security']) ? "" : parent::getListButton($action, $label, $viewDatas, $extras); + $action = $this->getMyAuth()->isAccessRole(['security']) ? parent::getListButton($action, $label, $viewDatas, $extras) : ""; break; case 'history': $extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras]; diff --git a/app/Helpers/Customer/ServiceHelper.php b/app/Helpers/Customer/ServiceHelper.php index 5031fea..dd61df9 100644 --- a/app/Helpers/Customer/ServiceHelper.php +++ b/app/Helpers/Customer/ServiceHelper.php @@ -60,7 +60,6 @@ class ServiceHelper extends CustomerHelper $value = $viewDatas['entity']->getServerEntity()->getPK(); } $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; - $extras['onChange'] = "document.querySelector('input[name=\'amount\']').value = this.options[this.selectedIndex].getAttribute('data-price')"; $attributes = ['data-price' => 'getPrice']; $form = $this->form_dropdown_common($field, $value, $viewDatas, $extras, $attributes); break; diff --git a/app/Helpers/Equipment/ServerHelper.php b/app/Helpers/Equipment/ServerHelper.php index bf9b55a..91965cf 100644 --- a/app/Helpers/Equipment/ServerHelper.php +++ b/app/Helpers/Equipment/ServerHelper.php @@ -65,7 +65,7 @@ class ServerHelper extends EquipmentHelper { switch ($action) { case 'modify': - $action = parent::getListButton($action, $label ? $label : $viewDatas['entity']->getCode(), $viewDatas, $extras); + $action = parent::getListButton($action, $viewDatas['entity']->getCode(), $viewDatas, $extras); break; case 'history': $extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras]; diff --git a/app/Helpers/Equipment/SwitchHelper.php b/app/Helpers/Equipment/SwitchHelper.php index 4a1a1fc..78b8457 100644 --- a/app/Helpers/Equipment/SwitchHelper.php +++ b/app/Helpers/Equipment/SwitchHelper.php @@ -16,11 +16,7 @@ class SwitchHelper extends EquipmentHelper { switch ($action) { case 'modify': - if (!$this->getMyAuth()->isAccessRole(['security'])) { - $action = $viewDatas['entity']->getCode(); - } else { - $action = parent::getListButton($action, $label ? $label : $viewDatas['entity']->getCode(), $viewDatas, $extras); - } + $action = parent::getListButton($action, $viewDatas['entity']->getCode(), $viewDatas, $extras); break; default: $action = parent::getListButton($action, $label, $viewDatas, $extras); diff --git a/app/Language/en/Customer/Service.php b/app/Language/en/Customer/Service.php index 8cd5bd7..79e6217 100644 --- a/app/Language/en/Customer/Service.php +++ b/app/Language/en/Customer/Service.php @@ -9,6 +9,8 @@ return [ 'code' => "코드", 'type' => "형식", 'location' => "위치", + 'rack' => "상면비", + 'line' => "회선비", 'billing_at' => "결제일", 'amount' => "월청구액", 'start_at' => "시작일", @@ -40,6 +42,17 @@ return [ "ours" => "자사용", "colocation" => "코로케이션", ], + "RACK" => [ + "0" => "0원", + "100000" => "10만원", + "200000" => "20만원", + "300000" => "30만원", + ], + "LINE" => [ + "0" => "0원", + "300000" => "30만원", + "500000" => "50만원", + ], "STATUS" => [ STATUS['AVAILABLE'] => "사용중", STATUS['PAUSE'] => "일시정지", diff --git a/app/Models/Customer/ServiceModel.php b/app/Models/Customer/ServiceModel.php index 8028e36..44dfcc2 100644 --- a/app/Models/Customer/ServiceModel.php +++ b/app/Models/Customer/ServiceModel.php @@ -21,6 +21,8 @@ class ServiceModel extends CustomerModel "site", "location", "type", + "rack", + "line", "billing_at", "amount", "start_at", @@ -42,6 +44,8 @@ class ServiceModel extends CustomerModel case "user_uid": case "clientinfo_uid": case "amount": + case "rack": + case "line": $rule = "required|numeric"; break; case "site": diff --git a/app/Services/Customer/ServiceService.php b/app/Services/Customer/ServiceService.php index a0c9d84..c79f68f 100644 --- a/app/Services/Customer/ServiceService.php +++ b/app/Services/Customer/ServiceService.php @@ -31,6 +31,8 @@ class ServiceService extends CustomerService "type", "clientinfo_uid", 'serverinfo_uid', + "rack", + "line", "start_at", "billing_at", "amount", @@ -46,6 +48,8 @@ class ServiceService extends CustomerService 'type', 'clientinfo_uid', 'serverinfo_uid', + 'rack', + 'line', 'status', ]; } diff --git a/app/Views/admin/service/create_form.php b/app/Views/admin/service/create_form.php new file mode 100644 index 0000000..134a81c --- /dev/null +++ b/app/Views/admin/service/create_form.php @@ -0,0 +1,25 @@ +extend(LAYOUTS[$viewDatas['layout']]['path']) ?> +section('content') ?> +getHelper()->alert($error) ?> +
+
include("templates/{$viewDatas['layout']}/form_content_top"); ?>
+ +
+ + + + + + + +
getHelper()->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?> + getHelper()->getFieldForm($field, old($field) ?? ($viewDatas['control']['form_datas'][$field] ?? null), $viewDatas) ?> + +
+
"btn btn-outline btn-primary")); ?>
+ +
+
include("templates/{$viewDatas['layout']}/form_content_bottom"); ?>
+
+ +endSection() ?> \ No newline at end of file diff --git a/public/js/admin/service.js b/public/js/admin/service.js new file mode 100644 index 0000000..e7ab92c --- /dev/null +++ b/public/js/admin/service.js @@ -0,0 +1,32 @@ +const serverSelect = document.querySelector("select[name=serverinfo_uid]"); +const rackSelect = document.querySelector("select[name=rack]"); +const lineSelect = document.querySelector("select[name=line]"); +const amountInput = document.querySelector("input[name=amount]"); + +function getTotalPrice() { + const serverPrice = serverSelect?.options[serverSelect.selectedIndex]?.getAttribute("data-price") || 0; + const rackPrice = rackSelect?.options[rackSelect.selectedIndex]?.value || 0; + const linePrice = lineSelect?.options[lineSelect.selectedIndex]?.value || 0; + + return Number(serverPrice) + Number(rackPrice) + Number(linePrice); +} + +// 공통 업데이트 함수 +function updateAmount() { + if (amountInput) { + amountInput.value = getTotalPrice(); + } +} + +// 이벤트 리스너 등록 +if (rackSelect) rackSelect.addEventListener("change", updateAmount); +if (lineSelect) lineSelect.addEventListener("change", updateAmount); +// ✅ select2는 전용 이벤트 사용 +if (serverSelect) { + $(serverSelect).on("select2:select", function () { + updateAmount(); + }); +} + +//페이지 로드 시 초기 실행 +document.addEventListener("DOMContentLoaded", updateAmount); \ No newline at end of file