dbmsv2 init...1

This commit is contained in:
choi.jh 2025-09-19 14:26:05 +09:00
parent 6df8db1fa1
commit b1c835db05
12 changed files with 163 additions and 38 deletions

View File

@ -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");

View File

@ -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": {

View File

@ -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'] ?? "";

View File

@ -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];

View File

@ -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;

View File

@ -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];

View File

@ -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);

View File

@ -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'] => "일시정지",

View File

@ -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":

View File

@ -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',
];
}

View File

@ -0,0 +1,25 @@
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
<?= $this->section('content') ?>
<?php if ($error = session('error')): echo $viewDatas['service']->getHelper()->alert($error) ?><?php endif ?>
<div id="container" class="content">
<div class="form_top"><?= $this->include("templates/{$viewDatas['layout']}/form_content_top"); ?></div>
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<div class="action_form">
<table class="table table-bordered">
<?php foreach ($viewDatas['control']['actionFields'] as $field): ?>
<tr>
<th nowrap class="text-end"><?= $viewDatas['service']->getHelper()->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
<td nowrap class="text-start">
<?= $viewDatas['service']->getHelper()->getFieldForm($field, old($field) ?? ($viewDatas['control']['form_datas'][$field] ?? null), $viewDatas) ?>
<span><?= validation_show_error($field); ?></span>
</td>
</tr>
<?php endforeach; ?>
</table>
<div class="text-center"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></div>
<?= form_close(); ?>
</div>
<div class="form_bottom"><?= $this->include("templates/{$viewDatas['layout']}/form_content_bottom"); ?></div>
</div>
<script src="/js/admin/service.js"></script>
<?= $this->endSection() ?>

View File

@ -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);