dbmsv2 init...1
This commit is contained in:
parent
70e1ecec06
commit
5a3b04a0e9
@ -4,22 +4,41 @@ namespace App\Cells\Equipment;
|
|||||||
|
|
||||||
|
|
||||||
use App\Services\Equipment\ServerPartService;
|
use App\Services\Equipment\ServerPartService;
|
||||||
|
use App\Services\Equipment\ServerService;
|
||||||
|
|
||||||
class ServerPartCell extends EquipmentCell
|
class ServerPartCell extends EquipmentCell
|
||||||
{
|
{
|
||||||
|
private ?ServerService $_serverService = null;
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct(new ServerPartService());
|
parent::__construct(new ServerPartService());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final public function getServerService(): ServerService
|
||||||
|
{
|
||||||
|
if (!$this->_serverService) {
|
||||||
|
$this->_serverService = new ServerService();
|
||||||
|
}
|
||||||
|
return $this->_serverService;
|
||||||
|
}
|
||||||
|
|
||||||
public function parttable(array $params): string
|
public function parttable(array $params): string
|
||||||
{
|
{
|
||||||
|
$result = "";
|
||||||
|
if (array_key_exists('serverinfo_uid', $params)) {
|
||||||
$this->getService()->setAction(__FUNCTION__);
|
$this->getService()->setAction(__FUNCTION__);
|
||||||
$this->getService()->setFormFields();
|
$this->getService()->setFormFields();
|
||||||
$this->getService()->setFormFilters();
|
$this->getService()->setFormFilters();
|
||||||
$this->getService()->setFormRules();
|
$this->getService()->setFormRules();
|
||||||
$this->getService()->setFormOptions();
|
$this->getService()->setFormOptions();
|
||||||
$serverPartEntities = $this->getService()->getEntities(['serverinfo_uid' => $params['serverinfo_uid']]);
|
// dd($params);
|
||||||
|
//서버정보
|
||||||
|
$serverEntity = $this->getServerService()->getEntity($params['serverinfo_uid']);
|
||||||
|
if (!$serverEntity) {
|
||||||
|
return "[{$params['serverinfo_uid']}]에 해당하는 서버정보가 지정되지 않았거나 존재하지 않습니다.";
|
||||||
|
}
|
||||||
|
//서버파트정보
|
||||||
|
$serverPartEntities = $this->getService()->getEntities(['serverinfo_uid' => $serverEntity->getPK(),]);
|
||||||
$entities = [];
|
$entities = [];
|
||||||
foreach ($serverPartEntities as $entity) {
|
foreach ($serverPartEntities as $entity) {
|
||||||
if (!array_key_exists($entity->getType(), $entities)) {
|
if (!array_key_exists($entity->getType(), $entities)) {
|
||||||
@ -28,14 +47,17 @@ class ServerPartCell extends EquipmentCell
|
|||||||
$entities[$entity->getType()][] = $entity;
|
$entities[$entity->getType()][] = $entity;
|
||||||
}
|
}
|
||||||
$template = array_key_exists('template', $params) ? $params['template'] : __FUNCTION__;
|
$template = array_key_exists('template', $params) ? $params['template'] : __FUNCTION__;
|
||||||
return view('cells/serverpart/' . $template, [
|
$result = view('cells/serverpart/' . $template, [
|
||||||
'serverPartCellDatas' => [
|
'serverPartCellDatas' => [
|
||||||
'control' => $this->getService()->getControlDatas(),
|
'control' => $this->getService()->getControlDatas(),
|
||||||
'service' => $this->getService(),
|
'service' => $this->getService(),
|
||||||
'entities' => $entities,
|
|
||||||
'serverinfo_uid' => $params['serverinfo_uid'],
|
'serverinfo_uid' => $params['serverinfo_uid'],
|
||||||
|
'entities' => $entities,
|
||||||
|
'serverEntity' => $serverEntity,
|
||||||
'types' => $params['types'],
|
'types' => $params['types'],
|
||||||
]
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,6 +41,7 @@ class ServiceController extends CustomerController
|
|||||||
{
|
{
|
||||||
switch ($this->getService()->getAction()) {
|
switch ($this->getService()->getAction()) {
|
||||||
case 'view':
|
case 'view':
|
||||||
|
case 'index':
|
||||||
$this->service = $this->getService();
|
$this->service = $this->getService();
|
||||||
$this->control = $this->getService()->getControlDatas();
|
$this->control = $this->getService()->getControlDatas();
|
||||||
$this->getService()->getHelper()->setViewDatas($this->getViewDatas());
|
$this->getService()->getHelper()->setViewDatas($this->getViewDatas());
|
||||||
|
|||||||
@ -68,11 +68,6 @@ class ServiceHelper extends CustomerHelper
|
|||||||
case 'clientinfo_uid':
|
case 'clientinfo_uid':
|
||||||
$value = "<a href=\"/admin/customer/client/detail/{$value}\">" . $viewDatas['control']['field_optons'][$field][$value]->getTitle() . "</a>";
|
$value = "<a href=\"/admin/customer/client/detail/{$value}\">" . $viewDatas['control']['field_optons'][$field][$value]->getTitle() . "</a>";
|
||||||
break;
|
break;
|
||||||
case 'serverinfo_uid':
|
|
||||||
$value = $viewDatas['entity']->getServerEntity()->getCode();
|
|
||||||
$value .= " /" . view_cell("\App\Cells\Equipment\ServerPartCell::parttable", ['serverinfo_uid' => $viewDatas['entity']->getServerEntity()->getPK(), 'types' => SERVERPART['SERVICE_PARTTYPES'], 'template' => 'part_service']);
|
|
||||||
$value .= "<div class=\"float-end rounded border border-primary\" onClick=\"navigator.clipboard.writeText('복사할 텍스트'); alert('복사됨!')\">COPY</div>";
|
|
||||||
break;
|
|
||||||
case 'billing_at':
|
case 'billing_at':
|
||||||
if (array_key_exists('unPaids', $viewDatas)) {
|
if (array_key_exists('unPaids', $viewDatas)) {
|
||||||
if (array_key_exists($viewDatas['entity']->getPK(), $viewDatas['unPaids'])) {
|
if (array_key_exists($viewDatas['entity']->getPK(), $viewDatas['unPaids'])) {
|
||||||
|
|||||||
@ -88,6 +88,9 @@ class ServerPartHelper extends EquipmentHelper
|
|||||||
$title = $entity->getTitle();
|
$title = $entity->getTitle();
|
||||||
$title .= $entity->getCnt() > 1 ? "*" . $entity->getCnt() . "개" : "";
|
$title .= $entity->getCnt() > 1 ? "*" . $entity->getCnt() . "개" : "";
|
||||||
$title .= $entity->getExtra() !== "" ? "/" . $entity->getExtra() : "";
|
$title .= $entity->getExtra() !== "" ? "/" . $entity->getExtra() : "";
|
||||||
|
if (array_key_exists('return_type', $extras) && $extras['return_type'] === 'text') {
|
||||||
|
$temps[] = $title;
|
||||||
|
} else {
|
||||||
$temps[] = form_label(
|
$temps[] = form_label(
|
||||||
$title,
|
$title,
|
||||||
$field,
|
$field,
|
||||||
@ -100,6 +103,7 @@ class ServerPartHelper extends EquipmentHelper
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$value = implode(",", $temps);
|
$value = implode(",", $temps);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -11,7 +11,6 @@ use App\Services\Customer\ClientService;
|
|||||||
use App\Services\Customer\ServiceService;
|
use App\Services\Customer\ServiceService;
|
||||||
use App\Services\Equipment\ServerService;
|
use App\Services\Equipment\ServerService;
|
||||||
use App\Services\UserService;
|
use App\Services\UserService;
|
||||||
use CodeIgniter\Model;
|
|
||||||
|
|
||||||
abstract class EquipmentService extends CommonService
|
abstract class EquipmentService extends CommonService
|
||||||
{
|
{
|
||||||
@ -80,7 +79,7 @@ abstract class EquipmentService extends CommonService
|
|||||||
{
|
{
|
||||||
$entity = $this->getClientService()->getEntity($uid);
|
$entity = $this->getClientService()->getEntity($uid);
|
||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
throw new \Exception("{$uid}에 해당하는 고객정보가 존재하지 않습니다. uid: {$uid}");
|
throw new \Exception("{$uid}에 해당하는 고객정보가 존재하지 않습니다.");
|
||||||
}
|
}
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,7 +73,11 @@
|
|||||||
<?= $viewDatas['service']->getHelper()->getFieldView('title', $entity->getTitle(), $viewDatas) ?>
|
<?= $viewDatas['service']->getHelper()->getFieldView('title', $entity->getTitle(), $viewDatas) ?>
|
||||||
</td>
|
</td>
|
||||||
<td nowrap>
|
<td nowrap>
|
||||||
<?= view_cell("\App\Cells\Equipment\ServerPartCell::parttable", ['serverinfo_uid' => $entity->getPK(), 'types' => SERVERPART['SERVER_PARTTYPES'], 'template' => 'part_server']) ?>
|
<?= view_cell("\App\Cells\Equipment\ServerPartCell::parttable", [
|
||||||
|
'serverinfo_uid' => $entity->getPK(),
|
||||||
|
'types' => SERVERPART['SERVER_PARTTYPES'],
|
||||||
|
'template' => 'part_server'
|
||||||
|
]) ?>
|
||||||
</td>
|
</td>
|
||||||
<td nowrap>
|
<td nowrap>
|
||||||
<?= $viewDatas['service']->getHelper()->getFieldView('price', $entity->price, $viewDatas) ?>
|
<?= $viewDatas['service']->getHelper()->getFieldView('price', $entity->price, $viewDatas) ?>
|
||||||
|
|||||||
@ -24,7 +24,10 @@
|
|||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
<td><?= view_cell("\App\Cells\Equipment\ServerPartCell::parttable", ['serverinfo_uid' => $viewDatas['entity']->getPK(), 'types' => SERVERPART['PARTTYPES']]) ?></td>>
|
<td><?= view_cell("\App\Cells\Equipment\ServerPartCell::parttable", [
|
||||||
|
'serverinfo_uid' => $viewDatas['entity']->getPK(),
|
||||||
|
'types' => SERVERPART['PARTTYPES']
|
||||||
|
]) ?></td>>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<div class="text-center"><?= form_submit('', '수정', array("class" => "btn btn-outline btn-primary")); ?></div>
|
<div class="text-center"><?= form_submit('', '수정', array("class" => "btn btn-outline btn-primary")); ?></div>
|
||||||
|
|||||||
@ -47,9 +47,8 @@
|
|||||||
<?= $viewDatas['service']->getHelper()->getListLabel('clientinfo_uid', lang("{$viewDatas['class_path']}.label.clientinfo_uid"), $viewDatas) ?>
|
<?= $viewDatas['service']->getHelper()->getListLabel('clientinfo_uid', lang("{$viewDatas['class_path']}.label.clientinfo_uid"), $viewDatas) ?>
|
||||||
</th>
|
</th>
|
||||||
<th class="index_head_short_column">
|
<th class="index_head_short_column">
|
||||||
<?= $viewDatas['service']->getHelper()->getListLabel('serverinfo_uid', lang("{$viewDatas['class_path']}.label.serverinfo_uid"), $viewDatas) ?>
|
서버정보<div class="float-end rounded border border-primary" style="cursor:pointer;" onclick="copyServerPartsToClipboard()">All COPY</div>
|
||||||
</th>
|
</th>
|
||||||
<th class="index_head_short_column">부품정보</th>
|
|
||||||
<th class="index_head_short_column">
|
<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>
|
||||||
@ -84,10 +83,11 @@
|
|||||||
<?= $viewDatas['service']->getHelper()->getFieldView('clientinfo_uid', $entity->clientinfo_uid, $viewDatas) ?>
|
<?= $viewDatas['service']->getHelper()->getFieldView('clientinfo_uid', $entity->clientinfo_uid, $viewDatas) ?>
|
||||||
</td>
|
</td>
|
||||||
<td nowrap>
|
<td nowrap>
|
||||||
<?= $viewDatas['service']->getHelper()->getFieldView('serverinfo_uid', $entity->serverinfo_uid, $viewDatas) ?>
|
<?= view_cell("\App\Cells\Equipment\ServerPartCell::parttable", [
|
||||||
</td>
|
'serverinfo_uid' => $entity->getServerEntity()->getPK(),
|
||||||
<td nowrap>
|
'types' => SERVERPART['SERVICE_PARTTYPES'],
|
||||||
<?= view_cell("\App\Cells\Equipment\ServerPartCell::parttable", ['serverinfo_uid' => $entity->getServerEntity()->getPK(), 'types' => SERVERPART['SERVICE_PARTTYPES'], 'template' => 'part_service']) ?>
|
'template' => 'part_service'
|
||||||
|
]) ?>
|
||||||
</td>
|
</td>
|
||||||
<td nowrap>
|
<td nowrap>
|
||||||
<?= $viewDatas['service']->getHelper()->getFieldView('billing_at', $entity->billing_at, $viewDatas) ?>
|
<?= $viewDatas['service']->getHelper()->getFieldView('billing_at', $entity->billing_at, $viewDatas) ?>
|
||||||
@ -120,4 +120,35 @@
|
|||||||
</table>
|
</table>
|
||||||
<!-- Layout Middle End -->
|
<!-- Layout Middle End -->
|
||||||
<div class="layout_bottom"><?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/bottom'); ?></div>
|
<div class="layout_bottom"><?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/bottom'); ?></div>
|
||||||
|
<script>
|
||||||
|
function copyServerPartToClipboard(text) {
|
||||||
|
try {
|
||||||
|
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||||
|
// HTTPS 환경
|
||||||
|
navigator.clipboard.writeText(text)
|
||||||
|
.then(() => alert(text + " 복사되었습니다."))
|
||||||
|
.catch(err => alert("실패: " + err));
|
||||||
|
} else {
|
||||||
|
// HTTP 환경 fallback
|
||||||
|
const temp = document.createElement("textarea");
|
||||||
|
temp.value = text;
|
||||||
|
document.body.appendChild(temp);
|
||||||
|
temp.select();
|
||||||
|
document.execCommand("copy");
|
||||||
|
document.body.removeChild(temp);
|
||||||
|
alert(text + " 복사되었습니다.");
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
alert("복사 실패: " + err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyServerPartsToClipboard() {
|
||||||
|
// 모든 .serverparts div에서 data-text 속성값 수집
|
||||||
|
const elements = document.querySelectorAll(".serverparts");
|
||||||
|
const texts = Array.from(elements).map(el => el.getAttribute("data-text") || "");
|
||||||
|
const combined = texts.join("\n");
|
||||||
|
copyServerPartToClipboard(combined);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -22,7 +22,10 @@
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
<td><?= view_cell("\App\Cells\Equipment\ServerPartCell::parttable", ['serverinfo_uid' => $viewDatas['entity']->getServerEntity()->getPK(), 'types' => SERVERPART['PARTTYPES']]) ?></td>
|
<td><?= view_cell("\App\Cells\Equipment\ServerPartCell::parttable", [
|
||||||
|
'serverinfo_uid' => $viewDatas['entity']->getServerEntity()->getPK(),
|
||||||
|
'types' => SERVERPART['PARTTYPES']
|
||||||
|
]) ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<div class="form_bottom"><?= $this->include("templates/{$viewDatas['layout']}/form_content_bottom"); ?></div>
|
<div class="form_bottom"><?= $this->include("templates/{$viewDatas['layout']}/form_content_bottom"); ?></div>
|
||||||
|
|||||||
@ -27,7 +27,11 @@
|
|||||||
<td><?= $viewDatas['service']->getHelper()->getFieldView('clientinfo_uid', $entity->getClientInfoUID(), $viewDatas) ?></td>
|
<td><?= $viewDatas['service']->getHelper()->getFieldView('clientinfo_uid', $entity->getClientInfoUID(), $viewDatas) ?></td>
|
||||||
<td><?= $viewDatas['service']->getHelper()->getFieldView('type', $entity->getType(), $viewDatas) ?></td>
|
<td><?= $viewDatas['service']->getHelper()->getFieldView('type', $entity->getType(), $viewDatas) ?></td>
|
||||||
<td><?= $viewDatas['service']->getHelper()->getFieldView('serveripinfo_uid', $entity->getServerEntity()->getCode(), $viewDatas) ?></td>
|
<td><?= $viewDatas['service']->getHelper()->getFieldView('serveripinfo_uid', $entity->getServerEntity()->getCode(), $viewDatas) ?></td>
|
||||||
<td><?= view_cell("\App\Cells\Equipment\ServerPartCell::parttable", ['serverinfo_uid' => $entity->getServerEntity()->getPK(), 'types' => SERVERPART['SERVICE_PARTTYPES'], 'template' => 'part_service']) ?></td>
|
<td><?= view_cell("\App\Cells\Equipment\ServerPartCell::parttable", [
|
||||||
|
'serverinfo_uid' => $entity->getServerEntity()->getPK(),
|
||||||
|
'types' => SERVERPART['SERVICE_PARTTYPES'],
|
||||||
|
'template' => 'part_service'
|
||||||
|
]) ?></td>
|
||||||
<td><?= $viewDatas['service']->getHelper()->getFieldView('user_uid', $entity->getUserUID(), $viewDatas) ?></td>
|
<td><?= $viewDatas['service']->getHelper()->getFieldView('user_uid', $entity->getUserUID(), $viewDatas) ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
|
|||||||
@ -1,5 +1,9 @@
|
|||||||
<?php $temps = [] ?>
|
<?php $htmls = $texts = [$serverPartCellDatas['serverEntity']->getCode()] ?>
|
||||||
<?php foreach (['SWITCH', 'IP', 'OS'] as $type): ?>
|
<?php foreach (['SWITCH', 'IP', 'OS'] as $type): ?>
|
||||||
<?php $temps[] = $serverPartCellDatas['service']->getHelper()->getListButton($type, '', $serverPartCellDatas) . $serverPartCellDatas['service']->getHelper()->getFieldView($type, "", $serverPartCellDatas) ?>
|
<?php $texts[] = $serverPartCellDatas['service']->getHelper()->getFieldView($type, '', $serverPartCellDatas, ['return_type' => 'text']); ?>
|
||||||
|
<?php $button = $serverPartCellDatas['service']->getHelper()->getListButton($type, '', $serverPartCellDatas) ?>
|
||||||
|
<?php $htmls[] = $button . $serverPartCellDatas['service']->getHelper()->getFieldView($type, '', $serverPartCellDatas) ?>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
<?= implode("/", $temps) ?>
|
<?= implode(" /", $htmls) ?>
|
||||||
|
<?php $text = implode('/', $texts) ?>
|
||||||
|
<div class="serverparts float-end rounded border border-primary" style="cursor:pointer;" onclick="copyServerPartToClipboard('<?= $text ?>')" text-data="<?= $text ?>">COPY</div>
|
||||||
@ -30,7 +30,11 @@
|
|||||||
<div><?= $serviceCellDatas['service']->getHelper()->getFieldView('location', $entity->getLocation(), $serviceCellDatas) ?></div>
|
<div><?= $serviceCellDatas['service']->getHelper()->getFieldView('location', $entity->getLocation(), $serviceCellDatas) ?></div>
|
||||||
<div><?= $serviceCellDatas['service']->getHelper()->getFieldView('type', $entity->getType(), $serviceCellDatas) ?></div>
|
<div><?= $serviceCellDatas['service']->getHelper()->getFieldView('type', $entity->getType(), $serviceCellDatas) ?></div>
|
||||||
</td>
|
</td>
|
||||||
<?= view_cell("\App\Cells\Equipment\ServerPartCell::parttable", ['serverinfo_uid' => $entity->getServerEntity()->getPK(), 'types' => SERVERPART['SERVICE_PARTTYPES'], 'template' => 'part_detail']) ?>
|
<?= view_cell("\App\Cells\Equipment\ServerPartCell::parttable", [
|
||||||
|
'serverinfo_uid' => $entity->getServerEntity()->getPK(),
|
||||||
|
'types' => SERVERPART['SERVICE_PARTTYPES'],
|
||||||
|
'template' => 'part_detail'
|
||||||
|
]) ?>
|
||||||
<td>
|
<td>
|
||||||
<?= form_open("/admin/customer/service/history/{$entity->getPK()}?return_url=" . urlencode(current_url()), ['method' => "post"]) ?>
|
<?= form_open("/admin/customer/service/history/{$entity->getPK()}?return_url=" . urlencode(current_url()), ['method' => "post"]) ?>
|
||||||
<div class="row align-items-center">
|
<div class="row align-items-center">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user