feat: Implement live editing (HTMX) and refine UI hierarchy
Integrates HTMX for real-time updates of Experience and Education forms in the admin dashboard, eliminating full page reloads on save and enabling instant addition of new entries. Adjusted the visual prominence of 'Role' in Experience and 'Degree' in Education sections. Fixes: - Corrected database query parameter passing, resolving text field clearing issue on save. - Enabled live 'Add New' functionality for Experience and Education entries.
This commit is contained in:
@@ -138,6 +138,20 @@ export function getAdminExperience() {
|
||||
});
|
||||
}
|
||||
|
||||
export function getAdminExperienceById(id: number) {
|
||||
const e = db.query(`SELECT * FROM experience WHERE id = $id`).get({ $id: id }) as any;
|
||||
if (!e) return null;
|
||||
|
||||
const trans = db.query(`SELECT * FROM experience_translations WHERE experience_id = $id`).all({ $id: id }) as any[];
|
||||
trans.forEach(t => {
|
||||
e[`company_name_${t.language_code}`] = t.company_name;
|
||||
e[`role_${t.language_code}`] = t.role;
|
||||
e[`description_${t.language_code}`] = t.description;
|
||||
e[`location_${t.language_code}`] = t.location;
|
||||
});
|
||||
return e;
|
||||
}
|
||||
|
||||
export function getAdminEducation() {
|
||||
const edus = db.query(`SELECT * FROM education ORDER BY display_order ASC, start_date DESC`).all() as any[];
|
||||
return edus.map(e => {
|
||||
@@ -151,4 +165,17 @@ export function getAdminEducation() {
|
||||
});
|
||||
}
|
||||
|
||||
export function getAdminEducationById(id: number) {
|
||||
const e = db.query(`SELECT * FROM education WHERE id = $id`).get({ $id: id }) as any;
|
||||
if (!e) return null;
|
||||
|
||||
const trans = db.query(`SELECT * FROM education_translations WHERE education_id = $id`).all({ $id: id }) as any[];
|
||||
trans.forEach(t => {
|
||||
e[`institution_${t.language_code}`] = t.institution;
|
||||
e[`degree_${t.language_code}`] = t.degree;
|
||||
e[`description_${t.language_code}`] = t.description;
|
||||
});
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user