Commit 46bf23a74af6ce36b96ecdc28239eae4afecbfd1

Authored by Андрей Ларионов
1 parent 77f5d911ff

Добавление картинок - диалог

Showing 1 changed file with 9 additions and 11 deletions Inline Diff

resources/views/employers/messages.blade.php
1 @extends('layout.frontend', ['title' => 'Сообщения от пользователей - РекаМоре']) 1 @extends('layout.frontend', ['title' => 'Сообщения от пользователей - РекаМоре'])
2 @section('scripts') 2 @section('scripts')
3 <script> 3 <script>
4 console.log('Test system'); 4 console.log('Test system');
5 $(document).on('change', '#sort_ajax', function() { 5 $(document).on('change', '#sort_ajax', function() {
6 var this_ = $(this); 6 var this_ = $(this);
7 var val_ = this_.val(); 7 var val_ = this_.val();
8 console.log('sort items '+val_); 8 console.log('sort items '+val_);
9 9
10 $.ajax({ 10 $.ajax({
11 type: "GET", 11 type: "GET",
12 url: "{{ route('shipping_companies') }}", 12 url: "{{ route('shipping_companies') }}",
13 data: "sort="+val_+"&block=1", 13 data: "sort="+val_+"&block=1",
14 success: function (data) { 14 success: function (data) {
15 console.log('Выбор сортировки'); 15 console.log('Выбор сортировки');
16 console.log(data); 16 console.log(data);
17 $('#block_1').html(data); 17 $('#block_1').html(data);
18 }, 18 },
19 headers: { 19 headers: {
20 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 20 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
21 }, 21 },
22 error: function (data) { 22 error: function (data) {
23 data = JSON.stringify(data); 23 data = JSON.stringify(data);
24 console.log('Error: ' + data); 24 console.log('Error: ' + data);
25 } 25 }
26 }); 26 });
27 27
28 $.ajax({ 28 $.ajax({
29 type: "GET", 29 type: "GET",
30 url: "{{ route('shipping_companies') }}", 30 url: "{{ route('shipping_companies') }}",
31 data: "sort="+val_+"&block=2", 31 data: "sort="+val_+"&block=2",
32 success: function (data) { 32 success: function (data) {
33 console.log('Выбор сортировки2'); 33 console.log('Выбор сортировки2');
34 console.log(data); 34 console.log(data);
35 history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); 35 history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif");
36 $('#block_2').html(data); 36 $('#block_2').html(data);
37 }, 37 },
38 headers: { 38 headers: {
39 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 39 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
40 }, 40 },
41 error: function (data) { 41 error: function (data) {
42 data = JSON.stringify(data); 42 data = JSON.stringify(data);
43 console.log('Error: ' + data); 43 console.log('Error: ' + data);
44 } 44 }
45 }); 45 });
46 }); 46 });
47 </script> 47 </script>
48 @endsection 48 @endsection
49 49
50 @section('content') 50 @section('content')
51 <section class="cabinet"> 51 <section class="cabinet">
52 <div class="container"> 52 <div class="container">
53 <ul class="breadcrumbs cabinet__breadcrumbs"> 53 <ul class="breadcrumbs cabinet__breadcrumbs">
54 <li><a href="{{ route('index') }}">Главная</a></li> 54 <li><a href="{{ route('index') }}">Главная</a></li>
55 <li><b>Личный кабинет</b></li> 55 <li><b>Личный кабинет</b></li>
56 </ul> 56 </ul>
57 <div class="cabinet__wrapper"> 57 <div class="cabinet__wrapper">
58 <div class="cabinet__side"> 58 <div class="cabinet__side">
59 <div class="cabinet__side-toper"> 59 <div class="cabinet__side-toper">
60 @include('employers.emblema') 60 @include('employers.emblema')
61 </div> 61 </div>
62 62
63 63
64 @include('employers.menu', ['item' => 5]) 64 @include('employers.menu', ['item' => 5])
65 </div> 65 </div>
66 66
67 <div class="cabinet__body"> 67 <div class="cabinet__body">
68 <div class="cabinet__body-item"> 68 <div class="cabinet__body-item">
69 <h2 class="title cabinet__title">Сообщения</h2> 69 <h2 class="title cabinet__title">Сообщения</h2>
70 </div> 70 </div>
71 <div class="cabinet__body-item"> 71 <div class="cabinet__body-item">
72 <div class="cabinet__filters"> 72 <div class="cabinet__filters">
73 <div class="cabinet__filters-item"> 73 <div class="cabinet__filters-item">
74 <div class="cabinet__filters-buttons"> 74 <div class="cabinet__filters-buttons">
75 <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="button button_light @if ($type_message == 'input') active @endif">Входящие ({{ $count_input }})</a> 75 <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="button button_light @if ($type_message == 'input') active @endif">Входящие ({{ $count_input }})</a>
76 <a href="{{ route('employer.messages', ['type_message' => 'output']) }}" class="button button_light @if ($type_message == 'output') active @endif">Исходящие ({{ $count_output }})</a> 76 <a href="{{ route('employer.messages', ['type_message' => 'output']) }}" class="button button_light @if ($type_message == 'output') active @endif">Исходящие ({{ $count_output }})</a>
77 </div> 77 </div>
78 </div> 78 </div>
79 <!--<div class="cabinet__filters-item"> 79 <!--<div class="cabinet__filters-item">
80 <div class="select"> 80 <div class="select">
81 <select class="js-select2" id="sort_ajax" name="sort_ajax"> 81 <select class="js-select2" id="sort_ajax" name="sort_ajax">
82 <option value="default">Сортировка (по умолчанию)</option> 82 <option value="default">Сортировка (по умолчанию)</option>
83 <option value="name (asc)">По имени (возрастание)</option> 83 <option value="name (asc)">По имени (возрастание)</option>
84 <option value="name (desc)">По имени (убывание)</option> 84 <option value="name (desc)">По имени (убывание)</option>
85 <option value="created_at (asc)">По дате (возрастание)</option> 85 <option value="created_at (asc)">По дате (возрастание)</option>
86 <option value="created_at (desc)">По дате (убывание)</option> 86 <option value="created_at (desc)">По дате (убывание)</option>
87 </select> 87 </select>
88 </div> 88 </div>
89 </div>--> 89 </div>-->
90 </div> 90 </div>
91 <div class="messages"> 91 <div class="messages">
92 <!--<button type="button" class="messages__button js-toggle js-parent-toggle button button_light button_more"> 92 <!--<button type="button" class="messages__button js-toggle js-parent-toggle button button_light button_more">
93 <span>Показать ещё</span> 93 <span>Показать ещё</span>
94 <span>Скрыть</span> 94 <span>Скрыть</span>
95 </button>--> 95 </button>-->
96 <div class="messages__body"> 96 <div class="messages__body">
97 @if ($messages->count()) 97 @if ($messages->count())
98 @foreach($messages as $it) 98 @foreach($messages as $it)
99 <div class="messages__item"> 99 <div class="messages__item">
100 <div class="messages__item-info"> 100 <div class="messages__item-info">
101 <div class="messages__item-photo"> 101 <div class="messages__item-photo">
102 <svg> 102 <svg>
103 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> 103 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
104 </svg> 104 </svg>
105 105
106 106
107 @if ($type_message == 'input') 107 @if ($type_message == 'input')
108 @if ($it->user_to->is_worker) 108 @if ($it->user_from->is_worker)
109 @if (isset($it->user_to->workers->photo)) 109 @if (isset($it->user_from->workers[0]->photo))
110 <img src="{{ asset(Storage::url($it->user_to->workers->photo)) }}" alt=""> 110 <img src="{{ asset(Storage::url($it->user_from->workers[0]->photo)) }}" alt="">
111 @elseif(isset($it->user_to->file))
112 <img src="{{ asset(Storage::url($it->user_to->file)) }}" alt="">
113 @else 111 @else
114 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 112 <img src="{{ asset('images/default_man.jpg') }}" alt="">
115 @endif 113 @endif
116 @else 114 @else
117 @if (isset($it->user_to->employers->logo)) 115 @if (isset($it->user_from->employers[0]->logo))
118 <img src="{{ asset(Storage::url($it->user_to->employers->logo)) }}" alt=""> 116 <img src="{{ asset(Storage::url($it->user_from->employers[0]->logo)) }}" alt="">
119 @else 117 @else
120 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 118 <img src="{{ asset('images/default_man.jpg') }}" alt="">
121 @endif 119 @endif
122 @endif 120 @endif
123 @endif 121 @endif
124 122
125 @if ($type_message == 'output') 123 @if ($type_message == 'output')
126 @if ($it->user_from->is_worker) 124 @if ($it->user_from->is_worker)
127 @if (isset($it->user_from->workers->photo)) 125 @if (isset($it->user_from->workers[0]->photo))
128 <img src="{{ asset(Storage::url($it->user_from->workers->photo)) }}" alt=""> 126 <img src="{{ asset(Storage::url($it->user_from->workers[0]->photo)) }}" alt="">
129 @else 127 @else
130 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 128 <img src="{{ asset('images/default_man.jpg') }}" alt="">
131 @endif 129 @endif
132 @else 130 @else
133 @if (isset($it->user_from->employers->logo)) 131 @if (isset($it->user_from->employers[0]->logo))
134 <img src="{{ asset(Storage::url($it->user_from->employers->logo)) }}" alt=""> 132 <img src="{{ asset(Storage::url($it->user_from->employers[0]->logo)) }}" alt="">
135 @else 133 @else
136 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 134 <img src="{{ asset('images/default_man.jpg') }}" alt="">
137 @endif 135 @endif
138 @endif 136 @endif
139 @endif 137 @endif
140 </div> 138 </div>
141 <div class="messages__item-text"> 139 <div class="messages__item-text">
142 <div> 140 <div>
143 От: @if (isset($it->user_from)) 141 От: @if (isset($it->user_from))
144 @if ($it->user_from->id !== $user_id) 142 @if ($it->user_from->id !== $user_id)
145 <!--<a href=" route('employer.dialog', ['user1' => $user_id, 'user2' => $it->user_from->id]) }}" style="text-decoration: underline">--> 143 <!--<a href=" route('employer.dialog', ['user1' => $user_id, 'user2' => $it->user_from->id]) }}" style="text-decoration: underline">-->
146 {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }} 144 {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }}
147 <!--</a>--> 145 <!--</a>-->
148 @else 146 @else
149 {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }} 147 {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }}
150 @endif 148 @endif
151 @else 149 @else
152 Удаленный пользователь 150 Удаленный пользователь
153 @endif 151 @endif
154 <br> 152 <br>
155 К: @if (isset($it->user_to)) 153 К: @if (isset($it->user_to))
156 @if ($it->user_to->id !== $user_id) 154 @if ($it->user_to->id !== $user_id)
157 <!--<a href=" route('employer.dialog', ['user1' => $user_id, 'user2' => $it->user_to->id]) }}" style="text-decoration: underline">--> 155 <!--<a href=" route('employer.dialog', ['user1' => $user_id, 'user2' => $it->user_to->id]) }}" style="text-decoration: underline">-->
158 {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }} 156 {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }}
159 <!--</a>--> 157 <!--</a>-->
160 @else 158 @else
161 {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }} 159 {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }}
162 @endif 160 @endif
163 @else 161 @else
164 Удаленный пользователь 162 Удаленный пользователь
165 @endif 163 @endif
166 </div> 164 </div>
167 <div> 165 <div>
168 <span>Вакансия: </span> 166 <span>Вакансия: </span>
169 @if (isset($it->user_from)) 167 @if (isset($it->user_from))
170 @if ($it->user_from->id !== $user_id) 168 @if ($it->user_from->id !== $user_id)
171 @if (isset($it->vacancies)) 169 @if (isset($it->vacancies))
172 <a href="{{ route('employer.dialog', ['user1' => $user_id, 'user2' => $it->user_from->id, 'ad_employer' => $it->vacancies->id, 'ad_name' => $it->vacancies->name ]) }}" style="text-decoration: underline"> 170 <a href="{{ route('employer.dialog', ['user1' => $user_id, 'user2' => $it->user_from->id, 'ad_employer' => $it->vacancies->id, 'ad_name' => $it->vacancies->name ]) }}" style="text-decoration: underline">
173 {{ $it->vacancies->name." (".($it->vacancies->id).")" }} 171 {{ $it->vacancies->name." (".($it->vacancies->id).")" }}
174 </a> 172 </a>
175 @else 173 @else
176 <a href="{{ route('employer.dialog', ['user1' => $user_id, 'user2' => $it->user_from->id, 'ad_employer' => 0, 'ad_name' => 'Не указана вакансия' ]) }}" style="text-decoration: underline"> 174 <a href="{{ route('employer.dialog', ['user1' => $user_id, 'user2' => $it->user_from->id, 'ad_employer' => 0, 'ad_name' => 'Не указана вакансия' ]) }}" style="text-decoration: underline">
177 Вакансия не указана 175 Вакансия не указана
178 </a> 176 </a>
179 @endif 177 @endif
180 @else 178 @else
181 179
182 @endif 180 @endif
183 @endif 181 @endif
184 182
185 @if (isset($it->user_to)) 183 @if (isset($it->user_to))
186 @if ($it->user_to->id !== $user_id) 184 @if ($it->user_to->id !== $user_id)
187 @if (isset($it->vacancies)) 185 @if (isset($it->vacancies))
188 <a href="{{ route('employer.dialog', ['user1' => $user_id, 'user2' => $it->user_to->id, 'ad_employer' => $it->vacancies->id, 'ad_name' => $it->vacancies->name ]) }}" style="text-decoration: underline"> 186 <a href="{{ route('employer.dialog', ['user1' => $user_id, 'user2' => $it->user_to->id, 'ad_employer' => $it->vacancies->id, 'ad_name' => $it->vacancies->name ]) }}" style="text-decoration: underline">
189 {{ $it->vacancies->name." (".($it->vacancies->id).")" }} 187 {{ $it->vacancies->name." (".($it->vacancies->id).")" }}
190 </a> 188 </a>
191 @else 189 @else
192 <a href="{{ route('employer.dialog', ['user1' => $user_id, 'user2' => $it->user_to->id, 'ad_employer' => 0, 'ad_name' => 'Не указана вакансия' ]) }}" style="text-decoration: underline"> 190 <a href="{{ route('employer.dialog', ['user1' => $user_id, 'user2' => $it->user_to->id, 'ad_employer' => 0, 'ad_name' => 'Не указана вакансия' ]) }}" style="text-decoration: underline">
193 Вакансия не указана 191 Вакансия не указана
194 </a> 192 </a>
195 @endif 193 @endif
196 @else 194 @else
197 195
198 @endif 196 @endif
199 @endif 197 @endif
200 198
201 </div> 199 </div>
202 <div><span>Текст:</span>{{ $it->text }}</div> 200 <div><span>Текст:</span>{{ $it->text }}</div>
203 </div> 201 </div>
204 </div> 202 </div>
205 203
206 <div class="messages__item-date">{{ $it->created_at }}</div> 204 <div class="messages__item-date">{{ $it->created_at }}</div>
207 </div> 205 </div>
208 @endforeach 206 @endforeach
209 <div style="margin-top: 20px"> 207 <div style="margin-top: 20px">
210 {{ $messages->onEachSide(0)->appends($_GET)->links('paginate') }} 208 {{ $messages->onEachSide(0)->appends($_GET)->links('paginate') }}
211 </div><!-- конец --> 209 </div><!-- конец -->
212 @else 210 @else
213 <div class="notify"> 211 <div class="notify">
214 <svg> 212 <svg>
215 <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> 213 <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use>
216 </svg> 214 </svg>
217 <span>Сообщений не найдено</span> 215 <span>Сообщений не найдено</span>
218 </div> 216 </div>
219 @endif 217 @endif
220 </div> 218 </div>
221 </div> 219 </div>
222 </div> 220 </div>
223 </div> 221 </div>
224 </div> 222 </div>
225 </div> 223 </div>
226 </section> 224 </section>
227 </div> 225 </div>
228 @endsection 226 @endsection
229 227