Commit 9b4580039f5ceae97c06059b629e07965e8214a9
1 parent
09a5498b17
Exists in
master
and in
1 other branch
Медиа сущность, должности в бд, фильтры в вакансиях
Showing 17 changed files with 486 additions and 26 deletions Side-by-side Diff
- app/Http/Controllers/Admin/Ad_EmployersController.php
- app/Http/Controllers/Admin/UsersController.php
- app/Http/Controllers/Admin/WorkersController.php
- app/Http/Controllers/MediaController.php
- app/Http/Requests/BaseUserRequest.php
- app/Models/Media.php
- app/Models/User.php
- database/migrations/2023_10_28_112853_create_media_table.php
- resources/views/admin/ad_employers/index.blade.php
- resources/views/admin/find_ad_employer.blade.php
- resources/views/admin/media/index.blade.php
- resources/views/admin/users/form.blade.php
- resources/views/admin/users/index_bd.blade.php
- resources/views/admin/users/index_bd_ajax.blade.php
- resources/views/admin/worker/index.blade.php
- resources/views/layout/admin.blade.php
- routes/web.php
app/Http/Controllers/Admin/Ad_EmployersController.php
... | ... | @@ -31,13 +31,47 @@ class Ad_EmployersController extends Controller |
31 | 31 | } |
32 | 32 | } |
33 | 33 | |
34 | - $ad_employers = Ad_employer::with('employer')->with('jobs') | |
35 | - ->where('is_remove', '0')->OrderBy('updated_at', 'desc')->paginate(15); | |
34 | + $select_job = Job_title::query()->active()->get(); | |
35 | + $all_ad = Ad_employer::with('employer')->with('jobs') | |
36 | + ->where('is_remove', '0')->get()->count(); | |
37 | + | |
38 | + $ad_employers = Ad_employer::where('is_remove', '0'); | |
39 | + | |
40 | + $find_job = ""; | |
41 | + if (isset($request->category_job)) { | |
42 | + if ($request->category_job != 'Все вакансии') { | |
43 | + $find_job = $request->category_job; | |
44 | + $ad_employers = $ad_employers->WhereHas('jobs', function($query) use ($find_job){ | |
45 | + return $query->where('name', 'LIKE', '%'.$find_job.'%'); | |
46 | + }); | |
47 | + } | |
48 | + } else { | |
49 | + $ad_employers = $ad_employers->with('jobs'); | |
50 | + } | |
51 | + | |
52 | + $find_key = ""; | |
53 | + if (isset($request->find)) { | |
54 | + $find_key = $request->find; | |
55 | + $ad_employers = $ad_employers->whereHas('employer', function($query) use($find_key) { | |
56 | + $query->Where('name_company', 'LIKE', "%$find_key%"); | |
57 | + $query->orWhere('name', 'LIKE', "%$find_key%"); | |
58 | + }); | |
59 | + | |
60 | + } else { | |
61 | + $ad_employers = $ad_employers->with('employer'); | |
62 | + } | |
63 | + | |
64 | + $ad_employers = $ad_employers->OrderBy('updated_at', 'desc')->paginate(15); | |
36 | 65 | |
37 | 66 | if ($request->ajax()) { |
38 | 67 | return view('admin.ad_employers.index_ajax', compact('ad_employers', 'params')); |
39 | 68 | } else { |
40 | - return view('admin.ad_employers.index', compact('ad_employers', 'title')); | |
69 | + return view('admin.ad_employers.index', compact('ad_employers', | |
70 | + 'title', | |
71 | + 'all_ad', | |
72 | + 'find_job', | |
73 | + 'find_key', | |
74 | + 'select_job')); | |
41 | 75 | } |
42 | 76 | } |
43 | 77 |
app/Http/Controllers/Admin/UsersController.php
... | ... | @@ -4,7 +4,9 @@ namespace App\Http\Controllers\Admin; |
4 | 4 | |
5 | 5 | use App\Http\Controllers\Controller; |
6 | 6 | use App\Http\Requests\BaseUserRequest; |
7 | +use App\Models\Job_title; | |
7 | 8 | use App\Models\User; |
9 | +use App\Models\Worker; | |
8 | 10 | use Illuminate\Http\Request; |
9 | 11 | use Illuminate\Support\Facades\Auth; |
10 | 12 | use Illuminate\Support\Facades\Storage; |
... | ... | @@ -62,26 +64,40 @@ class UsersController extends Controller |
62 | 64 | } |
63 | 65 | |
64 | 66 | public function add_bd() { |
65 | - return view('admin.users.add'); | |
67 | + $list_job_titles = Job_title::query()->active()->orderBy('name', 'asc')->get(); | |
68 | + return view('admin.users.add', compact('list_job_titles')); | |
66 | 69 | } |
67 | 70 | |
68 | 71 | public function add_store_bd(BaseUserRequest $request) { |
69 | 72 | $params = $request->all(); |
73 | + $position_work = $request->position_work; | |
70 | 74 | |
71 | 75 | if ($request->has('file')) { |
72 | 76 | $params['file'] = $request->file('file')->store('basedata', 'public'); |
73 | 77 | } |
74 | 78 | |
79 | + if (isset($request->name)) { | |
80 | + $params['name'] = $request->surname." ".$request->name_man." ".$request->surname2; | |
81 | + } | |
82 | + | |
75 | 83 | $user = User::create($params); |
84 | + $user_id = $user->id; | |
85 | + $worker = new Worker(); | |
86 | + $worker->position_work = $position_work; | |
87 | + $worker->user_id = $user_id; | |
88 | + $worker->save(); | |
89 | + | |
76 | 90 | return redirect()->route('admin.basedata'); |
77 | 91 | } |
78 | 92 | |
79 | 93 | public function edit_bd(User $user) { |
80 | - return view('admin.users.edit', compact('user')); | |
94 | + $list_job_titles = Job_title::query()->active()->orderBy('name', 'asc')->get(); | |
95 | + return view('admin.users.edit', compact('user', 'list_job_titles')); | |
81 | 96 | } |
82 | 97 | |
83 | 98 | public function update_bd(BaseUserRequest $request, User $user) { |
84 | 99 | $params = $request->all(); |
100 | + $position_work = $request->position_work; | |
85 | 101 | |
86 | 102 | if ($request->has('file')) { |
87 | 103 | if (!empty($user->file)) Storage::delete($user->file); |
... | ... | @@ -90,7 +106,22 @@ class UsersController extends Controller |
90 | 106 | if (!empty($user->image)) $params['file'] = $user->file; |
91 | 107 | } |
92 | 108 | |
109 | + if (isset($request->name)) { | |
110 | + $params['name'] = $request->surname." ".$request->name_man." ".$request->surname2; | |
111 | + } | |
112 | + | |
93 | 113 | $user->update($params); |
114 | + if (isset($user->workers[0]->id)) { | |
115 | + $worker = Worker::find($user->workers[0]->id); | |
116 | + $worker->position_work = $position_work; | |
117 | + $worker->save(); | |
118 | + } else { | |
119 | + $worker = new Worker(); | |
120 | + $worker->user_id = $user->id; | |
121 | + $worker->position_work = $position_work; | |
122 | + $worker->save(); | |
123 | + } | |
124 | + | |
94 | 125 | return redirect()->route('admin.basedata'); |
95 | 126 | } |
96 | 127 |
app/Http/Controllers/Admin/WorkersController.php
... | ... | @@ -33,7 +33,8 @@ class WorkersController extends Controller |
33 | 33 | } |
34 | 34 | |
35 | 35 | $status_work = Job_title::query()->active()->orderBy('name')->get(); |
36 | - $users = User::with('jobtitles')->where('is_worker', '1'); | |
36 | + $users = User::with('jobtitles')->worker()->realuser(); | |
37 | + $all_worker = $users->count(); | |
37 | 38 | |
38 | 39 | $find_status_work = ""; |
39 | 40 | if (isset($request->status_work)) { |
... | ... | @@ -126,7 +127,8 @@ class WorkersController extends Controller |
126 | 127 | 'find_key', |
127 | 128 | 'find_status_work', |
128 | 129 | 'status_work', |
129 | - 'status_wor')); | |
130 | + 'status_wor', | |
131 | + 'all_worker')); | |
130 | 132 | } |
131 | 133 | } |
132 | 134 |
app/Http/Controllers/MediaController.php
... | ... | @@ -0,0 +1,24 @@ |
1 | +<?php | |
2 | + | |
3 | +namespace App\Http\Controllers; | |
4 | + | |
5 | +use App\Models\Media; | |
6 | +use Illuminate\Http\Request; | |
7 | +use Illuminate\Support\Facades\Storage; | |
8 | + | |
9 | +class MediaController extends Controller | |
10 | +{ | |
11 | + public function index() { | |
12 | + $Media = Media::query()->OrderBy('id', 'desc')->paginate(); | |
13 | + return view('admin.media.index', compact('Media')); | |
14 | + } | |
15 | + | |
16 | + public function delete(Media $media) { | |
17 | + if (!empty($media->file)){ | |
18 | + Storage::delete($media->file); | |
19 | + } | |
20 | + | |
21 | + $media->delete(); | |
22 | + return redirect()->route('admin.media'); | |
23 | + } | |
24 | +} |
app/Http/Requests/BaseUserRequest.php
... | ... | @@ -23,11 +23,17 @@ class BaseUserRequest extends FormRequest |
23 | 23 | */ |
24 | 24 | public function rules() |
25 | 25 | { |
26 | + | |
27 | + $unique ='|unique:users'; | |
28 | + if (in_array($this->route()->getName(), ['admin.update-basedata'])) { | |
29 | + $unique = '|unique:users,email,'.$this->user->id; | |
30 | + } | |
31 | + | |
26 | 32 | return [ |
27 | - 'name' => 'required|min:3|max:255', | |
33 | + //'name' => 'required|min:3|max:255', | |
28 | 34 | 'surname' => 'required|min:3|max:255', |
29 | 35 | 'name_man' => 'required|min:3|max:255', |
30 | - 'email' => 'required|email|min:5', | |
36 | + 'email' => 'required|email|min:5'.$unique, | |
31 | 37 | ]; |
32 | 38 | } |
33 | 39 | |
... | ... | @@ -42,7 +48,8 @@ class BaseUserRequest extends FormRequest |
42 | 48 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
43 | 49 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
44 | 50 | ], |
45 | - 'email' => 'Введите корректный емайл' | |
51 | + 'email' => 'Введите корректный емайл', | |
52 | + 'unique' => 'Емайл должен быть уникальным', | |
46 | 53 | |
47 | 54 | ]; |
48 | 55 | } |
app/Models/Media.php
... | ... | @@ -0,0 +1,24 @@ |
1 | +<?php | |
2 | + | |
3 | +namespace App\Models; | |
4 | + | |
5 | +use Illuminate\Database\Eloquent\Factories\HasFactory; | |
6 | +use Illuminate\Database\Eloquent\Model; | |
7 | + | |
8 | +class Media extends Model | |
9 | +{ | |
10 | + use HasFactory; | |
11 | + | |
12 | + protected $fillable = [ | |
13 | + 'user_id', | |
14 | + 'file', | |
15 | + ]; | |
16 | + | |
17 | + /* | |
18 | + * Связь таблицы media с таблицей users | |
19 | + многие-к-одному | |
20 | + */ | |
21 | + public function user() { | |
22 | + return $this->belongsTo(User::class, 'user_id'); | |
23 | + } | |
24 | +} |
app/Models/User.php
... | ... | @@ -131,6 +131,10 @@ class User extends Authenticatable |
131 | 131 | return $query->where('is_remove', '=', '0'); |
132 | 132 | } |
133 | 133 | |
134 | + public function scopeWorker($query) { | |
135 | + return $query->where('is_worker', '=', '1'); | |
136 | + } | |
137 | + | |
134 | 138 | public function scopeBaseuser($query) { |
135 | 139 | return $query->where('is_bd', '=', '1'); |
136 | 140 | } |
database/migrations/2023_10_28_112853_create_media_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::create('media', function (Blueprint $table) { | |
17 | + $table->id(); | |
18 | + $table->string('file', 255)->nullable(false); | |
19 | + $table->bigInteger('user_id')->nullable(false); | |
20 | + $table->timestamps(); | |
21 | + }); | |
22 | + } | |
23 | + | |
24 | + /** | |
25 | + * Reverse the migrations. | |
26 | + * | |
27 | + * @return void | |
28 | + */ | |
29 | + public function down() | |
30 | + { | |
31 | + Schema::dropIfExists('media'); | |
32 | + } | |
33 | +}; |
resources/views/admin/ad_employers/index.blade.php
... | ... | @@ -38,10 +38,30 @@ |
38 | 38 | @endsection |
39 | 39 | |
40 | 40 | @section('search') |
41 | - | |
41 | + @include('admin.find_ad_employer', ['select_job' => $select_job]) | |
42 | 42 | @endsection |
43 | 43 | |
44 | 44 | @section('content') |
45 | + <div class="grid gap-6 mb-8 md:grid-cols-2 xl:grid-cols-4"> | |
46 | + | |
47 | + <div class="flex items-center p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800"> | |
48 | + <div class="p-3 mr-4 text-orange-500 bg-orange-100 rounded-full dark:text-orange-100 dark:bg-orange-500"> | |
49 | + <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20"> | |
50 | + <path | |
51 | + d="M13 6a3 3 0 11-6 0 3 3 0 016 0zM18 8a2 2 0 11-4 0 2 2 0 014 0zM14 15a4 4 0 00-8 0v3h8v-3zM6 8a2 2 0 11-4 0 2 2 0 014 0zM16 18v-3a5.972 5.972 0 00-.75-2.906A3.005 3.005 0 0119 15v3h-3zM4.75 12.094A5.973 5.973 0 004 15v3H1v-3a3 3 0 013.75-2.906z"></path> | |
52 | + </svg> | |
53 | + </div> | |
54 | + <div> | |
55 | + <p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400"> | |
56 | + Всего вакансий | |
57 | + </p> | |
58 | + <p class="text-lg font-semibold text-gray-700 dark:text-gray-200"> | |
59 | + {{ $all_ad }} | |
60 | + </p> | |
61 | + </div> | |
62 | + </div> | |
63 | + </div> | |
64 | + | |
45 | 65 | <button style="margin-bottom: 10px; width:165px" id="refresh_btn" name="refresh_btn" 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"> |
46 | 66 | Обновить вакансии |
47 | 67 | </button> |
resources/views/admin/find_ad_employer.blade.php
... | ... | @@ -0,0 +1,41 @@ |
1 | +<div class="absolute inset-y-0 flex items-center pl-2"> | |
2 | + <svg | |
3 | + class="w-4 h-4" | |
4 | + aria-hidden="true" | |
5 | + fill="currentColor" | |
6 | + viewBox="0 0 20 20" | |
7 | + > | |
8 | + <path | |
9 | + fill-rule="evenodd" | |
10 | + 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" | |
11 | + clip-rule="evenodd" | |
12 | + ></path> | |
13 | + </svg> | |
14 | +</div> | |
15 | +<form action="" method="GET"> | |
16 | + <div style="float:left; margin-right:10px;" ><input | |
17 | + name="find" id="find" | |
18 | + 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" | |
19 | + style="width: 200px" | |
20 | + type="text" | |
21 | + placeholder="Искать..." | |
22 | + aria-label="Search" | |
23 | + value="{{$find_key}}" | |
24 | + /> | |
25 | + </div> | |
26 | + <div style="float:left; margin-top: -5px;"> | |
27 | + <select | |
28 | + name="category_job" id="category_job" | |
29 | + placeholder="Вакансии" | |
30 | + class="block w-full 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" | |
31 | + > | |
32 | + <option value="Все вакансии">Все вакансии</option> | |
33 | + @foreach ($select_job as $job) | |
34 | + <option value="{{$job->name}}" @if ($find_job ==$job->name) selected @endif>{{$job->name}}</option> | |
35 | + @endforeach | |
36 | + </select> | |
37 | + </div> | |
38 | + <div style="float: left"> | |
39 | + <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button> | |
40 | + </div> | |
41 | +</form> |
resources/views/admin/media/index.blade.php
... | ... | @@ -0,0 +1,103 @@ |
1 | +@extends('layout.admin', ['title' => 'Админка - Медиа проекта']) | |
2 | + | |
3 | +@section('script') | |
4 | + <script> | |
5 | + $(document).ready(function() { | |
6 | + $(document).on('click', '.btn-eye', function () { | |
7 | + var this_ = $(this); | |
8 | + var status_ = this_.attr('data-status'); | |
9 | + var id_ = this_.attr('data-id'); | |
10 | + var ajax_block = $('#ajax_block'); | |
11 | + | |
12 | + $.ajax({ | |
13 | + type: "GET", | |
14 | + url: "{{ url()->full()}}", | |
15 | + data: "id=" + id_ + "&status=" + status_, | |
16 | + success: function (data) { | |
17 | + console.log('Обновление таблицы '); | |
18 | + //data = JSON.parse(data); | |
19 | + //console.log(data); | |
20 | + ajax_block.html(data); | |
21 | + }, | |
22 | + headers: { | |
23 | + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | |
24 | + }, | |
25 | + error: function (data) { | |
26 | + console.log('Error: ' + data); | |
27 | + } | |
28 | + }); | |
29 | + }); | |
30 | + }); | |
31 | + </script> | |
32 | +@endsection | |
33 | + | |
34 | +@section('modal') | |
35 | + | |
36 | +@endsection | |
37 | + | |
38 | +@section('search') | |
39 | + | |
40 | +@endsection | |
41 | + | |
42 | +@section('content') | |
43 | + | |
44 | + <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> | |
45 | + <div class="w-full overflow-x-auto"> | |
46 | + <table class="w-full whitespace-no-wrap"> | |
47 | + <thead> | |
48 | + <tr | |
49 | + 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" | |
50 | + > | |
51 | + <th class="px-4 py-3">№</th> | |
52 | + <th class="px-4 py-3">Картинка</th> | |
53 | + <th class="px-4 py-3">Юзер</th> | |
54 | + <th class="px-4 py-3">Дата загрузки</th> | |
55 | + <th class="px-4 py-3">Редактировать</th> | |
56 | + </tr> | |
57 | + </thead> | |
58 | + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> | |
59 | + @foreach($Media as $img) | |
60 | + <tr class="text-gray-700 dark:text-gray-400"> | |
61 | + <td class="px-4 py-3"> | |
62 | + {{$img->id}} | |
63 | + </td> | |
64 | + <td class="px-4 py-3"> | |
65 | + <img style="width: 50px" src="{{ asset(Storage::url($img->file)) }}" /> | |
66 | + </td> | |
67 | + | |
68 | + <td class="px-4 py-3"> | |
69 | + <div class="flex items-center text-sm"> | |
70 | + <div> | |
71 | + @if (isset($img->user->id)) | |
72 | + <p class="font-semibold"> | |
73 | + {{$img->user->name_man}} {{$img->user->surname}} {{$img->user->surname2}} | |
74 | + </p> | |
75 | + <p class="text-xs text-gray-600 dark:text-gray-400"> | |
76 | + ID: {{$img->id}} | |
77 | + </p> | |
78 | + @endif | |
79 | + </div> | |
80 | + </div> | |
81 | + </td> | |
82 | + <td class="px-4 py-3"> | |
83 | + {{$img->created_at}} | |
84 | + </td> | |
85 | + | |
86 | + <td class="px-4 py-3 text-sm_"> | |
87 | + <form action="{{ route('admin.delete-media', ['media' => $img->id]) }}" method="POST"> | |
88 | + @csrf | |
89 | + @method('DELETE') | |
90 | + <input class="btn btn-danger" type="submit" value="Удалить"/> | |
91 | + </form> | |
92 | + </td> | |
93 | + </tr> | |
94 | + @endforeach | |
95 | + </tbody> | |
96 | + </table> | |
97 | + </div> | |
98 | + | |
99 | + <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"> | |
100 | + <?=$Media->appends($_GET)->links('admin.pagginate'); ?> | |
101 | + </div> | |
102 | + </div> | |
103 | +@endsection |
resources/views/admin/users/form.blade.php
1 | 1 | <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"> |
2 | - <label class="block text-sm"> | |
2 | + <!--<label class="block text-sm"> | |
3 | 3 | <span class="text-gray-700 dark:text-gray-400">Имя/Псевдоним</span> |
4 | 4 | <input name="name" id="name" |
5 | 5 | 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" |
... | ... | @@ -10,6 +10,34 @@ |
10 | 10 | {{ $message }} |
11 | 11 | </span> |
12 | 12 | @enderror |
13 | + </label><br>--> | |
14 | + | |
15 | + <input name="name" id="name" type="hidden" | |
16 | + 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" | |
17 | + placeholder="Имя/Псевдоним" value="{{ old('name') ?? $user->name ?? 'Пользователь базы данных' }}" | |
18 | + /> | |
19 | + | |
20 | + <label class="block text-sm"> | |
21 | + <span class="text-gray-700 dark:text-gray-400">Должность</span> | |
22 | + <select name="position_work" id="position_work" class="form-control block w-full 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" | |
23 | + "> | |
24 | + @isset($list_job_titles) | |
25 | + @foreach($list_job_titles as $job_title) | |
26 | + <option value="{{ $job_title->id }}" | |
27 | + @if (isset($user->workers[0]->position_work)) | |
28 | + @if($job_title->id == $user->workers[0]->position_work) | |
29 | + selected | |
30 | + @endif | |
31 | + @endif | |
32 | + >{{ $job_title->name }} ({{ $job_title->id }})</option> | |
33 | + @endforeach | |
34 | + @endisset | |
35 | + </select> | |
36 | + @error('name') | |
37 | + <span class="text-xs text-red-600 dark:text-red-400"> | |
38 | + {{ $message }} | |
39 | + </span> | |
40 | + @enderror | |
13 | 41 | </label><br> |
14 | 42 | |
15 | 43 | <label class="block text-sm"> |
resources/views/admin/users/index_bd.blade.php
... | ... | @@ -58,7 +58,7 @@ |
58 | 58 | <th class="px-4 py-3">№</th> |
59 | 59 | <th class="px-4 py-3">Имя</th> |
60 | 60 | <th class="px-4 py-3">Email/телефон</th> |
61 | - <th class="px-4 py-3">Статус</th> | |
61 | + <th class="px-4 py-3">Должность</th> | |
62 | 62 | <th class="px-4 py-3">Анкета</th> |
63 | 63 | <th class="px-4 py-3">Дата регистрации</th> |
64 | 64 | <th class="px-4 py-3">Изменить</th> |
... | ... | @@ -108,7 +108,7 @@ |
108 | 108 | </div> |
109 | 109 | </td> |
110 | 110 | |
111 | - <td class="px-4 py-3 text-xs"> | |
111 | + <!--<td class="px-4 py-3 text-xs"> | |
112 | 112 | <span class="px-2 py-1 font-semibold leading-tight text-green-700 bg-green-100 rounded-full dark:bg-green-700 dark:text-green-100"> |
113 | 113 | @if ($user->is_worker) |
114 | 114 | Работник |
... | ... | @@ -126,6 +126,14 @@ |
126 | 126 | База данных |
127 | 127 | </span> |
128 | 128 | @endif |
129 | + </td>--> | |
130 | + | |
131 | + <td class="px-4 py-3 text-xs"> | |
132 | + @if (isset($user->jobtitles[0]->name)) | |
133 | + {{ $user->jobtitles[0]->name }} | |
134 | + @else | |
135 | + - | |
136 | + @endif | |
129 | 137 | </td> |
130 | 138 | |
131 | 139 | <td class="px-4 py-3 text-sm"> |
resources/views/admin/users/index_bd_ajax.blade.php
... | ... | @@ -6,9 +6,11 @@ |
6 | 6 | > |
7 | 7 | <th class="px-4 py-3">№</th> |
8 | 8 | <th class="px-4 py-3">Имя</th> |
9 | - <th class="px-4 py-3">Email/логин</th> | |
10 | - <th class="px-4 py-3">Статус</th> | |
9 | + <th class="px-4 py-3">Email/телефон</th> | |
10 | + <th class="px-4 py-3">Должность</th> | |
11 | + <th class="px-4 py-3">Анкета</th> | |
11 | 12 | <th class="px-4 py-3">Дата регистрации</th> |
13 | + <th class="px-4 py-3">Изменить</th> | |
12 | 14 | </tr> |
13 | 15 | </thead> |
14 | 16 | <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> |
... | ... | @@ -33,8 +35,11 @@ |
33 | 35 | </div> |
34 | 36 | </div> |
35 | 37 | --> |
36 | - <a style="text-decoration: underline;" href="{{ route('admin.user-profile', ['user' => $user->id]) }}">{{ $user->name }}</a> | |
38 | + <!--<a style="text-decoration: underline;" href="{{ route('admin.user-profile', ['user' => $user->id]) }}"></a>--> | |
39 | + | |
40 | + {{ $user->name }} | |
37 | 41 | </td> |
42 | + | |
38 | 43 | <td class="px-4 py-3"> |
39 | 44 | <div class="flex items-center text-sm"> |
40 | 45 | <!--<div class="relative hidden w-8 h-8 mr-3 rounded-full md:block"> |
... | ... | @@ -51,29 +56,59 @@ |
51 | 56 | </div> |
52 | 57 | </div> |
53 | 58 | </td> |
54 | - <td class="px-4 py-3 text-xs"> | |
59 | + | |
60 | + <!--<td class="px-4 py-3 text-xs"> | |
55 | 61 | <span class="px-2 py-1 font-semibold leading-tight text-green-700 bg-green-100 rounded-full dark:bg-green-700 dark:text-green-100"> |
56 | 62 | @if ($user->is_worker) |
57 | 63 | Работник |
58 | 64 | @else |
59 | - Работодатель | |
60 | - @endif | |
65 | + Работодатель | |
66 | + @endif | |
61 | 67 | </span> |
62 | - @if ($user->admin) | |
63 | - <span class="px-2 py-1 font-semibold leading-tight text-orange-700 bg-orange-100 rounded-full dark:text-white dark:bg-orange-600"> | |
68 | + @if ($user->admin) | |
69 | + <span class="px-2 py-1 font-semibold leading-tight text-orange-700 bg-orange-100 rounded-full dark:text-white dark:bg-orange-600"> | |
64 | 70 | Администратор |
65 | 71 | </span> |
72 | + @endif | |
73 | + @if ($user->is_bd) | |
74 | + <span class="px-2 py-1 font-semibold leading-tight text-red-700 bg-red-100 rounded-full dark:text-red-100 dark:bg-red-700"> | |
75 | + База данных | |
76 | + </span> | |
77 | + @endif | |
78 | + </td>--> | |
79 | + | |
80 | + <td class="px-4 py-3 text-xs"> | |
81 | + @if (isset($user->jobtitles[0]->name)) | |
82 | + {{ $user->jobtitles[0]->name }} | |
83 | + @else | |
84 | + - | |
66 | 85 | @endif |
67 | - @if ($user->is_bd) | |
68 | - <span class="px-2 py-1 font-semibold leading-tight text-red-700 bg-red-100 rounded-full dark:text-red-100 dark:bg-red-700"> | |
69 | - База данных | |
70 | - </span> | |
86 | + </td> | |
87 | + | |
88 | + <td class="px-4 py-3 text-sm"> | |
89 | + @if (isset($user->workers[0]->id)) | |
90 | + <!--<a href="{{ route('admin.worker-profile-edit', ['worker' => $user->workers[0]->id]) }}">Править</a> |--> | |
91 | + <!--<a href="{{ route('admin.doc-basedata', ['user' => $user->id]) }}">Скачать</a>--> | |
71 | 92 | @endif |
93 | + @isset($user->file) | |
94 | + <a class="text-gray-700 dark:text-gray-400" target="blank" href="{{ asset(Storage::url($user->file)) }}">Скачать</a> | |
95 | + @else | |
96 | + <p class="text-gray-700 dark:text-gray-400">-</p> | |
97 | + @endisset | |
72 | 98 | </td> |
73 | 99 | |
74 | 100 | <td class="px-4 py-3 text-sm"> |
75 | 101 | {{ date('d.m.Y', strtotime($user->created_at)) }} |
76 | 102 | </td> |
103 | + | |
104 | + <td class="px-4 py-3 text-sm_"> | |
105 | + <form action="{{ route('admin.delete-basedata', ['user' => $user->id]) }}" method="POST"> | |
106 | + <a href="{{ route('admin.edit-basedata', ['user' => $user->id]) }}">Изменить</a> | | |
107 | + @csrf | |
108 | + @method('DELETE') | |
109 | + <input class="btn btn-danger" type="submit" value="Удалить"/> | |
110 | + </form> | |
111 | + </td> | |
77 | 112 | </tr> |
78 | 113 | @endforeach |
79 | 114 | </tbody> |
resources/views/admin/worker/index.blade.php
... | ... | @@ -43,6 +43,26 @@ |
43 | 43 | @endsection |
44 | 44 | |
45 | 45 | @section('content') |
46 | + <div class="grid gap-6 mb-8 md:grid-cols-2 xl:grid-cols-4"> | |
47 | + | |
48 | + <div class="flex items-center p-4 bg-white rounded-lg shadow-xs dark:bg-gray-800"> | |
49 | + <div class="p-3 mr-4 text-orange-500 bg-orange-100 rounded-full dark:text-orange-100 dark:bg-orange-500"> | |
50 | + <svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20"> | |
51 | + <path | |
52 | + d="M13 6a3 3 0 11-6 0 3 3 0 016 0zM18 8a2 2 0 11-4 0 2 2 0 014 0zM14 15a4 4 0 00-8 0v3h8v-3zM6 8a2 2 0 11-4 0 2 2 0 014 0zM16 18v-3a5.972 5.972 0 00-.75-2.906A3.005 3.005 0 0119 15v3h-3zM4.75 12.094A5.973 5.973 0 004 15v3H1v-3a3 3 0 013.75-2.906z"></path> | |
53 | + </svg> | |
54 | + </div> | |
55 | + <div> | |
56 | + <p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400"> | |
57 | + Всего соискателей | |
58 | + </p> | |
59 | + <p class="text-lg font-semibold text-gray-700 dark:text-gray-200"> | |
60 | + {{ $all_worker }} | |
61 | + </p> | |
62 | + </div> | |
63 | + </div> | |
64 | + </div> | |
65 | + | |
46 | 66 | <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> |
47 | 67 | <div class="w-full overflow-x-auto"> |
48 | 68 | <table class="w-full whitespace-no-wrap"> |
resources/views/layout/admin.blade.php
... | ... | @@ -234,6 +234,27 @@ |
234 | 234 | <span class="ml-4">Группы пользователей</span> |
235 | 235 | </a> |
236 | 236 | </li> |
237 | + | |
238 | + <li class="relative px-6 py-3"> | |
239 | + <a class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.media') ? 'dark:text-gray-100' : null }}" href="{{ route('admin.media') }}"> | |
240 | + <svg | |
241 | + class="w-5 h-5" | |
242 | + aria-hidden="true" | |
243 | + fill="none" | |
244 | + stroke-linecap="round" | |
245 | + stroke-linejoin="round" | |
246 | + stroke-width="2" | |
247 | + viewBox="0 0 24 24" | |
248 | + stroke="currentColor" | |
249 | + > | |
250 | + <path | |
251 | + d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" | |
252 | + ></path> | |
253 | + </svg> | |
254 | + <span class="ml-4">Медиа</span> | |
255 | + </a> | |
256 | + </li> | |
257 | + | |
237 | 258 | @if ($UserId == 1) |
238 | 259 | <li class="relative px-6 py-3"> |
239 | 260 | <a class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.roles') ? 'dark:text-gray-100' : null }}" href="{{ route('admin.roles') }}"> |
... | ... | @@ -729,6 +750,27 @@ |
729 | 750 | <span class="ml-4">Группы пользователей</span> |
730 | 751 | </a> |
731 | 752 | </li> |
753 | + | |
754 | + <li class="relative px-6 py-3"> | |
755 | + <a class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.media') ? 'dark:text-gray-100' : null }}" href="{{ route('admin.media') }}"> | |
756 | + <svg | |
757 | + class="w-5 h-5" | |
758 | + aria-hidden="true" | |
759 | + fill="none" | |
760 | + stroke-linecap="round" | |
761 | + stroke-linejoin="round" | |
762 | + stroke-width="2" | |
763 | + viewBox="0 0 24 24" | |
764 | + stroke="currentColor" | |
765 | + > | |
766 | + <path | |
767 | + d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" | |
768 | + ></path> | |
769 | + </svg> | |
770 | + <span class="ml-4">Медиа</span> | |
771 | + </a> | |
772 | + </li> | |
773 | + | |
732 | 774 | @if ($UserId == 1) |
733 | 775 | <li class="relative px-6 py-3"> |
734 | 776 | <a class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.roles') ? 'dark:text-gray-100' : null }}" href="{{ route('admin.roles') }}"> |
routes/web.php
... | ... | @@ -14,6 +14,7 @@ use App\Http\Controllers\Auth\ForgotPasswordController; |
14 | 14 | use App\Http\Controllers\Auth\LoginController; |
15 | 15 | use App\Http\Controllers\Auth\RegisterController; |
16 | 16 | use App\Http\Controllers\CKEditorController; |
17 | +use App\Http\Controllers\MediaController; | |
17 | 18 | use App\Http\Controllers\WorkerController; |
18 | 19 | use App\Models\User; |
19 | 20 | use App\Http\Controllers\MainController; |
... | ... | @@ -172,6 +173,9 @@ Route::group([ |
172 | 173 | // кабинет профиль работник - сохранение формы |
173 | 174 | Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile-update'); |
174 | 175 | |
176 | + // Медиа | |
177 | + Route::get('media', [MediaController::class, 'index'])->name('media'); | |
178 | + Route::delete('media/{media}', [MediaController::class, 'delete'])->name('delete-media'); | |
175 | 179 | |
176 | 180 | // кабинет настройки сайта - форма |
177 | 181 | Route::get('config', [AdminController::class, 'config_form'])->name('config'); |