fix:coach相關改provider

This commit is contained in:
2025-05-12 01:22:09 +08:00
parent 3d7660a24c
commit 125d4bf8d8
10 changed files with 433 additions and 165 deletions
+54 -36
View File
@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CFDive平台 - 管理員與教練註冊測試</title>
<title>CFDive平台 - 管理員與服務提供者註冊測試</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
.container { max-width: 800px; margin-top: 50px; }
@@ -15,14 +15,14 @@
</head>
<body>
<div class="container">
<h1 class="mb-4">CFDive平台 - 管理員與教練註冊測試</h1>
<h1 class="mb-4">CFDive平台 - 管理員與服務提供者註冊測試</h1>
<ul class="nav nav-tabs" id="userTypeTabs" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="admin-tab" data-bs-toggle="tab" data-bs-target="#admin" type="button" role="tab">管理員註冊</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="coach-tab" data-bs-toggle="tab" data-bs-target="#coach" type="button" role="tab">教練註冊</button>
<button class="nav-link" id="provider-tab" data-bs-toggle="tab" data-bs-target="#provider" type="button" role="tab">服務提供者註冊</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="login-tab" data-bs-toggle="tab" data-bs-target="#login" type="button" role="tab">登入</button>
@@ -82,48 +82,63 @@
</div>
<!-- 教練註冊表單 -->
<div class="tab-pane fade" id="coach" role="tabpanel">
<h3>教練註冊</h3>
<form id="coachForm">
<div class="tab-pane fade" id="provider" role="tabpanel">
<h3>服務提供者註冊</h3>
<form id="providerForm">
<div class="row">
<div class="col-md-6">
<label for="coachName" class="form-label">姓名</label>
<input type="text" class="form-control" id="coachName" value="測試教練" required>
<label for="providerName" class="form-label">姓名</label>
<input type="text" class="form-control" id="providerName" value="測試服務提供者" required>
</div>
<div class="col-md-6">
<label for="coachEmail" class="form-label">電子郵件</label>
<input type="email" class="form-control" id="coachEmail" value="coach@example.com" required>
<label for="providerEmail" class="form-label">電子郵件</label>
<input type="email" class="form-control" id="providerEmail" value="provider@example.com" required>
</div>
</div>
<div class="row">
<div class="col-md-6">
<label for="coachPassword" class="form-label">密碼</label>
<input type="password" class="form-control" id="coachPassword" value="Coach123!" required>
<label for="providerPassword" class="form-label">密碼</label>
<input type="password" class="form-control" id="providerPassword" value="Provider123!" required>
</div>
<div class="col-md-6">
<label for="coachPasswordConfirmation" class="form-label">確認密碼</label>
<input type="password" class="form-control" id="coachPasswordConfirmation" value="Coach123!" required>
<label for="providerPasswordConfirmation" class="form-label">確認密碼</label>
<input type="password" class="form-control" id="providerPasswordConfirmation" value="Provider123!" required>
</div>
</div>
<div class="row">
<div class="col-md-4">
<label for="coachPhone" class="form-label">電話</label>
<input type="text" class="form-control" id="coachPhone" value="0987654321">
<label for="providerPhone" class="form-label">電話</label>
<input type="text" class="form-control" id="providerPhone" value="0987654321">
</div>
<div class="col-md-8">
<label for="coachExpertise" class="form-label">專長</label>
<input type="text" class="form-control" id="coachExpertise" value="自由潛水,水肺潛水" required>
<div class="col-md-4">
<label for="businessName" class="form-label">業者名稱</label>
<input type="text" class="form-control" id="businessName" value="藍海潛水中心" required>
</div>
<div class="col-md-4">
<label for="contactPerson" class="form-label">聯絡人</label>
<input type="text" class="form-control" id="contactPerson" value="王大師" required>
</div>
</div>
<div class="row">
<div class="col-md-6">
<label for="contactEmail" class="form-label">聯絡電子郵件</label>
<input type="email" class="form-control" id="contactEmail" value="contact@bluedive.com">
</div>
<div class="col-md-6">
<label for="address" class="form-label">營業地址</label>
<input type="text" class="form-control" id="address" value="台灣屏東縣恆春鎮大路123號">
</div>
</div>
<div class="mb-3">
<label for="coachBio" class="form-label">個人簡介</label>
<textarea class="form-control" id="coachBio" rows="3" required>擁有10年潛水教學經驗,專精於開放水域和洞穴潛水</textarea>
<label for="description" class="form-label">業者描述</label>
<textarea class="form-control" id="description" rows="3" required>專業潛水中心,提供各種潛水服務、潛水行程和潛水課程</textarea>
</div>
<button type="submit" class="btn btn-success">註冊教練</button>
<button type="submit" class="btn btn-success">註冊服務提供者</button>
</form>
</div>
@@ -134,7 +149,7 @@
<div class="col-md-4">
<select class="form-select mb-3" id="loginType">
<option value="admin">管理員</option>
<option value="coach">教練</option>
<option value="provider">服務提供者</option>
<option value="member">會員</option>
</select>
</div>
@@ -159,7 +174,7 @@
<label for="logoutType" class="form-label">用戶類型</label>
<select class="form-select" id="logoutType">
<option value="member">會員</option>
<option value="coach">教練</option>
<option value="provider">服務提供者</option>
<option value="admin">管理員</option>
</select>
</div>
@@ -195,7 +210,7 @@
<div class="tab-pane fade" id="check-user" role="tabpanel">
<h3>查詢會員/教練資料</h3>
<div class="alert alert-info">
<i class="bi bi-info-circle"></i> 此功能為管理員專用,可查詢會員或教練的詳細資料。請先以管理員身份登入才能使用此功能。
<i class="bi bi-info-circle"></i> 此功能為管理員專用,可查詢會員或服務提供者的詳細資料。請先以管理員身份登入才能使用此功能。
</div>
<form id="checkUserForm">
<div class="row mb-3">
@@ -203,7 +218,7 @@
<label for="checkUserType" class="form-label">用戶類型</label>
<select class="form-select" id="checkUserType">
<option value="member">會員</option>
<option value="coach">教練</option>
<option value="provider">服務提供者</option>
</select>
</div>
<div class="col-md-6">
@@ -273,21 +288,24 @@
callApi('/api/admin/register', 'POST', data);
});
// 教練註冊
document.getElementById('coachForm').addEventListener('submit', function(e) {
// 服務提供者註冊
document.getElementById('providerForm').addEventListener('submit', function(e) {
e.preventDefault();
const data = {
name: document.getElementById('coachName').value,
email: document.getElementById('coachEmail').value,
password: document.getElementById('coachPassword').value,
password_confirmation: document.getElementById('coachPasswordConfirmation').value,
phone: document.getElementById('coachPhone').value,
bio: document.getElementById('coachBio').value,
expertise: document.getElementById('coachExpertise').value
name: document.getElementById('providerName').value,
email: document.getElementById('providerEmail').value,
password: document.getElementById('providerPassword').value,
password_confirmation: document.getElementById('providerPasswordConfirmation').value,
phone: document.getElementById('providerPhone').value,
business_name: document.getElementById('businessName').value,
description: document.getElementById('description').value,
contact_person: document.getElementById('contactPerson').value,
contact_email: document.getElementById('contactEmail').value,
address: document.getElementById('address').value
};
callApi('/api/coach/register', 'POST', data);
callApi('/api/provider/register', 'POST', data);
});
// 登入