Commit 6644490231a1fe7e15b9332b06acb864382796f8
1 parent
bc71e803a9
Exists in
master
Employer personal account fixes
Showing 12 changed files with 155 additions and 49 deletions Side-by-side Diff
- app/Http/Controllers/Ad_jobsController.php
- app/Http/Controllers/EmployerController.php
- public/css/custom-ckeditor.css
- public/css/general.css
- public/css/style_may2024.css
- resources/views/chats/chats_list.blade.php
- resources/views/employers/add_vacancy.blade.php
- resources/views/employers/bd.blade.php
- resources/views/employers/favorite.blade.php
- resources/views/employers/list_vacancy.blade.php
- resources/views/modals/chats/remove_chat.blade.php
- resources/views/modals/vacancy/delete_vacancy.blade.php
app/Http/Controllers/Ad_jobsController.php
... | ... | @@ -118,6 +118,7 @@ class Ad_jobsController extends Controller |
118 | 118 | } |
119 | 119 | |
120 | 120 | $handler->sendVacancy($vacancy); |
121 | - return response()->redirectTo(route('employer.vacancy_list')); | |
121 | + return redirect()->route('employer.vacancy_list') | |
122 | + ->with('success', 'Вакансия отправлена в телеграм'); | |
122 | 123 | } |
123 | 124 | } |
app/Http/Controllers/EmployerController.php
... | ... | @@ -30,6 +30,7 @@ use Illuminate\Database\Eloquent\Builder; |
30 | 30 | use Illuminate\Http\RedirectResponse; |
31 | 31 | use Illuminate\Http\Request; |
32 | 32 | use Illuminate\Support\Facades\Auth; |
33 | +use Illuminate\Support\Facades\Cache; | |
33 | 34 | use Illuminate\Support\Facades\Hash; |
34 | 35 | use Illuminate\Support\Facades\Log; |
35 | 36 | use Illuminate\Support\Facades\Mail; |
... | ... | @@ -301,7 +302,7 @@ class EmployerController extends Controller |
301 | 302 | $ad_employer->delete(); |
302 | 303 | |
303 | 304 | return redirect()->route('employer.vacancy_list') |
304 | - ->with('success', 'Данные были успешно сохранены'); | |
305 | + ->with('success', 'Вакансия удалена'); | |
305 | 306 | } |
306 | 307 | |
307 | 308 | // Обновление даты |
... | ... | @@ -310,16 +311,23 @@ class EmployerController extends Controller |
310 | 311 | $ad_employer->updated_at = $up; |
311 | 312 | $ad_employer->save(); |
312 | 313 | |
313 | - return redirect()->back(); | |
314 | + return redirect()->route('employer.vacancy_list') | |
315 | + ->with('success', 'Вакансия поднята'); | |
314 | 316 | } |
315 | 317 | |
316 | 318 | //Видимость вакансии |
317 | 319 | public function vacancy_eye(Ad_employer $ad_employer, $status) { |
320 | + $statusMessages = [ | |
321 | + 'Вакансия скрыта', | |
322 | + 'Вакансия видна работникам' | |
323 | + ]; | |
324 | + | |
318 | 325 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); |
319 | 326 | $vac_emp->active_is = $status; |
320 | 327 | $vac_emp->save(); |
321 | 328 | |
322 | - return redirect()->route('employer.vacancy_list'); | |
329 | + return redirect()->route('employer.vacancy_list') | |
330 | + ->with('success', $statusMessages[$status]); | |
323 | 331 | } |
324 | 332 | |
325 | 333 | //Вакансия редактирования (шаблон) |
... | ... | @@ -382,7 +390,14 @@ class EmployerController extends Controller |
382 | 390 | $chat_id = $request->get('id'); |
383 | 391 | $is_fixed = $request->get('is_fixed'); |
384 | 392 | |
385 | - Chat::pin_chat($chat_id, $is_fixed); | |
393 | + $new_state = Chat::pin_chat($chat_id, $is_fixed); | |
394 | + | |
395 | + if ($new_state !== null) { | |
396 | + $message = $new_state ? 'Сообщение закреплено' : 'Сообщение откреплено'; | |
397 | + return redirect()->back()->with('success', $message); | |
398 | + } | |
399 | + | |
400 | + return redirect()->back()->withErrors(['message' => 'Ошибка: сообщение не удалось обновить.']); | |
386 | 401 | } |
387 | 402 | |
388 | 403 | public function remove_chat(Request $request){ |
... | ... | @@ -581,14 +596,13 @@ class EmployerController extends Controller |
581 | 596 | ->orWhere('email', 'LIKE', "%$find_key%") |
582 | 597 | ->orWhere('telephone', 'LIKE', "%$find_key%"); |
583 | 598 | } |
599 | + $count_users = $users->count(); | |
584 | 600 | |
585 | 601 | // Данные |
586 | 602 | $users = $users |
587 | 603 | ->Baseuser() |
588 | - ->orderByDesc(Worker::select('created_at') | |
589 | - ->whereColumn('workers.user_id', 'users.id')); | |
590 | - $count_users = $users->count(); | |
591 | - $users = $users->paginate(10); | |
604 | + ->orderByDesc('created_at') | |
605 | + ->paginate(10); | |
592 | 606 | |
593 | 607 | $export_options = DbExportColumns::toArray(); |
594 | 608 |
public/css/custom-ckeditor.css
public/css/general.css
... | ... | @@ -50,3 +50,24 @@ |
50 | 50 | .review-image-modal{ |
51 | 51 | cursor: pointer; |
52 | 52 | } |
53 | + | |
54 | +.cabinet__export-options-wrap { | |
55 | + display: flex; | |
56 | + flex-wrap: nowrap; | |
57 | + overflow-x: auto; | |
58 | + -webkit-overflow-scrolling: touch; | |
59 | + scroll-behavior: smooth; | |
60 | + gap: 10px; | |
61 | +} | |
62 | + | |
63 | +.cabinet__export-options-wrap::-webkit-scrollbar { | |
64 | + display: none; | |
65 | +} | |
66 | + | |
67 | +@media (min-width: 768px) { | |
68 | + .cabinet__export-options-wrap { | |
69 | + flex-wrap: wrap; | |
70 | + overflow-x: visible; | |
71 | + gap: 20px; | |
72 | + } | |
73 | +} |
public/css/style_may2024.css
... | ... | @@ -8348,7 +8348,8 @@ main + .news { |
8348 | 8348 | } |
8349 | 8349 | .cabinet__title { |
8350 | 8350 | font-size: 24px; |
8351 | - color: #6b6c6d; | |
8351 | + /*color: #6b6c6d;*/ | |
8352 | + color: #000000 | |
8352 | 8353 | } |
8353 | 8354 | @media (min-width: 768px) { |
8354 | 8355 | .cabinet__title { |
... | ... | @@ -9802,7 +9803,7 @@ nav .drop-down.closed { |
9802 | 9803 | /* When toggled via jQuery this class will reduce the height of the ul which inconjuction |
9803 | 9804 | with overflow: hidden set on the ul will hide all list items apart from the first */ |
9804 | 9805 | /* current li height 38px + 5px border */ |
9805 | - height: 43px; | |
9806 | + height: 35px; | |
9806 | 9807 | } |
9807 | 9808 | |
9808 | 9809 | .select2-selection__choice[title*="Все должности"] .select2-selection__choice__remove { |
resources/views/chats/chats_list.blade.php
... | ... | @@ -27,6 +27,10 @@ |
27 | 27 | @endif |
28 | 28 | |
29 | 29 | @if ($chats->count()) |
30 | + @include('modals.flash-message', [ | |
31 | + 'title' => 'Успешно!', | |
32 | + 'message' => session('success') | |
33 | + ]) | |
30 | 34 | @foreach($chats as $chat) |
31 | 35 | @if(!$chat->is_admin_chat) |
32 | 36 | <div class="messages__item hover-shadow {{ intval($chat->is_fixed) == 1 ? 'chat-fixed' : '' }}"> |
... | ... | @@ -62,10 +66,20 @@ |
62 | 66 | @if($chat->unread_messages_count > 0) |
63 | 67 | <div class="unread-messages-count mr-15">{{ $chat->unread_messages_count }}</div> |
64 | 68 | @endif |
65 | - | |
66 | - <button class="pin-chat {{ intval($chat->is_fixed) == 1 ? 'pin-on' : 'pin-off' }} mr-15"> | |
67 | - @include('svg.pin_off') | |
69 | + <button | |
70 | + class="pin-chat {{ intval($chat->is_fixed) == 1 ? 'pin-on' : 'pin-off' }} mr-15" | |
71 | + data-form-id="pin-chat-form-{{ $chat->id }}"> | |
72 | + @if (intval($chat->is_fixed) == 1) | |
73 | + @include('svg.pin_on') | |
74 | + @else | |
75 | + @include('svg.pin_off') | |
76 | + @endif | |
68 | 77 | </button> |
78 | + <form id="pin-chat-form-{{ $chat->id }}" action="{{ route('employer.pin_chat') }}" method="POST" style="display: none;"> | |
79 | + @csrf | |
80 | + <input type="hidden" name="id" value="{{ $chat->id }}"> | |
81 | + <input type="hidden" name="is_fixed" value="{{ intval($chat->is_fixed) == 1 ? 0 : 1 }}"> | |
82 | + </form> | |
69 | 83 | <button class="remove-chat" data-user="{{ $chat->user_id }}" data-fancybox data-src="#remove_chat"> |
70 | 84 | <svg> |
71 | 85 | <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> |
... | ... | @@ -92,25 +106,16 @@ |
92 | 106 | |
93 | 107 | <script> |
94 | 108 | $(function (){ |
95 | - $('.pin-chat').click(function(){ | |
96 | - var this_btn = $(this); | |
97 | - var chat_id = this_btn.closest('.messages__item-actions').data('chat-id'); | |
98 | - var $is_fixed = this_btn.hasClass('pin-on') ? 0 : 1; | |
109 | + $('.pin-chat').on('click', function (event) { | |
110 | + event.preventDefault(); | |
111 | + const formId = $(this).data('form-id'); | |
112 | + const $form = $('#' + formId); | |
99 | 113 | |
100 | - $.ajax({ | |
101 | - type: "POST", | |
102 | - url: "{{ route('employer.pin_chat') }}", | |
103 | - data: { | |
104 | - id: chat_id, | |
105 | - is_fixed: $is_fixed | |
106 | - }, | |
107 | - headers: { | |
108 | - 'X-CSRF-TOKEN': $('[name="_token"]').val() | |
109 | - }, | |
110 | - success: function(){ | |
111 | - location.reload(); | |
112 | - } | |
113 | - }); | |
114 | + if ($form.length) { | |
115 | + $form.submit(); | |
116 | + } else { | |
117 | + console.error('Form not found:', formId); | |
118 | + } | |
114 | 119 | }); |
115 | 120 | |
116 | 121 | $('.remove-chat').click(function(){ |
resources/views/employers/add_vacancy.blade.php
... | ... | @@ -284,12 +284,28 @@ |
284 | 284 | </div> |
285 | 285 | <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script> |
286 | 286 | <script> |
287 | - CKEDITOR.replace('text'); | |
288 | - //CKEDITOR.replace( 'text', { | |
289 | - // filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", | |
290 | - // filebrowserImageUploadUrl: "{{ route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", | |
291 | - // filebrowserUploadMethod: 'form' | |
292 | - // }); | |
287 | + CKEDITOR.replace('text', { | |
288 | + // File upload configuration (uncomment if needed) | |
289 | + // filebrowserUploadUrl: "{{ route('ckeditor.image-upload', ['_token' => csrf_token() ]) }}", | |
290 | + // filebrowserImageUploadUrl: "{{ route('ckeditor.image-upload', ['_token' => csrf_token() ]) }}", | |
291 | + // filebrowserUploadMethod: 'form', | |
292 | + | |
293 | + allowedContent: true, | |
294 | + extraAllowedContent: 'p br strong em u ul ol li span;*{*}', | |
295 | + | |
296 | + on: { | |
297 | + paste: function (event) { | |
298 | + let data = event.data.dataValue; | |
299 | + data = data.replace(/<br\s*\/?>\s*<br\s*\/?>/g, '<br>'); | |
300 | + event.data.dataValue = data.trim(); | |
301 | + } | |
302 | + }, | |
303 | + | |
304 | + contentsCss: [ | |
305 | + CKEDITOR.basePath + 'contents.css', | |
306 | + '/css/custom-ckeditor.css' | |
307 | + ] | |
308 | + }); | |
293 | 309 | </script> |
294 | 310 | |
295 | 311 | @endsection |
resources/views/employers/bd.blade.php
... | ... | @@ -22,6 +22,20 @@ |
22 | 22 | wrap.find('[name="search"]').val(''); |
23 | 23 | wrap.find('button').click(); |
24 | 24 | }); |
25 | + | |
26 | + const $exportOptionsWrap = $(".cabinet__export-options-wrap"); | |
27 | + | |
28 | + if ($exportOptionsWrap.length && $exportOptionsWrap[0].scrollWidth > $exportOptionsWrap[0].clientWidth) { | |
29 | + const $scrollHint = $('<div>', { | |
30 | + style: `position: absolute; | |
31 | + top: 0; | |
32 | + right: 0; | |
33 | + width: 50px; | |
34 | + height: 100%; | |
35 | + background: linear-gradient(to left, rgba(255,255,255,1), rgba(255,255,255,0)); | |
36 | + pointer-events: none;`}); | |
37 | + $exportOptionsWrap.parent().css("position", "relative").append($scrollHint); | |
38 | + } | |
25 | 39 | }); |
26 | 40 | |
27 | 41 | |
... | ... | @@ -146,7 +160,6 @@ |
146 | 160 | <table> |
147 | 161 | <thead> |
148 | 162 | <tr> |
149 | - <th style="max-width: 40px; min-width: 30px"></th> | |
150 | 163 | <th>ФИО соискателя</th> |
151 | 164 | <th>Должность</th> |
152 | 165 | <th>Наличие<br>анкеты</th> |
... | ... | @@ -160,14 +173,13 @@ |
160 | 173 | |
161 | 174 | @if ($users->count()) |
162 | 175 | @foreach ($users as $key => $it) |
176 | + @php $worker = !empty($it->workers[0]) ? $it->workers[0] : ''; @endphp | |
163 | 177 | <tr> |
164 | - <td style="max-width: 40px; min-width: 30px; font-size: 1.5rem">{{ $it->workers[0]->comment }}</td> | |
165 | - | |
166 | 178 | <td>{{ $it->surname." ".$it->name_man }}<br>{{ $it->surname2 }}</td> |
167 | 179 | |
168 | 180 | <td> |
169 | - @if($it->workers[0]->positions_work) | |
170 | - {{ $it->workers[0]->jobs->first()->name }} | |
181 | + @if($worker && $worker->positions_work) | |
182 | + {{ !empty($worker->jobs) ? $worker->jobs->first()->name : '' }} | |
171 | 183 | @endif |
172 | 184 | </td> |
173 | 185 |
resources/views/employers/favorite.blade.php
... | ... | @@ -157,7 +157,7 @@ |
157 | 157 | data-src="#send2" |
158 | 158 | data-vacancy="0" |
159 | 159 | data-uid="{{ Auth()->user()->id }}" |
160 | - data-tuid="{{ $it->users->id }}" | |
160 | + data-tuid="{{ $it->users ? $it->users->id : '' }}" | |
161 | 161 | data-options='{"touch":false,"autoFocus":false}'> |
162 | 162 | <svg class="mr-10"> |
163 | 163 | <use xlink:href="{{ asset('images/sprite.svg#chat') }}"></use> |
resources/views/employers/list_vacancy.blade.php
... | ... | @@ -26,13 +26,23 @@ |
26 | 26 | } |
27 | 27 | }); |
28 | 28 | }); |
29 | + | |
30 | + $(document).on('click', '.js-delete-trigger', function () { | |
31 | + var targetModal = $(this).data('target'); | |
32 | + $.fancybox.open({ | |
33 | + src: targetModal, | |
34 | + type: 'inline', | |
35 | + opts: { touch: false } | |
36 | + }); | |
37 | + }); | |
38 | + | |
29 | 39 | </script> |
30 | 40 | @endsection |
31 | 41 | |
32 | 42 | @section('content') |
33 | 43 | <section class="cabinet"> |
34 | 44 | @include('modals.flash-message', [ |
35 | - 'title' => 'Спасибо!', | |
45 | + 'title' => 'Успешно!', | |
36 | 46 | 'message' => session('success') |
37 | 47 | ]) |
38 | 48 | <div class="container"> |
... | ... | @@ -136,20 +146,24 @@ |
136 | 146 | <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use> |
137 | 147 | </svg> |
138 | 148 | </a> |
139 | - <a class="table__controls-item" title="Удалить вакансию" href="{{ route('employer.vacancy_delete', ['ad_employer' => $it->id]) }}"> | |
149 | + <a class="table__controls-item js-delete-trigger" | |
150 | + title="Удалить вакансию" | |
151 | + href="javascript:void(0)" | |
152 | + data-target="#delete-{{ $it->id }}"> | |
140 | 153 | <svg> |
141 | 154 | <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use> |
142 | 155 | </svg> |
143 | 156 | </a> |
157 | + @include('modals.vacancy.delete_vacancy', ['modalId' => "delete-{$it->id}", 'vacancyId' => $it->id, 'vacancyName' => $it->name]) | |
144 | 158 | @if ($it->active_is) |
145 | 159 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 0]) }}" title="Скрыть вакансию" class="table__controls-item"> |
146 | - <svg> | |
160 | + <svg preserveAspectRatio="xMidYMid meet"> | |
147 | 161 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> |
148 | 162 | </svg> |
149 | 163 | </a> |
150 | 164 | @else |
151 | 165 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 1]) }}" title="Показать вакансию" class="table__controls-item"> |
152 | - <svg> | |
166 | + <svg preserveAspectRatio="xMidYMid meet"> | |
153 | 167 | <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use> |
154 | 168 | </svg> |
155 | 169 | </a> |
resources/views/modals/chats/remove_chat.blade.php
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | <h2>Удалить чат</h2> |
5 | 5 | </div> |
6 | 6 | <div class="modal-dialog-body"> |
7 | - <p>Вы действительно хотите удалить чат с "<b><span class="target-chat"></span></b>"?</p> | |
7 | + <p>Вы уверены, что хотите удалить час с "<b><span class="target-chat"></span></b>"?</p> | |
8 | 8 | </div> |
9 | 9 | <div class="modal-dialog-footer"> |
10 | 10 | <button type="button" class="button remove-chat-button">Удалить</button> |
resources/views/modals/vacancy/delete_vacancy.blade.php
... | ... | @@ -0,0 +1,14 @@ |
1 | +<form action="{{ route('employer.vacancy_delete', ['ad_employer' => $vacancyId]) }}" | |
2 | + id="{{ $modalId }}" | |
3 | + class="modal modal_bg" | |
4 | + style="display: none;"> | |
5 | + @csrf | |
6 | + <div class="modal__body"> | |
7 | + <div class="modal__title">Удалить вакансию?</div> | |
8 | + <div class="modal__text">Вы уверены, что хотите удалить вакансию {{ $vacancyName }}?</div> | |
9 | + <div class="modal__buttons"> | |
10 | + <button type="submit" class="button">Да</button> | |
11 | + <button type="button" class="button button_light" data-fancybox-close>Нет</button> | |
12 | + </div> | |
13 | + </div> | |
14 | +</form> |