From 1dac6df6e433f3be02f424fffe6a4c9cef62de93 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 25 Jul 2026 09:54:36 +0000 Subject: [PATCH] =?UTF-8?q?refactor:=20remove=20Requirements=20page=20?= =?UTF-8?q?=E2=80=94=20superseded=20by=20Batches?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/app.js | 189 ---------------------------------------------- static/index.html | 12 +-- 2 files changed, 1 insertion(+), 200 deletions(-) diff --git a/static/app.js b/static/app.js index 6a4ed6f..85f7e28 100644 --- a/static/app.js +++ b/static/app.js @@ -17,7 +17,6 @@ document.querySelectorAll('.nav-link').forEach(link => { if (page === 'dashboard') loadDashboard(); if (page === 'candidates') loadCandidates(); if (page === 'templates') loadCarboneTemplates(); - if (page === 'requirements') loadRequirements(); if (page === 'generated') loadGeneratedCVs(); if (page === 'batches') loadBatches(); }); @@ -343,194 +342,6 @@ async function deleteTemplate(id) { loadTemplates(); } -// ============================================================ -// REQUIREMENTS -// ============================================================ -async function loadRequirements() { - const data = await api('/api/requirements'); - const list = document.getElementById('requirements-list'); - if (!data.requirements.length) { - list.innerHTML = '

No requirements yet. Create one to start matching candidates.

'; - return; - } - list.innerHTML = data.requirements.map(r => ` -
-
-
- ${r.title} - ${r.customer_name ? ' ยท ' + r.customer_name + '' : ''} -
${r.description || ''}
-
${(r.requirements || []).length} position(s) requested
-
-
- - - - -
-
-
- `).join(''); -} - -function showRequirementModal() { - const body = ` -
- - -
-
- - -
-
- - -
-
- -

Define each position with required skills and years of experience.

- -
- - `; - showModal(body, 'Create Requirement Request'); -} - -async function createRequirement() { - const positions = JSON.parse(document.getElementById('req-positions').value || '[]'); - await api('/api/requirements', 'POST', { - title: document.getElementById('req-title').value, - customer_name: document.getElementById('req-customer').value, - description: document.getElementById('req-desc').value, - requirements: positions - }); - closeModal(); - toast('Requirement created'); - loadRequirements(); -} - -async function viewRequirement(id) { - const data = await api('/api/requirements/' + id); - const positions = data.requirements || []; - const body = ` -

${data.title}

- ${data.customer_name ? '

Customer: ' + data.customer_name + '

' : ''} - ${data.description ? '

' + data.description + '

' : ''} -

Positions (${positions.length})

- ${positions.map((p, i) => ` -
- ${p.position_title || 'Position ' + (i+1)} - ${p.quantity ? 'Qty: ' + p.quantity + '' : ''} - ${p.experience_years ? 'Min ' + p.experience_years + ' yrs' : ''} - ${p.description ? '

' + p.description + '

' : ''} - ${(p.skills || []).map(s => ` -
- ${s.required ? '๐Ÿ”’' : 'โšช'} ${s.name} ${s.min_years ? '(min ' + s.min_years + ' yrs)' : ''} -
- `).join('')} -
- `).join('')} - ${data.generated_cvs && data.generated_cvs.length ? ` -

Generated CVs (${data.generated_cvs.length})

- ${data.generated_cvs.map(g => ` -
- ${g.position_title || 'N/A'} โ€” ${g.first_name || ''} ${g.last_name || ''} - ${g.status} -
- `).join('')} - ` : ''} - `; - showModal(body, 'Requirement Details'); -} - -async function matchRequirement(id) { - const list = document.getElementById('requirements-list'); - // Show loading - const oldHTML = list.innerHTML; - list.innerHTML = '
Matching candidates with AI... this may take a while
'; - - try { - const data = await api('/api/requirements/' + id + '/match', 'POST', {}); - const results = data.matches.filter(m => !m.error); - results.sort((a, b) => (b.match_score || 0) - (a.match_score || 0)); - - const body = ` -

Match Results

-

${results.length} candidates matched

-
- ${results.map(m => ` -
-
- ${m.candidate_name || 'Unknown'} -
${m.position_title || ''}
-
- Match: ${m.matching_skills?.join(', ') || 'none'} | - Missing: ${m.missing_skills?.join(', ') || 'none'} -
-
${m.reasoning || ''}
-
-
${m.match_score || 0}%
-
- `).join('')} -
- `; - showModal(body, 'Match Results'); - list.innerHTML = oldHTML; - } catch(e) { - list.innerHTML = oldHTML; - toast('Match failed: ' + e.message, 'error'); - } -} - -async function generateForRequirement(id) { - if (!confirm('Generate tailored CVs for all parsed candidates? This may take several minutes.')) return; - const list = document.getElementById('requirements-list'); - const oldHTML = list.innerHTML; - list.innerHTML = '
Generating CVs with AI... this may take several minutes
'; - - try { - const data = await api('/api/requirements/' + id + '/generate', 'POST', {}); - closeModal(); - list.innerHTML = oldHTML; - toast(`Generated ${data.generated.length} CVs`); - loadGeneratedCVs(); - document.querySelector('[data-page="generated"]').click(); - } catch(e) { - list.innerHTML = oldHTML; - toast('Generation failed: ' + e.message, 'error'); - } -} - -async function deleteRequirement(id) { - if (!confirm('Delete this requirement and all generated CVs?')) return; - await api('/api/requirements/' + id, 'DELETE'); - toast('Requirement deleted'); - loadRequirements(); -} - // ============================================================ // GENERATED CVs // ============================================================ diff --git a/static/index.html b/static/index.html index 5a9fd36..0e707d5 100644 --- a/static/index.html +++ b/static/index.html @@ -20,7 +20,6 @@
  • Candidates
  • Templates
  • Batches
  • -
  • Requirements
  • Generated CVs
  • @@ -117,15 +116,6 @@ - -
    -

    Requirement Requests

    -
    - -
    -
    -
    -

    Generated CVs

    @@ -150,7 +140,7 @@
    - +