dbms_init...1
This commit is contained in:
parent
3c041b3a02
commit
3960b7d394
@ -3,6 +3,7 @@
|
||||
namespace App\Helpers\Customer;
|
||||
|
||||
use App\Entities\Equipment\CodeEntity;
|
||||
use App\Entities\Equipment\SwitchEntity;
|
||||
use App\Models\Customer\ServiceModel;
|
||||
|
||||
class ServiceHelper extends CustomerHelper
|
||||
@ -48,8 +49,28 @@ class ServiceHelper extends CustomerHelper
|
||||
if (in_array($viewDatas['control']['action'], ['create', 'modify', 'create_form', 'modify_form'])) {
|
||||
$extras = (strpos($viewDatas['control']['field_rules'][$field], 'required') !== false) ? ["class" => "form-control", "required" => "", ...$extras] : ["class" => "form-control", ...$extras];
|
||||
}
|
||||
// $test_value = $value === null ? "NULL" : $value;
|
||||
// echo "Field:{$field},VALUE:{$test_value}";
|
||||
switch ($field) {
|
||||
case 'code':
|
||||
case 'switchinfo_uid':
|
||||
if (!is_array($viewDatas['control']['filter_optons'][$field])) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$field}의 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.' . $field) . " 선택</option>";
|
||||
foreach ($viewDatas['control']['filter_optons'][$field] as $key => $filterEntity) {
|
||||
$disabled = "";
|
||||
if (!array_key_exists('index_content_top_filter', $extras)) {
|
||||
$disabled = $filterEntity->getStatus() === SwitchEntity::STATUS_OCCUPIED ? 'disabled="disabled"' : '';
|
||||
}
|
||||
$selected = ($value == $key) ? 'selected="selected"' : '';
|
||||
$form_temps[] = "<option value=\"{$key}\"{$selected} {$disabled}>{$filterEntity->getTitle()}</option>";
|
||||
}
|
||||
$form_temps[] = '</select>';
|
||||
$form = implode("", $form_temps);
|
||||
break;
|
||||
case 'codeinfo_uid':
|
||||
if (!is_array($viewDatas['control']['filter_optons'][$field])) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다.");
|
||||
}
|
||||
@ -61,7 +82,7 @@ class ServiceHelper extends CustomerHelper
|
||||
if (!array_key_exists('index_content_top_filter', $extras)) {
|
||||
$disabled = $filterEntity->getStatus() === CodeEntity::STATUS_OCCUPIED ? 'disabled="disabled"' : '';
|
||||
}
|
||||
$selected = ($value === $key) ? 'selected="selected"' : '';
|
||||
$selected = ($value == $key) ? 'selected="selected"' : '';
|
||||
$form_temps[] = "<option value=\"{$key}\"{$selected} {$disabled}>{$filterEntity->getTitle()}</option>";
|
||||
}
|
||||
$form_temps[] = '</select>';
|
||||
|
||||
@ -39,7 +39,7 @@ class ServiceItemHelper extends CustomerHelper
|
||||
if (!array_key_exists('index_content_top_filter', $extras)) {
|
||||
$disabled = in_array($filterEntity->getStatus(), [DomainEntity::STATUS_OCCUPIED, DomainEntity::STATUS_FORBIDDEN]) ? 'disabled="disabled"' : '';
|
||||
}
|
||||
$selected = ($value === $key) ? 'selected="selected"' : '';
|
||||
$selected = ($value == $key) ? 'selected="selected"' : '';
|
||||
$form_temps[] = "<option value=\"{$key}\"{$selected} {$disabled}>{$filterEntity->getTitle()}</option>";
|
||||
}
|
||||
$form_temps[] = '</select>';
|
||||
@ -62,7 +62,7 @@ class ServiceItemHelper extends CustomerHelper
|
||||
$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"' : '';
|
||||
$selected = ($value == $key) ? 'selected="selected"' : '';
|
||||
$form_temps[] = "<option value=\"{$key}\"{$selected} {$disabled}>{$filterEntity->getTitle()}</option>";
|
||||
}
|
||||
$form_temps[] = '</select>';
|
||||
@ -80,7 +80,7 @@ class ServiceItemHelper extends CustomerHelper
|
||||
if (!array_key_exists('index_content_top_filter', $extras)) {
|
||||
$disabled = in_array($filterEntity->getStatus(), [IpEntity::STATUS_OCCUPIED, IpEntity::STATUS_FORBIDDEN]) ? 'disabled="disabled"' : '';
|
||||
}
|
||||
$selected = ($value === $key) ? 'selected="selected"' : '';
|
||||
$selected = ($value == $key) ? 'selected="selected"' : '';
|
||||
$form_temps[] = "<option value=\"{$key}\"{$selected} {$disabled}>{$filterEntity->getTitle()}</option>";
|
||||
}
|
||||
$form_temps[] = '</select>';
|
||||
|
||||
@ -204,26 +204,26 @@ class ServiceService extends CustomerService
|
||||
public function create(array $formDatas, mixed $entity = null): ServiceEntity
|
||||
{
|
||||
//code의 경우 서비스중으로 설정작업
|
||||
$this->getCodeService()->setStatus($formDatas['code'], CodeEntity::STATUS_OCCUPIED);
|
||||
$this->getCodeService()->setStatus($formDatas['codeinfo_uid'], CodeEntity::STATUS_OCCUPIED);
|
||||
//switch의 경우 서비스중으로 설정작업
|
||||
$this->getCodeService()->setStatus($formDatas['switch'], SwitchEntity::STATUS_OCCUPIED);
|
||||
$this->getSwitchService()->setStatus($formDatas['switchinfo_uid'], SwitchEntity::STATUS_OCCUPIED);
|
||||
return parent::create($formDatas, $entity);
|
||||
}
|
||||
public function modify(mixed $entity, array $formDatas): ServiceEntity
|
||||
{
|
||||
//code가 기존과 다를경우 //toggle,batchjob의 경우 $formDatas에 code가 없을수도 있음
|
||||
if (array_key_exists('code', $formDatas) && $formDatas['code'] !== $entity->getCode()) {
|
||||
if (array_key_exists('codeinfo_uid', $formDatas) && $formDatas['codeinfo_uid'] !== $entity->getCodeUID()) {
|
||||
//기존 code의 경우 반환처리
|
||||
$this->getCodeService()->setStatus($entity->getCode(), CodeEntity::STATUS_AVAILABLE);
|
||||
$this->getCodeService()->setStatus($entity->getCodeUID(), CodeEntity::STATUS_AVAILABLE);
|
||||
//신규 설정된 code의 경우 서비스중 변경처리
|
||||
$this->getCodeService()->setStatus($formDatas['code'], CodeEntity::STATUS_OCCUPIED);
|
||||
$this->getCodeService()->setStatus($formDatas['codeinfo_uid'], CodeEntity::STATUS_OCCUPIED);
|
||||
}
|
||||
//switch가 기존과 다를경우 //toggle,batchjob의 경우 $formDatas에 switch가 없을수도 있음
|
||||
if (array_key_exists('switch', $formDatas) && $formDatas['switch'] !== $entity->getCode()) {
|
||||
if (array_key_exists('switchinfo_uid', $formDatas) && $formDatas['switchinfo_uid'] !== $entity->getSwitchUID()) {
|
||||
//기존 switch의 경우 반환처리
|
||||
$this->getSwitchService()->setStatus($entity->getCode(), SwitchEntity::STATUS_AVAILABLE);
|
||||
$this->getSwitchService()->setStatus($entity->getSwitchUID(), SwitchEntity::STATUS_AVAILABLE);
|
||||
//신규 설정된 switch의 경우 서비스중 변경처리
|
||||
$this->getSwitchService()->setStatus($formDatas['switch'], SwitchEntity::STATUS_OCCUPIED);
|
||||
$this->getSwitchService()->setStatus($formDatas['switchinfo_uid'], SwitchEntity::STATUS_OCCUPIED);
|
||||
}
|
||||
//관리자가 바뀐경우 결제쪽에도 결제가 완료되지않은 것은 관리자를 변경해줘야함
|
||||
if (array_key_exists('ownerinfo_uid', $formDatas) && $entity->getOwnerUID() !== intval($formDatas['ownerinfo_uid'])) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user