Commit 36b239fd916a9c8b7e77c2239112ad506c7fee52

Authored by Hayk Nazaryan
1 parent 947d970adb
Exists in master

user role fixes

Showing 9 changed files with 150 additions and 44 deletions Side-by-side Diff

app/Http/Controllers/Admin/EmployersController.php
... ... @@ -139,6 +139,9 @@ class EmployersController extends Controller
139 139 unset($params['email']);
140 140 unset($params['address']);
141 141 unset($params['site']);
  142 + unset($params['is_lookin']);
  143 + unset($params['show_database']);
  144 + unset($params['can_autolift']);
142 145 unset($params['status_hidden']);
143 146 unset($params['oficial_status']);
144 147 unset($params['social_is']);
... ... @@ -196,6 +199,12 @@ class EmployersController extends Controller
196 199 }
197 200 $employer->save();
198 201  
  202 + $employer->users()->update([
  203 + 'is_lookin' => $request->is_lookin,
  204 + 'show_database' => $request->show_database,
  205 + 'can_autolift' => $request->can_autolift,
  206 + ]);
  207 +
199 208 return redirect()->route('admin.employer-profile', ['employer' => $employer->id])
200 209 ->with('success', 'Данные были успешно сохранены');
201 210 }
app/Http/Controllers/EmployerController.php
... ... @@ -566,6 +566,10 @@ class EmployerController extends Controller
566 566  
567 567 // База данных
568 568 public function bd(Request $request) {
  569 + if (!Auth::user()->show_database) {
  570 + return redirect()->route('employer.employer_info');
  571 + }
  572 +
569 573 $users = User_Model::query()->with('workers')->with('jobtitles');
570 574  
571 575 if ($request->has('search')) {
... ... @@ -793,8 +797,12 @@ class EmployerController extends Controller
793 797 /**
794 798 * @throws JsonException
795 799 */
796   - public function vacancyAutoLiftForm(): View
  800 + public function vacancyAutoLiftForm(): View|RedirectResponse
797 801 {
  802 + if (!Auth::user()->can_autolift) {
  803 + return redirect()->route('employer.employer_info');
  804 + }
  805 +
798 806 $employer = Auth::user()->employers[0];
799 807 $vacancies = $employer
800 808 ->ads()
... ... @@ -32,6 +32,8 @@ class User extends Authenticatable implements MustVerifyEmail
32 32 'surname2',
33 33 'is_worker',
34 34 'is_lookin',
  35 + 'show_database',
  36 + 'can_autolift',
35 37 'is_message',
36 38 'is_public',
37 39 'is_worker',
database/migrations/2024_11_28_110548_add_columns_in_users_table.php
... ... @@ -0,0 +1,33 @@
  1 +<?php
  2 +
  3 +use Illuminate\Database\Migrations\Migration;
  4 +use Illuminate\Database\Schema\Blueprint;
  5 +use Illuminate\Support\Facades\Schema;
  6 +
  7 +return new class extends Migration
  8 +{
  9 + /**
  10 + * Run the migrations.
  11 + *
  12 + * @return void
  13 + */
  14 + public function up()
  15 + {
  16 + Schema::table('users', function (Blueprint $table) {
  17 + $table->boolean('show_database')->default(false)->after('is_lookin');
  18 + $table->boolean('can_autolift')->default(false)->after('show_database');
  19 + });
  20 + }
  21 +
  22 + /**
  23 + * Reverse the migrations.
  24 + *
  25 + * @return void
  26 + */
  27 + public function down()
  28 + {
  29 + Schema::table('users', function (Blueprint $table) {
  30 + $table->dropColumn(['show_database', 'can_autolift']);
  31 + });
  32 + }
  33 +};
resources/views/admin/content/roles_index.blade.php
... ... @@ -90,7 +90,6 @@
90 90 </div>
91 91  
92 92 <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">
93   - <?//=$users->appends($_GET)->links('admin.pagginate'); ?>
94 93 {{$roles->links('admin.pagginate') }}
95 94 </div>
96 95 </div>
resources/views/admin/employer/edit.blade.php
... ... @@ -172,34 +172,66 @@
172 172  
173 173 </div>
174 174 <div id="content-2">
175   - <label class="block text-sm">
176   - <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">
177   - Права работодателя:
178   - </h4>
  175 + <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">
  176 + Права работодателя:
  177 + </h4><br>
  178 +
  179 + <label class="block text-sm flex">
179 180 <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Просмотр базы резюме </p>
180 181 <input type="hidden" name="is_lookin" value="0" />
181   - <input name="is_lookin" <?php if ($employer->users->is_lookin) echo "checked";?>
  182 + <input name="is_lookin" id="is_lookin" <?php if ($employer->users->is_lookin) echo "checked";?>
182 183 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 "
183 184 placeholder="" type="checkbox" value="1"
184   - /><br>
  185 + />
  186 + </label><br>
  187 +
  188 + <label class="block text-sm flex">
  189 + <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Просмотр базы данных</p>
  190 + <input type="hidden" name="show_database" value="0" />
  191 + <input name="show_database" id="show_database" <?php if ($employer->users->show_database) echo "checked";?>
  192 + 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 "
  193 + placeholder="" type="checkbox" value="1"
  194 + />
  195 + </label><br>
  196 +
  197 + <label class="block text-sm flex">
  198 + <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Автоподнятие вакансий</p>
  199 + <input type="hidden" name="can_autolift" value="0" />
  200 + <input name="can_autolift" id="can_autolift" <?php if ($employer->users->can_autolift) echo "checked";?>
  201 + 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 "
  202 + placeholder="" type="checkbox" value="1"
  203 + />
  204 + </label><br>
185 205  
  206 + <label class="block text-sm flex">
186 207 <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Отправка сообщений</p>
187 208 <input type="hidden" name="is_message" value="0" />
188 209 <input name="is_message" id="is_message" <?php if ($employer->users->is_message) echo "checked";?>
189 210 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 "
190 211 placeholder="" type="checkbox" value="1"
191   - /><br>
  212 + />
  213 + </label><br>
192 214  
  215 + <label class="block text-sm flex">
193 216 <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Публикация вакансий</p>
194 217 <input type="hidden" name="is_public" value="0" />
195 218 <input name="is_public" id="is_public" <?php if ($employer->users->is_public) echo "checked";?>
196 219 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 "
197 220 placeholder="" type="checkbox" value="1"
198   - /><br>
  221 + />
  222 + </label><br>
199 223  
200   - </label>
  224 + <label class="block text-sm flex">
  225 + <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Публикация вакансий</p>
  226 + <input type="hidden" name="is_public" value="0" />
  227 + <input name="is_public" id="is_public" <?php if ($employer->users->is_public) echo "checked";?>
  228 + 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 "
  229 + placeholder="" type="checkbox" value="1"
  230 + />
201 231  
202   - <label class="block text-sm">
  232 + </label><br>
  233 +
  234 + <label class="block text-sm flex">
203 235 <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Работодатель скрыт </p>
204 236 <input type="hidden" name="status_hidden" value="0" />
205 237 <input name="status_hidden" <?php if ($employer->status_hidden) echo "checked";?>
... ... @@ -208,7 +240,7 @@
208 240 />
209 241 </label><br>
210 242  
211   - <label class="block text-sm">
  243 + <label class="block text-sm flex">
212 244 <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Компания подтверждена </p>
213 245 <input type="hidden" name="oficial_status" value="0" />
214 246 <input name="oficial_status" <?php if ($employer->oficial_status) echo "checked";?>
... ... @@ -217,7 +249,7 @@
217 249 />
218 250 </label><br>
219 251  
220   - <label class="block text-sm">
  252 + <label class="block text-sm flex">
221 253 <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Разрешение публикации в соц.сетях </p>
222 254 <input type="hidden" name="social_is" value="0" />
223 255 <input name="social_is" <?php if ($employer->social_is) echo "checked";?>
... ... @@ -226,7 +258,7 @@
226 258 />
227 259 </label><br>
228 260  
229   - <label class="block text-sm">
  261 + <label class="block text-sm flex">
230 262 <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Рассылка </p>
231 263 <input type="hidden" name="sending_is" value="0" />
232 264 <input name="sending_is" <?php if ($employer->sending_is) echo "checked";?>
resources/views/admin/users/roles/index.blade.php
... ... @@ -83,6 +83,8 @@
83 83 <th class="px-4 py-3">Имя</th>
84 84 <th class="px-4 py-3">Email/логин</th>
85 85 <th class="px-4 py-3">Просмотр резюме</th>
  86 + <th class="px-4 py-3">Просмотр базы данных</th>
  87 + <th class="px-4 py-3">Автоподнятие вакансий</th>
86 88 <th class="px-4 py-3">Отправка сообщений</th>
87 89 <th class="px-4 py-3">Публикация вакансий</th>
88 90 <th class="px-4 py-3">Админ</th>
... ... @@ -104,6 +106,13 @@
104 106 <td class="px-4 py-3 text-sm">
105 107 <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="is_lookin" name="lookin_{{$user->id}}" {{ ($user->is_lookin) ? "checked" : "" }}/>
106 108 </td>
  109 + <td class="px-4 py-3 text-sm">
  110 + <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="show_database" name="show_database_{{$user->id}}" {{ ($user->show_database) ? "checked" : "" }}/>
  111 + </td>
  112 +
  113 + <td class="px-4 py-3 text-sm">
  114 + <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="can_autolift" name="can_autolift_{{$user->id}}" {{ ($user->can_autolift) ? "checked" : "" }}/>
  115 + </td>
107 116  
108 117 <td class="px-4 py-3 text-sm">
109 118 <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="is_message" name="message_{{$user->id}}" {{ ($user->is_message) ? "checked" : "" }}/>
... ... @@ -129,7 +138,6 @@
129 138 </div>
130 139  
131 140 <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">
132   - <?//=$users->appends($_GET)->links('admin.pagginate'); ?>
133 141 <?=$users->links('admin.pagginate'); ?>
134 142 </div>
135 143  
... ... @@ -232,7 +240,4 @@
232 240 </div>-->
233 241 </div>
234 242  
235   - <?//=$users->appends($_GET)->links('catalogs.paginate'); ?>
236   -
237   -
238 243 @endsection
resources/views/admin/users/roles/index_ajax.blade.php
... ... @@ -8,6 +8,8 @@
8 8 <th class="px-4 py-3">Имя</th>
9 9 <th class="px-4 py-3">Email/логин</th>
10 10 <th class="px-4 py-3">Просмотр резюме</th>
  11 + <th class="px-4 py-3">Просмотр базы данных</th>
  12 + <th class="px-4 py-3">Автоподнятие вакансий</th>
11 13 <th class="px-4 py-3">Отправка сообщений</th>
12 14 <th class="px-4 py-3">Публикация вакансий</th>
13 15 <th class="px-4 py-3">Админ</th>
... ... @@ -29,8 +31,14 @@
29 31 <td class="px-4 py-3 text-sm">
30 32 <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="is_lookin" name="lookin_{{$user->id}}" {{ ($user->is_lookin) ? "checked" : "" }}/>
31 33 </td>
  34 + <td class="px-4 py-3 text-sm">
  35 + <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="show_database" name="show_database_{{$user->id}}" {{ ($user->show_database) ? "checked" : "" }}/>
  36 + </td>
32 37  
33 38 <td class="px-4 py-3 text-sm">
  39 + <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="can_autolift" name="can_autolift_{{$user->id}}" {{ ($user->can_autolift) ? "checked" : "" }}/>
  40 + </td>
  41 + <td class="px-4 py-3 text-sm">
34 42 <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="is_message" name="message_{{$user->id}}" {{ ($user->is_message) ? "checked" : "" }}/>
35 43 </td>
36 44  
resources/views/employers/menu.blade.php
... ... @@ -69,32 +69,42 @@
69 69 </i>
70 70 <span>Избранные кандидаты</span>
71 71 </a>
72   - <a href="{{ route('employer.autolift') }}" class="cabinet__menu-item @if ($item==15) active @endif">
73   - <i>
74   - <svg>
75   - <use xlink:href="{{ asset('images/sprite.svg#refresh') }}"></use>
76   - </svg>
77   - </i>
78   - <span>Автоподнятие вакансий</span>
79   - </a>
80   - @if ((!Auth()->user()->is_worker) && (Auth()->user()->is_lookin))
81   - <a href="{{ route('employer.bd') }}" class="cabinet__menu-item @if ($item==7) active @endif">
82   - <i>
83   - <svg>
84   - <use xlink:href="{{ asset('images/sprite.svg#cabinet-7')}}"></use>
85   - </svg>
86   - </i>
87   - <span>База данных</span>
88   - </a>
89   - <a href="{{ route('bd_resume') }}" target="_blank" class="cabinet__menu-item @if ($item==8) active @endif">
90   - <i>
91   - <svg>
92   - <use xlink:href="{{ asset('images/sprite.svg#cabinet-8') }}"></use>
93   - </svg>
94   - </i>
95   - <span>База резюме</span>
96   - </a>
  72 + @if ((!Auth()->user()->is_worker))
  73 + @if(Auth()->user()->can_autolift)
  74 + <a href="{{ route('employer.autolift') }}" class="cabinet__menu-item @if ($item==15) active @endif">
  75 + <i>
  76 + <svg>
  77 + <use xlink:href="{{ asset('images/sprite.svg#refresh') }}"></use>
  78 + </svg>
  79 + </i>
  80 + <span>Автоподнятие вакансий</span>
  81 + </a>
  82 + @endif
  83 +
  84 + @if(Auth()->user()->show_database)
  85 + <a href="{{ route('employer.bd') }}" class="cabinet__menu-item @if ($item==7) active @endif">
  86 + <i>
  87 + <svg>
  88 + <use xlink:href="{{ asset('images/sprite.svg#cabinet-7')}}"></use>
  89 + </svg>
  90 + </i>
  91 + <span>База данных</span>
  92 + </a>
  93 + @endif
  94 +
  95 + @if(Auth()->user()->is_lookin)
  96 + <a href="{{ route('bd_resume') }}" target="_blank" class="cabinet__menu-item @if ($item==8) active @endif">
  97 + <i>
  98 + <svg>
  99 + <use xlink:href="{{ asset('images/sprite.svg#cabinet-8') }}"></use>
  100 + </svg>
  101 + </i>
  102 + <span>База резюме</span>
  103 + </a>
  104 + @endif
97 105 @endif
  106 +
  107 +
98 108 <a href="{{ route('employer.send_all_messages') }}" class="cabinet__menu-item @if ($item==9) active @endif">
99 109 <i>
100 110 <svg>