129 lines
7.3 KiB
HTML
129 lines
7.3 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}Profile - DocuPulse{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="container mx-auto px-4 py-6">
|
|
<div class="max-w-3xl mx-auto">
|
|
{% with messages = get_flashed_messages(with_categories=true) %}
|
|
{% if messages %}
|
|
{% for category, message in messages %}
|
|
<div class="mb-3 p-3 rounded-lg {% if category == 'error' %}bg-red-100 text-red-700{% else %}bg-green-100 text-green-700{% endif %}">
|
|
{{ message }}
|
|
</div>
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endwith %}
|
|
|
|
<form method="POST" enctype="multipart/form-data" class="bg-white rounded-lg shadow overflow-hidden">
|
|
<!-- Profile Picture Section -->
|
|
<div class="p-4 border-b border-gray-200">
|
|
<h2 class="text-lg font-medium text-gray-900 mb-3">Profile Picture</h2>
|
|
<div class="flex flex-col items-center">
|
|
<div class="relative group flex flex-col items-center">
|
|
<label for="profile_picture" class="cursor-pointer">
|
|
<img id="avatarPreview" src="{{ url_for('profile_pic', filename=current_user.profile_picture) if current_user.profile_picture else url_for('static', filename='default-avatar.png') }}" alt="Profile Picture" class="w-32 h-32 rounded-full object-cover border-4 border-gray-200 mb-0 transition duration-200 group-hover:opacity-80 group-hover:ring-4 group-hover:ring-primary-200 shadow-sm">
|
|
<input id="profile_picture" type="file" name="profile_picture" accept="image/*" class="hidden" onchange="previewAvatar(event)" />
|
|
</label>
|
|
{% if current_user.profile_picture %}
|
|
<button type="submit" name="remove_picture" value="1" class="mt-2 text-xs px-3 py-1 rounded bg-red-100 text-red-700 border border-red-200 hover:bg-red-200 transition">Remove Picture</button>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Personal Information Section -->
|
|
<div class="p-4 border-b border-gray-200">
|
|
<h2 class="text-lg font-medium text-gray-900 mb-3">Personal Information</h2>
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">First Name</label>
|
|
<input type="text" name="first_name" value="{{ current_user.username }}"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Last Name</label>
|
|
<input type="text" name="last_name" value="{{ current_user.last_name }}"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Email</label>
|
|
<input type="email" name="email" value="{{ current_user.email }}"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Phone</label>
|
|
<input type="tel" name="phone" value="{{ current_user.phone or '' }}"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Professional Information Section -->
|
|
<div class="p-4 border-b border-gray-200">
|
|
<h2 class="text-lg font-medium text-gray-900 mb-3">Professional Information</h2>
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Company</label>
|
|
<input type="text" name="company" value="{{ current_user.company or '' }}"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Position</label>
|
|
<input type="text" name="position" value="{{ current_user.position or '' }}"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
</div>
|
|
</div>
|
|
<div class="mt-4">
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Notes</label>
|
|
<textarea name="notes" rows="4"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">{{ current_user.notes or '' }}</textarea>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Password Change Section -->
|
|
<div class="p-4 border-b border-gray-200">
|
|
<h2 class="text-lg font-medium text-gray-900 mb-3">Change Password</h2>
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">New Password</label>
|
|
<input type="password" name="new_password"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Confirm New Password</label>
|
|
<input type="password" name="confirm_password"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Submit Button -->
|
|
<div class="p-4 bg-gray-50">
|
|
<div class="flex justify-end">
|
|
<button type="submit"
|
|
class="text-white px-6 py-2 rounded-lg transition duration-200"
|
|
style="background-color: #16767b; border: 1px solid #16767b;"
|
|
onmouseover="this.style.backgroundColor='#1a8a90'"
|
|
onmouseout="this.style.backgroundColor='#16767b'">
|
|
Save Changes
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function previewAvatar(event) {
|
|
const [file] = event.target.files;
|
|
if (file) {
|
|
const reader = new FileReader();
|
|
reader.onload = function(e) {
|
|
document.getElementById('avatarPreview').src = e.target.result;
|
|
};
|
|
reader.readAsDataURL(file);
|
|
}
|
|
}
|
|
</script>
|
|
{% endblock %} |