이용자 관리 - 목록 스타일 적용

This commit is contained in:
현성필
2025-12-04 14:34:57 +09:00
parent 4f7aa0327e
commit 2a6c40b3f6
7 changed files with 564 additions and 586 deletions
@@ -11,9 +11,9 @@
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
background: rgba(0, 0, 0, 0.6); background: #385670;
z-index: $z-index-modal-backdrop; z-index: $z-index-modal-backdrop;
opacity: 0; opacity: 0.9;
visibility: hidden; visibility: hidden;
transition: $transition-base; transition: $transition-base;
@@ -30,7 +30,7 @@
left: 0; left: 0;
width: 100%; width: 100%;
height: 100vh; height: 100vh;
z-index: 1000; z-index: $z-index-modal;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
@@ -128,9 +128,9 @@
// Modal dialog // Modal dialog
.modal-dialog { .modal-dialog {
margin-top: 150px;
position: relative; position: relative;
background: $white; background: $white;
padding: 0 $spacing-lg;
border-radius: $border-radius-lg; border-radius: $border-radius-lg;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
max-width: 700px; max-width: 700px;
@@ -156,11 +156,10 @@
// Modal header with gradient background // Modal header with gradient background
.modal-header { .modal-header {
padding: 30px 50px 20px; padding: 30px 50px 20px;
background: #C7EAFF;
border-bottom: none;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
border-bottom: 1px solid black;
border-top-left-radius: $border-radius-lg; border-top-left-radius: $border-radius-lg;
border-top-right-radius: $border-radius-lg; border-top-right-radius: $border-radius-lg;
@@ -224,52 +223,6 @@
justify-content: space-between; justify-content: space-between;
} }
// Cancel button (Figma node 985:1990)
.btn-modal-cancel {
min-width: 150px;
height: 50px;
padding: 10px 40px;
background: $white;
border: 1px solid #dadada;
border-radius: 50px;
font-size: 16px;
font-weight: $font-weight-bold;
color: #5f666c;
cursor: pointer;
transition: $transition-base;
&:hover {
background: #f5f5f5;
border-color: #c0c0c0;
}
&:active {
transform: scale(0.98);
}
}
// Confirm button (Figma node 985:1989)
.btn-modal-confirm {
min-width: 150px;
height: 50px;
padding: 10px 40px;
background: #0049b4;
border: none;
border-radius: 50px;
font-size: 16px;
font-weight: $font-weight-bold;
color: $white;
cursor: pointer;
transition: $transition-base;
&:hover {
background: #003a91;
}
&:active {
transform: scale(0.98);
}
}
@media (max-width: $breakpoint-sm) { @media (max-width: $breakpoint-sm) {
padding: 16px 24px 24px; padding: 16px 24px 24px;
@@ -284,6 +237,37 @@
} }
} }
.pop_input_field {
width: 100%;
padding: 12px $spacing-md;
border: 1px solid $border-gray;
border-radius: $border-radius-md;
font-size: $font-size-sm;
font-family: $font-family-primary;
transition: all 0.3s ease;
box-sizing: border-box;
&:focus {
outline: none;
border-color: $primary-blue;
box-shadow: 0 0 0 3px rgba($primary-blue, 0.1);
}
&::placeholder {
color: $text-light;
}
// Error state
&.error {
border-color: $accent-orange;
&:focus {
border-color: $accent-orange;
box-shadow: 0 0 0 3px rgba($accent-orange, 0.1);
}
}
}
// Alert modal // Alert modal
.modal-alert { .modal-alert {
.modal-container { .modal-container {
@@ -6,9 +6,9 @@
// Password popup specific styles (using modal structure) // Password popup specific styles (using modal structure)
#passwordInputPopup { #passwordInputPopup {
// Modal dialog size override // Modal dialog size override
.modal-dialog { //.modal-dialog {
max-width: 450px; // max-width: 450px;
} //}
// Password input group // Password input group
.pop_input_group { .pop_input_group {
@@ -16,37 +16,6 @@
margin: 0; margin: 0;
} }
.pop_input_field {
width: 100%;
padding: 12px $spacing-md;
border: 1px solid $border-gray;
border-radius: $border-radius-md;
font-size: $font-size-sm;
font-family: $font-family-primary;
transition: all 0.3s ease;
box-sizing: border-box;
&:focus {
outline: none;
border-color: $primary-blue;
box-shadow: 0 0 0 3px rgba($primary-blue, 0.1);
}
&::placeholder {
color: $text-light;
}
// Error state
&.error {
border-color: $accent-orange;
&:focus {
border-color: $accent-orange;
box-shadow: 0 0 0 3px rgba($accent-orange, 0.1);
}
}
}
.error-message { .error-message {
color: $accent-orange; color: $accent-orange;
font-size: $font-size-xs; font-size: $font-size-xs;
@@ -271,12 +271,244 @@
} }
} }
// -----------------------------------------------------------------------------
// List Table - Modern design with colored header (Figma: 984-2173)
// Used in: User management, API key list, etc.
// -----------------------------------------------------------------------------
.list-table {
width: 100%;
background: $white;
border-radius: $border-radius-lg;
overflow: hidden;
&-wrapper {
overflow-x: auto;
margin-bottom: $spacing-xl;
}
// Table Header - Blue background with white text
.list-table-header {
display: flex;
align-items: center;
background: #3BA4ED;
height: 72px;
padding: 0 $spacing-lg;
@media (max-width: $breakpoint-md) {
display: none;
}
.header-cell {
display: flex;
align-items: center;
justify-content: center;
padding: $spacing-sm $spacing-md;
font-size: 20px;
font-weight: $font-weight-bold;
color: $white;
text-align: center;
}
}
// Table Body
.list-table-body {
display: flex;
flex-direction: column;
}
// Table Row
.list-table-row {
display: flex;
align-items: center;
height: 54px;
padding: $spacing-sm $spacing-lg;
transition: $transition-base;
// Alternating row colors
&:nth-child(even) {
background-color: #EDF5FD;
}
&:nth-child(odd) {
background-color: $white;
}
&:hover {
background-color: rgba($primary-blue, 0.08);
}
@media (max-width: $breakpoint-md) {
flex-direction: column;
align-items: flex-start;
gap: $spacing-sm;
padding: $spacing-md;
}
.row-cell {
display: flex;
align-items: center;
justify-content: center;
padding: $spacing-sm $spacing-md;
font-size: 18px;
color: #515151;
text-align: center;
@media (max-width: $breakpoint-md) {
font-size: $font-size-sm;
padding: $spacing-xs 0;
&::before {
content: attr(data-label);
font-weight: $font-weight-semibold;
color: $text-gray;
margin-right: $spacing-sm;
min-width: 80px;
text-align: left;
}
}
}
// Action buttons container
.row-actions {
display: flex;
align-items: center;
justify-content: center;
gap: 14px;
flex-wrap: wrap;
@media (max-width: $breakpoint-md) {
width: 100%;
justify-content: flex-start;
padding-top: $spacing-sm;
}
}
}
}
// List table action buttons
.list-table-btn {
display: inline-flex;
align-items: center;
justify-content: center;
padding: $spacing-sm $spacing-md;
height: 40px;
border-radius: $border-radius-md;
font-size: $font-size-base;
font-weight: $font-weight-regular;
color: #000000;
border: none;
cursor: pointer;
transition: $transition-base;
white-space: nowrap;
&:hover {
transform: translateY(-1px);
box-shadow: $shadow-sm;
}
&:active {
transform: translateY(0);
}
// Button variants
&--default {
background-color: #DADADA;
&:hover {
background-color: darken(#DADADA, 5%);
}
}
&--primary {
background-color: #A4D6EA;
&:hover {
background-color: darken(#A4D6EA, 5%);
}
}
&--secondary {
background-color: #CDD4F0;
&:hover {
background-color: darken(#CDD4F0, 5%);
}
}
}
// -----------------------------------------------------------------------------
// Pagination - Table pagination controls
// -----------------------------------------------------------------------------
.table-pagination {
display: flex;
align-items: center;
justify-content: center;
gap: 13px;
padding: $spacing-xl 0;
.pagination-btn {
display: flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
background: none;
border: none;
cursor: pointer;
color: #212529;
transition: $transition-base;
&:hover {
color: $primary-blue;
}
&:disabled {
opacity: 0.4;
cursor: not-allowed;
}
i {
font-size: $font-size-base;
}
}
.pagination-numbers {
display: flex;
align-items: center;
gap: 13px;
}
.pagination-number {
display: flex;
align-items: center;
justify-content: center;
min-width: 10px;
height: 21px;
font-size: 18px;
color: #5F666C;
background: none;
border: none;
cursor: pointer;
transition: $transition-base;
&:hover {
color: $primary-blue;
}
&.active {
font-weight: $font-weight-bold;
color: #212529;
}
}
}
// Search and filter section for tables // Search and filter section for tables
.table-controls { .table-controls {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-bottom: $spacing-xl; margin-bottom: $spacing-lg;
padding: 0 $spacing-sm;
gap: $spacing-lg; gap: $spacing-lg;
@media (max-width: $breakpoint-sm) { @media (max-width: $breakpoint-sm) {
@@ -286,12 +518,14 @@
} }
.total-count { .total-count {
font-size: $font-size-sm; font-size: $font-size-base;
color: $text-gray; color: $text-gray;
margin-bottom: 0;
strong { strong {
color: $primary-blue; color: $primary-blue;
font-weight: $font-weight-semibold; font-weight: $font-weight-semibold;
font-size: $font-size-lg;
} }
@media (max-width: $breakpoint-sm) { @media (max-width: $breakpoint-sm) {
@@ -54,7 +54,7 @@
background-color: #ffffff; background-color: #ffffff;
backdrop-filter: blur(10px); backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
z-index: 1000; z-index: $z-index-header;
height: 112px; height: 112px;
transition: all 0.3s ease; transition: all 0.3s ease;
border-bottom: 1px solid #dddddd; border-bottom: 1px solid #dddddd;
+1
View File
@@ -36,6 +36,7 @@
@import 'components/accordion'; @import 'components/accordion';
@import 'components/page-title-banner'; @import 'components/page-title-banner';
@import 'components/alerts'; @import 'components/alerts';
@import 'components/pagination';
// 5. Page-specific styles // 5. Page-specific styles
@import 'pages/index'; @import 'pages/index';
@@ -8,8 +8,7 @@
max-width: 1400px; max-width: 1400px;
margin: 0 auto; margin: 0 auto;
padding: $spacing-3xl $spacing-2xl; padding: $spacing-3xl $spacing-2xl;
background-color: $gray-bg; margin-bottom: $spacing-2xl;
min-height: 100vh;
@media (max-width: $breakpoint-sm) { @media (max-width: $breakpoint-sm) {
padding: $spacing-lg $spacing-md; padding: $spacing-lg $spacing-md;
@@ -56,237 +55,54 @@
margin-top: $spacing-lg; margin-top: $spacing-lg;
} }
// Table Controls // Table Controls - Uses common styles from components/_tables.scss
.table-controls { // Page-specific overrides only
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: $spacing-lg;
padding: 0 $spacing-sm;
@media (max-width: $breakpoint-sm) { // -----------------------------------------------------------------------------
flex-direction: column; // User List Table Customizations
align-items: flex-start; // Extends .list-table from components/_tables.scss
gap: $spacing-md; // -----------------------------------------------------------------------------
} .user-management-container {
} .list-table {
margin-bottom: $spacing-2xl;
.total-count { // Link styles in table cells
font-size: $font-size-base; .row-cell a {
color: $text-gray; color: $text-dark;
text-decoration: none;
transition: $transition-base;
strong { &:hover {
color: $primary-blue; color: $primary-blue;
font-weight: $font-weight-semibold; }
font-size: $font-size-lg; }
}
}
// User Table
.user-list-wrapper {
background: $white;
border-radius: $border-radius-lg;
box-shadow: $shadow-sm;
overflow: hidden;
margin-bottom: $spacing-2xl;
}
.user-table {
display: flex;
flex-direction: column;
width: 100%;
}
// Table Header
.table-header {
display: grid;
grid-template-columns: 60px 120px 1fr 150px 120px 200px;
gap: $spacing-md;
padding: $spacing-md $spacing-lg;
background: $light-bg;
border-bottom: 2px solid $border-gray;
font-size: $font-size-sm;
font-weight: $font-weight-semibold;
color: $text-dark;
@media (max-width: $breakpoint-lg) {
grid-template-columns: 50px 100px 1fr 120px 100px 180px;
font-size: $font-size-xs;
padding: $spacing-sm $spacing-md;
} }
@media (max-width: $breakpoint-md) { .table-controls {
display: none; // Hide on mobile, use stacked layout @extend .common-title-bar;
}
}
// Table Row .search-box {
.table-row { .btn {
display: grid; height: 44px;
grid-template-columns: 60px 120px 1fr 150px 120px 200px; }
gap: $spacing-md;
padding: $spacing-lg;
border-bottom: 1px solid $border-gray;
align-items: center;
transition: $transition-base;
cursor: pointer;
&:hover {
background-color: rgba($primary-blue, 0.02);
}
&:last-child {
border-bottom: none;
}
&.row-pending {
background-color: rgba($accent-yellow, 0.03);
border-left: 3px solid $accent-yellow;
}
@media (max-width: $breakpoint-lg) {
grid-template-columns: 50px 100px 1fr 120px 100px 180px;
padding: $spacing-md;
font-size: $font-size-sm;
}
@media (max-width: $breakpoint-md) {
grid-template-columns: 1fr;
gap: $spacing-sm;
padding: $spacing-md;
&::before {
content: attr(data-label);
font-weight: $font-weight-semibold;
color: $text-gray;
} }
} }
} }
// Table Columns // Current user badge (used in actions column)
.col-num {
font-size: $font-size-sm;
color: $text-gray;
text-align: center;
@media (max-width: $breakpoint-md) {
display: none;
}
}
.col-name {
font-weight: $font-weight-medium;
a {
color: $text-dark;
text-decoration: none;
transition: $transition-base;
&:hover {
color: $primary-blue;
}
}
.pending-label {
display: inline-flex;
align-items: center;
gap: $spacing-xs;
color: $text-gray;
font-style: italic;
i {
color: $accent-yellow;
}
}
}
.col-email {
color: $text-gray;
font-size: $font-size-sm;
word-break: break-all;
}
.col-role {
display: flex;
align-items: center;
}
.user-role-badge {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 6px 12px;
background-color: rgba($primary-blue, 0.1);
color: $primary-blue;
border-radius: $border-radius-sm;
font-size: $font-size-xs;
font-weight: $font-weight-medium;
i {
font-size: $font-size-xs;
}
}
// Status and Actions Columns
.col-status {
display: flex;
align-items: center;
justify-content: center;
}
.col-actions {
display: flex;
align-items: center;
justify-content: flex-start;
}
.user-status-badge {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 6px 12px;
border-radius: $border-radius-full;
font-size: $font-size-xs;
font-weight: $font-weight-semibold;
text-transform: uppercase;
letter-spacing: 0.5px;
white-space: nowrap;
&.status-active {
background-color: rgba($accent-green, 0.1);
color: darken($accent-green, 10%);
}
&.status-inactive {
background-color: rgba($text-gray, 0.1);
color: $text-gray;
}
&.status-pending {
background-color: rgba($accent-yellow, 0.15);
color: darken($accent-yellow, 30%);
}
}
.user-current-badge { .user-current-badge {
display: inline-flex; display: inline-flex;
height: 40px;
align-items: center; align-items: center;
gap: 6px; gap: 6px;
padding: 6px 12px; padding: 6px 12px;
background-color: rgba($accent-purple, 0.1); background-color: rgba($accent-purple, 0.1);
color: $accent-purple; color: $accent-purple;
border-radius: $border-radius-sm; border-radius: $border-radius-sm;
font-size: $font-size-xs; font-size: $font-size-sm;
font-weight: $font-weight-medium; font-weight: $font-weight-medium;
} }
.user-action-buttons {
display: flex;
flex-wrap: wrap;
gap: $spacing-xs;
align-items: center;
}
// Empty State // Empty State
.user-empty-state { .user-empty-state {
text-align: center; text-align: center;
@@ -1,314 +1,288 @@
<!doctype html> <!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" <html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{layout/kjbank_base_layout}"> xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{layout/kjbank_title_layout}">
<body> <body>
<section layout:fragment="title">
<div class="page-title-banner">
<img th:src="@{/img/img_title_bg.png}" class="title-image">
<h1>이용자 관리</h1>
</div>
</section>
<th:block layout:fragment="contentFragment"> <th:block layout:fragment="contentFragment">
<section class="user-management-container"> <section class="user-management-container">
<!-- Header Section --> <!-- App List Title Section -->
<div class="user-management-header"> <div class="table-controls">
<div class="user-management-title"> <h2 class="total-count">
<h1>사용자 관리</h1> <strong th:text="${(users != null ? users.size() : 0) + (pendingUsers != null ? pendingUsers.size() : 0)}">0</strong>
<h2>이용자 목록</h2> </h2>
</div> <div class="search-box">
<div class="user-management-actions"> <button type="button" class="btn btn-primary" id="addUserBtn">
<button type="button" class="btn btn-primary" id="addUserBtn"> <i class="fas fa-plus"></i>
<i class="fas fa-plus"></i> <span>이용자 추가</span>
<span>이용자 추가</span> </button>
</button> </div>
</div> </div>
</div>
<!-- Table Controls --> <!-- User Table -->
<div class="table-controls"> <div class="list-table" th:if="${(users != null and !users.isEmpty()) or (pendingUsers != null and !pendingUsers.isEmpty())}">
<div class="total-count"> <!-- Table Header -->
<strong th:text="${(users != null ? users.size() : 0) + (pendingUsers != null ? pendingUsers.size() : 0)}">0</strong> <div class="list-table-header">
</div> <div class="header-cell" style="width: 90px;">NO.</div>
</div> <div class="header-cell" style="width: 90px;">성명</div>
<div class="header-cell" style="flex: 1; min-width: 200px;">이메일 아이디</div>
<div class="header-cell" style="width: 120px;">권한</div>
<div class="header-cell" style="width: 120px;">계정상태</div>
<div class="header-cell" style="width: 240px;">설정</div>
</div>
<!-- User Table --> <!-- Table Body -->
<div class="user-list-wrapper" th:if="${(users != null and !users.isEmpty()) or (pendingUsers != null and !pendingUsers.isEmpty())}"> <div class="list-table-body">
<div class="user-table"> <!-- Active/Inactive Users -->
<!-- Table Header --> <div class="list-table-row" th:each="user, status : ${users}">
<div class="table-header"> <div class="row-cell" style="width: 90px;" data-label="NO" th:text="${status.index + 1}">1</div>
<div class="col-num">NO</div> <div class="row-cell" style="width: 90px;" data-label="성명">
<div class="col-name">성명</div> <a th:href="@{/users/detail(id=${user.id})}" th:text="${user.maskedUserName}">
<div class="col-email">이메일 아이디</div> 사용자 이름
<div class="col-role">권한</div> </a>
<div class="col-status">계정상태</div> </div>
<div class="col-actions">설정</div> <div class="row-cell" style="flex: 1; min-width: 200px;" data-label="이메일" th:text="${user.maskedEmailAddr}">
</div> user@example.com
</div>
<!-- Active/Inactive Users --> <div class="row-cell" style="width: 120px;" data-label="권한">
<div class="table-row" th:each="user, status : ${users}"> <span th:if="${user.roleCode != null}" th:text="#{${user.roleCode}}">권한</span>
<div class="col-num" th:text="${status.index + 1}">1</div> </div>
<div class="col-name"> <div class="row-cell" style="width: 120px;" data-label="계정상태" th:text="${user.userStatus.getDescription()}">
<a th:href="@{/users/detail(id=${user.id})}" th:text="${user.maskedUserName}"> 활성
사용자 이름 </div>
</a> <div class="row-cell row-actions" style="width: 240px;">
</div> <!-- Current User -->
<div class="col-email" th:text="${user.maskedEmailAddr}"> <span class="user-current-badge" th:if="${user.id == currentUserId}">
user@example.com
</div>
<div class="col-role">
<span class="user-role-badge" th:if="${user.roleCode != null}">
<i class="fas fa-shield-alt"></i>
<span th:text="#{${user.roleCode}}">권한</span>
</span>
</div>
<div class="col-status">
<span class="user-status-badge"
th:classappend="${user.userStatus.toString() == 'ACTIVE'} ? 'status-active' : (${user.userStatus.toString() == 'PENDING'} ? 'status-pending' : 'status-inactive')"
th:text="${user.userStatus.getDescription()}">
활성
</span>
</div>
<div class="col-actions">
<!-- Current User -->
<div class="user-current-badge" th:if="${user.id == currentUserId}">
<i class="fas fa-user-check"></i> 현재 사용자 <i class="fas fa-user-check"></i> 현재 사용자
</div>
<!-- Action Buttons -->
<div class="user-action-buttons" th:if="${user.roleCode != null and user.id != currentUserId}">
<button type="button" class="btn btn-sm btn-secondary inactivate_user"
th:if="${user.userStatus.toString() == 'ACTIVE'}"
th:data-user-id="${user.id}"
th:data-user-name="${user.maskedUserName}">
비활성화
</button>
<button type="button" class="btn btn-sm btn-primary activate_user"
th:if="${user.userStatus.toString() != 'ACTIVE'}"
th:data-user-id="${user.id}"
th:data-user-name="${user.maskedUserName}">
활성화
</button>
<button type="button" class="btn btn-sm btn-secondary cancel_invitation"
th:if="${user.userStatus.toString() == 'PENDING'}"
th:data-user-id="${user.id}"
th:data-user-email="${user.maskedEmailAddr}">
초대취소
</button>
<button type="button" class="btn btn-sm btn-warning assign_manager"
th:if="${user.userStatus.toString() == 'ACTIVE' && user.roleCode.toString() == 'ROLE_CORP_USER'}"
th:data-user-id="${user.id}"
th:data-user-name="${user.maskedUserName}"
th:data-user-email="${user.maskedEmailAddr}">
관리자 권한
</button>
</div>
</div>
</div>
<!-- Pending Invitation Users -->
<div class="table-row row-pending" th:each="user : ${pendingUsers}">
<div class="col-num"></div>
<div class="col-name">
<span class="pending-label">
<i class="fas fa-envelope"></i> 초대 대기중
</span> </span>
</div>
<div class="col-email" th:text="${user.maskedEmailAddr}"> <!-- Action Buttons -->
pending@example.com <th:block th:if="${user.roleCode != null and user.id != currentUserId}">
</div> <button type="button" class="list-table-btn list-table-btn--default assign_manager"
<div class="col-role">-</div> th:if="${user.userStatus.toString() == 'ACTIVE' && user.roleCode.toString() == 'ROLE_CORP_USER'}"
<div class="col-status"> th:data-user-id="${user.id}"
<span class="user-status-badge status-pending"> th:data-user-name="${user.maskedUserName}"
초대중 th:data-user-email="${user.maskedEmailAddr}">
</span> 관리자 권한부여
</div> </button>
<div class="col-actions"> <button type="button" class="list-table-btn list-table-btn--primary activate_user"
<div class="user-action-buttons"> th:if="${user.userStatus.toString() != 'ACTIVE'}"
<button type="button" class="btn btn-sm btn-secondary cancel_invitation" th:data-user-id="${user.id}"
th:data-user-id="${user.id}" th:data-user-name="${user.maskedUserName}">
th:data-user-email="${user.maskedEmailAddr}"> 활성화
초대취소 </button>
</button> <button type="button" class="list-table-btn list-table-btn--primary inactivate_user"
</div> th:if="${user.userStatus.toString() == 'ACTIVE'}"
</div> th:data-user-id="${user.id}"
</div> th:data-user-name="${user.maskedUserName}">
</div> 비활성화
</button>
<button type="button" class="list-table-btn list-table-btn--secondary cancel_invitation"
th:if="${user.userStatus.toString() == 'PENDING'}"
th:data-user-id="${user.id}"
th:data-user-email="${user.maskedEmailAddr}">
초대취소
</button>
</th:block>
</div>
</div> </div>
<!-- Empty State --> <!-- Pending Invitation Users -->
<div class="user-empty-state" th:if="${(users == null or users.isEmpty()) and (pendingUsers == null or pendingUsers.isEmpty())}"> <div class="list-table-row" th:each="user : ${pendingUsers}">
<div class="empty-icon">👥</div> <div class="row-cell" style="width: 90px;" data-label="NO">-</div>
<h3>등록된 이용자가 없습니다</h3> <div class="row-cell" style="width: 90px;" data-label="성명">-</div>
<p>새로운 이용자를 추가하여 시작하세요.</p> <div class="row-cell" style="flex: 1; min-width: 200px;" data-label="이메일" th:text="${user.maskedEmailAddr}">
<button type="button" class="btn btn-primary" id="addUserBtnEmpty"> pending@example.com
<i class="fas fa-plus"></i> </div>
<span>이용자 추가하기</span> <div class="row-cell" style="width: 120px;" data-label="권한">이용자</div>
<div class="row-cell" style="width: 120px;" data-label="계정상태">초대중</div>
<div class="row-cell row-actions" style="width: 240px;">
<button type="button" class="list-table-btn list-table-btn--secondary cancel_invitation"
th:data-user-id="${user.id}"
th:data-user-email="${user.maskedEmailAddr}">
초대취소
</button> </button>
</div>
</div> </div>
</div>
</div>
<!-- Pagination --> <!-- Empty State -->
<div class="pagination page_top" <div class="user-empty-state" th:if="${(users == null or users.isEmpty()) and (pendingUsers == null or pendingUsers.isEmpty())}">
th:replace="~{fragment/pagination :: pagination(jsFunction='fn_select_page')}"></div> <div class="empty-icon">👥</div>
<h3>등록된 이용자가 없습니다</h3>
<p>새로운 이용자를 추가하여 시작하세요.</p>
</div>
</section> <!-- Pagination -->
<div class="pagination page_top"
th:replace="~{fragment/pagination :: pagination(jsFunction='fn_select_page')}"></div>
</section>
</th:block> </th:block>
<section layout:fragment="pagePopups" class="content pop"> <section layout:fragment="pagePopups" class="content pop">
<!-- User Invite Modal --> <!-- User Invite Modal -->
<div th:replace="~{fragment/popup/userInvitePopup :: userInvitePopup}"></div> <div th:replace="~{fragment/popup/userInvitePopup :: userInvitePopup}"></div>
<!-- Change Role Modal --> <!-- Change Role Modal -->
<div th:replace="~{fragment/popup/changeRolePopup :: changeRolePopup}"></div> <div th:replace="~{fragment/popup/changeRolePopup :: changeRolePopup}"></div>
</section> </section>
</body> </body>
<th:block layout:fragment="contentScript"> <th:block layout:fragment="contentScript">
<script> <script>
$.ajaxSetup({ $.ajaxSetup({
beforeSend: function (xhr) { beforeSend: function(xhr) {
xhr.setRequestHeader("X-XSRF-TOKEN", '[[${_csrf.token}]]'); xhr.setRequestHeader('X-XSRF-TOKEN', '[[${_csrf.token}]]');
} }
});
document.addEventListener('DOMContentLoaded', function() {
// Function to open the user invite popup
function openUserInvitePopup() {
customPopups.showUserInvite({
onConfirm: function(email) {
$.ajax({
url: '/users/invite',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({emailAddr: email})
}).done(function(response) {
customPopups.hideUserInvite();
customPopups.showAlert(response.msg, function() {
location.reload();
});
}).fail(function(jqXHR, textStatus, errorThrown) {
let errorMessage;
try {
const errorResponse = JSON.parse(jqXHR.responseText);
errorMessage = errorResponse.msg || '이용자 초대 중 오류가 발생했습니다';
} catch (e) {
errorMessage = '이용자 초대 중 오류가 발생했습니다: ' + errorThrown;
}
customPopups.showUserInviteError(errorMessage);
});
},
onCancel: function() {
// Optional: handle cancel action
}
}); });
}
document.addEventListener('DOMContentLoaded', function () { // Add event listeners to the "이용자 추가" buttons
// Function to open the user invite popup const addUserBtn = document.getElementById('addUserBtn');
function openUserInvitePopup() {
customPopups.showUserInvite({ if (addUserBtn) {
onConfirm: function(email) { addUserBtn.addEventListener('click', openUserInvitePopup);
$.ajax({ }
url: '/users/invite',
type: 'POST', // Change role button handlers
contentType: 'application/json', const adminPrivilegeButtons = document.querySelectorAll('.assign_manager');
data: JSON.stringify({emailAddr: email}) adminPrivilegeButtons.forEach(button => {
}).done(function (response) { button.addEventListener('click', function(event) {
customPopups.hideUserInvite(); const button = event.currentTarget;
customPopups.showAlert(response.msg, function () { const userId = button.dataset.userId;
location.reload(); const userName = button.dataset.userName;
}); const userEmail = button.dataset.userEmail;
}).fail(function (jqXHR, textStatus, errorThrown) {
let errorMessage; customPopups.showChangeRole({
try { userName: userName,
const errorResponse = JSON.parse(jqXHR.responseText); userEmail: userEmail,
errorMessage = errorResponse.msg || '이용자 초대 중 오류가 발생했습니다'; userId: userId,
} catch (e) { onConfirm: function(userId) {
errorMessage = '이용자 초대 중 오류가 발생했습니다: ' + errorThrown; $.ajax({
} url: '/users/change-role',
customPopups.showUserInviteError(errorMessage); type: 'POST',
}); contentType: 'application/json',
}, data: JSON.stringify({id: userId})
onCancel: function() { }).done(function(response) {
// Optional: handle cancel action customPopups.hideChangeRole();
} customPopups.showAlert(response.msg, function() {
window.location.href = '/actionLogout.do';
}); });
}).fail(function(jqXHR, textStatus, errorThrown) {
customPopups.hideChangeRole();
customPopups.showAlert('권한 변경 중 오류가 발생했습니다: ' + errorThrown);
});
} }
});
// Add event listeners to the "이용자 추가" buttons
const addUserBtn = document.getElementById('addUserBtn');
const addUserBtnEmpty = document.getElementById('addUserBtnEmpty');
if (addUserBtn) {
addUserBtn.addEventListener('click', openUserInvitePopup);
}
if (addUserBtnEmpty) {
addUserBtnEmpty.addEventListener('click', openUserInvitePopup);
}
// Change role button handlers
const adminPrivilegeButtons = document.querySelectorAll('.assign_manager');
adminPrivilegeButtons.forEach(button => {
button.addEventListener('click', function(event) {
const button = event.currentTarget;
const userId = button.dataset.userId;
const userName = button.dataset.userName;
const userEmail = button.dataset.userEmail;
customPopups.showChangeRole({
userName: userName,
userEmail: userEmail,
userId: userId,
onConfirm: function(userId) {
$.ajax({
url: '/users/change-role',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({id: userId})
}).done(function (response) {
customPopups.hideChangeRole();
customPopups.showAlert(response.msg, function () {
window.location.href = '/actionLogout.do';
});
}).fail(function (jqXHR, textStatus, errorThrown) {
customPopups.hideChangeRole();
customPopups.showAlert('권한 변경 중 오류가 발생했습니다: ' + errorThrown);
});
}
});
});
});
const activateButtons = document.querySelectorAll('.activate_user');
const inactivateButtons = document.querySelectorAll('.inactivate_user');
const cancelInvitationButtons = document.querySelectorAll('.cancel_invitation');
activateButtons.forEach(button => {
button.addEventListener('click', handleUserStatusChange);
});
inactivateButtons.forEach(button => {
button.addEventListener('click', handleUserStatusChange);
});
cancelInvitationButtons.forEach(button => {
button.addEventListener('click', handleCancelInvitation);
});
function handleUserStatusChange(event) {
const button = event.currentTarget;
const userId = button.dataset.userId;
const userName = button.dataset.userName;
const isActivating = button.classList.contains('activate_user');
const actionText = isActivating ? '활성화' : '비활성화';
customPopups.showConfirm(`${userName} 사용자를 ${actionText}하시겠습니까?`, function (selection) {
if (selection) {
$.ajax({
url: `/users/${isActivating ? 'activate' : 'inactivate'}`,
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({id: userId})
}).done(function (response) {
customPopups.showAlert(response.msg, function () {
location.reload(); // Reload the page to reflect changes
});
}).fail(function (jqXHR, textStatus, errorThrown) {
customPopups.showAlert(`사용자 ${actionText} 중 오류가 발생했습니다: ` + errorThrown);
}).always(function () {
$('#customConfirm').hide();
});
}
});
}
function handleCancelInvitation(event) {
const button = event.currentTarget;
const userId = button.dataset.userId;
const userEmail = button.dataset.userEmail;
customPopups.showConfirm(`${userEmail}에 대한 초대를 취소하시겠습니까?`, function (selection) {
if (selection) {
$.ajax({
url: '/users/cancel-invitation',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({id: userId})
}).done(function (response) {
customPopups.showAlert(response.msg, function () {
location.reload(); // Reload the page to reflect changes
});
}).fail(function (jqXHR, textStatus, errorThrown) {
customPopups.showAlert('초대 취소 중 오류가 발생했습니다: ' + errorThrown);
}).always(function () {
$('#customConfirm').hide();
});
}
});
}
}); });
</script> });
const activateButtons = document.querySelectorAll('.activate_user');
const inactivateButtons = document.querySelectorAll('.inactivate_user');
const cancelInvitationButtons = document.querySelectorAll('.cancel_invitation');
activateButtons.forEach(button => {
button.addEventListener('click', handleUserStatusChange);
});
inactivateButtons.forEach(button => {
button.addEventListener('click', handleUserStatusChange);
});
cancelInvitationButtons.forEach(button => {
button.addEventListener('click', handleCancelInvitation);
});
function handleUserStatusChange(event) {
const button = event.currentTarget;
const userId = button.dataset.userId;
const userName = button.dataset.userName;
const isActivating = button.classList.contains('activate_user');
const actionText = isActivating ? '활성화' : '비활성화';
customPopups.showConfirm(`${userName} 사용자를 ${actionText}하시겠습니까?`, function(selection) {
if (selection) {
$.ajax({
url: `/users/${isActivating ? 'activate' : 'inactivate'}`,
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({id: userId})
}).done(function(response) {
customPopups.showAlert(response.msg, function() {
location.reload(); // Reload the page to reflect changes
});
}).fail(function(jqXHR, textStatus, errorThrown) {
customPopups.showAlert(`사용자 ${actionText} 중 오류가 발생했습니다: ` + errorThrown);
}).always(function() {
$('#customConfirm').hide();
});
}
});
}
function handleCancelInvitation(event) {
const button = event.currentTarget;
const userId = button.dataset.userId;
const userEmail = button.dataset.userEmail;
customPopups.showConfirm(`${userEmail}에 대한 초대를 취소하시겠습니까?`, function(selection) {
if (selection) {
$.ajax({
url: '/users/cancel-invitation',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({id: userId})
}).done(function(response) {
customPopups.showAlert(response.msg, function() {
location.reload(); // Reload the page to reflect changes
});
}).fail(function(jqXHR, textStatus, errorThrown) {
customPopups.showAlert('초대 취소 중 오류가 발생했습니다: ' + errorThrown);
}).always(function() {
$('#customConfirm').hide();
});
}
});
}
});
</script>
</th:block> </th:block>