Blame view

resources/views/employers/messages.blade.php 11.4 KB
e3c7b0ffb   Андрей Ларионов   Коммит на понедел...
1
  @extends('layout.frontend', ['title' => 'Сообщения от пользователей - РекаМоре'])
e3c7b0ffb   Андрей Ларионов   Коммит на понедел...
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
  @section('scripts')
      <script>
          console.log('Test system');
          $(document).on('change', '#sort_ajax', function() {
              var this_ = $(this);
              var val_ = this_.val();
              console.log('sort items '+val_);
  
              $.ajax({
                  type: "GET",
                  url: "{{ route('shipping_companies') }}",
                  data: "sort="+val_+"&block=1",
                  success: function (data) {
                      console.log('Выбор сортировки');
                      console.log(data);
                      $('#block_1').html(data);
                  },
                  headers: {
                      'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                  },
                  error: function (data) {
                      data = JSON.stringify(data);
                      console.log('Error: ' + data);
                  }
              });
  
              $.ajax({
                  type: "GET",
                  url: "{{ route('shipping_companies') }}",
                  data: "sort="+val_+"&block=2",
                  success: function (data) {
                      console.log('Выбор сортировки2');
                      console.log(data);
                      history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif");
                      $('#block_2').html(data);
                  },
                  headers: {
                      'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                  },
                  error: function (data) {
                      data = JSON.stringify(data);
                      console.log('Error: ' + data);
                  }
              });
          });
      </script>
  @endsection
  
  @section('content')
      <section class="cabinet">
          <div class="container">
              <ul class="breadcrumbs cabinet__breadcrumbs">
                  <li><a href="{{ route('index') }}">Главная</a></li>
                  <li><b>Личный кабинет</b></li>
              </ul>
              <div class="cabinet__wrapper">
                  <div class="cabinet__side">
                      <div class="cabinet__side-toper">
                          @include('employers.emblema')
e3c7b0ffb   Андрей Ларионов   Коммит на понедел...
61
                      </div>
4ad4653cd   Андрей Ларионов   Обновление вторник
62

e3c7b0ffb   Андрей Ларионов   Коммит на понедел...
63
64
65
66
67
                      @include('employers.menu', ['item' => 5])
                  </div>
  
                  <div class="cabinet__body">
                      <div class="cabinet__body-item">
99a41e761   Андрей Ларионов   Личный кабинет по...
68
                          <h2 class="title cabinet__title">Сообщения</h2>
e3c7b0ffb   Андрей Ларионов   Коммит на понедел...
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
                      </div>
                      <div class="cabinet__body-item">
                          <div class="cabinet__filters">
                              <div class="cabinet__filters-item">
                                  <div class="cabinet__filters-buttons">
                                      <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="button button_light @if ($type_message == 'input') active @endif">Входящие ({{ $count_input }})</a>
                                      <a href="{{ route('employer.messages', ['type_message' => 'output']) }}" class="button button_light @if ($type_message == 'output') active @endif">Исходящие ({{ $count_output }})</a>
                                  </div>
                              </div>
                              <div class="cabinet__filters-item">
                                  <div class="select">
                                      <select class="js-select2" id="sort_ajax" name="sort_ajax">
                                          <option value="default">Сортировка (по умолчанию)</option>
                                          <option value="name (asc)">По имени (возрастание)</option>
                                          <option value="name (desc)">По имени (убывание)</option>
                                          <option value="created_at (asc)">По дате (возрастание)</option>
                                          <option value="created_at (desc)">По дате (убывание)</option>
                                      </select>
                                  </div>
                              </div>
                          </div>
                          <div class="messages">
                              <!--<button type="button" class="messages__button js-toggle js-parent-toggle button button_light button_more">
                                  <span>Показать ещё</span>
                                  <span>Скрыть</span>
                              </button>-->
                              <div class="messages__body">
                                  @if ($messages->count())
                                      @foreach($messages as $it)
                                          <div class="messages__item">
                                              <div class="messages__item-info">
                                                  <div class="messages__item-photo">
                                                      <svg>
                                                          <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
                                                      </svg>
  
                                                      @if ($type_message == 'input')
                                                          @if ($it->user_to->is_worker)
                                                              @if (isset($it->user_to->workers->phote))
                                                                  <img src="{{ asset(Storage::url($it->user_to->workers->phote)) }}" alt="">
                                                              @else
                                                                  <img src="{{ asset('images/default_man.jpg') }}" alt="">
                                                              @endif
                                                          @else
                                                              @if (isset($it->user_to->employers->logo))
                                                                  <img src="{{ asset(Storage::url($it->user_to->employers->logo)) }}" alt="">
                                                              @else
                                                                  <img src="{{ asset('images/default_man.jpg') }}" alt="">
                                                              @endif
                                                          @endif
                                                      @endif
  
                                                      @if ($type_message == 'output')
                                                          @if ($it->user_from->is_worker)
                                                              @if (isset($it->user_from->workers->phote))
                                                                  <img src="{{ asset(Storage::url($it->user_from->workers->phote)) }}" alt="">
                                                              @else
                                                                  <img src="{{ asset('images/default_man.jpg') }}" alt="">
                                                              @endif
                                                          @else
                                                              @if (isset($it->user_from->employers->logo))
                                                                  <img src="{{ asset(Storage::url($it->user_from->employers->logo)) }}" alt="">
                                                              @else
                                                                  <img src="{{ asset('images/default_man.jpg') }}" alt="">
                                                              @endif
                                                          @endif
                                                      @endif
                                                  </div>
                                                  <div class="messages__item-text">
                                                      <div>
                                                          От: @if (isset($it->user_from))
                                                                  @if ($it->user_from->id !== $user_id)
                                                                      <a href="{{ route('employer.dialog', ['user1' => $user_id, 'user2' => $it->user_from->id]) }}" style="text-decoration: underline">
                                                                          {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }}
                                                                      </a>
                                                                  @else
                                                                      {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }}
                                                                  @endif
                                                          @else
                                                              Удаленный пользователь
                                                          @endif
                                                          <br>
                                                          К: @if (isset($it->user_to))
                                                                  @if ($it->user_to->id !== $user_id)
                                                                      <a href="{{ route('employer.dialog', ['user1' => $user_id, 'user2' => $it->user_to->id]) }}" style="text-decoration: underline">
                                                                          {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }}
                                                                      </a>
                                                                  @else
                                                                      {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }}
                                                                  @endif
                                                             @else
                                                                Удаленный пользователь
                                                             @endif
                                                      </div>
                                                      <div><span>Вакансия:</span>@if (isset($it->vacancies[0])) {{ $it->vacancies[0]->name." (".($it->vacancies[0]->id).")" }} @else Удалена @endif</div>
                                                      <div><span>Текст:</span>{{ $it->text }}</div>
                                                  </div>
                                              </div>
                                              <div class="messages__item-date">{{ $it->created_at }}</div>
                                          </div>
                                      @endforeach
                                  @endif
                              </div>
                          </div>
                      </div>
                  </div>
              </div>
          </div>
      </section>
      </div>
  @endsection