dbmsv2 init...1
This commit is contained in:
parent
5369def63f
commit
09530b370f
@ -385,6 +385,10 @@ define("STATUS", [
|
|||||||
'PAID' => 'paid',
|
'PAID' => 'paid',
|
||||||
'UNPAID' => 'unpaid',
|
'UNPAID' => 'unpaid',
|
||||||
]);
|
]);
|
||||||
|
define("STATUS_ICONS", [
|
||||||
|
'AVAILABLE' => "",
|
||||||
|
'NOT_AVAILABLE' => "x."
|
||||||
|
]);
|
||||||
//서버 관련
|
//서버 관련
|
||||||
define("SERVER", []);
|
define("SERVER", []);
|
||||||
//서비스 관련
|
//서비스 관련
|
||||||
|
|||||||
@ -65,18 +65,13 @@ class ServiceController extends CustomerController
|
|||||||
//생성관련
|
//생성관련
|
||||||
protected function create_form_process(): void
|
protected function create_form_process(): void
|
||||||
{
|
{
|
||||||
//Form 기본값정의
|
$formDatas = $this->getService()->getFormDatas();
|
||||||
$format = env("Server.Prefix.code.format", false);
|
$formDatas['location'] = 'chiba';
|
||||||
if (!$format) {
|
$formDatas['type'] = 'normal';
|
||||||
throw new \Exception(__METHOD__ . "에서 code의 format[Server.Prefix.code.format]이 정의되지 않았습니다.");
|
$formDatas['billing_at'] = date("Y-m-d");
|
||||||
}
|
$formDatas['start_at'] = date("Y-m-d");
|
||||||
$this->getService()->setFormDatas([
|
$formDatas['status'] = ServiceEntity::DEFAULT_STATUS;
|
||||||
'location' => 'chiba',
|
$this->getService()->setFormDatas($formDatas);
|
||||||
'type' => 'normal',
|
|
||||||
'billing_at' => date("Y-m-d"),
|
|
||||||
'start_at' => date("Y-m-d"),
|
|
||||||
'status' => ServiceEntity::DEFAULT_STATUS,
|
|
||||||
]);
|
|
||||||
parent::create_form_process();
|
parent::create_form_process();
|
||||||
}
|
}
|
||||||
protected function create_process(array $formDatas): ServiceEntity
|
protected function create_process(array $formDatas): ServiceEntity
|
||||||
|
|||||||
@ -57,12 +57,12 @@ class ServerController extends EquipmentController
|
|||||||
if (!$format) {
|
if (!$format) {
|
||||||
throw new \Exception(__METHOD__ . "에서 code의 format[Server.Prefix.code.format]이 정의되지 않았습니다.");
|
throw new \Exception(__METHOD__ . "에서 code의 format[Server.Prefix.code.format]이 정의되지 않았습니다.");
|
||||||
}
|
}
|
||||||
$this->getService()->setFormDatas([
|
$formDatas = $this->getService()->getFormDatas();
|
||||||
'code' => $this->getService()->getLastestCode(
|
$formDatas['code'] = $this->getService()->getLastestCode(
|
||||||
$format,
|
$format,
|
||||||
(int)env("Server.Default.code", 0)
|
(int)env("Server.Default.code", 0)
|
||||||
)
|
);
|
||||||
]);
|
$this->getService()->setFormDatas($formDatas);
|
||||||
parent::create_form_process();
|
parent::create_form_process();
|
||||||
}
|
}
|
||||||
//생성
|
//생성
|
||||||
|
|||||||
@ -51,4 +51,15 @@ class ServerPartController extends EquipmentController
|
|||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//생성관련
|
||||||
|
protected function create_form_process(): void
|
||||||
|
{
|
||||||
|
//Form 기본값정의
|
||||||
|
$formDatas = $this->getService()->getFormDatas();
|
||||||
|
$formDatas['billing'] = 'base';
|
||||||
|
$formDatas['cnt'] = 1;
|
||||||
|
$this->getService()->setFormDatas($formDatas);
|
||||||
|
parent::create_form_process();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -239,11 +239,12 @@ class CommonHelper
|
|||||||
$attribute = "";
|
$attribute = "";
|
||||||
$label = "";
|
$label = "";
|
||||||
if ($option_value instanceof CommonEntity) {
|
if ($option_value instanceof CommonEntity) {
|
||||||
if (in_array($viewDatas['control']['action'], ['create_form', 'index'])) {
|
// if (in_array($viewDatas['control']['action'], ['create_form'])) {
|
||||||
if ($option_value->getStatus() != $option_value::DEFAULT_STATUS)
|
// if ($option_value->getStatus() != $option_value::DEFAULT_STATUS) {
|
||||||
$html = " disabled";
|
// $isDisabled = " disabled";
|
||||||
}
|
// }
|
||||||
$label = $option_value->getStatus() != $option_value::DEFAULT_STATUS ? "X." : "";
|
// }
|
||||||
|
$label = $option_value->getStatus() != $option_value::DEFAULT_STATUS ? STATUS_ICONS['NOT_AVAILABLE'] : STATUS_ICONS['AVAILABLE'];
|
||||||
$label .= $option_value->getCustomTitle();
|
$label .= $option_value->getCustomTitle();
|
||||||
} else {
|
} else {
|
||||||
$label = $option_value;
|
$label = $option_value;
|
||||||
@ -295,8 +296,9 @@ class CommonHelper
|
|||||||
break;
|
break;
|
||||||
case 'description':
|
case 'description':
|
||||||
case 'content':
|
case 'content':
|
||||||
|
case 'detail':
|
||||||
case 'history':
|
case 'history':
|
||||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' tinymce' : 'tinymce';
|
// $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' tinymce' : 'tinymce';
|
||||||
$form = form_textarea($field, $value ?? "", $extras);
|
$form = form_textarea($field, $value ?? "", $extras);
|
||||||
break;
|
break;
|
||||||
case 'user_uid':
|
case 'user_uid':
|
||||||
@ -349,6 +351,14 @@ class CommonHelper
|
|||||||
$value = array_key_exists($value, $viewDatas['control']['field_optons'][$field]) &&
|
$value = array_key_exists($value, $viewDatas['control']['field_optons'][$field]) &&
|
||||||
$viewDatas['control']['field_optons'][$field][$value] ? $viewDatas['control']['field_optons'][$field][$value]->getTitle() : "";
|
$viewDatas['control']['field_optons'][$field][$value] ? $viewDatas['control']['field_optons'][$field][$value]->getTitle() : "";
|
||||||
break;
|
break;
|
||||||
|
case 'description':
|
||||||
|
case 'content':
|
||||||
|
case 'history':
|
||||||
|
case 'detail':
|
||||||
|
if (in_array($viewDatas['control']['action'], ['view', 'index'])) {
|
||||||
|
$value = nl2br($value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (in_array($field, $viewDatas['control']['actionFilters'])) {
|
if (in_array($field, $viewDatas['control']['actionFilters'])) {
|
||||||
//index 액션에서만 filter_options를 변경시 선택된 값을 변경하는 기능
|
//index 액션에서만 filter_options를 변경시 선택된 값을 변경하는 기능
|
||||||
|
|||||||
@ -57,9 +57,6 @@ class ClientHelper extends CustomerHelper
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'history':
|
|
||||||
$value = nl2br($value);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
$value = parent::getFieldView($field, $value, $viewDatas, $extras);
|
$value = parent::getFieldView($field, $value, $viewDatas, $extras);
|
||||||
break;
|
break;
|
||||||
@ -91,7 +88,7 @@ class ClientHelper extends CustomerHelper
|
|||||||
$label ? $label : ICONS['HISTORY'],
|
$label ? $label : ICONS['HISTORY'],
|
||||||
$action,
|
$action,
|
||||||
[
|
[
|
||||||
"data-src" => "/admin/customer/clienthistory?clientinfo_uid={$viewDatas['entity']->getPK()}",
|
"data-src" => "/admin/customer/client/history?clientinfo_uid={$viewDatas['entity']->getPK()}",
|
||||||
"data-bs-toggle" => "modal",
|
"data-bs-toggle" => "modal",
|
||||||
"data-bs-target" => "#index_action_form",
|
"data-bs-target" => "#index_action_form",
|
||||||
...$extras
|
...$extras
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Helpers\Customer;
|
namespace App\Helpers\Customer;
|
||||||
|
|
||||||
|
use App\Entities\CommonEntity;
|
||||||
use App\Entities\Equipment\ServerEntity;
|
use App\Entities\Equipment\ServerEntity;
|
||||||
use App\Models\Customer\ServiceModel;
|
use App\Models\Customer\ServiceModel;
|
||||||
|
|
||||||
@ -12,6 +13,41 @@ class ServiceHelper extends CustomerHelper
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->setTitleField(field: ServiceModel::TITLE);
|
$this->setTitleField(field: ServiceModel::TITLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function form_dropdown_common_process(string $field, mixed $value, array $viewDatas, array $extras = [], array $attributes = []): string
|
||||||
|
{
|
||||||
|
$html = "";
|
||||||
|
switch ($field) {
|
||||||
|
case "serverinfo_uid":
|
||||||
|
foreach ($viewDatas['control']['field_optons'][$field] as $option_key => $option_value) {
|
||||||
|
$isSelected = $option_key == $value ? ' selected' : '';
|
||||||
|
$isDisabled = "";
|
||||||
|
$attribute = "";
|
||||||
|
$label = "";
|
||||||
|
if ($option_value instanceof CommonEntity) {
|
||||||
|
if (in_array($viewDatas['control']['action'], ['create_form'])) {
|
||||||
|
if ($option_value->getStatus() != $option_value::DEFAULT_STATUS) {
|
||||||
|
$isDisabled = " disabled";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($attributes as $attribute_name => $attribute_value) {
|
||||||
|
$attribute = sprintf(" %s=\"%s\"", $attribute_name, $option_value->$attribute_value());
|
||||||
|
}
|
||||||
|
$label = $option_value->getStatus() != $option_value::DEFAULT_STATUS ? STATUS_ICONS['NOT_AVAILABLE'] : STATUS_ICONS['AVAILABLE'];
|
||||||
|
$label .= $option_value->getCustomTitle();
|
||||||
|
} else {
|
||||||
|
$label = $option_value;
|
||||||
|
}
|
||||||
|
$html .= sprintf("<option value=\"%s\"%s%s%s>%s</option>", $option_key, $isSelected, $isDisabled, $attribute, $label);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$html = parent::form_dropdown_common_process($field, $value, $viewDatas, $extras, $attributes);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||||
{
|
{
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
@ -47,9 +83,6 @@ class ServiceHelper extends CustomerHelper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'history':
|
|
||||||
$value = nl2br($value);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
$value = parent::getFieldView($field, $value, $viewDatas, $extras);
|
$value = parent::getFieldView($field, $value, $viewDatas, $extras);
|
||||||
break;
|
break;
|
||||||
@ -72,7 +105,7 @@ class ServiceHelper extends CustomerHelper
|
|||||||
$label ? $label : ICONS['HISTORY'],
|
$label ? $label : ICONS['HISTORY'],
|
||||||
$action,
|
$action,
|
||||||
[
|
[
|
||||||
"data-src" => "/admin/customer/servicehistory?serviceinfo_uid={$viewDatas['entity']->getPK()}&serviceinfo_uid={$viewDatas['entity']->getPK()}&ActionTemplate=popup",
|
"data-src" => "/admin/customer/service/history?serviceinfo_uid={$viewDatas['entity']->getPK()}&serviceinfo_uid={$viewDatas['entity']->getPK()}&ActionTemplate=popup",
|
||||||
"data-bs-toggle" => "modal",
|
"data-bs-toggle" => "modal",
|
||||||
"data-bs-target" => "#index_action_form",
|
"data-bs-target" => "#index_action_form",
|
||||||
...$extras
|
...$extras
|
||||||
|
|||||||
@ -16,33 +16,6 @@ class ServerPartHelper extends EquipmentHelper
|
|||||||
{
|
{
|
||||||
$html = "";
|
$html = "";
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'SWITCH':
|
|
||||||
case 'IP':
|
|
||||||
case 'CS':
|
|
||||||
case 'CPU':
|
|
||||||
case 'RAM':
|
|
||||||
case 'DISK':
|
|
||||||
case 'DB':
|
|
||||||
case 'OS':
|
|
||||||
case 'SOFTWARE':
|
|
||||||
foreach ($viewDatas['control']['field_optons'][$field] as $option_key => $option_value) {
|
|
||||||
$isSelected = $option_key == $value ? ' selected' : '';
|
|
||||||
$isDisabled = "";
|
|
||||||
$attribute = "";
|
|
||||||
$label = "";
|
|
||||||
if ($option_value instanceof CommonEntity) {
|
|
||||||
if (in_array($viewDatas['control']['action'], ['create_form', 'index'])) {
|
|
||||||
if ($option_value->getStatus() != $option_value::DEFAULT_STATUS)
|
|
||||||
$html = " disabled";
|
|
||||||
}
|
|
||||||
$label = $option_value->getStatus() != $option_value::DEFAULT_STATUS ? "X." : "";
|
|
||||||
$label .= $option_value->getCustomTitle();
|
|
||||||
} else {
|
|
||||||
$label = $option_value;
|
|
||||||
}
|
|
||||||
$html .= sprintf("<option value=\"%s\"%s%s%s>%s</option>", $option_key, $isSelected, $isDisabled, $attribute, $label);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'part_uid':
|
case 'part_uid':
|
||||||
if (!array_key_exists('type', $viewDatas['control']['form_datas']) || !$viewDatas['control']['form_datas']['type']) {
|
if (!array_key_exists('type', $viewDatas['control']['form_datas']) || !$viewDatas['control']['form_datas']['type']) {
|
||||||
throw new \Exception(__METHOD__ . "에서 오류발생: Type가 정의되지 않았습니다.");
|
throw new \Exception(__METHOD__ . "에서 오류발생: Type가 정의되지 않았습니다.");
|
||||||
@ -53,11 +26,15 @@ class ServerPartHelper extends EquipmentHelper
|
|||||||
$attribute = "";
|
$attribute = "";
|
||||||
$label = "";
|
$label = "";
|
||||||
if ($option_value instanceof CommonEntity) {
|
if ($option_value instanceof CommonEntity) {
|
||||||
if (in_array($viewDatas['control']['action'], ['create_form', 'index'])) {
|
// if (in_array($viewDatas['control']['action'], ['create_form'])) {
|
||||||
if ($option_value->getStatus() != $option_value::DEFAULT_STATUS)
|
// if ($option_value->getStatus() != $option_value::DEFAULT_STATUS) {
|
||||||
$html = " disabled";
|
// $isDisabled = " disabled";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
foreach ($attributes as $attribute_name => $attribute_value) {
|
||||||
|
$attribute = sprintf(" %s=\"%s\"", $attribute_name, $option_value->$attribute_value());
|
||||||
}
|
}
|
||||||
$label = $option_value->getStatus() != $option_value::DEFAULT_STATUS ? "X." : "";
|
$label = $option_value->getStatus() != $option_value::DEFAULT_STATUS ? STATUS_ICONS['NOT_AVAILABLE'] : STATUS_ICONS['AVAILABLE'];
|
||||||
$label .= $option_value->getCustomTitle();
|
$label .= $option_value->getCustomTitle();
|
||||||
} else {
|
} else {
|
||||||
$label = $option_value;
|
$label = $option_value;
|
||||||
@ -74,18 +51,10 @@ class ServerPartHelper extends EquipmentHelper
|
|||||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||||
{
|
{
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'SWITCH':
|
case 'part_uid':
|
||||||
case 'IP':
|
|
||||||
case 'CS':
|
|
||||||
case 'CPU':
|
|
||||||
case 'RAM':
|
|
||||||
case 'DISK':
|
|
||||||
case 'DB':
|
|
||||||
case 'OS':
|
|
||||||
case 'SOFTWARE':
|
|
||||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
$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')";
|
$extras['onChange'] = "document.querySelector('input[name=\'amount\']').value = this.options[this.selectedIndex].getAttribute('data-price')";
|
||||||
$attributes = ['data-type' => 'getType', 'data-price' => 'getPrice'];
|
$attributes = ['data-price' => 'getPrice'];
|
||||||
$form = $this->form_dropdown_common($field, $value, $viewDatas, $extras, $attributes);
|
$form = $this->form_dropdown_common($field, $value, $viewDatas, $extras, $attributes);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -28,9 +28,9 @@ class ServiceService extends CustomerService
|
|||||||
"type",
|
"type",
|
||||||
"clientinfo_uid",
|
"clientinfo_uid",
|
||||||
'serverinfo_uid',
|
'serverinfo_uid',
|
||||||
|
"start_at",
|
||||||
"billing_at",
|
"billing_at",
|
||||||
"amount",
|
"amount",
|
||||||
"start_at",
|
|
||||||
"status",
|
"status",
|
||||||
"history",
|
"history",
|
||||||
];
|
];
|
||||||
@ -235,7 +235,7 @@ class ServiceService extends CustomerService
|
|||||||
throw new \Exception("신규 서버가 지정되지 않았습니다.");
|
throw new \Exception("신규 서버가 지정되지 않았습니다.");
|
||||||
}
|
}
|
||||||
//기존서버정보 사용가능으로 설정
|
//기존서버정보 사용가능으로 설정
|
||||||
if ($entity->getServerInfoUID() !== $formDatas['serverinfo_uid']) {
|
if ($entity->getServerInfoUID() && $entity->getServerInfoUID() !== $formDatas['serverinfo_uid']) {
|
||||||
$entity = $this->setServer_process(
|
$entity = $this->setServer_process(
|
||||||
$entity,
|
$entity,
|
||||||
$entity->getServerEntity()->getPK(),
|
$entity->getServerEntity()->getPK(),
|
||||||
|
|||||||
@ -24,11 +24,11 @@ class ServerPartService extends EquipmentService
|
|||||||
return [
|
return [
|
||||||
"serverinfo_uid",
|
"serverinfo_uid",
|
||||||
"type",
|
"type",
|
||||||
"part_uid",
|
|
||||||
"billing",
|
"billing",
|
||||||
"amount",
|
"part_uid",
|
||||||
"cnt",
|
"cnt",
|
||||||
"extra",
|
"extra",
|
||||||
|
"amount",
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
public function getFormFilters(): array
|
public function getFormFilters(): array
|
||||||
|
|||||||
@ -1,8 +1,18 @@
|
|||||||
|
<?php $htmls ?>
|
||||||
|
<?php foreach ($serverPartCellDatas['types'] as $type): ?>
|
||||||
|
<?php $htmls[$type] = [] ?>
|
||||||
|
<?php foreach ($serverPartCellDatas['entities'][$type] as $entities): ?>
|
||||||
|
<?php foreach ($entities as $entity): ?>
|
||||||
|
<?php $serverPartCellDatas['entity'] = $entity ?>
|
||||||
|
<?php $htmls[$type][] = $serverPartCellDatas['service']->getHelper()->getFieldView($type, $entity->getPK(), $serverPartCellDatas) ?>
|
||||||
|
<?php endforeach ?>
|
||||||
|
<?php endforeach ?>
|
||||||
|
<?php endforeach ?>
|
||||||
<table class="table table-bordered table-striped m-0 p-0">
|
<table class="table table-bordered table-striped m-0 p-0">
|
||||||
<?php foreach ($serverPartCellDatas['types'] as $type): ?>
|
<?php foreach ($serverPartCellDatas['types'] as $type): ?>
|
||||||
<tr class="m-0 p-0">
|
<tr class="m-0 p-0">
|
||||||
<th class="text-end m-0 p-0" width="15%"><?= $serverPartCellDatas['service']->getHelper()->getListButton($type, $type, $serverPartCellDatas) ?></th>
|
<th class="text-end m-0 p-0" width="15%"><?= $serverPartCellDatas['service']->getHelper()->getListButton($type, '', $serverPartCellDatas) ?></th>
|
||||||
<td class="text-start m-0 p-0"><?= $serverPartCellDatas['service']->getHelper()->getFieldView($type, "", $serverPartCellDatas) ?></td>
|
<td class="text-start m-0 p-0"><?= implode(",", $htmls[$type]) ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
</table>
|
</table>
|
||||||
Loading…
Reference in New Issue
Block a user