Commit 7db5ce20a653825a7fdafe8866cd3aabe0487819

Authored by Hayk Nazaryan
1 parent 70d1f8db75
Exists in master

fix chat design

Showing 1 changed file with 21 additions and 26 deletions Inline Diff

resources/views/employers/dialog.blade.php
1 @extends('layout.frontend', ['title' => 'Диалог-переписка - РекаМоре']) 1 @extends('layout.frontend', ['title' => 'Диалог-переписка - РекаМоре'])
2 2
3 @section('scripts') 3 @section('scripts')
4 <script> 4 <script>
5 $(function(){ 5 $(function(){
6 var chatbox_div = $('.chatbox__list'); 6 var chatbox_div = $('.chatbox__list');
7 chatbox_div.scrollTop(chatbox_div.prop("scrollHeight")); 7 chatbox_div.scrollTop(chatbox_div.prop("scrollHeight"));
8 8
9 $('form.chatbox__bottom [name="file"]').on('change', function() { 9 $('form.chatbox__bottom [name="file"]').on('change', function() {
10 var fileName = $(this).val().split('\\').pop(); 10 var fileName = $(this).val().split('\\').pop();
11 $('.chatbox-file-name-wrap').text('Добавлен файл: ' + fileName); 11 $('.chatbox-file-name-wrap').text('Добавлен файл: ' + fileName);
12 }); 12 });
13 }); 13 });
14 14
15 $(document).on('change', '#send_btn', function() { 15 $(document).on('change', '#send_btn', function() {
16 var this_ = $(this); 16 var this_ = $(this);
17 var val_ = this_.val(); 17 var val_ = this_.val();
18 console.log('sort items '+val_); 18 console.log('sort items '+val_);
19 19
20 $.ajax({ 20 $.ajax({
21 type: "GET", 21 type: "GET",
22 url: "{{ route('shipping_companies') }}", 22 url: "{{ route('shipping_companies') }}",
23 data: "sort="+val_+"&block=1", 23 data: "sort="+val_+"&block=1",
24 success: function (data) { 24 success: function (data) {
25 console.log('Выбор сортировки'); 25 console.log('Выбор сортировки');
26 console.log(data); 26 console.log(data);
27 $('#block_1').html(data); 27 $('#block_1').html(data);
28 }, 28 },
29 headers: { 29 headers: {
30 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 30 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
31 }, 31 },
32 error: function (data) { 32 error: function (data) {
33 data = JSON.stringify(data); 33 data = JSON.stringify(data);
34 console.log('Error: ' + data); 34 console.log('Error: ' + data);
35 } 35 }
36 }); 36 });
37 37
38 $.ajax({ 38 $.ajax({
39 type: "GET", 39 type: "GET",
40 url: "{{ route('shipping_companies') }}", 40 url: "{{ route('shipping_companies') }}",
41 data: "sort="+val_+"&block=2", 41 data: "sort="+val_+"&block=2",
42 success: function (data) { 42 success: function (data) {
43 console.log('Выбор сортировки2'); 43 console.log('Выбор сортировки2');
44 console.log(data); 44 console.log(data);
45 history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); 45 history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif");
46 $('#block_2').html(data); 46 $('#block_2').html(data);
47 }, 47 },
48 headers: { 48 headers: {
49 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 49 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
50 }, 50 },
51 error: function (data) { 51 error: function (data) {
52 data = JSON.stringify(data); 52 data = JSON.stringify(data);
53 console.log('Error: ' + data); 53 console.log('Error: ' + data);
54 } 54 }
55 }); 55 });
56 }); 56 });
57 </script> 57 </script>
58 @endsection 58 @endsection
59 59
60 @section('content') 60 @section('content')
61 <section class="cabinet"> 61 <section class="cabinet">
62 <div class="container"> 62 <div class="container">
63 <ul class="breadcrumbs cabinet__breadcrumbs"> 63 <ul class="breadcrumbs cabinet__breadcrumbs">
64 <li><a href="{{ route('index') }}">Главная</a></li> 64 <li><a href="{{ route('index') }}">Главная</a></li>
65 <li><b>Личный кабинет</b></li> 65 <li><b>Личный кабинет</b></li>
66 </ul> 66 </ul>
67 <div class="cabinet__wrapper"> 67 <div class="cabinet__wrapper">
68 <div class="cabinet__side"> 68 <div class="cabinet__side">
69 <div class="cabinet__side-toper"> 69 <div class="cabinet__side-toper">
70 @include('employers.emblema') 70 @include('employers.emblema')
71 </div> 71 </div>
72 @include('employers.menu', ['item' => 5]) 72 @include('employers.menu', ['item' => 5])
73 </div> 73 </div>
74 <div class="cabinet__body"> 74 <div class="cabinet__body">
75 <div class="cabinet__body-item"> 75 <div class="cabinet__body-item">
76 <h2 class="title cabinet__title">Сообщения</h2> 76 <h2 class="title cabinet__title">Сообщения</h2>
77 </div> 77 </div>
78 <div class="cabinet__body-item"> 78 <div class="cabinet__body-item">
79 <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="back"> 79 <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="back">
80 <svg> 80 <svg>
81 <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use> 81 <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use>
82 </svg> 82 </svg>
83 <span> 83 <span>
84 К списку чатов 84 К списку чатов
85 </span> 85 </span>
86 </a> 86 </a>
87 <div class="chatbox"> 87 <div class="chatbox">
88 <div class="chatbox__toper"> 88 <div class="chatbox__toper">
89 @if($chat->is_admin_chat) 89 @if($chat->is_admin_chat)
90 <div class="chatbox__toper-info messages__item-info"> 90 <div class="chatbox__toper-info messages__item-info">
91 @include('svg.logo_icon') 91 @include('svg.logo_icon')
92 <div class="messages__item-text bold font20"> 92 <div class="messages__item-text bold font20">
93 Администратор сайта 93 Администратор сайта
94 </div> 94 </div>
95 </div> 95 </div>
96 @elseif ($companion->is_worker) 96 @elseif ($companion->is_worker)
97 <div class="chatbox__toper-info messages__item-info"> 97 <div class="chatbox__toper-info messages__item-info">
98 <div class="messages__item-photo"> 98 <div class="messages__item-photo">
99 <svg> 99 <svg>
100 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> 100 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
101 </svg> 101 </svg>
102 @if ((isset($companion->workers[0]->photo)) && 102 @if ((isset($companion->workers[0]->photo)) &&
103 (!empty($companion->workers[0]->photo))) 103 (!empty($companion->workers[0]->photo)))
104 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->workers[0]->photo)) }}" alt=""> 104 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->workers[0]->photo)) }}" alt="">
105 @else 105 @else
106 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 106 <img src="{{ asset('images/default_man.jpg') }}" alt="">
107 @endif 107 @endif
108 </div> 108 </div>
109 <div class="messages__item-text"> 109 <div class="messages__item-text">
110 <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div> 110 <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div>
111 </div> 111 </div>
112 </div> 112 </div>
113 @if (isset($companion->workers[0]->id)) 113 @if (isset($companion->workers[0]->id))
114 <a href="{{ route('resume_profile', ['worker' => $companion->workers[0]->id]) }}" class="button chatbox__toper-button"> 114 <a href="{{ route('resume_profile', ['worker' => $companion->workers[0]->id]) }}" class="button chatbox__toper-button">
115 <svg> 115 <svg>
116 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> 116 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use>
117 </svg> 117 </svg>
118 Перейти в профиль 118 Перейти в профиль
119 </a> 119 </a>
120 @endif 120 @endif
121 @else 121 @else
122 <div class="chatbox__toper-info messages__item-info"> 122 <div class="chatbox__toper-info messages__item-info">
123 <div class="messages__item-photo"> 123 <div class="messages__item-photo">
124 <svg> 124 <svg>
125 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> 125 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
126 </svg> 126 </svg>
127 @if ((isset($companion->employers[0]->logo)) && 127 @if ((isset($companion->employers[0]->logo)) &&
128 (!empty($companion->employers[0]->logo))) 128 (!empty($companion->employers[0]->logo)))
129 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->employers[0]->logo)) }}" alt=""> 129 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->employers[0]->logo)) }}" alt="">
130 @else 130 @else
131 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 131 <img src="{{ asset('images/default_man.jpg') }}" alt="">
132 @endif 132 @endif
133 </div> 133 </div>
134 <div class="messages__item-text"> 134 <div class="messages__item-text">
135 <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div> 135 <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div>
136 <div><span>Статус:</span> Работодатель или Администратор</div> 136 <div><span>Статус:</span> Работодатель или Администратор</div>
137 </div> 137 </div>
138 </div> 138 </div>
139 @if (isset($companion->employer->id)) 139 @if (isset($companion->employer->id))
140 <a href="" class="button chatbox__toper-button"> 140 <a href="" class="button chatbox__toper-button">
141 <svg> 141 <svg>
142 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> 142 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use>
143 </svg> 143 </svg>
144 Перейти в профиль 144 Перейти в профиль
145 </a> 145 </a>
146 @endif 146 @endif
147 @endif 147 @endif
148 </div> 148 </div>
149 149
150 @if ($errors->any()) 150 @if ($errors->any())
151 <div class="red bold"> 151 <div class="red bold">
152 <ul> 152 <ul>
153 @foreach ($errors->all() as $error) 153 @foreach ($errors->all() as $error)
154 <li>{{ $error }}</li> 154 <li>{{ $error }}</li>
155 @endforeach 155 @endforeach
156 </ul> 156 </ul>
157 </div> 157 </div>
158 @endif 158 @endif
159 159
160 <div class="chatbox__list" id="dialogs" name="dialogs"> 160 <div class="chatbox__list" id="dialogs" name="dialogs">
161 @if ($Messages->count()) 161 @if ($Messages->count())
162 @foreach ($Messages as $it) 162 @foreach ($Messages as $it)
163 @if ($it->user_id == $companion->id) 163 @if ($it->user_id == $companion->id)
164 <div class="chatbox__item"> 164 <div class="chatbox__item">
165 <div class="@if(!$companion->id != $superAdmin->id) chatbox__item-photo @endif "> 165 <div class="@if(!$companion->id != $superAdmin->id) chatbox__item-photo @endif ">
166 @if(!$companion->id == $superAdmin->id) 166 @if(!$companion->id == $superAdmin->id)
167 <svg> 167 <svg>
168 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> 168 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
169 </svg> 169 </svg>
170 @endif 170 @endif
171 @if($companion->is_worker) 171 @if($companion->is_worker)
172 @if ((isset($companion->workers[0]->photo)) && 172 @if ((isset($companion->workers[0]->photo)) &&
173 (!empty($companion->workers[0]->photo))) 173 (!empty($companion->workers[0]->photo)))
174 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->workers[0]->photo)) }}" alt=""> 174 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->workers[0]->photo)) }}" alt="">
175 @else 175 @else
176 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 176 <img src="{{ asset('images/default_man.jpg') }}" alt="">
177 @endif 177 @endif
178 @elseif($companion->id == $superAdmin->id) 178 @elseif($companion->id == $superAdmin->id)
179 @include('svg.logo_icon') 179 @include('svg.logo_icon')
180 @else 180 @else
181 @if ((isset($companion->employers[0]->logo)) && 181 @if ((isset($companion->employers[0]->logo)) && (!empty($companion->employers[0]->logo)))
182 (!empty($companion->employers[0]->logo)))
183 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->employers[0]->logo)) }}" alt=""> 182 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->employers[0]->logo)) }}" alt="">
184 @else 183 @else
185 <div class="chatbox__item-photo "> 184 <div class="chatbox__item-photo">
186
187 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 185 <img src="{{ asset('images/default_man.jpg') }}" alt="">
188 </div> 186 </div>
189
190 @endif 187 @endif
191 @endif 188 @endif
192 </div> 189 </div>
193 <div class="chatbox__item-body"> 190 <div class="chatbox__item-body">
194 <div class="chatbox__item-text">
195
196 <button class="button admin-chat-answer" data-fancybox data-src="#answer_to_admin_chat_modal"
197 data-to-user-id="{{ $it->user_id }}" data-message-id="{{ $it->id }}"
198 >
199 Ответить
200 </button>
201
202 @if(\App\Models\Ad_employer::where('id', $it->ad_employer_id)->exists())
203 Отклик на вакансию {{ \App\Models\Ad_employer::find($it->ad_employer_id)->name }}
204 @if($it->text)
205 Комментарий: {{ $it->text }}
206 @endif
207 @else
208 @if($it->text)
209 {{ $it->text }}
210 @endif
211 </div>
212
213 @endif
214 @if ((isset($it->file)) && (!empty($it->file))) 191 @if ((isset($it->file)) && (!empty($it->file)))
215 <div class="chatbox__item-text chatbox__item-body-file-name-wrap"> 192 <div class="chatbox__item-text chatbox__item-body-file-name-wrap">
216 <div class=""> 193 <div class="">
217 @if($it->original_file_name) 194 @if($it->original_file_name)
218 {{ $it->original_file_name }} 195 {{ $it->original_file_name }}
219 @else 196 @else
220 <svg> 197 <svg>
221 <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> 198 <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use>
222 </svg> 199 </svg>
223 @endif 200 @endif
224 </div> 201 </div>
225 <a href="{{ asset(Storage::url($it->file)) }}" class=""> 202 <a href="{{ asset(Storage::url($it->file)) }}" class="">
226 Скачать 203 Скачать
227 </a> 204 </a>
228 </div> 205 </div>
206 @else
207 <div class="chatbox__item-text">
208 <button class="button admin-chat-answer"
209 data-fancybox data-src="#answer_to_admin_chat_modal"
210 data-to-user-id="{{ $it->user_id }}" data-message-id="{{ $it->id }}">
211 Ответить
212 </button>
213 @if(\App\Models\Ad_employer::where('id', $it->ad_employer_id)->exists())
214 Отклик на вакансию {{ \App\Models\Ad_employer::find($it->ad_employer_id)->name }}
215 @if($it->text)
216 Комментарий: {{ $it->text }}
217 @endif
218 @else
219 @if($it->text)
220 {{ $it->text }}
221 @endif
222 @endif
223 </div>
229 @endif 224 @endif
230 </div> 225 </div>
231 <div class="chatbox__item-time">{{ $it->created_at }}</div> 226 <div class="chatbox__item-time">{{ $it->created_at }}</div>
232 </div> 227 </div>
233 @else 228 @else
234 <div class="chatbox__item chatbox__item_reverse"> 229 <div class="chatbox__item chatbox__item_reverse">
235 <div class="@if($sender->id!=$superAdmin->id) chatbox__item-photo @endif"> 230 <div class="@if($sender->id!=$superAdmin->id) chatbox__item-photo @endif">
236 @if ($sender->is_worker) 231 @if ($sender->is_worker)
237 @if ((isset($sender->workers[0]->photo)) && 232 @if ((isset($sender->workers[0]->photo)) &&
238 (!empty($sender->workers[0]->photo))) 233 (!empty($sender->workers[0]->photo)))
239 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($sender->workers[0]->photo)) }}" alt=""> 234 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($sender->workers[0]->photo)) }}" alt="">
240 @else 235 @else
241 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 236 <img src="{{ asset('images/default_man.jpg') }}" alt="">
242 @endif 237 @endif
243 @elseif($sender->id == $superAdmin->id) 238 @elseif($sender->id == $superAdmin->id)
244 @include('svg.logo_icon') 239 @include('svg.logo_icon')
245 @else 240 @else
246 <svg> 241 <svg>
247 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> 242 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
248 </svg> 243 </svg>
249 244
250 @if ((isset($sender->employers[0]->logo)) && 245 @if ((isset($sender->employers[0]->logo)) &&
251 (!empty($sender->employers[0]->logo))) 246 (!empty($sender->employers[0]->logo)))
252 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($sender->employers[0]->logo)) }}" alt=""> 247 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($sender->employers[0]->logo)) }}" alt="">
253 @else 248 @else
254 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 249 <img src="{{ asset('images/default_man.jpg') }}" alt="">
255 @endif 250 @endif
256 @endif 251 @endif
257 </div> 252 </div>
258 <div class="chatbox__item-body"> 253 <div class="chatbox__item-body">
259 @if($chat->is_admin_chat || $it->text || $it->reply_message_id || $it->ad_employer_id > 0) 254 @if($chat->is_admin_chat || $it->text || $it->reply_message_id || $it->ad_employer_id > 0)
260 <div class="chatbox__item-text"> 255 <div class="chatbox__item-text">
261 256
262 @if(\App\Models\Ad_employer::where('id', $it->ad_employer_id)->exists())) 257 @if(\App\Models\Ad_employer::where('id', $it->ad_employer_id)->exists()))
263 <b>Отклик на вакансию</b> "{{ \App\Models\Ad_employer::find($it->ad_employer_id)->name }}"<br> 258 <b>Отклик на вакансию</b> "{{ \App\Models\Ad_employer::find($it->ad_employer_id)->name }}"<br>
264 @if($it->text) 259 @if($it->text)
265 <b>Комментарий:</b> {{ $it->text }} 260 <b>Комментарий:</b> {{ $it->text }}
266 @endif 261 @endif
267 @else 262 @else
268 @if($it->text) 263 @if($it->text)
269 {{ $it->text }} 264 {{ $it->text }}
270 @endif 265 @endif
271 @endif 266 @endif
272 267
273 @if($it->reply_message_id) 268 @if($it->reply_message_id)
274 <div class="reply-message"> 269 <div class="reply-message">
275 {{ $it->reply_message->text }} 270 {{ $it->reply_message->text }}
276 </div> 271 </div>
277 @endif 272 @endif
278 </div> 273 </div>
279 @endif 274 @endif
280 @if ((isset($it->file)) && (!empty($it->file))) 275 @if ((isset($it->file)) && (!empty($it->file)))
281 <div class="chatbox__item-text chatbox__item-body-file-name-wrap"> 276 <div class="chatbox__item-text chatbox__item-body-file-name-wrap">
282 <a href="{{ asset(Storage::url($it->file)) }}" class=""> 277 <a href="{{ asset(Storage::url($it->file)) }}" class="">
283 Скачать 278 Скачать
284 </a> 279 </a>
285 <div class=""> 280 <div class="">
286 @if($it->original_file_name) 281 @if($it->original_file_name)
287 {{ $it->original_file_name }} 282 {{ $it->original_file_name }}
288 @else 283 @else
289 <svg> 284 <svg>
290 <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> 285 <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use>
291 </svg> 286 </svg>
292 @endif 287 @endif
293 </div> 288 </div>
294 </div> 289 </div>
295 @endif 290 @endif
296 </div> 291 </div>
297 <div class="chatbox__item-time">{{ $it->created_at }}</div> 292 <div class="chatbox__item-time">{{ $it->created_at }}</div>
298 </div> 293 </div>
299 @endif 294 @endif
300 295
301 @endforeach 296 @endforeach
302 @endif 297 @endif
303 </div> 298 </div>
304 <div> 299 <div>
305 <form action="{{ route('employer.test123') }}" class="chatbox__bottom" enctype="multipart/form-data" method="POST" > 300 <form action="{{ route('employer.test123') }}" class="chatbox__bottom" enctype="multipart/form-data" method="POST" >
306 @csrf 301 @csrf
307 <label class="chatbox__bottom-file"> 302 <label class="chatbox__bottom-file">
308 <input id="file" name="file" type="file" accept=".pdf, .doc, .docx"> 303 <input id="file" name="file" type="file" accept=".pdf, .doc, .docx">
309 <svg> 304 <svg>
310 <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> 305 <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use>
311 </svg> 306 </svg>
312 </label> 307 </label>
313 <input type="hidden" name="_token" value="{{ csrf_token() }}"/> 308 <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
314 <input type="hidden" id="user_id" name="user_id" value="{{ $sender->id }}"/> 309 <input type="hidden" id="user_id" name="user_id" value="{{ $sender->id }}"/>
315 <input type="hidden" id="to_user_id" name="to_user_id" value="{{ $companion->id }}"/> 310 <input type="hidden" id="to_user_id" name="to_user_id" value="{{ $companion->id }}"/>
316 <input type="hidden" id="ad_employer_id" name="ad_employer_id" value="{{ $ad_employer }}"/> 311 <input type="hidden" id="ad_employer_id" name="ad_employer_id" value="{{ $ad_employer }}"/>
317 <input type="hidden" id="ad_name" name="ad_name" value="@if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }} @endif"/> 312 <input type="hidden" id="ad_name" name="ad_name" value="@if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }} @endif"/>
318 <input id="text" name="text" type="text" class="input chatbox__bottom-text" placeholder="Ответить"> 313 <input id="text" name="text" type="text" class="input chatbox__bottom-text" placeholder="Ответить">