Commit 7592f66e6957f0ef01b88473620daeff2255f7fe

Authored by Андрей Ларионов
Exists in master

Merge branch 'master' of http://gitlab.nologostudio.ru/alarionov/rekamore-su

Showing 29 changed files Side-by-side Diff

app/Http/Controllers/Admin/CompanyController.php
... ... @@ -43,19 +43,62 @@ class CompanyController extends Controller
43 43 }
44 44 }
45 45  
  46 + ////////////////////////////////////////////////////////////////////////////////
46 47 // кабинет - редактор шапки-футера сайта
47 48 public function editblocks(Request $request) {
48 49 if ($request->ajax()) {
49 50 $header_footer = header_footer::where('header', $request->header)->OrderBy('sort')->OrderBy('name')->paginate(15);
50 51 $list_menu = header_footer::where('header', $request->header)->OrderBy('name')->get();
51   - return view('admin.editbloks.index_ajax', compact('header_footer'));
  52 + return view('admin.editbloks.index_ajax', compact('header_footer', 'list_menu'));
52 53 } else {
53 54 $header_footer = header_footer::where('header', '1')->OrderBy('sort')->OrderBy('name')->paginate(15);
54 55 $list_menu = header_footer::where('header', '1')->OrderBy('name')->get();
55   - return view('admin.editbloks.index', compact('header_footer'));
  56 + return view('admin.editbloks.index', compact('header_footer', 'list_menu'));
56 57 }
57 58 }
58 59  
  60 + public function editblock_add() {
  61 + $items = header_footer::query()->OrderBy('name')->get();
  62 + return view('admin.editbloks.add', compact('items'));
  63 + }
  64 +
  65 + public function editblock_store(Request $request) {
  66 + header_footer::create($request->all());
  67 + return redirect()->route('admin.edit-blocks');
  68 + }
  69 +
  70 + public function editblock_ajax(Request $request) {
  71 + if ($request->ajax()) {
  72 + $hf = header_footer::find($request->id);
  73 + $filter = $request->header;
  74 + unset($request->id);
  75 + unset($request->header);
  76 + $hf->update($request->all());
  77 +
  78 + $header_footer = header_footer::where('header', $filter)->OrderBy('sort')->OrderBy('name')->paginate(15);
  79 + $list_menu = header_footer::where('header', $filter)->OrderBy('name')->get();
  80 + return view('admin.editbloks.index_ajax', compact('header_footer', 'list_menu'));
  81 + } else {
  82 + return "Ошибка!";
  83 + }
  84 + }
  85 +
  86 + public function editblock_edit(header_footer $block) {
  87 + $items = header_footer::query()->OrderBy('name')->get();
  88 + return view('admin.editbloks.edit', compact('block', 'items'));
  89 + }
  90 +
  91 + public function editblock_update(Request $request, header_footer $block) {
  92 + $block->update($request->all());
  93 + return redirect()->route('admin.edit-blocks');
  94 + }
  95 +
  96 + public function editblock_destroy(header_footer $block) {
  97 + $block->delete();
  98 + return redirect()->route('admin.edit-blocks');
  99 + }
  100 + /////////////////////////////////////////////////////////
  101 +
59 102 // кабинет - редактор работодатели на главной
60 103 public function employers_main(Request $request) {
61 104 if ($request->ajax()) {
app/Http/Controllers/Admin/EmployersController.php
... ... @@ -3,8 +3,10 @@
3 3 namespace App\Http\Controllers\Admin;
4 4  
5 5 use App\Http\Controllers\Controller;
  6 +use App\Models\Ad_employer;
6 7 use App\Models\Answer;
7 8 use App\Models\Employer;
  9 +use App\Models\Static_ad;
8 10 use App\Models\User;
9 11 use Illuminate\Http\Request;
10 12 use Illuminate\Support\Facades\Storage;
... ... @@ -19,11 +21,22 @@ class EmployersController extends Controller
19 21 $user->update($request->all());
20 22 }
21 23  
22   - $users = User::where('is_worker', '0')->paginate(15);
  24 + $users = User::where('is_worker', '0');
  25 + $find_key = "";
  26 + if (isset($request->find)) {
  27 + $find_key = $request->find;
  28 + $users = $users->where(function($query) use($find_key) {
  29 + $query->Where('name', 'LIKE', "%$find_key%")
  30 + ->orWhere('email', 'LIKE', "%$find_key%")
  31 + ->orWhere('telephone', 'LIKE', "%$find_key%");
  32 + });
  33 + }
  34 + $users = $users->paginate(15);
  35 +
23 36 if ($request->ajax()) {
24 37 return view('admin.employer.index_ajax', compact('users'));
25 38 } else {
26   - return view('admin.employer.index', compact('users'));
  39 + return view('admin.employer.index', compact('users', 'find_key'));
27 40 }
28 41 }
29 42  
... ... @@ -107,8 +120,28 @@ class EmployersController extends Controller
107 120 }
108 121  
109 122 // кабинет - статистика вакансий работодателя
110   - public function static_ads() {
111   - return;
  123 + public function static_ads(Request $request) {
  124 + $stat = Static_ad::with('ads');
  125 + $ads = Ad_employer::query()->active()->OrderBy('id')->get();
  126 + $periods = Static_ad::query()->distinct('year_month')->select('year_month')->get();
  127 + if ($request->ajax()) {
  128 + if (isset($request->ad_employer_id))
  129 + if (!$request->ad_employer_id == "0")
  130 + $stat = $stat->Where('ad_employer_id', '=', $request->ad_employer_id);
  131 + if (isset($request->year_month)) {
  132 + if (!$request->year_month == "0")
  133 + $stat = $stat->Where('year_month', '=', $request->year_month);
  134 + }
  135 + }
  136 +
  137 + $stat = $stat->OrderByDesc('year_month');
  138 + $stat = $stat->paginate(15);
  139 +
  140 + if ($request->ajax())
  141 + return view('admin.static.index_ads_ajax', compact('stat'));
  142 + else
  143 + return view('admin.static.index_ads', compact('stat', 'ads', 'periods'));
  144 +
112 145 }
113 146  
114 147  
app/Http/Controllers/Admin/MsgAnswersController.php
... ... @@ -4,7 +4,11 @@ namespace App\Http\Controllers\Admin;
4 4  
5 5 use App\Http\Controllers\Controller;
6 6 use App\Models\Message;
  7 +use App\Models\User;
7 8 use Illuminate\Http\Request;
  9 +use Illuminate\Support\Facades\Auth;
  10 +use Illuminate\Support\Facades\DB;
  11 +use Illuminate\Support\Facades\Validator;
8 12  
9 13 class MsgAnswersController extends Controller
10 14 {
... ... @@ -13,4 +17,59 @@ class MsgAnswersController extends Controller
13 17  
14 18 return view('admin.messages', compact('Msgs'));
15 19 }
  20 +
  21 + public function admin_messages(Request $request) {
  22 + $id_admin = Auth::user()->id;
  23 + $users = User::query()->OrderBy('name')->get();
  24 +
  25 + $Msgs = Message::query()->where('user_id', '=', $id_admin)
  26 + ->orWhere('to_user_id', '=', $id_admin)
  27 + ->orderByDesc('created_at')->paginate(5);
  28 +
  29 + return view('admin.message.index', compact('Msgs', 'id_admin', 'users'));
  30 + }
  31 +
  32 + public function messages_sql(Request $request) {
  33 + $id = Auth::user()->id;
  34 + DB::enableQueryLog();
  35 + //$query = DB::select('select * from users where id = :id', ['id' => 1]);
  36 + $query = DB::select(DB::raw('SELECT u1.name as "To-user", u2.name as "From-user", m1.`text`, m1.created_at
  37 + FROM messages m1
  38 + JOIN (SELECT MAX(id) id FROM messages
  39 + GROUP BY LEAST(user_id, to_user_id),
  40 + GREATEST(user_id, to_user_id)
  41 + ) m2 USING (id)
  42 + JOIN users u1 ON u1.id = m1.user_id
  43 + JOIN users u2 ON u2.id = m1.to_user_id
  44 + Where ((m1.user_id = :uid) or (m1.to_user_id = :uid2))
  45 + '), ['uid' => $id, 'uid2' => $id]);
  46 + //dump(DB::getQueryLog());
  47 + dd($query);
  48 + return;
  49 + }
  50 +
  51 + public function admin_messages_post(Request $request) {
  52 + $rules = [
  53 + 'title' => 'required|min:3|max:255',
  54 + 'text' => 'required|min:1'
  55 + ];
  56 +
  57 + $messages = [
  58 + 'required' => 'Поле не может быть пустым!',
  59 + ];
  60 +
  61 + $validator = Validator::make($request->all(), $rules, $messages);
  62 +
  63 + if ($validator->fails()) {
  64 + return redirect()->route('admin.admin-messages')->withErrors($validator);
  65 + } else {
  66 + $params = $request->all();
  67 + $id_admin = Auth::user()->id;
  68 + if ($request->has('file')) {
  69 + $params['file'] = $request->file('file')->store("upload/".$id_admin, 'public');
  70 + }
  71 + Message::create($params);
  72 + return redirect()->route('admin.admin-messages');
  73 + }
  74 + }
16 75 }
app/Http/Controllers/Admin/UsersController.php
... ... @@ -17,13 +17,19 @@ class UsersController extends Controller
17 17 $request->offsetUnset('id');
18 18 $user->update($request->all());
19 19 }
20   -
21   - $users = User::query()->paginate(15);
  20 + $find_key = "";
  21 + $users = User::query();
  22 + if (isset($request->find)) {
  23 + $find_key = $request->find;
  24 + $users = $users->where('name', 'LIKE', "%$find_key%")
  25 + ->orWhere('email', 'LIKE', "%$find_key%");
  26 + }
  27 + $users = $users->paginate(15);
22 28  
23 29 if ($request->ajax()) {
24 30 return view('admin.users.index_ajax', compact('users', 'id_admin'));
25 31 } else {
26   - return view('admin.users.index', compact('users', 'title', 'id_admin'));
  32 + return view('admin.users.index', compact('users', 'title', 'id_admin', 'find_key'));
27 33 }
28 34 }
29 35  
app/Http/Controllers/Admin/WorkersController.php
... ... @@ -3,6 +3,7 @@
3 3 namespace App\Http\Controllers\Admin;
4 4  
5 5 use App\Http\Controllers\Controller;
  6 +use App\Models\Static_worker;
6 7 use App\Models\User;
7 8 use App\Models\Worker;
8 9 use Illuminate\Http\Request;
... ... @@ -16,12 +17,23 @@ class WorkersController extends Controller
16 17 $user->update($request->all());
17 18 }
18 19  
19   - $users = User::where('is_worker', '1')->paginate(15);
  20 + $users = User::where('is_worker', '1');
  21 + $find_key = "";
  22 + if (isset($request->find)) {
  23 + $find_key = $request->find;
  24 + $users = $users->where(function($query) use($find_key) {
  25 + $query->Where('name_man', 'LIKE', "%$find_key%")
  26 + ->orWhere('email', 'LIKE', "%$find_key%")
  27 + ->orWhere('telephone', 'LIKE', "%$find_key%");
  28 + });
  29 + }
  30 +
  31 + $users = $users->paginate(15);
20 32  
21 33 if ($request->ajax()) {
22 34 return view('admin.worker.index_ajax', compact('users'));
23 35 } else {
24   - return view('admin.worker.index', compact('users'));
  36 + return view('admin.worker.index', compact('users', 'find_key'));
25 37 }
26 38 }
27 39  
... ... @@ -30,8 +42,35 @@ class WorkersController extends Controller
30 42 }
31 43  
32 44 // кабинет - статистика работников
33   - public function static_workers() {
34   - return;
  45 + public function static_workers(Request $request) {
  46 + $stat = Static_worker::with('users');
  47 + //->join('users', 'users.id', '=', 'static_workers.user_id');
  48 + $users = User::query()->active()->OrderBy('id')->get();
  49 + $periods = Static_worker::query()->distinct('year_month')->select('year_month')->get();
  50 + if ($request->ajax()) {
  51 + if (isset($request->user_id))
  52 + if (!$request->user_id == "0")
  53 + $stat = $stat->Where('user_id', '=', $request->user_id);
  54 + if (isset($request->year_month)) {
  55 + if (!$request->year_month == "0")
  56 + $stat = $stat->Where('year_month', '=', $request->year_month);
  57 + }
  58 + }
  59 +
  60 + $stat = $stat->OrderByDesc('year_month');
  61 + //->OrderBy('users.name');
  62 + //OrderBy('users.name')->
  63 + /*$stat->implode() loadMissing(['users' => function (Builder $query) {
  64 + $query->orderBy('name', 'asc');
  65 + }]);*/
  66 +
  67 + $stat = $stat->paginate(15);
  68 +
  69 + if ($request->ajax())
  70 + return view('admin.static.index_workers_ajax', compact('stat'));
  71 + else
  72 + return view('admin.static.index_workers', compact('stat', 'users', 'periods'));
  73 +
35 74 }
36 75  
37 76 }
app/Models/Message.php
... ... @@ -9,6 +9,15 @@ class Message extends Model
9 9 {
10 10 use HasFactory;
11 11  
  12 + protected $fillable = [
  13 + 'user_id',
  14 + 'to_user_id',
  15 + 'text',
  16 + 'file',
  17 + 'flag_new'
  18 + ];
  19 +
  20 +
12 21 /*
13 22 * Связь таблицы Message с таблицей User (Отправитель)
14 23 */
app/Models/Static_ad.php
... ... @@ -8,4 +8,21 @@ use Illuminate\Database\Eloquent\Model;
8 8 class Static_ad extends Model
9 9 {
10 10 use HasFactory;
  11 +
  12 + protected $fillable = [
  13 + 'ad_employer_id',
  14 + 'lookin',
  15 + 'year_month',
  16 + 'message',
  17 + 'old_lookin',
  18 + 'old_message'
  19 + ];
  20 +
  21 + /*
  22 + * Связь таблицы ad_employers с таблицей static_ads
  23 + многие-к-одному
  24 + */
  25 + public function ads() {
  26 + return $this->belongsTo(Ad_employer::class, 'ad_employer_id');
  27 + }
11 28 }
app/Models/Static_worker.php
... ... @@ -8,4 +8,22 @@ use Illuminate\Database\Eloquent\Model;
8 8 class Static_worker extends Model
9 9 {
10 10 use HasFactory;
  11 +
  12 + protected $fillable = [
  13 + 'user_id',
  14 + 'lookin',
  15 + 'year_month',
  16 + 'message',
  17 + 'old_lookin',
  18 + 'old_message'
  19 + ];
  20 +
  21 + /*
  22 + * Связь таблицы users с таблицей static_workers
  23 + многие-к-одному
  24 + */
  25 + public function users() {
  26 + return $this->belongsTo(User::class, 'user_id');
  27 + }
  28 +
11 29 }
app/Models/header_footer.php
... ... @@ -8,4 +8,13 @@ use Illuminate\Database\Eloquent\Model;
8 8 class header_footer extends Model
9 9 {
10 10 use HasFactory;
  11 +
  12 + protected $fillable = [
  13 + 'name',
  14 + 'link',
  15 + 'code_id',
  16 + 'category',
  17 + 'header',
  18 + 'sort'
  19 + ];
11 20 }
database/migrations/2023_09_15_070116_alter_static_workers_table.php
... ... @@ -0,0 +1,34 @@
  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('static_workers', function (Blueprint $table) {
  17 + $table->integer('old_lookin')->default(0);
  18 + $table->integer('old_message')->default(0);
  19 + });
  20 + }
  21 +
  22 + /**
  23 + * Reverse the migrations.
  24 + *
  25 + * @return void
  26 + */
  27 + public function down()
  28 + {
  29 + Schema::table('static_workers', function (Blueprint $table) {
  30 + $table->dropColumn('old_lookin');
  31 + $table->dropColumn('old_message');
  32 + });
  33 + }
  34 +};
database/migrations/2023_09_15_070215_alter_static_ads_table.php
... ... @@ -0,0 +1,34 @@
  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('static_ads', function (Blueprint $table) {
  17 + $table->integer('old_lookin')->default(0);
  18 + $table->integer('old_message')->default(0);
  19 + });
  20 + }
  21 +
  22 + /**
  23 + * Reverse the migrations.
  24 + *
  25 + * @return void
  26 + */
  27 + public function down()
  28 + {
  29 + Schema::table('static_ads', function (Blueprint $table) {
  30 + $table->dropColumn('old_lookin');
  31 + $table->dropColumn('old_message');
  32 + });
  33 + }
  34 +};
database/migrations/2023_09_15_071013_alter_messages_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('messages', function (Blueprint $table) {
  17 + $table->boolean('flag_new')->default(1);
  18 + });
  19 + }
  20 +
  21 + /**
  22 + * Reverse the migrations.
  23 + *
  24 + * @return void
  25 + */
  26 + public function down()
  27 + {
  28 + Schema::table('messages', function (Blueprint $table) {
  29 + $table->dropColumn('flag_new');
  30 + });
  31 + }
  32 +};
resources/views/admin/editbloks/add.blade.php
... ... @@ -0,0 +1,7 @@
  1 +@extends('layout.admin', ['title' => 'Админка - Добавление элемента шапки-футера'])
  2 +
  3 +@section('content')
  4 + <form method="POST" action="{{ route('admin.add-block-store') }}">
  5 + @include('admin.editbloks.form')
  6 + </form>
  7 +@endsection
resources/views/admin/editbloks/edit.blade.php
... ... @@ -0,0 +1,7 @@
  1 +@extends('layout.admin', ['title' => 'Админка - Редактирование элемента шапки-футера'])
  2 +
  3 +@section('content')
  4 + <form method="POST" action="{{ route('admin.update-block', ['block' => $block->id]) }}">
  5 + @include('admin.editbloks.form')
  6 + </form>
  7 +@endsection
resources/views/admin/editbloks/form.blade.php
... ... @@ -0,0 +1,61 @@
  1 +@csrf
  2 +@isset($block)
  3 + @method('PUT')
  4 +@endisset
  5 +
  6 +<div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
  7 + <label class="block text-sm">
  8 + <span class="text-gray-700 dark:text-gray-400">Имя</span>
  9 + <input name="name" id="name"
  10 + 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"
  11 + placeholder="Название пункта" value="{{ old('name') ?? $block->name ?? '' }}"
  12 + />
  13 + @error('name')
  14 + <span class="text-xs text-red-600 dark:text-red-400">
  15 + {{ $message }}
  16 + </span>
  17 + @enderror
  18 + </label><br>
  19 +
  20 + <label class="block text-sm">
  21 + <span class="text-gray-700 dark:text-gray-400">Родитель</span>
  22 + @php
  23 + $parent_id = old('code_id') ?? $block->code_id ?? 0;
  24 + @endphp
  25 + <select name="code_id" 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"
  26 + title="Родитель">
  27 + <option value="0">Без родителя</option>
  28 + @include('admin.editbloks.parent_id', ['level' => -1, 'parent' => 0])
  29 + </select>
  30 + </label><br>
  31 +
  32 + <label class="block text-sm">
  33 + <span class="text-gray-700 dark:text-gray-400">Расположение</span>
  34 + <select name="header" 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"
  35 + title="Расположение">
  36 + <option value="1" @isset($block) @if($block->header == 1) selected @endif @endisset>Шапка</option>
  37 + <option value="0" @isset($block) @if($block->header == 0) selected @endif @endisset>Футер</option>
  38 + </select>
  39 + </label><br>
  40 +
  41 + <label class="block text-sm">
  42 + <span class="text-gray-700 dark:text-gray-400">Ссылка</span>
  43 + <input name="link" id="link"
  44 + 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"
  45 + placeholder="Ссылка" value="{{ old('link') ?? $block->link ?? '' }}"
  46 + />
  47 + @error('link')
  48 + <span class="text-xs text-red-600 dark:text-red-400">
  49 + {{ $message }}
  50 + </span>
  51 + @enderror
  52 + </label><br>
  53 +
  54 + <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
  55 + <div>
  56 + <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">
  57 + Сохранить
  58 + </button>
  59 + </div>
  60 + </div>
  61 +</div>
resources/views/admin/editbloks/index.blade.php
... ... @@ -3,16 +3,45 @@
3 3 @section('script')
4 4 <script>
5 5 $(document).ready(function() {
6   - $(document).on('chance', '#header', function () {
  6 + $(document).on('change', '#header', function () {
7 7 var this_ = $(this);
8 8 var value = this_.val();
9 9 var ajax_block = $('#ajax_block');
  10 + console.log('Смена фильтра таблицы меню ');
10 11  
11 12 $.ajax({
12 13 type: "GET",
13 14 url: "{{ url()->full()}}",
14 15 data: "header=" + value,
15 16 success: function (data) {
  17 + console.log('Успешно!');
  18 + ajax_block.html(data);
  19 + },
  20 + headers: {
  21 + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  22 + },
  23 + error: function (data) {
  24 + console.log('Error: ' + data);
  25 + }
  26 + });
  27 + });
  28 +
  29 + $(document).on('change', '.check_js', function () {
  30 + var this_ = $(this);
  31 + var value = this_.val();
  32 + var id_rec = this_.attr('data-fid');
  33 + var field = this_.attr('data-field');
  34 + var ajax_block = $('#ajax_block');
  35 + var filter = $('#header');
  36 + var filter_val = filter.val();
  37 +
  38 + console.log("id=" + id_rec + "&" + field + "=" + value + "&header=" + filter_val);
  39 +
  40 + $.ajax({
  41 + type: "GET",
  42 + url: "{{ route('admin.ajax.block')}}",
  43 + data: "id=" + id_rec + "&" + field + "=" + value + "&header=" + filter_val,
  44 + success: function (data) {
16 45 console.log('Обновление таблицы меню ');
17 46 ajax_block.html(data);
18 47 },
... ... @@ -60,10 +89,10 @@
60 89  
61 90 @section('content')
62 91  
63   - <a href="{{ route('admin.add-seo') }}" style="width: 145px" 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">
  92 + <a href="{{ route('admin.add-block') }}" style="width: 145px" 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">
64 93 Добавить опцию
65 94 </a>
66   - <select name="header" id="header" class="form-control">
  95 + <select name="header" id="header" 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">
67 96 <option value="1">Шапка</option>
68 97 <option value="0">Футер</option>
69 98 </select>
... ... @@ -99,7 +128,7 @@
99 128 {{$page->link}}
100 129 </td>
101 130 <td class="px-4 py-3">
102   - <select name="code_id{{$page->code_id}}" id="{{$page->id}}" data-field="code_id" class="form-control check_js">
  131 + <select name="code_id{{$page->code_id}}" id="code_id{{$page->id}}" data-fid="{{$page->id}}" data-field="code_id" class="form-control check_js">
103 132 <option value="0"
104 133 @if($page->code_id == 0)
105 134 selected
... ... @@ -108,7 +137,7 @@
108 137 @isset($list_menu)
109 138 @foreach($list_menu as $menu)
110 139 <option value="{{ $menu->id }}"
111   - @if($menu->id == $page->code_id)
  140 + @if($menu->id == $page->code_id)
112 141 selected
113 142 @endif
114 143 >{{ $menu->name }} ({{ $menu->id }})</option>
... ... @@ -117,7 +146,7 @@
117 146 </select>
118 147 </td>
119 148 <td class="px-4 py-3 text-sm">
120   - <select name="sort{{$page->id}}" id="{{$page->id}}" data-field="sort" class="form-control check_js">
  149 + <select name="sort{{$page->id}}" id="sort{{$page->id}}" data-fid="{{$page->id}}" data-field="sort" class="form-control check_js">
121 150 <option value="100" @if($page->sort == '100') selected @endif>100</option>
122 151 <option value="110" @if($page->sort == '110') selected @endif>110</option>
123 152 <option value="120" @if($page->sort == '120') selected @endif>120</option>
... ... @@ -136,14 +165,12 @@
136 165 {{$page->created_at}}
137 166 </td>
138 167 <td class="px-4 py-3 text-sm_">
139   - <? /*?>
140   - <form action="{{ route('admin.delete-seo', ['page' => $page->id]) }}" method="POST">
141   - <a href="{{ route('admin.edit-seo', ['page' => $page->id]) }}">Изменить</a> |
  168 + <form action="{{ route('admin.delete-block', ['block' => $page->id]) }}" method="POST">
  169 + <a href="{{ route('admin.edit-block', ['block' => $page->id]) }}">Изменить</a> |
142 170 @csrf
143 171 @method('DELETE')
144 172 <input class="btn btn-danger" type="submit" value="Удалить"/>
145 173 </form>
146   - <? */ ?>
147 174 </td>
148 175 </tr>
149 176 @endforeach
resources/views/admin/editbloks/index_ajax.blade.php
... ... @@ -26,7 +26,7 @@
26 26 {{$page->link}}
27 27 </td>
28 28 <td class="px-4 py-3">
29   - <select name="code_id{{$page->code_id}}" id="{{$page->id}}" data-field="code_id" class="form-control check_js">
  29 + <select name="code_id{{$page->code_id}}" id="code_id{{$page->id}}" data-fid="{{$page->id}}" data-field="code_id" class="form-control check_js">
30 30 <option value="0"
31 31 @if($page->code_id == 0)
32 32 selected
... ... @@ -44,7 +44,7 @@
44 44 </select>
45 45 </td>
46 46 <td class="px-4 py-3 text-sm">
47   - <select name="sort{{$page->id}}" id="{{$page->id}}" data-field="sort" class="form-control check_js">
  47 + <select name="sort{{$page->id}}" id="sort{{$page->id}}" data-fid="{{$page->id}}" data-field="sort" class="form-control check_js">
48 48 <option value="100" @if($page->sort == '100') selected @endif>100</option>
49 49 <option value="110" @if($page->sort == '110') selected @endif>110</option>
50 50 <option value="120" @if($page->sort == '120') selected @endif>120</option>
... ... @@ -63,14 +63,12 @@
63 63 {{$page->created_at}}
64 64 </td>
65 65 <td class="px-4 py-3 text-sm_">
66   - <? /*?>
67   - <form action="{{ route('admin.delete-seo', ['page' => $page->id]) }}" method="POST">
68   - <a href="{{ route('admin.edit-seo', ['page' => $page->id]) }}">Изменить</a> |
  66 + <form action="{{ route('admin.delete-block', ['block' => $page->id]) }}" method="POST">
  67 + <a href="{{ route('admin.edit-block', ['block' => $page->id]) }}">Изменить</a> |
69 68 @csrf
70 69 @method('DELETE')
71 70 <input class="btn btn-danger" type="submit" value="Удалить"/>
72 71 </form>
73   - <? */ ?>
74 72 </td>
75 73 </tr>
76 74 @endforeach
resources/views/admin/editbloks/parent_id.blade.php
... ... @@ -0,0 +1,10 @@
  1 +@if ($items->where('code_id', $parent)->count())
  2 + @php $level++ @endphp
  3 + @foreach ($items->where('code_id', $parent) as $item)
  4 + <option value="{{ $item->id }}" @if ($item->id == $parent_id) selected @endif>
  5 + @if ($level) {!! str_repeat('&nbsp;&nbsp;&nbsp;', $level) !!} @endif
  6 + {{ $item->name }} ({{ $item->id }})
  7 + </option>
  8 + @include('admin.editbloks.parent_id', ['level' => $level, 'parent' => $item->id])
  9 + @endforeach
  10 +@endif
resources/views/admin/employer/index.blade.php
... ... @@ -39,32 +39,7 @@
39 39 @endsection
40 40  
41 41 @section('search')
42   - <div class="absolute inset-y-0 flex items-center pl-2">
43   - <svg
44   - class="w-4 h-4"
45   - aria-hidden="true"
46   - fill="currentColor"
47   - viewBox="0 0 20 20"
48   - >
49   - <path
50   - fill-rule="evenodd"
51   - 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"
52   - clip-rule="evenodd"
53   - ></path>
54   - </svg>
55   - </div>
56   - <form action="" method="POST">
57   - <div style="float:left;"><input
58   - 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"
59   - style="width: 400px"
60   - type="text"
61   - placeholder="Искать..."
62   - aria-label="Search"
63   - /></div>
64   - <div style="float: left">
65   - <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
66   - </div>
67   - </form>
  42 + @include('admin.find')
68 43 @endsection
69 44  
70 45 @section('content')
resources/views/admin/find.blade.php
... ... @@ -0,0 +1,28 @@
  1 +<div class="absolute inset-y-0 flex items-center pl-2">
  2 + <svg
  3 + class="w-4 h-4"
  4 + aria-hidden="true"
  5 + fill="currentColor"
  6 + viewBox="0 0 20 20"
  7 + >
  8 + <path
  9 + fill-rule="evenodd"
  10 + d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z"
  11 + clip-rule="evenodd"
  12 + ></path>
  13 + </svg>
  14 +</div>
  15 +<form action="" method="GET">
  16 + <div style="float:left;"><input
  17 + name="find" id="find"
  18 + class="w-full pl-8 pr-2 text-sm text-gray-700 placeholder-gray-600 bg-gray-100 border-0 rounded-md dark:placeholder-gray-500 dark:focus:shadow-outline-gray dark:focus:placeholder-gray-600 dark:bg-gray-700 dark:text-gray-200 focus:placeholder-gray-500 focus:bg-white focus:border-purple-300 focus:outline-none focus:shadow-outline-purple form-input"
  19 + style="width: 400px"
  20 + type="text"
  21 + placeholder="Искать..."
  22 + aria-label="Search"
  23 + value="{{$find_key}}"
  24 + /></div>
  25 + <div style="float: left">
  26 + <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
  27 + </div>
  28 +</form>
resources/views/admin/message/index.blade.php
... ... @@ -0,0 +1,149 @@
  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 + <table class="w-full whitespace-no-wrap">
  39 + <thead>
  40 + <tr
  41 + 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"
  42 + >
  43 + <th class="px-4 py-3">№</th>
  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 + </tr>
  49 + </thead>
  50 + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
  51 + @foreach($Msgs as $msg)
  52 + <tr class="text-gray-700 dark:text-gray-400">
  53 + <td class="px-4 py-3">
  54 + {{$msg->id}}
  55 + </td>
  56 + <td class="px-4 py-3">
  57 + {{$msg->user_from->name}} ({{$msg->user_from->id}})
  58 + </td>
  59 + <td class="px-4 py-3">
  60 + {{$msg->user_to->name}} ({{$msg->user_to->id}})
  61 + </td>
  62 + <td class="px-4 py-3">
  63 + {{$msg->title}}
  64 + <div class="flex items-center text-sm">
  65 + <textarea cols="7" style="width:250px;">{{ $msg->text }}</textarea>
  66 + </div>
  67 + </td>
  68 + <td class="px-4 py-3 text-sm">
  69 + {{ $msg->created_at }}
  70 + </td>
  71 + </tr>
  72 + @endforeach
  73 + </tbody>
  74 + </table>
  75 + </div>
  76 +
  77 + <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">
  78 + <?=$Msgs->appends($_GET)->links('admin.pagginate'); ?>
  79 + </div>
  80 + </div><br>
  81 +
  82 + <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block2">
  83 +
  84 + <form method="POST" action="{{ route('admin.admin-messages-post') }}" enctype="multipart/form-data">
  85 + @csrf
  86 + <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
  87 + <h3 class="text-gray-700 dark:text-gray-400">Отправка сообщения</h3>
  88 + <hr>
  89 + <label for="ad_employer_id" class="block text-sm">
  90 + <input type="hidden" name="user_id" id="user_id" value="{{ $id_admin }}"/>
  91 +
  92 + <span class="text-gray-700 dark:text-gray-400">Кому:</span>
  93 +
  94 + <select name="to_user_id" id="to_user_id" class="block change_js 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">
  95 + @foreach($users as $user)
  96 + <option value="{{ $user->id }}">{{ $user->name }} ({{ $user->id }})</option>
  97 + @endforeach
  98 + </select>
  99 + </label><br>
  100 +
  101 + <label class="block text-sm">
  102 + <span class="text-gray-700 dark:text-gray-400">Заголовок</span>
  103 + <input name="title" id="title"
  104 + 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"
  105 + placeholder="Заголовок" value="{{ old('title') ?? '' }}"
  106 + />
  107 + @error('title')
  108 + <span class="text-xs text-red-600 dark:text-red-400">
  109 + {{ $message }}
  110 + </span>
  111 + @enderror
  112 + </label><br>
  113 +
  114 + <label class="block text-sm">
  115 + <span class="text-gray-700 dark:text-gray-400">Текст</span>
  116 + <textarea class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray" name="text" placeholder="Текст" required
  117 + rows="4">{{ old('text') ?? '' }}</textarea>
  118 + @error('text')
  119 + <span class="text-xs text-red-600 dark:text-red-400">
  120 + {{ $message }}
  121 + </span>
  122 + @enderror
  123 + </label><br>
  124 +
  125 +
  126 + <label class="block text-sm">
  127 + <span class="text-gray-700 dark:text-gray-400">Файл</span>
  128 + <input type="file" class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700
  129 + focus:border-purple-400 focus:outline-none focus:shadow-outline-purple
  130 + dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
  131 + id="file" name="file">
  132 + @error('file')
  133 + <span class="text-xs text-red-600 dark:text-red-400">
  134 + {{ $message }}
  135 + </span>
  136 + @enderror
  137 + </label><br>
  138 +
  139 + <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
  140 + <div>
  141 + <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">
  142 + Отправить
  143 + </button>
  144 + </div>
  145 + </div>
  146 + </div>
  147 + </form>
  148 + </div>
  149 +@endsection
resources/views/admin/static/index_ads.blade.php
... ... @@ -0,0 +1,131 @@
  1 +@extends('layout.admin', ['title' => 'Админка - Вакансии статистика'])
  2 +
  3 +@section('script')
  4 + <script>
  5 + $(document).ready(function() {
  6 + $(document).on('change', '.change_js', function () {
  7 + var ad_employer_id = $('#ad_employer_id');
  8 + var ad_employer_id_value = ad_employer_id.val();
  9 + var year_month = $('#year_month');
  10 + var year_month_value = year_month.val();
  11 + var ajax_block = $('#ajax_block');
  12 +
  13 + $.ajax({
  14 + type: "GET",
  15 + url: "{{ url()->full()}}",
  16 + data: "ad_employer_id=" + ad_employer_id_value + "&year_month=" + year_month_value,
  17 + success: function (data) {
  18 + console.log('Обновление таблицы резюме ');
  19 + //data = JSON.parse(data);
  20 + console.log(data);
  21 + ajax_block.html(data);
  22 + },
  23 + headers: {
  24 + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  25 + },
  26 + error: function (data) {
  27 + console.log('Error: ' + data);
  28 + }
  29 + });
  30 + });
  31 + });
  32 + </script>
  33 +@endsection
  34 +
  35 +@section('search')
  36 + <!-- <div class="absolute inset-y-0 flex items-center pl-2">
  37 + <svg
  38 + class="w-4 h-4"
  39 + aria-hidden="true"
  40 + fill="currentColor"
  41 + viewBox="0 0 20 20"
  42 + >
  43 + <path
  44 + fill-rule="evenodd"
  45 + 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"
  46 + clip-rule="evenodd"
  47 + ></path>
  48 + </svg>
  49 + </div>
  50 + <form action="" method="POST">
  51 + <div style="float:left;"><input
  52 + 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"
  53 + style="width: 400px"
  54 + type="text"
  55 + placeholder="Искать..."
  56 + aria-label="Search"
  57 + /></div>
  58 + <div style="float: left">
  59 + <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
  60 + </div>
  61 + </form>-->
  62 +@endsection
  63 +
  64 +@section('content')
  65 + <div>
  66 + <label for="ad_employer_id" class="block text-sm">
  67 + <span class="text-gray-700 dark:text-gray-400">Пользователи</span>
  68 + </label>
  69 + <select name="ad_employer_id" id="ad_employer_id" class="block change_js 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">
  70 + <option value="0">Все</option>
  71 + @foreach($ads as $ad)
  72 + <option value="{{ $ad->id }}">{{ $ad->name }} ({{ $ad->id }})</option>
  73 + @endforeach
  74 + </select>
  75 + <label for="year_month" class="block text-sm">
  76 + <span class="text-gray-700 dark:text-gray-400">Периоды</span>
  77 + </label>
  78 + <select name="year_month" id="year_month" class="block change_js 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">
  79 + <option value="0">Все</option>
  80 + @foreach($periods as $period)
  81 + <option value="{{ $period->year_month }}">{{ $period->year_month }}</option>
  82 + @endforeach
  83 + </select><br>
  84 + </div>
  85 + <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
  86 + <div class="w-full overflow-x-auto">
  87 + <table class="w-full whitespace-no-wrap">
  88 + <thead>
  89 + <tr
  90 + 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"
  91 + >
  92 + <th class="px-4 py-3">№</th>
  93 + <th class="px-4 py-3">Вакансия (название/код)</th>
  94 + <th class="px-4 py-3">Интервал времени</th>
  95 + <th class="px-4 py-3">Просмотры</th>
  96 + <th class="px-4 py-3">Сообщения</th>
  97 + </tr>
  98 + </thead>
  99 + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
  100 +
  101 + @foreach($stat as $ad)
  102 + <tr class="text-gray-700 dark:text-gray-400">
  103 + <td class="px-4 py-3">
  104 + {{$ad->id}}
  105 + </td>
  106 + <td class="px-4 py-3">
  107 + {{ $ad->ads->name }} ({{ $ad->ad_employer_id }})
  108 + </td>
  109 + <td class="px-4 py-3">
  110 + {{ $ad->year_month }}
  111 + </td>
  112 + <td class="px-4 py-3">
  113 + {{ $ad->lookin }}
  114 + </td>
  115 + <td class="px-4 py-3">
  116 + {{ $ad->message }}
  117 + </td>
  118 + </tr>
  119 + @endforeach
  120 +
  121 + </tbody>
  122 + </table>
  123 + </div>
  124 +
  125 + <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">
  126 + <?=$stat->appends($_GET)->links('admin.pagginate'); ?>
  127 + </div>
  128 + </div>
  129 +
  130 +
  131 +@endsection
resources/views/admin/static/index_ads_ajax.blade.php
... ... @@ -0,0 +1,42 @@
  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 + <th class="px-4 py-3">Сообщения</th>
  12 + </tr>
  13 + </thead>
  14 + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
  15 +
  16 + @foreach($stat as $ad)
  17 + <tr class="text-gray-700 dark:text-gray-400">
  18 + <td class="px-4 py-3">
  19 + {{$ad->id}}
  20 + </td>
  21 + <td class="px-4 py-3">
  22 + {{ $ad->ads->name }} ({{ $ad->ad_employer_id }})
  23 + </td>
  24 + <td class="px-4 py-3">
  25 + {{ $ad->year_month }}
  26 + </td>
  27 + <td class="px-4 py-3">
  28 + {{ $ad->lookin }}
  29 + </td>
  30 + <td class="px-4 py-3">
  31 + {{ $ad->message }}
  32 + </td>
  33 + </tr>
  34 + @endforeach
  35 +
  36 + </tbody>
  37 + </table>
  38 +</div>
  39 +
  40 +<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">
  41 + <?=$stat->appends($_GET)->links('admin.pagginate'); ?>
  42 +</div>
resources/views/admin/static/index_workers.blade.php
... ... @@ -0,0 +1,131 @@
  1 +@extends('layout.admin', ['title' => 'Админка - Работники статистика'])
  2 +
  3 +@section('script')
  4 + <script>
  5 + $(document).ready(function() {
  6 + $(document).on('change', '.change_js', function () {
  7 + var user_id = $('#user_id');
  8 + var user_id_value = user_id.val();
  9 + var year_month = $('#year_month');
  10 + var year_month_value = year_month.val();
  11 + var ajax_block = $('#ajax_block');
  12 +
  13 + $.ajax({
  14 + type: "GET",
  15 + url: "{{ url()->full()}}",
  16 + data: "user_id=" + user_id_value + "&year_month=" + year_month_value,
  17 + success: function (data) {
  18 + console.log('Обновление таблицы работников ');
  19 + //data = JSON.parse(data);
  20 + console.log(data);
  21 + ajax_block.html(data);
  22 + },
  23 + headers: {
  24 + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  25 + },
  26 + error: function (data) {
  27 + console.log('Error: ' + data);
  28 + }
  29 + });
  30 + });
  31 + });
  32 + </script>
  33 +@endsection
  34 +
  35 +@section('search')
  36 + <!-- <div class="absolute inset-y-0 flex items-center pl-2">
  37 + <svg
  38 + class="w-4 h-4"
  39 + aria-hidden="true"
  40 + fill="currentColor"
  41 + viewBox="0 0 20 20"
  42 + >
  43 + <path
  44 + fill-rule="evenodd"
  45 + 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"
  46 + clip-rule="evenodd"
  47 + ></path>
  48 + </svg>
  49 + </div>
  50 + <form action="" method="POST">
  51 + <div style="float:left;"><input
  52 + 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"
  53 + style="width: 400px"
  54 + type="text"
  55 + placeholder="Искать..."
  56 + aria-label="Search"
  57 + /></div>
  58 + <div style="float: left">
  59 + <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
  60 + </div>
  61 + </form>-->
  62 +@endsection
  63 +
  64 +@section('content')
  65 + <div>
  66 + <label for="user_id" class="block text-sm">
  67 + <span class="text-gray-700 dark:text-gray-400">Пользователи</span>
  68 + </label>
  69 + <select name="user_id" id="user_id" class="block change_js 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">
  70 + <option value="0">Все</option>
  71 + @foreach($users as $user)
  72 + <option value="{{ $user->id }}">{{ !empty($user->name) ? $user->name : $user->name_man }} ({{ $user->id }})</option>
  73 + @endforeach
  74 + </select>
  75 + <label for="year_month" class="block text-sm">
  76 + <span class="text-gray-700 dark:text-gray-400">Периоды</span>
  77 + </label>
  78 + <select name="year_month" id="year_month" class="block change_js 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">
  79 + <option value="0">Все</option>
  80 + @foreach($periods as $period)
  81 + <option value="{{ $period->year_month }}">{{ $period->year_month }}</option>
  82 + @endforeach
  83 + </select><br>
  84 + </div>
  85 + <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
  86 + <div class="w-full overflow-x-auto">
  87 + <table class="w-full whitespace-no-wrap">
  88 + <thead>
  89 + <tr
  90 + 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"
  91 + >
  92 + <th class="px-4 py-3">№</th>
  93 + <th class="px-4 py-3">Юзер (имя/код)</th>
  94 + <th class="px-4 py-3">Интервал времени</th>
  95 + <th class="px-4 py-3">Просмотры</th>
  96 + <th class="px-4 py-3">Сообщения</th>
  97 + </tr>
  98 + </thead>
  99 + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
  100 +
  101 + @foreach($stat as $user)
  102 + <tr class="text-gray-700 dark:text-gray-400">
  103 + <td class="px-4 py-3">
  104 + {{$user->id}}
  105 + </td>
  106 + <td class="px-4 py-3">
  107 + {{ !empty($user->users->name) ? $user->users->name : $user->users->name_man }} ({{ $user->user_id }})
  108 + </td>
  109 + <td class="px-4 py-3">
  110 + {{ $user->year_month }}
  111 + </td>
  112 + <td class="px-4 py-3">
  113 + {{ $user->lookin }}
  114 + </td>
  115 + <td class="px-4 py-3">
  116 + {{ $user->message }}
  117 + </td>
  118 + </tr>
  119 + @endforeach
  120 +
  121 + </tbody>
  122 + </table>
  123 + </div>
  124 +
  125 + <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">
  126 + <?=$stat->appends($_GET)->links('admin.pagginate'); ?>
  127 + </div>
  128 +</div>
  129 +
  130 +
  131 +@endsection
resources/views/admin/static/index_workers_ajax.blade.php
... ... @@ -0,0 +1,40 @@
  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 + <th class="px-4 py-3">Сообщения</th>
  12 + </tr>
  13 + </thead>
  14 + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
  15 + @foreach($stat as $user)
  16 + <tr class="text-gray-700 dark:text-gray-400">
  17 + <td class="px-4 py-3">
  18 + {{$user->id}}
  19 + </td>
  20 + <td class="px-4 py-3">
  21 + {{ !empty($user->users->name) ? $user->users->name : $user->users->name_man }} ({{ $user->user_id }})
  22 + </td>
  23 + <td class="px-4 py-3">
  24 + {{ $user->year_month }}
  25 + </td>
  26 + <td class="px-4 py-3">
  27 + {{ $user->lookin }}
  28 + </td>
  29 + <td class="px-4 py-3">
  30 + {{ $user->message }}
  31 + </td>
  32 + </tr>
  33 + @endforeach
  34 + </tbody>
  35 + </table>
  36 +</div>
  37 +
  38 +<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">
  39 + <?=$stat->appends($_GET)->links('admin.pagginate'); ?>
  40 +</div>
resources/views/admin/users/index.blade.php
... ... @@ -43,32 +43,7 @@
43 43 @endsection
44 44  
45 45 @section('search')
46   - <div class="absolute inset-y-0 flex items-center pl-2">
47   - <svg
48   - class="w-4 h-4"
49   - aria-hidden="true"
50   - fill="currentColor"
51   - viewBox="0 0 20 20"
52   - >
53   - <path
54   - fill-rule="evenodd"
55   - 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"
56   - clip-rule="evenodd"
57   - ></path>
58   - </svg>
59   - </div>
60   - <form action="" method="POST">
61   - <div style="float:left;"><input
62   - 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"
63   - style="width: 400px"
64   - type="text"
65   - placeholder="Искать..."
66   - aria-label="Search"
67   - /></div>
68   - <div style="float: left">
69   - <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
70   - </div>
71   - </form>
  46 + @include('admin.find')
72 47 @endsection
73 48  
74 49 @section('content')
resources/views/admin/worker/index.blade.php
... ... @@ -39,32 +39,7 @@
39 39 @endsection
40 40  
41 41 @section('search')
42   - <div class="absolute inset-y-0 flex items-center pl-2">
43   - <svg
44   - class="w-4 h-4"
45   - aria-hidden="true"
46   - fill="currentColor"
47   - viewBox="0 0 20 20"
48   - >
49   - <path
50   - fill-rule="evenodd"
51   - 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"
52   - clip-rule="evenodd"
53   - ></path>
54   - </svg>
55   - </div>
56   - <form action="" method="POST">
57   - <div style="float:left;"><input
58   - 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"
59   - style="width: 400px"
60   - type="text"
61   - placeholder="Искать..."
62   - aria-label="Search"
63   - /></div>
64   - <div style="float: left">
65   - <button type="submit" class="px-3 py-1 rounded-md focus:outline-none focus:shadow-outline-purple">Искать</button>
66   - </div>
67   - </form>
  42 + @include('admin.find')
68 43 @endsection
69 44  
70 45 @section('content')
resources/views/layout/admin.blade.php
... ... @@ -897,7 +897,7 @@
897 897 <li class="flex">
898 898 <a
899 899 class="inline-flex items-center justify-between w-full px-2 py-1 text-sm font-semibold transition-colors duration-150 rounded-md hover:bg-gray-100 hover:text-gray-800 dark:hover:bg-gray-800 dark:hover:text-gray-200"
900   - href="#"
  900 + href="{{ route('admin.admin-messages') }}"
901 901 >
902 902 <span>Сообщения</span>
903 903 <span
... ... @@ -907,14 +907,14 @@
907 907 </span>
908 908 </a>
909 909 </li>
910   - <li class="flex">
  910 + <!--<li class="flex">
911 911 <a
912 912 class="inline-flex items-center justify-between w-full px-2 py-1 text-sm font-semibold transition-colors duration-150 rounded-md hover:bg-gray-100 hover:text-gray-800 dark:hover:bg-gray-800 dark:hover:text-gray-200"
913 913 href="#"
914 914 >
915 915 <span>Логи</span>
916 916 </a>
917   - </li>
  917 + </li>-->
918 918 </ul>
919 919 </template>
920 920 </li>
... ... @@ -19,6 +19,7 @@ use App\Http\Controllers\Admin\Ad_EmployersController;
19 19 use App\Http\Controllers\Admin\MsgAnswersController;
20 20 use App\Http\Controllers\Admin\GroupsController;
21 21 use App\Http\Controllers\PagesController;
  22 +use Illuminate\Support\Facades\Storage;
22 23  
23 24  
24 25 /*
... ... @@ -90,6 +91,10 @@ Route::group([
90 91 // кабинет профиль админа - сохранение формы
91 92 Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile');
92 93  
  94 + //кабинет сообщения админа
  95 + //Route::get('messages', [AdminController::class, 'profile'])->name('profile');
  96 +
  97 +
93 98 // кабинет профиль - форма пароли
94 99 Route::get('password', [AdminController::class, 'profile_password'])->name('password');
95 100 // кабинет профиль - сохранение формы пароля
... ... @@ -144,8 +149,14 @@ Route::group([
144 149 */
145 150 Route::resource('job-titles', JobTitlesController::class, ['except' => ['show']]);
146 151  
147   - // кабинет - сообщения
  152 + // кабинет - сообщения (чтение чужих)
148 153 Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages');
  154 + // кабинет - сообщения (админские)
  155 + Route::get('admin-messages', [MsgAnswersController::class, 'admin_messages'])->name('admin-messages');
  156 + // кабинет - сообщения (админские)
  157 + Route::post('admin-messages', [MsgAnswersController::class, 'admin_messages_post'])->name('admin-messages-post');
  158 + // кабинет - sql - конструкция запросов
  159 + Route::get('messages-sql', [MsgAnswersController::class, 'messages_sql'])->name('messages-sql');
149 160  
150 161 /*
151 162 * Расписанный подход в описании каждой директорий групп пользователей.
... ... @@ -163,16 +174,26 @@ Route::group([
163 174 // кабинет - удаление группы пользователей
164 175 Route::delete('groups/delete/{group}', [GroupsController::class, 'destroy'])->name('delete-group');
165 176  
  177 +
166 178 // кабинет - список админов
167 179 Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin');
168 180  
  181 +
169 182 /////редактор////// кабинет - редактор сайта////////////////////////
170 183 Route::get('editor-site', function() {
171 184 return view('admin.editor.index');
172 185 })->name('editor-site');
173 186  
  187 +
174 188 // кабинет - редактор шапки-футера сайта
175 189 Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks');
  190 + Route::get('edit-bloks/add', [CompanyController::class, 'editblock_add'])->name('add-block');
  191 + Route::post('edit-bloks/add', [CompanyController::class, 'editblock_store'])->name('add-block-store');
  192 + Route::get('edit-bloks/ajax', [CompanyController::class, 'editblock_ajax'])->name('ajax.block');
  193 + Route::get('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_edit'])->name('edit-block');
  194 + Route::put('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_update'])->name('update-block');
  195 + Route::delete('edit-bloks/delete/{block}', [CompanyController::class, 'editblock_destroy'])->name('delete-block');
  196 +
176 197  
177 198 // кабинет - редактор должности на главной
178 199 Route::get('job-titles-main', [CompanyController::class, 'job_titles_main'])->name('job-titles-main');
... ... @@ -239,6 +260,11 @@ Route::group([
239 260 // кабинет - роли пользователя
240 261 Route::get('roles', [UsersController::class, 'roles'])->name('roles');
241 262  
  263 + Route::get('logs', function() {
  264 + $files = Storage::files('logs/laravel.log');
  265 + print_r($files);
  266 + })->name('logs');
  267 +
242 268 });
243 269  
244 270 Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload');