Initial
This commit is contained in:
@@ -0,0 +1,241 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Create Timer</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
}
|
||||
.banner {
|
||||
width: 100%;
|
||||
background-color: #f1f1f1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 20px;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
position: relative;
|
||||
}
|
||||
.banner img {
|
||||
max-height: 200px;
|
||||
}
|
||||
.menu-button {
|
||||
background: none;
|
||||
border: none;
|
||||
font-size: 24px;
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 20px;
|
||||
}
|
||||
.drawer {
|
||||
width: 250px;
|
||||
background-color: #f9f9f9;
|
||||
color: black;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: -250px;
|
||||
transition: left 0.3s;
|
||||
z-index: 1000;
|
||||
}
|
||||
.drawer.open {
|
||||
left: 0;
|
||||
}
|
||||
.drawer-header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 15px;
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
.drawer-header img {
|
||||
max-height: 200px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.drawer-header button {
|
||||
background: none;
|
||||
border: none;
|
||||
color: black;
|
||||
font-size: 24px;
|
||||
cursor: pointer;
|
||||
align-self: flex-end;
|
||||
}
|
||||
.drawer-content {
|
||||
padding: 20px;
|
||||
}
|
||||
.drawer-content a {
|
||||
display: block;
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
padding: 10px 0;
|
||||
border-bottom: 1px solid #007BFF;
|
||||
}
|
||||
.main-header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 15px;
|
||||
width: 100%;
|
||||
}
|
||||
.main-content.open {
|
||||
margin-left: 250px;
|
||||
}
|
||||
.main-header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 15px;
|
||||
width: 100%;
|
||||
}
|
||||
.main-header img {
|
||||
max-height: 200px;
|
||||
}
|
||||
.main-header h1 {
|
||||
margin: 10px 0;
|
||||
}
|
||||
.content {
|
||||
padding: 20px;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
text-align: center;
|
||||
}
|
||||
.form-group {
|
||||
margin-bottom: 15px;
|
||||
text-align: center;
|
||||
}
|
||||
.form-group label {
|
||||
display: block;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.form-group input {
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.form-group button {
|
||||
padding: 10px 20px;
|
||||
background-color: #007BFF;
|
||||
color: white;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
border-radius: 5px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="banner">
|
||||
<button class="menu-button" onclick="toggleDrawer()">☰</button>
|
||||
</div>
|
||||
<div class="drawer" id="drawer">
|
||||
<div class="drawer-header">
|
||||
<img src="VitLogo.png" alt="Logo">
|
||||
<button onclick="toggleDrawer()">✕</button>
|
||||
</div>
|
||||
<div class="drawer-content">
|
||||
<a href="/dashboard.html">Dashboard</a>
|
||||
<a href="/upload.html">Upload Video</a>
|
||||
<a href="/videos.html">Manage Videos</a>
|
||||
<a href="/create-workout.html">Create Workout</a>
|
||||
<a href="/workouts.html">Manage Workouts</a>
|
||||
<a href="/create-crossfit-workout.html">Create CrossFit Workout</a>
|
||||
<a href="/crossfit-workouts.html">Manage CrossFit Workouts</a>
|
||||
<a href="/categories.html">Manage Categories</a>
|
||||
<a href="/manage-timers.html">Manage Timers</a>
|
||||
<a href="/create-timer.html">Create Timer</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="main-content" id="main-content">
|
||||
<div class="main-header">
|
||||
<img src="VitLogo.png" alt="Logo">
|
||||
<h1>Create Timer</h1>
|
||||
</div>
|
||||
<div class="content">
|
||||
<form id="createTimerForm">
|
||||
<div class="form-group">
|
||||
<label for="totalTime">Total Workout Time (seconds)</label>
|
||||
<input type="number" id="totalTime" name="totalTime" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="setTime">Set Time (seconds)</label>
|
||||
<input type="number" id="setTime" name="setTime" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="restTime">Rest Time (seconds)</label>
|
||||
<input type="number" id="restTime" name="restTime" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="moveTime">Transition Time (seconds)</label>
|
||||
<input type="number" id="moveTime" name="moveTime" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="setCount">Number of Sets</label>
|
||||
<input type="number" id="setCount" name="setCount" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="exerciseCount">Number of Exercises</label>
|
||||
<input type="number" id="exerciseCount" name="exerciseCount" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="lapCount">Number of Laps</label>
|
||||
<input type="number" id="lapCount" name="lapCount" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit">Create Timer</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
const drawer = document.getElementById('drawer');
|
||||
const mainContent = document.getElementById('main-content');
|
||||
|
||||
function toggleDrawer() {
|
||||
drawer.classList.toggle('open');
|
||||
mainContent.classList.toggle('open');
|
||||
}
|
||||
|
||||
document.getElementById('createTimerForm').addEventListener('submit', async function (event) {
|
||||
event.preventDefault();
|
||||
const formData = new FormData(this);
|
||||
const timerData = {
|
||||
totalTime: formData.get('totalTime'),
|
||||
setTime: formData.get('setTime'),
|
||||
restTime: formData.get('restTime'),
|
||||
moveTime: formData.get('moveTime'),
|
||||
setCount: formData.get('setCount'),
|
||||
exerciseCount: formData.get('exerciseCount'),
|
||||
lapCount: formData.get('lapCount')
|
||||
};
|
||||
console.log('Timer Data:', timerData);
|
||||
try {
|
||||
const response = await fetch('/create-timer', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': `Bearer ${localStorage.getItem('token')}`,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(timerData)
|
||||
});
|
||||
if (!response.ok) throw new Error('Failed to create timer');
|
||||
|
||||
console.log('Timer created successfully');
|
||||
window.location.href = '/manage-timers.html';
|
||||
} catch (error) {
|
||||
console.error('Error creating timer:', error);
|
||||
alert('Failed to create timer');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user