resumebuilder / templates /create_profile_summary.html
sakthi07's picture
pushing to hugging face
ab028ac
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Profile Summary - AI Resume Builder</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
body {
background-color: #f8f9fa;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.form-container {
max-width: 800px;
margin: 40px auto;
padding: 30px;
background: white;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.section-title {
color: #2c3e50;
margin-bottom: 30px;
text-align: center;
font-weight: 600;
}
.btn-logout {
position: absolute;
top: 20px;
right: 20px;
}
.form-label {
font-weight: 500;
margin-bottom: 8px;
color: #495057;
}
.form-control:focus {
border-color: #4e73df;
box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}
.navigation-buttons {
display: flex;
justify-content: space-between;
margin-top: 30px;
padding-top: 20px;
border-top: 1px solid #e9ecef;
}
.error-message {
color: #e74c3c;
font-size: 0.875rem;
margin-top: 5px;
}
.progress-indicator {
margin-bottom: 30px;
text-align: center;
color: #6c757d;
font-size: 0.9rem;
}
.progress-indicator span {
display: inline-block;
margin: 0 10px;
}
.progress-indicator span.active {
color: #4e73df;
font-weight: 600;
}
.ai-generation-section {
background-color: #f8f9fa;
padding: 20px;
border-radius: 8px;
margin-top: 20px;
}
.ai-generation-section h5 {
color: #4e73df;
margin-bottom: 15px;
}
.btn-generate-ai {
background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
border: none;
color: white;
padding: 10px 20px;
border-radius: 5px;
transition: all 0.3s;
}
.btn-generate-ai:hover {
background: linear-gradient(135deg, #224abe 0%, #1a2d8a 100%);
color: white;
}
.btn-generate-ai:disabled {
background: #6c757d;
cursor: not-allowed;
}
.loading-spinner {
display: none;
margin-left: 10px;
}
.ai-generated-label {
background-color: #d4edda;
color: #155724;
padding: 5px 10px;
border-radius: 4px;
font-size: 0.875rem;
margin-top: 10px;
display: none;
}
textarea.form-control {
min-height: 150px;
resize: vertical;
}
.help-text {
font-size: 0.875rem;
color: #6c757d;
margin-top: 5px;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
<a class="navbar-brand" href="{{ url_for('profile') }}">AI Resume Builder</a>
<div class="ms-auto">
<a href="{{ url_for('logout') }}" class="btn btn-outline-light">
<i class="fas fa-sign-out-alt"></i> Logout
</a>
</div>
</div>
</nav>
<div class="container">
<div class="form-container">
<div class="progress-indicator">
<span>Introduction</span>
<span></span>
<span class="active">Profile Summary</span>
<span></span>
<span>Work Experience</span>
<span></span>
<span>Projects</span>
<span></span>
<span>Education</span>
<span></span>
<span>Skills</span>
<span></span>
<span>Achievements</span>
<span></span>
<span>Preview</span>
</div>
<h2 class="section-title">Profile Summary</h2>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
{{ message }}
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
{% endfor %}
{% endif %}
{% endwith %}
<form method="POST" action="{{ url_for('create_profile_summary') }}" id="profileSummaryForm">
<div class="mb-3">
<label for="summary" class="form-label">Profile Summary</label>
<textarea class="form-control" id="summary" name="summary" rows="6" placeholder="Write a brief summary about yourself...">{{ form_data.summary if form_data }}</textarea>
<div class="help-text">
Write a concise summary of your professional background, skills, and career goals (2-4 paragraphs).
</div>
{% if form_errors.summary %}
<div class="error-message">{{ form_errors.summary[0] }}</div>
{% endif %}
</div>
<div class="ai-generation-section">
<h5><i class="fas fa-magic"></i> Generate with AI</h5>
<p class="text-muted mb-3">
Let AI help you create a compelling profile summary based on your introduction.
The AI will generate a professional summary that highlights your strengths.
</p>
<button type="button" class="btn btn-generate-ai" id="generateAIBtn" onclick="generateAISummary()">
<i class="fas fa-wand-magic-sparkles"></i> Generate Profile Summary with AI
<span class="spinner-border spinner-border-sm loading-spinner" id="aiLoading" role="status" aria-hidden="true"></span>
</button>
<div class="ai-generated-label" id="aiGeneratedLabel">
<i class="fas fa-check-circle"></i> AI-generated summary
</div>
</div>
<div class="navigation-buttons">
<div>
<a href="{{ url_for('create_introduction') }}" class="btn btn-outline-secondary">
<i class="fas fa-arrow-left"></i> Back
</a>
</div>
<div>
<button type="submit" class="btn btn-primary">
Next <i class="fas fa-arrow-right"></i>
</button>
</div>
</div>
</form>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script>
function generateAISummary() {
const btn = document.getElementById('generateAIBtn');
const loading = document.getElementById('aiLoading');
const aiLabel = document.getElementById('aiGeneratedLabel');
const summaryTextarea = document.getElementById('summary');
btn.disabled = true;
loading.style.display = 'inline-block';
aiLabel.style.display = 'none';
fetch('/profile/create/generate-summary', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': '{{ csrf_token() if csrf_token else "" }}'
},
credentials: 'same-origin'
})
.then(response => response.json())
.then(data => {
if (data.success) {
summaryTextarea.value = data.summary;
aiLabel.style.display = 'block';
// Show success message
const alertDiv = document.createElement('div');
alertDiv.className = 'alert alert-success alert-dismissible fade show mt-3';
alertDiv.innerHTML = `
${data.message}
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
`;
document.querySelector('.ai-generation-section').appendChild(alertDiv);
} else {
// Show error message
const alertDiv = document.createElement('div');
alertDiv.className = 'alert alert-danger alert-dismissible fade show mt-3';
alertDiv.innerHTML = `
${data.message}
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
`;
document.querySelector('.ai-generation-section').appendChild(alertDiv);
}
})
.catch(error => {
console.error('Error:', error);
// Show error message
const alertDiv = document.createElement('div');
alertDiv.className = 'alert alert-danger alert-dismissible fade show mt-3';
alertDiv.innerHTML = `
Failed to generate summary. Please try again.
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
`;
document.querySelector('.ai-generation-section').appendChild(alertDiv);
})
.finally(() => {
btn.disabled = false;
loading.style.display = 'none';
});
}
</script>
</body>
</html>