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 $rows = []; // Data rows for the table
public $selected = []; // Selected row IDs public $selected = []; // Selected row IDs
public $addRoute = null; // Route for adding new rows (optional) 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 $selectAll = false; // Whether 'Select All' is active
public $hasCheckbox = true; // Whether checkboxes are shown for row selection public $hasCheckbox = true; // Whether checkboxes are shown for row selection
public $hasActions = false; // Whether action buttons (like Edit/Delete) are shown public $hasActions = false; // Whether action buttons (like Edit/Delete) are shown

View File

@ -99,6 +99,14 @@
@endforelse @endforelse
</tbody> </tbody>
</table> </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 --> <!-- Modal for Viewing / Editing Row -->
@if ($showModal) @if ($showModal)

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
<div> <div>
{{-- Top Nav --}} {{-- Top Nav --}}
@include('livewire.station-locator.top-nav.station') @include('livewire.station-locator.top-nav.station')
<livewire:components.table <livewire:components.table
:columns="[ :columns="[
['label' => 'Station Code', 'field' => 'station_code'], ['label' => 'Station Code', 'field' => 'station_code'],
['label' => 'Station Name', 'field' => 'station_name'], ['label' => 'Station Name', 'field' => 'station_name'],
@ -15,5 +15,5 @@
:hasActions="true" :hasActions="true"
:isViewPage="false" :isViewPage="false"
:addRoute="route('station-create')" :addRoute="route('station-create')"
/> :hasDelete="false" />
</div> </div>