dbmsv3 init...1

This commit is contained in:
choi.jh 2025-10-17 18:22:57 +09:00
parent c08d960bb0
commit 82e18e7516
16 changed files with 90 additions and 61 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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']]);
}
}

View File

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

View File

@ -65,7 +65,6 @@
<?= view_cell("\App\Cells\Equipment\ServerPartCell::parttable", [
'serverinfo_uid' => $serverEntity->getPK(),
'types' => SERVERPART['SERVICE_PARTTYPES'],
'serviceinfo_serverinfo_uid' => $entity->getServerEntity()->getPK(),
'template' => 'partlist_service'
]) ?>
<?php endforeach ?>

View File

@ -80,7 +80,6 @@
<?= view_cell("\App\Cells\Equipment\ServerPartCell::parttable", [
'serverinfo_uid' => $serverEntity->getPK(),
'types' => SERVERPART['SERVICE_PARTTYPES'],
'serviceinfo_serverinfo_uid' => $entity->getServerEntity()->getPK(),
'template' => 'partlist_service'
]) ?>
<?php endforeach ?>

View File

@ -27,9 +27,5 @@
<?php $text = implode("/", $view_texts) ?>
<div class="text-nowrap" style="font-size: 0.9em;">
<span class="serverparts" style="cursor:pointer;" onClick="copyServerPartToClipboard('<?= $text ?>')" text-data="<?= $text ?>">📋</span>
<?= $serverPartCellDatas['serviceinfo_serverinfo_uid'] == $serverPartCellDatas['serverEntity']->getPK() ? "📌" : "<a href=\"/admin/customer/service/changeServer/{$serverPartCellDatas['serverEntity']->getServiceInfoUID()}?serverinfo_uid={$serverPartCellDatas['serverEntity']->getPK()}\">✔️</a>" ?>
<?= implode("/", $view_htmls) ?>
<?php if ($serverPartCellDatas['serverEntity']): ?>
<a href="/admin/customer/service/terminateServer/<?= $serverPartCellDatas['serverEntity']->getServiceInfoUID() ?>?serverinfo_uid=<?= $serverPartCellDatas['serverEntity']->getPK() ?>"></a>
<?php endif ?>
</div>

View File

@ -1,46 +1,29 @@
<?php foreach ($serviceCellDatas['entities'] as $entity): ?>
<?php $serviceCellDatas['entity'] = $entity ?>
<div class="rounded border border-gray p-2 mt-3">
<table class="table table-bordered table-striped">
<tr class="text-center">
<th style="width: 120px">서비스정보</th>
<th>서버</th>
<th style="width: 600px">서비스 비고</th>
<th style="width: 200px">결제처리</th>
</tr>
<div class="rounded border border-gray p-2 mt-3">
<table class="table table-bordered table-striped">
<tr class="text-center">
<th style="width: 120px">서비스정보</th>
<th>서버</th>
<th style="width: 600px">서비스 비고</th>
<th style="width: 200px">결제처리</th>
</tr>
<?php foreach ($serviceCellDatas['entities'] as $entity): ?>
<?php $serviceCellDatas['entity'] = $entity ?>
<tr class="text-left">
<td class="text-center">
<div><?= $entity->getTitle() ?></div>
<div><?= $serviceCellDatas['service']->getHelper()->getFieldView('site', $entity->getSite(), $serviceCellDatas) ?></div>
<div><?= $serviceCellDatas['service']->getHelper()->getFieldView('location', $entity->getLocation(), $serviceCellDatas) ?></div>
<div class="mt-3"><?= $serviceCellDatas['service']->getHelper()->getListButton('addServer', '대체서버 입력', ['entity' => $entity], ['class' => 'btn btn-sm btn-primary']) ?></div>
</td>
<td class="text-center" nowrap><?= view('cells/service/server', ['serverEntities' => $serviceCellDatas['childServers'][$entity->getPK()]]) ?></td>
<td class="text-center" nowrap><?= view('cells/service/server', ['serviceEntity' => $entity, 'serverEntities' => $serviceCellDatas['childServers'][$entity->getPK()]]) ?></td>
<td class="text-center" nowrap>
<?= form_open("/admin/customer/service/history/{$entity->getPK()}?return_url=" . urlencode(current_url()), ['method' => "post"]) ?>
<textarea name="history" class="form-control note-box"><?= $entity->getHistory() ?></textarea>
<?= form_submit('', '저장', array("class" => "btn btn-outline btn-primary m-3")); ?>
<?= form_close() ?>
</td>
<td>
<table class="table m-0 p-0">
<tr>
<th class="fw-bold" nowrap>결제일</th>
<td nowrap><?= $entity->getBillingAT() ?></td>
</tr>
<tr>
<th class="fw-bold" nowrap>결제금</th>
<td class="amount-green" nowrap><?= number_format(intval($entity->getAmount())) ?>원</td>
</tr>
<tr>
<th class="fw-bold" nowrap>미납금</th>
<td class="amount-red" nowrap>
<?php if (array_key_exists($entity->getPK(), $serviceCellDatas['unPaids'])): ?>
<a href="/admin/customer/payment?clientinfo_uid=<?= $entity->getClientInfoUID() ?>&serviceinfo_uid=<?= $entity->getPK() ?>"><?= $serviceCellDatas['unPaids'][$entity->getPK()]['cnt'] ?>건/<?= number_format($serviceCellDatas['unPaids'][$entity->getPK()]['amount']) ?></a>원
<?php endif ?>
</td>
</tr>
</table>
</td>
<td><?= view('cells/service/payment', ['serviceEntity' => $entity]) ?></td>
</tr>
</table>
</div>
<?php endforeach; ?>
<?php endforeach; ?>
</table>
</div>

View File

@ -0,0 +1,21 @@
<table class="table m-0 p-0">
<tr>
<th class="fw-bold" nowrap>결제일</th>
<td nowrap><?= $serviceEntity->getBillingAT() ?></td>
</tr>
<tr>
<th class="fw-bold" nowrap>결제금</th>
<td class="amount-green" nowrap><?= number_format(intval($serviceEntity->getAmount())) ?>원</td>
</tr>
<tr>
<th class="fw-bold" nowrap>미납금</th>
<td class="amount-red" nowrap>
<?php if (array_key_exists($serviceEntity->getPK(), $serviceCellDatas['unPaids'])): ?>
<a href="/admin/customer/payment?clientinfo_uid=<?= $serviceEntity->getClientInfoUID() ?>&serviceinfo_uid=<?= $serviceEntity->getPK() ?>"><?= $serviceCellDatas['unPaids'][$serviceEntity->getPK()]['cnt'] ?>건/<?= number_format($serviceCellDatas['unPaids'][$serviceEntity->getPK()]['amount']) ?></a>원
<?php endif ?>
</td>
</tr>
<tr>
<td colspan="2" class="text-center"><?= $serviceCellDatas['service']->getHelper()->getListButton('onetime', '일회성 입력', ['entity' => $serviceEntity], ['class' => 'btn btn-sm btn-primary']) ?></td>
</tr>
</table>

View File

@ -1,8 +1,11 @@
<table class="table table-bordered table-striped">
<?php foreach ($serverEntities as $serverEntity): ?>
<tr class="text-center">
<th style="width: 250px"><?= $serviceCellDatas['serverPartHelper']->getFieldView('SERVER', "", ['serverEntity' => $serverEntity]) ?></th>
<th style="width: 250px">
<?= $serviceEntity->getServerEntity()->getPK() == $serverEntity->getPK() ? "📌" : "<a href=\"/admin/customer/service/changeServer/{$serviceEntity->getPK()}?serverinfo_uid={$serverEntity->getPK()}\">✔️</a>" ?>
<?= $serviceCellDatas['serverPartHelper']->getFieldView('SERVER', "", ['serverEntity' => $serverEntity]) ?>
<?= $serviceEntity->getServerEntity()->getPK() != $serverEntity->getPK() ? "<a href=\"/admin/customer/service/terminateServer/{$serviceEntity->getPK()}?serverinfo_uid={$serverEntity->getPK()}\">❌</a>" : "" ?>
</th>
<th style="width: 250px">
<?= $serviceCellDatas['serverPartHelper']->getListButton('CPU', 'CPU', ['serverinfo_uid' => $serverEntity->getPK()]) ?>
/ <?= $serviceCellDatas['serverPartHelper']->getListButton('RAM', 'RAM', ['serverinfo_uid' => $serverEntity->getPK()]) ?>

View File

@ -31,6 +31,8 @@ window.initFormModal = function (context) {
theme: "bootstrap-5",
tags: true,
allowClear: true,
width: '100%',
dropdownAutoWidth: true,
language: {
noResults: function () {
return "직접 입력 후 Enter"; // 사용자 안내