80 lines
2.7 KiB
PHP
80 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\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관련
|
|
}
|