Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

Commit 6014601

Browse files
authored
Merge pull request #24 from archan0621/stage
2023-10-22 9월 2주차 스프린트 배포
2 parents c2cb269 + 8f8a73d commit 6014601

12 files changed

+173
-9
lines changed

admin_control/add_match_player.php

+4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<?php
22
require $_SERVER['DOCUMENT_ROOT'].'/model/JwtApiCall.php';
3+
include '../loading/loading.php';
34
$_SERVER['REQUEST_URI'] == "/" ? require 'config/config.php' : require '../config/config.php';
45
global $my_api;
56

67
$eventId = $_GET['event_id'];
78
$memberId = $_GET['memberId'];
89

910
if (isset($eventId) && isset($memberId)) {
11+
loading_page(true);
1012
if ($memberId) {
1113
$responseData = JwtApiCall($my_api."event/memberAdd",
1214
"POST",
@@ -18,8 +20,10 @@
1820
}
1921

2022
if ($responseData['result'] == 'fail') {
23+
loading_page(false);
2124
echo "<script>alert('".$responseData['message']."');;history.back();</script>";
2225
} elseif ($responseData['result'] == 'success') {
26+
loading_page(false);
2327
echo "<script>alert('".$responseData['message']."');history.back();</script>";
2428
}
2529
}

admin_control/expenses_match_player.php

+4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<?php
22
require $_SERVER['DOCUMENT_ROOT'].'/model/JwtApiCall.php';
3+
include '../loading/loading.php';
34
$_SERVER['REQUEST_URI'] == "/" ? require 'config/config.php' : require '../config/config.php';
45
global $my_api;
56

67
$eventId = $_GET['event_id'];
78
$memberId = $_GET['memberId'];
89

910
if (isset($eventId) && isset($memberId)) {
11+
loading_page(true);
1012
if ($memberId) {
1113
$responseData = JwtApiCall($my_api."event/memberPurchaseCheck",
1214
"POST",
@@ -18,8 +20,10 @@
1820
}
1921

2022
if ($responseData['result'] == 'fail') {
23+
loading_page(false);
2124
echo "<script>alert('".$responseData['message']."');history.back();</script>";
2225
} elseif ($responseData['result'] == 'success') {
26+
loading_page(false);
2327
echo "<script>alert('".$responseData['message']."');history.back();</script>";
2428
}
2529
}

admin_control/match_create.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22
require $_SERVER['DOCUMENT_ROOT'].'/model/JwtApiCall.php';
3+
include '../loading/loading.php';
34
$_SERVER['REQUEST_URI'] == "/" ? require 'config/config.php' : require '../config/config.php';
45
global $my_api;
56

@@ -18,14 +19,16 @@
1819
} elseif (!$_POST['match_description']) {
1920
echo "<script>alert('유의사항을 입력해주세요');history.back();</script>";
2021
} else {
22+
loading_page(true);
23+
2124
$title = $_POST['match_title'];
2225
$location = $_POST['match_location'];
2326
$gender = $_POST['member_gender'];
2427
$money = $_POST['match_money'];
2528
$start_time = $_POST['match_start_time'];
2629
$end_time = $_POST['match_end_time'];
2730
$description = $_POST['match_description'];
28-
31+
2932
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
3033
$responseData = JwtApiCall($my_api."event/create",
3134
"POST",
@@ -42,8 +45,10 @@
4245
}
4346

4447
if ($responseData['result'] == 'fail') {
48+
loading_page(false);
4549
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/match';</script>";
4650
} elseif ($responseData['result'] == 'success') {
51+
loading_page(false);
4752
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/match';</script>";
4853
}
4954
}

admin_control/match_delete.php

+4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<?php
22
require $_SERVER['DOCUMENT_ROOT'].'/model/JwtApiCall.php';
3+
include '../loading/loading.php';
34
$_SERVER['REQUEST_URI'] == "/" ? require 'config/config.php' : require '../config/config.php';
45
global $my_api;
56

67
$eventId = $_GET['eventId'];
78

89
if (isset($eventId)) {
10+
loading_page(true);
911
$responseData = JwtApiCall($my_api."event/remove",
1012
"POST",
1113
array(
@@ -14,8 +16,10 @@
1416
$_SESSION['token']);
1517

1618
if ($responseData['result'] == 'fail') {
19+
loading_page(false);
1720
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/match';</script>";
1821
} elseif ($responseData['result'] == 'success') {
22+
loading_page(false);
1923
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/match';</script>";
2024
}
2125
}

admin_control/match_update.php

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22
require $_SERVER['DOCUMENT_ROOT'].'/model/JwtApiCall.php';
3+
include '../loading/loading.php';
34
$_SERVER['REQUEST_URI'] == "/" ? require 'config/config.php' : require '../config/config.php';
45
global $my_api;
56

@@ -20,6 +21,8 @@
2021
} elseif (!$_POST['match_description']) {
2122
echo "<script>alert('유의사항을 입력해주세요');history.back();</script>";
2223
} else {
24+
loading_page(true);
25+
2326
$id = $_POST['match_id'];
2427
$title = $_POST['match_title'];
2528
$location = $_POST['match_location'];
@@ -46,8 +49,10 @@
4649
}
4750

4851
if ($responseData['result'] == 'fail') {
52+
loading_page(false);
4953
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/index';</script>";
5054
} elseif ($responseData['result'] == 'success') {
55+
loading_page(false);
5156
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/match_detail?event_id=$id';</script>";
5257
}
5358
}

admin_control/minus_match_player.php

+4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<?php
22
require $_SERVER['DOCUMENT_ROOT'].'/model/JwtApiCall.php';
3+
include '../loading/loading.php';
34
$_SERVER['REQUEST_URI'] == "/" ? require 'config/config.php' : require '../config/config.php';
45
global $my_api;
56

67
$eventId = $_GET['event_id'];
78
$memberId = $_GET['memberId'];
89

910
if (isset($eventId) && isset($memberId)) {
11+
loading_page(true);
1012
if ($memberId) {
1113
$responseData = JwtApiCall($my_api."event/memberRemove",
1214
"POST",
@@ -18,8 +20,10 @@
1820
}
1921

2022
if ($responseData['result'] == 'fail') {
23+
loading_page(false);
2124
echo "<script>alert('".$responseData['message']."');history.back();</script>";
2225
} elseif ($responseData['result'] == 'success') {
26+
loading_page(false);
2327
echo "<script>alert('".$responseData['message']."');history.back();</script>";
2428
}
2529
}

admin_data/match_member_data.php

+31-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@
77
global $my_api;
88

99
$memberSearch = JwtApiCall($my_api."event/".$list_type, "POST", array('eventId' => $event_id), $_SESSION['token']);
10+
11+
function comparePlayers($player1, $player2) {
12+
$sortA = $player1['memberName'];
13+
$sortB = $player2['memberName'];
14+
15+
return strcmp($sortA, $sortB);
16+
}
17+
18+
usort($memberSearch['memberList'], 'comparePlayers');
19+
1020
if ($memberSearch['result'] == 'fail' && $memberSearch['message'] == '만료된 토큰으로 JWT 요청시도') {
1121
echo "<script>alert('세션이 만료되었습니다. 다시 로그인해주세요.');location.href='../view_control/signout';</script>";
1222
} else {
@@ -16,9 +26,28 @@
1626
} elseif ($_POST['func'] == 'minus_player') {
1727
echo "<a href=\"../admin_control/minus_match_player?memberId={$item['memberId']}&event_id={$event_id}\">{$item['memberName']}</a><br/>";
1828
} elseif ($_POST['func'] == 'list_player') {
19-
echo "{$item['memberName']}<br/>";
29+
if($item['attendance']) {
30+
if ($item['attendance'] == 'LATE') {
31+
$item['attendance'] = '지각';
32+
} else {
33+
$item['attendance'] = $item['attendance'] == 'ABSENT' ? '미출석' : '출석';
34+
}
35+
} else {
36+
$item['attendance'] = '';
37+
}
38+
39+
if($item['purchaseStatus']) {
40+
if ($item['purchaseStatus'] == 'NOT_PURCHASED') {
41+
$item['purchaseStatus'] = '미납';
42+
} else {
43+
$item['purchaseStatus'] = $item['purchaseStatus'] == 'WAITING' ? '확인 대기중' : '납부 완료';
44+
}
45+
} else {
46+
$item['purchaseStatus'] = '';
47+
}
48+
echo "{$item['memberName']} / {$item['attendance']} / {$item['purchaseStatus']}<br/>";
2049
} elseif ($_POST['func'] == 'expenses_player') {
21-
echo "<a href=\"../admin_control/expenses_match_player?event_id={$event_id}\">{$item['memberName']}</a><a class=\"expenses_ok_btn\" href=\"../admin_control/expenses_match_player?memberId={$item['memberId']}&event_id={$event_id}\">확인</a><br/>";
50+
echo "<div class=\"expenses_ok_btn_wrap\"><a href=\"../admin_control/expenses_match_player?event_id={$event_id}\">{$item['memberName']}</a><a class=\"expenses_ok_btn\" href=\"../admin_control/expenses_match_player?memberId={$item['memberId']}&event_id={$event_id}\">확인</a><br/>";
2251
} else {
2352
echo "데이터를 불러오지 못했습니다.<br/>";
2453
}

loading/loading.php

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
if (isset($_POST['status']) && $_POST['status']) {
3+
$status = $_POST['status'];
4+
loading_page($status);
5+
}
6+
function loading_page($status) {
7+
if ($status) {
8+
?>
9+
<!DOCTYPE html>
10+
<html lang="en">
11+
<head>
12+
<meta charset="UTF-8">
13+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
14+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
15+
<title>Document</title>
16+
<style>
17+
.spinner-wrapper {
18+
position: fixed;
19+
top: 0;
20+
left: 0;
21+
width: 100%;
22+
height: 100%;
23+
background-color: rgba(0, 0, 0, 0.4);
24+
z-index: 9999;
25+
display: flex;
26+
justify-content: center;
27+
align-items: center;
28+
}
29+
.spinner {
30+
display: inline-block;
31+
width: 40px;
32+
height: 40px;
33+
border: 4px solid rgba(0, 0, 0, 0.2);
34+
border-top-color: #333;
35+
border-radius: 50%;
36+
animation: spin 1s ease-in-out infinite;
37+
}
38+
39+
@keyframes spin {
40+
to {
41+
-webkit-transform: rotate(360deg);
42+
transform: rotate(360deg);
43+
}
44+
}
45+
</style>
46+
</head>
47+
<body>
48+
<div class="spinner-wrapper" id="spinner-wrapper">
49+
<div class="spinner"></div>
50+
</div>
51+
</body>
52+
</html>
53+
<?php
54+
}
55+
}
56+
?>

style/admin.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,6 @@
160160
border-radius: 6px;
161161
padding: 4px 12px;
162162
}
163-
.expenses_ok_btn:not(:first-child) {
164-
margin-top: 6px;
163+
.expenses_ok_btn_wrap:not(:first-child) {
164+
margin-top: 12px;
165165
}

view/match.php

+46-1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ public function get_event_location() {
101101
}
102102

103103
$match_player = JwtApiCall($my_api."event/memberList", "POST", array('eventId' => $event_id), $_SESSION['token']); //참여인원
104+
105+
function comparePlayers($player1, $player2) {
106+
$sortA = $player1['memberName'];
107+
$sortB = $player2['memberName'];
108+
109+
return strcmp($sortA, $sortB);
110+
}
111+
112+
usort($match_player['memberList'], 'comparePlayers');
104113
?>
105114
<div class="page_wrap">
106115
<div class="page">
@@ -156,7 +165,7 @@ public function get_event_location() {
156165
<div class="icon"><i class="fa-solid fa-user-check"></i></div>
157166
<div class="attendance_check_txt"><p>출석 확인</p></div>
158167
</a>
159-
<a href="../view_control/purchasereq_check?eventId=<?=$event_dto_id?>&memberId=<?=$_SESSION['member_id']?>" class="expenses_check">
168+
<a href="javascript:;" onclick="purchasereq_check()" class="expenses_check">
160169
<div class="icon"><i class="fa-solid fa-hand-holding-dollar"></i></div>
161170
<div class="expenses_check_txt"><p>납부 확인</p></div>
162171
</a>
@@ -203,11 +212,27 @@ public function get_event_location() {
203212
</div>
204213
</div>
205214
<script>
215+
function loading_page(status) {
216+
if (status) {
217+
$.ajax({
218+
url: '../loading/loading',
219+
method: 'POST',
220+
data: { status: status },
221+
success: function(response) {
222+
document.body.innerHTML += response;
223+
}
224+
});
225+
} else {
226+
const loading = document.getElementById("spinner-wrapper");
227+
loading.parentNode.removeChild(loading);
228+
}
229+
}
206230
function player_check_lity() {
207231
lity('#player_check_lity');
208232
}
209233
function attendance_check() {
210234
if ("geolocation" in navigator) {
235+
loading_page(true);
211236
navigator.geolocation.getCurrentPosition(function(position) {
212237
var latitude = position.coords.latitude; // 위도
213238
var longitude = position.coords.longitude; // 경도
@@ -216,14 +241,34 @@ function attendance_check() {
216241
method: 'POST',
217242
data: { eventId: <?=$event_dto_id?>, latitude: latitude, longitude: longitude },
218243
success: function(response) {
244+
loading_page(false);
219245
alert(response);
220246
}
221247
});
248+
}, function(error) {
249+
if (error.code === error.PERMISSION_DENIED) {
250+
alert("위치 권한이 거부되었습니다.");
251+
} else {
252+
alert("위치 정보를 가져오는 중 오류가 발생했습니다.");
253+
}
222254
});
223255
} else {
256+
loading_page(false);
224257
alert("위치정보를 지원하지 않는 브라우저입니다.");
225258
}
226259
}
260+
function purchasereq_check() {
261+
loading_page(true);
262+
$.ajax({
263+
url: '../view_control/purchasereq_check',
264+
method: 'POST',
265+
data: { eventId: <?=$event_dto_id?> },
266+
success: function(response) {
267+
loading_page(false);
268+
alert(response);
269+
}
270+
});
271+
}
227272
function matchLocation() {
228273
var address = document.getElementById('match_address_txt').textContent;
229274
var centerCoord = new naver.maps.LatLng(37.5666102, 126.9783881);

0 commit comments

Comments
 (0)