Mercurial > packages > magicforger
comparison src/Generator/View/stubs/index.stub @ 25:1a717c7b211f codex
added support for some basic views
| author | Luka Sitas <sitas.luka.97@gmail.com> |
|---|---|
| date | Sun, 11 May 2025 21:03:51 -0400 |
| parents | |
| children | 555bfaa500ac |
comparison
equal
deleted
inserted
replaced
| 24:31109c61ce02 | 25:1a717c7b211f |
|---|---|
| 1 <x-app-layout> | |
| 2 <x-slot name="header"> | |
| 3 <h2 class="font-semibold text-xl text-gray-800 leading-tight"> | |
| 4 All {{ Str::plural(ucfirst('{{ modelVariable }}')) }} | |
| 5 </h2> | |
| 6 </x-slot> | |
| 7 | |
| 8 <div class="py-12"> | |
| 9 <div class="max-w-7xl mx-auto sm:px-6 lg:px-8"> | |
| 10 <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg p-6"> | |
| 11 <div class="flex items-center justify-between mb-4"> | |
| 12 <span></span> | |
| 13 <a href="{{ route('{{ tableName }}.create') }}" class="px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700"> | |
| 14 + New {{ ucfirst('{{ modelVariable }}') }} | |
| 15 </a> | |
| 16 </div> | |
| 17 <table class="w-full text-left border-collapse"> | |
| 18 <thead> | |
| 19 <tr> | |
| 20 @foreach($fields as $field) | |
| 21 <th class="border-b p-2">{{ ucfirst($field) }}</th> | |
| 22 @endforeach | |
| 23 <th class="border-b p-2">Actions</th> | |
| 24 </tr> | |
| 25 </thead> | |
| 26 <tbody> | |
| 27 @forelse ($items as $item) | |
| 28 <tr> | |
| 29 @foreach($fields as $field) | |
| 30 <td class="border-b p-2">{{ $item->$field }}</td> | |
| 31 @endforeach | |
| 32 <td class="border-b p-2 flex space-x-2"> | |
| 33 <a href="{{ route('{{ tableName }}.show', $item) }}" class="text-blue-600 hover:underline">View</a> | |
| 34 <a href="{{ route('{{ tableName }}.edit', $item) }}" class="text-yellow-600 hover:underline">Edit</a> | |
| 35 <form action="{{ route('{{ tableName }}.destroy', $item) }}" method="POST" class="inline"> | |
| 36 @csrf | |
| 37 @method('DELETE') | |
| 38 <button type="submit" class="text-red-600 hover:underline" onclick="return confirm('Delete?')">Delete</button> | |
| 39 </form> | |
| 40 </td> | |
| 41 </tr> | |
| 42 @empty | |
| 43 <tr> | |
| 44 <td class="p-2" colspan="{{ count($fields)+1 }}">No {{ tableName }} found.</td> | |
| 45 </tr> | |
| 46 @endforelse | |
| 47 </tbody> | |
| 48 </table> | |
| 49 </div> | |
| 50 </div> | |
| 51 </div> | |
| 52 </x-app-layout> |
