dbms_init...1
This commit is contained in:
parent
3908b3240e
commit
209661fd8d
@ -134,19 +134,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
$routes->post('batchjob_delete', 'IpController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'IpController::download/$1');
|
||||
});
|
||||
$routes->group('network', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
$routes->get('/', 'NetworkController::index', []);
|
||||
$routes->get('create', 'NetworkController::create_form');
|
||||
$routes->post('create', 'NetworkController::create');
|
||||
$routes->get('modify/(:num)', 'NetworkController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'NetworkController::modify/$1');
|
||||
$routes->get('view/(:num)', 'NetworkController::view/$1');
|
||||
$routes->get('delete/(:num)', 'NetworkController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'NetworkController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'NetworkController::batchjob');
|
||||
$routes->post('batchjob_delete', 'NetworkController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'NetworkController::download/$1');
|
||||
});
|
||||
|
||||
$routes->group('server', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
$routes->get('/', 'ServerController::index', []);
|
||||
$routes->get('create', 'ServerController::create_form');
|
||||
|
||||
@ -51,37 +51,6 @@ class ClientController extends CustomerController
|
||||
}
|
||||
return $validation;
|
||||
}
|
||||
|
||||
// protected function create_process(): ClientEntity
|
||||
// {
|
||||
// $entity = parent::create_process();
|
||||
// //Account정보
|
||||
// $temps = [];
|
||||
// $temps['clientinfo_uid'] = $entity->getPK();
|
||||
// $temps['title'] = "첫가입";
|
||||
// $temps['alias'] = $entity->getTitle();
|
||||
// $temps['amount'] = $this->formDatas['account_balance'] ?? 0;
|
||||
// $temps['status'] = lang("{$this->getAccountService()->getClassPath()}.DEFAULTS.status");
|
||||
// $this->getAccountService()->create($temps, new AccountEntity());
|
||||
|
||||
// //Coupon정보
|
||||
// $temps = [];
|
||||
// $temps['clientinfo_uid'] = $entity->getPK();
|
||||
// $temps['title'] = "첫가입";
|
||||
// $temps['amount'] = $this->formDatas['coupon_balance'] ?? 0;
|
||||
// $temps['status'] = lang("{$this->getCouponService()->getClassPath()}.DEFAULTS.status");
|
||||
// $this->getCouponService()->create($temps, new CouponEntity());
|
||||
|
||||
// //Point정보
|
||||
// $temps = [];
|
||||
// $temps['clientinfo_uid'] = $entity->getPK();
|
||||
// $temps['title'] = "첫가입";
|
||||
// $temps['amount'] = $this->formDatas['point_balance'] ?? 0;
|
||||
// $temps['status'] = lang("{$this->getPointService()->getClassPath()}.DEFAULTS.status");
|
||||
// $this->getPointService()->create($temps, new CouponEntity());
|
||||
|
||||
// return $entity;
|
||||
// }
|
||||
//Index,FieldForm관련.
|
||||
|
||||
//View관련
|
||||
|
||||
@ -2,22 +2,35 @@
|
||||
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Entities\Customer\ServicePartEntity;
|
||||
use App\Helpers\Customer\ServiceHelper;
|
||||
use App\Services\Customer\ServiceService;
|
||||
use App\Services\Equipment\PartService;
|
||||
use App\Services\Equipment\IpService;
|
||||
|
||||
use App\Services\Equipment\ServerService;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Validation\Validation;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class ServiceController extends CustomerController
|
||||
{
|
||||
private ?ServerService $_serverService = null;
|
||||
private ?PartService $_partService = null;
|
||||
private ?IpService $_ipService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName()) . '/';
|
||||
$this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
// echo $this->view_path;
|
||||
// exit;
|
||||
$this->class_path = $this->getService()->getClassPath();
|
||||
$this->title = lang("{$this->getService()->getClassPath()}.title");
|
||||
$this->helper = $this->getHelper();
|
||||
$this->individualStylesheets = ['server_partinfo.css'];;
|
||||
$this->individualScripts = ['server_partinfo.js'];
|
||||
}
|
||||
public function getService(): ServiceService
|
||||
{
|
||||
@ -33,14 +46,128 @@ class ServiceController extends CustomerController
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련.
|
||||
final public function getServerService(): ServerService
|
||||
{
|
||||
if (!$this->_serverService) {
|
||||
$this->_serverService = new ServerService();
|
||||
}
|
||||
return $this->_serverService;
|
||||
}
|
||||
final public function getPartService(): PartService
|
||||
{
|
||||
if (!$this->_partService) {
|
||||
$this->_partService = new PartService($this->request);
|
||||
}
|
||||
return $this->_partService;
|
||||
}
|
||||
final public function getIpService(): IpService
|
||||
{
|
||||
if (!$this->_ipService) {
|
||||
$this->_ipService = new IpService();
|
||||
}
|
||||
return $this->_ipService;
|
||||
}
|
||||
|
||||
//Index,FieldForm관련
|
||||
protected function getFieldRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
}
|
||||
switch ($field) {
|
||||
case 'CPU':
|
||||
case 'RAM':
|
||||
case 'DISK':
|
||||
$rule = "if_exist|permit_empty|numeric";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFieldRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
}
|
||||
protected function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'SERVER':
|
||||
$options[$field] = $this->getServerService()->getFormFieldOption($field);
|
||||
break;
|
||||
case 'CPU':
|
||||
case 'RAM':
|
||||
case 'DISK':
|
||||
$options[$field] = $this->getPartService()->getFormFieldOption($field);
|
||||
break;
|
||||
case 'IP':
|
||||
$options[$field] = $this->getIPService()->getFormFieldOption($field);
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
protected function setValidation(Validation $validation, string $action, string $field, ?string $rule = null): Validation
|
||||
{
|
||||
switch ($field) {
|
||||
case 'SERVER':
|
||||
case 'CPU':
|
||||
case 'RAM':
|
||||
case 'DISK':
|
||||
case 'IP':
|
||||
//아래 Rule Array는 필드명.* checkbox를 사용
|
||||
$validation->setRule("{$field}.*", $field, $rule);
|
||||
break;
|
||||
default:
|
||||
$validation = parent::setValidation($validation, $action, $field, $rule);
|
||||
break;
|
||||
}
|
||||
return $validation;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
|
||||
protected function create_process(): mixed
|
||||
{
|
||||
$entity = parent::create_process();
|
||||
//변경할 UIDS
|
||||
$cpu_uids = $this->request->getVar('CPU[]');
|
||||
if (!is_array($cpu_uids)) {
|
||||
throw new \Exception("CPU가 정의되지 않았습니다.");
|
||||
}
|
||||
foreach ($cpu_uids as $uid) {
|
||||
$temps = ['serviceinfo_uid' => $entity->getPK(), 'partinfo_uid' => $uid];
|
||||
$this->getService()->create($temps, new ServicePartEntity());
|
||||
}
|
||||
$ram_uids = $this->request->getVar('RAM[]');
|
||||
if (!is_array($ram_uids)) {
|
||||
throw new \Exception("RAM가 정의되지 않았습니다.");
|
||||
}
|
||||
foreach ($ram_uids as $uid) {
|
||||
$temps = ['serviceinfo_uid' => $entity->getPK(), 'partinfo_uid' => $uid];
|
||||
$this->getService()->create($temps, new ServicePartEntity());
|
||||
}
|
||||
$disk_uids = $this->request->getVar('DISK[]');
|
||||
if (!is_array($disk_uids)) {
|
||||
throw new \Exception("DISK가 정의되지 않았습니다.");
|
||||
}
|
||||
foreach ($disk_uids as $uid) {
|
||||
$temps = ['serviceinfo_uid' => $entity->getPK(), 'partinfo_uid' => $uid];
|
||||
$this->getService()->create($temps, new ServicePartEntity());
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['clientinfo_uid', 'type', $this->getService()->getModel()->getTitleField(), 'payment_date', 'amount', 'start_at', 'end_at', 'status'],
|
||||
'fields' => ['clientinfo_uid', 'type', $this->getService()->getModel()->getTitleField(), 'billing_at', 'start_at', 'end_at', 'status'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
$this->modal_type = 'modal_iframe';
|
||||
return parent::index_process();
|
||||
$entities = parent::index_process();
|
||||
foreach ($entities as $key => $entity) {
|
||||
$entity->CPU = $this->getServerService()->getEntities(['serverinfo_uid' => $entity->getPK()]);
|
||||
$entity->RAM = $this->getServerService()->getEntities(['serverinfo_uid' => $entity->getPK()]);
|
||||
$entity->DISK = $this->getServerService()->getEntities(['serverinfo_uid' => $entity->getPK()]);
|
||||
}
|
||||
return $entities;
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,11 +35,11 @@ class IpController extends EquipmentController
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
protected function setOrcerByForList()
|
||||
protected function setOrderByForList()
|
||||
{
|
||||
//OrderBy 처리
|
||||
$this->getService()->getModel()->orderBy('INET_ATON(ip)', 'ASC', false);
|
||||
parent::setOrcerByForList();
|
||||
parent::setOrderByForList();
|
||||
}
|
||||
|
||||
protected function index_process(): array
|
||||
|
||||
@ -59,10 +59,27 @@ class LineController extends EquipmentController
|
||||
$temps = [];
|
||||
$temps['lineinfo_uid'] = $entity->getPK();
|
||||
$temps['ip'] = $ip;
|
||||
$temps['price'] = $this->formDatas['price'] ?? 0;
|
||||
$temps['status'] = lang("{$this->getIpService()->getClassPath()}.DEFAULTS.status");
|
||||
$this->getIpService()->create($temps, new IpEntity());
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
|
||||
protected function view_process($uid): mixed
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['clientinfo_uid', 'type', $this->getService()->getModel()->getTitleField(), 'bandwith', 'status', "start_at", 'created_at'],
|
||||
];
|
||||
$this->init('view', $fields);
|
||||
return parent::view_process($uid);
|
||||
}
|
||||
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['clientinfo_uid', 'type', $this->getService()->getModel()->getTitleField(), 'bandwith', 'status', "start_at", 'created_at'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
return parent::index_process();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Validation\Validation;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Equipment\NetworkHelper;
|
||||
use App\Services\Equipment\NetworkService;
|
||||
|
||||
class NetworkController extends EquipmentController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName()) . '/';
|
||||
$this->class_path = $this->getService()->getClassPath();
|
||||
$this->title = lang("{$this->getService()->getClassPath()}.title");
|
||||
$this->helper = $this->getHelper();
|
||||
}
|
||||
public function getService(): NetworkService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new NetworkService($this->request);
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
public function getHelper(): mixed
|
||||
{
|
||||
if (!$this->_helper) {
|
||||
$this->_helper = new NetworkHelper($this->request);
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['code', 'clientinfo_uid', 'type', $this->getService()->getModel()->getTitleField(), 'price', 'status', 'description'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
$this->modal_type = 'modal_iframe';
|
||||
return parent::index_process();
|
||||
}
|
||||
}
|
||||
@ -38,7 +38,7 @@ class PartController extends EquipmentController
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['clientinfo_uid', 'type', $this->getService()->getModel()->getTitleField(), 'price', 'status', 'description'],
|
||||
'fields' => ['type', $this->getService()->getModel()->getTitleField(), 'manufactur_at', 'status'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
$this->modal_type = 'modal_iframe';
|
||||
|
||||
@ -4,31 +4,22 @@ namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Helpers\Equipment\ServerHelper;
|
||||
use App\Services\Equipment\ServerPartService;
|
||||
|
||||
use App\Services\Equipment\PartService;
|
||||
use App\Services\Equipment\ServerService;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Validation\Validation;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class ServerController extends EquipmentController
|
||||
{
|
||||
private ?PartService $_partService = null;
|
||||
private ?ServerPartService $_serverPartService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName()) . '/';
|
||||
$this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
// echo $this->view_path;
|
||||
// exit;
|
||||
|
||||
$this->class_path = $this->getService()->getClassPath();
|
||||
$this->title = lang("{$this->getService()->getClassPath()}.title");
|
||||
$this->helper = $this->getHelper();
|
||||
$this->individualStylesheets = ['server_partinfo.css'];;
|
||||
$this->individualScripts = ['server_partinfo.js'];
|
||||
}
|
||||
public function getService(): ServerService
|
||||
{
|
||||
@ -44,112 +35,15 @@ class ServerController extends EquipmentController
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
final public function getPartService(): PartService
|
||||
{
|
||||
if (!$this->_partService) {
|
||||
$this->_partService = new PartService($this->request);
|
||||
}
|
||||
return $this->_partService;
|
||||
}
|
||||
final public function getServerPartService(): ServerPartService
|
||||
{
|
||||
if (!$this->_serverPartService) {
|
||||
$this->_serverPartService = new ServerPartService();
|
||||
}
|
||||
return $this->_serverPartService;
|
||||
}
|
||||
|
||||
//Index,FieldForm관련
|
||||
protected function getFieldRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
}
|
||||
switch ($field) {
|
||||
case 'cpu_partinfo_uid':
|
||||
case 'ram_partinfo_uid':
|
||||
case 'disk_partinfo_uid':
|
||||
$rule = "if_exist|permit_empty|numeric";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFieldRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
}
|
||||
protected function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'cpu_partinfo_uid':
|
||||
case 'ram_partinfo_uid':
|
||||
case 'disk_partinfo_uid':
|
||||
$options[$field] = $this->getPartService()->getFormFieldOption($field);
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
protected function setValidation(Validation $validation, string $action, string $field, ?string $rule = null): Validation
|
||||
{
|
||||
switch ($field) {
|
||||
case 'cpu_partinfo_uid':
|
||||
case 'ram_partinfo_uid':
|
||||
case 'disk_partinfo_uid':
|
||||
//아래 Rule Array는 필드명.* checkbox를 사용
|
||||
$validation->setRule("{$field}.*", $field, $rule);
|
||||
break;
|
||||
default:
|
||||
$validation = parent::setValidation($validation, $action, $field, $rule);
|
||||
break;
|
||||
}
|
||||
return $validation;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
|
||||
protected function create_process(): mixed
|
||||
{
|
||||
$entity = parent::create_process();
|
||||
//변경할 UIDS
|
||||
$cpu_uids = $this->request->getVar('cpu_partinfo_uid[]');
|
||||
if (!is_array($cpu_uids)) {
|
||||
throw new \Exception("CPU가 정의되지 않았습니다.");
|
||||
}
|
||||
foreach ($cpu_uids as $uid) {
|
||||
$temps = ['serverinfo_uid' => $entity->getPK(), 'partinfo_uid' => $uid];
|
||||
$this->getServerPartService()->create($temps, new ServerPartEntity());
|
||||
}
|
||||
$ram_uids = $this->request->getVar('ram_partinfo_uid[]');
|
||||
if (!is_array($ram_uids)) {
|
||||
throw new \Exception("RAM가 정의되지 않았습니다.");
|
||||
}
|
||||
foreach ($ram_uids as $uid) {
|
||||
$temps = ['serverinfo_uid' => $entity->getPK(), 'partinfo_uid' => $uid];
|
||||
$this->getServerPartService()->create($temps, new ServerPartEntity());
|
||||
}
|
||||
$disk_uids = $this->request->getVar('disk_partinfo_uid[]');
|
||||
if (!is_array($disk_uids)) {
|
||||
throw new \Exception("DISK가 정의되지 않았습니다.");
|
||||
}
|
||||
foreach ($disk_uids as $uid) {
|
||||
$temps = ['serverinfo_uid' => $entity->getPK(), 'partinfo_uid' => $uid];
|
||||
$this->getServerPartService()->create($temps, new ServerPartEntity());
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['code', 'clientinfo_uid', 'type', $this->getService()->getModel()->getTitleField(), 'price', 'status'],
|
||||
'fields' => ['code', 'type', $this->getService()->getModel()->getTitleField(), 'manufactur_at', 'status'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
$this->modal_type = 'modal_iframe';
|
||||
$entities = parent::index_process();
|
||||
foreach ($entities as $key => $entity) {
|
||||
$entities[$key]['partinfo_uid'] = $this->getServerPartService()->getEntities(['serverinfo_uid' => $entity['id']);
|
||||
$entities[$key]['ram_partinfo_uid'] = $this->getServerPartService()->getEntities(['serverinfo_uid' => $entity['id']);
|
||||
$entities[$key]['disk_partinfo_uid'] = $this->getServerPartService()->getEntities(['serverinfo_uid' => $entity['id']);
|
||||
}
|
||||
return parent::index_process();
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ class SoftwareController extends EquipmentController
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['type', $this->getService()->getModel()->getTitleField(), 'price', 'status', 'description'],
|
||||
'fields' => ['type', $this->getService()->getModel()->getTitleField(), 'status', 'description'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
$this->modal_type = 'modal_iframe';
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
11
app/Entities/Customer/ServicePartEntity.php
Normal file
11
app/Entities/Customer/ServicePartEntity.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Customer;
|
||||
|
||||
use App\Models\Customer\ServicePartModel;
|
||||
|
||||
class ServicePartEntity extends CustomerEntity
|
||||
{
|
||||
const PK = ServicePartModel::PK;
|
||||
const TITLE = ServicePartModel::TITLE;
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Equipment;
|
||||
|
||||
use App\Models\Equipment\NetworkModel;
|
||||
|
||||
class NetworkEntity extends EquipmentEntity
|
||||
{
|
||||
const PK = NetworkModel::PK;
|
||||
const TITLE = NetworkModel::TITLE;
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Equipment;
|
||||
|
||||
use App\Models\Equipment\ServerPartModel;
|
||||
|
||||
class ServerPartEntity extends EquipmentEntity
|
||||
{
|
||||
const PK = ServerPartModel::PK;
|
||||
const TITLE = ServerPartModel::TITLE;
|
||||
}
|
||||
@ -253,6 +253,10 @@ class CommonHelper
|
||||
}
|
||||
$form = form_dropdown($field, $formOptions, $value, ['class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
|
||||
break;
|
||||
case 'manufactur_at':
|
||||
case 'billing_at':
|
||||
case 'start_at':
|
||||
case 'end_at':
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
$extra_class = isset($extras['class']) ? $extras['class'] . ' calender' : 'calender';
|
||||
@ -313,6 +317,10 @@ class CommonHelper
|
||||
}
|
||||
$value = implode(" , ", $roles);
|
||||
break;
|
||||
case 'manufactur_at':
|
||||
case 'billing_at':
|
||||
case 'start_at':
|
||||
case 'end_at':
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
$value = $value ? date("Y-m-d", strtotime($value)) : "";
|
||||
|
||||
@ -19,11 +19,31 @@ class ServiceHelper extends CustomerHelper
|
||||
$extras = (strpos($viewDatas['field_rules'][$field], 'required') !== false) ? ["class" => "form-control", "required" => "", ...$extras] : ["class" => "form-control", ...$extras];
|
||||
}
|
||||
switch ($field) {
|
||||
case 'payment_date':
|
||||
case 'start_at':
|
||||
case 'end_at':
|
||||
$extra_class = isset($extras['class']) ? $extras['class'] . ' calender' : 'calender';
|
||||
$form = form_input($field, $value ?? "", ['class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
|
||||
case 'CPU':
|
||||
case 'RAM':
|
||||
case 'DISK':
|
||||
if (!is_array($viewDatas['field_options'][$field])) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다.");
|
||||
}
|
||||
if (in_array($viewDatas['action'], ['create_form', 'modify_form'])) {
|
||||
$form = " <button type=\"button\" class=\"server_partinfo_layer_btn\" onclick=\"openLayer('{$field}')\">" . lang($viewDatas['class_path'] . '.label.' . $field) . " 추가</button>";
|
||||
$form .= "<div id=\"{$field}_layer\" class=\"server_partinfo_layer\" style=\"display: none;\">";
|
||||
$form .= "<div class=\"server_partinfo_layer_inner\">";
|
||||
$form .= "<ul class=\"server_partinfo_item_list\">";
|
||||
foreach ($viewDatas['field_options'][$field] as $key => $label) {
|
||||
$form .= "<li><label onclick=\"addComponentFromLabel('{$field}', {$key},'{$label}')\">{$label}</label></li>";
|
||||
}
|
||||
$form .= "</ul>";
|
||||
$form .= "<button type=\"button\" onclick=\"closeLayer('{$field}')\">닫기</button>";
|
||||
$form .= "</div></div>";
|
||||
$form .= "<div id=\"{$field}_list\" class=\"server_partinfo_items\" style=\"border:1px solid silver\"></div>";
|
||||
} else {
|
||||
$formOptions = ["" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택'];
|
||||
foreach ($viewDatas['field_options'][$field] as $key => $label) {
|
||||
$formOptions[$key] = $label;
|
||||
}
|
||||
$form = form_dropdown($field, $formOptions, $value, $extras);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
@ -31,20 +51,4 @@ class ServiceHelper extends CustomerHelper
|
||||
}
|
||||
return $form;
|
||||
} //
|
||||
public function getFieldView(string $field, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
$value = $viewDatas['entity']->$field ?? "";
|
||||
switch ($field) {
|
||||
case 'payment_date':
|
||||
case 'start_at':
|
||||
case 'end_at':
|
||||
$value = $value ? date("Y-m-d", strtotime($value)) : "";
|
||||
break;
|
||||
|
||||
default:
|
||||
$value = parent::getFieldView($field, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Equipment;
|
||||
|
||||
use App\Models\Equipment\NetworkModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class NetworkHelper extends EquipmentHelper
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
$this->setTitleField(field: NetworkModel::TITLE);
|
||||
}
|
||||
|
||||
// public function getListButton(string $action, array $viewDatas, array $extras = []): string
|
||||
// {
|
||||
// switch ($action) {
|
||||
// case 'create':
|
||||
// $extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
|
||||
// $action = anchor(
|
||||
// current_url() . '/' . $action . '?' . $this->request->getUri()->getQuery(),
|
||||
// '입력',
|
||||
// $extras
|
||||
// );
|
||||
// break;
|
||||
// default:
|
||||
// $action = parent::getListButton($action, $viewDatas, $extras);
|
||||
// break;
|
||||
// }
|
||||
// return $action;
|
||||
// }
|
||||
}
|
||||
@ -13,42 +13,4 @@ class ServerHelper extends EquipmentHelper
|
||||
parent::__construct($request);
|
||||
$this->setTitleField(field: ServerModel::TITLE);
|
||||
}
|
||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
if (in_array($viewDatas['action'], ['create', 'modify'])) {
|
||||
$extras = (strpos($viewDatas['field_rules'][$field], 'required') !== false) ? ["class" => "form-control", "required" => "", ...$extras] : ["class" => "form-control", ...$extras];
|
||||
}
|
||||
switch ($field) {
|
||||
case 'cpu_partinfo_uid':
|
||||
case 'ram_partinfo_uid':
|
||||
case 'disk_partinfo_uid':
|
||||
if (!is_array($viewDatas['field_options'][$field])) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다.");
|
||||
}
|
||||
if (in_array($viewDatas['action'], ['create_form', 'modify_form'])) {
|
||||
$form = " <button type=\"button\" class=\"server_partinfo_layer_btn\" onclick=\"openLayer('{$field}')\">" . lang($viewDatas['class_path'] . '.label.' . $field) . " 추가</button>";
|
||||
$form .= "<div id=\"{$field}_layer\" class=\"server_partinfo_layer\" style=\"display: none;\">";
|
||||
$form .= "<div class=\"server_partinfo_layer_inner\">";
|
||||
$form .= "<ul class=\"server_partinfo_item_list\">";
|
||||
foreach ($viewDatas['field_options'][$field] as $key => $label) {
|
||||
$form .= "<li><label onclick=\"addComponentFromLabel('{$field}', {$key},'{$label}')\">{$label}</label></li>";
|
||||
}
|
||||
$form .= "</ul>";
|
||||
$form .= "<button type=\"button\" onclick=\"closeLayer('{$field}')\">닫기</button>";
|
||||
$form .= "</div></div>";
|
||||
$form .= "<div id=\"{$field}_list\" class=\"server_partinfo_items\" style=\"border:1px solid silver\"></div>";
|
||||
} else {
|
||||
$formOptions = ["" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택'];
|
||||
foreach ($viewDatas['field_options'][$field] as $key => $label) {
|
||||
$formOptions[$key] = $label;
|
||||
}
|
||||
$form = form_dropdown($field, $formOptions, $value, $extras);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $form;
|
||||
} //
|
||||
}
|
||||
|
||||
@ -3,15 +3,20 @@ return [
|
||||
'title' => "고객서비스정보",
|
||||
'label' => [
|
||||
'clientinfo_uid' => "고객명",
|
||||
'code' => "Rack코드",
|
||||
'type' => "종류",
|
||||
'title' => "제목",
|
||||
'payment_date' => "결제일",
|
||||
'amount' => "결제금액",
|
||||
'billing_at' => "청구일",
|
||||
'start_at' => "개통일",
|
||||
'end_at' => "해지일",
|
||||
'status' => "상태",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "신청일",
|
||||
'SERVER' => "서버",
|
||||
'CPU' => "CPU",
|
||||
'RAM' => "RAM",
|
||||
'DISK' => "DISK",
|
||||
'IP' => "IP",
|
||||
],
|
||||
'DEFAULTS' => [
|
||||
'type' => "hosting",
|
||||
|
||||
@ -5,9 +5,9 @@ return [
|
||||
'clientinfo_uid' => "소유자명",
|
||||
'title' => "제목",
|
||||
'type' => "종류",
|
||||
'price' => "금액",
|
||||
'bandwith' => "CIDR대역",
|
||||
'status' => "상태",
|
||||
'start_at' => "개통일",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일",
|
||||
],
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
'title' => "네트워크장비정보",
|
||||
'label' => [
|
||||
'clientinfo_uid' => "소유자명",
|
||||
'code' => "코드",
|
||||
'type' => "종류",
|
||||
'model' => "모델",
|
||||
'price' => "금액",
|
||||
'description' => "설명",
|
||||
'status' => "상태",
|
||||
'manufactur_at' => "입고일",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일",
|
||||
],
|
||||
'DEFAULTS' => [
|
||||
'type' => 'L2',
|
||||
'status' => "use"
|
||||
],
|
||||
"TYPE" => [
|
||||
"L2" => "L2",
|
||||
"L3" => "L3",
|
||||
"L4" => "L4",
|
||||
"Router" => "Router",
|
||||
"colocation" => "코로케이션",
|
||||
],
|
||||
"STATUS" => [
|
||||
"use" => "사용가능",
|
||||
"pause" => "일시정지",
|
||||
"occupied" => "사용중",
|
||||
"terminated" => "해지",
|
||||
],
|
||||
];
|
||||
@ -2,10 +2,8 @@
|
||||
return [
|
||||
'title' => "부품장비정보",
|
||||
'label' => [
|
||||
'clientinfo_uid' => "소유자명",
|
||||
'type' => "종류",
|
||||
'model' => "모델",
|
||||
'price' => "금액",
|
||||
'description' => "설명",
|
||||
'status' => "상태",
|
||||
'manufactur_at' => "입고일",
|
||||
|
||||
@ -2,19 +2,14 @@
|
||||
return [
|
||||
'title' => "서버장비정보",
|
||||
'label' => [
|
||||
'clientinfo_uid' => "소유자명",
|
||||
'code' => "코드",
|
||||
'code' => "장비코드",
|
||||
'type' => "종류",
|
||||
'model' => "모델",
|
||||
'price' => "금액",
|
||||
'description' => "설명",
|
||||
'status' => "상태",
|
||||
'manufactur_at' => "입고일",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일",
|
||||
'cpu_partinfo_uid' => "CPU",
|
||||
'ram_partinfo_uid' => "RAM",
|
||||
'disk_partinfo_uid' => "DISK",
|
||||
],
|
||||
'DEFAULTS' => [
|
||||
'type' => 'RacKMount',
|
||||
|
||||
@ -4,7 +4,6 @@ return [
|
||||
'label' => [
|
||||
'type' => "종류",
|
||||
'model' => "모델",
|
||||
'price' => "금액",
|
||||
'description' => "설명",
|
||||
'status' => "상태",
|
||||
'updated_at' => "수정일",
|
||||
|
||||
@ -14,10 +14,10 @@ class ServiceModel extends CustomerModel
|
||||
protected $returnType = ServiceEntity::class;
|
||||
protected $allowedFields = [
|
||||
"clientinfo_uid",
|
||||
"code",
|
||||
"type",
|
||||
"title",
|
||||
"payment_date",
|
||||
"amount",
|
||||
"billing_at",
|
||||
"start_at",
|
||||
"end_at",
|
||||
"status",
|
||||
@ -36,14 +36,15 @@ class ServiceModel extends CustomerModel
|
||||
case "clientinfo_uid":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
case "amount":
|
||||
$rule = "if_exist|numeric";
|
||||
case "code":
|
||||
$rule = "required|trim|min_length[4]|max_length[20]";
|
||||
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->table}.{$field}]" : "";
|
||||
break;
|
||||
case "title":
|
||||
case "type":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "payment_date":
|
||||
case "billing_at":
|
||||
$rule = "required|valid_date";
|
||||
break;
|
||||
case "start_at":
|
||||
|
||||
@ -1,26 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Equipment;
|
||||
namespace App\Models\Customer;
|
||||
|
||||
use App\Entities\Equipment\NetworkEntity;
|
||||
use App\Entities\Customer\ServicePartEntity;
|
||||
|
||||
class NetworkModel extends EquipmentModel
|
||||
class ServicePartModel extends CustomerModel
|
||||
{
|
||||
const TABLE = "networkinfo";
|
||||
const TABLE = "serviceinfo";
|
||||
const PK = "uid";
|
||||
const TITLE = "model";
|
||||
const TITLE = "title";
|
||||
protected $table = self::TABLE;
|
||||
protected $primaryKey = self::PK;
|
||||
protected $returnType = NetworkEntity::class;
|
||||
protected $returnType = ServicePartEntity::class;
|
||||
protected $allowedFields = [
|
||||
"clientinfo_uid",
|
||||
"code",
|
||||
"type",
|
||||
"model",
|
||||
"manufactur_at",
|
||||
"price",
|
||||
"title",
|
||||
"billing_at",
|
||||
"start_at",
|
||||
"end_at",
|
||||
"status",
|
||||
"description",
|
||||
"updated_at"
|
||||
];
|
||||
public function __construct()
|
||||
@ -34,23 +34,22 @@ class NetworkModel extends EquipmentModel
|
||||
}
|
||||
switch ($field) {
|
||||
case "clientinfo_uid":
|
||||
$rule = "if_exist|permit_empty|numeric";
|
||||
break;
|
||||
case "price":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
case "code":
|
||||
case "model":
|
||||
$rule = "required|trim|min_length[4]|max_length[20]";
|
||||
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->table}.{$field}]" : "";
|
||||
break;
|
||||
case "title":
|
||||
case "type":
|
||||
case "status":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "manufactur_at":
|
||||
case "billing_at":
|
||||
$rule = "required|valid_date";
|
||||
break;
|
||||
case "description":
|
||||
$rule = "if_exist|trim|string";
|
||||
break;
|
||||
case "start_at":
|
||||
case "end_at":
|
||||
$rule = "if_exist|valid_date";
|
||||
default:
|
||||
$rule = parent::getFieldRule($action, $field);
|
||||
break;
|
||||
@ -17,8 +17,8 @@ class LineModel extends EquipmentModel
|
||||
"type",
|
||||
"title",
|
||||
"bandwith",
|
||||
"price",
|
||||
"status",
|
||||
"start_at",
|
||||
"updated_at"
|
||||
];
|
||||
public function __construct()
|
||||
@ -34,9 +34,6 @@ class LineModel extends EquipmentModel
|
||||
case "clientinfo_uid":
|
||||
$rule = "if_exist|permit_empty|numeric";
|
||||
break;
|
||||
case "price":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
case "title":
|
||||
case "bandwith":
|
||||
case "type":
|
||||
|
||||
@ -13,10 +13,8 @@ class PartModel extends EquipmentModel
|
||||
protected $primaryKey = self::PK;
|
||||
protected $returnType = PartEntity::class;
|
||||
protected $allowedFields = [
|
||||
"clientinfo_uid",
|
||||
"type",
|
||||
"model",
|
||||
"price",
|
||||
"description",
|
||||
"manufactur_at",
|
||||
"status",
|
||||
@ -32,12 +30,6 @@ class PartModel extends EquipmentModel
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
}
|
||||
switch ($field) {
|
||||
case "clientinfo_uid":
|
||||
$rule = "if_exist|permit_empty|numeric";
|
||||
break;
|
||||
case "price":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
case "model":
|
||||
case "type":
|
||||
case "status":
|
||||
|
||||
@ -13,14 +13,12 @@ class ServerModel extends EquipmentModel
|
||||
protected $primaryKey = self::PK;
|
||||
protected $returnType = ServerEntity::class;
|
||||
protected $allowedFields = [
|
||||
"clientinfo_uid",
|
||||
"code",
|
||||
"type",
|
||||
"model",
|
||||
"manufactur_at",
|
||||
"price",
|
||||
"status",
|
||||
"description",
|
||||
"manufactur_at",
|
||||
"status",
|
||||
"updated_at"
|
||||
];
|
||||
public function __construct()
|
||||
@ -33,13 +31,10 @@ class ServerModel extends EquipmentModel
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
}
|
||||
switch ($field) {
|
||||
case "clientinfo_uid":
|
||||
$rule = "if_exist|permit_empty|numeric";
|
||||
break;
|
||||
case "price":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
case "code":
|
||||
$rule = "required|trim|min_length[4]|max_length[20]";
|
||||
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->table}.{$field}]" : "";
|
||||
break;
|
||||
case "model":
|
||||
case "type":
|
||||
case "manufactur_at":
|
||||
|
||||
@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Equipment;
|
||||
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
|
||||
class ServerPartModel extends EquipmentModel
|
||||
{
|
||||
const TABLE = "serverinfos_partinfos";
|
||||
const PK = "uid";
|
||||
const TITLE = "serverinfo_uid";
|
||||
protected $table = self::TABLE;
|
||||
protected $primaryKey = self::PK;
|
||||
protected $returnType = ServerPartEntity::class;
|
||||
protected $allowedFields = [
|
||||
"serverinfo_uid",
|
||||
"partinfo_uid",
|
||||
"type"
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getFieldRule(string $action, string $field): string
|
||||
{
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
}
|
||||
switch ($field) {
|
||||
case "serverinfo_uid":
|
||||
case "partinfo_uid":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
case "type":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFieldRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
}
|
||||
}
|
||||
@ -13,10 +13,8 @@ class SoftwareModel extends EquipmentModel
|
||||
protected $primaryKey = self::PK;
|
||||
protected $returnType = SoftwareEntity::class;
|
||||
protected $allowedFields = [
|
||||
"clientinfo_uid",
|
||||
"type",
|
||||
"model",
|
||||
"price",
|
||||
"status",
|
||||
"description",
|
||||
"updated_at"
|
||||
@ -31,9 +29,6 @@ class SoftwareModel extends EquipmentModel
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
}
|
||||
switch ($field) {
|
||||
case "price":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
case "model":
|
||||
case "type":
|
||||
case "status":
|
||||
|
||||
@ -29,18 +29,22 @@ class ServiceService extends CustomerService
|
||||
{
|
||||
return [
|
||||
"clientinfo_uid",
|
||||
"code",
|
||||
"type",
|
||||
"title",
|
||||
"payment_date",
|
||||
"amount",
|
||||
"billing_at",
|
||||
"start_at",
|
||||
"end_at",
|
||||
"SERVER",
|
||||
"CPU",
|
||||
"RAM",
|
||||
"DISK",
|
||||
"IP",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", 'type', 'status'];
|
||||
return ["clientinfo_uid", 'type', "SERVER", "CPU", "RAM", "DISK", "IP", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
|
||||
@ -41,4 +41,19 @@ class IpService extends EquipmentService
|
||||
{
|
||||
return ['status'];
|
||||
}
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'IP':
|
||||
foreach ($this->getEntities(['status' => 'use']) as $entity) {
|
||||
$options[$entity->getPK()] = $entity->getTitle();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
// dd($options);
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,16 +29,16 @@ class LineService extends EquipmentService
|
||||
{
|
||||
return [
|
||||
"clientinfo_uid",
|
||||
"start_at",
|
||||
"type",
|
||||
"title",
|
||||
"bandwith",
|
||||
"price",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", "type", 'status'];
|
||||
return ["clientinfo_uid", "type", 'status',];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
|
||||
@ -1,49 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment;
|
||||
|
||||
use App\Entities\Equipment\NetworkEntity;
|
||||
use App\Models\Equipment\NetworkModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class NetworkService extends EquipmentService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
}
|
||||
public function getClassName(): string
|
||||
{
|
||||
return parent::getClassName() . DIRECTORY_SEPARATOR . "Network";
|
||||
}
|
||||
public function getModelClass(): NetworkModel
|
||||
{
|
||||
return new NetworkModel();
|
||||
}
|
||||
public function getEntityClass(): NetworkEntity
|
||||
{
|
||||
return new NetworkEntity();
|
||||
}
|
||||
public function getFields(): array
|
||||
{
|
||||
return [
|
||||
"clientinfo_uid",
|
||||
"code",
|
||||
"type",
|
||||
"model",
|
||||
"manufactur_at",
|
||||
"price",
|
||||
"status",
|
||||
"description",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", "type", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ["type", 'status'];
|
||||
}
|
||||
}
|
||||
@ -29,18 +29,16 @@ class PartService extends EquipmentService
|
||||
public function getFields(): array
|
||||
{
|
||||
return [
|
||||
"clientinfo_uid",
|
||||
"type",
|
||||
"model",
|
||||
"manufactur_at",
|
||||
"price",
|
||||
"status",
|
||||
"description",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", "type", 'status'];
|
||||
return ["type", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
@ -49,18 +47,10 @@ class PartService extends EquipmentService
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'cpu_partinfo_uid':
|
||||
foreach ($this->getEntities(['type' => 'CPU']) as $entity) {
|
||||
$options[$entity->getPK()] = $entity->getTitle();
|
||||
}
|
||||
break;
|
||||
case 'ram_partinfo_uid':
|
||||
foreach ($this->getEntities(['type' => 'RAM']) as $entity) {
|
||||
$options[$entity->getPK()] = $entity->getTitle();
|
||||
}
|
||||
break;
|
||||
case 'disk_partinfo_uid':
|
||||
foreach ($this->getEntities(['type' => 'DISK']) as $entity) {
|
||||
case 'CPU':
|
||||
case 'RAM':
|
||||
case 'DISK':
|
||||
foreach ($this->getEntities(['type' => $field]) as $entity) {
|
||||
$options[$entity->getPK()] = $entity->getTitle();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Equipment;
|
||||
|
||||
use App\Entities\Equipment\ServerPartEntity;
|
||||
use App\Models\Equipment\ServerPartModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use App\Services\Equipment\EquipmentService; // Ensure this path is correct and the class exists or create the class if missing
|
||||
|
||||
class ServerPartService extends EquipmentService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
}
|
||||
public function getClassName(): string
|
||||
{
|
||||
return parent::getClassName() . DIRECTORY_SEPARATOR . "Part";
|
||||
}
|
||||
public function getModelClass(): ServerPartModel
|
||||
{
|
||||
return new ServerPartModel();
|
||||
}
|
||||
public function getEntityClass(): ServerPartEntity
|
||||
{
|
||||
return new ServerPartEntity();
|
||||
}
|
||||
public function getFields(): array
|
||||
{
|
||||
return [
|
||||
"serverinfo_uid",
|
||||
"partinfo_uid",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["serverinfo_uid", "partinfo_uid"];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@ -29,25 +29,36 @@ class ServerService extends EquipmentService
|
||||
public function getFields(): array
|
||||
{
|
||||
return [
|
||||
"clientinfo_uid",
|
||||
"code",
|
||||
"type",
|
||||
"model",
|
||||
"cpu_partinfo_uid",
|
||||
"ram_partinfo_uid",
|
||||
"disk_partinfo_uid",
|
||||
"manufactur_at",
|
||||
"price",
|
||||
"status",
|
||||
"description",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", "type", 'cpu_partinfo_uid', 'ram_partinfo_uid', 'disk_partinfo_uid', 'status'];
|
||||
return ["type", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ["type", 'cpu_partinfo_uid', 'ram_partinfo_uid', 'disk_partinfo_uid', 'status'];
|
||||
return ["type", 'status'];
|
||||
}
|
||||
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'SERVER':
|
||||
foreach ($this->getEntities() as $entity) {
|
||||
$options[$entity->getPK()] = $entity->getTitle();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
// dd($options);
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +30,6 @@ class SoftwareService extends EquipmentService
|
||||
return [
|
||||
"type",
|
||||
"model",
|
||||
"price",
|
||||
"status",
|
||||
"description",
|
||||
];
|
||||
|
||||
@ -11,9 +11,6 @@
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/equipment/ip"><?= ICONS['DESKTOP'] ?>IP정보</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/equipment/network"><?= ICONS['CLOUD'] ?>Network정보</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/equipment/server"><?= ICONS['DESKTOP'] ?>Server정보</a>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user