formfields 수정

main
이범준 6 months ago
parent 3bd0574964
commit 902b27cc92

@ -1,6 +1,6 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> <%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<form id="infoPrefix-form"> <form id="actioninfoPrefix-form">
<div class="row g-3"> <div class="row g-3">
<div class="col-md-12"> <div class="col-md-12">
<div class="row"> <div class="row">
@ -40,39 +40,32 @@
</form> </form>
<script type="text/javascript"> <script type="text/javascript">
var infoPrefixFields = new FormFields("#infoPrefix-form"); var actioninfoPrefixFields = new FormFields("#actioninfoPrefix-form");
infoPrefixControl.groups.setInfo = obj => { actioninfoPrefixControl.groups.setInfo = obj => {
infoPrefixFields.set(obj); actioninfoPrefixFields.set(actioninfoPrefixControl, obj);
let create = isEmpty(obj.data.GRP_ID); let create = isEmpty(obj.data.GRP_ID);
$("input[name='id']").prop("readonly", !create); $("input[name='id']").prop("readonly", !create);
$("#infoPrefix-form input") $("#actioninfoPrefix-form input").onEnterPress(saveinfoPrefix);
.change(function() {
let input = $(this),
name = input.attr("data-map"),
val = input.val();
infoPrefixControl.groups.setValue(name, val);
})
.onEnterPress(saveinfoPrefix);
document.querySelector("input[name='" + (create ? "id" : "name") + "']").focus(); document.querySelector("input[name='" + (create ? "id" : "name") + "']").focus();
} }
infoPrefixControl.groups.onModify = (changed) => { actioninfoPrefixControl.groups.onModify = (changed) => {
if (["GRP_NM"].filter(e => changed.includes(e)).length < 1) if (["GRP_NM"].filter(e => changed.includes(e)).length < 1)
return; return;
renderinfoPrefixList(); renderactioninfoPrefixList();
infoPrefixControl.groups.dataset.setState(); actioninfoPrefixControl.groups.dataset.setState();
} }
function saveinfoPrefix() { function saveinfoPrefix() {
if (!$("#infoPrefix-form input").validInputs()) return; if (!$("#actioninfoPrefix-form input").validInputs()) return;
dialog.alert({ dialog.alert({
content:"현재 prefixName 정보를 저장하시겠습니까?", content:"현재 prefixName 정보를 저장하시겠습니까?",
onOK:() => { onOK:() => {
infoPrefixControl.groups.save(infoPrefixFields.get()); actioninfoPrefixControl.groups.save(actioninfoPrefixFields.get());
} }
}); });
} }

@ -1,145 +1,115 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> <%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<c:set var="prefixName" scope="request">기능 그룹</c:set>
<!-- Content wrapper --> <!-- Page Body -->
<div class="content-wrapper"> <div class="d-flex flex-column flex-grow-1">
<!-- Content --> <div id="DataTables_Table_0_wrapper" class="dataTables_wrapper dt-bootstrap5 no-footer">
<div class="container-xxl flex-grow-1 container-p-y">
<%--h4 id="pageTitle" class="fw-bold py-3 mb-4">페이지 제목</h4--%> <div class="d-flex flex-row justify-content-evenly">
<c:set var="prefixName" scope="request">기능 그룹</c:set> <div style="width:49%;">
<!-- Page Body --> <h5 class="mt-3">기능 그룹</h5>
<div class="card"> <div class="d-flex flex-row justify-content-between p-3">
<div class="card-datatable text-nowrap"> <div>
<div id="DataTables_Table_0_wrapper" class="dataTables_wrapper dt-bootstrap5 no-footer"> <div class="input-group" id="DataTables_Table_0_length">
<select id="by" onchange="document.getElementById('term').focus();" aria-controls="DataTables_Table_0" class="form-select">
<div class="d-flex flex-row justify-content-evenly"> <option value="${infoPrefix}Name">이름</option>
<div class="w-50 mx-3"> <option value="${infoPrefix}ID">아이디</option>
<h5 class="mt-3">기능 그룹</h5> </select>
<div class="d-flex flex-row justify-content-between p-3"> <input id="term" autofocus type="text" placeholder="조회 조건을 입력하십시오." class="form-control">
<div>
<div class="input-group" id="DataTables_Table_0_length">
<select id="by" onchange="document.getElementById('term').focus();" aria-controls="DataTables_Table_0" class="form-select">
<option value="${infoPrefix}Name">기능그룹 이름</option>
<option value="${infoPrefix}ID">기능그룹 아이디</option>
</select>
<input id="term" autofocus type="text" placeholder="조회 조건을 입력하십시오." class="form-control">
</div>
</div>
<div>
<button onclick="search${infoPrefix}s();" class="btn btn-primary">찾기</button>
<button onclick="${infoPrefix}Control.groups.newInfo();" class="btn btn-primary">+ 추가</button>
<button id="btnRemove${infoPrefix}s" onclick="remove${infoPrefix}s();" class="btn btn-primary">- 제거</button>
</div>
</div>
<table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
<thead>
<tr>
<th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" class="text-center">
<input onchange="${infoPrefix}Control.groups.select(this.checked);" type="checkbox" class="form-check-input">
</th>
<th class="sorting sorting_asc" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Full name: activate to sort column descending">기능그룹 아이디</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending">기능그룹 이름</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Start date: activate to sort column ascending">등록일자</th>
</tr>
</thead>
<tbody id="${infoPrefix}List">
</tbody>
<template id="${infoPrefix}Row">
<tr data-key="{GRP_ID}">
<td class="text-center">
<input value="{GRP_ID}" onchange="${infoPrefix}Control.groups.select('{GRP_ID}', this.checked);" type="checkbox" class="form-check-input">
</td>
<td onclick="${infoPrefix}Control.groups.setCurrent('{GRP_ID}')" ondblclick="${infoPrefix}Control.groups.getInfo({})">{GRP_ID}</td>
<td onclick="${infoPrefix}Control.groups.setCurrent('{GRP_ID}')" ondblclick="${infoPrefix}Control.groups.getInfo({})">{GRP_NM}</td>
<td onclick="${infoPrefix}Control.groups.setCurrent('{GRP_ID}')" ondblclick="${infoPrefix}Control.groups.getInfo({})">{REG_DT}</td>
</tr>
</template>
<template id="${infoPrefix}NotFound">
<tr class="odd">
<td valign="top" colspan="4" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
<div class="d-flex flex-row p-3 justify-content-between">
<span id="${infoPrefix}PagingInfo" class="dataTables_info" role="status" aria-live="polite"></span>
<ul id="${infoPrefix}Paging" class="pagination pagination-primary">
</ul>
</div>
</div>
<div class="w-50 mx-3">
<h5 class="mt-3">기능 URL</h5>
<div class="d-flex flex-row justify-content-end p-3">
<div>
<button id="btnAddActions" onclick="${infoPrefix}Control.addActions();" class="btn btn-primary">+ 추가</button>
<button id="btnRemoveActions" onclick="removeActions();" class="btn btn-primary">- 제거</button>
</div>
</div>
<table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
<thead>
<tr>
<th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" class="text-center">
<input id="actionToggler" onchange="${infoPrefix}Control.actions.select(this.checked);" type="checkbox" class="form-check-input"></th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending">기능 URL</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Start date: activate to sort column ascending">등록일자</th>
</tr>
</thead>
<tbody id="actionList">
</tbody>
<template id="actionRow">
<tr data-key="{GRP_ID}-{ACTION}">
<td class="text-center">
<input value="{GRP_ID}-{ACTION}" onchange="${infoPrefix}Control.actions.select('{GRP_ID}-{ACTION}', this.checked);" type="checkbox" class="form-check-input">
</td>
<td onclick="${infoPrefix}Control.actions.setCurrent('{GRP_ID}-{ACTION}')">{ACTION}</td>
<td onclick="${infoPrefix}Control.actions.setCurrent('{GRP_ID}-{ACTION}">{REG_DT}</td>
</tr>
</template>
<template id="actionNotFound">
<tr class="odd">
<td valign="top" colspan="3" class="dataTables_empty text-center">기능 URL 정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
<div class="d-flex flex-row p-3 justify-content-between">
<span id="actionPagingInfo" class="dataTables_info" role="status" aria-live="polite"></span>
<ul id="actionPaging" class="pagination pagination-primary">
</ul>
</div>
</div> </div>
</div> </div>
<div>
<button onclick="searchaction${infoPrefix}s();" class="btn btn-primary">찾기</button>
<button onclick="action${infoPrefix}Control.groups.newInfo();" class="btn btn-primary">+ 추가</button>
<button id="btnRemoveaction${infoPrefix}s" onclick="removeaction${infoPrefix}s();" class="btn btn-primary">- 제거</button>
</div>
</div>
<table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
<thead>
<tr><th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" style="text-align:center;"><input onchange="action${infoPrefix}Control.groups.select(this.checked);" type="checkbox" class="form-check-input"></th>
<th class="sorting sorting_asc" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Full name: activate to sort column descending" style="">아이디</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" style="">이름</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Start date: activate to sort column ascending" style="">등록일자</th>
</tr>
</thead>
<tbody id="action${infoPrefix}List">
</tbody>
<template id="action${infoPrefix}Row">
<tr data-key="{GRP_ID}">
<td style="text-align:center;"><input value="{GRP_ID}" onchange="action${infoPrefix}Control.groups.select('{GRP_ID}', this.checked);" type="checkbox" class="form-check-input"></td>
<td onclick="action${infoPrefix}Control.groups.setCurrent('{GRP_ID}')" ondblclick="action${infoPrefix}Control.groups.getInfo({})">{GRP_ID}</td>
<td onclick="action${infoPrefix}Control.groups.setCurrent('{GRP_ID}')" ondblclick="action${infoPrefix}Control.groups.getInfo({})">{GRP_NM}</td>
<td onclick="action${infoPrefix}Control.groups.setCurrent('{GRP_ID}')" ondblclick="action${infoPrefix}Control.groups.getInfo({})">{REG_DT}</td>
</tr>
</template>
<template id="action${infoPrefix}NotFound">
<tr class="odd">
<td valign="top" colspan="4" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
<div class="d-flex flex-row p-3 justify-content-between">
<label id="action${infoPrefix}PagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
<ul id="action${infoPrefix}Paging" class="pagination pagination-primary">
</ul>
</div>
</div>
<div style="width:49%;">
<h5 class="mt-3">기능 URL</h5>
<div class="d-flex flex-row justify-content-end p-3">
<div>
<button id="btnAddActions" onclick="action${infoPrefix}Control.addActions();" class="btn btn-primary">+ 추가</button>
<button id="btnRemoveActions" onclick="removeActions();" class="btn btn-primary">- 제거</button>
</div>
</div> </div>
</div> <table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
<thead>
<tr><th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" style="text-align:center;"><input id="actionToggler" onchange="action${infoPrefix}Control.actions.select(this.checked);" type="checkbox" class="form-check-input"></th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" style="">기능 URL</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Start date: activate to sort column ascending" style="">등록일자</th>
</tr>
</thead>
<tbody id="actionList">
</tbody>
<template id="actionRow">
<tr data-key="{GRP_ID}-{ACTION}">
<td style="text-align:center;"><input value="{GRP_ID}-{ACTION}" onchange="action${infoPrefix}Control.actions.select('{GRP_ID}-{ACTION}', this.checked);" type="checkbox" class="form-check-input"></td>
<td onclick="action${infoPrefix}Control.actions.setCurrent('{GRP_ID}-{ACTION}')">{ACTION}</td>
<td onclick="action${infoPrefix}Control.actions.setCurrent('{GRP_ID}-{ACTION}">{REG_DT}</td>
</tr>
</template>
<template id="actionNotFound">
<tr class="odd">
<td valign="top" colspan="3" class="dataTables_empty text-center">기능 URL 정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
<div class="d-flex flex-row p-3 justify-content-between">
<label id="actionPagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
<ul id="actionPaging" class="pagination pagination-primary">
</ul>
</div>
</div>
</div>
</div> </div>
<!--/ Page Body --> </div>
<!--/ Page Body -->
<hr class="my-5" /> <script >
</div> var action${infoPrefix}Control = new ActionGroupControl();
<!-- / Content -->
<div class="content-backdrop fade"></div>
</div>
<!-- Content wrapper -->
function searchaction${infoPrefix}s() {
action${infoPrefix}Control.groups.query = {
<script>
var ${infoPrefix}Control = new ActionGroupControl();
function search${infoPrefix}s() {
${infoPrefix}Control.groups.query = {
by:$("#by").val(), by:$("#by").val(),
term:$("#term").val() term:$("#term").val()
}; };
${infoPrefix}Control.groups.load(1); action${infoPrefix}Control.groups.load(1);
} }
function remove${infoPrefix}s() { function removeaction${infoPrefix}s() {
dialog.alert({ dialog.alert({
content:"선택한 ${prefixName} 정보를 제거하시겠습니까?", content:"선택한 ${prefixName} 정보를 제거하시겠습니까?",
onOK:() => { onOK:() => {
${infoPrefix}Control.groups.remove(); action${infoPrefix}Control.groups.remove();
} }
}); });
} }
@ -148,57 +118,57 @@ function removeActions() {
dialog.alert({ dialog.alert({
content:"선택한 기능 URL을 삭제하시겠습니까?", content:"선택한 기능 URL을 삭제하시겠습니까?",
onOK:() => { onOK:() => {
${infoPrefix}Control.removeActions(); action${infoPrefix}Control.removeActions();
} }
}); });
} }
function render${infoPrefix}List() { function renderaction${infoPrefix}List() {
let ${infoPrefix}List = ${infoPrefix}Control.groups.dataset; let ${infoPrefix}List = action${infoPrefix}Control.groups.dataset;
let empty = ${infoPrefix}List.empty; let empty = action${infoPrefix}List.empty;
let trs = empty ? let trs = empty ?
[document.getElementById("${infoPrefix}NotFound").innerHTML] : <%-- from template#${infoPrefix}NotFound --%> [document.getElementById("action${infoPrefix}NotFound").innerHTML] : <%-- from template#action${infoPrefix}NotFound --%>
${infoPrefix}List.inStrings(document.getElementById("${infoPrefix}Row").innerHTML); <%-- from template#${infoPrefix}Row --%> ${infoPrefix}List.inStrings(document.getElementById("action${infoPrefix}Row").innerHTML); <%-- from template#action${infoPrefix}Row --%>
$("#${infoPrefix}List").html(trs.join()); $("#action${infoPrefix}List").html(trs.join());
$("th input[type='checkbox']").prop("checked", false); $("th input[type='checkbox']").prop("checked", false);
} }
${infoPrefix}Control.onGroupListChange = obj => { action${infoPrefix}Control.onGroupListChange = obj => {
render${infoPrefix}List(); renderaction${infoPrefix}List();
$("#${infoPrefix}Paging").setPaging({ $("#action${infoPrefix}Paging").setPaging({
list:${infoPrefix}Control.groups.dataset, list:action${infoPrefix}Control.groups.dataset,
prefix:${infoPrefix}Control.groups.prefix, prefix:action${infoPrefix}Control.groups.prefix,
start:obj.${infoPrefix}Start, start:obj.${infoPrefix}Start,
totalSize:obj.${infoPrefix}Total, totalSize:obj.${infoPrefix}Total,
fetchSize:obj.${infoPrefix}Fetch, fetchSize:obj.${infoPrefix}Fetch,
func:"${infoPrefix}Control.groups.load({index})" func:"action${infoPrefix}Control.groups.load({index})"
}); });
}; };
${infoPrefix}Control.onCurrentGroupChange = item => { action${infoPrefix}Control.onCurrentGroupChange = item => {
$("#btnAddActions").prop("disabled", !item); $("#btnAddActions").prop("disabled", !item);
if (!item) return; if (!item) return;
let key = item.data.GRP_ID; let key = item.data.GRP_ID;
$("#${infoPrefix}List").setCurrentRow(key); $("#action${infoPrefix}List").setCurrentRow(key);
}; };
${infoPrefix}Control.onGroupSelect = selected => { action${infoPrefix}Control.onGroupSelect = selected => {
let ${infoPrefix}List = ${infoPrefix}Control.groups.dataset; let ${infoPrefix}List = action${infoPrefix}Control.groups.dataset;
let keys = selected.map(e => ${infoPrefix}List.getKey(e)); let keys = selected.map(e => ${infoPrefix}List.getKey(e));
$("#${infoPrefix}List input[type='checkbox']").each(function() { $("#action${infoPrefix}List input[type='checkbox']").each(function() {
let checkbox = $(this); let checkbox = $(this);
checkbox.prop("checked", keys.includes(checkbox.val())); checkbox.prop("checked", keys.includes(checkbox.val()));
}); });
$("#btnRemove${infoPrefix}s").prop("disabled", keys.length < 1); $("#btnRemoveaction${infoPrefix}s").prop("disabled", keys.length < 1);
}; };
${infoPrefix}Control.onActionListChange = obj => { action${infoPrefix}Control.onActionListChange = obj => {
let ${infoPrefix}List = ${infoPrefix}Control.actions.dataset; let ${infoPrefix}List = action${infoPrefix}Control.actions.dataset;
let empty = ${infoPrefix}List.empty; let empty = ${infoPrefix}List.empty;
let trs = empty ? let trs = empty ?
@ -208,16 +178,16 @@ ${infoPrefix}Control.onActionListChange = obj => {
$("#actionToggler").prop("checked", false); $("#actionToggler").prop("checked", false);
$("#actionPaging").setPaging({ $("#actionPaging").setPaging({
list:${infoPrefix}Control.actions.dataset, list:action${infoPrefix}Control.actions.dataset,
prefix:${infoPrefix}Control.actions.prefix, prefix:action${infoPrefix}Control.actions.prefix,
start:obj.actionStart, start:obj.actionStart,
totalSize:obj.actionTotal, totalSize:obj.actionTotal,
fetchSize:obj.actionFetch, fetchSize:obj.actionFetch,
func:"${infoPrefix}Control.actions.load({index})" func:"action${infoPrefix}Control.actions.load({index})"
}); });
}; };
${infoPrefix}Control.onCurrentActionChange = item => { action${infoPrefix}Control.onCurrentActionChange = item => {
if (!item) return; if (!item) return;
let data = item.data; let data = item.data;
@ -225,8 +195,8 @@ ${infoPrefix}Control.onCurrentActionChange = item => {
$("#actionList").setCurrentRow(key); $("#actionList").setCurrentRow(key);
}; };
${infoPrefix}Control.onActionSelect = selected => { action${infoPrefix}Control.onActionSelect = selected => {
let ${infoPrefix}List = ${infoPrefix}Control.actions.dataset; let ${infoPrefix}List = action${infoPrefix}Control.actions.dataset;
let keys = selected.map(e => ${infoPrefix}List.getKey(e)); let keys = selected.map(e => ${infoPrefix}List.getKey(e));
$("#actionList input[type='checkbox']").each(function() { $("#actionList input[type='checkbox']").each(function() {
let checkbox = $(this); let checkbox = $(this);
@ -236,15 +206,16 @@ ${infoPrefix}Control.onActionSelect = selected => {
$("#btnRemoveActions").prop("disabled", keys.length < 1); $("#btnRemoveActions").prop("disabled", keys.length < 1);
}; };
$("#term").onEnterPress(search${infoPrefix}s); $("#term").onEnterPress(searchaction${infoPrefix}s);
$(function(){ $(function(){
${onload} ${onload}
${infoPrefix}Control.groups.setData({ action${infoPrefix}Control.groups.setData({
${infoPrefix}List:${groupList}, ${infoPrefix}List:${groupList},
${infoPrefix}Start:${groupStart}, ${infoPrefix}Start:${groupStart},
${infoPrefix}Fetch:${groupFetch}, ${infoPrefix}Fetch:${groupFetch},
${infoPrefix}Total:${groupTotal} ${infoPrefix}Total:${groupTotal}
}); });
}); });
//# sourceURL=actionGroup-main.jsp
</script> </script>

@ -8,48 +8,45 @@
<div class="d-flex flex-row justify-content-between p-3"> <div class="d-flex flex-row justify-content-between p-3">
<div> <div>
<div class="input-group" id="DataTables_Table_0_length"> <div class="input-group" id="DataTables_Table_0_length">
<select id="_groupBy" onchange="document.getElementById('_groupTerm').focus();" aria-controls="DataTables_Table_0" class="form-select"> <select id="_actionGroupBy" onchange="document.getElementById('_actionGroupTerm').focus();" aria-controls="DataTables_Table_0" class="form-select">
<option value="${infoPrefix}Name">기능그룹 이름</option> <option value="${infoPrefix}Name">이름</option>
<option value="${infoPrefix}ID">기능그룹 아이디</option> <option value="${infoPrefix}ID">아이디</option>
</select> </select>
<input id="_groupTerm" autofocus type="text" placeholder="조회 조건을 입력하십시오." class="form-control"> <input id="_actionGroupTerm" autofocus type="text" placeholder="조회 조건을 입력하십시오." class="form-control">
</div> </div>
</div> </div>
<div> <div>
<button onclick="search${infoPrefix}s();" class="btn btn-primary">찾기</button> <button onclick="_search${infoPrefix}s();" class="btn btn-primary">찾기</button>
</div> </div>
</div> </div>
<table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info"> <table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
<thead> <thead>
<tr> <tr><th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" style="text-align:center;"><input onchange="${infoPrefix}Control.groups.select(this.checked);" type="checkbox" class="form-check-input"></th>
<th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" class="text-center"> <th class="sorting sorting_asc" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Full name: activate to sort column descending" style="">아이디</th>
<input onchange="${infoPrefix}Control.groups.select(this.checked);" type="checkbox" class="form-check-input"></th> <th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" style="">이름</th>
<th class="sorting sorting_asc" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Full name: activate to sort column descending">기능그룹 아이디</th> <th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Start date: activate to sort column ascending" style="">등록일자</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending">기능그룹 이름</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Start date: activate to sort column ascending">등록일자</th>
</tr> </tr>
</thead> </thead>
<tbody id="_${infoPrefix}List"> <tbody id="_action${infoPrefix}List">
</tbody> </tbody>
<template id="${infoPrefix}Row"> <template id="_action${infoPrefix}Row">
<tr data-key="{GRP_ID}"> <tr data-key="{GRP_ID}">
<td class="text-center"> <td style="text-align:center;"><input value="{GRP_ID}" onchange="${infoPrefix}Control.groups.select('{GRP_ID}', this.checked);" type="checkbox" class="form-check-input"></td>
<input value="{GRP_ID}" onchange="${infoPrefix}Control.groups.select('{GRP_ID}', this.checked);" type="checkbox" class="form-check-input"></td>
<td onclick="${infoPrefix}Control.groups.setCurrent('{GRP_ID}')" ondblclick="${infoPrefix}Control.groups.getInfo({})">{GRP_ID}</td> <td onclick="${infoPrefix}Control.groups.setCurrent('{GRP_ID}')" ondblclick="${infoPrefix}Control.groups.getInfo({})">{GRP_ID}</td>
<td onclick="${infoPrefix}Control.groups.setCurrent('{GRP_ID}')" ondblclick="${infoPrefix}Control.groups.getInfo({})">{GRP_NM}</td> <td onclick="${infoPrefix}Control.groups.setCurrent('{GRP_ID}')" ondblclick="${infoPrefix}Control.groups.getInfo({})">{GRP_NM}</td>
<td onclick="${infoPrefix}Control.groups.setCurrent('{GRP_ID}')" ondblclick="${infoPrefix}Control.groups.getInfo({})">{REG_DT}</td> <td onclick="${infoPrefix}Control.groups.setCurrent('{GRP_ID}')" ondblclick="${infoPrefix}Control.groups.getInfo({})">{REG_DT}</td>
</tr> </tr>
</template> </template>
<template id="${infoPrefix}NotFound"> <template id="_action${infoPrefix}NotFound">
<tr class="odd"> <tr class="odd">
<td valign="top" colspan="4" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td> <td valign="top" colspan="4" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
</tr> </tr>
</template> </template>
</table> </table>
<div class="d-flex flex-row p-3 justify-content-between"> <div class="d-flex flex-row p-3 justify-content-between">
<span id="${infoPrefix}PagingInfo" class="dataTables_info" role="status" aria-live="polite"></span> <label id="_action${infoPrefix}PagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
<ul id="${infoPrefix}Paging" class="pagination pagination-primary"> <ul id="_action${infoPrefix}Paging" class="pagination pagination-primary">
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
@ -66,10 +63,10 @@ function getSelectedActionGroup() {
return selected; return selected;
} }
function search${infoPrefix}s() { function _search${infoPrefix}s() {
${infoPrefix}Control.groups.query = { ${infoPrefix}Control.groups.query = {
by:$("#_groupBy").val(), by:$("#_actionGroupBy").val(),
term:$("#_groupTerm").val() term:$("#_actionGroupTerm").val()
}; };
${infoPrefix}Control.groups.load(1); ${infoPrefix}Control.groups.load(1);
} }
@ -79,12 +76,12 @@ ${infoPrefix}Control.onGroupListChange = obj => {
let empty = ${infoPrefix}List.empty; let empty = ${infoPrefix}List.empty;
let trs = empty ? let trs = empty ?
[document.getElementById("${infoPrefix}NotFound").innerHTML] : <%-- from template#${infoPrefix}NotFound --%> [document.getElementById("_action${infoPrefix}NotFound").innerHTML] : <%-- from template#_action${infoPrefix}NotFound --%>
${infoPrefix}List.inStrings(document.getElementById("${infoPrefix}Row").innerHTML); <%-- from template#${infoPrefix}Row --%> ${infoPrefix}List.inStrings(document.getElementById("_action${infoPrefix}Row").innerHTML); <%-- from template#_action${infoPrefix}Row --%>
$("#_${infoPrefix}List").html(trs.join()); $("#_action${infoPrefix}List").html(trs.join());
$("th input[type='checkbox']").prop("checked", false); $("th input[type='checkbox']").prop("checked", false);
$("#${infoPrefix}Paging").setPaging({ $("#_action${infoPrefix}Paging").setPaging({
list:${infoPrefix}Control.groups.dataset, list:${infoPrefix}Control.groups.dataset,
prefix:${infoPrefix}Control.groups.prefix, prefix:${infoPrefix}Control.groups.prefix,
start:obj.${infoPrefix}Start, start:obj.${infoPrefix}Start,
@ -98,19 +95,19 @@ ${infoPrefix}Control.onCurrentGroupChange = item => {
if (!item) return; if (!item) return;
let key = item.data.GRP_ID; let key = item.data.GRP_ID;
$("#_${infoPrefix}List").setCurrentRow(key); $("#_action${infoPrefix}List").setCurrentRow(key);
}; };
${infoPrefix}Control.onGroupSelect = selected => { ${infoPrefix}Control.onGroupSelect = selected => {
let ${infoPrefix}List = ${infoPrefix}Control.groups.dataset; let ${infoPrefix}List = ${infoPrefix}Control.groups.dataset;
let keys = selected.map(e => ${infoPrefix}List.getKey(e)); let keys = selected.map(e => ${infoPrefix}List.getKey(e));
$("#_${infoPrefix}List input[type='checkbox']").each(function() { $("#_action${infoPrefix}List input[type='checkbox']").each(function() {
let checkbox = $(this); let checkbox = $(this);
checkbox.prop("checked", keys.includes(checkbox.val())); checkbox.prop("checked", keys.includes(checkbox.val()));
}); });
}; };
$("#_groupTerm").onEnterPress(search${infoPrefix}s); $("#_actionGroupTerm").onEnterPress(_search${infoPrefix}s);
$(function(){ $(function(){
${onload} ${onload}

@ -2,49 +2,43 @@
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> <%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<div class="d-flex flex-row justify-content-end p-3"> <div class="d-flex flex-row justify-content-end p-3">
<div> <div>
<button id="btnAddActions" onclick="${infoPrefix}Control.addActions();" class="btn btn-primary">+ 추가</button> <button id="btnAddAuthActions" onclick="${infoPrefix}Control.addActions();" class="btn btn-primary">+ 추가</button>
<button id="btnRemoveActions" onclick="removeActions();" class="btn btn-primary">- 제거</button> <button id="btnRemoveAuthActions" onclick="removeAuthActions();" class="btn btn-primary">- 제거</button>
</div> </div>
</div> </div>
<table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info"> <table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
<thead> <thead>
<tr> <tr><th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" style="text-align:center;"><input id="authActionToggler" onchange="${infoPrefix}Control.actions.select(this.checked);" type="checkbox" class="form-check-input"></th>
<th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" class="text-center"> <th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" style="">기능 그룹</th>
<input id="actionToggler" onchange="${infoPrefix}Control.actions.select(this.checked);" type="checkbox" class="form-check-input"></th> <th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Start date: activate to sort column ascending" style="">등록일자</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending">기능 그룹 아이디</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending">기능 그룹 이름</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Start date: activate to sort column ascending">등록일자</th>
</tr> </tr>
</thead> </thead>
<tbody id="authActions"> <tbody id="authActionList">
</tbody> </tbody>
<template id="authActionRow"> <template id="authActionRow">
<tr data-key="{AUTH_ID}-{GRP_ID}"> <tr data-key="{AUTH_ID}-{GRP_ID}">
<td class="text-center"> <td style="text-align:center;"><input value="{AUTH_ID}-{GRP_ID}" onchange="${infoPrefix}Control.actions.select('{AUTH_ID}-{GRP_ID}', this.checked);" type="checkbox" class="form-check-input"></td>
<input value="{AUTH_ID}-{GRP_ID}" onchange="${infoPrefix}Control.actions.select('{AUTH_ID}-{GRP_ID}', this.checked);" type="checkbox" class="form-check-input">
</td>
<td onclick="${infoPrefix}Control.actions.setCurrent('{AUTH_ID}-{GRP_ID}')">{GRP_ID}</td> <td onclick="${infoPrefix}Control.actions.setCurrent('{AUTH_ID}-{GRP_ID}')">{GRP_ID}</td>
<td onclick="${infoPrefix}Control.actions.setCurrent('{AUTH_ID}-{GRP_ID}')">{GRP_NM}</td>
<td onclick="${infoPrefix}Control.actions.setCurrent('{AUTH_ID}-{GRP_ID}">{REG_DT}</td> <td onclick="${infoPrefix}Control.actions.setCurrent('{AUTH_ID}-{GRP_ID}">{REG_DT}</td>
</tr> </tr>
</template> </template>
<template id="actionNotFound"> <template id="authActionNotFound">
<tr class="odd"> <tr class="odd">
<td valign="top" colspan="4" class="dataTables_empty text-center">기능 그룹 정보를 찾지 못했습니다.</td> <td valign="top" colspan="3" class="dataTables_empty text-center">기능 그룹 정보를 찾지 못했습니다.</td>
</tr> </tr>
</template> </template>
<template id="adminActions"> <template id="adminActions">
<tr class="odd"> <tr class="odd">
<td valign="top" colspan="4" class="dataTables_empty text-center">{authority}는 모든 기능을 사용할 수 있습니다.</td> <td valign="top" colspan="3" class="dataTables_empty text-center">{authority}는 모든 기능을 사용할 수 있습니다.</td>
</tr> </tr>
</template> </template>
</table> </table>
<div class="d-flex flex-row p-3 justify-content-between"> <div class="d-flex flex-row p-3 justify-content-between">
<span id="actionPagingInfo" class="dataTables_info" role="status" aria-live="polite"></span> <label id="authActionPagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
<ul id="actionPaging" class="pagination pagination-primary"> <ul id="authActionPaging" class="pagination pagination-primary">
</ul> </ul>
</div> </div>
<c:set var="actionGroupFunc" scope="request">function removeActions() { <c:set var="actionGroupFunc" scope="request">function removeAuthActions() {
dialog.alert({ dialog.alert({
content:"선택한 기능그룹을 삭제하시겠습니까?", content:"선택한 기능그룹을 삭제하시겠습니까?",
onOK:() => { onOK:() => {
@ -62,12 +56,12 @@ ${infoPrefix}Control.onActionListChange = obj => {
let trs = let trs =
${infoPrefix}Control.authorities.isAdmin() ? [document.getElementById("adminActions").innerHTML.replace(/{authority}/, authority)] : ${infoPrefix}Control.authorities.isAdmin() ? [document.getElementById("adminActions").innerHTML.replace(/{authority}/, authority)] :
empty ? empty ?
[document.getElementById("actionNotFound").innerHTML] : <%-- from template#${infoPrefix}NotFound --%> [document.getElementById("authActionNotFound").innerHTML] : <%-- from template#${infoPrefix}NotFound --%>
${infoPrefix}List.inStrings(document.getElementById("authActionRow").innerHTML); <%-- from template#${infoPrefix}Row --%> ${infoPrefix}List.inStrings(document.getElementById("authActionRow").innerHTML); <%-- from template#${infoPrefix}Row --%>
$("#authActions").html(trs.join()); $("#authActionList").html(trs.join());
$("#actionToggler").prop("checked", false); $("#authActionToggler").prop("checked", false);
$("#actionPaging").setPaging({ $("#authActionPaging").setPaging({
list:${infoPrefix}Control.actions.dataset, list:${infoPrefix}Control.actions.dataset,
prefix:${infoPrefix}Control.actions.prefix, prefix:${infoPrefix}Control.actions.prefix,
start:obj.actionStart, start:obj.actionStart,
@ -82,16 +76,16 @@ ${infoPrefix}Control.onCurrentActionChange = item => {
let data = item.data; let data = item.data;
let key = data.AUTH_ID + "-" + data.GRP_ID; let key = data.AUTH_ID + "-" + data.GRP_ID;
$("#authActions").setCurrentRow(key); $("#authActionList").setCurrentRow(key);
}; };
${infoPrefix}Control.onActionSelect = selected => { ${infoPrefix}Control.onActionSelect = selected => {
let ${infoPrefix}List = ${infoPrefix}Control.actions.dataset; let ${infoPrefix}List = ${infoPrefix}Control.actions.dataset;
let keys = selected.map(e => ${infoPrefix}List.getKey(e)); let keys = selected.map(e => ${infoPrefix}List.getKey(e));
$("#authActions input[type='checkbox']").each(function() { $("#authActionList input[type='checkbox']").each(function() {
let checkbox = $(this); let checkbox = $(this);
checkbox.prop("checked", keys.includes(checkbox.val())); checkbox.prop("checked", keys.includes(checkbox.val()));
}); });
$("#btnRemoveActions").prop("disabled", keys.length < 1); $("#btnRemoveAuthActions").prop("disabled", keys.length < 1);
};</c:set> };</c:set>

@ -43,18 +43,11 @@
var infoPrefixFields = new FormFields("#infoPrefix-form"); var infoPrefixFields = new FormFields("#infoPrefix-form");
infoPrefixControl.authorities.setInfo = obj => { infoPrefixControl.authorities.setInfo = obj => {
infoPrefixFields.set(obj); infoPrefixFields.set(infoPrefixControl, obj);
let info = obj.data; let info = obj.data;
let create = isEmpty(info.AUTH_ID); let create = isEmpty(info.AUTH_ID);
$("input[name='id']").prop("readonly", !create); $("input[name='id']").prop("readonly", !create);
$("#infoPrefix-form input") $("#infoPrefix-form input").onEnterPress(saveinfoPrefix);
.change(function() {
let input = $(this),
name = input.attr("data-map"),
val = input.val();
infoPrefixControl.authorities.setValue(name, val);
})
.onEnterPress(saveinfoPrefix);
$("input[name='" + (create ? "id" : "name") + "']").focus(); $("input[name='" + (create ? "id" : "name") + "']").focus();
$("#btnSaveAuth").prop("disabled", infoPrefixControl.authorities.isBuiltIn(info)); $("#btnSaveAuth").prop("disabled", infoPrefixControl.authorities.isBuiltIn(info));

@ -1,110 +1,84 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> <%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<c:set var="prefixName" scope="request">권한</c:set>
<!-- Page Body -->
<!-- Content wrapper --> <div class="d-flex flex-column flex-grow-1">
<div class="content-wrapper"> <div id="DataTables_Table_0_wrapper" class="dataTables_wrapper dt-bootstrap5 no-footer">
<!-- Content -->
<div class="container-xxl flex-grow-1 container-p-y"> <div class="d-flex flex-row justify-content-evenly">
<%--h4 id="pageTitle" class="fw-bold py-3 mb-4">페이지 제목</h4--%> <div style="width:49%;">
<c:set var="prefixName" scope="request">권한</c:set> <h5 class="mt-3">권한</h5>
<!-- Page Body --> <div class="d-flex flex-row justify-content-between p-3">
<div class="card"> <div>
<div class="card-datatable text-nowrap"> <div class="input-group" id="DataTables_Table_0_length">
<div id="DataTables_Table_0_wrapper" class="dataTables_wrapper dt-bootstrap5 no-footer"> <select id="by" onchange="document.getElementById('term').focus();" aria-controls="DataTables_Table_0" class="form-select">
<option value="authName">이름</option>
<div class="d-flex flex-row justify-content-evenly"> <option value="authID">아이디</option>
<div class="w-40 mx-3"> </select>
<h5 class="mt-3">권한</h5> <input id="term" autofocus type="text" placeholder="조회 조건을 입력하십시오." class="form-control">
<div class="d-flex flex-row justify-content-between p-3">
<div>
<div class="input-group" id="DataTables_Table_0_length">
<select id="by" onchange="document.getElementById('term').focus();" aria-controls="DataTables_Table_0" class="form-select">
<option value="authName">권한 이름</option>
<option value="authID">권한 아이디</option>
</select>
<input id="term" autofocus type="text" placeholder="조회 조건을 입력하십시오." class="form-control">
</div>
</div>
<div>
<button onclick="search${infoPrefix}s();" class="btn btn-primary">찾기</button>
<button onclick="${infoPrefix}Control.authorities.newInfo();" class="btn btn-primary">+ 추가</button>
<button id="btnRemove${infoPrefix}s" onclick="remove${infoPrefix}s();" class="btn btn-primary">- 제거</button>
</div>
</div>
<table class="datatables-ajax table table-bordered dataTable no-footer compress-cell" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
<thead>
<tr>
<th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" class="text-center">
<input onchange="${infoPrefix}Control.authorities.select(this.checked);" type="checkbox" class="form-check-input"></th>
<th class="sorting sorting_asc" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Full name: activate to sort column descending">권한 아이디</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending">권한 이름</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Start date: activate to sort column ascending">등록일자</th>
</tr>
</thead>
<tbody id="${infoPrefix}List">
</tbody>
<template id="${infoPrefix}Row">
<tr data-key="{AUTH_ID}">
<td class="text-center">
<input value="{AUTH_ID}" onchange="${infoPrefix}Control.authorities.select('{AUTH_ID}', this.checked);" type="checkbox" class="form-check-input"></td>
<td onclick="${infoPrefix}Control.authorities.setCurrent('{AUTH_ID}')" ondblclick="${infoPrefix}Control.authorities.getInfo({})">{AUTH_ID}</td>
<td onclick="${infoPrefix}Control.authorities.setCurrent('{AUTH_ID}')" ondblclick="${infoPrefix}Control.authorities.getInfo({})">{AUTH_NM}</td>
<td onclick="${infoPrefix}Control.authorities.setCurrent('{AUTH_ID}')" ondblclick="${infoPrefix}Control.authorities.getInfo({})">{REG_DT}</td>
</tr>
</template>
<template id="${infoPrefix}NotFound">
<tr class="odd">
<td valign="top" colspan="4" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
<div class="d-flex flex-row p-3 justify-content-between">
<span id="${infoPrefix}PagingInfo" class="dataTables_info" role="status" aria-live="polite">
</span>
<ul id="${infoPrefix}Paging" class="pagination pagination-primary">
</ul>
</div>
</div>
<div class="pt-3 w-60 mx-3">
<div class="nav-align-top">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<button type="button" onClick="${infoPrefix}Control.getLinkedList('users');" class="nav-link active" role="tab" data-bs-toggle="tab" data-bs-target="#navs-top-users" aria-controls="navs-top-users" aria-selected="true">사용자</button>
</li>
<li class="nav-item">
<button type="button" onClick="${infoPrefix}Control.getLinkedList('actions');" class="nav-link" role="tab" data-bs-toggle="tab" data-bs-target="#navs-top-actions" aria-controls="navs-top-actions" aria-selected="false">기능그룹</button>
</li>
</ul>
<div class="tab-content py-2 px-0">
<div class="tab-pane fade show active" id="navs-top-users" role="tabpanel">
<jsp:include page="user-list.jsp" />
</div>
<div class="tab-pane fade" id="navs-top-actions" role="tabpanel">
<jsp:include page="actionGroup-list.jsp" />
</div>
</div>
</div>
</div> </div>
</div> </div>
<div>
<button onclick="search${infoPrefix}s();" class="btn btn-primary">찾기</button>
<button onclick="${infoPrefix}Control.authorities.newInfo();" class="btn btn-primary">+ 추가</button>
<button id="btnRemove${infoPrefix}s" onclick="remove${infoPrefix}s();" class="btn btn-primary">- 제거</button>
</div>
</div> </div>
</div> <table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
</div> <thead>
<!--/ Page Body --> <tr><th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" style="text-align:center;"><input onchange="${infoPrefix}Control.authorities.select(this.checked);" type="checkbox" class="form-check-input"></th>
<th class="sorting sorting_asc" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Full name: activate to sort column descending" style="">아이디</th>
<hr class="my-5" /> <th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" style="">이름</th>
</div> <th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Start date: activate to sort column ascending" style="">등록일자</th>
<!-- / Content --> </tr>
</thead>
<tbody id="${infoPrefix}List">
<div class="content-backdrop fade"></div> </tbody>
<template id="${infoPrefix}Row">
<tr data-key="{AUTH_ID}">
<td style="text-align:center;"><input value="{AUTH_ID}" onchange="${infoPrefix}Control.authorities.select('{AUTH_ID}', this.checked);" type="checkbox" class="form-check-input"></td>
<td onclick="${infoPrefix}Control.authorities.setCurrent('{AUTH_ID}')" ondblclick="${infoPrefix}Control.authorities.getInfo({})">{AUTH_ID}</td>
<td onclick="${infoPrefix}Control.authorities.setCurrent('{AUTH_ID}')" ondblclick="${infoPrefix}Control.authorities.getInfo({})">{AUTH_NM}</td>
<td onclick="${infoPrefix}Control.authorities.setCurrent('{AUTH_ID}')" ondblclick="${infoPrefix}Control.authorities.getInfo({})">{REG_DT}</td>
</tr>
</template>
<template id="${infoPrefix}NotFound">
<tr class="odd">
<td valign="top" colspan="4" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
<div class="d-flex flex-row p-3 justify-content-between">
<label id="${infoPrefix}PagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
<ul id="${infoPrefix}Paging" class="pagination pagination-primary">
</ul>
</div>
</div>
<div style="width:49%; padding-top:.25em;">
<div class="nav-align-top">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<button type="button" onClick="${infoPrefix}Control.getLinkedList('users');" class="nav-link active" role="tab" data-bs-toggle="tab" data-bs-target="#navs-top-users" aria-controls="navs-top-users" aria-selected="true">사용자</button>
</li>
<li class="nav-item">
<button type="button" onClick="${infoPrefix}Control.getLinkedList('actions');" class="nav-link" role="tab" data-bs-toggle="tab" data-bs-target="#navs-top-actions" aria-controls="navs-top-actions" aria-selected="false">기능그룹</button>
</li>
</ul>
<div class="tab-content" style="padding:.6em 0;">
<div class="tab-pane fade show active" id="navs-top-users" role="tabpanel">
<jsp:include page="user-list.jsp" />
</div>
<div class="tab-pane fade" id="navs-top-actions" role="tabpanel">
<jsp:include page="actionGroup-list.jsp" />
</div>
</div>
</div> </div>
<!-- Content wrapper --> </div>
</div>
</div>
</div>
<!--/ Page Body -->
<script> <script >
var ${infoPrefix}Control = new AuthorityControl(); var ${infoPrefix}Control = new AuthorityControl();
function search${infoPrefix}s() { function search${infoPrefix}s() {

@ -2,30 +2,26 @@
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> <%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<div class="d-flex flex-row justify-content-end p-3"> <div class="d-flex flex-row justify-content-end p-3">
<div> <div>
<button id="btnAddUsers" onclick="${infoPrefix}Control.addUsers();" class="btn btn-primary">+ 추가</button> <button id="btnAddAuthUsers" onclick="${infoPrefix}Control.addUsers();" class="btn btn-primary">+ 추가</button>
<button id="btnRemoveUsers" onclick="removeUsers();" class="btn btn-primary">- 제거</button> <button id="btnRemoveAuthUsers" onclick="removeAuthUsers();" class="btn btn-primary">- 제거</button>
</div> </div>
</div> </div>
<table class="datatables-ajax table table-bordered dataTable no-footer compress-cell" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info"> <table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
<thead> <thead>
<tr> <tr><th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" style="text-align:center;"><input id="authUserToggler" onchange="${infoPrefix}Control.users.select(this.checked);" type="checkbox" class="form-check-input"></th>
<th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" class="text-center">
<input id="authUserToggler" onchange="${infoPrefix}Control.users.select(this.checked);" type="checkbox" class="form-check-input"></th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending">시군구명</th> <th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending">시군구명</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" >기관명</th> <th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" >기관명</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" >부서명</th> <th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" >부서명</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" >사용자 계정</th> <th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" >사용자 계정</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" >사용자 이름</th> <th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" >사용자 이름</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Start date: activate to sort column ascending" >등록일자</th> <th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Start date: activate to sort column ascending" >등록일자</th>
</tr> </tr>
</thead> </thead>
<tbody id="authUsers"> <tbody id="authUserList">
</tbody> </tbody>
<template id="authUserRow"> <template id="authUserRow">
<tr data-key="{AUTH_ID}-{USER_ID}"> <tr data-key="{AUTH_ID}-{USER_ID}">
<td class="text-center"> <td style="text-align:center;"><input value="{AUTH_ID}-{USER_ID}" onchange="${infoPrefix}Control.users.select('{AUTH_ID}-{USER_ID}', this.checked);" type="checkbox" class="form-check-input"></td>
<input value="{AUTH_ID}-{USER_ID}" onchange="${infoPrefix}Control.users.select('{AUTH_ID}-{USER_ID}', this.checked);" type="checkbox" class="form-check-input">
</td>
<td onclick="${infoPrefix}Control.users.setCurrent('{AUTH_ID}-{USER_ID}')">{SGG_NM}</td> <td onclick="${infoPrefix}Control.users.setCurrent('{AUTH_ID}-{USER_ID}')">{SGG_NM}</td>
<td onclick="${infoPrefix}Control.users.setCurrent('{AUTH_ID}-{USER_ID}')">{NSTT_NM}</td> <td onclick="${infoPrefix}Control.users.setCurrent('{AUTH_ID}-{USER_ID}')">{NSTT_NM}</td>
<td onclick="${infoPrefix}Control.users.setCurrent('{AUTH_ID}-{USER_ID}')">{DEPT_NM}</td> <td onclick="${infoPrefix}Control.users.setCurrent('{AUTH_ID}-{USER_ID}')">{DEPT_NM}</td>
@ -34,7 +30,7 @@
<td onclick="${infoPrefix}Control.users.setCurrent('{AUTH_ID}-{USER_ID}">{REG_DT}</td> <td onclick="${infoPrefix}Control.users.setCurrent('{AUTH_ID}-{USER_ID}">{REG_DT}</td>
</tr> </tr>
</template> </template>
<template id="userNotFound"> <template id="authUserNotFound">
<tr class="odd"> <tr class="odd">
<td valign="top" colspan="7" class="dataTables_empty text-center">사용자 정보를 찾지 못했습니다.</td> <td valign="top" colspan="7" class="dataTables_empty text-center">사용자 정보를 찾지 못했습니다.</td>
</tr> </tr>
@ -46,12 +42,12 @@
</template> </template>
</table> </table>
<div class="d-flex flex-row p-3 justify-content-between"> <div class="d-flex flex-row p-3 justify-content-between">
<span id="userPagingInfo" class="dataTables_info" role="status" aria-live="polite"></span> <label id="authUserPagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
<ul id="userPaging" class="pagination pagination-primary"> <ul id="authUserPaging" class="pagination pagination-primary">
</ul> </ul>
</div> </div>
<c:set var="userFunc" scope="request"> <c:set var="userFunc" scope="request">
function removeUsers() { function removeAuthUsers() {
dialog.alert({ dialog.alert({
content:"선택한 사용자를 삭제하시겠습니까?", content:"선택한 사용자를 삭제하시겠습니까?",
onOK:() => { onOK:() => {
@ -68,12 +64,12 @@ ${infoPrefix}Control.onUserListChange = obj => {
let trs = let trs =
${infoPrefix}Control.authorities.isImplicit() ? [document.getElementById("implicitActions").innerHTML.replace(/{authority}/, authority)] : ${infoPrefix}Control.authorities.isImplicit() ? [document.getElementById("implicitActions").innerHTML.replace(/{authority}/, authority)] :
empty ? [document.getElementById("userNotFound").innerHTML] : <%-- from template#${infoPrefix}NotFound --%> empty ? [document.getElementById("authUserNotFound").innerHTML] : <%-- from template#${infoPrefix}NotFound --%>
${infoPrefix}List.inStrings(document.getElementById("authUserRow").innerHTML); <%-- from template#${infoPrefix}Row --%> ${infoPrefix}List.inStrings(document.getElementById("authUserRow").innerHTML); <%-- from template#${infoPrefix}Row --%>
$("#authUsers").html(trs.join()); $("#authUserList").html(trs.join());
$("#authUserToggler").prop("checked", false); $("#authUserToggler").prop("checked", false);
$("#userPaging").setPaging({ $("#authUserPaging").setPaging({
list:${infoPrefix}Control.users.dataset, list:${infoPrefix}Control.users.dataset,
prefix:${infoPrefix}Control.users.prefix, prefix:${infoPrefix}Control.users.prefix,
start:obj.userStart, start:obj.userStart,
@ -88,16 +84,16 @@ ${infoPrefix}Control.onCurrentUserChange = item => {
let data = item.data; let data = item.data;
let key = data.AUTH_ID + "-" + data.USER_ID; let key = data.AUTH_ID + "-" + data.USER_ID;
$("#authUsers").setCurrentRow(key); $("#authUserList").setCurrentRow(key);
}; };
${infoPrefix}Control.onUserSelect = selected => { ${infoPrefix}Control.onUserSelect = selected => {
let ${infoPrefix}List = ${infoPrefix}Control.users.dataset; let ${infoPrefix}List = ${infoPrefix}Control.users.dataset;
let keys = selected.map(e => ${infoPrefix}List.getKey(e)); let keys = selected.map(e => ${infoPrefix}List.getKey(e));
$("#authUsers input[type='checkbox']").each(function() { $("#authUserList input[type='checkbox']").each(function() {
let checkbox = $(this); let checkbox = $(this);
checkbox.prop("checked", keys.includes(checkbox.val())); checkbox.prop("checked", keys.includes(checkbox.val()));
}); });
$("#btnRemoveUsers").prop("disabled", keys.length < 1); $("#btnRemoveAuthUsers").prop("disabled", keys.length < 1);
};</c:set> };</c:set>

@ -105,17 +105,10 @@ var codeFields = new FormFields("#code-form");
codeControl.codes.setInfo = obj => { codeControl.codes.setInfo = obj => {
let info = obj.data; let info = obj.data;
codeFields.set(obj); codeFields.set(codeControl, obj);
let create = isEmpty(info.CODE); let create = isEmpty(info.CODE);
$("input[name='code']").prop("readonly", !create); $("input[name='code']").prop("readonly", !create);
$("#code-form input") $("#code-form input").onEnterPress(saveCode);
.change(function() {
let input = $(this),
name = input.attr("data-map"),
val = input.val();
codeControl.codes.setValue(name, val);
})
.onEnterPress(saveCode);
$("#codeInUse").html("Y" == info.USE_YN ? "사용 중" : "사용하지 않음"); $("#codeInUse").html("Y" == info.USE_YN ? "사용 중" : "사용하지 않음");
document.querySelector("input[name='" + (create ? "code" : "value") + "']").focus(); document.querySelector("input[name='" + (create ? "code" : "value") + "']").focus();
} }

@ -1,131 +1,102 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> <%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<c:set var="prefixName" scope="request">코드 그룹</c:set>
<!-- Content wrapper --> <!-- Page Body -->
<div class="content-wrapper"> <div class="d-flex flex-column flex-grow-1">
<!-- Content --> <div id="DataTables_Table_0_wrapper" class="dataTables_wrapper dt-bootstrap5 no-footer">
<div class="container-xxl flex-grow-1 container-p-y">
<%--h4 id="pageTitle" class="fw-bold py-3 mb-4">페이지 제목</h4--%> <div class="d-flex flex-row justify-content-evenly">
<c:set var="prefixName" scope="request">코드 그룹</c:set> <div style="width:49%;">
<!-- Page Body --> <h5 class="mt-3">${prefixName}</h5>
<div class="card"> <div class="d-flex flex-row justify-content-between p-3">
<div class="card-datatable text-nowrap"> <%--div>
<div id="DataTables_Table_0_wrapper" class="dataTables_wrapper dt-bootstrap5 no-footer"> <div class="input-group" id="DataTables_Table_0_length">
<select id="by" onchange="document.getElementById('term').focus();" aria-controls="DataTables_Table_0" class="form-select">
<div class="d-flex flex-row justify-content-evenly"> <option value="groupName">이름</option>
<div class="w-50 mx-3"> <option value="groupID">아이디</option>
<h5 class="mt-3">${prefixName}</h5> </select>
<div class="d-flex flex-row justify-content-between p-3"> <input id="term" autofocus type="text" placeholder="조회 조건을 입력하십시오." class="form-control">
<%--div>
<div class="input-group" id="DataTables_Table_0_length">
<select id="by" onchange="document.getElementById('term').focus();" aria-controls="DataTables_Table_0" class="form-select">
<option value="groupName">이름</option>
<option value="groupID">아이디</option>
</select>
<input id="term" autofocus type="text" placeholder="조회 조건을 입력하십시오." class="form-control">
</div>
</div--%>
<div>
<%--button onclick="searchGroups();" class="btn btn-primary">찾기</button--%>
<button onclick="codeControl.groups.newInfo();" class="btn btn-primary">+ 추가</button>
<button id="btnRemoveGroups" onclick="removeGroups();" class="btn btn-primary">- 제거</button>
</div>
</div>
<table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
<thead>
<tr>
<th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" class="text-center">
<input onchange="codeControl.groups.select(this.checked);" type="checkbox" class="form-check-input"></th>
<th class="sorting sorting_asc" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Full name: activate to sort column descending">아이디</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending">이름</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Start date: activate to sort column ascending">등록일자</th>
</tr>
</thead>
<tbody id="groupList">
</tbody>
<template id="groupRow">
<tr data-key="{GRP_ID}">
<td class="text-center">
<input value="{GRP_ID}" onchange="codeControl.groups.select('{GRP_ID}', this.checked);" type="checkbox" class="form-check-input"></td>
<td onclick="codeControl.groups.setCurrent('{GRP_ID}')" ondblclick="codeControl.groups.getInfo({})">{GRP_ID}</td>
<td onclick="codeControl.groups.setCurrent('{GRP_ID}')" ondblclick="codeControl.groups.getInfo({})">{GRP_NM}</td>
<td onclick="codeControl.groups.setCurrent('{GRP_ID}')" ondblclick="codeControl.groups.getInfo({})">{REG_DT}</td>
</tr>
</template>
<template id="groupNotFound">
<tr class="odd">
<td valign="top" colspan="4" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
<div class="d-flex flex-row p-3 justify-content-between">
<span id="groupPagingInfo" class="dataTables_info" role="status" aria-live="polite"></span>
<ul id="groupPaging" class="pagination pagination-primary">
</ul>
</div>
</div>
<div class="w-50 mx-3">
<h5 class="mt-3">공통 코드</h5>
<div class="d-flex flex-row justify-content-end p-3">
<div>
<button id="btnAddCode" onclick="codeControl.newCode();" class="btn btn-primary">+ 추가</button>
<button id="btnRemoveCodes" onclick="removeCodes();" class="btn btn-primary">- 제거</button>
</div>
</div>
<table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
<thead>
<tr>
<th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" class="text-center">
<input id="codeToggler" onchange="codeControl.codes.select(this.checked);" type="checkbox" class="form-check-input">
</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending">코드</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending">코드값</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Start date: activate to sort column ascending">등록일자</th>
</tr>
</thead>
<tbody id="codeList">
</tbody>
<template id="codeRow">
<tr data-key="{CODE}">
<td class="text-center">
<input value="{CODE}" onchange="codeControl.codes.select('{CODE}', this.checked);" type="checkbox" class="form-check-input">
</td>
<td onclick="codeControl.codes.setCurrent('{CODE}')" ondblclick="codeControl.codes.getInfo({})">{CODE}</td>
<td onclick="codeControl.codes.setCurrent('{CODE}')" ondblclick="codeControl.codes.getInfo({})">{CODE_VAL}</td>
<td onclick="codeControl.codes.setCurrent('{CODE}')" ondblclick="codeControl.codes.getInfo({})">{REG_DT}</td>
</tr>
</template>
<template id="codeNotFound">
<tr class="odd">
<td valign="top" colspan="4" class="dataTables_empty text-center">코드 정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
<div class="d-flex flex-row p-3 justify-content-between">
<span id="codePagingInfo" class="dataTables_info" role="status" aria-live="polite"></span>
<ul id="codePaging" class="pagination pagination-primary">
</ul>
</div>
</div> </div>
</div--%>
<div>
<%--button onclick="searchGroups();" class="btn btn-primary">찾기</button--%>
<button onclick="codeControl.groups.newInfo();" class="btn btn-primary">+ 추가</button>
<button id="btnRemoveGroups" onclick="removeGroups();" class="btn btn-primary">- 제거</button>
</div>
</div>
<table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
<thead>
<tr><th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" style="text-align:center;"><input onchange="codeControl.groups.select(this.checked);" type="checkbox" class="form-check-input"></th>
<th class="sorting sorting_asc" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Full name: activate to sort column descending">아이디</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending">이름</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Start date: activate to sort column ascending">등록일자</th>
</tr>
</thead>
<tbody id="groupList">
</tbody>
<template id="groupRow">
<tr data-key="{GRP_ID}">
<td style="text-align:center;"><input value="{GRP_ID}" onchange="codeControl.groups.select('{GRP_ID}', this.checked);" type="checkbox" class="form-check-input"></td>
<td onclick="codeControl.groups.setCurrent('{GRP_ID}')" ondblclick="codeControl.groups.getInfo({})">{GRP_ID}</td>
<td onclick="codeControl.groups.setCurrent('{GRP_ID}')" ondblclick="codeControl.groups.getInfo({})">{GRP_NM}</td>
<td onclick="codeControl.groups.setCurrent('{GRP_ID}')" ondblclick="codeControl.groups.getInfo({})">{REG_DT}</td>
</tr>
</template>
<template id="groupNotFound">
<tr class="odd">
<td valign="top" colspan="4" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
<div class="d-flex flex-row p-3 justify-content-between">
<label id="groupPagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
<ul id="groupPaging" class="pagination pagination-primary">
</ul>
</div>
</div>
<div style="width:49%;">
<h5 class="mt-3">공통 코드</h5>
<div class="d-flex flex-row justify-content-end p-3">
<div>
<button id="btnAddCode" onclick="codeControl.newCode();" class="btn btn-primary">+ 추가</button>
<button id="btnRemoveCodes" onclick="removeCodes();" class="btn btn-primary">- 제거</button>
</div> </div>
</div> </div>
</div> <table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
<thead>
<tr><th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" style="text-align:center;"><input id="codeToggler" onchange="codeControl.codes.select(this.checked);" type="checkbox" class="form-check-input"></th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending">코드</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending">코드값</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Start date: activate to sort column ascending">등록일자</th>
</tr>
</thead>
<tbody id="codeList">
</tbody>
<template id="codeRow">
<tr data-key="{CODE}">
<td style="text-align:center;"><input value="{CODE}" onchange="codeControl.codes.select('{CODE}', this.checked);" type="checkbox" class="form-check-input"></td>
<td onclick="codeControl.codes.setCurrent('{CODE}')" ondblclick="codeControl.codes.getInfo({})">{CODE}</td>
<td onclick="codeControl.codes.setCurrent('{CODE}')" ondblclick="codeControl.codes.getInfo({})">{CODE_VAL}</td>
<td onclick="codeControl.codes.setCurrent('{CODE}')" ondblclick="codeControl.codes.getInfo({})">{REG_DT}</td>
</tr>
</template>
<template id="codeNotFound">
<tr class="odd">
<td valign="top" colspan="4" class="dataTables_empty text-center">코드 정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
<div class="d-flex flex-row p-3 justify-content-between">
<label id="codePagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
<ul id="codePaging" class="pagination pagination-primary">
</ul>
</div>
</div>
</div>
</div> </div>
<!--/ Page Body --> </div>
<!--/ Page Body -->
<hr class="my-5" /> <script >
</div>
<!-- / Content -->
<div class="content-backdrop fade"></div>
</div>
<!-- Content wrapper -->
<script>
var codeControl = new CodeControl(); var codeControl = new CodeControl();
function searchGroups() { function searchGroups() {
@ -149,7 +120,7 @@ function removeCodes() {
dialog.alert({ dialog.alert({
content:"선택한 코드를 삭제하시겠습니까?", content:"선택한 코드를 삭제하시겠습니까?",
onOK:() => { onOK:() => {
codeControl.removeCodes(); codeControl.codes.remove();
} }
}); });
} }
@ -214,9 +185,9 @@ codeControl.onCodeListChange = obj => {
$("#codePaging").setPaging({ $("#codePaging").setPaging({
list:codeControl.codes.dataset, list:codeControl.codes.dataset,
prefix:codeControl.codes.prefix, prefix:codeControl.codes.prefix,
start:obj.codeStart, start:obj ? obj.codeStart : -1,
totalSize:obj.codeTotal, totalSize:obj ? obj.codeTotal : 0,
fetchSize:obj.codeFetch, fetchSize:obj ? obj.codeFetch : 10,
func:"codeControl.codes.load({index})" func:"codeControl.codes.load({index})"
}); });
}; };
@ -251,4 +222,5 @@ $(function(){
groupTotal:${groupTotal} groupTotal:${groupTotal}
}); });
}); });
</script> //# sourceURL=code-main.jsp
</script>

@ -74,17 +74,10 @@ var groupFields = new FormFields("#group-form");
codeControl.groups.setInfo = obj => { codeControl.groups.setInfo = obj => {
let info = obj.data; let info = obj.data;
groupFields.set(obj); groupFields.set(codeControl, obj);
let create = isEmpty(info.GRP_ID); let create = isEmpty(info.GRP_ID);
$("input[name='id']").prop("readonly", !create); $("input[name='id']").prop("readonly", !create);
$("#group-form input") $("#group-form input").onEnterPress(saveGroup);
.change(function() {
let input = $(this),
name = input.attr("data-map"),
val = input.val();
codeControl.groups.setValue(name, val);
})
.onEnterPress(saveGroup);
$("#groupInUse").html(create ? "" : info.USE_YN == "Y" ? "사용 중" : "사용하지 않음"); $("#groupInUse").html(create ? "" : info.USE_YN == "Y" ? "사용 중" : "사용하지 않음");
document.querySelector("input[name='" + (create ? "id" : "name") + "']").focus(); document.querySelector("input[name='" + (create ? "id" : "name") + "']").focus();

@ -74,7 +74,7 @@
var menuFields = new FormFields("#menu-form"); var menuFields = new FormFields("#menu-form");
menuControl.setInfo = obj => { menuControl.setInfo = obj => {
menuFields.set(obj); menuFields.set(menuControl, obj);
$("input[name='name']").focus(); $("input[name='name']").focus();
} }
@ -98,11 +98,5 @@ function saveMenu() {
} }
$("#menu-form input") $("#menu-form input")
.change(function() {
let input = $(this),
name = input.attr("name"),
val = input.val();
menuControl.setValue(name, val);
})
.onEnterPress(() => saveMenu()); .onEnterPress(() => saveMenu());
</c:set> </c:set>

@ -1,56 +1,38 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> <%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<!-- inner page css --> <link rel="stylesheet" href="<c:url value="/resources/3rd-party/sneat/libs/jstree/jstree.css"/>" /--%>
<!-- inner page html --> <c:set var="prefixName" scope="request">메뉴</c:set>
<div class="content-wrapper"> <!-- Page Body -->
<!-- Content --> <div class="d-flex flex-column flex-grow-1">
<div id="DataTables_Table_0_wrapper" class="dataTables_wrapper dt-bootstrap5 no-footer">
<div class="container-xxl flex-grow-1 container-p-y">
<%--h4 id="pageTitle" class="fw-bold py-3 mb-4">페이지 제목</h4--%> <div class="d-flex flex-row justify-content-evenly">
<c:set var="prefixName" scope="request">메뉴</c:set> <div style="width:49%;">
<!-- Page Body --> <h5 class="mt-3">레이아웃</h5>
<div class="card"> <div id="menu-tree" class="main-left d-flex flex-column flex-grow-1">
<div class="card-datatable text-nowrap"> <div class="d-flex justify-content-between" style="padding-top:.5em; padding-bottom:.5em; border-top:1px solid #dfdfdf; border-bottom:1px solid #dfdfdf;">
<div id="DataTables_Table_0_wrapper" class="dataTables_wrapper dt-bootstrap5 no-footer"> <span>
<button id="menuToggler" onclick="toggleMenus();" class="btn btn-primary"></button>
<div class="d-flex flex-row justify-content-evenly"> </span>
<div class="w-50 mx-3"> </div>
<h5 class="mt-3">레이아웃</h5> <div id="menuTree" style="padding-top:1em; min-height:26em; overflow:auto;">
<div id="menu-tree" class="main-left d-flex flex-column flex-grow-1"> </div>
<div class="d-flex justify-content-between py-2 border-separator-y"> </div>
<span> </div>
<button id="menuToggler" onclick="toggleMenus();" class="btn btn-primary"></button> <div style="width:49%;">
</span> <h5 class="mt-3">등록 정보</h5>
</div> <div class="d-flex flex-row justify-content-end p-3">
<div id="menuTree" class="pt-3 ox-auto oy-auto"> <div>
</div> <button id="btnRemoveMenus" onclick="removeMenus();" class="btn btn-primary">- 제거</button>
</div>
</div>
<div class="w-50 mx-3">
<h5 class="mt-3">등록 정보</h5>
<div class="d-flex flex-row justify-content-end p-3">
<div>
<button id="btnRemoveMenus" onclick="removeMenus();" class="btn btn-primary">- 제거</button>
</div>
</div>
<jsp:include page="menu-info.jsp" />
</div>
</div> </div>
</div> </div>
<jsp:include page="menu-info.jsp" />
</div>
</div> </div>
</div> </div>
<!-- Page Body --> </div>
<!--/ Page Body -->
<hr class="my-5" /> <script >
</div>
<!-- / Content -->
<div class="content-backdrop fade"></div>
</div>
<script>
var menuBranches = treeSupport({ var menuBranches = treeSupport({
selector:"#menuTree", selector:"#menuTree",
trace:wctx.trace, trace:wctx.trace,
@ -148,4 +130,5 @@ $(function(){
menuControl.setData(${menus}); menuControl.setData(${menus});
menuBranches.open(); menuBranches.open();
}); });
</script> //# sourceURL=menu-main.jsp
</script>

@ -21,24 +21,20 @@
</div> </div>
<table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info"> <table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
<thead> <thead>
<tr> <tr><th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" style="text-align:center;"><input onchange="${infoPrefix}Control.dataset.select(this.checked);" type="checkbox" class="form-check-input"></th>
<th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" class="text-center">
<input onchange="${infoPrefix}Control.dataset.select(this.checked);" type="checkbox" class="form-check-input"></th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" >시군구명</th> <th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" >시군구명</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" >기관명</th> <th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" >기관명</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" >부서명</th> <th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" >부서명</th>
<th class="sorting sorting_asc" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Full name: activate to sort column descending" >계정</th> <th class="sorting sorting_asc" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Full name: activate to sort column descending" >계정</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" >이름</th> <th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Email: activate to sort column ascending" >이름</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Start date: activate to sort column ascending" >등록일자</th> <th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="Start date: activate to sort column ascending" >등록일자</th>
</tr> </tr>
</thead> </thead>
<tbody id="_${infoPrefix}List"> <tbody id="_${infoPrefix}List">
</tbody> </tbody>
<template id="_${infoPrefix}Row"> <template id="_${infoPrefix}Row">
<tr data-key="{USER_ID}"> <tr data-key="{USER_ID}">
<td class="text-center"> <td style="text-align:center;"><input value="{USER_ID}" onchange="${infoPrefix}Control.dataset.select('{USER_ID}', this.checked);" type="checkbox" class="form-check-input"></td>
<input value="{USER_ID}" onchange="${infoPrefix}Control.dataset.select('{USER_ID}', this.checked);" type="checkbox" class="form-check-input">
</td>
<td onclick="${infoPrefix}Control.setCurrent('{USER_ID}')" ondblclick="${infoPrefix}Control.getInfo({})">{SGG_NM}</td> <td onclick="${infoPrefix}Control.setCurrent('{USER_ID}')" ondblclick="${infoPrefix}Control.getInfo({})">{SGG_NM}</td>
<td onclick="${infoPrefix}Control.setCurrent('{USER_ID}')" ondblclick="${infoPrefix}Control.getInfo({})">{NSTT_NM}</td> <td onclick="${infoPrefix}Control.setCurrent('{USER_ID}')" ondblclick="${infoPrefix}Control.getInfo({})">{NSTT_NM}</td>
<td onclick="${infoPrefix}Control.setCurrent('{USER_ID}')" ondblclick="${infoPrefix}Control.getInfo({})">{DEPT_NM}</td> <td onclick="${infoPrefix}Control.setCurrent('{USER_ID}')" ondblclick="${infoPrefix}Control.getInfo({})">{DEPT_NM}</td>
@ -54,9 +50,9 @@
</template> </template>
</table> </table>
<div class="d-flex flex-row p-3 justify-content-between"> <div class="d-flex flex-row p-3 justify-content-between">
<span id="_${infoPrefix}PagingInfo" class="dataTables_info" role="status" aria-live="polite"></span> <label id="_${infoPrefix}PagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
<ul id="_${infoPrefix}Paging" class="pagination pagination-primary"> <ul id="_${infoPrefix}Paging" class="pagination pagination-primary">
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>

@ -179,7 +179,7 @@
<script type="text/javascript"> <script type="text/javascript">
var infoPrefixFields = new FormFields("#infoPrefix-form"); var infoPrefixFields = new FimsFormFields("#infoPrefix-form");
infoPrefixControl.setInfo = obj => { infoPrefixControl.setInfo = obj => {
infoPrefixFields.set(obj); infoPrefixFields.set(obj);
@ -190,9 +190,9 @@ infoPrefixControl.setInfo = obj => {
let password = $(this).prop("required", create); let password = $(this).prop("required", create);
let div = password.parent().parent().parent(); let div = password.parent().parent().parent();
if (create) { if (create) {
div.show(); div.removeAttr("hidden");
} else } else
div.hide(); div.attr("hidden","hidden");
}); });
$("#infoPrefix-form").find("input,select") $("#infoPrefix-form").find("input,select")
.change(function() { .change(function() {

@ -1,95 +1,69 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> <%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<c:set var="prefixName" scope="request">사용자</c:set>
<!-- Page Body -->
<div class="d-flex flex-column flex-grow-1">
<!-- Content wrapper --> <div id="DataTables_Table_0_wrapper" class="dataTables_wrapper dt-bootstrap5 no-footer">
<div class="content-wrapper">
<!-- Content --> <div class="d-flex flex-row justify-content-between p-3">
<div class="container-xxl flex-grow-1 container-p-y"> <div>
<%--h4 id="pageTitle" class="fw-bold py-3 mb-4">페이지 제목</h4--%> <div class="input-group" id="DataTables_Table_0_length">
<c:set var="prefixName" scope="request">사용자</c:set> <select id="by" onchange="document.getElementById('term').focus();" aria-controls="DataTables_Table_0" class="form-select">
<!-- Page Body --> <option value="${infoPrefix}Name">이름</option>
<div class="card"> <option value="${infoPrefix}Account">계정</option>
<div class="card-datatable text-nowrap"> </select>
<div id="DataTables_Table_0_wrapper" class="dataTables_wrapper dt-bootstrap5 no-footer"> <input id="term" autofocus type="text" placeholder="조회 조건을 입력하십시오." class="form-control">
<div class="d-flex flex-row justify-content-between p-3">
<div>
<div class="input-group" id="DataTables_Table_0_length">
<select id="by" onchange="document.getElementById('term').focus();" aria-controls="DataTables_Table_0" class="form-select">
<option value="${infoPrefix}Name">이름</option>
<option value="${infoPrefix}Account">계정</option>
</select>
<input id="term" autofocus type="text" placeholder="조회 조건을 입력하십시오." class="form-control">
</div>
</div>
<div>
<button onclick="search${infoPrefix}s();" class="btn btn-primary">찾기</button>
<button onclick="${infoPrefix}Control.newInfo();" class="btn btn-primary">+ 추가</button>
<button id="btnRemove${infoPrefix}s" onclick="remove${infoPrefix}s();" class="btn btn-primary">- 제거</button>
</div>
</div>
<div class="table-responsive">
<table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
<thead>
<tr>
<th tabindex="0" class="text-center" style="width: 158.828px;">
<input onchange="${infoPrefix}Control.select(this.checked);" type="checkbox" class="form-check-input">
</th>
<th class="sorting sorting_asc" aria-sort="ascending" style="width: 223.719px;">계정</th>
<th class="sorting" style="width: 146.156px;">이름</th>
<th class="sorting" style="width: 146.156px;">기관</th>
<th class="sorting" style="width: 146.156px;">부서</th>
<th class="sorting" style="width: 160.141px;">전화번호(유선)</th>
<th class="sorting" style="width: 195.688px;">이메일</th>
<th class="sorting" style="width: 230.469px;">등록일자</th>
</tr>
</thead>
<tbody id="${infoPrefix}List">
</tbody>
<template id="${infoPrefix}Row">
<tr data-key="{USER_ID}">
<td class="text-center">
<input value="{USER_ID}" onchange="${infoPrefix}Control.select('{USER_ID}', this.checked);" type="checkbox" class="form-check-input">
</td>
<td {onclick} {ondblclick}>{USER_ACNT}</td>
<td {onclick} {ondblclick}>{USER_NM}</td>
<td {onclick} {ondblclick}>{NSTT_NM}</td>
<td {onclick} {ondblclick}>{DEPT_NM}</td>
<td {onclick} {ondblclick}>{TELNO}</td>
<td {onclick} {ondblclick}>{EML_ADRS}</td>
<td {onclick} {ondblclick}>{REG_DT}</td>
</tr>
</template>
<template id="${infoPrefix}NotFound">
<tr class="odd">
<td valign="top" colspan="8" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
</div>
<div class="d-flex flex-row p-3 justify-content-between">
<span id="${infoPrefix}PagingInfo" class="dataTables_info" role="status" aria-live="polite"></span>
<ul id="${infoPrefix}Paging" class="pagination pagination-primary">
</ul>
</div> </div>
</div> </div>
</div> <div>
<button onclick="search${infoPrefix}s();" class="btn btn-primary">찾기</button>
<button onclick="${infoPrefix}Control.newInfo();" class="btn btn-primary">+ 추가</button>
<button id="btnRemove${infoPrefix}s" onclick="remove${infoPrefix}s();" class="btn btn-primary">- 제거</button>
</div>
</div>
<div class="table-responsive">
<table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
<thead>
<tr><th tabindex="0" style="width: 158.828px; text-align:center;"><input onchange="${infoPrefix}Control.select(this.checked);" type="checkbox" class="form-check-input"></th>
<th class="sorting sorting_asc" aria-sort="ascending" style="width: 223.719px;">계정</th>
<th class="sorting" style="width: 146.156px;">이름</th>
<th class="sorting" style="width: 146.156px;">기관</th>
<th class="sorting" style="width: 146.156px;">부서</th>
<th class="sorting" style="width: 195.688px;">이메일</th>
<th class="sorting" style="width: 160.141px;">전화번호(유선)</th>
<th class="sorting" style="width: 230.469px;">등록일자</th>
</tr>
</thead>
<tbody id="${infoPrefix}List">
</tbody>
<template id="${infoPrefix}Row">
<tr data-key="{USER_ID}">
<td style="text-align:center;"><input value="{USER_ID}" onchange="${infoPrefix}Control.select('{USER_ID}', this.checked);" type="checkbox" class="form-check-input"></td>
<td {onclick} {ondblclick}>{USER_ACNT}</td>
<td {onclick} {ondblclick}>{USER_NM}</td>
<td {onclick} {ondblclick}>{NSTT_NM}</td>
<td {onclick} {ondblclick}>{DEPT_NM}</td>
<td {onclick} {ondblclick}>{EML_ADRS}</td>
<td {onclick} {ondblclick}>{TELNO}</td>
<td {onclick} {ondblclick}>{REG_DT}</td>
</tr>
</template>
<template id="${infoPrefix}NotFound">
<tr class="odd">
<td valign="top" colspan="8" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
</div>
<div class="d-flex flex-row p-3 justify-content-between">
<label id="${infoPrefix}PagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
<ul id="${infoPrefix}Paging" class="pagination pagination-primary">
</ul>
</div>
</div> </div>
<!--/ Page Body --> </div>
<!--/ Page Body -->
<hr class="my-5" /> <script >
</div>
<!-- / Content -->
<div class="content-backdrop fade"></div>
</div>
<!-- Content wrapper -->
<script>
var ${infoPrefix}Control = new UserControl(); var ${infoPrefix}Control = new UserControl();
function search${infoPrefix}s() { function search${infoPrefix}s() {
@ -112,23 +86,23 @@ function remove${infoPrefix}s() {
function render${infoPrefix}List() { function render${infoPrefix}List() {
let ${infoPrefix}List = ${infoPrefix}Control.dataset; let ${infoPrefix}List = ${infoPrefix}Control.dataset;
let empty = ${infoPrefix}List.empty; let empty = ${infoPrefix}List.empty;
let trs = empty ? let trs = empty ?
[document.getElementById("${infoPrefix}NotFound").innerHTML] : <%-- from template#${infoPrefix}NotFound --%> [document.getElementById("${infoPrefix}NotFound").innerHTML] : <%-- from template#${infoPrefix}NotFound --%>
${infoPrefix}List.inStrings( ${infoPrefix}List.inStrings(
document.getElementById("${infoPrefix}Row").innerHTML, <%-- from template#${infoPrefix}Row --%> document.getElementById("${infoPrefix}Row").innerHTML, <%-- from template#${infoPrefix}Row --%>
(str, dataItem) => str (str, dataItem) => str
.replace(/{onclick}/gi, 'onclick="userControl.setCurrent(\'' + dataItem.getValue("USER_ID") + '\');"') .replace(/{onclick}=""/gi, 'onclick="userControl.setCurrent(\'' + dataItem.getValue("USER_ID") + '\');"')
.replace(/{ondblclick}/gi, 'ondblclick="userControl.getInfo(\'' + dataItem.getValue("USER_ID") + '\')"') .replace(/{ondblclick}=""/gi, 'ondblclick="userControl.getInfo(\'' + dataItem.getValue("USER_ID") + '\')"')
<%-- OR <%-- OR
(str, dataItem) => { (str, dataItem) => {
let userID = dataItem.getValue("USER_ID"); let userID = dataItem.getValue("USER_ID");
return str return str
.replace(/{onclick}/gi, 'onclick="userControl.setCurrent(\'' + userID + '\');"') .replace(/{onclick}=""/gi, 'onclick="userControl.setCurrent(\'' + userID + '\');"')
.replace(/{ondblclick}/gi, 'ondblclick="userControl.getInfo(\'' + userID + '\')"') .replace(/{ondblclick}=""/gi, 'ondblclick="userControl.getInfo(\'' + userID + '\')"')
} }
--%> --%>
); );
$("#${infoPrefix}List").html(trs.join()); $("#${infoPrefix}List").html(trs.join());
$("th input[type='checkbox']").prop("checked", false); $("th input[type='checkbox']").prop("checked", false);
} }
@ -148,7 +122,7 @@ ${infoPrefix}Control.onDatasetChange = obj => {
${infoPrefix}Control.onCurrentChange = item => { ${infoPrefix}Control.onCurrentChange = item => {
if (!item) return; if (!item) return;
let key = item.data.USER_ID; let key = item.data.USER_ID;
$("#${infoPrefix}List").setCurrentRow(key); $("#${infoPrefix}List").setCurrentRow(key);
}; };
@ -160,7 +134,7 @@ ${infoPrefix}Control.onSelectionChange = selected => {
let checkbox = $(this); let checkbox = $(this);
checkbox.prop("checked", keys.includes(checkbox.val())); checkbox.prop("checked", keys.includes(checkbox.val()));
}); });
$("#btnRemove${infoPrefix}s").prop("disabled", keys.length < 1); $("#btnRemove${infoPrefix}s").prop("disabled", keys.length < 1);
}; };
@ -175,4 +149,5 @@ $(function(){
${infoPrefix}Total:${userTotal} ${infoPrefix}Total:${userTotal}
}); });
}); });
//# sourceURL=user-main.jsp
</script> </script>

@ -224,7 +224,7 @@
<script src="/resources/js/base/base-fims.js"></script> <script src="/resources/js/base/base-fims.js"></script>
<script> <script>
var userFields = new FormFields("#user-form"); var userFields = new FimsFormFields("#user-form");
var userControl = new UserControl(); var userControl = new UserControl();
userControl.setInfo = obj => { userControl.setInfo = obj => {
@ -240,9 +240,9 @@ userControl.setInfo = obj => {
let password = $(this).prop("required", create); let password = $(this).prop("required", create);
let div = password.parent().parent().parent(); let div = password.parent().parent().parent();
if (create) { if (create) {
div.show(); div.removeAttr("hidden");
} else } else
div.hide(); div.attr("hidden","hidden");
}); });
$("#user-form").find("input,select") $("#user-form").find("input,select")
.change(function() { .change(function() {

@ -685,26 +685,40 @@ class FormFields {
this.children = ["input", "select", "textarea"].map(tag => this.selector + " " + tag).join(","); this.children = ["input", "select", "textarea"].map(tag => this.selector + " " + tag).join(",");
this.datamap = []; this.datamap = [];
} }
set(obj) { set(ctrl, obj) {
let setChanged = evt => {
let input = evt.target,
name = input.getAttribute("data-map"),
val = input.value;
ctrl.setValue(name, val);
};
document.querySelectorAll(this.children).forEach(input => { document.querySelectorAll(this.children).forEach(input => {
let prop = input.getAttribute("data-map") let prop = input.getAttribute("data-map")
|| input.name || input.name
|| input.id; || input.id;
if (!prop) return; if (!prop) return;
let dataItem = obj instanceof DataItem, input.removeEventListener("change", setChanged);
value = dataItem ? obj.getValue(prop) : obj[prop];
let dataItem = obj instanceof DataItem,
if ("radio" == input.type) { value = dataItem ? obj.getValue(prop) : obj[prop],
if (value && value == input.value) inputType = (input.type || input.tagName || "").toLowerCase();
input.checked = true;
} else { switch (inputType) {
input.value = ifEmpty(value, ""); case "radio": input.checked = value && value == input.value; break;
case "checkbox": input.checked = value && value == input.value; break;
case "select":
for(let option of input.options) {
option.selected = option.value == value;
}
break;
default: input.value = ifEmpty(value, ""); break;
} }
input.addEventListener("change", setChanged);
}); });
} }
get() { get() {
let obj = {}; let obj = {};
document.querySelectorAll(this.children).forEach(input => { document.querySelectorAll(this.children).forEach(input => {
@ -714,12 +728,7 @@ class FormFields {
if (input.checked) if (input.checked)
obj[property] = value; obj[property] = value;
} else { } else {
let dataFmtType = input.getAttribute("data-fmt-type"); obj[property] = value;
if (["day", "time"].includes(dataFmtType))
obj[property] = value.replace(/-|:/gi, "");
else
obj[property] = value;
} }
// log(property, value, "radio" == input.type ? "radio" : "", input.checked ? "checked" : ""); // log(property, value, "radio" == input.type ? "radio" : "", input.checked ? "checked" : "");
}); });

Loading…
Cancel
Save