Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved functionlality of appointment form #777

Merged
merged 2 commits into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 22 additions & 17 deletions Html-Files/appointScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,27 @@ document.addEventListener("DOMContentLoaded", function() {
});

window.previewAppointment = function() {
const formData = new FormData(appointmentForm);

let details = `
<strong>Doctor:</strong> ${formData.get('doctor')}<br>
<strong>Date:</strong> ${formData.get('date')}<br>
<strong>Time:</strong> ${formData.get('time-slot')}<br>
<strong>Name:</strong> ${formData.get('full-name')}<br>
<strong>Date of Birth:</strong> ${formData.get('dob')}<br>
<strong>Email:</strong> ${formData.get('email')}<br>
<strong>Phone:</strong> ${formData.get('phone')}<br>
<strong>Reason for Visit:</strong> ${formData.get('reason')}<br>
<strong>Existing Patient:</strong> ${formData.get('existing-patient') ? 'Yes' : 'No'}<br>
<strong>Patient ID:</strong> ${formData.get('patient-id')}
`;
previewDetails.innerHTML = details;
previewSection.style.display = 'block';
appointmentForm.style.display = 'none';
if (appointmentForm.checkValidity()) {
const formData = new FormData(appointmentForm);

let details = `
<strong>Doctor:</strong> ${formData.get('doctor')}<br>
<strong>Date:</strong> ${formData.get('date')}<br>
<strong>Time:</strong> ${formData.get('time-slot')}<br>
<strong>Name:</strong> ${formData.get('full-name')}<br>
<strong>Date of Birth:</strong> ${formData.get('dob')}<br>
<strong>Email:</strong> ${formData.get('email')}<br>
<strong>Phone:</strong> ${formData.get('phone')}<br>
<strong>Reason for Visit:</strong> ${formData.get('reason')}<br>
<strong>Existing Patient:</strong> ${formData.get('existing-patient') ? 'Yes' : 'No'}<br>
<strong>Patient ID:</strong> ${formData.get('patient-id')}
`;
previewDetails.innerHTML = details;
previewSection.style.display = 'block';
appointmentForm.style.display = 'none';
} else {
appointmentForm.reportValidity();
}
};

window.confirmAppointment = function() {
Expand All @@ -48,3 +52,4 @@ document.addEventListener("DOMContentLoaded", function() {
appointmentForm.style.display = 'block';
};
});

3 changes: 1 addition & 2 deletions Html-Files/appointment.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ <h1>Book an Appointment</h1>
<option value="doctor2">Dr. Ajay Aggarwal - Cardiologist</option>
<option value="doctor3">Dr. Soni Gupta - Dermatologist</option>
<option value="doctor4">Dr. Jayant Jaswal - ENT Specialist</option>

</select>
</div>

Expand Down Expand Up @@ -57,7 +56,7 @@ <h1>Book an Appointment</h1>
<input type="tel" id="phone" name="phone" required>

<label for="reason">Reason for Visit:</label>
<textarea id="reason" name="reason"></textarea>
<textarea id="reason" name="reason" required></textarea>

<label>
<input type="checkbox" name="existing-patient" id="existing-patient">
Expand Down