Commit 57dadebaf039f22de2e5259fad6351a0ef008bf7

Authored by Андрей Ларионов
Exists in master

Merge branch 'master' of http://gitlab.nologostudio.ru/alarionov/rekamore-su

Showing 4 changed files Side-by-side Diff

app/Http/Controllers/Admin/UsersController.php
... ... @@ -27,6 +27,7 @@ class UsersController extends Controller
27 27 $request->offsetUnset('id');
28 28 $user->update($request->all());
29 29 }
  30 +
30 31 $find_key = "";
31 32 $users = User::query();
32 33 if (isset($request->find)) {
... ... @@ -34,6 +35,7 @@ class UsersController extends Controller
34 35 $users = $users->where('name', 'LIKE', "%$find_key%")
35 36 ->orWhere('email', 'LIKE', "%$find_key%");
36 37 }
  38 +
37 39 $users = $users->paginate(15);
38 40  
39 41 if ($request->ajax()) {
... ... @@ -17,6 +17,7 @@ class User extends Authenticatable
17 17 *
18 18 * @var array<int, string>
19 19 */
  20 +
20 21 protected $fillable = [
21 22 'name',
22 23 'email',
... ... @@ -40,6 +41,7 @@ class User extends Authenticatable
40 41 'birthday',
41 42 'file',
42 43 'pubpassword',
  44 + 'is_manager',
43 45 ];
44 46  
45 47 /**
resources/views/admin/users/index.blade.php
... ... @@ -7,6 +7,7 @@
7 7 var this_ = $(this);
8 8 var value = this_.val();
9 9 var field = this_.attr('data-field');
  10 + var value_id = this_.attr('data-id');
10 11 var ajax_block = $('#ajax_block');
11 12 var bool = 0;
12 13 var str_get = '';
... ... @@ -17,7 +18,7 @@
17 18 bool = 0;
18 19 }
19 20 console.log(field);
20   - str_get = "id=" + value + "&" + field + "=" + bool;
  21 + str_get = "id=" + value_id + "&" + field + "=" + bool;
21 22 console.log(str_get);
22 23  
23 24 $.ajax({
... ... @@ -58,9 +59,8 @@
58 59 <th class="px-4 py-3 text-xs">Имя</th>
59 60 <th class="px-4 py-3 text-xs">Email/логин</th>
60 61 <th class="px-4 py-3 text-xs">Работодатель/работник/администратор</th>
61   - @if ($id_admin == 1)
62 62 <th class="px-4 py-3 text-xs">Админ</th>
63   - @endif
  63 + <th class="px-4 py-3 text-xs">Менеджер</th>
64 64 <th class="px-4 py-3 text-xs">Дата регист.</th>
65 65 </tr>
66 66 </thead>
... ... @@ -96,13 +96,17 @@
96 96 @endif
97 97 </td>
98 98  
99   - @if ($id_admin == 1)
100   - <td class="px-4 py-3 text-xs">
101   - @if ($user->id > 1)
102   - <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="admin" name="admin_{{$user->id}}" {{ ($user->admin) ? "checked" : "" }}/>
103   - @endif
104   - </td>
105   - @endif
  99 + <td class="px-4 py-3 text-xs">
  100 + @if ($user->id > 1)
  101 + <input type="checkbox" class="check_click" data-id="{{$user->id}}" data-field="admin" name="admin_{{$user->id}}" {{ ($user->admin) ? "checked" : "" }}/>
  102 + @endif
  103 + </td>
  104 +
  105 + <td class="px-4 py-3 text-xs">
  106 + @if ($user->id > 1)
  107 + <input type="checkbox" class="check_click" data-id="{{$user->id}}" data-field="is_manager" name="manager_{{$user->id}}" {{ ($user->is_manager) ? "checked" : "" }}/>
  108 + @endif
  109 + </td>
106 110  
107 111 <td class="px-4 py-3 text-xs">
108 112 {{ date('d.m.Y', strtotime($user->created_at)) }}
... ... @@ -114,8 +118,7 @@
114 118 </div>
115 119  
116 120 <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">
117   - <?//=$users->appends($_GET)->links('admin.pagginate'); ?>
118   - <?=$users->links('admin.pagginate'); ?>
  121 + {{ $users->links('admin.pagginate') }}
119 122 </div>
120 123  
121 124  
resources/views/admin/users/index_ajax.blade.php
... ... @@ -8,9 +8,8 @@
8 8 <th class="px-4 py-3 text-xs">Имя</th>
9 9 <th class="px-4 py-3 text-xs">Email/логин</th>
10 10 <th class="px-4 py-3 text-xs">Работодатель/работник/администратор</th>
11   - @if ($id_admin == 1)
12   - <th class="px-4 py-3 text-xs">Админ</th>
13   - @endif
  11 + <th class="px-4 py-3 text-xs">Админ</th>
  12 + <th class="px-4 py-3 text-xs">Менеджер</th>
14 13 <th class="px-4 py-3 text-xs">Дата регист.</th>
15 14 </tr>
16 15 </thead>
... ... @@ -46,13 +45,17 @@
46 45 @endif
47 46 </td>
48 47  
49   - @if ($id_admin == 1)
50   - <td class="px-4 py-3 text-xs">
51   - @if ($user->id > 1)
52   - <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="admin" name="admin_{{$user->id}}" {{ ($user->admin) ? "checked" : "" }}/>
53   - @endif
54   - </td>
55   - @endif
  48 + <td class="px-4 py-3 text-xs">
  49 + @if ($user->id > 1)
  50 + <input type="checkbox" class="check_click" data-id="{{$user->id}}" data-field="admin" name="admin_{{$user->id}}" {{ ($user->admin) ? "checked" : "" }}/>
  51 + @endif
  52 + </td>
  53 +
  54 + <td class="px-4 py-3 text-xs">
  55 + @if ($user->id > 1)
  56 + <input type="checkbox" class="check_click" data-id="{{$user->id}}" data-field="is_manager" name="manager_{{$user->id}}" {{ ($user->is_manager) ? "checked" : "" }}/>
  57 + @endif
  58 + </td>
56 59  
57 60 <td class="px-4 py-3 text-xs">
58 61 {{ date('d.m.Y', strtotime($user->created_at)) }}
... ... @@ -64,6 +67,5 @@
64 67 </div>
65 68  
66 69 <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">
67   - <?//=$users->appends($_GET)->links('admin.pagginate'); ?>
68   - <?=$users->links('admin.pagginate'); ?>
  70 + {{ $users->links('admin.pagginate') }}
69 71 </div>