Blame view
resources/views/chats/chats_list.blade.php
4.25 KB
2f592b01f сообщения |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
@if ($chats->count()) @csrf @foreach($chats as $chat) <div class="messages__item hover-shadow {{ intval($chat->is_fixed) == 1 ? 'chat-fixed' : '' }}"> <div class="messages__item-info"> <div class="messages__item-photo"> <a class="" href="{{ route($user_type . '.dialog', ['user1' => $chat->user_id, 'user2' => $chat->to_user_id, 'ad_employer' => 0]) }}"> @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 </a> </div> <div class="messages__item-text"> <div> <a class="messages__item-target" href="{{ route($user_type . '.dialog', ['user1' => $chat->user_id, 'user2' => $chat->to_user_id, 'ad_employer' => 0]) }}"> <b> @if ($chat->employer && $chat->employer->name_company) {{ $chat->employer->name_company }} @else {{ $chat->user->surname . ' ' . $chat->user->name_man . ' ' . $chat->user->surname2 }} @endif </b> </a> </div> <div> {{ $chat->last_message->text }} </div> </div> </div> <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 <button class="pin-chat {{ intval($chat->is_fixed) == 1 ? 'pin-on' : 'pin-off' }} mr-15"> @include('svg.pin_off') </button> <button class="remove-chat" data-fancybox data-src="#remove_chat"> <svg> <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> </svg> </button> </div> <div class="clear"></div> </div> </div> @endforeach <div style="margin-top: 20px"> {{ $chats->onEachSide(0)->appends($_GET)->links('paginate') }} </div><!-- конец --> @else <div class="notify"> <svg> <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> </svg> <span>Сообщений не найдено</span> </div> @endif <script> $(function (){ $('.pin-chat').click(function(){ var this_btn = $(this); var chat_id = this_btn.closest('.messages__item-actions').data('chat-id'); var $is_fixed = this_btn.hasClass('pin-on') ? 0 : 1; $.ajax({ type: "POST", url: "{{ route('employer.pin_chat') }}", data: { id: chat_id, is_fixed: $is_fixed }, headers: { 'X-CSRF-TOKEN': $('[name="_token"]').val() }, success: function(){ location.reload(); } }); }); $('.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'); var target = wrap.find('.messages__item-target').text(); $('#remove_chat').data('chat-id', chat_id); $('#remove_chat').find('.target-chat').text(target.trim()); }); }); </script> |