dbms_init...1
This commit is contained in:
parent
88571ab237
commit
5323b7c678
@ -3,7 +3,6 @@
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
|
||||
use App\Controllers\Admin\AdminController;
|
||||
use App\Entities\Equipment\Part\IpEntity;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
@ -16,4 +15,15 @@ abstract class CustomerController extends AdminController
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
|
||||
//Service,ServicePaymentController사용
|
||||
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
||||
final protected function setFilterOptionsByItemType(): void
|
||||
{
|
||||
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
||||
$options = $this->getService()->getServiceItemLinkService($item_type)->getEntities();
|
||||
$this->setFilterFieldOption($item_type, $options);
|
||||
}
|
||||
// dd($this->getFilterFieldOptions());
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,18 +2,21 @@
|
||||
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Helpers\Customer\ServiceHelper;
|
||||
use App\Services\Customer\ServiceItemService;
|
||||
use App\Services\Customer\ServiceService;
|
||||
|
||||
use App\Services\Equipment\CodeService;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Customer\ServiceHelper;
|
||||
use App\Services\Customer\ServiceService;
|
||||
use App\Services\Equipment\CodeService;
|
||||
|
||||
class ServiceController extends CustomerController
|
||||
{
|
||||
private ?CodeService $_codeService = null;
|
||||
private ?ServiceItemService $_serviceItemService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
@ -44,10 +47,18 @@ class ServiceController extends CustomerController
|
||||
}
|
||||
return $this->_codeService;
|
||||
}
|
||||
public function getServiceItemService(): ServiceItemService
|
||||
{
|
||||
if (!$this->_serviceItemService) {
|
||||
$this->_serviceItemService = new ServiceItemService($this->request);
|
||||
}
|
||||
return $this->_serviceItemService;
|
||||
}
|
||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
{
|
||||
switch ($this->getAction()) {
|
||||
case 'index':
|
||||
case 'view':
|
||||
$result = parent::getResultSuccess($message, $this->request->getVar('ActionTemplate') ?? $actionTemplate ?? 'service');
|
||||
break;
|
||||
default:
|
||||
@ -56,7 +67,27 @@ class ServiceController extends CustomerController
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
|
||||
//Service마다 ItemEntities 설정용
|
||||
private function setItemEntitiesByService(ServiceEntity $entity): ServiceEntity
|
||||
{
|
||||
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
||||
$entity->setItemEntities(
|
||||
$item_type,
|
||||
$this->getServiceItemService()->getEntities(['serviceinfo_uid' => $entity->getPK(), 'item_type' => $item_type])
|
||||
);
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
//View 관련
|
||||
protected function view_process(mixed $entity): mixed
|
||||
{
|
||||
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
||||
$this->setFilterOptionsByItemType();
|
||||
return $this->setItemEntitiesByService($entity);
|
||||
}
|
||||
//List 관련
|
||||
protected function setWordConditionForList(): void
|
||||
{
|
||||
$this->word = $this->request->getVar('word');
|
||||
@ -68,15 +99,14 @@ class ServiceController extends CustomerController
|
||||
}
|
||||
}
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
protected function index_process(): array
|
||||
{
|
||||
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
||||
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
||||
$options = $this->getService()->getServiceItemLinkService($item_type)->getEntities();
|
||||
$this->setFilterFieldOption($item_type, $options);
|
||||
$this->setFilterOptionsByItemType();
|
||||
$entities = [];
|
||||
foreach (parent::index_process() as $entity) {
|
||||
$entities[$entity->getPK()] = $this->setItemEntitiesByService($entity);
|
||||
}
|
||||
// dd($this->getFilterFieldOptions());
|
||||
return parent::index_process();
|
||||
return $entities;
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,26 +81,27 @@ class ServicePaymentController extends CustomerController
|
||||
return $result;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
//View 관련
|
||||
protected function view_process(mixed $entity): mixed
|
||||
{
|
||||
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
||||
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
||||
$options = $this->getService()->getServiceItemLinkService($item_type)->getEntities();
|
||||
$this->setFilterFieldOption($item_type, $options);
|
||||
}
|
||||
// dd($this->getFilterFieldOptions());
|
||||
$this->setFilterOptionsByItemType();
|
||||
return parent::view_process($entity);
|
||||
}
|
||||
//List 관련
|
||||
protected function setOrderByForList(): void
|
||||
{
|
||||
//OrderBy 처리
|
||||
$this->getService()->getModel()->orderBy('billing_at', 'ASC', false);
|
||||
parent::setOrderByForList();
|
||||
}
|
||||
protected function index_process(): array
|
||||
{
|
||||
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
||||
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
||||
$options = $this->getService()->getServiceItemLinkService($item_type)->getEntities();
|
||||
$this->setFilterFieldOption($item_type, $options);
|
||||
}
|
||||
// dd($this->getFilterFieldOptions());
|
||||
$this->setFilterOptionsByItemType();
|
||||
return parent::index_process();
|
||||
}
|
||||
//Invoice 관련
|
||||
private function getOwnersForInvoice(ClientEntity $ownerEntity): array
|
||||
{
|
||||
$temps = [
|
||||
|
||||
@ -45,7 +45,7 @@ class IpController extends PartController
|
||||
return $this->_lineService;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
protected function setOrderByForList()
|
||||
protected function setOrderByForList(): void
|
||||
{
|
||||
//OrderBy 처리
|
||||
$this->getService()->getModel()->orderBy('INET_ATON(ip)', 'ASC', false);
|
||||
|
||||
@ -35,6 +35,18 @@ class ServerController extends EquipmentController
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
//View부분
|
||||
protected function view_process(mixed $entity): mixed
|
||||
{
|
||||
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
||||
$entity->setItemEntities(
|
||||
$item_type,
|
||||
$this->getService()->getEntities(['serviceinfo_uid' => $entity->getPK(), 'item_type' => $item_type])
|
||||
);
|
||||
}
|
||||
return parent::view_process($entity);
|
||||
}
|
||||
//List부분
|
||||
protected function setOrderByForList(): void
|
||||
{
|
||||
//OrderBy 처리
|
||||
|
||||
@ -55,7 +55,7 @@ class Payment extends BaseController
|
||||
foreach ($this->getServiceItemService()->getEntities(['serviceinfo_uid' => $serviceEntity->getPK()]) as $itemEntity) {
|
||||
//결제정보 ServicePaymentService에 월별 결제만 신규등록
|
||||
if ($itemEntity->getBillingCycle() == "month") {
|
||||
$this->getServicePaymentService()->createPaymentByServiceItem($itemEntity);
|
||||
$this->getServicePaymentService()->createByServiceItem($itemEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -612,7 +612,7 @@ abstract class CommonController extends BaseController
|
||||
}
|
||||
}
|
||||
//OrderBy 처리
|
||||
protected function setOrderByForList()
|
||||
protected function setOrderByForList(): void
|
||||
{
|
||||
$this->order_field = $this->request->getVar('order_field');
|
||||
$this->order_value = $this->request->getVar('order_value');
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -4,13 +4,13 @@
|
||||
"settings": {
|
||||
"width": 3000,
|
||||
"height": 3000,
|
||||
"scrollTop": -876.1692,
|
||||
"scrollLeft": -874.0376,
|
||||
"zoomLevel": 0.73,
|
||||
"scrollTop": -1193.6655,
|
||||
"scrollLeft": -1398.9278,
|
||||
"zoomLevel": 0.16,
|
||||
"show": 511,
|
||||
"database": 4,
|
||||
"databaseName": "",
|
||||
"canvasType": "@dineug/erd-editor/builtin-schema-sql",
|
||||
"canvasType": "ERD",
|
||||
"language": 1,
|
||||
"tableNameCase": 4,
|
||||
"columnNameCase": 2,
|
||||
|
||||
@ -362,7 +362,7 @@ class CommonHelper
|
||||
// echo current_url() . '/' . $action . '?' . $this->getRequest()->getUri()->getQuery();
|
||||
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
|
||||
$action = form_label(
|
||||
ICONS['ADD'],
|
||||
array_key_exists('label', $extras) ? $extras['label'] : ICONS['ADD'],
|
||||
$action,
|
||||
[
|
||||
"data-src" => current_url() . '/' . $action . '?' . $this->getRequest()->getUri()->getQuery(),
|
||||
@ -396,7 +396,7 @@ class CommonHelper
|
||||
case 'view':
|
||||
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
|
||||
$action = form_label(
|
||||
ICONS['SEARCH'],
|
||||
array_key_exists('label', $extras) ? $extras['label'] : ICONS['SEARCH'],
|
||||
$action,
|
||||
[
|
||||
"data-src" => current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK(),
|
||||
@ -410,7 +410,7 @@ class CommonHelper
|
||||
$extras = ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self", ...$extras];
|
||||
$action = anchor(
|
||||
current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK(),
|
||||
ICONS['DELETE'],
|
||||
array_key_exists('label', $extras) ? $extras['label'] : ICONS['DELETE'],
|
||||
$extras
|
||||
);
|
||||
break;
|
||||
|
||||
@ -61,4 +61,26 @@ class HomeHelper extends CommonHelper
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
public function getListButton(string $action, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($action) {
|
||||
case 'new_service_view':
|
||||
$extras = ["class" => "btn btn-outline btn-light btn-circle", "target" => "_self", ...$extras];
|
||||
$action = form_label(
|
||||
array_key_exists('label', $extras) ? $extras['label'] : ICONS['SEARCH'],
|
||||
$action,
|
||||
[
|
||||
"data-src" => '/admin/customer/service/view/' . $viewDatas['entity']->getPK(),
|
||||
"data-bs-toggle" => "modal",
|
||||
"data-bs-target" => "#index_action_form",
|
||||
...$extras
|
||||
]
|
||||
);
|
||||
break;
|
||||
default:
|
||||
$action = parent::getListButton($action, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $action;
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ abstract class CommonService
|
||||
}
|
||||
return $this->_model;
|
||||
}
|
||||
public function getEntity(mixed $where, ?string $message = null): mixed
|
||||
final public function getEntity(mixed $where, ?string $message = null): mixed
|
||||
{
|
||||
$entity = is_array($where) ? $this->getModel()->where($where)->first() : $this->getModel()->find($where);
|
||||
if (!$entity) {
|
||||
@ -70,7 +70,7 @@ abstract class CommonService
|
||||
{
|
||||
return $this->getModel()->select(implode(',', $columns))->findAll();
|
||||
}
|
||||
public function getEntities(mixed $where = null, array $columns = ['*']): array
|
||||
final public function getEntities(mixed $where = null, array $columns = ['*']): array
|
||||
{
|
||||
if ($where) {
|
||||
$this->getModel()->where($where);
|
||||
|
||||
@ -11,6 +11,7 @@ use App\Services\Customer\ServiceService;
|
||||
class ServiceItemService extends CustomerService
|
||||
{
|
||||
private ?ServiceService $_serviceService = null;
|
||||
private ?ServicePaymentService $_servicePaymentService = null;
|
||||
public function __construct(mixed $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
@ -81,15 +82,7 @@ class ServiceItemService extends CustomerService
|
||||
{
|
||||
$entity = parent::create($formDatas, $entity);
|
||||
//결제정보 ServicePaymentService에 등록
|
||||
$this->getServicePaymentService()->createPaymentByServiceItem($entity);
|
||||
$this->getServicePaymentService()->createByServiceItem($entity);
|
||||
return $entity;
|
||||
}
|
||||
public function modify(mixed $entity, array $formDatas): ServiceItemEntity
|
||||
{
|
||||
return parent::modify($entity, $formDatas);
|
||||
}
|
||||
public function delete(mixed $entity): bool
|
||||
{
|
||||
return parent::delete($entity);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Services\Customer;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Entities\Customer\ServiceItemEntity;
|
||||
use App\Entities\Customer\ServicePaymentEntity;
|
||||
use App\Models\Customer\ServicePaymentModel;
|
||||
@ -82,7 +83,7 @@ class ServicePaymentService extends CustomerService
|
||||
return $this->getEntities($where);
|
||||
}
|
||||
//ServiceItemService에서 사용
|
||||
public function createPaymentByServiceItem(ServiceItemEntity $serviceItemEntity): ServicePaymentEntity
|
||||
public function createByServiceItem(ServiceItemEntity $serviceItemEntity): ServicePaymentEntity
|
||||
{
|
||||
$serviceEntity = $this->getServiceService()->getEntity($serviceItemEntity->getServiceUid());
|
||||
if (!$serviceEntity) {
|
||||
@ -100,4 +101,17 @@ class ServicePaymentService extends CustomerService
|
||||
];
|
||||
return $this->create($formDatas);
|
||||
}
|
||||
|
||||
//Service정보 와 관리자가 기존 정보과 같고, 결제가 아직 완료되지 않은 결제정보의 관리자 변경
|
||||
public function modifyOwnerByService(ServiceEntity $serviceEntity, int $ownerinfo_uid)
|
||||
{
|
||||
$wheres = [
|
||||
'serviceinfo_uid' => $serviceEntity->getPK(),
|
||||
'ownerinfo_uid' => $serviceEntity->getOwnerUID(),
|
||||
'status' => DEFAULTS['STATUS']
|
||||
];
|
||||
foreach ($this->getEntities($wheres) as $entity) {
|
||||
$this->modify($entity, ['ownerinfo_uid' => $ownerinfo_uid]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,6 @@ use App\Entities\Customer\ServiceEntity;
|
||||
use App\Entities\Equipment\CodeEntity;
|
||||
use App\Models\Customer\ServiceModel;
|
||||
|
||||
use App\Services\Customer\ServiceItemService;
|
||||
use App\Services\Equipment\CodeService;
|
||||
use App\Services\UserService;
|
||||
|
||||
@ -14,7 +13,7 @@ class ServiceService extends CustomerService
|
||||
{
|
||||
private ?UserService $_userService = null;
|
||||
private ?CodeService $_codeService = null;
|
||||
private ?ServiceItemService $_serviceItemService = null;
|
||||
private ?ServicePaymentService $_servicePaymentService = null;
|
||||
private ?string $_searchIP = null;
|
||||
public function __construct(mixed $request = null)
|
||||
{
|
||||
@ -71,12 +70,12 @@ class ServiceService extends CustomerService
|
||||
}
|
||||
return $this->_codeService;
|
||||
}
|
||||
public function getServiceItemService(): ServiceItemService
|
||||
public function getServicePaymentService(): ServicePaymentService
|
||||
{
|
||||
if (!$this->_serviceItemService) {
|
||||
$this->_serviceItemService = new ServiceItemService($this->request);
|
||||
if (!$this->_servicePaymentService) {
|
||||
$this->_servicePaymentService = new ServicePaymentService($this->request);
|
||||
}
|
||||
return $this->_serviceItemService;
|
||||
return $this->_servicePaymentService;
|
||||
}
|
||||
//Entity의 관련객체정의용
|
||||
public function setSearchIp(string $ip): void
|
||||
@ -99,20 +98,6 @@ class ServiceService extends CustomerService
|
||||
}
|
||||
return parent::findAllDatas($columns);
|
||||
}
|
||||
public function getEntities(mixed $where = null, array $columns = ['*']): array
|
||||
{
|
||||
$entities = [];
|
||||
foreach (parent::getEntities($where, $columns) as $entity) {
|
||||
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
||||
$entity->setItemEntities(
|
||||
$item_type,
|
||||
$this->getServiceItemService()->getEntities(['serviceinfo_uid' => $entity->getPK(), 'item_type' => $item_type])
|
||||
);
|
||||
}
|
||||
$entities[$entity->getPK()] = $entity;
|
||||
}
|
||||
return $entities;
|
||||
} //
|
||||
//기본 기능부분
|
||||
//FieldForm관련용
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
@ -164,6 +149,10 @@ class ServiceService extends CustomerService
|
||||
//coded의 경우 변경된 code는 서비스중으로 설정작업
|
||||
$this->getCodeService()->setStatus($formDatas['code'], CodeEntity::STATUS_OCCUPIED);
|
||||
}
|
||||
//관리자가 바뀐경우 결제쪽에도 결제가 완료되지않은 것은 관리자를 변경해줘야함
|
||||
if ($entity->getOwnerUID() !== intval($formDatas['ownerinfo_uid'])) {
|
||||
$this->getServicePaymentService()->modifyOwnerByService($entity, $formDatas['ownerinfo_uid']);
|
||||
}
|
||||
return parent::modify($entity, $formDatas);
|
||||
}
|
||||
final public function delete(mixed $entity): bool
|
||||
|
||||
32
app/Views/admin/service/view.php
Normal file
32
app/Views/admin/service/view.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" />
|
||||
<div class="action_form">
|
||||
<table class="table table-bordered">
|
||||
<?php $loop = false ?>
|
||||
<?php $rowspan = count($viewDatas['control']['view_fields']) ?>
|
||||
<?php foreach ($viewDatas['control']['view_fields'] as $field): ?>
|
||||
<tr>
|
||||
<th nowrap class="text-end" width="15%"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
|
||||
<td nowrap class="text-start" width="15%"><?= $viewDatas['helper']->getFieldView($field, $viewDatas['entity']->$field, $viewDatas) ?></td>
|
||||
<?php if (!$loop): ?>
|
||||
<td rowspan="<?= $rowspan ?>">
|
||||
<table class="table table-bordered table-hover table-striped">
|
||||
<?php foreach (SERVICE_ITEM_TYPES as $item_type => $label): ?>
|
||||
<tr>
|
||||
<th nowrap class="text-end" width="15%" data-rtc-resizable="<?= $item_type ?>" nowrap><?= $viewDatas['helper']->getFieldLabel($item_type, $viewDatas) ?></th>
|
||||
<td nowrap class="text-start"><?= $viewDatas['helper']->getFieldView($item_type, $viewDatas['entity']->$item_type, $viewDatas) ?></td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</table>
|
||||
</td>
|
||||
<?php $loop = true ?>
|
||||
<?php endif ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
@ -12,6 +12,6 @@
|
||||
<a href="/admin/customer/service"><?= ICONS['SERVICE'] ?> 서비스내역</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/customer/payment"><?= ICONS['PAYMENT'] ?> 결제내역</a>
|
||||
<a href="/admin/customer/payment?status=default"><?= ICONS['PAYMENT'] ?> 결제내역</a>
|
||||
</div>
|
||||
</div>
|
||||
@ -25,7 +25,7 @@
|
||||
<?php foreach ($viewDatas['newServiceEntities'] as $entity): ?>
|
||||
<?php $viewDatas['entity'] = $entity ?>
|
||||
<tr>
|
||||
<td><a href="/admin/customer/service" class="service-code"><?= $entity->getTitle() ?></a></td>
|
||||
<td><?= $viewDatas['helper']->getListButton('new_service_view', $viewDatas, ['label' => $entity->getTitle()]) ?></td>
|
||||
<td><?= $viewDatas['helper']->getFieldView('ownerinfo_uid', $entity->getOwnerUID(), $viewDatas) ?></td>
|
||||
<td><?= $viewDatas['helper']->getFieldView('type', $entity->getType(), $viewDatas) ?></td>
|
||||
<td><?= $viewDatas['helper']->getFieldView('code', $entity->getCode(), $viewDatas) ?></td>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user