Commit df6f35bf3b6bc3f8f01a970882b71459ec681060

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

Коммит избранные

Showing 7 changed files Side-by-side Diff

app/Http/Controllers/WorkerController.php
... ... @@ -389,7 +389,6 @@ class WorkerController extends Controller
389 389 with('user_to')->where('user_id', $user_id)->
390 390 OrderByDesc('created_at');
391 391  
392   -
393 392 $count_input = $messages_input->count();
394 393 $count_output = $messages_output->count();
395 394  
... ... @@ -401,6 +400,7 @@ class WorkerController extends Controller
401 400 $messages = $messages_output->paginate(5);
402 401 }
403 402  
  403 + //dd($messages);
404 404 // Вернуть все 100%
405 405 return view('workers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id'));
406 406 }
... ... @@ -706,7 +706,14 @@ class WorkerController extends Controller
706 706 }
707 707  
708 708 //Переписка
709   - public function dialog(User_Model $user1, User_Model $user2) {
  709 + public function dialog(User_Model $user1, User_Model $user2, Request $request) {
  710 + // Получение параметров.
  711 + if ($request->has('ad_employer')){
  712 + $ad_employer = $request->get('ad_employer');
  713 + } else {
  714 + $ad_employer = 0;
  715 + }
  716 +
710 717 if (isset($user2->id)) {
711 718 $companion = User_Model::query()->with('workers')->
712 719 with('employers')->
... ... @@ -734,10 +741,11 @@ class WorkerController extends Controller
734 741 if (!is_null($id_vac)) break;
735 742 }*/
736 743  
737   - $ad_employer = null;
738   - if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first();
  744 + //$ad_employer = null;
  745 + //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first();
739 746 $sender = $user1;
740 747  
  748 +
741 749 return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer'));
742 750 }
743 751  
... ... @@ -899,6 +907,49 @@ class WorkerController extends Controller
899 907 return redirect()->route('worker.messages', ['type_message' => 'output']);
900 908 }
901 909  
  910 +
  911 + public function test123(Request $request) {
  912 + $params = $request->all();
  913 + $user1 = $params['user_id'];
  914 + $user2 = $params['to_user_id'];
  915 + $id_vacancy = $params['ad_employer_id'];
  916 + $ad_name = $params['ad_name'];
  917 +
  918 + $rules = [
  919 + 'text' => 'required|min:1|max:150000',
  920 + 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000'
  921 + ];
  922 + $messages = [
  923 + 'required' => 'Укажите обязательное поле',
  924 + 'min' => [
  925 + 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
  926 + 'integer' => 'Поле «:attribute» должно быть :min или больше',
  927 + 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
  928 + ],
  929 + 'max' => [
  930 + 'string' => 'Поле «:attribute» должно быть не больше :max символов',
  931 + 'integer' => 'Поле «:attribute» должно быть :max или меньше',
  932 + 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
  933 + ]
  934 + ];
  935 +
  936 + $validator = Validator::make($request->all(), $rules, $messages);
  937 +
  938 + if ($validator->fails()) {
  939 + return redirect()->route('worker.dialog', ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name])
  940 + ->withErrors($validator);
  941 + } else {
  942 + if ($request->has('file')) {
  943 + $params['file'] = $request->file('file')->store("messages", 'public');
  944 + }
  945 + Message::create($params);
  946 + //return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]);
  947 + return redirect()->route('worker.dialog',
  948 + ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]);
  949 +
  950 + }
  951 + }
  952 +
902 953 // Информация о предыдущих компаниях
903 954 public function new_prev_company(Worker $worker) {
904 955 return view('workers.prev_company_form', compact('worker'));
resources/views/employers/favorite.blade.php
... ... @@ -149,7 +149,7 @@
149 149 @if (!empty($it->email))
150 150 <div>
151 151 Электронный адрес
152   - <a href="emailto: {{ $it->email }}">{{ $it->email }}</a>
  152 + <a href="mailto: {{ $it->email }}">{{ $it->email }}</a>
153 153 </div>
154 154 @endif
155 155 @if (!empty($it->city))
resources/views/vacance-item.blade.php
... ... @@ -5,7 +5,7 @@
5 5 @extends('layout.frontend', ['title' => $title])
6 6  
7 7 @section('scripts')
8   - @include('js.favorite-vacancy')
  8 + <!--include('js.favorite-vacancy')-->
9 9 <script>
10 10 $(document).on('click', '.js_send_it_button', function() {
11 11 var this_ = $(this);
... ... @@ -173,7 +173,7 @@
173 173 </div>
174 174 <div class="main__employer-page-two-item-bottom">
175 175 <div class="main__employer-page-two-item-bottom-date">{{ date('d.m.Y H:i:s', strtotime($Q->created_at)) }}</div>
176   - <button type="button" data-val="{{ $Q->id }}" class="like main__employer-page-two-item-bottom-like js_vac_favorite js-toggle {{ \App\Classes\LikesClass::get_status_vacancy($Q) }}">
  176 + <button type="button" id="like{{ $Q->id }}" data-val="{{ $Q->id }}" class="like main__employer-page-two-item-bottom-like js_vac_favorite js-toggle {{ \App\Classes\LikesClass::get_status_vacancy($Q) }}">
177 177 <svg>
178 178 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use>
179 179 </svg>
resources/views/workers/dialog.blade.php
... ... @@ -163,7 +163,7 @@
163 163 @endforeach
164 164 @endif
165 165 </div>
166   - <form action="{{ route('employer.test123') }}" class="chatbox__bottom" enctype="multipart/form-data" method="POST" >
  166 + <form action="{{ route('worker.test123') }}" class="chatbox__bottom" enctype="multipart/form-data" method="POST" >
167 167 @csrf
168 168 <label class="chatbox__bottom-file">
169 169 <input id="file" name="file" type="file">
... ... @@ -174,6 +174,8 @@
174 174 <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
175 175 <input type="hidden" id="user_id" name="user_id" value="{{ $sender->id }}"/>
176 176 <input type="hidden" id="to_user_id" name="to_user_id" value="{{ $companion->id }}"/>
  177 + <input type="hidden" id="ad_employer_id" name="ad_employer_id" value="{{ $ad_employer }}"/>
  178 + <input type="hidden" id="ad_name" name="ad_name" value="@if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }} @endif"/>
177 179 <input id="text" name="text" type="text" class="input chatbox__bottom-text" placeholder="Ответить">
178 180 <button type="submit" id="send_btn" name="send_btn" class="chatbox__bottom-send">
179 181 <svg>
resources/views/workers/favorite.blade.php
... ... @@ -136,7 +136,7 @@
136 136 <svg>
137 137 <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use>
138 138 </svg>
139   - <span>Нет избранных работодателей</span>
  139 + <span>Нет избранных должностей!</span>
140 140 </div>
141 141 @endif
142 142 </div>
resources/views/workers/messages.blade.php
... ... @@ -66,11 +66,11 @@
66 66 @if (isset($it->user_from->employers[0]->logo))
67 67 <img src="{{ asset(Storage::url($it->user_from->employers[0]->logo)) }}" alt="">
68 68 @else
69   - <img src=" asset('images/default_man.jpg') }}" alt="">
  69 + <img src="{{ asset('images/default_man.jpg') }}" alt="">
70 70 @endif
71 71 @endif
72 72 @else
73   - <img src=" asset('images/default_man.jpg') }}" alt="">
  73 + <img src="{{ asset('images/default_man.jpg') }}" alt="">
74 74 @endif
75 75 @endif
76 76  
... ... @@ -97,10 +97,10 @@
97 97 @endif
98 98 </div>
99 99 <div class="messages__item-text">
100   - <div>
  100 + <div>@if (isset($it->vacancies)) @php $ad_name = $it->vacancies->name; @endphp @else @php $ad_name = 'Вакансия удалена'; @endphp @endif
101 101 От: @if (isset($it->user_from))
102 102 @if ($it->user_from->id !== $user_id)
103   - <a href="{{ route('worker.dialog', ['user1' => $user_id, 'user2' => $it->user_from->id]) }}" style="text-decoration: underline">
  103 + <a href="{{ route('worker.dialog', ['user1' => $user_id, 'user2' => $it->user_from->id, 'ad_employer' => $it->ad_employer_id, 'ad_name' => $ad_name]) }}" style="text-decoration: underline">
104 104 {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }}
105 105 </a>
106 106 @else
... ... @@ -112,7 +112,8 @@
112 112 <br>
113 113 К: @if (isset($it->user_to))
114 114 @if ($it->user_to->id !== $user_id)
115   - <a href="{{ route('worker.dialog', ['user1' => $user_id, 'user2' => $it->user_to->id]) }}" style="text-decoration: underline">
  115 +
  116 + <a href="{{ route('worker.dialog', ['user1' => $user_id, 'user2' => $it->user_to->id, 'ad_employer' => $it->ad_employer_id, 'ad_name' => $ad_name]) }}" style="text-decoration: underline">
116 117 {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }}
117 118 </a>
118 119 @else
... ... @@ -518,6 +518,8 @@ Route::group([
518 518 // Поднятие анкеты
519 519 Route::get('кабинет/up/{worker}', [WorkerController::class, 'up'])->name('up');
520 520  
  521 + Route::post('test123', [WorkerController::class, 'test123'])->name('test123');
  522 +
521 523 // Добавление сертификата
522 524 Route::get('кабинет/new_sertificate/{worker}', [WorkerController::class, 'new_sertificate'])->name('new_sertificate');
523 525 Route::get('кабинет/add_sertificate', [WorkerController::class, 'add_serificate'])->name('add_serificate');