-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathres_input.html
392 lines (343 loc) · 14.7 KB
/
res_input.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
<!DOCTYPE html>
<html lang="en">
<head>
<title>預約洽詢</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<!-- 自己的css -->
<link href="statics/css/res_input.css" rel="stylesheet" type="text/css">
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous">
</script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous">
</script>
<script src="statics/js/jquery-3.4.1.min.js" crossorigin="anonymous"></script>
</head>
<body>
<header style="box-shadow:3px 3px 5px 2px #cccccc;">
<div class='container'>
<nav class="navbar navbar-expand-lg navbar-fixed-top navbar-light px-5">
<a class="navbar-brand" href="#">
<img src='statics/img/logo.png'>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse px-5" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto px-2">
<li class="nav-item px-2">
<a class="nav-link" href="home.html">首頁</a>
</li>
<li class="nav-item px-2">
<a class="nav-link" href="center.html">會員中心</a>
</li>
<li class="nav-item px-2">
<a class="nav-link" style="color: #ff8800;" href="#">熱門搜尋</a>
</li>
<li class="nav-item dropdown px-3">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
商品清單
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="res_list.html">預約清單</a>
<a class="dropdown-item" href="#">追蹤清單</a>
<a class="dropdown-item" href="#">售屋清單</a>
</div>
</li>
<li class="nav-item px-2">
<a class="nav-link" href="#">常見問題</a>
</li>
<li class="nav-item px-2">
<a class="nav-link" href="#">聯絡我們</a>
</li>
</ul>
</div>
<div class="nav-user-block" style="height: 50px;" onmouseover="switchMenu('MainMenu', 'SubMenu', 'MouseOver')"
onmouseout="hideMenu()">
<div class="nav-user" style="margin-top: 11px;">
<span class="d-none d-lg-block">
<span class="nav-user-wrapper dropdown py-3">
<span class="nav-user-login mr-3">
<span class="main-menu" id="MainMenu" style="display:block;">
<i class="fas fa-user-circle" style="font-size: 1.6em;"></i>
</span>
</span>
<div id="SubMenu" class="dropdown-menu dropdown-origin-width" style="display:none;">
<a class="dropdown-item" href="#" style="color: rgba(0, 0, 0, 0.87);">會員登出</a>
</div>
</span>
</span>
</div>
</div>
</nav>
</div>
</header>
<div>
</div>>
<div class="date-input">
<p class="h3">
預約洽詢
</p>
<p class="form-text text-muted">
如欲更改姓名或電話請至會員中心,且一旦預約即不得刪除僅能更改日期,請確定後再預約
</p>
<div class="form-group">
<label for="">名字</label>
<input type="text" class="form-control" disabled="disabled" id="name" aria-describedby="helpId" value="test">
<small id="helpId" class="form-text text-muted"></small>
</div>
<div class="form-group">
<label for="">電話</label>
<input type="text" class="form-control" disabled="disabled" id="phone" aria-describedby="helpId" value="test123">
<small id="helpId" class="form-text text-muted"></small>
</div>
<div class="form-group">
<label for="">預約日期</label>
<input type="date" class="form-control" id="date" name="date">
<small id="helpId" class="form-text text-muted"></small>
</div>
<div>
<input type="submit" onclick="submit()" class="btn btn-primary" id="submit" value="確認">
</div>
</div>
<footer id="contact" style="background-color: #f4f4f4;">
<div class="container px-0">
<div class="row justify-content-center">
<div class="col-md-12 py-5">
<div class="row">
<div class="col-md-6 d-flex justify-content-around footer-block media">
<div class="footer-box">
<span class="font-weight-bold" style="margin-left: 15px;">相關社群</span>
<div class="footer-content mt-3">
<div class="d-flex justify-content-around">
<a href="https://www.facebook.com/hhhfb" target="_blank">
<div class="footer-media">
<img class="footer-media-item" src="statics/img/facebook.png" alt="fb" width="60" height="60">
</div>
</a>
<a href="https://line.me/ti/p/%40ovs4341s" target="_blank" style="margin-left: 7px;">
<div class="footer-media">
<img class="footer-media-item" src="statics/img/skype.png" alt="skype" width="45" height="45">
</div>
</a>
<a href="https://www.youtube.com/user/gorgeousspace" target="_blank" style="margin-left: 11px;">
<div class="footer-media">
<img class="footer-media-item" src="statics/img/youtube.png" alt="youtube" width="52"
height="52">
</div>
</a>
<a href="https://www.instagram.com/gorgeous_space/" target="_blank">
<div class="footer-media">
<img class="footer-media-item" src="statics/img/instagram.png" alt="ig" width="64" height="49">
</div>
</a>
</div>
</div>
</div>
</div>
<div class="col-md-6 d-flex justify-content-around footer-block">
<div class="footer-box">
<div class="footer-content text-center">
<span class="footer-content-tel">
矮人房屋網免付費諮詢信箱
<a href='mailto:[email protected]' class="text-primary text-photo-color"><i
class="fas fa-envelope-square" style="color:rgb(97, 97, 97);"></i> </a>
</span>
<div class="footer-note mt-3 d-flex justify-content-center px-3">
<div class="px-2 footer-note-item">
<span><a href="/about/contact" target="_blank">聯絡我們</a></span>
</div>
<div class="px-2 footer-note-item">
<span><a href="/about/privacy_policy" target="_blank">隱私保護</a></span>
</div>
<div class="px-2 footer-note-item">
<span><a href="/about" target="_blank">關於本站</a></span>
</div>
</div>
<div class="footer-note mt-2 d-flex px-3">
<div class="px-2 footer-note-item">
<span><a href="/about/timeline" target="_blank">公司歷程</a></span>
</div>
<div class="px-2 footer-note-item">
<span><a href="https://www.104.com.tw/company/d6hr8sg" target="_blank">工作機會</a></span>
</div>
<div class="px-2 footer-note-item">
<span><a href="/about/sitemap" target="_blank">網站地圖</a></span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</footer>
<script type="text/javascript">
//先初始化要用來存放傳值的參數
var members_id = 0;
var product_id = 0;
//執行網頁初始化,先將資料從後端取至前端
init();
//用來初始化網頁的function,從後端提取資料進入前端顯示
function init() {
members_id = getCookie("id");
product_id = getParameterByURL(location.href, "product_id");
// 將資料組成object格式
var data_object = {
"members_id": members_id
};
// 發出GET的AJAX請求
$.ajax({
type: "GET",
url: "/NCU_MIS_SA/api/ReservationInput.do",
data: data_object,
crossDomain: true,
cache: false,
dataType: 'json',
timeout: 5000,
success: function (response) {
//解析JSON檔案
var member_json = response.response['data'];
var unk = member_json['0'];
//提取資料
document.getElementById("name").value = unk.members_name;
document.getElementById("phone").value = unk.members_phone;
$('#flashMessage').html(response.message);
$('#flashMessage').show();
if (response.status == 200) {
updateSQLTable(response.response);
}
},
error: function () {
alert("無法連線到伺服器!");
}
});
}
function submit() {
var date = document.getElementById("date").value;
// 將資料組成Object格式
var inputdata = {
"members_id": members_id,
"reservation_date": date,
"product_id": product_id
};
// 發出POST的AJAX請求
$.ajax({
type: "POST",
url: "/NCU_MIS_SA/api/ReservationInput.do",
data: JSON.stringify(inputdata),
crossDomain: true,
cache: false,
dataType: 'json',
timeout: 5000,
success: function (response) {
alert(response.message);
$('#flashMessage').html(response.message);
$('#flashMessage').show();
if (response.status == 200) {
updateSQLTable(response.response);
}
},
error: function () {
alert("無法連線到伺服器!");
}
});
}
var VisibleMenu = ''; // 記錄目前顯示的子選單的 ID
// 顯示或隱藏子選單
function switchMenu(theMainMenu, theSubMenu, theEvent) {
var SubMenu = document.getElementById(theSubMenu);
var MainMenu = document.getElementById(theMainMenu);
if (SubMenu.style.display == 'none') { // 顯示子選單
SubMenu.style.minWidth = theMainMenu.clientWidth; // 讓子選單的最小寬度與主選單相同 (僅為了美觀)
SubMenu.style.display = 'block';
MainMenu.style.display == 'none';
hideMenu(); // 隱藏子選單
VisibleMenu = theSubMenu;
} else { // 隱藏子選單
if (theEvent != 'MouseOver' || VisibleMenu != theSubMenu) {
SubMenu.style.display = 'none';
MainMenu.style.display == 'block';
VisibleMenu = '';
}
}
}
// 隱藏子選單
function hideMenu() {
if (VisibleMenu != '') {
document.getElementById(VisibleMenu).style.display = 'none';
MainMenu.style.display == 'block';
}
VisibleMenu = '';
}
//登入轉址判斷
function jumpto(id) {
var log = getCookie('logined');
var el = document.getElementById(id);
if (log != 1) {
;
alert("請先完成登入!")
document.location.href = "login.html";
}
}
//讀取cookie值
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i].trim();
if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
}
return "";
}
/**從網址中取得參數
* url:網址
* key:欲取得參數之名稱
*/
function getParameterByURL(url, key) {
if (url.indexOf('?') != -1) {
var output = "";
//在此直接將各自的參數資料切割放進ary中
var ary = url.split('?')[1].split('&');
//此時ary的內容為:
//ary[0] = 'id=U001',ary[1] = 'name=GQSM'
//下迴圈去搜尋每個資料參數
for (i = 0; i <= ary.length - 1; i++) {
//如果資料名稱為id的話那就把他取出來
if (ary[i].split('=')[0] == key)
output = ary[i].split('=')[1];
}
return output;
}
}
function updateSQLTable(data) {
$("#sql_log > tbody").empty();
var time = (data.time / 1000000).toFixed(2);
var table_html = "";
table_html += '<tr>';
table_html += '<td>' + '1' + '</td>';
table_html += '<td>' + data.sql + '</td>';
table_html += '<td style="text-align: right">' + '0' + '</td>';
table_html += '<td style="text-align: right">' + data.row + '</td>';
table_html += '<td style="text-align: right">' + data.row + '</td>';
table_html += '<td style="text-align: right">' + time + '</td>';
table_html += '</tr>';
$("#sql_log > tbody").append(table_html);
$("#sql_summary").html("(default) " + data.row + " queries took " + time + " ms");
};
</script>
</body>
</html>