Commit e5cf2b39d22769d0a2fd211e36ed2c10c0b9e60b

Authored by Андрей Ларионов
Exists in master

Коммит блейд добавление вакансии

Showing 14 changed files Side-by-side Diff

app/Http/Controllers/EmployerController.php
... ... @@ -131,6 +131,26 @@ class EmployerController extends Controller
131 131 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен');
132 132 }
133 133  
  134 + public function edit_flot(Flot $Flot, Employer $Employer) {
  135 + return view('employers.edit-flot', compact('Flot', 'Employer'));
  136 + }
  137 +
  138 + public function update_flot(FlotRequest $request, Flot $Flot) {
  139 + $params = $request->all();
  140 +
  141 + if ($request->has('image')) {
  142 + if (!empty($flot->image)) {
  143 + Storage::delete($flot->image);
  144 + }
  145 + $params['image'] = $request->file('image')->store("flot", 'public');
  146 + } else {
  147 + if (!empty($flot->image)) $params['image'] = $flot->image;
  148 + }
  149 +
  150 + $Flot->update($params);
  151 + return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен');
  152 + }
  153 +
134 154 public function delete_flot(Flot $Flot) {
135 155 $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get();
136 156  
... ... @@ -143,9 +163,9 @@ class EmployerController extends Controller
143 163 $id = Auth()->user()->id;
144 164  
145 165 $categories = Category::query()->active()->get();
146   - $Positions = Category::query()->active()->get();
147   - if ($Positions->count()) {
148   - $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->Notbdif()->where('position_id', $Positions[0]->id)->get();
  166 +
  167 + if ($categories->count()) {
  168 + $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->Notbdif()->where('position_id', $categories[0]->id)->get();
149 169 } else {
150 170 $jobs = Job_title::query()->OrderBy('name')->where('is_remove', '=', '0')->Notbdif()->where('position_id', 0)->get();
151 171 }
... ... @@ -154,8 +174,7 @@ class EmployerController extends Controller
154 174 WhereHas('users',
155 175 function (Builder $query) use ($id) {$query->Where('id', $id);
156 176 })->get();
157   -
158   - return view('employers.add_vacancy', compact('Employer', 'jobs' , 'categories', 'Positions'));
  177 + return view('employers.add_vacancy', compact('Employer', 'jobs' , 'categories'));
159 178 }
160 179  
161 180 // Сохранение вакансии
... ... @@ -563,6 +582,8 @@ class EmployerController extends Controller
563 582 }
564 583  
565 584 $Workers = $Workers->get();
  585 +
  586 +
566 587 return view('employers.favorite', compact('Workers'));
567 588 }
568 589  
app/Http/Controllers/MainController.php
... ... @@ -79,6 +79,7 @@ class MainController extends Controller
79 79 groupBy('job_titles.id')->orderByDesc('job_titles.position_id')->
80 80 orderByDesc('job_titles.sort')->get()->toArray();
81 81  
  82 +
82 83 $Main_Job = array();
83 84 $name_cat = '';
84 85 foreach ($Data as $it) {
... ... @@ -108,10 +109,9 @@ class MainController extends Controller
108 109  
109 110 if ($request->has('code_record')) {
110 111 if ($request->has('delete')) {
  112 + $code = $request->get('code_record');
111 113 $atomic_era = Like_vacancy::select('id')->
112   - where('code_record', '=', $request->
113   - get('code_record'))->first();
114   -
  114 + where('code_record', '=', $code)->toSql();
115 115 DB::table('like_vacancy')->where('code_record', $request->get('code_record'))->delete();
116 116  
117 117 } else {
app/Http/Requests/FlotRequest.php
... ... @@ -26,10 +26,10 @@ class FlotRequest extends FormRequest
26 26 return [
27 27 'name' => 'required|min:3|max:255',
28 28 'text' => 'required|min:5',
29   - 'image' => [
30   - 'mimes:jpeg,jpg,png',
31   - 'max:20000'
32   - ],
  29 + //'image' => [
  30 + // 'mimes:jpeg,jpg,png',
  31 + // 'max:20000'
  32 + //],
33 33 'region' => 'required|min:3|max:255',
34 34 'power' => 'required|min:3|max:255'
35 35 ];
resources/views/employers/add_vacancy.blade.php
... ... @@ -128,13 +128,11 @@
128 128 <div class="form-group__item">
129 129 <div class="select">
130 130 <select class="js-select2" name="category_id" id="category_id">
  131 + <option selected> Выберите категорию из списка</option>
131 132 @php $i = 1 @endphp
132 133 @if ($categories->count())
133 134 @foreach($categories as $j)
134   - @if ($i == 1) <option selected> Выберите категорию из списка</option>
135   - @else
136 135 <option value="{{ $j->id }}">{{ $j->name }}</option>
137   - @endif
138 136 @php $i++ @endphp
139 137 @endforeach
140 138 @endif
resources/views/employers/edit-flot.blade.php
... ... @@ -0,0 +1,147 @@
  1 +@extends('layout.frontend', ['title' => 'Редактирование флота - РекаМоре'])
  2 +
  3 +@section('scripts')
  4 + <script src="https://cdn.ckeditor.com/ckeditor5/23.0.0/classic/ckeditor.js"></script>
  5 + <script>
  6 + ClassicEditor
  7 + .create( document.querySelector( '#txtarea' ) )
  8 + .catch( error => {
  9 + console.error( error );
  10 + } );
  11 + </script>
  12 +@endsection
  13 +@section('content')
  14 + <section class="cabinet">
  15 + <div class="container">
  16 + <ul class="breadcrumbs cabinet__breadcrumbs">
  17 + <li><a href="{{ route('index') }}">Главная</a></li>
  18 + <li><b>Личный кабинет</b></li>
  19 + </ul>
  20 + <div class="cabinet__wrapper">
  21 + <div class="cabinet__side">
  22 + <div class="cabinet__side-toper">
  23 + @include('employers.emblema')
  24 + </div>
  25 +
  26 + @include('employers.menu', ['item' => 12])
  27 +
  28 + </div>
  29 + <div class="cabinet__body">
  30 + @include('messages_error')
  31 +
  32 + <div class="cabinet__body-item">
  33 + <div class="cabinet__descr">
  34 + <h2 class="title cabinet__title">Редактирование флота</h2>
  35 + </div>
  36 +
  37 + <form action="{{ route('employer.update_flot_save', ['Flot' => $Flot->id]) }}" enctype="multipart/form-data" method="POST" class="cabinet__add">
  38 + @csrf
  39 + <label class="cabinet__add-pic" style="vertical-align: top">
  40 + <input type="file" name="image" id="image">
  41 + @error('image')
  42 + <span class="text-xs text-red-600">
  43 + {{ $message }}
  44 + </span>
  45 + @enderror
  46 + <input type="hidden" name="employer_id" id="employer_id" value="{{ $Employer->id }}"/>
  47 + <svg>
  48 + <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
  49 + </svg>
  50 + <span>
  51 + <svg>
  52 + <use xlink:href="{{ asset('images/sprite.svg#plus') }}"></use>
  53 + </svg>
  54 + Загрузить фото
  55 + </span>
  56 + </label>
  57 +
  58 + <div class="cabinet__add-body">
  59 + <div class="form-group">
  60 + <label class="form-group__label">Название</label>
  61 + <div class="form-group__item">
  62 + <input type="text" name="name" id="flot_name" class="input" value="{{ old('name') ?? $Flot->name ?? '' }}" placeholder="Корабль №000001" required>
  63 + @error('name')
  64 + <span class="text-xs text-red-600">
  65 + {{ $message }}
  66 + </span>
  67 + @enderror
  68 + </div>
  69 + </div>
  70 + <div class="form-group" style="display:none">
  71 + <label class="form-group__label">Описание</label>
  72 + <div class="form-group__item">
  73 + <input type="text" name="text" id="flot_text" class="input" placeholder="Это судно находится..." value="{{ old('text') ?? $Flot->text ?? '' }}">
  74 + @error('text')
  75 + <span class="text-xs text-red-600">
  76 + {{ $message }}
  77 + </span>
  78 + @enderror
  79 + </div>
  80 + </div>
  81 + <div class="form-group" style="display:none">
  82 + <label class="form-group__label">Регион</label>
  83 + <div class="form-group__item">
  84 + <input type="text" name="region" id="region" class="input" placeholder="Мурманск" value="{{ old('region') ?? $Flot->region ?? '' }}">
  85 + @error('region')
  86 + <span class="text-xs text-red-600">
  87 + {{ $message }}
  88 + </span>
  89 + @enderror
  90 + </div>
  91 + </div>
  92 + <div class="form-group" style="display:none">
  93 + <label class="form-group__label">Мощность</label>
  94 + <div class="form-group__item">
  95 + <input type="text" name="power" id="flot_power" class="input" placeholder="Dw 40000 9000Kw" value="{{ old('power') ?? $Flot->power ?? '' }}">
  96 + @error('power')
  97 + <span class="text-xs text-red-600">
  98 + {{ $message }}
  99 + </span>
  100 + @enderror
  101 + </div>
  102 + </div>
  103 + <div class="form-group">
  104 + <label class="form-group__label">DWT</label>
  105 + <div class="form-group__item">
  106 + <input type="text" name="DWT" id="flot_DWT" class="input" placeholder="4000 т" value="{{ old('DWT') ?? $Flot->DWT ?? '' }}">
  107 + @error('DWT')
  108 + <span class="text-xs text-red-600">
  109 + {{ $message }}
  110 + </span>
  111 + @enderror
  112 + </div>
  113 + </div>
  114 + <div class="form-group">
  115 + <label class="form-group__label">Мощность ГД (кВт)</label>
  116 + <div class="form-group__item">
  117 + <input type="text" name="POWER_GD" id="flot_POWER_GD" class="input" placeholder="14000 кВт" value="{{ old('POWER_GD') ?? $Flot->POWER_GD ?? '' }}">
  118 + @error('POWER_GD')
  119 + <span class="text-xs text-red-600">
  120 + {{ $message }}
  121 + </span>
  122 + @enderror
  123 + </div>
  124 + </div>
  125 + <div class="form-group" style="">
  126 + <label class="form-group__label">IMO</label>
  127 + <div class="form-group__item">
  128 + <input type="text" name="IMO" id="flot_IMO" class="input" placeholder="8814275" value="{{ old('IMO') ?? $Flot->IMO ?? '' }}">
  129 + @error('IMO')
  130 + <span class="text-xs text-red-600">
  131 + {{ $message }}
  132 + </span>
  133 + @enderror
  134 + </div>
  135 + </div>
  136 + <button type="submit" class="button" id="ajax_flot-" name="ajax_flot-">Сохранить флот</button>
  137 + </div>
  138 + </form>
  139 + </div>
  140 + </div>
  141 + </div>
  142 + </div>
  143 +
  144 + </section>
  145 + </div>
  146 + <!-- END TOP WRAPPER -->
  147 +@endsection
resources/views/employers/favorite.blade.php
... ... @@ -46,7 +46,7 @@
46 46 });
47 47 });
48 48 </script>
49   - @include('js.favorite-vacancy-45')
  49 + @include('js.favorite-worker')
50 50 @endsection
51 51  
52 52 @section('content')
... ... @@ -104,7 +104,7 @@
104 104 @foreach ($Workers as $it)
105 105 <div class="cvs__body">
106 106 <div class="cvs__item">
107   - <button type="button" data-val="{{ $it->id }}" class="like cvs__item-like js_vac_favorite js-toggle {{ \App\Classes\LikesClass::get_status_worker($it) }}">
  107 + <button type="button" id="elem_{{ $it->id }}" data-val="{{ $it->id }}" class="like cvs__item-like js_box_favorit js-toggle {{ \App\Classes\LikesClass::get_status_worker($it) }}">
108 108 <svg>
109 109 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use>
110 110 </svg>
... ... @@ -113,7 +113,11 @@
113 113 <svg>
114 114 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
115 115 </svg>
116   - <img src="{{ asset('images/default_man.jpg') }}" alt="">
  116 + @if (!empty($it->photo))
  117 + <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($it->photo)) }}" alt="">
  118 + @else
  119 + <img src="{{ asset('images/default_man.jpg') }}" alt="">
  120 + @endif
117 121 </div>
118 122 <div class="cvs__item-text">
119 123 <div>
resources/views/employers/fly-flot.blade.php
... ... @@ -133,7 +133,7 @@
133 133 @enderror
134 134 </div>
135 135 </div>
136   - <button type="submit" class="button" id="ajax_flot" name="ajax_flot">Добавить флот</button>
  136 + <button type="submit" class="button" id="ajax_flot_" name="ajax_flot_">Добавить флот</button>
137 137 </div>
138 138  
139 139 </form>
... ... @@ -143,11 +143,18 @@
143 143 @if ($Employer[0]->flots->count())
144 144 @foreach ($Employer[0]->flots as $it)
145 145 <div class="cabinet__fleet-item main__employer-page-one-item">
  146 + <div style="margin-bottom: -10px">
146 147 <a class="del die_black" href="{{ route('employer.delete_flot', ['Flot' => $it->id]) }}">
147 148 <svg>
148 149 <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use>
149 150 </svg>
150 151 </a>
  152 + <a href="{{ route('employer.edit_flot', ['Flot' => $it->id, 'Employer' => $Employer[0]->id]) }}" class="del die_black" style="margin-left: 40px">
  153 + <svg>
  154 + <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use>
  155 + </svg>
  156 + </a>
  157 + </div>
151 158 @if (!empty($it->image))
152 159 <img src="{{ asset(Storage::url($it->image)) }}" alt="{{ $it->name }}">
153 160 @else
resources/views/layout/pdf-list-people.blade.php
... ... @@ -345,6 +345,23 @@
345 345 </ul>
346 346 </div>
347 347 @endforeach
  348 + @else
  349 + <div class="main__resume-profile-info-body-item">
  350 + <h3 class="main__resume-profile-info-body-subtitle">Не указано</h3>
  351 + <ul class="main__resume-profile-info-body-inner">
  352 + <li>
  353 + <b>Руководитель</b>
  354 + <span>Нет сведений</span>
  355 + </li>
  356 + <li>
  357 + <b>Телефон того, кто может дать рекомендацию</b>
  358 + <span>
  359 + <a>Нет сведений</a>
  360 + </span>
  361 + </li>
  362 + </ul>
  363 + </div>
  364 +
348 365 @endif
349 366 </div>
350 367 </div>
resources/views/layout/pdf.blade.php
... ... @@ -338,6 +338,22 @@
338 338 </ul>
339 339 </div>
340 340 @endforeach
  341 + @else
  342 + <div class="main__resume-profile-info-body-item">
  343 + <h3 class="main__resume-profile-info-body-subtitle">Не указано</h3>
  344 + <ul class="main__resume-profile-info-body-inner">
  345 + <li>
  346 + <b>Руководитель</b>
  347 + <span>Нет сведений</span>
  348 + </li>
  349 + <li>
  350 + <b>Телефон того, кто может дать рекомендацию</b>
  351 + <span>
  352 + <a>Нет сведений</a>
  353 + </span>
  354 + </li>
  355 + </ul>
  356 + </div>
341 357 @endif
342 358 </div>
343 359 </div>
resources/views/workers/cabinet.blade.php
... ... @@ -617,19 +617,19 @@
617 617 </div>
618 618 </div>
619 619 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
620   - <label class="form-group__label">Директор</label>
  620 + <label class="form-group__label">ФИО сотрудника</label>
621 621 <div class="form-group__item">
622 622 <input type="text" class="input" value="{{ $it->direct }}" disabled>
623 623 </div>
624 624 </div>
625 625 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
626   - <label class="form-group__label">Телефон</label>
  626 + <label class="form-group__label">Должность сотрудника</label>
627 627 <div class="form-group__item">
628 628 <input type="text" class="input" value="{{ $it->telephone }}" disabled>
629 629 </div>
630 630 </div>
631 631 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
632   - <label class="form-group__label">Телефон2</label>
  632 + <label class="form-group__label">Телефон сотрудника</label>
633 633 <div class="form-group__item">
634 634 <input type="text" class="input" value="{{ $it->telephone2 }}" disabled>
635 635 </div>
resources/views/workers/docs.blade.php
... ... @@ -60,7 +60,7 @@
60 60 </div>
61 61 </div>
62 62 <div class="cabinet__inputs-item form-group">
63   - <label class="form-group__label">Тип судна (GWT)</label>
  63 + <label class="form-group__label">Тип судна</label>
64 64 <div class="form-group__item">
65 65 <input type="text" name="GWT" id="GWT" class="input" value="{{ old('GWT') ?? $doc->GWT ?? '' }}">
66 66 </div>
... ... @@ -74,7 +74,7 @@
74 74 </div>
75 75  
76 76 <div class="cabinet__inputs-item form-group">
77   - <label class="form-group__label">Мощность ГД (кВТ)</label>
  77 + <label class="form-group__label">Мощность (кВт)</label>
78 78 <div class="form-group__item">
79 79 <input type="text" name="KBT" id="KBT" class="input" value="{{ old('KBT') ?? $doc->KBT ?? '' }}">
80 80 </div>
resources/views/workers/prev_company_edit_form.blade.php
... ... @@ -57,19 +57,19 @@
57 57 </div>
58 58 </div>
59 59 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
60   - <label class="form-group__label">ФИО директора</label>
  60 + <label class="form-group__label">ФИО сотрудника</label>
61 61 <div class="form-group__item">
62 62 <input type="text" name="direct" id="direct" class="input" value="{{ old('direct') ?? $doc->direct ?? '' }}">
63 63 </div>
64 64 </div>
65 65 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
66   - <label class="form-group__label">Телефон</label>
  66 + <label class="form-group__label">Должность сотрудника</label>
67 67 <div class="form-group__item">
68 68 <input type="text" name="telephone" id="telephone" class="input" value="{{ old('telephone') ?? $doc->telephone ?? '' }}">
69 69 </div>
70 70 </div>
71 71 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
72   - <label class="form-group__label">Телефон 2</label>
  72 + <label class="form-group__label">Телефон сотрудника</label>
73 73 <div class="form-group__item">
74 74 <input type="text" name="telephone2" id="telephone2" class="input" value="{{ old('telephone2') ?? $doc->telephone2 ?? '' }}">
75 75 </div>
resources/views/workers/prev_company_form.blade.php
... ... @@ -59,19 +59,19 @@
59 59 </div>
60 60 </div>
61 61 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
62   - <label class="form-group__label">ФИО директора</label>
  62 + <label class="form-group__label">ФИО сотрудника</label>
63 63 <div class="form-group__item">
64 64 <input type="text" name="direct" id="direct" class="input" value="{{ old('direct') ?? '' }}">
65 65 </div>
66 66 </div>
67 67 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
68   - <label class="form-group__label">Телефон</label>
  68 + <label class="form-group__label">Должность сотрудника</label>
69 69 <div class="form-group__item">
70 70 <input type="text" name="telephone" id="telephone" class="input" value="{{ old('telephone') ?? '' }}">
71 71 </div>
72 72 </div>
73 73 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
74   - <label class="form-group__label">Телефон 2</label>
  74 + <label class="form-group__label">Телефон сотрудника</label>
75 75 <div class="form-group__item">
76 76 <input type="text" name="telephone2" id="telephone2" class="input" value="{{ old('telephone2') ?? '' }}">
77 77 </div>
... ... @@ -557,6 +557,8 @@ Route::group([
557 557 Route::post('cabinet/{Employer}', [EmployerController::class, 'cabinet_save'])->name('cabinet_save');
558 558 Route::post('flot_add_ajax', [EmployerController::class, 'save_add_flot'])->name('save_add_flot');
559 559 Route::get('flot_delete_ajax/{Flot}', [EmployerController::class, 'delete_flot'])->name('delete_flot');
  560 + Route::get('cabinet/flot_edit/{Flot}/{Employer}', [EmployerController::class, 'edit_flot'])->name('edit_flot');
  561 + Route::post('cabinet/flot_edit/{Flot}', [EmployerController::class, 'update_flot'])->name('update_flot_save');
560 562 Route::get('cabinet/flot', [EmployerController::class, 'slider_flot'])->name('slider_flot');
561 563  
562 564 // 2 страница - Добавление вакансий