dbms_init...1

This commit is contained in:
choi.jh 2025-06-10 16:39:38 +09:00
parent 3828dc90e3
commit 00998fd39c
35 changed files with 543 additions and 732 deletions

View File

@ -134,6 +134,19 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
});
});
$routes->group('equipment', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
$routes->group('code', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
$routes->get('/', 'CodeController::index', []);
$routes->get('create', 'CodeController::create_form');
$routes->post('create', 'CodeController::create');
$routes->get('modify/(:alphanum)', 'CodeController::modify_form/$1');
$routes->post('modify/(:alphanum)', 'CodeController::modify/$1');
$routes->get('view/(:alphanum)', 'CodeController::view/$1');
$routes->get('delete/(:alphanum)', 'CodeController::delete/$1');
$routes->get('toggle/(:alphanum)/(:any)', 'CodeController::toggle/$1/$2');
$routes->post('batchjob', 'CodeController::batchjob');
$routes->post('batchjob_delete', 'CodeController::batchjob_delete');
$routes->get('download/(:alpha)', 'CodeController::download/$1');
});
$routes->group('server', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
$routes->get('/', 'ServerController::index', []);
$routes->get('create', 'ServerController::create_form');

View File

@ -2,11 +2,12 @@
namespace App\Controllers\Admin\Customer;
use App\Entities\Equipment\CodeEntity;
use App\Helpers\Customer\ServiceHelper;
use App\Services\Customer\ServiceItemService;
use App\Services\Customer\ServiceService;
use App\Services\Customer\ServiceItemService;
use App\Services\Equipment\CodeService;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
@ -15,6 +16,7 @@ use Psr\Log\LoggerInterface;
class ServiceController extends CustomerController
{
private ?ServiceItemService $_serviceItemService = null;
private ?CodeService $_codeService = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
@ -38,6 +40,13 @@ class ServiceController extends CustomerController
}
return $this->_helper;
}
public function getCodeService(): CodeService
{
if (!$this->_codeService) {
$this->_codeService = new CodeService($this->request);
}
return $this->_codeService;
}
public function getServiceItemService(): ServiceItemService
{
if (!$this->_serviceItemService) {
@ -53,6 +62,11 @@ class ServiceController extends CustomerController
$options[$entity->getPK()] = $entity->getTitle();
}
break;
case 'code':
foreach ($this->getCodeService()->getEntities() as $entity) {
$options[$entity->getPK()] = $entity->getTitle();
}
break;
case 'SERVER':
case 'CPU':
case 'RAM':
@ -72,15 +86,9 @@ class ServiceController extends CustomerController
}
return $options;
}
//Index,FieldForm관련
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
{
switch ($this->getAction()) {
case 'create':
case 'modify':
$this->getMyLogService()->save($this->getService(), __FUNCTION__, $this->getMyAuth(), $message);
$result = $this->view($this->entity->getPK());
break;
case 'index':
$this->control = $this->getControlDatas();
$this->getHelper()->setViewDatas($this->getViewDatas());
@ -93,6 +101,30 @@ class ServiceController extends CustomerController
return $result;
}
//Index,FieldForm관련
private function setCodeStatus(string $code, string $status): void
{
//coded의 경우 사용가능/사용중으로 설정작업
$codeEntity = $this->getCodeService()->getEntity($code);
if (!$codeEntity) {
throw new \Exception("{$code}에 대한 서버코드정보를 찾을수 없습니다.");
}
$codeEntity = $this->getCodeService()->setStatus($codeEntity, $status);
if (!$codeEntity) {
throw new \Exception("{$code}에 대한 {$status} 상태설정에 실패하였습니다.");
}
}
protected function create_process(array $formDatas): mixed
{
//coded의 경우 서비스중으로 설정작업
$this->setCodeStatus($formDatas['code'], CodeEntity::STATUS_OCCUPIED);
return parent::create_process($formDatas);
}
protected function delete_process(mixed $entity): mixed
{
//coded의 경우 사용가능으로 설정작업
$this->setCodeStatus($entity->getCode(), CodeEntity::STATUS_AVAILABLE);
return parent::delete_process($entity);
}
protected function index_process(): array
{
//추가 Field작업 처리

View File

@ -60,8 +60,10 @@ class ServiceItemController extends CustomerController
if (!$item_type) {
throw new \Exception(__FUNCTION__ . "에서 item_type이 지정되지 않았습니다.");
}
//CustomerController에서 선언된 getFormFieldOption사용 됨
$options = parent::getFormFieldOption($item_type, $options);
//$item_type(CPU,RAM,STORAGE등)에 따라 선언된 getFormFieldOption사용 됨
foreach ($this->getEquipmentService($item_type)->getEntities() as $entity) {
$options[$entity->getPK()] = $entity->getTitle();
}
break;
default:
$options = parent::getFormFieldOption($field, $options);
@ -69,20 +71,6 @@ class ServiceItemController extends CustomerController
}
return $options;
}
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
{
switch ($this->getAction()) {
case 'index':
$this->control = $this->getControlDatas();
$this->getHelper()->setViewDatas($this->getViewDatas());
$result = view($this->view_path . 'popup' . DIRECTORY_SEPARATOR . $this->getAction(), ['viewDatas' => $this->getViewDatas()]);
break;
default:
$result = parent::getResultSuccess($message);
break;
}
return $result;
}
//Index,FieldForm관련
protected function create_process(array $formDatas): mixed
{

View File

@ -0,0 +1,44 @@
<?php
namespace App\Controllers\Admin\Equipment;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Helpers\Equipment\CodeHelper;
use App\Services\Equipment\CodeService;
class CodeController extends EquipmentController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->title = lang("{$this->getService()->getClassName()}.title");
$this->class_path .= $this->getService()->getClassName();
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
}
public function getService(): CodeService
{
if (!$this->_service) {
$this->_service = new CodeService($this->request);
}
return $this->_service;
}
public function getHelper(): CodeHelper
{
if (!$this->_helper) {
$this->_helper = new CodeHelper($this->request);
}
return $this->_helper;
}
//Index,FieldForm관련
protected function setOrderByForList(): void
{
//OrderBy 처리
$this->getService()->getModel()->orderBy('code', 'ASC', false);
parent::setOrderByForList();
}
}

View File

@ -245,11 +245,14 @@ abstract class CommonController extends BaseController
case 'index':
case 'view':
case 'download':
$this->view_template = $this->view_path . $this->getAction();
$actionFrameType = $this->request->getVar('ActionFrameType');
if ($actionFrameType) {
$this->view_template = $this->view_path . $actionFrameType . DIRECTORY_SEPARATOR . $this->getAction();
}
$this->control = $this->getControlDatas();
$this->getHelper()->setViewDatas($this->getViewDatas());
$result = view($this->view_path . $this->getAction(), [
'viewDatas' => $this->getViewDatas()
]);
$result = view($this->view_template, ['viewDatas' => $this->getViewDatas()]);
break;
default:
$result = redirect()->to($this->getMyAuth()->popPreviousUrl())->with('error', $message);

File diff suppressed because one or more lines are too long

View File

@ -4,13 +4,13 @@
"settings": {
"width": 3000,
"height": 3000,
"scrollTop": -1395.0309,
"scrollLeft": -515.7816,
"scrollTop": -988.0309,
"scrollLeft": -1051.8446,
"zoomLevel": 0.76,
"show": 511,
"database": 4,
"databaseName": "",
"canvasType": "@dineug/erd-editor/builtin-schema-sql",
"canvasType": "ERD",
"language": 1,
"tableNameCase": 4,
"columnNameCase": 2,
@ -51,7 +51,8 @@
"B8haiEbPc1lRBWTv1g25G",
"isiA_oaJNIm3F4nYJuLJ1",
"0WXrjcyXXGeoAVM2VB8s2",
"eLGlqJ4z_woGP6CLZEuUr"
"eLGlqJ4z_woGP6CLZEuUr",
"JoMB-mb6p6NoHpiAvjD2y"
],
"relationshipIds": [
"gAVYXWnBSnCw-0ieO4Mil",
@ -67,7 +68,8 @@
"Wma86GpS3BhikEaHSamgX",
"I80TuGxKm3tXIO_EO2PSm",
"o8yw46vm30cC7wl9cRMdo",
"ocWjncqwtYkP02mw4A0-8"
"ocWjncqwtYkP02mw4A0-8",
"6oBuPqT-ikPI7X8a05Trv"
],
"indexIds": [],
"memoIds": []
@ -799,7 +801,7 @@
"uuDbJDSDQLey7Km1W9hlJ",
"Gb6fmS40Q3wvnvD1HMTqR",
"_UFwKNcesG423815BIYBi",
"RpyPtXKwtu3XFr5BM61TA",
"O7aGU_LJxCO1NeNVWbB-J",
"FJtEzmrQUsMMbrWbzr8IR",
"hQ5EOPiUpDbVpWQwawtw4",
"9o7wfPp7WK2nZoxkDZ9Y1",
@ -825,6 +827,7 @@
"uuDbJDSDQLey7Km1W9hlJ",
"Gb6fmS40Q3wvnvD1HMTqR",
"_UFwKNcesG423815BIYBi",
"O7aGU_LJxCO1NeNVWbB-J",
"RpyPtXKwtu3XFr5BM61TA",
"FJtEzmrQUsMMbrWbzr8IR",
"hQ5EOPiUpDbVpWQwawtw4",
@ -844,7 +847,7 @@
"color": ""
},
"meta": {
"updateAt": 1749517812138,
"updateAt": 1749529381866,
"createAt": 1748485662214
}
},
@ -969,6 +972,36 @@
"updateAt": 1749520763447,
"createAt": 1749520593335
}
},
"JoMB-mb6p6NoHpiAvjD2y": {
"id": "JoMB-mb6p6NoHpiAvjD2y",
"name": "codeinfo",
"comment": "코드표",
"columnIds": [
"FMB1Pw8d7ED0xlrEAdVok",
"G1UKbUmdA5cmhcVHaqrTj",
"UIl3k8fn-kPZvaWKIMtKY",
"4TGBpdAErYnDel4snI9A5"
],
"seqColumnIds": [
"WsOgvUtYTLLdAhcZUJZFQ",
"FMB1Pw8d7ED0xlrEAdVok",
"G1UKbUmdA5cmhcVHaqrTj",
"UIl3k8fn-kPZvaWKIMtKY",
"4TGBpdAErYnDel4snI9A5"
],
"ui": {
"x": 1695.8469,
"y": 1219.7775,
"zIndex": 2508,
"widthName": 60,
"widthComment": 60,
"color": ""
},
"meta": {
"updateAt": 1749527271778,
"createAt": 1749526993705
}
}
},
"tableColumnEntities": {
@ -6559,7 +6592,7 @@
"comment": "서비스명",
"dataType": "VARCHAR(255)",
"default": "",
"options": 8,
"options": 12,
"ui": {
"keys": 0,
"widthName": 60,
@ -6568,7 +6601,7 @@
"widthDefault": 60
},
"meta": {
"updateAt": 1749435003173,
"updateAt": 1749526904029,
"createAt": 1749434957365
}
},
@ -6771,6 +6804,126 @@
"updateAt": 1749520739979,
"createAt": 1749520727362
}
},
"WsOgvUtYTLLdAhcZUJZFQ": {
"id": "WsOgvUtYTLLdAhcZUJZFQ",
"tableId": "JoMB-mb6p6NoHpiAvjD2y",
"name": "uid",
"comment": "",
"dataType": "INT",
"default": "",
"options": 15,
"ui": {
"keys": 1,
"widthName": 60,
"widthComment": 60,
"widthDataType": 60,
"widthDefault": 60
},
"meta": {
"updateAt": 1749527175180,
"createAt": 1749527110532
}
},
"G1UKbUmdA5cmhcVHaqrTj": {
"id": "G1UKbUmdA5cmhcVHaqrTj",
"tableId": "JoMB-mb6p6NoHpiAvjD2y",
"name": "status",
"comment": "",
"dataType": "VARCHAR(20)",
"default": "'default'",
"options": 8,
"ui": {
"keys": 0,
"widthName": 60,
"widthComment": 60,
"widthDataType": 75,
"widthDefault": 60
},
"meta": {
"updateAt": 1749527110533,
"createAt": 1749527110533
}
},
"UIl3k8fn-kPZvaWKIMtKY": {
"id": "UIl3k8fn-kPZvaWKIMtKY",
"tableId": "JoMB-mb6p6NoHpiAvjD2y",
"name": "updated_at",
"comment": "",
"dataType": "TIMESTAMP",
"default": "",
"options": 0,
"ui": {
"keys": 0,
"widthName": 62,
"widthComment": 60,
"widthDataType": 65,
"widthDefault": 60
},
"meta": {
"updateAt": 1749527110533,
"createAt": 1749527110533
}
},
"4TGBpdAErYnDel4snI9A5": {
"id": "4TGBpdAErYnDel4snI9A5",
"tableId": "JoMB-mb6p6NoHpiAvjD2y",
"name": "created_at",
"comment": "",
"dataType": "TIMESTAMP",
"default": "CURRENT_TIMESTAMP",
"options": 8,
"ui": {
"keys": 0,
"widthName": 60,
"widthComment": 60,
"widthDataType": 65,
"widthDefault": 122
},
"meta": {
"updateAt": 1749527110533,
"createAt": 1749527110533
}
},
"FMB1Pw8d7ED0xlrEAdVok": {
"id": "FMB1Pw8d7ED0xlrEAdVok",
"tableId": "JoMB-mb6p6NoHpiAvjD2y",
"name": "code",
"comment": "서버코드",
"dataType": "VARCHAR(20)",
"default": "",
"options": 14,
"ui": {
"keys": 1,
"widthName": 60,
"widthComment": 60,
"widthDataType": 75,
"widthDefault": 60
},
"meta": {
"updateAt": 1749527292426,
"createAt": 1749527129380
}
},
"O7aGU_LJxCO1NeNVWbB-J": {
"id": "O7aGU_LJxCO1NeNVWbB-J",
"tableId": "B8haiEbPc1lRBWTv1g25G",
"name": "code",
"comment": "서버코드",
"dataType": "VARCHAR(20)",
"default": "",
"options": 8,
"ui": {
"keys": 2,
"widthName": 60,
"widthComment": 60,
"widthDataType": 75,
"widthDefault": 60
},
"meta": {
"updateAt": 1749529387909,
"createAt": 1749527376195
}
}
},
"relationshipEntities": {
@ -7046,7 +7199,7 @@
"NzxkmndrTbH7xb6fbnGV7"
],
"x": 1454.3741,
"y": 1132.673,
"y": 1098.0063333333333,
"direction": 2
},
"meta": {
@ -7130,7 +7283,7 @@
"f1hR1JRFHBHwiJSSX34gw"
],
"x": 1454.3741,
"y": 1340.673,
"y": 1236.673,
"direction": 2
},
"meta": {
@ -7165,6 +7318,34 @@
"updateAt": 1749520727362,
"createAt": 1749520727362
}
},
"6oBuPqT-ikPI7X8a05Trv": {
"id": "6oBuPqT-ikPI7X8a05Trv",
"identification": false,
"relationshipType": 16,
"startRelationshipType": 2,
"start": {
"tableId": "JoMB-mb6p6NoHpiAvjD2y",
"columnIds": [
"FMB1Pw8d7ED0xlrEAdVok"
],
"x": 1695.8469,
"y": 1295.7775,
"direction": 1
},
"end": {
"tableId": "B8haiEbPc1lRBWTv1g25G",
"columnIds": [
"O7aGU_LJxCO1NeNVWbB-J"
],
"x": 1454.3741,
"y": 1375.3396666666667,
"direction": 2
},
"meta": {
"updateAt": 1749527376196,
"createAt": 1749527376196
}
}
},
"indexEntities": {},

View File

@ -12,6 +12,10 @@ class ServiceEntity extends CustomerEntity
{
return intval($this->attributes['ownerinfo_uid']);
}
final public function getCode(): string
{
return $this->attributes['code'];
}
public function getItemEntities(string $type): array
{
return $this->attributes[$type] ?? [];

View File

@ -0,0 +1,13 @@
<?php
namespace App\Entities\Equipment;
use App\Models\Equipment\CodeModel;
class CodeEntity extends EquipmentEntity
{
const PK = CodeModel::PK;
const TITLE = CodeModel::TITLE;
const STATUS_AVAILABLE = "default";
const STATUS_OCCUPIED = "occupied";
}

View File

@ -265,27 +265,14 @@ class CommonHelper
if (!is_array($viewDatas['control']['filter_optons'][$field])) {
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다.");
}
//codeigniter 함수사용시
$formOptions = ["" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택'];
foreach ($viewDatas['control']['filter_optons'][$field] as $key => $label) {
$formOptions[$key] = $label;
}
$form = form_dropdown($field, $formOptions, $value, $extras);
//* $form = form_dropdown($field, $formOptions, $value, $extras); --> form_dropdown사용시 form_dropdown() 함수 내부에서 htmlspecialchars()가 실행되어 javascript에서는 &quot;로 바뀌어 javascript가 실행되 않는 문제발생
//직접작성 함수사용시
// $onChange= isset($extras["onChange"]) ? " onChange=\"{$extras["onChange"]}\"":"";
// $forms = [
// "<select name=\"{$field}\"{$onChange}>",
// "<option value=\"\">". lang($viewDatas['class_path'] . '.label.' . $field) . " 선택</option>"
// ];
// foreach ($viewDatas['control']['filter_optons'][$field] as $key => $label) {
// $isSelected = ($key == $value) ? ' selected="selected"' : '';
// $forms[] = "<option value=\"{$key}\"{$isSelected}>{$label}</option>";
// }
// $forms[]="</select>";
// $form = implode("",$forms);
$extra_class = isset($extras['class']) ? $extras['class'] . ' select-field' : 'select-field';
$form = form_dropdown($field, $formOptions, $value, ['class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
} else {
$form = form_input($field, $value ?? "", ["autocomplete" => $field, ...$extras]);
$form = form_input($field, $value ?? "", ["autocomplete" => $field, $extras]);
}
break;
}
@ -316,6 +303,11 @@ class CommonHelper
break;
default:
if (in_array($field, $viewDatas['control']['filter_fields'])) {
if (env('app.debug.filter_options')) {
echo "field=>" . $field . ",value=>" . $value . "<br>";
echo var_dump($viewDatas['control']['filter_optons'][$field]) . "<br>";
// echo var_dump($viewDatas['entity']) . "<br>";
}
$extras["onChange"] = sprintf(
"document.location.href='%s/toggle/%s/%s?%s='+this.options[this.selectedIndex].value",
current_url(),
@ -323,7 +315,7 @@ class CommonHelper
$field,
$field
);
$value = $this->getFieldForm($field, $viewDatas['entity']->$field, $viewDatas, $extras);
$value = $this->getFieldForm($field, $value, $viewDatas, $extras);
}
break;
}

View File

@ -18,9 +18,43 @@ class ClientHelper extends CustomerHelper
$value = $viewDatas['entity']->$field;
switch ($field) {
case 'account_balance':
$extras = ["class" => "btn btn-link", "target" => "_self", ...$extras];
$value = form_label(
number_format(intval($value)),
'index',
[
"data-src" => "/admin/customer/account?clientinfo_uid={$viewDatas['entity']->getPK()}&ActionFrameType=popup",
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
]
);
break;
case 'coupon_balance':
$extras = ["class" => "btn btn-link", "target" => "_self", ...$extras];
$value = form_label(
number_format(intval($value)),
'index',
[
"data-src" => "/admin/customer/coupon?clientinfo_uid={$viewDatas['entity']->getPK()}&ActionFrameType=popup",
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
]
);
break;
case 'point_balance':
$value = number_format(intval($value));
$extras = ["class" => "btn btn-link", "target" => "_self", ...$extras];
$value = form_label(
number_format(intval($value)),
'index',
[
"data-src" => "/admin/customer/point?clientinfo_uid={$viewDatas['entity']->getPK()}&ActionFrameType=popup",
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
]
);
break;
default:
$value = parent::getFieldView($field, $viewDatas, $extras);

View File

@ -31,7 +31,7 @@ class ServiceHelper extends CustomerHelper
ICONS['SETUP'],
$field,
[
"data-src" => "/admin/customer/serviceitem?serviceinfo_uid={$viewDatas['entity']->getPK()}&item_type={$field}",
"data-src" => "/admin/customer/serviceitem?serviceinfo_uid={$viewDatas['entity']->getPK()}&item_type={$field}&ActionFrameType=popup",
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
@ -57,7 +57,7 @@ class ServiceHelper extends CustomerHelper
case "SOFTWARE":
case "DEFENCE":
case "DOMAIN":
$temps = ["<ol>"];
$temps = ["<ul>"];
foreach ($viewDatas['entity']->getItemEntities($field) as $itemEntity) {
$temps[] = sprintf(
"<li title=\"%s\">%s&nbsp;%s&nbsp;%s</li>",
@ -67,7 +67,7 @@ class ServiceHelper extends CustomerHelper
$itemEntity->getView_Sale()
);
}
$temps[] = "</ol>";
$temps[] = "</ul>";
$value = implode("", $temps);
break;
default:

View File

@ -0,0 +1,16 @@
<?php
namespace App\Helpers\Equipment;
use App\Models\Equipment\CodeModel;
use CodeIgniter\HTTP\IncomingRequest;
class CodeHelper extends EquipmentHelper
{
protected ?IncomingRequest $request = null;
public function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
$this->setTitleField(field: CodeModel::TITLE);
}
}

View File

@ -9,6 +9,7 @@ return [
'status' => "입/출금",
'updated_at' => "수정일",
'created_at' => "작성일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'status' => 'default',

View File

@ -12,6 +12,7 @@ return [
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'role' => "user",
@ -26,5 +27,6 @@ return [
'default' => "사용",
"pause" => "일시정지",
"terminated" => "해지",
"delete" => "삭제",
],
];

View File

@ -8,6 +8,7 @@ return [
'status' => "추가/사용",
'updated_at' => "수정일",
'created_at' => "작성일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'status' => 'default'

View File

@ -8,6 +8,7 @@ return [
'status' => "입/출금",
'updated_at' => "수정일",
'created_at' => "작성일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'status' => 'default'

View File

@ -16,6 +16,7 @@ return [
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "신청일",
'deleted_at' => "삭제일",
'SERVER' => "서버",
'LINE' => "회선",
'IP' => "IP",
@ -40,21 +41,6 @@ return [
"default" => "치바",
"tokyo" => "도쿄",
],
"CODE" => [
"JPN130" => "JPN130",
"JPN140" => "JPN140",
"JPN138" => "JPN138",
"R45P20" => "R45P20",
"X1508C" => "X1508C",
"X1508D" => "X1508D",
"X2001A" => "X2001A",
"X2001B" => "X2001B",
"X2001C" => "X2001C",
"X2001D" => "X2001D",
"X2001E" => "X2001E",
"P2404I510" => "P2404I510",
"P2404I710" => "P2404I710",
],
"TYPE" => [
"default" => "일반",
"defence" => "방어",
@ -62,7 +48,7 @@ return [
"alternative" => "대체",
"test" => "테스트",
"VPN" => "VPN",
"own" => "자사용",
"ours" => "자사용",
"colocation" => "코로케이션",
],
"RAID" => [
@ -76,5 +62,6 @@ return [
'default' => "사용중",
"pause" => "일시정지",
"terminated" => "해지",
"delete" => "삭제",
],
];

View File

@ -15,6 +15,7 @@ return [
],
"STATUS" => [
'default' => "사용중",
"pause" => "일시정지",
'delete' => "삭제",
],
];

View File

@ -13,6 +13,7 @@ return [
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "신청일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'item_type' => "server",
@ -40,5 +41,6 @@ return [
"pause" => "일시정지",
'reservation' => "설치예약",
"terminated" => "해지",
"delete" => "삭제",
],
];

View File

@ -0,0 +1,18 @@
<?php
return [
'title' => "서버장비정보",
'label' => [
'code' => "코드",
'updated_at' => "수정일",
'created_at' => "작성일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'status' => 'default',
],
"STATUS" => [
'default' => "사용가능",
'occupied' => "서비스중",
"deleete" => "삭제",
],
];

View File

@ -10,10 +10,12 @@ return [
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일",
'deleted_at' => "삭제일",
],
"STATUS" => [
'default' => "사용가능",
"pause" => "일시정지",
"occupied" => "사용중",
"delete" => "삭제",
],
];

View File

@ -8,6 +8,7 @@ return [
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'status' => 'default'
@ -15,5 +16,6 @@ return [
"STATUS" => [
'default' => "사용가능",
"pause" => "일시정지",
"delete" => "삭제",
],
];

View File

@ -11,6 +11,7 @@ return [
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'type' => 'VPC-CS',
@ -24,5 +25,6 @@ return [
'default' => "사용가능",
"pause" => "일시정지",
"occupied" => "사용중",
"delete" => "삭제",
],
];

View File

@ -8,6 +8,7 @@ return [
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'status' => 'default'
@ -17,5 +18,6 @@ return [
"pause" => "일시정지",
"occupied" => "사용중",
"forbidden" => "사용금지됨",
"delete" => "삭제",
],
];

View File

@ -11,6 +11,7 @@ return [
'start_at' => "개통일",
'updated_at' => "수정일",
'created_at' => "작성일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'type' => 'default',
@ -25,5 +26,6 @@ return [
'default' => "사용가능",
"pause" => "일시정지",
"terminated" => "해지",
"delete" => "삭제",
],
];

View File

@ -8,6 +8,7 @@ return [
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'status' => 'default'
@ -15,5 +16,6 @@ return [
"STATUS" => [
'default' => "사용가능",
"pause" => "일시정지",
"delete" => "삭제",
],
];

View File

@ -9,6 +9,7 @@ return [
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'type' => 'Windows',
@ -24,5 +25,6 @@ return [
"STATUS" => [
'default' => "사용가능",
"pause" => "일시정지",
"delete" => "삭제",
],
];

View File

@ -8,6 +8,7 @@ return [
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'status' => 'default'
@ -15,5 +16,6 @@ return [
"STATUS" => [
'default' => "사용가능",
"pause" => "일시정지",
"delete" => "삭제",
],
];

View File

@ -8,6 +8,7 @@ return [
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'status' => 'default',
@ -15,6 +16,6 @@ return [
"STATUS" => [
'default' => "사용가능",
"pause" => "일시정지",
"occupied" => "사용중",
"delete" => "삭제",
],
];

View File

@ -11,6 +11,7 @@ return [
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'status' => 'default'
@ -18,5 +19,6 @@ return [
"STATUS" => [
'default' => "완료",
"fail" => "실패",
"delete" => "삭제",
],
];

View File

@ -13,6 +13,7 @@ return [
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'role' => "manager",
@ -28,5 +29,6 @@ return [
"STATUS" => [
'default' => "사용",
"pause" => "사용정지",
"delete" => "삭제",
],
];

View File

@ -0,0 +1,61 @@
<?php
namespace App\Models\Equipment;
use App\Entities\Equipment\CodeEntity;
class CodeModel extends EquipmentModel
{
const TABLE = "codeinfo";
const PK = "code";
const TITLE = "code";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $useAutoIncrement = false;
protected $returnType = CodeEntity::class;
protected $allowedFields = [
"code",
"status",
"updated_at"
];
public function __construct()
{
parent::__construct();
}
public function getFormFieldRule(string $action, string $field): string
{
if (is_array($field)) {
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case $this->getPKField():
// 수동입력인 경우
if (!$this->useAutoIncrement) {
$rule = "required|regex_match[/^[0-9a-zA-Z]/]";
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->table}.{$field}]" : "";
} else {
$rule = "required|numeric";
}
break;
case "status":
$rule = "required|trim|string";
break;
default:
$rule = parent::getFormFieldRule($action, $field);
break;
}
return $rule;
}
protected function convertEntityData(string $action, string $field, array $formDatas, mixed $entity): mixed
{
switch ($field) {
case $this->getPKField():
$entity->$field = $formDatas[$field];
break;
default:
$entity = parent::convertEntityData($action, $field, $formDatas, $entity);
break;
}
return $entity;
}
}

View File

@ -0,0 +1,49 @@
<?php
namespace App\Services\Equipment;
use App\Entities\Equipment\CodeEntity;
use App\Models\Equipment\CodeModel;
use CodeIgniter\HTTP\IncomingRequest;
use App\Services\Equipment\EquipmentService;
class CodeService extends EquipmentService
{
protected ?IncomingRequest $request = null;
public function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
$this->addClassName('Code');
}
public function getModelClass(): CodeModel
{
return new CodeModel();
}
public function getEntityClass(): CodeEntity
{
return new CodeEntity();
}
public function getFormFields(): array
{
return [
"code",
"status",
];
}
public function getFilterFields(): array
{
return ['status'];
}
public function getBatchJobFields(): array
{
return ['status'];
}
public function getIndexFields(): array
{
return ['status'];
}
public function setStatus(CodeEntity $entity, string $status): CodeEntity
{
return $this->getModel()->modify($entity, ['status' => $status]);
}
}

View File

@ -29,6 +29,9 @@
<div class="accordion-item">
<a href="/admin/equipment/part/storage"><?= ICONS['SETUP'] ?>저장장치정보</a>
</div>
<div class="accordion-item">
<a href="/admin/equipment/code"><?= ICONS['SETUP'] ?>Code정보</a>
</div>
<div class="accordion-item">
<a href="/admin/equipment/server"><?= ICONS['DESKTOP'] ?>Server정보</a>
</div>