dbms_init...1

This commit is contained in:
choi.jh 2025-06-10 11:41:10 +09:00
parent fd208c6e0d
commit 3828dc90e3
19 changed files with 561 additions and 64 deletions

View File

@ -119,6 +119,19 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
$routes->post('batchjob_delete', 'ServiceItemController::batchjob_delete'); $routes->post('batchjob_delete', 'ServiceItemController::batchjob_delete');
$routes->get('download/(:alpha)', 'ServiceItemController::download/$1'); $routes->get('download/(:alpha)', 'ServiceItemController::download/$1');
}); });
$routes->group('servicehistory', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
$routes->get('/', 'ServiceHistoryController::index', []);
$routes->get('create', 'ServiceHistoryController::create_form');
$routes->post('create', 'ServiceHistoryController::create');
$routes->get('modify/(:num)', 'ServiceHistoryController::modify_form/$1');
$routes->post('modify/(:num)', 'ServiceHistoryController::modify/$1');
$routes->get('view/(:num)', 'ServiceHistoryController::view/$1');
$routes->get('delete/(:num)', 'ServiceHistoryController::delete/$1');
$routes->get('toggle/(:num)/(:any)', 'ServiceHistoryController::toggle/$1/$2');
$routes->post('batchjob', 'ServiceHistoryController::batchjob');
$routes->post('batchjob_delete', 'ServiceHistoryController::batchjob_delete');
$routes->get('download/(:alpha)', 'ServiceHistoryController::download/$1');
});
}); });
$routes->group('equipment', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) { $routes->group('equipment', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
$routes->group('server', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) { $routes->group('server', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {

View File

@ -8,10 +8,20 @@ use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use App\Services\Customer\ClientService; use App\Services\Customer\ClientService;
use App\Services\Equipment\Part\CpuService;
use App\Services\Equipment\Part\DefenceService;
use App\Services\Equipment\Part\StorageService;
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\ServerService;
use App\Services\Equipment\DomainService;
abstract class CustomerController extends AdminController abstract class CustomerController extends AdminController
{ {
private ?ClientService $_clientService = null; private ?ClientService $_clientService = null;
private $_equipmentService = [];
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{ {
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
@ -39,4 +49,42 @@ abstract class CustomerController extends AdminController
return $options; return $options;
} }
//Index,FieldForm관련 //Index,FieldForm관련
//ServiceItemController,ServiceController에서 사용
final public function getEquipmentService(string $key): mixed
{
if (!array_key_exists($key, $this->_equipmentService)) {
switch ($key) {
case 'SERVER':
$this->_equipmentService[$key] = new ServerService();
break;
case 'CPU':
$this->_equipmentService[$key] = new CpuService();
break;
case 'RAM':
$this->_equipmentService[$key] = new RamService();
break;
case 'STORAGE':
$this->_equipmentService[$key] = new StorageService();
break;
case 'LINE':
$this->_equipmentService[$key] = new LineService();
break;
case 'IP':
$this->_equipmentService[$key] = new IpService();
break;
case 'DEFENCE':
$this->_equipmentService[$key] = new DefenceService();
break;
case 'SOFTWARE':
$this->_equipmentService[$key] = new SoftwareService();
break;
case 'DOMAIN':
$this->_equipmentService[$key] = new DomainService();
break;
default:
throw new \Exception(__FUNCTION__ . "에서 사용하지않는 Service를 요청하였습니다.: {$key}");
}
}
return $this->_equipmentService[$key];
}
} }

View File

@ -11,20 +11,10 @@ use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface; use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use App\Services\Equipment\Part\CpuService;
use App\Services\Equipment\Part\DefenceService;
use App\Services\Equipment\Part\StorageService;
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\ServerService;
use App\Services\Equipment\DomainService;
class ServiceController extends CustomerController class ServiceController extends CustomerController
{ {
private ?ServiceItemService $_serviceItemService = null; private ?ServiceItemService $_serviceItemService = null;
private $_equipmentService = [];
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{ {
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
@ -55,43 +45,6 @@ class ServiceController extends CustomerController
} }
return $this->_serviceItemService; return $this->_serviceItemService;
} }
final public function getEquipmentService(string $key): mixed
{
if (!array_key_exists($key, $this->_equipmentService)) {
switch ($key) {
case 'SERVER':
$this->_equipmentService[$key] = new ServerService();
break;
case 'CPU':
$this->_equipmentService[$key] = new CpuService();
break;
case 'RAM':
$this->_equipmentService[$key] = new RamService();
break;
case 'STORAGE':
$this->_equipmentService[$key] = new StorageService();
break;
case 'LINE':
$this->_equipmentService[$key] = new LineService();
break;
case 'IP':
$this->_equipmentService[$key] = new IpService();
break;
case 'DEFENCE':
$this->_equipmentService[$key] = new DefenceService();
break;
case 'SOFTWARE':
$this->_equipmentService[$key] = new SoftwareService();
break;
case 'DOMAIN':
$this->_equipmentService[$key] = new DomainService();
break;
default:
throw new \Exception(__FUNCTION__ . "에서 사용하지않는 Service를 요청하였습니다.: {$key}");
}
}
return $this->_equipmentService[$key];
}
protected function getFormFieldOption(string $field, array $options = []): array protected function getFormFieldOption(string $field, array $options = []): array
{ {
switch ($field) { switch ($field) {

View File

@ -0,0 +1,79 @@
<?php
namespace App\Controllers\Admin\Customer;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Helpers\Customer\ServiceHistoryHelper;
use App\Services\Customer\ServiceHistoryService;
use App\Services\Customer\ServiceService;
class ServiceHistoryController extends CustomerController
{
private ?ServiceService $_serviceService = null;
private $_equipmentService = [];
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->title = lang("{$this->getService()->getClassName()}.title");
$this->class_path .= $this->getService()->getClassName();
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
}
public function getService(): ServiceHistoryService
{
if (!$this->_service) {
$this->_service = new ServiceHistoryService($this->request);
}
return $this->_service;
}
public function getHelper(): ServiceHistoryHelper
{
if (!$this->_helper) {
$this->_helper = new ServiceHistoryHelper($this->request);
}
return $this->_helper;
}
public function getServiceService(): ServiceService
{
if (!$this->_serviceService) {
$this->_serviceService = new ServiceService($this->request);
}
return $this->_serviceService;
}
protected function getFormFieldOption(string $field, array $options = []): array
{
switch ($field) {
case 'serviceinfo_uid':
foreach ($this->getServiceService()->getEntities() as $entity) {
$options[$entity->getPK()] = $entity->getTitle();
}
break;
default:
$options = parent::getFormFieldOption($field, $options);
break;
}
return $options;
}
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
{
switch ($this->getAction()) {
case 'index':
$this->control = $this->getControlDatas();
$this->getHelper()->setViewDatas($this->getViewDatas());
$result = view($this->view_path . 'popup' . DIRECTORY_SEPARATOR . $this->getAction(), ['viewDatas' => $this->getViewDatas()]);
break;
default:
$result = parent::getResultSuccess($message);
break;
}
return $result;
}
//Index,FieldForm관련
}

View File

@ -93,7 +93,7 @@ class ServiceItemController extends CustomerController
throw new \Exception("{$formDatas['serviceinfo_uid']}에 대한 서비스정보를 찾을수 없습니다."); throw new \Exception("{$formDatas['serviceinfo_uid']}에 대한 서비스정보를 찾을수 없습니다.");
} }
$equipmentEntity = $this->getEquipmentService($formDatas['item_type'])->create([ $equipmentEntity = $this->getEquipmentService($formDatas['item_type'])->create([
'clientinfo_uid' => $serviceEntity->getClientInfoUID(), 'clientinfo_uid' => $serviceEntity->getClientUID(),
'domain' => $formDatas['item_uid'] 'domain' => $formDatas['item_uid']
]); ]);
//도메인용 항목의 item_uid로 전달함 //도메인용 항목의 item_uid로 전달함

View File

@ -411,6 +411,7 @@ abstract class CommonController extends BaseController
$this->setFieldRule($field, $this->getFormFieldRule($this->getAction(), $field)); $this->setFieldRule($field, $this->getFormFieldRule($this->getAction(), $field));
//입력값정의 //입력값정의
$formDatas = [$field => $this->request->getVar($field)]; $formDatas = [$field => $this->request->getVar($field)];
// dd($formDatas);
$this->entity = $this->toggle_process($entity, $formDatas); $this->entity = $this->toggle_process($entity, $formDatas);
$this->getService()->getModel()->transCommit(); $this->getService()->getModel()->transCommit();
return $this->getResultSuccess(); return $this->getResultSuccess();
@ -574,7 +575,7 @@ abstract class CommonController extends BaseController
if ($value) { if ($value) {
$this->$field = $value; $this->$field = $value;
} }
} }
$this->entity = $this->view_process($entity); $this->entity = $this->view_process($entity);
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []]; $this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
return $this->getResultSuccess(); return $this->getResultSuccess();

View File

@ -4,13 +4,13 @@
"settings": { "settings": {
"width": 3000, "width": 3000,
"height": 3000, "height": 3000,
"scrollTop": -903.0309, "scrollTop": -1395.0309,
"scrollLeft": -660.6028, "scrollLeft": -515.7816,
"zoomLevel": 0.76, "zoomLevel": 0.76,
"show": 511, "show": 511,
"database": 4, "database": 4,
"databaseName": "", "databaseName": "",
"canvasType": "ERD", "canvasType": "@dineug/erd-editor/builtin-schema-sql",
"language": 1, "language": 1,
"tableNameCase": 4, "tableNameCase": 4,
"columnNameCase": 2, "columnNameCase": 2,
@ -50,7 +50,8 @@
"8GMPyGUFlx2Mw7BwzizfD", "8GMPyGUFlx2Mw7BwzizfD",
"B8haiEbPc1lRBWTv1g25G", "B8haiEbPc1lRBWTv1g25G",
"isiA_oaJNIm3F4nYJuLJ1", "isiA_oaJNIm3F4nYJuLJ1",
"0WXrjcyXXGeoAVM2VB8s2" "0WXrjcyXXGeoAVM2VB8s2",
"eLGlqJ4z_woGP6CLZEuUr"
], ],
"relationshipIds": [ "relationshipIds": [
"gAVYXWnBSnCw-0ieO4Mil", "gAVYXWnBSnCw-0ieO4Mil",
@ -65,7 +66,8 @@
"anhMCXytE7rcE_drKBPWz", "anhMCXytE7rcE_drKBPWz",
"Wma86GpS3BhikEaHSamgX", "Wma86GpS3BhikEaHSamgX",
"I80TuGxKm3tXIO_EO2PSm", "I80TuGxKm3tXIO_EO2PSm",
"o8yw46vm30cC7wl9cRMdo" "o8yw46vm30cC7wl9cRMdo",
"ocWjncqwtYkP02mw4A0-8"
], ],
"indexIds": [], "indexIds": [],
"memoIds": [] "memoIds": []
@ -373,15 +375,15 @@
"R-UjmO-S2UeQdddVNwH5M" "R-UjmO-S2UeQdddVNwH5M"
], ],
"ui": { "ui": {
"x": 157.5582, "x": 160.1898,
"y": 1812.2726, "y": 2080.6937,
"zIndex": 2, "zIndex": 2,
"widthName": 60, "widthName": 60,
"widthComment": 60, "widthComment": 60,
"color": "" "color": ""
}, },
"meta": { "meta": {
"updateAt": 1749008087739, "updateAt": 1749520757443,
"createAt": 1745819764138 "createAt": 1745819764138
} }
}, },
@ -931,6 +933,42 @@
"updateAt": 1749435563253, "updateAt": 1749435563253,
"createAt": 1748507247933 "createAt": 1748507247933
} }
},
"eLGlqJ4z_woGP6CLZEuUr": {
"id": "eLGlqJ4z_woGP6CLZEuUr",
"name": "serviceinfo_history",
"comment": "서비스정보_history",
"columnIds": [
"GSdcECWONRu3DzkVAl77W",
"jyD_WqbebGSYxIa72ig3p",
"LmgKX38-LCXZSgqcIgHJj",
"4-Pao4CcHMrZtTY6e6qCK",
"oCf04YALk6M6oHU8bZHOy",
"DyDt_9ZdXzTgjVTIBUnYE",
"48WpZBVteR66aLEAb_iOh"
],
"seqColumnIds": [
"GSdcECWONRu3DzkVAl77W",
"Bj32Fyri_pY_6cWVF3Qn0",
"jyD_WqbebGSYxIa72ig3p",
"LmgKX38-LCXZSgqcIgHJj",
"4-Pao4CcHMrZtTY6e6qCK",
"oCf04YALk6M6oHU8bZHOy",
"DyDt_9ZdXzTgjVTIBUnYE",
"48WpZBVteR66aLEAb_iOh"
],
"ui": {
"x": 35.2385,
"y": 1775.0406,
"zIndex": 2505,
"widthName": 99,
"widthComment": 103,
"color": ""
},
"meta": {
"updateAt": 1749520763447,
"createAt": 1749520593335
}
} }
}, },
"tableColumnEntities": { "tableColumnEntities": {
@ -6573,6 +6611,166 @@
"updateAt": 1749517861624, "updateAt": 1749517861624,
"createAt": 1749517809732 "createAt": 1749517809732
} }
},
"GSdcECWONRu3DzkVAl77W": {
"id": "GSdcECWONRu3DzkVAl77W",
"tableId": "eLGlqJ4z_woGP6CLZEuUr",
"name": "uid",
"comment": "",
"dataType": "INT",
"default": "",
"options": 11,
"ui": {
"keys": 1,
"widthName": 60,
"widthComment": 60,
"widthDataType": 60,
"widthDefault": 60
},
"meta": {
"updateAt": 1749520665994,
"createAt": 1749520659473
}
},
"Bj32Fyri_pY_6cWVF3Qn0": {
"id": "Bj32Fyri_pY_6cWVF3Qn0",
"tableId": "eLGlqJ4z_woGP6CLZEuUr",
"name": "serviceinfo_uid",
"comment": "",
"dataType": "INT",
"default": "",
"options": 8,
"ui": {
"keys": 0,
"widthName": 80,
"widthComment": 60,
"widthDataType": 60,
"widthDefault": 60
},
"meta": {
"updateAt": 1749520659473,
"createAt": 1749520659473
}
},
"oCf04YALk6M6oHU8bZHOy": {
"id": "oCf04YALk6M6oHU8bZHOy",
"tableId": "eLGlqJ4z_woGP6CLZEuUr",
"name": "status",
"comment": "상태",
"dataType": "VARCHAR(20)",
"default": "'default'",
"options": 8,
"ui": {
"keys": 0,
"widthName": 60,
"widthComment": 60,
"widthDataType": 75,
"widthDefault": 60
},
"meta": {
"updateAt": 1749520659473,
"createAt": 1749520659473
}
},
"DyDt_9ZdXzTgjVTIBUnYE": {
"id": "DyDt_9ZdXzTgjVTIBUnYE",
"tableId": "eLGlqJ4z_woGP6CLZEuUr",
"name": "updated_at",
"comment": "",
"dataType": "TIMESTAMP",
"default": "",
"options": 0,
"ui": {
"keys": 0,
"widthName": 62,
"widthComment": 60,
"widthDataType": 65,
"widthDefault": 60
},
"meta": {
"updateAt": 1749520659473,
"createAt": 1749520659473
}
},
"48WpZBVteR66aLEAb_iOh": {
"id": "48WpZBVteR66aLEAb_iOh",
"tableId": "eLGlqJ4z_woGP6CLZEuUr",
"name": "created_at",
"comment": "",
"dataType": "TIMESTAMP",
"default": "CURRENT_TIMESTAMP",
"options": 8,
"ui": {
"keys": 0,
"widthName": 60,
"widthComment": 60,
"widthDataType": 65,
"widthDefault": 122
},
"meta": {
"updateAt": 1749520659473,
"createAt": 1749520659473
}
},
"LmgKX38-LCXZSgqcIgHJj": {
"id": "LmgKX38-LCXZSgqcIgHJj",
"tableId": "eLGlqJ4z_woGP6CLZEuUr",
"name": "title",
"comment": "",
"dataType": "VARCHAR(255)",
"default": "",
"options": 8,
"ui": {
"keys": 0,
"widthName": 60,
"widthComment": 60,
"widthDataType": 81,
"widthDefault": 60
},
"meta": {
"updateAt": 1749520700141,
"createAt": 1749520682358
}
},
"4-Pao4CcHMrZtTY6e6qCK": {
"id": "4-Pao4CcHMrZtTY6e6qCK",
"tableId": "eLGlqJ4z_woGP6CLZEuUr",
"name": "description",
"comment": "",
"dataType": "TEXT",
"default": "",
"options": 0,
"ui": {
"keys": 0,
"widthName": 61,
"widthComment": 60,
"widthDataType": 60,
"widthDefault": 60
},
"meta": {
"updateAt": 1749520710971,
"createAt": 1749520710971
}
},
"jyD_WqbebGSYxIa72ig3p": {
"id": "jyD_WqbebGSYxIa72ig3p",
"tableId": "eLGlqJ4z_woGP6CLZEuUr",
"name": "serviceinfo_uid",
"comment": "",
"dataType": "INT",
"default": "",
"options": 8,
"ui": {
"keys": 2,
"widthName": 80,
"widthComment": 60,
"widthDataType": 60,
"widthDefault": 60
},
"meta": {
"updateAt": 1749520739979,
"createAt": 1749520727362
}
} }
}, },
"relationshipEntities": { "relationshipEntities": {
@ -6707,8 +6905,8 @@
"columnIds": [ "columnIds": [
"f7_MGvRjkwL1xkCWrAgDR" "f7_MGvRjkwL1xkCWrAgDR"
], ],
"x": 655.5581999999999, "x": 658.1898,
"y": 1912.2726, "y": 2180.6937,
"direction": 2 "direction": 2
}, },
"meta": { "meta": {
@ -6867,7 +7065,7 @@
"N_yJVoCN4oUEDhYqdzApb" "N_yJVoCN4oUEDhYqdzApb"
], ],
"x": 934.3741, "x": 934.3741,
"y": 1236.673, "y": 1132.673,
"direction": 1 "direction": 1
}, },
"end": { "end": {
@ -6939,6 +7137,34 @@
"updateAt": 1749517809733, "updateAt": 1749517809733,
"createAt": 1749517809733 "createAt": 1749517809733
} }
},
"ocWjncqwtYkP02mw4A0-8": {
"id": "ocWjncqwtYkP02mw4A0-8",
"identification": false,
"relationshipType": 16,
"startRelationshipType": 2,
"start": {
"tableId": "B8haiEbPc1lRBWTv1g25G",
"columnIds": [
"N_yJVoCN4oUEDhYqdzApb"
],
"x": 934.3741,
"y": 1340.673,
"direction": 1
},
"end": {
"tableId": "eLGlqJ4z_woGP6CLZEuUr",
"columnIds": [
"jyD_WqbebGSYxIa72ig3p"
],
"x": 556.2385,
"y": 1887.0406,
"direction": 2
},
"meta": {
"updateAt": 1749520727362,
"createAt": 1749520727362
}
} }
}, },
"indexEntities": {}, "indexEntities": {},

View File

@ -11,7 +11,7 @@ abstract class CustomerEntity extends CommonEntity
parent::__construct($data); parent::__construct($data);
} }
final public function getClientInfoUID(): int final public function getClientUID(): int
{ {
return intval($this->attributes['clientinfo_uid']); return intval($this->attributes['clientinfo_uid']);
} }

View File

@ -8,6 +8,10 @@ class ServiceEntity extends CustomerEntity
{ {
const PK = ServiceModel::PK; const PK = ServiceModel::PK;
const TITLE = ServiceModel::TITLE; const TITLE = ServiceModel::TITLE;
final public function getOwnertUID(): int
{
return intval($this->attributes['ownerinfo_uid']);
}
public function getItemEntities(string $type): array public function getItemEntities(string $type): array
{ {
return $this->attributes[$type] ?? []; return $this->attributes[$type] ?? [];

View File

@ -0,0 +1,15 @@
<?php
namespace App\Entities\Customer;
use App\Models\Customer\ServiceHistoryModel;
class ServiceHistoryEntity extends CustomerEntity
{
const PK = ServiceHistoryModel::PK;
const TITLE = ServiceHistoryModel::TITLE;
public function getServiceUid(): int
{
return intval($this->attributes['serviceinfo_uid']);
}
}

View File

@ -8,7 +8,10 @@ class ServiceItemEntity extends CustomerEntity
{ {
const PK = ServiceItemModel::PK; const PK = ServiceItemModel::PK;
const TITLE = ServiceItemModel::TITLE; const TITLE = ServiceItemModel::TITLE;
public function getServiceUid(): int
{
return intval($this->attributes['serviceinfo_uid']);
}
public function getItemUid(): int public function getItemUid(): int
{ {
return intval($this->attributes['item_uid']); return intval($this->attributes['item_uid']);

View File

@ -31,7 +31,7 @@ class ServiceHelper extends CustomerHelper
ICONS['SETUP'], ICONS['SETUP'],
$field, $field,
[ [
"data-src" => "/admin/customer/serviceitem?item_type={$field}&serviceinfo_uid={$viewDatas['entity']->getPK()}", "data-src" => "/admin/customer/serviceitem?serviceinfo_uid={$viewDatas['entity']->getPK()}&item_type={$field}",
"data-bs-toggle" => "modal", "data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form", "data-bs-target" => "#index_action_form",
...$extras ...$extras
@ -80,4 +80,27 @@ class ServiceHelper extends CustomerHelper
} }
return $value; return $value;
} }
public function getListButton(string $action, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'history':
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
$action = form_label(
ICONS['PLAY'],
$action,
[
"data-src" => "/admin/customer/servicehistory?serviceinfo_uid={$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;
}
} }

View File

@ -0,0 +1,16 @@
<?php
namespace App\Helpers\Customer;
use App\Models\Customer\ServiceHistoryModel;
use CodeIgniter\HTTP\IncomingRequest;
class ServiceHistoryHelper extends CustomerHelper
{
protected ?IncomingRequest $request = null;
public function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
$this->setTitleField(field: ServiceHistoryModel::TITLE);
}
}

View File

@ -0,0 +1,20 @@
<?php
return [
'title' => "서비스History정보",
'label' => [
'serviceinfo_uid' => "서비스명",
'title' => "제목",
'description' => "상세정보",
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "신청일",
'deleted_at' => "삭제일",
],
'DEFAULTS' => [
'status' => 'default'
],
"STATUS" => [
'default' => "사용중",
'delete' => "삭제",
],
];

View File

@ -0,0 +1,44 @@
<?php
namespace App\Models\Customer;
use App\Entities\Customer\ServiceHistoryEntity;
class ServiceHistoryModel extends CustomerModel
{
const TABLE = "serviceinfo_history";
const PK = "uid";
const TITLE = "title";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = ServiceHistoryEntity::class;
protected $allowedFields = [
"serviceinfo_uid",
"title",
"description",
"status",
"updated_at"
];
public function __construct()
{
parent::__construct();
}
public function getFormFieldRule(string $action, string $field): string
{
if (is_array($field)) {
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case "serviceinfo_uid":
$rule = "required|numeric";
break;
case "title":
$rule = "required|trim|string";
break;
default:
$rule = parent::getFormFieldRule($action, $field);
break;
}
return $rule;
}
}

View File

@ -14,6 +14,7 @@ class ServiceModel extends CustomerModel
protected $returnType = ServiceEntity::class; protected $returnType = ServiceEntity::class;
protected $allowedFields = [ protected $allowedFields = [
"clientinfo_uid", "clientinfo_uid",
"ownerinfo_uid",
"title", "title",
"type", "type",
"location", "location",
@ -37,6 +38,7 @@ class ServiceModel extends CustomerModel
} }
switch ($field) { switch ($field) {
case "clientinfo_uid": case "clientinfo_uid":
case "ownerinfo_uid":
$rule = "required|numeric"; $rule = "required|numeric";
break; break;
case "title": case "title":

View File

@ -0,0 +1,46 @@
<?php
namespace App\Services\Customer;
use App\Entities\Customer\ServiceHistoryEntity;
use App\Models\Customer\ServiceHistoryModel;
use CodeIgniter\HTTP\IncomingRequest;
class ServiceHistoryService extends CustomerService
{
protected ?IncomingRequest $request = null;
public function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
$this->addClassName('ServiceHistory');
}
public function getModelClass(): ServiceHistoryModel
{
return new ServiceHistoryModel();
}
public function getEntityClass(): ServiceHistoryEntity
{
return new ServiceHistoryEntity();
}
public function getFormFields(): array
{
return [
"serviceinfo_uid",
"title",
"description",
"status",
];
}
public function getFilterFields(): array
{
return ["serviceinfo_uid", 'status'];
}
public function getBatchJobFields(): array
{
return ['status'];
}
public function getIndexFields(): array
{
return ['serviceinfo_uid', 'title', 'status', 'created_at'];
}
}

View File

@ -27,7 +27,10 @@
<?php foreach ($viewDatas['control']['index_fields'] as $field): ?> <?php foreach ($viewDatas['control']['index_fields'] as $field): ?>
<td><?= $viewDatas['helper']->getFieldView($field, $viewDatas) ?></td> <td><?= $viewDatas['helper']->getFieldView($field, $viewDatas) ?></td>
<?php endforeach ?> <?php endforeach ?>
<td><?= $viewDatas['helper']->getListButton('delete', $viewDatas) ?></td> <td nowrap>
<?= $viewDatas['helper']->getListButton('view', $viewDatas) ?>&nbsp;
<?= $viewDatas['helper']->getListButton('delete', $viewDatas) ?>
</td>
</tr> </tr>
<?php $cnt++ ?> <?php $cnt++ ?>
<?php endforeach ?> <?php endforeach ?>

View File

@ -40,6 +40,7 @@
<?php endforeach ?> <?php endforeach ?>
<td nowrap> <td nowrap>
<?= $viewDatas['helper']->getListButton('view', $viewDatas) ?>&nbsp; <?= $viewDatas['helper']->getListButton('view', $viewDatas) ?>&nbsp;
<?= $viewDatas['helper']->getListButton('history', $viewDatas) ?>&nbsp;
<?= $viewDatas['helper']->getListButton('delete', $viewDatas) ?> <?= $viewDatas['helper']->getListButton('delete', $viewDatas) ?>
</td> </td>
</tr> </tr>