Commit d8f9f29a6ef19a6eb5debd9cefefcc5f5844eb76

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

Merge branch 'master' of http://gitlab.nologostudio.ru/alarionov/rekamore-su

Showing 15 changed files Side-by-side Diff

app/Http/Controllers/Admin/MsgAnswersController.php
... ... @@ -16,7 +16,7 @@ class MsgAnswersController extends Controller
16 16 public function messages(Request $request) {
17 17 $find_key = "";
18 18 $find_cat = "";
19   - $Msgs = Message::with('user_from')->with('user_to')->with('response');
  19 + $Msgs = Message::with('user_from')->with('user_to'); //->with('response');
20 20  
21 21 $Msgs = $this->filter($Msgs, $request, $find_key, $find_cat);
22 22  
app/Http/Controllers/EmployerController.php
... ... @@ -348,7 +348,6 @@ class EmployerController extends Controller
348 348 with('user_to')->where('user_id', $user_id)->
349 349 OrderByDesc('created_at');
350 350  
351   -
352 351 $count_input = $messages_input->count();
353 352 $count_output = $messages_output->count();
354 353  
... ... @@ -534,6 +533,8 @@ class EmployerController extends Controller
534 533 $params = $request->all();
535 534 $user1 = $params['user_id'];
536 535 $user2 = $params['to_user_id'];
  536 + $id_vacancy = $params['ad_employer_id'];
  537 + $ad_name = $params['ad_name'];
537 538  
538 539 $rules = [
539 540 'text' => 'required|min:1|max:150000',
... ... @@ -563,7 +564,9 @@ class EmployerController extends Controller
563 564 $params['file'] = $request->file('file')->store("messages", 'public');
564 565 }
565 566 Message::create($params);
566   - return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]);
  567 + //return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]);
  568 + return redirect()->route('employer.dialog',
  569 + ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]);
567 570  
568 571 }
569 572 }
app/Http/Controllers/MainController.php
... ... @@ -94,7 +94,7 @@ class MainController extends Controller
94 94 whereHas('employer', function ($query) {
95 95 $query->where('status_hidden', '=', '0');
96 96 })->
97   - orderBy('id')->limit(8)->get();
  97 + orderBy('sort')->get();
98 98 $vacancy = Ad_jobs::query()->with('job_title')->orderBy('position_ship')->get();
99 99 return view('index', compact('news', 'Job_title', 'categories', 'employers', 'vacancy', 'Main_Job'));
100 100 }
app/Http/Controllers/WorkerController.php
... ... @@ -166,7 +166,7 @@ class WorkerController extends Controller
166 166 $status_work = $this->status_work;
167 167 $Query = Worker::query()->with('users')->with('job_titles')
168 168 ->with('place_worker')->with('sertificate')->with('prev_company')
169   - ->with('infobloks');
  169 + ->with('infobloks')->with('response');
170 170 $Query = $Query->where('id', '=', $worker->id);
171 171 $Query = $Query->get();
172 172  
... ... @@ -187,9 +187,10 @@ class WorkerController extends Controller
187 187 $status = $crt->save();
188 188 }
189 189 $stat = Static_worker::query()->where('year_month', '=', $get_date)
190   - ->where('user_id', '=', $worker->id)
  190 + ->where('user_id', '=', $worker->user_id)
191 191 ->get();
192   - return view('worker', compact('Query', 'status_work', 'idiot'));
  192 +
  193 + return view('worker', compact('Query', 'status_work', 'idiot', 'stat'));
193 194 }
194 195  
195 196 // скачать анкету соискателя
... ... @@ -712,14 +713,16 @@ class WorkerController extends Controller
712 713 where('id', $user2->id)->first();
713 714 }
714 715  
715   - $Messages = Message::query()->with('response')->where(function($query) use ($user1, $user2) {
  716 + $Messages = Message::query()->
  717 + //with('response')->
  718 + where(function($query) use ($user1, $user2) {
716 719 $query->where('user_id', $user1->id)->where('to_user_id', $user2->id);
717 720 })->orWhere(function($query) use ($user1, $user2) {
718 721 $query->where('user_id', $user2->id)->where('to_user_id', $user1->id);
719 722 })->OrderBy('created_at')->get();
720 723  
721 724 $id_vac = null;
722   - foreach ($Messages as $it) {
  725 + /*foreach ($Messages as $it) {
723 726 if (isset($it->response)) {
724 727 foreach ($it->response as $r) {
725 728 if (isset($r->ad_employer_id)) {
... ... @@ -729,7 +732,7 @@ class WorkerController extends Controller
729 732 }
730 733 }
731 734 if (!is_null($id_vac)) break;
732   - }
  735 + }*/
733 736  
734 737 $ad_employer = null;
735 738 if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first();
app/Models/Ad_employer.php
... ... @@ -59,7 +59,6 @@ class Ad_employer extends Model
59 59 return $this->hasMany(Category::class, 'id');
60 60 }
61 61  
62   -
63 62 public function scopeActive($query) {
64 63 return $query->where('is_remove', '=', '0');
65 64 }
app/Models/ResponseWork.php
... ... @@ -4,6 +4,7 @@ namespace App\Models;
4 4  
5 5 use Illuminate\Database\Eloquent\Factories\HasFactory;
6 6 use Illuminate\Database\Eloquent\Model;
  7 +use Illuminate\Database\Eloquent\Relations\BelongsTo;
7 8  
8 9 class ResponseWork extends Model
9 10 {
... ... @@ -14,4 +15,5 @@ class ResponseWork extends Model
14 15 'stars',
15 16 'message'
16 17 ];
  18 +
17 19 }
app/Models/Worker.php
... ... @@ -89,4 +89,8 @@ class Worker extends Model
89 89 return $this->hasMany(Dop_info::class, 'worker_id');
90 90 }
91 91  
  92 + public function response() {
  93 + return $this->hasMany(ResponseWork::class);
  94 + }
  95 +
92 96 }
app/Models/infobloks.php
... ... @@ -18,4 +18,12 @@ class infobloks extends Model
18 18 public function ScopeActive($query) {
19 19 return $query->where('is_remove', '=', '0');
20 20 }
  21 +
  22 + /*
  23 + * Связь модели Инфоблоки (Infobloks) с моделью Доп.информация (dop_info)
  24 + один-ко-многим
  25 + */
  26 + public function model_dop_info() {
  27 + return $this->hasMany(Dop_info::class, 'infoblok_id');
  28 + }
21 29 }
resources/views/admin/messages.blade.php
... ... @@ -18,7 +18,7 @@
18 18 <th class="px-4 py-3">№</th>
19 19 <th class="px-4 py-3">От юзера</th>
20 20 <th class="px-4 py-3">К юзеру</th>
21   - <th class="px-4 py-3">Отклик</th>
  21 + <th class="px-4 py-3" style="display:none">Отклик</th>
22 22 <th class="px-4 py-3">Читать</th>
23 23 <th class="px-4 py-3">Дата</th>
24 24 </tr>
... ... @@ -43,10 +43,10 @@
43 43 Пользователь удален
44 44 @endif
45 45 </td>
46   - <td class="px-4 py-3">
  46 + <td class="px-4 py-3" style="display:none">
47 47 <div class="flex items-center text-sm">
48 48 <div>
49   - @if ($msg->response->count())
  49 + @if (true) //$msg->response->count())
50 50 Да
51 51 @else
52 52 Нет
resources/views/employers/dialog.blade.php
... ... @@ -98,8 +98,8 @@
98 98 </div>
99 99 </div>
100 100 </div>
101   - @if (isset($companion->worker->id))
102   - <a href="{{ route('resume_profile', ['worker' => $companion->worker->id]) }}" class="button chatbox__toper-button">
  101 + @if (isset($companion->workers[0]->id))
  102 + <a href="{{ route('resume_profile', ['worker' => $companion->workers[0]->id]) }}" class="button chatbox__toper-button">
103 103 <svg>
104 104 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use>
105 105 </svg>
... ... @@ -182,6 +182,8 @@
182 182 <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
183 183 <input type="hidden" id="user_id" name="user_id" value="{{ $sender->id }}"/>
184 184 <input type="hidden" id="to_user_id" name="to_user_id" value="{{ $companion->id }}"/>
  185 + <input type="hidden" id="ad_employer_id" name="ad_employer_id" value="{{ $ad_employer }}"/>
  186 + <input type="hidden" id="ad_name" name="ad_name" value="@if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }} @endif"/>
185 187 <input id="text" name="text" type="text" class="input chatbox__bottom-text" placeholder="Ответить">
186 188 <button type="submit" id="send_btn" name="send_btn" class="chatbox__bottom-send">
187 189 <svg>
resources/views/employers/messages.blade.php
... ... @@ -103,10 +103,13 @@
103 103 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
104 104 </svg>
105 105  
  106 +
106 107 @if ($type_message == 'input')
107 108 @if ($it->user_to->is_worker)
108   - @if (isset($it->user_to->workers->phote))
109   - <img src="{{ asset(Storage::url($it->user_to->workers->phote)) }}" alt="">
  109 + @if (isset($it->user_to->workers->photo))
  110 + <img src="{{ asset(Storage::url($it->user_to->workers->photo)) }}" alt="">
  111 + @elseif(isset($it->user_to->file))
  112 + <img src="{{ asset(Storage::url($it->user_to->file)) }}" alt="">
110 113 @else
111 114 <img src="{{ asset('images/default_man.jpg') }}" alt="">
112 115 @endif
... ... @@ -121,8 +124,8 @@
121 124  
122 125 @if ($type_message == 'output')
123 126 @if ($it->user_from->is_worker)
124   - @if (isset($it->user_from->workers->phote))
125   - <img src="{{ asset(Storage::url($it->user_from->workers->phote)) }}" alt="">
  127 + @if (isset($it->user_from->workers->photo))
  128 + <img src="{{ asset(Storage::url($it->user_from->workers->photo)) }}" alt="">
126 129 @else
127 130 <img src="{{ asset('images/default_man.jpg') }}" alt="">
128 131 @endif
resources/views/modals/send_worker_new.blade.php
... ... @@ -32,6 +32,9 @@
32 32 <input type="text" id="send_to_user_id" name="send_to_user_id" class="input" placeholder="to_user_id" value="">
33 33 Вакансия:
34 34 <input type="text" id="send_vacancy" name="send_vacancy" class="input" placeholder="vacancy" value="">
  35 + Должность:
  36 + <input type="text" id="send_job_title_id" name="send_job_title_id" class="input" placeholder="vacancy" value="0">
  37 +
35 38 </div>
36 39 <div class="modal__form-item send_title_div error_">
37 40 <input id="send_title" name="send_title" type="text" class="input" placeholder="Тема" required>
resources/views/worker.blade.php
... ... @@ -235,6 +235,12 @@
235 235 <tr>
236 236 <td>Документ:</td>
237 237 <td><b>{{ $it->name }}</b></td>
  238 + <td>
  239 + @if ($it->model_dop_info[0]->status == 0) Не указано
  240 + @elseif($it->model_dop_info[0]->status==1) В наличии
  241 + @else Отсутствует
  242 + @endif
  243 + </td>
238 244 </tr>
239 245 @endforeach
240 246 </tbody>
... ... @@ -288,6 +294,35 @@
288 294 </div>
289 295 </div>
290 296  
  297 + <div class="main__resume-profile-info">
  298 + <h2 class="main__resume-profile-info-title">Количество просмотров страницы: ({{ $stat[0]->lookin }})</h2>
  299 + </div>
  300 +
  301 + <div class="main__resume-profile-info">
  302 + <h2 class="main__resume-profile-info-title">Отзывы о работнике ({{ $Query[0]->response->count() }})</h2>
  303 + <div class="main__resume-profile-info-body">
  304 + @if ((isset($Query[0]->response)) && ($Query[0]->response->count()))
  305 + <div class="main__resume-profile-info-body-item">
  306 + <ul class="main__resume-profile-info-body-inner">
  307 + @php $i = 1; @endphp
  308 + @foreach($Query[0]->response as $it)
  309 + <li>
  310 + <span><h3>Комментарий №{{$i}}</h3></span>
  311 + <span><b>Оценка человека: {{ $it->stars }}</b></span>
  312 + <span><b>Сообщение: </b>{{ $it->message }}</span>
  313 + </li>
  314 + @php $i++; @endphp
  315 + @endforeach
  316 + </ul>
  317 + </div>
  318 + @else
  319 + <div class="main__resume-profile-info-body-item">
  320 + <h3 class="main__resume-profile-info-body-subtitle">Нету комментариев</h3>
  321 + </div>
  322 + @endif
  323 + </div>
  324 + </div>
  325 +
291 326 <div class="main__resume-profile-review">
292 327 <form action="{{ route('stars_answer') }}" method="POST">
293 328 @csrf
resources/views/workers/cabinet.blade.php
... ... @@ -203,7 +203,7 @@
203 203 <use xlink:href="{{ asset('images/sprite.svg#warning') }}"></use>
204 204 </svg>
205 205 <span>Отзывов:</span>
206   - <b>@if (isset($stat[0]->message)) {{ $stat[0]->message }} @else 0 @endif</b>
  206 + <b>@if(isset($Worker[0]->response)) {{ $Worker[0]->response->count() }} @else 0 @endif</b>
207 207 </div>
208 208 </div>
209 209 <div class="cabinet__stats-subtitle">Анкета заполнена на {{ $persent }}%</div>
resources/views/workers/messages.blade.php
... ... @@ -44,36 +44,37 @@
44 44 </div>
45 45 </div>-->
46 46 </div>
47   -
48 47 @if ($messages->count())
49 48 @foreach($messages as $it)
50 49 <div class="messages__item">
51 50 <div class="messages__item-info">
  51 + <!--<pre> print_r(asset(Storage::url($it->user_from->employers[0]->logo))) }}</pre>-->
52 52 <div class="messages__item-photo">
53 53 <svg>
54 54 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
55 55 </svg>
56   -
  56 + <!-- Комментарий: обновление структуры вывода картинок, все корректное -->
57 57 @if ($type_message == 'input')
58   - @if ($it->user_to->is_worker)
59   - @if (isset($it->user_to->workers->phote))
60   - <img src="{{ asset(Storage::url($it->user_to->workers->phote)) }}" alt="">
  58 + @if ($it->user_from->is_worker)
  59 + @if (isset($it->user_from->workers[0]->photo))
  60 + <img src="{{ asset(Storage::url($it->user_to->workers[0]->photo)) }}" alt="">
61 61 @else
62 62 <img src="{{ asset('images/default_man.jpg') }}" alt="">
63 63 @endif
64 64 @else
65   - @if (isset($it->user_to->employers->logo))
66   - <img src="{{ asset(Storage::url($it->user_to->employers->logo)) }}" alt="">
  65 + @if (isset($it->user_from->employers[0]->logo))
  66 + <img src="{{ asset(Storage::url($it->user_from->employers[0]->logo)) }}" alt="">
67 67 @else
68   - <img src="{{ asset('images/default_man.jpg') }}" alt="">
  68 + <img src=" asset('images/default_man.jpg') }}" alt="">
69 69 @endif
70 70 @endif
71 71 @endif
72 72  
  73 + <!-- Обновление исходящих сообщений - фотографии компании и работника -->
73 74 @if ($type_message == 'output')
74 75 @if ($it->user_from->is_worker)
75   - @if (isset($it->user_from->workers->phote))
76   - <img src="{{ asset(Storage::url($it->user_from->workers->phote)) }}" alt="">
  76 + @if (isset($it->user_from->workers[0]->photo))
  77 + <img src="{{ asset(Storage::url($it->user_from->workers[0]->photo)) }}" alt="">
77 78 @else
78 79 <img src="{{ asset('images/default_man.jpg') }}" alt="">
79 80 @endif
... ... @@ -112,7 +113,7 @@
112 113 Удаленный пользователь
113 114 @endif
114 115 </div>
115   - <div><span>Вакансия:</span>@if (isset($it->vacancies[0])) {{ $it->vacancies[0]->name." (".($it->vacancies[0]->id).")" }} @else Удалена @endif</div>
  116 + <div><span>Вакансия:</span>@if (isset($it->vacancies)) {{ $it->vacancies->name." (".($it->vacancies->id).")" }} @else Удалена @endif</div>
116 117 <div><span>Текст:</span>{{ $it->text }}</div>
117 118 </div>
118 119 </div>