Commit f950a1227c4fbdfc98ec27672fb1e9bd8c97dc32
1 parent
bfc7d8856d
Exists in
master
and in
1 other branch
Коммит обновление по замечаниям заказчика
Showing 18 changed files with 375 additions and 98 deletions Side-by-side Diff
- app/Http/Controllers/Admin/AdminController.php
- app/Http/Controllers/MainController.php
- app/Http/Requests/RequestPosition.php
- app/Models/Job_title.php
- app/Models/Positions.php
- database/migrations/2024_03_25_131309_create_positions_table.php
- public/css/style45.css
- resources/views/admin/job_titles/form.blade.php
- resources/views/admin/positions/add.blade.php
- resources/views/admin/positions/edit.blade.php
- resources/views/admin/positions/form.blade.php
- resources/views/admin/positions/position.blade.php
- resources/views/ajax/new_sky.blade.php
- resources/views/block_real.blade.php
- resources/views/index.blade.php
- resources/views/layout/admin.blade.php
- resources/views/new_sky.blade.php
- routes/web.php
app/Http/Controllers/Admin/AdminController.php
... | ... | @@ -5,8 +5,10 @@ namespace App\Http\Controllers\Admin; |
5 | 5 | use App\Classes\Tools; |
6 | 6 | use App\Http\Controllers\Controller; |
7 | 7 | use App\Http\Requests\CompanyRequest; |
8 | +use App\Http\Requests\RequestPosition; | |
8 | 9 | use App\Models\Company; |
9 | 10 | use App\Models\Employer; |
11 | +use App\Models\Positions; | |
10 | 12 | use App\Models\User; |
11 | 13 | use Carbon\Carbon; |
12 | 14 | use Illuminate\Http\Request; |
... | ... | @@ -346,5 +348,34 @@ class AdminController extends Controller |
346 | 348 | return redirect()->route('admin.config'); |
347 | 349 | } |
348 | 350 | |
351 | + public function position() { | |
352 | + $Positions = Positions::query()->get(); | |
353 | + return view('admin.positions.position', compact('Positions')); | |
354 | + } | |
355 | + | |
356 | + public function position_add() { | |
357 | + return view('admin.positions.add'); | |
358 | + } | |
359 | + | |
360 | + public function position_add_save(RequestPosition $request) { | |
361 | + $all = $request->all(); | |
362 | + $position = Positions::create($all); | |
363 | + return redirect()->route('admin.position'); | |
364 | + } | |
349 | 365 | |
366 | + public function position_edit(Positions $position) { | |
367 | + return view('admin.positions.edit', compact('position')); | |
368 | + } | |
369 | + | |
370 | + public function position_update(Positions $position, RequestPosition $request) { | |
371 | + $all = $request->all(); | |
372 | + unset($all['_token']); | |
373 | + $status = $position->update($all); | |
374 | + return redirect()->route('admin.position'); | |
375 | + } | |
376 | + | |
377 | + public function position_delete(Positions $position) { | |
378 | + $position->delete(); | |
379 | + return redirect()->route('admin.position'); | |
380 | + } | |
350 | 381 | } |
app/Http/Controllers/MainController.php
... | ... | @@ -16,6 +16,7 @@ use App\Models\Job_title; |
16 | 16 | use App\Models\Like_vacancy; |
17 | 17 | use App\Models\Like_worker; |
18 | 18 | use App\Models\News; |
19 | +use App\Models\Positions; | |
19 | 20 | use App\Models\reclame; |
20 | 21 | use App\Models\User; |
21 | 22 | use Illuminate\Http\Request; |
... | ... | @@ -38,34 +39,21 @@ class MainController extends Controller |
38 | 39 | ->GroupBy('categories.id') |
39 | 40 | ->get(); |
40 | 41 | |
41 | - $flot_paluba = DB::table('ad_jobs')->selectRaw('DISTINCT(job_titles.name), job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt')-> | |
42 | - join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | |
43 | - where('position_ship', 'Палуба'); | |
42 | + $Position = Positions::query()->get(); | |
44 | 43 | |
44 | + $BigFlot = Array(); | |
45 | + foreach ($Position as $position) { | |
46 | + $BigFlot[] = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> | |
47 | + orderBy('job_titles.sort')-> | |
48 | + join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | |
49 | + where('position_ship', "$position->name")-> | |
50 | + groupby('job_title_id','position_ship')-> | |
51 | + get(); | |
52 | + } | |
45 | 53 | |
46 | - | |
47 | - $flot_paluba = $flot_paluba->groupby('job_title_id')->get(); | |
48 | - $flot_MO = DB::table('ad_jobs')->selectRaw('DISTINCT(job_titles.name), job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt')-> | |
49 | - join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | |
50 | - where('position_ship', '=', 'МО'); | |
51 | - | |
52 | - $flot_MO = $flot_MO->groupby('ad_jobs.id')->get(); | |
53 | - | |
54 | - $flot_radovie = DB::table('ad_jobs')->selectRaw('DISTINCT(job_titles.name), job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt')-> | |
55 | - join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | |
56 | - where('position_ship', '=', 'Рядовые'); | |
57 | - | |
58 | - $flot_radovie = $flot_radovie->groupby('ad_jobs.id')->get(); | |
59 | - | |
60 | - $flot_prochee = DB::table('ad_jobs')->selectRaw('DISTINCT(job_titles.name), job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt')-> | |
61 | - join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | |
62 | - where('position_ship', '=', 'Прочее'); | |
63 | - $flot_prochee = $flot_prochee->groupby('ad_jobs.id')->get(); | |
64 | 54 | $employers = employers_main::query()->with('employer')->orderBy('id')->limit(8)->get(); |
65 | 55 | $vacancy = Ad_jobs::query()->with('job_title')->orderBy('position_ship')->get(); |
66 | - return view('index', compact('news', 'categories', 'employers', 'vacancy', | |
67 | - 'flot_paluba', 'flot_MO', 'flot_radovie', 'flot_prochee' | |
68 | - )); | |
56 | + return view('index', compact('news', 'categories', 'employers', 'vacancy', 'BigFlot', 'Position')); | |
69 | 57 | } |
70 | 58 | |
71 | 59 | public function search_vacancies(Request $request) { |
... | ... | @@ -137,45 +125,25 @@ class MainController extends Controller |
137 | 125 | |
138 | 126 | $categories = $categories->OrderByDesc('created_at')->GroupBy('categories.id')->get(); |
139 | 127 | |
128 | + $Position = Positions::query()->get(); | |
140 | 129 | |
141 | - $flot_paluba = DB::table('ad_jobs')->selectRaw('DISTINCT(job_titles.name), job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt')-> | |
142 | - join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | |
143 | - where('position_ship', 'Палуба'); | |
144 | - if (!empty($request->get('job'))) { | |
145 | - $flot_paluba = $flot_paluba->where('job_title_id', '=', $request->get('job')); | |
146 | - } | |
147 | - $flot_paluba = $flot_paluba->groupby('job_title_id')->get(); | |
148 | - | |
149 | - $flot_MO = DB::table('ad_jobs')->selectRaw('DISTINCT(job_titles.name), job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt')-> | |
150 | - join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | |
151 | - where('position_ship', '=', 'МО'); | |
152 | - if (!empty($request->get('job'))) { | |
153 | - $flot_MO = $flot_MO->where('job_title_id', '=', $request->get('job')); | |
154 | - } | |
155 | - $flot_MO = $flot_MO->groupby('ad_jobs.id')->get(); | |
156 | - | |
157 | - $flot_radovie = DB::table('ad_jobs')->selectRaw('DISTINCT(job_titles.name), job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt')-> | |
158 | - join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | |
159 | - where('position_ship', '=', 'Рядовые'); | |
160 | - if (!empty($request->get('job'))) { | |
161 | - $flot_radovie = $flot_radovie->where('job_title_id', '=', $request->get('job')); | |
162 | - } | |
163 | - $flot_radovie = $flot_radovie->groupby('ad_jobs.id')->get(); | |
164 | - | |
165 | - $flot_prochee = DB::table('ad_jobs')->selectRaw('DISTINCT(job_titles.name), job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt')-> | |
166 | - join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | |
167 | - where('position_ship', '=', 'Прочее'); | |
168 | - if (!empty($request->get('job'))) { | |
169 | - $flot_prochee = $flot_prochee->where('job_title_id', '=', $request->get('job')); | |
130 | + $BigFlot = Array(); | |
131 | + foreach ($Position as $position) { | |
132 | + $War_flot = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> | |
133 | + orderBy('job_titles.sort')-> | |
134 | + join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | |
135 | + where('position_ship', "$position->name"); | |
136 | + if (($request->has('job')) && ($request->get('job') > 0)) { | |
137 | + $War_flot = $War_flot->where('job_title_id', $request->get('job')); | |
138 | + } | |
139 | + $War_flot = $War_flot->groupby('job_title_id','position_ship')->get(); | |
140 | + $BigFlot[] = $War_flot; | |
170 | 141 | } |
171 | - $flot_prochee = $flot_prochee->groupby('ad_jobs.id')->get(); | |
172 | - | |
173 | 142 | |
174 | 143 | if ($request->ajax()) { |
175 | - return view('ajax.new_sky', compact('categories', 'flot_paluba', 'flot_MO', 'flot_radovie', 'flot_prochee')); | |
144 | + return view('ajax.new_sky', compact('categories', 'BigFlot', 'Position')); | |
176 | 145 | } else { |
177 | - return view('new_sky', compact('Job_title', 'categories', | |
178 | - 'flot_paluba', 'flot_MO', 'flot_radovie', 'flot_prochee')); | |
146 | + return view('new_sky', compact('Job_title', 'categories', 'BigFlot', 'Position')); | |
179 | 147 | } |
180 | 148 | } |
181 | 149 | |
... | ... | @@ -416,7 +384,7 @@ class MainController extends Controller |
416 | 384 | |
417 | 385 | //Детальная новость |
418 | 386 | public function detail_new(News $new) { |
419 | - // Выборка | |
387 | + // Наборка | |
420 | 388 | $Query = News::query()->where('id', $new->id)->get(); |
421 | 389 | $title = $Query[0]->title; |
422 | 390 | $All_Query = News::query()->paginate(8); |
app/Http/Requests/RequestPosition.php
... | ... | @@ -0,0 +1,52 @@ |
1 | +<?php | |
2 | + | |
3 | +namespace App\Http\Requests; | |
4 | + | |
5 | +use Illuminate\Foundation\Http\FormRequest; | |
6 | + | |
7 | +class RequestPosition extends FormRequest | |
8 | +{ | |
9 | + public function authorize() | |
10 | + { | |
11 | + return true; | |
12 | + } | |
13 | + | |
14 | + public function rules() | |
15 | + { | |
16 | + return [ | |
17 | + 'name' => [ | |
18 | + 'required', | |
19 | + 'string', | |
20 | + 'min:3', | |
21 | + 'max:255', | |
22 | + ], | |
23 | + 'sort' => [ | |
24 | + 'required', | |
25 | + 'numeric', | |
26 | + 'min:0', | |
27 | + 'max: 1000000' | |
28 | + ], | |
29 | + ]; | |
30 | + } | |
31 | + | |
32 | + public function messages() { | |
33 | + return [ | |
34 | + 'required' => 'Поле :attribute обязательно для ввода', | |
35 | + 'unique' => 'Поле :attribute должно быть уникальным', | |
36 | + 'mimes' => 'Допускаются файлы только с расширением jpeg,jpg,png', | |
37 | + 'numeric' => 'Поле :attribute должно быть числом', | |
38 | + 'min' => [ | |
39 | + 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | |
40 | + 'integer' => 'Поле «:attribute» должно быть :min или больше', | |
41 | + 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | |
42 | + ], | |
43 | + | |
44 | + 'max' => [ | |
45 | + 'string' => 'Поле «:attribute» должно быть не больше :max символов', | |
46 | + 'integer' => 'Поле «:attribute» должно быть :max или меньше', | |
47 | + 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | |
48 | + ], | |
49 | + | |
50 | + ]; | |
51 | + } | |
52 | +} |
app/Models/Job_title.php
app/Models/Positions.php
... | ... | @@ -0,0 +1,16 @@ |
1 | +<?php | |
2 | + | |
3 | +namespace App\Models; | |
4 | + | |
5 | +use Illuminate\Database\Eloquent\Factories\HasFactory; | |
6 | +use Illuminate\Database\Eloquent\Model; | |
7 | + | |
8 | +class Positions extends Model | |
9 | +{ | |
10 | + use HasFactory; | |
11 | + | |
12 | + public $fillable = [ | |
13 | + 'name', | |
14 | + 'sort', | |
15 | + ]; | |
16 | +} |
database/migrations/2024_03_25_131309_create_positions_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('positions', function (Blueprint $table) { | |
17 | + $table->id(); | |
18 | + $table->string('name', 255)->nullable(false); | |
19 | + $table->integer('sort')->default(100); | |
20 | + $table->timestamps(); | |
21 | + }); | |
22 | + } | |
23 | + | |
24 | + /** | |
25 | + * Reverse the migrations. | |
26 | + * | |
27 | + * @return void | |
28 | + */ | |
29 | + public function down() | |
30 | + { | |
31 | + Schema::dropIfExists('positions'); | |
32 | + } | |
33 | +}; |
public/css/style45.css
... | ... | @@ -8909,4 +8909,22 @@ main + .news { |
8909 | 8909 | display: -webkit-box; |
8910 | 8910 | display: -ms-flexbox; |
8911 | 8911 | display: flex; |
8912 | -} | |
8913 | 8912 | \ No newline at end of file |
8913 | +} | |
8914 | + | |
8915 | +.select2-selection--multiple .select2-selection__rendered { | |
8916 | + display: -webkit-box !important; | |
8917 | + display: -ms-flexbox !important; | |
8918 | + display: flex !important; | |
8919 | + -webkit-box-align: center; | |
8920 | + -ms-flex-align: center; | |
8921 | + align-items: center; | |
8922 | + -ms-flex-wrap: wrap; | |
8923 | + flex-wrap: wrap; | |
8924 | + gap: 10px; | |
8925 | + padding-top: 10px !important; | |
8926 | + padding-bottom: 10px !important; | |
8927 | +} | |
8928 | + | |
8929 | +.select2-selection--multiple .select2-selection__rendered .select2-selection__choice { | |
8930 | + margin: 0; | |
8931 | +} |
resources/views/admin/job_titles/form.blade.php
... | ... | @@ -25,6 +25,20 @@ |
25 | 25 | </select> |
26 | 26 | </label><br> |
27 | 27 | |
28 | + <label class="block text-sm"> | |
29 | + <span class="text-gray-700 dark:text-gray-400">Сортировка</span> | |
30 | + @php | |
31 | + $sort_num = 100; | |
32 | + @endphp | |
33 | + <select name="sort" 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" | |
34 | + title="Сортировка"> | |
35 | + @for($i = 1; $i <= 10; $i++) | |
36 | + <option value="{{ $sort_num }}" @if (isset($job_title)) @if ($sort_num == $job_title->sort) selected @else @endif @endif>{{ $sort_num }}</option> | |
37 | + @php $sort_num = $sort_num + 10; @endphp | |
38 | + @endfor | |
39 | + </select> | |
40 | + </label><br> | |
41 | + | |
28 | 42 | <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4"> |
29 | 43 | <div> |
30 | 44 | <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"> |
resources/views/admin/positions/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.add-save-position') }}"> | |
8 | + @csrf | |
9 | + @include('admin.positions.form') | |
10 | + </form> | |
11 | +@endsection |
resources/views/admin/positions/edit.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.update-position', ['position' => $position->id]) }}"> | |
8 | + @csrf | |
9 | + @include('admin.positions.form') | |
10 | + </form> | |
11 | +@endsection |
resources/views/admin/positions/form.blade.php
... | ... | @@ -0,0 +1,41 @@ |
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') ?? $position->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 | + <label class="block text-sm"> | |
16 | + <span class="text-gray-700 dark:text-gray-400">Сортировка</span> | |
17 | + @php | |
18 | + $sort_num = 100; | |
19 | + @endphp | |
20 | + <select name="sort" 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" | |
21 | + title="Сортировка"> | |
22 | + @for($i = 1; $i <= 10; $i++) | |
23 | + <option value="{{ $sort_num }}" @if (isset($position)) @if ($sort_num == $position->sort) selected @else @endif @endif>{{ $sort_num }}</option> | |
24 | + @php $sort_num = $sort_num + 10; @endphp | |
25 | + @endfor | |
26 | + </select> | |
27 | + </label><br> | |
28 | + | |
29 | + <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4"> | |
30 | + <div> | |
31 | + <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"> | |
32 | + Сохранить | |
33 | + </button> | |
34 | + | |
35 | + <a href="{{ route('admin.position') }}" | |
36 | + 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" | |
37 | + style="display: -webkit-inline-box; height: 30px!important;" | |
38 | + >Назад</a> | |
39 | + </div> | |
40 | + </div> | |
41 | +</div> |
resources/views/admin/positions/position.blade.php
... | ... | @@ -0,0 +1,80 @@ |
1 | +@extends('layout.admin', ['title' => 'Админка - Работники']) | |
2 | +@section('script') | |
3 | + <script> | |
4 | + $(document).ready(function() { | |
5 | + $(document).on('click', '.checkban', function () { | |
6 | + var this_ = $(this); | |
7 | + var value = this_.val(); | |
8 | + var ajax_block = $('#ajax_block'); | |
9 | + var bool = 0; | |
10 | + | |
11 | + if(this.checked){ | |
12 | + bool = 1; | |
13 | + } else { | |
14 | + bool = 0; | |
15 | + } | |
16 | + | |
17 | + $.ajax({ | |
18 | + type: "GET", | |
19 | + url: "{{ url()->full()}}", | |
20 | + data: "id=" + value + "&is_ban=" + bool, | |
21 | + success: function (data) { | |
22 | + console.log('Обновление таблицы работников '); | |
23 | + //data = JSON.parse(data); | |
24 | + console.log(data); | |
25 | + ajax_block.html(data); | |
26 | + }, | |
27 | + headers: { | |
28 | + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | |
29 | + }, | |
30 | + error: function (data) { | |
31 | + console.log('Error: ' + data); | |
32 | + } | |
33 | + }); | |
34 | + }); | |
35 | + }); | |
36 | + </script> | |
37 | +@endsection | |
38 | + | |
39 | +@section('search') | |
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 | + <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.add-position') }}">Создать позицию</a><br><br> | |
47 | + <table class="w-full whitespace-no-wrap"> | |
48 | + <thead> | |
49 | + <tr | |
50 | + 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" | |
51 | + > | |
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($Positions as $Pos) | |
60 | + <tr class="text-gray-700 dark:text-gray-400"> | |
61 | + <td class="px-4 py-3 text-xs"> | |
62 | + {{$Pos->id}} | |
63 | + </td> | |
64 | + <td class="px-4 py-3 text-xs"> | |
65 | + {{ $Pos->name }} | |
66 | + </td> | |
67 | + <td class="px-4 py-3 text-xs"> | |
68 | + {{ date('d.m.Y h:i:s', strtotime($Pos->created_at)) }} | |
69 | + </td> | |
70 | + <td class="px-4 py-3 text-xs"> | |
71 | + <a href="{{ route('admin.edit-position', ['position' => $Pos->id]) }}">Изменить</a> | | |
72 | + <a href="{{ route('admin.delete-position', ['position' => $Pos->id]) }}">Удалить</a> | |
73 | + </td> | |
74 | + </tr> | |
75 | + @endforeach | |
76 | + </tbody> | |
77 | + </table> | |
78 | + </div> | |
79 | + </div> | |
80 | +@endsection |
resources/views/ajax/new_sky.blade.php
1 | -<div class="vacancies__list-col"> | |
2 | - @include('block_real', ['flot' => $flot_paluba, 'title' => 'Палуба']) | |
3 | -</div> | |
4 | -<div class="vacancies__list-col"> | |
5 | - @include('block_real', ['flot' => $flot_MO, 'title' => 'МО']) | |
6 | -</div> | |
7 | -<div class="vacancies__list-col"> | |
8 | - @include('block_real', ['flot' => $flot_radovie, 'title' => 'Рядовые']) | |
9 | -</div> | |
10 | -<div class="vacancies__list-col"> | |
11 | - @include('block_real', ['flot' => $flot_prochee, 'title' => 'Прочее']) | |
12 | -</div> | |
1 | +@foreach ($BigFlot as $key => $flot) | |
2 | + <div class="vacancies__list-col"> | |
3 | + @include('block_real', ['flot' => $flot, 'position' => $Position[$key]]) | |
4 | + </div> | |
5 | +@endforeach |
resources/views/block_real.blade.php
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | @if ($flot->count()) |
6 | 6 | @foreach ($flot as $key => $cat) |
7 | 7 | @if ($k == 0) |
8 | - <div class="vacancies__list-label">{{ $title }}</div> | |
8 | + <div class="vacancies__list-label">{{ $cat->position_ship }}</div> | |
9 | 9 | @endif |
10 | 10 | <a href="{{ route('list-vacancies', ['job' => $cat->id_title]) }}" class="vacancies__item"> |
11 | 11 | <span style="border-color:{{$colors[$i]}}"> |
... | ... | @@ -21,7 +21,7 @@ |
21 | 21 | @endphp |
22 | 22 | @endforeach |
23 | 23 | @else |
24 | - <div class="vacancies__list-label">{{ $title }}</div> | |
24 | + <div class="vacancies__list-label">{{ $position->name }}</div> | |
25 | 25 | <a class="vacancies__item"> |
26 | 26 | <span style="border-color:{{$colors[1]}}"> |
27 | 27 | <b>Тут нет информации</b> |
resources/views/index.blade.php
... | ... | @@ -103,18 +103,13 @@ |
103 | 103 | <span>Скрыть</span> |
104 | 104 | </button>--> |
105 | 105 | <div class="vacancies__list" id="block_ajax" name="block_ajax"> |
106 | - <div class="vacancies__list-col"> | |
107 | - @include('block_real', ['flot' => $flot_paluba, 'title' => 'Палуба']) | |
108 | - </div> | |
109 | - <div class="vacancies__list-col"> | |
110 | - @include('block_real', ['flot' => $flot_MO, 'title' => 'МО']) | |
111 | - </div> | |
112 | - <div class="vacancies__list-col"> | |
113 | - @include('block_real', ['flot' => $flot_radovie, 'title' => 'Рядовые']) | |
114 | - </div> | |
115 | - <div class="vacancies__list-col"> | |
116 | - @include('block_real', ['flot' => $flot_prochee, 'title' => 'Прочее']) | |
117 | - </div> | |
106 | + | |
107 | + @foreach ($BigFlot as $key => $flot) | |
108 | + <div class="vacancies__list-col"> | |
109 | + | |
110 | + @include('block_real', ['flot' => $flot, 'position' => $Position[$key]]) | |
111 | + </div> | |
112 | + @endforeach | |
118 | 113 | </div> |
119 | 114 | </div> |
120 | 115 | </div> |
resources/views/layout/admin.blade.php
... | ... | @@ -571,6 +571,9 @@ |
571 | 571 | @endif |
572 | 572 | @endif |
573 | 573 | @endforeach |
574 | + <li class="px-2 py-1 transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.position') ? 'dark:text-gray-100' : null }}"> | |
575 | + <a class="w-full" href="{{ route('admin.position') }}">Позиция</a> | |
576 | + </li> | |
574 | 577 | </ul> |
575 | 578 | </template> |
576 | 579 | </li> |
... | ... | @@ -1227,6 +1230,16 @@ |
1227 | 1230 | </li> |
1228 | 1231 | @endif |
1229 | 1232 | @endif |
1233 | + | |
1234 | + @if ($cont->url_page == "admin/position") | |
1235 | + @if ((($cont->is_admin == 1) && ($admin == 1)) || | |
1236 | + (($cont->is_manager == 1) && ($is_manager == 1))) | |
1237 | + <li class="px-2 py-1 transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.position') ? 'dark:text-gray-100' : null }}"> | |
1238 | + <a class="w-full" href="{{ route('admin.position') }}">Позиция</a> | |
1239 | + </li> | |
1240 | + @endif | |
1241 | + @endif | |
1242 | + | |
1230 | 1243 | @endforeach |
1231 | 1244 | </ul> |
1232 | 1245 | </template> |
resources/views/new_sky.blade.php
... | ... | @@ -69,18 +69,11 @@ |
69 | 69 | <span>Скрыть</span> |
70 | 70 | </button>--> |
71 | 71 | <div class="vacancies__list" id="block_ajax" name="block_ajax"> |
72 | - <div class="vacancies__list-col"> | |
73 | - @include('block_real', ['flot' => $flot_paluba, 'title' => 'Палуба']) | |
74 | - </div> | |
75 | - <div class="vacancies__list-col"> | |
76 | - @include('block_real', ['flot' => $flot_MO, 'title' => 'МО']) | |
77 | - </div> | |
78 | - <div class="vacancies__list-col"> | |
79 | - @include('block_real', ['flot' => $flot_radovie, 'title' => 'Рядовые']) | |
80 | - </div> | |
81 | - <div class="vacancies__list-col"> | |
82 | - @include('block_real', ['flot' => $flot_prochee, 'title' => 'Прочее']) | |
83 | - </div> | |
72 | + @foreach ($BigFlot as $key => $flot) | |
73 | + <div class="vacancies__list-col"> | |
74 | + @include('block_real', ['flot' => $flot, 'position' => $Position[$key]]) | |
75 | + </div> | |
76 | + @endforeach | |
84 | 77 | </div> |
85 | 78 | </div> |
86 | 79 | </div> |
routes/web.php
... | ... | @@ -289,6 +289,13 @@ Route::group([ |
289 | 289 | // кабинет - список админов |
290 | 290 | Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin'); |
291 | 291 | |
292 | + // справочник Позиции | |
293 | + Route::get('positions', [AdminController::class, 'position'])->name('position'); | |
294 | + Route::get('positions/add', [AdminController::class, 'position_add'])->name('add-position'); | |
295 | + Route::post('positions/add', [AdminController::class, 'position_add_save'])->name('add-save-position'); | |
296 | + Route::get('positions/edit/{position}', [AdminController::class, 'position_edit'])->name('edit-position'); | |
297 | + Route::post('position/edit/{position}', [AdminController::class, 'position_update'])->name('update-position'); | |
298 | + Route::get('position/delete/{position}', [AdminController::class, 'position_delete'])->name('delete-position'); | |
292 | 299 | |
293 | 300 | /////редактор////// кабинет - редактор сайта//////////////////////// |
294 | 301 | Route::get('editor-site', function() { |