Commit 86a17538a5914a0115bce89200fddf15e4a228ee

Authored by Андрей Ларионов
1 parent 673a7768d8

Реклама, правки в соискатели, компаниях

Showing 9 changed files with 246 additions and 68 deletions Inline Diff

app/Http/Controllers/Admin/CompanyController.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Controllers\Admin; 3 namespace App\Http\Controllers\Admin;
4 4
5 use App\Classes\Meta; 5 use App\Classes\Meta;
6 use App\Http\Controllers\Controller; 6 use App\Http\Controllers\Controller;
7 use App\Http\Requests\PagesRequest; 7 use App\Http\Requests\PagesRequest;
8 use App\Http\Requests\ReclameRequest; 8 use App\Http\Requests\ReclameRequest;
9 use App\Http\Requests\SEORequest; 9 use App\Http\Requests\SEORequest;
10 use App\Models\Employer; 10 use App\Models\Employer;
11 use App\Models\employers_main; 11 use App\Models\employers_main;
12 use App\Models\header_footer; 12 use App\Models\header_footer;
13 use App\Models\Job_title; 13 use App\Models\Job_title;
14 use App\Models\job_titles_main; 14 use App\Models\job_titles_main;
15 use App\Models\pages; 15 use App\Models\pages;
16 use App\Models\reclame; 16 use App\Models\reclame;
17 use App\Models\SEO; 17 use App\Models\SEO;
18 use Illuminate\Http\Request; 18 use Illuminate\Http\Request;
19 use Illuminate\Support\Facades\Storage; 19 use Illuminate\Support\Facades\Storage;
20 20
21 class CompanyController extends Controller 21 class CompanyController extends Controller
22 { 22 {
23 // кабинет - редактор сайта 23 // кабинет - редактор сайта
24 public function editor() { 24 public function editor() {
25 return; 25 return;
26 } 26 }
27 27
28 // кабинет - редактор должности на главной 28 // кабинет - редактор должности на главной
29 public function job_titles_main(Request $request) { 29 public function job_titles_main(Request $request) {
30 if ($request->ajax()) { 30 if ($request->ajax()) {
31 $user = job_titles_main::find($request->id); 31 $user = job_titles_main::find($request->id);
32 $request->offsetUnset('id'); 32 $request->offsetUnset('id');
33 $user->update($request->all()); 33 $user->update($request->all());
34 } 34 }
35 35
36 $jobs = job_titles_main::query()->OrderBy('sort')->paginate(10); 36 $jobs = job_titles_main::query()->OrderBy('sort')->paginate(10);
37 $list_job_titles = Job_title::query()->active()->orderBy('name')->get(); 37 $list_job_titles = Job_title::query()->active()->orderBy('name')->get();
38 38
39 if ($request->ajax()) { 39 if ($request->ajax()) {
40 return view('admin.job_main.index_ajax', compact('jobs', 'list_job_titles')); 40 return view('admin.job_main.index_ajax', compact('jobs', 'list_job_titles'));
41 } else { 41 } else {
42 return view('admin.job_main.index', compact('jobs', 'list_job_titles')); 42 return view('admin.job_main.index', compact('jobs', 'list_job_titles'));
43 } 43 }
44 } 44 }
45 45
46 //////////////////////////////////////////////////////////////////////////////// 46 ////////////////////////////////////////////////////////////////////////////////
47 // кабинет - редактор шапки-футера сайта 47 // кабинет - редактор шапки-футера сайта
48 public function editblocks(Request $request) { 48 public function editblocks(Request $request) {
49 if ($request->ajax()) { 49 if ($request->ajax()) {
50 $header_footer = header_footer::where('header', $request->header)->OrderBy('sort')->OrderBy('name')->paginate(15); 50 $header_footer = header_footer::where('header', $request->header)->OrderBy('sort')->OrderBy('name')->paginate(15);
51 $list_menu = header_footer::where('header', $request->header)->OrderBy('name')->get(); 51 $list_menu = header_footer::where('header', $request->header)->OrderBy('name')->get();
52 return view('admin.editbloks.index_ajax', compact('header_footer', 'list_menu')); 52 return view('admin.editbloks.index_ajax', compact('header_footer', 'list_menu'));
53 } else { 53 } else {
54 $header_footer = header_footer::where('header', '1')->OrderBy('sort')->OrderBy('name')->paginate(15); 54 $header_footer = header_footer::where('header', '1')->OrderBy('sort')->OrderBy('name')->paginate(15);
55 $list_menu = header_footer::where('header', '1')->OrderBy('name')->get(); 55 $list_menu = header_footer::where('header', '1')->OrderBy('name')->get();
56 return view('admin.editbloks.index', compact('header_footer', 'list_menu')); 56 return view('admin.editbloks.index', compact('header_footer', 'list_menu'));
57 } 57 }
58 } 58 }
59 59
60 public function editblock_add() { 60 public function editblock_add() {
61 $items = header_footer::query()->OrderBy('name')->get(); 61 $items = header_footer::query()->OrderBy('name')->get();
62 return view('admin.editbloks.add', compact('items')); 62 return view('admin.editbloks.add', compact('items'));
63 } 63 }
64 64
65 public function editblock_store(Request $request) { 65 public function editblock_store(Request $request) {
66 header_footer::create($request->all()); 66 header_footer::create($request->all());
67 return redirect()->route('admin.edit-blocks'); 67 return redirect()->route('admin.edit-blocks');
68 } 68 }
69 69
70 public function editblock_ajax(Request $request) { 70 public function editblock_ajax(Request $request) {
71 if ($request->ajax()) { 71 if ($request->ajax()) {
72 $hf = header_footer::find($request->id); 72 $hf = header_footer::find($request->id);
73 $filter = $request->header; 73 $filter = $request->header;
74 unset($request->id); 74 unset($request->id);
75 unset($request->header); 75 unset($request->header);
76 $hf->update($request->all()); 76 $hf->update($request->all());
77 77
78 $header_footer = header_footer::where('header', $filter)->OrderBy('sort')->OrderBy('name')->paginate(15); 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(); 79 $list_menu = header_footer::where('header', $filter)->OrderBy('name')->get();
80 return view('admin.editbloks.index_ajax', compact('header_footer', 'list_menu')); 80 return view('admin.editbloks.index_ajax', compact('header_footer', 'list_menu'));
81 } else { 81 } else {
82 return "Ошибка!"; 82 return "Ошибка!";
83 } 83 }
84 } 84 }
85 85
86 public function editblock_edit(header_footer $block) { 86 public function editblock_edit(header_footer $block) {
87 $items = header_footer::query()->OrderBy('name')->get(); 87 $items = header_footer::query()->OrderBy('name')->get();
88 return view('admin.editbloks.edit', compact('block', 'items')); 88 return view('admin.editbloks.edit', compact('block', 'items'));
89 } 89 }
90 90
91 public function editblock_update(Request $request, header_footer $block) { 91 public function editblock_update(Request $request, header_footer $block) {
92 $block->update($request->all()); 92 $block->update($request->all());
93 return redirect()->route('admin.edit-blocks'); 93 return redirect()->route('admin.edit-blocks');
94 } 94 }
95 95
96 public function editblock_destroy(header_footer $block) { 96 public function editblock_destroy(header_footer $block) {
97 $block->delete(); 97 $block->delete();
98 return redirect()->route('admin.edit-blocks'); 98 return redirect()->route('admin.edit-blocks');
99 } 99 }
100 ///////////////////////////////////////////////////////// 100 /////////////////////////////////////////////////////////
101 101
102 // кабинет - редактор работодатели на главной 102 // кабинет - редактор работодатели на главной
103 public function employers_main(Request $request) { 103 public function employers_main(Request $request) {
104 if ($request->ajax()) { 104 if ($request->ajax()) {
105 $user = employers_main::find($request->id); 105 $user = employers_main::find($request->id);
106 $request->offsetUnset('id'); 106 $request->offsetUnset('id');
107 $user->update($request->all()); 107 $user->update($request->all());
108 } 108 }
109 109
110 $employers = employers_main::query()->OrderBy('sort')->paginate(10); 110 $employers = employers_main::query()->OrderBy('sort')->paginate(10);
111 $list_employers = Employer::query()->active()->orderBy('name_company')->get(); 111 $list_employers = Employer::query()->active()->orderBy('name_company')->get();
112 112
113 if ($request->ajax()) { 113 if ($request->ajax()) {
114 return view('admin.employer_main.index_ajax', compact('employers', 'list_employers')); 114 return view('admin.employer_main.index_ajax', compact('employers', 'list_employers'));
115 } else { 115 } else {
116 return view('admin.employer_main.index', compact('employers', 'list_employers')); 116 return view('admin.employer_main.index', compact('employers', 'list_employers'));
117 } 117 }
118 } 118 }
119 119
120 //////////// кабинет - редактор seo-сайта ///////////////////////////// 120 //////////// кабинет - редактор seo-сайта /////////////////////////////
121 public function editor_seo() { 121 public function editor_seo() {
122 $pages = SEO::query()->OrderBy('url')->paginate(15); 122 $pages = SEO::query()->OrderBy('url')->paginate(15);
123 return view('admin.seo.index', compact('pages')); 123 return view('admin.seo.index', compact('pages'));
124 } 124 }
125 125
126 public function editor_seo_add() { 126 public function editor_seo_add() {
127 return view('admin.seo.add'); 127 return view('admin.seo.add');
128 } 128 }
129 129
130 public function editor_seo_store(SEORequest $request) { 130 public function editor_seo_store(SEORequest $request) {
131 SEO::create($request->all()); 131 SEO::create($request->all());
132 return redirect()->route('admin.editor-seo'); 132 return redirect()->route('admin.editor-seo');
133 } 133 }
134 134
135 public function editor_seo_ajax(Request $request) { 135 public function editor_seo_ajax(Request $request) {
136 $url = $request->get('url'); // post('url'); 136 $url = $request->get('url'); // post('url');
137 $metaData = Array(); 137 $metaData = Array();
138 //$url = json_decode($url, true); 138 //$url = json_decode($url, true);
139 139
140 if (!empty($url)) { 140 if (!empty($url)) {
141 141
142 $meta = new Meta($url); 142 $meta = new Meta($url);
143 $meta->parse(); 143 $meta->parse();
144 $metaData = $meta->finalize(); 144 $metaData = $meta->finalize();
145 145
146 return json_encode($metaData); 146 return json_encode($metaData);
147 } else { 147 } else {
148 return json_encode(Array('Error URL')); 148 return json_encode(Array('Error URL'));
149 } 149 }
150 } 150 }
151 151
152 public function editor_seo_edit(SEO $page) { 152 public function editor_seo_edit(SEO $page) {
153 return view('admin.seo.edit', compact('page')); 153 return view('admin.seo.edit', compact('page'));
154 } 154 }
155 155
156 public function editor_seo_update(SEORequest $request, SEO $page) { 156 public function editor_seo_update(SEORequest $request, SEO $page) {
157 $page->update($request->all()); 157 $page->update($request->all());
158 return redirect()->route('admin.editor-seo'); 158 return redirect()->route('admin.editor-seo');
159 } 159 }
160 160
161 public function editor_seo_destroy(SEO $page) { 161 public function editor_seo_destroy(SEO $page) {
162 $page->delete(); 162 $page->delete();
163 return redirect()->route('admin.editor-seo'); 163 return redirect()->route('admin.editor-seo');
164 } 164 }
165 /////////////////////////////////////////////////////////////////////// 165 ///////////////////////////////////////////////////////////////////////
166 166
167 /////////// кабинет - редактор страниц //////////////////////////////// 167 /////////// кабинет - редактор страниц ////////////////////////////////
168 public function editor_pages() { 168 public function editor_pages() {
169 $pages = pages::query()->OrderBy('name')->paginate(15); 169 $pages = pages::query()->OrderBy('name')->paginate(15);
170 return view('admin.pages.index', compact('pages')); 170 return view('admin.pages.index', compact('pages'));
171 } 171 }
172 172
173 public function editor_pages_add() { 173 public function editor_pages_add() {
174 return view('admin.pages.add'); 174 return view('admin.pages.add');
175 } 175 }
176 176
177 public function editor_pages_store(PagesRequest $request) { 177 public function editor_pages_store(PagesRequest $request) {
178 $params = $request->all(); 178 $params = $request->all();
179 if ($request->has('image')) { 179 if ($request->has('image')) {
180 $params['image'] = $request->file('image')->store('pages', 'public'); 180 $params['image'] = $request->file('image')->store('pages', 'public');
181 } 181 }
182 182
183 pages::create($params); 183 pages::create($params);
184 return redirect()->route('admin.editor-pages'); 184 return redirect()->route('admin.editor-pages');
185 } 185 }
186 186
187 public function editor_pages_edit(pages $page) { 187 public function editor_pages_edit(pages $page) {
188 return view('admin.pages.edit', compact('page')); 188 return view('admin.pages.edit', compact('page'));
189 } 189 }
190 190
191 public function editor_pages_update(PagesRequest $request, pages $page) { 191 public function editor_pages_update(PagesRequest $request, pages $page) {
192 $params = $request->all(); 192 $params = $request->all();
193 193
194 if ($request->has('image')) { 194 if ($request->has('image')) {
195 if (!empty($page->image)) Storage::delete($page->image); 195 if (!empty($page->image)) Storage::delete($page->image);
196 $params['image'] = $request->file('image')->store('pages', 'public'); 196 $params['image'] = $request->file('image')->store('pages', 'public');
197 } else { 197 } else {
198 if (!empty($page->image)) $params['image'] = $page->image; 198 if (!empty($page->image)) $params['image'] = $page->image;
199 } 199 }
200 200
201 $page->update($params); 201 $page->update($params);
202 return redirect()->route('admin.editor-pages'); 202 return redirect()->route('admin.editor-pages');
203 } 203 }
204 204
205 public function editor_pages_destroy(pages $page) { 205 public function editor_pages_destroy(pages $page) {
206 $page->delete(); 206 $page->delete();
207 return redirect()->route('admin.editor-pages'); 207 return redirect()->route('admin.editor-pages');
208 } 208 }
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 $reclames = reclame::query()->OrderBy('title')->paginate(15); 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 public function reclames_add() { 232 public function reclames_add() {
218 return view('admin.reclames.add'); 233 return view('admin.reclames.add');
219 } 234 }
220 235
221 public function reclames_store(ReclameRequest $request) { 236 public function reclames_store(ReclameRequest $request) {
222 $params = $request->all(); 237 $params = $request->all();
223 /*if('on' == $request->get('is_hidden')) { 238 /*if('on' == $request->get('is_hidden')) {
224 $params['is_hidden'] = 1; 239 $params['is_hidden'] = 1;
225 } else { 240 } else {
226 $params['is_hidden'] = 0; 241 $params['is_hidden'] = 0;
227 }*/ 242 }*/
228 if ($request->has('image')) { 243 if ($request->has('image')) {
229 $params['image'] = $request->file('image')->store('reclames', 'public'); 244 $params['image'] = $request->file('image')->store('reclames', 'public');
230 } 245 }
231 246
232 reclame::create($params); 247 reclame::create($params);
233 return redirect()->route('admin.reclames'); 248 return redirect()->route('admin.reclames');
234 } 249 }
235 250
236 public function reclames_edit(reclame $reclame) { 251 public function reclames_edit(reclame $reclame) {
237 return view('admin.reclames.edit', compact('reclame')); 252 return view('admin.reclames.edit', compact('reclame'));
238 } 253 }
239 254
240 public function reclames_update(ReclameRequest $request, reclame $reclame) { 255 public function reclames_update(ReclameRequest $request, reclame $reclame) {
241 $params = $request->all(); 256 $params = $request->all();
242 /*if('on' == $request->get('is_hidden')) { 257 /*if('on' == $request->get('is_hidden')) {
243 $params['is_hidden'] = 1; 258 $params['is_hidden'] = 1;
244 } else { 259 } else {
245 $params['is_hidden'] = 0; 260 $params['is_hidden'] = 0;
246 }*/ 261 }*/
247 262
248 if ($request->has('image')) { 263 if ($request->has('image')) {
249 if (!empty($reclame->image)) Storage::delete($reclame->image); 264 if (!empty($reclame->image)) Storage::delete($reclame->image);
250 $params['image'] = $request->file('image')->store('reclames', 'public'); 265 $params['image'] = $request->file('image')->store('reclames', 'public');
251 } else { 266 } else {
252 if (!empty($reclame->image)) $params['image'] = $reclame->image; 267 if (!empty($reclame->image)) $params['image'] = $reclame->image;
253 } 268 }
254 269
255 $reclame->update($params); 270 $reclame->update($params);
256 return redirect()->route('admin.reclames'); 271 return redirect()->route('admin.reclames');
257 } 272 }
258 273
259 public function reclames_destroy(reclame $reclame) { 274 public function reclames_destroy(reclame $reclame) {
260 $reclame->delete(); 275 $reclame->delete();
261 return redirect()->route('admin.reclames'); 276 return redirect()->route('admin.reclames');
262 } 277 }
263 278
264 ///////////////////////////////////////////////////////////////// 279 /////////////////////////////////////////////////////////////////
265 } 280 }
266 281
app/Models/reclame.php
1 <?php 1 <?php
2 2
3 namespace App\Models; 3 namespace App\Models;
4 4
5 use Illuminate\Database\Eloquent\Factories\HasFactory; 5 use Illuminate\Database\Eloquent\Factories\HasFactory;
6 use Illuminate\Database\Eloquent\Model; 6 use Illuminate\Database\Eloquent\Model;
7 7
8 class reclame extends Model 8 class reclame extends Model
9 { 9 {
10 use HasFactory; 10 use HasFactory;
11 11
12 protected $fillable = [ 12 protected $fillable = [
13 'title', 13 'title',
14 'image', 14 'image',
15 'link', 15 'link',
16 'text', 16 'text',
17 'position', 17 'position',
18 'is_hidden', 18 'is_hidden',
19 'col_vo_click', 19 'col_vo_click',
20 'is_remove', 20 'is_remove',
21 'name',
21 ]; 22 ];
22 } 23 }
23 24
database/migrations/2023_10_24_113129_alter_table_reclames.php
File was created 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 };
33
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> 1
2 <script>
3 CKEDITOR.replace( 'text', {
4 filebrowserUploadUrl: "{{route('ckeditor.image-upload', ['_token' => csrf_token() ])}}",
5 filebrowserUploadMethod: 'form'
6 });
7 </script>
8 <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"> 2 <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
9 <label class="block text-sm"> 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 <span class="text-gray-700 dark:text-gray-400">Заголовок рекламы</span> 17 <span class="text-gray-700 dark:text-gray-400">Заголовок рекламы</span>
11 <input name="title" id="title" 18 <input name="title" id="title"
12 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" 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"
13 placeholder="Заголовок рекламы" value="{{ old('title') ?? (isset($reclame->title)) ? $reclame->title : '' }}" 20 placeholder="Заголовок рекламы" value="{{ old('title') ?? (isset($reclame->title)) ? $reclame->title : '' }}"
14 /> 21 />
15 @error('title') 22 @error('title')
16 <span class="text-xs text-red-600 dark:text-red-400"> 23 <span class="text-xs text-red-600 dark:text-red-400">
17 {{ $message }} 24 {{ $message }}
18 </span> 25 </span>
19 @enderror 26 @enderror
20 </label><br> 27 </label><br>
21 28
22 <label class="block text-sm"> 29 <label class="block text-sm">
23 <span class="text-gray-700 dark:text-gray-400"> 30 <span class="text-gray-700 dark:text-gray-400">
24 <input type="hidden" name="is_hidden" value="0" /> 31 <input type="hidden" name="is_hidden" value="0" />
25 <input type="checkbox" value="1" name="is_hidden" id="is_hidden" {{ isset($reclame->is_hidden) ? ($reclame->is_hidden) ? "checked" : "" : "" }} /> 32 <input type="checkbox" value="1" name="is_hidden" id="is_hidden" {{ isset($reclame->is_hidden) ? ($reclame->is_hidden) ? "checked" : "" : "" }} />
26 Скрыть рекламу</span> 33 Скрыть рекламу</span>
27 </label><br> 34 </label><br>
28 35
29 <label class="block text-sm"> 36 <label class="block text-sm">
30 <span class="text-gray-700 dark:text-gray-400">Ссылка</span> 37 <span class="text-gray-700 dark:text-gray-400">Ссылка</span>
31 <input name="link" id="link" 38 <input name="link" id="link"
32 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" 39 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"
33 placeholder="Ссылка" value="{{ old('link') ?? $reclame->link ?? '' }}" 40 placeholder="Ссылка" value="{{ old('link') ?? $reclame->link ?? '' }}"
34 /> 41 />
35 @error('link') 42 @error('link')
36 <span class="text-xs text-red-600 dark:text-red-400"> 43 <span class="text-xs text-red-600 dark:text-red-400">
37 {{ $message }} 44 {{ $message }}
38 </span> 45 </span>
39 @enderror 46 @enderror
40 </label><br> 47 </label><br>
41 48
42 <label class="block text-sm"> 49 <label class="block text-sm">
43 <span class="text-gray-700 dark:text-gray-400">Текст</span> 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 rows="10">{{ old('text') ?? $reclame->text ?? '' }}</textarea> 52 rows="10">{{ old('text') ?? $reclame->text ?? '' }}</textarea>
46 @error('text') 53 @error('text')
47 <span class="text-xs text-red-600 dark:text-red-400"> 54 <span class="text-xs text-red-600 dark:text-red-400">
48 {{ $message }} 55 {{ $message }}
49 </span> 56 </span>
50 @enderror 57 @enderror
51 </label><br> 58 </label><br>
52 59
53 <label class="block text-sm"> 60 <label class="block text-sm">
54 <span class="text-gray-700 dark:text-gray-400">Позиция (число)</span> 61 <span class="text-gray-700 dark:text-gray-400">Позиция (число)</span>
55 <input name="position" id="position" 62 <input name="position" id="position"
56 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" 63 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"
57 placeholder="Позиция" value="{{ old('position') ?? $reclame->position ?? '' }}" 64 placeholder="Позиция" value="{{ old('position') ?? $reclame->position ?? '' }}"
58 /> 65 />
59 @error('position') 66 @error('position')
60 <span class="text-xs text-red-600 dark:text-red-400"> 67 <span class="text-xs text-red-600 dark:text-red-400">
61 {{ $message }} 68 {{ $message }}
62 </span> 69 </span>
63 @enderror 70 @enderror
64 </label><br> 71 </label><br>
65 72
66 <label class="block text-sm"> 73 <label class="block text-sm">
67 <span class="text-gray-700 dark:text-gray-400">Картинка</span> 74 <span class="text-gray-700 dark:text-gray-400">Картинка</span>
68 <input type="file" class="block w-full mt-1 text-sm dark:border-gray-600 75 <input type="file" class="block w-full mt-1 text-sm dark:border-gray-600
69 dark:bg-gray-700 focus:border-purple-400 76 dark:bg-gray-700 focus:border-purple-400
70 focus:outline-none focus:shadow-outline-purple 77 focus:outline-none focus:shadow-outline-purple
71 dark:text-gray-300 dark:focus:shadow-outline-gray 78 dark:text-gray-300 dark:focus:shadow-outline-gray
72 form-input" 79 form-input"
73 id="image" name="image" accept="image/png, image/jpeg"> 80 id="image" name="image" accept="image/png, image/jpeg">
74 @error('image') 81 @error('image')
75 <span class="text-xs text-red-600 dark:text-red-400"> 82 <span class="text-xs text-red-600 dark:text-red-400">
76 {{ $message }} 83 {{ $message }}
77 </span> 84 </span>
78 @enderror 85 @enderror
79 @isset($reclame->image) 86 @isset($reclame->image)
80 <img src="{{asset(Storage::url($reclame->image))}}" width="100px"/> 87 <img src="{{asset(Storage::url($reclame->image))}}" width="100px"/>
81 @endisset 88 @endisset
82 89
83 </label><br> 90 </label><br>
84 91
85 <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4"> 92 <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
86 <div> 93 <div>
87 <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"> 94 <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">
88 Сохранить 95 Сохранить
89 </button> 96 </button>
90 <a href="{{ route('admin.reclames') }}" 97 <a href="{{ route('admin.reclames') }}"
91 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" 98 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 style="display: -webkit-inline-box; height: 30px!important;" 99 style="display: -webkit-inline-box; height: 30px!important;"
93 >Назад</a> 100 >Назад</a>
94 </div> 101 </div>
95 </div> 102 </div>
96 </div> 103 </div>
104 <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script>
105 <script>
resources/views/admin/reclames/index.blade.php
1 @extends('layout.admin', ['title' => 'Админка - Реклама сайта']) 1 @extends('layout.admin', ['title' => 'Админка - Реклама сайта'])
2 2
3 @section('script') 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 @endsection 32 @endsection
6 33
7 @section('search') 34 @section('search')
8 <!--<div class="absolute inset-y-0 flex items-center pl-2"> 35
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 36 @endsection
35 37
36 @section('content') 38 @section('content')
37 39
38 <a href="{{ route('admin.add-reclames') }}" style="width: 160px" 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"> 40 <a href="{{ route('admin.add-reclames') }}" style="width: 160px" 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 Добавить рекламу 41 Добавить рекламу
40 </a> 42 </a>
41 <br> 43 <br>
42 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> 44 <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block">
43 45
44 <div class="w-full overflow-x-auto"> 46 <div class="w-full overflow-x-auto">
45 <table class="w-full whitespace-no-wrap"> 47 <table class="w-full whitespace-no-wrap">
46 <thead> 48 <thead>
47 <tr 49 <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" 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 <th class="px-4 py-3">№</th> 52 <th class="px-4 py-3">№</th>
51 <th class="px-4 py-3">Заголовок</th> 53 <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>
54 <th class="px-4 py-3">Скрыть</th>
55 <th class="px-4 py-3">Клики</th> 55 <th class="px-4 py-3">Клики</th>
56 <th class="px-4 py-3">Редактировать</th> 56 <th class="px-4 py-3">Редактировать</th>
57 </tr> 57 </tr>
58 </thead> 58 </thead>
59 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> 59 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
60 @foreach($reclames as $reclame) 60 @foreach($reclames as $reclame)
61 <tr class="text-gray-700 dark:text-gray-400"> 61 <tr class="text-gray-700 dark:text-gray-400">
62 <td class="px-4 py-3"> 62 <td class="px-4 py-3">
63 {{$reclame->id}} 63 {{$reclame->id}}
64 </td> 64 </td>
65 <td class="px-4 py-3"> 65 <td class="px-4 py-3">
66 {{$reclame->title}} 66 <div class="flex items-center text-sm">
67 </td> 67 <div>
68 <td class="px-4 py-3"> 68 <p class="font-semibold">
69 {{$reclame->link}} 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 </td> 79 </td>
71 <td class="px-4 py-3"> 80 <td class="px-4 py-3">
72 {{$reclame->position}} 81 {{$reclame->position}}
73 </td> 82 </td>
74 <td class="px-4 py-3"> 83
75 @if ($reclame->is_hidden)
76 Скрыто
77 @else
78 Показано
resources/views/admin/reclames/index_ajax.blade.php
File was created 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
69
resources/views/admin/worker/index_ajax.blade.php
1
1 <div class="w-full overflow-x-auto"> 2 <div class="w-full overflow-x-auto">
2 <table class="w-full whitespace-no-wrap"> 3 <table class="w-full whitespace-no-wrap">
3 <thead> 4 <thead>
4 <tr 5 <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 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 <th class="px-4 py-3">№</th> 8 <th class="px-4 py-3">№</th>
8 <th class="px-4 py-3">Имя</th> 9 <th class="px-4 py-3">Лого</th>
9 <th class="px-4 py-3">Email/Телефон</th> 10 <th class="px-4 py-3">ФИО/Email/Телефон</th>
10 <th class="px-4 py-3">% заполнения анкеты</th> 11 <th class="px-4 py-3">Статус</th>
12 <th class="px-4 py-3">% анкеты</th>
11 <th class="px-4 py-3">Должность</th> 13 <th class="px-4 py-3">Должность</th>
12 <th class="px-4 py-3">Дата регистрации</th> 14 <th class="px-4 py-3">Дата регистрации</th>
13 <th class="px-4 py-3">Изменить</th> 15 <th class="px-4 py-3">Изменить</th>
14 <th class="px-4 py-3">Бан</th>
15 </tr> 16 </tr>
16 </thead> 17 </thead>
17 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> 18 <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800">
18 @foreach($users as $user) 19 @foreach($users as $user)
19 <tr class="text-gray-700 dark:text-gray-400"> 20 <tr class="text-gray-700 dark:text-gray-400">
20 <td class="px-4 py-3"> 21 <td class="px-4 py-3">
21 {{$user->id}} 22 {{$user->id}}
22 </td> 23 </td>
23 <td class="px-4 py-3"> 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 </td> 45 </td>
26 <td class="px-4 py-3 text-sm"> 46
47 <td class="px-4 py-3">
27 <div class="flex items-center text-sm"> 48 <div class="flex items-center text-sm">
28 <div> 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 <p class="font-semibold">{{ empty($user->workers->email) ? $user->email : $user->workers->email }}</p> 57 <p class="font-semibold">{{ empty($user->workers->email) ? $user->email : $user->workers->email }}</p>
30 <p class="text-xs text-gray-600 dark:text-gray-400"> 58 <p class="text-xs text-gray-600 dark:text-gray-400">
31 {{ empty($user->workers->telephone) ? $user->telephone : $user->workers->telephone }} 59 {{ empty($user->workers->telephone) ? $user->telephone : $user->workers->telephone }}
32 </p> 60 </p>
33 </div> 61 </div>
34 </div> 62 </div>
35 </td> 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 <td class="px-4 py-3 text-xs"> 73 <td class="px-4 py-3 text-xs">
37 @if (isset($user->workers[0]->persent_anketa)) 74 @if (isset($user->workers[0]->persent_anketa))
38 @if ($user->workers[0]->persent_anketa > 40) 75 @if ($user->workers[0]->persent_anketa > 40)
39 <span class="px-2 py-1 font-semibold leading-tight text-green-700 bg-green-100 rounded-full dark:bg-green-700 dark:text-green-100"> 76 <span class="px-2 py-1 font-semibold leading-tight text-green-700 bg-green-100 rounded-full dark:bg-green-700 dark:text-green-100">
40 {{$user->workers[0]->persent_anketa}}% 77 {{$user->workers[0]->persent_anketa}}%
41 </span> 78 </span>
42 @else 79 @else
43 <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"> 80 <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">
44 {{$user->workers[0]->persent_anketa}}% 81 {{$user->workers[0]->persent_anketa}}%
45 </span> 82 </span>
46 @endif 83 @endif
47 @else 84 @else
48 <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"> 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 </span> 87 </span>
51 @endif 88 @endif
52 </td> 89 </td>
53 <td class="px-4 py-3 text-sm"> 90 <td class="px-4 py-3 text-sm">
54 @if (isset($user->jobtitles[0]->name)) 91 @if (isset($user->jobtitles[0]->name))
55 {{ $user->jobtitles[0]->name }} 92 {{ $user->jobtitles[0]->name }}
56 @else 93 @else
57 Не задана 94 Не задана
58 @endif 95 @endif
59 </td> 96 </td>
60 <td class="px-4 py-3 text-sm"> 97 <td class="px-4 py-3 text-sm">
61 {{ date('d.m.Y h:i:s', strtotime($user->created_at)) }} 98 {{ date('d.m.Y h:i:s', strtotime($user->created_at)) }}
62 </td> 99 </td>
63 <td class="px-4 py-3 text-sm"> 100 <td class="px-4 py-3 text-sm">
64 @if ($user->id > 1) 101 <!--if ($user->id > 1)-->
65 @if (isset($user->workers[0]->id)) 102 @if (isset($user->workers[0]->id))
66 <a href="{{ route('admin.worker-profile-edit', ['worker' => $user->workers[0]->id]) }}">Изменить</a> 103 <a href="{{ route('admin.worker-profile-edit', ['worker' => $user->workers[0]->id]) }}">Изменить</a>
67 104
68 @endif 105 @endif
69 @endif 106 <!--endif-->
70 </td> 107 </td>
71 <!--<td class="px-4 py-3 text-sm"> 108 <!--<td class="px-4 py-3 text-sm">
72 @if ($user->id > 1) 109 @if ($user->id > 1)
73 <input type="checkbox" class="checkban" value="{{$user->id}}" name="ban_{{$user->id}}" {{ ($user->is_ban) ? "checked" : "" }}/> 110 <input type="checkbox" class="checkban" value="{{$user->id}}" name="ban_{{$user->id}}" {{ ($user->is_ban) ? "checked" : "" }}/>
74 @endif 111 @endif
75 </td>--> 112 </td>-->
76 </tr> 113 </tr>
77 @endforeach 114 @endforeach
78 </tbody> 115 </tbody>
79 </table> 116 </table>
80 </div> 117 </div>
81 118
82 <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"> 119 <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">
83 <?=$users->appends($_GET)->links('admin.pagginate'); ?> 120 <?=$users->appends($_GET)->links('admin.pagginate'); ?>
84 </div> 121 </div>