From 75527e0caaf6b49618d0a99592fe91436e73bf65 Mon Sep 17 00:00:00 2001 From: "choi.jh" Date: Wed, 3 Sep 2025 18:03:04 +0900 Subject: [PATCH] dbmsv2_init...1 --- .../Admin/Customer/AccountController.php | 20 ++- .../Admin/Customer/CouponController.php | 20 ++- .../Admin/Customer/PointController.php | 20 ++- app/Controllers/CommonController.php | 7 +- app/Entities/CommonEntity.php | 4 +- app/Entities/Customer/AccountEntity.php | 2 +- app/Entities/Customer/ClientEntity.php | 6 +- app/Entities/Customer/CouponEntity.php | 2 +- app/Entities/Customer/CustomerEntity.php | 4 +- app/Entities/Customer/PaymentEntity.php | 10 +- app/Entities/Customer/PointEntity.php | 2 +- app/Entities/Customer/ServiceEntity.php | 25 +-- app/Entities/Equipment/LineEntity.php | 2 +- app/Entities/Equipment/PartEntity.php | 2 +- app/Entities/Equipment/ServerEntity.php | 22 ++- app/Entities/Equipment/ServerPartEntity.php | 2 +- app/Helpers/CommonHelper.php | 13 +- app/Helpers/Customer/ClientHelper.php | 4 +- app/Helpers/Customer/CustomerHelper.php | 18 -- app/Helpers/Customer/PaymentHelper.php | 2 +- app/Helpers/Customer/ServiceHelper.php | 121 +++++--------- app/Helpers/Equipment/EquipmentHelper.php | 18 -- app/Helpers/Equipment/ServerHelper.php | 156 +++++++++++------- app/Helpers/Equipment/ServerPartHelper.php | 132 --------------- app/Helpers/Equipment/SwitchHelper.php | 2 +- app/Language/en/Equipment/Server.php | 28 ++-- app/Models/Equipment/ServerPartModel.php | 2 +- app/Services/CommonService.php | 7 + app/Services/Customer/AccountService.php | 3 +- app/Services/Customer/CouponService.php | 2 +- app/Services/Customer/PaymentService.php | 2 - app/Services/Customer/PointService.php | 2 +- app/Services/Customer/ServiceService.php | 24 +-- app/Services/Equipment/ServerPartService.php | 42 +++-- app/Services/Equipment/ServerService.php | 72 ++++---- app/Views/admin/popup/modify_form.php | 24 +++ app/Views/admin/server/create_form.php | 10 +- app/Views/admin/server/index.php | 30 +++- app/Views/admin/server/modify_form.php | 44 +---- app/Views/admin/server/view.php | 18 +- app/Views/admin/service/create_form.php | 40 +---- app/Views/admin/service/index.php | 31 +++- app/Views/admin/service/modify_form.php | 44 +---- app/Views/admin/service/view.php | 8 +- 44 files changed, 454 insertions(+), 595 deletions(-) create mode 100644 app/Views/admin/popup/modify_form.php diff --git a/app/Controllers/Admin/Customer/AccountController.php b/app/Controllers/Admin/Customer/AccountController.php index 123268b..57a070f 100644 --- a/app/Controllers/Admin/Customer/AccountController.php +++ b/app/Controllers/Admin/Customer/AccountController.php @@ -2,13 +2,14 @@ namespace App\Controllers\Admin\Customer; +use App\Entities\Customer\AccountEntity; +use App\Helpers\Customer\AccountHelper; +use App\Services\Customer\AccountService; + use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; use Psr\Log\LoggerInterface; -use App\Helpers\Customer\AccountHelper; -use App\Services\Customer\AccountService; - class AccountController extends CustomerController { public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) @@ -35,4 +36,17 @@ class AccountController extends CustomerController return $this->_helper; } //Index,FieldForm관련. + protected function create_process(array $formDatas): AccountEntity + { + // 관리자 UID는 현재 인증된 사용자로 설정 + $formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo(); + return parent::create_process($formDatas); + } + //수정관련 + protected function modify_process(mixed $entity, array $formDatas): AccountEntity + { + // 관리자 UID는 현재 인증된 사용자로 설정 + $formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo(); + return parent::modify_process($entity, $formDatas); + } } diff --git a/app/Controllers/Admin/Customer/CouponController.php b/app/Controllers/Admin/Customer/CouponController.php index 92c4abb..dd0cc6a 100644 --- a/app/Controllers/Admin/Customer/CouponController.php +++ b/app/Controllers/Admin/Customer/CouponController.php @@ -2,13 +2,14 @@ namespace App\Controllers\Admin\Customer; +use App\Entities\Customer\CouponEntity; +use App\Helpers\Customer\CouponHelper; +use App\Services\Customer\CouponService; + use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; use Psr\Log\LoggerInterface; -use App\Helpers\Customer\CouponHelper; -use App\Services\Customer\CouponService; - class CouponController extends CustomerController { public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) @@ -35,4 +36,17 @@ class CouponController extends CustomerController return $this->_helper; } //Index,FieldForm관련. + protected function create_process(array $formDatas): CouponEntity + { + // 관리자 UID는 현재 인증된 사용자로 설정 + $formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo(); + return parent::create_process($formDatas); + } + //수정관련 + protected function modify_process(mixed $entity, array $formDatas): CouponEntity + { + // 관리자 UID는 현재 인증된 사용자로 설정 + $formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo(); + return parent::modify_process($entity, $formDatas); + } } diff --git a/app/Controllers/Admin/Customer/PointController.php b/app/Controllers/Admin/Customer/PointController.php index b79b300..a1839c4 100644 --- a/app/Controllers/Admin/Customer/PointController.php +++ b/app/Controllers/Admin/Customer/PointController.php @@ -2,13 +2,14 @@ namespace App\Controllers\Admin\Customer; +use App\Entities\Customer\PointEntity; +use App\Helpers\Customer\PointHelper; +use App\Services\Customer\PointService; + use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; use Psr\Log\LoggerInterface; -use App\Helpers\Customer\PointHelper; -use App\Services\Customer\PointService; - class PointController extends CustomerController { public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) @@ -35,4 +36,17 @@ class PointController extends CustomerController return $this->_helper; } //Index,FieldForm관련. + protected function create_process(array $formDatas): PointEntity + { + // 관리자 UID는 현재 인증된 사용자로 설정 + $formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo(); + return parent::create_process($formDatas); + } + //수정관련 + protected function modify_process(mixed $entity, array $formDatas): PointEntity + { + // 관리자 UID는 현재 인증된 사용자로 설정 + $formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo(); + return parent::modify_process($entity, $formDatas); + } } diff --git a/app/Controllers/CommonController.php b/app/Controllers/CommonController.php index 9376e9d..3179986 100644 --- a/app/Controllers/CommonController.php +++ b/app/Controllers/CommonController.php @@ -403,7 +403,6 @@ abstract class CommonController extends BaseController try { $this->setAction(__FUNCTION__); $this->setFormFields([$field]); - $this->setFormFilters([$field]); $this->setFormRules(); //기본값정의 $this->setFormDatas($this->request->getGet()); @@ -424,12 +423,11 @@ abstract class CommonController extends BaseController //일괄처리작업기능 protected function batchjob_process(mixed $entity, array $formDatas): mixed { - return $this->getService()->modify($entity, $formDatas); + return $this->getService()->batchjob($entity, $formDatas); } private function batchjob_pre_process(): array { $selectedFields = []; - //getBatchJobFields를 이용해서 선택된 Field 와 값정의 $formDatas = []; foreach ($this->getService()->getBatchjobFields() as $field) { $value = $this->request->getPost($field); @@ -457,10 +455,9 @@ abstract class CommonController extends BaseController $this->setAction(__FUNCTION__); list($selectedFields, $formDatas, $uids) = $this->batchjob_pre_process(); $this->setFormFields($selectedFields); - $this->setFormFilters($selectedFields); $this->setFormRules(); //기본값정의 - $this->setFormDatas($this->request->getGet()); + $this->setFormDatas($this->request->getPost()); $this->doValidations(); $entities = []; foreach ($uids as $uid) { diff --git a/app/Entities/CommonEntity.php b/app/Entities/CommonEntity.php index 3a44323..b95bb15 100644 --- a/app/Entities/CommonEntity.php +++ b/app/Entities/CommonEntity.php @@ -33,7 +33,7 @@ abstract class CommonEntity extends Entity } final public function getUpdatedAt(): string|null { - return $this->attributes['updated_at']; + return $this->attributes['updated_at'] ?? null; } final public function getCreatedAt(): string { @@ -41,6 +41,6 @@ abstract class CommonEntity extends Entity } final public function getDeletedAt(): string { - return $this->attributes['deleted_at']; + return $this->attributes['deleted_at'] ?? null; } } diff --git a/app/Entities/Customer/AccountEntity.php b/app/Entities/Customer/AccountEntity.php index b681b66..29e3f72 100644 --- a/app/Entities/Customer/AccountEntity.php +++ b/app/Entities/Customer/AccountEntity.php @@ -10,7 +10,7 @@ class AccountEntity extends CustomerEntity const TITLE = AccountModel::TITLE; const STATUS_WIDTHDRAWAL = "widthdrawal"; const STATUS_DEPOSIT = "deposit"; - const DEFAULT_STATUS = self::STATUS_WIDTHDRAWAL; + const DEFAULT_STATUS = self::STATUS_DEPOSIT; //고객정보객체-상속 //타 객체정의 부분 } diff --git a/app/Entities/Customer/ClientEntity.php b/app/Entities/Customer/ClientEntity.php index 246ba0a..766b4cb 100644 --- a/app/Entities/Customer/ClientEntity.php +++ b/app/Entities/Customer/ClientEntity.php @@ -29,14 +29,14 @@ class ClientEntity extends CustomerEntity } public function getAccountBalance(): int { - return intval($this->attributes['account_balance']); + return $this->attributes['account_balance']; } public function getCouponBalance(): int { - return intval($this->attributes['coupon_balance']); + return $this->attributes['coupon_balance']; } public function getPointBalance(): int { - return intval($this->attributes['point_balance']); + return $this->attributes['point_balance']; } } diff --git a/app/Entities/Customer/CouponEntity.php b/app/Entities/Customer/CouponEntity.php index d47cedd..bc311ae 100644 --- a/app/Entities/Customer/CouponEntity.php +++ b/app/Entities/Customer/CouponEntity.php @@ -10,7 +10,7 @@ class CouponEntity extends CustomerEntity const TITLE = CouponModel::TITLE; const STATUS_WIDTHDRAWAL = "widthdrawal"; const STATUS_DEPOSIT = "deposit"; - const DEFAULT_STATUS = self::STATUS_WIDTHDRAWAL; + const DEFAULT_STATUS = self::STATUS_DEPOSIT; //고객정보객체-상속 //타 객체정의 부분 } diff --git a/app/Entities/Customer/CustomerEntity.php b/app/Entities/Customer/CustomerEntity.php index 84a998a..c13dd8b 100644 --- a/app/Entities/Customer/CustomerEntity.php +++ b/app/Entities/Customer/CustomerEntity.php @@ -11,8 +11,8 @@ abstract class CustomerEntity extends CommonEntity parent::__construct($data); } //고객정보객체 - final public function getClientUID(): int + final public function getClientUID(): int|null { - return intval($this->attributes['clientinfo_uid']); + return $this->attributes['clientinfo_uid'] ?? null; } } diff --git a/app/Entities/Customer/PaymentEntity.php b/app/Entities/Customer/PaymentEntity.php index 809c026..ebc334e 100644 --- a/app/Entities/Customer/PaymentEntity.php +++ b/app/Entities/Customer/PaymentEntity.php @@ -15,15 +15,15 @@ class PaymentEntity extends CustomerEntity //관리자정보객체 final public function getUserUID(): int { - return intval($this->attributes['user_uid']); + return $this->attributes['user_uid']; } final public function getClientCode(): int { - return intval($this->attributes['clientinfo_uid']); + return $this->attributes['clientinfo_uid']; } final public function getServiceCode(): int { - return intval($this->attributes['serviceinfo_uid']); + return $this->attributes['serviceinfo_uid']; } //타 객체정의 부분 public function getItemType(): string @@ -32,11 +32,11 @@ class PaymentEntity extends CustomerEntity } public function getIsOnetime(): int { - return intval($this->attributes['isOnetime']); + return $this->attributes['isOnetime']; } public function getAmount(): int { - return intval($this->attributes['amount']); + return $this->attributes['amount']; } public function getBillingAt(): string { diff --git a/app/Entities/Customer/PointEntity.php b/app/Entities/Customer/PointEntity.php index af3ccf0..a9be394 100644 --- a/app/Entities/Customer/PointEntity.php +++ b/app/Entities/Customer/PointEntity.php @@ -10,7 +10,7 @@ class PointEntity extends CustomerEntity const TITLE = PointModel::TITLE; const STATUS_WIDTHDRAWAL = "widthdrawal"; const STATUS_DEPOSIT = "deposit"; - const DEFAULT_STATUS = self::STATUS_WIDTHDRAWAL; + const DEFAULT_STATUS = self::STATUS_DEPOSIT; //고객정보객체-상속 //타 객체정의 부분 } diff --git a/app/Entities/Customer/ServiceEntity.php b/app/Entities/Customer/ServiceEntity.php index afce01d..aa240d8 100644 --- a/app/Entities/Customer/ServiceEntity.php +++ b/app/Entities/Customer/ServiceEntity.php @@ -25,21 +25,17 @@ class ServiceEntity extends CustomerEntity } return $this->attributes['serverEntity']; } - public function getCode(): string + public function getCode(): string|null { - return $this->attributes['code'] ?? "null"; + return $this->attributes['code']; } - final public function getUserUID(): int + final public function getUserUID(): int|null { - return intval($this->attributes['user_uid']); + return $this->attributes['user_uid']; } - final public function getClientInfoUID(): int + final public function getClientInfoUID(): int|null { - return intval($this->attributes['clientinfo_uid']); - } - public function getSwitchCode(): string - { - return $this->attributes['switchinfo_code']; + return $this->attributes['clientinfo_uid']; } public function getType(): string { @@ -49,13 +45,4 @@ class ServiceEntity extends CustomerEntity { return $this->attributes['billing_at']; } - public function getItemEntities(string $type): array - { - return $this->attributes[$type] ?? []; - } - public function setItemEntities(string $type, array $itemEntities): void - { - $this->attributes[$type] = $itemEntities; - // $this->attributes[$type] = array_unique($this->attributes[$type], SORT_REGULAR); - } } diff --git a/app/Entities/Equipment/LineEntity.php b/app/Entities/Equipment/LineEntity.php index d9e42e0..e82ac35 100644 --- a/app/Entities/Equipment/LineEntity.php +++ b/app/Entities/Equipment/LineEntity.php @@ -12,7 +12,7 @@ class LineEntity extends EquipmentEntity const STATUS_OCCUPIED = "occupied"; const STATUS_FORBIDDEN = "forbidden"; const DEFAULT_STATUS = self::STATUS_AVAILABLE; - public function getBandwith() + public function getBandwith(): string { return $this->attributes['bandwith']; } diff --git a/app/Entities/Equipment/PartEntity.php b/app/Entities/Equipment/PartEntity.php index 83dac4c..cb238e4 100644 --- a/app/Entities/Equipment/PartEntity.php +++ b/app/Entities/Equipment/PartEntity.php @@ -19,7 +19,7 @@ class PartEntity extends EquipmentEntity } public function getPrice(): int { - return (int) $this->attributes['price']; + return $this->attributes['price']; } public function getFormTitle(): string { diff --git a/app/Entities/Equipment/ServerEntity.php b/app/Entities/Equipment/ServerEntity.php index e552d7d..0d4bd21 100644 --- a/app/Entities/Equipment/ServerEntity.php +++ b/app/Entities/Equipment/ServerEntity.php @@ -29,15 +29,25 @@ class ServerEntity extends EquipmentEntity if (!array_key_exists('serverPartEntities', $this->attributes)) { $this->attributes['serverPartEntities'] = []; } - $this->attributes['serverPartEntities'][$partType] = $entity; + if (!array_key_exists($partType, $this->attributes['serverPartEntities'])) { + $this->attributes['serverPartEntities'][$partType] = []; + } + $this->attributes['serverPartEntities'][$partType][] = $entity; } - public function getServerPartEntity(string $partType): ServerPartEntity|null + public function setServerPartEntities(string $partType, array $serverPartEntities): void { if (!array_key_exists('serverPartEntities', $this->attributes)) { - return null; + $this->attributes['serverPartEntities'] = []; + } + $this->attributes['serverPartEntities'][$partType] = $serverPartEntities; + } + public function getServerPartEntities(string $partType): array + { + if (!array_key_exists('serverPartEntities', $this->attributes)) { + return []; } if (!array_key_exists($partType, $this->attributes['serverPartEntities'])) { - return null; + return []; } return $this->attributes['serverPartEntities'][$partType]; } @@ -76,6 +86,10 @@ class ServerEntity extends EquipmentEntity { return $this->attributes['code']; } + public function getTitle(): string + { + return sprintf("%s[%s]", parent::getTitle(), $this->getCode()); + } public function getClientInfoUID(): int|null { return $this->attributes['clientinfo_uid'] ?? null; diff --git a/app/Entities/Equipment/ServerPartEntity.php b/app/Entities/Equipment/ServerPartEntity.php index a2f0520..67e3010 100644 --- a/app/Entities/Equipment/ServerPartEntity.php +++ b/app/Entities/Equipment/ServerPartEntity.php @@ -37,7 +37,7 @@ class ServerPartEntity extends EquipmentEntity } public function getServiceInfoUID(): int|null { - return $this->attributes['serviceinfo_uid'] ?? null; + return $this->attributes['serviceinfo_uid']; } public function getType(): string { diff --git a/app/Helpers/CommonHelper.php b/app/Helpers/CommonHelper.php index 91452bc..09578cc 100644 --- a/app/Helpers/CommonHelper.php +++ b/app/Helpers/CommonHelper.php @@ -226,7 +226,7 @@ class CommonHelper // echo "{$field}->{$value}"; foreach ($viewDatas['control']['field_optons'][$field] as $key => $entity) { $isSelected = $key == $value ? ' selected' : ''; - $isDisabled = $entity->getStatus() === $entity::DEFAULT_STATUS ? '' : ' disabled'; + $isDisabled = $viewDatas['control']['action'] === 'index' && $entity->getStatus() !== $entity::DEFAULT_STATUS ? ' disabled' : ''; $html .= sprintf("", $key, $isSelected, $isDisabled, array_key_exists('isForm', $extras) ? $entity->getFormTitle() : $entity->getTitle()); } $html .= ''; @@ -349,6 +349,17 @@ class CommonHelper } public function getListFilter(string $field, mixed $value, array $viewDatas, array $extras = []): string { + switch ($field) { + case 'user_uid': + case 'old_clientinfo_uid': + case 'clientinfo_uid': + case 'serviceinfo_uid': + case 'serverinfo_uid': + case 'csinfo_uid': + case 'ipinfo_uid': + $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; + break; + } if (!array_key_exists($field, $viewDatas['control']['field_optons'])) { throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 정의되지 않았습니다."); } diff --git a/app/Helpers/Customer/ClientHelper.php b/app/Helpers/Customer/ClientHelper.php index 8a4ba04..b9f8ae7 100644 --- a/app/Helpers/Customer/ClientHelper.php +++ b/app/Helpers/Customer/ClientHelper.php @@ -74,7 +74,7 @@ class ClientHelper extends CustomerHelper if (!$this->getMyAuth()->isAccessRole(['security'])) { $action = $viewDatas['entity']->getCode(); } else { - $action = parent::getListButton($action, $viewDatas['entity']->getCode(), $viewDatas, $extras); + $action = parent::getListButton($action, $label ? $label : $viewDatas['entity']->getCode(), $viewDatas, $extras); } break; case 'create': @@ -86,7 +86,7 @@ class ClientHelper extends CustomerHelper case 'history': $extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras]; $action = form_label( - ICONS['HISTORY'], + $label ? $label : ICONS['HISTORY'], $action, [ "data-src" => "/admin/customer/clienthistory?clientinfo_uid={$viewDatas['entity']->getPK()}", diff --git a/app/Helpers/Customer/CustomerHelper.php b/app/Helpers/Customer/CustomerHelper.php index cb28dde..b6f19f8 100644 --- a/app/Helpers/Customer/CustomerHelper.php +++ b/app/Helpers/Customer/CustomerHelper.php @@ -10,22 +10,4 @@ abstract class CustomerHelper extends CommonHelper { parent::__construct(); } - - public function getListFilter(string $field, mixed $value, array $viewDatas, array $extras = []): string - { - switch ($field) { - case 'user_uid': - case 'old_clientinfo_uid': - case 'clientinfo_uid': - case 'serviceinfo_uid': - case 'serverinfo_uid': - $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; - $form = parent::getListFilter($field, $value, $viewDatas, $extras); - break; - default: - $form = parent::getListFilter($field, $value, $viewDatas, $extras); - break; - } - return $form; - } } diff --git a/app/Helpers/Customer/PaymentHelper.php b/app/Helpers/Customer/PaymentHelper.php index 1deddd6..f807079 100644 --- a/app/Helpers/Customer/PaymentHelper.php +++ b/app/Helpers/Customer/PaymentHelper.php @@ -49,7 +49,7 @@ class PaymentHelper extends CustomerHelper $action = $viewDatas['entity']->getStatus() !== $viewDatas['entity']::DEFAULT_STATUS ? "" : parent::getListButton($action, $label, $viewDatas, $extras); break; case 'invoice': - $action = form_submit($action . "_submit", '청구서 발행', [ + $action = form_submit($action . "_submit", $label ? $label : '청구서 발행', [ "formaction" => current_url() . '/' . $action, "class" => "btn btn-outline btn-primary", ]); diff --git a/app/Helpers/Customer/ServiceHelper.php b/app/Helpers/Customer/ServiceHelper.php index 1e49484..f18ece4 100644 --- a/app/Helpers/Customer/ServiceHelper.php +++ b/app/Helpers/Customer/ServiceHelper.php @@ -11,25 +11,6 @@ class ServiceHelper extends CustomerHelper parent::__construct(); $this->setTitleField(field: ServiceModel::TITLE); } - private function getServerPartForm(string $field, mixed $value, array $viewDatas, array $extras, string $partType): string - { - //Type별로 부품연결정보가 있는지 확인 - $serverpartEntity = null; - if (array_key_exists('entity', $viewDatas)) { - $serverpartEntity = $viewDatas['entity']->getServerPartEntity($partType); - } - $form = ""; - //수정시 Type별 사용할 hidden partinfo_uid - if ($serverpartEntity !== null) { - $form .= form_hidden("partinfo_uid_{$partType}", $serverpartEntity->getPK()); - } - //기존 입력화면에서 return 된것인지? - if ($value === null && $serverpartEntity !== null) { - $value = $serverpartEntity->getPartInfoUID(); - } - $form .= $this->form_dropdown_custom($field, $value, $viewDatas, $extras); - return $form; - } public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string { switch ($field) { @@ -73,69 +54,12 @@ class ServiceHelper extends CustomerHelper } $form .= $this->form_dropdown_custom($field, $value, $viewDatas, $extras); break; - case 'partinfo_uid_CPU': - $form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'CPU'); - break; - case 'partinfo_uid_CPU_cnt': - $form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "개"; - break; - case 'partinfo_uid_RAM': - $form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'RAM',); - break; - case 'partinfo_uid_RAM_cnt': - $form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "개"; - break; - case 'partinfo_uid_DISK': - $form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'DISK'); - break; - case 'partinfo_uid_DISK_cnt': - $form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "개"; - break; - case 'partinfo_uid_DISK_extra': - $form = $this->form_dropdown_custom($field, $value, $viewDatas, $extras); - break; - case 'partinfo_uid_OS': - $form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'OS'); - break; - case 'partinfo_uid_OS_cnt': - $form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "개"; - break; - case 'partinfo_uid_DB': - $form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'DB'); - break; - case 'partinfo_uid_DB_cnt': - $form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "개"; - break; - case 'partinfo_uid_SOFTWARE': - $form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'SOFTWARE'); - break; - case 'partinfo_uid_SOFTWARE_cnt': - $form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "개"; - break; - // case 'ipinfo_uid': - // case 'csinfo_uid': - // $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; - // $form = $this->form_dropdown_custom($field, $value, $viewDatas, $extras); - // break; default: $form = parent::getFieldForm($field, $value, $viewDatas, $extras); break; } return $form; } - private function getServerPartView(string $field, mixed $value, array $viewDatas, array $extras, string $partType): string - { - $serverPartEntity = $viewDatas['entity']->getServerEntity()->getServerPartEntity($partType); - if ($serverPartEntity !== null) { - $value .= sprintf( - "
%s%s %s
", - $serverPartEntity->getTitle(), - $serverPartEntity->getCnt() >= 1 ? "*" . $serverPartEntity->getCnt() . "개" : "", - $serverPartEntity->getExtra() ?? "" - ); - } - return $value; - } public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null { switch ($field) { @@ -159,16 +83,34 @@ class ServiceHelper extends CustomerHelper case 'OS': case 'DB': case 'SOFTWARE': - $value = $this->getServerPartView($field, $value, $viewDatas, $extras, $field); + $temps = []; + foreach ($viewDatas['entity']->getServerEntity()->getServerPartEntities($field) as $serverPartEntity) { + $modal = form_label( + ICONS['SETUP'], + $field, + [ + "data-src" => "/admin/equipment/serverpart/modify/{$serverPartEntity->getPK()}?ActionTemplate=popup", + "data-bs-toggle" => "modal", + "data-bs-target" => "#index_action_form", + ["class" => "btn btn-sm btn-outline btn-circle", "target" => "_self"] + ] + ); + $temps[] = sprintf( + "%s%s%s %s", + $modal, + $serverPartEntity->getTitle(), + $serverPartEntity->getCnt() >= 1 ? "*" . $serverPartEntity->getCnt() . "개" : "", + $serverPartEntity->getExtra() ?? "" + ); + } + $value .= implode("
", $temps); break; case 'ipinfo_uid': - $value = ""; foreach ($viewDatas['entity']->getServerEntity()->getIPEntities() as $ipEntity) { $value .= sprintf("
%s%s %s
", $ipEntity->getTitle(), $ipEntity->getAmount()); } break; case 'csinfo_uid': - $value = ""; foreach ($viewDatas['entity']->getServerEntity()->getCSEntities() as $csEntity) { $value .= sprintf("
%s%s %s
", $csEntity->getTitle(), $csEntity->getAmount()); } @@ -203,7 +145,26 @@ class ServiceHelper extends CustomerHelper $label ? $label : ICONS['HISTORY'], $action, [ - "data-src" => "/admin/customer/servicehistory?serviceinfo_uid={$viewDatas['entity']->getPK()}", + "data-src" => "/admin/customer/servicehistory?serviceinfo_uid={$viewDatas['entity']->getPK()}&serviceinfo_uid={$viewDatas['entity']->getPK()}&ActionTemplate=popup", + "data-bs-toggle" => "modal", + "data-bs-target" => "#index_action_form", + ...$extras + ] + ); + break; + case 'CPU': + case 'RAM': + case 'DISK': + case 'OS': + case 'DB': + case 'SOFTWARE': + $serverEntity = $viewDatas['entity']->getServerEntity(); + $extras = ["class" => "btn btn-sm btn-outline btn-circle", "target" => "_self", ...$extras]; + $action = form_label( + $label ? $label : ICONS['SETUP'], + $action, + [ + "data-src" => "/admin/equipment/serverpart?serverinfo_uid={$serverEntity->getPK()}&type={$action}&ActionTemplate=popup", "data-bs-toggle" => "modal", "data-bs-target" => "#index_action_form", ...$extras diff --git a/app/Helpers/Equipment/EquipmentHelper.php b/app/Helpers/Equipment/EquipmentHelper.php index 00d2469..fc41676 100644 --- a/app/Helpers/Equipment/EquipmentHelper.php +++ b/app/Helpers/Equipment/EquipmentHelper.php @@ -10,22 +10,4 @@ abstract class EquipmentHelper extends CommonHelper { parent::__construct(); } - - public function getListFilter(string $field, mixed $value, array $viewDatas, array $extras = []): string - { - switch ($field) { - case 'user_uid': - case 'old_clientinfo_uid': - case 'clientinfo_uid': - case 'serviceinfo_uid': - case 'serverinfo_uid': - $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; - $form = parent::getListFilter($field, $value, $viewDatas, $extras); - break; - default: - $form = parent::getListFilter($field, $value, $viewDatas, $extras); - break; - } - return $form; - } } diff --git a/app/Helpers/Equipment/ServerHelper.php b/app/Helpers/Equipment/ServerHelper.php index 98b52f9..494d7bc 100644 --- a/app/Helpers/Equipment/ServerHelper.php +++ b/app/Helpers/Equipment/ServerHelper.php @@ -13,21 +13,18 @@ class ServerHelper extends EquipmentHelper } private function getServerPartForm(string $field, mixed $value, array $viewDatas, array $extras, string $partType): string { - //Type별로 부품연결정보가 있는지 확인 - $serverpartEntity = null; - if (array_key_exists('entity', $viewDatas)) { - $serverpartEntity = $viewDatas['entity']->getServerPartEntity($partType); - } $form = ""; - //수정시 Type별 사용할 hidden partinfo_uid - if ($serverpartEntity !== null) { - $form .= form_hidden("partinfo_uid_{$partType}", $serverpartEntity->getPK()); + if (array_key_exists('entity', $viewDatas)) { + foreach ($viewDatas['entity']->getServerPartEntities($partType) as $serverPartEntity) { + //기존 입력화면에서 return 된것인지? + if ($value === null && $serverPartEntity !== null) { + $value = $serverPartEntity->getPartInfoUID(); + } + $form .= $this->form_dropdown_custom($field, $value, $viewDatas, $extras); + } + } else { + $form .= $this->form_dropdown_custom($field, $value, $viewDatas, $extras); } - //기존 입력화면에서 return 된것인지? - if ($value === null && $serverpartEntity !== null) { - $value = $serverpartEntity->getPartInfoUID(); - } - $form .= $this->form_dropdown_custom($field, $value, $viewDatas, $extras); return $form; } public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string @@ -37,72 +34,86 @@ class ServerHelper extends EquipmentHelper // $extras['readonly'] = in_array($viewDatas['control']['action'], ['modify_form']) ? ' readonly' : ''; $form = parent::getFieldForm($field, $value, $viewDatas, $extras); break; + case 'switchinfo_uid': + if (array_key_exists('entity', $viewDatas)) { + $value = $viewDatas['entity']->getSwitchEntity() !== null ? $viewDatas['entity']->getSwitchEntity()->getPK() : $value; + } + $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; + $form = $this->form_dropdown_custom($field, $value, $viewDatas, $extras); + break; + case 'ipinfo_uid': + $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; + $form = ""; + if (array_key_exists('entity', $viewDatas)) { + foreach ($viewDatas['entity']->getIPEntities() as $ipEntity) { + $form .= "
" . $this->form_dropdown_custom($field, $ipEntity->getPK(), $viewDatas, $extras) . "
"; + } + } + $form .= $this->form_dropdown_custom($field, $value, $viewDatas, $extras); + break; + case 'csinfo_uid': + $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; + $form = ""; + if (array_key_exists('entity', $viewDatas)) { + foreach ($viewDatas['entity']->getCSEntities() as $csEntity) { + $form .= "
" . $this->form_dropdown_custom($field, $csEntity->getPK(), $viewDatas, $extras) . "
"; + } + } + $form .= $this->form_dropdown_custom($field, $value, $viewDatas, $extras); + break; case 'manufactur_at': case 'format_at': $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' calender' : 'calender'; $form = form_input($field, $value ?? "", $extras); break; - case 'partinfo_uid_CPU': + case 'CPU': $form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'CPU'); break; - case 'partinfo_uid_CPU_cnt': + case 'CPU_cnt': $form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "개"; break; - case 'partinfo_uid_RAM': + case 'RAM': $form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'RAM',); break; - case 'partinfo_uid_RAM_cnt': + case 'RAM_cnt': $form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "개"; break; - case 'partinfo_uid_DISK': + case 'DISK': $form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'DISK'); break; - case 'partinfo_uid_DISK_cnt': + case 'DISK_cnt': $form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "개"; break; - case 'partinfo_uid_DISK_extra': + case 'DISK_extra': $form = $this->form_dropdown_custom($field, $value, $viewDatas, $extras); break; - case 'partinfo_uid_OS': + case 'OS': $form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'OS'); break; - case 'partinfo_uid_OS_cnt': + case 'OS_cnt': $form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "개"; break; - case 'partinfo_uid_DB': + case 'DB': $form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'DB'); break; - case 'partinfo_uid_DB_cnt': + case 'DB_cnt': $form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "개"; break; - case 'partinfo_uid_SOFTWARE': + case 'SOFTWARE': $form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'SOFTWARE'); break; - case 'partinfo_uid_SOFTWARE_cnt': + case 'SOFTWARE_cnt': $form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "개"; break; - case 'ipinfo_uid': - case 'csinfo_uid': - $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; - $form = $this->form_dropdown_custom($field, $value, $viewDatas, $extras); - break; default: $form = parent::getFieldForm($field, $value, $viewDatas, $extras); break; } return $form; } - private function getServerPartView(string $field, mixed $value, array $viewDatas, array $extras, string $partType): string + private function getServerPartView(string $field, mixed $value, array $viewDatas, array $extras): string { - $serverPartEntity = $viewDatas['entity']->getServerPartEntity($partType); - if ($serverPartEntity !== null) { - $value .= sprintf( - "
%s%s %s
", - $serverPartEntity->getTitle(), - $serverPartEntity->getCnt() >= 1 ? "*" . $serverPartEntity->getCnt() . "개" : "", - $serverPartEntity->getExtra() ?? "" - ); - } + return $value; } public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null @@ -118,16 +129,34 @@ class ServerHelper extends EquipmentHelper case 'OS': case 'DB': case 'SOFTWARE': - $value = $this->getServerPartView($field, $value, $viewDatas, $extras, $field); + $temps = []; + foreach ($viewDatas['entity']->getServerPartEntities($field) as $serverPartEntity) { + $modal = form_label( + ICONS['SETUP'], + $field, + [ + "data-src" => "/admin/equipment/serverpart/modify/{$serverPartEntity->getPK()}?ActionTemplate=popup", + "data-bs-toggle" => "modal", + "data-bs-target" => "#index_action_form", + ["class" => "btn btn-sm btn-outline btn-circle", "target" => "_self"] + ] + ); + $temps[] = sprintf( + "%s%s%s %s", + $modal, + $serverPartEntity->getTitle(), + $serverPartEntity->getCnt() >= 1 ? "*" . $serverPartEntity->getCnt() . "개" : "", + $serverPartEntity->getExtra() ?? "" + ); + } + $value .= implode("
", $temps); break; case 'ipinfo_uid': - $value = ""; foreach ($viewDatas['entity']->getIPEntities() as $ipEntity) { $value .= sprintf("
%s%s %s
", $ipEntity->getTitle(), $ipEntity->getAmount()); } break; case 'csinfo_uid': - $value = ""; foreach ($viewDatas['entity']->getCSEntities() as $csEntity) { $value .= sprintf("
%s%s %s
", $csEntity->getTitle(), $csEntity->getAmount()); } @@ -142,21 +171,6 @@ class ServerHelper extends EquipmentHelper } return $value; } - public function getListFilter(string $field, mixed $value, array $viewDatas, array $extras = []): string - { - switch ($field) { - case 'csinfo_uid': - case 'ipinfo_uid': - $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; - $form = parent::getListFilter($field, $value, $viewDatas, $extras); - break; - default: - $form = parent::getListFilter($field, $value, $viewDatas, $extras); - break; - } - return $form; - } - public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string { switch ($action) { @@ -164,7 +178,7 @@ class ServerHelper extends EquipmentHelper if (!$this->getMyAuth()->isAccessRole(['security'])) { $action = $viewDatas['entity']->getCode(); } else { - $action = parent::getListButton($action, $viewDatas['entity']->getCode(), $viewDatas, $extras); + $action = parent::getListButton($action, $label ? $label : $viewDatas['entity']->getCode(), $viewDatas, $extras); } break; case 'create': @@ -175,8 +189,8 @@ class ServerHelper extends EquipmentHelper break; case 'history': $extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras]; - $action = form_label( - ICONS['HISTORY'], + $action = $label ? $label : form_label( + $label ? $label : ICONS['HISTORY'], $action, [ "data-src" => "/admin/customer/clienthistory?clientinfo_uid={$viewDatas['entity']->getPK()}", @@ -186,6 +200,24 @@ class ServerHelper extends EquipmentHelper ] ); break; + case 'CPU': + case 'RAM': + case 'DISK': + case 'OS': + case 'DB': + case 'SOFTWARE': + $extras = ["class" => "btn btn-sm btn-outline btn-circle", "target" => "_self", ...$extras]; + $action = form_label( + $label ? $label : ICONS['SETUP'], + $action, + [ + "data-src" => "/admin/equipment/serverpart?serverinfo_uid={$viewDatas['entity']->getPK()}&type={$action}&ActionTemplate=popup", + "data-bs-toggle" => "modal", + "data-bs-target" => "#index_action_form", + ...$extras + ] + ); + break; default: $action = parent::getListButton($action, $label, $viewDatas, $extras); break; diff --git a/app/Helpers/Equipment/ServerPartHelper.php b/app/Helpers/Equipment/ServerPartHelper.php index c5aacb4..178856b 100644 --- a/app/Helpers/Equipment/ServerPartHelper.php +++ b/app/Helpers/Equipment/ServerPartHelper.php @@ -11,25 +11,6 @@ class ServerPartHelper extends EquipmentHelper parent::__construct(); $this->setTitleField(field: ServerPartModel::TITLE); } - private function getServerPartForm(string $field, mixed $value, array $viewDatas, array $extras, string $partType): string - { - //Type별로 부품연결정보가 있는지 확인 - $serverpartEntity = null; - if (array_key_exists('entity', $viewDatas)) { - $serverpartEntity = $viewDatas['entity']->getServerPartEntity($partType); - } - $form = ""; - //수정시 Type별 사용할 hidden partinfo_uid - if ($serverpartEntity !== null) { - $form .= form_hidden("partinfo_uid_{$partType}", $serverpartEntity->getPK()); - } - //기존 입력화면에서 return 된것인지? - if ($value === null && $serverpartEntity !== null) { - $value = $serverpartEntity->getPartInfoUID(); - } - $form .= $this->form_dropdown_custom($field, $value, $viewDatas, $extras); - return $form; - } public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string { switch ($field) { @@ -37,123 +18,10 @@ class ServerPartHelper extends EquipmentHelper // $extras['readonly'] = in_array($viewDatas['control']['action'], ['modify_form']) ? ' readonly' : ''; $form = parent::getFieldForm($field, $value, $viewDatas, $extras); break; - case 'manufactur_at': - case 'format_at': - $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' calender' : 'calender'; - $form = form_input($field, $value ?? "", $extras); - break; - case 'partinfo_uid_CPU': - $form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'CPU'); - break; - case 'partinfo_uid_CPU_cnt': - $form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "개"; - break; - case 'partinfo_uid_RAM': - $form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'RAM',); - break; - case 'partinfo_uid_RAM_cnt': - $form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "개"; - break; - case 'partinfo_uid_DISK': - $form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'DISK'); - break; - case 'partinfo_uid_DISK_cnt': - $form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "개"; - break; - case 'partinfo_uid_DISK_extra': - $form = $this->form_dropdown_custom($field, $value, $viewDatas, $extras); - break; - case 'partinfo_uid_OS': - $form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'OS'); - break; - case 'partinfo_uid_OS_cnt': - $form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "개"; - break; - case 'partinfo_uid_DB': - $form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'DB'); - break; - case 'partinfo_uid_DB_cnt': - $form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "개"; - break; - case 'partinfo_uid_SOFTWARE': - $form = $this->getServerPartForm($field, $value, $viewDatas, $extras, 'SOFTWARE'); - break; - case 'partinfo_uid_SOFTWARE_cnt': - $form = form_dropdown($field, $viewDatas['partinfo_cnt_options'], $value, $extras) . "개"; - break; - case 'ipinfo_uid': - case 'csinfo_uid': - $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; - $form = $this->form_dropdown_custom($field, $value, $viewDatas, $extras); - break; default: $form = parent::getFieldForm($field, $value, $viewDatas, $extras); break; } return $form; } - private function getServerPartView(string $field, mixed $value, array $viewDatas, array $extras, string $partType): string - { - $serverPartEntity = $viewDatas['entity']->getServerPartEntity($partType); - if ($serverPartEntity !== null) { - $value .= sprintf( - "
%s%s %s
", - $serverPartEntity->getTitle(), - $serverPartEntity->getCnt() >= 1 ? "*" . $serverPartEntity->getCnt() . "개" : "", - $serverPartEntity->getExtra() ?? "" - ); - } - return $value; - } - public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null - { - switch ($field) { - case 'manufactur_at': - case 'format_at': - $value = $value ? date("Y-m-d", strtotime($value)) : ""; - break; - case 'CPU': - case 'RAM': - case 'DISK': - case 'OS': - case 'DB': - case 'SOFTWARE': - $value = $this->getServerPartView($field, $value, $viewDatas, $extras, $field); - break; - case 'ipinfo_uid': - $value = ""; - foreach ($viewDatas['entity']->getIPEntities() as $ipEntity) { - $value .= sprintf("
%s%s %s
", $ipEntity->getTitle(), $ipEntity->getAmount()); - } - break; - case 'csinfo_uid': - $value = ""; - foreach ($viewDatas['entity']->getCSEntities() as $csEntity) { - $value .= sprintf("
%s%s %s
", $csEntity->getTitle(), $csEntity->getAmount()); - } - break; - default: - $value = parent::getFieldView($field, $value, $viewDatas, $extras); - break; - } - if (is_array($value)) { - echo __METHOD__ . "에서 오류: {$field}의 값이 Array형태입니다"; - exit; - } - return $value; - } - public function getListFilter(string $field, mixed $value, array $viewDatas, array $extras = []): string - { - switch ($field) { - case 'csinfo_uid': - case 'ipinfo_uid': - $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; - $form = parent::getListFilter($field, $value, $viewDatas, $extras); - break; - default: - $form = parent::getListFilter($field, $value, $viewDatas, $extras); - break; - } - return $form; - } } diff --git a/app/Helpers/Equipment/SwitchHelper.php b/app/Helpers/Equipment/SwitchHelper.php index d99d501..4a1a1fc 100644 --- a/app/Helpers/Equipment/SwitchHelper.php +++ b/app/Helpers/Equipment/SwitchHelper.php @@ -19,7 +19,7 @@ class SwitchHelper extends EquipmentHelper if (!$this->getMyAuth()->isAccessRole(['security'])) { $action = $viewDatas['entity']->getCode(); } else { - $action = parent::getListButton($action, $viewDatas['entity']->getCode(), $viewDatas, $extras); + $action = parent::getListButton($action, $label ? $label : $viewDatas['entity']->getCode(), $viewDatas, $extras); } break; default: diff --git a/app/Language/en/Equipment/Server.php b/app/Language/en/Equipment/Server.php index 11458bb..58aac91 100644 --- a/app/Language/en/Equipment/Server.php +++ b/app/Language/en/Equipment/Server.php @@ -18,19 +18,19 @@ return [ "serverpartinfo" => "부품정보", "ipinfo_uid" => "IP정보", "csinfo_uid" => "CS정보", - 'partinfo_uid_CPU' => "CPU", - 'partinfo_uid_CPU_cnt' => "CPU갯수", - 'partinfo_uid_RAM' => "RAM", - 'partinfo_uid_RAM_cnt' => "RAM갯수", - 'partinfo_uid_DISK' => "DISK", - 'partinfo_uid_DISK_cnt' => "DISK갯수", - 'partinfo_uid_DISK_extra' => "RAID설정", - 'partinfo_uid_OS' => "OS", - 'partinfo_uid_OS_cnt' => "OS갯수", - 'partinfo_uid_DB' => "DB", - 'partinfo_uid_DB_cnt' => "DB갯수", - 'partinfo_uid_SOFTWARE' => "기타SW", - 'partinfo_uid_SOFTWARE_cnt' => "SOFTWARE갯수", + 'CPU' => "CPU", + 'CPU_cnt' => "CPU갯수", + 'RAM' => "RAM", + 'RAM_cnt' => "RAM갯수", + 'DISK' => "DISK", + 'DISK_cnt' => "DISK갯수", + 'DISK_extra' => "RAID설정", + 'OS' => "OS", + 'OS_cnt' => "OS갯수", + 'DB' => "DB", + 'DB_cnt' => "DB갯수", + 'SOFTWARE' => "기타SW", + 'SOFTWARE_cnt' => "SOFTWARE갯수", ], "TITLE" => [ 'HP DL360 Gen6' => "HP DL360 Gen6", @@ -50,7 +50,7 @@ return [ 'occupied' => "서비스중", 'forbidden' => "사용불가", ], - "PARTINFO_UID_DISK_EXTRA" => [ + "DISK_EXTRA" => [ 'RAID0' => "RAID0", 'RAID1' => "RAID1", 'RAID5' => "RAID5", diff --git a/app/Models/Equipment/ServerPartModel.php b/app/Models/Equipment/ServerPartModel.php index 2a89fb6..b3afd02 100644 --- a/app/Models/Equipment/ServerPartModel.php +++ b/app/Models/Equipment/ServerPartModel.php @@ -35,7 +35,6 @@ class ServerPartModel extends EquipmentModel switch ($field) { case "partinfo_uid": case "serverinfo_uid": - case "billing": case "cnt": case "amount": $rule = "required|numeric"; @@ -44,6 +43,7 @@ class ServerPartModel extends EquipmentModel $rule = "permit_empty|numeric"; break; case "type": + case "billing": $rule = "required|trim|string"; break; case "extra": diff --git a/app/Services/CommonService.php b/app/Services/CommonService.php index 9f7e153..d3024b7 100644 --- a/app/Services/CommonService.php +++ b/app/Services/CommonService.php @@ -171,6 +171,13 @@ abstract class CommonService // LogCollector::info("[{$entity->getTitle()}]" . MESSAGES["UPDATED"] . ":"); return $entity; } + //일괄처리작업 + public function batchjob(mixed $entity, array $formDatas): mixed + { + $entity = $this->getModel()->modify($entity, $formDatas); + // LogCollector::info("[{$entity->getTitle()}]" . MESSAGES["UPDATED"] . ":"); + return $entity; + } //삭제 public function delete(mixed $entity): mixed { diff --git a/app/Services/Customer/AccountService.php b/app/Services/Customer/AccountService.php index 30788fa..51f7d4d 100644 --- a/app/Services/Customer/AccountService.php +++ b/app/Services/Customer/AccountService.php @@ -48,8 +48,7 @@ class AccountService extends CustomerService throw new \Exception("{$formDatas['clientinfo_uid']}에 대한 고객정보를 찾을수 없습니다."); } $amount = intval($formDatas['amount']); - // dd($formDatas); - if ($formDatas['status'] === AccountEntity::DEFAULT_STATUS) { //입금, 쿠폰추가 + if ($formDatas['status'] === AccountEntity::STATUS_DEPOSIT) { //입금, 쿠폰추가 $entity = $this->getClientService()->deposit($entity, 'account_balance', $amount); } else { // 출금, 쿠폰사용 $entity = $this->getClientService()->withdrawal($entity, 'account_balance', $amount); diff --git a/app/Services/Customer/CouponService.php b/app/Services/Customer/CouponService.php index 559b712..50566b9 100644 --- a/app/Services/Customer/CouponService.php +++ b/app/Services/Customer/CouponService.php @@ -44,7 +44,7 @@ class CouponService extends CustomerService throw new \Exception("{$formDatas['clientinfo_uid']}에 대한 고객정보를 찾을수 없습니다."); } $cnt = intval($formDatas['cnt']); - if ($formDatas['status'] === CouponEntity::DEFAULT_STATUS) { //입금, 쿠폰추가 + if ($formDatas['status'] === CouponEntity::STATUS_DEPOSIT) { //입금, 쿠폰추가 $entity = $this->getClientService()->deposit($entity, 'coupon_balance', $cnt); } else { // 출금, 쿠폰사용 $entity = $this->getClientService()->withdrawal($entity, 'coupon_balance', $cnt); diff --git a/app/Services/Customer/PaymentService.php b/app/Services/Customer/PaymentService.php index ef663f2..3e61287 100644 --- a/app/Services/Customer/PaymentService.php +++ b/app/Services/Customer/PaymentService.php @@ -2,8 +2,6 @@ namespace App\Services\Customer; -use App\Entities\Customer\ServiceEntity; -use App\Entities\Customer\ServiceItemEntity; use App\Entities\Customer\PaymentEntity; use App\Models\Customer\PaymentModel; diff --git a/app/Services/Customer/PointService.php b/app/Services/Customer/PointService.php index e8442c7..ff2f984 100644 --- a/app/Services/Customer/PointService.php +++ b/app/Services/Customer/PointService.php @@ -43,7 +43,7 @@ class PointService extends CustomerService throw new \Exception("{$formDatas['clientinfo_uid']}에 대한 고객정보를 찾을수 없습니다."); } $amount = intval($formDatas['amount']); - if ($formDatas['status'] === PointEntity::DEFAULT_STATUS) { //입금, 쿠폰추가 + if ($formDatas['status'] === PointEntity::STATUS_DEPOSIT) { //입금, 쿠폰추가 $entity = $this->getClientService()->deposit($entity, 'point_balance', $amount); } else { // 출금, 쿠폰사용 $entity = $this->getClientService()->withdrawal($entity, 'point_balance', $amount); diff --git a/app/Services/Customer/ServiceService.php b/app/Services/Customer/ServiceService.php index 3a7e11a..82f13cd 100644 --- a/app/Services/Customer/ServiceService.php +++ b/app/Services/Customer/ServiceService.php @@ -136,23 +136,23 @@ class ServiceService extends CustomerService public function getFormOption(string $field, array $options = []): array { switch ($field) { - case 'partinfo_uid_CPU': - $options = $this->getServerPartService()->getFormOption('partinfo_uid_CPU'); + case 'CPU': + $options = $this->getServerPartService()->getFormOption('CPU'); break; - case 'partinfo_uid_RAM': - $options = $this->getServerPartService()->getFormOption('partinfo_uid_RAM'); + case 'RAM': + $options = $this->getServerPartService()->getFormOption('RAM'); break; - case 'partinfo_uid_DISK': - $options = $this->getServerPartService()->getFormOption('partinfo_uid_DISK'); + case 'DISK': + $options = $this->getServerPartService()->getFormOption('DISK'); break; - case 'partinfo_uid_OS': - $options = $this->getServerPartService()->getFormOption('partinfo_uid_OS'); + case 'OS': + $options = $this->getServerPartService()->getFormOption('OS'); break; - case 'partinfo_uid_DB': - $options = $this->getServerPartService()->getFormOption('partinfo_uid_DB'); + case 'DB': + $options = $this->getServerPartService()->getFormOption('DB'); break; - case 'partinfo_uid_SOFTWARE': - $options = $this->getServerPartService()->getFormOption('partinfo_uid_SOFTWARE'); + case 'SOFTWARE': + $options = $this->getServerPartService()->getFormOption('SOFTWARE'); break; case 'ipinfo_uid': //수정때문에 전체가 필요 $options = $this->getIPService()->getEntities(); diff --git a/app/Services/Equipment/ServerPartService.php b/app/Services/Equipment/ServerPartService.php index 15bf6a9..12b2fb6 100644 --- a/app/Services/Equipment/ServerPartService.php +++ b/app/Services/Equipment/ServerPartService.php @@ -18,7 +18,6 @@ class ServerPartService extends EquipmentService public function getFormFields(): array { return [ - "serviceinfo_uid", "serverinfo_uid", "type", "partinfo_uid", @@ -31,7 +30,6 @@ class ServerPartService extends EquipmentService public function getFormFilters(): array { return [ - "serviceinfo_uid", "serverinfo_uid", "type", "partinfo_uid", @@ -64,22 +62,22 @@ class ServerPartService extends EquipmentService public function getFormOption(string $field, array $options = []): array { switch ($field) { - case 'partinfo_uid_CPU': + case 'CPU': $options = $this->getPartService()->getEntities(['type' => 'CPU']); break; - case 'partinfo_uid_RAM': + case 'RAM': $options = $this->getPartService()->getEntities(['type' => 'RAM']); break; - case 'partinfo_uid_DISK': + case 'DISK': $options = $this->getPartService()->getEntities(['type' => 'DISK']); break; - case 'partinfo_uid_OS': + case 'OS': $options = $this->getPartService()->getEntities(['type' => 'OS']); break; - case 'partinfo_uid_DB': + case 'DB': $options = $this->getPartService()->getEntities(['type' => 'DB']); break; - case 'partinfo_uid_SOFTWARE': + case 'SOFTWARE': $options = $this->getPartService()->getEntities(['type' => 'SOFTWARE']); break; case 'partinfo_uid': //수정때문에 전체가 필요 @@ -91,19 +89,19 @@ class ServerPartService extends EquipmentService } return $options; } - //생성 + //서버별생성 public function createByServer(ServerEntity $serverEntity, array $formDatas): ServerPartEntity { foreach (SERVER['PARTTYPES'] as $partType) { $serverPartFormDatas = []; - $serverPartFormDatas["partinfo_uid"] = $formDatas["partinfo_uid_{$partType}"]; + $serverPartFormDatas["partinfo_uid"] = $formDatas["{$partType}"]; $serverPartFormDatas["serverinfo_uid"] = $serverEntity->getPK(); $serverPartFormDatas["serviceinfo_uid"] = $serverEntity->getServiceInfoUID(); $serverPartFormDatas["type"] = $partType; - $serverPartFormDatas["billing"] = array_key_exists("partinfo_uid_{$partType}_billing", $formDatas) ? $formDatas["partinfo_uid_{$partType}_billing"] : null; - $serverPartFormDatas["amount"] = array_key_exists("partinfo_uid_{$partType}_amount", $formDatas) ? $formDatas["partinfo_uid_{$partType}_amount"] : 0; - $serverPartFormDatas["cnt"] = array_key_exists("partinfo_uid_{$partType}_cnt", $formDatas) ? $formDatas["partinfo_uid_{$partType}_cnt"] : null; - $serverPartFormDatas["extra"] = array_key_exists("partinfo_uid_{$partType}_extra", $formDatas) ? $formDatas["partinfo_uid_{$partType}_extra"] : null; + $serverPartFormDatas["billing"] = array_key_exists("{$partType}_billing", $formDatas) ? $formDatas["{$partType}_billing"] : null; + $serverPartFormDatas["amount"] = array_key_exists("{$partType}_amount", $formDatas) ? $formDatas["{$partType}_amount"] : 0; + $serverPartFormDatas["cnt"] = array_key_exists("{$partType}_cnt", $formDatas) ? $formDatas["{$partType}_cnt"] : null; + $serverPartFormDatas["extra"] = array_key_exists("{$partType}_extra", $formDatas) ? $formDatas["{$partType}_extra"] : null; $entity = parent::create($serverPartFormDatas); //부품정보 정의 $partEntity = $this->getPartService()->getEntity($entity->getPartInfoUID()); @@ -113,7 +111,7 @@ class ServerPartService extends EquipmentService } return $entity; } - //삭제 + //서버별삭제 public function deleteByServer(ServerEntity $serverEntity): void { //기존 서벼별 부품연결정보 삭제 후 @@ -121,4 +119,18 @@ class ServerPartService extends EquipmentService $this->delete($entity); } } + //서비스연결 + public function enableService(ServerEntity $serverEntity, ServerPartEntity $entity): ServerPartEntity + { + $formDatas = []; + $formDatas["serviceinfo_uid"] = $serverEntity->getServiceInfoUID(); + return parent::modify($entity, $formDatas); + } + //서비스해지 + public function disableService(ServerPartEntity $entity): ServerPartEntity + { + $formDatas = []; + $formDatas["serviceinfo_uid"] = null; + return parent::modify($entity, $formDatas); + } } diff --git a/app/Services/Equipment/ServerService.php b/app/Services/Equipment/ServerService.php index 04c3392..6c6724a 100644 --- a/app/Services/Equipment/ServerService.php +++ b/app/Services/Equipment/ServerService.php @@ -28,13 +28,13 @@ class ServerService extends EquipmentService "manufactur_at", "format_at", "status", - "partinfo_uid_CPU", - "partinfo_uid_CPU_cnt", - "partinfo_uid_RAM", - "partinfo_uid_RAM_cnt", - "partinfo_uid_DISK", - "partinfo_uid_DISK_cnt", - "partinfo_uid_DISK_extra", + "CPU", + "CPU_cnt", + "RAM", + "RAM_cnt", + "DISK", + "DISK_cnt", + "DISK_extra", ]; } public function getFormFilters(): array @@ -44,10 +44,10 @@ class ServerService extends EquipmentService "serviceinfo_uid", "type", "title", - "partinfo_uid_CPU", - "partinfo_uid_RAM", - "partinfo_uid_DISK", - "partinfo_uid_DISK_extra", + "CPU", + "RAM", + "DISK", + "DISK_extra", "status" ]; } @@ -104,8 +104,7 @@ class ServerService extends EquipmentService { //부품연결정보 정의 foreach (SERVER['PARTTYPES'] as $partType) { - $serverPartEntity = $this->getServerPartService()->getEntity(['serverinfo_uid' => $entity->getPK(), 'type' => $partType]); - if ($serverPartEntity) { + foreach ($this->getServerPartService()->getEntities(['serverinfo_uid' => $entity->getPK(), 'type' => $partType]) as $serverPartEntity) { $entity->addServerPartEntity($partType, $serverPartEntity); } } @@ -126,23 +125,23 @@ class ServerService extends EquipmentService public function getFormOption(string $field, array $options = []): array { switch ($field) { - case 'partinfo_uid_CPU': - $options = $this->getServerPartService()->getFormOption('partinfo_uid_CPU'); + case 'CPU': + $options = $this->getServerPartService()->getFormOption('CPU'); break; - case 'partinfo_uid_RAM': - $options = $this->getServerPartService()->getFormOption('partinfo_uid_RAM'); + case 'RAM': + $options = $this->getServerPartService()->getFormOption('RAM'); break; - case 'partinfo_uid_DISK': - $options = $this->getServerPartService()->getFormOption('partinfo_uid_DISK'); + case 'DISK': + $options = $this->getServerPartService()->getFormOption('DISK'); break; - case 'partinfo_uid_OS': - $options = $this->getServerPartService()->getFormOption('partinfo_uid_OS'); + case 'OS': + $options = $this->getServerPartService()->getFormOption('OS'); break; - case 'partinfo_uid_DB': - $options = $this->getServerPartService()->getFormOption('partinfo_uid_DB'); + case 'DB': + $options = $this->getServerPartService()->getFormOption('DB'); break; - case 'partinfo_uid_SOFTWARE': - $options = $this->getServerPartService()->getFormOption('partinfo_uid_SOFTWARE'); + case 'SOFTWARE': + $options = $this->getServerPartService()->getFormOption('SOFTWARE'); break; case 'ipinfo_uid': //수정때문에 전체가 필요 $options = $this->getIPService()->getEntities(); @@ -186,18 +185,6 @@ class ServerService extends EquipmentService } return $entity; } - //수정 - public function modify(mixed $entity, array $formDatas): ServerEntity - { - $entity = parent::modify($entity, $formDatas); - //기존 ServerPart정보 삭제 - $this->getServerPartService()->deleteByServer($entity); - //신규 ServerPart정보 생성 - foreach ($this->getServerPartService()->createByServer($entity, $formDatas) as $serverPartEntity) { - $entity->addServerPartEntity($serverPartEntity->getType(), $serverPartEntity); - } - return $entity; - } //삭제 public function delete(mixed $entity): ServerEntity { @@ -220,7 +207,10 @@ class ServerService extends EquipmentService $formDatas["serviceinfo_uid"] = $serviceEntity->getPK(); $formDatas['status'] = ServerEntity::STATUS_OCCUPIED; $entity = parent::modify($entity, $formDatas); - + //ServerPart경우 서비스번호 설정 + foreach ($this->getServerPartService()->getEntities(['serverinfo_uid' => $entity->getPK()]) as $serverPartEntity) { + $this->getServerPartService()->enableService($entity, $serverPartEntity); + } //Switch경우 서비스중으로 설정 if (array_key_exists('switchinfo_uid', $formDatas)) { $switchEntity = $this->getSwitchService()->getEntity($formDatas['switchinfo_uid']); @@ -252,19 +242,21 @@ class ServerService extends EquipmentService } public function disableService(ServerEntity $entity): ServerEntity { + //ServerPart경우 서비스번호 해지 + foreach ($this->getServerPartService()->getEntities(['serverinfo_uid' => $entity->getPK()]) as $serverPartEntity) { + $this->getServerPartService()->disableService($serverPartEntity); + } //서비스 해지시 기존 Switch정보를 사용가능 상태로 변경 $switchEntity = $entity->getSwitchEntity(); if ($switchEntity !== null) { $this->getSwitchService()->disableService($switchEntity); $entity->setSwitchEntity(null); } - //서비스 해지시 기존 IP정보를 사용가능 상태로 변경 foreach ($entity->getIPEntities() as $ipEntity) { $this->getIPService()->disableService($ipEntity); } $entity->setIPEntities([]); - //서비스 해지시 기존 CS정보를 사용가능 상태로 변경 foreach ($entity->getCSEntities() as $csEntity) { $this->getCSService()->disableService($csEntity); diff --git a/app/Views/admin/popup/modify_form.php b/app/Views/admin/popup/modify_form.php new file mode 100644 index 0000000..a806e01 --- /dev/null +++ b/app/Views/admin/popup/modify_form.php @@ -0,0 +1,24 @@ +extend(LAYOUTS[$viewDatas['layout']]['path']) ?> +section('content') ?> +alert($error) ?> +
+
include("templates/{$viewDatas['layout']}/form_content_top"); ?>
+ +
+ + + + + + + +
getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?> + getFieldForm($field, old($field) ?? ($viewDatas['entity']->$field ?? null), $viewDatas) ?> + +
+
"btn btn-outline btn-primary")); ?>
+ +
+
include("templates/{$viewDatas['layout']}/form_content_bottom"); ?>
+
+endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/server/create_form.php b/app/Views/admin/server/create_form.php index cc783f7..4410328 100644 --- a/app/Views/admin/server/create_form.php +++ b/app/Views/admin/server/create_form.php @@ -28,12 +28,12 @@ - + diff --git a/app/Views/admin/server/index.php b/app/Views/admin/server/index.php index cd8fa09..c75d424 100644 --- a/app/Views/admin/server/index.php +++ b/app/Views/admin/server/index.php @@ -51,27 +51,40 @@ getStatus() === $entity::DEFAULT_STATUS ? "" : 'class="table-danger"' ?>> - - - - diff --git a/app/Views/admin/server/modify_form.php b/app/Views/admin/server/modify_form.php index 94165c6..5b5646d 100644 --- a/app/Views/admin/server/modify_form.php +++ b/app/Views/admin/server/modify_form.php @@ -6,41 +6,15 @@
getFieldLabel("partinfo_uid_{$partType}", lang("{$viewDatas['class_path']}.label.partinfo_uid_{$partType}"), $viewDatas) ?>getFieldLabel("{$partType}", lang("{$viewDatas['class_path']}.label.{$partType}"), $viewDatas) ?> - getFieldForm("partinfo_uid_{$partType}", old("partinfo_uid_{$partType}") ?? ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}"] ?? null), $viewDatas) ?> - getFieldForm("partinfo_uid_{$partType}_cnt", old("partinfo_uid_{$partType}_cnt") ?? ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}_cnt"] ?? null), $viewDatas) ?> - - getFieldForm("partinfo_uid_{$partType}_extra", old("partinfo_uid_{$partType}_extra") ?? ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}_extra"] ?? null), $viewDatas) ?> + getFieldForm("{$partType}", old("{$partType}") ?? ($viewDatas['control']['form_datas']["{$partType}"] ?? null), $viewDatas) ?> + getFieldForm("{$partType}_cnt", old("{$partType}_cnt") ?? ($viewDatas['control']['form_datas']["{$partType}_cnt"] ?? null), $viewDatas) ?> + + getFieldForm("{$partType}_extra", old("{$partType}_extra") ?? ($viewDatas['control']['form_datas']["{$partType}_extra"] ?? null), $viewDatas) ?>
getListButton('modify', '', $viewDatas) ?> +
getFieldView('clientinfo_uid', $entity->getClientInfoUID(), $viewDatas) ?>
getFieldView('serviceinfo_uid', $entity->getServiceInfoUID(), $viewDatas) ?>
+
getFieldView('type', $entity->type, $viewDatas) ?>
getFieldView('title', $entity->getTitle(), $viewDatas) ?>
+
getFieldView('price', $entity->price, $viewDatas) ?>
getFieldView('amount', $entity->amount, $viewDatas) ?>
+
getFieldView('manufactur_at', $entity->manufactur_at, $viewDatas) ?>
getFieldView('format_at', $entity->format_at, $viewDatas) ?>
getFieldView('status', $entity->status, $viewDatas) ?> -
getFieldView($partType, "", $viewDatas) ?>
-
getFieldView("ipinfo_uid", "", $viewDatas) ?>
-
getFieldView("csinfo_uid", "", $viewDatas) ?>
+ + + + + + + + + + + + + + + +
getListButton($partType, $partType, $viewDatas) ?>getFieldView($partType, "", $viewDatas) ?>
IPgetFieldView("ipinfo_uid", "", $viewDatas) ?>
CSgetFieldView("csinfo_uid", "", $viewDatas) ?>
getListButton('view', '', $viewDatas) ?>  @@ -87,7 +100,8 @@ - +
- - - - - - - - + + + + + +
서버정보추가정보
- - - - - - - -
getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?> - getFieldForm($field, old($field) ?? ($viewDatas['entity']->$field ?? null), $viewDatas) ?> - -
-
- - - - - - - -
getFieldLabel("partinfo_uid_{$partType}", lang("{$viewDatas['class_path']}.label.partinfo_uid_{$partType}"), $viewDatas) ?> - getFieldForm("partinfo_uid_{$partType}", old("partinfo_uid_{$partType}") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getPartInfoUID() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}"] ?? null)), $viewDatas) ?> - getFieldForm("partinfo_uid_{$partType}_cnt", old("partinfo_uid_{$partType}_cnt") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getCnt() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}_cnt"] ?? null)), $viewDatas) ?> - - getFieldForm("partinfo_uid_{$partType}_extra", old("partinfo_uid_{$partType}_extra") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getExtra() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}_extra"] ?? null)), $viewDatas) ?> - -
-
getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?> + getFieldForm($field, old($field) ?? ($viewDatas['entity']->$field ?? null), $viewDatas) ?> + +
"btn btn-outline btn-primary")); ?>
diff --git a/app/Views/admin/server/view.php b/app/Views/admin/server/view.php index 2796bde..59a0f5e 100644 --- a/app/Views/admin/server/view.php +++ b/app/Views/admin/server/view.php @@ -21,23 +21,25 @@ - + - + - +
getFieldLabel("partinfo_uid_{$partType}", lang("{$viewDatas['class_path']}.label.partinfo_uid_{$partType}"), $viewDatas) ?>getFieldLabel("{$partType}", lang("{$viewDatas['class_path']}.label.{$partType}"), $viewDatas) ?> - getFieldView("partinfo_uid_{$partType}", old("partinfo_uid_{$partType}") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getPartInfoUID() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}"] ?? null)), $viewDatas) ?> - getFieldView("partinfo_uid_{$partType}_cnt", old("partinfo_uid_{$partType}_cnt") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getCnt() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}_cnt"] ?? null)), $viewDatas) ?> - - getFieldView("partinfo_uid_{$partType}_extra", old("partinfo_uid_{$partType}_extra") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getExtra() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}_extra"] ?? null)), $viewDatas) ?> - + getServerPartEntities($partType) as $serverPartEntity): ?> +
+ getFieldView("{$partType}", $serverPartEntity->getPartInfoUID(), $viewDatas) ?> + getFieldView("{$partType}_cnt", $serverPartEntity->getCnt(), $viewDatas) ?> + getFieldView("{$partType}_extra", $serverPartEntity->getExtra(), $viewDatas) ?> +
+
diff --git a/app/Views/admin/service/create_form.php b/app/Views/admin/service/create_form.php index d389f27..0d856d4 100644 --- a/app/Views/admin/service/create_form.php +++ b/app/Views/admin/service/create_form.php @@ -7,40 +7,14 @@
- - - - - - + + + +
기본 서버정보기본 추가정보(서버 비용에 포함)
- - - - - - - -
getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?> - getFieldForm($field, old($field) ?? ($viewDatas['control']['form_datas'][$field] ?? null), $viewDatas) ?> - -
-
- - - - - - - -
getFieldLabel("partinfo_uid_{$partType}", lang("{$viewDatas['class_path']}.label.partinfo_uid_{$partType}"), $viewDatas) ?> - getFieldForm("partinfo_uid_{$partType}", old("partinfo_uid_{$partType}") ?? ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}"] ?? null), $viewDatas) ?> - getFieldForm("partinfo_uid_{$partType}_cnt", old("partinfo_uid_{$partType}_cnt") ?? ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}_cnt"] ?? null), $viewDatas) ?> - - getFieldForm("partinfo_uid_{$partType}_extra", old("partinfo_uid_{$partType}_extra") ?? ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}_extra"] ?? null), $viewDatas) ?> - -
-
getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?> + getFieldForm($field, old($field) ?? ($viewDatas['control']['form_datas'][$field] ?? null), $viewDatas) ?> + +
"btn btn-outline btn-primary")); ?>
diff --git a/app/Views/admin/service/index.php b/app/Views/admin/service/index.php index 81ad31b..64658f6 100644 --- a/app/Views/admin/service/index.php +++ b/app/Views/admin/service/index.php @@ -54,33 +54,46 @@ getStatus() === $entity::DEFAULT_STATUS ? "" : 'class="table-danger"' ?>> getListButton('modify', '', $viewDatas) ?> - +
getFieldView('site', $entity->site, $viewDatas) ?>
getFieldView('location', $entity->location, $viewDatas) ?>
getFieldView('switchinfo_uid', $entity->switchinfo_uid, $viewDatas) ?>
- +
getFieldView('clientinfo_uid', $entity->getClientInfoUID(), $viewDatas) ?>
getFieldView('type', $entity->type, $viewDatas) ?>
- +
getFieldView('serverinfo_uid', $entity->getServerEntity()->getTitle(), $viewDatas) ?>
getFieldView('start_at', $entity->start_at, $viewDatas) ?>
- +
getFieldView('amount', $entity->amount, $viewDatas) ?>
getFieldView('billing_at', $entity->billing_at, $viewDatas) ?>
- +
getFieldView('status', $entity->status, $viewDatas) ?>
getFieldView('updated_at', $entity->updated_at, $viewDatas) ?>
-
getFieldView($partType, "", $viewDatas) ?>
-
getFieldView("ipinfo_uid", "", $viewDatas) ?>
-
getFieldView("csinfo_uid", "", $viewDatas) ?>
+ + + + + + + + + + + + + + + +
getListButton($partType, $partType, $viewDatas) ?>getFieldView($partType, "", $viewDatas) ?>
IPgetFieldView("ipinfo_uid", "", $viewDatas) ?>
CSgetFieldView("csinfo_uid", "", $viewDatas) ?>
- +
getFieldView('user_uid', $entity->user_uid, $viewDatas) ?>
diff --git a/app/Views/admin/service/modify_form.php b/app/Views/admin/service/modify_form.php index d596707..5b5646d 100644 --- a/app/Views/admin/service/modify_form.php +++ b/app/Views/admin/service/modify_form.php @@ -6,41 +6,15 @@
- - - - - - - - + + + + + +
서버정보추가정보
- - - - - - - -
getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?> - getFieldForm($field, old($field) ?? ($viewDatas['entity']->$field ?? null), $viewDatas) ?> - -
-
- - - - - - - -
getFieldLabel("partinfo_uid_{$partType}", lang("{$viewDatas['class_path']}.label.partinfo_uid_{$partType}"), $viewDatas) ?> - getFieldForm("partinfo_uid_{$partType}", old("partinfo_uid_{$partType}") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getPartInfoUID() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}"] ?? null)), $viewDatas) ?> - getFieldForm("partinfo_uid_{$partType}_cnt", old("partinfo_uid_{$partType}_cnt") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getCnt() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}_cnt"] ?? null)), $viewDatas) ?> - - getFieldForm("partinfo_uid_{$partType}_extra", old("partinfo_uid_{$partType}_extra") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getExtra() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}_extra"] ?? null)), $viewDatas) ?> - -
-
getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?> + getFieldForm($field, old($field) ?? ($viewDatas['entity']->$field ?? null), $viewDatas) ?> + +
"btn btn-outline btn-primary")); ?>
diff --git a/app/Views/admin/service/view.php b/app/Views/admin/service/view.php index f13fd43..d978c3c 100644 --- a/app/Views/admin/service/view.php +++ b/app/Views/admin/service/view.php @@ -28,12 +28,12 @@ - +
getFieldLabel("partinfo_uid_{$partType}", lang("{$viewDatas['class_path']}.label.partinfo_uid_{$partType}"), $viewDatas) ?>getFieldLabel("{$partType}", lang("{$viewDatas['class_path']}.label.{$partType}"), $viewDatas) ?> - getFieldView("partinfo_uid_{$partType}", old("partinfo_uid_{$partType}") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getPartInfoUID() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}"] ?? null)), $viewDatas) ?> - getFieldView("partinfo_uid_{$partType}_cnt", old("partinfo_uid_{$partType}_cnt") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getCnt() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}_cnt"] ?? null)), $viewDatas) ?> + getFieldView("{$partType}", old("{$partType}") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getPartInfoUID() : ($viewDatas['control']['form_datas']["{$partType}"] ?? null)), $viewDatas) ?> + getFieldView("{$partType}_cnt", old("{$partType}_cnt") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getCnt() : ($viewDatas['control']['form_datas']["{$partType}_cnt"] ?? null)), $viewDatas) ?> - getFieldView("partinfo_uid_{$partType}_extra", old("partinfo_uid_{$partType}_extra") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getExtra() : ($viewDatas['control']['form_datas']["partinfo_uid_{$partType}_extra"] ?? null)), $viewDatas) ?> + getFieldView("{$partType}_extra", old("{$partType}_extra") ?? ($viewDatas['entity']->getServerPartEntity($partType) ? $viewDatas['entity']->getServerPartEntity($partType)->getExtra() : ($viewDatas['control']['form_datas']["{$partType}_extra"] ?? null)), $viewDatas) ?>