Commit 066f7f9f852d605e6b9ac07bafaa1330d23d7979

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

Коммит по диалогам

Showing 14 changed files with 77 additions and 18 deletions 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
... ... @@ -349,7 +349,6 @@ class EmployerController extends Controller
349 349 with('user_to')->where('user_id', $user_id)->
350 350 OrderByDesc('created_at');
351 351  
352   -
353 352 $count_input = $messages_input->count();
354 353 $count_output = $messages_output->count();
355 354  
... ... @@ -535,6 +534,8 @@ class EmployerController extends Controller
535 534 $params = $request->all();
536 535 $user1 = $params['user_id'];
537 536 $user2 = $params['to_user_id'];
  537 + $id_vacancy = $params['ad_employer_id'];
  538 + $ad_name = $params['ad_name'];
538 539  
539 540 $rules = [
540 541 'text' => 'required|min:1|max:150000',
... ... @@ -564,7 +565,9 @@ class EmployerController extends Controller
564 565 $params['file'] = $request->file('file')->store("messages", 'public');
565 566 }
566 567 Message::create($params);
567   - return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]);
  568 + //return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]);
  569 + return redirect()->route('employer.dialog',
  570 + ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]);
568 571  
569 572 }
570 573 }
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 // скачать анкету соискателя
... ... @@ -713,14 +714,16 @@ class WorkerController extends Controller
713 714 where('id', $user2->id)->first();
714 715 }
715 716  
716   - $Messages = Message::query()->with('response')->where(function($query) use ($user1, $user2) {
  717 + $Messages = Message::query()->
  718 + //with('response')->
  719 + where(function($query) use ($user1, $user2) {
717 720 $query->where('user_id', $user1->id)->where('to_user_id', $user2->id);
718 721 })->orWhere(function($query) use ($user1, $user2) {
719 722 $query->where('user_id', $user2->id)->where('to_user_id', $user1->id);
720 723 })->OrderBy('created_at')->get();
721 724  
722 725 $id_vac = null;
723   - foreach ($Messages as $it) {
  726 + /*foreach ($Messages as $it) {
724 727 if (isset($it->response)) {
725 728 foreach ($it->response as $r) {
726 729 if (isset($r->ad_employer_id)) {
... ... @@ -730,7 +733,7 @@ class WorkerController extends Controller
730 733 }
731 734 }
732 735 if (!is_null($id_vac)) break;
733   - }
  736 + }*/
734 737  
735 738 $ad_employer = null;
736 739 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/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
... ... @@ -112,7 +112,7 @@
112 112 Удаленный пользователь
113 113 @endif
114 114 </div>
115   - <div><span>Вакансия:</span>@if (isset($it->vacancies[0])) {{ $it->vacancies[0]->name." (".($it->vacancies[0]->id).")" }} @else Удалена @endif</div>
  115 + <div><span>Вакансия:</span>@if (isset($it->vacancies)) {{ $it->vacancies->name." (".($it->vacancies->id).")" }} @else Удалена @endif</div>
116 116 <div><span>Текст:</span>{{ $it->text }}</div>
117 117 </div>
118 118 </div>