Skip to content

Commit

Permalink
feat: update ElementType
Browse files Browse the repository at this point in the history
  • Loading branch information
albert1413 committed Dec 10, 2024
1 parent 08e8cc7 commit 00492f8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 39 deletions.
8 changes: 4 additions & 4 deletions app/src/app/Views/Admin/ElementType/Create.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="mb-4 flex justify-end">
<a href="/elementTypes"
<a href="/admin/elementTypes"
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 flex items-center space-x-2">
<!-- Heroicon for return/back (chevron-left) -->
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
Expand All @@ -11,7 +11,7 @@ class="bg-blue-500 hover:bg-blue-600 text-white font-medium py-2 px-4 rounded-lg

<div class="bg-white p-8 border border-gray-300 rounded-lg shadow-md">
<h2 class="text-2xl font-semibold text-gray-800 mb-6">Create Element Type</h2>
<form action="/elementType/store" method="POST" class="space-y-6">
<form action="/admin/elementType/store" method="POST" class="space-y-6">

Check warning on line 14 in app/src/app/Views/Admin/ElementType/Create.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Views/Admin/ElementType/Create.php#L12-L14

Added lines #L12 - L14 were not covered by tests
<!-- Name -->
<div>
Expand All @@ -23,8 +23,8 @@ class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none foc
<!-- Description -->
<div>
<label for="name" class="block text-sm font-medium text-gray-700 mb-1">Name</label>
<input type="text" id="name" name="name"
<label for="description" class="block text-sm font-medium text-gray-700 mb-1">Description</label>
<input type="text" id="description" name="description"
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring focus:ring-blue-500 focus:border-blue-500"
required>
</div>

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

View check run for this annotation

Codecov / codecov/patch

app/src/app/Views/Admin/ElementType/Create.php#L24-L30

Added lines #L24 - L30 were not covered by tests
Expand Down
41 changes: 9 additions & 32 deletions app/src/app/Views/Admin/ElementType/Edit.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="mb-4 flex justify-end">
<a href="/elements"
<a href="/admin/elementTypes"
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 flex items-center space-x-2">
<!-- Heroicon for return/back (chevron-left) -->
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
Expand All @@ -10,51 +10,28 @@ class="bg-blue-500 hover:bg-blue-600 text-white font-medium py-2 px-4 rounded-lg
</div>

Check warning on line 10 in app/src/app/Views/Admin/ElementType/Edit.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Views/Admin/ElementType/Edit.php#L1-L10

Added lines #L1 - L10 were not covered by tests

<div class="bg-white p-8 border border-gray-300 rounded-lg shadow-md">
<h2 class="text-2xl font-semibold text-gray-800 mb-6">Edit Element</h2>
<h2 class="text-2xl font-semibold text-gray-800 mb-6">Edit Element Type</h2>
<form
action="/element/<?php echo htmlspecialchars($element->getId()); ?>/update"
action="/admin/elementType/<?php echo htmlspecialchars($elementType->getId()); ?>/update"

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

View check run for this annotation

Codecov / codecov/patch

app/src/app/Views/Admin/ElementType/Edit.php#L12-L15

Added lines #L12 - L15 were not covered by tests
method="POST" class="space-y-6">

<!-- Name -->
<div>
<label for="name" class="block text-sm font-medium text-gray-700 mb-1">Name</label>
<input type="text" id="name" name="name"
value="<?php echo htmlspecialchars($element->name); ?>"
value="<?php echo htmlspecialchars($elementType->name); ?>"

Check warning on line 22 in app/src/app/Views/Admin/ElementType/Edit.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Views/Admin/ElementType/Edit.php#L22

Added line #L22 was not covered by tests
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring focus:ring-blue-500 focus:border-blue-500">
</div>

<!-- Zone Name -->
<!-- Description -->
<div>
<label for="zone_id" class="block text-sm font-medium text-gray-700 mb-1">Zone</label>
<input type="text" id="zone_id" name="zone_id"
value="<?php echo htmlspecialchars($element->zone_id); ?>"
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring focus:ring-blue-500 focus:border-blue-500">
</div>

<!-- Tree Type -->
<div>
<label for="tree_type_id" class="block text-sm font-medium text-gray-700 mb-1">Tree Type</label>
<input type="tree_type_id" id="tree_type_id" name="tree_type_id"
value="<?php echo htmlspecialchars($element->tree_type_id); ?>"
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring focus:ring-blue-500 focus:border-blue-500">
</div>

<!-- Latitude -->
<div>
<label for="latitude" class="block text-sm font-medium text-gray-700 mb-1">Latitude</label>
<input type="latitude" id="latitude" name="latitude"
value="<?php echo htmlspecialchars($element->latitude); ?>"
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring focus:ring-blue-500 focus:border-blue-500">
</div>

<!-- Longitude -->
<div>
<label for="longitude" class="block text-sm font-medium text-gray-700 mb-1">Longitude</label>
<input type="longitude" id="longitude" name="longitude"
value="<?php echo htmlspecialchars($element->longitude); ?>"
<label for="description" class="block text-sm font-medium text-gray-700 mb-1">Description</label>
<input type="description" id="description" name="description"
value="<?php echo htmlspecialchars($elementType->description); ?>"

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

View check run for this annotation

Codecov / codecov/patch

app/src/app/Views/Admin/ElementType/Edit.php#L30

Added line #L30 was not covered by tests
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring focus:ring-blue-500 focus:border-blue-500">
</div>


<!-- Submit Button -->
<div class="flex items-center">
<button type="submit"
Expand Down
6 changes: 3 additions & 3 deletions app/src/app/Views/Admin/ElementTypes.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="/elementType/create"
<a href="/admin/elementType/create"
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 Type
</a>
Expand Down Expand Up @@ -40,14 +40,14 @@ class="bg-blue-500 hover:bg-blue-600 text-white font-medium py-2 px-4 rounded-lg
<?php echo $elementType->description; ?></td>

Check warning on line 40 in app/src/app/Views/Admin/ElementTypes.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Views/Admin/ElementTypes.php#L40

Added line #L40 was not covered by tests
<td class="px-4 py-3 border-b text-center flex space-x-4">
<!-- Edit Button (Pencil Icon) -->
<a href="/elementType/<?php echo htmlspecialchars($elementType->getId()); ?>/edit"
<a href="/admin/elementType/<?php echo htmlspecialchars($elementType->getId()); ?>/edit"

Check warning on line 43 in app/src/app/Views/Admin/ElementTypes.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Views/Admin/ElementTypes.php#L43

Added line #L43 was 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="/elementType/<?php echo htmlspecialchars($elementType->getId()); ?>/delete"
<a href="/admin/elementType/<?php echo htmlspecialchars($elementType->getId()); ?>/delete"

Check warning on line 50 in app/src/app/Views/Admin/ElementTypes.php

View check run for this annotation

Codecov / codecov/patch

app/src/app/Views/Admin/ElementTypes.php#L50

Added line #L50 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">
Expand Down

0 comments on commit 00492f8

Please sign in to comment.