Commit 7fa088c5b0476e7dfcdc6f928a1766b3c30e1b5a

Authored by Сергей П
1 parent e335a0a1d2
Exists in master

Задачи 58,49,51 + правки от Марины

Showing 12 changed files with 72 additions and 22 deletions Side-by-side Diff

app/Http/Controllers/EmployerController.php
... ... @@ -530,6 +530,20 @@ class EmployerController extends Controller
530 530  
531 531 $validator = Validator::make($request->all(), $rules, $messages);
532 532  
  533 + /*if ($validator->fails()) {
  534 + return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2])
  535 + ->withErrors($validator);
  536 + } else {
  537 + if ($request->has('file')) {
  538 + $params['file'] = $request->file('file')->store("messages", 'public');
  539 + }
  540 + Message::create($params);
  541 + //return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]);
  542 + return redirect()->route('employer.dialog',
  543 + ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]);
  544 +
  545 + }*/
  546 +
533 547 if ($validator->fails()) {
534 548 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2])
535 549 ->withErrors($validator);
app/Http/Controllers/WorkerController.php
... ... @@ -818,9 +818,12 @@ class WorkerController extends Controller
818 818 }
819 819  
820 820 if (isset($user2->id)) {
821   - $companion = User_Model::query()->with('workers')->
822   - with('employers')->
823   - where('id', $user2->id)->first();
  821 + $companion = User_Model::query()
  822 + ->with('workers')
  823 + ->with('employers')
  824 + ->where('id', $user2->id)
  825 + ->first()
  826 + ;
824 827 }
825 828  
826 829 $Messages = Message::query()->
... ... @@ -832,6 +835,10 @@ class WorkerController extends Controller
832 835 ->get()
833 836 ;
834 837  
  838 + Message::where('user_id', '=', $user2->id)
  839 + ->where('to_user_id', '=', $user1->id)
  840 + ->update(['flag_new' => 0]);
  841 +
835 842 return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer'));
836 843 }
837 844  
public/css/style_may2024.css
... ... @@ -7110,6 +7110,8 @@ main + .news {
7110 7110 -ms-flex-direction: column;
7111 7111 flex-direction: column;
7112 7112 gap: 10px;
  7113 + max-height: 400px;
  7114 + overflow: auto;
7113 7115 }
7114 7116 @media (min-width: 768px) {
7115 7117 .chatbox__list {
resources/views/employers/bd.blade.php
... ... @@ -16,6 +16,11 @@
16 16 $('.cabinet__export-button-wrap button').click(function(){
17 17 $('.cabinet__export-error').parent().remove();
18 18 });
  19 +
  20 + $('.search-reset-button').click(function(){
  21 + var wrap = $(this).closest('.cabinet__filters');
  22 + wrap.find('[name="search"]').val('');
  23 + });
19 24 });
20 25  
21 26  
... ... @@ -65,18 +70,19 @@
65 70 <h2 class="title cabinet__title">База данных</h2>
66 71 </div>
67 72 <div class="cabinet__body-item">
68   - <div class="cabinet__filters">
  73 + <div class="cabinet__filters" style="display: flex;flex-direction: unset;justify-content: left;align-items: center;">
69 74 <div class="cabinet__filters-item">
70 75 <form class="search" action="{{ route('employer.bd') }}">
71 76 <input type="search" name="search" id="search" class="input" placeholder="Поиск&hellip;" value="@if (isset($_GET['search'])) {{ $_GET['search'] }} @endif">
72 77 <button type="submit" class="button">Найти</button>
73 78 <span>
74   - <svg>
75   - <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use>
76   - </svg>
77   - </span>
  79 + <svg>
  80 + <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use>
  81 + </svg>
  82 + </span>
78 83 </form>
79 84 </div>
  85 + <a href="javascript:void(0)" class="search-reset-button bold font18" style="color: #377d87;">Сбросить поиск</a>
80 86 </div>
81 87 <div class="cabinet__filters">
82 88 <div class="cabinet__export-wrap">
resources/views/employers/dialog.blade.php
... ... @@ -2,7 +2,11 @@
2 2  
3 3 @section('scripts')
4 4 <script>
5   - console.log('Test system');
  5 + $(function(){
  6 + var chatbox_div = $('.chatbox__list');
  7 + chatbox_div.scrollTop(chatbox_div.prop("scrollHeight"));
  8 + });
  9 +
6 10 $(document).on('change', '#send_btn', function() {
7 11 var this_ = $(this);
8 12 var val_ = this_.val();
resources/views/workers/cabinet.blade.php
... ... @@ -118,15 +118,18 @@
118 118 </div>
119 119 <div class="cabinet__avatar-form">
120 120 <label class="file">
121   - <span class="file__input">
  121 + <span class="file__input flex">
122 122 <input type="file" name="photo" id="photo">
123 123  
124   - <span class="button">
  124 + <span class="button mr-20">
125 125 <svg>
126 126 <use xlink:href="{{ asset('images/sprite.svg#plus') }}"></use>
127 127 </svg>
128 128 Загрузить
129 129 </span>
  130 + @if (!empty($worker->photo))
  131 + <button type="submit" class="button">Удалить фото</button>
  132 + @endif
130 133 </span>
131 134 </label>
132 135 <p class="cabinet__text">Загрузите фотографию в формате svg., jpg., jpeg., png.</p>
resources/views/workers/dialog.blade.php
... ... @@ -2,7 +2,11 @@
2 2  
3 3 @section('scripts')
4 4 <script>
5   - console.log('Test system');
  5 + $(function(){
  6 + var chatbox_div = $('.chatbox__list');
  7 + chatbox_div.scrollTop(chatbox_div.prop("scrollHeight"));
  8 + });
  9 +
6 10 $(document).on('change', '#send_btn', function() {
7 11 var this_ = $(this);
8 12 var val_ = this_.val();
... ... @@ -91,8 +95,8 @@
91 95 @endif
92 96 </div>
93 97 </div>
94   - @if (isset($companion->worker->id))
95   - <a href="{{ route('resume_profile', ['worker' => $companion->worker->id]) }}" class="button chatbox__toper-button">
  98 + @if (isset($companion->workers[0]->id))
  99 + <a href="{{ route('resume_profile', ['worker' => $companion->workers[0]->id]) }}" class="button chatbox__toper-button">
96 100 <svg>
97 101 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use>
98 102 </svg>
... ... @@ -100,7 +104,7 @@
100 104 </a>
101 105 @endif
102 106 @else
103   - <div class="chatbox__toper-info messages__item-info">
  107 + <div class="chatbox__toper-info messages__item-info 222">
104 108 <div class="messages__item-photo">
105 109 <svg>
106 110 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
... ... @@ -117,8 +121,8 @@
117 121 <div><span>Статус:</span> Работодатель или Администратор</div>
118 122 </div>
119 123 </div>
120   - @if (isset($companion->employer->id))
121   - <a href="" class="button chatbox__toper-button">
  124 + @if (isset($companion->employers[0]->id))
  125 + <a href="{{ route('info_company', ['company' => $companion->employers[0]->id]) }}" class="button chatbox__toper-button">
122 126 <svg>
123 127 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use>
124 128 </svg>
... ... @@ -128,6 +132,16 @@
128 132 @endif
129 133 </div>
130 134  
  135 + @if ($errors->any())
  136 + <div class="red bold">
  137 + <ul>
  138 + @foreach ($errors->all() as $error)
  139 + <li>{{ $error }}</li>
  140 + @endforeach
  141 + </ul>
  142 + </div>
  143 + @endif
  144 +
131 145 <div class="chatbox__list" id="dialogs" name="dialogs">
132 146 @if ($Messages->count())
133 147 @foreach ($Messages as $it)
resources/views/workers/docs-edit.blade.php
... ... @@ -82,7 +82,7 @@
82 82  
83 83 <div class="flex">
84 84 <button type="submit" class="button mr-10">Сохранить</button>
85   - <a href="{{ route('worker.cabinet') }}" class="button button_light active">Отмена</a>
  85 + <a href="{{ route('worker.cabinet') }}" class="button button_light active">Назад</a>
86 86 </div>
87 87 </div>
88 88 </div>
resources/views/workers/form_additional_documents.blade.php
... ... @@ -38,7 +38,7 @@
38 38 <div class="cabinet__body-item cabinet__inputs-item-full-row">
39 39 <div class="cabinet__buttons_flex">
40 40 <button type="submit" class="button mr-10">Сохранить</button>
41   - <a href="{{ route('worker.cabinet') }}" class="button button_light active">Отменить</a>
  41 + <a href="{{ route('worker.cabinet') }}" class="button button_light active">Назад</a>
42 42 </div>
43 43 </div>
44 44 </div>
resources/views/workers/form_basic_information.blade.php
... ... @@ -173,7 +173,7 @@
173 173 <div class="cabinet__body-item cabinet__inputs-item-full-row">
174 174 <div class="cabinet__buttons_flex">
175 175 <button type="submit" class="button">Сохранить</button>
176   - <a href="{{ route('worker.cabinet') }}" class="button button_light active">Отменить</a>
  176 + <a href="{{ route('worker.cabinet') }}" class="button button_light active">Назад</a>
177 177 </div>
178 178 </div>
179 179 </div>
resources/views/workers/prev_company_edit_form.blade.php
... ... @@ -40,7 +40,7 @@
40 40  
41 41 <div class="flex">
42 42 <button type="submit" class="button mr-10">Сохранить</button>
43   - <a href="{{ route('worker.cabinet') }}" class="button button_light">Отменить</a>
  43 + <a href="{{ route('worker.cabinet') }}" class="button button_light">Назад</a>
44 44 </div>
45 45 </div>
46 46 </div>
resources/views/workers/sertificate_edit.blade.php
... ... @@ -31,7 +31,7 @@
31 31  
32 32 <div class="flex">
33 33 <button type="submit" class="button mr-10">Сохранить</button>
34   - <a href="{{ route('worker.cabinet') }}" class="button button_light">Отменить</a>
  34 + <a href="{{ route('worker.cabinet') }}" class="button button_light">Назад</a>
35 35 </div>
36 36 </form>
37 37 @endsection