Commit f364ad5b7af17b54dcee6c27a56de8629dd2aabc
1 parent
e3ac493bbd
Exists in
master
and in
1 other branch
Коммит по вакансиям
Showing 8 changed files with 78 additions and 29 deletions Side-by-side Diff
- app/Http/Controllers/Ad_jobsController.php
- app/Http/Controllers/Admin/JobTitlesController.php
- app/Http/Controllers/Admin/UsersController.php
- app/Http/Controllers/EmployerController.php
- app/Providers/MyServiceProvider.php
- resources/views/employers/add_ad_jobs.blade.php
- resources/views/employers/edit_ad_jobs.blade.php
- resources/views/employers/list_vacancy.blade.php
app/Http/Controllers/Ad_jobsController.php
... | ... | @@ -44,11 +44,25 @@ class Ad_jobsController extends Controller |
44 | 44 | $id = Auth()->user()->id; |
45 | 45 | |
46 | 46 | $Positions = Category::query()->active()->get(); |
47 | - if ($Positions->count()) { | |
48 | - $jobs = Job_title::query()->OrderBy('name')->Notbdif()->where('position_id', $Positions[0]->id)->get(); | |
47 | + /*if ($Positions->count()) { | |
48 | + $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> | |
49 | + where('is_remove', '=', '0')-> | |
50 | + where('is_bd', '=', '0')-> | |
51 | + where('position_id', $Positions[0]->id)-> | |
52 | + get(); | |
49 | 53 | } else { |
50 | - $jobs = Job_title::query()->OrderBy('name')->Notbdif()->where('position_id', 0)->get(); | |
54 | + $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> | |
55 | + where('is_remove', '=', '0')-> | |
56 | + where('is_bd', '=', '0')-> | |
57 | + where('position_id', 0)-> | |
58 | + get(); | |
51 | 59 | } |
60 | + */ | |
61 | + $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> | |
62 | + where('is_remove', '=', '0')-> | |
63 | + where('is_bd', '=', '0')-> | |
64 | + get(); | |
65 | + | |
52 | 66 | $categories = Category::query()->get(); |
53 | 67 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
54 | 68 | where('user_id', $id)->first(); |
... | ... | @@ -73,11 +87,25 @@ class Ad_jobsController extends Controller |
73 | 87 | $job_title_id = ''; |
74 | 88 | |
75 | 89 | $Positions = Category::query()->active()->get(); |
76 | - if ($Positions->count()) { | |
77 | - $jobs123 = Job_title::query()->OrderBy('name')->where('position_id', $ad_job->job_title->position_id )->get(); | |
90 | + /*if ($Positions->count()) { | |
91 | + $jobs123 = Job_title::query()-> | |
92 | + orderByDesc('sort')->OrderBy('name')-> | |
93 | + where('is_remove', '=', '0')-> | |
94 | + where('is_bd', '=', '0')-> | |
95 | + where('position_id', $ad_job->job_title->position_id )->get(); | |
78 | 96 | } else { |
79 | - $jobs123 = Job_title::query()->OrderBy('name')->where('position_id', 0)->get(); | |
80 | - } | |
97 | + $jobs123 = Job_title::query()-> | |
98 | + orderByDesc('sort')->OrderBy('name')-> | |
99 | + where('is_remove', '=', '0')-> | |
100 | + where('is_bd', '=', '0')-> | |
101 | + where('position_id', 0)->get(); | |
102 | + }*/ | |
103 | + | |
104 | + $jobs123 = Job_title::query()-> | |
105 | + orderByDesc('sort')->OrderBy('name')-> | |
106 | + where('is_remove', '=', '0')-> | |
107 | + where('is_bd', '=', '0')-> | |
108 | + get(); | |
81 | 109 | |
82 | 110 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
83 | 111 | where('user_id', $id)->first(); |
app/Http/Controllers/Admin/JobTitlesController.php
... | ... | @@ -18,7 +18,8 @@ class JobTitlesController extends Controller |
18 | 18 | */ |
19 | 19 | public function index() |
20 | 20 | { |
21 | - $Jobs = Job_title::query()->where('is_remove', '=', '0')->orderBy('name')->paginate(15); | |
21 | + $Jobs = Job_title::query()->where('is_remove', '=', '0')-> | |
22 | + orderByDesc('sort')->orderBy('name')->paginate(15); | |
22 | 23 | return view('admin.job_titles.index', compact('Jobs')); |
23 | 24 | } |
24 | 25 |
app/Http/Controllers/Admin/UsersController.php
... | ... | @@ -94,7 +94,8 @@ class UsersController extends Controller |
94 | 94 | } |
95 | 95 | |
96 | 96 | public function edit_bd(User $user) { |
97 | - $list_job_titles = Job_title::query()->active()->where('is_bd', '=' , '2')->orderBy('name', 'asc')->get(); | |
97 | + $list_job_titles = Job_title::query()->active()->where('is_bd', '=' , '2')-> | |
98 | + orderByDesc('sort')->orderBy('name', 'asc')->get(); | |
98 | 99 | return view('admin.users.edit', compact('user', 'list_job_titles')); |
99 | 100 | } |
100 | 101 |
app/Http/Controllers/EmployerController.php
... | ... | @@ -212,11 +212,18 @@ class EmployerController extends Controller |
212 | 212 | // Список вакансий |
213 | 213 | public function vacancy_list(Request $request) { |
214 | 214 | $id = Auth()->user()->id; |
215 | + | |
216 | + //dd($request->all()); | |
215 | 217 | $Employer = Employer::query()->where('user_id', $id)->first(); |
216 | 218 | $vacancy_list = Ad_employer::query()->with('jobs')-> |
217 | 219 | with('jobs_code')-> |
218 | 220 | where('employer_id', $Employer->id); |
219 | 221 | |
222 | + if (($request->has('search')) && (!empty($request->get('search')))) { | |
223 | + $search = $request->get('search'); | |
224 | + $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%"); | |
225 | + } | |
226 | + | |
220 | 227 | if ($request->get('sort')) { |
221 | 228 | $sort = $request->get('sort'); |
222 | 229 | switch ($sort) { |
... | ... | @@ -802,7 +809,11 @@ class EmployerController extends Controller |
802 | 809 | // Избранные люди на корабль |
803 | 810 | public function selected_people(Request $request) { |
804 | 811 | $id = $request->get('id'); |
805 | - $favorite_people = Job_title::query()->Notbdif()->where('is_remove', '=', '0')->where('position_id', $id)->get(); | |
812 | + $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> | |
813 | + where('is_remove', '=', '0')-> | |
814 | + where('is_bd', '=', '0')-> | |
815 | + where('position_id', $id)-> | |
816 | + get(); | |
806 | 817 | return view('favorite_people', compact('favorite_people')); |
807 | 818 | } |
808 | 819 | } |
app/Providers/MyServiceProvider.php
... | ... | @@ -82,7 +82,11 @@ class MyServiceProvider extends ServiceProvider |
82 | 82 | function($view){ |
83 | 83 | $id = Auth::user(); |
84 | 84 | $companies = Company::query()->limit(1)->get(); |
85 | - $jobs = Job_title::query()->where('is_remove', '=', '0')->get(); | |
85 | + //$jobs = Job_title::query()->where('is_remove', '=', '0')->get(); | |
86 | + $jobs = Job_title::query()->where('is_remove', '=', '0')-> | |
87 | + where('is_bd', '=' , '0')-> | |
88 | + OrderByDesc('sort')->OrderBy('name')->get(); | |
89 | + | |
86 | 90 | $view->with(['UserId' => $id, 'companies' => $companies, 'jobs' => $jobs]); |
87 | 91 | } |
88 | 92 | ); |
... | ... | @@ -112,8 +116,12 @@ class MyServiceProvider extends ServiceProvider |
112 | 116 | $view_job_title = ['modals.register']; |
113 | 117 | View::composer($view_job_title, |
114 | 118 | function($view_job_title) { |
119 | + //$Job_titles = Job_title::query()->where('is_remove', '=', '0')-> | |
120 | + // where('is_bd', '=' , '1')->get(); | |
115 | 121 | $Job_titles = Job_title::query()->where('is_remove', '=', '0')-> |
116 | - where('is_bd', '=' , '1')->get(); | |
122 | + where('is_bd', '=' , '1')-> | |
123 | + OrderByDesc('sort')->OrderBy('name')->get(); | |
124 | + | |
117 | 125 | $view_job_title->with(['Job_titles' => $Job_titles]); |
118 | 126 | } |
119 | 127 | ); |
resources/views/employers/add_ad_jobs.blade.php
... | ... | @@ -59,7 +59,7 @@ |
59 | 59 | </div> |
60 | 60 | </div> |
61 | 61 | |
62 | - <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | |
62 | + <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> | |
63 | 63 | <label class="form-group__label">Категория вакансии</label> |
64 | 64 | <div class="form-group__item"> |
65 | 65 | <div class="select"> |
... | ... | @@ -82,17 +82,15 @@ |
82 | 82 | <div class="form-group__item"> |
83 | 83 | <div class="select"> |
84 | 84 | <select class="js-select2" name="job_title_id" id="job_title_id"> |
85 | - @php $i = 1 @endphp | |
86 | - @if ($jobs->count()) | |
87 | - @foreach($jobs as $j) | |
88 | - @if ($i == 1) <option selected> Выберите должность из списка</option> | |
89 | - @else | |
90 | - <option value="{{ $j->id }}">{{ $j->name }}</option> | |
91 | - @endif | |
92 | - @php $i++ @endphp | |
93 | - @endforeach | |
94 | - @endif | |
85 | + @php $i = 1; | |
86 | + @endphp | |
87 | + <option value="0"> Выберите должность из списка</option> | |
88 | + @foreach($jobs as $j) | |
89 | + <option value="{{ $j->id }}">{{ $j->name }}</option> | |
90 | + @php $i++ @endphp | |
91 | + @endforeach | |
95 | 92 | </select> |
93 | + | |
96 | 94 | @error('job_title_id') |
97 | 95 | <span class="text-xs text-red-600 dark:text-red-400"> |
98 | 96 | {{ $message }} |
resources/views/employers/edit_ad_jobs.blade.php
... | ... | @@ -59,7 +59,7 @@ |
59 | 59 | </div> |
60 | 60 | </div> |
61 | 61 | |
62 | - <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | |
62 | + <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group" style="display:none"> | |
63 | 63 | <label class="form-group__label">Категория должности</label> |
64 | 64 | <div class="form-group__item"> |
65 | 65 | <div class="select"> |
... | ... | @@ -81,6 +81,8 @@ |
81 | 81 | <label class="form-group__label">Должность соискателя</label> |
82 | 82 | <div class="form-group__item"> |
83 | 83 | <div class="select"> |
84 | + <pre><? print_r($jobs123)?></pre> | |
85 | + | |
84 | 86 | <select class="js-select2" name="job_title_id" id="job_title_id"> |
85 | 87 | @php $i = 1; |
86 | 88 | @endphp |
resources/views/employers/list_vacancy.blade.php
... | ... | @@ -10,12 +10,12 @@ |
10 | 10 | |
11 | 11 | $.ajax({ |
12 | 12 | type: "GET", |
13 | - url: "{{ route('employer.vacancy_list') }}", | |
14 | - data: "sort="+val_, | |
13 | + url: "{{ url()->current() }}", | |
14 | + data: "sort="+val_+"&search=@if ((isset($_GET['search']))&&(!empty($_GET['search']))){{$_GET['search']}}@endif", | |
15 | 15 | success: function (data) { |
16 | 16 | console.log('Выбор сортировки'); |
17 | 17 | console.log(data); |
18 | - history.pushState({}, '', "{{ route('employer.vacancy_list') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); | |
18 | + history.pushState({}, '', "{{ route('employer.vacancy_list') }}?search=@if ((isset($_GET['search']))&&(!empty($_GET['search']))){{$_GET['search']}}@endif"+"&sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); | |
19 | 19 | $('#main_ockar').html(data); |
20 | 20 | }, |
21 | 21 | headers: { |
... | ... | @@ -54,8 +54,8 @@ |
54 | 54 | <div class="cabinet__body-item"> |
55 | 55 | <div class="cabinet__filters"> |
56 | 56 | <div class="cabinet__filters-item"> |
57 | - <form class="search"> | |
58 | - <input type="search" class="input" placeholder="Поиск…" required> | |
57 | + <form class="search" action="{{ url()->current() }}" method="GET"> | |
58 | + <input type="search" name="search" class="input" placeholder="Поиск…" value="@if ((isset($_GET['search'])) && (!empty($_GET['search']))) {{ $_GET['search'] }}@endif"> | |
59 | 59 | <button type="submit" class="button">Найти</button> |
60 | 60 | <span> |
61 | 61 | <svg> |