diff --git a/app/Controllers/Admin/Equipment/IpController.php b/app/Controllers/Admin/Equipment/IpController.php index b096c85..795500f 100644 --- a/app/Controllers/Admin/Equipment/IpController.php +++ b/app/Controllers/Admin/Equipment/IpController.php @@ -45,7 +45,7 @@ class IpController extends EquipmentController protected function index_process(): array { $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); return parent::index_process(); diff --git a/app/Controllers/Admin/Equipment/PartController.php b/app/Controllers/Admin/Equipment/PartController.php index 7cee351..ef06832 100644 --- a/app/Controllers/Admin/Equipment/PartController.php +++ b/app/Controllers/Admin/Equipment/PartController.php @@ -38,7 +38,7 @@ class PartController extends EquipmentController protected function index_process(): array { $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->modal_type = 'modal_iframe'; diff --git a/app/Controllers/Admin/Equipment/ServerController.php b/app/Controllers/Admin/Equipment/ServerController.php index 9c1f3de..d59081f 100644 --- a/app/Controllers/Admin/Equipment/ServerController.php +++ b/app/Controllers/Admin/Equipment/ServerController.php @@ -20,6 +20,8 @@ class ServerController extends EquipmentController $this->class_path = $this->getService()->getClassPath(); $this->title = lang("{$this->getService()->getClassPath()}.title"); $this->helper = $this->getHelper(); + $this->individualStylesheets = ['server_partinfo.css'];; + $this->individualScripts = ['server_partinfo.js']; } public function getService(): ServerService { @@ -47,10 +49,14 @@ class ServerController extends EquipmentController protected function getFormFieldOption(string $field, array $options = []): array { 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); - // echo $this->getUserModel()->getLastQuery(); - // dd($options); break; default: $options = parent::getFormFieldOption($field, $options); diff --git a/app/Controllers/CommonController.php b/app/Controllers/CommonController.php index a68c137..2568598 100644 --- a/app/Controllers/CommonController.php +++ b/app/Controllers/CommonController.php @@ -36,6 +36,8 @@ abstract class CommonController extends BaseController $this->myAuthName = $this->getMyAuth()->getNameByAuthInfo(); $this->myAuthUID = $this->getMyAuth()->getUIDByAuthInfo(); } + $this->individualStylesheets = []; + $this->individualScripts = []; } final public function __get($name) { diff --git a/app/Database/erp2.vuerd.json b/app/Database/erp2.vuerd.json index c345de1..1548671 100644 --- a/app/Database/erp2.vuerd.json +++ b/app/Database/erp2.vuerd.json @@ -4,13 +4,13 @@ "settings": { "width": 4000, "height": 4000, - "scrollTop": -656.9025, - "scrollLeft": -537.9629, - "zoomLevel": 0.76, + "scrollTop": -1173.8117, + "scrollLeft": -1956.3985, + "zoomLevel": 0.97, "show": 511, "database": 4, "databaseName": "", - "canvasType": "@dineug/erd-editor/builtin-schema-sql", + "canvasType": "ERD", "language": 1, "tableNameCase": 4, "columnNameCase": 2, @@ -77,7 +77,8 @@ "hEYDIiEFtsN5gxqTmDYC7", "dzvA2g0z62LPmClZ32wPE", "Trklw7votg2N3SEwtuiuX", - "STHM-pzaTO72SEkIGYTCA" + "STHM-pzaTO72SEkIGYTCA", + "nqdOCB_VJIeTtmlv33rcm" ], "indexIds": [], "memoIds": [] @@ -376,6 +377,7 @@ "comment": "회선 정보", "columnIds": [ "7B0zaLoZnOoMNW8OHZlrQ", + "Ue1gt0C4DyjOQswV8LxkE", "oc5quhO8E3mqrBZKbIy_G", "lZQAY89JoyOHoTQEHeS1Y", "fiQBfXvw-4tj42PuGiDAk", @@ -389,6 +391,7 @@ "7B0zaLoZnOoMNW8OHZlrQ", "XQE8sY3pDLC2iy95uc9Ir", "dkwDt8XZjnu1Hq3vX4Wta", + "Ue1gt0C4DyjOQswV8LxkE", "oc5quhO8E3mqrBZKbIy_G", "lZQAY89JoyOHoTQEHeS1Y", "fiQBfXvw-4tj42PuGiDAk", @@ -408,7 +411,7 @@ "color": "" }, "meta": { - "updateAt": 1747033197608, + "updateAt": 1747198684209, "createAt": 1745819764138 } }, @@ -420,7 +423,6 @@ "Id0h8QbOdlhPj9P1zTm5o", "f7_MGvRjkwL1xkCWrAgDR", "6qd6rcTkraI_AbHcVbp6T", - "0ONL4QLQRyZ32MBJ7TN7u", "nDoaVrEhO8hLuHbgZV4il", "Vm1-FnoJLcJ0GRnTp0vnn", "R-UjmO-S2UeQdddVNwH5M" @@ -447,7 +449,7 @@ "color": "" }, "meta": { - "updateAt": 1747033204342, + "updateAt": 1747199283990, "createAt": 1745819764138 } }, @@ -983,7 +985,6 @@ "ha72QbBWfvyRymsyFBov8", "-Vr-igaSkx5zEcVp0oUGN", "DC7TvFFpBT7vY0UKKHt-W", - "kXkNsvdbXOcI-DslovgVa", "cg9Jr22ykbciJUTruf5fu", "dr0UoY8ebsS-TjcPyP4is", "GnoGvT4HaG9kp-BvwZ4FQ", @@ -1014,7 +1015,7 @@ "color": "" }, "meta": { - "updateAt": 1747118821379, + "updateAt": 1747198081255, "createAt": 1746783410914 } }, @@ -6566,6 +6567,26 @@ "updateAt": 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": { @@ -6830,7 +6851,7 @@ "tableId": "ZLEpY5EjuZV21718zf-Y1", "columnIds": [], "x": 2213.123, - "y": 1536.6199, + "y": 1524.6199, "direction": 1 }, "end": { @@ -6886,7 +6907,7 @@ "7B0zaLoZnOoMNW8OHZlrQ" ], "x": 2205.6162, - "y": 1202.5589, + "y": 1288.5589, "direction": 1 }, "end": { @@ -7025,8 +7046,8 @@ "columnIds": [ "7B0zaLoZnOoMNW8OHZlrQ" ], - "x": 2457.1162, - "y": 1338.5589, + "x": 2462.6162, + "y": 1362.5589, "direction": 8 }, "end": { @@ -7110,7 +7131,7 @@ "Jh6e_-9QYe1Tqve0PE3kT" ], "x": 2736.1253, - "y": 2722.5239, + "y": 2710.5239, "direction": 2 }, "end": { @@ -7194,7 +7215,7 @@ "Jh6e_-9QYe1Tqve0PE3kT" ], "x": 2223.1253, - "y": 2722.5239, + "y": 2784.5239, "direction": 1 }, "end": { @@ -7390,7 +7411,7 @@ "_AcWUYKzNJd-V0fRHq8Cx" ], "x": 1701.0947, - "y": 968.1356, + "y": 1048.1356, "direction": 2 }, "end": { @@ -7418,7 +7439,7 @@ "_AcWUYKzNJd-V0fRHq8Cx" ], "x": 1701.0947, - "y": 1048.1356, + "y": 1128.1356, "direction": 2 }, "end": { @@ -7445,23 +7466,51 @@ "columnIds": [ "_AcWUYKzNJd-V0fRHq8Cx" ], - "x": 1701.0947, - "y": 1128.1356, - "direction": 2 + "x": 1435.5947, + "y": 1168.1356, + "direction": 8 }, "end": { "tableId": "RMhrLs7bOaopKmKt9YKHQ", "columnIds": [ "ha72QbBWfvyRymsyFBov8" ], - "x": 2479.6253, - "y": 2562.5239, - "direction": 4 + "x": 2223.1253, + "y": 2636.5239, + "direction": 1 }, "meta": { "updateAt": 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": {}, diff --git a/app/Entities/Customer/AccountEntity.php b/app/Entities/Customer/AccountEntity.php index 1b3630e..017ba49 100644 --- a/app/Entities/Customer/AccountEntity.php +++ b/app/Entities/Customer/AccountEntity.php @@ -8,9 +8,4 @@ class AccountEntity extends CustomerEntity { const PK = AccountModel::PK; const TITLE = AccountModel::TITLE; - - public function getAmount() - { - return $this->attributes['amount']; - } } diff --git a/app/Entities/Customer/ClientEntity.php b/app/Entities/Customer/ClientEntity.php index 9194cde..84bcfba 100644 --- a/app/Entities/Customer/ClientEntity.php +++ b/app/Entities/Customer/ClientEntity.php @@ -8,12 +8,6 @@ class ClientEntity extends CustomerEntity { const PK = ClientModel::PK; const TITLE = ClientModel::TITLE; - - - public function getClient() - { - return $this->attributes[self::PK]; - } public function getRole(): string { return $this->attributes['role']; diff --git a/app/Entities/Customer/CouponEntity.php b/app/Entities/Customer/CouponEntity.php index 15f9d3b..f02eed0 100644 --- a/app/Entities/Customer/CouponEntity.php +++ b/app/Entities/Customer/CouponEntity.php @@ -8,9 +8,4 @@ class CouponEntity extends CustomerEntity { const PK = CouponModel::PK; const TITLE = CouponModel::TITLE; - - public function getAmount() - { - return $this->attributes['amount']; - } } diff --git a/app/Entities/Customer/CustomerEntity.php b/app/Entities/Customer/CustomerEntity.php index 4ddb392..f1d53cd 100644 --- a/app/Entities/Customer/CustomerEntity.php +++ b/app/Entities/Customer/CustomerEntity.php @@ -11,7 +11,7 @@ abstract class CustomerEntity extends CommonEntity parent::__construct($data); } - public function getClient() + final public function getClient() { return $this->attributes['clientinfo_uid']; } diff --git a/app/Entities/Customer/PointEntity.php b/app/Entities/Customer/PointEntity.php index f63d43e..0713ba7 100644 --- a/app/Entities/Customer/PointEntity.php +++ b/app/Entities/Customer/PointEntity.php @@ -8,9 +8,4 @@ class PointEntity extends CustomerEntity { const PK = PointModel::PK; const TITLE = PointModel::TITLE; - - public function getAmount() - { - return $this->attributes['amount']; - } } diff --git a/app/Entities/Customer/ServiceEntity.php b/app/Entities/Customer/ServiceEntity.php index 0de66a3..c474eb8 100644 --- a/app/Entities/Customer/ServiceEntity.php +++ b/app/Entities/Customer/ServiceEntity.php @@ -8,9 +8,4 @@ class ServiceEntity extends CustomerEntity { const PK = ServiceModel::PK; const TITLE = ServiceModel::TITLE; - - public function getAmount() - { - return $this->attributes['amount']; - } } diff --git a/app/Entities/Equipment/IpEntity.php b/app/Entities/Equipment/IpEntity.php index e8b52a2..e4c481a 100644 --- a/app/Entities/Equipment/IpEntity.php +++ b/app/Entities/Equipment/IpEntity.php @@ -8,9 +8,4 @@ class IpEntity extends EquipmentEntity { const PK = IpModel::PK; const TITLE = IpModel::TITLE; - - public function getAmount() - { - return $this->attributes['amount']; - } } diff --git a/app/Entities/Equipment/LineEntity.php b/app/Entities/Equipment/LineEntity.php index a498520..c149377 100644 --- a/app/Entities/Equipment/LineEntity.php +++ b/app/Entities/Equipment/LineEntity.php @@ -13,8 +13,4 @@ class LineEntity extends EquipmentEntity { return $this->attributes['bandwith']; } - public function getPrice() - { - return $this->attributes['price']; - } } diff --git a/app/Helpers/Equipment/ServerHelper.php b/app/Helpers/Equipment/ServerHelper.php index c05e7b0..d67acfc 100644 --- a/app/Helpers/Equipment/ServerHelper.php +++ b/app/Helpers/Equipment/ServerHelper.php @@ -13,4 +13,34 @@ class ServerHelper extends EquipmentHelper parent::__construct($request); $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 .= ""; + $form .= ""; + $form .= "
"; + } + break; + default: + $form = parent::getFieldForm($field, $value, $viewDatas, $extras); + break; + } + return $form; + } // } diff --git a/app/Language/en/Customer/Client.php b/app/Language/en/Customer/Client.php index fac3caf..26e5743 100644 --- a/app/Language/en/Customer/Client.php +++ b/app/Language/en/Customer/Client.php @@ -24,6 +24,7 @@ return [ ], "STATUS" => [ "use" => "사용", - "pause" => "사용정지", + "pause" => "일시정지", + "terminated" => "해지", ], ]; diff --git a/app/Language/en/Customer/Service.php b/app/Language/en/Customer/Service.php index bde38c6..4ab09c2 100644 --- a/app/Language/en/Customer/Service.php +++ b/app/Language/en/Customer/Service.php @@ -7,11 +7,11 @@ return [ 'title' => "제목", 'payment_date' => "결제일", 'amount' => "결제금액", - 'startdate_at' => "시작일", + 'startdate_at' => "개통일", 'enddate_at' => "해지일", 'status' => "상태", 'updated_at' => "수정일", - 'created_at' => "작성일", + 'created_at' => "신청일", ], 'DEFAULTS' => [ 'type' => "hosting", diff --git a/app/Language/en/Equipment/Ip.php b/app/Language/en/Equipment/Ip.php index a34d491..31fd0a7 100644 --- a/app/Language/en/Equipment/Ip.php +++ b/app/Language/en/Equipment/Ip.php @@ -4,7 +4,6 @@ return [ 'label' => [ 'lineinfo_uid' => '회선정보', 'ip' => "IP", - 'price' => "금액", 'status' => "상태", 'updated_at' => "수정일", 'created_at' => "작성일", @@ -14,7 +13,7 @@ return [ ], "STATUS" => [ "use" => "사용가능", - "pause" => "일시중지", + "pause" => "일시정지", "occupied" => "사용중", "forbidden" => "사용금지됨", ], diff --git a/app/Language/en/Equipment/Line.php b/app/Language/en/Equipment/Line.php index 3a3e60d..01112d8 100644 --- a/app/Language/en/Equipment/Line.php +++ b/app/Language/en/Equipment/Line.php @@ -2,6 +2,7 @@ return [ 'title' => "회선정보", 'label' => [ + 'clientinfo_uid' => "소유자명", 'title' => "제목", 'type' => "종류", 'price' => "금액", @@ -17,11 +18,11 @@ return [ "TYPE" => [ "general" => "일반", "dedicated" => "전용", - "defence" => "빙아", + "defence" => "방어", ], "STATUS" => [ "use" => "사용가능", - "pause" => "사용정지", - "termination" => "해지", + "pause" => "일시정지", + "terminated" => "해지", ], ]; diff --git a/app/Language/en/Equipment/Network.php b/app/Language/en/Equipment/Network.php index ec50b7f..23f9427 100644 --- a/app/Language/en/Equipment/Network.php +++ b/app/Language/en/Equipment/Network.php @@ -9,7 +9,7 @@ return [ 'price' => "금액", 'description' => "설명", 'status' => "상태", - 'manufactur_at' => "제조일", + 'manufactur_at' => "입고일", 'updated_at' => "수정일", 'created_at' => "작성일", ], @@ -26,7 +26,8 @@ return [ ], "STATUS" => [ "use" => "사용가능", - "pause" => "수리중", + "pause" => "일시정지", "occupied" => "사용중", + "terminated" => "해지", ], ]; diff --git a/app/Language/en/Equipment/Part.php b/app/Language/en/Equipment/Part.php index eb87719..4bab518 100644 --- a/app/Language/en/Equipment/Part.php +++ b/app/Language/en/Equipment/Part.php @@ -5,11 +5,10 @@ return [ 'clientinfo_uid' => "소유자명", 'type' => "종류", 'model' => "모델", - 'capacity' => "용량/성능", 'price' => "금액", 'description' => "설명", 'status' => "상태", - 'manufactur_at' => "제조일", + 'manufactur_at' => "입고일", 'updated_at' => "수정일", 'created_at' => "작성일", ], @@ -25,7 +24,7 @@ return [ ], "STATUS" => [ "use" => "사용가능", - "pause" => "수리중", + "pause" => "일시정지", "occupied" => "사용중", ], ]; diff --git a/app/Language/en/Equipment/Server.php b/app/Language/en/Equipment/Server.php index 6ee6675..f8de666 100644 --- a/app/Language/en/Equipment/Server.php +++ b/app/Language/en/Equipment/Server.php @@ -9,9 +9,12 @@ return [ 'price' => "금액", 'description' => "설명", 'status' => "상태", - 'manufactur_at' => "제조일", + 'manufactur_at' => "입고일", 'updated_at' => "수정일", 'created_at' => "작성일", + 'cpu_partinfo_uid' => "CPU", + 'ram_partinfo_uid' => "RAM", + 'disk_partinfo_uid' => "DISK", ], 'DEFAULTS' => [ 'type' => 'RacKMount', @@ -25,7 +28,7 @@ return [ ], "STATUS" => [ "use" => "사용가능", - "pause" => "수리중", + "pause" => "일시정지", "occupied" => "사용중", ], ]; diff --git a/app/Language/en/Equipment/Software.php b/app/Language/en/Equipment/Software.php index d369258..5613571 100644 --- a/app/Language/en/Equipment/Software.php +++ b/app/Language/en/Equipment/Software.php @@ -23,6 +23,6 @@ return [ ], "STATUS" => [ "use" => "사용가능", - "occupied" => "사용중", + "pause" => "일시정지", ], ]; diff --git a/app/Models/Equipment/IpModel.php b/app/Models/Equipment/IpModel.php index d70efc1..61dbc3c 100644 --- a/app/Models/Equipment/IpModel.php +++ b/app/Models/Equipment/IpModel.php @@ -15,7 +15,6 @@ class IpModel extends EquipmentModel protected $allowedFields = [ "lineinfo_uid", "ip", - "price", "status", "updated_at" ]; @@ -30,7 +29,6 @@ class IpModel extends EquipmentModel } switch ($field) { case "lineinfo_uid": - case "price": $rule = "required|numeric"; break; case "ip": diff --git a/app/Models/Equipment/LineModel.php b/app/Models/Equipment/LineModel.php index 5798421..711ea97 100644 --- a/app/Models/Equipment/LineModel.php +++ b/app/Models/Equipment/LineModel.php @@ -13,6 +13,7 @@ class LineModel extends EquipmentModel protected $primaryKey = self::PK; protected $returnType = LineEntity::class; protected $allowedFields = [ + "clientinfo_uid", "type", "title", "bandwith", @@ -30,6 +31,9 @@ class LineModel extends EquipmentModel throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true)); } switch ($field) { + case "clientinfo_uid": + $rule = "if_exist|permit_empty|numeric"; + break; case "price": $rule = "required|numeric"; break; diff --git a/app/Models/Equipment/NetworkModel.php b/app/Models/Equipment/NetworkModel.php index 0e0eebf..7e76191 100644 --- a/app/Models/Equipment/NetworkModel.php +++ b/app/Models/Equipment/NetworkModel.php @@ -34,7 +34,7 @@ class NetworkModel extends EquipmentModel } switch ($field) { case "clientinfo_uid": - $rule = "if_exist|numeric"; + $rule = "if_exist|permit_empty|numeric"; break; case "price": $rule = "required|numeric"; diff --git a/app/Models/Equipment/PartModel.php b/app/Models/Equipment/PartModel.php index 68d1a39..e56a83c 100644 --- a/app/Models/Equipment/PartModel.php +++ b/app/Models/Equipment/PartModel.php @@ -14,14 +14,12 @@ class PartModel extends EquipmentModel protected $returnType = PartEntity::class; protected $allowedFields = [ "clientinfo_uid", - "code", "type", "model", - "manufactur_at", - "capacity", "price", - "status", "description", + "manufactur_at", + "status", "updated_at" ]; public function __construct() @@ -35,13 +33,11 @@ class PartModel extends EquipmentModel } switch ($field) { case "clientinfo_uid": - $rule = "if_exist|numeric"; + $rule = "if_exist|permit_empty|numeric"; break; - case "capacity": case "price": $rule = "required|numeric"; break; - case "code": case "model": $rule = "required|trim|string"; break; diff --git a/app/Models/Equipment/ServerModel.php b/app/Models/Equipment/ServerModel.php index 37cd6b8..05ee3eb 100644 --- a/app/Models/Equipment/ServerModel.php +++ b/app/Models/Equipment/ServerModel.php @@ -34,7 +34,7 @@ class ServerModel extends EquipmentModel } switch ($field) { case "clientinfo_uid": - $rule = "if_exist|numeric"; + $rule = "if_exist|permit_empty|numeric"; break; case "price": $rule = "required|numeric"; diff --git a/app/Models/Equipment/SoftwareModel.php b/app/Models/Equipment/SoftwareModel.php index dab911d..2f24950 100644 --- a/app/Models/Equipment/SoftwareModel.php +++ b/app/Models/Equipment/SoftwareModel.php @@ -41,7 +41,7 @@ class SoftwareModel extends EquipmentModel $rule = "required|in_list[Windows,Linux,Security,Virus,App]"; break; case "status": - $rule = "required|in_list[use,occupied]"; + $rule = "required|in_list[use,pause]"; break; case "description": $rule = "if_exist|trim|string"; diff --git a/app/Services/CommonService.php b/app/Services/CommonService.php index 6b98acf..11cd73f 100644 --- a/app/Services/CommonService.php +++ b/app/Services/CommonService.php @@ -57,8 +57,11 @@ abstract class CommonService } 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 객체 가져오기 // $builder = $this->getModel()->builder(); // $builder->select(implode(',', $columns));; diff --git a/app/Services/Equipment/IpService.php b/app/Services/Equipment/IpService.php index d8ef619..9a647fe 100644 --- a/app/Services/Equipment/IpService.php +++ b/app/Services/Equipment/IpService.php @@ -30,7 +30,6 @@ class IpService extends EquipmentService return [ "lineinfo_uid", "ip", - "price", "status", ]; } diff --git a/app/Services/Equipment/LineService.php b/app/Services/Equipment/LineService.php index b59651c..d5aaf44 100644 --- a/app/Services/Equipment/LineService.php +++ b/app/Services/Equipment/LineService.php @@ -28,6 +28,7 @@ class LineService extends EquipmentService public function getFields(): array { return [ + "clientinfo_uid", "type", "title", "bandwith", @@ -37,7 +38,7 @@ class LineService extends EquipmentService } public function getFilterFields(): array { - return ["type", 'status']; + return ["clientinfo_uid", "type", 'status']; } public function getBatchJobFields(): array { diff --git a/app/Services/Equipment/PartService.php b/app/Services/Equipment/PartService.php index a61d4e6..8db9784 100644 --- a/app/Services/Equipment/PartService.php +++ b/app/Services/Equipment/PartService.php @@ -33,7 +33,6 @@ class PartService extends EquipmentService "type", "model", "manufactur_at", - "capacity", "price", "status", "description", @@ -47,4 +46,29 @@ class PartService extends EquipmentService { 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; + } } diff --git a/app/Services/Equipment/ServerService.php b/app/Services/Equipment/ServerService.php index 50723ac..13d4ae2 100644 --- a/app/Services/Equipment/ServerService.php +++ b/app/Services/Equipment/ServerService.php @@ -5,7 +5,7 @@ namespace App\Services\Equipment; use App\Entities\Equipment\ServerEntity; use App\Models\Equipment\ServerModel; 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 { @@ -33,6 +33,9 @@ class ServerService extends EquipmentService "code", "type", "model", + "cpu_partinfo_uid", + "ram_partinfo_uid", + "disk_partinfo_uid", "manufactur_at", "price", "status", @@ -41,10 +44,10 @@ class ServerService extends EquipmentService } 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 { - return ['type', 'status']; + return ["type", 'cpu_partinfo_uid', 'ram_partinfo_uid', 'disk_partinfo_uid', 'status']; } } diff --git a/app/Views/admin/create_form.php b/app/Views/admin/create_form.php index 47de885..2125294 100644 --- a/app/Views/admin/create_form.php +++ b/app/Views/admin/create_form.php @@ -4,8 +4,14 @@ + + + + + + = form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?> -