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