add_vacancy.blade.php 20.6 KB
@extends('layout.frontend', ['title' => 'Добавление вакансии РекаМоре'])

@section('scripts')
    <script>
        console.log('Приближаемся к системе, нас рой тут...');
        $(document).on('change', '#category_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' => 2])

                </div>

                <form class="cabinet__body" action="{{ route('employer.vac_save') }}" method="POST">
                    @csrf
                    <input type="hidden" name="employer_id" value="{{ $Employer[0]->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') ?? $Employer[0]->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">
                                <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
                                                    @if (isset($Worker[0]->job_titles))
                                                        @if ($Worker[0]->job_titles->count())
                                                            @foreach($Worker[0]->job_titles as $select)
                                                                @if ($it->id == $select->id)
                                                                    @php $selected = true; @endphp
                                                                @endif
                                                            @endforeach
                                                        @endif
                                                    @endif
                                                    <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" 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') ?? $Employer[0]->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') ?? $Employer[0]->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="0" 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') ?? $Employer[0]->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">
                                <label class="form-group__label">Категория (локация)</label>
                                <div class="form-group__item">
                                    <div class="select">
                                        <select class="js-select2" name="category_id" id="category_id">
                                            <option selected> Выберите категорию из списка</option>
                                            _php $i = 1 _endphp
                                            _if ($categories->count())
                                                _foreach($categories as $j)
                                                        <option value=" $j->id }}"> $j->name }}</option>
                                                    _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>-->

                            <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') ?? '' }}</textarea>
                                    @error('text')
                                    <span class="text-xs text-red-600">
                                          {{ $message }}
                                    </span>
                                    @enderror
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="cabinet__body-item">
                           <!-- <div class="cabinet__body-item">
                                <div class="cabinet__descr">
                                    <p class="cabinet__text"><b>Добавление должности</b></p>
                                </div>
                            </div>

                            <!--<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">
                                            php $i = 1 endphp
                                            if ($jobs->count())
                                                foreach($jobs as $j)
                                                    if ($i == 1) <option selected> Выберите должность из списка</option>
                                                    else
                                                        <option value=" $j->id }}"> $j->name }}</option>
                                                    endif
                                                    php $i++ endphp
                                                endforeach
                                            endif
                                        </select>
                                        error('job_title_id')
                                        <span class="text-xs text-red-600 dark:text-red-400">
                                               $message }}
                                        </span>
                                        enderror
                                    </div>
                                </div>
                            </div>-->

                            <div class="cabinet__inputs-item cabinet__inputs-item_max form-group">

                            </div>

                            <!--<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="min_salary" id="min_salary" value=" old('min_salary') ?? '' }}" placeholder="Минимальная зарплата">
                                    error('min_salary')
                                    <span class="text-xs text-red-600">
                                           $message }}
                                    </span>
                                    enderror
                                </div>
                            </div>

                            <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="max_salary" id="max_salary" value=" old('max_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">
                                <label class="form-group__label">Регион отплытия</label>
                                <div class="form-group__item">
                                    <input type="text" class="input" name="region" id="region" value=" old('region') ?? $Employer[0]->city ?? '' }}" placeholder="Севастополь">
                                    error('region')
                                    <span class="text-xs text-red-600">
                                           $message }}
                                    </span>
                                    enderror
                                </div>
                            </div>

                            <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="power" id="power" value=" old('power') ?? '' }}" placeholder="POWER-45">
                                    error('power')
                                    <span class="text-xs text-red-600">
                                           $message }}
                                    </span>
                                    enderror
                                </div>
                            </div>

                            <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="sytki" id="sytki" value=" old('sytki') ?? '' }}" placeholder="2000">
                                    error('power')
                                    <span class="text-xs text-red-600">
                                           $message }}
                                    </span>
                                    enderror
                                </div>
                            </div>

                            <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="start" id="start" value=" old('start') ?? '' }}" placeholder="20 сентября 2024">
                                    error('power')
                                    <span class="text-xs text-red-600">
                                           $message }}
                                    </span>
                                    enderror
                                </div>
                            </div>

                            <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="flot" id="flot">
                                            <option value="" selected> Не указан корабль</option>
                                            if ($Employer[0]->flots->count())
                                                foreach($Employer[0]->flots as $j)
                                                    <option value=" $j->name }}"> $j->name }} ( $j->id }})</option>
                                                endforeach
                                            endif
                                        </select>
                                        error('flot')
                                        <span class="text-xs text-red-600">
                                               $message }}
                                        </span>
                                        enderror
                                    </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" name="description" id="description"> old('description') ?? '' }}</textarea>
                                    error('description')
                                    <span class="text-xs text-red-600">
                                           $message }}
                                    </span>
                                    enderror
                                </div>
                            </div>-->

                        </div>
                        <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