list_vacancy.blade.php 11 KB
@extends('layout.frontend', ['title' => 'Список вакансий - РекаМоре'])

@section('scripts')
    <script>
        console.log('Test system');
        $(document).on('change', '#sort_ajax', function() {
            var this_ = $(this);
            var val_ = this_.val();
            console.log('sort items '+val_);

            $.ajax({
                type: "GET",
                url: "{{ route('shipping_companies') }}",
                data: "sort="+val_+"&block=1",
                success: function (data) {
                    console.log('Выбор сортировки');
                    console.log(data);
                    $('#block_1').html(data);
                },
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                },
                error: function (data) {
                    data = JSON.stringify(data);
                    console.log('Error: ' + data);
                }
            });

            $.ajax({
                type: "GET",
                url: "{{ route('shipping_companies') }}",
                data: "sort="+val_+"&block=2",
                success: function (data) {
                    console.log('Выбор сортировки2');
                    console.log(data);
                    history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif");
                    $('#block_2').html(data);
                },
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                },
                error: function (data) {
                    data = JSON.stringify(data);
                    console.log('Error: ' + data);
                }
            });
        });
    </script>
@endsection

@section('content')
    <section class="cabinet">
        <div class="container">
            <ul class="breadcrumbs cabinet__breadcrumbs">
                <li><a href="{{ route('index') }}">Главная</a></li>
                <li><b>Личный кабинет</b></li>
            </ul>
            <div class="cabinet__wrapper">
                <div class="cabinet__side">
                    <div class="cabinet__side-toper">
                        <div class="cabinet__side-toper-pic">
                            @if (isset($Employer->logo))
                                <img src="{{ asset(Storage::url($Employer->logo)) }}" width="150" alt="{{ $Employer->name_company }}">
                            @else
                                <img src="{{ asset('images/logo_emp.png') }}" width="150" alt="{{ $Employer->name_company }}"/>
                            @endif
                        </div>
                        <b>{{ $Employer->name_company }}</b>
                    </div>

                    @include('employers.menu', ['item' => 3])
                </div>
                <div class="cabinet__body">
                    <div class="cabinet__body-item">
                        <h2 class="title cabinet__title">Мои вакансии</h2>
                    </div>
                    <div class="cabinet__body-item">
                        <div class="cabinet__filters">
                            <div class="cabinet__filters-item">
                                <form class="search">
                                    <input type="search" class="input" placeholder="Поиск&hellip;" required>
                                    <button type="submit" class="button">Найти</button>
                                    <span>
                                            <svg>
                                                <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use>
                                            </svg>
                                        </span>
                                </form>
                            </div>
                            <div class="cabinet__filters-item">
                                <div class="select">
                                    <select class="js-select2" id="sort_ajax" name="sort_ajax">
                                        <option value="default">Сортировка (по умолчанию)</option>
                                        <option value="name (asc)">По имени (возрастание)</option>
                                        <option value="name (desc)">По имени (убывание)</option>
                                        <option value="created_at (asc)">По дате (возрастание)</option>
                                        <option value="created_at (desc)">По дате (убывание)</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        @if ($vacancy_list->count())
                            <div class="table table_spoiler">
                                <!--<button type="button" class="table__button js-toggle js-parent-toggle button button_light button_more">
                                    <span>Показать ещё</span>
                                    <span>Свернуть</span>
                                </button>-->
                                <div class="table__scroll">
                                    <div class="table__body table__body_min-width">
                                        <table>
                                            <thead>
                                            <tr>
                                                <th>Название</th>
                                                <th>Дата добавления<br>/&nbsp;обновления</th>
                                                <th>Статус</th>
                                                <th>Действия</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            @foreach($vacancy_list as $it)
                                            <tr>
                                                <td>{{ $it->name }}</td>
                                                <td>{{ $it->created_at }} / {{ $it->updated_at }}</td>
                                                <td>
                                                   @if ($it->active_is)
                                                        <span class="table__status green"><i></i>Опубликовано</span>
                                                   @else
                                                        <span class="table__status"><i></i>Не опубликовано</span>
                                                    @endif
                                                </td>
                                                <td>
                                                    <span class="table__controls">
                                                        <a class="table__controls-item up-it" href="{{ route('employer.vacancy_up', ['ad_employer' => $it->id]) }}">
                                                            <svg>
                                                                <use xlink:href="{{ asset('images/sprite.svg#arrow-radius') }}"></use>
                                                            </svg>
                                                        </a>
                                                        <a href="{{ route('employer.vacancy_edit', ['ad_employer' => $it->id]) }}" class="table__controls-item">
                                                            <svg>
                                                                <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use>
                                                            </svg>
                                                        </a>
                                                        <a class="table__controls-item" href="{{ route('employer.vacancy_delete', ['ad_employer' => $it->id]) }}">
                                                            <svg>
                                                                <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use>
                                                            </svg>
                                                        </a>
                                                        @if ($it->active_is)
                                                            <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 0]) }}" class="table__controls-item">
                                                                <svg>
                                                                    <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use>
                                                                </svg>
                                                            </a>
                                                        @else
                                                            <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 1]) }}" class="table__controls-item">
                                                                <svg>
                                                                    <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use>
                                                                </svg>
                                                            </a>
                                                        @endif

                                                        <!--<button type="button" class="table__controls-item">
                                                            <svg>
                                                                <use xlink:href=" asset('images/sprite.svg#tg') }}"></use>
                                                            </svg>
                                                        </button>
                                                        -->
                                                    </span>
                                                </td>
                                            </tr>
                                            @endforeach
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        @else
                        <div class="notify">
                            <svg>
                                <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use>
                            </svg>
                            <span>Вы ещё не разместили ни одной вакансии</span>
                        </div>
                        @endif
                    </div>
                </div>
            </div>
        </div>
    </section>
    </div>
@endsection