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

Commit af740f5

Browse files
authored
Merge pull request #28 from archan0621/stage
10월 4주차 스프린트 PR
2 parents 6014601 + 7e4d5b4 commit af740f5

10 files changed

+150
-15
lines changed

admin_data/match_member_data.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,26 @@ function comparePlayers($player1, $player2) {
2828
} elseif ($_POST['func'] == 'list_player') {
2929
if($item['attendance']) {
3030
if ($item['attendance'] == 'LATE') {
31-
$item['attendance'] = '지각';
31+
$item['attendance'] = '<span class="txt_yellow">지각</span>';
3232
} else {
33-
$item['attendance'] = $item['attendance'] == 'ABSENT' ? '미출석' : '출석';
33+
$item['attendance'] = $item['attendance'] == 'ABSENT' ? '<span class="txt_red">미출석</span>' : '<span class="txt_green">출석</span>';
3434
}
3535
} else {
3636
$item['attendance'] = '';
3737
}
3838

3939
if($item['purchaseStatus']) {
4040
if ($item['purchaseStatus'] == 'NOT_PURCHASED') {
41-
$item['purchaseStatus'] = '미납';
41+
$item['purchaseStatus'] = '<span class="txt_red">미납</span>';
4242
} else {
43-
$item['purchaseStatus'] = $item['purchaseStatus'] == 'WAITING' ? '확인 대기중' : '납부 완료';
43+
$item['purchaseStatus'] = $item['purchaseStatus'] == 'WAITING' ? '<span class="txt_yellow">확인 대기중</span>' : '<span class="txt_green">납부 완료</span>';
4444
}
4545
} else {
4646
$item['purchaseStatus'] = '';
4747
}
4848
echo "{$item['memberName']} / {$item['attendance']} / {$item['purchaseStatus']}<br/>";
4949
} elseif ($_POST['func'] == 'expenses_player') {
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/>";
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/></div>";
5151
} else {
5252
echo "데이터를 불러오지 못했습니다.<br/>";
5353
}

admin_view/match_create.php

+24-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,18 @@ function html_body() {
3030
<div class="match_create_wrap">
3131
<form action="../admin_control/match_create" method="post">
3232
<div><p>경기 제목</p><input type="text" name="match_title" id="match_title" class="match_title" placeholder="경기 제목을 입력해주세요"></div>
33-
<div><p>경기 위치</p><input type="text" name="match_location" id="match_location" class="match_location" placeholder="경기 위치를 선택해주세요"></div>
33+
<div>
34+
<p>경기 위치</p>
35+
<div class="admin_match_location_wrap">
36+
<input type="text" name="match_location" id="match_location" class="match_location" placeholder="경기 위치를 입력해주세요">
37+
<select name="match_location_select" id="match_location_select" class="admin_match_location_select" onchange="changeMatchLocation(this)">
38+
<option value="none">직접 입력</option>
39+
<option value="서울시 강남구 도곡동 산21" class="select" id="select">중대부고</option>
40+
<option value="서울 송파구 올림픽로 240 잠실롯데마트 제타플렉스동 R층" class="select" id="select">잠실 로꼬스타디움</option>
41+
<option value="한강로3가 40-999" class="select" id="select">용산 더베이스</option>
42+
</select>
43+
</div>
44+
</div>
3445
<div>
3546
<p>경기 종류</p>
3647
<select name="member_gender" id="member_gender" class="admin_member_gender" onchange="changeGender(this)">
@@ -51,6 +62,18 @@ function html_body() {
5162
</div>
5263
</div>
5364
<script>
65+
const changeMatchLocation = (target) => {
66+
const match_location_select = document.getElementById('match_location_select');
67+
const match_location = document.getElementById('match_location');
68+
if (target.value != 'none') {
69+
match_location_select.classList.add('select_on');
70+
match_location.value = target.value;
71+
} else {
72+
match_location_select.classList.remove('select_on');
73+
match_location.value = '';
74+
}
75+
}
76+
5477
const changeGender = (target) => {
5578
const member_gender = document.getElementById('member_gender');
5679
if (target.value == 'MALE' || target.value == 'FEMALE') {

admin_view/match_detail.php

+23-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,18 @@ function html_body() {
177177
<form action="../admin_control/match_update" method="post">
178178
<input type="hidden" name="match_id" id="match_id" class="match_id" value=<?=$event_info['event_dto_id']?>>
179179
<div><p>경기 제목</p><input type="text" name="match_title" id="match_title" class="match_title" value="<?=$event_info['event_dto_title']?>"></div>
180-
<div><p>경기 위치</p><input type="text" name="match_location" id="match_location" class="match_location" value="<?=$event_info['event_dto_location']?>"></div>
180+
<div>
181+
<p>경기 위치</p>
182+
<div class="admin_match_location_wrap">
183+
<input type="text" name="match_location" id="match_location" class="match_location" value="<?=$event_info['event_dto_location']?>">
184+
<select name="match_location_select" id="match_location_select" class="admin_match_location_select" onchange="changeMatchLocation(this)">
185+
<option value="none">직접 입력</option>
186+
<option value="서울시 강남구 도곡동 산21" class="select" id="select">중대부고</option>
187+
<option value="서울 송파구 올림픽로 240 잠실롯데마트 제타플렉스동 R층" class="select" id="select">잠실 로꼬스타디움</option>
188+
<option value="한강로3가 40-999" class="select" id="select">용산 더베이스</option>
189+
</select>
190+
</div>
191+
</div>
181192
<div>
182193
<p>경기 종류</p>
183194
<select name="member_gender" id="member_gender" class="admin_member_gender">
@@ -195,6 +206,17 @@ function html_body() {
195206
</div>
196207
</div>
197208
<script>
209+
const changeMatchLocation = (target) => {
210+
const match_location_select = document.getElementById('match_location_select');
211+
const match_location = document.getElementById('match_location');
212+
if (target.value != 'none') {
213+
match_location_select.classList.add('select_on');
214+
match_location.value = target.value;
215+
} else {
216+
match_location_select.classList.remove('select_on');
217+
match_location.value = '';
218+
}
219+
}
198220
function add_player() {
199221
$.ajax({
200222
url: '../admin_data/match_member_data.php',

index.php

+15-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ public function get_event_title() {
2222
}
2323
}
2424
}
25+
$id = '';
26+
$pw = '';
27+
$checked = false;
28+
if(isset($_COOKIE['save_login'])) {
29+
$user_data = unserialize($_COOKIE['save_login']);
30+
$id = $user_data['member_id'];
31+
$pw = $user_data['member_pw'];
32+
$checked = true;
33+
}
2534
?>
2635
<div class="page_wrap">
2736
<?php if (isset($_SESSION['member_id'])) { ?>
@@ -82,8 +91,12 @@ public function get_event_title() {
8291
</div>
8392
<div class="login_main">
8493
<form action="view_control/login_control" method="post">
85-
<input type="text" name="member_id" id="member_id" class="m_b_16" placeholder="아이디">
86-
<input type="password" name="member_pw" id="member_pw" class="m_b_16" placeholder="비밀번호">
94+
<input type="text" name="member_id" id="member_id" class="m_b_16" value="<?=$id ?: ''?>" placeholder="아이디">
95+
<input type="password" name="member_pw" id="member_pw" class="m_b_16" value="<?=$pw ?: ''?>" placeholder="비밀번호">
96+
<div class="save_login_wrap">
97+
<input type="checkbox" name="save_login" value="save_login" <?=$checked ? 'checked' : ''?> id="save_login" class="m_b_16">
98+
<label for="save_login">로그인 정보 기억하기</label>
99+
</div>
87100
<button type="submit" class="login_submit">로그인</button>
88101
</form>
89102
</div>

style/admin.css

+10
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,16 @@
9797
font-family: 'Noto Sans KR', sans-serif !important;
9898
text-align: start;
9999
}
100+
.admin_match_location_wrap {
101+
display: flex;
102+
}
103+
.admin_match_location_select {
104+
width: auto;
105+
background: #fff;
106+
font-weight: 400;
107+
padding: 8px;
108+
margin-left: 12px;
109+
}
100110
.admin_member_gender {
101111
background: #fff;
102112
font-weight: 400;

style/color.css

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
.bg_purple {background: #BC00FF;}
22
.bg_white {background: #fff;}
33
.txt_white {color: #fff;}
4-
.txt_gray {color: #9c9c9c;}
4+
.txt_gray {color: #9c9c9c;}
5+
.txt_red {color: #ee495a;}
6+
.txt_green {color: #00bb27;}
7+
.txt_yellow {color: #ffbf00;}

style/style.css

+13
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@
3636
align-items: center;
3737
padding: 0 20px;
3838
}
39+
.save_login_wrap {
40+
width: 100%;
41+
max-width: 460px;
42+
display: flex;
43+
justify-content: flex-start;
44+
align-items: center;
45+
color: #9c9c9c;
46+
font-size: 12px;
47+
}
48+
.save_login_wrap > input {
49+
width: auto;
50+
margin: 0 8px 0 0;
51+
}
3952
.login_submit {
4053
width: 100%;
4154
height: 48px;

view/match.php

+40-5
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ class event_dto {
1717
private $startTime;
1818
private $endTime;
1919
private $location;
20+
private $attend;
21+
private $purchaseStatus;
2022

21-
public function __construct($eventId, $title, $gender, $money, $description, $startTime, $endTime, $location) {
23+
public function __construct($eventId, $title, $gender, $money, $description, $startTime, $endTime, $location, $attend, $purchaseStatus) {
2224
$this->eventId = $eventId;
2325
$this->title = $title;
2426
$this->gender = $gender;
@@ -27,6 +29,8 @@ public function __construct($eventId, $title, $gender, $money, $description, $st
2729
$this->startTime = $startTime;
2830
$this->endTime = $endTime;
2931
$this->location = $location;
32+
$this->attend = $attend;
33+
$this->purchaseStatus = $purchaseStatus;
3034
}
3135
public function get_event_id() {
3236
return $this->eventId;
@@ -81,9 +85,15 @@ public function get_event_endTime() {
8185
public function get_event_location() {
8286
return $this->location;
8387
}
88+
public function get_event_attend() {
89+
return $this->attend;
90+
}
91+
public function get_event_purchaseStatus() {
92+
return $this->purchaseStatus;
93+
}
8494

8595
}
86-
$event_dto = new event_dto($get_event['readResult']['eventId'], $get_event['readResult']['title'], $get_event['readResult']['gender'], $get_event['readResult']['money'], $get_event['readResult']['description'], $get_event['readResult']['startTime'], $get_event['readResult']['endTime'], $get_event['readResult']['location']);
96+
$event_dto = new event_dto($get_event['readResult']['eventId'], $get_event['readResult']['title'], $get_event['readResult']['gender'], $get_event['readResult']['money'], $get_event['readResult']['description'], $get_event['readResult']['startTime'], $get_event['readResult']['endTime'], $get_event['readResult']['location'], $get_event['readResult']['attend'], $get_event['readResult']['purchaseStatus']);
8797
$event_dto_id = $event_dto->get_event_id();
8898
$event_dto_title = $event_dto->get_event_title();
8999
$event_dto_gender = $event_dto->get_event_gender();
@@ -92,6 +102,8 @@ public function get_event_location() {
92102
$event_dto_startTime = $event_dto->get_event_startTime();
93103
$event_dto_endTime = $event_dto->get_event_endTime();
94104
$event_dto_location = $event_dto->get_event_location();
105+
$event_dto_attend = $event_dto->get_event_attend();
106+
$event_dto_purchaseStatus = $event_dto->get_event_purchaseStatus();
95107
if ($event_dto_gender == 'MALE') {
96108
$event_dto_gender = '남자 경기';
97109
} elseif ($event_dto_gender == 'FEMALE') {
@@ -161,13 +173,29 @@ function comparePlayers($player1, $player2) {
161173
</div>
162174
<div class="member_check_wrap">
163175
<div class="member_check">
164-
<a href="javascript:;" onclick="attendance_check()" class="attendance_check">
165-
<div class="icon"><i class="fa-solid fa-user-check"></i></div>
166-
<div class="attendance_check_txt"><p>출석 확인</p></div>
176+
<a href="javascript:;" onclick="attendance_check()" class="attendance_check <?=$event_dto_attend == 'LATE' ? 'attendance_check_late' : ''?>">
177+
<?php if ($event_dto_attend == 'ATTEND') { ?>
178+
<div class="icon"><i class="fa-solid fa-user-check"></i></div>
179+
<div class="attendance_check_txt"><p>출석 완료</p></div>
180+
<?php } elseif ($event_dto_attend == 'LATE') { ?>
181+
<div class="icon"><i class="fa-solid fa-user-clock"></i></div>
182+
<div class="attendance_check_txt"><p>지각 완료</p></div>
183+
<?php } else { ?>
184+
<div class="icon"><i class="fa-solid fa-user-xmark"></i></div>
185+
<div class="attendance_check_txt"><p>출석 확인</p></div>
186+
<?php } ?>
167187
</a>
168188
<a href="javascript:;" onclick="purchasereq_check()" class="expenses_check">
189+
<?php if ($event_dto_purchaseStatus == 'PURCHASED') { ?>
190+
<div class="icon"><i class="fa-solid fa-dollar-sign"></i></div>
191+
<div class="expenses_check_txt"><p>납부 완료</p></div>
192+
<?php } elseif ($event_dto_purchaseStatus == 'WAITING') { ?>
193+
<div class="icon"><i class="fa-solid fa-spinner"></i></div>
194+
<div class="expenses_check_txt"><p>납부 확인중</p></div>
195+
<?php } else { ?>
169196
<div class="icon"><i class="fa-solid fa-hand-holding-dollar"></i></div>
170197
<div class="expenses_check_txt"><p>납부 확인</p></div>
198+
<?php } ?>
171199
</a>
172200
<a href="javascript:;" onclick="player_check_lity();" class="player_check">
173201
<div class="icon"><i class="fa-solid fa-user"></i></div>
@@ -236,13 +264,15 @@ function attendance_check() {
236264
navigator.geolocation.getCurrentPosition(function(position) {
237265
var latitude = position.coords.latitude; // 위도
238266
var longitude = position.coords.longitude; // 경도
267+
console.log('위도 :' + latitude + ' / 경도 : '+ longitude);
239268
$.ajax({
240269
url: '../view_control/attendance_check',
241270
method: 'POST',
242271
data: { eventId: <?=$event_dto_id?>, latitude: latitude, longitude: longitude },
243272
success: function(response) {
244273
loading_page(false);
245274
alert(response);
275+
location.reload();
246276
}
247277
});
248278
}, function(error) {
@@ -251,6 +281,10 @@ function attendance_check() {
251281
} else {
252282
alert("위치 정보를 가져오는 중 오류가 발생했습니다.");
253283
}
284+
},
285+
{
286+
enableHighAccuracy: true,
287+
timeout: Infinity,
254288
});
255289
} else {
256290
loading_page(false);
@@ -266,6 +300,7 @@ function purchasereq_check() {
266300
success: function(response) {
267301
loading_page(false);
268302
alert(response);
303+
location.reload();
269304
}
270305
});
271306
}

view_control/login_control.php

+14
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@
2727
$_SESSION['token'] = $responseData['token'];
2828
$_SESSION['member_id'] = $get_user_name['message'];
2929
$_SESSION['userRole'] = $get_user_name['userRole'];
30+
if (isset($_POST['save_login']) && $_POST['save_login']){
31+
$cookie_name = "save_login";
32+
$user_data = array(
33+
'member_id' => $member_id,
34+
'member_pw' => $member_pw
35+
);
36+
$cookie_value = serialize($user_data);
37+
$expiration_time = time() + 31536000; // 1년
38+
setcookie($cookie_name, $cookie_value, $expiration_time, "/");
39+
} else {
40+
$cookie_name = "save_login";
41+
$expiration_time = time() - 3600; // 현재 시간보다 1시간 이전
42+
setcookie($cookie_name, "", $expiration_time, "/");
43+
}
3044
loading_page(false);
3145
header("Location: /");
3246
} elseif ($get_user_name['result'] == 'fail') {

view_control/signup_control.php

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
echo "<script>alert('아이디를 입력해주세요');history.back();</script>";
88
} elseif (!$_POST['member_pw']) {
99
echo "<script>alert('비밀번호를 입력해주세요');history.back();</script>";
10+
} elseif (!preg_match('/^(?=.*[a-zA-Z0-9])[a-zA-Z0-9!@#$%^&*()-+=]{8,}$/', $_POST['member_pw'])) {
11+
echo "<script>alert('비밀번호는 영어, 숫자를 포함해 8자리 이상이여야 합니다.');history.back();</script>";
1012
} elseif (!$_POST['member_name']) {
1113
echo "<script>alert('이름을 입력해주세요');history.back();</script>";
1214
} elseif (!$_POST['member_mobile']) {

0 commit comments

Comments
 (0)