dbms_init...1
This commit is contained in:
parent
052f0e2145
commit
7296c0a82d
@ -36,7 +36,7 @@ abstract class CustomerController extends AdminController
|
||||
$forbidden_ips = [];
|
||||
}
|
||||
$options = [];
|
||||
foreach ($this->getService()->getEquipmentService($item_type)->getEntities() as $entity) {
|
||||
foreach ($this->getService()->getServiceItemLinkService($item_type)->getEntities() as $entity) {
|
||||
$options[$entity->getPK()] = $entity->getTitle();
|
||||
if ($item_type == 'IP') {
|
||||
if ($entity->getStatus() === IpEntity::STATUS_OCCUPIED) {
|
||||
|
||||
@ -48,12 +48,6 @@ class ServiceItemController extends CustomerController
|
||||
}
|
||||
return $this->_serviceService;
|
||||
}
|
||||
protected function initAction(string $action): void
|
||||
{
|
||||
//$item_type(CPU,RAM,STORAGE등)에 따라 선언된 getFormFieldOption용 사용됨 (initAction보다 먼저 호출해야 됨)
|
||||
$this->initServiceItemOptions();
|
||||
parent::initAction($action);
|
||||
}
|
||||
protected function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
@ -94,7 +88,7 @@ class ServiceItemController extends CustomerController
|
||||
private function createDomain(ServiceEntity $serviceEntity, array $formDatas): array
|
||||
{
|
||||
//DomainService에 먼저 create후 결과 uid를 item_uid로 전달함
|
||||
$equipmentEntity = $this->getService()->getEquipmentService($formDatas['item_type'])->create([
|
||||
$equipmentEntity = $this->getService()->getServiceItemLinkService($formDatas['item_type'])->create([
|
||||
'clientinfo_uid' => $serviceEntity->getClientUID(),
|
||||
'domain' => $formDatas['item_uid']
|
||||
]);
|
||||
|
||||
@ -156,6 +156,7 @@ class ServicePaymentController extends CustomerController
|
||||
if (!array_key_exists($entity->getPK(), $entities[$owner_pk]['services'][$serviceEntity->getPK()])) {
|
||||
$entities[$owner_pk]['services'][$serviceEntity->getPK()]['items'][] = $this->getItems($entity);
|
||||
}
|
||||
//entities에 총 결제금액 설정
|
||||
$entities[$ownerEntity->getPK()]['total_amount'] += $entity->getAmount();
|
||||
}
|
||||
// dd($entities);
|
||||
|
||||
@ -183,7 +183,7 @@ abstract class CommonController extends BaseController
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
$options = lang($this->getService()->getClassName() . '.' . strtoupper($field));
|
||||
$options = $this->getService()->getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
if (!is_array($options)) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -14,70 +14,26 @@ class ServicePaymentHelper extends CustomerHelper
|
||||
$this->setTitleField(field: ServicePaymentModel::TITLE);
|
||||
}
|
||||
|
||||
//ItemType에 따른 조건부 추가 Index Page
|
||||
public function getFieldFormByItemType(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
if (in_array($viewDatas['control']['action'], ['create', 'modify', 'create_form', 'modify_form'])) {
|
||||
$extras = (strpos($viewDatas['control']['field_rules'][$field], 'required') !== false) ? ["class" => "form-control", "required" => "", ...$extras] : ["class" => "form-control", ...$extras];
|
||||
}
|
||||
switch ($field) {
|
||||
case "LINE":
|
||||
case "IP":
|
||||
case "SERVER":
|
||||
case "CPU":
|
||||
case "RAM":
|
||||
case "STORAGE":
|
||||
case "SOFTWARE":
|
||||
case "DEFENCE":
|
||||
case "DOMAIN":
|
||||
if (!is_array($viewDatas['control']['filter_optons'][$field])) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다.");
|
||||
}
|
||||
$formOptions = ["" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택'];
|
||||
foreach ($viewDatas['control']['filter_optons'][$field] as $key => $label) {
|
||||
$formOptions[$key] = $label;
|
||||
}
|
||||
$extra_class = isset($extras['class']) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
// create, modify, create_form, modify_form 액션에서는 기본값:DEFAULTS['STATUS']을 설정
|
||||
if (in_array($viewDatas['control']['action'], ['create', 'modify', 'create_form', 'modify_form'])) {
|
||||
$value = $value ?? DEFAULTS['STATUS'];
|
||||
}
|
||||
$form = form_dropdown($field, $formOptions, $value, ['class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
|
||||
break;
|
||||
default:
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $form;
|
||||
}
|
||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
if (in_array($viewDatas['control']['action'], ['create', 'modify', 'create_form', 'modify_form'])) {
|
||||
$extras = (strpos($viewDatas['control']['field_rules'][$field], 'required') !== false) ? ["class" => "form-control", "required" => "", ...$extras] : ["class" => "form-control", ...$extras];
|
||||
}
|
||||
switch ($field) {
|
||||
case 'item_uid':
|
||||
if (array_key_exists('entity', $viewDatas)) {
|
||||
$form = $this->getFieldFormByItemType($viewDatas['entity']->getItemType(), $value, $viewDatas, $extras);
|
||||
} else {
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $form;
|
||||
}
|
||||
public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
|
||||
{
|
||||
switch ($field) {
|
||||
case "countdown": //결제일Countdown
|
||||
$value = $viewDatas['entity']->getView_CounDueAt();
|
||||
break;
|
||||
default:
|
||||
case 'item_uid':
|
||||
$value = $viewDatas['control']['filter_optons'][$viewDatas['entity']->getItemType()][$value];
|
||||
break;
|
||||
case 'amount':
|
||||
$value = number_format($value);
|
||||
break;
|
||||
case 'status':
|
||||
$value = parent::getFieldView($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
default:
|
||||
if (in_array($field, $viewDatas['control']['filter_fields'])) {
|
||||
$value = $viewDatas['control']['filter_optons'][$field][$value];
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (is_array($value)) {
|
||||
echo __METHOD__ . "에서 오류: {$field}의 값이 Array형태입니다";
|
||||
|
||||
@ -88,6 +88,18 @@ abstract class CommonService
|
||||
//기본 기능부분
|
||||
|
||||
//FieldForm관련용
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
$options = lang($this->getClassName() . '.' . strtoupper($field));
|
||||
break;
|
||||
}
|
||||
if (!is_array($options)) {
|
||||
throw new \Exception(__FUNCTION__ . "에서 field의 options 값이 array가 아닙니다.\n" . var_export($options, true));
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
public function getFormFieldRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
|
||||
@ -6,15 +6,16 @@ use App\Entities\Customer\ClientEntity;
|
||||
use App\Services\CommonService;
|
||||
|
||||
use App\Services\Customer\ClientService;
|
||||
use App\Services\Customer\ServiceItemLink\ServiceItemIpService;
|
||||
use App\Services\Equipment\DomainService;
|
||||
use App\Services\Equipment\ServerService;
|
||||
use App\Services\Equipment\Part\IpService;
|
||||
use App\Services\Equipment\Part\CpuService;
|
||||
use App\Services\Equipment\Part\DefenceService;
|
||||
use App\Services\Equipment\Part\IpService;
|
||||
use App\Services\Equipment\Part\LineService;
|
||||
use App\Services\Equipment\Part\RamService;
|
||||
use App\Services\Equipment\Part\SoftwareService;
|
||||
use App\Services\Equipment\Part\StorageService;
|
||||
use App\Services\Equipment\ServerService;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
abstract class CustomerService extends CommonService
|
||||
@ -35,7 +36,7 @@ abstract class CustomerService extends CommonService
|
||||
}
|
||||
|
||||
//ServiceItemController,ServiceController에서 사용
|
||||
final public function getEquipmentService(string $key): mixed
|
||||
final public function getServiceItemLinkService(string $key): mixed
|
||||
{
|
||||
if (!array_key_exists($key, $this->_equipmentService)) {
|
||||
switch ($key) {
|
||||
@ -55,6 +56,7 @@ abstract class CustomerService extends CommonService
|
||||
$this->_equipmentService[$key] = new LineService();
|
||||
break;
|
||||
case 'IP':
|
||||
// $this->_equipmentService[$key] = new ServiceItemIpService();
|
||||
$this->_equipmentService[$key] = new IpService();
|
||||
break;
|
||||
case 'DEFENCE':
|
||||
|
||||
@ -1,49 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Customer\ServiceItem;
|
||||
|
||||
use App\Entities\Equipment\Part\IpEntity;
|
||||
use App\Services\Equipment\Part\IpService;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class ServiceItemIpService extends ServiceItemService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
private ?IpService $_ipService = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
}
|
||||
|
||||
public function getIpService(): IpService
|
||||
{
|
||||
if (!$this->_ipService) {
|
||||
$this->_ipService = new IpService($this->request);
|
||||
}
|
||||
return $this->_ipService;
|
||||
}
|
||||
|
||||
public function create(array $formDatas, mixed $entity = null): ServiceItemEntity
|
||||
{
|
||||
//ip의 경우 서비스중으로 설정작업
|
||||
$entity = parent::create($formDatas, $entity);
|
||||
$this->getIpService()->setStatus($formDatas['code'], IpEntity::STATUS_OCCUPIED);
|
||||
}
|
||||
public function modify(mixed $entity, array $formDatas): ServiceEntity
|
||||
{
|
||||
//code가 기존과 다를경우 //toggle,batchjob의 경우 $formDatas에 code가 없을수도 있음
|
||||
if (array_key_exists('code', $formDatas) && $formDatas['code'] !== $entity->getCode()) {
|
||||
//code의 경우 기존code는 사용가능으로 설정작업
|
||||
$this->getCodeService()->setStatus($entity->getCode(), IpEntity::STATUS_AVAILABLE);
|
||||
//coded의 경우 변경된 code는 서비스중으로 설정작업
|
||||
$this->getCodeService()->setStatus($formDatas['code'], IpEntity::STATUS_OCCUPIED);
|
||||
}
|
||||
return parent::modify($entity, $formDatas);
|
||||
}
|
||||
final public function delete(mixed $entity): bool
|
||||
{
|
||||
//code의 경우 기존code는 사용가능으로 설정작업
|
||||
$this->getCodeService()->setStatus($entity->getCode(), IpEntity::STATUS_AVAILABLE);
|
||||
return parent::delete($entity);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Customer\ServiceItemLink;
|
||||
|
||||
use App\Entities\Customer\ServiceItemEntity;
|
||||
use App\Entities\Equipment\Part\IpEntity;
|
||||
use App\Services\Equipment\Part\IpService;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class ServiceItemLinkIpService extends ServiceItemLinkService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
private ?IpService $_ipService = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
}
|
||||
|
||||
public function getIpService(): IpService
|
||||
{
|
||||
if (!$this->_ipService) {
|
||||
$this->_ipService = new IpService($this->request);
|
||||
}
|
||||
return $this->_ipService;
|
||||
}
|
||||
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'clientinfo_uid':
|
||||
case 'ownerinfo_uid':
|
||||
foreach ($this->getClientService()->getEntities() as $entity) {
|
||||
$options[$entity->getPK()] = $entity->getTitle();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
public function create(array $formDatas, mixed $entity = null): ServiceItemEntity
|
||||
{
|
||||
//ip의 경우 서비스중으로 설정작업
|
||||
$this->getIpService()->setStatus($formDatas['item_uid'], IpEntity::STATUS_OCCUPIED);
|
||||
return parent::create($formDatas, $entity);;
|
||||
}
|
||||
public function modify(mixed $entity, array $formDatas): ServiceItemEntity
|
||||
{
|
||||
//item_uid가 기존과 다를경우 //toggle,batchjob의 경우 $formDatas에 item_uid가 없을수도 있음
|
||||
if (array_key_exists('item_uid', $formDatas) && $formDatas['item_uid'] !== $entity->getItemUid()) {
|
||||
//item_uid의 경우 기존item_uid는 사용가능으로 설정작업
|
||||
$this->getIpService()->setStatus($entity->getItemUid(), IpEntity::STATUS_AVAILABLE);
|
||||
//item_uidd의 경우 변경된 item_uid는 서비스중으로 설정작업
|
||||
$this->getIpService()->setStatus($formDatas['item_uid'], IpEntity::STATUS_OCCUPIED);
|
||||
}
|
||||
return parent::modify($entity, $formDatas);
|
||||
}
|
||||
public function delete(mixed $entity): bool
|
||||
{
|
||||
//item_uid의 경우 기존item_uid는 사용가능으로 설정작업
|
||||
$this->getIpService()->setStatus($entity->getItemUid(), IpEntity::STATUS_AVAILABLE);
|
||||
return parent::delete($entity);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Customer\ServiceItemLink;
|
||||
|
||||
use App\Services\Customer\ServiceItemService;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
abstract class ServiceItemLinkService extends ServiceItemService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Customer\ServiceItem;
|
||||
namespace App\Services\Customer;
|
||||
|
||||
use App\Entities\Customer\ServiceItemEntity;
|
||||
use App\Models\Customer\ServiceItemModel;
|
||||
@ -84,7 +84,7 @@ class ServiceItemService extends CustomerService
|
||||
{
|
||||
return parent::modify($entity, $formDatas);
|
||||
}
|
||||
final public function delete(mixed $entity): bool
|
||||
public function delete(mixed $entity): bool
|
||||
{
|
||||
return parent::delete($entity);
|
||||
}
|
||||
@ -2,7 +2,7 @@
|
||||
<?= $this->section('content') ?>
|
||||
<div id="container" class="content">
|
||||
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<div class="action_form" style="width:1024px;">
|
||||
<div class="action_form" style="width:600px;">
|
||||
<!-- 청구서 정보 -->
|
||||
<table class=" table table-bordered">
|
||||
<tbody>
|
||||
|
||||
32
app/Views/admin/popup/create_form.php
Normal file
32
app/Views/admin/popup/create_form.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
||||
<?= $this->section('content') ?>
|
||||
<?php if ($error = session('error')): echo $viewDatas['helper']->alert($error) ?><?php endif ?>
|
||||
<div id="container" class="content">
|
||||
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<script src="/js/<?= $viewDatas['layout'] ?>/form.js" referrerpolicy="origin"></script>
|
||||
<script src="/assets/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
|
||||
<?php foreach ($viewDatas['individualStylesheets'] as $css): ?>
|
||||
<link href="/css/<?= $viewDatas['layout'] ?>/<?= $css ?>" media="screen" rel="stylesheet" type="text/css" />
|
||||
<?php endforeach ?>
|
||||
<?php foreach ($viewDatas['individualScripts'] as $js): ?>
|
||||
<script src="/js/<?= $viewDatas['layout'] ?>/<?= $js ?>" referrerpolicy="origin"></script>
|
||||
<?php endforeach ?>
|
||||
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
|
||||
<div class=" action_form">
|
||||
<table class="table table-bordered">
|
||||
<?php foreach ($viewDatas['control']['form_fields'] as $field): ?>
|
||||
<tr>
|
||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
|
||||
<td nowrap class="text-start">
|
||||
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? isset($viewDatas[$field]) ? $viewDatas[$field] : null, $viewDatas) ?>
|
||||
<span><?= validation_show_error($field); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<div class="text-center"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></div>
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="create_bottom"><?= $this->include("templates/common/modal_create_iframe"); ?></div>
|
||||
<?= $this->endSection() ?>
|
||||
@ -53,13 +53,7 @@
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="index_batchjob">
|
||||
<ul class="nav justify-content-center">
|
||||
<li class="nav-item"><?= $viewDatas['helper']->getListButton('create', $viewDatas) ?></li>
|
||||
<li class="nav-item index_pagination"><?= $viewDatas['pagination'] ?></li>
|
||||
</ul>
|
||||
</div>
|
||||
<?= $this->include("templates/{$viewDatas['layout']}/index_content_bottom_script"); ?>
|
||||
<?= $this->include("templates/{$viewDatas['layout']}/index_content_bottom"); ?>
|
||||
<?= form_close() ?>
|
||||
</div>
|
||||
<div class="index_bottom"><?= $this->include("templates/common/" . (isset($viewDatas['modal_type']) ? $viewDatas['modal_type'] : 'modal_iframe')); ?></div>
|
||||
|
||||
@ -8,15 +8,6 @@
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/customer/client"><?= ICONS['SIGNPOST'] ?>고객정보</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/customer/account"><?= ICONS['DEPOSIT'] ?> 예치금내역</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/customer/coupon"><?= ICONS['COUPON'] ?> 쿠폰내역</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/customer/point"><?= ICONS['POINT'] ?> Point내역</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/customer/service"><?= ICONS['SERVICE'] ?> 서비스내역</a>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user