관리자 수정
This commit is contained in:
@@ -48,6 +48,9 @@ public class AdminCreateValidator implements Validator {
|
||||
if (vo.getName() == null || vo.getName().isBlank()) {
|
||||
errors.rejectValue("name", "error.name", "이름을 입력해주세요.");
|
||||
}
|
||||
if (vo.getName().length() > 4) {
|
||||
errors.rejectValue("name", "error.name", "이름은 4자리까지 입력가능합니다.");
|
||||
}
|
||||
if (vo.getPhone1() == null || vo.getPhone1().isBlank()) {
|
||||
errors.rejectValue("phone1", "error.phone1", "전화번호 앞자리를 입력해주세요.");
|
||||
} else if (!vo.getPhone1().matches("^\\d{4}$")) {
|
||||
|
||||
@@ -57,6 +57,47 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="researcherArea"
|
||||
th:classappend="${#lists.isEmpty(bindingVO.roleIds) or #lists.contains(bindingVO.roleIds, 'ROLE_LOCAL_INSPECTOR')} ? 'd-none'">
|
||||
<th><label for="name">이름<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input id="name" type="text" name="name"
|
||||
th:classappend="${#fields.hasErrors('name')} ? 'is-invalid'"
|
||||
th:field="*{name}"/>
|
||||
<div class="invalid-feedback fw-bold"
|
||||
th:if="${#fields.hasErrors('name')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<th><label for="name">전화번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
<td>
|
||||
010-
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input id="phone1" name="phone1" type="number" maxlength="4"
|
||||
th:value="${bindingVO.phone != null ? bindingVO.phone.substring(3, 7) : ''}"
|
||||
th:classappend="${#fields.hasErrors('phone')} ? 'is-invalid'"/>
|
||||
</div>
|
||||
</div>
|
||||
-
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input id="phone2" name="phone2" type="number" maxlength="4"
|
||||
th:value="${bindingVO.phone != null ? bindingVO.phone.substring(7, 11) : ''}"
|
||||
th:classappend="${#fields.hasErrors('phone')} ? 'is-invalid'"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="invalid-feedback fw-bold"
|
||||
th:if="${#fields.hasErrors('phone')}">
|
||||
에러 메세지
|
||||
</div>
|
||||
<input type="hidden" name="phone" id="phone" th:field="*{phone}"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="regionMainCodeArea"
|
||||
th:classappend="${#lists.isEmpty(bindingVO.roleIds) or #lists.contains(bindingVO.roleIds, 'ROLE_ADMIN')} ? 'd-none'">
|
||||
<th><label for="regionMainCode">실사<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
|
||||
@@ -137,12 +178,7 @@
|
||||
<th:block layout:fragment="script">
|
||||
<script th:inline="javascript">
|
||||
function gotoList() {
|
||||
if (document.prevAdminParamForm) {
|
||||
const f = document.prevAdminParamForm;
|
||||
f.submit();
|
||||
} else {
|
||||
location.href = '/settings/admins';
|
||||
}
|
||||
location.href = '/settings/admins';
|
||||
}
|
||||
|
||||
$(document).ready(() => {
|
||||
@@ -156,12 +192,26 @@
|
||||
if (roleSelect) {
|
||||
onRoleChange(roleSelect);
|
||||
}
|
||||
|
||||
$('form').on('submit', function() {
|
||||
const phone1 = $('#phone1').val();
|
||||
const phone2 = $('#phone2').val();
|
||||
if (phone1 && phone2) {
|
||||
$('#phone').val('010' + phone1 + phone2);
|
||||
} else {
|
||||
$('#phone').val('');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
const onRoleChange = (el) => {
|
||||
const isAdmin = el.value === 'ROLE_ADMIN' || !el.value;
|
||||
const idResearcher = el.value === 'ROLE_RESEARCHER' || !el.value;
|
||||
$('.regionMainCodeArea').toggle(!isAdmin);
|
||||
$('.researcherArea').toggle(idResearcher);
|
||||
};
|
||||
|
||||
</script>
|
||||
</th:block>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user