diff --git a/app/Http/Controllers/Admin/AdminController.php b/app/Http/Controllers/Admin/AdminController.php index a5d4c23..cee6877 100644 --- a/app/Http/Controllers/Admin/AdminController.php +++ b/app/Http/Controllers/Admin/AdminController.php @@ -5,9 +5,11 @@ namespace App\Http\Controllers\Admin; use App\Classes\Tools; use App\Http\Controllers\Controller; use App\Http\Requests\CompanyRequest; +use App\Http\Requests\RequestAdminNews; use App\Http\Requests\RequestPosition; use App\Models\Company; use App\Models\Employer; +use App\Models\News; use App\Models\Positions; use App\Models\User; use Carbon\Carbon; @@ -378,4 +380,50 @@ class AdminController extends Controller $position->delete(); return redirect()->route('admin.position'); } + + public function news_admin() { + $news = News::query()->paginate(10); + return view('admin.news.list', compact('news')); + } + + public function new_admin_add() { + return view('admin.news.add'); + } + + public function new_admin_add_save(RequestAdminNews $request) { + $params = $request->all(); + if ($request->has('image')) { + $params['image'] = $request->file('image')->store('news', 'public'); + } + + News::create($params); + return redirect()->route('admin.news_admin'); + } + + public function new_admin_edit(News $new) { + // Вернуть все + return view('admin.news.edit', compact('new')); + } + + public function new_admin_update_save(RequestAdminNews $request, News $new) { + $params = $request->all(); + if ($request->has('image')) { + if (!empty($request->get('image'))) { + $params['image'] = $request->file('image')->store('news', 'public'); + } else { + if (!empty($new->image)) + $params['image'] = $new->image; + else + unset($params['image']); + } + } + $new->update($params); + return redirect()->route('admin.news_admin'); + } + + public function new_admin_delete(News $new) + { + $new->delete(); + return redirect()->route('admin.news_admin'); + } } diff --git a/app/Http/Controllers/EmployerController.php b/app/Http/Controllers/EmployerController.php index 88508db..dcd3f06 100644 --- a/app/Http/Controllers/EmployerController.php +++ b/app/Http/Controllers/EmployerController.php @@ -75,6 +75,15 @@ class EmployerController extends Controller return view('employers.cabinet45', compact('Employer')); } + public function slider_flot() { + $id = Auth()->user()->id; + $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> + WhereHas('users', + function (Builder $query) use ($id) {$query->Where('id', $id); + })->get(); + return view('employers.fly-flot', compact('Employer')); + } + public function cabinet_save(Employer $Employer, Request $request) { $params = $request->all(); $params['user_id'] = Auth()->user()->id; @@ -101,14 +110,14 @@ class EmployerController extends Controller } Flot::create($params); $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); - return redirect()->route('employer.cabinet')->with('success', 'Новый корабль был добавлен'); + return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); } public function delete_flot(Flot $Flot) { $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); if (isset($Flot->id)) $Flot->delete(); - return redirect()->route('employer.cabinet')->with('success', 'Корабль был удален'); + return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); } // Форма добавления вакансий diff --git a/app/Http/Controllers/WorkerController.php b/app/Http/Controllers/WorkerController.php index c7eb8d5..0d7fa51 100644 --- a/app/Http/Controllers/WorkerController.php +++ b/app/Http/Controllers/WorkerController.php @@ -625,17 +625,29 @@ class WorkerController extends Controller return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); } + // Форма сертификате + public function new_sertificate(Worker $worker) { + return view('workers.sertificate_add', compact('worker')); + } + // Добавление сертификата public function add_serificate(Request $request) { $params = $request->all(); - $params['date_begin'] = date('d.m.Y', strtotime($params['date_begin'])); - $params['end_begin'] = date('d.m.Y', strtotime($params['end_begin'])); + $Sertificate = new sertification(); $Sertificate->create($params); $Docs = sertification::query()->where('worker_id', $request->get('worker_id'))->get(); - return view('ajax.documents', compact('Docs')); + return redirect()->route('worker.cabinet'); + //return view('ajax.documents', compact('Docs')); } + public function delete_diplom(Request $request, Worker $worker) { + $infoblok_id = $request->get('infoblok_id'); + $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete(); + + //$Infoblocks = infobloks::query()->get(); + return redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); + } // Удалить сертификат public function delete_sertificate(sertification $doc) { diff --git a/app/Http/Requests/RequestAdminNews.php b/app/Http/Requests/RequestAdminNews.php new file mode 100644 index 0000000..e9fa7dd --- /dev/null +++ b/app/Http/Requests/RequestAdminNews.php @@ -0,0 +1,30 @@ + + */ + public function rules() + { + return [ + // + ]; + } +} diff --git a/resources/views/admin/news/add.blade.php b/resources/views/admin/news/add.blade.php new file mode 100644 index 0000000..2c29008 --- /dev/null +++ b/resources/views/admin/news/add.blade.php @@ -0,0 +1,8 @@ +@extends('layout.admin', ['title' => 'Админка - Добавление новости']) + +@section('content') +
+ @csrf + @include('admin.news.form') +
+@endsection diff --git a/resources/views/admin/news/edit.blade.php b/resources/views/admin/news/edit.blade.php new file mode 100644 index 0000000..ac42c5b --- /dev/null +++ b/resources/views/admin/news/edit.blade.php @@ -0,0 +1,8 @@ +@extends('layout.admin', ['title' => 'Админка - Редактирование новости']) + +@section('content') +
+ @csrf + @include('admin.news.form') +
+@endsection diff --git a/resources/views/admin/news/form.blade.php b/resources/views/admin/news/form.blade.php new file mode 100644 index 0000000..e6b5b2b --- /dev/null +++ b/resources/views/admin/news/form.blade.php @@ -0,0 +1,77 @@ + +
+
+ +
+ +
+ +
+ +
+
+ + Назад +
+
+
+ + diff --git a/resources/views/admin/news/list.blade.php b/resources/views/admin/news/list.blade.php new file mode 100644 index 0000000..52ff010 --- /dev/null +++ b/resources/views/admin/news/list.blade.php @@ -0,0 +1,92 @@ +@extends('layout.admin', ['title' => 'Админка - Реклама сайта']) + +@section('script') + + +@endsection + +@section('modal') + @include('admin.reclames.modal') +@endsection + +@section('search') + +@endsection + +@section('content') + + + Добавить новость + +
+ +
+ + +
+ + + + + + + + + + + @foreach($news as $new) + + + + + + + + @endforeach + +
Заголовок новостиДата публикации/редактированияРедактировать
+ {{$new->id}} + + {{$new->title}} + + {{ $new->created_at }} / {{ $new->updated_at }} + + Изменить | + Удалить +
+
+ +
+ appends($_GET)->links('admin.pagginate'); ?> +
+
+@endsection diff --git a/resources/views/employers/cabinet45.blade.php b/resources/views/employers/cabinet45.blade.php index fd11114..d652e29 100644 --- a/resources/views/employers/cabinet45.blade.php +++ b/resources/views/employers/cabinet45.blade.php @@ -1,4 +1,4 @@ -@extends('layout.frontend', ['title' => 'Образование и образовательные программы - РекаМоре']) +@extends('layout.frontend', ['title' => 'Кабинет работодателя - РекаМоре']) @section('scripts') @@ -157,142 +157,6 @@ -
-
-

Мой флот

-
- -
- @csrf - - -
-
- -
- - @error('name') - - {{ $message }} - - @enderror -
-
-
- -
- - @error('text') - - {{ $message }} - - @enderror -
-
-
- -
- - @error('region') - - {{ $message }} - - @enderror -
-
-
- -
- - @error('power') - - {{ $message }} - - @enderror -
-
-
- -
- - @error('DWT') - - {{ $message }} - - @enderror -
-
-
- -
- - @error('POWER_GD') - - {{ $message }} - - @enderror -
-
-
- -
- - @error('IMO') - - {{ $message }} - - @enderror -
-
- -
- -
- -
- @if (isset($Employer[0]->flots)) - @if ($Employer[0]->flots->count()) - @foreach ($Employer[0]->flots as $it) -
- - - - - - @if (!empty($it->image)) - {{ $it->name }} - @else - {{ $it->name }} - @endif - {{ $it->name }} - {{ $it->region }} - DWT{{ $it->DWT }} - Мощность ГД{{ $it->POWER_GD }} - IMO{{ $it->IMO }} - {{ $it->power }} -
- @endforeach - @endif - @endif -
-
diff --git a/resources/views/employers/delete_people.blade.php b/resources/views/employers/delete_people.blade.php index e60eb41..10b2ece 100644 --- a/resources/views/employers/delete_people.blade.php +++ b/resources/views/employers/delete_people.blade.php @@ -56,7 +56,7 @@
@include('employers.emblema')
- @include('employers.menu', ['item' => 13]) + @include('employers.menu', ['item' => 14])
diff --git a/resources/views/employers/fly-flot.blade.php b/resources/views/employers/fly-flot.blade.php new file mode 100644 index 0000000..2c8090e --- /dev/null +++ b/resources/views/employers/fly-flot.blade.php @@ -0,0 +1,175 @@ +@extends('layout.frontend', ['title' => 'Мой флот - РекаМоре']) + +@section('scripts') + + +@endsection +@section('content') +
+
+ +
+
+
+ @include('employers.emblema') +
+ + @include('employers.menu', ['item' => 12]) + +
+
+ @include('messages_error') + +
+
+

Мой флот

+
+ +
+ @csrf + + +
+
+ +
+ + @error('name') + + {{ $message }} + + @enderror +
+
+
+ +
+ + @error('text') + + {{ $message }} + + @enderror +
+
+
+ +
+ + @error('region') + + {{ $message }} + + @enderror +
+
+
+ +
+ + @error('power') + + {{ $message }} + + @enderror +
+
+
+ +
+ + @error('DWT') + + {{ $message }} + + @enderror +
+
+
+ +
+ + @error('POWER_GD') + + {{ $message }} + + @enderror +
+
+
+ +
+ + @error('IMO') + + {{ $message }} + + @enderror +
+
+ +
+ +
+ +
+ @if (isset($Employer[0]->flots)) + @if ($Employer[0]->flots->count()) + @foreach ($Employer[0]->flots as $it) +
+ + + + + + @if (!empty($it->image)) + {{ $it->name }} + @else + {{ $it->name }} + @endif + {{ $it->name }} + {{ $it->region }} + DWT{{ $it->DWT }} + Мощность ГД{{ $it->POWER_GD }} + IMO{{ $it->IMO }} + {{ $it->power }} +
+ @endforeach + @endif + @endif +
+
+
+
+
+ +
+
+ +@endsection diff --git a/resources/views/employers/menu.blade.php b/resources/views/employers/menu.blade.php index 7588848..9880a08 100644 --- a/resources/views/employers/menu.blade.php +++ b/resources/views/employers/menu.blade.php @@ -105,11 +105,19 @@ Настройки уведомлений - + + + + + + + Мой флот + + Сменить пароль - + Удалить профиль diff --git a/resources/views/employers/password-reset.blade.php b/resources/views/employers/password-reset.blade.php index 85008ad..e7f6c18 100644 --- a/resources/views/employers/password-reset.blade.php +++ b/resources/views/employers/password-reset.blade.php @@ -18,7 +18,7 @@ - @include('employers.menu', ['item' => 12]) + @include('employers.menu', ['item' => 13])
diff --git a/resources/views/layout/admin.blade.php b/resources/views/layout/admin.blade.php index c9f2c1f..03f44ec 100644 --- a/resources/views/layout/admin.blade.php +++ b/resources/views/layout/admin.blade.php @@ -487,6 +487,29 @@ @endif @endif @endforeach + + +
  • + + + Новости + +
  • diff --git a/resources/views/workers/ajax/diploms_dop.blade.php b/resources/views/workers/ajax/diploms_dop.blade.php new file mode 100644 index 0000000..9764f7b --- /dev/null +++ b/resources/views/workers/ajax/diploms_dop.blade.php @@ -0,0 +1,34 @@ +@if (isset($worker->infobloks)) + @if ($worker->infobloks->count()) + @php $i = 1; @endphp + @foreach ($worker->infobloks as $info) +
    + +
    +
    + +
    +
    +
    + @php $i++; @endphp + @endforeach + @endif +@endif + +
    + +
    +
    + +
    +
    +
    diff --git a/resources/views/workers/cabinet.blade.php b/resources/views/workers/cabinet.blade.php index 4de829c..0b458ee 100644 --- a/resources/views/workers/cabinet.blade.php +++ b/resources/views/workers/cabinet.blade.php @@ -3,7 +3,7 @@ @section('scripts') @endsection @@ -329,6 +360,21 @@
  • +
    +

    О себе

    + +
    + + +
    +
    + +
    @if ((isset($Worker[0]->sertificate)) && ($Worker[0]->sertificate->count() > 0)) @php $i = 0; @endphp @@ -346,7 +392,13 @@
    - + +
    + +
    +
    +
    +
    @@ -370,43 +422,17 @@
    -

    Добавить сертификат

    -
    - -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    - -
    + +

    Дополнительная информация

    -
    - @if (isset($Worker[0]->infobloks)) +
    + @if (isset($Worker[0]->infobloks)) @if ($Worker[0]->infobloks->count()) @php $i = 1; @endphp @foreach ($Worker[0]->infobloks as $info) @@ -414,7 +440,7 @@
    - @@ -426,24 +452,24 @@ @endif @endif -
    +
    + + Добавить документ +
    @@ -529,91 +555,10 @@ @php $i++ @endphp @endforeach @endif - - - Новое место работы
    -
    - -
    -

    О себе

    - -
    - -
    -
    + Новое место работы +
    diff --git a/resources/views/workers/sertificate_add.blade.php b/resources/views/workers/sertificate_add.blade.php new file mode 100644 index 0000000..854e8d4 --- /dev/null +++ b/resources/views/workers/sertificate_add.blade.php @@ -0,0 +1,88 @@ +@extends('layout.frontend', ['title' => 'Добавление стандартного документа - РекаМоре']) + +@section('scripts') + +@endsection + +@section('content') +
    +
    + +
    +
    +
    + @include('workers.emblema') + +
    + + @include('workers.menu', ['item' => 1]) +
    + +
    +
    +

    Добавить сертификат

    +
    + @csrf + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    + + Назад +
    +
    +
    +
    +
    +
    + +@endsection diff --git a/routes/web.php b/routes/web.php index 4ca56d4..918d3ff 100644 --- a/routes/web.php +++ b/routes/web.php @@ -188,6 +188,14 @@ Route::group([ // кабинет настройки сайта сохранение формы Route::post('config', [AdminController::class, 'store_config'])->name('store_config'); + // кабинет - новости + Route::get('news-list', [AdminController::class, 'news_admin'])->name('news_admin'); + Route::get('news/add', [AdminController::class, 'new_admin_add'])->name('new_admin_add'); + Route::post('news/add', [AdminController::class, 'new_admin_add_save'])->name('new_admin_save_add'); + Route::get('news/edit/{new}', [AdminController::class, 'new_admin_edit'])->name('new_admin_edit'); + Route::post('news/edit/{new}', [AdminController::class, 'new_admin_update_save'])->name('new_admin_update'); + Route::get('news/delete/{new}', [AdminController::class, 'new_admin_delete'])->name('new_admin_delete'); + // кабинет - пользователи Route::get('users', [UsersController::class, 'index'])->name('users'); @@ -505,12 +513,14 @@ Route::group([ Route::get('кабинет/up/{worker}', [WorkerController::class, 'up'])->name('up'); // Добавление сертификата + Route::get('кабинет/new_sertificate/{worker}', [WorkerController::class, 'new_sertificate'])->name('new_sertificate'); Route::get('кабинет/add_sertificate', [WorkerController::class, 'add_serificate'])->name('add_serificate'); Route::get('кабинет/delete_sertificate/{doc}', [WorkerController::class, 'delete_sertificate'])->name('delete_sertificate'); // Добавление документа-диплома Route::get('кабинет/add_diplom/{worker}', [WorkerController::class, 'add_diplom'])->name('add_diplom'); Route::post('кабинет/add_diplom', [WorkerController::class, 'add_diplom_save'])->name('dop_info_save'); + Route::get('кабинет/delete_diplom/{worker}', [WorkerController::class, 'delete_diplom'])->name('delete_diplom'); // Добавление стандартного диплома Route::get('кабинет/add_document/{worker}', [WorkerController::class, 'add_document'])->name('add_document'); @@ -534,6 +544,7 @@ Route::group([ Route::post('cabinet/{Employer}', [EmployerController::class, 'cabinet_save'])->name('cabinet_save'); Route::post('flot_add_ajax', [EmployerController::class, 'save_add_flot'])->name('save_add_flot'); Route::get('flot_delete_ajax/{Flot}', [EmployerController::class, 'delete_flot'])->name('delete_flot'); + Route::get('cabinet/flot', [EmployerController::class, 'slider_flot'])->name('slider_flot'); // 2 страница - Добавление вакансий Route::get('cabinet/vacancie', [EmployerController::class, 'cabinet_vacancie'])->name('cabinet_vacancie');