From 82e18e7516efe3ec17e71295516f27edaa0bb0f1 Mon Sep 17 00:00:00 2001 From: "choi.jh" Date: Fri, 17 Oct 2025 18:22:57 +0900 Subject: [PATCH] dbmsv3 init...1 --- app/Cells/Equipment/ServerPartCell.php | 1 - app/Entities/CommonEntity.php | 4 +- app/Entities/Customer/ClientEntity.php | 4 +- app/Entities/Customer/ServiceEntity.php | 4 +- app/Entities/Equipment/ServerEntity.php | 4 +- app/Entities/Part/PartEntity.php | 4 +- app/Helpers/CommonHelper.php | 26 ++++++++-- app/Services/Customer/ServiceService.php | 2 +- app/Services/Equipment/ServerService.php | 15 ++++-- app/Views/admin/search/index.php | 1 - app/Views/admin/service/index.php | 1 - .../cells/serverpart/partlist_service.php | 4 -- app/Views/cells/service/detail.php | 51 +++++++------------ app/Views/cells/service/payment.php | 21 ++++++++ app/Views/cells/service/server.php | 7 ++- public/js/admin/form.js | 2 + 16 files changed, 90 insertions(+), 61 deletions(-) create mode 100644 app/Views/cells/service/payment.php diff --git a/app/Cells/Equipment/ServerPartCell.php b/app/Cells/Equipment/ServerPartCell.php index b51493e..15ae8ba 100644 --- a/app/Cells/Equipment/ServerPartCell.php +++ b/app/Cells/Equipment/ServerPartCell.php @@ -53,7 +53,6 @@ class ServerPartCell extends EquipmentCell 'control' => $this->getService()->getControlDatas(), 'service' => $this->getService(), 'serverinfo_uid' => $params['serverinfo_uid'], - 'serviceinfo_serverinfo_uid' => $params['serviceinfo_serverinfo_uid'] ?? 0, 'types' => $params['types'], 'serverEntity' => $serverEntity, 'entities' => $entities, diff --git a/app/Entities/CommonEntity.php b/app/Entities/CommonEntity.php index 6ba91c4..41d2c42 100644 --- a/app/Entities/CommonEntity.php +++ b/app/Entities/CommonEntity.php @@ -27,9 +27,9 @@ abstract class CommonEntity extends Entity $field = constant("static::TITLE"); return $this->attributes[$field] ?? ""; } - public function getCustomTitle(): string + public function getCustomTitle(mixed $title = null): string { - return $this->getTitle(); + return $title ? $title : $this->getTitle(); } public function getStatus(): string { diff --git a/app/Entities/Customer/ClientEntity.php b/app/Entities/Customer/ClientEntity.php index 755a3bf..1e9de6e 100644 --- a/app/Entities/Customer/ClientEntity.php +++ b/app/Entities/Customer/ClientEntity.php @@ -14,9 +14,9 @@ class ClientEntity extends CustomerEntity return $this->attributes['user_uid'] ?? null; } //기본기능 - public function getCustomTitle(string $field = ClientModel::TITLE): string + public function getCustomTitle(mixed $title = null): string { - return sprintf("%s/%s", $this->getSite(), $this->$field); + return sprintf("[%s]%s", $this->getSite(), $title ? $title : $this->getTitle()); } final public function getCode(): string { diff --git a/app/Entities/Customer/ServiceEntity.php b/app/Entities/Customer/ServiceEntity.php index 78253ab..504ab31 100644 --- a/app/Entities/Customer/ServiceEntity.php +++ b/app/Entities/Customer/ServiceEntity.php @@ -46,9 +46,9 @@ class ServiceEntity extends CustomerEntity return $this->attributes['payment_uid'] ?? null; } //기본기능용 - public function getCustomTitle(string $field = ServiceModel::TITLE): string + public function getCustomTitle(mixed $title = null): string { - return sprintf("[%s]%s", $this->getCode(), $this->$field); + return sprintf("[%s]%s", $this->getCode(), $title ? $title : $this->getServerEntity()->getIP()); } final public function getCode(): string { diff --git a/app/Entities/Equipment/ServerEntity.php b/app/Entities/Equipment/ServerEntity.php index cc8a2c4..b7eee61 100644 --- a/app/Entities/Equipment/ServerEntity.php +++ b/app/Entities/Equipment/ServerEntity.php @@ -18,9 +18,9 @@ class ServerEntity extends EquipmentEntity return $this->attributes['serviceinfo_uid'] ?? null; } //기본기능용 - public function getCustomTitle(string $field = ServerModel::TITLE): string + public function getCustomTitle(mixed $title = null): string { - return sprintf("[%s]%s", $this->getCode(), $this->$field); + return sprintf("[%s]%s", $this->getCode(), $title ? $title : $this->getIP()); } final public function getCode(): string { diff --git a/app/Entities/Part/PartEntity.php b/app/Entities/Part/PartEntity.php index 08afc34..b51531b 100644 --- a/app/Entities/Part/PartEntity.php +++ b/app/Entities/Part/PartEntity.php @@ -23,9 +23,9 @@ abstract class PartEntity extends CommonEntity return $this->attributes['serverinfo_uid']; } //기본기능용 - final public function getCustomTitle(): string + public function getCustomTitle(mixed $title = null): string { - return $this->getTitle() . " " . number_format($this->getPrice()) . "원"; + return sprintf("%s %s원", $title ? $title : $this->getTitle(), number_format($this->getPrice())); } final public function getPrice(): int { diff --git a/app/Helpers/CommonHelper.php b/app/Helpers/CommonHelper.php index adf7bbf..be5f3fc 100644 --- a/app/Helpers/CommonHelper.php +++ b/app/Helpers/CommonHelper.php @@ -258,11 +258,21 @@ class CommonHelper { switch ($field) { case 'email': - $form = form_input($field, $value ?? "", ["placeholder" => "예)test@example.com", ...$extras]); + $form = form_input($field, $value ?? "", [ + "class" => "form-control", + 'style' => 'width:100%;', + "placeholder" => "예)test@example.com", + ...$extras + ]); break; case 'mobile': case 'phone': - $form = form_input($field, $value ?? "", ["placeholder" => "예)010-0010-0010", ...$extras]); + $form = form_input($field, $value ?? "", [ + "class" => "form-control", + 'style' => 'width:100%;', + "placeholder" => "예)010-0010-0010", + ...$extras + ]); break; case 'role': if (!is_array($viewDatas['control']['field_optons'][$field])) { @@ -299,7 +309,11 @@ class CommonHelper case 'detail': case 'history': // $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' tinymce' : 'tinymce'; - $form = form_textarea($field, $value ?? "", $extras); + $form = form_textarea($field, $value ?? "", [ + "class" => "form-control", + 'style' => 'width:100%;', + ...$extras + ]); break; default: if (in_array($field, $viewDatas['control']['actionFilters'])) { @@ -308,7 +322,11 @@ class CommonHelper } $form = $this->form_dropdown_common($field, $value, $viewDatas, $extras); } else { - $form = form_input($field, $value ?? "", $extras); + $form = form_input($field, $value ?? "", [ + "class" => "form-control", + 'style' => 'width:100%;', + ...$extras + ]); } break; } diff --git a/app/Services/Customer/ServiceService.php b/app/Services/Customer/ServiceService.php index 04244b2..45f3352 100644 --- a/app/Services/Customer/ServiceService.php +++ b/app/Services/Customer/ServiceService.php @@ -308,7 +308,7 @@ class ServiceService extends CustomerService if ($entity->getServerEntity()->getPK() === $formDatas['serverinfo_uid']) { throw new \Exception(__METHOD__ . "에서 오류발생: 서비스의 메인 서버정보는 해지할 수 없습니다."); } - //대체서버해지 및 결제처리는 하지않음 + //대체서버해지 return $this->getServerService()->setService('delete', $entity, ['serverinfo_uid' => $formDatas['serverinfo_uid']]); } } diff --git a/app/Services/Equipment/ServerService.php b/app/Services/Equipment/ServerService.php index a65ae88..476f624 100644 --- a/app/Services/Equipment/ServerService.php +++ b/app/Services/Equipment/ServerService.php @@ -185,8 +185,17 @@ class ServerService extends EquipmentService implements ServiceInterface if (!array_key_exists('serverinfo_uid', $serviceFormDatas)) { throw new \Exception(__METHOD__ . "에서 {$action}오류발생: 서버가 지정되지 않았습니다."); } - $entity = $this->getEntity($serviceFormDatas['serverinfo_uid']); - if (!$entity instanceof ServerEntity) { + $selectedEntity = null; + foreach ($this->getEntities(['serviceinfo_uid' => $serviceEntity->getPK()]) as $entity) { + if ($entity->getPK() == $serviceFormDatas['serverinfo_uid']) { + if ($serviceEntity->getServerEntity()->getPK() == $entity->getPK()) { + throw new \Exception(__METHOD__ . "에서 {$action}오류발생: 서비스의 메인 서버정보는 해지할 수 없습니다."); + } + $selectedEntity = $entity; + break; + } + } + if (!$selectedEntity instanceof ServerEntity) { throw new \Exception(__METHOD__ . "에서 {$action}오류발생: 해지 할 서버정보를 찾을수 없습니다."); } $formDatas = []; @@ -194,7 +203,7 @@ class ServerService extends EquipmentService implements ServiceInterface $formDatas['serviceinfo_uid'] = null; $formDatas['format_at'] = date("Y-m-d"); $formDatas['status'] = STATUS['AVAILABLE']; - $entity = parent::modify($entity, $formDatas); + $entity = parent::modify($selectedEntity, $formDatas); //서버파트정보해지 $this->getServerPartService()->setServer('delete', $entity, []); break; diff --git a/app/Views/admin/search/index.php b/app/Views/admin/search/index.php index d2152e4..ec371a8 100644 --- a/app/Views/admin/search/index.php +++ b/app/Views/admin/search/index.php @@ -65,7 +65,6 @@ $serverEntity->getPK(), 'types' => SERVERPART['SERVICE_PARTTYPES'], - 'serviceinfo_serverinfo_uid' => $entity->getServerEntity()->getPK(), 'template' => 'partlist_service' ]) ?> diff --git a/app/Views/admin/service/index.php b/app/Views/admin/service/index.php index b6f901f..0a43944 100644 --- a/app/Views/admin/service/index.php +++ b/app/Views/admin/service/index.php @@ -80,7 +80,6 @@ $serverEntity->getPK(), 'types' => SERVERPART['SERVICE_PARTTYPES'], - 'serviceinfo_serverinfo_uid' => $entity->getServerEntity()->getPK(), 'template' => 'partlist_service' ]) ?> diff --git a/app/Views/cells/serverpart/partlist_service.php b/app/Views/cells/serverpart/partlist_service.php index 34a2297..06bcde5 100644 --- a/app/Views/cells/serverpart/partlist_service.php +++ b/app/Views/cells/serverpart/partlist_service.php @@ -27,9 +27,5 @@
📋 - getPK() ? "📌" : "getServiceInfoUID()}?serverinfo_uid={$serverPartCellDatas['serverEntity']->getPK()}\">✔️" ?> - - -
\ No newline at end of file diff --git a/app/Views/cells/service/detail.php b/app/Views/cells/service/detail.php index 260a6c7..e0a6c1c 100644 --- a/app/Views/cells/service/detail.php +++ b/app/Views/cells/service/detail.php @@ -1,46 +1,29 @@ - - -
- - - - - - - +
+
서비스정보서버서비스 비고결제처리
+ + + + + + + + - + - + -
서비스정보서버서비스 비고결제처리
+
getTitle() ?>
getHelper()->getFieldView('site', $entity->getSite(), $serviceCellDatas) ?>
getHelper()->getFieldView('location', $entity->getLocation(), $serviceCellDatas) ?>
+
getHelper()->getListButton('addServer', '대체서버 입력', ['entity' => $entity], ['class' => 'btn btn-sm btn-primary']) ?>
$serviceCellDatas['childServers'][$entity->getPK()]]) ?> $entity, 'serverEntities' => $serviceCellDatas['childServers'][$entity->getPK()]]) ?> getPK()}?return_url=" . urlencode(current_url()), ['method' => "post"]) ?> "btn btn-outline btn-primary m-3")); ?> - - - - - - - - - - - - - -
결제일getBillingAT() ?>
결제금getAmount())) ?>원
미납금 - getPK(), $serviceCellDatas['unPaids'])): ?> - 총 getPK()]['cnt'] ?>건/getPK()]['amount']) ?>원 - -
-
$entity]) ?>
-
- \ No newline at end of file + + + \ No newline at end of file diff --git a/app/Views/cells/service/payment.php b/app/Views/cells/service/payment.php new file mode 100644 index 0000000..db9419a --- /dev/null +++ b/app/Views/cells/service/payment.php @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + +
결제일getBillingAT() ?>
결제금getAmount())) ?>원
미납금 + getPK(), $serviceCellDatas['unPaids'])): ?> + 총 getPK()]['cnt'] ?>건/getPK()]['amount']) ?>원 + +
getHelper()->getListButton('onetime', '일회성 입력', ['entity' => $serviceEntity], ['class' => 'btn btn-sm btn-primary']) ?>
\ No newline at end of file diff --git a/app/Views/cells/service/server.php b/app/Views/cells/service/server.php index d9c5b6a..e2d3fbb 100644 --- a/app/Views/cells/service/server.php +++ b/app/Views/cells/service/server.php @@ -1,8 +1,11 @@ - - +
getFieldView('SERVER', "", ['serverEntity' => $serverEntity]) ?> + getServerEntity()->getPK() == $serverEntity->getPK() ? "📌" : "getPK()}?serverinfo_uid={$serverEntity->getPK()}\">✔️" ?> + getFieldView('SERVER', "", ['serverEntity' => $serverEntity]) ?> + getServerEntity()->getPK() != $serverEntity->getPK() ? "getPK()}?serverinfo_uid={$serverEntity->getPK()}\">❌" : "" ?> + getListButton('CPU', 'CPU', ['serverinfo_uid' => $serverEntity->getPK()]) ?> / getListButton('RAM', 'RAM', ['serverinfo_uid' => $serverEntity->getPK()]) ?> diff --git a/public/js/admin/form.js b/public/js/admin/form.js index 444b011..1977628 100644 --- a/public/js/admin/form.js +++ b/public/js/admin/form.js @@ -31,6 +31,8 @@ window.initFormModal = function (context) { theme: "bootstrap-5", tags: true, allowClear: true, + width: '100%', + dropdownAutoWidth: true, language: { noResults: function () { return "직접 입력 후 Enter"; // 사용자 안내