index.blade.php 3.86 KB
@extends('layout.admin', ['title' => 'Офисы'])

@section('content')
    <section class="favorites">
        <div class="favorites-top">
            <div class="container">
                <div class="breadcrumbs">
                    <ul class="breadcrumbs__list">
                        <li class="breadcrumbs__item"><a class="breadcrumbs__link" href="{{ route('user.index') }}">Главная</a></li>
                        <li class="breadcrumbs__item"><span class="breadcrumbs__link">Офисы </span></li>
                    </ul>
                </div>
                <h1 class="favorites__title title-main">Офисы</h1>
            </div>
        </div>
        <div class="favorites-cnt">
            <div class="container">
                <a href="{{ route('admin.houses.create') }}" class="btn hero-search__btn btn--main">
                    Создать офис
                </a><br><br>
                <table class="table" style="width: 100%">
                    <thead>
                    <tr>
                        <th>Фото</th>
                        <th>ID</th>
                        <th>Название офиса</th>
                        <th>Жилой комплекс</th>
                        <th>Адрес</th>
                        <th>Дата создания</th>
                        <th>Действия</th>
                    </tr>
                    </thead>
                    <tbody>
                    @if ($houses->count())
                        @foreach($houses as $house)
                            <tr>
                                <td><? if (empty($house->foto_main)) {?>Нет фото<?} else {?><img src="/storage/app/public/<?=$house->foto_main;//=asset(Storage::url($house->foto_main))?>" width="100px"/><?}?></td>
                                <td>{{ $house->id }}</td>
                                <td>{{ $house->title }}</td>
                                <td>{{ $house->areas->name_area }}</td>
                                <td>{{ $house->address }}</td>
                                <td>{{ $house->created_at }}</td>
                                <td> <form action="{{ route('admin.houses.destroy', $house) }}" method="POST">
                                        <a style="color:green" target="_blank" href="{{ route('offer', ['house' => $house->id]) }}">
                                            Просмотр
                                        </a> |
                                        <a  href="{{ route('admin.houses.edit', ['house' => $house->id]) }}">
                                            Редактировать
                                        </a> |
                                        <a href="{{ route('admin.view.images.houses', ['house' => $house->id]) }}">
                                            Доп.картинки
                                        </a> |

                                        @csrf
                                        @method('DELETE')
                                        <input class=" btn-danger" type="submit" value="Удалить">
                                    </form>
                                </td>
                            </tr>
                        @endforeach
                    @else
                        <tr>
                            <td>-</td>
                            <td>-</td>
                            <td>-</td>
                            <td>-</td>
                            <td>-</td>
                            <td>-</td>
                            <td>-</td>
                        </tr>
                    @endif

                    </tbody>
                </table>
                {{ $houses->onEachSide(1)->links('catalogs.paginate') }}
                <div class="favorites__items">

                </div>
            </div>
        </div>
    </section>
@endsection