dbmsv4 init...1
This commit is contained in:
parent
bd31409d0c
commit
a7caf53c86
@ -2,9 +2,6 @@
|
||||
|
||||
namespace App\Cells\Customer;
|
||||
|
||||
use App\Helpers\Equipment\ServerPartHelper;
|
||||
use App\Services\PaymentService;
|
||||
|
||||
class ServiceCell extends CustomerCell
|
||||
{
|
||||
public function __construct()
|
||||
@ -18,12 +15,7 @@ class ServiceCell extends CustomerCell
|
||||
//서비스별 미납 Count
|
||||
$unPaids = service('paymentservice')->getUnPaids('serviceinfo_uid', ['clientinfo_uid' => $params['clientinfo_uid']]);
|
||||
//서비스별 서버리스트
|
||||
$entities = [];
|
||||
$childServers = [];
|
||||
foreach ($this->getService()->getEntities(['clientinfo_uid' => $params['clientinfo_uid']]) as $entity) {
|
||||
$entities[] = $entity;
|
||||
$childServers[$entity->getPK()] = service('equipment_serverservice')->getEntities(['serviceinfo_uid' => $entity->getPK()]);
|
||||
}
|
||||
$entities = $this->getService()->getEntities(['clientinfo_uid' => $params['clientinfo_uid']]);
|
||||
$template = array_key_exists('template', $params) ? $params['template'] : __FUNCTION__;
|
||||
return view('cells/service/' . $template, [
|
||||
'serviceCellDatas' => [
|
||||
@ -32,8 +24,6 @@ class ServiceCell extends CustomerCell
|
||||
'helper' => $this->getService()->getHelper(),
|
||||
'unPaids' => $unPaids,
|
||||
'entities' => $entities,
|
||||
'childServers' => $childServers,
|
||||
'serverPartHelper' => new ServerPartHelper(),
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Cells\Equipment;
|
||||
|
||||
use App\Helpers\Equipment\ServerPartHelper;
|
||||
use App\Services\Equipment\ServerService;
|
||||
|
||||
class ServerCell extends EquipmentCell
|
||||
@ -65,4 +66,25 @@ class ServerCell extends EquipmentCell
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
public function detail(array $params): string
|
||||
{
|
||||
$this->getService()->action_init_process(__FUNCTION__);
|
||||
if (!array_key_exists('serviceEntity', $params)) {
|
||||
return __METHOD__ . "에서 오류발생: 서비스 정보가 정의되지 않았습니다.";
|
||||
}
|
||||
$serviceEntity = $params['serviceEntity'];
|
||||
$entities = $this->getService()->getEntities(['serviceinfo_uid' => $params['serviceEntity']->getPK()]);
|
||||
$template = array_key_exists('template', $params) ? $params['template'] : __FUNCTION__;
|
||||
return view('cells/server/' . $template, [
|
||||
'serverCellDatas' => [
|
||||
'formFilters' => $this->getService()->getFormService()->getFormFilters(),
|
||||
'formOptions' => $this->getService()->getFormService()->getFormOptions(),
|
||||
'helper' => $this->getService()->getHelper(),
|
||||
'entities' => $entities,
|
||||
'serviceEntity' => $serviceEntity,
|
||||
'serverPartHelper' => new ServerPartHelper(),
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,35 +12,39 @@ class Home extends AbstractWebController
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
if ($this->service === null) {
|
||||
$this->service = service('customer_serviceservice');
|
||||
}
|
||||
$this->addActionPaths('home');
|
||||
}
|
||||
protected function action_init_process(string $action, ?object $entity = null): void
|
||||
{
|
||||
// $this->service->action_init_process($action, $entity);
|
||||
parent::action_init_process($action, $entity);
|
||||
$this->addViewDatas('layout', LAYOUTS['admin']);
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
public function welcome(): string
|
||||
{
|
||||
$action = __FUNCTION__;
|
||||
$this->action_init_process($action);
|
||||
//요청업무
|
||||
$boardRequestTaskCount = service('boardservice')->getRequestTaskCount($this->getAuthContext()->getUID());
|
||||
$this->addViewDatas('boardRequestTaskCount', service('boardservice')->getRequestTaskCount($this->getAuthContext()->getUID()));
|
||||
//Total 서버 현황
|
||||
//interval을 기준으로 최근 신규 서비스정보 가져오기
|
||||
$interval = intval($this->request->getVar('interval') ?? SERVICE['NEW_INTERVAL']);
|
||||
$newServiceEntities = service('customer_serviceservice')->getNewServiceEntities($interval);
|
||||
$newServiceCount = count($newServiceEntities);
|
||||
$this->addViewDatas('interval', $interval);
|
||||
$newServiceEntities = $this->service->getNewServiceEntities($interval);
|
||||
$this->addViewDatas('newServiceEntities', $newServiceEntities);
|
||||
$this->addViewDatas('newServiceCount', count($newServiceEntities));
|
||||
//서비스별 미납 Count
|
||||
$unPaidTotalCount = $unPaidTotalAmount = 0;
|
||||
foreach (array_values(service('paymentservice')->getUnPaids('serviceinfo_uid')) as $unPaid) {
|
||||
$unPaidTotalCount += $unPaid['cnt'];
|
||||
$unPaidTotalAmount += $unPaid['amount'];
|
||||
}
|
||||
return $this->action_render_process(
|
||||
__FUNCTION__,
|
||||
[
|
||||
'authContext' => $this->getAuthContext(),
|
||||
'layout' => 'admin',
|
||||
'boardRequestTaskCount' => $boardRequestTaskCount,
|
||||
'interval' => $interval,
|
||||
'newServiceEntities' => $newServiceEntities,
|
||||
'newServiceCount' => $newServiceCount,
|
||||
'unPaidTotalCount' => $unPaidTotalCount,
|
||||
'unPaidTotalAmount' => $unPaidTotalAmount,
|
||||
]
|
||||
);
|
||||
$this->addViewDatas('unPaidTotalCount', $unPaidTotalCount);
|
||||
$this->addViewDatas('unPaidTotalAmount', $unPaidTotalAmount);
|
||||
return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ class ServerDTO extends CommonDTO
|
||||
public ?int $uid = null;
|
||||
public ?string $code = null;
|
||||
public ?string $type = null;
|
||||
public ?string $switch = null;
|
||||
public ?int $switchinfo_uid = null;
|
||||
public ?string $ip = null;
|
||||
public ?string $os = null;
|
||||
public ?string $title = null;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -16,10 +16,14 @@ class ServerEntity extends EquipmentEntity
|
||||
{
|
||||
return $this->attributes['serviceinfo_uid'] ?? null;
|
||||
}
|
||||
final public function getSwitchInfoUID(): int|null
|
||||
{
|
||||
return $this->attributes['switchinfo_uid'] ?? null;
|
||||
}
|
||||
//기본기능용
|
||||
public function getCustomTitle(mixed $title = null): string
|
||||
{
|
||||
return sprintf("[%s]%s / %s / %s", $this->getCode(), $title ? $title : $this->getIP(), $this->getSwitch(), $this->getOS());
|
||||
return sprintf("[%s]%s / %s", $this->getCode(), $title ? $title : $this->getIP(), $this->getOS());
|
||||
}
|
||||
final public function getCode(): string
|
||||
{
|
||||
@ -33,10 +37,6 @@ class ServerEntity extends EquipmentEntity
|
||||
{
|
||||
return $this->attributes['type'];
|
||||
}
|
||||
public function getSwitch(): string|null
|
||||
{
|
||||
return $this->attributes['switch'] ?? null;
|
||||
}
|
||||
public function getIP(): string|null
|
||||
{
|
||||
return $this->attributes['ip'] ?? null;
|
||||
|
||||
@ -191,7 +191,7 @@ abstract class CommonForm
|
||||
$entities = $service->getEntities(['status' => STATUS['AVAILABLE']]);
|
||||
break;
|
||||
case 'modify_form':
|
||||
$where = sprintf("status = '%s' OR %s=%s", STATUS['AVAILABLE'], $this->getAttribute('pk_field'), $entity->$field);
|
||||
$where = sprintf("status = '%s' OR %s='%s'", STATUS['AVAILABLE'], $this->getAttribute('pk_field'), $entity->$field);
|
||||
$entities = $service->getEntities([$where => null]);
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -45,6 +45,26 @@ class ServerForm extends EquipmentForm
|
||||
}
|
||||
return $rule;
|
||||
}
|
||||
|
||||
protected function getFormOption_process($service, string $action, string $field, ?object $entity = null): array
|
||||
{
|
||||
$entities = [];
|
||||
switch ($action) {
|
||||
case 'modify_form':
|
||||
if ($field === 'ip') {
|
||||
$where = sprintf("status = '%s' OR %s='%s'", STATUS['AVAILABLE'], "ip", $entity->$field);
|
||||
$entities = $service->getEntities([$where => null]);
|
||||
} else {
|
||||
$entities = parent::getFormOption_process($service, $action, $field, $entity);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$entities = parent::getFormOption_process($service, $action, $field, $entity);
|
||||
break;
|
||||
}
|
||||
return $entities;
|
||||
}
|
||||
|
||||
public function getFormOption(string $action, string $field, ?object $entity = null, array $options = ['options' => [], 'extras' => [], 'atttributes' => []]): array
|
||||
{
|
||||
$tempOptions = ['' => lang("{$this->getAttribute('class_path')}.label.{$field}") . " 선택"];
|
||||
@ -56,15 +76,15 @@ class ServerForm extends EquipmentForm
|
||||
}
|
||||
$options['options'] = $tempOptions;
|
||||
break;
|
||||
case 'switch':
|
||||
case 'switchinfo_uid':
|
||||
foreach ($this->getFormOption_process(service('part_switchservice'), $action, $field, $entity) as $tempEntity) {
|
||||
$tempOptions[$tempEntity->getTitle()] = $tempEntity->getTitle();
|
||||
$tempOptions[$tempEntity->getPK()] = $tempEntity->getTitle();
|
||||
// $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())];
|
||||
}
|
||||
$options['options'] = $tempOptions;
|
||||
// dd($options);
|
||||
break;
|
||||
case 'ip':
|
||||
case 'ip': //key=value이 같음주의
|
||||
foreach ($this->getFormOption_process(service('part_ipservice'), $action, $field, $entity) as $tempEntity) {
|
||||
$tempOptions[$tempEntity->getTitle()] = $tempEntity->getTitle();
|
||||
// $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())];
|
||||
|
||||
@ -184,8 +184,6 @@ abstract class CommonHelper
|
||||
if (in_array($field, $viewDatas['formFilters'])) {
|
||||
if ($value) {
|
||||
if (!array_key_exists($value, $viewDatas['formOptions'][$field]['options'])) {
|
||||
echo "VALUE:{$value}";
|
||||
dd($viewDatas['formOptions'][$field]['options']);
|
||||
throw new \Exception(__METHOD__ . "에서 오류발생: {$field}에서 {$value}에 해당하는 값이 존재하지 않습니다.");
|
||||
}
|
||||
$value = !$value ? "" : $viewDatas['formOptions'][$field]['options'][$value];
|
||||
|
||||
@ -24,7 +24,6 @@ class ServiceHelper extends CustomerHelper
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$form = form_dropdown($field, $viewDatas['formOptions'][$field]['options'], $value, $extras);
|
||||
break;
|
||||
|
||||
case 'amount':
|
||||
$form = form_input($field, 0, ["readonly" => "readonly", ...$extras]);
|
||||
break;
|
||||
|
||||
@ -13,18 +13,15 @@ class ServerHelper extends EquipmentHelper
|
||||
switch ($field) {
|
||||
case 'clientinfo_uid':
|
||||
case 'serviceinfo_uid':
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
if (in_array($viewDatas['control']['action'], ['modify_form']) && $value) {
|
||||
$form = $this->getFieldView($field, $value, $viewDatas, $extras);
|
||||
$form .= form_hidden($field, (string)$value);
|
||||
}
|
||||
case 'switchinfo_uid':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$form = form_dropdown($field, $viewDatas['formOptions'][$field]['options'], $value, $extras);
|
||||
break;
|
||||
case 'manufactur_at':
|
||||
case 'format_at':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' calender' : 'calender';
|
||||
$form = form_input($field, $value ?? "", $extras);
|
||||
break;
|
||||
case 'switch':
|
||||
case 'ip':
|
||||
case 'title':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
|
||||
@ -6,7 +6,7 @@ return [
|
||||
'serviceinfo_uid' => "서비스번호",
|
||||
'code' => "장비번호",
|
||||
'type' => "형식",
|
||||
'switch' => "스위치",
|
||||
'switchinfo_uid' => "스위치",
|
||||
'ip' => "IP",
|
||||
'os' => "OS",
|
||||
'title' => "모델명",
|
||||
|
||||
@ -20,7 +20,7 @@ class ServerModel extends EquipmentModel
|
||||
"serviceinfo_uid",
|
||||
"code",
|
||||
"type",
|
||||
"switch",
|
||||
"switchinfo_uid",
|
||||
"ip",
|
||||
"os",
|
||||
"title",
|
||||
|
||||
@ -76,6 +76,8 @@ class ServiceService extends CustomerService
|
||||
$filters = [
|
||||
'site',
|
||||
'location',
|
||||
"rack",
|
||||
"line",
|
||||
'clientinfo_uid',
|
||||
'serverinfo_uid',
|
||||
'user_uid',
|
||||
|
||||
@ -59,7 +59,7 @@ class ServerService extends EquipmentService
|
||||
$fields = [
|
||||
"code",
|
||||
"type",
|
||||
"switch",
|
||||
"switchinfo_uid",
|
||||
"ip",
|
||||
"title",
|
||||
"os",
|
||||
@ -71,13 +71,13 @@ class ServerService extends EquipmentService
|
||||
"clientinfo_uid",
|
||||
'title',
|
||||
'type',
|
||||
'switch',
|
||||
'switchinfo_uid',
|
||||
'ip',
|
||||
'os',
|
||||
"status",
|
||||
];
|
||||
$indexFilter = $filters;
|
||||
$batchjobFilters = ['type', 'title', 'switch', 'ip', 'os', 'status'];
|
||||
$batchjobFilters = ['type', 'title', 'switchinfo_uid', 'ip', 'os', 'status'];
|
||||
switch ($action) {
|
||||
case 'create':
|
||||
case 'create_form':
|
||||
|
||||
@ -12,14 +12,14 @@
|
||||
</td>
|
||||
<td class="layout_right">
|
||||
<!-- Layout Right Start -->
|
||||
<?= $this->include("{$viewDatas['layout']}/welcome/banner"); ?>
|
||||
<?= $this->include("{$viewDatas['layout']['path']}/welcome/banner"); ?>
|
||||
<div class="row align-items-start mt-3">
|
||||
<div class="col-8">
|
||||
<?= $this->include("{$viewDatas['layout']}/welcome/total_service"); ?>
|
||||
<?= $this->include("{$viewDatas['layout']}/welcome/new_service"); ?>
|
||||
<?= $this->include("{$viewDatas['layout']}/welcome/stock"); ?>
|
||||
<?= $this->include("{$viewDatas['layout']['path']}/welcome/total_service"); ?>
|
||||
<?= $this->include("{$viewDatas['layout']['path']}/welcome/new_service"); ?>
|
||||
<?= $this->include("{$viewDatas['layout']['path']}/welcome/stock"); ?>
|
||||
</div>
|
||||
<div class="col-4"><?= $this->include("{$viewDatas['layout']}/welcome/mylog"); ?></div>
|
||||
<div class="col-4"><?= $this->include("{$viewDatas['layout']['path']}/welcome/mylog"); ?></div>
|
||||
</div>
|
||||
<!-- Layout Right End -->
|
||||
</td>
|
||||
|
||||
32
app/Views/cells/server/detail.php
Normal file
32
app/Views/cells/server/detail.php
Normal file
@ -0,0 +1,32 @@
|
||||
<table class="table table-bordered table-striped">
|
||||
<?php foreach ($serverCellDatas['entities'] as $entity): ?>
|
||||
<?php $serverCellDatas['entity'] = $entity ?>
|
||||
<tr class="text-center">
|
||||
<th style="width: 250px">
|
||||
<?= $serverCellDatas['serviceEntity']->getServerInfoUID() == $entity->getPK() ? "📌" : "<a href=\"/admin/customer/service/changeServer/{$serverCellDatas['serviceEntity']->getPK()}?serverinfo_uid={$entity->getPK()}\">✔️</a>" ?>
|
||||
<?= $serverCellDatas['serverPartHelper']->getFieldView('SERVER', "", ['serverEntity' => $entity]) ?>
|
||||
<?= $serverCellDatas['serviceEntity']->getServerInfoUID() != $entity->getPK() ? "<a href=\"/admin/customer/service/terminateServer/{$serverCellDatas['serviceEntity']->getPK()}?serverinfo_uid={$entity->getPK()}\">❌</a>" : "" ?>
|
||||
</th>
|
||||
<th style="width: 250px">
|
||||
<?= $serverCellDatas['serverPartHelper']->getListButton('CPU', 'CPU', ['serverinfo_uid' => $entity->getPK()]) ?>
|
||||
/ <?= $serverCellDatas['serverPartHelper']->getListButton('RAM', 'RAM', ['serverinfo_uid' => $entity->getPK()]) ?>
|
||||
/ <?= $serverCellDatas['serverPartHelper']->getListButton('DISK', 'DISK', ['serverinfo_uid' => $entity->getPK()]) ?>
|
||||
</th>
|
||||
<th style="width: 200px"><?= $serverCellDatas['serverPartHelper']->getListButton('IP', '추가IP', ['serverinfo_uid' => $entity->getPK()]) ?></th>
|
||||
<th style="width: 200px"><?= $serverCellDatas['serverPartHelper']->getListButton('CS', 'CS', ['serverinfo_uid' => $entity->getPK()]) ?></th>
|
||||
</tr>
|
||||
<tr class="text-center">
|
||||
<td nowrap>
|
||||
<div><?= $serverCellDatas['helper']->getFieldView('switchinfo_uid', $entity->getSwitchInfoUID(), $serverCellDatas) ?></div>
|
||||
<div><?= $entity->getTitle() ?></div>
|
||||
<div><?= $entity->getIP() ?></div>
|
||||
<div><?= $entity->getOS() ?></div>
|
||||
</td>
|
||||
<?= view_cell("\App\Cells\Equipment\ServerPartCell::parttable", [
|
||||
'serverinfo_uid' => $entity->getPK(),
|
||||
'types' => SERVERPART['ALL_PARTTYPES'],
|
||||
'template' => 'detail'
|
||||
]) ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
@ -16,7 +16,7 @@
|
||||
<div><?= $serviceCellDatas['helper']->getFieldView('location', $entity->getLocation(), $serviceCellDatas) ?></div>
|
||||
<div class="mt-3"><?= $serviceCellDatas['helper']->getListButton('addServer', '대체서버추가', ['entity' => $entity], ['class' => 'btn btn-sm btn-primary']) ?></div>
|
||||
</td>
|
||||
<td class="text-center" nowrap><?= view('cells/service/server', ['serviceEntity' => $entity, 'serverEntities' => $serviceCellDatas['childServers'][$entity->getPK()]]) ?></td>
|
||||
<td class="text-center" nowrap><?= view_cell("\App\Cells\Equipment\ServerCell::detail", ['serviceEntity' => $entity]) ?></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>
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
<table class="table table-bordered table-striped">
|
||||
<?php foreach ($serverEntities as $serverEntity): ?>
|
||||
<tr class="text-center">
|
||||
<th style="width: 250px">
|
||||
<?= $serviceEntity->getServerInfoUID() == $serverEntity->getPK() ? "📌" : "<a href=\"/admin/customer/service/changeServer/{$serviceEntity->getPK()}?serverinfo_uid={$serverEntity->getPK()}\">✔️</a>" ?>
|
||||
<?= $serviceCellDatas['serverPartHelper']->getFieldView('SERVER', "", ['serverEntity' => $serverEntity]) ?>
|
||||
<?= $serviceEntity->getServerInfoUID() != $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()]) ?>
|
||||
/ <?= $serviceCellDatas['serverPartHelper']->getListButton('DISK', 'DISK', ['serverinfo_uid' => $serverEntity->getPK()]) ?>
|
||||
</th>
|
||||
<th style="width: 200px"><?= $serviceCellDatas['serverPartHelper']->getListButton('IP', '추가IP', ['serverinfo_uid' => $serverEntity->getPK()]) ?></th>
|
||||
<th style="width: 200px"><?= $serviceCellDatas['serverPartHelper']->getListButton('CS', 'CS', ['serverinfo_uid' => $serverEntity->getPK()]) ?></th>
|
||||
</tr>
|
||||
<tr class="text-center">
|
||||
<td nowrap>
|
||||
<div><?= $serverEntity->getTitle() ?></div>
|
||||
<div><?= $serverEntity->getIP() ?></div>
|
||||
<div><?= $serverEntity->getOS() ?></div>
|
||||
</td>
|
||||
<?= view_cell("\App\Cells\Equipment\ServerPartCell::parttable", [
|
||||
'serverinfo_uid' => $serverEntity->getPK(),
|
||||
'types' => SERVERPART['ALL_PARTTYPES'],
|
||||
'template' => 'partlist_detail'
|
||||
]) ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
Loading…
Reference in New Issue
Block a user