/* ============================================================ offers.js — Offer management ============================================================ */ window.Views = window.Views || {}; window.Offers = {}; Views.offers = function () { const filters = { q: '', status: '' }; let table; const stats = { sent: DB.offers.filter(o => o.status !== 'Draft').length, accepted: DB.offers.filter(o => o.status === 'Accepted').length, pending: DB.offers.filter(o => ['Sent', 'Negotiating'].includes(o.status)).length, rate: Math.round(DB.offers.filter(o => o.status === 'Accepted').length / (DB.offers.filter(o => ['Accepted', 'Declined'].includes(o.status)).length || 1) * 100) }; function apply() { const rows = DB.offers.filter(o => { if (filters.status && o.status !== filters.status) return false; if (filters.q && !(o.candidate + o.jobTitle + o.recruiter).toLowerCase().includes(filters.q.toLowerCase())) return false; return true; }); table.update(rows); } table = UI.dataTable({ pageSize: 8, rows: DB.offers, columns: [ { key: 'candidate', label: 'Candidate', sortable: true, render: o => `
Track offer letters and acceptance