Merge branch 'bo_fixes' into 'dev'

[BO] 관리자 에러 수정

See merge request korea-research/korea-research!109
This commit is contained in:
이강선 매니저/ST
2025-07-15 03:04:53 +00:00
19 changed files with 408 additions and 383 deletions

View File

@@ -15,9 +15,17 @@ import org.springframework.web.bind.annotation.RestController;
class AdminIdDuplicateCheckPostController {
private final CheckAdminIdPortIn checkAdminIdPortIn;
private final String ID_REGEX = "^[a-zA-Z0-9가-힣_-]{4,15}$";
private final String INVALID_ID_MSG = "아이디는 4~15자, 영문/숫자/한글/특수문자(_,-)만 가능합니다.";
@GetMapping("/api/settings/admin/idCheck")
ResponseEntity<?> selectIdCheck(@RequestParam String id ) {
if (!id.matches(ID_REGEX)) {
return ResponseEntity
.status(HttpStatus.UNPROCESSABLE_ENTITY)
.body(INVALID_ID_MSG);
}
return ResponseEntity.status(HttpStatus.OK).body(checkAdminIdPortIn.connect(id));
}
}

View File

@@ -28,4 +28,5 @@ public class AdminCreateBindingVO {
private Boolean accountDisabled;
/* private Boolean accountLocked;*/
private String roleId;
private Boolean checkDuplicate;
}

View File

@@ -24,51 +24,68 @@ public class AdminCreateValidator implements Validator {
public void validate(Object target, Errors errors) {
AdminCreateBindingVO vo = (AdminCreateBindingVO) target;
if (vo.getRoleId() == null || vo.getRoleId().isEmpty()) {
errors.rejectValue("roleId", "error.roleId", "권한을 선택해주세요.");
// [1] 필수값 누락 체크
if(vo.getRoleId() == null || vo.getRoleId().isEmpty()) {
errors.rejectValue("roleId", "error.roleId", "필수입력항목을 확인해주세요.");
return;
}
if(vo.getId() == null || vo.getId().isBlank()) {
errors.rejectValue("id", "error.id", "필수입력항목을 확인해주세요.");
return;
}
if(vo.getPassword() == null || vo.getPassword().isBlank()) {
errors.rejectValue("password", "error.password", "필수입력항목을 확인해주세요.");
return;
}
if (vo.getAccountDisabled() == null ) {
errors.rejectValue("accountDisabled", "error.accountDisabled", "사용여부를 선택해주세요.");
}
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "id", "valid.common.required","아이디는 필수입력값입니다.");
Optional.ofNullable(vo.getId())
.filter(id -> !id.matches(ID_REGEX))
.ifPresent(id -> errors.rejectValue("id", "valid.common.id.wrong","아이디를 4~15자, 영문/숫자/한글/특수문자(_,-) 입니다."));
// 비밀번호 유효성 검사
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", "valid.common.required","비밀번호는 필수입력값입니다.");
Optional.ofNullable(vo.getPassword())
.filter(password -> !password.matches(PASSWORD_REGEX))
.ifPresent(password -> errors.rejectValue("password", "valid.common.password.wrong","비밀번호는 5자, 숫자 + 특수문자(!@#$%_-) 1개 이상입니다."));
if (vo.getRoleId() != null && "ROLE_RESEARCHER".equals(vo.getRoleId())) {
if (vo.getName() == null || vo.getName().isBlank()) {
errors.rejectValue("name", "error.name", "이름을 입력해주세요.");
// 권한 조사원으로 선택했을 경우
if(vo.getRoleId() != null && "ROLE_RESEARCHER".equals(vo.getRoleId())) {
if(vo.getName() == null || vo.getName().isEmpty()) {
errors.rejectValue("name", "error.name", "필수입력항목을 확인해주세요.");
return;
}
if (vo.getName().length() > 10) {
errors.rejectValue("name", "error.name", "이름은 10자까지 입력가능합니다.");
if(vo.getPhone1() == null || vo.getPhone1().isBlank()) {
errors.rejectValue("phone1", "error.phone1", "필수입력항목을 확인해주세요.");
return;
}
if (vo.getPhone1() == null || vo.getPhone1().isBlank()) {
errors.rejectValue("phone1", "error.phone1", "전화번호 앞자리를 입력해주세요.");
} else if (!vo.getPhone1().matches("^\\d{4}$")) {
if(vo.getPhone2() == null || vo.getPhone2().isBlank()) {
errors.rejectValue("phone2", "error.phone2", "필수입력항목을 확인해주세요.");
return;
}
if (!vo.getPhone1().matches("^\\d{4}$")) {
errors.rejectValue("phone1", "error.phone1", "전화번호 앞자리는 4자리 숫자여야 합니다.");
return;
}
if (vo.getPhone2() == null || vo.getPhone2().isBlank()) {
errors.rejectValue("phone2", "error.phone2", "전화번호 뒷자리를 입력해주세요.");
} else if (!vo.getPhone2().matches("^\\d{4}$")) {
if (!vo.getPhone2().matches("^\\d{4}$")) {
errors.rejectValue("phone2", "error.phone2", "전화번호 뒷자리는 4자리 숫자여야 합니다.");
return;
}
}
// ROLE_ADMIN이 아닌 경우 regionMainCode null체크
if(vo.getAccountDisabled() == null) {
errors.rejectValue("accountDisabled", "error.accountDisabled", "필수입력항목을 확인해주세요.");
return;
}
// ROLE_ADMIN이 아닌 경우 실사지역 null체크
Optional.ofNullable(vo.getRoleId())
.filter(id -> !id.equals("ROLE_ADMIN"))
.ifPresent(nonAdmins -> {
if (vo.getRegionMainCode() == null || vo.getRegionMainCode().isBlank()) {
errors.rejectValue("regionMainCode", "valid.common.required","실사지역은 필수입력값입니다.");
errors.rejectValue("regionMainCode", "valid.common.required","필수입력항목을 확인해주세요.");
}
});
// [2] 아이디 중복 확인 여부
if (vo.getCheckDuplicate() == null || !vo.getCheckDuplicate()) {
errors.rejectValue("checkDuplicate", "error.checkDuplicate", "아이디 중복 확인을 먼저 진행해주세요.");
return;
}
// [3] 비밀번호 형식 검사
if (!vo.getPassword().matches(PASSWORD_REGEX)) {
errors.rejectValue("password", "valid.common.password.wrong",
"비밀번호는 5자, 숫자 + 특수문자(!@#$%_-) 1개 이상입니다.");
}
}
}

View File

@@ -22,39 +22,55 @@ public class AdminUpdateValidator implements Validator {
public void validate(Object target, Errors errors) {
AdminUpdateBindingVO vo = (AdminUpdateBindingVO) target;
if (vo.getRoleId() == null || vo.getRoleId().isEmpty()) {
errors.rejectValue("roleId", "error.roleId", "권한을 선택해주세요.");
// [1] 필수값 누락 체크
if(vo.getRoleId() == null || vo.getRoleId().isEmpty()) {
errors.rejectValue("roleId", "error.roleId", "필수입력항목을 확인해주세요.");
return;
}
Optional.ofNullable(vo.getUpdatePassword())
.filter(password -> !password.trim().isEmpty() && !password.matches(PASSWORD_REGEX))
.ifPresent(password -> errors.rejectValue("updatePassword", "valid.common.password.wrong","비밀번호는 5자, 숫자 + 특수문자(!@#$%_-) 1개 이상입니다."));
if (vo.getRoleId() != null && "ROLE_RESEARCHER".equals(vo.getRoleId())) {
if (vo.getName() == null || vo.getName().isBlank()) {
errors.rejectValue("name", "error.name", "이름을 입력해주세요.");
// 권한 조사원으로 선택했을 경우
if(vo.getRoleId() != null && "ROLE_RESEARCHER".equals(vo.getRoleId())) {
if(vo.getName() == null || vo.getName().isEmpty()) {
errors.rejectValue("name", "error.name", "필수입력항목을 확인해주세요.");
return;
}
if (vo.getName().length() > 10) {
errors.rejectValue("name", "error.name", "이름은 10자까지 입력가능합니다.");
if(vo.getPhone1() == null || vo.getPhone1().isBlank()) {
errors.rejectValue("phone1", "error.phone1", "필수입력항목을 확인해주세요.");
return;
}
if (vo.getPhone1() == null || vo.getPhone1().isBlank()) {
errors.rejectValue("phone1", "error.phone1", "전화번호 앞자리를 입력해주세요.");
} else if (!vo.getPhone1().matches("^\\d{4}$")) {
if(vo.getPhone2() == null || vo.getPhone2().isBlank()) {
errors.rejectValue("phone2", "error.phone2", "필수입력항목을 확인해주세요.");
return;
}
if (!vo.getPhone1().matches("^\\d{4}$")) {
errors.rejectValue("phone1", "error.phone1", "전화번호 앞자리는 4자리 숫자여야 합니다.");
return;
}
if (vo.getPhone2() == null || vo.getPhone2().isBlank()) {
errors.rejectValue("phone2", "error.phone2", "전화번호 뒷자리를 입력해주세요.");
} else if (!vo.getPhone2().matches("^\\d{4}$")) {
if (!vo.getPhone2().matches("^\\d{4}$")) {
errors.rejectValue("phone2", "error.phone2", "전화번호 뒷자리는 4자리 숫자여야 합니다.");
return;
}
}
// ROLE_ADMIN이 아닌 경우 regionMainCode null체크
// 사용여부
if(vo.getAccountDisabled() == null) {
errors.rejectValue("accountDisabled", "error.accountDisabled", "필수입력항목을 확인해주세요.");
return;
}
// ROLE_ADMIN이 아닌 경우 실사지역 null체크
Optional.ofNullable(vo.getRoleId())
.filter(id -> !id.equals("ROLE_ADMIN"))
.ifPresent(nonAdmins -> {
if (vo.getRegionMainCode() == null || vo.getRegionMainCode().isBlank()) {
errors.rejectValue("regionMainCode", "valid.common.required","실사지역을 선택해주세요.");
errors.rejectValue("regionMainCode", "valid.common.required","필수입력항목을 확인해주세요.");
}
});
// [2] 비밀번호 형식 검사
if (!vo.getUpdatePassword().matches(PASSWORD_REGEX)) {
errors.rejectValue("updatePassword", "valid.common.password.wrong",
"비밀번호는 5자, 숫자 + 특수문자(!@#$%_-) 1개 이상입니다.");
}
}
}

View File

@@ -15,11 +15,6 @@ class SaveHouseholdVisitInfoDao implements SaveHouseholdVisitInfoPortOut {
@Override
@Transactional
public void operate(SaveHouseholdVisitInfoCmd cmd) {
// 답례품 전달 완료일 경우 기존 방문들 중 true → false로 변경
if (Boolean.TRUE.equals(cmd.getIsGiftSent())) {
mapper.updateGiftSentToFalse(AuditUtil.update(cmd));
}
if (cmd.getVisitInfoId() != null) {
mapper.findById(cmd.getHouseholdSeq())
.ifPresentOrElse(v -> mapper.updateHouseholdVisitInfo(AuditUtil.update(cmd)),
@@ -29,5 +24,10 @@ class SaveHouseholdVisitInfoDao implements SaveHouseholdVisitInfoPortOut {
} else {
mapper.createHouseholdVisitInfo(AuditUtil.create(cmd));
}
// 답례품 전달 완료일 경우 기존 방문들 중 true → false로 변경
if (Boolean.TRUE.equals(cmd.getIsGiftSent())) {
mapper.updateGiftSentToFalse(AuditUtil.update(cmd));
}
}
}

View File

@@ -67,11 +67,13 @@ public class ResearcherDao implements ResearcherPortOut {
@Override
@UpdateCommand
public Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO) {
if(Boolean.TRUE.equals(reqVO.getIsGiftSent())) {
int updated = researcherMapper.updateVisitHousehold(reqVO);
if (Boolean.TRUE.equals(reqVO.getIsGiftSent())) {
researcherMapper.updateGiftSentToFalse(reqVO);
}
return researcherMapper.updateVisitHousehold(reqVO);
return updated;
}
@Override

View File

@@ -25,13 +25,18 @@
AND rhh.is_deleted = false
WHERE a.is_deleted = false AND a.account_disabled = false
<if test="cmd.searchField != null and cmd.searchField != '' and cmd.searchValue != ''">
<if test="cmd.searchValue != null and cmd.searchValue != ''">
/* 조사원 검색 */
<choose>
<when test="cmd.searchField == ''">
AND (
a.name ILIKE '%' || #{cmd.searchValue} || '%'
OR a.phone ILIKE '%' || #{cmd.searchValue} || '%'
)
</when>
<when test="cmd.searchField eq 'name'">
AND a.name ILIKE '%' || #{cmd.searchValue} || '%'
</when>
<when test="cmd.searchField eq 'phone'">
AND a.phone ILIKE '%' || #{cmd.searchValue} || '%'
</when>

View File

@@ -44,8 +44,10 @@
WHERE household_seq = #{householdSeq}
AND TO_CHAR(visit_date, 'YYYYMM') = TO_CHAR(TO_DATE(#{visitDate}, 'YYYY-MM-DD'), 'YYYYMM')
AND is_gift_sent = true
AND (#{visitInfoId} IS NULL OR id != #{visitInfoId})
AND is_deleted = false
<if test="visitInfoId != null">
AND id != #{visitInfoId}
</if>
</update>
<select id="findById" resultType="java.lang.Long">

View File

@@ -156,7 +156,7 @@
<if test="searchMonth != null and searchMonth != ''">
and TO_CHAR(rhv.visit_date ,'YYYYMM')= #{searchMonth}
</if>
order by rhv.visit_date
order by rhv.visit_date, h.household_num
</select>
<select id="selectVisitHouseholdPercentage">
@@ -253,8 +253,8 @@
WHERE household_seq = #{householdSeq}
AND TO_CHAR(visit_date, 'YYYYMM') = TO_CHAR(#{visitDate}, 'YYYYMM')
AND is_gift_sent = true
AND (#{id} IS NULL OR id != #{id})
AND is_deleted = false
AND id != #{id}
</update>
<update id="updateVisitHousehold">

View File

@@ -2,8 +2,8 @@ uri=Home
uri.admin.settings=Settings
uri.admin.settings.admins.group=\uAD00\uB9AC\uC790 & \uC5ED\uD560
uri.admin.settings.admins=\uAD00\uB9AC\uC790
uri.admin.settings.admins.create=\uB4F1\uB85D
uri.admin.settings.admins.update.{{pathVar}}=\uC218\uC815
uri.admin.settings.admins.create=\uAD00\uB9AC\uC790 \uB4F1\uB85D
uri.admin.settings.admins.update.{{pathVar}}=\uAD00\uB9AC\uC790 \uC218\uC815
uri.admin.settings.uri.admin=URI \uAD00\uB9AC (Admin)
uri.admin.settings.uri.front=URI \uAD00\uB9AC (Front)
uri.admin.settings.uicode=UI \uCF54\uB4DC \uAD00\uB9AC

View File

@@ -9,166 +9,155 @@
th:action="@{/settings/admins/create}"
th:object="${bindingVO}"
name="adminCreateForm">
<div class="content-inner">
<table class="type-form">
<colgroup>
<col width="8%" />
<col width="33.3%" />
<col width="8%" />
<col width="33.3%" />
</colgroup>
<table class="type-form">
<tbody>
<tr>
<th><label for="roleId">권한<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="d-flex">
<div class="component-input">
<tbody>
<tr>
<th><label for="roleId">권한<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="d-flex">
<div class="component-input">
<div class="component-select">
<select class="select-list" id="roleId"
th:classappend="${#fields.hasErrors('roleId')} ? 'is-invalid'"
th:field="*{roleId}"
onchange="onRoleChange(this);">
<option value="">선택</option>
<option th:each="role : ${roles}" th:text="${role.description}"
th:value="${role.id}"></option>
</select>
</div>
</div>
</div>
</td>
</tr>
<tr>
<th>ID<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
<td>
<div class="d-flex">
<div class="component-input">
<div class="d-flex">
<div class="input-field">
<input id="id"
name="id"
th:classappend="${#fields.hasErrors('id')} ? 'is-invalid'"
th:field="*{id}"
maxlength="15"
oninput="checkDuplicate = false;"/>
</div>
<button type="button" class="btn" onclick="adminIdCheckDuplicate();">
<span class="btn-txt">중복확인</span>
</button>
</div>
<span>4~15자 / 영문,숫자,한글 가능/ 특수문자 _,- 사용가능</span>
</div>
</div>
</td>
<th><label for="password">Password<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-input">
<div class="input-field">
<input id="password" type="password" maxlength="5"
th:classappend="${#fields.hasErrors('password')} ? 'is-invalid'"
th:field="*{password}"/>
</div>
<span>총 5자 / 숫자 + 특수문자 1개 이상 (!,@,#,$,%,_,-)</span>
</div>
</td>
</tr>
<tr class="researcherArea"
th:classappend="${bindingVO.roleId == '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}" maxlength="10"/>
</div>
</div>
</td>
<th><label for="name">전화번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="d-flex">
<div class="component-select">
<select class="select-list" required>
<option value="value1" selected>010</option>
</select>
</div>
<div class="component-input">
<div class="input-field">
<input type="number" id="phone1" name="phone1" placeholder="" th:field="*{phone1}"
maxlength="4" oninput="limitMaxLength(this);">
</div>
</div>
<div class="component-input">
<div class="input-field">
<input type="number" id="phone2" name="phone2" placeholder="" th:field="*{phone2}"
maxlength="4" oninput="limitMaxLength(this);">
</div>
</div>
</div>
</td>
</tr>
<tr class="regionMainCodeArea"
th:classappend="${bindingVO.roleId != 'ROLE_ADMIN'} ? 'd-none'">
<th><label for="regionMainCode">실사<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-select">
<select class="select-list" id="roleId"
th:classappend="${#fields.hasErrors('roleId')} ? 'is-invalid'"
th:field="*{roleId}"
onchange="onRoleChange(this);">
<select class="select-list" id="regionMainCode" name="regionMainCode"
th:classappend="${#fields.hasErrors('regionMainCode')} ? 'is-invalid'"
th:field="*{regionMainCode}">
<option value="">선택</option>
<option th:each="role : ${roles}" th:text="${role.description}"
th:value="${role.id}"></option>
<option th:each="code : ${regionMainCode}"
th:value="${code.id}"
th:text="${code.codeText}">
</option>
</select>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{roleId}"
th:if="${#fields.hasErrors('roleId')}">
에러 메세지
</td>
</tr>
<tr>
<th><label>사용 여부<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td class="radio-group">
<div class="component-input">
<label for="inlineRadio1" class="radio-inner">
<input id="inlineRadio1" name="accountDisabled" type="radio" value="true">
<span class="radio-item">
<span class="radio-txt">미사용</span>
</span>
</label>
</div>
</div>
</div>
</td>
</tr>
<tr>
<th><label for="id">ID<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-input">
<div class="input-field">
<input id="id"
name="id"
th:classappend="${#fields.hasErrors('id')} ? 'is-invalid'"
th:field="*{id}"/>
<button type="button" class="btn btn-primary" onclick="adminIdCheckDuplicate();">
<span class="btn-txt">중복확인</span>
</button>
<div class="invalid-feedback fw-bold" th:errors="*{id}"
th:if="${#fields.hasErrors('id')}">
에러 메세지
<div class="component-input">
<label for="inlineRadio2" class="radio-inner">
<input id="inlineRadio2" name="accountDisabled" type="radio" value="false" checked>
<span class="radio-item">
<span class="radio-txt">사용</span>
</span>
</label>
</div>
</div>
<span>4~15자 / 영문,숫자,한글 가능/ 특수문자 _,- 사용가능</span>
</div>
</td>
<th><label for="password">Password<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-input">
<div class="input-field">
<input id="password" type="password"
th:classappend="${#fields.hasErrors('password')} ? 'is-invalid'"
th:field="*{password}"/>
<div class="invalid-feedback fw-bold" th:errors="*{password}"
th:if="${#fields.hasErrors('password')}">
에러 메세지
</div>
</div>
<span>총 5자 / 숫자 + 특수문자 1개 이상 (!,@,#,$,%,_,-)</span>
</div>
</td>
</tr>
<tr class="researcherArea"
th:classappend="${bindingVO.roleId == '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}" maxlength="10"/>
<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>
<div class="d-flex">
<div class="component-select">
<select class="select-list" required>
<option value="value1" selected>010</option>
</select>
</div>
<div class="component-input">
<div class="input-field">
<input type="number" id="phone1" name="phone1" placeholder="" th:field="*{phone1}" maxlength="4">
</div>
</div>
<div class="component-input">
<div class="input-field">
<input type="number" id="phone2" name="phone2" placeholder="" th:field="*{phone2}" maxlength="4">
</div>
</div>
</div>
<div class="invalid-feedback fw-bold"
th:if="${#fields.hasErrors('phone1')}">
에러 메세지
</div>
</td>
</tr>
<tr class="regionMainCodeArea"
th:classappend="${bindingVO.roleId != 'ROLE_ADMIN'} ? 'd-none'">
<th><label for="regionMainCode">실사<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-select">
<select class="select-list" id="regionMainCode" name="regionMainCode"
th:classappend="${#fields.hasErrors('regionMainCode')} ? 'is-invalid'"
th:field="*{regionMainCode}">
<option value="">선택</option>
<option th:each="code : ${regionMainCode}"
th:value="${code.id}"
th:text="${code.codeText}">
</option>
</select>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{regionMainCode}"
th:if="${#fields.hasErrors('regionMainCode')}">
에러 메세지
</div>
</td>
</tr>
<tr>
<th><label>사용 여부<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td class="radio-group">
<div class="component-input">
<label for="inlineRadio1" class="radio-inner">
<input id="inlineRadio1" th:field="*{accountDisabled}" type="radio" value="true">
<span class="radio-item">
<span class="radio-txt">미사용</span>
</span>
</label>
</div>
<div class="component-input">
<label for="inlineRadio2" class="radio-inner">
<input id="inlineRadio2" th:field="*{accountDisabled}" type="radio" value="false" checked>
<span class="radio-item">
<span class="radio-txt">사용</span>
</span>
</label>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{accountDisabled}"
th:if="${#fields.hasErrors('accountDisabled')}">
에러 메세지
</div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<div class="component-btns bottom-btn-group">
<div class="btns-row align-right">
<button type="button" class="btn btn-secondary" onclick="gotoList();return false;">
<span class="btn-txt">목록으로 이동</span>
</button>
<button type="button" class="btn btn-primary" onclick="createAdmin();">
<span class="btn-txt">저장</span>
</button>
<div class="component-btns bottom-btn-group">
<div class="btns-row align-right">
<button type="button" class="btn btn-secondary" onclick="gotoList();return false;">
<span class="btn-txt">취소</span>
</button>
<button type="button" class="btn btn-primary" onclick="createAdmin();">
<span class="btn-txt">등록</span>
</button>
</div>
</div>
</div>
</form>
@@ -187,8 +176,8 @@
$(document).ready(() => {
const roleSelect = document.getElementById('roleId');
onRoleChange(roleSelect);
});
const onRoleChange = (el) => {
const selectedValues = Array.from(el.selectedOptions).map(option => option.value);
const isAdmin = !selectedValues.length || selectedValues.includes('ROLE_ADMIN');
@@ -218,19 +207,19 @@
function (code, rstData) {
console.log("error : ", code);
if(code == 400) alert("아이디를 입력해주세요.");
if(code == 422) alert(rstData.responseText);
checkDuplicate = false;
},
'get',
'json'
'json',
{ handle422Type: 'alert' }
);
}
const createAdmin = () => {
if (!checkDuplicate) {
alert("아이디 중복 확인을 해주세요.");
return false;
}
const createAdmin = () => {
const f = document.adminCreateForm;
let dataOj = $(f).serializeObject();
dataOj.checkDuplicate = checkDuplicate;
ajaxUtil._ajaxMethod(
'/api/settings/admin/create',

View File

@@ -13,161 +13,150 @@
<input type="hidden" name="seq" th:field="*{seq}"/>
<table class="type-form">
<colgroup>
<col width="8%" />
<col width="33.3%" />
<col width="8%" />
<col width="33.3%" />
</colgroup>
<tbody>
<tr>
<th> <label for="roleId">권한<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="d-flex">
<tr>
<th> <label for="roleId">권한<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="d-flex">
<div class="component-input">
<div class="component-select">
<select class="select-list" id="roleId"
th:classappend="${#fields.hasErrors('roleId')} ? 'is-invalid'"
th:field="*{roleId}"
onchange="onRoleChange(this);">
<option value="">선택</option>
<option th:each="role : ${roles}" th:text="${role.description}"
th:value="${role.id}"></option>
</select>
</div>
</div>
</div>
</td>
</tr>
<tr>
<th><label for="id">ID<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-input">
<div class="input-field">
<input id="id" readonly="readonly" maxlength="15" th:field="*{id}"/>
</div>
</div>
</td>
<th><label for="updatePassword">비밀번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-input">
<div class="input-field">
<input id="updatePassword" placeholder="암호를 변경하고 싶다면 입력하세요"
th:classappend="${#fields.hasErrors('updatePassword')} ? 'is-invalid'"
th:field="*{updatePassword}"
type="password" maxlength="5"/>
</div>
<span>총 5자 / 숫자 + 특수문자 1개 이상 (!,@,#,$,%,_,-)</span>
</div>
</td>
</tr>
<tr class="researcherArea"
th:classappend="${#lists.isEmpty(bindingVO.roleId) or #lists.contains(bindingVO.roleId, '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}" maxlength="10" />
</div>
</div>
</td>
<th><label for="name">전화번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="d-flex">
<div class="component-select">
<select class="select-list" id="roleId"
th:classappend="${#fields.hasErrors('roleId')} ? 'is-invalid'"
th:field="*{roleId}"
onchange="onRoleChange(this);">
<option value="">선택</option>
<option th:each="role : ${roles}" th:text="${role.description}"
th:value="${role.id}"></option>
<select class="select-list" required>
<option value="value1" selected>010</option>
</select>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{roleId}"
th:if="${#fields.hasErrors('roleId')}">
에러 메세지
<div class="component-input">
<div class="input-field">
<input type="number" id="phone1" name="phone1" placeholder=""
maxlength="4" oninput="limitMaxLength(this);"
th:value="${bindingVO.phone1 != null ? bindingVO.phone1 : ''}">
</div>
</div>
<div class="component-input">
<div class="input-field">
<input type="number" id="phone2" name="phone2" placeholder=""
maxlength="4" oninput="limitMaxLength(this);"
th:value="${bindingVO.phone2 != null ? bindingVO.phone2 : ''}">
</div>
</div>
</div>
</div>
</td>
</tr>
<tr>
<th><label for="id">ID<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-input">
<div class="input-field">
<input id="id" readonly="readonly" th:field="*{id}"/>
</div>
</div>
</td>
<th><label for="updatePassword">비밀번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-input">
<div class="input-field">
<input id="updatePassword" placeholder="암호를 변경하고 싶다면 입력하세요"
th:classappend="${#fields.hasErrors('updatePassword')} ? 'is-invalid'"
th:field="*{updatePassword}"
type="password"/>
<div class="invalid-feedback fw-bold" th:errors="*{updatePassword}"
th:if="${#fields.hasErrors('updatePassword')}">
에러 메세지
</div>
</div>
<span>총 5자 / 숫자 + 특수문자 1개 이상 (!,@,#,$,%,_,-)</span>
</div>
</td>
</tr>
<tr class="researcherArea"
th:classappend="${#lists.isEmpty(bindingVO.roleId) or #lists.contains(bindingVO.roleId, '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}" maxlength="10" />
<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>
<div class="d-flex">
</td>
</tr>
<tr class="regionMainCodeArea"
th:classappend="${#lists.isEmpty(bindingVO.roleId) or #lists.contains(bindingVO.roleId, 'ROLE_ADMIN')} ? 'd-none'">
<th><label for="regionMainCode">실사<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-select">
<select class="select-list" required>
<option value="value1" selected>010</option>
<select class="select-list" id="regionMainCode" name="regionMainCode"
th:classappend="${#fields.hasErrors('regionMainCode')} ? 'is-invalid'"
th:field="*{regionMainCode}">
<option value="">선택</option>
<option th:each="code : ${regionMainCode}"
th:value="${code.id}"
th:text="${code.codeText}">
</option>
</select>
</div>
<div class="component-input">
<div class="input-field">
<input type="number" id="phone1" name="phone1" placeholder="" maxlength="4"
th:value="${bindingVO.phone1 != null ? bindingVO.phone1 : ''}">
</div>
</div>
<div class="invalid-feedback fw-bold"
th:if="${#fields.hasErrors('phone1')}">
<div class="invalid-feedback fw-bold" th:errors="*{regionMainCode}"
th:if="${#fields.hasErrors('regionMainCode')}">
에러 메세지
</div>
</td>
</tr>
<tr>
<th> <label>사용 여부<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td class="radio-group">
<div class="component-input">
<div class="input-field">
<input type="number" id="phone2" name="phone2" placeholder="" maxlength="4"
th:value="${bindingVO.phone2 != null ? bindingVO.phone2 : ''}">
</div>
<label for="inlineRadio1" class="radio-inner">
<input id="inlineRadio1" th:field="*{accountDisabled}" type="radio" value="true">
<span class="radio-item">
<span class="radio-txt">미사용</span>
</span>
</label>
</div>
<div class="invalid-feedback fw-bold"
th:if="${#fields.hasErrors('phone2')}">
<div class="component-input">
<label for="inlineRadio2" class="radio-inner">
<input id="inlineRadio2" th:field="*{accountDisabled}" type="radio" value="false">
<span class="radio-item">
<span class="radio-txt">사용</span>
</span>
</label>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{accountDisabled}"
th:if="${#fields.hasErrors('accountDisabled')}">
에러 메세지
</div>
</div>
</td>
</tr>
<tr class="regionMainCodeArea"
th:classappend="${#lists.isEmpty(bindingVO.roleId) or #lists.contains(bindingVO.roleId, 'ROLE_ADMIN')} ? 'd-none'">
<th><label for="regionMainCode">실사<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-select">
<select class="select-list" id="regionMainCode" name="regionMainCode"
th:classappend="${#fields.hasErrors('regionMainCode')} ? 'is-invalid'"
th:field="*{regionMainCode}">
<option value="">선택</option>
<option th:each="code : ${regionMainCode}"
th:value="${code.id}"
th:text="${code.codeText}">
</option>
</select>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{regionMainCode}"
th:if="${#fields.hasErrors('regionMainCode')}">
에러 메세지
</div>
</td>
</tr>
<tr>
<th> <label>사용 여부<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td class="radio-group">
<div class="component-input">
<label for="inlineRadio1" class="radio-inner">
<input id="inlineRadio1" th:field="*{accountDisabled}" type="radio" value="true">
<span class="radio-item">
<span class="radio-txt">미사용</span>
</span>
</label>
</div>
<div class="component-input">
<label for="inlineRadio2" class="radio-inner">
<input id="inlineRadio2" th:field="*{accountDisabled}" type="radio" value="false">
<span class="radio-item">
<span class="radio-txt">사용</span>
</span>
</label>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{accountDisabled}"
th:if="${#fields.hasErrors('accountDisabled')}">
에러 메세지
</div>
</td>
</tr>
</td>
</tr>
</tbody>
</table>
<!-- <div th:replace="common/components :: auditArea"></div>-->
<div class="component-btns bottom-btn-group">
<div class="btns-row">
<div class="btns-row align-right">
<button type="button" class="btn btn-secondary" onclick="gotoList();return false;">
<span class="btn-txt">목록</span>
<span class="btn-txt">취소</span>
</button>
<button type="button" class="btn btn-primary" onclick="updateAdmin();">
<span class="btn-txt">저장</span>
<span class="btn-txt">등록</span>
</button>
</div>
</div>

View File

@@ -3,7 +3,7 @@
layout:decorate="~{layout/layout}">
<div class="layer-wrap" th:fragment="modalFragment">
<form autocomplete="off" method="get" name="reqResearcherForm">
<form autocomplete="off" method="get" name="reqResearcherForm" onsubmit="return false;">
<input name="page" value="0" type="hidden"/>
<input name="size" value="10" type="hidden">
@@ -38,7 +38,9 @@
</div>
<div class="component-input">
<div class="input-field">
<input type="text" id="searchField" name="searchValue" placeholder="">
<input type="text" id="searchField"
name="searchValue" placeholder=""
onkeydown="if(event.key === 'Enter'){ event.preventDefault(); getResearchers(0); }">
</div>
</div>
</div>

View File

@@ -197,7 +197,9 @@
<div class="d-flex">
<div class="component-input">
<div class="input-field">
<input type="text" name="researcherName" id="researcherName" placeholder="">
<input type="text" name="researcherName" id="researcherName"
placeholder="" readonly
style="background-color: #fff; color: #000; cursor: default;">
</div>
</div>
<button type="button" class="btn" onclick="showResearcherModal();">

View File

@@ -213,8 +213,9 @@
<div class="component-input">
<div class="input-field">
<input type="text" name="researcherName" id="researcherName"
placeholder=""
th:value="${householdInfo.researcherName}">
placeholder="" readonly
th:value="${householdInfo.researcherName}"
style="background-color: #fff; color: #000; cursor: default;">
<input type="hidden" name="researcherSeq" id="researcherSeq"
th:value="${householdInfo.researcherSeq}">
</div>

View File

@@ -3,7 +3,7 @@
layout:decorate="~{layout/layout}">
<section layout:fragment="content">
<form autocomplete="off" method="get" name="reqForm">
<form autocomplete="off" method="get" name="reqForm" onsubmit="return false;">
<input type="hidden" name="householdSeq" th:value="${seq}">
<div class="content-inner">

View File

@@ -60,8 +60,10 @@
<button type="button" class="tab-label" data-tab-value="tab1">담당 임가 목록</button>
<button type="button" class="tab-label" data-tab-value="tab2">임가방문정보</button>
<div class="component-select select-date" id="monthTab2" style="display: none;">
<select name="searchMonth" class="select-list search-month-container" onchange="getHouseholdVisitList();">
<option th:each="month : ${monthList}"
<select name="searchMonth" class="select-list search-month-container"
onchange="getVisitHouseholdPercentage();
getHouseholdVisitList();">
<option th:each="month : ${monthList}"
th:value="${month.value}"
th:text="${month.label}"
th:selected="${month.value == currentMonth}">
@@ -150,7 +152,7 @@
<th>방문일</th>
<th>관리분야</th>
<th>내용</th>
<th>작성일</th>
<th>최종 수정자</th>
<th>답례품 전달</th>
</tr>
</thead>
@@ -272,7 +274,7 @@
}
// 임가 방문 퍼센트
const getVisitHouseholdPercentage=()=>{
const getVisitHouseholdPercentage = () => {
const f = document.householdReqForm;
let dataObj = {

View File

@@ -19,7 +19,7 @@
</div>
<div class="component-input">
<div class="input-field">
<input type="text" id="floatingInput" name="username" placeholder="아이디 입력">
<input type="text" id="floatingInput" name="username" placeholder="아이디 입력" maxlength="15">
</div>
</div>
</div>