dbmsv3 init...1
This commit is contained in:
parent
6e9cdd8644
commit
c08d960bb0
File diff suppressed because one or more lines are too long
@ -198,7 +198,7 @@ class CommonHelper
|
||||
|
||||
return $ips;
|
||||
}
|
||||
final public function form_dropdown_common(string $field, mixed $value, array $viewDatas, array $extras = [], array $attributes = []): string
|
||||
final public function form_dropdown_common(string $field, mixed $value, array $viewDatas, array $extras = [], array $attributes = [], bool $isAll = false): string
|
||||
{
|
||||
// 필터 옵션이 없으면 빈 배열로 초기화
|
||||
if (!array_key_exists($field, $viewDatas['control']['field_optons'])) {
|
||||
@ -206,28 +206,17 @@ class CommonHelper
|
||||
}
|
||||
$extra = "";
|
||||
foreach ($extras as $extra_tag => $extra_value) {
|
||||
$extra .= sprintf(" %s=\"%s\"", $extra_tag, htmlspecialchars($extra_value, ENT_QUOTES, 'UTF-8'));
|
||||
$extra .= sprintf(" %s=\"%s\"", $extra_tag, $extra_value);
|
||||
}
|
||||
// $formOptions는 필터 옵션 배열로, key는 필터 엔티티의 PK, value는 필터 엔티티 객체
|
||||
$html = sprintf("<select name=\"%s\" %s>", $field, $extra);
|
||||
$html .= "<option value=\"\">" . lang("{$viewDatas['class_path']}.label.{$field}") . " 선택" . "</option>";
|
||||
$html .= $this->form_dropdown_common_process($field, $value, $viewDatas, $extras, $attributes);
|
||||
$html .= $this->form_dropdown_common_process($field, $value, $viewDatas, $extras, $attributes, $isAll);
|
||||
$html .= '</select>';
|
||||
return $html;
|
||||
}
|
||||
//필수항목
|
||||
public function getFieldLabel(string $field, string $label, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
// required가 있으면 class 추가
|
||||
$extras = (strpos($viewDatas['control']['field_rules'][$field], 'required') !== false) ? ["class" => "text-danger", "required" => "", ...$extras] : $extras;
|
||||
$label = form_label($label, $field, ['class' => 'form-label-sm', ...$extras]);
|
||||
break;
|
||||
}
|
||||
return $label;
|
||||
}
|
||||
protected function form_dropdown_common_process(string $field, mixed $value, array $viewDatas, array $extras = [], array $attributes = []): string
|
||||
//필수함수
|
||||
protected function form_dropdown_common_process(string $field, mixed $value, array $viewDatas, array $extras = [], array $attributes = [], bool $isAll = false): string
|
||||
{
|
||||
$html = "";
|
||||
switch ($field) {
|
||||
@ -238,11 +227,11 @@ class CommonHelper
|
||||
$attribute = "";
|
||||
$label = "";
|
||||
if ($option_value instanceof CommonEntity) {
|
||||
if ($option_key != $value && $option_value->getStatus() != $option_value::DEFAULT_STATUS) {
|
||||
if ($option_key != $value && $option_value->getStatus() != $option_value::DEFAULT_STATUS && !$isAll) {
|
||||
continue;
|
||||
}
|
||||
foreach ($attributes as $attribute_name => $attribute_value) {
|
||||
$attribute .= sprintf(" %s=\"%s\"", $attribute_name, $option_value->$attribute_value());
|
||||
$attribute .= sprintf(" %s=\"%s\"", $attribute_name, $option_value->$attribute_value);
|
||||
}
|
||||
$label = $option_value->getCustomTitle();
|
||||
} else {
|
||||
@ -254,6 +243,17 @@ class CommonHelper
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
public function getFieldLabel(string $field, string $label, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
// required가 있으면 class 추가
|
||||
$extras = (strpos($viewDatas['control']['field_rules'][$field], 'required') !== false) ? ["class" => "text-danger", "required" => "", ...$extras] : $extras;
|
||||
$label = form_label($label, $field, ['class' => 'form-label-sm', ...$extras]);
|
||||
break;
|
||||
}
|
||||
return $label;
|
||||
}
|
||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($field) {
|
||||
@ -280,7 +280,7 @@ class CommonHelper
|
||||
}
|
||||
$form = implode(" ", $forms);
|
||||
} else {
|
||||
$form = $this->form_dropdown_common($field, $value, $viewDatas, $extras);
|
||||
$form = form_dropdown($field, $value, $viewDatas, $extras);
|
||||
}
|
||||
break;
|
||||
case 'issue_at':
|
||||
@ -301,16 +301,11 @@ class CommonHelper
|
||||
// $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' tinymce' : 'tinymce';
|
||||
$form = form_textarea($field, $value ?? "", $extras);
|
||||
break;
|
||||
case 'user_uid':
|
||||
case 'old_clientinfo_uid':
|
||||
case 'clientinfo_uid':
|
||||
case 'serviceinfo_uid':
|
||||
case 'serverinfo_uid':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$form = $this->form_dropdown_common($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
default:
|
||||
if (in_array($field, $viewDatas['control']['actionFilters'])) {
|
||||
if (str_contains($field, "_uid")) {
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
}
|
||||
$form = $this->form_dropdown_common($field, $value, $viewDatas, $extras);
|
||||
} else {
|
||||
$form = form_input($field, $value ?? "", $extras);
|
||||
@ -358,19 +353,6 @@ class CommonHelper
|
||||
break;
|
||||
default:
|
||||
if (in_array($field, $viewDatas['control']['actionFilters'])) {
|
||||
// //index 액션에서만 filter_options를 변경시 선택된 값을 변경하는 기능
|
||||
// if ($viewDatas['control']['action'] == 'index') {
|
||||
// $extras["onChange"] = sprintf(
|
||||
// "document.location.href='%s/toggle/%s/%s?%s='+this.options[this.selectedIndex].value",
|
||||
// current_url(),
|
||||
// $viewDatas['entity']->getPK(),
|
||||
// $field,
|
||||
// $field
|
||||
// );
|
||||
// $value = $this->getFieldForm($field, $value, $viewDatas, $extras);
|
||||
// } else {
|
||||
// $value = array_key_exists($value, $viewDatas['control']['field_optons'][$field]) ? $viewDatas['control']['field_optons'][$field][$value] : "";
|
||||
// }
|
||||
if (str_contains($field, "_uid")) {
|
||||
$value = array_key_exists($value, $viewDatas['control']['field_optons'][$field]) && $viewDatas['control']['field_optons'][$field][$value] ? $viewDatas['control']['field_optons'][$field][$value]->getTitle() : "";
|
||||
} else {
|
||||
@ -387,17 +369,14 @@ class CommonHelper
|
||||
public function getListFilter(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($field) {
|
||||
case 'user_uid':
|
||||
case 'old_clientinfo_uid':
|
||||
case 'clientinfo_uid':
|
||||
case 'serviceinfo_uid':
|
||||
case 'serverinfo_uid':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$filter = $this->form_dropdown_common($field, $value, $viewDatas, $extras);
|
||||
break;
|
||||
default:
|
||||
if (in_array($field, $viewDatas['control']['actionFilters'])) {
|
||||
$filter = $this->getFieldForm($field, $value, $viewDatas, $extras);
|
||||
if (str_contains($field, "_uid")) {
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
}
|
||||
$attributes = [];
|
||||
$isAll = true;
|
||||
$filter = $this->form_dropdown_common($field, $value, $viewDatas, $extras, $attributes, $isAll);
|
||||
} else {
|
||||
$filter = array_key_exists($value, $viewDatas['control']['field_optons'][$field]) ? $viewDatas['control']['field_optons'][$field][$value] : "";
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ class ServiceHelper extends CustomerHelper
|
||||
$value = $viewDatas['entity']->getServerEntity()->getPK();
|
||||
}
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$attributes = ['data-price' => 'getPrice'];
|
||||
$attributes = ['data-price' => 'price'];
|
||||
$form = $this->form_dropdown_common($field, $value, $viewDatas, $extras, $attributes);
|
||||
break;
|
||||
case 'amount':
|
||||
|
||||
@ -12,7 +12,7 @@ class ServerPartHelper extends EquipmentHelper
|
||||
parent::__construct();
|
||||
$this->setTitleField(field: ServerPartModel::TITLE);
|
||||
}
|
||||
protected function form_dropdown_common_process(string $field, mixed $value, array $viewDatas, array $extras = [], array $attributes = []): string
|
||||
protected function form_dropdown_common_process(string $field, mixed $value, array $viewDatas, array $extras = [], array $attributes = [], bool $isAll = false): string
|
||||
{
|
||||
$html = "";
|
||||
switch ($field) {
|
||||
@ -26,11 +26,11 @@ class ServerPartHelper extends EquipmentHelper
|
||||
$attribute = "";
|
||||
$label = "";
|
||||
if ($option_value instanceof CommonEntity) {
|
||||
if ($option_key != $value && $option_value->getStatus() != $option_value::DEFAULT_STATUS) {
|
||||
if ($option_key != $value && $option_value->getStatus() != $option_value::DEFAULT_STATUS && !$isAll) {
|
||||
continue;
|
||||
}
|
||||
foreach ($attributes as $attribute_name => $attribute_value) {
|
||||
$attribute .= sprintf(" %s=\"%s\"", $attribute_name, $option_value->$attribute_value());
|
||||
$attribute .= sprintf(" %s=\"%s\"", $attribute_name, $option_value->$attribute_value);
|
||||
}
|
||||
$label = $option_value->getCustomTitle();
|
||||
} else {
|
||||
@ -50,8 +50,8 @@ class ServerPartHelper extends EquipmentHelper
|
||||
switch ($field) {
|
||||
case 'part_uid':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$extras['onChange'] = "document.querySelector('input[name=\'amount\']').value = this.options[this.selectedIndex].getAttribute('data-price'); document.querySelector('input[name=\'title\']').value = this.options[this.selectedIndex].getAttribute('data-title')";
|
||||
$attributes = ['data-title' => 'getTitle', 'data-price' => 'getPrice'];
|
||||
$extras['onChange'] = "document.querySelector('input[name=\'title\']').value = this.options[this.selectedIndex].getAttribute('data-title'); document.querySelector('input[name=\'amount\']').value = this.options[this.selectedIndex].getAttribute('data-price')";
|
||||
$attributes = ['data-title' => 'title', 'data-price' => 'price'];
|
||||
$form = $this->form_dropdown_common($field, $value, $viewDatas, $extras, $attributes);
|
||||
break;
|
||||
case 'extra':
|
||||
|
||||
@ -136,7 +136,12 @@ class PaymentService extends CommonService implements ServiceInterface, ServerPa
|
||||
$formDatas['clientinfo_uid'] = $serviceEntity->getClientInfoUID();
|
||||
$formDatas['serviceinfo_uid'] = $serviceEntity->getPK();
|
||||
$formDatas['serverinfo_uid'] = $serviceEntity->getServerInfoUID();
|
||||
$formDatas['title'] = sprintf("[%s] %s 서비스비용", $serviceEntity->getBillingAt(), $serviceEntity->getServerEntity->getTitle());
|
||||
$formDatas['title'] = sprintf(
|
||||
"[%s/%s] %s 서비스비용",
|
||||
$serviceEntity->getServerEntity()->getCode(),
|
||||
$serviceEntity->getServerEntity()->getIP(),
|
||||
date("Y년 n월", strtotime($serviceEntity->getBillingAt()))
|
||||
);
|
||||
$formDatas['amount'] = $serviceEntity->getAmount();
|
||||
$formDatas['billing'] = PAYMENT['BILLING']['MONTH'];
|
||||
$formDatas['billing_at'] = $serviceEntity->getBillingAt();
|
||||
@ -157,7 +162,12 @@ class PaymentService extends CommonService implements ServiceInterface, ServerPa
|
||||
$formDatas['clientinfo_uid'] = $serviceEntity->getClientInfoUID();
|
||||
$formDatas['serviceinfo_uid'] = $serviceEntity->getPK();
|
||||
$formDatas['serverinfo_uid'] = $serviceEntity->getServerInfoUID();
|
||||
$formDatas['title'] = $formDatas['title'] = sprintf("[%s] %s 서비스비용", $serviceEntity->getBillingAt(), $serviceEntity->getServerEntity->getTitle());
|
||||
$formDatas['title'] = sprintf(
|
||||
"[%s/%s] %s 서비스비용",
|
||||
$serviceEntity->getServerEntity()->getCode(),
|
||||
$serviceEntity->getServerEntity()->getIP(),
|
||||
date("Y년 n월", strtotime($serviceEntity->getBillingAt()))
|
||||
);
|
||||
$formDatas['amount'] = $serviceEntity->getAmount();
|
||||
$formDatas['billing'] = PAYMENT['BILLING']['MONTH'];
|
||||
$formDatas['billing_at'] = $serviceEntity->getBillingAt();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user