dbms_init...1

This commit is contained in:
최준흠 2025-05-14 16:12:09 +09:00
parent b292ca2f6b
commit 7f099e35e5
38 changed files with 276 additions and 111 deletions

View File

@ -45,7 +45,7 @@ class IpController extends EquipmentController
protected function index_process(): array protected function index_process(): array
{ {
$fields = [ $fields = [
'fields' => ['lineinfo_uid', $this->getService()->getModel()->getTitleField(), 'price', 'status', 'updated_at'], 'fields' => ['lineinfo_uid', $this->getService()->getModel()->getTitleField(), 'status', 'updated_at'],
]; ];
$this->init('index', $fields); $this->init('index', $fields);
return parent::index_process(); return parent::index_process();

View File

@ -38,7 +38,7 @@ class PartController extends EquipmentController
protected function index_process(): array protected function index_process(): array
{ {
$fields = [ $fields = [
'fields' => ['clientinfo_uid', 'type', $this->getService()->getModel()->getTitleField(), 'capacity', 'price', 'status', 'description'], 'fields' => ['clientinfo_uid', 'type', $this->getService()->getModel()->getTitleField(), 'price', 'status', 'description'],
]; ];
$this->init('index', $fields); $this->init('index', $fields);
$this->modal_type = 'modal_iframe'; $this->modal_type = 'modal_iframe';

View File

@ -20,6 +20,8 @@ class ServerController extends EquipmentController
$this->class_path = $this->getService()->getClassPath(); $this->class_path = $this->getService()->getClassPath();
$this->title = lang("{$this->getService()->getClassPath()}.title"); $this->title = lang("{$this->getService()->getClassPath()}.title");
$this->helper = $this->getHelper(); $this->helper = $this->getHelper();
$this->individualStylesheets = ['server_partinfo.css'];;
$this->individualScripts = ['server_partinfo.js'];
} }
public function getService(): ServerService public function getService(): ServerService
{ {
@ -47,10 +49,14 @@ class ServerController extends EquipmentController
protected function getFormFieldOption(string $field, array $options = []): array protected function getFormFieldOption(string $field, array $options = []): array
{ {
switch ($field) { switch ($field) {
case 'partinfo_uid': case 'cpu_partinfo_uid':
$options[$field] = $this->getPartService()->getFormFieldOption($field);
break;
case 'ram_partinfo_uid':
$options[$field] = $this->getPartService()->getFormFieldOption($field);
break;
case 'disk_partinfo_uid':
$options[$field] = $this->getPartService()->getFormFieldOption($field); $options[$field] = $this->getPartService()->getFormFieldOption($field);
// echo $this->getUserModel()->getLastQuery();
// dd($options);
break; break;
default: default:
$options = parent::getFormFieldOption($field, $options); $options = parent::getFormFieldOption($field, $options);

View File

@ -36,6 +36,8 @@ abstract class CommonController extends BaseController
$this->myAuthName = $this->getMyAuth()->getNameByAuthInfo(); $this->myAuthName = $this->getMyAuth()->getNameByAuthInfo();
$this->myAuthUID = $this->getMyAuth()->getUIDByAuthInfo(); $this->myAuthUID = $this->getMyAuth()->getUIDByAuthInfo();
} }
$this->individualStylesheets = [];
$this->individualScripts = [];
} }
final public function __get($name) final public function __get($name)
{ {

View File

@ -4,13 +4,13 @@
"settings": { "settings": {
"width": 4000, "width": 4000,
"height": 4000, "height": 4000,
"scrollTop": -656.9025, "scrollTop": -1173.8117,
"scrollLeft": -537.9629, "scrollLeft": -1956.3985,
"zoomLevel": 0.76, "zoomLevel": 0.97,
"show": 511, "show": 511,
"database": 4, "database": 4,
"databaseName": "", "databaseName": "",
"canvasType": "@dineug/erd-editor/builtin-schema-sql", "canvasType": "ERD",
"language": 1, "language": 1,
"tableNameCase": 4, "tableNameCase": 4,
"columnNameCase": 2, "columnNameCase": 2,
@ -77,7 +77,8 @@
"hEYDIiEFtsN5gxqTmDYC7", "hEYDIiEFtsN5gxqTmDYC7",
"dzvA2g0z62LPmClZ32wPE", "dzvA2g0z62LPmClZ32wPE",
"Trklw7votg2N3SEwtuiuX", "Trklw7votg2N3SEwtuiuX",
"STHM-pzaTO72SEkIGYTCA" "STHM-pzaTO72SEkIGYTCA",
"nqdOCB_VJIeTtmlv33rcm"
], ],
"indexIds": [], "indexIds": [],
"memoIds": [] "memoIds": []
@ -376,6 +377,7 @@
"comment": "회선 정보", "comment": "회선 정보",
"columnIds": [ "columnIds": [
"7B0zaLoZnOoMNW8OHZlrQ", "7B0zaLoZnOoMNW8OHZlrQ",
"Ue1gt0C4DyjOQswV8LxkE",
"oc5quhO8E3mqrBZKbIy_G", "oc5quhO8E3mqrBZKbIy_G",
"lZQAY89JoyOHoTQEHeS1Y", "lZQAY89JoyOHoTQEHeS1Y",
"fiQBfXvw-4tj42PuGiDAk", "fiQBfXvw-4tj42PuGiDAk",
@ -389,6 +391,7 @@
"7B0zaLoZnOoMNW8OHZlrQ", "7B0zaLoZnOoMNW8OHZlrQ",
"XQE8sY3pDLC2iy95uc9Ir", "XQE8sY3pDLC2iy95uc9Ir",
"dkwDt8XZjnu1Hq3vX4Wta", "dkwDt8XZjnu1Hq3vX4Wta",
"Ue1gt0C4DyjOQswV8LxkE",
"oc5quhO8E3mqrBZKbIy_G", "oc5quhO8E3mqrBZKbIy_G",
"lZQAY89JoyOHoTQEHeS1Y", "lZQAY89JoyOHoTQEHeS1Y",
"fiQBfXvw-4tj42PuGiDAk", "fiQBfXvw-4tj42PuGiDAk",
@ -408,7 +411,7 @@
"color": "" "color": ""
}, },
"meta": { "meta": {
"updateAt": 1747033197608, "updateAt": 1747198684209,
"createAt": 1745819764138 "createAt": 1745819764138
} }
}, },
@ -420,7 +423,6 @@
"Id0h8QbOdlhPj9P1zTm5o", "Id0h8QbOdlhPj9P1zTm5o",
"f7_MGvRjkwL1xkCWrAgDR", "f7_MGvRjkwL1xkCWrAgDR",
"6qd6rcTkraI_AbHcVbp6T", "6qd6rcTkraI_AbHcVbp6T",
"0ONL4QLQRyZ32MBJ7TN7u",
"nDoaVrEhO8hLuHbgZV4il", "nDoaVrEhO8hLuHbgZV4il",
"Vm1-FnoJLcJ0GRnTp0vnn", "Vm1-FnoJLcJ0GRnTp0vnn",
"R-UjmO-S2UeQdddVNwH5M" "R-UjmO-S2UeQdddVNwH5M"
@ -447,7 +449,7 @@
"color": "" "color": ""
}, },
"meta": { "meta": {
"updateAt": 1747033204342, "updateAt": 1747199283990,
"createAt": 1745819764138 "createAt": 1745819764138
} }
}, },
@ -983,7 +985,6 @@
"ha72QbBWfvyRymsyFBov8", "ha72QbBWfvyRymsyFBov8",
"-Vr-igaSkx5zEcVp0oUGN", "-Vr-igaSkx5zEcVp0oUGN",
"DC7TvFFpBT7vY0UKKHt-W", "DC7TvFFpBT7vY0UKKHt-W",
"kXkNsvdbXOcI-DslovgVa",
"cg9Jr22ykbciJUTruf5fu", "cg9Jr22ykbciJUTruf5fu",
"dr0UoY8ebsS-TjcPyP4is", "dr0UoY8ebsS-TjcPyP4is",
"GnoGvT4HaG9kp-BvwZ4FQ", "GnoGvT4HaG9kp-BvwZ4FQ",
@ -1014,7 +1015,7 @@
"color": "" "color": ""
}, },
"meta": { "meta": {
"updateAt": 1747118821379, "updateAt": 1747198081255,
"createAt": 1746783410914 "createAt": 1746783410914
} }
}, },
@ -6566,6 +6567,26 @@
"updateAt": 1747124839902, "updateAt": 1747124839902,
"createAt": 1747124839902 "createAt": 1747124839902
} }
},
"Ue1gt0C4DyjOQswV8LxkE": {
"id": "Ue1gt0C4DyjOQswV8LxkE",
"tableId": "doERb3lIVeBW_D0NtNYX8",
"name": "clientinfo_uid",
"comment": "소유자",
"dataType": "INT",
"default": "",
"options": 0,
"ui": {
"keys": 2,
"widthName": 73,
"widthComment": 60,
"widthDataType": 60,
"widthDefault": 60
},
"meta": {
"updateAt": 1747198771670,
"createAt": 1747198681287
}
} }
}, },
"relationshipEntities": { "relationshipEntities": {
@ -6830,7 +6851,7 @@
"tableId": "ZLEpY5EjuZV21718zf-Y1", "tableId": "ZLEpY5EjuZV21718zf-Y1",
"columnIds": [], "columnIds": [],
"x": 2213.123, "x": 2213.123,
"y": 1536.6199, "y": 1524.6199,
"direction": 1 "direction": 1
}, },
"end": { "end": {
@ -6886,7 +6907,7 @@
"7B0zaLoZnOoMNW8OHZlrQ" "7B0zaLoZnOoMNW8OHZlrQ"
], ],
"x": 2205.6162, "x": 2205.6162,
"y": 1202.5589, "y": 1288.5589,
"direction": 1 "direction": 1
}, },
"end": { "end": {
@ -7025,8 +7046,8 @@
"columnIds": [ "columnIds": [
"7B0zaLoZnOoMNW8OHZlrQ" "7B0zaLoZnOoMNW8OHZlrQ"
], ],
"x": 2457.1162, "x": 2462.6162,
"y": 1338.5589, "y": 1362.5589,
"direction": 8 "direction": 8
}, },
"end": { "end": {
@ -7110,7 +7131,7 @@
"Jh6e_-9QYe1Tqve0PE3kT" "Jh6e_-9QYe1Tqve0PE3kT"
], ],
"x": 2736.1253, "x": 2736.1253,
"y": 2722.5239, "y": 2710.5239,
"direction": 2 "direction": 2
}, },
"end": { "end": {
@ -7194,7 +7215,7 @@
"Jh6e_-9QYe1Tqve0PE3kT" "Jh6e_-9QYe1Tqve0PE3kT"
], ],
"x": 2223.1253, "x": 2223.1253,
"y": 2722.5239, "y": 2784.5239,
"direction": 1 "direction": 1
}, },
"end": { "end": {
@ -7390,7 +7411,7 @@
"_AcWUYKzNJd-V0fRHq8Cx" "_AcWUYKzNJd-V0fRHq8Cx"
], ],
"x": 1701.0947, "x": 1701.0947,
"y": 968.1356, "y": 1048.1356,
"direction": 2 "direction": 2
}, },
"end": { "end": {
@ -7418,7 +7439,7 @@
"_AcWUYKzNJd-V0fRHq8Cx" "_AcWUYKzNJd-V0fRHq8Cx"
], ],
"x": 1701.0947, "x": 1701.0947,
"y": 1048.1356, "y": 1128.1356,
"direction": 2 "direction": 2
}, },
"end": { "end": {
@ -7445,23 +7466,51 @@
"columnIds": [ "columnIds": [
"_AcWUYKzNJd-V0fRHq8Cx" "_AcWUYKzNJd-V0fRHq8Cx"
], ],
"x": 1701.0947, "x": 1435.5947,
"y": 1128.1356, "y": 1168.1356,
"direction": 2 "direction": 8
}, },
"end": { "end": {
"tableId": "RMhrLs7bOaopKmKt9YKHQ", "tableId": "RMhrLs7bOaopKmKt9YKHQ",
"columnIds": [ "columnIds": [
"ha72QbBWfvyRymsyFBov8" "ha72QbBWfvyRymsyFBov8"
], ],
"x": 2479.6253, "x": 2223.1253,
"y": 2562.5239, "y": 2636.5239,
"direction": 4 "direction": 1
}, },
"meta": { "meta": {
"updateAt": 1747118545120, "updateAt": 1747118545120,
"createAt": 1747118545120 "createAt": 1747118545120
} }
},
"nqdOCB_VJIeTtmlv33rcm": {
"id": "nqdOCB_VJIeTtmlv33rcm",
"identification": false,
"relationshipType": 16,
"startRelationshipType": 1,
"start": {
"tableId": "6ajvOCaGuXU9pzV0Y9jEi",
"columnIds": [
"_AcWUYKzNJd-V0fRHq8Cx"
],
"x": 1701.0947,
"y": 968.1356,
"direction": 2
},
"end": {
"tableId": "doERb3lIVeBW_D0NtNYX8",
"columnIds": [
"Ue1gt0C4DyjOQswV8LxkE"
],
"x": 2205.6162,
"y": 1140.5589,
"direction": 1
},
"meta": {
"updateAt": 1747198681287,
"createAt": 1747198681287
}
} }
}, },
"indexEntities": {}, "indexEntities": {},

View File

@ -8,9 +8,4 @@ class AccountEntity extends CustomerEntity
{ {
const PK = AccountModel::PK; const PK = AccountModel::PK;
const TITLE = AccountModel::TITLE; const TITLE = AccountModel::TITLE;
public function getAmount()
{
return $this->attributes['amount'];
}
} }

View File

@ -8,12 +8,6 @@ class ClientEntity extends CustomerEntity
{ {
const PK = ClientModel::PK; const PK = ClientModel::PK;
const TITLE = ClientModel::TITLE; const TITLE = ClientModel::TITLE;
public function getClient()
{
return $this->attributes[self::PK];
}
public function getRole(): string public function getRole(): string
{ {
return $this->attributes['role']; return $this->attributes['role'];

View File

@ -8,9 +8,4 @@ class CouponEntity extends CustomerEntity
{ {
const PK = CouponModel::PK; const PK = CouponModel::PK;
const TITLE = CouponModel::TITLE; const TITLE = CouponModel::TITLE;
public function getAmount()
{
return $this->attributes['amount'];
}
} }

View File

@ -11,7 +11,7 @@ abstract class CustomerEntity extends CommonEntity
parent::__construct($data); parent::__construct($data);
} }
public function getClient() final public function getClient()
{ {
return $this->attributes['clientinfo_uid']; return $this->attributes['clientinfo_uid'];
} }

View File

@ -8,9 +8,4 @@ class PointEntity extends CustomerEntity
{ {
const PK = PointModel::PK; const PK = PointModel::PK;
const TITLE = PointModel::TITLE; const TITLE = PointModel::TITLE;
public function getAmount()
{
return $this->attributes['amount'];
}
} }

View File

@ -8,9 +8,4 @@ class ServiceEntity extends CustomerEntity
{ {
const PK = ServiceModel::PK; const PK = ServiceModel::PK;
const TITLE = ServiceModel::TITLE; const TITLE = ServiceModel::TITLE;
public function getAmount()
{
return $this->attributes['amount'];
}
} }

View File

@ -8,9 +8,4 @@ class IpEntity extends EquipmentEntity
{ {
const PK = IpModel::PK; const PK = IpModel::PK;
const TITLE = IpModel::TITLE; const TITLE = IpModel::TITLE;
public function getAmount()
{
return $this->attributes['amount'];
}
} }

View File

@ -13,8 +13,4 @@ class LineEntity extends EquipmentEntity
{ {
return $this->attributes['bandwith']; return $this->attributes['bandwith'];
} }
public function getPrice()
{
return $this->attributes['price'];
}
} }

View File

@ -13,4 +13,34 @@ class ServerHelper extends EquipmentHelper
parent::__construct($request); parent::__construct($request);
$this->setTitleField(field: ServerModel::TITLE); $this->setTitleField(field: ServerModel::TITLE);
} }
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
if (in_array($viewDatas['action'], ['create', 'modify'])) {
$extras = (strpos($viewDatas['field_rules'][$field], 'required') !== false) ? ["class" => "form-control", "required" => "", ...$extras] : ["class" => "form-control", ...$extras];
}
switch ($field) {
case 'cpu_partinfo_uid':
case 'ram_partinfo_uid':
case 'disk_partinfo_uid':
if (!is_array($viewDatas['field_options'][$field])) {
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다.");
}
$formOptions = array_merge(
["" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택'],
$viewDatas['field_options'][$field]
);
$extra_class = isset($extras['class']) ? $extras['class'] : "";
$form = form_dropdown($field, $formOptions, $value, ['id' => "{$field}_Select", 'class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
if (in_array($viewDatas['action'], ['create_form', 'modify_form'])) {
$form .= "<button type=\"button\" onclick=\"addComponent('{$field}')\">추가</button>";
$form .= "<button type=\"button\" onclick=\"removeCheckedComponents('{$field}')\">선택 삭제</button>";
$form .= "<div id=\"{$field}_List\"></div>";
}
break;
default:
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
break;
}
return $form;
} //
} }

View File

@ -24,6 +24,7 @@ return [
], ],
"STATUS" => [ "STATUS" => [
"use" => "사용", "use" => "사용",
"pause" => "사용정지", "pause" => "일시정지",
"terminated" => "해지",
], ],
]; ];

View File

@ -7,11 +7,11 @@ return [
'title' => "제목", 'title' => "제목",
'payment_date' => "결제일", 'payment_date' => "결제일",
'amount' => "결제금액", 'amount' => "결제금액",
'startdate_at' => "시작", 'startdate_at' => "개통",
'enddate_at' => "해지일", 'enddate_at' => "해지일",
'status' => "상태", 'status' => "상태",
'updated_at' => "수정일", 'updated_at' => "수정일",
'created_at' => "작성", 'created_at' => "신청",
], ],
'DEFAULTS' => [ 'DEFAULTS' => [
'type' => "hosting", 'type' => "hosting",

View File

@ -4,7 +4,6 @@ return [
'label' => [ 'label' => [
'lineinfo_uid' => '회선정보', 'lineinfo_uid' => '회선정보',
'ip' => "IP", 'ip' => "IP",
'price' => "금액",
'status' => "상태", 'status' => "상태",
'updated_at' => "수정일", 'updated_at' => "수정일",
'created_at' => "작성일", 'created_at' => "작성일",
@ -14,7 +13,7 @@ return [
], ],
"STATUS" => [ "STATUS" => [
"use" => "사용가능", "use" => "사용가능",
"pause" => "일시", "pause" => "일시",
"occupied" => "사용중", "occupied" => "사용중",
"forbidden" => "사용금지됨", "forbidden" => "사용금지됨",
], ],

View File

@ -2,6 +2,7 @@
return [ return [
'title' => "회선정보", 'title' => "회선정보",
'label' => [ 'label' => [
'clientinfo_uid' => "소유자명",
'title' => "제목", 'title' => "제목",
'type' => "종류", 'type' => "종류",
'price' => "금액", 'price' => "금액",
@ -17,11 +18,11 @@ return [
"TYPE" => [ "TYPE" => [
"general" => "일반", "general" => "일반",
"dedicated" => "전용", "dedicated" => "전용",
"defence" => "빙아", "defence" => "방어",
], ],
"STATUS" => [ "STATUS" => [
"use" => "사용가능", "use" => "사용가능",
"pause" => "사용정지", "pause" => "일시정지",
"termination" => "해지", "terminated" => "해지",
], ],
]; ];

View File

@ -9,7 +9,7 @@ return [
'price' => "금액", 'price' => "금액",
'description' => "설명", 'description' => "설명",
'status' => "상태", 'status' => "상태",
'manufactur_at' => "제조", 'manufactur_at' => "입고",
'updated_at' => "수정일", 'updated_at' => "수정일",
'created_at' => "작성일", 'created_at' => "작성일",
], ],
@ -26,7 +26,8 @@ return [
], ],
"STATUS" => [ "STATUS" => [
"use" => "사용가능", "use" => "사용가능",
"pause" => "수리중", "pause" => "일시정지",
"occupied" => "사용중", "occupied" => "사용중",
"terminated" => "해지",
], ],
]; ];

View File

@ -5,11 +5,10 @@ return [
'clientinfo_uid' => "소유자명", 'clientinfo_uid' => "소유자명",
'type' => "종류", 'type' => "종류",
'model' => "모델", 'model' => "모델",
'capacity' => "용량/성능",
'price' => "금액", 'price' => "금액",
'description' => "설명", 'description' => "설명",
'status' => "상태", 'status' => "상태",
'manufactur_at' => "제조", 'manufactur_at' => "입고",
'updated_at' => "수정일", 'updated_at' => "수정일",
'created_at' => "작성일", 'created_at' => "작성일",
], ],
@ -25,7 +24,7 @@ return [
], ],
"STATUS" => [ "STATUS" => [
"use" => "사용가능", "use" => "사용가능",
"pause" => "수리중", "pause" => "일시정지",
"occupied" => "사용중", "occupied" => "사용중",
], ],
]; ];

View File

@ -9,9 +9,12 @@ return [
'price' => "금액", 'price' => "금액",
'description' => "설명", 'description' => "설명",
'status' => "상태", 'status' => "상태",
'manufactur_at' => "제조", 'manufactur_at' => "입고",
'updated_at' => "수정일", 'updated_at' => "수정일",
'created_at' => "작성일", 'created_at' => "작성일",
'cpu_partinfo_uid' => "CPU",
'ram_partinfo_uid' => "RAM",
'disk_partinfo_uid' => "DISK",
], ],
'DEFAULTS' => [ 'DEFAULTS' => [
'type' => 'RacKMount', 'type' => 'RacKMount',
@ -25,7 +28,7 @@ return [
], ],
"STATUS" => [ "STATUS" => [
"use" => "사용가능", "use" => "사용가능",
"pause" => "수리중", "pause" => "일시정지",
"occupied" => "사용중", "occupied" => "사용중",
], ],
]; ];

View File

@ -23,6 +23,6 @@ return [
], ],
"STATUS" => [ "STATUS" => [
"use" => "사용가능", "use" => "사용가능",
"occupied" => "사용중", "pause" => "일시정지",
], ],
]; ];

View File

@ -15,7 +15,6 @@ class IpModel extends EquipmentModel
protected $allowedFields = [ protected $allowedFields = [
"lineinfo_uid", "lineinfo_uid",
"ip", "ip",
"price",
"status", "status",
"updated_at" "updated_at"
]; ];
@ -30,7 +29,6 @@ class IpModel extends EquipmentModel
} }
switch ($field) { switch ($field) {
case "lineinfo_uid": case "lineinfo_uid":
case "price":
$rule = "required|numeric"; $rule = "required|numeric";
break; break;
case "ip": case "ip":

View File

@ -13,6 +13,7 @@ class LineModel extends EquipmentModel
protected $primaryKey = self::PK; protected $primaryKey = self::PK;
protected $returnType = LineEntity::class; protected $returnType = LineEntity::class;
protected $allowedFields = [ protected $allowedFields = [
"clientinfo_uid",
"type", "type",
"title", "title",
"bandwith", "bandwith",
@ -30,6 +31,9 @@ class LineModel extends EquipmentModel
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true)); throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
} }
switch ($field) { switch ($field) {
case "clientinfo_uid":
$rule = "if_exist|permit_empty|numeric";
break;
case "price": case "price":
$rule = "required|numeric"; $rule = "required|numeric";
break; break;

View File

@ -34,7 +34,7 @@ class NetworkModel extends EquipmentModel
} }
switch ($field) { switch ($field) {
case "clientinfo_uid": case "clientinfo_uid":
$rule = "if_exist|numeric"; $rule = "if_exist|permit_empty|numeric";
break; break;
case "price": case "price":
$rule = "required|numeric"; $rule = "required|numeric";

View File

@ -14,14 +14,12 @@ class PartModel extends EquipmentModel
protected $returnType = PartEntity::class; protected $returnType = PartEntity::class;
protected $allowedFields = [ protected $allowedFields = [
"clientinfo_uid", "clientinfo_uid",
"code",
"type", "type",
"model", "model",
"manufactur_at",
"capacity",
"price", "price",
"status",
"description", "description",
"manufactur_at",
"status",
"updated_at" "updated_at"
]; ];
public function __construct() public function __construct()
@ -35,13 +33,11 @@ class PartModel extends EquipmentModel
} }
switch ($field) { switch ($field) {
case "clientinfo_uid": case "clientinfo_uid":
$rule = "if_exist|numeric"; $rule = "if_exist|permit_empty|numeric";
break; break;
case "capacity":
case "price": case "price":
$rule = "required|numeric"; $rule = "required|numeric";
break; break;
case "code":
case "model": case "model":
$rule = "required|trim|string"; $rule = "required|trim|string";
break; break;

View File

@ -34,7 +34,7 @@ class ServerModel extends EquipmentModel
} }
switch ($field) { switch ($field) {
case "clientinfo_uid": case "clientinfo_uid":
$rule = "if_exist|numeric"; $rule = "if_exist|permit_empty|numeric";
break; break;
case "price": case "price":
$rule = "required|numeric"; $rule = "required|numeric";

View File

@ -41,7 +41,7 @@ class SoftwareModel extends EquipmentModel
$rule = "required|in_list[Windows,Linux,Security,Virus,App]"; $rule = "required|in_list[Windows,Linux,Security,Virus,App]";
break; break;
case "status": case "status":
$rule = "required|in_list[use,occupied]"; $rule = "required|in_list[use,pause]";
break; break;
case "description": case "description":
$rule = "if_exist|trim|string"; $rule = "if_exist|trim|string";

View File

@ -57,8 +57,11 @@ abstract class CommonService
} }
return $entity; return $entity;
} }
final public function getEntities(array $columns = ['*']): array final public function getEntities(mixed $where = null, array $columns = ['*']): array
{ {
if ($where) {
$this->getModel()->where($where);
}
// QueryBuilder 객체 가져오기 // QueryBuilder 객체 가져오기
// $builder = $this->getModel()->builder(); // $builder = $this->getModel()->builder();
// $builder->select(implode(',', $columns));; // $builder->select(implode(',', $columns));;

View File

@ -30,7 +30,6 @@ class IpService extends EquipmentService
return [ return [
"lineinfo_uid", "lineinfo_uid",
"ip", "ip",
"price",
"status", "status",
]; ];
} }

View File

@ -28,6 +28,7 @@ class LineService extends EquipmentService
public function getFields(): array public function getFields(): array
{ {
return [ return [
"clientinfo_uid",
"type", "type",
"title", "title",
"bandwith", "bandwith",
@ -37,7 +38,7 @@ class LineService extends EquipmentService
} }
public function getFilterFields(): array public function getFilterFields(): array
{ {
return ["type", 'status']; return ["clientinfo_uid", "type", 'status'];
} }
public function getBatchJobFields(): array public function getBatchJobFields(): array
{ {

View File

@ -33,7 +33,6 @@ class PartService extends EquipmentService
"type", "type",
"model", "model",
"manufactur_at", "manufactur_at",
"capacity",
"price", "price",
"status", "status",
"description", "description",
@ -47,4 +46,29 @@ class PartService extends EquipmentService
{ {
return ['type', 'status']; return ['type', 'status'];
} }
public function getFormFieldOption(string $field, array $options = []): array
{
switch ($field) {
case 'cpu_partinfo_uid':
foreach ($this->getEntities(['type' => 'CPU']) as $entity) {
$options[$entity->getPK()] = $entity->getTitle();
}
break;
case 'ram_partinfo_uid':
foreach ($this->getEntities(['type' => 'RAM']) as $entity) {
$options[$entity->getPK()] = $entity->getTitle();
}
break;
case 'disk_partinfo_uid':
foreach ($this->getEntities(['type' => 'DISK']) as $entity) {
$options[$entity->getPK()] = $entity->getTitle();
}
break;
default:
$options = parent::getFormFieldOption($field, $options);
break;
}
// dd($options);
return $options;
}
} }

View File

@ -5,7 +5,7 @@ namespace App\Services\Equipment;
use App\Entities\Equipment\ServerEntity; use App\Entities\Equipment\ServerEntity;
use App\Models\Equipment\ServerModel; use App\Models\Equipment\ServerModel;
use CodeIgniter\HTTP\IncomingRequest; use CodeIgniter\HTTP\IncomingRequest;
use App\Services\Equipment\EquipmentService; // Ensure this path is correct and the class exists or create the class if missing use App\Services\Equipment\EquipmentService;
class ServerService extends EquipmentService class ServerService extends EquipmentService
{ {
@ -33,6 +33,9 @@ class ServerService extends EquipmentService
"code", "code",
"type", "type",
"model", "model",
"cpu_partinfo_uid",
"ram_partinfo_uid",
"disk_partinfo_uid",
"manufactur_at", "manufactur_at",
"price", "price",
"status", "status",
@ -41,10 +44,10 @@ class ServerService extends EquipmentService
} }
public function getFilterFields(): array public function getFilterFields(): array
{ {
return ["clientinfo_uid", "type", 'status']; return ["clientinfo_uid", "type", 'cpu_partinfo_uid', 'ram_partinfo_uid', 'disk_partinfo_uid', 'status'];
} }
public function getBatchJobFields(): array public function getBatchJobFields(): array
{ {
return ['type', 'status']; return ["type", 'cpu_partinfo_uid', 'ram_partinfo_uid', 'disk_partinfo_uid', 'status'];
} }
} }

View File

@ -4,8 +4,14 @@
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" /> <link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
<script src="/js/<?= $viewDatas['layout'] ?>/form.js" referrerpolicy="origin"></script> <script src="/js/<?= $viewDatas['layout'] ?>/form.js" referrerpolicy="origin"></script>
<script src="/assets/tinymce/tinymce.min.js" referrerpolicy="origin"></script> <script src="/assets/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
<?php foreach ($viewDatas['individualStylesheets'] as $css): ?>
<link href="/css/<?= $viewDatas['layout'] ?>/<?= $css ?>" media="screen" rel="stylesheet" type="text/css" />
<?php endforeach ?>
<?php foreach ($viewDatas['individualScripts'] as $js): ?>
<script src="/js/<?= $viewDatas['layout'] ?>/<?= $js ?>" referrerpolicy="origin"></script>
<?php endforeach ?>
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?> <?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<div class="action_form"> <div class=" action_form">
<table class="table table-bordered"> <table class="table table-bordered">
<?php foreach ($viewDatas['fields'] as $field): ?> <?php foreach ($viewDatas['fields'] as $field): ?>
<tr> <tr>

View File

@ -1,9 +1,15 @@
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?> <?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
<?= $this->section('content') ?> <?= $this->section('content') ?>
<div id="container" class="content"> <div id="container" class="content">
<script src="/assets/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" /> <link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
<script src="/js/<?= $viewDatas['layout'] ?>/form.js" referrerpolicy="origin"></script> <script src="/js/<?= $viewDatas['layout'] ?>/form.js" referrerpolicy="origin"></script>
<script src="/assets/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
<?php foreach ($viewDatas['individualStylesheets'] as $css): ?>
<link href="/css/<?= $viewDatas['layout'] ?>/<?= $css ?>" media="screen" rel="stylesheet" type="text/css" />
<?php endforeach ?>
<?php foreach ($viewDatas['individualScripts'] as $js): ?>
<script src="/js/<?= $viewDatas['layout'] ?>/<?= $js ?>" referrerpolicy="origin"></script>
<?php endforeach ?>
<?= form_open(current_url(), ['id' => 'action_form', ...$viewDatas['forms']['attributes']], $viewDatas['forms']['hiddens']) ?> <?= form_open(current_url(), ['id' => 'action_form', ...$viewDatas['forms']['attributes']], $viewDatas['forms']['hiddens']) ?>
<div class="action_form"> <div class="action_form">
<table class="table table-bordered"> <table class="table table-bordered">

View File

@ -3,15 +3,9 @@
<head> <head>
<title><?= LAYOUTS[$viewDatas['layout']]['title'] ?></title> <title><?= LAYOUTS[$viewDatas['layout']]['title'] ?></title>
<?php foreach (LAYOUTS[$viewDatas['layout']]['metas'] as $meta): ?> <?php foreach (LAYOUTS[$viewDatas['layout']]['metas'] as $meta): ?><?= $meta ?><?php endforeach; ?>
<?= $meta ?> <?php foreach (LAYOUTS[$viewDatas['layout']]['stylesheets'] as $stylesheet): ?><?= $stylesheet ?><?php endforeach; ?>
<?php endforeach; ?> <?php foreach (LAYOUTS[$viewDatas['layout']]['javascripts'] as $javascript): ?><?= $javascript ?><?php endforeach; ?>
<?php foreach (LAYOUTS[$viewDatas['layout']]['stylesheets'] as $stylesheet): ?>
<?= $stylesheet ?>
<?php endforeach; ?>
<?php foreach (LAYOUTS[$viewDatas['layout']]['javascripts'] as $javascript): ?>
<?= $javascript ?>
<?php endforeach; ?>
<link href="/css/<?= $viewDatas['layout'] ?>.css" media="screen" rel="stylesheet" type="text/css" /> <link href="/css/<?= $viewDatas['layout'] ?>.css" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>.js"></script> <script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->

View File

@ -0,0 +1,29 @@
.layer {
display: none;
position: fixed;
top: 20%;
left: 50%;
transform: translate(-50%, -20%);
background: #fff;
border: 1px solid #ccc;
padding: 20px;
box-shadow: 0 0 10px rgba(0,0,0,0.3);
z-index: 1000;
}
.server_partinfo_item {
margin: 5px 0;
}
.list-container {
margin-top: 20px;
}
.btn {
padding: 6px 10px;
margin: 5px;
background: #007BFF;
color: #fff;
border: none;
cursor: pointer;
}
.btn:hover {
background: #0056b3;
}

View File

@ -0,0 +1,46 @@
function openLayer(type) {
document.getElementById(type + '_Layer').style.display = 'block';
}
function closeLayer(type) {
document.getElementById(type + '_Layer').style.display = 'none';
}
function applyCheckedComponents(type) {
const checkboxes = document.querySelectorAll(`#${type}_Layer input[type="checkbox"]:checked`);
const listDiv = document.getElementById(`${type}_List`);
checkboxes.forEach(cb => {
// 중복 방지
const exists = listDiv.querySelector(`input[type="hidden"][value="${cb.value}"]`);
if (exists) return;
const wrapper = document.createElement('div');
wrapper.className = 'server_partinfo_item';
const checkbox = document.createElement('input');
checkbox.type = 'checkbox';
checkbox.className = `${type}_checkbox`;
const hiddenInput = document.createElement('input');
hiddenInput.type = 'hidden';
hiddenInput.name = `${type}[]`;
hiddenInput.value = cb.value;
const span = document.createElement('span');
span.textContent = cb.getAttribute('data-label');
wrapper.appendChild(checkbox);
wrapper.appendChild(hiddenInput);
wrapper.appendChild(span);
listDiv.appendChild(wrapper);
});
closeLayer(type);
}
function removeCheckedComponents(type) {
const checkboxes = document.querySelectorAll(`#${type}_List .${type}_checkbox:checked`);
checkboxes.forEach(cb => cb.closest('.server_partinfo_item').remove());
}