Commit d6d0f4b3a0dc960cd5b0053e689591fc1b59212a

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

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

X

Showing 10 changed files Side-by-side Diff

app/Http/Controllers/Admin/AdminController.php
... ... @@ -155,13 +155,21 @@ class AdminController extends Controller
155 155 $request->offsetUnset('id');
156 156 $user->update($request->all());
157 157 }
158   -
159   - $users = User::where('admin', '1')->paginate(15);
  158 + $find_key = '';
  159 + $users = User::where('admin', '1');
  160 + if (isset($request->find)) {
  161 + $find_key = $request->find;
  162 + $users = $users->where(function($query) use($find_key) {
  163 + $query->Where('name', 'LIKE', "%$find_key%")
  164 + ->orWhere('email', 'LIKE', "%$find_key%");
  165 + });
  166 + }
  167 + $users = $users->paginate(15);
160 168  
161 169 if ($request->ajax()) {
162 170 return view('admin.users.index_ajax', compact('users', 'id_admin'));
163 171 } else {
164   - return view('admin.users.index', compact('users', 'title', 'id_admin'));
  172 + return view('admin.users.index', compact('users', 'title', 'id_admin', 'find_key'));
165 173 }
166 174 }
167 175  
app/Http/Controllers/Admin/EmployersController.php
... ... @@ -9,6 +9,7 @@ use App\Models\Employer;
9 9 use App\Models\Static_ad;
10 10 use App\Models\User;
11 11 use Illuminate\Http\Request;
  12 +use Illuminate\Support\Facades\DB;
12 13 use Illuminate\Support\Facades\Storage;
13 14 use Illuminate\Support\Facades\Validator;
14 15  
... ... @@ -21,7 +22,7 @@ class EmployersController extends Controller
21 22 $user->update($request->all());
22 23 }
23 24  
24   - $users = User::where('is_worker', '0');
  25 + /*$users = User::with('employers')->where('is_worker', '0');
25 26 $find_key = "";
26 27 if (isset($request->find)) {
27 28 $find_key = $request->find;
... ... @@ -30,8 +31,23 @@ class EmployersController extends Controller
30 31 ->orWhere('email', 'LIKE', "%$find_key%")
31 32 ->orWhere('telephone', 'LIKE', "%$find_key%");
32 33 });
  34 + }*/
  35 +
  36 + $users = User::select(['users.*', 'emp.id as emp_id', 'emp.*'])->join('employers as emp','emp.user_id','users.id')
  37 + ->where('users.is_worker', '0');
  38 + $find_key = "";
  39 + if (isset($request->find)) {
  40 + $find_key = $request->find;
  41 + $users = $users->where(function($query) use($find_key) {
  42 + $query->Where('users.name', 'LIKE', "%$find_key%")
  43 + ->orWhere('emp.email', 'LIKE', "%$find_key%")
  44 + ->orWhere('emp.telephone', 'LIKE', "%$find_key%");
  45 + });
33 46 }
  47 +
  48 + //DB::enableQueryLog();
34 49 $users = $users->paginate(15);
  50 + //dd(DB::getQueryLog());
35 51  
36 52 if ($request->ajax()) {
37 53 return view('admin.employer.index_ajax', compact('users'));
... ... @@ -52,6 +68,10 @@ class EmployersController extends Controller
52 68 unset($params['email']);
53 69 unset($params['address']);
54 70 unset($params['site']);
  71 + unset($params['status_hidden']);
  72 + unset($params['oficial_status']);
  73 + unset($params['social_is']);
  74 + unset($params['sending_is']);
55 75  
56 76 $rules = [
57 77 'name' => 'required|string|max:255',
... ... @@ -85,6 +105,10 @@ class EmployersController extends Controller
85 105 $employer->address = $request->address;
86 106 $employer->site = $request->site;
87 107 $employer->text = $request->text;
  108 + $employer->status_hidden = $request->status_hidden;
  109 + $employer->oficial_status = $request->oficial_status;
  110 + $employer->social_is = $request->social_is;
  111 + $employer->sending_is = $request->sending_is;
88 112  
89 113 if ($request->has('logo')) {
90 114 if (!empty($employer->logo)) {
app/Http/Controllers/Admin/MsgAnswersController.php
... ... @@ -19,6 +19,12 @@ class MsgAnswersController extends Controller
19 19 }
20 20  
21 21 public function admin_messages(Request $request) {
  22 + if ($request->ajax()) {
  23 + $msg = Message::find($request->id);
  24 + $msg->flag_new = !($request->flag_new);
  25 + $msg->save();
  26 + }
  27 +
22 28 $id_admin = Auth::user()->id;
23 29 $users = User::query()->OrderBy('name')->get();
24 30  
... ... @@ -26,7 +32,10 @@ class MsgAnswersController extends Controller
26 32 ->orWhere('to_user_id', '=', $id_admin)
27 33 ->orderByDesc('created_at')->paginate(5);
28 34  
29   - return view('admin.message.index', compact('Msgs', 'id_admin', 'users'));
  35 + if ($request->ajax())
  36 + return view('admin.message.index_ajax', compact('Msgs', 'id_admin', 'users'));
  37 + else
  38 + return view('admin.message.index', compact('Msgs', 'id_admin', 'users'));
30 39 }
31 40  
32 41 public function messages_sql(Request $request) {
app/Providers/MyServiceProvider.php
... ... @@ -3,6 +3,8 @@
3 3 namespace App\Providers;
4 4  
5 5 use App\Models\Job_title;
  6 +use Illuminate\Support\Facades\Auth;
  7 +use Illuminate\Support\Facades\DB;
6 8 use Illuminate\Support\Facades\View;
7 9 use Illuminate\Support\ServiceProvider;
8 10  
... ... @@ -45,5 +47,20 @@ class MyServiceProvider extends ServiceProvider
45 47  
46 48 }
47 49 );
  50 +
  51 + $views2 = ['layout.admin'];
  52 +
  53 + View::composer($views2,
  54 + function($view){
  55 + $id = Auth::user()->id;
  56 + $query = DB::select(DB::raw('SELECT count(*) as MsgCount
  57 + FROM messages m1
  58 + Where ((m1.flag_new = 1) and (m1.to_user_id = :uid))
  59 + '), ['uid' => $id]
  60 + );
  61 +
  62 + $view->with(['MsgCount' => $query[0]->MsgCount]);
  63 + }
  64 + );
48 65 }
49 66 }
public/assets/css/tabs.css
... ... @@ -0,0 +1,47 @@
  1 +.tabs {
  2 + font-size: 0;
  3 +}
  4 +
  5 +.tabs>input[type="radio"] {
  6 + display: none;
  7 +}
  8 +
  9 +.tabs>div {
  10 + /* скрыть контент по умолчанию */
  11 + display: none;
  12 + border: 1px solid #e0e0e0;
  13 + padding: 10px 15px;
  14 + font-size: 16px;
  15 +}
  16 +
  17 +/* отобразить контент, связанный с вабранной радиокнопкой (input type="radio") */
  18 +#tab-btn-1:checked~#content-1,
  19 +#tab-btn-2:checked~#content-2,
  20 +#tab-btn-3:checked~#content-3 {
  21 + display: block;
  22 +}
  23 +
  24 +.tabs>label {
  25 + display: inline-block;
  26 + text-align: center;
  27 + vertical-align: middle;
  28 + user-select: none;
  29 + background-color: #f5f5f5;
  30 + border: 1px solid #e0e0e0;
  31 + padding: 2px 8px;
  32 + font-size: 16px;
  33 + line-height: 1.5;
  34 + transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out;
  35 + cursor: pointer;
  36 + position: relative;
  37 + top: 1px;
  38 +}
  39 +
  40 +.tabs>label:not(:first-of-type) {
  41 + border-left: none;
  42 +}
  43 +
  44 +.tabs>input[type="radio"]:checked+label {
  45 + background-color: #fff;
  46 + border-bottom: 1px solid #fff;
  47 +}
resources/views/admin/employer/edit.blade.php
... ... @@ -5,143 +5,195 @@
5 5 Работодатель-пользователь: "{{$employer->users->name_man}} ({{$employer->user_id}})"
6 6 </h4>
7 7 <form method="POST" action="" enctype="multipart/form-data">
8   - @csrf
9 8 <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
10   - <label class="block text-sm">
11   - <span class="text-gray-700 dark:text-gray-400">Имя компании</span>
12   - <input name="name" id="name"
13   - 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"
14   - placeholder="Имя компании" value="{{ old('name') ?? $employer->users->name ?? '' }}"
15   - />
16   - @error('name')
17   - <span class="text-xs text-red-600 dark:text-red-400">
18   - {{ $message }}
19   - </span>
20   - @enderror
21   - </label><br>
  9 + @csrf
  10 + <div class="tabs">
  11 + <input type="radio" name="tab-btn" id="tab-btn-1" value="" checked>
  12 + <label for="tab-btn-1">Персональная информация</label>
  13 + <input type="radio" name="tab-btn" id="tab-btn-2" value="">
  14 + <label for="tab-btn-2">Настройки</label>
  15 + <!--<input type="radio" name="tab-btn" id="tab-btn-3" value="">
  16 + <label for="tab-btn-3">Вкладка 3</label>-->
  17 + <div id="content-1">
  18 +
  19 + <label class="block text-sm">
  20 + <span class="text-gray-700 dark:text-gray-400">Имя компании</span>
  21 + <input name="name" id="name"
  22 + 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"
  23 + placeholder="Имя компании" value="{{ old('name') ?? $employer->users->name ?? '' }}"
  24 + />
  25 + @error('name')
  26 + <span class="text-xs text-red-600 dark:text-red-400">
  27 + {{ $message }}
  28 + </span>
  29 + @enderror
  30 + </label><br>
22 31  
23   - <label class="block text-sm">
24   - <span class="text-gray-700 dark:text-gray-400">Email</span>
25   - <input name="email" id="email"
  32 + <label class="block text-sm">
  33 + <span class="text-gray-700 dark:text-gray-400">Email</span>
  34 + <input name="email" id="email"
26 35 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"
27 36 placeholder="Почта" value="{{ old('email') ?? $employer->email ?? '' }}"
28   - />
29   - @error('email')
30   - <span class="text-xs text-red-600 dark:text-red-400">
31   - {{ $message }}
32   - </span>
33   - @enderror
34   - </label><br>
  37 + />
  38 + @error('email')
  39 + <span class="text-xs text-red-600 dark:text-red-400">
  40 + {{ $message }}
  41 + </span>
  42 + @enderror
  43 + </label><br>
35 44  
36   - <label class="block text-sm">
37   - <span class="text-gray-700 dark:text-gray-400">Телефон</span>
38   - <input name="telephone" id="telephone"
39   - 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"
40   - placeholder="Телефон" value="{{ old('telephone') ?? $employer->telephone ?? '' }}"
41   - />
42   - @error('telephone')
43   - <span class="text-xs text-red-600 dark:text-red-400">
44   - {{ $message }}
45   - </span>
46   - @enderror
47   - </label><br>
  45 + <label class="block text-sm">
  46 + <span class="text-gray-700 dark:text-gray-400">Телефон</span>
  47 + <input name="telephone" id="telephone"
  48 + 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"
  49 + placeholder="Телефон" value="{{ old('telephone') ?? $employer->telephone ?? '' }}"
  50 + />
  51 + @error('telephone')
  52 + <span class="text-xs text-red-600 dark:text-red-400">
  53 + {{ $message }}
  54 + </span>
  55 + @enderror
  56 + </label><br>
48 57  
49   - <label class="block text-sm">
50   - <span class="text-gray-700 dark:text-gray-400">Адрес</span>
51   - <input name="address" id="address"
52   - 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"
53   - placeholder="Адрес" value="{{ old('address') ?? $employer->address ?? '' }}"
54   - />
55   - @error('address')
56   - <span class="text-xs text-red-600 dark:text-red-400">
57   - {{ $message }}
58   - </span>
59   - @enderror
60   - </label><br>
  58 + <label class="block text-sm">
  59 + <span class="text-gray-700 dark:text-gray-400">Адрес</span>
  60 + <input name="address" id="address"
  61 + 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"
  62 + placeholder="Адрес" value="{{ old('address') ?? $employer->address ?? '' }}"
  63 + />
  64 + @error('address')
  65 + <span class="text-xs text-red-600 dark:text-red-400">
  66 + {{ $message }}
  67 + </span>
  68 + @enderror
  69 + </label><br>
61 70  
62   - <label class="block text-sm">
63   - <span class="text-gray-700 dark:text-gray-400">Сайт</span>
64   - <input name="site" id="site"
65   - 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"
66   - placeholder="Сайт" value="{{ old('site') ?? $employer->site ?? '' }}"
67   - />
68   - @error('site')
69   - <span class="text-xs text-red-600 dark:text-red-400">
70   - {{ $message }}
71   - </span>
72   - @enderror
73   - </label><br>
  71 + <label class="block text-sm">
  72 + <span class="text-gray-700 dark:text-gray-400">Сайт</span>
  73 + <input name="site" id="site"
  74 + 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"
  75 + placeholder="Сайт" value="{{ old('site') ?? $employer->site ?? '' }}"
  76 + />
  77 + @error('site')
  78 + <span class="text-xs text-red-600 dark:text-red-400">
  79 + {{ $message }}
  80 + </span>
  81 + @enderror
  82 + </label><br>
74 83  
75   - <label class="block text-sm">
76   - <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">
77   - Права работодателя:
78   - </h4>
79   - <p style="float:left; margin-right: 10px">Просмотр базы резюме </p>
80   - <input type="hidden" name="is_lookin" value="0" />
81   - <input name="is_lookin" <? if ($employer->users->is_lookin) echo "checked";?>
82   - class="block 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 "
83   - placeholder="" type="checkbox" value="1"
84   - /><br>
  84 + <label class="block text-sm">
  85 + <span class="text-gray-700 dark:text-gray-400">Лого</span>
85 86  
86   - <p style="float:left; margin-right: 10px">Отправка сообщений</p>
87   - <input type="hidden" name="is_message" value="0" />
88   - <input name="is_message" id="is_message" <? if ($employer->users->is_message) echo "checked";?>
89   - class="block 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 "
90   - placeholder="" type="checkbox" value="1"
91   - /><br>
  87 + <input name="logo" id="logo" type="file"
  88 + 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"
  89 + placeholder="Лого" value=""
  90 + />
  91 + @isset($employer->logo)
  92 + <img src="<?=asset(Storage::url($employer->logo))?>" width="150"/>
  93 + @endisset
  94 + @error('logo')
  95 + <span class="text-xs text-red-600 dark:text-red-400">
  96 + {{ $message }}
  97 + </span>
  98 + @enderror
  99 + </label><br>
92 100  
93   - <p style="float:left; margin-right: 10px">Публикация вакансий</p>
94   - <input type="hidden" name="is_public" value="0" />
95   - <input name="is_public" id="is_public" <? if ($employer->users->is_public) echo "checked";?>
96   - class="block 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 "
97   - placeholder="" type="checkbox" value="1"
98   - /><br>
  101 + <label class="block mt-4 text-sm">
  102 + <span class="text-gray-700 dark:text-gray-400">Описание</span>
  103 + <textarea name="text" id="text"
  104 + 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"
  105 + rows="3"
  106 + placeholder="Описание компании"
  107 + >{{ old('text') ?? $employer->text ?? '' }}</textarea>
  108 + </label>
99 109  
100   - </label>
  110 + </div>
  111 + <div id="content-2">
  112 + <label class="block text-sm">
  113 + <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">
  114 + Права работодателя:
  115 + </h4>
  116 + <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Просмотр базы резюме </p>
  117 + <input type="hidden" name="is_lookin" value="0" />
  118 + <input name="is_lookin" <? if ($employer->users->is_lookin) echo "checked";?>
  119 + class="block 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 "
  120 + placeholder="" type="checkbox" value="1"
  121 + /><br>
101 122  
102   - <label class="block text-sm">
103   - <span class="text-gray-700 dark:text-gray-400">Лого</span>
  123 + <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Отправка сообщений</p>
  124 + <input type="hidden" name="is_message" value="0" />
  125 + <input name="is_message" id="is_message" <? if ($employer->users->is_message) echo "checked";?>
  126 + class="block 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 "
  127 + placeholder="" type="checkbox" value="1"
  128 + /><br>
104 129  
105   - <input name="logo" id="logo" type="file"
106   - 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"
107   - placeholder="Лого" value=""
108   - />
109   - @isset($employer->logo)
110   - <img src="<?=asset(Storage::url($employer->logo))?>" width="150"/>
111   - @endisset
112   - @error('logo')
113   - <span class="text-xs text-red-600 dark:text-red-400">
114   - {{ $message }}
115   - </span>
116   - @enderror
117   - </label><br>
  130 + <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Публикация вакансий</p>
  131 + <input type="hidden" name="is_public" value="0" />
  132 + <input name="is_public" id="is_public" <? if ($employer->users->is_public) echo "checked";?>
  133 + class="block 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 "
  134 + placeholder="" type="checkbox" value="1"
  135 + /><br>
  136 +
  137 + </label>
  138 +
  139 + <label class="block text-sm">
  140 + <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Работодатель скрыт </p>
  141 + <input type="hidden" name="status_hidden" value="0" />
  142 + <input name="status_hidden" <? if ($employer->status_hidden) echo "checked";?>
  143 + class="block 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 "
  144 + placeholder="" type="checkbox" value="1"
  145 + />
  146 + </label><br>
  147 +
  148 + <label class="block text-sm">
  149 + <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Компания подтверждена </p>
  150 + <input type="hidden" name="oficial_status" value="0" />
  151 + <input name="oficial_status" <? if ($employer->oficial_status) echo "checked";?>
  152 + class="block 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 "
  153 + placeholder="" type="checkbox" value="1"
  154 + />
  155 + </label><br>
118 156  
119   - <label class="block mt-4 text-sm">
120   - <span class="text-gray-700 dark:text-gray-400">Описание</span>
121   - <textarea name="text" id="text"
122   - 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"
123   - rows="3"
124   - placeholder="Описание компании"
125   - >{{ old('text') ?? $employer->text ?? '' }}</textarea>
126   - </label>
  157 + <label class="block text-sm">
  158 + <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Разрешение публикации в соц.сетях </p>
  159 + <input type="hidden" name="social_is" value="0" />
  160 + <input name="social_is" <? if ($employer->social_is) echo "checked";?>
  161 + class="block 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 "
  162 + placeholder="" type="checkbox" value="1"
  163 + />
  164 + </label><br>
127 165  
  166 + <label class="block text-sm">
  167 + <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Рассылка </p>
  168 + <input type="hidden" name="sending_is" value="0" />
  169 + <input name="sending_is" <? if ($employer->sending_is) echo "checked";?>
  170 + class="block 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 "
  171 + placeholder="" type="checkbox" value="1"
  172 + />
  173 + </label><br>
128 174  
129   - <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
130   - <div>
131   - <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">
132   - Сохранить
133   - </button>
134   - </div>
135   - <div>
136   - <a href="">Флот</a>
137   - </div>
138   - <div>
139   - <a href="">Вакансии</a>
140   - </div>
141   - <div>
142   - <a href="">Контакты</a>
143   - </div>
144 175 </div>
  176 + <div id="content-3">
  177 + Содержимое 3...
  178 + </div>
  179 + </div>
  180 + <br>
  181 + <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
  182 + <div>
  183 + <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">
  184 + Сохранить
  185 + </button>
  186 + </div>
  187 + <!--<div>
  188 + <a href="">Флот</a>
  189 + </div>
  190 + <div>
  191 + <a href="">Вакансии</a>
  192 + </div>
  193 + <div>
  194 + <a href="">Контакты</a>
  195 + </div>-->
  196 + </div>
145 197 </div>
146 198 </form>
147 199 <!--
resources/views/admin/employer/index.blade.php
... ... @@ -86,14 +86,14 @@
86 86  
87 87 </td>
88 88 <td class="px-4 py-3 text-sm">
89   - {{ $user->name_man }}
  89 + {{ $user->name_man }} ({{ $user->emp_id }})
90 90 </td>
91 91 <td class="px-4 py-3 text-sm">
92 92 {{ $user->created_at }}
93 93 </td>
94 94 <td class="px-4 py-3 text-sm">
95   - @if ($user->id > 1)
96   - <a href="{{ route('admin.user-profile', ['user' => $user->id]) }}">Изменить</a>
  95 + @if (!empty($user->emp_id))
  96 + <a href="{{ route('admin.employer-profile', ['employer' => $user->emp_id]) }}">Изменить</a>
97 97 @endif
98 98 </td>
99 99 <td class="px-4 py-3 text-sm">
resources/views/admin/message/index.blade.php
1 1 @extends('layout.admin', ['title' => 'Админка - Сообщения адмистратора'])
2 2  
3 3 @section('script')
  4 + <script>
  5 + $(document).ready(function() {
  6 + $(document).on('change', '.checkread', function () {
  7 + var this_ = $(this);
  8 + var value = this_.val();
  9 + var ajax_block = $('#ajax_block');
  10 + var bool = 0;
  11 +
  12 + if(this.checked){
  13 + bool = 1;
  14 + } else {
  15 + bool = 0;
  16 + }
  17 +
  18 + $.ajax({
  19 + type: "GET",
  20 + url: "{{ url()->full()}}",
  21 + data: "id=" + value + "&flag_new=" + bool,
  22 + success: function (data) {
  23 + console.log('Обновление таблицы сообщений администратора ');
  24 + //data = JSON.parse(data);
  25 + //console.log(data);
  26 + ajax_block.html(data);
  27 + },
  28 + headers: {
  29 + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  30 + },
  31 + error: function (data) {
  32 + console.log('Error: ' + data);
  33 + }
  34 + });
  35 + });
  36 +
  37 + });
  38 + </script>
4 39 @endsection
5 40  
6 41 @section('search')
7   - <!--<div class="absolute inset-y-0 flex items-center pl-2">
8   - <svg
9   - class="w-4 h-4"
10   - aria-hidden="true"
11   - fill="currentColor"
12   - viewBox="0 0 20 20"
13   - >
14   - <path
15   - fill-rule="evenodd"
16   - d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z"
17   - clip-rule="evenodd"
18   - ></path>
19   - </svg>
20   - </div>
21   - <form action="" method="POST">
22   - <div style="float:left;"><input
23   - class="w-full pl-8 pr-2 text-sm text-gray-700 placeholder-gray-600 bg-gray-100 border-0 rounded-md dark:placeholder-gray-500 dark:focus:shadow-outline-gray dark:focus:placeholder-gray-600 dark:bg-gray-700 dark:text-gray-200 focus:placeholder-gray-500 focus:bg-white focus:border-purple-300 focus:outline-none focus:shadow-outline-purple form-input"
24   - style="width: 400px"
25   - type="text"
26   - placeholder="Искать компанию или вакансию"
27   - aria-label="Search"
28   - /></div>
29   - <div style="float: left">
30   - <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Поиск</button>
31   - </div>
32   - </form>-->
  42 +
33 43 @endsection
34 44  
35 45 @section('content')
... ... @@ -45,11 +55,13 @@
45 55 <th class="px-4 py-3">К юзеру</th>
46 56 <th class="px-4 py-3">Текст</th>
47 57 <th class="px-4 py-3">Дата</th>
  58 + <th class="px-4 py-3">Прочтено</th>
48 59 </tr>
49 60 </thead>
50 61 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
51 62 @foreach($Msgs as $msg)
52   - <tr class="text-gray-700 dark:text-gray-400">
  63 + <tr class="text-gray-700 dark:text-gray-400"
  64 + @if (($msg->user_to->id == $id_admin) && ($msg->flag_new == 1)) style="background-color: #403998;" @endif>
53 65 <td class="px-4 py-3">
54 66 {{$msg->id}}
55 67 </td>
... ... @@ -68,6 +80,11 @@
68 80 <td class="px-4 py-3 text-sm">
69 81 {{ $msg->created_at }}
70 82 </td>
  83 + <td class="px-4 py-3 text-sm">
  84 + @if (($msg->user_to->id == $id_admin) && ($msg->flag_new == 1))
  85 + <input type="checkbox" class="checkread" value="{{$msg->id}}" name="read_{{$msg->id}}"/>
  86 + @endif
  87 + </td>
71 88 </tr>
72 89 @endforeach
73 90 </tbody>
resources/views/admin/message/index_ajax.blade.php
... ... @@ -0,0 +1,50 @@
  1 +<div class="w-full overflow-x-auto">
  2 + <table class="w-full whitespace-no-wrap">
  3 + <thead>
  4 + <tr
  5 + 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"
  6 + >
  7 + <th class="px-4 py-3">№</th>
  8 + <th class="px-4 py-3">От юзера</th>
  9 + <th class="px-4 py-3">К юзеру</th>
  10 + <th class="px-4 py-3">Текст</th>
  11 + <th class="px-4 py-3">Дата</th>
  12 + <th class="px-4 py-3">Прочтено</th>
  13 + </tr>
  14 + </thead>
  15 + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
  16 + @foreach($Msgs as $msg)
  17 + <tr class="text-gray-700 dark:text-gray-400"
  18 + @if (($msg->user_to->id == $id_admin) && ($msg->flag_new == 1)) style="background-color: #403998;" @endif>
  19 + <td class="px-4 py-3">
  20 + {{$msg->id}}
  21 + </td>
  22 + <td class="px-4 py-3">
  23 + {{$msg->user_from->name}} ({{$msg->user_from->id}})
  24 + </td>
  25 + <td class="px-4 py-3">
  26 + {{$msg->user_to->name}} ({{$msg->user_to->id}})
  27 + </td>
  28 + <td class="px-4 py-3">
  29 + {{$msg->title}}
  30 + <div class="flex items-center text-sm">
  31 + <textarea cols="7" style="width:250px;">{{ $msg->text }}</textarea>
  32 + </div>
  33 + </td>
  34 + <td class="px-4 py-3 text-sm">
  35 + {{ $msg->created_at }}
  36 + </td>
  37 + <td class="px-4 py-3 text-sm">
  38 + @if (($msg->user_to->id == $id_admin) && ($msg->flag_new == 1))
  39 + <input type="checkbox" class="checkread" value="{{$msg->id}}" name="read_{{$msg->id}}"/>
  40 + @endif
  41 + </td>
  42 + </tr>
  43 + @endforeach
  44 + </tbody>
  45 + </table>
  46 +</div>
  47 +
  48 +<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">
  49 + <?=$Msgs->appends($_GET)->links('admin.pagginate'); ?>
  50 +</div>
resources/views/layout/admin.blade.php
... ... @@ -9,6 +9,7 @@
9 9 rel="stylesheet"
10 10 />
11 11 <link rel="stylesheet" href="{{ asset('./assets/css/tailwind.output.css')}}" />
  12 + <link rel="stylesheet" href="{{ asset('./assets/css/tabs.css')}}" />
12 13 <script
13 14 src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.x.x/dist/alpine.min.js"
14 15 defer
... ... @@ -900,11 +901,14 @@
900 901 href="{{ route('admin.admin-messages') }}"
901 902 >
902 903 <span>Сообщения</span>
  904 + @if($MsgCount > 0)
903 905 <span
904 906 class="inline-flex items-center justify-center px-2 py-1 text-xs font-bold leading-none text-red-600 bg-red-100 rounded-full dark:text-red-100 dark:bg-red-600"
905 907 >
906   - 13
907   - </span>
  908 +
  909 + {{ $MsgCount }}
  910 + </span>
  911 + @endif
908 912 </a>
909 913 </li>
910 914 <!--<li class="flex">