Commit 4c66e360c8ab112cedffb80e98ca9bc10c18c0d4
1 parent
5f2a2635a1
Exists in
master
and in
1 other branch
Справочник документы и ajax-подгрузка пользователей в группах
Showing 20 changed files with 572 additions and 25 deletions Side-by-side Diff
- app/Http/Controllers/Admin/GroupsController.php
- app/Http/Controllers/Admin/InfoBloksController.php
- app/Http/Controllers/Admin/WorkersController.php
- app/Models/infobloks.php
- database/migrations/2023_09_08_092903_alter_infobloks_table.php
- resources/views/admin/editor/index.blade.php
- resources/views/admin/groups/add.blade.php
- resources/views/admin/groups/ajax.blade.php
- resources/views/admin/groups/ajax_add.blade.php
- resources/views/admin/groups/edit.blade.php
- resources/views/admin/groups/form.blade.php
- resources/views/admin/groups/script.blade.php
- resources/views/admin/index.blade.php
- resources/views/admin/infobloks/add.blade.php
- resources/views/admin/infobloks/edit.blade.php
- resources/views/admin/infobloks/form.blade.php
- resources/views/admin/infobloks/index.blade.php
- resources/views/admin/job_titles/index.blade.php
- resources/views/layout/admin.blade.php
- routes/web.php
app/Http/Controllers/Admin/GroupsController.php
... | ... | @@ -4,13 +4,17 @@ namespace App\Http\Controllers\Admin; |
4 | 4 | |
5 | 5 | use App\Http\Controllers\Controller; |
6 | 6 | use App\Models\Group_user; |
7 | +use App\Models\Group_works; | |
7 | 8 | use App\Models\User; |
9 | +use Illuminate\Database\Eloquent\Model; | |
8 | 10 | use Illuminate\Http\Request; |
9 | 11 | use Illuminate\Support\Facades\Auth; |
10 | 12 | use Illuminate\Support\Facades\Validator; |
11 | 13 | |
12 | 14 | class GroupsController extends Controller |
13 | 15 | { |
16 | + public $limit = 15; | |
17 | + | |
14 | 18 | // индексная страница |
15 | 19 | public function index() { |
16 | 20 | $groups = Group_user::query()->active()->paginate(15); |
... | ... | @@ -18,10 +22,26 @@ class GroupsController extends Controller |
18 | 22 | } |
19 | 23 | |
20 | 24 | // форма добавления группы |
21 | - public function add() { | |
22 | - $editor = Auth::user()->id; | |
23 | - $users = User::query()->get(); | |
24 | - return view('admin.groups.add', compact('editor', 'users')); | |
25 | + public function add(Request $request) { | |
26 | + /*$editor = Auth::user()->id; | |
27 | + $users = User::query()->active()->Offset(0)->limit($this->limit)->get(); | |
28 | + return view('admin.groups.add', compact('editor', 'users'));*/ | |
29 | + $hide = false; | |
30 | + $total = User::query()->active()->count(); | |
31 | + $amt = ceil($total / $this->limit); | |
32 | + if ($this->limit >= $total) $hide = true; | |
33 | + if ($request->ajax()) { | |
34 | + $page = intval($request->page); | |
35 | + $page = (empty($page)) ? 1 : $page; | |
36 | + $start = ($page != 1) ? $page * $this->limit - $this->limit : 0; | |
37 | + $users = User::query()->active()->Offset($start)->limit($this->limit)->get(); | |
38 | + return view('admin.groups.ajax_add', compact('users', 'amt')); | |
39 | + | |
40 | + } else { | |
41 | + $editor = Auth::user()->id; | |
42 | + $users = User::query()->active()->Offset(0)->limit($this->limit)->get(); | |
43 | + return view('admin.groups.add', compact('editor', 'users', 'amt', 'hide')); | |
44 | + } | |
25 | 45 | } |
26 | 46 | |
27 | 47 | // форма сохранения добавленной группы |
... | ... | @@ -38,7 +58,13 @@ class GroupsController extends Controller |
38 | 58 | return redirect()->route('admin.add-group') |
39 | 59 | ->withErrors($validator); |
40 | 60 | } else { |
41 | - Group_user::create($request->all()); | |
61 | + $id_group = Group_user::create($request->all())->id; | |
62 | + foreach ($request->usergroup as $user) { | |
63 | + $people = new Group_works(); | |
64 | + $people->group_user_id = $id_group; | |
65 | + $people->user_id = $user; | |
66 | + $people->save(); | |
67 | + } | |
42 | 68 | return redirect()->route('admin.groups') |
43 | 69 | ->with('success', 'Данные были успешно сохранены'); |
44 | 70 | } |
... | ... | @@ -47,14 +73,28 @@ class GroupsController extends Controller |
47 | 73 | |
48 | 74 | // форма редактирования группы |
49 | 75 | public function edit(Group_user $group, Request $request) { |
50 | - $editor = Auth::user()->id; | |
51 | - $users = User::query()->get(); | |
52 | - return view('admin.groups.edit', compact('editor', 'group', 'users')); | |
76 | + //https://snipp.ru/php/loading-scrolling | |
77 | + $hide = false; | |
78 | + $total = User::query()->active()->count(); | |
79 | + $amt = ceil($total / $this->limit); | |
80 | + if ($this->limit >= $total) $hide = true; | |
81 | + | |
82 | + if ($request->ajax()) { | |
83 | + $page = intval($request->page); | |
84 | + $page = (empty($page)) ? 1 : $page; | |
85 | + $start = ($page != 1) ? $page * $this->limit - $this->limit : 0; | |
86 | + $users = User::query()->active()->Offset($start)->limit($this->limit)->get(); | |
87 | + return view('admin.groups.ajax', compact('users', 'group', 'amt')); | |
88 | + | |
89 | + } else { | |
90 | + $editor = Auth::user()->id; | |
91 | + $users = User::query()->active()->Offset(0)->limit($this->limit)->get(); | |
92 | + return view('admin.groups.edit', compact('editor', 'group', 'users', 'amt', 'hide')); | |
93 | + } | |
53 | 94 | } |
54 | 95 | |
55 | 96 | // форма сохранения редактированной группы |
56 | 97 | public function update(Group_user $group, Request $request) { |
57 | - | |
58 | 98 | $params = $request->all(); |
59 | 99 | unset($params['usergroup']); |
60 | 100 | $rules = [ |
app/Http/Controllers/Admin/InfoBloksController.php
... | ... | @@ -0,0 +1,90 @@ |
1 | +<?php | |
2 | + | |
3 | +namespace App\Http\Controllers\Admin; | |
4 | + | |
5 | +use App\Http\Controllers\Controller; | |
6 | +use App\Models\infobloks; | |
7 | +use Illuminate\Http\Request; | |
8 | + | |
9 | +class InfoBloksController extends Controller | |
10 | +{ | |
11 | + /** | |
12 | + * Display a listing of the resource. | |
13 | + * | |
14 | + * @return \Illuminate\Http\Response | |
15 | + */ | |
16 | + public function index() | |
17 | + { | |
18 | + $infobloks = infobloks::query()->active()->orderByDesc('sort')->orderBy('name')->paginate(15); | |
19 | + return view('admin.infobloks.index', compact('infobloks')); | |
20 | + } | |
21 | + | |
22 | + /** | |
23 | + * Show the form for creating a new resource. | |
24 | + * | |
25 | + * @return \Illuminate\Http\Response | |
26 | + */ | |
27 | + public function create() | |
28 | + { | |
29 | + return view('admin.infobloks.add'); | |
30 | + } | |
31 | + | |
32 | + /** | |
33 | + * Store a newly created resource in storage. | |
34 | + * | |
35 | + * @param \Illuminate\Http\Request $request | |
36 | + * @return \Illuminate\Http\Response | |
37 | + */ | |
38 | + public function store(Request $request) | |
39 | + { | |
40 | + infobloks::create($request->all()); | |
41 | + return redirect()->route('admin.infobloks.index'); | |
42 | + } | |
43 | + | |
44 | + /** | |
45 | + * Display the specified resource. | |
46 | + * | |
47 | + * @param \App\Models\infobloks $infobloks | |
48 | + * @return \Illuminate\Http\Response | |
49 | + */ | |
50 | + public function show(infobloks $infobloks) | |
51 | + { | |
52 | + // | |
53 | + } | |
54 | + | |
55 | + /** | |
56 | + * Show the form for editing the specified resource. | |
57 | + * | |
58 | + * @param \App\Models\infobloks $infoblok | |
59 | + * @return \Illuminate\Http\Response | |
60 | + */ | |
61 | + public function edit(infobloks $infoblok) | |
62 | + { | |
63 | + return view('admin.infobloks.edit', compact('infoblok')); | |
64 | + } | |
65 | + | |
66 | + /** | |
67 | + * Update the specified resource in storage. | |
68 | + * | |
69 | + * @param \Illuminate\Http\Request $request | |
70 | + * @param \App\Models\infobloks $infobloks | |
71 | + * @return \Illuminate\Http\Response | |
72 | + */ | |
73 | + public function update(Request $request, infobloks $infoblok) | |
74 | + { | |
75 | + $infoblok->update($request->all()); | |
76 | + return redirect()->route('admin.infobloks.index'); | |
77 | + } | |
78 | + | |
79 | + /** | |
80 | + * Remove the specified resource from storage. | |
81 | + * | |
82 | + * @param \App\Models\infobloks $infobloks | |
83 | + * @return \Illuminate\Http\Response | |
84 | + */ | |
85 | + public function destroy(infobloks $infoblok) | |
86 | + { | |
87 | + $infoblok->update(['is_remove' => 1]); | |
88 | + return redirect()->route('admin.infobloks.index'); | |
89 | + } | |
90 | +} |
app/Http/Controllers/Admin/WorkersController.php
app/Models/infobloks.php
... | ... | @@ -8,4 +8,14 @@ use Illuminate\Database\Eloquent\Model; |
8 | 8 | class infobloks extends Model |
9 | 9 | { |
10 | 10 | use HasFactory; |
11 | + | |
12 | + protected $fillable = [ | |
13 | + 'name', | |
14 | + 'is_remove', | |
15 | + 'sort', | |
16 | + ]; | |
17 | + | |
18 | + public function ScopeActive($query) { | |
19 | + return $query->where('is_remove', '=', '0'); | |
20 | + } | |
11 | 21 | } |
database/migrations/2023_09_08_092903_alter_infobloks_table.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('infobloks', function (Blueprint $table) { | |
17 | + $table->integer('sort')->default(100); | |
18 | + }); | |
19 | + } | |
20 | + | |
21 | + /** | |
22 | + * Reverse the migrations. | |
23 | + * | |
24 | + * @return void | |
25 | + */ | |
26 | + public function down() | |
27 | + { | |
28 | + Schema::table('infobloks', function (Blueprint $table) { | |
29 | + $table->dropColumn('sort'); | |
30 | + }); | |
31 | + } | |
32 | +}; |
resources/views/admin/editor/index.blade.php
... | ... | @@ -0,0 +1,149 @@ |
1 | +@extends('layout.admin', ['title' => 'Админка - Редактор сайта']) | |
2 | + | |
3 | +@section('content') | |
4 | + | |
5 | + <!-- Таблицы --> | |
6 | + <div class="w-full overflow-hidden rounded-lg shadow-xs"> | |
7 | + <div class="w-full overflow-x-auto"> | |
8 | + <table class="w-full whitespace-no-wrap"> | |
9 | + <thead> | |
10 | + <tr | |
11 | + 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" | |
12 | + > | |
13 | + <th class="px-4 py-3">Название</th> | |
14 | + <th class="px-4 py-3">Ссылка</th> | |
15 | + </tr> | |
16 | + </thead> | |
17 | + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> | |
18 | + <tr class="text-gray-700 dark:text-gray-400"> | |
19 | + <td class="px-4 py-3"> | |
20 | + <div class="flex items-center text-sm"> | |
21 | + <div class="relative hidden w-8 h-8 mr-3 rounded-full md:block"> | |
22 | + <div | |
23 | + class="absolute inset-0 rounded-full shadow-inner" | |
24 | + aria-hidden="true" | |
25 | + ></div> | |
26 | + </div> | |
27 | + <div> | |
28 | + <p class="font-semibold">Шапка-футер сайта</p> | |
29 | + <p class="text-xs text-gray-600 dark:text-gray-400"> | |
30 | + Редактор шапки и подвала сайта | |
31 | + </p> | |
32 | + </div> | |
33 | + </div> | |
34 | + </td> | |
35 | + <td class="px-4 py-3 text-sm"> | |
36 | + <a href="{{ route('admin.edit-blocks') }}">Ссылка</a> | |
37 | + </td> | |
38 | + </tr> | |
39 | + <tr class="text-gray-700 dark:text-gray-400"> | |
40 | + <td class="px-4 py-3"> | |
41 | + <div class="flex items-center text-sm"> | |
42 | + <div class="relative hidden w-8 h-8 mr-3 rounded-full md:block"> | |
43 | + <div | |
44 | + class="absolute inset-0 rounded-full shadow-inner" | |
45 | + aria-hidden="true" | |
46 | + ></div> | |
47 | + </div> | |
48 | + <div> | |
49 | + <p class="font-semibold">Реклама</p> | |
50 | + <p class="text-xs text-gray-600 dark:text-gray-400"> | |
51 | + Рекламные объявления сайта | |
52 | + </p> | |
53 | + </div> | |
54 | + </div> | |
55 | + </td> | |
56 | + <td class="px-4 py-3 text-sm"> | |
57 | + <a href="{{ route('admin.reclames') }}">Ссылка</a> | |
58 | + </td> | |
59 | + </tr> | |
60 | + <tr class="text-gray-700 dark:text-gray-400"> | |
61 | + <td class="px-4 py-3"> | |
62 | + <div class="flex items-center text-sm"> | |
63 | + <div class="relative hidden w-8 h-8 mr-3 rounded-full md:block"> | |
64 | + <div | |
65 | + class="absolute inset-0 rounded-full shadow-inner" | |
66 | + aria-hidden="true" | |
67 | + ></div> | |
68 | + </div> | |
69 | + <div> | |
70 | + <p class="font-semibold">SEO-сайта</p> | |
71 | + <p class="text-xs text-gray-600 dark:text-gray-400"> | |
72 | + Расширенные возможности seo для отдельных страниц сайта | |
73 | + </p> | |
74 | + </div> | |
75 | + </div> | |
76 | + </td> | |
77 | + <td class="px-4 py-3 text-sm"> | |
78 | + <a href="{{ route('admin.editor-seo') }}">Ссылка</a> | |
79 | + </td> | |
80 | + </tr> | |
81 | + <tr class="text-gray-700 dark:text-gray-400"> | |
82 | + <td class="px-4 py-3"> | |
83 | + <div class="flex items-center text-sm"> | |
84 | + <div class="relative hidden w-8 h-8 mr-3 rounded-full md:block"> | |
85 | + <div | |
86 | + class="absolute inset-0 rounded-full shadow-inner" | |
87 | + aria-hidden="true" | |
88 | + ></div> | |
89 | + </div> | |
90 | + <div> | |
91 | + <p class="font-semibold">Редактор страниц</p> | |
92 | + <p class="text-xs text-gray-600 dark:text-gray-400"> | |
93 | + Создание и изменение страниц с произвольным содержанием | |
94 | + </p> | |
95 | + </div> | |
96 | + </div> | |
97 | + </td> | |
98 | + <td class="px-4 py-3 text-sm"> | |
99 | + <a href="{{ route('admin.editor-pages') }}">Ссылка</a> | |
100 | + </td> | |
101 | + </tr> | |
102 | + <tr class="text-gray-700 dark:text-gray-400"> | |
103 | + <td class="px-4 py-3"> | |
104 | + <div class="flex items-center text-sm"> | |
105 | + <div class="relative hidden w-8 h-8 mr-3 rounded-full md:block"> | |
106 | + <div | |
107 | + class="absolute inset-0 rounded-full shadow-inner" | |
108 | + aria-hidden="true" | |
109 | + ></div> | |
110 | + </div> | |
111 | + <div> | |
112 | + <p class="font-semibold">Должности на главной</p> | |
113 | + <p class="text-xs text-gray-600 dark:text-gray-400"> | |
114 | + Вывод некоторых актуальных должностей на главной странице | |
115 | + </p> | |
116 | + </div> | |
117 | + </div> | |
118 | + </td> | |
119 | + <td class="px-4 py-3 text-sm"> | |
120 | + <a href="{{ route('admin.job-titles-main') }}">Ссылка</a> | |
121 | + </td> | |
122 | + </tr> | |
123 | + <tr class="text-gray-700 dark:text-gray-400"> | |
124 | + <td class="px-4 py-3"> | |
125 | + <div class="flex items-center text-sm"> | |
126 | + <div class="relative hidden w-8 h-8 mr-3 rounded-full md:block"> | |
127 | + <div | |
128 | + class="absolute inset-0 rounded-full shadow-inner" | |
129 | + aria-hidden="true" | |
130 | + ></div> | |
131 | + </div> | |
132 | + <div> | |
133 | + <p class="font-semibold">Работодатели на главной</p> | |
134 | + <p class="text-xs text-gray-600 dark:text-gray-400"> | |
135 | + Вывод некоторых актуальных работодателей на главной странице | |
136 | + </p> | |
137 | + </div> | |
138 | + </div> | |
139 | + </td> | |
140 | + <td class="px-4 py-3 text-sm"> | |
141 | + <a href="{{ route('admin.employers-main') }}">Ссылка</a> | |
142 | + </td> | |
143 | + </tr> | |
144 | + | |
145 | + </tbody> | |
146 | + </table> | |
147 | + </div> | |
148 | + </div> | |
149 | +@endsection |
resources/views/admin/groups/add.blade.php
resources/views/admin/groups/ajax.blade.php
... | ... | @@ -0,0 +1,14 @@ |
1 | +@foreach($users as $user) | |
2 | + <tr class="text-gray-700 dark:text-gray-400"> | |
3 | + <td class="px-4 py-3"> | |
4 | + {{$user->id}} | |
5 | + </td> | |
6 | + <td class="px-4 py-3"> | |
7 | + {{$user->name}} | |
8 | + </td> | |
9 | + <td class="px-4 py-3"> | |
10 | + <input type="checkbox" id="user{{$user->id}}" name="usergroup[]" value="{{$user->id}}" <?php if ($user->ingroup->contains('id', $group->id)) {?>checked<? }?>/> | |
11 | + </td> | |
12 | + </tr> | |
13 | +@endforeach | |
14 | + |
resources/views/admin/groups/ajax_add.blade.php
... | ... | @@ -0,0 +1,14 @@ |
1 | +@foreach($users as $user) | |
2 | + <tr class="text-gray-700 dark:text-gray-400"> | |
3 | + <td class="px-4 py-3"> | |
4 | + {{$user->id}} | |
5 | + </td> | |
6 | + <td class="px-4 py-3"> | |
7 | + {{$user->name}} | |
8 | + </td> | |
9 | + <td class="px-4 py-3"> | |
10 | + <input type="checkbox" id="user{{$user->id}}" name="usergroup[]" value="{{$user->id}}"/> | |
11 | + </td> | |
12 | + </tr> | |
13 | +@endforeach | |
14 | + |
resources/views/admin/groups/edit.blade.php
resources/views/admin/groups/form.blade.php
... | ... | @@ -24,7 +24,8 @@ |
24 | 24 | <label class="block text-sm"> |
25 | 25 | <span class="text-gray-700 dark:text-gray-400">Пользователи системы</span> |
26 | 26 | </label> |
27 | - <table class="w-full whitespace-no-wrap"> | |
27 | + <div> | |
28 | + <table class="w-full whitespace-no-wrap" > | |
28 | 29 | <thead> |
29 | 30 | <tr |
30 | 31 | 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" |
... | ... | @@ -34,9 +35,9 @@ |
34 | 35 | <th class="px-4 py-3">Добавленные в группу</th> |
35 | 36 | </tr> |
36 | 37 | </thead> |
37 | - <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> | |
38 | + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800" id="showmore-list"> | |
38 | 39 | @foreach($users as $user) |
39 | - <tr class="text-gray-700 dark:text-gray-400"> | |
40 | + <tr class="text-gray-700 dark:text-gray-400" > | |
40 | 41 | <td class="px-4 py-3"> |
41 | 42 | {{$user->id}} |
42 | 43 | </td> |
... | ... | @@ -44,14 +45,21 @@ |
44 | 45 | {{$user->name}} |
45 | 46 | </td> |
46 | 47 | <td class="px-4 py-3"> |
47 | - <input type="checkbox" id="user{{$user->id}}" name="usergroup[]" value="{{$user->id}}" <?php if ($user->ingroup->contains('id', $group->id)) {?>checked<? }?>/> | |
48 | - <pre><? //print_r($user->ingroup->id);?></pre> | |
48 | + <input type="checkbox" id="user{{$user->id}}" name="usergroup[]" value="{{$user->id}}" @isset($group) <?php if ($user->ingroup->contains('id', $group->id)) {?>checked<? }?> @endisset/> | |
49 | 49 | </td> |
50 | 50 | </tr> |
51 | 51 | @endforeach |
52 | 52 | </tbody> |
53 | 53 | </table> |
54 | - | |
55 | - | |
54 | + </div> | |
55 | + @if (!$hide) | |
56 | + <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4"> | |
57 | + <div> | |
58 | + <a id="showmore-triger" data-page="1" data-max="{{ $amt }}" 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 center"> | |
59 | + Погрузить пользователей | |
60 | + </a> | |
61 | + </div> | |
62 | + </div> | |
63 | + @endif | |
56 | 64 | </div> |
57 | 65 |
resources/views/admin/groups/script.blade.php
... | ... | @@ -0,0 +1,43 @@ |
1 | +<script> | |
2 | +$(document).ready(function() { | |
3 | + console.log('load script...'); | |
4 | + var block_show = false; | |
5 | + | |
6 | + function scrollMore() { | |
7 | + var $target = $('#showmore-triger'); | |
8 | + | |
9 | + if (block_show) { | |
10 | + return false; | |
11 | + } | |
12 | + | |
13 | + console.log('function ScrollMore'); | |
14 | + | |
15 | + if (true) { | |
16 | + var page = $target.attr('data-page'); | |
17 | + page++; | |
18 | + block_show = true; | |
19 | + | |
20 | + $.ajax({ | |
21 | + type: "GET", | |
22 | + url: "{{ url()->full()}}", | |
23 | + data: "page=" + page, | |
24 | + dataType: 'html', | |
25 | + success: function (data) { | |
26 | + $('#showmore-list').append(data); | |
27 | + block_show = false; | |
28 | + } | |
29 | + }); | |
30 | + | |
31 | + $target.attr('data-page', page); | |
32 | + if (page == $target.attr('data-max')) { | |
33 | + $target.remove(); | |
34 | + } | |
35 | + } | |
36 | + } | |
37 | + | |
38 | + $(document).on('click', '#showmore-triger', function () { | |
39 | + console.log('click paginate...'); | |
40 | + scrollMore(); | |
41 | + }); | |
42 | +}); | |
43 | +</script> |
resources/views/admin/index.blade.php
... | ... | @@ -268,7 +268,7 @@ |
268 | 268 | <div class="absolute inset-0 rounded-full shadow-inner" aria-hidden="true"></div> |
269 | 269 | </div> |
270 | 270 | <div> |
271 | - <p class="font-semibold"><a href="{{ route('admin.infobloks') }}">Документы-Дипломы</a></p> | |
271 | + <p class="font-semibold"><a href="{{ route('admin.infobloks.index') }}">Документы-Дипломы</a></p> | |
272 | 272 | <p class="text-xs text-gray-600 dark:text-gray-400"> |
273 | 273 | Справочник документы-дипломы (все блоки-документы необходимые соискателю) |
274 | 274 | </p> |
resources/views/admin/infobloks/add.blade.php
... | ... | @@ -0,0 +1,11 @@ |
1 | +@extends('layout.admin', ['title' => 'Админка - Добавление документа-диплома']) | |
2 | + | |
3 | +@section('content') | |
4 | + <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300"> | |
5 | + Добавление документа-диплома | |
6 | + </h4> | |
7 | + <form method="POST" action="{{ route('admin.infobloks.store') }}"> | |
8 | + @csrf | |
9 | + @include('admin.infobloks.form') | |
10 | + </form> | |
11 | +@endsection |
resources/views/admin/infobloks/edit.blade.php
... | ... | @@ -0,0 +1,15 @@ |
1 | +@extends('layout.admin', ['title' => 'Админка - Редактирование документа-диплома']) | |
2 | + | |
3 | +@section('content') | |
4 | + <h4 class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300"> | |
5 | + Редактирование документа-диплома | |
6 | + </h4> | |
7 | + <form method="POST" action="{{ route('admin.infobloks.update', ['infoblok' => $infoblok->id]) }}"> | |
8 | + @csrf | |
9 | + @isset($infoblok) | |
10 | + @method('PUT') | |
11 | + @endisset | |
12 | + | |
13 | + @include('admin.infobloks.form') | |
14 | + </form> | |
15 | +@endsection |
resources/views/admin/infobloks/form.blade.php
... | ... | @@ -0,0 +1,22 @@ |
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"> | |
3 | + <span class="text-gray-700 dark:text-gray-400">Название документа-диплома</span> | |
4 | + <input name="name" id="name" | |
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" | |
6 | + placeholder="Название документа-диплома" value="{{ old('name') ?? $infoblok->name ?? '' }}" | |
7 | + /> | |
8 | + @error('name') | |
9 | + <span class="text-xs text-red-600 dark:text-red-400"> | |
10 | + {{ $message }} | |
11 | + </span> | |
12 | + @enderror | |
13 | + </label><br> | |
14 | + | |
15 | + <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4"> | |
16 | + <div> | |
17 | + <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"> | |
18 | + Сохранить | |
19 | + </button> | |
20 | + </div> | |
21 | + </div> | |
22 | +</div> |
resources/views/admin/infobloks/index.blade.php
... | ... | @@ -0,0 +1,84 @@ |
1 | +@extends('layout.admin', ['title' => 'Админка - Справочник Дипломы-Документы']) | |
2 | + | |
3 | +@section('script') | |
4 | +@endsection | |
5 | + | |
6 | +@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>--> | |
33 | +@endsection | |
34 | + | |
35 | +@section('content') | |
36 | + <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> | |
37 | + <div class="w-full overflow-x-auto"> | |
38 | + <a 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" href="{{ route('admin.infobloks.create') }}">Создать стандарт документа</a><br><br> | |
39 | + <table class="w-full whitespace-no-wrap"> | |
40 | + <thead> | |
41 | + <tr | |
42 | + 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" | |
43 | + > | |
44 | + <th class="px-4 py-3">№</th> | |
45 | + <th class="px-4 py-3">Название документа</th> | |
46 | + <th class="px-4 py-3">Сортировка</th> | |
47 | + <th class="px-4 py-3">Дата создания</th> | |
48 | + <th class="px-4 py-3">Изменить</th> | |
49 | + </tr> | |
50 | + </thead> | |
51 | + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> | |
52 | + @foreach($infobloks as $blok) | |
53 | + <tr class="text-gray-700 dark:text-gray-400"> | |
54 | + <td class="px-4 py-3"> | |
55 | + {{$blok->id}} | |
56 | + </td> | |
57 | + <td class="px-4 py-3"> | |
58 | + {{$blok->name}} | |
59 | + </td> | |
60 | + <td class="px-4 py-3"> | |
61 | + {{$blok->sort}} | |
62 | + </td> | |
63 | + <td class="px-4 py-3 text-sm"> | |
64 | + {{$blok->created_at }} | |
65 | + </td> | |
66 | + <td class="px-4 py-3 text-sm_"> | |
67 | + <form action="{{ route('admin.infobloks.destroy', ['infoblok' => $blok->id]) }}" method="POST"> | |
68 | + <a href="{{ route('admin.infobloks.edit', ['infoblok' => $blok->id]) }}">Изменить</a> | | |
69 | + @csrf | |
70 | + @method('DELETE') | |
71 | + <input class="btn btn-danger" type="submit" value="Удалить"/> | |
72 | + </form> | |
73 | + </td> | |
74 | + </tr> | |
75 | + @endforeach | |
76 | + </tbody> | |
77 | + </table> | |
78 | + </div> | |
79 | + | |
80 | + <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"> | |
81 | + <?=$infobloks->appends($_GET)->links('admin.pagginate'); ?> | |
82 | + </div> | |
83 | + </div> | |
84 | +@endsection |
resources/views/admin/job_titles/index.blade.php
... | ... | @@ -44,6 +44,7 @@ |
44 | 44 | <th class="px-4 py-3">№</th> |
45 | 45 | <th class="px-4 py-3">Родитель</th> |
46 | 46 | <th class="px-4 py-3">Должность</th> |
47 | + <th class="px-4 py-3">Сортировка</th> | |
47 | 48 | <th class="px-4 py-3">Дата создания</th> |
48 | 49 | <th class="px-4 py-3">Изменить</th> |
49 | 50 | </tr> |
... | ... | @@ -64,6 +65,9 @@ |
64 | 65 | <td class="px-4 py-3"> |
65 | 66 | {{$job->name}} |
66 | 67 | </td> |
68 | + <td class="px-4 py-3"> | |
69 | + {{$job->sort}} | |
70 | + </td> | |
67 | 71 | <td class="px-4 py-3 text-sm"> |
68 | 72 | {{ $job->created_at }} |
69 | 73 | </td> |
resources/views/layout/admin.blade.php
... | ... | @@ -308,7 +308,7 @@ |
308 | 308 | <a class="w-full" href="{{ route('admin.categories.index') }}">Категории</a> |
309 | 309 | </li> |
310 | 310 | <li class="px-2 py-1 transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200"> |
311 | - <a class="w-full" href="{{ route('admin.infobloks') }}">Блоки-Дипломы</a> | |
311 | + <a class="w-full" href="{{ route('admin.infobloks.index') }}">Блоки-Дипломы</a> | |
312 | 312 | </li> |
313 | 313 | |
314 | 314 | </ul> |
... | ... | @@ -701,7 +701,7 @@ |
701 | 701 | <a class="w-full" href="{{ route('admin.categories.index') }}">Категории</a> |
702 | 702 | </li> |
703 | 703 | <li class="px-2 py-1 transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200"> |
704 | - <a class="w-full" href="{{ route('admin.infobloks') }}">Блоки-Дипломы</a> | |
704 | + <a class="w-full" href="{{ route('admin.infobloks.index') }}">Блоки-Дипломы</a> | |
705 | 705 | </li> |
706 | 706 | |
707 | 707 | </ul> |
routes/web.php
... | ... | @@ -3,6 +3,7 @@ |
3 | 3 | use App\Http\Controllers\Admin\AdminController; |
4 | 4 | use App\Http\Controllers\Admin\CategoryController; |
5 | 5 | use App\Http\Controllers\Admin\EmployersController; |
6 | +use App\Http\Controllers\Admin\InfoBloksController; | |
6 | 7 | use App\Http\Controllers\Admin\JobTitlesController; |
7 | 8 | use App\Http\Controllers\Admin\UsersController; |
8 | 9 | use App\Http\Controllers\Admin\WorkersController; |
... | ... | @@ -164,7 +165,9 @@ Route::group([ |
164 | 165 | Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin'); |
165 | 166 | |
166 | 167 | /////редактор////// кабинет - редактор сайта//////////////////////// |
167 | - Route::get('editor-site', [CompanyController::class, 'editor'])->name('editor-site'); | |
168 | + Route::get('editor-site', function() { | |
169 | + return view('admin.editor.index'); | |
170 | + })->name('editor-site'); | |
168 | 171 | |
169 | 172 | // кабинет - редактор шапки-футера сайта |
170 | 173 | Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks'); |
... | ... | @@ -200,7 +203,11 @@ Route::group([ |
200 | 203 | Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads'); |
201 | 204 | |
202 | 205 | // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника |
203 | - Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks'); | |
206 | + /* | |
207 | + * CRUD-операции над справочником дипломы и документы | |
208 | + */ | |
209 | + //Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks'); | |
210 | + Route::resource('infobloks', InfoBloksController::class, ['except' => ['show']]); | |
204 | 211 | |
205 | 212 | // кабинет - роли пользователя |
206 | 213 | Route::get('roles', [UsersController::class, 'roles'])->name('roles'); |