diff --git a/app/Helpers/CommonHelper.php b/app/Helpers/CommonHelper.php
index 57da0eb..34f8d3d 100644
--- a/app/Helpers/CommonHelper.php
+++ b/app/Helpers/CommonHelper.php
@@ -199,6 +199,7 @@ class CommonHelper
{
switch ($field) {
default:
+ // required가 있으면 class 추가
$extras = (strpos($viewDatas['control']['field_rules'][$field], 'required') !== false) ? ["class" => "text-danger", "required" => "", ...$extras] : $extras;
$label = form_label(lang("{$viewDatas['class_path']}.label.{$field}"), $field, $extras);
break;
@@ -209,6 +210,7 @@ class CommonHelper
// header.php에서 getFieldForm_Helper사용
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
+ // create, modify, create_form, modify_form일때 required가 있으면 class 추가
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];
}
@@ -224,6 +226,7 @@ class CommonHelper
if (!is_array($viewDatas['control']['filter_optons'][$field])) {
throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다.");
}
+ // create, modify, create_form, modify_form일때 checkbox로 표시
if (in_array($viewDatas['control']['action'], ['create', 'modify', 'create_form', 'modify_form'])) {
$forms = [];
foreach ($viewDatas['control']['filter_optons'][$field] as $key => $label) {
@@ -253,16 +256,6 @@ class CommonHelper
$extra_class = isset($extras['class']) ? $extras['class'] . ' tinymce' : 'tinymce';
$form = form_textarea($field, $value ?? "", ['id' => $field, 'class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
break;
- case 'status':
- if (!is_array($viewDatas['control']['filter_optons'][$field])) {
- throw new \Exception(__METHOD__ . "에서 {$field}의 field_options가 array형태가 아닙니다.");
- }
- $formOptions = ["" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택'];
- foreach ($viewDatas['control']['filter_optons'][$field] as $key => $label) {
- $formOptions[$key] = $label;
- }
- $form = form_dropdown($field, $formOptions, $value, $extras);
- break;
default:
if (in_array($field, $viewDatas['control']['filter_fields'])) {
if (!is_array($viewDatas['control']['filter_optons'][$field])) {
@@ -273,6 +266,10 @@ class CommonHelper
$formOptions[$key] = $label;
}
$extra_class = isset($extras['class']) ? $extras['class'] . ' select-field' : 'select-field';
+ // create, modify, create_form, modify_form 액션에서는 기본값:DEFAULTS['STATUS']을 설정
+ if (in_array($viewDatas['control']['action'], ['create', 'modify', 'create_form', 'modify_form'])) {
+ $value = $value ?? DEFAULTS['STATUS'];
+ }
$form = form_dropdown($field, $formOptions, $value, ['class' => $extra_class, ...array_diff_key($extras, ['class' => ''])]);
} else {
$form = form_input($field, $value ?? "", $extras);
@@ -282,9 +279,8 @@ class CommonHelper
return $form;
}
- public function getFieldView(string $field, array $viewDatas, array $extras = []): string
+ public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
{
- $value = $viewDatas['entity']->$field ?? "";
switch ($field) {
case 'role':
$roles = [];
@@ -309,7 +305,6 @@ class CommonHelper
if (env('app.debug.filter_options')) {
echo "field=>" . $field . ",value=>" . $value . "
";
echo var_dump($viewDatas['control']['filter_optons'][$field]) . "
";
- // echo var_dump($viewDatas['entity']) . "
";
}
$extras["onChange"] = sprintf(
"document.location.href='%s/toggle/%s/%s?%s='+this.options[this.selectedIndex].value",
@@ -318,7 +313,9 @@ class CommonHelper
$field,
$field
);
- $value = $this->getFieldForm($field, $value, $viewDatas, $extras);
+ $value =
+ $value = $this->getFieldForm($field, $value, $viewDatas, $extras);
+ $this->getFieldForm($field, $value, $viewDatas, $extras);
}
break;
}
diff --git a/app/Helpers/Customer/ClientHelper.php b/app/Helpers/Customer/ClientHelper.php
index 86aa370..1fb2d43 100644
--- a/app/Helpers/Customer/ClientHelper.php
+++ b/app/Helpers/Customer/ClientHelper.php
@@ -13,9 +13,8 @@ class ClientHelper extends CustomerHelper
parent::__construct($request);
$this->setTitleField(ClientModel::TITLE);
}
- public function getFieldView(string $field, array $viewDatas, array $extras = []): string
+ public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
{
- $value = $viewDatas['entity']->$field;
switch ($field) {
case 'account_balance':
$extras = ["class" => "btn btn-link", "target" => "_self", ...$extras];
@@ -57,7 +56,7 @@ class ClientHelper extends CustomerHelper
);
break;
default:
- $value = parent::getFieldView($field, $viewDatas, $extras);
+ $value = parent::getFieldView($field, $value, $viewDatas, $extras);
break;
}
if (is_array($value)) {
diff --git a/app/Helpers/Customer/ServiceHelper.php b/app/Helpers/Customer/ServiceHelper.php
index 608392c..de86585 100644
--- a/app/Helpers/Customer/ServiceHelper.php
+++ b/app/Helpers/Customer/ServiceHelper.php
@@ -71,9 +71,8 @@ class ServiceHelper extends CustomerHelper
}
return $form;
}
- public function getFieldView(string $field, array $viewDatas, array $extras = []): string
+ public function getFieldView(string $field, mixed $value, array $viewDatas, array $extras = []): string|null
{
- $value = $viewDatas['entity']->$field ?? "";
switch ($field) {
case "LINE":
case "IP":
@@ -98,7 +97,7 @@ class ServiceHelper extends CustomerHelper
$value = implode("", $temps);
break;
default:
- $value = parent::getFieldView($field, $viewDatas, $extras);
+ $value = parent::getFieldView($field, $value, $viewDatas, $extras);
break;
}
if (is_array($value)) {
diff --git a/app/Helpers/MyLogHelper.php b/app/Helpers/MyLogHelper.php
index 812557a..ad9da79 100644
--- a/app/Helpers/MyLogHelper.php
+++ b/app/Helpers/MyLogHelper.php
@@ -14,19 +14,6 @@ class MyLogHelper extends CommonHelper
$this->setTitleField(MyLogModel::TITLE);
}
- public function getFieldView(string $field, array $viewDatas, array $extras = []): string
- {
- $value = $viewDatas['entity']->$field ?? "";
- switch ($field) {
- case 'content':
- $value = nl2br($value);
- break;
- default:
- $value = parent::getFieldView($field, $viewDatas, $extras);
- break;
- }
- return $value;
- }
public function getListButton(string $action, array $viewDatas, array $extras = []): string
{
switch ($action) {
diff --git a/app/Services/Customer/ServiceHistoryService.php b/app/Services/Customer/ServiceHistoryService.php
index 21f8227..d28f06b 100644
--- a/app/Services/Customer/ServiceHistoryService.php
+++ b/app/Services/Customer/ServiceHistoryService.php
@@ -28,7 +28,6 @@ class ServiceHistoryService extends CustomerService
"serviceinfo_uid",
"title",
"description",
- "status",
];
}
public function getFilterFields(): array
diff --git a/app/Views/admin/index.php b/app/Views/admin/index.php
index aade0e1..ebe7bb8 100644
--- a/app/Views/admin/index.php
+++ b/app/Views/admin/index.php
@@ -36,7 +36,7 @@