Commit 6b9776dfb30a2a94a5ed700da5b2a8a509f45b23
1 parent
8e71d994af
Exists in
master
and in
1 other branch
Вторник работа над проектом 12.03.2024
Showing 17 changed files with 151 additions and 35 deletions Side-by-side Diff
- app/Http/Controllers/MainController.php
- app/Http/Controllers/WorkerController.php
- app/Models/ResponseWork.php
- database/migrations/2024_03_11_141704_create_response_works_table.php
- resources/views/ajax/list_vacancies.blade.php
- resources/views/detail_new.blade.php
- resources/views/errors/404.blade.php
- resources/views/index.blade.php
- resources/views/info_company_new.blade.php
- resources/views/layout/frontend.blade.php
- resources/views/layout/pdf.blade.php
- resources/views/list_vacancies.blade.php
- resources/views/news-list.blade.php
- resources/views/paginate.blade.php
- resources/views/vacance-item.blade.php
- resources/views/worker.blade.php
- routes/web.php
app/Http/Controllers/MainController.php
... | ... | @@ -58,16 +58,11 @@ class MainController extends Controller |
58 | 58 | |
59 | 59 | //категории и вакансии |
60 | 60 | if (($request->has('job')) && ($request->get('job') > 0)) { |
61 | - $categories = $categories->Where('job_title_id', '=', $request->get('job')) | |
62 | - ->OrderByDesc('created_at') | |
63 | - ->GroupBy('categories.id') | |
64 | - ->get(); | |
65 | - } else { | |
66 | - $categories = $categories->OrderByDesc('created_at') | |
67 | - ->GroupBy('categories.id') | |
68 | - ->get(); | |
61 | + $categories = $categories->Where('job_title_id', '=', $request->get('job')); | |
69 | 62 | } |
70 | 63 | |
64 | + $categories = $categories->OrderByDesc('created_at')->GroupBy('categories.id')->get(); | |
65 | + | |
71 | 66 | if ($request->ajax()) { |
72 | 67 | return view('ajax.vacancies', compact('categories')); |
73 | 68 | } else { |
app/Http/Controllers/WorkerController.php
... | ... | @@ -14,6 +14,7 @@ use App\Models\Job_title; |
14 | 14 | use App\Models\Message; |
15 | 15 | use App\Models\place_works; |
16 | 16 | use App\Models\reclame; |
17 | +use App\Models\ResponseWork; | |
17 | 18 | use App\Models\sertification; |
18 | 19 | use App\Models\Static_worker; |
19 | 20 | use App\Models\User; |
... | ... | @@ -379,6 +380,31 @@ class WorkerController extends Controller |
379 | 380 | } |
380 | 381 | } |
381 | 382 | |
383 | + | |
384 | + // Звездная оценка и ответ | |
385 | + public function stars_answer(Request $request) { | |
386 | + $params = $request->all(); | |
387 | + $rules = [ | |
388 | + 'message' => ['required', 'string', 'max:255'], | |
389 | + ]; | |
390 | + | |
391 | + $messages = [ | |
392 | + 'required' => 'Укажите обязательное поле', | |
393 | + 'min' => [ | |
394 | + 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | |
395 | + 'integer' => 'Поле «:attribute» должно быть :min или больше', | |
396 | + 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | |
397 | + ], | |
398 | + 'max' => [ | |
399 | + 'string' => 'Поле «:attribute» должно быть не больше :max символов', | |
400 | + 'integer' => 'Поле «:attribute» должно быть :max или меньше', | |
401 | + 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | |
402 | + ] | |
403 | + ]; | |
404 | + $response_worker = ResponseWork::create($params); | |
405 | + return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!'); | |
406 | + } | |
407 | + | |
382 | 408 | // Создание пользователя |
383 | 409 | protected function create(array $data) |
384 | 410 | { |
... | ... | @@ -447,7 +473,7 @@ class WorkerController extends Controller |
447 | 473 | |
448 | 474 | } |
449 | 475 | |
450 | - //Переписка пись-пись-пись | |
476 | + //Переписка | |
451 | 477 | public function dialog(User_Model $user1, User_Model $user2) { |
452 | 478 | if (isset($user2->id)) { |
453 | 479 | $companion = User_Model::query()->with('workers')-> |
... | ... | @@ -597,5 +623,6 @@ class WorkerController extends Controller |
597 | 623 | $ad_responce = ad_response::create($data); |
598 | 624 | return redirect()->route('worker.messages', ['type_message' => 'output']); |
599 | 625 | } |
626 | + | |
600 | 627 | } |
601 | 628 |
app/Models/ResponseWork.php
... | ... | @@ -0,0 +1,17 @@ |
1 | +<?php | |
2 | + | |
3 | +namespace App\Models; | |
4 | + | |
5 | +use Illuminate\Database\Eloquent\Factories\HasFactory; | |
6 | +use Illuminate\Database\Eloquent\Model; | |
7 | + | |
8 | +class ResponseWork extends Model | |
9 | +{ | |
10 | + use HasFactory; | |
11 | + | |
12 | + public $fillable = [ | |
13 | + 'worker_id', | |
14 | + 'stars', | |
15 | + 'message' | |
16 | + ]; | |
17 | +} |
database/migrations/2024_03_11_141704_create_response_works_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::create('response_works', function (Blueprint $table) { | |
17 | + $table->id(); | |
18 | + $table->bigInteger('worker_id')->nullable(false); | |
19 | + $table->integer('stars')->nullable(true); | |
20 | + $table->string('message', 255)->default('Без комментариев'); | |
21 | + $table->timestamps(); | |
22 | + }); | |
23 | + } | |
24 | + | |
25 | + /** | |
26 | + * Reverse the migrations. | |
27 | + * | |
28 | + * @return void | |
29 | + */ | |
30 | + public function down() | |
31 | + { | |
32 | + Schema::dropIfExists('response_works'); | |
33 | + } | |
34 | +}; |
resources/views/ajax/list_vacancies.blade.php
... | ... | @@ -63,7 +63,7 @@ |
63 | 63 | <a href="{{ route('vacancie', ['vacancy' => $Q->id]) }}" class="button button_light main__employer-page-two-item-button">Подробнее</a> |
64 | 64 | </div> |
65 | 65 | <div class="main__employer-page-two-item-bottom"> |
66 | - <div class="main__employer-page-two-item-bottom-date">{{ $Q->created_at }}</div> | |
66 | + <div class="main__employer-page-two-item-bottom-date">{{ date('d.m.Y H:i:s', strtotime($Q->created_at)) }}</div> | |
67 | 67 | <button type="button" data-val="{{ $Q->id }}" class="like main__employer-page-two-item-bottom-like js-toggle <?=App\Classes\Cookies_vacancy::selected_vacancy($Q->id);?>"> |
68 | 68 | <svg> |
69 | 69 | <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> |
resources/views/detail_new.blade.php
... | ... | @@ -57,7 +57,7 @@ |
57 | 57 | <li><b>{{ $title }}</b></li> |
58 | 58 | </ul> |
59 | 59 | <img src="{{ asset(Storage::url($Query[0]->image)) }}" alt="{{ $title }}" class="thing__pic thing__pic_two"> |
60 | - <time class="thing__date">{{ $Query[0]->created_at }}</time> | |
60 | + <time class="thing__date">{{ date('d.m.Y H:i:s', strtotime($Query[0]->created_at)) }}</time> | |
61 | 61 | <h1 class="thing__title">{{ $title }}</h1> |
62 | 62 | <p class="thing__text">{{ mb_strimwidth($Query[0]->text, 0, 100, "...") }}</p> |
63 | 63 | </div> |
... | ... | @@ -74,7 +74,6 @@ |
74 | 74 | </div> |
75 | 75 | </div> |
76 | 76 | </div> |
77 | - | |
78 | 77 | </main> |
79 | 78 | <section class="news"> |
80 | 79 | <div class="container"> |
... | ... | @@ -101,7 +100,7 @@ |
101 | 100 | <div class="news__item"> |
102 | 101 | <img src="{{ asset(Storage::url($Q_item->image)) }}" alt="{{ $Q_item->title }}" class="news__item-pic"> |
103 | 102 | <div class="news__item-body"> |
104 | - <time datetime="2023-05-01" class="news__item-date">{{ $Q_item->created_at }}</time> | |
103 | + <time datetime="{{ date('d.m.Y H:i:s', strtotime($Q_item->created_at)) }}" class="news__item-date">{{ date('d.m.Y H:i:s', strtotime($Q_item->created_at)) }}</time> | |
105 | 104 | <span class="news__item-title">{{ $Q_item->title }}</span> |
106 | 105 | <span class="news__item-text">{!! $Q_item->text !!}</span> |
107 | 106 | <a href="{{ route('detail_new', ['new' => $Q_item->id]) }}" class="news__item-more button button_light">Читать далее</a> |
resources/views/errors/404.blade.php
... | ... | @@ -0,0 +1,19 @@ |
1 | +@extends('layout.frontend', ['title' => 'Судоходные компании РекаМоре']) | |
2 | + | |
3 | +@section('scripts') | |
4 | + | |
5 | +@endsection | |
6 | + | |
7 | +@section('content') | |
8 | + <section class="page-404"> | |
9 | + <div class="container"> | |
10 | + <div class="page-404__body"> | |
11 | + <div class="page-404__numb">404</div> | |
12 | + <div class="page-404__title">Упс! Страница не найдена</div> | |
13 | + <div class="page-404__subtitle">Такой страницы не существует. Воспользуйтесь меню или перейдите на главную.</div> | |
14 | + <a href="{{ route('index') }}" class="button page-404__button">Перейти на главную</a> | |
15 | + </div> | |
16 | + </div> | |
17 | + </section> | |
18 | +@endsection | |
19 | + |
resources/views/index.blade.php
... | ... | @@ -178,7 +178,7 @@ |
178 | 178 | <div class="news__item"> |
179 | 179 | <img src="{{ asset(Storage::url($new->image)) }}" alt="" class="news__item-pic"> |
180 | 180 | <div class="news__item-body"> |
181 | - <time datetime="2023-05-01" class="news__item-date">{{ $new->created_at }}</time> | |
181 | + <time datetime="{{ date('d.m.Y H:i:s', strtotime($new->created_at)) }}" class="news__item-date">{{ date('d.m.Y H:i:s', strtotime($new->created_at)) }}</time> | |
182 | 182 | <span class="news__item-title">{{ $new->title }}</span> |
183 | 183 | <span class="news__item-text">{{ mb_strimwidth($new->text, 0, 100) }}</span> |
184 | 184 | <a href="{{ route('detail_new', ['new' => $new->id]) }}" class="news__item-more button button_light">Читать далее</a> |
resources/views/info_company_new.blade.php
... | ... | @@ -241,7 +241,7 @@ |
241 | 241 | class="button button_light main__employer-page-two-item-button">Подробнее</a>--> |
242 | 242 | </div> |
243 | 243 | <div class="main__employer-page-two-item-bottom"> |
244 | - <div class="main__employer-page-two-item-bottom-date">{{ $job->updated_at }}</div> | |
244 | + <div class="main__employer-page-two-item-bottom-date">{{ date('d.m.Y H:i:s', strtotime($job->updated_at)) }}</div> | |
245 | 245 | <button type="button" |
246 | 246 | class="like main__employer-page-two-item-bottom-like js-toggle"> |
247 | 247 | <svg> |
resources/views/layout/frontend.blade.php
... | ... | @@ -9,6 +9,7 @@ |
9 | 9 | <script src="{{ asset('js/jquery.js') }}"></script> |
10 | 10 | <script type="text/javascript" src="{{ asset('js/jquery.cookie.js') }}"></script> |
11 | 11 | <link rel="stylesheet" href="{{ asset('css/style_new.css') }}"> |
12 | + <link rel="stylesheet" href="{{ asset('css/star-rating.min.css') }}"> | |
12 | 13 | <style> |
13 | 14 | .err_red { |
14 | 15 | border: red 2px solid; |
... | ... | @@ -276,6 +277,7 @@ |
276 | 277 | <script src="{{ asset('js/jquery.select2.js') }}"></script> |
277 | 278 | <script src="{{ asset('js/swiper.js') }}"></script> |
278 | 279 | <script src="{{ asset('js/script.js') }}"></script> |
280 | +<script src="{{ asset('js/star-rating.min.js') }}"></script> | |
279 | 281 | <script> |
280 | 282 | var getUrlParameter = function getUrlParameter(sParam) { |
281 | 283 | var sPageURL = decodeURIComponent(window.location.search.substring(1)), |
resources/views/layout/pdf.blade.php
... | ... | @@ -7,6 +7,9 @@ |
7 | 7 | <meta name="viewport" content="width=device-width,initial-scale=1"> |
8 | 8 | <meta name="theme-color" content="#377D87"> |
9 | 9 | <link rel="stylesheet" href="{{ asset('css/style.css') }}"> |
10 | + <style> | |
11 | + body{font-family:'DejaVu Sans',sans-serif;background:#fff;font-size:1.6rem;font-weight:400;color:#363A3F} | |
12 | + </style> | |
10 | 13 | </head> |
11 | 14 | |
12 | 15 | <body id="body" class="pdf"> |
... | ... | @@ -176,13 +179,6 @@ |
176 | 179 | </div> |
177 | 180 | </div> |
178 | 181 | </main> |
179 | -<script src="{{ asset('js/jquery.js') }}"></script> | |
180 | -<script src="{{ asset('js/jquery.maskedinput.js') }}"></script> | |
181 | -<script src="{{ asset('js/jquery.fancybox.js') }}"></script> | |
182 | -<script src="{{ asset('js/jquery.select2.js') }}"></script> | |
183 | -<script src="{{ asset('js/swiper.js') }}"></script> | |
184 | -<script src="{{ asset('js/star-rating.min.js') }}"></script> | |
185 | -<script src="{{ asset('js/script.js') }}"></script> | |
186 | 182 | </body> |
187 | 183 | |
188 | 184 | </html> |
resources/views/list_vacancies.blade.php
... | ... | @@ -225,7 +225,7 @@ |
225 | 225 | <a href="{{ route('vacancie', ['vacancy' => $Q->id]) }}" class="button button_light main__employer-page-two-item-button">Подробнее</a> |
226 | 226 | </div> |
227 | 227 | <div class="main__employer-page-two-item-bottom"> |
228 | - <div class="main__employer-page-two-item-bottom-date">{{ $Q->created_at }}</div> | |
228 | + <div class="main__employer-page-two-item-bottom-date">{{ date('d.m.Y H:i:s', strtotime($Q->created_at)) }}</div> | |
229 | 229 | <button type="button" data-val="{{ $Q->id }}" class="like main__employer-page-two-item-bottom-like js-toggle js_vacancy_favorites <?=App\Classes\Cookies_vacancy::selected_vacancy($Q->id);?>"> |
230 | 230 | <svg> |
231 | 231 | <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> |
resources/views/news-list.blade.php
... | ... | @@ -144,16 +144,14 @@ |
144 | 144 | <img src="{{ asset('images/8.jpg') }}" alt="{{ $Q->title }}" class="news__item-pic"> |
145 | 145 | @endif |
146 | 146 | <div class="news__item-body"> |
147 | - <time datetime="2023-05-01" class="news__item-date">{{ $Q->created_at }}</time> | |
147 | + <time datetime="{{ date('d.m.Y H:i:s', strtotime($Q->created_at)) }}" class="news__item-date">{{ date('d.m.Y H:i:s', strtotime($Q->created_at)) }}</time> | |
148 | 148 | <span class="news__item-title">{{ $Q->title }}</span> |
149 | 149 | <span class="news__item-text">{!! $Q->text !!}</span> |
150 | 150 | <a href="{{ route('detail_new', ['new' => $Q->id]) }}" class="news__item-more button button_light">Читать далее</a> |
151 | 151 | </div> |
152 | 152 | </div> |
153 | 153 | @endforeach |
154 | - | |
155 | 154 | </div> |
156 | - | |
157 | 155 | {{ $Query->appends($_GET)->links('paginate') }} |
158 | 156 | @else |
159 | 157 | <div class="news__items"> |
resources/views/paginate.blade.php
1 | 1 | @if ($paginator->hasPages()) |
2 | 2 | <div class="pagination"> |
3 | 3 | @if ($paginator->onFirstPage()) |
4 | - | |
4 | + <a href="{{ $paginator->previousPageUrl() }}" class="pagination__nav pagination__nav_prev"> | |
5 | + <svg> | |
6 | + <use xlink:href="{{ asset('images/sprite.svg#arrow-bold') }}"></use> | |
7 | + </svg> | |
8 | + </a> | |
5 | 9 | @else |
6 | 10 | <a href="{{ $paginator->previousPageUrl() }}" class="pagination__nav pagination__nav_prev"> |
7 | 11 | <svg> |
... | ... | @@ -45,7 +49,11 @@ |
45 | 49 | </svg> |
46 | 50 | </a> |
47 | 51 | @else |
48 | - | |
52 | + <a href="{{ $paginator->nextPageUrl() }}" class="pagination__nav pagination__nav_next"> | |
53 | + <svg> | |
54 | + <use xlink:href="{{ asset('images/sprite.svg#arrow-bold') }}"></use> | |
55 | + </svg> | |
56 | + </a> | |
49 | 57 | @endif |
50 | 58 | </div> |
51 | 59 | @endif |
resources/views/vacance-item.blade.php
... | ... | @@ -109,7 +109,7 @@ |
109 | 109 | <button type="button" class="button main__employer-page-two-item-button">Откликнуться</button> |
110 | 110 | </div> |
111 | 111 | <div class="main__employer-page-two-item-bottom"> |
112 | - <div class="main__employer-page-two-item-bottom-date">{{ $Q->created_at }}</div> | |
112 | + <div class="main__employer-page-two-item-bottom-date">{{ date('d.m.Y H:i:s', strtotime($Q->created_at)) }}</div> | |
113 | 113 | <button type="button" data-val="{{ $Q->id }}" class="like main__employer-page-two-item-bottom-like js_vacancy_favorites js-toggle <?=\App\Classes\RusDate::selected_vacancy($Q->id);?>"> |
114 | 114 | <svg> |
115 | 115 | <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> |
resources/views/worker.blade.php
... | ... | @@ -222,9 +222,7 @@ |
222 | 222 | <div class="main__resume-profile-info"> |
223 | 223 | <h2 class="main__resume-profile-info-title">Данные о прошлых компаниях</h2> |
224 | 224 | <div class="main__resume-profile-info-body"> |
225 | - | |
226 | - @if (isset($Query[0]->prev_company)) | |
227 | - @if ($Query[0]->prev_company->count()) | |
225 | + @if ((isset($Query[0]->prev_company)) && ($Query[0]->prev_company->count())) | |
228 | 226 | @foreach ($Query[0]->prev_company as $it) |
229 | 227 | <div class="main__resume-profile-info-body-item"> |
230 | 228 | <h3 class="main__resume-profile-info-body-subtitle">{{ $it->name_company }}</h3> |
... | ... | @@ -247,23 +245,44 @@ |
247 | 245 | </ul> |
248 | 246 | </div> |
249 | 247 | @endforeach |
250 | - @endif | |
248 | + @else | |
249 | + <div class="main__resume-profile-info-body-item"> | |
250 | + <h3 class="main__resume-profile-info-body-subtitle">Нету данных о компании</h3> | |
251 | + </div> | |
251 | 252 | @endif |
252 | 253 | </div> |
253 | 254 | </div> |
255 | + | |
256 | + | |
257 | + | |
258 | + | |
259 | + | |
260 | + | |
261 | + | |
262 | + | |
254 | 263 | <div class="main__resume-profile-review"> |
264 | + <form action="{{ route('stars_answer') }}" method="POST"> | |
265 | + @csrf | |
255 | 266 | <h2 class="main__resume-profile-review-title">Оставить отзыв о работнике</h2> |
256 | 267 | <div class="rate"> |
257 | 268 | <div class="rate__label">Ваша оценка:</div> |
258 | 269 | <div class="rate__stars"> |
259 | - <img src="{{ asset('images/stars.svg') }}" alt=""> | |
270 | + <select name="stars" id="stars" class="star-rating js-stars"> | |
271 | + <option value="5">5</option> | |
272 | + <option value="4">4</option> | |
273 | + <option value="3">3</option> | |
274 | + <option value="2">2</option> | |
275 | + <option value="1" selected>1</option> | |
276 | + </select> | |
260 | 277 | </div> |
261 | 278 | </div> |
279 | + <input type="hidden" name="worker_id" id="worker_id" value="{{ $Query[0]->id }}"/> | |
262 | 280 | <div class="main__resume-profile-review-body"> |
263 | 281 | <h3>Ваш отзыв</h3> |
264 | - <textarea class="textarea" placeholder="Текст отзыва…" required></textarea> | |
282 | + <textarea class="textarea" name="message" id="message" placeholder="Текст отзыва…" required></textarea> | |
265 | 283 | <button type="submit" class="button">Оставить отзыв</button> |
266 | 284 | </div> |
285 | + </form> | |
267 | 286 | </div> |
268 | 287 | </div> |
269 | 288 | </div> |
routes/web.php
... | ... | @@ -442,6 +442,8 @@ Route::get('register_employer', [EmployerController::class, 'register_employer'] |
442 | 442 | |
443 | 443 | //восстановление пароля |
444 | 444 | Route::get('repair-password', [MainController::class, 'repair_password'])->name('repair_password'); |
445 | +// Звезда сообщения | |
446 | +Route::post('stars-answer', [WorkerController::class, 'stars_answer'])->name('stars_answer'); | |
445 | 447 | |
446 | 448 | // Борьба |
447 | 449 | Route::get('clear_cookie', function() { |