Commit 86a17538a5914a0115bce89200fddf15e4a228ee
1 parent
673a7768d8
Exists in
master
and in
1 other branch
Реклама, правки в соискатели, компаниях
Showing 9 changed files with 246 additions and 68 deletions Side-by-side Diff
- app/Http/Controllers/Admin/CompanyController.php
- app/Models/reclame.php
- database/migrations/2023_10_24_113129_alter_table_reclames.php
- public/assets/img/close-eye.png
- public/assets/img/open-eye.png
- resources/views/admin/reclames/form.blade.php
- resources/views/admin/reclames/index.blade.php
- resources/views/admin/reclames/index_ajax.blade.php
- resources/views/admin/worker/index_ajax.blade.php
app/Http/Controllers/Admin/CompanyController.php
... | ... | @@ -209,9 +209,24 @@ class CompanyController extends Controller |
209 | 209 | /////////////////////////////////////////////////////////////////// |
210 | 210 | |
211 | 211 | ////// кабинет - реклама сайта //////////////////////////////////// |
212 | - public function reclames() { | |
212 | + public function reclames(Request $request) { | |
213 | + if ($request->ajax()) { | |
214 | + $rec = reclame::find($request->id); | |
215 | + if ($request->status == 'close') { | |
216 | + $rec->is_hidden = 0; | |
217 | + } else { | |
218 | + $rec->is_hidden = 1; | |
219 | + } | |
220 | + $rec->save(); | |
221 | + } | |
222 | + | |
213 | 223 | $reclames = reclame::query()->OrderBy('title')->paginate(15); |
214 | - return view('admin.reclames.index', compact('reclames')); | |
224 | + | |
225 | + if ($request->ajax()) { | |
226 | + return view('admin.reclames.index_ajax', compact('reclames')); | |
227 | + } else { | |
228 | + return view('admin.reclames.index', compact('reclames')); | |
229 | + } | |
215 | 230 | } |
216 | 231 | |
217 | 232 | public function reclames_add() { |
app/Models/reclame.php
database/migrations/2023_10_24_113129_alter_table_reclames.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('reclames', function (Blueprint $table) { | |
17 | + $table->string('name', 255)->nullable(); | |
18 | + }); | |
19 | + } | |
20 | + | |
21 | + /** | |
22 | + * Reverse the migrations. | |
23 | + * | |
24 | + * @return void | |
25 | + */ | |
26 | + public function down() | |
27 | + { | |
28 | + Schema::table('reclames', function (Blueprint $table) { | |
29 | + $table->dropColumn('name'); | |
30 | + }); | |
31 | + } | |
32 | +}; |
public/assets/img/close-eye.png
10.4 KB
public/assets/img/open-eye.png
8.43 KB
resources/views/admin/reclames/form.blade.php
1 | -<script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script> | |
2 | -<script> | |
3 | - CKEDITOR.replace( 'text', { | |
4 | - filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", | |
5 | - filebrowserUploadMethod: 'form' | |
6 | - }); | |
7 | -</script> | |
1 | + | |
8 | 2 | <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"> |
9 | 3 | <label class="block text-sm"> |
4 | + <span class="text-gray-700 dark:text-gray-400">Имя (для администраторов)</span> | |
5 | + <input name="name" id="name" | |
6 | + 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" | |
7 | + placeholder="Имя рекламы" value="{{ old('name') ?? (isset($reclame->name)) ? $reclame->name : '' }}" | |
8 | + /> | |
9 | + @error('name') | |
10 | + <span class="text-xs text-red-600 dark:text-red-400"> | |
11 | + {{ $message }} | |
12 | + </span> | |
13 | + @enderror | |
14 | + </label><br> | |
15 | + | |
16 | + <label class="block text-sm"> | |
10 | 17 | <span class="text-gray-700 dark:text-gray-400">Заголовок рекламы</span> |
11 | 18 | <input name="title" id="title" |
12 | 19 | 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" |
... | ... | @@ -41,7 +48,7 @@ |
41 | 48 | |
42 | 49 | <label class="block text-sm"> |
43 | 50 | <span class="text-gray-700 dark:text-gray-400">Текст</span> |
44 | - <textarea class="form-control ckeditor" name="text" id="text" placeholder="Текст (html)" required | |
51 | + <textarea class="block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray ckeditor" name="text" id="text" placeholder="Текст (html)" required | |
45 | 52 | rows="10">{{ old('text') ?? $reclame->text ?? '' }}</textarea> |
46 | 53 | @error('text') |
47 | 54 | <span class="text-xs text-red-600 dark:text-red-400"> |
... | ... | @@ -94,3 +101,10 @@ |
94 | 101 | </div> |
95 | 102 | </div> |
96 | 103 | </div> |
104 | +<script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script> | |
105 | +<script> | |
106 | + CKEDITOR.replace( 'text', { | |
107 | + filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}", | |
108 | + filebrowserUploadMethod: 'form' | |
109 | + }); | |
110 | +</script> |
resources/views/admin/reclames/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', '.btn-eye', function () { | |
7 | + var this_ = $(this); | |
8 | + var status_ = this_.attr('data-status'); | |
9 | + var id_ = this_.attr('data-id'); | |
10 | + var ajax_block = $('#ajax_block'); | |
4 | 11 | |
12 | + $.ajax({ | |
13 | + type: "GET", | |
14 | + url: "{{ url()->full()}}", | |
15 | + data: "id=" + id_ + "&status=" + status_, | |
16 | + success: function (data) { | |
17 | + console.log('Обновление таблицы '); | |
18 | + //data = JSON.parse(data); | |
19 | + //console.log(data); | |
20 | + ajax_block.html(data); | |
21 | + }, | |
22 | + headers: { | |
23 | + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | |
24 | + }, | |
25 | + error: function (data) { | |
26 | + console.log('Error: ' + data); | |
27 | + } | |
28 | + }); | |
29 | + }); | |
30 | + }); | |
31 | + </script> | |
5 | 32 | @endsection |
6 | 33 | |
7 | 34 | @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>--> | |
35 | + | |
34 | 36 | @endsection |
35 | 37 | |
36 | 38 | @section('content') |
... | ... | @@ -48,10 +50,8 @@ |
48 | 50 | class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800" |
49 | 51 | > |
50 | 52 | <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> | |
53 | 54 | <th class="px-4 py-3">Позиция</th> |
54 | - <th class="px-4 py-3">Скрыть</th> | |
55 | 55 | <th class="px-4 py-3">Клики</th> |
56 | 56 | <th class="px-4 py-3">Редактировать</th> |
57 | 57 | </tr> |
... | ... | @@ -63,30 +63,41 @@ |
63 | 63 | {{$reclame->id}} |
64 | 64 | </td> |
65 | 65 | <td class="px-4 py-3"> |
66 | - {{$reclame->title}} | |
67 | - </td> | |
68 | - <td class="px-4 py-3"> | |
69 | - {{$reclame->link}} | |
66 | + <div class="flex items-center text-sm"> | |
67 | + <div> | |
68 | + <p class="font-semibold"> | |
69 | + {{$reclame->name}} | |
70 | + </p> | |
71 | + <p class="text-xs text-gray-600 dark:text-gray-400"> | |
72 | + {{$reclame->title}} | |
73 | + </p> | |
74 | + <p class="text-xs text-gray-600 dark:text-gray-400"> | |
75 | + {{$reclame->link}} | |
76 | + </p> | |
77 | + </div> | |
78 | + </div> | |
70 | 79 | </td> |
71 | 80 | <td class="px-4 py-3"> |
72 | 81 | {{$reclame->position}} |
73 | 82 | </td> |
74 | - <td class="px-4 py-3"> | |
75 | - @if ($reclame->is_hidden) | |
76 | - Скрыто | |
77 | - @else | |
78 | - Показано | |
79 | - @endif | |
80 | - </td> | |
83 | + | |
81 | 84 | <td class="px-4 py-3"> |
82 | 85 | {{$reclame->col_vo_click}} |
83 | 86 | </td> |
84 | 87 | <td class="px-4 py-3 text-sm_"> |
85 | 88 | <form action="{{ route('admin.delete-reclames', ['reclame' => $reclame->id]) }}" method="POST"> |
86 | - <a href="{{ route('admin.edit-reclames', ['reclame' => $reclame->id]) }}">Изменить</a> | | |
89 | + <a href="{{ route('admin.edit-reclames', ['reclame' => $reclame->id]) }}" style="float:left">Изменить |</a> | |
87 | 90 | @csrf |
88 | 91 | @method('DELETE') |
89 | - <input class="btn btn-danger" type="submit" value="Удалить"/> | |
92 | + @if ($reclame->is_hidden) | |
93 | + <img class="btn-eye" name="btn_close_{{$reclame->id}}" data-status="close" data-id="{{$reclame->id}}" src="{{asset('/assets/img/close-eye.png')}}" style="width:25px; float:left; margin: 0px 5px 0px 5px; cursor: pointer;" /> | |
94 | + <p style="float:left">|</p> | |
95 | + @else | |
96 | + <img class="btn-eye" name="btn_open_{{$reclame->id}}" data-status="open" data-id="{{$reclame->id}}" src="{{asset('/assets/img/open-eye.png')}}" style="width:25px; float: left; margin: 0px 5px 0px 5px; cursor: pointer;"/> | |
97 | + <p style="float:left">|</p> | |
98 | + @endif | |
99 | + | |
100 | + <input class="btn btn-danger" type="submit" style="float:left" value="Удалить"/> | |
90 | 101 | </form> |
91 | 102 | </td> |
92 | 103 | </tr> |
resources/views/admin/reclames/index_ajax.blade.php
... | ... | @@ -0,0 +1,68 @@ |
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($reclames as $reclame) | |
16 | + <tr class="text-gray-700 dark:text-gray-400"> | |
17 | + <td class="px-4 py-3"> | |
18 | + {{$reclame->id}} | |
19 | + </td> | |
20 | + <td class="px-4 py-3"> | |
21 | + <div class="flex items-center text-sm"> | |
22 | + <div> | |
23 | + <p class="font-semibold"> | |
24 | + {{$reclame->name}} | |
25 | + </p> | |
26 | + <p class="text-xs text-gray-600 dark:text-gray-400"> | |
27 | + {{$reclame->title}} | |
28 | + </p> | |
29 | + <p class="text-xs text-gray-600 dark:text-gray-400"> | |
30 | + {{$reclame->link}} | |
31 | + </p> | |
32 | + </div> | |
33 | + </div> | |
34 | + </td> | |
35 | + <td class="px-4 py-3"> | |
36 | + {{$reclame->position}} | |
37 | + </td> | |
38 | + | |
39 | + <td class="px-4 py-3"> | |
40 | + {{$reclame->col_vo_click}} | |
41 | + </td> | |
42 | + <td class="px-4 py-3 text-sm_"> | |
43 | + <form action="{{ route('admin.delete-reclames', ['reclame' => $reclame->id]) }}" method="POST"> | |
44 | + <a href="{{ route('admin.edit-reclames', ['reclame' => $reclame->id]) }}" style="float:left">Изменить |</a> | |
45 | + @csrf | |
46 | + @method('DELETE') | |
47 | + @if ($reclame->is_hidden) | |
48 | + <img class="btn-eye" name="btn_close_{{$reclame->id}}" data-status="close" data-id="{{$reclame->id}}" src="{{asset('/assets/img/close-eye.png')}}" style="width:25px; float:left; margin: 0px 5px 0px 5px; cursor: pointer;" /> | |
49 | + <p style="float:left">|</p> | |
50 | + @else | |
51 | + <img class="btn-eye" name="btn_open_{{$reclame->id}}" data-status="open" data-id="{{$reclame->id}}" src="{{asset('/assets/img/open-eye.png')}}" style="width:25px; float: left; margin: 0px 5px 0px 5px; cursor: pointer;"/> | |
52 | + <p style="float:left">|</p> | |
53 | + @endif | |
54 | + | |
55 | + <input class="btn btn-danger" type="submit" style="float:left" value="Удалить"/> | |
56 | + </form> | |
57 | + </td> | |
58 | + </tr> | |
59 | + @endforeach | |
60 | + </tbody> | |
61 | + </table> | |
62 | +</div> | |
63 | + | |
64 | +<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"> | |
65 | + <?=$reclames->appends($_GET)->links('admin.pagginate'); ?> | |
66 | +</div> | |
67 | + | |
68 | + |
resources/views/admin/worker/index_ajax.blade.php
1 | + | |
1 | 2 | <div class="w-full overflow-x-auto"> |
2 | 3 | <table class="w-full whitespace-no-wrap"> |
3 | 4 | <thead> |
... | ... | @@ -5,13 +6,13 @@ |
5 | 6 | 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 | > |
7 | 8 | <th class="px-4 py-3">№</th> |
8 | - <th class="px-4 py-3">Имя</th> | |
9 | - <th class="px-4 py-3">Email/Телефон</th> | |
10 | - <th class="px-4 py-3">% заполнения анкеты</th> | |
9 | + <th class="px-4 py-3">Лого</th> | |
10 | + <th class="px-4 py-3">ФИО/Email/Телефон</th> | |
11 | + <th class="px-4 py-3">Статус</th> | |
12 | + <th class="px-4 py-3">% анкеты</th> | |
11 | 13 | <th class="px-4 py-3">Должность</th> |
12 | 14 | <th class="px-4 py-3">Дата регистрации</th> |
13 | 15 | <th class="px-4 py-3">Изменить</th> |
14 | - <th class="px-4 py-3">Бан</th> | |
15 | 16 | </tr> |
16 | 17 | </thead> |
17 | 18 | <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> |
... | ... | @@ -21,11 +22,38 @@ |
21 | 22 | {{$user->id}} |
22 | 23 | </td> |
23 | 24 | <td class="px-4 py-3"> |
24 | - {{ !empty($user->name_man) ? $user->name_man : $user->name }} | |
25 | + @if (isset($user->workers[0]->photo)) | |
26 | + <div class="flex items-center text-sm"> | |
27 | + <div | |
28 | + class="relative hidden w-8 h-8 mr-3 rounded-full md:block" | |
29 | + > | |
30 | + <img | |
31 | + class="object-cover w-full h-full rounded-full" | |
32 | + src="{{ asset(Storage::url($user->workers[0]->photo)) }}" | |
33 | + alt="" | |
34 | + loading="lazy" | |
35 | + /> | |
36 | + <div | |
37 | + class="absolute inset-0 rounded-full shadow-inner" | |
38 | + aria-hidden="true" | |
39 | + ></div> | |
40 | + </div> | |
41 | + </div> | |
42 | + @else | |
43 | + - | |
44 | + @endif | |
25 | 45 | </td> |
26 | - <td class="px-4 py-3 text-sm"> | |
46 | + | |
47 | + <td class="px-4 py-3"> | |
27 | 48 | <div class="flex items-center text-sm"> |
28 | 49 | <div> |
50 | + <p class="font-semibold"> | |
51 | + @if (isset($user->id)) | |
52 | + <a style="text-decoration: underline;" href="{{ route('admin.user-profile', ['user' => $user->id]) }}}">{{ $user->surname }} {{ !empty($user->name_man) ? $user->name_man : $user->name }} {{ $user->surname2 }}</a> | |
53 | + @else | |
54 | + {{ $user->surname }} {{ !empty($user->name_man) ? $user->name_man : $user->name }} {{ $user->surname2 }} | |
55 | + @endif | |
56 | + </p> | |
29 | 57 | <p class="font-semibold">{{ empty($user->workers->email) ? $user->email : $user->workers->email }}</p> |
30 | 58 | <p class="text-xs text-gray-600 dark:text-gray-400"> |
31 | 59 | {{ empty($user->workers->telephone) ? $user->telephone : $user->workers->telephone }} |
... | ... | @@ -33,6 +61,15 @@ |
33 | 61 | </div> |
34 | 62 | </div> |
35 | 63 | </td> |
64 | + | |
65 | + <td class="px-4 py-3"> | |
66 | + @if (isset($user->workers[0]->status_work)) | |
67 | + {{ $status_wor[$user->workers[0]->status_work] }} | |
68 | + @else | |
69 | + - | |
70 | + @endif | |
71 | + </td> | |
72 | + | |
36 | 73 | <td class="px-4 py-3 text-xs"> |
37 | 74 | @if (isset($user->workers[0]->persent_anketa)) |
38 | 75 | @if ($user->workers[0]->persent_anketa > 40) |
... | ... | @@ -46,7 +83,7 @@ |
46 | 83 | @endif |
47 | 84 | @else |
48 | 85 | <span class="px-2 py-1 font-semibold leading-tight text-orange-700 bg-orange-100 rounded-full dark:text-white dark:bg-orange-600"> |
49 | - 0% | |
86 | + 0% | |
50 | 87 | </span> |
51 | 88 | @endif |
52 | 89 | </td> |
... | ... | @@ -61,17 +98,17 @@ |
61 | 98 | {{ date('d.m.Y h:i:s', strtotime($user->created_at)) }} |
62 | 99 | </td> |
63 | 100 | <td class="px-4 py-3 text-sm"> |
64 | - @if ($user->id > 1) | |
65 | - @if (isset($user->workers[0]->id)) | |
66 | - <a href="{{ route('admin.worker-profile-edit', ['worker' => $user->workers[0]->id]) }}">Изменить</a> | |
101 | + <!--if ($user->id > 1)--> | |
102 | + @if (isset($user->workers[0]->id)) | |
103 | + <a href="{{ route('admin.worker-profile-edit', ['worker' => $user->workers[0]->id]) }}">Изменить</a> | |
67 | 104 | |
68 | - @endif | |
69 | - @endif | |
105 | + @endif | |
106 | + <!--endif--> | |
70 | 107 | </td> |
71 | - <!--<td class="px-4 py-3 text-sm"> | |
72 | - @if ($user->id > 1) | |
73 | - <input type="checkbox" class="checkban" value="{{$user->id}}" name="ban_{{$user->id}}" {{ ($user->is_ban) ? "checked" : "" }}/> | |
74 | - @endif | |
108 | + <!--<td class="px-4 py-3 text-sm"> | |
109 | + @if ($user->id > 1) | |
110 | + <input type="checkbox" class="checkban" value="{{$user->id}}" name="ban_{{$user->id}}" {{ ($user->is_ban) ? "checked" : "" }}/> | |
111 | + @endif | |
75 | 112 | </td>--> |
76 | 113 | </tr> |
77 | 114 | @endforeach |