list_answer.blade.php 11.8 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">

                            @include('employers.emblema')

                    </div>

                    @include('employers.menu', ['item' => 4])
                </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" action="{{ route('employer.answers', ['employer' => $employer->id]) }}" method="GET">
                                    <input type="search" class="input" name="search" id="search" placeholder="Поиск&hellip;" value="@isset($_GET['search']) {{ $_GET['search'] }} @endisset">
                                    <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 class="select">
                                    <select class="js-select2">
                                        <option>Фильтр по вакансиям</option>
                                        <option>Вариант 1</option>
                                        <option>Вариант 2</option>
                                        <option>Вариант 3</option>
                                    </select>
                                </div>-->
                            </div>
                        </div>
                        <div class="responses">
                            <!--<button type="button" class="messages__button js-toggle js-parent-toggle button button_light button_more">
                                <span>Показать ещё</span>
                                <span>Скрыть</span>
                            </button>-->
                            <div class="responses__body">
                                @if ($answer->count())
                                    @foreach ($answer as $it)
                                        @if ($it->response->count())
                                            @foreach($it->response as $el)
                                                <div class="responses__item">
                                                <div class="responses__item-date">{{ $el->created_at }}</div>
                                                <div class="responses__item-wrapper">
                                                    <div class="responses__item-inner">
                                                        <div class="responses__item-row">
                                                            <span>Название вакансии</span>
                                                            {{ $it->name }}
                                                        </div>
                                                        <div class="responses__item-row">
                                                            <span>Имя кандидата</span>
                                                            @if (isset($el->message->user_from->name))
                                                                {{ $el->message->user_from->name }}
                                                            @else
                                                                Удален пользователь
                                                            @endif
                                                        </div>
                                                        <div class="responses__item-row">
                                                            <span>Статус</span>
                                                            @if ($el->flag == 1)
                                                                Новое
                                                            @elseif ($el->flag == 2)
                                                                Отклонить
                                                            @elseif ($el->flag == 3)
                                                                Удержать
                                                            @elseif ($el->flag ==4)
                                                                Удалено
                                                            @endif
                                                        </div>
                                                    </div>
                                                    <div class="responses__item-buttons">
                                                        <a href="{{ route('employer.status_msg', ['employer' => $employer->id,'ad_response' => $el->id, 'flag' => 1]) }}" data-it="{{ $el->id }}" class="button button_light js-toggle supple-btn @if ($el->flag == 1) active @endif">
                                                            <svg>
                                                                <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use>
                                                            </svg>
                                                            Принят
                                                        </a>
                                                        <a href="{{ route('employer.status_msg', ['employer' => $employer->id, 'ad_response' => $el->id, 'flag' => 2]) }}" data-it="{{ $el->id }}" class="button button_light js-toggle cancel-btn @if ($el->flag == 2) active @endif">
                                                            <svg>
                                                                <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use>
                                                            </svg>
                                                            Отклонить
                                                        </a>
                                                        <a href="{{ route('employer.status_msg', ['employer' => $employer->id, 'ad_response' => $el->id, 'flag' => 3]) }}" data-it="{{ $el->id }}" class="button button_light js-toggle time-btn @if ($el->flag == 3) active @endif">
                                                            <svg>
                                                                <use xlink:href="{{ asset('images/sprite.svg#time') }}"></use>
                                                            </svg>
                                                            Удержать
                                                        </a>
                                                        <a href="{{ route('employer.status_msg', ['employer' => $employer->id, 'ad_response' => $el->id, 'flag' => 4]) }}" data-it="{{ $el->id }}" class="button button_light js-toggle delete-btn @if ($el->flag == 4) active @endif">
                                                            <svg>
                                                                <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use>
                                                            </svg>
                                                            Удалить
                                                        </a>
                                                    </div>
                                                </div>
                                            </div>
                                            @endforeach
                                        @endif
                                    @endforeach
                                @else
                                        <div class="notify">
                                            <svg>
                                                <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use>
                                            </svg>
                                            <span>Вам еще никто не написал сообщений</span>
                                        </div>
                                @endif
                            </div>
                        </div>
                    </div>
                </div>

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