table with hotels
This commit is contained in:
32
resources/views/admin/hotels/create.blade.php
Normal file
32
resources/views/admin/hotels/create.blade.php
Normal file
@@ -0,0 +1,32 @@
|
||||
@extends('admin.layout')
|
||||
|
||||
@section('content')
|
||||
<div style="max-width: 600px;">
|
||||
<h1>Добавить отель</h1>
|
||||
|
||||
<form method="POST" action="{{ route('admin.hotels.store') }}">
|
||||
@csrf
|
||||
|
||||
<div style="margin-bottom: 15px;">
|
||||
<label for="name" style="display: block; margin-bottom: 6px; font-weight: 500;">Название *</label>
|
||||
<input type="text" name="name" id="name" required
|
||||
style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box;">
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 15px;">
|
||||
<label for="address" style="display: block; margin-bottom: 6px; font-weight: 500;">Адрес</label>
|
||||
<textarea name="address" id="address" rows="3"
|
||||
style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box;"></textarea>
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 20px;">
|
||||
<label for="phone" style="display: block; margin-bottom: 6px; font-weight: 500;">Телефон</label>
|
||||
<input type="text" name="phone" id="phone"
|
||||
style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box;">
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn">Сохранить</button>
|
||||
<a href="{{ route('admin.hotels.index') }}" class="btn" style="background: #6c757d; text-decoration: none; margin-left: 10px;">Отмена</a>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
33
resources/views/admin/hotels/edit.blade.php
Normal file
33
resources/views/admin/hotels/edit.blade.php
Normal file
@@ -0,0 +1,33 @@
|
||||
@extends('admin.layout')
|
||||
|
||||
@section('content')
|
||||
<div style="max-width: 600px;">
|
||||
<h1>Редактировать отель</h1>
|
||||
|
||||
<form method="POST" action="{{ route('admin.hotels.update', $hotel) }}">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
<div style="margin-bottom: 15px;">
|
||||
<label for="name" style="display: block; margin-bottom: 6px; font-weight: 500;">Название *</label>
|
||||
<input type="text" name="name" id="name" value="{{ old('name', $hotel->name) }}" required
|
||||
style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box;">
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 15px;">
|
||||
<label for="address" style="display: block; margin-bottom: 6px; font-weight: 500;">Адрес</label>
|
||||
<textarea name="address" id="address" rows="3"
|
||||
style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box;">{{ old('address', $hotel->address) }}</textarea>
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 20px;">
|
||||
<label for="phone" style="display: block; margin-bottom: 6px; font-weight: 500;">Телефон</label>
|
||||
<input type="text" name="phone" id="phone" value="{{ old('phone', $hotel->phone) }}"
|
||||
style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box;">
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn">Сохранить</button>
|
||||
<a href="{{ route('admin.hotels.index') }}" class="btn" style="background: #6c757d; text-decoration: none; margin-left: 10px;">Отмена</a>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -1,45 +1,43 @@
|
||||
@extends('admin.layout')
|
||||
|
||||
@section('content')
|
||||
<div>
|
||||
<div>
|
||||
<h1>Отели</h1>
|
||||
|
||||
@if(session('success'))
|
||||
<div class="success">
|
||||
{{ session('success') }}
|
||||
</div>
|
||||
<a href="{{ route('admin.hotels.create') }}" class="btn" style="display: inline-block; margin-bottom: 20px;">Добавить отель</a>
|
||||
|
||||
@if($hotels->isEmpty())
|
||||
<p>Нет отелей.</p>
|
||||
@else
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Название</th>
|
||||
<th>Адрес</th>
|
||||
<th>Телефон</th>
|
||||
<th>Действия</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($hotels as $hotel)
|
||||
<tr>
|
||||
<td>{{ $hotel->name }}</td>
|
||||
<td>{{ $hotel->address ?? '-' }}</td>
|
||||
<td>{{ $hotel->phone ?? '-' }}</td>
|
||||
<td>
|
||||
<a href="{{ route('admin.hotels.edit', $hotel) }}" class="btn" style="background: #6c757d; margin-right: 6px;">Редактировать</a>
|
||||
<form action="{{ route('admin.hotels.destroy', $hotel) }}" method="POST" style="display: inline;">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="btn" style="background: #aaa;" onclick="return confirm('Удалить отель?')">
|
||||
Удалить
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
|
||||
<a href="{{ route('admin.hotels.create') }}" class="btn">Добавить отель</a>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Название</th>
|
||||
<th>Адрес</th>
|
||||
<th>Телефон</th>
|
||||
<th>Действия</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($hotels as $hotel)
|
||||
<tr>
|
||||
<td>{{ $hotel->name }}</td>
|
||||
<td>{{ $hotel->address ?? '-' }}</td>
|
||||
<td>{{ $hotel->phone ?? '-' }}</td>
|
||||
<td>
|
||||
<a href="{{ route('admin.hotels.edit', $hotel) }}" class="btn" style="background: #666;">Редактировать</a>
|
||||
<form action="{{ route('admin.hotels.destroy', $hotel) }}" method="POST" style="display: inline;">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="btn" style="background: #aaa;" onclick="return confirm('Удалить отель?')">
|
||||
Удалить
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user