cabinet.blade.php 13.9 KB
@extends('layout.frontend', ['title' => 'Образование и образовательные программы - РекаМоре'])

@section('scripts')
    <script>
        console.log('Test system');


        $(document).on('click', '.die_black', function() {
            var this_ = $(this);
            var ajax_ = $('#ajax_flot_div');
            var id_ = this_.attr('data-test');
            var url_ = this_.attr('data-link');

            console.log(url_);
            $.ajax({
                type: "GET",
                url: url_,
                success: function (data) {
                    console.log('Ответка');
                    ajax_.html(data);
                },
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                },
                error: function (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[0]->logo))
                                <img src="{{ asset(Storage::url($Employer[0]->logo)) }}" width="150" alt="{{ $Employer[0]->name_company }}">
                            @else
                                <img src="{{ asset('images/logo_emp.png') }}" width="150" alt="{{ $Employer[0]->name_company }}"/>
                            @endif
                        </div>
                        <b>{{ $Employer[0]->name_company }}</b>
                    </div>

                    @include('employers.menu')

                </div>
                <div class="cabinet__body">
                    @include('messages_error')

                <form  action="{{ route('employer.cabinet_save', ['Employer' => $Employer[0]->id]) }}" method="POST" enctype="multipart/form-data">
                    @csrf
                    <div class="cabinet__body-item">
                        <div class="cabinet__descr">
                            <h2 class="title cabinet__title">Мой профиль</h2>
                            <p class="cabinet__text">Все поля обязательны для заполнения *</p>
                        </div>
                        <div class="cabinet__avatar">
                            <div class="cabinet__avatar-pic">
                                @if (isset($Employer[0]->logo))
                                    <img src="{{ asset(Storage::url($Employer[0]->logo)) }}" width="150" alt="{{ $Employer[0]->name_company }}">
                                @else
                                    <img src="{{ asset('images/logo_emp.png') }}" width="150" alt="{{ $Employer[0]->name_company }}"/>
                                @endif
                            </div>
                            <div class="cabinet__avatar-form">
                                <label class="file">
                                        <span class="file__input">
                                            <input type="file" name="logo">
                                            <span class="button">
                                                <svg>
                                                    <use xlink:href="{{ asset('images/sprite.svg#plus') }}"></use>
                                                </svg>
                                                Загрузить
                                            </span>
                                        </span>
                                </label>
                                <p class="cabinet__text">Загрузите логотип в формате .svg, .jpg, .png или .jpeg</p>
                            </div>
                        </div>
                        <div class="cabinet__inputs">
                            <div class="cabinet__inputs-item form-group">
                                <label class="form-group__label">Название судоходной компании</label>
                                <div class="form-group__item">
                                    <input type="text" class="input" name="name_company" id="name_company" placeholder="ООО Река Море" value="{{ old('name_company') ?? $Employer[0]->name_company ?? '' }}" required>
                                    @error('name_company')
                                    <span class="text-xs text-red-600">
                                          {{ $message }}
                                    </span>
                                    @enderror
                                </div>
                            </div>
                            <div class="cabinet__inputs-item form-group">
                                <label class="form-group__label">Электронная почта</label>
                                <div class="form-group__item">
                                    <input type="email" name="email" class="input" placeholder="info@rekamore.su" value="{{ old('email') ?? $Employer[0]->email ?? '' }}" required>
                                    @error('email')
                                    <span class="text-xs text-red-600">
                                          {{ $message }}
                                    </span>
                                    @enderror
                                </div>
                            </div>
                            <div class="cabinet__inputs-item form-group">
                                <label class="form-group__label">Номер телефона</label>
                                <div class="form-group__item">
                                    <input type="tel" name="telephone" class="input" placeholder="+7 (___) ___-__-__" value="{{ old('telephone') ?? $Employer[0]->telephone ?? '' }}" required>
                                    @error('telephone')
                                    <span class="text-xs text-red-600">
                                          {{ $message }}
                                    </span>
                                    @enderror
                                </div>
                            </div>
                            <div class="cabinet__inputs-item form-group">
                                <label class="form-group__label">Адрес компании</label>
                                <div class="form-group__item">
                                    <input type="text" name="address" class="input" value="{{ old('address') ?? $Employer[0]->address ?? '' }}" placeholder="692904, Приморский край, г. Находка, ул. Портовая 3А, 5 этаж" required>
                                    @error('address')
                                    <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="url" name="site" class="input" value="{{ old('site') ?? $Employer[0]->site ?? '' }}" placeholder="https://rekamore.su" required>
                                    @error('site')
                                    <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">
                                    <textarea name="text" class="textarea" required>{{ old('text') ?? $Employer[0]->text ?? '' }}</textarea>
                                    @error('text')
                                    <span class="text-xs text-red-600">
                                          {{ $message }}
                                    </span>
                                    @enderror
                                </div>
                            </div>
                        </div>
                    </div><br>
                    <button type="submit" class="button cabinet__submit">Сохранить изменения</button>
                </form>

                    <div class="cabinet__body-item">
                        <div class="cabinet__descr">
                            <h2 class="title cabinet__title">Мой флот</h2>
                        </div>

                        <form action="{{ route('employer.save_add_flot') }}" method="POST" class="cabinet__add" enctype="multipart/form-data">
                            @csrf
                            <label class="cabinet__add-pic" style="vertical-align: top">
                                <input type="file" name="image" id="image">
                                <input type="hidden" name="employer_id" id="employer_id" value="{{ $Employer[0]->id }}"/>
                                <svg>
                                    <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
                                </svg>
                                <span>
                                        <svg>
                                            <use xlink:href="{{ asset('images/sprite.svg#plus') }}"></use>
                                        </svg>
                                        Загрузить фото
                                    </span>
                            </label>

                            <div class="cabinet__add-body">
                                <div class="form-group">
                                    <label class="form-group__label">Название корабля</label>
                                    <div class="form-group__item">
                                        <input type="text" name="name" id="flot_name" class="input" placeholder="Корабль №000001" required>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="form-group__label">Описание</label>
                                    <div class="form-group__item">
                                        <input type="text" name="text" id="flot_text" class="input" placeholder="Это судно находится..." required>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="form-group__label">Регион</label>
                                    <div class="form-group__item">
                                        <input type="text" name="region" id="region" class="input" placeholder="Мурманск" required>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="form-group__label">Мощность</label>
                                    <div class="form-group__item">
                                        <input type="text" name="power" id="flot_power" class="input" placeholder="Dw 40000 9000Kw" required>
                                    </div>
                                </div>
                                <button type="submit" class="button" id="ajax_flot" name="ajax_flot">Добавить флот</button>
                            </div>

                        </form>

                        <div class="cabinet__fleet" id="ajax_flot_div" name="ajax_flot_div">
                            @if (isset($Employer[0]->flots))
                              @if ($Employer[0]->flots->count())
                                  @foreach ($Employer[0]->flots as $it)
                                    <div class="cabinet__fleet-item main__employer-page-one-item">
                                        <div class="del die_black" data-test="{{ $it->id }}" data-link="{{ route('employer.delete_flot', ['Flot' => $it->id]) }}">
                                            <svg>
                                                <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use>
                                            </svg>
                                        </div>
                                        @if (!empty($it->image))
                                            <img src="{{ asset(Storage::url($it->image)) }}" alt="{{ $it->name }}">
                                        @else
                                            <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $it->name }}"/>
                                        @endif
                                        <b>{{ $it->name }}</b>
                                        <span>{{ $it->text }}</span>
                                    </div>
                                 @endforeach
                              @endif
                            @endif
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    </div> <!-- END TOP WRAPPER -->
@endsection