Files
Student-Management-System-I…/templates/shared/common_modals.html
T
2025-04-22 03:47:31 +05:45

329 lines
11 KiB
HTML

{% load static %}
<style>
/* Modal Base Styles */
.modal-overlay {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 10000;
backdrop-filter: blur(4px);
}
.modal-container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 90%;
max-width: 500px;
background-color: white;
border-radius: 12px;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
overflow: hidden;
}
.modal-header {
background: linear-gradient(135deg, #0D6EFD 0%, #0B5ED7 100%);
color: white;
padding: 16px 24px;
display: flex;
justify-content: space-between;
align-items: center;
}
.modal-title {
margin: 0;
font-size: 18px;
font-weight: 600;
}
.modal-close {
background: none;
border: none;
color: white;
font-size: 24px;
cursor: pointer;
line-height: 24px;
padding: 0;
opacity: 0.8;
transition: opacity 0.2s ease;
}
.modal-close:hover {
opacity: 1;
}
.modal-body {
padding: 24px;
}
.modal-footer {
padding: 16px 24px;
border-top: 1px solid #E9ECEF;
display: flex;
justify-content: flex-end;
gap: 12px;
}
/* Form Styles */
.form-group {
margin-bottom: 20px;
}
.form-label {
display: block;
margin-bottom: 8px;
font-weight: 500;
color: #212529;
}
.form-control {
width: 100%;
padding: 10px 12px;
border: 1px solid #DEE2E6;
border-radius: 6px;
box-sizing: border-box;
font-size: 14px;
transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-control:focus {
border-color: #0D6EFD;
box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
outline: none;
}
textarea.form-control {
resize: vertical;
min-height: 80px;
}
/* Button Styles */
.btn {
padding: 8px 16px;
border-radius: 6px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
border: none;
transition: all 0.2s ease;
}
.btn-primary {
background-color: #0D6EFD;
color: white;
}
.btn-primary:hover {
background-color: #0B5ED7;
}
.btn-secondary {
background-color: #6C757D;
color: white;
}
.btn-secondary:hover {
background-color: #5C636A;
}
/* Profile Picture Styles */
.profile-picture-container {
width: 120px;
height: 120px;
border-radius: 50%;
overflow: hidden;
margin-bottom: 20px;
border: 3px solid #E9ECEF;
}
.profile-picture {
width: 100%;
height: 100%;
object-fit: cover;
}
/* File Input Styles */
.file-input-wrapper {
position: relative;
}
.file-input {
opacity: 0;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
cursor: pointer;
}
.file-input-label {
display: block;
padding: 10px 12px;
background-color: #F8F9FA;
border: 1px dashed #DEE2E6;
border-radius: 6px;
text-align: center;
cursor: pointer;
transition: all 0.2s ease;
}
.file-input-label:hover {
background-color: #E9ECEF;
border-color: #CED4DA;
}
</style>
<!-- Profile Modal -->
<div id="profileModal" class="modal-overlay" onclick="if(event.target === this) closeProfileModal();">
<div class="modal-container">
<div class="modal-header">
<h5 class="modal-title">Update Profile Picture</h5>
<button class="modal-close" onclick="closeProfileModal()">&times;</button>
</div>
<div class="modal-body">
<form action="{% url 'update_profile' %}" method="post" enctype="multipart/form-data">
{% csrf_token %}
<div class="text-center">
{% if user.image %}
<div class="profile-picture-container mx-auto">
<img src="{{ user.image.url }}" alt="{{ user.name }}" class="profile-picture">
</div>
{% else %}
<div class="profile-picture-container mx-auto">
<img src="{% static 'img/user.png' %}" alt="Default User" class="profile-picture">
</div>
{% endif %}
</div>
<div class="form-group">
<label class="form-label">Select New Profile Picture</label>
<div class="file-input-wrapper">
<label class="file-input-label">
<i class="fas fa-cloud-upload-alt me-2"></i>Choose a file...
<input type="file" name="profile_image" required class="file-input">
</label>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" onclick="closeProfileModal()">Cancel</button>
<button type="submit" class="btn btn-primary">Update Picture</button>
</div>
</form>
</div>
</div>
</div>
<!-- Password Change Modal -->
<div id="passwordModal" class="modal-overlay" onclick="if(event.target === this) closePasswordModal();">
<div class="modal-container">
<div class="modal-header">
<h5 class="modal-title">Change Password</h5>
<button class="modal-close" onclick="closePasswordModal()">&times;</button>
</div>
<div class="modal-body">
<form action="{% url 'change_password' %}" method="post">
{% csrf_token %}
<div class="form-group">
<label class="form-label" for="current_password">Current Password</label>
<input type="password" id="current_password" name="current_password" required class="form-control">
</div>
<div class="form-group">
<label class="form-label" for="new_password">New Password</label>
<input type="password" id="new_password" name="new_password" required class="form-control">
</div>
<div class="form-group">
<label class="form-label" for="confirm_password">Confirm New Password</label>
<input type="password" id="confirm_password" name="confirm_password" required class="form-control">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" onclick="closePasswordModal()">Cancel</button>
<button type="submit" class="btn btn-primary">Change Password</button>
</div>
</form>
</div>
</div>
</div>
<!-- Leave Request Modal -->
<div id="customLeaveModal" class="modal-overlay" onclick="if(event.target === this) closeLeaveModal();">
<div class="modal-container">
<div class="modal-header">
<h5 class="modal-title">Request Leave</h5>
<button class="modal-close" onclick="closeLeaveModal()">&times;</button>
</div>
<div class="modal-body">
<form action="{% if user.is_teacher %}{% url 'request_staff_leave' %}{% else %}{% url 'request_leave' %}{% endif %}" method="post">
{% csrf_token %}
<div class="form-group">
<label class="form-label" for="startDate">Start Date</label>
<input type="date" id="startDate" name="start_date" class="form-control" required>
</div>
<div class="form-group">
<label class="form-label" for="endDate">End Date</label>
<input type="date" id="endDate" name="end_date" class="form-control" required>
</div>
<div class="form-group">
<label class="form-label" for="customLeaveMessage">Reason</label>
<textarea id="customLeaveMessage" name="message" rows="3" class="form-control" required></textarea>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" onclick="closeLeaveModal()">Cancel</button>
<button type="submit" class="btn btn-primary">Submit Request</button>
</div>
</form>
</div>
</div>
</div>
<!-- Confirmation Modal -->
<div id="confirmationModal" class="modal-overlay" onclick="if(event.target === this) closeConfirmationModal();">
<div class="modal-container" style="max-width: 400px;">
<div class="modal-header">
<h5 class="modal-title">Confirm Deletion</h5>
<button class="modal-close" onclick="closeConfirmationModal()">&times;</button>
</div>
<div class="modal-body">
<p class="mb-0">Are you sure you want to delete this file? This action cannot be undone.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" onclick="closeConfirmationModal()">Cancel</button>
<button type="button" class="btn btn-primary" id="confirmDeleteBtn">Delete</button>
</div>
</div>
</div>
<!-- Message Modal -->
<div id="messageModal" class="modal-overlay" onclick="if(event.target === this) closeMessageModal();">
<div class="modal-container" style="max-width: 400px;">
<div class="modal-header">
<h5 class="modal-title" id="messageModalTitle">Message</h5>
<button class="modal-close" onclick="closeMessageModal()">&times;</button>
</div>
<div class="modal-body">
<p class="mb-0" id="messageModalContent"></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="closeMessageModal()">OK</button>
</div>
</div>
</div>
<script>
function showMessageModal(title, message) {
document.getElementById('messageModalTitle').textContent = title;
document.getElementById('messageModalContent').textContent = message;
document.getElementById('messageModal').style.display = 'block';
document.body.style.overflow = 'hidden';
}
function closeMessageModal() {
document.getElementById('messageModal').style.display = 'none';
document.body.style.overflow = '';
}
</script>