Skip to content

Commit

Permalink
fix: update element links and table headers to use admin prefix and i…
Browse files Browse the repository at this point in the history
…mprove readability
  • Loading branch information
0x1026 committed Dec 12, 2024
1 parent aea49f7 commit 6809097
Showing 1 changed file with 42 additions and 25 deletions.
67 changes: 42 additions & 25 deletions app/src/app/Views/Admin/Elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<?php } ?>

<div class="mb-4 flex justify-end">
<a href="/element/create"
<a href="/admin/element/create"

Check warning on line 15 in app/src/app/Views/Admin/Elements.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Views/Admin/Elements.php#L15

Added line #L15 was not covered by tests
class="bg-blue-500 hover:bg-blue-600 text-white font-medium py-2 px-4 rounded-lg shadow focus:outline-none focus:ring focus:ring-green-500">
Create Element
</a>
Expand All @@ -22,34 +22,51 @@ class="bg-blue-500 hover:bg-blue-600 text-white font-medium py-2 px-4 rounded-lg
<table class="min-w-full table-fixed bg-white border border-gray-300 rounded-lg shadow-md">
<thead>
<tr class="bg-gray-700 text-white text-left h-14">
<th class="px-4 py-2 border-b">Tipo Elemento</th>
<th class="px-4 py-2 border-b">Contrato</th>
<th class="px-4 py-2 border-b">Zona</th>
<th class="px-4 py-2 border-b">Tipo Arbol</th>
<th class="px-4 py-2 border-b">Element type</th>
<th class="px-4 py-2 border-b">Contract</th>
<th class="px-4 py-2 border-b">Zone</th>
<th class="px-4 py-2 border-b">Tree type</th>

Check warning on line 28 in app/src/app/Views/Admin/Elements.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Views/Admin/Elements.php#L25-L28

Added lines #L25 - L28 were not covered by tests
<th class="px-4 py-2 border-b">Actions</th>
</tr>
</thead>
<tbody>


<td class="px-4 py-3 border-b text-center flex justify-center space-x-4">
<!-- Edit Button (Pencil Icon) -->
<a href="/element/<?php echo htmlspecialchars($element->getId()); ?>/edit"
class="text-blue-500 hover:text-blue-700" title="Edit">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5">
<path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" />
</svg>
</a>
<!-- Delete Button (Trash Icon) -->
<a href="/element/<?php echo htmlspecialchars($element->getId()); ?>/delete"
onclick="return confirm('Are you sure you want to delete this element?');"
class="text-red-500 hover:text-red-700" title="Delete">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5">
<path stroke-linecap="round" stroke-linejoin="round" d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" />
</svg>
</a>
</td>
</tr>
<?php foreach ($elements as $element) { ?>
<tr class="hover:bg-gray-50">
<td class="px-4 py-2 border-b">
<?php echo $element->elementType()->name; ?>
</td>
<td class="px-4 py-2 border-b">
<?php echo $element->contract()->name; ?>
</td>
<td class="px-4 py-2 border-b">
<?php echo $element->zone()->predefined()->name ?? 'Not on a predefined zone'; ?>
</td>
<td class="px-4 py-2 border-b">
<?php echo $element->treeType()->species; ?>
</td>
<td class="px-4 py-3 border-b text-center flex justify-center space-x-4">
<!-- Edit Button (Pencil Icon) -->
<a href="/admin/element/<?php echo htmlspecialchars($element->getId()); ?>/edit"

Check warning on line 49 in app/src/app/Views/Admin/Elements.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Views/Admin/Elements.php#L34-L49

Added lines #L34 - L49 were not covered by tests
class="text-blue-500 hover:text-blue-700" title="Edit">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="w-5 h-5">
<path stroke-linecap="round" stroke-linejoin="round"
d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" />
</svg>
</a>
<!-- Delete Button (Trash Icon) -->
<a href="/admin/element/<?php echo htmlspecialchars($element->getId()); ?>/delete"

Check warning on line 58 in app/src/app/Views/Admin/Elements.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Views/Admin/Elements.php#L58

Added line #L58 was not covered by tests
onclick="return confirm('Are you sure you want to delete this element?');"
class="text-red-500 hover:text-red-700" title="Delete">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="w-5 h-5">
<path stroke-linecap="round" stroke-linejoin="round"
d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" />
</svg>
</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>

0 comments on commit 6809097

Please sign in to comment.