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

Commit

Permalink
Merge pull request #24 from archan0621/stage
Browse files Browse the repository at this point in the history
2023-10-22 9월 2주차 스프린트 배포
  • Loading branch information
archan0621 authored Oct 22, 2023
2 parents c2cb269 + 8f8a73d commit 6014601
Show file tree
Hide file tree
Showing 12 changed files with 173 additions and 9 deletions.
4 changes: 4 additions & 0 deletions admin_control/add_match_player.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?php
require $_SERVER['DOCUMENT_ROOT'].'/model/JwtApiCall.php';
include '../loading/loading.php';
$_SERVER['REQUEST_URI'] == "/" ? require 'config/config.php' : require '../config/config.php';
global $my_api;

$eventId = $_GET['event_id'];
$memberId = $_GET['memberId'];

if (isset($eventId) && isset($memberId)) {
loading_page(true);
if ($memberId) {
$responseData = JwtApiCall($my_api."event/memberAdd",
"POST",
Expand All @@ -18,8 +20,10 @@
}

if ($responseData['result'] == 'fail') {
loading_page(false);
echo "<script>alert('".$responseData['message']."');;history.back();</script>";
} elseif ($responseData['result'] == 'success') {
loading_page(false);
echo "<script>alert('".$responseData['message']."');history.back();</script>";
}
}
Expand Down
4 changes: 4 additions & 0 deletions admin_control/expenses_match_player.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?php
require $_SERVER['DOCUMENT_ROOT'].'/model/JwtApiCall.php';
include '../loading/loading.php';
$_SERVER['REQUEST_URI'] == "/" ? require 'config/config.php' : require '../config/config.php';
global $my_api;

$eventId = $_GET['event_id'];
$memberId = $_GET['memberId'];

if (isset($eventId) && isset($memberId)) {
loading_page(true);
if ($memberId) {
$responseData = JwtApiCall($my_api."event/memberPurchaseCheck",
"POST",
Expand All @@ -18,8 +20,10 @@
}

if ($responseData['result'] == 'fail') {
loading_page(false);
echo "<script>alert('".$responseData['message']."');history.back();</script>";
} elseif ($responseData['result'] == 'success') {
loading_page(false);
echo "<script>alert('".$responseData['message']."');history.back();</script>";
}
}
Expand Down
7 changes: 6 additions & 1 deletion admin_control/match_create.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
require $_SERVER['DOCUMENT_ROOT'].'/model/JwtApiCall.php';
include '../loading/loading.php';
$_SERVER['REQUEST_URI'] == "/" ? require 'config/config.php' : require '../config/config.php';
global $my_api;

Expand All @@ -18,14 +19,16 @@
} elseif (!$_POST['match_description']) {
echo "<script>alert('유의사항을 입력해주세요');history.back();</script>";
} else {
loading_page(true);

$title = $_POST['match_title'];
$location = $_POST['match_location'];
$gender = $_POST['member_gender'];
$money = $_POST['match_money'];
$start_time = $_POST['match_start_time'];
$end_time = $_POST['match_end_time'];
$description = $_POST['match_description'];

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$responseData = JwtApiCall($my_api."event/create",
"POST",
Expand All @@ -42,8 +45,10 @@
}

if ($responseData['result'] == 'fail') {
loading_page(false);
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/match';</script>";
} elseif ($responseData['result'] == 'success') {
loading_page(false);
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/match';</script>";
}
}
Expand Down
4 changes: 4 additions & 0 deletions admin_control/match_delete.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?php
require $_SERVER['DOCUMENT_ROOT'].'/model/JwtApiCall.php';
include '../loading/loading.php';
$_SERVER['REQUEST_URI'] == "/" ? require 'config/config.php' : require '../config/config.php';
global $my_api;

$eventId = $_GET['eventId'];

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

if ($responseData['result'] == 'fail') {
loading_page(false);
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/match';</script>";
} elseif ($responseData['result'] == 'success') {
loading_page(false);
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/match';</script>";
}
}
Expand Down
5 changes: 5 additions & 0 deletions admin_control/match_update.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
require $_SERVER['DOCUMENT_ROOT'].'/model/JwtApiCall.php';
include '../loading/loading.php';
$_SERVER['REQUEST_URI'] == "/" ? require 'config/config.php' : require '../config/config.php';
global $my_api;

Expand All @@ -20,6 +21,8 @@
} elseif (!$_POST['match_description']) {
echo "<script>alert('유의사항을 입력해주세요');history.back();</script>";
} else {
loading_page(true);

$id = $_POST['match_id'];
$title = $_POST['match_title'];
$location = $_POST['match_location'];
Expand All @@ -46,8 +49,10 @@
}

if ($responseData['result'] == 'fail') {
loading_page(false);
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/index';</script>";
} elseif ($responseData['result'] == 'success') {
loading_page(false);
echo "<script>alert('".$responseData['message']."');location.href='../admin_view/match_detail?event_id=$id';</script>";
}
}
Expand Down
4 changes: 4 additions & 0 deletions admin_control/minus_match_player.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?php
require $_SERVER['DOCUMENT_ROOT'].'/model/JwtApiCall.php';
include '../loading/loading.php';
$_SERVER['REQUEST_URI'] == "/" ? require 'config/config.php' : require '../config/config.php';
global $my_api;

$eventId = $_GET['event_id'];
$memberId = $_GET['memberId'];

if (isset($eventId) && isset($memberId)) {
loading_page(true);
if ($memberId) {
$responseData = JwtApiCall($my_api."event/memberRemove",
"POST",
Expand All @@ -18,8 +20,10 @@
}

if ($responseData['result'] == 'fail') {
loading_page(false);
echo "<script>alert('".$responseData['message']."');history.back();</script>";
} elseif ($responseData['result'] == 'success') {
loading_page(false);
echo "<script>alert('".$responseData['message']."');history.back();</script>";
}
}
Expand Down
33 changes: 31 additions & 2 deletions admin_data/match_member_data.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@
global $my_api;

$memberSearch = JwtApiCall($my_api."event/".$list_type, "POST", array('eventId' => $event_id), $_SESSION['token']);

function comparePlayers($player1, $player2) {
$sortA = $player1['memberName'];
$sortB = $player2['memberName'];

return strcmp($sortA, $sortB);
}

usort($memberSearch['memberList'], 'comparePlayers');

if ($memberSearch['result'] == 'fail' && $memberSearch['message'] == '만료된 토큰으로 JWT 요청시도') {
echo "<script>alert('세션이 만료되었습니다. 다시 로그인해주세요.');location.href='../view_control/signout';</script>";
} else {
Expand All @@ -16,9 +26,28 @@
} elseif ($_POST['func'] == 'minus_player') {
echo "<a href=\"../admin_control/minus_match_player?memberId={$item['memberId']}&event_id={$event_id}\">{$item['memberName']}</a><br/>";
} elseif ($_POST['func'] == 'list_player') {
echo "{$item['memberName']}<br/>";
if($item['attendance']) {
if ($item['attendance'] == 'LATE') {
$item['attendance'] = '지각';
} else {
$item['attendance'] = $item['attendance'] == 'ABSENT' ? '미출석' : '출석';
}
} else {
$item['attendance'] = '';
}

if($item['purchaseStatus']) {
if ($item['purchaseStatus'] == 'NOT_PURCHASED') {
$item['purchaseStatus'] = '미납';
} else {
$item['purchaseStatus'] = $item['purchaseStatus'] == 'WAITING' ? '확인 대기중' : '납부 완료';
}
} else {
$item['purchaseStatus'] = '';
}
echo "{$item['memberName']} / {$item['attendance']} / {$item['purchaseStatus']}<br/>";
} elseif ($_POST['func'] == 'expenses_player') {
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/>";
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/>";
} else {
echo "데이터를 불러오지 못했습니다.<br/>";
}
Expand Down
56 changes: 56 additions & 0 deletions loading/loading.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
if (isset($_POST['status']) && $_POST['status']) {
$status = $_POST['status'];
loading_page($status);
}
function loading_page($status) {
if ($status) {
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.spinner-wrapper {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.4);
z-index: 9999;
display: flex;
justify-content: center;
align-items: center;
}
.spinner {
display: inline-block;
width: 40px;
height: 40px;
border: 4px solid rgba(0, 0, 0, 0.2);
border-top-color: #333;
border-radius: 50%;
animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
to {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<div class="spinner-wrapper" id="spinner-wrapper">
<div class="spinner"></div>
</div>
</body>
</html>
<?php
}
}
?>
4 changes: 2 additions & 2 deletions style/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,6 @@
border-radius: 6px;
padding: 4px 12px;
}
.expenses_ok_btn:not(:first-child) {
margin-top: 6px;
.expenses_ok_btn_wrap:not(:first-child) {
margin-top: 12px;
}
47 changes: 46 additions & 1 deletion view/match.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ public function get_event_location() {
}

$match_player = JwtApiCall($my_api."event/memberList", "POST", array('eventId' => $event_id), $_SESSION['token']); //참여인원

function comparePlayers($player1, $player2) {
$sortA = $player1['memberName'];
$sortB = $player2['memberName'];

return strcmp($sortA, $sortB);
}

usort($match_player['memberList'], 'comparePlayers');
?>
<div class="page_wrap">
<div class="page">
Expand Down Expand Up @@ -156,7 +165,7 @@ public function get_event_location() {
<div class="icon"><i class="fa-solid fa-user-check"></i></div>
<div class="attendance_check_txt"><p>출석 확인</p></div>
</a>
<a href="../view_control/purchasereq_check?eventId=<?=$event_dto_id?>&memberId=<?=$_SESSION['member_id']?>" class="expenses_check">
<a href="javascript:;" onclick="purchasereq_check()" class="expenses_check">
<div class="icon"><i class="fa-solid fa-hand-holding-dollar"></i></div>
<div class="expenses_check_txt"><p>납부 확인</p></div>
</a>
Expand Down Expand Up @@ -203,11 +212,27 @@ public function get_event_location() {
</div>
</div>
<script>
function loading_page(status) {
if (status) {
$.ajax({
url: '../loading/loading',
method: 'POST',
data: { status: status },
success: function(response) {
document.body.innerHTML += response;
}
});
} else {
const loading = document.getElementById("spinner-wrapper");
loading.parentNode.removeChild(loading);
}
}
function player_check_lity() {
lity('#player_check_lity');
}
function attendance_check() {
if ("geolocation" in navigator) {
loading_page(true);
navigator.geolocation.getCurrentPosition(function(position) {
var latitude = position.coords.latitude; // 위도
var longitude = position.coords.longitude; // 경도
Expand All @@ -216,14 +241,34 @@ function attendance_check() {
method: 'POST',
data: { eventId: <?=$event_dto_id?>, latitude: latitude, longitude: longitude },
success: function(response) {
loading_page(false);
alert(response);
}
});
}, function(error) {
if (error.code === error.PERMISSION_DENIED) {
alert("위치 권한이 거부되었습니다.");
} else {
alert("위치 정보를 가져오는 중 오류가 발생했습니다.");
}
});
} else {
loading_page(false);
alert("위치정보를 지원하지 않는 브라우저입니다.");
}
}
function purchasereq_check() {
loading_page(true);
$.ajax({
url: '../view_control/purchasereq_check',
method: 'POST',
data: { eventId: <?=$event_dto_id?> },
success: function(response) {
loading_page(false);
alert(response);
}
});
}
function matchLocation() {
var address = document.getElementById('match_address_txt').textContent;
var centerCoord = new naver.maps.LatLng(37.5666102, 126.9783881);
Expand Down
Loading

0 comments on commit 6014601

Please sign in to comment.