2025-11-24 18:49:02 +09:00
|
|
|
@extends('layouts.app')
|
|
|
|
|
|
|
|
|
|
@section('title', '사용자 관리')
|
|
|
|
|
|
|
|
|
|
@section('content')
|
|
|
|
|
<!-- 페이지 헤더 -->
|
2025-12-19 16:46:30 +09:00
|
|
|
<div class="flex flex-col sm:flex-row sm:justify-between sm:items-center gap-4 mb-6">
|
2025-11-25 15:21:48 +09:00
|
|
|
<h1 class="text-2xl font-bold text-gray-800">사용자 관리</h1>
|
2025-12-19 16:46:30 +09:00
|
|
|
<a href="{{ route('users.create') }}" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg transition text-center w-full sm:w-auto">
|
2025-11-24 18:49:02 +09:00
|
|
|
+ 새 사용자
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 필터 영역 -->
|
2025-12-19 16:46:30 +09:00
|
|
|
<x-filter-collapsible id="filterForm">
|
|
|
|
|
<form id="filterForm" class="flex flex-wrap gap-2 sm:gap-4">
|
2025-11-24 18:49:02 +09:00
|
|
|
<!-- 검색 -->
|
2025-12-19 16:46:30 +09:00
|
|
|
<div class="flex-1 min-w-0 w-full sm:w-auto">
|
2025-11-24 18:49:02 +09:00
|
|
|
<input type="text"
|
|
|
|
|
name="search"
|
|
|
|
|
placeholder="이름, 이메일, 연락처로 검색..."
|
|
|
|
|
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 활성 상태 필터 -->
|
2025-12-19 16:46:30 +09:00
|
|
|
<div class="w-full sm:w-48">
|
2025-11-24 18:49:02 +09:00
|
|
|
<select name="is_active" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
|
|
|
<option value="">전체 상태</option>
|
|
|
|
|
<option value="1">활성</option>
|
|
|
|
|
<option value="0">비활성</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 검색 버튼 -->
|
2025-12-19 16:46:30 +09:00
|
|
|
<button type="submit" class="bg-gray-600 hover:bg-gray-700 text-white px-6 py-2 rounded-lg transition w-full sm:w-auto">
|
2025-11-24 18:49:02 +09:00
|
|
|
검색
|
|
|
|
|
</button>
|
|
|
|
|
</form>
|
2025-12-19 16:46:30 +09:00
|
|
|
</x-filter-collapsible>
|
2025-11-24 18:49:02 +09:00
|
|
|
|
|
|
|
|
<!-- 테이블 영역 (HTMX로 로드) -->
|
|
|
|
|
<div id="user-table"
|
|
|
|
|
hx-get="/api/admin/users"
|
|
|
|
|
hx-trigger="load, filterSubmit from:body"
|
|
|
|
|
hx-include="#filterForm"
|
|
|
|
|
hx-headers='{"X-CSRF-TOKEN": "{{ csrf_token() }}"}'
|
|
|
|
|
class="bg-white rounded-lg shadow-sm overflow-hidden">
|
|
|
|
|
<!-- 로딩 스피너 -->
|
|
|
|
|
<div class="flex justify-center items-center p-12">
|
|
|
|
|
<div class="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
@endsection
|
|
|
|
|
|
|
|
|
|
@push('scripts')
|
|
|
|
|
<script src="https://unpkg.com/htmx.org@1.9.10"></script>
|
|
|
|
|
<script>
|
|
|
|
|
// 폼 제출 시 HTMX 이벤트 트리거
|
|
|
|
|
document.getElementById('filterForm').addEventListener('submit', function(e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
htmx.trigger('#user-table', 'filterSubmit');
|
|
|
|
|
});
|
|
|
|
|
|
2025-12-21 15:13:01 +09:00
|
|
|
// HTMX 응답 후 필요한 초기화 처리
|
2025-11-24 18:49:02 +09:00
|
|
|
document.body.addEventListener('htmx:afterSwap', function(event) {
|
|
|
|
|
if (event.detail.target.id === 'user-table') {
|
2025-12-21 15:13:01 +09:00
|
|
|
// 필요시 테이블 로드 후 초기화 작업
|
2025-11-24 18:49:02 +09:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 삭제 확인
|
|
|
|
|
window.confirmDelete = function(id, name) {
|
브라우저 alert/confirm을 SweetAlert2로 전환
- layouts/app.blade.php에 SweetAlert2 CDN 및 전역 헬퍼 함수 추가
- showToast(): 토스트 알림 (success, error, warning, info)
- showConfirm(): 확인 대화상자
- showDeleteConfirm(): 삭제 확인 (경고 아이콘)
- showPermanentDeleteConfirm(): 영구 삭제 확인 (빨간색 경고)
- showSuccess(), showError(): 성공/에러 알림
- 변환된 파일 목록 (48개 Blade 파일):
- menus/* (6개), boards/* (2개), posts/* (3개)
- daily-logs/* (3개), project-management/* (6개)
- dev-tools/flow-tester/* (6개)
- quote-formulas/* (4개), permission-analyze/* (1개)
- archived-records/* (1개), profile/* (1개)
- roles/* (3개), permissions/* (3개)
- departments/* (3개), tenants/* (3개), users/* (3개)
- 주요 개선사항:
- Tailwind CSS 테마와 일관된 디자인
- 비동기 콜백 패턴으로 리팩토링
- 삭제/복원/영구삭제 각각 다른 스타일 적용
2025-12-05 09:49:56 +09:00
|
|
|
showDeleteConfirm(name, () => {
|
2025-11-24 18:49:02 +09:00
|
|
|
htmx.ajax('DELETE', `/api/admin/users/${id}`, {
|
|
|
|
|
target: '#user-table',
|
|
|
|
|
swap: 'none',
|
|
|
|
|
headers: {
|
|
|
|
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
|
|
|
|
}
|
|
|
|
|
}).then(() => {
|
|
|
|
|
htmx.trigger('#user-table', 'filterSubmit');
|
|
|
|
|
});
|
브라우저 alert/confirm을 SweetAlert2로 전환
- layouts/app.blade.php에 SweetAlert2 CDN 및 전역 헬퍼 함수 추가
- showToast(): 토스트 알림 (success, error, warning, info)
- showConfirm(): 확인 대화상자
- showDeleteConfirm(): 삭제 확인 (경고 아이콘)
- showPermanentDeleteConfirm(): 영구 삭제 확인 (빨간색 경고)
- showSuccess(), showError(): 성공/에러 알림
- 변환된 파일 목록 (48개 Blade 파일):
- menus/* (6개), boards/* (2개), posts/* (3개)
- daily-logs/* (3개), project-management/* (6개)
- dev-tools/flow-tester/* (6개)
- quote-formulas/* (4개), permission-analyze/* (1개)
- archived-records/* (1개), profile/* (1개)
- roles/* (3개), permissions/* (3개)
- departments/* (3개), tenants/* (3개), users/* (3개)
- 주요 개선사항:
- Tailwind CSS 테마와 일관된 디자인
- 비동기 콜백 패턴으로 리팩토링
- 삭제/복원/영구삭제 각각 다른 스타일 적용
2025-12-05 09:49:56 +09:00
|
|
|
});
|
2025-11-24 18:49:02 +09:00
|
|
|
};
|
2025-11-24 19:30:36 +09:00
|
|
|
|
|
|
|
|
// 복원 확인
|
|
|
|
|
window.confirmRestore = function(id, name) {
|
브라우저 alert/confirm을 SweetAlert2로 전환
- layouts/app.blade.php에 SweetAlert2 CDN 및 전역 헬퍼 함수 추가
- showToast(): 토스트 알림 (success, error, warning, info)
- showConfirm(): 확인 대화상자
- showDeleteConfirm(): 삭제 확인 (경고 아이콘)
- showPermanentDeleteConfirm(): 영구 삭제 확인 (빨간색 경고)
- showSuccess(), showError(): 성공/에러 알림
- 변환된 파일 목록 (48개 Blade 파일):
- menus/* (6개), boards/* (2개), posts/* (3개)
- daily-logs/* (3개), project-management/* (6개)
- dev-tools/flow-tester/* (6개)
- quote-formulas/* (4개), permission-analyze/* (1개)
- archived-records/* (1개), profile/* (1개)
- roles/* (3개), permissions/* (3개)
- departments/* (3개), tenants/* (3개), users/* (3개)
- 주요 개선사항:
- Tailwind CSS 테마와 일관된 디자인
- 비동기 콜백 패턴으로 리팩토링
- 삭제/복원/영구삭제 각각 다른 스타일 적용
2025-12-05 09:49:56 +09:00
|
|
|
showConfirm(`"${name}" 사용자를 복원하시겠습니까?`, () => {
|
2025-11-24 19:30:36 +09:00
|
|
|
htmx.ajax('POST', `/api/admin/users/${id}/restore`, {
|
|
|
|
|
target: '#user-table',
|
|
|
|
|
swap: 'none',
|
|
|
|
|
headers: {
|
|
|
|
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
|
|
|
|
}
|
|
|
|
|
}).then(() => {
|
|
|
|
|
htmx.trigger('#user-table', 'filterSubmit');
|
|
|
|
|
});
|
브라우저 alert/confirm을 SweetAlert2로 전환
- layouts/app.blade.php에 SweetAlert2 CDN 및 전역 헬퍼 함수 추가
- showToast(): 토스트 알림 (success, error, warning, info)
- showConfirm(): 확인 대화상자
- showDeleteConfirm(): 삭제 확인 (경고 아이콘)
- showPermanentDeleteConfirm(): 영구 삭제 확인 (빨간색 경고)
- showSuccess(), showError(): 성공/에러 알림
- 변환된 파일 목록 (48개 Blade 파일):
- menus/* (6개), boards/* (2개), posts/* (3개)
- daily-logs/* (3개), project-management/* (6개)
- dev-tools/flow-tester/* (6개)
- quote-formulas/* (4개), permission-analyze/* (1개)
- archived-records/* (1개), profile/* (1개)
- roles/* (3개), permissions/* (3개)
- departments/* (3개), tenants/* (3개), users/* (3개)
- 주요 개선사항:
- Tailwind CSS 테마와 일관된 디자인
- 비동기 콜백 패턴으로 리팩토링
- 삭제/복원/영구삭제 각각 다른 스타일 적용
2025-12-05 09:49:56 +09:00
|
|
|
}, { title: '복원 확인', icon: 'question' });
|
2025-11-24 19:30:36 +09:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 영구삭제 확인
|
|
|
|
|
window.confirmForceDelete = function(id, name) {
|
브라우저 alert/confirm을 SweetAlert2로 전환
- layouts/app.blade.php에 SweetAlert2 CDN 및 전역 헬퍼 함수 추가
- showToast(): 토스트 알림 (success, error, warning, info)
- showConfirm(): 확인 대화상자
- showDeleteConfirm(): 삭제 확인 (경고 아이콘)
- showPermanentDeleteConfirm(): 영구 삭제 확인 (빨간색 경고)
- showSuccess(), showError(): 성공/에러 알림
- 변환된 파일 목록 (48개 Blade 파일):
- menus/* (6개), boards/* (2개), posts/* (3개)
- daily-logs/* (3개), project-management/* (6개)
- dev-tools/flow-tester/* (6개)
- quote-formulas/* (4개), permission-analyze/* (1개)
- archived-records/* (1개), profile/* (1개)
- roles/* (3개), permissions/* (3개)
- departments/* (3개), tenants/* (3개), users/* (3개)
- 주요 개선사항:
- Tailwind CSS 테마와 일관된 디자인
- 비동기 콜백 패턴으로 리팩토링
- 삭제/복원/영구삭제 각각 다른 스타일 적용
2025-12-05 09:49:56 +09:00
|
|
|
showPermanentDeleteConfirm(name, () => {
|
2025-11-24 19:30:36 +09:00
|
|
|
htmx.ajax('DELETE', `/api/admin/users/${id}/force`, {
|
|
|
|
|
target: '#user-table',
|
|
|
|
|
swap: 'none',
|
|
|
|
|
headers: {
|
|
|
|
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
|
|
|
|
}
|
|
|
|
|
}).then(() => {
|
|
|
|
|
htmx.trigger('#user-table', 'filterSubmit');
|
|
|
|
|
});
|
브라우저 alert/confirm을 SweetAlert2로 전환
- layouts/app.blade.php에 SweetAlert2 CDN 및 전역 헬퍼 함수 추가
- showToast(): 토스트 알림 (success, error, warning, info)
- showConfirm(): 확인 대화상자
- showDeleteConfirm(): 삭제 확인 (경고 아이콘)
- showPermanentDeleteConfirm(): 영구 삭제 확인 (빨간색 경고)
- showSuccess(), showError(): 성공/에러 알림
- 변환된 파일 목록 (48개 Blade 파일):
- menus/* (6개), boards/* (2개), posts/* (3개)
- daily-logs/* (3개), project-management/* (6개)
- dev-tools/flow-tester/* (6개)
- quote-formulas/* (4개), permission-analyze/* (1개)
- archived-records/* (1개), profile/* (1개)
- roles/* (3개), permissions/* (3개)
- departments/* (3개), tenants/* (3개), users/* (3개)
- 주요 개선사항:
- Tailwind CSS 테마와 일관된 디자인
- 비동기 콜백 패턴으로 리팩토링
- 삭제/복원/영구삭제 각각 다른 스타일 적용
2025-12-05 09:49:56 +09:00
|
|
|
});
|
2025-11-24 19:30:36 +09:00
|
|
|
};
|
2025-12-20 13:43:13 +09:00
|
|
|
|
|
|
|
|
// DEV 사이트 접속 (자동 로그인)
|
|
|
|
|
window.openDevSite = function(id, name) {
|
|
|
|
|
showConfirm(`"${name}" 사용자로 DEV 사이트에 접속하시겠습니까?`, () => {
|
|
|
|
|
// 토큰 생성 API 호출
|
|
|
|
|
fetch(`/api/admin/users/${id}/login-token`, {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.then(response => response.json())
|
|
|
|
|
.then(data => {
|
|
|
|
|
if (data.success && data.data?.url) {
|
|
|
|
|
// 새 창에서 DEV 사이트 열기
|
|
|
|
|
window.open(data.data.url, '_blank');
|
|
|
|
|
} else {
|
|
|
|
|
showAlert(data.message || 'DEV 접속 토큰 생성에 실패했습니다.', 'error');
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch(error => {
|
|
|
|
|
console.error('DEV 접속 오류:', error);
|
|
|
|
|
showAlert('DEV 접속 중 오류가 발생했습니다.', 'error');
|
|
|
|
|
});
|
|
|
|
|
}, { title: 'DEV 사이트 접속', icon: 'question' });
|
|
|
|
|
};
|
2025-11-24 18:49:02 +09:00
|
|
|
</script>
|
|
|
|
|
@endpush
|