admin resume and vacancy edit
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1008,9 +1008,19 @@
|
||||
async function loadResume() {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}/resumes/${resumeId}`);
|
||||
if (!response.ok) throw new Error('Резюме не найдено');
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Резюме не найдено');
|
||||
}
|
||||
|
||||
currentResume = await response.json();
|
||||
|
||||
// Отладочный вывод
|
||||
console.log('📥 Загружено резюме:', currentResume);
|
||||
console.log('📌 Теги (сырые):', currentResume.tags);
|
||||
|
||||
renderResume(currentResume);
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error loading resume:', error);
|
||||
document.getElementById('resumeDetail').innerHTML = `
|
||||
@@ -1028,19 +1038,46 @@
|
||||
function renderResume(resume) {
|
||||
const container = document.getElementById('resumeDetail');
|
||||
const token = localStorage.getItem('accessToken');
|
||||
|
||||
const canContact = token && currentUser && currentUser.role === 'employer';
|
||||
const decodedName = decodeHtmlEntities(resume.full_name || '');
|
||||
const decodedPosition = decodeHtmlEntities(resume.desired_position || '');
|
||||
|
||||
// Проверяем и обрабатываем теги (поддержка разных форматов)
|
||||
let tags = [];
|
||||
if (resume.tags) {
|
||||
if (Array.isArray(resume.tags)) {
|
||||
// Если теги приходят как массив объектов или строк
|
||||
tags = resume.tags.map(t => {
|
||||
if (typeof t === 'string') return t;
|
||||
if (t.name) return t.name;
|
||||
return t;
|
||||
});
|
||||
} else if (typeof resume.tags === 'string') {
|
||||
tags = resume.tags.split(',').map(t => t.trim()).filter(t => t);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('📌 Теги для отображения:', tags);
|
||||
|
||||
const experienceHtml = resume.work_experience && resume.work_experience.length > 0
|
||||
? resume.work_experience.map(exp => `
|
||||
<div class="experience-item">
|
||||
<div class="experience-header">
|
||||
<span class="experience-title">${escapeHtml(exp.position)}</span>
|
||||
<span class="experience-period"><i class="far fa-calendar"></i> ${escapeHtml(exp.period || 'Период не указан')}</span>
|
||||
<span class="experience-period">
|
||||
<i class="far fa-calendar"></i> ${escapeHtml(exp.period || 'Период не указан')}
|
||||
</span>
|
||||
</div>
|
||||
<div class="experience-company"><i class="fas fa-building"></i> ${escapeHtml(exp.company)}</div>
|
||||
${exp.description ? `<div class="experience-description"><strong>📋 Обязанности и достижения:</strong><p style="margin-top: 10px;">${escapeHtml(exp.description).replace(/\n/g, '<br>')}</p></div>` : ''}
|
||||
<div class="experience-company">
|
||||
<i class="fas fa-building"></i> ${escapeHtml(exp.company)}
|
||||
</div>
|
||||
${exp.description ? `
|
||||
<div class="experience-description">
|
||||
<strong>📋 Обязанности и достижения:</strong>
|
||||
<p style="margin-top: 10px;">${escapeHtml(exp.description).replace(/\n/g, '<br>')}</p>
|
||||
</div>
|
||||
` : ''}
|
||||
</div>
|
||||
`).join('')
|
||||
: '<p style="color: #4f7092; text-align: center; padding: 20px;">Опыт работы не указан</p>';
|
||||
@@ -1059,7 +1096,9 @@
|
||||
|
||||
container.innerHTML = `
|
||||
<div class="resume-header">
|
||||
<div class="resume-avatar"><i class="fas fa-user"></i></div>
|
||||
<div class="resume-avatar">
|
||||
<i class="fas fa-user"></i>
|
||||
</div>
|
||||
<div class="resume-title">
|
||||
<div class="resume-title-header">
|
||||
<div class="resume-name">${escapeHtml(decodedName)}</div>
|
||||
@@ -1070,7 +1109,9 @@
|
||||
</div>
|
||||
<div class="resume-position">${escapeHtml(decodedPosition)}</div>
|
||||
<div class="resume-stats">
|
||||
<span class="view-counter"><i class="fas fa-eye"></i> ${resume.views || 0} просмотров</span>
|
||||
<span class="view-counter">
|
||||
<i class="fas fa-eye"></i> ${resume.views || 0} просмотров
|
||||
</span>
|
||||
<span><i class="fas fa-calendar"></i> Обновлено: ${new Date(resume.updated_at).toLocaleDateString()}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1078,8 +1119,11 @@
|
||||
|
||||
<div class="resume-salary">${escapeHtml(resume.desired_salary || 'Зарплатные ожидания не указаны')}</div>
|
||||
|
||||
${resume.tags && resume.tags.length > 0 ? `
|
||||
<div class="resume-tags">${resume.tags.map(t => `<span class="tag">${escapeHtml(t.name)}</span>`).join('')}</div>
|
||||
<!-- Блок с тегами - исправленное отображение -->
|
||||
${tags && tags.length > 0 ? `
|
||||
<div class="resume-tags">
|
||||
${tags.map(t => `<span class="tag">${escapeHtml(t)}</span>`).join('')}
|
||||
</div>
|
||||
` : ''}
|
||||
|
||||
<h2 class="section-title">О себе</h2>
|
||||
@@ -1093,25 +1137,50 @@
|
||||
|
||||
<div class="contact-section">
|
||||
<h3 style="color: #0b1c34; margin-bottom: 20px;">Контактная информация</h3>
|
||||
|
||||
${canContact ? `
|
||||
<div class="contact-grid">
|
||||
<div class="contact-item"><i class="fas fa-envelope"></i><span>${escapeHtml(resume.email || 'Email не указан')}</span></div>
|
||||
<div class="contact-item"><i class="fas fa-phone"></i><span>${escapeHtml(resume.phone || 'Телефон не указан')}</span></div>
|
||||
<div class="contact-item"><i class="fab fa-telegram"></i><span>${escapeHtml(resume.telegram || 'Telegram не указан')}</span></div>
|
||||
<div class="contact-item">
|
||||
<i class="fas fa-envelope"></i>
|
||||
<span>${escapeHtml(resume.email || 'Email не указан')}</span>
|
||||
</div>
|
||||
<div class="contact-item">
|
||||
<i class="fas fa-phone"></i>
|
||||
<span>${escapeHtml(resume.phone || 'Телефон не указан')}</span>
|
||||
</div>
|
||||
<div class="contact-item">
|
||||
<i class="fab fa-telegram"></i>
|
||||
<span>${escapeHtml(resume.telegram || 'Telegram не указан')}</span>
|
||||
</div>
|
||||
</div>
|
||||
` : `
|
||||
<div style="text-align: center; padding: 30px; background: white; border-radius: 20px;">
|
||||
<i class="fas fa-lock" style="font-size: 48px; color: #4f7092; margin-bottom: 15px;"></i>
|
||||
<p style="color: #1f3f60; margin-bottom: 20px;">Контактные данные доступны только авторизованным работодателям</p>
|
||||
${!token ? '<a href="/login" class="btn btn-primary">Войти как работодатель</a>' : '<p class="btn btn-primary" style="opacity: 0.6;">Только для работодателей</p>'}
|
||||
<p style="color: #1f3f60; margin-bottom: 20px;">
|
||||
Контактные данные доступны только авторизованным работодателям
|
||||
</p>
|
||||
${!token ?
|
||||
'<a href="/login" class="btn btn-primary">Войти как работодатель</a>' :
|
||||
'<p class="btn btn-primary" style="opacity: 0.6;">Только для работодателей</p>'
|
||||
}
|
||||
</div>
|
||||
`}
|
||||
</div>
|
||||
|
||||
<div class="action-buttons">
|
||||
${canContact ? `<button class="btn btn-primary" onclick="contactCandidate()"><i class="fas fa-paper-plane"></i> Связаться</button>` : ''}
|
||||
<button class="btn btn-outline" onclick="saveToFavorites()"><i class="fas fa-heart"></i> В избранное</button>
|
||||
<button class="btn btn-outline" onclick="shareResume()"><i class="fas fa-share-alt"></i> Поделиться</button>
|
||||
${canContact ? `
|
||||
<button class="btn btn-primary" onclick="contactCandidate()">
|
||||
<i class="fas fa-paper-plane"></i> Связаться
|
||||
</button>
|
||||
` : ''}
|
||||
|
||||
<button class="btn btn-outline" onclick="saveToFavorites()">
|
||||
<i class="fas fa-heart"></i> В избранное
|
||||
</button>
|
||||
|
||||
<button class="btn btn-outline" onclick="shareResume()">
|
||||
<i class="fas fa-share-alt"></i> Поделиться
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user