dbmsv4 init...1
This commit is contained in:
parent
f0511fbf56
commit
11708086c6
@ -302,6 +302,7 @@ define('LAYOUTS', [
|
||||
'javascripts' => [
|
||||
'<script src="//cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>',
|
||||
],
|
||||
'footerScripts' => []
|
||||
],
|
||||
'front' => [
|
||||
'title' => KEYWORD,
|
||||
@ -333,6 +334,7 @@ define('LAYOUTS', [
|
||||
'<script src="//cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>',
|
||||
'<script src="//cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>',
|
||||
],
|
||||
'footerScripts' => []
|
||||
],
|
||||
'admin' => [
|
||||
'title' => '관리자화면',
|
||||
@ -368,6 +370,7 @@ define('LAYOUTS', [
|
||||
'<script src="/assets/tinymce/tinymce.min.js" referrerpolicy="origin"></script>',
|
||||
'<script src="/assets/tagify/dist/tagify.js"></script>'
|
||||
],
|
||||
'footerScripts' => []
|
||||
],
|
||||
]);
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
@ -16,8 +15,9 @@ class ServiceController extends CustomerController
|
||||
if ($this->service === null) {
|
||||
$this->service = service('customer_serviceservice');
|
||||
}
|
||||
$this->addActionPaths('service');
|
||||
$this->layouts['javascripts'][] = '<script src="/js/admin/clipboard.js"></script>';
|
||||
$this->addActionPaths(path: 'service');
|
||||
$this->layouts['footerScripts'][] = '<script src="/js/admin/clipboard.js"></script>';
|
||||
$this->layouts['footerScripts'][] = '<script src="/js/admin/service.js"></script>';
|
||||
}
|
||||
//기본 함수 작업
|
||||
//Custom 추가 함수
|
||||
|
||||
@ -17,7 +17,7 @@ class ServerController extends EquipmentController
|
||||
$this->service = service('equipment_serverservice');
|
||||
}
|
||||
$this->addActionPaths('server');
|
||||
$this->layouts['javascripts'][] = '<script src="/js/admin/clipboard.js"></script>';
|
||||
$this->layouts['footerScripts'][] = '<script src="/js/admin/clipboard.js"></script>';
|
||||
}
|
||||
//기본 함수 작업
|
||||
//Custom 추가 함수
|
||||
|
||||
@ -52,8 +52,12 @@ class ServiceForm extends CustomerForm
|
||||
switch ($field) {
|
||||
case 'serverinfo_uid':
|
||||
foreach ($this->getFormOption_process(service('equipment_serverservice'), $action, $field, $formDatas) as $tempEntity) {
|
||||
$tempOptions[$tempEntity->getPK()] = $tempEntity->getCustomTitle();
|
||||
// $options['attributes'][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())];
|
||||
$tempOptions[$tempEntity->getPK()] = [
|
||||
'value' => $tempEntity->getPK(),
|
||||
'text' => $tempEntity->getTitle(),
|
||||
'data-title' => $tempEntity->getTitle(),
|
||||
'data-price' => $tempEntity->getPrice()
|
||||
];
|
||||
}
|
||||
$options['options'] = $tempOptions;
|
||||
break;
|
||||
|
||||
@ -51,8 +51,12 @@ class ServerPartForm extends EquipmentForm
|
||||
$partService = $this->getPartService($type);
|
||||
$tempOptions[$type] = [lang("{$this->getAttribute('class_path')}.TYPE.{$type}") . " 선택"];
|
||||
foreach ($this->getFormOption_process($partService, $action, $field, $formDatas) as $tempEntity) {
|
||||
$tempOptions[$type][$tempEntity->getPK()] = $tempEntity->getTitle();
|
||||
// $options['attributes'][$type][$tempEntity->getPK()] = ['data-role' => implode(DEFAULTS['DELIMITER_ROLE'], $tempEntity->getRole())];
|
||||
$tempOptions[$type][$tempEntity->getPK()] = [
|
||||
'value' => $tempEntity->getPK(),
|
||||
'text' => $tempEntity->getTitle(),
|
||||
'data-title' => $tempEntity->getTitle(),
|
||||
'data-price' => $tempEntity->getPrice()
|
||||
];
|
||||
}
|
||||
}
|
||||
$options['options'] = $tempOptions;
|
||||
|
||||
@ -47,8 +47,12 @@ abstract class CommonHelper
|
||||
* @param string $extra <select> 태그에 추가할 속성
|
||||
* @return string HTML <select> 태그
|
||||
*/
|
||||
public function form_dropdown_custom(string $name = '', array $options = [], $selected = null, string $extra = ''): string
|
||||
final public function form_dropdown_custom(string $name = '', array $options = [], $selected = null, array $extras = []): string
|
||||
{
|
||||
$extra = "";
|
||||
foreach ($extras as $extras_key => $extras_value) {
|
||||
$extra .= " " . esc($extras_key) . '="' . esc($extras_value) . '"';
|
||||
}
|
||||
$select = '<select name="' . esc($name) . '"' . $extra . ">\n";
|
||||
// 선택된 값 처리
|
||||
$selected = is_array($selected) ? $selected : [$selected];
|
||||
@ -83,7 +87,14 @@ abstract class CommonHelper
|
||||
$select .= "</select>\n";
|
||||
return $select;
|
||||
}
|
||||
|
||||
protected function getFieldForm_process(string $field, array $viewDatas, string $form): string
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return $form;
|
||||
}
|
||||
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($field) {
|
||||
|
||||
@ -18,7 +18,11 @@ class ServiceHelper extends CustomerHelper
|
||||
break;
|
||||
case 'serverinfo_uid':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$form = form_dropdown($field, $viewDatas['formOptions'][$field]['options'], $value, $extras);
|
||||
$extras['onChange'] = "document.querySelector('input[name=\'amount\']').value = this.options[this.selectedIndex].getAttribute('data-price')";
|
||||
if (array_key_exists('extras', $viewDatas['formOptions'][$field])) {
|
||||
$extras = array_merge($extras, $viewDatas['formOptions'][$field]['extras']);
|
||||
}
|
||||
$form = $this->form_dropdown_custom($field, $viewDatas['formOptions'][$field]['options'], $value, $extras);
|
||||
break;
|
||||
case 'clientinfo_uid':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
|
||||
@ -23,11 +23,11 @@ class ServerPartHelper extends EquipmentHelper
|
||||
// dd($viewDatas);
|
||||
$type = array_key_exists('entity', $viewDatas) ? $viewDatas['entity']->getType() : $viewDatas['formDatas']['type'];
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$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')";
|
||||
$extras['onChange'] = "document.querySelector('input[name=\'amount\']').value = this.options[this.selectedIndex].getAttribute('data-price')";
|
||||
if (array_key_exists('extras', $viewDatas['formOptions'][$field])) {
|
||||
$extras = array_merge($extras, $viewDatas['formOptions'][$field]['extras']);
|
||||
}
|
||||
$form = form_dropdown($field, $viewDatas['formOptions'][$field]['options'][$type], $value, $extras);
|
||||
$form = $this->form_dropdown_custom($field, $viewDatas['formOptions'][$field]['options'][$type], $value, $extras);
|
||||
break;
|
||||
default:
|
||||
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
|
||||
|
||||
@ -20,5 +20,6 @@
|
||||
<body>
|
||||
<?= $this->renderSection('content') ?>
|
||||
</body>
|
||||
<?php foreach ($viewDatas['layout']['footerScripts'] as $javascript): ?><?= $javascript ?><?php endforeach; ?>
|
||||
|
||||
</html>
|
||||
@ -20,5 +20,6 @@
|
||||
<?php if ($error = session('message')): ?><?= $viewDatas['service']->getHelper()->alertTrait($error) ?><?php endif ?>
|
||||
<div class="middle"><?= $this->renderSection('content') ?></div>
|
||||
</body>
|
||||
<?php foreach ($viewDatas['layout']['footerScripts'] as $javascript): ?><?= $javascript ?><?php endforeach; ?>
|
||||
|
||||
</html>
|
||||
@ -20,5 +20,6 @@
|
||||
<?php if ($error = session('message')): ?><?= $viewDatas['service']->getHelper()->alertTrait($error) ?><?php endif ?>
|
||||
<?= $this->renderSection('content') ?></div>
|
||||
</body>
|
||||
<?php foreach ($viewDatas['layout']['footerScripts'] as $javascript): ?><?= $javascript ?><?php endforeach; ?>
|
||||
|
||||
</html>
|
||||
@ -30,6 +30,5 @@ if (serverSelect) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//페이지 로드 시 초기 실행
|
||||
document.addEventListener("DOMContentLoaded", updateAmount);
|
||||
Loading…
Reference in New Issue
Block a user