Mercurial > packages > magicforger
comparison src/Generator/View/stubs/create_edit.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 {{ isset($item) ? 'Edit' : 'Create' }} {{ ucfirst('{{ modelVariable }}') }} | |
| 5 </h2> | |
| 6 </x-slot> | |
| 7 | |
| 8 <div class="py-12"> | |
| 9 <div class="max-w-2xl mx-auto sm:px-6 lg:px-8"> | |
| 10 <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg p-6"> | |
| 11 <form method="POST" action="{{ isset($item) ? route('{{ tableName }}.update', $item) : route('{{ tableName }}.store') }}"> | |
| 12 @csrf | |
| 13 @if(isset($item)) | |
| 14 @method('PUT') | |
| 15 @endif | |
| 16 | |
| 17 @foreach($fields as $field) | |
| 18 <div class="mb-4"> | |
| 19 <label for="{{ $field }}" class="block text-gray-700">{{ ucfirst($field) }}</label> | |
| 20 <input type="text" name="{{ $field }}" id="{{ $field }}" | |
| 21 class="mt-1 block w-full rounded border-gray-300 shadow-sm focus:ring focus:ring-blue-200" | |
| 22 value="{{ old('$field', isset($item) ? $item->$field : '') }}"> | |
| 23 @error($field) | |
| 24 <span class="text-red-600 text-sm">{{ $message }}</span> | |
| 25 @enderror | |
| 26 </div> | |
| 27 @endforeach | |
| 28 | |
| 29 <div class="flex justify-end"> | |
| 30 <a href="{{ route('{{ tableName }}.index') }}" class="mr-2 px-4 py-2 bg-gray-200 rounded hover:bg-gray-300">Back</a> | |
| 31 <button type="submit" class="px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700"> | |
| 32 {{ isset($item) ? 'Update' : 'Create' }} | |
| 33 </button> | |
| 34 </div> | |
| 35 </form> | |
| 36 </div> | |
| 37 </div> | |
| 38 </div> | |
| 39 </x-app-layout> |
