dbms_init...1
This commit is contained in:
parent
07a4799f31
commit
b292ca2f6b
@ -93,6 +93,19 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
||||
$routes->post('batchjob_delete', 'PointController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'PointController::download/$1');
|
||||
});
|
||||
$routes->group('service', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
|
||||
$routes->get('/', 'ServiceController::index', []);
|
||||
$routes->get('create', 'ServiceController::create_form');
|
||||
$routes->post('create', 'ServiceController::create');
|
||||
$routes->get('modify/(:num)', 'ServiceController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'ServiceController::modify/$1');
|
||||
$routes->get('view/(:num)', 'ServiceController::view/$1');
|
||||
$routes->get('delete/(:num)', 'ServiceController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'ServiceController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'ServiceController::batchjob');
|
||||
$routes->post('batchjob_delete', 'ServiceController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'ServiceController::download/$1');
|
||||
});
|
||||
});
|
||||
$routes->group('equipment', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
$routes->group('line', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
|
||||
@ -52,36 +52,36 @@ 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());
|
||||
// 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());
|
||||
// //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());
|
||||
// //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;
|
||||
}
|
||||
// return $entity;
|
||||
// }
|
||||
//Index,FieldForm관련.
|
||||
|
||||
//View관련
|
||||
|
||||
@ -8,13 +8,11 @@ use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Services\Customer\AccountService;
|
||||
use App\Services\Customer\ClientService;
|
||||
use App\Services\Customer\CouponService;
|
||||
use App\Services\Customer\PointService;
|
||||
|
||||
abstract class CustomerController extends AdminController
|
||||
{
|
||||
private ?ClientService $_clientService = null;
|
||||
private ?AccountService $_accountService = null;
|
||||
private ?CouponService $_couponService = null;
|
||||
private ?PointService $_pointService = null;
|
||||
@ -24,13 +22,6 @@ abstract class CustomerController extends AdminController
|
||||
$this->uri_path .= 'customer/';
|
||||
// $this->view_path .= "customer" . DIRECTORY_SEPARATOR;
|
||||
}
|
||||
final public function getClientService(): ClientService
|
||||
{
|
||||
if (!$this->_clientService) {
|
||||
$this->_clientService = new ClientService($this->request);
|
||||
}
|
||||
return $this->_clientService;
|
||||
}
|
||||
final public function getAccountService(): AccountService
|
||||
{
|
||||
if (!$this->_accountService) {
|
||||
@ -53,18 +44,4 @@ abstract class CustomerController extends AdminController
|
||||
return $this->_pointService;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
protected function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'clientinfo_uid':
|
||||
$options[$field] = $this->getClientService()->getFormFieldOption($field);
|
||||
// echo $this->getUserModel()->getLastQuery();
|
||||
// dd($options);
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
|
||||
46
app/Controllers/Admin/Customer/ServiceController.php
Normal file
46
app/Controllers/Admin/Customer/ServiceController.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\Customer\ServiceHelper;
|
||||
use App\Services\Customer\ServiceService;
|
||||
|
||||
class ServiceController extends CustomerController
|
||||
{
|
||||
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(): ServiceService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new ServiceService($this->request);
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
public function getHelper(): mixed
|
||||
{
|
||||
if (!$this->_helper) {
|
||||
$this->_helper = new ServiceHelper($this->request);
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련.
|
||||
protected function index_process(): array
|
||||
{
|
||||
$fields = [
|
||||
'fields' => ['clientinfo_uid', 'type', $this->getService()->getModel()->getTitleField(), 'payment_date', 'amount', 'startdate_at', 'enddate_at', 'status'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
$this->modal_type = 'modal_iframe';
|
||||
return parent::index_process();
|
||||
}
|
||||
}
|
||||
@ -9,13 +9,11 @@ use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Services\Equipment\LineService;
|
||||
use App\Services\Equipment\ServerService;
|
||||
use App\Services\Customer\ClientService;
|
||||
|
||||
abstract class EquipmentController extends AdminController
|
||||
{
|
||||
private ?ServerService $_serverService = null;
|
||||
private ?LineService $_lineService = null;
|
||||
private ?ClientService $_clientService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
@ -36,19 +34,12 @@ abstract class EquipmentController extends AdminController
|
||||
}
|
||||
return $this->_lineService;
|
||||
}
|
||||
final public function getClientService(): ClientService
|
||||
{
|
||||
if (!$this->_clientService) {
|
||||
$this->_clientService = new ClientService($this->request);
|
||||
}
|
||||
return $this->_clientService;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
protected function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'clientinfo_uid':
|
||||
$options[$field] = $this->getClientService()->getFormFieldOption($field);
|
||||
case 'lineinfo_uid':
|
||||
$options[$field] = $this->getLineService()->getFormFieldOption($field);
|
||||
// echo $this->getUserModel()->getLastQuery();
|
||||
// dd($options);
|
||||
break;
|
||||
|
||||
@ -35,18 +35,13 @@ class PartController extends EquipmentController
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
protected function setValidation(Validation $validation, string $action, string $field, ?string $rule = null): Validation
|
||||
protected function index_process(): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'role':
|
||||
//아래 Rule Array는 필드명.* checkbox를 사용
|
||||
$validation->setRule("{$field}.*", $field, $rule);
|
||||
break;
|
||||
default:
|
||||
$validation = parent::setValidation($validation, $action, $field, $rule);
|
||||
break;
|
||||
}
|
||||
return $validation;
|
||||
$fields = [
|
||||
'fields' => ['clientinfo_uid', 'type', $this->getService()->getModel()->getTitleField(), 'capacity', 'price', 'status', 'description'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
$this->modal_type = 'modal_iframe';
|
||||
return parent::index_process();
|
||||
}
|
||||
//Index,FieldForm관련.
|
||||
}
|
||||
|
||||
@ -4,14 +4,15 @@ 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\ServerHelper;
|
||||
use App\Services\Equipment\ServerService;
|
||||
use App\Services\Equipment\PartService;
|
||||
|
||||
class ServerController extends EquipmentController
|
||||
{
|
||||
private ?PartService $_partService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
@ -34,6 +35,30 @@ class ServerController extends EquipmentController
|
||||
}
|
||||
return $this->_helper;
|
||||
}
|
||||
final public function getPartService(): PartService
|
||||
{
|
||||
if (!$this->_partService) {
|
||||
$this->_partService = new PartService($this->request);
|
||||
}
|
||||
return $this->_partService;
|
||||
}
|
||||
|
||||
//Index,FieldForm관련
|
||||
protected function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'partinfo_uid':
|
||||
$options[$field] = $this->getPartService()->getFormFieldOption($field);
|
||||
// echo $this->getUserModel()->getLastQuery();
|
||||
// dd($options);
|
||||
break;
|
||||
default:
|
||||
$options = parent::getFormFieldOption($field, $options);
|
||||
break;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
//Index,FieldForm관련
|
||||
protected function index_process(): array
|
||||
{
|
||||
|
||||
@ -35,18 +35,13 @@ class SoftwareController extends EquipmentController
|
||||
return $this->_helper;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
protected function setValidation(Validation $validation, string $action, string $field, ?string $rule = null): Validation
|
||||
protected function index_process(): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'role':
|
||||
//아래 Rule Array는 필드명.* checkbox를 사용
|
||||
$validation->setRule("{$field}.*", $field, $rule);
|
||||
break;
|
||||
default:
|
||||
$validation = parent::setValidation($validation, $action, $field, $rule);
|
||||
break;
|
||||
}
|
||||
return $validation;
|
||||
$fields = [
|
||||
'fields' => ['type', $this->getService()->getModel()->getTitleField(), 'price', 'status', 'description'],
|
||||
];
|
||||
$this->init('index', $fields);
|
||||
$this->modal_type = 'modal_iframe';
|
||||
return parent::index_process();
|
||||
}
|
||||
//Index,FieldForm관련.
|
||||
}
|
||||
|
||||
@ -17,11 +17,13 @@ use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Libraries\LogCollector;
|
||||
use App\Services\MyLogService;
|
||||
use App\Services\Customer\ClientService;
|
||||
|
||||
abstract class CommonController extends BaseController
|
||||
{
|
||||
private $_myAuth = null;
|
||||
private $_myLogService = null;
|
||||
private ?MyLogService $_myLogService = null;
|
||||
private ?ClientService $_clientService = null;
|
||||
private $_viewDatas = [];
|
||||
abstract public function getService(): mixed;
|
||||
abstract function getHelper(): mixed;
|
||||
@ -57,6 +59,13 @@ abstract class CommonController extends BaseController
|
||||
{
|
||||
return $this->_viewDatas;
|
||||
}
|
||||
final public function getClientService(): ClientService
|
||||
{
|
||||
if (!$this->_clientService) {
|
||||
$this->_clientService = new ClientService($this->request);
|
||||
}
|
||||
return $this->_clientService;
|
||||
}
|
||||
final public function getMyLogService(): mixed
|
||||
{
|
||||
if (!$this->_myLogService) {
|
||||
@ -108,6 +117,11 @@ abstract class CommonController extends BaseController
|
||||
protected function getFormFieldOption(string $field, array $options): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'clientinfo_uid':
|
||||
$options[$field] = $this->getClientService()->getFormFieldOption($field);
|
||||
// echo $this->getUserModel()->getLastQuery();
|
||||
// dd($options);
|
||||
break;
|
||||
default:
|
||||
$options[$field] = lang($this->getService()->getClassPath() . '.' . strtoupper($field));
|
||||
break;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
16
app/Entities/Customer/ServiceEntity.php
Normal file
16
app/Entities/Customer/ServiceEntity.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Customer;
|
||||
|
||||
use App\Models\Customer\ServiceModel;
|
||||
|
||||
class ServiceEntity extends CustomerEntity
|
||||
{
|
||||
const PK = ServiceModel::PK;
|
||||
const TITLE = ServiceModel::TITLE;
|
||||
|
||||
public function getAmount()
|
||||
{
|
||||
return $this->attributes['amount'];
|
||||
}
|
||||
}
|
||||
@ -8,9 +8,4 @@ class PartEntity extends EquipmentEntity
|
||||
{
|
||||
const PK = PartModel::PK;
|
||||
const TITLE = PartModel::TITLE;
|
||||
|
||||
public function getAmount()
|
||||
{
|
||||
return $this->attributes['amount'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,9 +8,4 @@ class SoftwareEntity extends EquipmentEntity
|
||||
{
|
||||
const PK = SoftwareModel::PK;
|
||||
const TITLE = SoftwareModel::TITLE;
|
||||
|
||||
public function getAmount()
|
||||
{
|
||||
return $this->attributes['amount'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,6 +14,10 @@ class UserEntity extends CommonEntity
|
||||
{
|
||||
return $this->attributes['id'];
|
||||
}
|
||||
public function getPassword(): string
|
||||
{
|
||||
return $this->attributes['passwd'];
|
||||
}
|
||||
public function getRole(): string
|
||||
{
|
||||
return $this->attributes['role'];
|
||||
|
||||
@ -242,9 +242,19 @@ class CommonHelper
|
||||
$form = form_dropdown($field, $formOptions, $value, $extras);
|
||||
}
|
||||
break;
|
||||
case 'clientinfo_uid':
|
||||
if (!is_array($viewDatas['field_options'][$field])) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다.");
|
||||
}
|
||||
$extra_class = isset($extras['class']) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$formOptions = ["" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택'];
|
||||
foreach ($viewDatas['field_options'][$field] as $key => $label) {
|
||||
$formOptions[$key] = $label;
|
||||
}
|
||||
$form = form_dropdown($field, $formOptions, $value, ['class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
|
||||
break;
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
case 'manufactur_at':
|
||||
$extra_class = isset($extras['class']) ? $extras['class'] . ' calender' : 'calender';
|
||||
$form = form_input($field, $value ?? "", ['class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
|
||||
break;
|
||||
@ -257,11 +267,13 @@ class CommonHelper
|
||||
if (!is_array($viewDatas['field_options'][$field])) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다.");
|
||||
}
|
||||
// $extra_class = isset($extras['class']) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$extra_class = isset($extras['class']) ? $extras['class'] : "";
|
||||
$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);
|
||||
$form = form_dropdown($field, $formOptions, $value, ['class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
|
||||
} else {
|
||||
$form = form_input($field, $value ?? "", ["autocomplete" => $field, ...$extras]);
|
||||
}
|
||||
@ -287,15 +299,6 @@ class CommonHelper
|
||||
]
|
||||
);
|
||||
break;
|
||||
case 'category_uid':
|
||||
foreach (array_values($viewDatas['field_options'][$field]) as $category_2depths) {
|
||||
foreach ($category_2depths as $key => $depth) {
|
||||
if ($key == $depth) {
|
||||
$value = $depth;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'user_uid':
|
||||
$user_uids = [];
|
||||
foreach (explode(DEFAULTS["DELIMITER_ROLE"], $value) as $key) {
|
||||
@ -312,7 +315,6 @@ class CommonHelper
|
||||
break;
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
case 'manufactur_at':
|
||||
$value = $value ? date("Y-m-d", strtotime($value)) : "";
|
||||
break;
|
||||
default:
|
||||
|
||||
50
app/Helpers/Customer/ServiceHelper.php
Normal file
50
app/Helpers/Customer/ServiceHelper.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers\Customer;
|
||||
|
||||
use App\Models\Customer\ServiceModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class ServiceHelper extends CustomerHelper
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
$this->setTitleField(field: ServiceModel::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 'payment_date':
|
||||
case 'startdate_at':
|
||||
case 'enddate_at':
|
||||
$extra_class = isset($extras['class']) ? $extras['class'] . ' calender' : 'calender';
|
||||
$form = form_input($field, $value ?? "", ['class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
|
||||
break;
|
||||
default:
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $form;
|
||||
} //
|
||||
public function getFieldView(string $field, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
$value = $viewDatas['entity']->$field ?? "";
|
||||
switch ($field) {
|
||||
case 'payment_date':
|
||||
case 'startdate_at':
|
||||
case 'enddate_at':
|
||||
$value = $value ? date("Y-m-d", strtotime($value)) : "";
|
||||
break;
|
||||
|
||||
default:
|
||||
$value = parent::getFieldView($field, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
@ -27,14 +27,27 @@ class EquipmentHelper extends CommonHelper
|
||||
);
|
||||
$form = form_dropdown($field, $formOptions, $value, $extras);
|
||||
break;
|
||||
case 'manufactur_at':
|
||||
$extra_class = isset($extras['class']) ? $extras['class'] . ' calender' : 'calender';
|
||||
$form = form_input($field, $value ?? "", ['class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
|
||||
break;
|
||||
default:
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $form;
|
||||
} //
|
||||
public function getListRowColor(mixed $entity, string $field = 'status', string $value = 'use'): string
|
||||
public function getFieldView(string $field, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
return $entity->isMatched($field, $value) ? "" : 'class="table-danger"';
|
||||
$value = $viewDatas['entity']->$field ?? "";
|
||||
switch ($field) {
|
||||
case 'manufactur_at':
|
||||
$value = $value ? date("Y-m-d", strtotime($value)) : "";
|
||||
break;
|
||||
default:
|
||||
$value = parent::getFieldView($field, $viewDatas, $extras);
|
||||
break;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
29
app/Language/en/Customer/Service.php
Normal file
29
app/Language/en/Customer/Service.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
return [
|
||||
'title' => "고객서비스정보",
|
||||
'label' => [
|
||||
'clientinfo_uid' => "고객명",
|
||||
'type' => "종류",
|
||||
'title' => "제목",
|
||||
'payment_date' => "결제일",
|
||||
'amount' => "결제금액",
|
||||
'startdate_at' => "시작일",
|
||||
'enddate_at' => "해지일",
|
||||
'status' => "상태",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일",
|
||||
],
|
||||
'DEFAULTS' => [
|
||||
'type' => "hosting",
|
||||
'status' => "use"
|
||||
],
|
||||
"TYPE" => [
|
||||
"hosting" => "서버호스팅",
|
||||
"colocation" => "코로케이션",
|
||||
],
|
||||
"STATUS" => [
|
||||
"use" => "사용중",
|
||||
"pause" => "일시정지",
|
||||
"terminated" => "해지",
|
||||
],
|
||||
];
|
||||
@ -20,7 +20,7 @@ return [
|
||||
"defence" => "빙아",
|
||||
],
|
||||
"STATUS" => [
|
||||
"use" => "사용",
|
||||
"use" => "사용가능",
|
||||
"pause" => "사용정지",
|
||||
"termination" => "해지",
|
||||
],
|
||||
|
||||
@ -9,6 +9,7 @@ return [
|
||||
'price' => "금액",
|
||||
'description' => "설명",
|
||||
'status' => "상태",
|
||||
'manufactur_at' => "제조일",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일",
|
||||
],
|
||||
@ -24,7 +25,7 @@ return [
|
||||
"colocation" => "코로케이션",
|
||||
],
|
||||
"STATUS" => [
|
||||
"use" => "사용",
|
||||
"use" => "사용가능",
|
||||
"pause" => "수리중",
|
||||
"occupied" => "사용중",
|
||||
],
|
||||
|
||||
31
app/Language/en/Equipment/Part.php
Normal file
31
app/Language/en/Equipment/Part.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
return [
|
||||
'title' => "부품장비정보",
|
||||
'label' => [
|
||||
'clientinfo_uid' => "소유자명",
|
||||
'type' => "종류",
|
||||
'model' => "모델",
|
||||
'capacity' => "용량/성능",
|
||||
'price' => "금액",
|
||||
'description' => "설명",
|
||||
'status' => "상태",
|
||||
'manufactur_at' => "제조일",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일",
|
||||
],
|
||||
'DEFAULTS' => [
|
||||
'type' => 'CPU',
|
||||
'status' => "use"
|
||||
],
|
||||
"TYPE" => [
|
||||
"CPU" => "CPU",
|
||||
"RAM" => "RAM",
|
||||
"DISK" => "DISK",
|
||||
"colocation" => "코로케이션",
|
||||
],
|
||||
"STATUS" => [
|
||||
"use" => "사용가능",
|
||||
"pause" => "수리중",
|
||||
"occupied" => "사용중",
|
||||
],
|
||||
];
|
||||
@ -14,20 +14,17 @@ return [
|
||||
'created_at' => "작성일",
|
||||
],
|
||||
'DEFAULTS' => [
|
||||
'type' => 'L2',
|
||||
'type' => 'RacKMount',
|
||||
'status' => "use"
|
||||
],
|
||||
"TYPE" => [
|
||||
"normal" => "일반",
|
||||
"kcs" => "KCS",
|
||||
"vpc" => "VPC",
|
||||
"jcs" => "JCS",
|
||||
"VPN" => "VPN",
|
||||
"defence" => "방어",
|
||||
"Rack" => "RacKMount",
|
||||
"PC" => "조립PC",
|
||||
"MiniPC" => "MiniPC",
|
||||
"colocation" => "코로케이션",
|
||||
],
|
||||
"STATUS" => [
|
||||
"use" => "사용",
|
||||
"use" => "사용가능",
|
||||
"pause" => "수리중",
|
||||
"occupied" => "사용중",
|
||||
],
|
||||
|
||||
28
app/Language/en/Equipment/Software.php
Normal file
28
app/Language/en/Equipment/Software.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
return [
|
||||
'title' => "소프트웨어정보",
|
||||
'label' => [
|
||||
'type' => "종류",
|
||||
'model' => "모델",
|
||||
'price' => "금액",
|
||||
'description' => "설명",
|
||||
'status' => "상태",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일",
|
||||
],
|
||||
'DEFAULTS' => [
|
||||
'type' => 'Windows',
|
||||
'status' => "use"
|
||||
],
|
||||
"TYPE" => [
|
||||
"Windows" => "Windows OS",
|
||||
"Linux" => "Linux OS",
|
||||
"Security" => "보안용",
|
||||
"Virus" => "바이러스용",
|
||||
"App" => "어플리케이션",
|
||||
],
|
||||
"STATUS" => [
|
||||
"use" => "사용가능",
|
||||
"occupied" => "사용중",
|
||||
],
|
||||
];
|
||||
64
app/Models/Customer/ServiceModel.php
Normal file
64
app/Models/Customer/ServiceModel.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Customer;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
|
||||
class ServiceModel extends CustomerModel
|
||||
{
|
||||
const TABLE = "serviceinfo";
|
||||
const PK = "uid";
|
||||
const TITLE = "title";
|
||||
protected $table = self::TABLE;
|
||||
protected $primaryKey = self::PK;
|
||||
protected $returnType = ServiceEntity::class;
|
||||
protected $allowedFields = [
|
||||
"clientinfo_uid",
|
||||
"type",
|
||||
"title",
|
||||
"payment_date",
|
||||
"amount",
|
||||
"startdate_at",
|
||||
"enddate_at",
|
||||
"status",
|
||||
"updated_at"
|
||||
];
|
||||
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 "clientinfo_uid":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
case "amount":
|
||||
$rule = "if_exist|numeric";
|
||||
break;
|
||||
case "title":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "type":
|
||||
$rule = "required|in_list[hosting,colocation]";
|
||||
break;
|
||||
case "status":
|
||||
$rule = "required|in_list[use,pause,terminated]";
|
||||
break;
|
||||
case "payment_date":
|
||||
$rule = "required|valid_date";
|
||||
break;
|
||||
case "startdate_at":
|
||||
case "enddate_at":
|
||||
case "deleted_at":
|
||||
$rule = "if_exist|valid_date";
|
||||
default:
|
||||
$rule = parent::getFieldRule($action, $field);
|
||||
break;
|
||||
}
|
||||
return $rule;
|
||||
}
|
||||
}
|
||||
@ -17,6 +17,7 @@ class NetworkModel extends EquipmentModel
|
||||
"code",
|
||||
"type",
|
||||
"model",
|
||||
"manufactur_at",
|
||||
"price",
|
||||
"status",
|
||||
"description",
|
||||
@ -43,7 +44,10 @@ class NetworkModel extends EquipmentModel
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "type":
|
||||
$rule = "required|in_list[L2,L3,L4,Router]";
|
||||
$rule = "required|in_list[L2,L3,L4,Router,colocation]";
|
||||
break;
|
||||
case "manufactur_at":
|
||||
$rule = "required|valid_date";
|
||||
break;
|
||||
case "status":
|
||||
$rule = "required|in_list[use,pause,occupied]";
|
||||
|
||||
@ -8,15 +8,20 @@ class PartModel extends EquipmentModel
|
||||
{
|
||||
const TABLE = "partinfo";
|
||||
const PK = "uid";
|
||||
const TITLE = "title";
|
||||
const TITLE = "model";
|
||||
protected $table = self::TABLE;
|
||||
protected $primaryKey = self::PK;
|
||||
protected $returnType = PartEntity::class;
|
||||
protected $allowedFields = [
|
||||
"clientinfo_uid",
|
||||
"code",
|
||||
"type",
|
||||
"model",
|
||||
"manufactur_at",
|
||||
"capacity",
|
||||
"price",
|
||||
"status",
|
||||
"title",
|
||||
"amount",
|
||||
"description",
|
||||
"updated_at"
|
||||
];
|
||||
public function __construct()
|
||||
@ -30,14 +35,27 @@ class PartModel extends EquipmentModel
|
||||
}
|
||||
switch ($field) {
|
||||
case "clientinfo_uid":
|
||||
case "amount":
|
||||
$rule = "if_exist|numeric";
|
||||
break;
|
||||
case "capacity":
|
||||
case "price":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
case "title":
|
||||
case "code":
|
||||
case "model":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "type":
|
||||
$rule = "required|in_list[CPU,RAM,DISK,colocation]";
|
||||
break;
|
||||
case "manufactur_at":
|
||||
$rule = "required|valid_date";
|
||||
break;
|
||||
case "status":
|
||||
$rule = "required|in_list[in,out]";
|
||||
$rule = "required|in_list[use,pause,occupied]";
|
||||
break;
|
||||
case "description":
|
||||
$rule = "if_exist|trim|string";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFieldRule($action, $field);
|
||||
|
||||
@ -44,7 +44,10 @@ class ServerModel extends EquipmentModel
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "type":
|
||||
$rule = "required|in_list[normal,kcs,vpc,jcs,vpn,defence,clocation]";
|
||||
$rule = "required|in_list[Rack,PC,MiniPC,clocation]";
|
||||
break;
|
||||
case "manufactur_at":
|
||||
$rule = "required|valid_date";
|
||||
break;
|
||||
case "status":
|
||||
$rule = "required|in_list[use,pause,occupied]";
|
||||
@ -52,9 +55,6 @@ class ServerModel extends EquipmentModel
|
||||
case "description":
|
||||
$rule = "if_exist|trim|string";
|
||||
break;
|
||||
case "manufactur_at":
|
||||
$rule = "required|valid_date";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFieldRule($action, $field);
|
||||
break;
|
||||
|
||||
@ -6,17 +6,19 @@ use App\Entities\Equipment\SoftwareEntity;
|
||||
|
||||
class SoftwareModel extends EquipmentModel
|
||||
{
|
||||
const TABLE = "serverinfo";
|
||||
const TABLE = "softwareinfo";
|
||||
const PK = "uid";
|
||||
const TITLE = "title";
|
||||
const TITLE = "model";
|
||||
protected $table = self::TABLE;
|
||||
protected $primaryKey = self::PK;
|
||||
protected $returnType = SoftwareEntity::class;
|
||||
protected $allowedFields = [
|
||||
"clientinfo_uid",
|
||||
"type",
|
||||
"model",
|
||||
"price",
|
||||
"status",
|
||||
"title",
|
||||
"amount",
|
||||
"description",
|
||||
"updated_at"
|
||||
];
|
||||
public function __construct()
|
||||
@ -29,15 +31,20 @@ class SoftwareModel extends EquipmentModel
|
||||
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
|
||||
}
|
||||
switch ($field) {
|
||||
case "clientinfo_uid":
|
||||
case "amount":
|
||||
case "price":
|
||||
$rule = "required|numeric";
|
||||
break;
|
||||
case "title":
|
||||
case "model":
|
||||
$rule = "required|trim|string";
|
||||
break;
|
||||
case "type":
|
||||
$rule = "required|in_list[Windows,Linux,Security,Virus,App]";
|
||||
break;
|
||||
case "status":
|
||||
$rule = "required|in_list[in,out]";
|
||||
$rule = "required|in_list[use,occupied]";
|
||||
break;
|
||||
case "description":
|
||||
$rule = "if_exist|trim|string";
|
||||
break;
|
||||
default:
|
||||
$rule = parent::getFieldRule($action, $field);
|
||||
|
||||
@ -41,11 +41,11 @@ class LocalService extends AuthService
|
||||
|
||||
public function checkUser(array $formDatas): UserEntity
|
||||
{
|
||||
$entity = $this->getEntity(['id' => $formDatas['id']]);
|
||||
if (is_null($entity) || !isset($entity->passwd)) {
|
||||
$entity = $this->getEntity(['id' => $formDatas['id'], 'status' => 'use']);
|
||||
if (is_null($entity)) {
|
||||
throw new \Exception("사용자ID: {$formDatas['id']}가 존재하지 않습니다.");
|
||||
}
|
||||
if (!password_verify($formDatas['passwd'], $entity->passwd)) {
|
||||
if (!password_verify($formDatas['passwd'], $entity->getPassword())) {
|
||||
// log_message("error", "암호: {$formDatas['passwd']}, {$entity->passwd}");
|
||||
throw new \Exception("암호가 맞지 않습니다.");
|
||||
}
|
||||
|
||||
49
app/Services/Customer/ServiceService.php
Normal file
49
app/Services/Customer/ServiceService.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Customer;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Models\Customer\ServiceModel;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
class ServiceService extends CustomerService
|
||||
{
|
||||
protected ?IncomingRequest $request = null;
|
||||
public function __construct(?IncomingRequest $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
}
|
||||
public function getClassName(): string
|
||||
{
|
||||
return parent::getClassName() . DIRECTORY_SEPARATOR . "Service";
|
||||
}
|
||||
public function getModelClass(): ServiceModel
|
||||
{
|
||||
return new ServiceModel();
|
||||
}
|
||||
public function getEntityClass(): ServiceEntity
|
||||
{
|
||||
return new ServiceEntity();
|
||||
}
|
||||
public function getFields(): array
|
||||
{
|
||||
return [
|
||||
"clientinfo_uid",
|
||||
"type",
|
||||
"title",
|
||||
"payment_date",
|
||||
"amount",
|
||||
"startdate_at",
|
||||
"enddate_at",
|
||||
"status",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", 'type', 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['type', 'status'];
|
||||
}
|
||||
}
|
||||
@ -32,6 +32,7 @@ class NetworkService extends EquipmentService
|
||||
"code",
|
||||
"type",
|
||||
"model",
|
||||
"manufactur_at",
|
||||
"price",
|
||||
"status",
|
||||
"description",
|
||||
@ -43,6 +44,6 @@ class NetworkService extends EquipmentService
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", "type", 'status'];
|
||||
return ["type", 'status'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ namespace App\Services\Equipment;
|
||||
use App\Entities\Equipment\PartEntity;
|
||||
use App\Models\Equipment\PartModel;
|
||||
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 PartService extends EquipmentService
|
||||
{
|
||||
@ -29,17 +30,21 @@ class PartService extends EquipmentService
|
||||
{
|
||||
return [
|
||||
"clientinfo_uid",
|
||||
"type",
|
||||
"model",
|
||||
"manufactur_at",
|
||||
"capacity",
|
||||
"price",
|
||||
"status",
|
||||
"title",
|
||||
"amount",
|
||||
"description",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", 'status'];
|
||||
return ["clientinfo_uid", "type", 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
return ['type', 'status'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,6 +45,6 @@ class ServerService extends EquipmentService
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", 'type', 'status'];
|
||||
return ['type', 'status'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,18 +28,19 @@ class SoftwareService extends EquipmentService
|
||||
public function getFields(): array
|
||||
{
|
||||
return [
|
||||
"clientinfo_uid",
|
||||
"type",
|
||||
"model",
|
||||
"price",
|
||||
"status",
|
||||
"title",
|
||||
"amount",
|
||||
"description",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return ["clientinfo_uid", 'status'];
|
||||
return ['type', 'status'];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return ['status'];
|
||||
return ['type', 'status'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,6 +17,9 @@
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/customer/point"><?= ICONS['FLAG'] ?> Point내역</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/customer/service"><?= ICONS['CARD'] ?> 서비스내역</a>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<a href="/admin/customer/invoice"><?= ICONS['CARD'] ?> 청구내역</a>
|
||||
</div>
|
||||
|
||||
@ -25,4 +25,10 @@ div.action_form table td {
|
||||
/* 자동 줄바꿈 */
|
||||
}
|
||||
|
||||
/* create,modify,view 페이지용 */
|
||||
/* create,modify,view 페이지용 */
|
||||
|
||||
/*Form 안에서 datepicker 사용시*/
|
||||
/* datepicker의 z-index를 높여서 다른 요소 위에 표시되도록 설정 tinyMCE와 겹치는 문제 처리용용*/
|
||||
.ui-datepicker {
|
||||
z-index: 9999 !important;
|
||||
}
|
||||
@ -25,4 +25,10 @@ div.action_form table td {
|
||||
/* 자동 줄바꿈 */
|
||||
}
|
||||
|
||||
/* create,modify,view 페이지용 */
|
||||
/* create,modify,view 페이지용 */
|
||||
|
||||
/*Form 안에서 datepicker 사용시*/
|
||||
/* datepicker의 z-index를 높여서 다른 요소 위에 표시되도록 설정 tinyMCE와 겹치는 문제 처리용용*/
|
||||
.ui-datepicker {
|
||||
z-index: 9999 !important;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user