diff --git a/svar-gantt-app/data.db b/svar-gantt-app/data.db index 652f098..57014f2 100644 Binary files a/svar-gantt-app/data.db and b/svar-gantt-app/data.db differ diff --git a/svar-gantt-app/scripts/init-db.js b/svar-gantt-app/scripts/init-db.js index 77cc968..bf6785d 100644 --- a/svar-gantt-app/scripts/init-db.js +++ b/svar-gantt-app/scripts/init-db.js @@ -21,7 +21,8 @@ db.exec(` progress INTEGER, type TEXT, parent INTEGER, - lazy BOOLEAN DEFAULT 0 -- ✅ Ajout ici + assignedTo TEXT, + lazy_loading BOOLEAN DEFAULT 0 ); CREATE TABLE links ( diff --git a/svar-gantt-app/src/routes/api/tasks/+server.ts b/svar-gantt-app/src/routes/api/tasks/+server.ts index 835ac34..62b5425 100644 --- a/svar-gantt-app/src/routes/api/tasks/+server.ts +++ b/svar-gantt-app/src/routes/api/tasks/+server.ts @@ -12,8 +12,30 @@ export async function POST({ request }) { const { tasks, links } = await request.json(); const insertTask = db.prepare(` - INSERT INTO tasks (id, text, start, end, duration, progress, type, parent, lazy) - VALUES (@id, @text, @start, @end, @duration, @progress, @type, @parent, @lazy) + INSERT INTO tasks ( + id, + text, + start, + end, + duration, + progress, + type, + parent, + assignedTo, + lazy_loading + ) + VALUES ( + @id, + @text, + @start, + @end, + @duration, + @progress, + @type, + @parent, + @assignedTo, + @lazy_loading + ) `); const insertLink = db.prepare(` @@ -21,21 +43,20 @@ export async function POST({ request }) { VALUES (@id, @source, @target, @type) `); - const taskTx = db.transaction((all) => { + const taskTx = db.transaction(({ tasks, links }) => { db.prepare('DELETE FROM tasks').run(); db.prepare('DELETE FROM links').run(); - for (const task of all.tasks) { + for (const task of tasks) { insertTask.run({ ...task, start: typeof task.start === 'object' ? new Date(task.start).toISOString() : task.start, end: typeof task.end === 'object' ? new Date(task.end).toISOString() : task.end, - lazy: task.lazy ? 1 : 0, // ⚠️ SQLite ne supporte pas le type boolean natif + lazy_loading: task.lazy_loading ? 1 : 0 }); } - - for (const link of all.links) { + for (const link of links) { insertLink.run(link); } }); diff --git a/svar-gantt-app/src/routes/gantt/+page.svelte b/svar-gantt-app/src/routes/gantt/+page.svelte index fc46815..6135ccb 100644 --- a/svar-gantt-app/src/routes/gantt/+page.svelte +++ b/svar-gantt-app/src/routes/gantt/+page.svelte @@ -4,40 +4,52 @@ let tasks = []; let links = []; + + // 🗓️ Affichage : mois + jours const scales = [ { unit: 'month', step: 1, format: 'MMMM yyyy' }, { unit: 'day', step: 1, format: 'd' } ]; + // 📋 Options : colonnes personnalisées + const options = { + taskList: { + visible: true, // ✅ Important + columns: [ + { id: 'text', label: 'Nom', value: 'text', width: 200 }, + { id: 'assignedTo', label: 'Assignée à', value: 'assignedTo', width: 150 } + ] + } + }; + + onMount(async () => { - const res = await fetch('/api/tasks'); - if (res.ok) { - const { tasks: loadedTasks, links: loadedLinks } = await res.json(); + const res = await fetch('/api/tasks'); + if (res.ok) { + const { tasks: loadedTasks, links: loadedLinks } = await res.json(); - tasks = loadedTasks.map(task => { - const start = new Date(task.start); - const duration = task.duration || task.estimation || 1; + tasks = loadedTasks.map(task => { + const start = new Date(task.start); + const duration = task.duration || task.estimation || 1; - const end = new Date(start); - end.setDate(start.getDate() + duration); - - return { - ...task, - start: start.toISOString().slice(0, 10), - end: end.toISOString().slice(0, 10), - duration - }; - }); - - links = loadedLinks; - } else { - console.error('Erreur de chargement des données depuis la base.'); - } -}); + const end = new Date(start); + end.setDate(start.getDate() + duration); + return { + ...task, + start: start.toISOString().slice(0, 10), + end: end.toISOString().slice(0, 10), + duration: duration + }; + }); + links = loadedLinks; + } else { + console.error('Erreur de chargement des données depuis la base.'); + } + }); - + diff --git a/svar-gantt-app/src/routes/import/+page.svelte b/svar-gantt-app/src/routes/import/+page.svelte index 38d9cdd..193e5fc 100644 --- a/svar-gantt-app/src/routes/import/+page.svelte +++ b/svar-gantt-app/src/routes/import/+page.svelte @@ -25,13 +25,14 @@ return { id: index + 1, text: entry['Nom Ticket'], - start: start.toISOString().split('T')[0], // ⬅️ Converti en string - end: end.toISOString().split('T')[0], // ⬅️ Converti en string + start: start.toISOString().split('T')[0], + end: end.toISOString().split('T')[0], duration: Number(entry['Estimation (j)']) || 1, progress: Number(entry['RAF']) || 0, type: 'task', parent: null, - lazy: false + assignedTo: entry['assignedTo'] || '', // ✅ Ajout ici + lazy_loading: false // ✅ Correspond à la colonne renommée }; }); @@ -53,6 +54,7 @@ } +

Importer un fichier CSV

diff --git a/tickets.csv b/tickets.csv index a03b822..72c706b 100644 --- a/tickets.csv +++ b/tickets.csv @@ -1,7 +1,7 @@ -ID Ticket,Nom Ticket,Estimation (j),Sprint,Statut,RAF -T-001,Authentification,5,Sprint 1,Terminé,0 -T-002,Page d’accueil,3,Sprint 1,En cours,2 -T-003,Système de recherche,4,Sprint 2,À faire,4 -T-005,Sprint 3,3,Sprint 1,En cours,2 -T-004,Configuration BO,4,Sprint 2,À faire,4 -T-006,Endpoint à configurer sur api,1,Sprint 2,À faire,1 \ No newline at end of file +ID Ticket,Nom Ticket,Estimation (j),Sprint,Statut,RAF,assignedTo +T-001,Authentification,5,Sprint 1,Terminé,0,Simon BOYER +T-002,Page d’accueil,3,Sprint 1,En cours,2,Simon BOYER +T-003,Système de recherche,4,Sprint 2,À faire,4,Fatima BROUM +T-005,Sprint 3,3,Sprint 1,En cours,2,Fatima BROUM +T-004,Configuration BO,4,Sprint 2,À faire,4,Fatima BROUM +T-006,Endpoint à configurer sur api,1,Sprint 2,À faire,1,Fatima BROUM \ No newline at end of file