Commit 4a58df1ed3ac5d4de6297a2fed64ebd1de851ba0

Authored by Сергей П
1 parent f98ccb92ca
Exists in master

правки

Showing 1 changed file with 3 additions and 3 deletions Inline Diff

resources/views/admin/message/index.blade.php
1 @extends('layout.admin', ['title' => 'Админка - Сообщения адмистратора']) 1 @extends('layout.admin', ['title' => 'Админка - Сообщения адмистратора'])
2 2
3 @section('script') 3 @section('script')
4 <script> 4 <script>
5 $(document).ready(function() { 5 $(document).ready(function() {
6 $('.rejecte-button').click(function(){ 6 $('.rejecte-button').click(function(){
7 var this_btn = $(this); 7 var this_btn = $(this);
8 var wrap = this_btn.closest('tr'); 8 var wrap = this_btn.closest('tr');
9 var message_id = wrap.data('message-id'); 9 var message_id = wrap.data('message-id');
10 var target = wrap.find('.user-name').text(); 10 var target = wrap.find('.user-name').text();
11 11
12 $('#rejecte_message').data('message-id', message_id); 12 $('#rejecte_message').data('message-id', message_id);
13 $('#rejecte_message').find('.user-name').text(target.trim()); 13 $('#rejecte_message').find('.user-name').text(target.trim());
14 $('#rejecte_message').find('.message-id').text(message_id); 14 $('#rejecte_message').find('.message-id').text(message_id);
15 }); 15 });
16 16
17 $('.send-button').click(function(){cl(1000); 17 $('.send-button').click(function(){cl(1000);
18 var this_btn = $(this); 18 var this_btn = $(this);
19 var wrap = this_btn.closest('tr'); 19 var wrap = this_btn.closest('tr');
20 var message_id = wrap.data('message-id'); 20 var message_id = wrap.data('message-id');
21 var target = wrap.find('.user-name').text(); 21 var target = wrap.find('.user-name').text();
22 22
23 $('#send_message').data('message-id', message_id); 23 $('#send_message').data('message-id', message_id);
24 $('#send_message').find('.user-name').text(target.trim()); 24 $('#send_message').find('.user-name').text(target.trim());
25 $('#send_message').find('.message-id').text(message_id); 25 $('#send_message').find('.message-id').text(message_id);
26 }); 26 });
27 27
28 $(document).on('change', '.checkread', function () { 28 $(document).on('change', '.checkread', function () {
29 var this_ = $(this); 29 var this_ = $(this);
30 var value = this_.val(); 30 var value = this_.val();
31 var ajax_block = $('#ajax_block'); 31 var ajax_block = $('#ajax_block');
32 var bool = 0; 32 var bool = 0;
33 33
34 if(this.checked){ 34 if(this.checked){
35 bool = 1; 35 bool = 1;
36 } else { 36 } else {
37 bool = 0; 37 bool = 0;
38 } 38 }
39 39
40 $.ajax({ 40 $.ajax({
41 type: "GET", 41 type: "GET",
42 url: "{{ url()->full()}}", 42 url: "{{ url()->full()}}",
43 data: "id=" + value + "&flag_new=" + bool, 43 data: "id=" + value + "&flag_new=" + bool,
44 success: function (data) { 44 success: function (data) {
45 console.log('Обновление таблицы сообщений администратора '); 45 console.log('Обновление таблицы сообщений администратора ');
46 //data = JSON.parse(data); 46 //data = JSON.parse(data);
47 //console.log(data); 47 //console.log(data);
48 ajax_block.html(data); 48 ajax_block.html(data);
49 }, 49 },
50 headers: { 50 headers: {
51 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 51 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
52 }, 52 },
53 error: function (data) { 53 error: function (data) {
54 console.log('Error: ' + data); 54 console.log('Error: ' + data);
55 } 55 }
56 }); 56 });
57 }); 57 });
58 58
59 }); 59 });
60 </script> 60 </script>
61 @endsection 61 @endsection
62 62
63 @section('content') 63 @section('content')
64 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> 64 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
65 <div class="w-full overflow-x-auto"> 65 <div class="w-full overflow-x-auto">
66 <table class="w-full whitespace-no-wrap"> 66 <table class="w-full">
67 <thead> 67 <thead>
68 <tr 68 <tr
69 class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800" 69 class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800"
70 > 70 >
71 <th class="px-4 py-3">№</th> 71 <th class="px-4 py-3">№</th>
72 <th class="px-4 py-3">От юзера</th> 72 <th class="px-4 py-3">От юзера</th>
73 <th class="px-4 py-3">Должности</th> 73 <th class="px-4 py-3">Должности</th>
74 <th class="px-4 py-3">Текст</th> 74 <th class="px-4 py-3">Текст</th>
75 <th class="px-4 py-3">Дата</th> 75 <th class="px-4 py-3">Дата</th>
76 <th class="px-4 py-3">Прочтено</th> 76 <th class="px-4 py-3"></th>
77 </tr> 77 </tr>
78 </thead> 78 </thead>
79 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> 79 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
80 @foreach($Msgs as $msg) 80 @foreach($Msgs as $msg)
81 <tr class="text-gray-700 dark:text-gray-400" data-message-id="{{ $msg->id }}"> 81 <tr class="text-gray-700 dark:text-gray-400" data-message-id="{{ $msg->id }}">
82 <td class="px-4 py-3"> 82 <td class="px-4 py-3">
83 {{ $msg->id }} 83 {{ $msg->id }}
84 </td> 84 </td>
85 <td class="px-4 py-3"> 85 <td class="px-4 py-3">
86 <div class="user-name"> 86 <div class="user-name">
87 @if (isset($msg->user->name)) 87 @if (isset($msg->user->name))
88 {{$msg->user->name}} ({{$msg->user->id}}) 88 {{$msg->user->name}} ({{$msg->user->id}})
89 @else 89 @else
90 Пользователь удален 90 Пользователь удален
91 @endif 91 @endif
92 </div> 92 </div>
93 </td> 93 </td>
94 <td class="px-4 py-3"> 94 <td class="px-4 py-3">
95 @if($msg->job_titles) 95 @if($msg->job_titles)
96 @foreach($msg->jobs as $job) 96 @foreach($msg->jobs as $job)
97 {{ $job->name }} 97 {{ $job->name }}
98 @if(!$loop->last) 98 @if(!$loop->last)
99 <br> 99 <br>
100 @endif 100 @endif
101 @endforeach 101 @endforeach
102 @endif 102 @endif
103 </td> 103 </td>
104 <td class="px-4 py-3"> 104 <td class="px-4 py-3">
105 <div> 105 <div>
106 {{ $msg->text }} 106 {{ $msg->text }}
107 </div> 107 </div>
108 </td> 108 </td>
109 <td class="px-4 py-3 text-sm"> 109 <td class="px-4 py-3 text-sm">
110 {{ date('d.m.Y h:i:s', strtotime($msg->created_at)) }} 110 {{ date('d.m.Y h:i:s', strtotime($msg->created_at)) }}
111 </td> 111 </td>
112 <td class="px-4 py-3"> 112 <td class="px-4 py-3">
113 @if($msg->is_rejected) 113 @if($msg->is_rejected)
114 Отклонено 114 Отклонено
115 @elseif($msg->is_sent) 115 @elseif($msg->is_sent)
116 Отправлено 116 Отправлено
117 @else 117 @else
118 <div class=""> 118 <div class="">
119 <button class="rejecte-button px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-red-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple" 119 <button class="rejecte-button mb-10 px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-red-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"
120 data-fancybox data-src="#rejecte_message" 120 data-fancybox data-src="#rejecte_message"
121 > 121 >
122 Отклонить 122 Отклонить
123 </button> 123 </button>
124 <button class="send-button px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-green-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple" 124 <button class="send-button px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-green-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"
125 data-fancybox data-src="#send_message" 125 data-fancybox data-src="#send_message"
126 > 126 >
127 Отправить 127 Отправить
128 </button> 128 </button>
129 </div> 129 </div>
130 @endif 130 @endif
131 </td> 131 </td>
132 </tr> 132 </tr>
133 @endforeach 133 @endforeach
134 </tbody> 134 </tbody>
135 </table> 135 </table>
136 </div> 136 </div>
137 137
138 <div class="grid px-4 py-3 text-xs font-semibold tracking-wide text-gray-500 uppercase border-t dark:border-gray-700 bg-gray-50 sm:grid-cols-9 dark:text-gray-400 dark:bg-gray-800"> 138 <div class="grid px-4 py-3 text-xs font-semibold tracking-wide text-gray-500 uppercase border-t dark:border-gray-700 bg-gray-50 sm:grid-cols-9 dark:text-gray-400 dark:bg-gray-800">
139 <?=$Msgs->appends($_GET)->links('admin.pagginate'); ?> 139 <?=$Msgs->appends($_GET)->links('admin.pagginate'); ?>
140 </div> 140 </div>
141 </div><br> 141 </div><br>
142 142
143 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block2"> 143 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block2">
144 144
145 <form method="POST" action="{{ route('admin.admin-messages-post') }}" enctype="multipart/form-data"> 145 <form method="POST" action="{{ route('admin.admin-messages-post') }}" enctype="multipart/form-data">
146 @csrf 146 @csrf
147 <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"> 147 <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
148 <h3 class="text-gray-700 dark:text-gray-400">Отправка сообщения</h3> 148 <h3 class="text-gray-700 dark:text-gray-400">Отправка сообщения</h3>
149 <hr> 149 <hr>
150 <label for="ad_employer_id" class="block text-sm"> 150 <label for="ad_employer_id" class="block text-sm">
151 <input type="hidden" name="user_id" id="user_id" value="{{ $id_admin }}"/> 151 <input type="hidden" name="user_id" id="user_id" value="{{ $id_admin }}"/>
152 152
153 <span class="text-gray-700 dark:text-gray-400">Кому:</span> 153 <span class="text-gray-700 dark:text-gray-400">Кому:</span>
154 154
155 <select name="to_user_id" id="to_user_id" class="block change_js mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-select focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray"> 155 <select name="to_user_id" id="to_user_id" class="block change_js mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-select focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray">
156 @foreach($users as $user) 156 @foreach($users as $user)
157 <option value="{{ $user->id }}">{{ $user->name }} ({{ $user->id }})</option> 157 <option value="{{ $user->id }}">{{ $user->name }} ({{ $user->id }})</option>
158 @endforeach 158 @endforeach
159 </select> 159 </select>
160 </label><br> 160 </label><br>
161 161
162 <label class="block text-sm"> 162 <label class="block text-sm">
163 <span class="text-gray-700 dark:text-gray-400">Заголовок</span> 163 <span class="text-gray-700 dark:text-gray-400">Заголовок</span>
164 <input name="title" id="title" 164 <input name="title" id="title"
165 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" 165 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
166 placeholder="Заголовок" value="{{ old('title') ?? '' }}" 166 placeholder="Заголовок" value="{{ old('title') ?? '' }}"
167 /> 167 />
168 @error('title') 168 @error('title')
169 <span class="text-xs text-red-600 dark:text-red-400"> 169 <span class="text-xs text-red-600 dark:text-red-400">
170 {{ $message }} 170 {{ $message }}
171 </span> 171 </span>
172 @enderror 172 @enderror
173 </label><br> 173 </label><br>
174 174
175 <label class="block text-sm"> 175 <label class="block text-sm">
176 <span class="text-gray-700 dark:text-gray-400">Текст</span> 176 <span class="text-gray-700 dark:text-gray-400">Текст</span>
177 <textarea class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray" name="text" placeholder="Текст" required 177 <textarea class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray" name="text" placeholder="Текст" required
178 rows="4">{{ old('text') ?? '' }}</textarea> 178 rows="4">{{ old('text') ?? '' }}</textarea>
179 @error('text') 179 @error('text')
180 <span class="text-xs text-red-600 dark:text-red-400"> 180 <span class="text-xs text-red-600 dark:text-red-400">
181 {{ $message }} 181 {{ $message }}
182 </span> 182 </span>
183 @enderror 183 @enderror
184 </label><br> 184 </label><br>
185 185
186 186
187 <label class="block text-sm"> 187 <label class="block text-sm">
188 <span class="text-gray-700 dark:text-gray-400">Файл</span> 188 <span class="text-gray-700 dark:text-gray-400">Файл</span>
189 <input type="file" class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 189 <input type="file" class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700
190 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple 190 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple
191 dark:text-gray-300 dark:focus:shadow-outline-gray form-input" 191 dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
192 id="file" name="file"> 192 id="file" name="file">
193 @error('file') 193 @error('file')
194 <span class="text-xs text-red-600 dark:text-red-400"> 194 <span class="text-xs text-red-600 dark:text-red-400">
195 {{ $message }} 195 {{ $message }}
196 </span> 196 </span>
197 @enderror 197 @enderror
198 </label><br> 198 </label><br>
199 199
200 <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4"> 200 <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
201 <div> 201 <div>
202 <button type="submit" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"> 202 <button type="submit" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">
203 Отправить 203 Отправить
204 </button> 204 </button>
205 </div> 205 </div>
206 </div> 206 </div>
207 </div> 207 </div>
208 </form> 208 </form>
209 </div> 209 </div>
210 210
211 @include('modals.admin.messages.rejecte_message') 211 @include('modals.admin.messages.rejecte_message')
212 @include('modals.admin.messages.send_message') 212 @include('modals.admin.messages.send_message')
213 @endsection 213 @endsection
214 214