Blame view
resources/views/chats/chats_list.blade.php
5.58 KB
71329f175 правки |
1 2 |
@if ($chats->count() || $admin_chat) @csrf |
f98ccb92c Массова рассылка |
3 |
|
71329f175 правки |
4 5 6 7 8 9 10 11 12 |
@if($admin_chat) <div class="messages__item hover-shadow admin-chat-wrap"> <a class="messages__item-info" href="{{ route($user_type . '.dialog', ['chat' => $admin_chat->id]) }}"> @include('svg.logo_icon') <div class="messages__item-text"> <div> <b>Администратор сайта</b> </div> <div> |
09a2fc9d8 messages and subs... |
13 |
{{ $admin_chat->last_message?->text }} |
71329f175 правки |
14 |
</div> |
df58eaf86 правки |
15 |
</div> |
71329f175 правки |
16 |
</a> |
4e9bbc666 правки |
17 |
|
71329f175 правки |
18 19 20 |
<div class="messages__item-actions" data-chat-id="{{ $admin_chat->id }}"> <div class="messages__item-date max-content">{{ date(' H:i, d.m.Y', strtotime($admin_chat->created_at)) }}</div> <div class="messages__item-buttons"> |
09a2fc9d8 messages and subs... |
21 22 |
@if($admin_chat->unread_messages_count > 0) <div class="unread-messages-count mr-15">{{ $admin_chat->unread_messages_count }}</div> |
71329f175 правки |
23 24 |
@endif </div> |
4e9bbc666 правки |
25 |
</div> |
f98ccb92c Массова рассылка |
26 |
</div> |
71329f175 правки |
27 |
@endif |
f98ccb92c Массова рассылка |
28 |
|
71329f175 правки |
29 |
@if ($chats->count()) |
664449023 Employer personal... |
30 31 32 33 |
@include('modals.flash-message', [ 'title' => 'Успешно!', 'message' => session('success') ]) |
2f592b01f сообщения |
34 |
@foreach($chats as $chat) |
09a2fc9d8 messages and subs... |
35 |
@if(!$chat->is_admin_chat) |
2f592b01f сообщения |
36 |
<div class="messages__item hover-shadow {{ intval($chat->is_fixed) == 1 ? 'chat-fixed' : '' }}"> |
f98ccb92c Массова рассылка |
37 |
<a class="messages__item-info" href="{{ route($user_type . '.dialog', ['chat' => $chat->id]) }}"> |
2f592b01f сообщения |
38 |
<div class="messages__item-photo"> |
d721fd846 правки по сообщен... |
39 40 41 42 43 44 45 |
@if (isset($chat->employer->logo)) <img src="{{ asset(Storage::url($chat->employer->logo)) }}" alt=""> @elseif(isset($chat->worker->photo)) <img src="{{ asset(Storage::url($chat->worker->photo)) }}" alt=""> @else <img src="{{ asset('images/default_man.jpg') }}" alt=""> @endif |
2f592b01f сообщения |
46 47 48 |
</div> <div class="messages__item-text"> <div> |
d834955fe task-132687 додел... |
49 |
<b id="chat_name"> |
d721fd846 правки по сообщен... |
50 51 |
@if ($chat->employer && $chat->employer->name_company) {{ $chat->employer->name_company }} |
40d22381b fix chat |
52 |
@elseif($chat->user) |
d721fd846 правки по сообщен... |
53 54 55 |
{{ $chat->user->surname . ' ' . $chat->user->name_man . ' ' . $chat->user->surname2 }} @endif </b> |
2f592b01f сообщения |
56 57 |
</div> <div> |
09a2fc9d8 messages and subs... |
58 |
{{ $chat->last_message?->text }} |
2f592b01f сообщения |
59 60 |
</div> </div> |
d721fd846 правки по сообщен... |
61 |
</a> |
2f592b01f сообщения |
62 63 64 65 66 67 68 |
<div class="messages__item-actions" data-chat-id="{{ $chat->id }}"> <div class="messages__item-date max-content">{{ date(' H:i, d.m.Y', strtotime($chat->created_at)) }}</div> <div class="messages__item-buttons"> @if($chat->unread_messages_count > 0) <div class="unread-messages-count mr-15">{{ $chat->unread_messages_count }}</div> @endif |
664449023 Employer personal... |
69 70 71 72 73 74 75 76 |
<button class="pin-chat {{ intval($chat->is_fixed) == 1 ? 'pin-on' : 'pin-off' }} mr-15" data-form-id="pin-chat-form-{{ $chat->id }}"> @if (intval($chat->is_fixed) == 1) @include('svg.pin_on') @else @include('svg.pin_off') @endif |
2f592b01f сообщения |
77 |
</button> |
664449023 Employer personal... |
78 79 80 81 82 |
<form id="pin-chat-form-{{ $chat->id }}" action="{{ route('employer.pin_chat') }}" method="POST" style="display: none;"> @csrf <input type="hidden" name="id" value="{{ $chat->id }}"> <input type="hidden" name="is_fixed" value="{{ intval($chat->is_fixed) == 1 ? 0 : 1 }}"> </form> |
d834955fe task-132687 додел... |
83 |
<button class="remove-chat" data-user="{{ $chat->user_id }}" data-fancybox data-src="#remove_chat"> |
2f592b01f сообщения |
84 85 86 87 88 89 90 91 |
<svg> <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> </svg> </button> </div> <div class="clear"></div> </div> </div> |
09a2fc9d8 messages and subs... |
92 |
@endif |
2f592b01f сообщения |
93 94 95 96 |
@endforeach <div style="margin-top: 20px"> {{ $chats->onEachSide(0)->appends($_GET)->links('paginate') }} </div><!-- конец --> |
71329f175 правки |
97 |
@endif |
2f592b01f сообщения |
98 99 100 101 102 103 104 105 106 107 108 |
@else <div class="notify"> <svg> <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> </svg> <span>Сообщений не найдено</span> </div> @endif <script> $(function (){ |
664449023 Employer personal... |
109 110 111 112 |
$('.pin-chat').on('click', function (event) { event.preventDefault(); const formId = $(this).data('form-id'); const $form = $('#' + formId); |
2f592b01f сообщения |
113 |
|
664449023 Employer personal... |
114 115 116 117 118 |
if ($form.length) { $form.submit(); } else { console.error('Form not found:', formId); } |
2f592b01f сообщения |
119 120 121 122 123 124 |
}); $('.remove-chat').click(function(){ var this_btn = $(this); var chat_id = this_btn.closest('.messages__item-actions').data('chat-id'); var wrap = this_btn.closest('.messages__item'); |
d834955fe task-132687 додел... |
125 |
var target = wrap.find('.messages__item-text').find('#chat_name').text(); |
2f592b01f сообщения |
126 127 128 129 130 131 |
$('#remove_chat').data('chat-id', chat_id); $('#remove_chat').find('.target-chat').text(target.trim()); }); }); </script> |