Commit eb8596db66c772ba6f16740ed42179b0ab051f4c
1 parent
9b4580039f
Exists in
master
and in
1 other branch
Правки вакансии, образование, форма регистрации
Showing 17 changed files with 350 additions and 103 deletions Side-by-side Diff
- app/Classes/Tools.php
- app/Http/Controllers/Admin/Ad_EmployersController.php
- app/Http/Controllers/Admin/AdminController.php
- app/Http/Controllers/Admin/EducationController.php
- app/Http/Controllers/Admin/EmployersController.php
- app/Models/Employer.php
- app/Models/User.php
- database/migrations/2023_10_31_060833_alter_table_employers.php
- resources/views/admin/ad_employers/add.blade.php
- resources/views/admin/ad_employers/edit.blade.php
- resources/views/admin/ad_employers/index.blade.php
- resources/views/admin/education/edit.blade.php
- resources/views/admin/education/form.blade.php
- resources/views/admin/employer/index.blade.php
- resources/views/admin/register.blade.php
- resources/views/admin/users/index.blade.php
- routes/web.php
app/Classes/Tools.php
... | ... | @@ -0,0 +1,25 @@ |
1 | +<?php | |
2 | + | |
3 | + | |
4 | +namespace App\Classes; | |
5 | + | |
6 | + | |
7 | +class Tools | |
8 | +{ | |
9 | + static function generator_id($length = 6) | |
10 | + { | |
11 | + $word = ''; | |
12 | + $arr = array( | |
13 | + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', | |
14 | + 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', | |
15 | + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', | |
16 | + 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', | |
17 | + '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' | |
18 | + ); | |
19 | + | |
20 | + for ($i = 0; $i < $length; $i++) { | |
21 | + $word .= $arr[random_int(0, count($arr) - 1)]; | |
22 | + } | |
23 | + return $word; | |
24 | + } | |
25 | +} |
app/Http/Controllers/Admin/Ad_EmployersController.php
... | ... | @@ -76,13 +76,13 @@ class Ad_EmployersController extends Controller |
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
79 | - * Show the form for creating a new resource. | |
80 | - * | |
79 | + * Show the form for creating a new resource | |
81 | 80 | * @return \Illuminate\Http\Response |
82 | 81 | */ |
83 | 82 | public function create() |
84 | 83 | { |
85 | - // | |
84 | + $job_titles = Job_title::query()->active()->get(); | |
85 | + return view('admin.ad_employers.add', compact('job_titles')); | |
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
... | ... | @@ -93,7 +93,31 @@ class Ad_EmployersController extends Controller |
93 | 93 | */ |
94 | 94 | public function store(Request $request) |
95 | 95 | { |
96 | - // | |
96 | + $params = $request->all(); | |
97 | + unset($params->position_work); | |
98 | + $rules = [ | |
99 | + 'name' => 'required|min:3', | |
100 | + ]; | |
101 | + $messages = [ | |
102 | + 'required' => 'Укажите обязательное поле', | |
103 | + ]; | |
104 | + $validator = Validator::make($params, $rules, $messages); | |
105 | + | |
106 | + if ($validator->fails()) { | |
107 | + return redirect()->route('admin.add-ad-employers') | |
108 | + ->withErrors($validator); | |
109 | + } else { | |
110 | + $ad_employer = new Ad_employer(); | |
111 | + $params['employer_id'] = 1; | |
112 | + $data_ad = $ad_employer->create($params); | |
113 | + $data_ad->jobs()->sync($request->position_work); | |
114 | + //$ad_employer->jobs()->sync($request->position_work); | |
115 | + | |
116 | + | |
117 | + return redirect()->route('admin.ad-employers') | |
118 | + ->with('success', 'Данные были успешно сохранены'); | |
119 | + } | |
120 | + return redirect()->route('admin.ad-employers'); | |
97 | 121 | } |
98 | 122 | |
99 | 123 | /** |
... | ... | @@ -165,6 +189,9 @@ class Ad_EmployersController extends Controller |
165 | 189 | */ |
166 | 190 | public function destroy(Ad_employer $ad_employer) |
167 | 191 | { |
168 | - // | |
192 | + $ad_employer->is_remove = 1; | |
193 | + $ad_employer->save(); | |
194 | + | |
195 | + return redirect()->route('admin.ad-employers'); | |
169 | 196 | } |
170 | 197 | } |
app/Http/Controllers/Admin/AdminController.php
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | |
3 | 3 | namespace App\Http\Controllers\Admin; |
4 | 4 | |
5 | +use App\Classes\Tools; | |
5 | 6 | use App\Http\Controllers\Controller; |
6 | 7 | use App\Http\Requests\CompanyRequest; |
7 | 8 | use App\Models\Company; |
... | ... | @@ -28,12 +29,15 @@ class AdminController extends Controller |
28 | 29 | } |
29 | 30 | |
30 | 31 | public function register() { |
31 | - return view('admin.register'); | |
32 | + $code_emp = Tools::generator_id(10); | |
33 | + return view('admin.register', compact('code_emp')); | |
32 | 34 | } |
33 | 35 | |
34 | 36 | public function create(Request $request) { |
35 | 37 | |
36 | - $rules = [ | |
38 | + $params = $request->all(); | |
39 | + unset($params['code_emp']); | |
40 | + $rules = [ | |
37 | 41 | 'name' => 'required|string|max:255', |
38 | 42 | 'email' => 'required|string|email|max:255|unique:users', |
39 | 43 | 'password' => 'required|string|min:8|confirmed', |
... | ... | @@ -54,23 +58,30 @@ class AdminController extends Controller |
54 | 58 | ], |
55 | 59 | ]; |
56 | 60 | |
57 | - $validator = Validator::make($request->all(), $rules, $messages); | |
61 | + $validator = Validator::make($params, $rules, $messages); | |
58 | 62 | |
59 | 63 | if ($validator->fails()) { |
60 | - return back()->withErrors($validator)->withInput(); //->route('admin.register') | |
64 | + return back()->withErrors($validator)->withInput(); | |
61 | 65 | |
62 | 66 | } else { |
63 | - $params = $request->all(); | |
64 | - | |
65 | - User::create([ | |
66 | - 'name' => $request->name, | |
67 | - 'email' => $request->email, | |
68 | - 'password' => Hash::make($request->password), | |
69 | - 'pubpassword' => base64_encode($request->password), | |
70 | - 'admin' => '1', | |
71 | - 'email_verified_at' => Carbon::now() | |
67 | + try { | |
68 | + $user = User::create([ | |
69 | + 'name' => $request->name, | |
70 | + 'email' => $request->email, | |
71 | + 'password' => Hash::make($request->password), | |
72 | + 'pubpassword' => base64_encode($request->password), | |
73 | + 'admin' => '1', | |
74 | + 'is_worker' => '0', | |
75 | + 'email_verified_at' => Carbon::now() | |
76 | + ]); | |
77 | + } finally { | |
78 | + $emp = Employer::create([ | |
79 | + 'name_company' => 'Администратор', | |
80 | + 'user_id' => $user->id, | |
81 | + 'code' => $request->code_emp | |
82 | + ]); | |
83 | + } | |
72 | 84 | |
73 | - ]); | |
74 | 85 | return redirect() |
75 | 86 | ->route('admin.login') |
76 | 87 | ->with('success', 'Вы успешно зарегистрировались'); |
app/Http/Controllers/Admin/EducationController.php
... | ... | @@ -70,14 +70,18 @@ class EducationController extends Controller |
70 | 70 | */ |
71 | 71 | public function edit(Education $education) |
72 | 72 | { |
73 | - $program1 = ProgramEducation::query()->where('education_id', '=', $education->id) | |
73 | + /*$program1 = ProgramEducation::query()->where('education_id', '=', $education->id) | |
74 | 74 | ->where('level', '=', '1')->get(); |
75 | 75 | $program2 = ProgramEducation::query()->where('education_id', '=', $education->id) |
76 | 76 | ->where('level', '=', '2')->get(); |
77 | 77 | $program3 = ProgramEducation::query()->where('education_id', '=', $education->id) |
78 | 78 | ->where('level', '=', '3')->get(); |
79 | + */ | |
79 | 80 | |
80 | - return view('admin.education.edit', compact('education', 'program1', 'program2', 'program3')); | |
81 | + $program = ProgramEducation::query()->where('education_id', '=', $education->id) | |
82 | + ->orderBy('level')->get(); | |
83 | + | |
84 | + return view('admin.education.edit', compact('education', 'program')); | |
81 | 85 | } |
82 | 86 | |
83 | 87 | /** |
... | ... | @@ -113,8 +117,9 @@ class EducationController extends Controller |
113 | 117 | return redirect()->route('admin.education.index'); |
114 | 118 | } |
115 | 119 | |
116 | - public function add_program(Education $education, int $level) { | |
117 | - $id_education = $education->id; | |
120 | + public function add_program(Request $request) { | |
121 | + $id_education = $request->id; | |
122 | + $level = $request->level; | |
118 | 123 | return view('admin.education.program', compact('id_education', 'level')); |
119 | 124 | } |
120 | 125 |
app/Http/Controllers/Admin/EmployersController.php
... | ... | @@ -27,7 +27,7 @@ class EmployersController extends Controller |
27 | 27 | |
28 | 28 | $users = User::with('employers')->select(['users.*','users.id as usr_id', 'emp.id as emp_id', 'emp.logo as emp_logo', 'emp.*']) |
29 | 29 | ->join('employers as emp','emp.user_id','users.id') |
30 | - ->where('users.is_worker', '0')->Realuser(); | |
30 | + ->where('users.is_worker', '0')->Realuser()->Notadmin(); | |
31 | 31 | $all_employer = $users->count(); |
32 | 32 | |
33 | 33 | $find_cat = ""; |
... | ... | @@ -57,7 +57,11 @@ class EmployersController extends Controller |
57 | 57 | if ($request->ajax()) { |
58 | 58 | return view('admin.employer.index_ajax', compact('users')); |
59 | 59 | } else { |
60 | - return view('admin.employer.index', compact('users', 'find_key', 'find_cat', 'all_employer', 'select_category')); | |
60 | + return view('admin.employer.index', compact('users', | |
61 | + 'find_key', | |
62 | + 'find_cat', | |
63 | + 'all_employer', | |
64 | + 'select_category')); | |
61 | 65 | } |
62 | 66 | } |
63 | 67 | |
... | ... | @@ -144,10 +148,17 @@ class EmployersController extends Controller |
144 | 148 | public function delete_employer(Employer $employer, User $user) { |
145 | 149 | try { |
146 | 150 | if (!empty($employer)) { |
147 | - $employer->ads()->delete(); | |
148 | 151 | if (!empty($employer->logo)) { |
149 | 152 | Storage::delete($employer->logo); |
150 | 153 | } |
154 | + | |
155 | + foreach($employer->ads as $ad) { | |
156 | + $ads = Ad_employer::find($ad->id); | |
157 | + $ads->employer_id = 2; | |
158 | + $ads->is_remove = 1; | |
159 | + $ads->save(); | |
160 | + } | |
161 | + | |
151 | 162 | $employer->delete(); |
152 | 163 | } |
153 | 164 | } finally { |
app/Models/Employer.php
app/Models/User.php
... | ... | @@ -143,4 +143,12 @@ class User extends Authenticatable |
143 | 143 | return $query->where('is_bd', '=', '0'); |
144 | 144 | } |
145 | 145 | |
146 | + public function scopeAdmin($query) { | |
147 | + return $query->where('admin', '=', '1'); | |
148 | + } | |
149 | + | |
150 | + public function scopeNotadmin($query) { | |
151 | + return $query->where('admin', '=', '0'); | |
152 | + } | |
153 | + | |
146 | 154 | } |
database/migrations/2023_10_31_060833_alter_table_employers.php
... | ... | @@ -0,0 +1,32 @@ |
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('employers', function (Blueprint $table) { | |
17 | + $table->string('code', 100)->nullable(false); | |
18 | + }); | |
19 | + } | |
20 | + | |
21 | + /** | |
22 | + * Reverse the migrations. | |
23 | + * | |
24 | + * @return void | |
25 | + */ | |
26 | + public function down() | |
27 | + { | |
28 | + Schema::table('employers', function (Blueprint $table) { | |
29 | + $table->dropColumn('code'); | |
30 | + }); | |
31 | + } | |
32 | +}; |
resources/views/admin/ad_employers/add.blade.php
... | ... | @@ -0,0 +1,104 @@ |
1 | +@extends('layout.admin', ['title' => 'Админка - Добавление вакансии']) | |
2 | + | |
3 | +@section('script') | |
4 | + | |
5 | +@endsection | |
6 | + | |
7 | +@section('content') | |
8 | + <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300"> | |
9 | + Добавление вакансии | |
10 | + </h4> | |
11 | + <form method="POST" action="{{ route('admin.store-ad-employers')}}"> | |
12 | + @csrf | |
13 | + <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"> | |
14 | + <label class="block text-sm"> | |
15 | + <span class="text-gray-700 dark:text-gray-400">Название вакансии</span> | |
16 | + <input name="name" id="name" | |
17 | + 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" | |
18 | + placeholder="Название вакансии" value="{{ old('name') ?? '' }}" | |
19 | + /> | |
20 | + @error('name') | |
21 | + <span class="text-xs text-red-600 dark:text-red-400"> | |
22 | + {{ $message }} | |
23 | + </span> | |
24 | + @enderror | |
25 | + </label> | |
26 | + | |
27 | + <label class="block mt-4 text-sm"> | |
28 | + <span class="text-gray-700 dark:text-gray-400"> | |
29 | + Категории должности | |
30 | + </span> | |
31 | + <select | |
32 | + class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-multiselect focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray" | |
33 | + multiple | |
34 | + name="position_work[]" id="position_work" | |
35 | + > | |
36 | + @foreach($job_titles as $job) | |
37 | + <option value="{{$job->id}}" @if (old('position_work') == $job->id) selected @endif > | |
38 | + {{ $job->name }} ({{$job->id}}) | |
39 | + </option> | |
40 | + @endforeach | |
41 | + </select> | |
42 | + </label><br> | |
43 | + | |
44 | + <label class="block text-sm"> | |
45 | + <span class="text-gray-700 dark:text-gray-400">Текст-описание вакансии</span> | |
46 | + <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 ckeditor" name="text" placeholder="Описание вакансии (text/html)" | |
47 | + rows="10">{{ old('text') ?? '' }}</textarea> | |
48 | + @error('text') | |
49 | + <span class="text-xs text-red-600 dark:text-red-400"> | |
50 | + {{ $message }} | |
51 | + </span> | |
52 | + @enderror | |
53 | + </label> | |
54 | + | |
55 | + <label class="block mt-4 text-sm"> | |
56 | + <span class="text-gray-700 dark:text-gray-400"> | |
57 | + Статус вакансии | |
58 | + </span> | |
59 | + <select | |
60 | + class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-multiselect focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray" | |
61 | + name="status" id="status" | |
62 | + > | |
63 | + <option value="Не задан" @if (old('status') == "Не задан") selected @endif > | |
64 | + Не задан | |
65 | + </option> | |
66 | + <option value="Открыта" @if (old('status') == "Открыта") selected @endif > | |
67 | + Открыта | |
68 | + </option> | |
69 | + <option value="Закрыта" @if (old('status') == "Закрыта") selected @endif > | |
70 | + Закрыта | |
71 | + </option> | |
72 | + </select> | |
73 | + </label><br> | |
74 | + | |
75 | + <label class="block text-sm"> | |
76 | + <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Срочная вакансия</p> | |
77 | + <input type="hidden" name="sroch_vacancy" value="0" /> | |
78 | + <input name="sroch_vacancy" | |
79 | + 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 " | |
80 | + placeholder="" type="checkbox" value="1" | |
81 | + /><br> | |
82 | + | |
83 | + <p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Избранная вакансия</p> | |
84 | + <input type="hidden" name="favorite_vacancy" value="0" /> | |
85 | + <input name="favorite_vacancy" id="favorite_vacancy" | |
86 | + 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 " | |
87 | + placeholder="" type="checkbox" value="1" | |
88 | + /><br> | |
89 | + </label> | |
90 | + | |
91 | + <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4"> | |
92 | + <div> | |
93 | + <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"> | |
94 | + Сохранить | |
95 | + </button> | |
96 | + <a href="{{ route('admin.ad-employers') }}" | |
97 | + 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" | |
98 | + style="display: -webkit-inline-box; height: 30px!important;" | |
99 | + >Назад</a> | |
100 | + </div> | |
101 | + </div> | |
102 | + </div> | |
103 | + </form> | |
104 | +@endsection |
resources/views/admin/ad_employers/edit.blade.php
... | ... | @@ -39,6 +39,17 @@ |
39 | 39 | </option> |
40 | 40 | @endforeach |
41 | 41 | </select> |
42 | + </label><br> | |
43 | + | |
44 | + <label class="block text-sm"> | |
45 | + <span class="text-gray-700 dark:text-gray-400">Текст-описание вакансии</span> | |
46 | + <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 ckeditor" name="text" placeholder="Описание вакансии (text/html)" | |
47 | + rows="10">{{ old('text') ?? $ad_employer->text ?? '' }}</textarea> | |
48 | + @error('text') | |
49 | + <span class="text-xs text-red-600 dark:text-red-400"> | |
50 | + {{ $message }} | |
51 | + </span> | |
52 | + @enderror | |
42 | 53 | </label> |
43 | 54 | |
44 | 55 | <label class="block mt-4 text-sm"> |
resources/views/admin/ad_employers/index.blade.php
... | ... | @@ -62,9 +62,14 @@ |
62 | 62 | </div> |
63 | 63 | </div> |
64 | 64 | |
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"> | |
66 | - Обновить вакансии | |
67 | - </button> | |
65 | + <div> | |
66 | + <button style="margin-bottom: 10px; width:165px; display: inline-block;" 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"> | |
67 | + Обновить вакансии | |
68 | + </button> | |
69 | + <a href="{{ route('admin.add-ad-employers') }}" style="margin-bottom: 10px; width:310px; display: inline-block;" 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"> | |
70 | + Добавить вакансии от администратора | |
71 | + </a> | |
72 | + </div> | |
68 | 73 | <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> |
69 | 74 | <div class="w-full overflow-x-auto"> |
70 | 75 | <table class="w-full whitespace-no-wrap"> |
... | ... | @@ -180,9 +185,12 @@ |
180 | 185 | </td> |
181 | 186 | |
182 | 187 | <td class="px-4 py-3 text-sm class10"> |
183 | - <a href="{{ route('admin.edit-ad-employers', ['ad_employer' => $ad->id]) }}"> | |
184 | - Изменить | |
185 | - </a> | |
188 | + <form action="{{ route('admin.delete-ad-employer', ['ad_employer' => $ad->id]) }}" method="POST"> | |
189 | + <a href="{{ route('admin.edit-ad-employers', ['ad_employer' => $ad->id]) }}">Изменить</a> | | |
190 | + @csrf | |
191 | + @method('DELETE') | |
192 | + <input class="btn btn-danger" type="submit" value="Удалить"/> | |
193 | + </form> | |
186 | 194 | </td> |
187 | 195 | </tr> |
188 | 196 | @endforeach |
resources/views/admin/education/edit.blade.php
1 | 1 | @extends('layout.admin', ['title' => 'Админка - Редактирование образования']) |
2 | 2 | |
3 | 3 | @section('content') |
4 | - <form method="POST" action="{{ route('admin.education.update', ['education' => $education->id]) }}" enctype="multipart/form-data"> | |
5 | - @include('admin.education.form') | |
6 | - </form> | |
4 | + @include('admin.education.form') | |
7 | 5 | @endsection |
resources/views/admin/education/form.blade.php
... | ... | @@ -5,6 +5,7 @@ |
5 | 5 | @endisset |
6 | 6 | |
7 | 7 | <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"> |
8 | + <form method="POST" action="{{ route('admin.education.update', ['education' => $education->id]) }}" enctype="multipart/form-data"> | |
8 | 9 | <label class="block text-sm"> |
9 | 10 | <span class="text-gray-700 dark:text-gray-400">Название учебного заведения</span> |
10 | 11 | <input name="name" id="name" |
... | ... | @@ -59,7 +60,7 @@ |
59 | 60 | |
60 | 61 | <label class="block text-sm"> |
61 | 62 | <span class="text-gray-700 dark:text-gray-400">Текст</span> |
62 | - <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 ckeditor" name="text" placeholder="Текст (html)" required | |
63 | + <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 ckeditor_" name="text" placeholder="Текст (html)" required | |
63 | 64 | rows="10">{{ old('text') ?? $education->text ?? '' }}</textarea> |
64 | 65 | @error('text') |
65 | 66 | <span class="text-xs text-red-600 dark:text-red-400"> |
... | ... | @@ -84,66 +85,6 @@ |
84 | 85 | @endisset |
85 | 86 | </label><br> |
86 | 87 | |
87 | - | |
88 | - @isset($education) | |
89 | - <div class="tabs"> | |
90 | - <input type="radio" name="tab-btn" id="tab-btn-1" value="" checked> | |
91 | - <label for="tab-btn-1">Высшее образование</label> | |
92 | - <input type="radio" name="tab-btn" id="tab-btn-2" value=""> | |
93 | - <label for="tab-btn-2">Средне-профессиональное образование</label> | |
94 | - <input type="radio" name="tab-btn" id="tab-btn-3" value=""> | |
95 | - <label for="tab-btn-3">Дополнительное образование</label> | |
96 | - <div id="content-1"> | |
97 | - <a id="add1" 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" | |
98 | - href="{{ route('admin.add-program-education', ['education' => $education->id, 'level' => 1]) }}" | |
99 | - >Добавить специализацию</a><br> | |
100 | - @if ((isset($program1)) && ($program1->count())) | |
101 | - @foreach ($program1 as $prog1) | |
102 | - <hr> | |
103 | - <label class="block text-sm"> | |
104 | - <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">Специальность: {{$prog1->name}}</h4> | |
105 | - <span class="text-gray-700 dark:text-gray-400">Описание: {{$prog1->text}}</span> | |
106 | - </label><br> | |
107 | - @endforeach | |
108 | - @else | |
109 | - <span class="text-gray-700 dark:text-gray-400">Нет записей</span> | |
110 | - @endif | |
111 | - </div> | |
112 | - <div id="content-2"> | |
113 | - <a id="add2" 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" | |
114 | - href="{{ route('admin.add-program-education', ['education' => $education->id, 'level' => 2]) }}" | |
115 | - >Добавить специализацию</a><br> | |
116 | - @if ((isset($program2)) && ($program2->count())) | |
117 | - @foreach ($program2 as $prog2) | |
118 | - <hr> | |
119 | - <label class="block text-sm"> | |
120 | - <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">Специальность: {{$prog2->name}}</h4> | |
121 | - <span class="text-gray-700 dark:text-gray-400">Описание: {{$prog2->text}}</span> | |
122 | - </label><br> | |
123 | - @endforeach | |
124 | - @else | |
125 | - <span class="text-gray-700 dark:text-gray-400">Нет записей</span> | |
126 | - @endif | |
127 | - </div> | |
128 | - <div id="content-3"> | |
129 | - <a id="add3" 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" | |
130 | - href="{{ route('admin.add-program-education', ['education' => $education->id, 'level' => 3]) }}" | |
131 | - >Добавить специализацию</a><br> | |
132 | - @if ((isset($program3)) && ($program3->count())) | |
133 | - @foreach ($program3 as $prog3) | |
134 | - <hr> | |
135 | - <label class="block text-sm"> | |
136 | - <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">Специальность: {{$prog3->name}}</h4> | |
137 | - <span class="text-gray-700 dark:text-gray-400">Описание: {{$prog3->text}}</span> | |
138 | - </label><br> | |
139 | - @endforeach | |
140 | - @else | |
141 | - <span class="text-gray-700 dark:text-gray-400">Нет записей</span> | |
142 | - @endif | |
143 | - </div> | |
144 | - </div><br> | |
145 | - @endisset | |
146 | - | |
147 | 88 | <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4"> |
148 | 89 | <div> |
149 | 90 | <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"> |
... | ... | @@ -155,6 +96,58 @@ |
155 | 96 | >Назад</a> |
156 | 97 | </div> |
157 | 98 | </div> |
99 | + </form> | |
100 | + | |
101 | + @isset($education) | |
102 | + <hr> | |
103 | + <form method="GET" action="{{ route('admin.add-program-education') }}"> | |
104 | + <label class="block text-sm"> | |
105 | + <span class="text-gray-700 dark:text-gray-400">Категория образования</span> | |
106 | + <input type="hidden" name="id" value="{{ $education->id }}"/> | |
107 | + <input name="level" id="level" | |
108 | + 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" | |
109 | + placeholder="Новое образование" value="" | |
110 | + /><br> | |
111 | + <button type="submit" id="btn_education" name="btn_education" 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"> | |
112 | + Добавить | |
113 | + </button> | |
114 | + </label><br> | |
115 | + </form> | |
116 | + <hr> | |
117 | + @if ($program->count()) | |
118 | + @php $bool = true; | |
119 | + $i = 1; | |
120 | + $level = ""; | |
121 | + @endphp | |
122 | + | |
123 | + @foreach ($program as $pro) | |
124 | + @if ((!empty($level)) && ($level <> $pro->level )) | |
125 | + </div> | |
126 | + </div><br> | |
127 | + @php $bool = true; $i++; @endphp | |
128 | + @endif | |
129 | + @if ($bool == true) | |
130 | + <div class="tabs"> | |
131 | + <input type="radio" name="tab-btn" id="tab-btn-{{$i}}" value="" checked> | |
132 | + <label for="tab-btn-{{$i}}">{{ $pro->level }}</label> | |
133 | + <div id="content-{{$i}}"> | |
134 | + | |
135 | + @php $bool = false; | |
136 | + $level = $pro->level; | |
137 | + @endphp | |
138 | + @endif | |
139 | + <label class="block text-sm"> | |
140 | + <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300">Специальность: {{$pro->name}}</h4> | |
141 | + <span class="text-gray-700 dark:text-gray-400">Описание: {{$pro->text}}</span> | |
142 | + </label><br><hr> | |
143 | + @endforeach | |
144 | + </div> | |
145 | + </div><br> | |
146 | + @else | |
147 | + <span class="text-gray-700 dark:text-gray-400">Нет записей</span> | |
148 | + @endif | |
149 | + @endisset | |
150 | + | |
158 | 151 | </div> |
159 | 152 | <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script> |
160 | 153 |
resources/views/admin/employer/index.blade.php
... | ... | @@ -43,7 +43,7 @@ |
43 | 43 | console.log('click button'); |
44 | 44 | let id = e.target.id; |
45 | 45 | let form = document.getElementById("form_modal_del"); |
46 | - form.action = "<?=$_SERVER['APP_URL']?>admin/employers/delete/"+e.target.getAttribute('data-employer')+'/'+e.target.getAttribute('data-user'); | |
46 | + form.action = "<?=$_SERVER['APP_URL']?>public/admin/employers/delete/"+e.target.getAttribute('data-employer')+'/'+e.target.getAttribute('data-user'); | |
47 | 47 | //document.getElementById("title_modal").innerHTML = id; |
48 | 48 | console.log(e.target.getAttribute('data-employer')); |
49 | 49 | console.log(e.target.getAttribute('data-user')); |
... | ... | @@ -160,8 +160,9 @@ |
160 | 160 | </td> |
161 | 161 | <td class="px-4 py-3 text-sm"> |
162 | 162 | @if (!empty($user->emp_id)) |
163 | - <a href="{{ route('admin.employer-profile', ['employer' => $user->emp_id]) }}">Изменить</a> | | |
164 | - <a @click="openModal" style="cursor: pointer;" data-employer="{{$user->emp_id}}" data-user="{{$user->user_id}}" class="btn_del btn btn-danger">Удалить</a> | |
163 | + <a href="{{ route('admin.employer-profile', ['employer' => $user->emp_id]) }}">Изменить</a> | |
164 | + @if ($user->emp_id > 2) | <a @click="openModal" style="cursor: pointer;" data-employer="{{$user->emp_id}}" data-user="{{$user->user_id}}" class="btn_del btn btn-danger">Удалить</a> | |
165 | + @endif | |
165 | 166 | @endif |
166 | 167 | </td> |
167 | 168 | <!--<td class="px-4 py-3 text-sm"> |
resources/views/admin/register.blade.php
... | ... | @@ -22,7 +22,13 @@ |
22 | 22 | Создание аккаунта администратора |
23 | 23 | </h1> |
24 | 24 | <form method="POST" action="{{ route('admin.create') }}"> |
25 | - @csrf | |
25 | + @csrf | |
26 | + | |
27 | + <input type="hidden" id="code_emp" name="code_emp" | |
28 | + 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" | |
29 | + placeholder="" value="{{ $code_emp }}" | |
30 | + /> | |
31 | + | |
26 | 32 | <label class="block text-sm"> |
27 | 33 | <span class="text-gray-700 dark:text-gray-400">Имя</span> |
28 | 34 | <input id="name" name="name" |
resources/views/admin/users/index.blade.php
... | ... | @@ -63,7 +63,7 @@ |
63 | 63 | @if ($id_admin == 1) |
64 | 64 | <th class="px-4 py-3">Админ</th> |
65 | 65 | @endif |
66 | - <th class="px-4 py-3">Дата регистрации</th> | |
66 | + <th class="px-4 py-3">Дата регист.</th> | |
67 | 67 | </tr> |
68 | 68 | </thead> |
69 | 69 | <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> |
routes/web.php
... | ... | @@ -115,9 +115,9 @@ Route::group([ |
115 | 115 | ], function () { |
116 | 116 | // Форма регистрации |
117 | 117 | Route::get('register', [AdminController::class, 'register'])->name('register'); |
118 | - | |
119 | 118 | // Создание пользователя |
120 | 119 | Route::post('register', [AdminController::class, 'create'])->name('create'); |
120 | + | |
121 | 121 | //Форма входа |
122 | 122 | Route::get('login', [AdminController::class, 'login'])->name('login'); |
123 | 123 | |
... | ... | @@ -207,8 +207,11 @@ Route::group([ |
207 | 207 | |
208 | 208 | // кабинет - вакансии |
209 | 209 | Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers'); |
210 | + Route::get('ad-employers/add', [Ad_EmployersController::class, 'create'])->name('add-ad-employers'); | |
211 | + Route::post('ad-employers/add', [Ad_EmployersController::class, 'store'])->name('store-ad-employers'); | |
210 | 212 | Route::get('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'edit'])->name('edit-ad-employers'); |
211 | 213 | Route::post('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'update'])->name('update-ad-employers'); |
214 | + Route::delete('ad-employers/delete/{ad_employer}', [Ad_EmployersController::class, 'destroy'])->name('delete-ad-employer'); | |
212 | 215 | |
213 | 216 | // кабинет - категории |
214 | 217 | //Route::get('categories', [AdminController::class, 'index'])->name('categories'); |
... | ... | @@ -223,7 +226,7 @@ Route::group([ |
223 | 226 | // CRUD-операции над справочником Образование |
224 | 227 | Route::resource('education', EducationController::class, ['except' => ['show']]); |
225 | 228 | |
226 | - Route::get('program-education/{education}/{level}', [EducationController::class, 'add_program'])->name('add-program-education'); | |
229 | + Route::get('program-education', [EducationController::class, 'add_program'])->name('add-program-education'); | |
227 | 230 | Route::post('program-education', [EducationController::class, 'store_program'])->name('store-program-education'); |
228 | 231 | |
229 | 232 | //Route::get('job-titles', [AdminController::class, 'index'])->name('job-titles'); |