dbms_init...1
This commit is contained in:
parent
3b3b8a57c8
commit
9fe08371ef
@ -37,8 +37,8 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
|||||||
$routes->post('batchjob', 'UserController::batchjob', ['filter' => 'authFilter:master']);
|
$routes->post('batchjob', 'UserController::batchjob', ['filter' => 'authFilter:master']);
|
||||||
$routes->post('batchjob_delete', 'UserController::batchjob_delete', ['filter' => 'authFilter:master']);
|
$routes->post('batchjob_delete', 'UserController::batchjob_delete', ['filter' => 'authFilter:master']);
|
||||||
$routes->get('download/(:alpha)', 'UserController::download/$1', ['filter' => 'authFilter:master']);
|
$routes->get('download/(:alpha)', 'UserController::download/$1', ['filter' => 'authFilter:master']);
|
||||||
$routes->get('individual_modify/(:num)', 'UserController::individual_modify_form/$1', ['filter' => 'authFilter:manager']);
|
$routes->get('profile_modify/(:num)', 'UserController::profile_modify_form/$1', ['filter' => 'authFilter:manager']);
|
||||||
$routes->post('individual_modify/(:num)', 'UserController::individual_modify/$1', ['filter' => 'authFilter:manager']);
|
$routes->post('profile_modify/(:num)', 'UserController::profile_modify/$1', ['filter' => 'authFilter:manager']);
|
||||||
});
|
});
|
||||||
$routes->group('mylog', ['namespace' => 'App\Controllers\Admin'], function ($routes) {
|
$routes->group('mylog', ['namespace' => 'App\Controllers\Admin'], function ($routes) {
|
||||||
$routes->get('/', 'MyLogController::index');
|
$routes->get('/', 'MyLogController::index');
|
||||||
|
|||||||
@ -60,8 +60,6 @@ class ServiceItemController extends CustomerController
|
|||||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||||
{
|
{
|
||||||
switch ($this->getAction()) {
|
switch ($this->getAction()) {
|
||||||
case 'create_form':
|
|
||||||
case 'modify_form':
|
|
||||||
case 'index':
|
case 'index':
|
||||||
$result = parent::getResultSuccess($message, $this->request->getVar('ActionTemplate') ?? $actionTemplate ?? 'popup');
|
$result = parent::getResultSuccess($message, $this->request->getVar('ActionTemplate') ?? $actionTemplate ?? 'popup');
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -43,18 +43,18 @@ class UserController extends AdminController
|
|||||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||||
{
|
{
|
||||||
switch ($this->getAction()) {
|
switch ($this->getAction()) {
|
||||||
case 'individual_modify':
|
case 'profile_modify':
|
||||||
$this->getMyLogService()->save($this->getService()->getClassName(), __FUNCTION__, $message);
|
$this->getMyLogService()->save($this->getService()->getClassName(), __FUNCTION__, $message);
|
||||||
$result = $this->view($this->entity->getPK());
|
$result = $this->view($this->entity->getPK());
|
||||||
break;
|
break;
|
||||||
case 'individual_modify_form':
|
case 'profile_modify_form':
|
||||||
$this->control = $this->getControlDatas();
|
$this->control = $this->getControlDatas();
|
||||||
$this->getHelper()->setViewDatas($this->getViewDatas());
|
$this->getHelper()->setViewDatas($this->getViewDatas());
|
||||||
$actionTemplate = $this->request->getVar('ActionTemplate') ?? $actionTemplate;
|
$actionTemplate = $this->request->getVar('ActionTemplate') ?? $actionTemplate;
|
||||||
if ($actionTemplate) {
|
if ($actionTemplate) {
|
||||||
$view_file = $this->view_path . $actionTemplate . DIRECTORY_SEPARATOR . $this->getAction();
|
$view_file = $this->view_path . $actionTemplate . DIRECTORY_SEPARATOR . 'modify_form';
|
||||||
} else {
|
} else {
|
||||||
$view_file = $this->view_path . $this->getAction();
|
$view_file = $this->view_path . 'modify_form';
|
||||||
}
|
}
|
||||||
$result = view($view_file, ['viewDatas' => $this->getViewDatas()]);
|
$result = view($view_file, ['viewDatas' => $this->getViewDatas()]);
|
||||||
break;
|
break;
|
||||||
@ -78,11 +78,11 @@ class UserController extends AdminController
|
|||||||
return $validation;
|
return $validation;
|
||||||
}
|
}
|
||||||
//Index,FieldForm관련.
|
//Index,FieldForm관련.
|
||||||
protected function individual_modify_form_process(mixed $entity): mixed
|
protected function profile_modify_form_process(mixed $entity): mixed
|
||||||
{
|
{
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
final public function individual_modify_form(mixed $uid): RedirectResponse|string
|
final public function profile_modify_form(mixed $uid): RedirectResponse|string
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
//각 Field 초기화
|
//각 Field 초기화
|
||||||
@ -108,20 +108,20 @@ class UserController extends AdminController
|
|||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||||
}
|
}
|
||||||
$this->entity = $this->individual_modify_form_process($entity);
|
$this->entity = $this->profile_modify_form_process($entity);
|
||||||
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||||
return $this->getResultSuccess();
|
return $this->getResultSuccess();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $this->getResultFail($e->getMessage());
|
return $this->getResultFail($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected function individual_modify_process(mixed $entity, array $formDatas): mixed
|
protected function profile_modify_process(mixed $entity, array $formDatas): mixed
|
||||||
{
|
{
|
||||||
//데이터 검증
|
//데이터 검증
|
||||||
$formDatas = $this->doValidate($this->getFieldRules(), $formDatas);
|
$formDatas = $this->doValidate($this->getFieldRules(), $formDatas);
|
||||||
return $this->getService()->modify($entity, $formDatas);
|
return $this->getService()->modify($entity, $formDatas);
|
||||||
}
|
}
|
||||||
final public function individual_modify(int $uid): RedirectResponse|string
|
final public function profile_modify(int $uid): RedirectResponse|string
|
||||||
{
|
{
|
||||||
//Transaction Start
|
//Transaction Start
|
||||||
$this->getService()->getModel()->transStart();
|
$this->getService()->getModel()->transStart();
|
||||||
@ -145,7 +145,7 @@ class UserController extends AdminController
|
|||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||||
}
|
}
|
||||||
$this->entity = $this->individual_modify_process($entity, $formDatas);
|
$this->entity = $this->profile_modify_process($entity, $formDatas);
|
||||||
$this->getService()->getModel()->transCommit();
|
$this->getService()->getModel()->transCommit();
|
||||||
return $this->getResultSuccess();
|
return $this->getResultSuccess();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|||||||
@ -2,17 +2,9 @@
|
|||||||
<?= $this->section('content') ?>
|
<?= $this->section('content') ?>
|
||||||
<?php if ($error = session('error')): echo $viewDatas['helper']->alert($error) ?><?php endif ?>
|
<?php if ($error = session('error')): echo $viewDatas['helper']->alert($error) ?><?php endif ?>
|
||||||
<div id="container" class="content">
|
<div id="container" class="content">
|
||||||
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
|
<div class="form_top"><?= $this->include("templates/{$viewDatas['layout']}/form_content_top"); ?></div>
|
||||||
<script src="/js/<?= $viewDatas['layout'] ?>/form.js" referrerpolicy="origin"></script>
|
|
||||||
<script src="/assets/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
|
|
||||||
<?php foreach ($viewDatas['individualStylesheets'] as $css): ?>
|
|
||||||
<link href="/css/<?= $viewDatas['layout'] ?>/<?= $css ?>" media="screen" rel="stylesheet" type="text/css" />
|
|
||||||
<?php endforeach ?>
|
|
||||||
<?php foreach ($viewDatas['individualScripts'] as $js): ?>
|
|
||||||
<script src="/js/<?= $viewDatas['layout'] ?>/<?= $js ?>" referrerpolicy="origin"></script>
|
|
||||||
<?php endforeach ?>
|
|
||||||
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
|
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
|
||||||
<div class=" action_form">
|
<div class="action_form">
|
||||||
<table class="table table-bordered">
|
<table class="table table-bordered">
|
||||||
<?php foreach ($viewDatas['control']['form_fields'] as $field): ?>
|
<?php foreach ($viewDatas['control']['form_fields'] as $field): ?>
|
||||||
<tr>
|
<tr>
|
||||||
@ -27,6 +19,6 @@
|
|||||||
<div class="text-center"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></div>
|
<div class="text-center"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></div>
|
||||||
<?= form_close(); ?>
|
<?= form_close(); ?>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form_bottom"><?= $this->include("templates/{$viewDatas['layout']}/form_content_bottom"); ?></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="create_bottom"><?= $this->include("templates/common/modal_create_iframe"); ?></div>
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -1,31 +0,0 @@
|
|||||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
|
||||||
<?= $this->section('content') ?>
|
|
||||||
<?php if ($error = session('error')): echo $viewDatas['helper']->alert($error) ?><?php endif ?>
|
|
||||||
<div id="container" class="content">
|
|
||||||
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
|
|
||||||
<script src="/js/<?= $viewDatas['layout'] ?>/form.js" referrerpolicy="origin"></script>
|
|
||||||
<script src="/assets/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
|
|
||||||
<?php foreach ($viewDatas['individualStylesheets'] as $css): ?>
|
|
||||||
<link href="/css/<?= $viewDatas['layout'] ?>/<?= $css ?>" media="screen" rel="stylesheet" type="text/css" />
|
|
||||||
<?php endforeach ?>
|
|
||||||
<?php foreach ($viewDatas['individualScripts'] as $js): ?>
|
|
||||||
<script src="/js/<?= $viewDatas['layout'] ?>/<?= $js ?>" referrerpolicy="origin"></script>
|
|
||||||
<?php endforeach ?>
|
|
||||||
<?= form_open(current_url(), ['id' => 'action_form', ...$viewDatas['forms']['attributes']], $viewDatas['forms']['hiddens']) ?>
|
|
||||||
<div class="action_form">
|
|
||||||
<table class="table table-bordered">
|
|
||||||
<?php foreach ($viewDatas['control']['form_fields'] as $field): ?>
|
|
||||||
<tr>
|
|
||||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
|
|
||||||
<td nowrap class="text-start">
|
|
||||||
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? $viewDatas['entity']->$field ?? null, $viewDatas) ?>
|
|
||||||
<div><?= validation_show_error($field); ?></div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</table>
|
|
||||||
<div class="text-center"><?= form_submit("", '수정', ["class" => "btn btn-outline btn-primary"]) ?></div>
|
|
||||||
<?= form_close(); ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?= $this->endSection() ?>
|
|
||||||
@ -2,15 +2,7 @@
|
|||||||
<?= $this->section('content') ?>
|
<?= $this->section('content') ?>
|
||||||
<?php if ($error = session('error')): echo $viewDatas['helper']->alert($error) ?><?php endif ?>
|
<?php if ($error = session('error')): echo $viewDatas['helper']->alert($error) ?><?php endif ?>
|
||||||
<div id="container" class="content">
|
<div id="container" class="content">
|
||||||
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
|
<div class="form_top"><?= $this->include("templates/{$viewDatas['layout']}/form_content_top"); ?></div>
|
||||||
<script src="/js/<?= $viewDatas['layout'] ?>/form.js" referrerpolicy="origin"></script>
|
|
||||||
<script src="/assets/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
|
|
||||||
<?php foreach ($viewDatas['individualStylesheets'] as $css): ?>
|
|
||||||
<link href="/css/<?= $viewDatas['layout'] ?>/<?= $css ?>" media="screen" rel="stylesheet" type="text/css" />
|
|
||||||
<?php endforeach ?>
|
|
||||||
<?php foreach ($viewDatas['individualScripts'] as $js): ?>
|
|
||||||
<script src="/js/<?= $viewDatas['layout'] ?>/<?= $js ?>" referrerpolicy="origin"></script>
|
|
||||||
<?php endforeach ?>
|
|
||||||
<?= form_open(current_url(), ['id' => 'action_form', ...$viewDatas['forms']['attributes']], $viewDatas['forms']['hiddens']) ?>
|
<?= form_open(current_url(), ['id' => 'action_form', ...$viewDatas['forms']['attributes']], $viewDatas['forms']['hiddens']) ?>
|
||||||
<div class="action_form">
|
<div class="action_form">
|
||||||
<table class="table table-bordered">
|
<table class="table table-bordered">
|
||||||
@ -27,5 +19,6 @@
|
|||||||
<div class="text-center"><?= form_submit("", '수정', ["class" => "btn btn-outline btn-primary"]) ?></div>
|
<div class="text-center"><?= form_submit("", '수정', ["class" => "btn btn-outline btn-primary"]) ?></div>
|
||||||
<?= form_close(); ?>
|
<?= form_close(); ?>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form_bottom"><?= $this->include("templates/{$viewDatas['layout']}/form_content_bottom"); ?></div>
|
||||||
</div>
|
</div>
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -1,32 +0,0 @@
|
|||||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
|
||||||
<?= $this->section('content') ?>
|
|
||||||
<?php if ($error = session('error')): echo $viewDatas['helper']->alert($error) ?><?php endif ?>
|
|
||||||
<div id="container" class="content">
|
|
||||||
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
|
|
||||||
<script src="/js/<?= $viewDatas['layout'] ?>/form.js" referrerpolicy="origin"></script>
|
|
||||||
<script src="/assets/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
|
|
||||||
<?php foreach ($viewDatas['individualStylesheets'] as $css): ?>
|
|
||||||
<link href="/css/<?= $viewDatas['layout'] ?>/<?= $css ?>" media="screen" rel="stylesheet" type="text/css" />
|
|
||||||
<?php endforeach ?>
|
|
||||||
<?php foreach ($viewDatas['individualScripts'] as $js): ?>
|
|
||||||
<script src="/js/<?= $viewDatas['layout'] ?>/<?= $js ?>" referrerpolicy="origin"></script>
|
|
||||||
<?php endforeach ?>
|
|
||||||
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
|
|
||||||
<div class=" action_form">
|
|
||||||
<table class="table table-bordered">
|
|
||||||
<?php foreach ($viewDatas['control']['form_fields'] as $field): ?>
|
|
||||||
<tr>
|
|
||||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
|
|
||||||
<td nowrap class="text-start">
|
|
||||||
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas[$field] ?? null), $viewDatas) ?>
|
|
||||||
<span><?= validation_show_error($field); ?></span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</table>
|
|
||||||
<div class="text-center"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></div>
|
|
||||||
<?= form_close(); ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="create_bottom"><?= $this->include("templates/common/modal_create_iframe"); ?></div>
|
|
||||||
<?= $this->endSection() ?>
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
|
||||||
<?= $this->section('content') ?>
|
|
||||||
<?php if ($error = session('error')): echo $viewDatas['helper']->alert($error) ?><?php endif ?>
|
|
||||||
<div id="container" class="content">
|
|
||||||
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
|
|
||||||
<script src="/js/<?= $viewDatas['layout'] ?>/form.js" referrerpolicy="origin"></script>
|
|
||||||
<script src="/assets/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
|
|
||||||
<?php foreach ($viewDatas['individualStylesheets'] as $css): ?>
|
|
||||||
<link href="/css/<?= $viewDatas['layout'] ?>/<?= $css ?>" media="screen" rel="stylesheet" type="text/css" />
|
|
||||||
<?php endforeach ?>
|
|
||||||
<?php foreach ($viewDatas['individualScripts'] as $js): ?>
|
|
||||||
<script src="/js/<?= $viewDatas['layout'] ?>/<?= $js ?>" referrerpolicy="origin"></script>
|
|
||||||
<?php endforeach ?>
|
|
||||||
<?= form_open(current_url(), ['id' => 'action_form', ...$viewDatas['forms']['attributes']], $viewDatas['forms']['hiddens']) ?>
|
|
||||||
<div class="action_form">
|
|
||||||
<table class="table table-bordered">
|
|
||||||
<?php foreach ($viewDatas['control']['form_fields'] as $field): ?>
|
|
||||||
<tr>
|
|
||||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
|
|
||||||
<td nowrap class="text-start">
|
|
||||||
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? $viewDatas['entity']->$field ?? null, $viewDatas) ?>
|
|
||||||
<div><?= validation_show_error($field); ?></div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</table>
|
|
||||||
<div class="text-center"><?= form_submit("", '수정', ["class" => "btn btn-outline btn-primary"]) ?></div>
|
|
||||||
<?= form_close(); ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?= $this->endSection() ?>
|
|
||||||
@ -29,7 +29,7 @@
|
|||||||
"modify",
|
"modify",
|
||||||
[
|
[
|
||||||
"class" => "dropdown-item",
|
"class" => "dropdown-item",
|
||||||
"data-src" => "/admin/user/individual_modify/" . $viewDatas['myAuthUID'],
|
"data-src" => "/admin/user/profile_modify/" . $viewDatas['myAuthUID'],
|
||||||
"data-bs-toggle" => "modal",
|
"data-bs-toggle" => "modal",
|
||||||
"data-bs-target" => "#index_action_form"
|
"data-bs-target" => "#index_action_form"
|
||||||
]
|
]
|
||||||
|
|||||||
1
app/Views/templates/admin/form_content_bottom.php
Normal file
1
app/Views/templates/admin/form_content_bottom.php
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?= $this->include("templates/common/modal_iframe"); ?>
|
||||||
9
app/Views/templates/admin/form_content_top.php
Normal file
9
app/Views/templates/admin/form_content_top.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
|
||||||
|
<script src="/js/<?= $viewDatas['layout'] ?>/form.js" referrerpolicy="origin"></script>
|
||||||
|
<script src="/assets/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
|
||||||
|
<?php foreach ($viewDatas['individualStylesheets'] as $css): ?>
|
||||||
|
<link href="/css/<?= $viewDatas['layout'] ?>/<?= $css ?>" media="screen" rel="stylesheet" type="text/css" />
|
||||||
|
<?php endforeach ?>
|
||||||
|
<?php foreach ($viewDatas['individualScripts'] as $js): ?>
|
||||||
|
<script src="/js/<?= $viewDatas['layout'] ?>/<?= $js ?>" referrerpolicy="origin"></script>
|
||||||
|
<?php endforeach ?>
|
||||||
@ -1,79 +0,0 @@
|
|||||||
<!-- 처음 호출할때 사용법
|
|
||||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#create_action_form" data-src="시작URL">시작</button>
|
|
||||||
-->
|
|
||||||
<!-- 동적으로 ifram src 바꾸고싶을때
|
|
||||||
<span data-bs-toggle="modal" data-bs-target="#create_action_form" data-src="바꾸고싶은URL" style="cursor:pointer;">바꾸기</span>
|
|
||||||
-->
|
|
||||||
<div id="create_action_form" class="create_action_form modal fade" tabindex="-1" aria-labelledby="iframe_modal_label"
|
|
||||||
aria-hidden="true">
|
|
||||||
<div class="modal-dialog modal-xl modal-dialog-centered modal-dialog-scrollable"> <!-- modal-lg는 모달 크기를 크게 설정 -->
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h5 class="modal-title" id="iframe_modal_label">
|
|
||||||
<?= ICONS['DESKTOP'] ?>
|
|
||||||
</h5>
|
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" onClick="window.location.reload()"></button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body" style="max-height: 80vh; overflow-y: auto;">
|
|
||||||
<iframe id="form-container" src="about:blank" width="100%" frameborder="0" allowfullscreen></iframe>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- Modal이 열릴 때 iframe의 src를 설정 -->
|
|
||||||
<script>
|
|
||||||
function resizeIframe() {
|
|
||||||
var iframe = document.getElementById('form-container');
|
|
||||||
// iframe.style.height = iframe.contentWindow.document.body.scrollHeight + 'px';
|
|
||||||
iframe.style.height = '500px';
|
|
||||||
}
|
|
||||||
|
|
||||||
function closeBootstrapModal() {
|
|
||||||
var modalElement = document.getElementById('create_action_form'); // 모달의 실제 DOM 요소 가져오기
|
|
||||||
var modalInstance = bootstrap.Modal.getInstance(modalElement); // 모달 인스턴스 가져오기
|
|
||||||
if (modalInstance) {
|
|
||||||
modalInstance.hide(); // 모달 닫기 (hide() 메서드 사용)
|
|
||||||
} else {
|
|
||||||
console.error("Modal instance not found.");
|
|
||||||
}
|
|
||||||
// iframe src를 초기화하거나 완전히 제거
|
|
||||||
const iframe = document.getElementById('form-container');
|
|
||||||
iframe.remove(); // DOM에서 완전히 제거
|
|
||||||
// 새 iframe 다시 생성 (깨끗한 상태로 초기화)
|
|
||||||
const newIframe = document.createElement('iframe');
|
|
||||||
newIframe.id = 'form-container';
|
|
||||||
newIframe.src = 'about:blank';
|
|
||||||
newIframe.width = '100%';
|
|
||||||
newIframe.frameBorder = '0';
|
|
||||||
newIframe.allowFullscreen = true;
|
|
||||||
// body에 다시 추가
|
|
||||||
document.querySelector('#create_action_form .modal-body').appendChild(newIframe);
|
|
||||||
// 부모창만 리로드
|
|
||||||
window.location.reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
var create_action_form = document.getElementById('create_action_form');
|
|
||||||
create_action_form.addEventListener('show.bs.modal', function(event) {
|
|
||||||
var button = event.relatedTarget;
|
|
||||||
var iframe = document.getElementById('form-container');
|
|
||||||
iframe.src = button.getAttribute('data-src');
|
|
||||||
// iframe이 로드된 후 높이를 조정하는 이벤트 리스너 추가
|
|
||||||
iframe.onload = function() {
|
|
||||||
resizeIframe();
|
|
||||||
var iframeContent = iframe.contentDocument || iframe.contentWindow.document;
|
|
||||||
// 컨텐츠 변경 시 높이 재조정을 위한 MutationObserver 설정
|
|
||||||
var observer = new MutationObserver(resizeIframe);
|
|
||||||
observer.observe(iframeContent.body, {
|
|
||||||
attributes: true,
|
|
||||||
childList: true,
|
|
||||||
subtree: true
|
|
||||||
});
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
// 모달이 닫힐 때 iframe src를 초기화하여 종료 처리
|
|
||||||
create_action_form.addEventListener('hidden.bs.modal', function() {
|
|
||||||
var iframe = document.getElementById('form-container');
|
|
||||||
iframe.src = "about:blank"; // 모달 닫힐 때 iframe 초기화
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
Loading…
Reference in New Issue
Block a user