dbmsv2_init...1

This commit is contained in:
choi.jh 2025-09-26 18:21:04 +09:00
parent 20915e2557
commit d5a43012d3
15 changed files with 186 additions and 29 deletions

View File

@ -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);

View File

@ -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) {

View File

@ -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()}에 대한 서비스정보를 찾을수 없습니다.");
}

View File

@ -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
{

View File

@ -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;

View File

@ -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": {

View File

@ -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

View File

@ -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(
"<div><a href=\"/admin/customer/payment?serviceinfo_uid=%s\">미지급: <span style=\"color:red;\">%s개,총 %s원</span></a></div>",
"<div><a href=\"/admin/customer/payment?serviceinfo_uid=%s\"><span style=\"color:red;\">%s개,총 %s원</span></a></div>",
$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(

View File

@ -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",

View File

@ -43,7 +43,7 @@
<?= $viewDatas['service']->getHelper()->getListLabel('title', lang("{$viewDatas['class_path']}.label.title"), $viewDatas) ?>
</th>
<th class="index_head_short_column" style="width:900px;">
부품정보<div class="float-end rounded border border-primary" style="cursor:pointer;" onclick="copyServerPartsToClipboard()">All COPY</div>
<span class="float-start rounded border border-primary" style="cursor:pointer;" onclick="copyServerPartsToClipboard()">ALL 📋</span>부품정보
</th>
<th class="index_head_short_column">
<?= $viewDatas['service']->getHelper()->getListLabel('price', lang("{$viewDatas['class_path']}.label.price"), $viewDatas) ?>

View File

@ -0,0 +1,25 @@
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
<?= $this->section('content') ?>
<?php if ($error = session('error')): echo $viewDatas['service']->getHelper()->alert($error) ?><?php endif ?>
<div id="container" class="content">
<div class="form_top"><?= $this->include("templates/{$viewDatas['layout']}/form_content_top"); ?></div>
<?= form_open(current_url(), ['id' => 'action_form', ...$viewDatas['forms']['attributes']], $viewDatas['forms']['hiddens']) ?>
<div class="action_form">
<table class="table table-bordered">
<?php foreach ($viewDatas['control']['actionFields'] as $field): ?>
<tr>
<th nowrap class="text-end"><?= $viewDatas['service']->getHelper()->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
<td nowrap class="text-start">
<?= $viewDatas['service']->getHelper()->getFieldForm($field, old($field) ?? $viewDatas['entity']->$field ?? null, $viewDatas) ?>
<div><?= validation_show_error($field); ?></div>
</td>
</tr>
<?php endforeach; ?>
</table>
<div class="text-center"><?= form_submit("", '대체서버', ["class" => "btn btn-outline btn-primary"]) ?></div>
<?= form_close(); ?>
</div>
<div class="form_bottom"><?= $this->include("templates/{$viewDatas['layout']}/form_content_bottom"); ?></div>
</div>
<script src="/js/admin/service.js"></script>
<?= $this->endSection() ?>

View File

@ -42,13 +42,13 @@
<?= $viewDatas['service']->getHelper()->getListLabel('clientinfo_uid', lang("{$viewDatas['class_path']}.label.clientinfo_uid"), $viewDatas) ?>
</th>
<th class="index_head_short_column" style="width:650px;">
서버정보<div class="float-end rounded border border-primary" style="cursor:pointer;" onclick="copyServerPartsToClipboard()">All COPY</div>
<span class="float-start rounded border border-primary" style="cursor:pointer;" onclick="copyServerPartsToClipboard()">ALL 📋</span>서버정보
</th>
<th class="index_head_short_column">
<?= $viewDatas['service']->getHelper()->getListLabel('amount', lang("{$viewDatas['class_path']}.label.amount"), $viewDatas) ?>
</th>
<th class="index_head_short_column">
<?= $viewDatas['service']->getHelper()->getListLabel('billing_at', lang("{$viewDatas['class_path']}.label.billing_at"), $viewDatas) ?>
<?= $viewDatas['service']->getHelper()->getListLabel('billing_at', lang("{$viewDatas['class_path']}.label.billing_at"), $viewDatas) ?> / 미지급
</th>
<th class="index_head_short_column">
<?= $viewDatas['service']->getHelper()->getListLabel('status', lang("{$viewDatas['class_path']}.label.status"), $viewDatas) ?>
@ -84,6 +84,7 @@
</td>
<td nowrap><?= $viewDatas['service']->getHelper()->getFieldView('start_at', $entity->start_at, $viewDatas) ?></td>
<td nowrap>
<?= $viewDatas['service']->getHelper()->getListButton('alternative', '', $viewDatas) ?>&nbsp;
<?= $viewDatas['service']->getHelper()->getListButton('view', '', $viewDatas) ?>&nbsp;
<?= $viewDatas['service']->getHelper()->getListButton('delete', '', $viewDatas) ?>
</td>

View File

@ -14,8 +14,7 @@
<th>사이트</th>
<th>업체명</th>
<th>
장비번호 / 스위치정보 / IP정보 / CS정보
<div class="float-end rounded border border-primary" style="cursor:pointer;" onclick="copyServerPartsToClipboard()">All COPY</div>
<span class="float-start rounded border border-primary" style="cursor:pointer;" onclick="copyServerPartsToClipboard()">ALL 📋</span> 장비번호 / 스위치정보 / IP정보 / CS정보
</th>
<th>등록자</th>
</tr>

View File

@ -20,4 +20,4 @@
<?php $view_texts[] = implode(',', $texts[$type]) ?>
<?php endforeach ?>
<?php $text = implode(" / ", $view_texts) ?>
<span class="serverparts float-end rounded border border-primary" style="cursor:pointer;" onClick="copyServerPartToClipboard('<?= $text ?>')" text-data="<?= $text ?>">COPY</span>
<span class="serverparts float-start rounded border border-primary" style="cursor:pointer;" onClick="copyServerPartToClipboard('<?= $text ?>')" text-data="<?= $text ?>">📋</span>

View File

@ -19,4 +19,10 @@
<?php $view_texts[] = implode(',', $datas) ?>
<?php endforeach ?>
<?php $text = implode(" / ", $view_texts) ?>
<div class="text-nowrap"><?= implode(" / ", $view_htmls) ?><span class="serverparts float-end rounded border border-primary" style="cursor:pointer;" onClick="copyServerPartToClipboard('<?= $text ?>')" text-data="<?= $text ?>">COPY</span></div>
<div class="text-nowrap">
<?= implode(" / ", $view_htmls) ?>
<span class="serverparts float-start" style="cursor:pointer;" onClick="copyServerPartToClipboard('<?= $text ?>')" text-data="<?= $text ?>">📋</span>
<?php if ($serverPartCellDatas['serverEntity']): ?>
<a href="/admin/customer/service/main/<?= $viewDatas['serverEntity']->getServiceInfoUID() ?>?serverinfo_uid=<?= $viewDatas['serverEntity']->getPK() ?>" class="float-e"></a>
<?php endif ?>
</div>