Skip to content

Commit

Permalink
FUNCIONA COÑOOOO
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuck-D-Norris committed Dec 17, 2024
1 parent cdcbc40 commit b2f0f05
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 2 additions & 3 deletions app/src/app/Controllers/Admin/EstadistiquesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,19 @@ public function index($queryParams = [])
{
// Obtenim les dades del model correcte
$totalContractes = Contract::count();
$totalTreeTypes = TreeType::count();
$nomcontracts = Contract::findAll();

Check warning on line 15 in app/src/app/Controllers/Admin/EstadistiquesController.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Controllers/Admin/EstadistiquesController.php#L14-L15

Added lines #L14 - L15 were not covered by tests


// Comprova si $grafiques és null i assegura't que sigui un array


$contracts = Contract::findAll();

// Renderitzem la vista amb les dades
View::render([
'view' => 'Admin/Grafics',
'title' => 'Grafiques',
'layout' => 'Admin/AdminLayout',
'data' => ['totalContractes' => $totalContractes, 'totalTreeTypes' => $totalTreeTypes],
'data' => ['totalContractes' => $totalContractes, 'nomsContractes' => $nomcontracts],
]);

Check warning on line 28 in app/src/app/Controllers/Admin/EstadistiquesController.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Controllers/Admin/EstadistiquesController.php#L23-L28

Added lines #L23 - L28 were not covered by tests
}
}
5 changes: 4 additions & 1 deletion app/src/app/Views/Admin/Grafics.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
Seleccionar Contrato
</button>
<div id="dropdown-menu" class="absolute bg-white border rounded shadow-lg mt-2 w-48 hidden">

Check warning on line 24 in app/src/app/Views/Admin/Grafics.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Views/Admin/Grafics.php#L2-L24

Added lines #L2 - L24 were not covered by tests
<?php echo $totalContractes; ?>

<?php foreach ($nomsContractes as $contracte): ?>
<div><?php echo $contracte->name; ?></div>
<?php endforeach; ?>
</div>
</div>

Check warning on line 30 in app/src/app/Views/Admin/Grafics.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Views/Admin/Grafics.php#L26-L30

Added lines #L26 - L30 were not covered by tests

Expand Down

0 comments on commit b2f0f05

Please sign in to comment.