Spaces:
Running

undefined / appointment.html
kudalkarpratham's picture
Can you make this webite working
158b74b verified
Raw History Blame Contribute Delete
12 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Book Appointment - AccountantPro</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<style>
.calendar-day:hover:not(.selected) {
background-color: #f3f4f6;
}
.selected {
background-color: #3b82f6;
color: white;
}
</style>
</head>
<body class="font-roboto bg-gray-50 min-h-screen">
<div class="flex flex-col md:flex-row min-h-screen">
<!-- Sidebar Navigation -->
<div class="bg-white shadow-md md:w-64 md:min-h-screen p-6">
<div class="flex items-center space-x-2 mb-8">
<i data-feather="columns" class="text-blue-600 w-6 h-6"></i>
<span class="text-xl font-bold text-gray-800">AccountantPro</span>
</div>
<nav class="space-y-4">
<a href="dashboard.html" class="flex items-center space-x-3 text-gray-600 hover:text-blue-600 transition">
<i data-feather="home" class="w-5 h-5"></i>
<span>Dashboard</span>
</a>
<a href="#" class="flex items-center space-x-3 text-gray-600 hover:text-blue-600 transition">
<i data-feather="users" class="w-5 h-5"></i>
<span>Clients</span>
</a>
<a href="#" class="flex items-center space-x-3 text-blue-600 transition">
<i data-feather="calendar" class="w-5 h-5"></i>
<span>Appointments</span>
</a>
<a href="documents.html" class="flex items-center space-x-3 text-gray-600 hover:text-blue-600 transition">
<i data-feather="file" class="w-5 h-5"></i>
<span>Documents</span>
</a>
<a href="#" class="flex items-center space-x-3 text-gray-600 hover:text-blue-600 transition">
<i data-feather="credit-card" class="w-5 h-5"></i>
<span>Billing</span>
</a>
<a href="#" class="flex items-center space-x-3 text-gray-600 hover:text-blue-600 transition">
<i data-feather="settings" class="w-5 h-5"></i>
<span>Settings</span>
</a>
<a href="#" class="flex items-center space-x-3 text-gray-600 hover:text-blue-600 transition">
<i data-feather="help-circle" class="w-5 h-5"></i>
<span>Help</span>
</a>
</nav>
</div>
<!-- Main Content -->
<div class="flex-1 p-6">
<div class="max-w-4xl mx-auto">
<h1 class="text-3xl font-bold text-gray-800 mb-8">Book Appointment</h1>
<div class="bg-white rounded-xl shadow-md p-6 mb-6">
<div class="flex items-center justify-between mb-6">
<button class="p-2 rounded-lg hover:bg-gray-100 transition">
<i data-feather="chevron-left" class="w-5 h-5 text-gray-600"></i>
</button>
<h2 class="text-xl font-semibold text-gray-800">July 2024</h2>
<button class="p-2 rounded-lg hover:bg-gray-100 transition">
<i data-feather="chevron-right" class="w-5 h-5 text-gray-600"></i>
</button>
</div>
<div class="grid grid-cols-7 gap-2 mb-4">
<div class="text-center text-gray-500 font-medium py-2">S</div>
<div class="text-center text-gray-500 font-medium py-2">M</div>
<div class="text-center text-gray-500 font-medium py-2">T</div>
<div class="text-center text-gray-500 font-medium py-2">W</div>
<div class="text-center text-gray-500 font-medium py-2">T</div>
<div class="text-center text-gray-500 font-medium py-2">F</div>
<div class="text-center text-gray-500 font-medium py-2">S</div>
</div>
<div class="grid grid-cols-7 gap-2" id="calendar-grid">
<!-- Calendar days will be populated by JavaScript -->
</div>
</div>
<div class="bg-white rounded-xl shadow-md p-6">
<h3 class="text-xl font-semibold text-gray-800 mb-4" id="selected-date-title">Available Times for July 5, 2024</h3>
<div class="grid grid-cols-2 md:grid-cols-3 gap-3 mb-6" id="time-slots">
<button class="border border-blue-200 text-blue-600 rounded-full py-2 px-4 hover:bg-blue-50 transition">9:00 AM</button>
<button class="border border-blue-200 text-blue-600 rounded-full py-2 px-4 hover:bg-blue-50 transition">10:00 AM</button>
<button class="border border-blue-200 text-blue-600 rounded-full py-2 px-4 hover:bg-blue-50 transition">11:00 AM</button>
<button class="border border-blue-200 text-blue-600 rounded-full py-2 px-4 hover:bg-blue-50 transition">1:00 PM</button>
<button class="border border-blue-200 text-blue-600 rounded-full py-2 px-4 hover:bg-blue-50 transition">2:00 PM</button>
<button class="border border-blue-200 text-blue-600 rounded-full py-2 px-4 hover:bg-blue-50 transition">3:00 PM</button>
</div>
<button class="w-full bg-blue-600 hover:bg-blue-700 text-white py-3 rounded-full transition font-medium">
Confirm Appointment
</button>
</div>
</div>
</div>
</div>
<script>
feather.replace();
// Calendar functionality
document.addEventListener('DOMContentLoaded', function() {
const calendarGrid = document.getElementById('calendar-grid');
const selectedDateTitle = document.getElementById('selected-date-title');
let selectedDate = 5; // Default selected date
// Generate calendar days for July 2024
function generateCalendar() {
calendarGrid.innerHTML = '';
// July 2024 starts on Monday (1 = Monday)
const startingDay = 1;
const daysInMonth = 31;
// Add empty cells for days before the 1st
for (let i = 0; i < startingDay; i++) {
const emptyCell = document.createElement('div');
emptyCell.className = 'h-10';
calendarGrid.appendChild(emptyCell);
}
// Add days 1-31
for (let day = 1; day <= daysInMonth; day++) {
const dayCell = document.createElement('button');
dayCell.className = `calendar-day h-10 rounded-full flex items-center justify-center text-gray-800 font-medium transition ${
day === selectedDate ? 'selected' : ''
}`;
dayCell.textContent = day;
dayCell.addEventListener('click', () => {
document.querySelectorAll('.calendar-day').forEach(cell => {
cell.classList.remove('selected');
});
dayCell.classList.add('selected');
selectedDate = day;
updateAvailableTimes();
});
calendarGrid.appendChild(dayCell);
}
}
function updateAvailableTimes() {
selectedDateTitle.textContent = `Available Times for July ${selectedDate}, 2024`;
// For demo purposes, only show times for July 5th
if (selectedDate === 5) {
document.getElementById('time-slots').innerHTML = `
<button class="border border-blue-200 text-blue-600 rounded-full py-2 px-4 hover:bg-blue-50 transition">9:00 AM</button>
<button class="border border-blue-200 text-blue-600 rounded-full py-2 px-4 hover:bg-blue-50 transition">10:00 AM</button>
<button class="border border-blue-200 text-blue-600 rounded-full py-2 px-4 hover:bg-blue-50 transition">11:00 AM</button>
<button class="border border-blue-200 text-blue-600 rounded-full py-2 px-4 hover:bg-blue-50 transition">1:00 PM</button>
<button class="border border-blue-200 text-blue-600 rounded-full py-2 px-4 hover:bg-blue-50 transition">2:00 PM</button>
<button class="border border-blue-200 text-blue-600 rounded-full py-2 px-4 hover:bg-blue-50 transition">3:00 PM</button>
`;
} else {
document.getElementById('time-slots').innerHTML = `
<div class="col-span-3 text-center text-gray-500 py-4">
No available times for this date
</div>
`;
}
}
generateCalendar();
updateAvailableTimes();
// Add appointment confirmation functionality
document.querySelector('button[class*="bg-blue-600"]').addEventListener('click', function() {
const selectedTime = document.querySelector('#time-slots button[class*="bg-blue-600"]');
if (!selectedTime) {
alert('Please select a time slot');
return;
}
fetch('https://jsonplaceholder.typicode.com/posts', {
method: 'POST',
body: JSON.stringify({
date: `July ${selectedDate}, 2024`,
time: selectedTime.textContent,
status: 'confirmed'
}),
headers: {
'Content-type': 'application/json; charset=UTF-8',
},
})
.then(response => response.json())
.then(data => {
alert(`Appointment confirmed for July ${selectedDate}, 2024 at ${selectedTime.textContent}`);
window.location.href = 'dashboard.html';
})
.catch(error => {
console.error('Error:', error);
alert('There was an error confirming your appointment');
});
});
// Add time slot selection
document.getElementById('time-slots').addEventListener('click', function(e) {
if (e.target.tagName === 'BUTTON') {
document.querySelectorAll('#time-slots button').forEach(btn => {
btn.classList.remove('bg-blue-600', 'text-white');
btn.classList.add('border-blue-200', 'text-blue-600');
});
e.target.classList.remove('border-blue-200', 'text-blue-600');
e.target.classList.add('bg-blue-600', 'text-white');
}
});
});
</body>
</html>