74 lines
2.7 KiB
PHP
74 lines
2.7 KiB
PHP
<?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\ServicePaymentHelper;
|
|
use App\Services\Customer\ServicePaymentService;
|
|
use App\Services\Customer\ServiceService;
|
|
|
|
class ServicePaymentController extends CustomerController
|
|
{
|
|
private ?ServiceService $_serviceService = null;
|
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
|
{
|
|
parent::initController($request, $response, $logger);
|
|
$this->content_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(): ServicePaymentService
|
|
{
|
|
if (!$this->_service) {
|
|
$this->_service = new ServicePaymentService($this->request);
|
|
}
|
|
return $this->_service;
|
|
}
|
|
public function getHelper(): ServicePaymentHelper
|
|
{
|
|
if (!$this->_helper) {
|
|
$this->_helper = new ServicePaymentHelper($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;
|
|
case 'item_uid':
|
|
//$item_type(CPU,RAM,STORAGE등)에 따라 선언된 getFormFieldOption사용 됨
|
|
$item_types = ['LINE', 'IP', 'SERVER', 'CPU', 'RAM', 'STORAGE', 'SOFTWARE', 'DEFENCE', 'DOMAIN'];
|
|
foreach ($item_types as $item_type) {
|
|
$options[$item_type] = [];
|
|
foreach ($this->getService()->getEquipmentService($item_type)->getEntities() as $entity) {
|
|
$options[$item_type][$entity->getPK()] = $entity->getTitle();
|
|
}
|
|
}
|
|
break;
|
|
default:
|
|
$options = parent::getFormFieldOption($field, $options);
|
|
break;
|
|
}
|
|
return $options;
|
|
}
|
|
//Index,FieldForm관련
|
|
}
|