delete button added

This commit is contained in:
erishBRBS 2025-04-22 11:45:12 +08:00
parent 92351c0bc1
commit e70ffa85a1
7 changed files with 32 additions and 20 deletions

View File

@ -11,7 +11,8 @@ class Table extends Component
public $rows = []; // Data rows for the table
public $selected = []; // Selected row IDs
public $addRoute = null; // Route for adding new rows (optional)
public $hasAddButton = true; // Whether the 'Add' button is shown
public $hasAddButton = true;
public $hasDelete = true; // Whether the 'Add' button is shown
public $selectAll = false; // Whether 'Select All' is active
public $hasCheckbox = true; // Whether checkboxes are shown for row selection
public $hasActions = false; // Whether action buttons (like Edit/Delete) are shown

View File

@ -99,6 +99,14 @@
@endforelse
</tbody>
</table>
<!-- Delete Button -->
@if($hasDelete)
<button wire:click="deleteSelected"
class="mt-4 px-4 py-2 bg-red-500 text-white rounded-md hover:bg-red-600 cursor-pointer"
@if (empty($selected)) disabled @endif>
Delete
</button>
@endif
<!-- Modal for Viewing / Editing Row -->
@if ($showModal)

View File

@ -14,5 +14,6 @@
:hasCheckbox="false"
:hasActions="true"
:isViewPage="true"
:hasDelete="false"
/>
</div>

View File

@ -14,5 +14,6 @@
:hasCheckbox="false"
:hasActions="true"
:isViewPage="true"
:hasDelete="false"
/>
</div>

View File

@ -14,5 +14,6 @@
:hasActions="true"
:isViewPage="false"
:addRoute="route('branch-create')"
:hasDelete="false"
/>
</div>

View File

@ -1,15 +1,15 @@
<div>
{{-- Top Nav --}}
@include('livewire.station-locator.top-nav.fuel')
<livewire:components.table
:columns="[
{{-- Top Nav --}}
@include('livewire.station-locator.top-nav.fuel')
<livewire:components.table
:columns="[
['label' => 'Fuel Name', 'field' => 'fuel_name'],
['label' => 'Date Created', 'field' => 'date_created'],
['label' => 'Date Modified', 'field' => 'date_modified'],
]"
:rows="$fuels"
:hasActions="true"
:isViewPage="false"
:addRoute="route('fuel-create')"
/>
:rows="$fuels"
:hasActions="true"
:isViewPage="false"
:addRoute="route('fuel-create')"
:hasDelete="false" />
</div>

View File

@ -1,8 +1,8 @@
<div>
{{-- Top Nav --}}
@include('livewire.station-locator.top-nav.station')
<livewire:components.table
:columns="[
{{-- Top Nav --}}
@include('livewire.station-locator.top-nav.station')
<livewire:components.table
:columns="[
['label' => 'Station Code', 'field' => 'station_code'],
['label' => 'Station Name', 'field' => 'station_name'],
['label' => 'Branch Name', 'field' => 'branch_name'],
@ -11,9 +11,9 @@
['label' => 'Modified By', 'field' => 'modified_by'],
['label' => 'Date Modified', 'field' => 'date_modified'],
]"
:rows="$stations"
:hasActions="true"
:isViewPage="false"
:addRoute="route('station-create')"
/>
</div>
:rows="$stations"
:hasActions="true"
:isViewPage="false"
:addRoute="route('station-create')"
:hasDelete="false" />
</div>