dbms_init...1
This commit is contained in:
parent
6f4701a5a4
commit
cd76b2566d
@ -31,6 +31,7 @@ abstract class CustomerController extends AdminController
|
|||||||
{
|
{
|
||||||
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
||||||
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
||||||
|
$this->setFieldRule($item_type, $this->getFormFieldRule($this->getAction(), $item_type));
|
||||||
$this->setFilterFieldOption($item_type, $this->getServiceService()->getFilterOptionsByItemType($item_type));
|
$this->setFilterFieldOption($item_type, $this->getServiceService()->getFilterOptionsByItemType($item_type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,11 +27,7 @@ class ServiceItemController extends CustomerController
|
|||||||
{
|
{
|
||||||
parent::initAction($action, $fields);
|
parent::initAction($action, $fields);
|
||||||
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
||||||
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
$this->setFilterOptionsByItemType();
|
||||||
$options = $this->getService()->getServiceItemLinkService($item_type)->getEntities();
|
|
||||||
$this->setFieldRule($item_type, $this->getFormFieldRule($this->getAction(), $item_type));
|
|
||||||
$this->setFilterFieldOption($item_type, $options);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public function getService(): ServiceItemService
|
public function getService(): ServiceItemService
|
||||||
{
|
{
|
||||||
@ -74,7 +70,7 @@ class ServiceItemController extends CustomerController
|
|||||||
if (!$item_type) {
|
if (!$item_type) {
|
||||||
throw new \Exception(__FUNCTION__ . "에서 item_type이 지정되지 않았습니다.");
|
throw new \Exception(__FUNCTION__ . "에서 item_type이 지정되지 않았습니다.");
|
||||||
}
|
}
|
||||||
$options = $this->getFilterFieldOption($item_type);
|
$options = $this->getFilterFieldOption('item_type');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$options = parent::getFormFieldOption($field, $options);
|
$options = parent::getFormFieldOption($field, $options);
|
||||||
|
|||||||
@ -180,8 +180,7 @@ class ServicePaymentController extends CustomerController
|
|||||||
$this->initAction(__FUNCTION__);
|
$this->initAction(__FUNCTION__);
|
||||||
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
//LINE,IP,SERVER등 추가 FilterOption 셋팅용
|
||||||
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
||||||
$options = $this->getService()->getServiceItemLinkService($item_type)->getEntities();
|
$this->setFilterFieldOption($item_type, $this->getServiceService()->getFilterOptionsByItemType($item_type));
|
||||||
$this->setFilterFieldOption($item_type, $options);
|
|
||||||
}
|
}
|
||||||
$this->invoice_process();
|
$this->invoice_process();
|
||||||
return $this->getResultSuccess();
|
return $this->getResultSuccess();
|
||||||
|
|||||||
@ -4,20 +4,21 @@ namespace App\Controllers;
|
|||||||
|
|
||||||
use App\Controllers\BaseController;
|
use App\Controllers\BaseController;
|
||||||
|
|
||||||
|
use App\Entities\FormOptionEntity;
|
||||||
|
use App\Libraries\LogCollector;
|
||||||
|
use App\Services\MyLogService;
|
||||||
|
use CodeIgniter\HTTP\DownloadResponse;
|
||||||
|
|
||||||
use CodeIgniter\HTTP\RedirectResponse;
|
use CodeIgniter\HTTP\RedirectResponse;
|
||||||
use CodeIgniter\HTTP\RequestInterface;
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use CodeIgniter\Validation\Validation;
|
use CodeIgniter\Validation\Validation;
|
||||||
|
|
||||||
use CodeIgniter\HTTP\DownloadResponse;
|
|
||||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Reader\Html;
|
use PhpOffice\PhpSpreadsheet\Reader\Html;
|
||||||
use PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf;
|
use PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
use App\Libraries\LogCollector;
|
|
||||||
use App\Services\MyLogService;
|
|
||||||
|
|
||||||
abstract class CommonController extends BaseController
|
abstract class CommonController extends BaseController
|
||||||
{
|
{
|
||||||
private $_myAuth = null;
|
private $_myAuth = null;
|
||||||
@ -146,11 +147,18 @@ abstract class CommonController extends BaseController
|
|||||||
if (!array_key_exists('filter_optons', $this->_control)) {
|
if (!array_key_exists('filter_optons', $this->_control)) {
|
||||||
$this->_control['filter_optons'] = [];
|
$this->_control['filter_optons'] = [];
|
||||||
}
|
}
|
||||||
$this->_control['filter_optons'][$field] = $options;
|
//Filter Options 초기화
|
||||||
|
$this->_control['filter_optons'][$field] = [
|
||||||
|
"" => new FormOptionEntity(["uid" => "", "title" => lang("{$this->getService()->getClassName()}.label.{$field}") . " 선택"])
|
||||||
|
];
|
||||||
|
foreach ($options as $option) {
|
||||||
|
$this->_control['filter_optons'][$field][$option->getPK()] = $option;
|
||||||
|
}
|
||||||
|
// dd($this->_control['filter_optons'][$field]);
|
||||||
}
|
}
|
||||||
final protected function getFilterFieldOption(string $field): array
|
final protected function getFilterFieldOption(string $field): array
|
||||||
{
|
{
|
||||||
return $this->_control['filter_optons'][$field] ?? [];
|
return $this->_control['filter_optons'][$field];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function initAction(string $action, $fields = []): void
|
protected function initAction(string $action, $fields = []): void
|
||||||
|
|||||||
@ -4,12 +4,6 @@ namespace App\Entities;
|
|||||||
|
|
||||||
class FormOptionEntity extends CommonEntity
|
class FormOptionEntity extends CommonEntity
|
||||||
{
|
{
|
||||||
public function getPK(): string
|
const PK = "uid";
|
||||||
{
|
const TITLE = "title";
|
||||||
return $this->attributes['uid'];
|
|
||||||
}
|
|
||||||
public function getTitle(): string
|
|
||||||
{
|
|
||||||
return $this->attributes['title'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -210,6 +210,23 @@ class CommonHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
// header.php에서 getFieldForm_Helper사용
|
// header.php에서 getFieldForm_Helper사용
|
||||||
|
protected function form_dropdown_disabled(string $field, mixed $value, array $formOptions, array $extras = [], mixed $disabledKey = null): string
|
||||||
|
{
|
||||||
|
// $formOptions는 필터 옵션 배열로, key는 필터 엔티티의 PK, value는 필터 엔티티 객체
|
||||||
|
$extra = "";
|
||||||
|
foreach ($extras as $option_tag => $option_value) {
|
||||||
|
$extra = sprintf(" %s=\"%s\"", $option_tag, htmlspecialchars($option_value, ENT_QUOTES, 'UTF-8'));
|
||||||
|
}
|
||||||
|
$html = sprintf("<select name=\"%s\" %s>", $field, $extra);
|
||||||
|
foreach ($formOptions as $key => $filterEntity) {
|
||||||
|
$isSelected = $key == $value ? ' selected' : '';
|
||||||
|
// disabledKey가 설정되어 있으면 해당 키를 disabled로 설정
|
||||||
|
$isDisabled = $disabledKey !== null && $filterEntity->getStatus() === $disabledKey ? ' disabled' : '';
|
||||||
|
$html .= sprintf("<option value=\"%s\"%s%s>%s</option>", $key, $isSelected, $isDisabled, $filterEntity->getTitle());
|
||||||
|
}
|
||||||
|
$html .= '</select>';
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||||
{
|
{
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
@ -234,12 +251,7 @@ class CommonHelper
|
|||||||
}
|
}
|
||||||
$form = implode(" ", $forms);
|
$form = implode(" ", $forms);
|
||||||
} else {
|
} else {
|
||||||
$extra_class = isset($extras['class']) ? $extras['class'] . ' select-field' : 'select-field';
|
$form = $this->form_dropdown_disabled($field, $value, $viewDatas['control']['filter_optons'][$field], $extras);
|
||||||
$formOptions = ["" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택'];
|
|
||||||
foreach ($viewDatas['control']['filter_optons'][$field] as $key => $filterEntity) {
|
|
||||||
$formOptions[$key] = $filterEntity->getTitle();
|
|
||||||
}
|
|
||||||
$form = form_dropdown($field, $formOptions, $value, [...$extras]);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'expired_at':
|
case 'expired_at':
|
||||||
@ -247,30 +259,23 @@ class CommonHelper
|
|||||||
case 'start_at':
|
case 'start_at':
|
||||||
case 'updated_at':
|
case 'updated_at':
|
||||||
case 'created_at':
|
case 'created_at':
|
||||||
$extra_class = isset($extras['class']) ? $extras['class'] . ' calender' : 'calender';
|
$extras['class'] = sprintf("class=\"%s\"", array_key_exists('class', $extras) ? $extras['class'] . ' calender' : 'calender');
|
||||||
$form = form_input($field, $value ?? "", ['class' => $extra_class, ...$extras]);
|
$form = form_input($field, $value ?? "", $extras);
|
||||||
break;
|
break;
|
||||||
case 'description':
|
case 'description':
|
||||||
case 'content':
|
case 'content':
|
||||||
$extra_class = isset($extras['class']) ? $extras['class'] . ' tinymce' : 'tinymce';
|
$extras['class'] = sprintf("class=\"%s\"", array_key_exists('class', $extras) ? $extras['class'] . ' tinymce' : 'tinymce');
|
||||||
$form = form_textarea($field, $value ?? "", ['id' => $field, 'class' => $extra_class, ...$extras]);
|
$form = form_textarea($field, $value ?? "", ['id' => $field, ...$extras]);
|
||||||
|
break;
|
||||||
|
case 'clientinfo_uid':
|
||||||
|
case 'ownerinfo_uid':
|
||||||
|
case 'user_uid':
|
||||||
|
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||||
|
$form = $this->form_dropdown_disabled($field, $value, $viewDatas['control']['filter_optons'][$field], $extras);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (in_array($field, $viewDatas['control']['filter_fields'])) {
|
if (in_array($field, $viewDatas['control']['filter_fields'])) {
|
||||||
if (!is_array($viewDatas['control']['filter_optons'][$field])) {
|
$form = $this->form_dropdown_disabled($field, $value, $viewDatas['control']['filter_optons'][$field], $extras);
|
||||||
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다.");
|
|
||||||
}
|
|
||||||
$formOptions = ["" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택'];
|
|
||||||
// dd($viewDatas['control']['filter_optons'][$field]);
|
|
||||||
foreach ($viewDatas['control']['filter_optons'][$field] as $key => $filterEntity) {
|
|
||||||
$formOptions[$key] = $filterEntity->getTitle();
|
|
||||||
}
|
|
||||||
$extra_class = isset($extras['class']) ? $extras['class'] . ' select-field' : 'select-field';
|
|
||||||
// create, create_form 액션에서는 기본값:DEFAULTS['STATUS']을 설정
|
|
||||||
if (in_array($viewDatas['control']['action'], ['create', 'create_form'])) {
|
|
||||||
$value = $value ?? DEFAULTS['STATUS'];
|
|
||||||
}
|
|
||||||
$form = form_dropdown($field, $formOptions, $value, ['class' => $extra_class, ...$extras]);
|
|
||||||
} else {
|
} else {
|
||||||
$form = form_input($field, $value ?? "", $extras);
|
$form = form_input($field, $value ?? "", $extras);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,46 +48,12 @@ class ServiceHelper extends CustomerHelper
|
|||||||
{
|
{
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'switchinfo_uid':
|
case 'switchinfo_uid':
|
||||||
if (!is_array($viewDatas['control']['filter_optons'][$field])) {
|
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||||
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다.");
|
$form = $this->form_dropdown_disabled($field, $value, $viewDatas['control']['filter_optons'][$field], $extras);
|
||||||
}
|
|
||||||
//CodeIgniter 4의 form_dropdown()은 options 배열로만 값을 받기 때문에, disabled 속성 같은 개별 옵션에 대한 HTML 속성 추가는 기본적으로 지원하지 않습니다.
|
|
||||||
$form_temps = ["<select name=\"{$field}\" class=\"select-field\"" . (isset($extras['onChange']) ? " onChange=\"{$extras['onChange']}\"" : "") . ">"];
|
|
||||||
$form_temps[] = "<option value=\"\">" . lang($viewDatas['class_path'] . '.label.' . $field) . " 선택</option>";
|
|
||||||
foreach ($viewDatas['control']['filter_optons'][$field] as $key => $filterEntity) {
|
|
||||||
$disabled = $filterEntity->getStatus() === SwitchEntity::STATUS_OCCUPIED ? 'disabled="disabled"' : '';
|
|
||||||
if (array_key_exists('index_content_top_filter', $extras)) {
|
|
||||||
$disabled = "";
|
|
||||||
}
|
|
||||||
if ($viewDatas['control']['action'] == "modify_form" && $value == $filterEntity->getPK()) {
|
|
||||||
$disabled = "";
|
|
||||||
}
|
|
||||||
$selected = ($value == $key) ? 'selected="selected"' : '';
|
|
||||||
$form_temps[] = "<option value=\"{$key}\"{$selected} {$disabled}>{$filterEntity->getTitle()}</option>";
|
|
||||||
}
|
|
||||||
$form_temps[] = '</select>';
|
|
||||||
$form = implode("", $form_temps);
|
|
||||||
break;
|
break;
|
||||||
case 'codeinfo_uid':
|
case 'codeinfo_uid':
|
||||||
if (!is_array($viewDatas['control']['filter_optons'][$field])) {
|
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||||
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다.");
|
$form = $this->form_dropdown_disabled($field, $value, $viewDatas['control']['filter_optons'][$field], $extras, CodeEntity::STATUS_OCCUPIED);
|
||||||
}
|
|
||||||
//CodeIgniter 4의 form_dropdown()은 options 배열로만 값을 받기 때문에, disabled 속성 같은 개별 옵션에 대한 HTML 속성 추가는 기본적으로 지원하지 않습니다.
|
|
||||||
$form_temps = ["<select name=\"{$field}\" class=\"select-field\"" . (isset($extras['onChange']) ? " onChange=\"{$extras['onChange']}\"" : "") . ">"];
|
|
||||||
$form_temps[] = "<option value=\"\">" . lang($viewDatas['class_path'] . '.label.' . $field) . " 선택</option>";
|
|
||||||
foreach ($viewDatas['control']['filter_optons'][$field] as $key => $filterEntity) {
|
|
||||||
$disabled = $filterEntity->getStatus() === CodeEntity::STATUS_OCCUPIED ? 'disabled="disabled"' : '';
|
|
||||||
if (array_key_exists('index_content_top_filter', $extras)) {
|
|
||||||
$disabled = "";
|
|
||||||
}
|
|
||||||
if ($viewDatas['control']['action'] == "modify_form" && $value == $filterEntity->getPK()) {
|
|
||||||
$disabled = "";
|
|
||||||
}
|
|
||||||
$selected = ($value == $key) ? 'selected="selected"' : '';
|
|
||||||
$form_temps[] = "<option value=\"{$key}\"{$selected} {$disabled}>{$filterEntity->getTitle()}</option>";
|
|
||||||
}
|
|
||||||
$form_temps[] = '</select>';
|
|
||||||
$form = implode("", $form_temps);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||||
|
|||||||
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Helpers\Customer;
|
namespace App\Helpers\Customer;
|
||||||
|
|
||||||
|
use App\Models\Customer\ServiceItemModel;
|
||||||
use App\Entities\Equipment\Part\DomainEntity;
|
use App\Entities\Equipment\Part\DomainEntity;
|
||||||
use App\Entities\Equipment\Part\IpEntity;
|
use App\Entities\Equipment\Part\IpEntity;
|
||||||
use App\Models\Customer\ServiceItemModel;
|
|
||||||
|
|
||||||
class ServiceItemHelper extends CustomerHelper
|
class ServiceItemHelper extends CustomerHelper
|
||||||
{
|
{
|
||||||
@ -15,54 +15,25 @@ class ServiceItemHelper extends CustomerHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
//ItemType에 따른 조건부 추가 Index Page
|
//ItemType에 따른 조건부 추가 Index Page
|
||||||
private function getFieldFormByItemType(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
final function getFieldFormByByItemType(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||||
{
|
{
|
||||||
$form = "";
|
// dd($viewDatas['control']);
|
||||||
// dd($viewDatas);
|
|
||||||
$item_type = $viewDatas['control']['filter_values']['item_type'];
|
$item_type = $viewDatas['control']['filter_values']['item_type'];
|
||||||
//Field는 item_uid이지만 , item_tpe에 따라 filter_options가 달라진다.
|
//Field는 item_uid이지만 , item_tpe에 따라 filter_options가 달라진다.
|
||||||
switch ($item_type) {
|
switch ($item_type) {
|
||||||
case "IP":
|
case "IP":
|
||||||
if (!is_array($viewDatas['control']['filter_optons'][$item_type])) {
|
// $options = ["" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택'];
|
||||||
throw new \Exception(__METHOD__ . "에서 {$item_type}의 field_options가 array형태가 아닙니다.");
|
// // index_content_top_filter가 있으면 disabled를 설정하지 않음
|
||||||
}
|
// // action이 modify_form이면 disabled로 설정하지 않음
|
||||||
//CodeIgniter 4의 form_dropdown()은 options 배열로만 값을 받기 때문에, disabled 속성 같은 개별 옵션에 대한 HTML 속성 추가는 기본적으로 지원하지 않습니다.
|
// if (array_key_exists('index_content_top_filter', $extras) || ($viewDatas['control']['action'] == "modify_form" && $value == $filterEntity->getPK())) {
|
||||||
$form_temps = ["<select name=\"{$field}\" class=\"select-field\"" . (isset($extras['onChange']) ? " onChange=\"{$extras['onChange']}\"" : "") . ">"];
|
// $disabledKeys = [];
|
||||||
$form_temps[] = "<option value=\"\">" . lang($viewDatas['class_path'] . '.label.' . $item_type) . " 선택</option>";
|
// }
|
||||||
foreach ($viewDatas['control']['filter_optons'][$item_type] as $key => $filterEntity) {
|
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||||
$disabled = $filterEntity->getStatus() === IpEntity::STATUS_OCCUPIED ? 'disabled="disabled"' : '';
|
$form = $this->form_dropdown_disabled($field, $value, $viewDatas['control']['filter_optons'][$item_type], $extras, IpEntity::STATUS_OCCUPIED);
|
||||||
if (array_key_exists('index_content_top_filter', $extras)) {
|
|
||||||
$disabled = "";
|
|
||||||
}
|
|
||||||
if ($viewDatas['control']['action'] == "modify_form" && $value == $filterEntity->getPK()) {
|
|
||||||
$disabled = "";
|
|
||||||
}
|
|
||||||
$selected = ($value == $key) ? 'selected="selected"' : '';
|
|
||||||
$form_temps[] = "<option value=\"{$key}\"{$selected} {$disabled}>{$filterEntity->getTitle()}</option>";
|
|
||||||
}
|
|
||||||
$form_temps[] = '</select>';
|
|
||||||
$form = implode("", $form_temps);
|
|
||||||
break;
|
break;
|
||||||
case 'DOMAIN':
|
case 'DOMAIN':
|
||||||
if (!is_array($viewDatas['control']['filter_optons'][$item_type])) {
|
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||||
throw new \Exception(__METHOD__ . "에서 {$item_type}의 field_options가 array형태가 아닙니다.");
|
$form = $this->form_dropdown_disabled($field, $value, $viewDatas['control']['filter_optons'][$item_type], $extras, DomainEntity::STATUS_OCCUPIED);
|
||||||
}
|
|
||||||
//CodeIgniter 4의 form_dropdown()은 options 배열로만 값을 받기 때문에, disabled 속성 같은 개별 옵션에 대한 HTML 속성 추가는 기본적으로 지원하지 않습니다.
|
|
||||||
$form_temps = ["<select name=\"{$field}\" class=\"select-field\"" . (isset($extras['onChange']) ? " onChange=\"{$extras['onChange']}\"" : "") . ">"];
|
|
||||||
$form_temps[] = "<option value=\"\">" . lang($viewDatas['class_path'] . '.label.' . $item_type) . " 선택</option>";
|
|
||||||
foreach ($viewDatas['control']['filter_optons'][$item_type] as $key => $filterEntity) {
|
|
||||||
$disabled = $filterEntity->getStatus() === DomainEntity::STATUS_OCCUPIED ? 'disabled="disabled"' : '';
|
|
||||||
if (array_key_exists('index_content_top_filter', $extras)) {
|
|
||||||
$disabled = "";
|
|
||||||
}
|
|
||||||
if ($viewDatas['control']['action'] == "modify_form" && $value == $filterEntity->getPK()) {
|
|
||||||
$disabled = "";
|
|
||||||
}
|
|
||||||
$selected = ($value == $key) ? 'selected="selected"' : '';
|
|
||||||
$form_temps[] = "<option value=\"{$key}\"{$selected} {$disabled}>{$filterEntity->getTitle()}</option>";
|
|
||||||
}
|
|
||||||
$form_temps[] = '</select>';
|
|
||||||
$form = implode("", $form_temps);
|
|
||||||
break;
|
break;
|
||||||
case "LINE":
|
case "LINE":
|
||||||
case "SERVER":
|
case "SERVER":
|
||||||
@ -71,20 +42,8 @@ class ServiceItemHelper extends CustomerHelper
|
|||||||
case "STORAGE":
|
case "STORAGE":
|
||||||
case "SOFTWARE":
|
case "SOFTWARE":
|
||||||
case "DEFENCE":
|
case "DEFENCE":
|
||||||
// dd($viewDatas['control']['filter_optons']);
|
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||||
if (!is_array($viewDatas['control']['filter_optons'][$item_type])) {
|
$form = $this->form_dropdown_disabled($field, $value, $viewDatas['control']['filter_optons'][$item_type], $extras);
|
||||||
throw new \Exception(__METHOD__ . "에서 {$item_type}의 field_options가 array형태가 아닙니다.");
|
|
||||||
}
|
|
||||||
//CodeIgniter 4의 form_dropdown()은 options 배열로만 값을 받기 때문에, disabled 속성 같은 개별 옵션에 대한 HTML 속성 추가는 기본적으로 지원하지 않습니다.
|
|
||||||
$form_temps = ["<select name=\"{$field}\" class=\"select-field\"" . (isset($extras['onChange']) ? " onChange=\"{$extras['onChange']}\"" : "") . ">"];
|
|
||||||
$form_temps[] = "<option value=\"\">" . lang($viewDatas['class_path'] . '.label.' . $item_type) . " 선택</option>";
|
|
||||||
foreach ($viewDatas['control']['filter_optons'][$item_type] as $key => $filterEntity) {
|
|
||||||
$disabled = '';
|
|
||||||
$selected = ($value == $key) ? 'selected="selected"' : '';
|
|
||||||
$form_temps[] = "<option value=\"{$key}\"{$selected} {$disabled}>{$filterEntity->getTitle()}</option>";
|
|
||||||
}
|
|
||||||
$form_temps[] = '</select>';
|
|
||||||
$form = implode("", $form_temps);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||||
@ -96,7 +55,7 @@ class ServiceItemHelper extends CustomerHelper
|
|||||||
{
|
{
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'item_uid':
|
case 'item_uid':
|
||||||
$form = $this->getFieldFormByItemType($field, $value, $viewDatas, $extras);
|
$form = $this->getFieldFormByByItemType($field, $value, $viewDatas, $extras);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||||
|
|||||||
@ -125,6 +125,11 @@ abstract class CustomerService extends CommonService
|
|||||||
}
|
}
|
||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
|
//ItemType에 따른 FilterOption 설정용
|
||||||
|
final public function getFilterOptionsByItemType(string $item_type): array
|
||||||
|
{
|
||||||
|
return $this->getServiceItemLinkService($item_type)->getEntities();
|
||||||
|
}
|
||||||
final public function getClient(int $uid): ClientEntity
|
final public function getClient(int $uid): ClientEntity
|
||||||
{
|
{
|
||||||
$entity = $this->getClientService()->getEntity($uid);
|
$entity = $this->getClientService()->getEntity($uid);
|
||||||
|
|||||||
@ -127,23 +127,15 @@ class ServiceService extends CustomerService
|
|||||||
}
|
}
|
||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
//ItemType에 따른 FilterOption 설정용
|
|
||||||
public function getFilterOptionsByItemType(string $item_type): array
|
|
||||||
{
|
|
||||||
return $this->getServiceItemLinkService($item_type)->getEntities();
|
|
||||||
}
|
|
||||||
//Service마다 ItemEntities 설정용
|
//Service마다 ItemEntities 설정용
|
||||||
public function setItemEntitiesByService(ServiceEntity $entity): ServiceEntity
|
public function setItemEntitiesByService(ServiceEntity $entity): ServiceEntity
|
||||||
{
|
{
|
||||||
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
foreach (SERVICE_ITEM_TYPES as $item_type => $label) {
|
||||||
$entity->setItemEntities(
|
$itemEntities = $this->getServiceItemService()->getEntities([
|
||||||
$item_type,
|
|
||||||
$this->getServiceItemService()->getEntities([
|
|
||||||
'serviceinfo_uid' => $entity->getPK(),
|
'serviceinfo_uid' => $entity->getPK(),
|
||||||
'item_type' => $item_type
|
'item_type' => $item_type
|
||||||
])
|
]);
|
||||||
);
|
$entity->setItemEntities($item_type, $itemEntities);
|
||||||
}
|
}
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user