diff --git a/zed_workouts/tracker/templates/tracker/index.html b/zed_workouts/tracker/templates/tracker/index.html index 6338ecf..a95daab 100644 --- a/zed_workouts/tracker/templates/tracker/index.html +++ b/zed_workouts/tracker/templates/tracker/index.html @@ -155,6 +155,10 @@ const tbody = document.getElementById('activeTableBody'); tbody.innerHTML = ''; + // Get current template data to seed values + const templateName = document.getElementById('templateSelect').value; + const templateData = templates[templateName] || []; + const selects = [ { el: document.getElementById('primarySelect'), group: 'Primary' }, { el: document.getElementById('secondarySelect'), group: 'Secondary' }, @@ -167,15 +171,23 @@ for (let set = 1; set <= 4; set++) { selects.forEach(s => { const opt = s.el.options[s.el.selectedIndex]; + const exName = s.el.value; + + // Look for existing data in the template for this exercise/set + const match = templateData.find(row => row.exercise === exName && row.set === set); + const rReps = match ? match.reps : 0; + const rWeight = match ? match.weight : 0; + const rNotes = match ? (match.notes || '') : ''; + const row = `