Commit 486a3601d8504bba4586ebe2880b489ccbbced01

Authored by Андрей Ларионов
1 parent 4c66e360c8

Должности и работодатели на главной странице, Конструктор страниц

Showing 20 changed files with 878 additions and 46 deletions Side-by-side Diff

app/Http/Controllers/Admin/CompanyController.php
... ... @@ -3,6 +3,11 @@
3 3 namespace App\Http\Controllers\Admin;
4 4  
5 5 use App\Http\Controllers\Controller;
  6 +use App\Models\Employer;
  7 +use App\Models\employers_main;
  8 +use App\Models\Job_title;
  9 +use App\Models\job_titles_main;
  10 +use App\Models\pages;
6 11 use Illuminate\Http\Request;
7 12  
8 13 class CompanyController extends Controller
... ... @@ -18,13 +23,39 @@ class CompanyController extends Controller
18 23 }
19 24  
20 25 // кабинет - редактор должности на главной
21   - public function job_titles_main() {
22   - return;
  26 + public function job_titles_main(Request $request) {
  27 + if ($request->ajax()) {
  28 + $user = job_titles_main::find($request->id);
  29 + $request->offsetUnset('id');
  30 + $user->update($request->all());
  31 + }
  32 +
  33 + $jobs = job_titles_main::query()->OrderBy('sort')->paginate(10);
  34 + $list_job_titles = Job_title::query()->active()->orderBy('name')->get();
  35 +
  36 + if ($request->ajax()) {
  37 + return view('admin.job_main.index_ajax', compact('jobs', 'list_job_titles'));
  38 + } else {
  39 + return view('admin.job_main.index', compact('jobs', 'list_job_titles'));
  40 + }
23 41 }
24 42  
25 43 // кабинет - редактор работодатели на главной
26   - public function employers_main() {
27   - return;
  44 + public function employers_main(Request $request) {
  45 + if ($request->ajax()) {
  46 + $user = employers_main::find($request->id);
  47 + $request->offsetUnset('id');
  48 + $user->update($request->all());
  49 + }
  50 +
  51 + $employers = employers_main::query()->OrderBy('sort')->paginate(10);
  52 + $list_employers = Employer::query()->active()->orderBy('name_company')->get();
  53 +
  54 + if ($request->ajax()) {
  55 + return view('admin.employer_main.index_ajax', compact('employers', 'list_employers'));
  56 + } else {
  57 + return view('admin.employer_main.index', compact('employers', 'list_employers'));
  58 + }
28 59 }
29 60  
30 61 // кабинет - редактор seo-сайта
... ... @@ -32,10 +63,32 @@ class CompanyController extends Controller
32 63 return;
33 64 }
34 65  
35   - // кабинет - редактор страниц
  66 + /////////// кабинет - редактор страниц ////////////////////////////////
36 67 public function editor_pages() {
37   - return;
  68 + $pages = pages::query()->OrderBy('name')->paginate(15);
  69 + return view('admin.pages.index', compact('pages'));
  70 + }
  71 +
  72 + public function editor_pages_add() {
  73 + return view('admin.pages.add');
  74 + }
  75 +
  76 + public function editor_pages_store(Request $request) {
  77 + return;
  78 + }
  79 +
  80 + public function editor_pages_edit(pages $page) {
  81 + return view('admin.pages.edit', compact('page'));
  82 + }
  83 +
  84 + public function editor_pages_update(Request $request, pages $page) {
  85 + return;
  86 + }
  87 +
  88 + public function editor_pages_destroy(pages $page) {
  89 + return;
38 90 }
  91 + ///////////////////////////////////////////////////////////////////
39 92  
40 93 // кабинет - реклама сайта
41 94 public function reclames() {
app/Http/Controllers/PagesController.php
... ... @@ -0,0 +1,12 @@
  1 +<?php
  2 +
  3 +namespace App\Http\Controllers;
  4 +
  5 +use Illuminate\Http\Request;
  6 +
  7 +class PagesController extends Controller
  8 +{
  9 + public function pages(string $slug) {
  10 + return;
  11 + }
  12 +}
app/Http/Requests/PagesRequest.php
... ... @@ -0,0 +1,30 @@
  1 +<?php
  2 +
  3 +namespace App\Http\Requests;
  4 +
  5 +use Illuminate\Foundation\Http\FormRequest;
  6 +
  7 +class PagesRequest extends FormRequest
  8 +{
  9 + /**
  10 + * Determine if the user is authorized to make this request.
  11 + *
  12 + * @return bool
  13 + */
  14 + public function authorize()
  15 + {
  16 + return false;
  17 + }
  18 +
  19 + /**
  20 + * Get the validation rules that apply to the request.
  21 + *
  22 + * @return array<string, mixed>
  23 + */
  24 + public function rules()
  25 + {
  26 + return [
  27 + //
  28 + ];
  29 + }
  30 +}
app/Models/employers_main.php
... ... @@ -8,4 +8,18 @@ use Illuminate\Database\Eloquent\Model;
8 8 class employers_main extends Model
9 9 {
10 10 use HasFactory;
  11 +
  12 + protected $fillable = [
  13 + 'name',
  14 + 'employer_id',
  15 + 'sort',
  16 + ];
  17 +
  18 + /*
  19 + * Связь таблицы employers с таблицей employers_main
  20 + многие-к-одному
  21 + */
  22 + public function employer() {
  23 + return $this->belongsTo(Employer::class, 'employer_id');
  24 + }
11 25 }
app/Models/job_titles_main.php
... ... @@ -8,4 +8,10 @@ use Illuminate\Database\Eloquent\Model;
8 8 class job_titles_main extends Model
9 9 {
10 10 use HasFactory;
  11 +
  12 + protected $fillable = [
  13 + 'name',
  14 + 'job_title_id',
  15 + 'sort',
  16 + ];
11 17 }
database/seeders/DatabaseSeeder.php
... ... @@ -14,6 +14,13 @@ class DatabaseSeeder extends Seeder
14 14 */
15 15 public function run()
16 16 {
  17 + $this->call(EmployersMainSeeder::class);
  18 + $this->command->info('Таблица работодатели на главной загружена!');
  19 +
  20 + $this->call(JobTitlesMainSeeder::class);
  21 + $this->command->info('Таблица должности на главной загружена!');
  22 +
  23 +
17 24 // \App\Models\User::factory(10)->create();
18 25  
19 26 // \App\Models\User::factory()->create([
database/seeders/EmployersMainSeeder.php
... ... @@ -0,0 +1,71 @@
  1 +<?php
  2 +
  3 +namespace Database\Seeders;
  4 +
  5 +use App\Models\employers_main;
  6 +use Illuminate\Database\Console\Seeds\WithoutModelEvents;
  7 +use Illuminate\Database\Eloquent\Model;
  8 +use Illuminate\Database\Seeder;
  9 +
  10 +class EmployersMainSeeder extends Seeder
  11 +{
  12 + /**
  13 + * Run the database seeds.
  14 + *
  15 + * @return void
  16 + */
  17 + public function run()
  18 + {
  19 + $data = [
  20 + /*1 */[
  21 + 'name' => 'Пункт 1',
  22 + 'employer_id' => '0',
  23 + 'sort' => '100',
  24 +
  25 + ],
  26 + /*2*/[
  27 + 'name' => 'Пункт 2',
  28 + 'employer_id' => '0',
  29 + 'sort' => '110',
  30 + ],
  31 + /*3*/[
  32 + 'name' => 'Пункт 3',
  33 + 'employer_id' => '0',
  34 + 'sort' => '120',
  35 + ],
  36 + /*4*/[
  37 + 'name' => 'Пункт 4',
  38 + 'employer_id' => '0',
  39 + 'sort' => '130',
  40 + ],
  41 + /*5*/[
  42 + 'name' => 'Пункт 5',
  43 + 'employer_id' => '0',
  44 + 'sort' => '140',
  45 + ],
  46 + /*6*/[
  47 + 'name' => 'Пункт 6',
  48 + 'employer_id' => '0',
  49 + 'sort' => '150',
  50 + ],
  51 + /*7*/[
  52 + 'name' => 'Пункт 7',
  53 + 'employer_id' => '0',
  54 + 'sort' => '160',
  55 + ],
  56 + /*8*/[
  57 + 'name' => 'Пункт 8',
  58 + 'employer_id' => '0',
  59 + 'sort' => '170',
  60 + ],
  61 + ];
  62 +
  63 + foreach ($data as $item) {
  64 + $emp = new employers_main();
  65 + $emp->name = $item['name'];
  66 + $emp->employer_id = $item['employer_id'];
  67 + $emp->sort = $item['sort'];
  68 + $emp->save();
  69 + }
  70 + }
  71 +}
database/seeders/JobTitlesMainSeeder.php
... ... @@ -0,0 +1,71 @@
  1 +<?php
  2 +
  3 +namespace Database\Seeders;
  4 +
  5 +use App\Models\job_titles_main;
  6 +use Illuminate\Database\Console\Seeds\WithoutModelEvents;
  7 +use Illuminate\Database\Eloquent\Model;
  8 +use Illuminate\Database\Seeder;
  9 +
  10 +class JobTitlesMainSeeder extends Seeder
  11 +{
  12 + /**
  13 + * Run the database seeds.
  14 + *
  15 + * @return void
  16 + */
  17 + public function run()
  18 + {
  19 + $data = [
  20 + /*1 */[
  21 + 'name' => 'Пункт 1',
  22 + 'job_title_id' => '0',
  23 + 'sort' => '100',
  24 +
  25 + ],
  26 + /*2*/[
  27 + 'name' => 'Пункт 2',
  28 + 'job_title_id' => '0',
  29 + 'sort' => '110',
  30 + ],
  31 + /*3*/[
  32 + 'name' => 'Пункт 3',
  33 + 'job_title_id' => '0',
  34 + 'sort' => '120',
  35 + ],
  36 + /*4*/[
  37 + 'name' => 'Пункт 4',
  38 + 'job_title_id' => '0',
  39 + 'sort' => '130',
  40 + ],
  41 + /*5*/[
  42 + 'name' => 'Пункт 5',
  43 + 'job_title_id' => '0',
  44 + 'sort' => '140',
  45 + ],
  46 + /*6*/[
  47 + 'name' => 'Пункт 6',
  48 + 'job_title_id' => '0',
  49 + 'sort' => '150',
  50 + ],
  51 + /*7*/[
  52 + 'name' => 'Пункт 7',
  53 + 'job_title_id' => '0',
  54 + 'sort' => '160',
  55 + ],
  56 + /*8*/[
  57 + 'name' => 'Пункт 8',
  58 + 'job_title_id' => '0',
  59 + 'sort' => '170',
  60 + ],
  61 + ];
  62 +
  63 + foreach ($data as $item) {
  64 + $emp = new job_titles_main();
  65 + $emp->name = $item['name'];
  66 + $emp->job_title_id = $item['job_title_id'];
  67 + $emp->sort = $item['sort'];
  68 + $emp->save();
  69 + }
  70 + }
  71 +}
resources/views/admin/category/index.blade.php
1 1 @extends('layout.admin', ['title' => 'Админка - Категории'])
2 2  
3 3 @section('script')
4   - <script>
5   - $(document).ready(function() {
6   - $(document).on('click', '.checkban', function () {
7   - var this_ = $(this);
8   - var value = this_.val();
9   - var ajax_block = $('#ajax_block');
10   - var bool = 0;
11 4  
12   - if(this.checked){
13   - bool = 1;
14   - } else {
15   - bool = 0;
16   - }
17   -
18   - $.ajax({
19   - type: "GET",
20   - url: "{{ url()->full()}}",
21   - data: "id=" + value + "&is_ban=" + bool,
22   - success: function (data) {
23   - console.log('Обновление таблицы пользователей ');
24   - //data = JSON.parse(data);
25   - console.log(data);
26   - ajax_block.html(data);
27   - },
28   - headers: {
29   - 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
30   - },
31   - error: function (data) {
32   - console.log('Error: ' + data);
33   - }
34   - });
35   - });
36   -
37   - });
38   - </script>
39 5 @endsection
40 6  
41 7 @section('search')
42   - <div class="absolute inset-y-0 flex items-center pl-2">
  8 + <!--<div class="absolute inset-y-0 flex items-center pl-2">
43 9 <svg
44 10 class="w-4 h-4"
45 11 aria-hidden="true"
... ... @@ -64,12 +30,12 @@
64 30 <div style="float: left">
65 31 <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
66 32 </div>
67   - </form>
  33 + </form>-->
68 34 @endsection
69 35  
70 36 @section('content')
71 37  
72   - <a href="{{ route('admin.categories.create') }}" style="width: 210px" class="px-5 py-3 font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-lg active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">
  38 + <a href="{{ route('admin.categories.create') }}" style="width: 175px" 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">
73 39 Добавить категорию
74 40 </a>
75 41 <br>
resources/views/admin/employer_main/index.blade.php
... ... @@ -0,0 +1,139 @@
  1 +@extends('layout.admin', ['title' => 'Админка - Работодатели на главной'])
  2 +
  3 +@section('script')
  4 + <script>
  5 + $(document).ready(function() {
  6 + $(document).on('change', '.check_js', function () {
  7 + var this_ = $(this);
  8 + var id = this_.attr('id');
  9 + var field = this_.attr('data-field');
  10 + var value = this_.val();
  11 + var ajax_block = $('#ajax_block');
  12 + var str ="id=" + id + "&"+ field + "=" + value;
  13 + console.log(str);
  14 + $.ajax({
  15 + type: "GET",
  16 + url: "{{ url()->full()}}",
  17 + data: str,
  18 + success: function (data) {
  19 + console.log('Обновление таблицы пользователей ');
  20 + //data = JSON.parse(data);
  21 + //console.log(data);
  22 + ajax_block.html(data);
  23 + },
  24 + headers: {
  25 + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  26 + },
  27 + error: function (data) {
  28 + console.log('Error: ' + data);
  29 + }
  30 + });
  31 + });
  32 +
  33 + });
  34 + </script>
  35 +@endsection
  36 +
  37 +@section('search')
  38 + <!--<div class="absolute inset-y-0 flex items-center pl-2">
  39 + <svg
  40 + class="w-4 h-4"
  41 + aria-hidden="true"
  42 + fill="currentColor"
  43 + viewBox="0 0 20 20"
  44 + >
  45 + <path
  46 + fill-rule="evenodd"
  47 + 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"
  48 + clip-rule="evenodd"
  49 + ></path>
  50 + </svg>
  51 + </div>
  52 + <form action="" method="POST">
  53 + <div style="float:left;"><input
  54 + 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"
  55 + style="width: 400px"
  56 + type="text"
  57 + placeholder="Искать..."
  58 + aria-label="Search"
  59 + /></div>
  60 + <div style="float: left">
  61 + <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
  62 + </div>
  63 + </form>-->
  64 +@endsection
  65 +
  66 +@section('content')
  67 + <style>
  68 + .col {
  69 + width: 250px; /* Ширина блока */
  70 + word-wrap: break-word; /* Перенос слов */
  71 + word-break: break-all;
  72 + }
  73 + </style>
  74 + <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
  75 + <div class="w-full overflow-x-auto">
  76 + <table class="w-full whitespace-no-wrap">
  77 + <thead>
  78 + <tr
  79 + 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"
  80 + >
  81 + <th class="px-4 py-3">№</th>
  82 + <th class="px-4 py-3">Название пункта</th>
  83 + <th class="px-4 py-3">Название компании</th>
  84 + <th class="px-4 py-3">Сортировка</th>
  85 + </tr>
  86 + </thead>
  87 + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
  88 + <? foreach($employers as $emp) {?>
  89 + <tr class="text-gray-700 dark:text-gray-400">
  90 + <td class="px-4 py-3">
  91 + {{$emp->id}}
  92 + </td>
  93 + <td class="px-4 py-3">
  94 + {{$emp->name}}
  95 + </td>
  96 + <td class="px-4 py-3">
  97 + <select name="employer_id{{$emp->employer_id}}" id="{{$emp->id}}" data-field="employer_id" class="form-control check_js">
  98 + <option value="0"
  99 + @if($emp->employer_id == 0)
  100 + selected
  101 + @endif
  102 + >Не указано</option>
  103 + @isset($list_employers)
  104 + @foreach($list_employers as $lemp)
  105 + <option value="{{ $lemp->id }}"
  106 + @if($lemp->id == $emp->employer_id)
  107 + selected
  108 + @endif
  109 + >{{ $lemp->name_company }} ({{ $lemp->id }})</option>
  110 + @endforeach
  111 + @endisset
  112 + </select>
  113 + </td>
  114 + <td class="px-4 py-3 text-sm">
  115 + <select name="sort{{$emp->employer_id}}" id="{{$emp->id}}" data-field="sort" class="form-control check_js">
  116 + <option value="100" @if($emp->sort == '100') selected @endif>100</option>
  117 + <option value="110" @if($emp->sort == '110') selected @endif>110</option>
  118 + <option value="120" @if($emp->sort == '120') selected @endif>120</option>
  119 + <option value="130" @if($emp->sort == '130') selected @endif>130</option>
  120 + <option value="140" @if($emp->sort == '140') selected @endif>140</option>
  121 + <option value="150" @if($emp->sort == '150') selected @endif>150</option>
  122 + <option value="160" @if($emp->sort == '160') selected @endif>160</option>
  123 + <option value="170" @if($emp->sort == '170') selected @endif>170</option>
  124 + <option value="180" @if($emp->sort == '180') selected @endif>180</option>
  125 + <option value="190" @if($emp->sort == '190') selected @endif>190</option>
  126 + <option value="200" @if($emp->sort == '200') selected @endif>200</option>
  127 + </select>
  128 + </td>
  129 + </tr>
  130 + <? } ?>
  131 + </tbody>
  132 + </table>
  133 + </div>
  134 +
  135 + <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">
  136 + <?=$employers->appends($_GET)->links('admin.pagginate'); ?>
  137 + </div>
  138 + </div>
  139 +@endsection
resources/views/admin/employer_main/index_ajax.blade.php
... ... @@ -0,0 +1,63 @@
  1 +<div class="w-full overflow-x-auto">
  2 + <table class="w-full whitespace-no-wrap">
  3 + <thead>
  4 + <tr
  5 + 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"
  6 + >
  7 + <th class="px-4 py-3">№</th>
  8 + <th class="px-4 py-3">Название пункта</th>
  9 + <th class="px-4 py-3">Название компании</th>
  10 + <th class="px-4 py-3">Сортировка</th>
  11 + </tr>
  12 + </thead>
  13 + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
  14 + <? foreach($employers as $emp) {?>
  15 + <tr class="text-gray-700 dark:text-gray-400">
  16 + <td class="px-4 py-3">
  17 + {{$emp->id}}
  18 + </td>
  19 + <td class="px-4 py-3">
  20 + {{$emp->name}}
  21 + </td>
  22 + <td class="px-4 py-3">
  23 + <select name="employer_id{{$emp->employer_id}}" id="{{$emp->id}}" data-field="employer_id" class="form-control check_js">
  24 + <option value="0"
  25 + @if($emp->employer_id == 0)
  26 + selected
  27 + @endif
  28 + >Не указано</option>
  29 + @isset($list_employers)
  30 + @foreach($list_employers as $lemp)
  31 + <option value="{{ $lemp->id }}"
  32 + @if($lemp->id == $emp->employer_id)
  33 + selected
  34 + @endif
  35 + >{{ $lemp->name_company }} ({{ $lemp->id }})</option>
  36 + @endforeach
  37 + @endisset
  38 + </select>
  39 + </td>
  40 + <td class="px-4 py-3 text-sm">
  41 + <select name="sort{{$emp->employer_id}}" id="{{$emp->id}}" data-field="sort" class="form-control check_js">
  42 + <option value="100" @if($emp->sort == '100') selected @endif>100</option>
  43 + <option value="110" @if($emp->sort == '110') selected @endif>110</option>
  44 + <option value="120" @if($emp->sort == '120') selected @endif>120</option>
  45 + <option value="130" @if($emp->sort == '130') selected @endif>130</option>
  46 + <option value="140" @if($emp->sort == '140') selected @endif>140</option>
  47 + <option value="150" @if($emp->sort == '150') selected @endif>150</option>
  48 + <option value="160" @if($emp->sort == '160') selected @endif>160</option>
  49 + <option value="170" @if($emp->sort == '170') selected @endif>170</option>
  50 + <option value="180" @if($emp->sort == '180') selected @endif>180</option>
  51 + <option value="190" @if($emp->sort == '190') selected @endif>190</option>
  52 + <option value="200" @if($emp->sort == '200') selected @endif>200</option>
  53 + </select>
  54 + </td>
  55 + </tr>
  56 + <? } ?>
  57 + </tbody>
  58 + </table>
  59 +</div>
  60 +
  61 +<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">
  62 + <?=$employers->appends($_GET)->links('admin.pagginate'); ?>
  63 +</div>
resources/views/admin/job_main/index.blade.php
... ... @@ -0,0 +1,139 @@
  1 +@extends('layout.admin', ['title' => 'Админка - Должности на главной'])
  2 +
  3 +@section('script')
  4 + <script>
  5 + $(document).ready(function() {
  6 + $(document).on('change', '.check_js', function () {
  7 + var this_ = $(this);
  8 + var id = this_.attr('id');
  9 + var field = this_.attr('data-field');
  10 + var value = this_.val();
  11 + var ajax_block = $('#ajax_block');
  12 + var str ="id=" + id + "&"+ field + "=" + value;
  13 + console.log(str);
  14 + $.ajax({
  15 + type: "GET",
  16 + url: "{{ url()->full()}}",
  17 + data: str,
  18 + success: function (data) {
  19 + console.log('Обновление таблицы пользователей ');
  20 + //data = JSON.parse(data);
  21 + //console.log(data);
  22 + ajax_block.html(data);
  23 + },
  24 + headers: {
  25 + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  26 + },
  27 + error: function (data) {
  28 + console.log('Error: ' + data);
  29 + }
  30 + });
  31 + });
  32 +
  33 + });
  34 + </script>
  35 +@endsection
  36 +
  37 +@section('search')
  38 + <!--<div class="absolute inset-y-0 flex items-center pl-2">
  39 + <svg
  40 + class="w-4 h-4"
  41 + aria-hidden="true"
  42 + fill="currentColor"
  43 + viewBox="0 0 20 20"
  44 + >
  45 + <path
  46 + fill-rule="evenodd"
  47 + 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"
  48 + clip-rule="evenodd"
  49 + ></path>
  50 + </svg>
  51 + </div>
  52 + <form action="" method="POST">
  53 + <div style="float:left;"><input
  54 + 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"
  55 + style="width: 400px"
  56 + type="text"
  57 + placeholder="Искать..."
  58 + aria-label="Search"
  59 + /></div>
  60 + <div style="float: left">
  61 + <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
  62 + </div>
  63 + </form>-->
  64 +@endsection
  65 +
  66 +@section('content')
  67 + <style>
  68 + .col {
  69 + width: 250px; /* Ширина блока */
  70 + word-wrap: break-word; /* Перенос слов */
  71 + word-break: break-all;
  72 + }
  73 + </style>
  74 + <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
  75 + <div class="w-full overflow-x-auto">
  76 + <table class="w-full whitespace-no-wrap">
  77 + <thead>
  78 + <tr
  79 + 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"
  80 + >
  81 + <th class="px-4 py-3">№</th>
  82 + <th class="px-4 py-3">Название пункта</th>
  83 + <th class="px-4 py-3">Должность</th>
  84 + <th class="px-4 py-3">Сортировка</th>
  85 + </tr>
  86 + </thead>
  87 + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
  88 + <? foreach($jobs as $job) {?>
  89 + <tr class="text-gray-700 dark:text-gray-400">
  90 + <td class="px-4 py-3">
  91 + {{$job->id}}
  92 + </td>
  93 + <td class="px-4 py-3">
  94 + {{$job->name}}
  95 + </td>
  96 + <td class="px-4 py-3">
  97 + <select name="job_title_id{{$job->id}}" id="{{$job->id}}" data-field="job_title_id" class="form-control check_js">
  98 + <option value="0"
  99 + @if($job->job_title_id == 0)
  100 + selected
  101 + @endif
  102 + >Не указано</option>
  103 + @isset($list_job_titles)
  104 + @foreach($list_job_titles as $job_title)
  105 + <option value="{{ $job_title->id }}"
  106 + @if($job_title->id == $job->job_title_id)
  107 + selected
  108 + @endif
  109 + >{{ $job_title->name }} ({{ $job_title->id }})</option>
  110 + @endforeach
  111 + @endisset
  112 + </select>
  113 + </td>
  114 + <td class="px-4 py-3 text-sm">
  115 + <select name="sort{{$job->id}}" id="{{$job->id}}" data-field="sort" class="form-control check_js">
  116 + <option value="100" @if($job->sort == '100') selected @endif>100</option>
  117 + <option value="110" @if($job->sort == '110') selected @endif>110</option>
  118 + <option value="120" @if($job->sort == '120') selected @endif>120</option>
  119 + <option value="130" @if($job->sort == '130') selected @endif>130</option>
  120 + <option value="140" @if($job->sort == '140') selected @endif>140</option>
  121 + <option value="150" @if($job->sort == '150') selected @endif>150</option>
  122 + <option value="160" @if($job->sort == '160') selected @endif>160</option>
  123 + <option value="170" @if($job->sort == '170') selected @endif>170</option>
  124 + <option value="180" @if($job->sort == '180') selected @endif>180</option>
  125 + <option value="190" @if($job->sort == '190') selected @endif>190</option>
  126 + <option value="200" @if($job->sort == '200') selected @endif>200</option>
  127 + </select>
  128 + </td>
  129 + </tr>
  130 + <? } ?>
  131 + </tbody>
  132 + </table>
  133 + </div>
  134 +
  135 + <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">
  136 + <?=$jobs->appends($_GET)->links('admin.pagginate'); ?>
  137 + </div>
  138 + </div>
  139 +@endsection
resources/views/admin/job_main/index_ajax.blade.php
... ... @@ -0,0 +1,63 @@
  1 +<div class="w-full overflow-x-auto">
  2 + <table class="w-full whitespace-no-wrap">
  3 + <thead>
  4 + <tr
  5 + 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"
  6 + >
  7 + <th class="px-4 py-3">№</th>
  8 + <th class="px-4 py-3">Название пункта</th>
  9 + <th class="px-4 py-3">Должность</th>
  10 + <th class="px-4 py-3">Сортировка</th>
  11 + </tr>
  12 + </thead>
  13 + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
  14 + <? foreach($jobs as $job) {?>
  15 + <tr class="text-gray-700 dark:text-gray-400">
  16 + <td class="px-4 py-3">
  17 + {{$job->id}}
  18 + </td>
  19 + <td class="px-4 py-3">
  20 + {{$job->name}}
  21 + </td>
  22 + <td class="px-4 py-3">
  23 + <select name="job_title_id{{$job->id}}" id="{{$job->id}}" data-field="job_title_id" class="form-control check_js">
  24 + <option value="0"
  25 + @if($job->job_title_id == 0)
  26 + selected
  27 + @endif
  28 + >Не указано</option>
  29 + @isset($list_job_titles)
  30 + @foreach($list_job_titles as $job_title)
  31 + <option value="{{ $job_title->id }}"
  32 + @if($job_title->id == $job->job_title_id)
  33 + selected
  34 + @endif
  35 + >{{ $job_title->name }} ({{ $job_title->id }})</option>
  36 + @endforeach
  37 + @endisset
  38 + </select>
  39 + </td>
  40 + <td class="px-4 py-3 text-sm">
  41 + <select name="sort{{$job->id}}" id="{{$job->id}}" data-field="sort" class="form-control check_js">
  42 + <option value="100" @if($job->sort == '100') selected @endif>100</option>
  43 + <option value="110" @if($job->sort == '110') selected @endif>110</option>
  44 + <option value="120" @if($job->sort == '120') selected @endif>120</option>
  45 + <option value="130" @if($job->sort == '130') selected @endif>130</option>
  46 + <option value="140" @if($job->sort == '140') selected @endif>140</option>
  47 + <option value="150" @if($job->sort == '150') selected @endif>150</option>
  48 + <option value="160" @if($job->sort == '160') selected @endif>160</option>
  49 + <option value="170" @if($job->sort == '170') selected @endif>170</option>
  50 + <option value="180" @if($job->sort == '180') selected @endif>180</option>
  51 + <option value="190" @if($job->sort == '190') selected @endif>190</option>
  52 + <option value="200" @if($job->sort == '200') selected @endif>200</option>
  53 + </select>
  54 + </td>
  55 + </tr>
  56 + <? } ?>
  57 + </tbody>
  58 + </table>
  59 +</div>
  60 +
  61 +<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">
  62 + <?=$jobs->appends($_GET)->links('admin.pagginate'); ?>
  63 +</div>
resources/views/admin/messages.blade.php
1   -@extends('layout.admin', ['title' => 'Админка - Вакансии'])
  1 +@extends('layout.admin', ['title' => 'Админка - Сообщения'])
2 2  
3 3 @section('script')
4 4 @endsection
resources/views/admin/pages/add.blade.php
... ... @@ -0,0 +1,7 @@
  1 +@extends('layout.admin', ['title' => 'Админка - Добавление страницы'])
  2 +
  3 +@section('content')
  4 + <form method="POST" action="{{ route('admin.add-page-store') }}">
  5 + @include('admin.pages.form')
  6 + </form>
  7 +@endsection
resources/views/admin/pages/edit.blade.php
... ... @@ -0,0 +1,7 @@
  1 +@extends('layout.admin', ['title' => 'Админка - Редактирование страницы'])
  2 +
  3 +@section('content')
  4 + <form method="POST" action="{{ route('admin.update-page', ['page' => $page->id]) }}">
  5 + @include('admin.pages.form')
  6 + </form>
  7 +@endsection
resources/views/admin/pages/form.blade.php
... ... @@ -0,0 +1,82 @@
  1 +@csrf
  2 +
  3 +@isset($page)
  4 + @method('PUT')
  5 +@endisset
  6 +
  7 +<div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
  8 +
  9 +<label class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
  10 + <label class="block text-sm">
  11 + <span class="text-gray-700 dark:text-gray-400">Название страницы</span>
  12 + <input name="name" id="name"
  13 + 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"
  14 + placeholder="Имя категории" value="{{ old('name') ?? $page->name ?? '' }}"
  15 + />
  16 + @error('name')
  17 + <span class="text-xs text-red-600 dark:text-red-400">
  18 + {{ $message }}
  19 + </span>
  20 + @enderror
  21 + </label><br>
  22 +
  23 + <label class="block text-sm">
  24 + <span class="text-gray-700 dark:text-gray-400">Английский псевдоним страницы</span>
  25 + <input name="slug" id="slug"
  26 + 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"
  27 + placeholder="Имя категории" value="{{ old('slug') ?? $page->slug ?? '' }}"
  28 + />
  29 + @error('slug')
  30 + <span class="text-xs text-red-600 dark:text-red-400">
  31 + {{ $message }}
  32 + </span>
  33 + @enderror
  34 + </label><br>
  35 +
  36 + <label class="block text-sm">
  37 + <span class="text-gray-700 dark:text-gray-400">Анонс</span>
  38 + <textarea class="form-control ckeditor" name="anons" placeholder="Анонс (html)" required
  39 + rows="10">{{ old('anons') ?? $page->anons ?? '' }}</textarea>
  40 + @error('anons')
  41 + <span class="text-xs text-red-600 dark:text-red-400">
  42 + {{ $message }}
  43 + </span>
  44 + @enderror
  45 + </label><br>
  46 +
  47 + <label class="block text-sm">
  48 + <span class="text-gray-700 dark:text-gray-400">Текст</span>
  49 + <textarea class="form-control ckeditor" name="text" placeholder="Текст (html)" required
  50 + rows="10">{{ old('text') ?? $page->text ?? '' }}</textarea>
  51 + @error('text')
  52 + <span class="text-xs text-red-600 dark:text-red-400">
  53 + {{ $message }}
  54 + </span>
  55 + @enderror
  56 + </label><br>
  57 +
  58 + <label class="block text-sm">
  59 + <span class="text-gray-700 dark:text-gray-400">Автор</span>
  60 + <input name="author" id="author"
  61 + 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"
  62 + placeholder="Имя категории" value="{{ old('author') ?? $page->author ?? '' }}"
  63 + />
  64 + @error('author')
  65 + <span class="text-xs text-red-600 dark:text-red-400">
  66 + {{ $message }}
  67 + </span>
  68 + @enderror
  69 + </label><br>
  70 +
  71 + <label class="block text-sm">
  72 + <input type="file" class="form-control-file" name="image" accept="image/png, image/jpeg">
  73 + </label>
  74 +
  75 + <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
  76 + <div>
  77 + <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">
  78 + Сохранить
  79 + </button>
  80 + </div>
  81 + </div>
  82 +</div>
resources/views/admin/pages/index.blade.php
... ... @@ -0,0 +1,90 @@
  1 +@extends('layout.admin', ['title' => 'Админка - Страницы сайта'])
  2 +
  3 +@section('script')
  4 +
  5 +@endsection
  6 +
  7 +@section('search')
  8 + <!--<div class="absolute inset-y-0 flex items-center pl-2">
  9 + <svg
  10 + class="w-4 h-4"
  11 + aria-hidden="true"
  12 + fill="currentColor"
  13 + viewBox="0 0 20 20"
  14 + >
  15 + <path
  16 + fill-rule="evenodd"
  17 + 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"
  18 + clip-rule="evenodd"
  19 + ></path>
  20 + </svg>
  21 + </div>
  22 + <form action="" method="POST">
  23 + <div style="float:left;"><input
  24 + 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"
  25 + style="width: 400px"
  26 + type="text"
  27 + placeholder="Искать..."
  28 + aria-label="Search"
  29 + /></div>
  30 + <div style="float: left">
  31 + <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
  32 + </div>
  33 + </form>-->
  34 +@endsection
  35 +
  36 +@section('content')
  37 +
  38 + <a href="{{ route('admin.add-page') }}" style="width: 170px" 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">
  39 + Добавить страницу
  40 + </a>
  41 + <br>
  42 + <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
  43 +
  44 + <div class="w-full overflow-x-auto">
  45 + <table class="w-full whitespace-no-wrap">
  46 + <thead>
  47 + <tr
  48 + 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"
  49 + >
  50 + <th class="px-4 py-3">№</th>
  51 + <th class="px-4 py-3">Название страницы</th>
  52 + <th class="px-4 py-3">Адрес</th>
  53 + <th class="px-4 py-3">Дата создания</th>
  54 + <th class="px-4 py-3">Редактировать</th>
  55 + </tr>
  56 + </thead>
  57 + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
  58 + @foreach($pages as $page)
  59 + <tr class="text-gray-700 dark:text-gray-400">
  60 + <td class="px-4 py-3">
  61 + {{$page->id}}
  62 + </td>
  63 + <td class="px-4 py-3">
  64 + {{$page->name}}
  65 + </td>
  66 + <td class="px-4 py-3">
  67 + {{ action([\App\Http\Controllers\PagesController::class, 'pages'], ['slug' => $page->slug]) }}
  68 + </td>
  69 + <td class="px-4 py-3">
  70 + {{$page->created_at}}
  71 + </td>
  72 + <td class="px-4 py-3 text-sm_">
  73 + <form action="{{ route('admin.delete-page', ['page' => $page->id]) }}" method="POST">
  74 + <a href="{{ route('admin.edit-page', ['page' => $page->id]) }}">Изменить</a> |
  75 + @csrf
  76 + @method('DELETE')
  77 + <input class="btn btn-danger" type="submit" value="Удалить"/>
  78 + </form>
  79 + </td>
  80 + </tr>
  81 + @endforeach
  82 + </tbody>
  83 + </table>
  84 + </div>
  85 +
  86 + <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">
  87 + <?=$pages->appends($_GET)->links('admin.pagginate'); ?>
  88 + </div>
  89 + </div>
  90 +@endsection
resources/views/admin/users/roles/index.blade.php
... ... @@ -43,7 +43,7 @@
43 43 @endsection
44 44  
45 45 @section('search')
46   - <div class="absolute inset-y-0 flex items-center pl-2">
  46 + <!--<div class="absolute inset-y-0 flex items-center pl-2">
47 47 <svg
48 48 class="w-4 h-4"
49 49 aria-hidden="true"
... ... @@ -68,7 +68,7 @@
68 68 <div style="float: left">
69 69 <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
70 70 </div>
71   - </form>
  71 + </form>-->
72 72 @endsection
73 73  
74 74 @section('content')
... ... @@ -181,8 +181,20 @@ Route::group([
181 181 // кабинет - редактор seo-сайта
182 182 Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo');
183 183  
  184 +
184 185 // кабинет - редактор страниц
185 186 Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages');
  187 + // кабинет - добавление страницы
  188 + Route::get('editor-pages/add', [CompanyController::class, 'editor_pages_add'])->name('add-page');
  189 + // кабинет - сохранение формы страницы
  190 + Route::post('editor-page/add', [CompanyController::class, 'editor_pages_store'])->name('add-page-store');
  191 + // кабинет - редактирование форма страницы
  192 + Route::get('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_edit'])->name('edit-page');
  193 + // кабинет - сохранение редактированной формы страницы
  194 + Route::put('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_update'])->name('update-page');
  195 + // кабинет - удаление страницы
  196 + Route::delete('editor-pages/delete/{page}', [CompanyController::class, 'editor_pages_destroy'])->name('delete-page');
  197 +
186 198  
187 199 // кабинет - реклама сайта
188 200 Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames');