Commit 8102d1f792f7373618e504603d2fc712166807a1

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

Merge branch 'master' of http://gitlab.nologostudio.ru/alarionov/rekamore-su

Showing 1 changed file Inline Diff

resources/views/chats/chats_list.blade.php
1 @if ($chats->count()) 1 @csrf
2 @csrf
3 2
4 @if($admin_chat) 3 @if($admin_chat)
5 <div class="messages__item hover-shadow admin-chat-wrap"> 4 <div class="messages__item hover-shadow admin-chat-wrap">
6 <a class="messages__item-info" href="{{ route($user_type . '.dialog', ['chat' => $admin_chat->id]) }}"> 5 <a class="messages__item-info" href="{{ route($user_type . '.dialog', ['chat' => $admin_chat->id]) }}">
7 @include('svg.logo_icon') 6 @include('svg.logo_icon')
8 <div class="messages__item-text"> 7 <div class="messages__item-text">
9 <div> 8 <div>
10 <b>Администратор сайта</b> 9 <b>Администратор сайта</b>
11 </div>
12 <div>
13 {{ $admin_chat->last_message->text }}
14 </div>
15 </div> 10 </div>
16 </a> 11 <div>
17 12 {{ $admin_chat->last_message->text }}
18 <div class="messages__item-actions" data-chat-id="{{ $admin_chat->id }}">
19 <div class="messages__item-date max-content">{{ date(' H:i, d.m.Y', strtotime($admin_chat->created_at)) }}</div>
20 <div class="messages__item-buttons">
21 @if($admin_chat->admin_chat_unread_messages_count > 0)
22 <div class="unread-messages-count mr-15">{{ $admin_chat->admin_chat_unread_messages_count }}</div>
23 @endif
24 </div> 13 </div>
25 </div> 14 </div>
15 </a>
16
17 <div class="messages__item-actions" data-chat-id="{{ $admin_chat->id }}">
18 <div class="messages__item-date max-content">{{ date(' H:i, d.m.Y', strtotime($admin_chat->created_at)) }}</div>
19 <div class="messages__item-buttons">
20 @if($admin_chat->admin_chat_unread_messages_count > 0)
21 <div class="unread-messages-count mr-15">{{ $admin_chat->admin_chat_unread_messages_count }}</div>
22 @endif
23 </div>
26 </div> 24 </div>
27 @endif 25 </div>
26 @endif
28 27
28 @if ($chats->count())
29 @foreach($chats as $chat) 29 @foreach($chats as $chat)
30 <div class="messages__item hover-shadow {{ intval($chat->is_fixed) == 1 ? 'chat-fixed' : '' }}"> 30 <div class="messages__item hover-shadow {{ intval($chat->is_fixed) == 1 ? 'chat-fixed' : '' }}">
31 <a class="messages__item-info" href="{{ route($user_type . '.dialog', ['chat' => $chat->id]) }}"> 31 <a class="messages__item-info" href="{{ route($user_type . '.dialog', ['chat' => $chat->id]) }}">
32 <div class="messages__item-photo"> 32 <div class="messages__item-photo">
33 @if (isset($chat->employer->logo)) 33 @if (isset($chat->employer->logo))
34 <img src="{{ asset(Storage::url($chat->employer->logo)) }}" alt=""> 34 <img src="{{ asset(Storage::url($chat->employer->logo)) }}" alt="">
35 @elseif(isset($chat->worker->photo)) 35 @elseif(isset($chat->worker->photo))
36 <img src="{{ asset(Storage::url($chat->worker->photo)) }}" alt=""> 36 <img src="{{ asset(Storage::url($chat->worker->photo)) }}" alt="">
37 @else 37 @else
38 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 38 <img src="{{ asset('images/default_man.jpg') }}" alt="">
39 @endif 39 @endif
40 </div> 40 </div>
41 <div class="messages__item-text"> 41 <div class="messages__item-text">
42 <div> 42 <div>
43 <b> 43 <b>
44 @if ($chat->employer && $chat->employer->name_company) 44 @if ($chat->employer && $chat->employer->name_company)
45 {{ $chat->employer->name_company }} 45 {{ $chat->employer->name_company }}
46 @else 46 @else
47 {{ $chat->user->surname . ' ' . $chat->user->name_man . ' ' . $chat->user->surname2 }} 47 {{ $chat->user->surname . ' ' . $chat->user->name_man . ' ' . $chat->user->surname2 }}
48 @endif 48 @endif
49 </b> 49 </b>
50 </div> 50 </div>
51 <div> 51 <div>
52 {{ $chat->last_message->text }} 52 {{ $chat->last_message->text }}
53 </div> 53 </div>
54 </div> 54 </div>
55 </a> 55 </a>
56 56
57 <div class="messages__item-actions" data-chat-id="{{ $chat->id }}"> 57 <div class="messages__item-actions" data-chat-id="{{ $chat->id }}">
58 <div class="messages__item-date max-content">{{ date(' H:i, d.m.Y', strtotime($chat->created_at)) }}</div> 58 <div class="messages__item-date max-content">{{ date(' H:i, d.m.Y', strtotime($chat->created_at)) }}</div>
59 <div class="messages__item-buttons"> 59 <div class="messages__item-buttons">
60 @if($chat->unread_messages_count > 0) 60 @if($chat->unread_messages_count > 0)
61 <div class="unread-messages-count mr-15">{{ $chat->unread_messages_count }}</div> 61 <div class="unread-messages-count mr-15">{{ $chat->unread_messages_count }}</div>
62 @endif 62 @endif
63 63
64 <button class="pin-chat {{ intval($chat->is_fixed) == 1 ? 'pin-on' : 'pin-off' }} mr-15"> 64 <button class="pin-chat {{ intval($chat->is_fixed) == 1 ? 'pin-on' : 'pin-off' }} mr-15">
65 @include('svg.pin_off') 65 @include('svg.pin_off')
66 </button> 66 </button>
67 <button class="remove-chat" data-fancybox data-src="#remove_chat"> 67 <button class="remove-chat" data-fancybox data-src="#remove_chat">
68 <svg> 68 <svg>
69 <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> 69 <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use>
70 </svg> 70 </svg>
71 </button> 71 </button>
72 </div> 72 </div>
73 <div class="clear"></div> 73 <div class="clear"></div>
74 </div> 74 </div>
75 </div> 75 </div>
76 @endforeach 76 @endforeach
77 <div style="margin-top: 20px"> 77 <div style="margin-top: 20px">
78 {{ $chats->onEachSide(0)->appends($_GET)->links('paginate') }} 78 {{ $chats->onEachSide(0)->appends($_GET)->links('paginate') }}
79 </div><!-- конец --> 79 </div><!-- конец -->
80 @else 80 @else
81 <div class="notify"> 81 <div class="notify">
82 <svg> 82 <svg>
83 <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> 83 <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use>
84 </svg> 84 </svg>
85 <span>Сообщений не найдено</span> 85 <span>Сообщений не найдено</span>
86 </div> 86 </div>
87 @endif 87 @endif
88 88
89 <script> 89 <script>
90 $(function (){ 90 $(function (){
91 $('.pin-chat').click(function(){ 91 $('.pin-chat').click(function(){
92 var this_btn = $(this); 92 var this_btn = $(this);
93 var chat_id = this_btn.closest('.messages__item-actions').data('chat-id'); 93 var chat_id = this_btn.closest('.messages__item-actions').data('chat-id');
94 var $is_fixed = this_btn.hasClass('pin-on') ? 0 : 1; 94 var $is_fixed = this_btn.hasClass('pin-on') ? 0 : 1;
95 95
96 $.ajax({ 96 $.ajax({
97 type: "POST", 97 type: "POST",
98 url: "{{ route('employer.pin_chat') }}", 98 url: "{{ route('employer.pin_chat') }}",
99 data: { 99 data: {
100 id: chat_id, 100 id: chat_id,
101 is_fixed: $is_fixed 101 is_fixed: $is_fixed
102 }, 102 },
103 headers: { 103 headers: {
104 'X-CSRF-TOKEN': $('[name="_token"]').val() 104 'X-CSRF-TOKEN': $('[name="_token"]').val()
105 }, 105 },
106 success: function(){ 106 success: function(){
107 location.reload(); 107 location.reload();
108 } 108 }
109 }); 109 });
110 }); 110 });
111 111
112 $('.remove-chat').click(function(){ 112 $('.remove-chat').click(function(){