From d5a43012d3e4478a8cc86f66a180d8cc3ca2c27a Mon Sep 17 00:00:00 2001 From: "choi.jh" Date: Fri, 26 Sep 2025 18:21:04 +0900 Subject: [PATCH] dbmsv2_init...1 --- app/Config/Constants.php | 2 +- app/Config/Routes.php | 2 + .../Admin/Customer/PaymentController.php | 2 +- .../Admin/Customer/ServiceController.php | 70 +++++++++++++++++++ .../Admin/Equipment/ServerController.php | 1 + app/Database/dbmsv2.vuerd.json | 69 ++++++++++++++---- app/Database/dbmsv2_test1.sql | 2 +- app/Helpers/Customer/ServiceHelper.php | 16 ++++- app/Helpers/Equipment/ServerPartHelper.php | 6 +- app/Views/admin/server/index.php | 2 +- app/Views/admin/service/alternative_form.php | 25 +++++++ app/Views/admin/service/index.php | 5 +- app/Views/admin/welcome/new_service.php | 3 +- .../cells/serverpart/partlist_server.php | 2 +- .../cells/serverpart/partlist_service.php | 8 ++- 15 files changed, 186 insertions(+), 29 deletions(-) create mode 100644 app/Views/admin/service/alternative_form.php diff --git a/app/Config/Constants.php b/app/Config/Constants.php index 36523c5..e15b08d 100644 --- a/app/Config/Constants.php +++ b/app/Config/Constants.php @@ -390,7 +390,7 @@ define("STATUS", [ ]); define("STATUS_ICONS", [ 'AVAILABLE' => "", - 'NOT_AVAILABLE' => "x." + 'NOT_AVAILABLE' => "❌" ]); //List의 Page당 갯수 define('DEFAULT_LIST_PERPAGE', $_ENV['LIST_PERPAGE'] ?? $_SERVER['LIST_PERPAGE'] ?? 20); diff --git a/app/Config/Routes.php b/app/Config/Routes.php index c69b938..935f3c9 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -123,6 +123,8 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au $routes->post('batchjob', 'ServiceController::batchjob'); $routes->post('batchjob_delete', 'ServiceController::batchjob_delete'); $routes->get('download/(:alpha)', 'ServiceController::download/$1'); + $routes->get('alternative/(:num)', 'ServiceController::alternative_form/$1'); + $routes->post('alternative/(:num)', 'ServiceController::alternative/$1'); $routes->post('history/(:num)', 'ServiceController::history/$1'); }); $routes->group('payment', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) { diff --git a/app/Controllers/Admin/Customer/PaymentController.php b/app/Controllers/Admin/Customer/PaymentController.php index f1f3796..3199768 100644 --- a/app/Controllers/Admin/Customer/PaymentController.php +++ b/app/Controllers/Admin/Customer/PaymentController.php @@ -87,7 +87,7 @@ class PaymentController extends CustomerController ]; } //entities에 서비스 설정 - $serviceEntity = $this->getServiceService()->getEntity($entity->getServiceUid()); + $serviceEntity = $this->getService()->getServiceService()->getEntity($entity->getServiceUid()); if (!$serviceEntity instanceof ServiceEntity) { throw new \Exception(__METHOD__ . "에서 {$entity->getServiceUid()}에 대한 서비스정보를 찾을수 없습니다."); } diff --git a/app/Controllers/Admin/Customer/ServiceController.php b/app/Controllers/Admin/Customer/ServiceController.php index a6d4ce2..c609464 100644 --- a/app/Controllers/Admin/Customer/ServiceController.php +++ b/app/Controllers/Admin/Customer/ServiceController.php @@ -3,6 +3,7 @@ namespace App\Controllers\Admin\Customer; use App\Entities\Customer\ServiceEntity; +use App\Entities\Equipment\ServerEntity; use App\Services\Customer\ServiceService; use App\Services\Equipment\ServerService; use App\Services\PaymentService; @@ -49,8 +50,12 @@ class ServiceController extends CustomerController protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string { switch ($this->getService()->getAction()) { + case 'alternative': + $result = "대체서버 추가가 완료되었습니다."; + break; case 'create_form': case 'modify_form': + case 'alternative_form': case 'view': case 'index': $this->service = $this->getService(); @@ -94,6 +99,7 @@ class ServiceController extends CustomerController $servers[] = view_cell("\App\Cells\Equipment\ServerPartCell::parttable", [ 'serverinfo_uid' => $serverEntity->getPK(), 'types' => SERVERPART['SERVICE_PARTTYPES'], + 'serviceinfo_serverinfo_uid' => $entity->getServerEntity()->getPK(), 'template' => 'partlist_service' ]); } @@ -112,6 +118,70 @@ class ServiceController extends CustomerController $this->childServers = $childServers; return $entities; } + //대체서버선정 + public function alternative_form(mixed $uid): RedirectResponse|string + { + try { + $this->getService()->setAction(__FUNCTION__); + $this->getService()->setFormFields(['serverinfo_uid']); + //전달값정의 + $this->getService()->setFormDatas($this->request->getGet()); + $this->getService()->setFormFilters(); + $this->getService()->setFormRules(); + $this->getService()->setFormOptions(); + //기존 Entity 가져오기 + $entity = $this->getService()->getEntity($uid); + if (!$entity) { + throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다."); + } + $this->entity = $entity; + helper(['form']); + $this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []]; + return $this->getResultSuccess(); + } catch (\Exception $e) { + return $this->getResultFail($e->getMessage()); + } + } + protected function alternative_process(mixed $entity, array $formDatas): mixed + { + $serverEntity = $this->getService()->getServerService()->getEntity($formDatas['serverinfo_uid']); + if (!$serverEntity instanceof ServerEntity) { + throw new \Exception("{$formDatas['serverinfo_uid']}에 대한 서버정보를 찾을수 없습니다."); + } + $formDatas['clientinfo_uid'] = $entity->getClientInfoUID(); + $formDatas['serviceinfo_uid'] = $entity->getPK(); + $formDatas['type'] = "alternative"; + $formDatas['status'] = STATUS['OCCUPIED']; + return $this->getServerService()->modify($serverEntity, $formDatas); + } + public function alternative(int $uid): RedirectResponse|string + { + //Transaction Start + $db = \Config\Database::connect(); + $db->transStart(); + try { + $this->getService()->setAction(__FUNCTION__); + $this->getService()->setFormFields(['serverinfo_uid']); + //전달값정의 + $this->getService()->setFormDatas($this->request->getPost()); + $this->getService()->setFormFilters(); + $this->getService()->setFormRules(); + $this->doValidations(); + //기존 Entity 가져오기 + $entity = $this->getService()->getEntity($uid); + if (!$entity) { + throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다."); + } + $this->entity = $this->alternative_process($entity, $this->getService()->getFormDatas()); + $db->transCommit(); + return $this->getResultSuccess(); + } catch (\Exception $e) { + $db->transRollback(); + return $this->getResultFail($e->getMessage()); + } + } + //MAIN서버선정 + public function history(int $uid): RedirectResponse|string { diff --git a/app/Controllers/Admin/Equipment/ServerController.php b/app/Controllers/Admin/Equipment/ServerController.php index 226ff7b..dd1ca33 100644 --- a/app/Controllers/Admin/Equipment/ServerController.php +++ b/app/Controllers/Admin/Equipment/ServerController.php @@ -2,6 +2,7 @@ namespace App\Controllers\Admin\Equipment; +use App\Services\Customer\ServiceService; use App\Services\Equipment\ServerService; use CodeIgniter\HTTP\RedirectResponse; use CodeIgniter\HTTP\RequestInterface; diff --git a/app/Database/dbmsv2.vuerd.json b/app/Database/dbmsv2.vuerd.json index 04ec1b9..f4a1d0d 100644 --- a/app/Database/dbmsv2.vuerd.json +++ b/app/Database/dbmsv2.vuerd.json @@ -4,8 +4,8 @@ "settings": { "width": 3000, "height": 3000, - "scrollTop": -1049.7873, - "scrollLeft": -1469.741, + "scrollTop": -1581.7873, + "scrollLeft": -576.9398, "zoomLevel": 0.79, "show": 511, "database": 4, @@ -312,6 +312,7 @@ "gf3QFUo-9exbygXX3-0H0", "DPWDmZrk302pW-5V72rvt", "IiWPO22p9r3zajF_EcPpe", + "PPAwb_2ihp7ZvgEsqv7C4", "hmZlcR-Pw2C_ife1zzo5o", "AGBQ4FnuIDU-Dy5QoS0Fu", "bh-W1plz0vCW2rURDnfDR", @@ -335,7 +336,7 @@ "color": "" }, "meta": { - "updateAt": 1758849792568, + "updateAt": 1758872003569, "createAt": 1745819764137 } }, @@ -482,6 +483,7 @@ "sJfMcwfDgXnsZ89DVVDA2", "QznZ6PY_T3OGj3YD4GdOX", "6qd6rcTkraI_AbHcVbp6T", + "xwEgRQcc2uyxZnk2eYsCU", "0ONL4QLQRyZ32MBJ7TN7u", "e6eWKMFnpXI-rPJZ_9tBt", "2-mxsDaVU45SAAkg_CmAZ", @@ -503,7 +505,7 @@ "color": "" }, "meta": { - "updateAt": 1756961435521, + "updateAt": 1758871920002, "createAt": 1745819764138 } }, @@ -826,7 +828,6 @@ "qd1nPOkfMmY9uJDQBaaWq", "40EIkWvxwjrABx7ipC0Hp", "j21ZiY0qBmRcuzMA7ZvJ0", - "Hdq6l8tC9YLsuc-JenFpd", "yJ7WRUZyPtVG_Sh9ytED6", "J6Q1DK6nYtjbR0gheWzY6", "cvcacwm-6mn2YlVM7rpSx", @@ -855,15 +856,15 @@ "S-_BBM4Qv5LCTvGVKmQQw" ], "ui": { - "x": 1995.8626, - "y": 1900.4232, + "x": 1897.1286, + "y": 1851.0561, "zIndex": 4045, "widthName": 60, "widthComment": 201, "color": "" }, "meta": { - "updateAt": 1758849606246, + "updateAt": 1758871927001, "createAt": 1755244574868 } }, @@ -9438,6 +9439,46 @@ "updateAt": 1758849665144, "createAt": 1758849665142 } + }, + "PPAwb_2ihp7ZvgEsqv7C4": { + "id": "PPAwb_2ihp7ZvgEsqv7C4", + "tableId": "B4qGh3KZsXHQ3_4EOgwJZ", + "name": "amount", + "comment": "서비스금액", + "dataType": "INT", + "default": "0", + "options": 8, + "ui": { + "keys": 0, + "widthName": 60, + "widthComment": 62, + "widthDataType": 60, + "widthDefault": 60 + }, + "meta": { + "updateAt": 1758871870139, + "createAt": 1758871870138 + } + }, + "xwEgRQcc2uyxZnk2eYsCU": { + "id": "xwEgRQcc2uyxZnk2eYsCU", + "tableId": "ZLEpY5EjuZV21718zf-Y1", + "name": "amount", + "comment": "서비스금액", + "dataType": "INT", + "default": "0", + "options": 8, + "ui": { + "keys": 0, + "widthName": 60, + "widthComment": 62, + "widthDataType": 60, + "widthDefault": 60 + }, + "meta": { + "updateAt": 1758871910233, + "createAt": 1758871910232 + } } }, "relationshipEntities": { @@ -9880,8 +9921,8 @@ "columnIds": [ "GtBqjKsmtYWvsd0fckBc0" ], - "x": 1995.8626, - "y": 2194.4232, + "x": 1897.1286, + "y": 2127.0561, "direction": 1 }, "meta": { @@ -10104,8 +10145,8 @@ "columnIds": [ "7Tqt0jVOln16nire8AE2K" ], - "x": 2264.8626, - "y": 1900.4232, + "x": 2166.1286, + "y": 1851.0561, "direction": 4 }, "meta": { @@ -10188,8 +10229,8 @@ "columnIds": [ "q_IaRBb367b9mgGozh6jB" ], - "x": 1995.8626, - "y": 1998.4232, + "x": 1897.1286, + "y": 1943.0561, "direction": 1 }, "meta": { diff --git a/app/Database/dbmsv2_test1.sql b/app/Database/dbmsv2_test1.sql index f448206..a7cf11b 100644 --- a/app/Database/dbmsv2_test1.sql +++ b/app/Database/dbmsv2_test1.sql @@ -725,4 +725,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2025-09-26 13:04:46 +-- Dump completed on 2025-09-26 14:55:06 diff --git a/app/Helpers/Customer/ServiceHelper.php b/app/Helpers/Customer/ServiceHelper.php index dce0fb8..79ee469 100644 --- a/app/Helpers/Customer/ServiceHelper.php +++ b/app/Helpers/Customer/ServiceHelper.php @@ -3,7 +3,6 @@ namespace App\Helpers\Customer; use App\Entities\CommonEntity; -use App\Entities\Equipment\ServerEntity; use App\Models\Customer\ServiceModel; class ServiceHelper extends CustomerHelper @@ -87,7 +86,7 @@ class ServiceHelper extends CustomerHelper if (array_key_exists('unPaids', $viewDatas)) { if (array_key_exists($viewDatas['entity']->getPK(), $viewDatas['unPaids'])) { $value .= sprintf( - "
미지급: %s개,총 %s원
", + "
%s개,총 %s원
", $viewDatas['entity']->getPK(), $viewDatas['unPaids'][$viewDatas['entity']->getPK()]['cnt'], number_format($viewDatas['unPaids'][$viewDatas['entity']->getPK()]['amount']) @@ -111,6 +110,19 @@ class ServiceHelper extends CustomerHelper case 'modify': $action = parent::getListButton($action, $label, $viewDatas, $extras); break; + case 'alternative': + $extras = ["class" => "btn btn-outline btn-info btn-circle", "target" => "_self", ...$extras]; + $action = form_label( + $label ? $label : ICONS['SETUP'], + $action, + [ + "data-src" => "/admin/customer/service/alternative/{$viewDatas['entity']->getPK()}", + "data-bs-toggle" => "modal", + "data-bs-target" => "#index_action_form", + ...$extras + ] + ); + break; case 'history': $extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras]; $action = form_label( diff --git a/app/Helpers/Equipment/ServerPartHelper.php b/app/Helpers/Equipment/ServerPartHelper.php index 90a75da..d74fcf6 100644 --- a/app/Helpers/Equipment/ServerPartHelper.php +++ b/app/Helpers/Equipment/ServerPartHelper.php @@ -76,9 +76,9 @@ class ServerPartHelper extends EquipmentHelper switch ($field) { case 'SERVER': if (array_key_exists('serverEntity', $viewDatas)) { - $value = form_label( - - $value ? $value : "[" . lang("Equipment/Server.TYPE")[$viewDatas['serverEntity']->getType()] . "] " . $viewDatas['serverEntity']->getCode(), + $value = $viewDatas['serviceinfo_serverinfo_uid'] == $viewDatas['serverEntity']->getPK() ? "📌" : ""; + $value .= form_label( + "[" . lang("Equipment/Server.TYPE")[$viewDatas['serverEntity']->getType()] . "] " . $viewDatas['serverEntity']->getCode(), $field, [ "data-src" => "/admin/equipment/server/modify/{$viewDatas['serverEntity']->getPK()}?ActionTemplate=popup", diff --git a/app/Views/admin/server/index.php b/app/Views/admin/server/index.php index ae67f05..8dd669c 100644 --- a/app/Views/admin/server/index.php +++ b/app/Views/admin/server/index.php @@ -43,7 +43,7 @@ getHelper()->getListLabel('title', lang("{$viewDatas['class_path']}.label.title"), $viewDatas) ?> - 부품정보
All COPY
+ ALL 📋부품정보 getHelper()->getListLabel('price', lang("{$viewDatas['class_path']}.label.price"), $viewDatas) ?> diff --git a/app/Views/admin/service/alternative_form.php b/app/Views/admin/service/alternative_form.php new file mode 100644 index 0000000..0766fc7 --- /dev/null +++ b/app/Views/admin/service/alternative_form.php @@ -0,0 +1,25 @@ +extend(LAYOUTS[$viewDatas['layout']]['path']) ?> +section('content') ?> +getHelper()->alert($error) ?> +
+
include("templates/{$viewDatas['layout']}/form_content_top"); ?>
+ 'action_form', ...$viewDatas['forms']['attributes']], $viewDatas['forms']['hiddens']) ?> +
+ + + + + + + +
getHelper()->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?> + getHelper()->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/service/index.php b/app/Views/admin/service/index.php index 9b9fd6d..b39e36c 100644 --- a/app/Views/admin/service/index.php +++ b/app/Views/admin/service/index.php @@ -42,13 +42,13 @@ getHelper()->getListLabel('clientinfo_uid', lang("{$viewDatas['class_path']}.label.clientinfo_uid"), $viewDatas) ?> - 서버정보
All COPY
+ ALL 📋서버정보 getHelper()->getListLabel('amount', lang("{$viewDatas['class_path']}.label.amount"), $viewDatas) ?> - getHelper()->getListLabel('billing_at', lang("{$viewDatas['class_path']}.label.billing_at"), $viewDatas) ?> + getHelper()->getListLabel('billing_at', lang("{$viewDatas['class_path']}.label.billing_at"), $viewDatas) ?> / 미지급 getHelper()->getListLabel('status', lang("{$viewDatas['class_path']}.label.status"), $viewDatas) ?> @@ -84,6 +84,7 @@ getHelper()->getFieldView('start_at', $entity->start_at, $viewDatas) ?> + getHelper()->getListButton('alternative', '', $viewDatas) ?>  getHelper()->getListButton('view', '', $viewDatas) ?>  getHelper()->getListButton('delete', '', $viewDatas) ?> diff --git a/app/Views/admin/welcome/new_service.php b/app/Views/admin/welcome/new_service.php index 894440a..ea6fdac 100644 --- a/app/Views/admin/welcome/new_service.php +++ b/app/Views/admin/welcome/new_service.php @@ -14,8 +14,7 @@ 사이트 업체명 - 장비번호 / 스위치정보 / IP정보 / CS정보 -
All COPY
+ ALL 📋 장비번호 / 스위치정보 / IP정보 / CS정보 등록자 diff --git a/app/Views/cells/serverpart/partlist_server.php b/app/Views/cells/serverpart/partlist_server.php index 5b8b513..60db3e5 100644 --- a/app/Views/cells/serverpart/partlist_server.php +++ b/app/Views/cells/serverpart/partlist_server.php @@ -20,4 +20,4 @@ -COPY \ No newline at end of file +📋 \ No newline at end of file diff --git a/app/Views/cells/serverpart/partlist_service.php b/app/Views/cells/serverpart/partlist_service.php index 9a89792..55a888b 100644 --- a/app/Views/cells/serverpart/partlist_service.php +++ b/app/Views/cells/serverpart/partlist_service.php @@ -19,4 +19,10 @@ -
COPY
\ No newline at end of file +
+ + 📋 + + + +
\ No newline at end of file