edit_vacancy.blade.php 14.1 KB
@extends('layout.frontend', ['title' => 'Редактирование вакансии РекаМоре'])

@section('scripts')
    <script>
        console.log('Приближаемся к системе, нас рой тут...');
        $(document).on('change', '#position_id', function() {
            var this_ = $(this);
            var val_ = this_.val();
            var ajax_ = $('#job_title_id');

            console.log('Создания списка людей, которые поднимутся на корабль...');

            $.ajax({
                type: "GET",
                url: "{{ route('employer.selected_people') }}",
                data: "id="+val_,
                success: function (data) {
                    console.log('Ответка пришла');
                    console.log('Список избранных людей создан');
                    ajax_.html(data);
                },
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                },
                error: function (data) {
                    console.log('Обрыв связи');
                    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' => 3])

                </div>

                <form class="cabinet__body" action="{{ route('employer.vacancy_save_me', ['ad_employer' => $Employer->id]) }}" method="POST">
                    @csrf
                    <input type="hidden" name="employer_id" value="{{ $Employer->id }}"/>
                    <div class="cabinet__body-item">
                        <div class="cabinet__descr">
                            <h2 class="title cabinet__title">Редактировать вакансию</h2>
                            <p class="cabinet__text"><b>Данные по вакансии</b></p>
                            <p class="cabinet__text">Все поля обязательны для заполнения *</p>
                        </div>
                    </div>
                    <div class="cabinet__body-item">
                            <h4>Поля для вакансии</h4>
                            <div class="cabinet__inputs">
                                <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
                                    <label class="form-group__label">Название вакансии</label>
                                    <div class="form-group__item">
                                        <input type="text" class="input" name="name" id="name" placeholder="Работа в море" value="{{ old('name') ?? $ad_employer->name ?? '' }}" required>
                                        @error('name')
                                        <span class="text-xs text-red-600 dark:text-red-400">
                                          {{ $message }}
                                    </span>
                                        @enderror
                                    </div>
                                </div>

                                <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none">
                                    <label class="form-group__label">Телефон</label>
                                    <div class="form-group__item">
                                        <input type="text" class="input" name="telephone" id="telephone" value="{{ old('telephone') ?? $ad_employer->telephone ?? '' }}" placeholder="Свой телефон">
                                        @error('telephone')
                                        <span class="text-xs text-red-600 dark:text-red-400">
                                          {{ $message }}
                                    </span>
                                        @enderror
                                    </div>
                                </div>

                                <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none">
                                    <label class="form-group__label">Емайл</label>
                                    <div class="form-group__item">
                                        <input type="text" class="input" name="email" id="email" value="{{ old('email') ?? $ad_employer->email ?? '' }}" placeholder="Своя почту">
                                        @error('email')
                                        <span class="text-xs text-red-600 dark:text-red-400">
                                          {{ $message }}
                                    </span>
                                        @enderror
                                    </div>
                                </div>

                                <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none">
                                    <label class="form-group__label">Зарплата среднестатистическая для вакансии</label>
                                    <div class="form-group__item">
                                        <input type="text" class="input" name="salary" id="salary" value="{{ old('salary') ?? $ad_employer->salary ??'' }}" placeholder="Среднестатистическая зарплата">
                                        @error('salary')
                                        <span class="text-xs text-red-600 dark:text-red-400">
                                          {{ $message }}
                                    </span>
                                        @enderror
                                    </div>
                                </div>

                                <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display: none">
                                    <label class="form-group__label">Город посадки</label>
                                    <div class="form-group__item">
                                        <input type="text" class="input" name="city" id="city" value="{{ old('city') ?? $ad_employer->city ?? 'Не указан' }}" placeholder="Севастополь">
                                        @error('city')
                                        <span class="text-xs text-red-600">
                                          {{ $message }}
                                    </span>
                                        @enderror
                                    </div>
                                </div>
                                <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="">
                                    <label class="form-group__label">Категория (локация)</label>
                                    <div class="form-group__item">
                                        <div class="select">
                                            <select class="js-select2" name="category_id" id="category_id">
                                                php $i = 1 endphp
                                                if ($Positions->count())
                                                    foreach($Positions as $j)
                                                        if ($i == 1) <option> Выберите категорию из списка</option>
                                                        else
                                                            <option value=" $j->id }}" if ($ad_employer->category_id == $j->id) selected endif>$j->name }}</option>
                                                        endif
                                                        php $i++ endphp
                                                    endforeach
                                                endif
                                            </select>
                                            error('category_id')
                                            <span class="text-xs text-red-600 dark:text-red-400">
                                               $message }}
                                        </span>
                                            enderror
                                        </div>
                                    </div>
                                </div>-->

                                <!--foreach ($ad_employer->jobs_code as $it_um)
                                    <pre> print_r($it_um) }}</pre>
                                endforeach-->
                                <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
                                    <label class="form-group__label">Редактирование должностей</label>
                                    <div class="form-group__item">
                                        <div class="select">
                                            <select class="js-select2" name="job_title_id[]" id="job_title_id[]" multiple="multiple">
                                                @php $i = 1 @endphp
                                                @if ($jobs->count())
                                                    @foreach($jobs as $it)
                                                        @php $selected = false; @endphp
                                                            @foreach ($ad_employer->jobs_code as $it_um)
                                                            @if (isset($it_um->job_title_id))
                                                                    @if ($it_um->job_title_id == $it->id))
                                                                        @php $selected = true; @endphp
                                                                    @endif
                                                            @endif
                                                            @endforeach
                                                        <option value="{{ $it->id }}" @if ($selected) selected @endif>{{ $it->name }}</option>
                                                    @endforeach
                                                @endif
                                            </select>
                                        </div>
                                    </div>
                                </div>

                                <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
                                    <label class="form-group__label">Описание вакансии</label>
                                    <div class="form-group__item">
                                        <textarea class="textarea ckeditor" name="text" id="text">{{ old('text') ?? $ad_employer->text ?? '' }}</textarea>
                                        @error('text')
                                        <span class="text-xs text-red-600">
                                          {{ $message }}
                                    </span>
                                        @enderror
                                    </div>
                                </div>

                                <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
                                    <h4 class="form-group__label">Редактирование должностей</h4>
                                    <div class="form-group__item">
                                        <a href=" route('employer.add_job_in_vac', ['ad_employer' => $ad_employer->id]) }}" class="button">Добавить</a>

                                        if ($ad_employer->jobs->count())
                                            foreach ($ad_employer->jobs as $key => $it_um)
                                                <p>if (isset($ad_employer->jobs_code[$key]))
                                                        <a href=" route('employer.edit_job_in_vac', ['ad_job' => $ad_employer->jobs_code[$key]->id, 'ad_employer' => $ad_employer->id, 'job_title_id' => $it_um->id]) }}" style="text-decoration: underline">$it_um->name}}</a>
                                                        <a href=" route('employer.delete_job_in_vac', ['ad_job' => $ad_employer->jobs_code[$key]->id]) }}" style="text-decoration: underline">(Del)</a>
                                                    endif
                                                </p>
                                            endforeach
                                        else
                                            Нет связанных <br> с вакансией должностей
                                        endif
                                    </div>
                                </div>-->
                            </div>

                        <a class="button cabinet__submit" href="{{ route('employer.vacancy_list') }}">Назад</a>
                        <button type="submit" class="button cabinet__submit">Опубликовать</button>
                    </div>
                </form>
            </div>
        </div>
    </section>
    </div>
    <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script>
    <script>
        CKEDITOR.replace('text');
        //CKEDITOR.replace( 'text', {
        //     filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}",
        //     filebrowserImageUploadUrl: "{{ route('ckeditor.image-upload', ['_token' => csrf_token() ])}}",
        //     filebrowserUploadMethod: 'form'
        // });
    </script>
@endsection