dbmsv2_init...1
This commit is contained in:
parent
5eed7114a9
commit
fc3746eb2d
@ -386,7 +386,8 @@ define("SERVICE", [
|
||||
//서버파트 관련
|
||||
define("SERVERPART", [
|
||||
"CNT_RANGE" => array_combine(range(1, 10), range(1, 10)),
|
||||
"PARTTYPES" => ['SWITCH', 'CPU', 'RAM', 'DISK', 'OS', 'DB', 'SOFTWARE', 'IP', 'CS'],
|
||||
"SERVER_PARTTTYPES" => ['CPU', 'RAM', 'DISK'],
|
||||
"PARTTYPES" => ['CPU', 'RAM', 'DISK', 'OS', 'DB', 'SOFTWARE', 'SWITCH', 'IP', 'CS'],
|
||||
]);
|
||||
//결제 관련
|
||||
define("PAYMENT", [
|
||||
|
||||
@ -108,6 +108,11 @@ class ServerController extends EquipmentController
|
||||
$this->getService()->codeCheck($formDatas);
|
||||
return parent::modify_process($entity, $formDatas);
|
||||
}
|
||||
protected function view_process(mixed $entity): ServerEntity
|
||||
{
|
||||
$this->serverPartHelper = new ServerPartHelper();
|
||||
return parent::view_process($entity);
|
||||
}
|
||||
protected function index_process(array $entities = []): array
|
||||
{
|
||||
$this->serverPartHelper = new ServerPartHelper();
|
||||
|
||||
@ -34,4 +34,19 @@ class ServerPartController extends EquipmentController
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
public function getFormOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'part_uid':
|
||||
$options = $this->getService()->getFormOption($this->request->getVar('type'));
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormOption($field, $options);
|
||||
break;
|
||||
}
|
||||
if (!is_array($options)) {
|
||||
throw new \Exception(__FUNCTION__ . "에서 {$field}의 options 값이 array가 아닙니다.\n" . var_export($options, true));
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,9 +4,9 @@
|
||||
"settings": {
|
||||
"width": 3000,
|
||||
"height": 3000,
|
||||
"scrollTop": -1503.4046,
|
||||
"scrollLeft": -1269.8532,
|
||||
"zoomLevel": 0.73,
|
||||
"scrollTop": -1818.7976,
|
||||
"scrollLeft": -968.7437,
|
||||
"zoomLevel": 0.91,
|
||||
"show": 511,
|
||||
"database": 4,
|
||||
"databaseName": "",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -281,7 +281,6 @@ class CommonHelper
|
||||
case 'old_clientinfo_uid':
|
||||
case 'clientinfo_uid':
|
||||
case 'serviceinfo_uid':
|
||||
case 'switchinfo_uid':
|
||||
case 'serverinfo_uid':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$form = $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
|
||||
@ -433,7 +432,7 @@ class CommonHelper
|
||||
$label ? $label : ICONS['SEARCH'],
|
||||
$action,
|
||||
[
|
||||
"data-src" => current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK(),
|
||||
"data-src" => current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK() . '?' . $viewDatas['uri']->getQuery(),
|
||||
"data-bs-toggle" => "modal",
|
||||
"data-bs-target" => "#index_action_form",
|
||||
...$extras
|
||||
|
||||
@ -21,39 +21,6 @@ class ServiceHelper extends CustomerHelper
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$form = $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
case 'switchinfo_uid':
|
||||
if (array_key_exists('entity', $viewDatas)) {
|
||||
if ($viewDatas['entity']->getServerEntity() !== null) {
|
||||
$value = $viewDatas['entity']->getServerEntity()->getSwitchEntity() !== null ? $viewDatas['entity']->getServerEntity()->getSwitchEntity()->getPK() : $value;
|
||||
}
|
||||
}
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$form = $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
case 'ipinfo_uid':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$form = "";
|
||||
if (array_key_exists('entity', $viewDatas)) {
|
||||
if ($viewDatas['entity']->getServerEntity() !== null) {
|
||||
foreach ($viewDatas['entity']->getServerEntity()->getIPEntities() as $ipEntity) {
|
||||
$form .= "<div>" . $this->form_dropdown_custom($field, $ipEntity->getPK(), $viewDatas, $extras) . "</div>";
|
||||
}
|
||||
}
|
||||
}
|
||||
$form .= $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
case 'csinfo_uid':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$form = "";
|
||||
if (array_key_exists('entity', $viewDatas)) {
|
||||
if ($viewDatas['entity']->getServerEntity() !== null) {
|
||||
foreach ($viewDatas['entity']->getServerEntity()->getCSEntities() as $csEntity) {
|
||||
$form .= "<div>" . $this->form_dropdown_custom($field, $csEntity->getPK(), $viewDatas, $extras) . "</div>";
|
||||
}
|
||||
}
|
||||
}
|
||||
$form .= $this->form_dropdown_custom($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
default:
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
@ -77,45 +44,6 @@ class ServiceHelper extends CustomerHelper
|
||||
// ]
|
||||
// );
|
||||
// break;
|
||||
case 'CPU':
|
||||
case 'RAM':
|
||||
case 'DISK':
|
||||
case 'OS':
|
||||
case 'DB':
|
||||
case 'SOFTWARE':
|
||||
$temps = [];
|
||||
foreach ($viewDatas['entity']->getServerEntity()->getServerPartEntities($field) as $serverPartEntity) {
|
||||
$modal = form_label(
|
||||
ICONS['SETUP'],
|
||||
$field,
|
||||
[
|
||||
"data-src" => "/admin/equipment/serverpart/modify/{$serverPartEntity->getPK()}?ActionTemplate=popup",
|
||||
"data-bs-toggle" => "modal",
|
||||
"data-bs-target" => "#index_action_form",
|
||||
"class" => "btn btn-sm btn-outline btn-circle",
|
||||
"target" => "_self"
|
||||
]
|
||||
);
|
||||
$temps[] = sprintf(
|
||||
"%s%s%s %s",
|
||||
$modal,
|
||||
$serverPartEntity->getTitle(),
|
||||
$serverPartEntity->getCnt() >= 1 ? "*" . $serverPartEntity->getCnt() . "개" : "",
|
||||
$serverPartEntity->getExtra() ?? ""
|
||||
);
|
||||
}
|
||||
$value .= implode("<BR>", $temps);
|
||||
break;
|
||||
case 'ipinfo_uid':
|
||||
foreach ($viewDatas['entity']->getServerEntity()->getIPEntities() as $ipEntity) {
|
||||
$value .= sprintf("<div>%s%s %s</div>", $ipEntity->getTitle(), $ipEntity->getAmount());
|
||||
}
|
||||
break;
|
||||
case 'csinfo_uid':
|
||||
foreach ($viewDatas['entity']->getServerEntity()->getCSEntities() as $csEntity) {
|
||||
$value .= sprintf("<div>%s%s %s</div>", $csEntity->getTitle(), $csEntity->getAmount());
|
||||
}
|
||||
break;
|
||||
case 'billing_at':
|
||||
if (array_key_exists('unPaids', $viewDatas)) {
|
||||
if (array_key_exists($viewDatas['entity']->getPK(), $viewDatas['unPaids'])) {
|
||||
@ -153,25 +81,6 @@ class ServiceHelper extends CustomerHelper
|
||||
]
|
||||
);
|
||||
break;
|
||||
case 'CPU':
|
||||
case 'RAM':
|
||||
case 'DISK':
|
||||
case 'OS':
|
||||
case 'DB':
|
||||
case 'SOFTWARE':
|
||||
$serverEntity = $viewDatas['entity']->getServerEntity();
|
||||
$extras = ["class" => "btn btn-sm btn-outline btn-circle", "target" => "_self", ...$extras];
|
||||
$action = form_label(
|
||||
$label ? $label : ICONS['SETUP'],
|
||||
$action,
|
||||
[
|
||||
"data-src" => "/admin/equipment/serverpart?serverinfo_uid={$serverEntity->getPK()}&type={$action}&ActionTemplate=popup",
|
||||
"data-bs-toggle" => "modal",
|
||||
"data-bs-target" => "#index_action_form",
|
||||
...$extras
|
||||
]
|
||||
);
|
||||
break;
|
||||
default:
|
||||
$action = parent::getListButton($action, $label, $viewDatas, $extras);
|
||||
break;
|
||||
|
||||
@ -105,7 +105,7 @@ class ServerPartHelper extends EquipmentHelper
|
||||
ICONS['SETUP'],
|
||||
$field,
|
||||
[
|
||||
"data-src" => "/admin/equipment/serverpart/modify/{$partEntity->getPK()}?ActionTemplate=popup",
|
||||
"data-src" => "/admin/equipment/serverpart/modify/{$partEntity->getPK()}?type={$field}&ActionTemplate=popup",
|
||||
"data-bs-toggle" => "modal",
|
||||
"data-bs-target" => "#index_action_form",
|
||||
"class" => "btn btn-sm btn-outline btn-circle",
|
||||
|
||||
@ -4,10 +4,7 @@ return [
|
||||
'label' => [
|
||||
'user_uid' => "관리자",
|
||||
'clientinfo_uid' => "고객",
|
||||
'switchinfo_uid' => "스위치포트",
|
||||
'serverinfo_uid' => "서버",
|
||||
'ipinfo_uid' => "IP정보",
|
||||
'csinfo_uid' => "CS정보",
|
||||
'site' => "사이트",
|
||||
'code' => "코드",
|
||||
'type' => "형식",
|
||||
|
||||
@ -78,9 +78,6 @@ abstract class CustomerService extends CommonService
|
||||
case 'serverinfo_uid':
|
||||
$options = $this->getServerService()->getEntities();
|
||||
break;
|
||||
case 'switchinfo_uid':
|
||||
$options = $this->getSwitchService()->getEntities();
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormOption($field, $options);
|
||||
break;
|
||||
|
||||
@ -27,10 +27,7 @@ class ServiceService extends CustomerService
|
||||
"location",
|
||||
"type",
|
||||
"clientinfo_uid",
|
||||
"switchinfo_uid",
|
||||
"serverinfo_uid",
|
||||
"ipinfo_uid",
|
||||
"csinfo_uid",
|
||||
"billing_at",
|
||||
"amount",
|
||||
"start_at",
|
||||
@ -45,10 +42,7 @@ class ServiceService extends CustomerService
|
||||
'location',
|
||||
'type',
|
||||
'clientinfo_uid',
|
||||
"switchinfo_uid",
|
||||
'serverinfo_uid',
|
||||
"ipinfo_uid",
|
||||
"csinfo_uid",
|
||||
'status',
|
||||
];
|
||||
}
|
||||
@ -59,7 +53,6 @@ class ServiceService extends CustomerService
|
||||
'location',
|
||||
'type',
|
||||
'clientinfo_uid',
|
||||
"switchinfo_uid",
|
||||
'serverinfo_uid',
|
||||
'billing_at',
|
||||
'amount',
|
||||
@ -76,7 +69,6 @@ class ServiceService extends CustomerService
|
||||
'location',
|
||||
'type',
|
||||
'clientinfo_uid',
|
||||
"switchinfo_uid",
|
||||
'serverinfo_uid',
|
||||
'user_uid',
|
||||
'status',
|
||||
@ -93,7 +85,6 @@ class ServiceService extends CustomerService
|
||||
}
|
||||
switch ($field) {
|
||||
case "serverinfo_uid":
|
||||
case "switchinfo_uid":
|
||||
$rule = "required|numeric";
|
||||
break;;
|
||||
default:
|
||||
@ -136,29 +127,16 @@ class ServiceService extends CustomerService
|
||||
public function getFormOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'SWITCH':
|
||||
case 'IP':
|
||||
case 'CS':
|
||||
case 'CPU':
|
||||
$options = $this->getServerPartService()->getFormOption('CPU');
|
||||
break;
|
||||
case 'RAM':
|
||||
$options = $this->getServerPartService()->getFormOption('RAM');
|
||||
break;
|
||||
case 'DISK':
|
||||
$options = $this->getServerPartService()->getFormOption('DISK');
|
||||
break;
|
||||
case 'OS':
|
||||
$options = $this->getServerPartService()->getFormOption('OS');
|
||||
break;
|
||||
case 'DB':
|
||||
$options = $this->getServerPartService()->getFormOption('DB');
|
||||
break;
|
||||
case 'SOFTWARE':
|
||||
$options = $this->getServerPartService()->getFormOption('SOFTWARE');
|
||||
break;
|
||||
case 'ipinfo_uid': //수정때문에 전체가 필요
|
||||
$options = $this->getIPService()->getEntities();
|
||||
break;
|
||||
case 'csinfo_uid': //수정때문에 전체가 필요
|
||||
$options = $this->getCSService()->getEntities();
|
||||
$options = $this->getServerPartService()->getFormOption($field, $options);
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormOption($field, $options);
|
||||
@ -242,9 +220,6 @@ class ServiceService extends CustomerService
|
||||
if (!array_key_exists('serverinfo_uid', $formDatas)) {
|
||||
throw new \Exception("서버가 지정되지 않았습니다.");
|
||||
}
|
||||
if (!array_key_exists('switchinfo_uid', $formDatas)) {
|
||||
throw new \Exception("스위치정보가 지정되지 않았습니다.");
|
||||
}
|
||||
//신규정보 Enable
|
||||
return $this->enableService($entity, $formDatas);
|
||||
}
|
||||
@ -254,9 +229,6 @@ class ServiceService extends CustomerService
|
||||
if (!array_key_exists('serverinfo_uid', $formDatas)) {
|
||||
throw new \Exception("서버가 지정되지 않았습니다.");
|
||||
}
|
||||
if (!array_key_exists('switchinfo_uid', $formDatas)) {
|
||||
throw new \Exception("스위치정보가 지정되지 않았습니다.");
|
||||
}
|
||||
//기존정보 Disable
|
||||
$entity = $this->disableService($entity);
|
||||
//신규정보 Enable
|
||||
|
||||
@ -89,9 +89,6 @@ class ServerPartService extends EquipmentService
|
||||
case 'part_uid':
|
||||
$options = $this->getPartService()->getEntities();
|
||||
break;
|
||||
case 'SWITCH':
|
||||
$options = $this->getSwitchService()->getEntities();
|
||||
break;
|
||||
case 'CPU':
|
||||
$options = $this->getPartService()->getEntities(['type' => 'CPU']);
|
||||
break;
|
||||
@ -110,6 +107,9 @@ class ServerPartService extends EquipmentService
|
||||
case 'SOFTWARE':
|
||||
$options = $this->getPartService()->getEntities(['type' => 'SOFTWARE']);
|
||||
break;
|
||||
case 'SWITCH':
|
||||
$options = $this->getSwitchService()->getEntities();
|
||||
break;
|
||||
case 'IP':
|
||||
$options = $this->getIPService()->getEntities();
|
||||
break;
|
||||
@ -242,23 +242,4 @@ class ServerPartService extends EquipmentService
|
||||
$entity->setPartEntity($partEntity);
|
||||
return $entity;
|
||||
}
|
||||
public function show(mixed $serverinfo_uid): string
|
||||
{
|
||||
//서버파트연결용
|
||||
$viewDatas = [
|
||||
'control' => [
|
||||
'fields' => SERVERPART['PARTTYPES'],
|
||||
'filters' => SERVERPART['PARTTYPES'],
|
||||
'field_options' => [],
|
||||
],
|
||||
];
|
||||
foreach (SERVERPART['PARTTYPES'] as $partType) {
|
||||
$viewDatas['control']['field_options'][$partType] = $this->getFormOption($partType);
|
||||
}
|
||||
$viewDatas['helper'] = new ServerPartHelper();
|
||||
$viewDatas['action'] = __FUNCTION__;
|
||||
//기존 Entity 가져오기
|
||||
$viewDatas['entities'] = $this->getEntities(['serverinfo_uid' => $serverinfo_uid]);
|
||||
return view('admin/serverpart/' . __FUNCTION__, ['viewDatas' => $viewDatas]);
|
||||
}
|
||||
}
|
||||
|
||||
17
app/Views/admin/popup/view.php
Normal file
17
app/Views/admin/popup/view.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||
<?= $this->section('content') ?>
|
||||
<?php if ($error = session('error')): echo $viewDatas['helper']->alert($error) ?><?php endif ?>
|
||||
<div id="container" class="content">
|
||||
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<div class="action_form">
|
||||
<table class="table table-bordered">
|
||||
<?php foreach ($viewDatas['control']['actionFields'] as $field): ?>
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
|
||||
<td nowrap class="text-start"><?= $viewDatas['helper']->getFieldView($field, $viewDatas['entity']->$field, $viewDatas) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
@ -26,7 +26,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<table class="table table-bordered">
|
||||
<?php foreach (['CPU', 'RAM', 'DISK'] as $field): ?>
|
||||
<?php foreach (SERVERPART['SERVER_PARTTTYPES'] as $field): ?>
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
|
||||
<td nowrap class="text-start">
|
||||
|
||||
@ -70,7 +70,7 @@
|
||||
<td><?= $viewDatas['helper']->getFieldView('status', $entity->status, $viewDatas) ?></td>
|
||||
<td nowrap>
|
||||
<table class="table table-bordered table-striped m-0 p-0">
|
||||
<?php foreach (SERVERPART['PARTTYPES'] as $partType): ?>
|
||||
<?php foreach (SERVERPART['SERVER_PARTTTYPES'] as $partType): ?>
|
||||
<tr class="m-0 p-0">
|
||||
<th class="text-end m-0 p-0"><?= $viewDatas['serverPartHelper']->getListButton($partType, $partType, $viewDatas) ?></th>
|
||||
<td class="text-start m-0 p-0"><?= $viewDatas['serverPartHelper']->getFieldView($partType, "", $viewDatas) ?></td>
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
<th>추가정보</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<td nowrap>
|
||||
<table class="table table-bordered">
|
||||
<?php foreach (["code", "type", "title", "price", "amount", "manufactur_at", "format_at", "status",] as $field): ?>
|
||||
<tr>
|
||||
@ -24,7 +24,7 @@
|
||||
<?php endforeach ?>
|
||||
</table>
|
||||
</td>
|
||||
<td>
|
||||
<td nowrap>
|
||||
<table class="table table-bordered table-striped m-0 p-0">
|
||||
<?php foreach (SERVERPART['PARTTYPES'] as $partType): ?>
|
||||
<tr class="m-0 p-0">
|
||||
@ -32,14 +32,6 @@
|
||||
<td class="text-start m-0 p-0"><?= $viewDatas['serverPartHelper']->getFieldView($partType, "", $viewDatas) ?></td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
<tr class="m-0 p-0">
|
||||
<th class="text-end m-0 p-0">IP</th>
|
||||
<td class="text-start m-0 p-0"><?= $viewDatas['helper']->getFieldView("ipinfo_uid", "", $viewDatas) ?></td>
|
||||
</tr>
|
||||
<tr class="m-0 p-0">
|
||||
<th class="text-end m-0 p-0">CS</th>
|
||||
<td class="text-start m-0 p-0"><?= $viewDatas['helper']->getFieldView("csinfo_uid", "", $viewDatas) ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -24,8 +24,7 @@
|
||||
<th class="index_head_short_column">번호</th>
|
||||
<th class="index_head_short_column">
|
||||
<?= $viewDatas['helper']->getListLabel('site', lang("{$viewDatas['class_path']}.label.site"), $viewDatas) ?>/
|
||||
<?= $viewDatas['helper']->getListLabel('location', lang("{$viewDatas['class_path']}.label.location"), $viewDatas) ?>/
|
||||
<?= $viewDatas['helper']->getListLabel('switchinfo_uid', lang("{$viewDatas['class_path']}.label.switchinfo_uid"), $viewDatas) ?>
|
||||
<?= $viewDatas['helper']->getListLabel('location', lang("{$viewDatas['class_path']}.label.location"), $viewDatas) ?>
|
||||
</th>
|
||||
<th class="index_head_short_column">
|
||||
<?= $viewDatas['helper']->getListLabel('clientinfo_uid', lang("{$viewDatas['class_path']}.label.clientinfo_uid"), $viewDatas) ?>/
|
||||
@ -57,7 +56,6 @@
|
||||
<td nowrap>
|
||||
<div><?= $viewDatas['helper']->getFieldView('site', $entity->site, $viewDatas) ?></div>
|
||||
<div><?= $viewDatas['helper']->getFieldView('location', $entity->location, $viewDatas) ?></div>
|
||||
<div><?= $viewDatas['helper']->getFieldView('switchinfo_uid', $entity->switchinfo_uid, $viewDatas) ?></div>
|
||||
</td>
|
||||
<td nowrap>
|
||||
<div><?= $viewDatas['helper']->getFieldView('clientinfo_uid', $entity->getClientInfoUID(), $viewDatas) ?></div>
|
||||
|
||||
@ -15,9 +15,7 @@
|
||||
<th class="text-center">업체명</th>
|
||||
<th class="text-center">구분</th>
|
||||
<th class="text-center">장비번호</th>
|
||||
<th class="text-center">스위치정보</th>
|
||||
<th class="text-center">IP정보</th>
|
||||
<th class="text-center">CS</th>
|
||||
<th class="text-center">등록자</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user