From 3835fd85ac7ae6c391c06c7b8bfedaba03b9da32 Mon Sep 17 00:00:00 2001 From: "choi.jh" Date: Mon, 7 Jul 2025 09:55:24 +0900 Subject: [PATCH] dbms_init...1 --- .../Admin/Equipment/Part/DomainController.php | 3 + app/Helpers/Equipment/Part/DomainHelper.php | 2 +- app/Views/admin/domain/create_form.php | 64 +++++++++++++++++++ public/js/admin/form.js | 31 --------- 4 files changed, 68 insertions(+), 32 deletions(-) create mode 100644 app/Views/admin/domain/create_form.php diff --git a/app/Controllers/Admin/Equipment/Part/DomainController.php b/app/Controllers/Admin/Equipment/Part/DomainController.php index e520c08..41ee104 100644 --- a/app/Controllers/Admin/Equipment/Part/DomainController.php +++ b/app/Controllers/Admin/Equipment/Part/DomainController.php @@ -45,6 +45,9 @@ class DomainController extends PartController $view_file = $this->view_path . 'domain' . DIRECTORY_SEPARATOR . 'view'; $result = view($view_file, ['viewDatas' => $this->getViewDatas()]); break; + case 'create_form': + $result = parent::getResultSuccess($message, $this->request->getVar('ActionTemplate') ?? $actionTemplate ?? 'domain'); + break; default: $result = parent::getResultSuccess($message, $actionTemplate); break; diff --git a/app/Helpers/Equipment/Part/DomainHelper.php b/app/Helpers/Equipment/Part/DomainHelper.php index f45e2ef..d515eaa 100644 --- a/app/Helpers/Equipment/Part/DomainHelper.php +++ b/app/Helpers/Equipment/Part/DomainHelper.php @@ -19,7 +19,7 @@ class DomainHelper extends PartHelper } switch ($field) { case 'domain': - $form = form_input($field, "", ['id' => $field, "placeholder" => "예)domain.co.kr", ...$extras]); + $form = form_input($field, $value ?? "", ['id' => $field, "placeholder" => "예)domain.co.kr", ...$extras]); $form .= "
"; break; default: diff --git a/app/Views/admin/domain/create_form.php b/app/Views/admin/domain/create_form.php new file mode 100644 index 0000000..866cb36 --- /dev/null +++ b/app/Views/admin/domain/create_form.php @@ -0,0 +1,64 @@ +extend(LAYOUTS[$viewDatas['layout']]['path']) ?> +section('content') ?> +alert($error) ?> +
+
include("templates/{$viewDatas['layout']}/form_content_top"); ?>
+ +
+ + + + + + + +
getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?> + getFieldForm($field, old($field) ?? ($viewDatas[$field] ?? null), $viewDatas) ?> + +
+
"btn btn-outline btn-primary")); ?>
+ +
+
include("templates/{$viewDatas['layout']}/form_content_bottom"); ?>
+
+ +endSection() ?> \ No newline at end of file diff --git a/public/js/admin/form.js b/public/js/admin/form.js index 8f36ad0..c2bb879 100644 --- a/public/js/admin/form.js +++ b/public/js/admin/form.js @@ -31,35 +31,4 @@ document.addEventListener('DOMContentLoaded', function() { dropdownAutoWidth: true }); } - if (document.querySelector('#domain')) { - const domainSelecor = document.querySelector('#domain') - const errorBox = document.getElementById('domain-errors'); - - const tagify = new Tagify(domainSelecor, { - enforceWhitelist: false, - whitelist: [], - duplicates: false, - delimiters: ", ", - pattern: /[a-zA-Z0-9\.\/\?\:@\-_=#]+\.([a-zA-Z0-9\&\.\/\?\:@\-_=#])*/ // 도메인주소 패턴 - }); - // ✅ 패턴이 맞지 않을 때 - tagify.on('invalid', e => { - const value = e.detail.data.value; - errorBox.innerText = `"${value}" 은(는) 유효한 도메인 형식이 아니거나 중복됩니다. 예: domain.co.kr`; - }); - // ✅ 서버에서 존재 여부 확인 - tagify.on('add', async e => { - const domain = e.detail.data.value; - const res = await fetch('/admin/equipment/part/domain/confirm', { - method: 'POST', - headers: {'Content-Type': 'application/json'}, - body: JSON.stringify({domain}) - }); - const results = await res.json(); - if (exists = results.exists === true || results.exists === 'true') { - tagify.removeTag(domain); // 이미 존재하는 도메인 제거 - errorBox.innerText = results.message; - } - }); - } }); \ No newline at end of file