From 7e7476abc80c1d2e2c6946f716fc97338645a81c Mon Sep 17 00:00:00 2001 From: Quildra Date: Wed, 30 Oct 2024 21:52:49 +0000 Subject: [PATCH] - Work on the counte tracking in the plan when marking as caught --- Site/templates/index.html | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/Site/templates/index.html b/Site/templates/index.html index 3cb978e..f0980a3 100644 --- a/Site/templates/index.html +++ b/Site/templates/index.html @@ -550,7 +550,7 @@
Catch count {{ pokemon.catch_count }}
@@ -565,7 +565,7 @@
{% if pokemon.evolve_to %} {% for evolution in pokemon.evolve_to %} -
+
{{ evolution.name }} {% if evolution.form_name %}({{ evolution.form_name }}){% endif %} @@ -581,7 +581,7 @@ {% if pokemon.breed_for %} {% for breeding in pokemon.breed_for %} -
+
{{ breeding.name }} {% if breeding.form_name %}({{ breeding.form_name }}){% endif %} @@ -742,9 +742,6 @@ count += isCaught ? -1 : 1; catchCount.textContent = count; - const pokeball = entry.querySelector('.catch-count-pokeball'); - pokeball.classList.toggle('grayscale', count === 0); - updateGameTotal(entry, isCaught); } @@ -872,15 +869,26 @@ .then(response => response.json()) .then(caught => { caught.forEach(pfic => { - const pokeball = document.querySelector(`.pokeball-icon[data-pfic="${pfic}"]`); - if (pokeball) { - pokeball.classList.remove('grayscale'); - } - - const planPokeball = document.querySelector(`.catch-count-pokeball[data-pfic="${pfic}"]`); - if (planPokeball) { - planPokeball.classList.remove('grayscale'); - } + // Update efficiency plan counts for caught Pokemon + const planTab = document.getElementById('efficiency-tab'); + planTab.querySelectorAll('.pokemon-entry').forEach(entry => { + // Check if this Pokemon is part of any evolution/breeding group + const targetCards = entry.querySelectorAll('.target-card'); + targetCards.forEach(card => { + if (card.dataset.pfic === pfic) { + // Found as an evolution/breeding target - update parent's catch count + const catchCount = entry.querySelector('.catch-count'); + let count = parseInt(catchCount.textContent); + if (count > 0) { + count -= 1; + catchCount.textContent = count; + } + + // Update game total + updateGameTotal(entry, true); + } + }); + }); }); }); });