Commit f364ad5b7af17b54dcee6c27a56de8629dd2aabc
1 parent
e3ac493bbd
Exists in
master
and in
1 other branch
Коммит по вакансиям
Showing 8 changed files with 78 additions and 29 deletions Inline 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
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers; | 3 | namespace App\Http\Controllers; |
4 | 4 | ||
5 | use App\Classes\RusDate; | 5 | use App\Classes\RusDate; |
6 | use App\Classes\Tools; | 6 | use App\Classes\Tools; |
7 | use App\Http\Requests\FlotRequest; | 7 | use App\Http\Requests\FlotRequest; |
8 | use App\Http\Requests\MessagesRequiest; | 8 | use App\Http\Requests\MessagesRequiest; |
9 | use App\Http\Requests\VacancyRequestEdit; | 9 | use App\Http\Requests\VacancyRequestEdit; |
10 | use App\Http\Requests\VacansiaRequiest; | 10 | use App\Http\Requests\VacansiaRequiest; |
11 | use App\Mail\MailSotrudnichestvo; | 11 | use App\Mail\MailSotrudnichestvo; |
12 | use App\Mail\SendAllMessages; | 12 | use App\Mail\SendAllMessages; |
13 | use App\Models\Ad_employer; | 13 | use App\Models\Ad_employer; |
14 | use App\Models\Ad_jobs; | 14 | use App\Models\Ad_jobs; |
15 | use App\Models\ad_response; | 15 | use App\Models\ad_response; |
16 | use App\Models\Category; | 16 | use App\Models\Category; |
17 | use App\Models\Education; | 17 | use App\Models\Education; |
18 | use App\Models\Employer; | 18 | use App\Models\Employer; |
19 | use App\Models\employers_main; | 19 | use App\Models\employers_main; |
20 | use App\Models\Flot; | 20 | use App\Models\Flot; |
21 | use App\Models\Job_title; | 21 | use App\Models\Job_title; |
22 | use App\Models\Like_vacancy; | 22 | use App\Models\Like_vacancy; |
23 | use App\Models\Like_worker; | 23 | use App\Models\Like_worker; |
24 | use App\Models\Message; | 24 | use App\Models\Message; |
25 | use App\Models\Positions; | 25 | use App\Models\Positions; |
26 | use App\Models\Worker; | 26 | use App\Models\Worker; |
27 | use Carbon\Carbon; | 27 | use Carbon\Carbon; |
28 | use Illuminate\Auth\Events\Registered; | 28 | use Illuminate\Auth\Events\Registered; |
29 | use Illuminate\Database\Eloquent\Builder; | 29 | use Illuminate\Database\Eloquent\Builder; |
30 | use Illuminate\Database\Eloquent\Model; | 30 | use Illuminate\Database\Eloquent\Model; |
31 | use Illuminate\Foundation\Auth\User; | 31 | use Illuminate\Foundation\Auth\User; |
32 | use Illuminate\Http\Request; | 32 | use Illuminate\Http\Request; |
33 | use Illuminate\Support\Facades\Auth; | 33 | use Illuminate\Support\Facades\Auth; |
34 | use Illuminate\Support\Facades\Hash; | 34 | use Illuminate\Support\Facades\Hash; |
35 | use Illuminate\Support\Facades\Mail; | 35 | use Illuminate\Support\Facades\Mail; |
36 | use Illuminate\Support\Facades\Storage; | 36 | use Illuminate\Support\Facades\Storage; |
37 | use App\Models\User as User_Model; | 37 | use App\Models\User as User_Model; |
38 | use Illuminate\Support\Facades\Validator; | 38 | use Illuminate\Support\Facades\Validator; |
39 | 39 | ||
40 | class Ad_jobsController extends Controller | 40 | class Ad_jobsController extends Controller |
41 | { | 41 | { |
42 | 42 | ||
43 | public function add_job_in_vac(Request $request, Ad_employer $ad_employer) { | 43 | public function add_job_in_vac(Request $request, Ad_employer $ad_employer) { |
44 | $id = Auth()->user()->id; | 44 | $id = Auth()->user()->id; |
45 | 45 | ||
46 | $Positions = Category::query()->active()->get(); | 46 | $Positions = Category::query()->active()->get(); |
47 | if ($Positions->count()) { | 47 | /*if ($Positions->count()) { |
48 | $jobs = Job_title::query()->OrderBy('name')->Notbdif()->where('position_id', $Positions[0]->id)->get(); | 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 | } else { | 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 | $categories = Category::query()->get(); | 66 | $categories = Category::query()->get(); |
53 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 67 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
54 | where('user_id', $id)->first(); | 68 | where('user_id', $id)->first(); |
55 | 69 | ||
56 | return view('employers.add_ad_jobs', compact('ad_employer', | 70 | return view('employers.add_ad_jobs', compact('ad_employer', |
57 | 'Positions', 'categories', 'jobs', | 71 | 'Positions', 'categories', 'jobs', |
58 | 'Employer')); | 72 | 'Employer')); |
59 | } | 73 | } |
60 | 74 | ||
61 | public function add_job_in_vac_save(Request $request) { | 75 | public function add_job_in_vac_save(Request $request) { |
62 | $params = $request->all(); | 76 | $params = $request->all(); |
63 | 77 | ||
64 | Ad_jobs::create($params); | 78 | Ad_jobs::create($params); |
65 | return redirect()->route('employer.vacancy_list'); | 79 | return redirect()->route('employer.vacancy_list'); |
66 | } | 80 | } |
67 | 81 | ||
68 | public function edit_job_in_vac(Ad_jobs $ad_job, Ad_employer $ad_employer, Request $request) { | 82 | public function edit_job_in_vac(Ad_jobs $ad_job, Ad_employer $ad_employer, Request $request) { |
69 | $id = Auth()->user()->id; | 83 | $id = Auth()->user()->id; |
70 | if ($request->has('job_title_id')) | 84 | if ($request->has('job_title_id')) |
71 | $job_title_id= $request->get('job_title_id'); | 85 | $job_title_id= $request->get('job_title_id'); |
72 | else | 86 | else |
73 | $job_title_id = ''; | 87 | $job_title_id = ''; |
74 | 88 | ||
75 | $Positions = Category::query()->active()->get(); | 89 | $Positions = Category::query()->active()->get(); |
76 | if ($Positions->count()) { | 90 | /*if ($Positions->count()) { |
77 | $jobs123 = Job_title::query()->OrderBy('name')->where('position_id', $ad_job->job_title->position_id )->get(); | 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 | } else { | 96 | } else { |
79 | $jobs123 = Job_title::query()->OrderBy('name')->where('position_id', 0)->get(); | 97 | $jobs123 = Job_title::query()-> |
80 | } | 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 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 110 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
83 | where('user_id', $id)->first(); | 111 | where('user_id', $id)->first(); |
84 | return view('employers.edit_ad_jobs', compact('ad_job', | 112 | return view('employers.edit_ad_jobs', compact('ad_job', |
85 | 'Positions', | 113 | 'Positions', |
86 | 'Employer','jobs123', 'ad_employer', 'job_title_id')); | 114 | 'Employer','jobs123', 'ad_employer', 'job_title_id')); |
87 | } | 115 | } |
88 | 116 | ||
89 | public function edit_job_in_vac_save(Request $request, Ad_jobs $ad_job) { | 117 | public function edit_job_in_vac_save(Request $request, Ad_jobs $ad_job) { |
90 | $params = $request->all(); | 118 | $params = $request->all(); |
91 | 119 | ||
92 | $ad_job->update($params); | 120 | $ad_job->update($params); |
93 | 121 | ||
94 | return redirect()->route('employer.vacancy_list'); | 122 | return redirect()->route('employer.vacancy_list'); |
95 | } | 123 | } |
96 | 124 | ||
97 | public function delete_job_in_vac(Ad_jobs $ad_job) { | 125 | public function delete_job_in_vac(Ad_jobs $ad_job) { |
98 | $ad_job->delete(); | 126 | $ad_job->delete(); |
99 | return redirect()->route('employer.vacancy_list'); | 127 | return redirect()->route('employer.vacancy_list'); |
100 | } | 128 | } |
101 | } | 129 | } |
102 | 130 |
app/Http/Controllers/Admin/JobTitlesController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers\Admin; | 3 | namespace App\Http\Controllers\Admin; |
4 | 4 | ||
5 | use App\Http\Controllers\Controller; | 5 | use App\Http\Controllers\Controller; |
6 | use App\Http\Requests\JobTitlesRequest; | 6 | use App\Http\Requests\JobTitlesRequest; |
7 | use App\Models\Category; | 7 | use App\Models\Category; |
8 | use App\Models\Job_title; | 8 | use App\Models\Job_title; |
9 | use App\Models\Positions; | 9 | use App\Models\Positions; |
10 | use Illuminate\Http\Request; | 10 | use Illuminate\Http\Request; |
11 | 11 | ||
12 | class JobTitlesController extends Controller | 12 | class JobTitlesController extends Controller |
13 | { | 13 | { |
14 | /** | 14 | /** |
15 | * Display a listing of the resource. | 15 | * Display a listing of the resource. |
16 | * | 16 | * |
17 | * @return \Illuminate\Http\Response | 17 | * @return \Illuminate\Http\Response |
18 | */ | 18 | */ |
19 | public function index() | 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 | return view('admin.job_titles.index', compact('Jobs')); | 23 | return view('admin.job_titles.index', compact('Jobs')); |
23 | } | 24 | } |
24 | 25 | ||
25 | /** | 26 | /** |
26 | * Show the form for creating a new resource. | 27 | * Show the form for creating a new resource. |
27 | * | 28 | * |
28 | * @return \Illuminate\Http\Response | 29 | * @return \Illuminate\Http\Response |
29 | */ | 30 | */ |
30 | public function create() | 31 | public function create() |
31 | { | 32 | { |
32 | /*$items = Job_title::query()-> | 33 | /*$items = Job_title::query()-> |
33 | orderByDesc('sort')-> | 34 | orderByDesc('sort')-> |
34 | orderBy('name')-> | 35 | orderBy('name')-> |
35 | active()-> | 36 | active()-> |
36 | get();*/ | 37 | get();*/ |
37 | $category = Category::query()->active()->get(); | 38 | $category = Category::query()->active()->get(); |
38 | 39 | ||
39 | return view('admin.job_titles.add', compact('category')); | 40 | return view('admin.job_titles.add', compact('category')); |
40 | } | 41 | } |
41 | 42 | ||
42 | /** | 43 | /** |
43 | * Store a newly created resource in storage. | 44 | * Store a newly created resource in storage. |
44 | * | 45 | * |
45 | * @param \Illuminate\Http\Request $request | 46 | * @param \Illuminate\Http\Request $request |
46 | * @return \Illuminate\Http\Response | 47 | * @return \Illuminate\Http\Response |
47 | */ | 48 | */ |
48 | public function store(JobTitlesRequest $request) | 49 | public function store(JobTitlesRequest $request) |
49 | { | 50 | { |
50 | Job_title::create($request->all()); | 51 | Job_title::create($request->all()); |
51 | return redirect()->route('admin.job-titles.index'); | 52 | return redirect()->route('admin.job-titles.index'); |
52 | } | 53 | } |
53 | 54 | ||
54 | /** | 55 | /** |
55 | * Display the specified resource. | 56 | * Display the specified resource. |
56 | * | 57 | * |
57 | * @param \App\Models\Job_title $job_title | 58 | * @param \App\Models\Job_title $job_title |
58 | * @return \Illuminate\Http\Response | 59 | * @return \Illuminate\Http\Response |
59 | */ | 60 | */ |
60 | public function show(Job_title $job_title) | 61 | public function show(Job_title $job_title) |
61 | { | 62 | { |
62 | // | 63 | // |
63 | } | 64 | } |
64 | 65 | ||
65 | /** | 66 | /** |
66 | * Show the form for editing the specified resource. | 67 | * Show the form for editing the specified resource. |
67 | * | 68 | * |
68 | * @param \App\Models\Job_title $job_title | 69 | * @param \App\Models\Job_title $job_title |
69 | * @return \Illuminate\Http\Response | 70 | * @return \Illuminate\Http\Response |
70 | */ | 71 | */ |
71 | public function edit(Job_title $job_title) | 72 | public function edit(Job_title $job_title) |
72 | { | 73 | { |
73 | $category = Category::query()->active()->get(); | 74 | $category = Category::query()->active()->get(); |
74 | return view('admin.job_titles.edit', compact('job_title', 'category')); | 75 | return view('admin.job_titles.edit', compact('job_title', 'category')); |
75 | } | 76 | } |
76 | 77 | ||
77 | /** | 78 | /** |
78 | * Update the specified resource in storage. | 79 | * Update the specified resource in storage. |
79 | * | 80 | * |
80 | * @param \Illuminate\Http\Request $request | 81 | * @param \Illuminate\Http\Request $request |
81 | * @param \App\Models\Job_title $job_title | 82 | * @param \App\Models\Job_title $job_title |
82 | * @return \Illuminate\Http\Response | 83 | * @return \Illuminate\Http\Response |
83 | */ | 84 | */ |
84 | public function update(JobTitlesRequest $request, Job_title $job_title) | 85 | public function update(JobTitlesRequest $request, Job_title $job_title) |
85 | { | 86 | { |
86 | $job_title->update($request->all()); | 87 | $job_title->update($request->all()); |
87 | return redirect()->route('admin.job-titles.index'); | 88 | return redirect()->route('admin.job-titles.index'); |
88 | } | 89 | } |
89 | 90 | ||
90 | /** | 91 | /** |
91 | * Remove the specified resource from storage. | 92 | * Remove the specified resource from storage. |
92 | * | 93 | * |
93 | * @param \App\Models\Job_title $job_title | 94 | * @param \App\Models\Job_title $job_title |
94 | * @return \Illuminate\Http\Response | 95 | * @return \Illuminate\Http\Response |
95 | */ | 96 | */ |
96 | public function destroy(Job_title $job_title) | 97 | public function destroy(Job_title $job_title) |
97 | { | 98 | { |
98 | $job_title->update(['is_remove' => 1]); | 99 | $job_title->update(['is_remove' => 1]); |
99 | return redirect()->route('admin.job-titles.index'); | 100 | return redirect()->route('admin.job-titles.index'); |
100 | } | 101 | } |
101 | } | 102 | } |
102 | 103 |
app/Http/Controllers/Admin/UsersController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers\Admin; | 3 | namespace App\Http\Controllers\Admin; |
4 | 4 | ||
5 | use App\Http\Controllers\Controller; | 5 | use App\Http\Controllers\Controller; |
6 | use App\Http\Requests\BaseUserRequest; | 6 | use App\Http\Requests\BaseUserRequest; |
7 | use App\Models\ContentRoles; | 7 | use App\Models\ContentRoles; |
8 | use App\Models\Job_title; | 8 | use App\Models\Job_title; |
9 | use App\Models\User; | 9 | use App\Models\User; |
10 | use App\Models\Worker; | 10 | use App\Models\Worker; |
11 | use Illuminate\Http\Request; | 11 | use Illuminate\Http\Request; |
12 | use Illuminate\Support\Facades\Auth; | 12 | use Illuminate\Support\Facades\Auth; |
13 | use Illuminate\Support\Facades\Storage; | 13 | use Illuminate\Support\Facades\Storage; |
14 | use PhpOffice\PhpSpreadsheet\Spreadsheet; | 14 | use PhpOffice\PhpSpreadsheet\Spreadsheet; |
15 | use PhpOffice\PhpSpreadsheet\Style\Alignment; | 15 | use PhpOffice\PhpSpreadsheet\Style\Alignment; |
16 | use PhpOffice\PhpSpreadsheet\Style\Border; | 16 | use PhpOffice\PhpSpreadsheet\Style\Border; |
17 | use PhpOffice\PhpSpreadsheet\Style\Font; | 17 | use PhpOffice\PhpSpreadsheet\Style\Font; |
18 | use PhpOffice\PhpSpreadsheet\Writer\Xlsx; | 18 | use PhpOffice\PhpSpreadsheet\Writer\Xlsx; |
19 | 19 | ||
20 | class UsersController extends Controller | 20 | class UsersController extends Controller |
21 | { | 21 | { |
22 | public function index(Request $request) { | 22 | public function index(Request $request) { |
23 | $title = 'Админка - Пользователи системы'; | 23 | $title = 'Админка - Пользователи системы'; |
24 | $id_admin = Auth::user()->id; | 24 | $id_admin = Auth::user()->id; |
25 | if ($request->ajax()) { | 25 | if ($request->ajax()) { |
26 | $user = User::find($request->id); | 26 | $user = User::find($request->id); |
27 | $request->offsetUnset('id'); | 27 | $request->offsetUnset('id'); |
28 | $user->update($request->all()); | 28 | $user->update($request->all()); |
29 | } | 29 | } |
30 | 30 | ||
31 | $find_key = ""; | 31 | $find_key = ""; |
32 | $users = User::query(); | 32 | $users = User::query(); |
33 | if (isset($request->find)) { | 33 | if (isset($request->find)) { |
34 | $find_key = $request->find; | 34 | $find_key = $request->find; |
35 | $users = $users->where('name', 'LIKE', "%$find_key%") | 35 | $users = $users->where('name', 'LIKE', "%$find_key%") |
36 | ->orWhere('email', 'LIKE', "%$find_key%"); | 36 | ->orWhere('email', 'LIKE', "%$find_key%"); |
37 | } | 37 | } |
38 | 38 | ||
39 | $users = $users->paginate(15); | 39 | $users = $users->paginate(15); |
40 | 40 | ||
41 | if ($request->ajax()) { | 41 | if ($request->ajax()) { |
42 | return view('admin.users.index_ajax', compact('users', 'id_admin')); | 42 | return view('admin.users.index_ajax', compact('users', 'id_admin')); |
43 | } else { | 43 | } else { |
44 | return view('admin.users.index', compact('users', 'title', 'id_admin', 'find_key')); | 44 | return view('admin.users.index', compact('users', 'title', 'id_admin', 'find_key')); |
45 | } | 45 | } |
46 | } | 46 | } |
47 | 47 | ||
48 | public function index_bd(Request $request) { | 48 | public function index_bd(Request $request) { |
49 | $title = 'Админка - Пользователи базы данных'; | 49 | $title = 'Админка - Пользователи базы данных'; |
50 | 50 | ||
51 | $find_key = ""; | 51 | $find_key = ""; |
52 | $users = User::query(); | 52 | $users = User::query(); |
53 | if (isset($request->find)) { | 53 | if (isset($request->find)) { |
54 | $find_key = $request->find; | 54 | $find_key = $request->find; |
55 | $users = $users->where('name', 'LIKE', "%$find_key%") | 55 | $users = $users->where('name', 'LIKE', "%$find_key%") |
56 | ->orWhere('email', 'LIKE', "%$find_key%") | 56 | ->orWhere('email', 'LIKE', "%$find_key%") |
57 | ->orWhere('telephone', 'LIKE', "%$find_key%"); | 57 | ->orWhere('telephone', 'LIKE', "%$find_key%"); |
58 | } | 58 | } |
59 | 59 | ||
60 | $users = $users->Baseuser()->paginate(15); | 60 | $users = $users->Baseuser()->paginate(15); |
61 | 61 | ||
62 | if ($request->ajax()) { | 62 | if ($request->ajax()) { |
63 | return view('admin.users.index_bd_ajax', compact('users')); | 63 | return view('admin.users.index_bd_ajax', compact('users')); |
64 | } else { | 64 | } else { |
65 | return view('admin.users.index_bd', compact('users', 'title', 'find_key')); | 65 | return view('admin.users.index_bd', compact('users', 'title', 'find_key')); |
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | public function add_bd() { | 69 | public function add_bd() { |
70 | $list_job_titles = Job_title::query()->active()->where('is_bd', '=' , '2')->orderBy('name', 'asc')->get(); | 70 | $list_job_titles = Job_title::query()->active()->where('is_bd', '=' , '2')->orderBy('name', 'asc')->get(); |
71 | return view('admin.users.add', compact('list_job_titles')); | 71 | return view('admin.users.add', compact('list_job_titles')); |
72 | } | 72 | } |
73 | 73 | ||
74 | public function add_store_bd(BaseUserRequest $request) { | 74 | public function add_store_bd(BaseUserRequest $request) { |
75 | $params = $request->all(); | 75 | $params = $request->all(); |
76 | $position_work = $request->position_work; | 76 | $position_work = $request->position_work; |
77 | 77 | ||
78 | if ($request->has('file')) { | 78 | if ($request->has('file')) { |
79 | $params['file'] = $request->file('file')->store('basedata', 'public'); | 79 | $params['file'] = $request->file('file')->store('basedata', 'public'); |
80 | } | 80 | } |
81 | 81 | ||
82 | if (isset($request->name)) { | 82 | if (isset($request->name)) { |
83 | $params['name'] = $request->surname." ".$request->name_man." ".$request->surname2; | 83 | $params['name'] = $request->surname." ".$request->name_man." ".$request->surname2; |
84 | } | 84 | } |
85 | 85 | ||
86 | $user = User::create($params); | 86 | $user = User::create($params); |
87 | $user_id = $user->id; | 87 | $user_id = $user->id; |
88 | $worker = new Worker(); | 88 | $worker = new Worker(); |
89 | $worker->position_work = $position_work; | 89 | $worker->position_work = $position_work; |
90 | $worker->user_id = $user_id; | 90 | $worker->user_id = $user_id; |
91 | $worker->save(); | 91 | $worker->save(); |
92 | 92 | ||
93 | return redirect()->route('admin.basedata'); | 93 | return redirect()->route('admin.basedata'); |
94 | } | 94 | } |
95 | 95 | ||
96 | public function edit_bd(User $user) { | 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 | return view('admin.users.edit', compact('user', 'list_job_titles')); | 99 | return view('admin.users.edit', compact('user', 'list_job_titles')); |
99 | } | 100 | } |
100 | 101 | ||
101 | public function update_bd(BaseUserRequest $request, User $user) { | 102 | public function update_bd(BaseUserRequest $request, User $user) { |
102 | $params = $request->all(); | 103 | $params = $request->all(); |
103 | $position_work = $request->position_work; | 104 | $position_work = $request->position_work; |
104 | 105 | ||
105 | if ($request->has('file')) { | 106 | if ($request->has('file')) { |
106 | if (!empty($user->file)) Storage::delete($user->file); | 107 | if (!empty($user->file)) Storage::delete($user->file); |
107 | $params['file'] = $request->file('file')->store('basedata', 'public'); | 108 | $params['file'] = $request->file('file')->store('basedata', 'public'); |
108 | } else { | 109 | } else { |
109 | if (!empty($user->image)) $params['file'] = $user->file; | 110 | if (!empty($user->image)) $params['file'] = $user->file; |
110 | } | 111 | } |
111 | 112 | ||
112 | if (isset($request->name)) { | 113 | if (isset($request->name)) { |
113 | $params['name'] = $request->surname." ".$request->name_man." ".$request->surname2; | 114 | $params['name'] = $request->surname." ".$request->name_man." ".$request->surname2; |
114 | } | 115 | } |
115 | 116 | ||
116 | $user->update($params); | 117 | $user->update($params); |
117 | if (isset($user->workers[0]->id)) { | 118 | if (isset($user->workers[0]->id)) { |
118 | $worker = Worker::find($user->workers[0]->id); | 119 | $worker = Worker::find($user->workers[0]->id); |
119 | $worker->position_work = $position_work; | 120 | $worker->position_work = $position_work; |
120 | $worker->save(); | 121 | $worker->save(); |
121 | } else { | 122 | } else { |
122 | $worker = new Worker(); | 123 | $worker = new Worker(); |
123 | $worker->user_id = $user->id; | 124 | $worker->user_id = $user->id; |
124 | $worker->position_work = $position_work; | 125 | $worker->position_work = $position_work; |
125 | $worker->save(); | 126 | $worker->save(); |
126 | } | 127 | } |
127 | 128 | ||
128 | return redirect()->route('admin.basedata'); | 129 | return redirect()->route('admin.basedata'); |
129 | } | 130 | } |
130 | 131 | ||
131 | public function destroy_bd(User $user) { | 132 | public function destroy_bd(User $user) { |
132 | $user->delete(); | 133 | $user->delete(); |
133 | return redirect()->route('admin.basedata'); | 134 | return redirect()->route('admin.basedata'); |
134 | } | 135 | } |
135 | 136 | ||
136 | public function roles(Request $request) { | 137 | public function roles(Request $request) { |
137 | if ($request->ajax()) { | 138 | if ($request->ajax()) { |
138 | $user = User::find($request->id); | 139 | $user = User::find($request->id); |
139 | $request->offsetUnset('id'); | 140 | $request->offsetUnset('id'); |
140 | $user->update($request->all()); | 141 | $user->update($request->all()); |
141 | } | 142 | } |
142 | 143 | ||
143 | $users = User::query()->Realuser()->paginate(15); | 144 | $users = User::query()->Realuser()->paginate(15); |
144 | 145 | ||
145 | if ($request->ajax()) { | 146 | if ($request->ajax()) { |
146 | return view('admin.users.roles.index_ajax', compact('users')); | 147 | return view('admin.users.roles.index_ajax', compact('users')); |
147 | } else { | 148 | } else { |
148 | return view('admin.users.roles.index', compact('users')); | 149 | return view('admin.users.roles.index', compact('users')); |
149 | } | 150 | } |
150 | } | 151 | } |
151 | 152 | ||
152 | public function admin_roles(Request $request) { | 153 | public function admin_roles(Request $request) { |
153 | 154 | ||
154 | if ($request->ajax()) { | 155 | if ($request->ajax()) { |
155 | $id = $request->id; | 156 | $id = $request->id; |
156 | $request->offsetUnset('id'); | 157 | $request->offsetUnset('id'); |
157 | ContentRoles::where('id', '=', $id)->update($request->all()); | 158 | ContentRoles::where('id', '=', $id)->update($request->all()); |
158 | } | 159 | } |
159 | $roles = ContentRoles::query()->OrderBy('id')->paginate(25); | 160 | $roles = ContentRoles::query()->OrderBy('id')->paginate(25); |
160 | 161 | ||
161 | 162 | ||
162 | if ($request->ajax()) { | 163 | if ($request->ajax()) { |
163 | return view('admin.content.roles_index_ajax', compact('roles')); | 164 | return view('admin.content.roles_index_ajax', compact('roles')); |
164 | } else { | 165 | } else { |
165 | return view('admin.content.roles_index', compact('roles')); | 166 | return view('admin.content.roles_index', compact('roles')); |
166 | } | 167 | } |
167 | } | 168 | } |
168 | 169 | ||
169 | public function doc_bd(User $user) { | 170 | public function doc_bd(User $user) { |
170 | $id = $user->id; | 171 | $id = $user->id; |
171 | $spreadsheet = new Spreadsheet(); | 172 | $spreadsheet = new Spreadsheet(); |
172 | $activeWorksheet = $spreadsheet->getActiveSheet(); | 173 | $activeWorksheet = $spreadsheet->getActiveSheet(); |
173 | $activeWorksheet->setCellValue('A1', 'Отчет по соискателю'); | 174 | $activeWorksheet->setCellValue('A1', 'Отчет по соискателю'); |
174 | $activeWorksheet->getStyle('A1')->applyFromArray([ | 175 | $activeWorksheet->getStyle('A1')->applyFromArray([ |
175 | 'font' => [ | 176 | 'font' => [ |
176 | 'name' => 'Arial', | 177 | 'name' => 'Arial', |
177 | 'bold' => true, | 178 | 'bold' => true, |
178 | 'italic' => false, | 179 | 'italic' => false, |
179 | 'underline' => Font::UNDERLINE_DOUBLE, | 180 | 'underline' => Font::UNDERLINE_DOUBLE, |
180 | 'strikethrough' => false, | 181 | 'strikethrough' => false, |
181 | 'color' => [ | 182 | 'color' => [ |
182 | 'rgb' => '808080' | 183 | 'rgb' => '808080' |
183 | ] | 184 | ] |
184 | ], | 185 | ], |
185 | 'borders' => [ | 186 | 'borders' => [ |
186 | 'allBorders' => [ | 187 | 'allBorders' => [ |
187 | 'borderStyle' => Border::BORDER_THIN, | 188 | 'borderStyle' => Border::BORDER_THIN, |
188 | 'color' => [ | 189 | 'color' => [ |
189 | 'rgb' => '808080' | 190 | 'rgb' => '808080' |
190 | ] | 191 | ] |
191 | ], | 192 | ], |
192 | 'outline' => array( | 193 | 'outline' => array( |
193 | 'style' => Border::BORDER_THIN, | 194 | 'style' => Border::BORDER_THIN, |
194 | 'color' => array('rgb' => '000000') | 195 | 'color' => array('rgb' => '000000') |
195 | ), | 196 | ), |
196 | ], | 197 | ], |
197 | 198 | ||
198 | 'alignment' => [ | 199 | 'alignment' => [ |
199 | 'horizontal' => Alignment::HORIZONTAL_CENTER, | 200 | 'horizontal' => Alignment::HORIZONTAL_CENTER, |
200 | 'vertical' => Alignment::VERTICAL_CENTER, | 201 | 'vertical' => Alignment::VERTICAL_CENTER, |
201 | 'wrapText' => true, | 202 | 'wrapText' => true, |
202 | ] | 203 | ] |
203 | ]); | 204 | ]); |
204 | 205 | ||
205 | $activeWorksheet->setCellValue('A2', "Псевдоним/имя: ".$user->name); | 206 | $activeWorksheet->setCellValue('A2', "Псевдоним/имя: ".$user->name); |
206 | $activeWorksheet->setCellValue('A3', "Фамилия: ".$user->surname); | 207 | $activeWorksheet->setCellValue('A3', "Фамилия: ".$user->surname); |
207 | $activeWorksheet->setCellValue('A4', "Имя: ".$user->name_man); | 208 | $activeWorksheet->setCellValue('A4', "Имя: ".$user->name_man); |
208 | $activeWorksheet->setCellValue('A5', "Отчество: ".$user->surname2); | 209 | $activeWorksheet->setCellValue('A5', "Отчество: ".$user->surname2); |
209 | $activeWorksheet->setCellValue('A6', "Телефон: ".$user->telephone); | 210 | $activeWorksheet->setCellValue('A6', "Телефон: ".$user->telephone); |
210 | $activeWorksheet->setCellValue('A7', "Емайл: ".$user->email); | 211 | $activeWorksheet->setCellValue('A7', "Емайл: ".$user->email); |
211 | 212 | ||
212 | if (isset($user->workers[0]->id)) { | 213 | if (isset($user->workers[0]->id)) { |
213 | $activeWorksheet->setCellValue('A9', "Анкета: "); | 214 | $activeWorksheet->setCellValue('A9', "Анкета: "); |
214 | $activeWorksheet->setCellValue('A10', "Телефон: " . $user->workers[0]->telephone); | 215 | $activeWorksheet->setCellValue('A10', "Телефон: " . $user->workers[0]->telephone); |
215 | $activeWorksheet->setCellValue('A11', "Емайл: " . $user->workers[0]->email); | 216 | $activeWorksheet->setCellValue('A11', "Емайл: " . $user->workers[0]->email); |
216 | } | 217 | } |
217 | 218 | ||
218 | if (isset($user->jobtitles[0]->id)) { | 219 | if (isset($user->jobtitles[0]->id)) { |
219 | $activeWorksheet->setCellValue('A12', "Должность: " . $user->jobtitles[0]->name); | 220 | $activeWorksheet->setCellValue('A12', "Должность: " . $user->jobtitles[0]->name); |
220 | } | 221 | } |
221 | $activeWorksheet->getColumnDimension("A")->setWidth(100); | 222 | $activeWorksheet->getColumnDimension("A")->setWidth(100); |
222 | $writer = new Xlsx($spreadsheet); | 223 | $writer = new Xlsx($spreadsheet); |
223 | 224 | ||
224 | header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); | 225 | header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); |
225 | header('Content-Disposition: attachment; filename="user'.$id.'.xlsx"'); | 226 | header('Content-Disposition: attachment; filename="user'.$id.'.xlsx"'); |
226 | header('Cache-Control: no-cache'); | 227 | header('Cache-Control: no-cache'); |
227 | 228 | ||
228 | $writer->save('php://output'); | 229 | $writer->save('php://output'); |
229 | $writer->save(storage_path("app/public/export/user$id.xlsx")); | 230 | $writer->save(storage_path("app/public/export/user$id.xlsx")); |
230 | 231 | ||
231 | //$spreadsheet->disconnectWorksheets(); | 232 | //$spreadsheet->disconnectWorksheets(); |
232 | return redirect()->route('admin.basedata'); | 233 | return redirect()->route('admin.basedata'); |
233 | 234 | ||
234 | } | 235 | } |
235 | } | 236 | } |
236 | 237 |
app/Http/Controllers/EmployerController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers; | 3 | namespace App\Http\Controllers; |
4 | 4 | ||
5 | use App\Classes\RusDate; | 5 | use App\Classes\RusDate; |
6 | use App\Classes\Tools; | 6 | use App\Classes\Tools; |
7 | use App\Http\Requests\BaseUser_min_Request; | 7 | use App\Http\Requests\BaseUser_min_Request; |
8 | use App\Http\Requests\BaseUserRequest; | 8 | use App\Http\Requests\BaseUserRequest; |
9 | use App\Http\Requests\FlotRequest; | 9 | use App\Http\Requests\FlotRequest; |
10 | use App\Http\Requests\MessagesRequiest; | 10 | use App\Http\Requests\MessagesRequiest; |
11 | use App\Http\Requests\VacancyRequestEdit; | 11 | use App\Http\Requests\VacancyRequestEdit; |
12 | use App\Http\Requests\VacansiaRequiest; | 12 | use App\Http\Requests\VacansiaRequiest; |
13 | use App\Mail\MailSotrudnichestvo; | 13 | use App\Mail\MailSotrudnichestvo; |
14 | use App\Mail\SendAllMessages; | 14 | use App\Mail\SendAllMessages; |
15 | use App\Models\Ad_employer; | 15 | use App\Models\Ad_employer; |
16 | use App\Models\Ad_jobs; | 16 | use App\Models\Ad_jobs; |
17 | use App\Models\ad_response; | 17 | use App\Models\ad_response; |
18 | use App\Models\Category; | 18 | use App\Models\Category; |
19 | use App\Models\Education; | 19 | use App\Models\Education; |
20 | use App\Models\Employer; | 20 | use App\Models\Employer; |
21 | use App\Models\employers_main; | 21 | use App\Models\employers_main; |
22 | use App\Models\Flot; | 22 | use App\Models\Flot; |
23 | use App\Models\Job_title; | 23 | use App\Models\Job_title; |
24 | use App\Models\Like_vacancy; | 24 | use App\Models\Like_vacancy; |
25 | use App\Models\Like_worker; | 25 | use App\Models\Like_worker; |
26 | use App\Models\Message; | 26 | use App\Models\Message; |
27 | use App\Models\Positions; | 27 | use App\Models\Positions; |
28 | use App\Models\Worker; | 28 | use App\Models\Worker; |
29 | use Carbon\Carbon; | 29 | use Carbon\Carbon; |
30 | use Illuminate\Auth\Events\Registered; | 30 | use Illuminate\Auth\Events\Registered; |
31 | use Illuminate\Database\Eloquent\Builder; | 31 | use Illuminate\Database\Eloquent\Builder; |
32 | use Illuminate\Database\Eloquent\Model; | 32 | use Illuminate\Database\Eloquent\Model; |
33 | use Illuminate\Foundation\Auth\User; | 33 | use Illuminate\Foundation\Auth\User; |
34 | use Illuminate\Http\Request; | 34 | use Illuminate\Http\Request; |
35 | use Illuminate\Support\Facades\Auth; | 35 | use Illuminate\Support\Facades\Auth; |
36 | use Illuminate\Support\Facades\Hash; | 36 | use Illuminate\Support\Facades\Hash; |
37 | use Illuminate\Support\Facades\Mail; | 37 | use Illuminate\Support\Facades\Mail; |
38 | use Illuminate\Support\Facades\Storage; | 38 | use Illuminate\Support\Facades\Storage; |
39 | use App\Models\User as User_Model; | 39 | use App\Models\User as User_Model; |
40 | use Illuminate\Support\Facades\Validator; | 40 | use Illuminate\Support\Facades\Validator; |
41 | 41 | ||
42 | class EmployerController extends Controller | 42 | class EmployerController extends Controller |
43 | { | 43 | { |
44 | public function vacancie($vacancy, Request $request) { | 44 | public function vacancie($vacancy, Request $request) { |
45 | $title = 'Заголовок вакансии'; | 45 | $title = 'Заголовок вакансии'; |
46 | $Query = Ad_employer::with('jobs')-> | 46 | $Query = Ad_employer::with('jobs')-> |
47 | with('cat')-> | 47 | with('cat')-> |
48 | with('employer')-> | 48 | with('employer')-> |
49 | with('jobs_code')-> | 49 | with('jobs_code')-> |
50 | select('ad_employers.*')-> | 50 | select('ad_employers.*')-> |
51 | where('id', '=', $vacancy)->get(); | 51 | where('id', '=', $vacancy)->get(); |
52 | 52 | ||
53 | if (isset(Auth()->user()->id)) | 53 | if (isset(Auth()->user()->id)) |
54 | $uid = Auth()->user()->id; | 54 | $uid = Auth()->user()->id; |
55 | else | 55 | else |
56 | $uid = 0; | 56 | $uid = 0; |
57 | $title = $Query[0]->name; | 57 | $title = $Query[0]->name; |
58 | if ($request->ajax()) { | 58 | if ($request->ajax()) { |
59 | return view('ajax.vacance-item', compact('Query','uid')); | 59 | return view('ajax.vacance-item', compact('Query','uid')); |
60 | } else { | 60 | } else { |
61 | return view('vacance-item', compact('title', 'Query', 'uid')); | 61 | return view('vacance-item', compact('title', 'Query', 'uid')); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | public function logout() { | 65 | public function logout() { |
66 | Auth::logout(); | 66 | Auth::logout(); |
67 | return redirect()->route('index') | 67 | return redirect()->route('index') |
68 | ->with('success', 'Вы вышли из личного кабинета'); | 68 | ->with('success', 'Вы вышли из личного кабинета'); |
69 | } | 69 | } |
70 | 70 | ||
71 | public function employer_info() { | 71 | public function employer_info() { |
72 | // код юзера | 72 | // код юзера |
73 | $user_info = Auth()->user(); | 73 | $user_info = Auth()->user(); |
74 | // вьюшка для вывода данных | 74 | // вьюшка для вывода данных |
75 | return view('employers.info', compact('user_info')); | 75 | return view('employers.info', compact('user_info')); |
76 | } | 76 | } |
77 | 77 | ||
78 | public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { | 78 | public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { |
79 | // Все данные через реквест | 79 | // Все данные через реквест |
80 | $all = $request->all(); | 80 | $all = $request->all(); |
81 | unset($all['_token']); | 81 | unset($all['_token']); |
82 | // обновление | 82 | // обновление |
83 | $user->update($all); | 83 | $user->update($all); |
84 | return redirect()->route('employer.employer_info'); | 84 | return redirect()->route('employer.employer_info'); |
85 | } | 85 | } |
86 | 86 | ||
87 | public function cabinet() { | 87 | public function cabinet() { |
88 | $id = Auth()->user()->id; | 88 | $id = Auth()->user()->id; |
89 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 89 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
90 | WhereHas('users', | 90 | WhereHas('users', |
91 | function (Builder $query) use ($id) {$query->Where('id', $id); | 91 | function (Builder $query) use ($id) {$query->Where('id', $id); |
92 | })->get(); | 92 | })->get(); |
93 | return view('employers.cabinet45', compact('Employer')); | 93 | return view('employers.cabinet45', compact('Employer')); |
94 | } | 94 | } |
95 | 95 | ||
96 | public function slider_flot() { | 96 | public function slider_flot() { |
97 | $id = Auth()->user()->id; | 97 | $id = Auth()->user()->id; |
98 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 98 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
99 | WhereHas('users', | 99 | WhereHas('users', |
100 | function (Builder $query) use ($id) {$query->Where('id', $id); | 100 | function (Builder $query) use ($id) {$query->Where('id', $id); |
101 | })->get(); | 101 | })->get(); |
102 | return view('employers.fly-flot', compact('Employer')); | 102 | return view('employers.fly-flot', compact('Employer')); |
103 | } | 103 | } |
104 | 104 | ||
105 | public function cabinet_save(Employer $Employer, Request $request) { | 105 | public function cabinet_save(Employer $Employer, Request $request) { |
106 | $params = $request->all(); | 106 | $params = $request->all(); |
107 | $params['user_id'] = Auth()->user()->id; | 107 | $params['user_id'] = Auth()->user()->id; |
108 | $id = $Employer->id; | 108 | $id = $Employer->id; |
109 | 109 | ||
110 | if ($request->has('logo')) { | 110 | if ($request->has('logo')) { |
111 | if (!empty($Employer->logo)) { | 111 | if (!empty($Employer->logo)) { |
112 | Storage::delete($Employer->logo); | 112 | Storage::delete($Employer->logo); |
113 | } | 113 | } |
114 | $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); | 114 | $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); |
115 | } | 115 | } |
116 | 116 | ||
117 | $Employer->update($params); | 117 | $Employer->update($params); |
118 | 118 | ||
119 | return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); | 119 | return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); |
120 | } | 120 | } |
121 | 121 | ||
122 | public function save_add_flot(FlotRequest $request) { | 122 | public function save_add_flot(FlotRequest $request) { |
123 | // отмена | 123 | // отмена |
124 | $params = $request->all(); | 124 | $params = $request->all(); |
125 | 125 | ||
126 | if ($request->has('image')) { | 126 | if ($request->has('image')) { |
127 | $params['image'] = $request->file('image')->store("flot", 'public'); | 127 | $params['image'] = $request->file('image')->store("flot", 'public'); |
128 | } | 128 | } |
129 | Flot::create($params); | 129 | Flot::create($params); |
130 | $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); | 130 | $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); |
131 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); | 131 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); |
132 | } | 132 | } |
133 | 133 | ||
134 | public function edit_flot(Flot $Flot, Employer $Employer) { | 134 | public function edit_flot(Flot $Flot, Employer $Employer) { |
135 | return view('employers.edit-flot', compact('Flot', 'Employer')); | 135 | return view('employers.edit-flot', compact('Flot', 'Employer')); |
136 | } | 136 | } |
137 | 137 | ||
138 | public function update_flot(FlotRequest $request, Flot $Flot) { | 138 | public function update_flot(FlotRequest $request, Flot $Flot) { |
139 | $params = $request->all(); | 139 | $params = $request->all(); |
140 | 140 | ||
141 | if ($request->has('image')) { | 141 | if ($request->has('image')) { |
142 | if (!empty($flot->image)) { | 142 | if (!empty($flot->image)) { |
143 | Storage::delete($flot->image); | 143 | Storage::delete($flot->image); |
144 | } | 144 | } |
145 | $params['image'] = $request->file('image')->store("flot", 'public'); | 145 | $params['image'] = $request->file('image')->store("flot", 'public'); |
146 | } else { | 146 | } else { |
147 | if (!empty($flot->image)) $params['image'] = $flot->image; | 147 | if (!empty($flot->image)) $params['image'] = $flot->image; |
148 | } | 148 | } |
149 | 149 | ||
150 | $Flot->update($params); | 150 | $Flot->update($params); |
151 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); | 151 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); |
152 | } | 152 | } |
153 | 153 | ||
154 | public function delete_flot(Flot $Flot) { | 154 | public function delete_flot(Flot $Flot) { |
155 | $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); | 155 | $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); |
156 | 156 | ||
157 | if (isset($Flot->id)) $Flot->delete(); | 157 | if (isset($Flot->id)) $Flot->delete(); |
158 | return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); | 158 | return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); |
159 | } | 159 | } |
160 | 160 | ||
161 | // Форма добавления вакансий | 161 | // Форма добавления вакансий |
162 | public function cabinet_vacancie() { | 162 | public function cabinet_vacancie() { |
163 | $id = Auth()->user()->id; | 163 | $id = Auth()->user()->id; |
164 | 164 | ||
165 | if (Auth()->user()->is_public) { | 165 | if (Auth()->user()->is_public) { |
166 | $categories = Category::query()->active()->get(); | 166 | $categories = Category::query()->active()->get(); |
167 | 167 | ||
168 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> | 168 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> |
169 | where('is_remove', '=', '0')-> | 169 | where('is_remove', '=', '0')-> |
170 | where('is_bd', '=', '0')-> | 170 | where('is_bd', '=', '0')-> |
171 | get(); | 171 | get(); |
172 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 172 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
173 | 173 | ||
174 | WhereHas('users', | 174 | WhereHas('users', |
175 | function (Builder $query) use ($id) { | 175 | function (Builder $query) use ($id) { |
176 | $query->Where('id', $id); | 176 | $query->Where('id', $id); |
177 | })->get(); | 177 | })->get(); |
178 | 178 | ||
179 | return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); | 179 | return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); |
180 | } else { | 180 | } else { |
181 | return redirect()->route('employer.cabinet_vacancie_danger'); | 181 | return redirect()->route('employer.cabinet_vacancie_danger'); |
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | // Форма предупреждения об оплате | 185 | // Форма предупреждения об оплате |
186 | public function cabinet_vacancie_danger() { | 186 | public function cabinet_vacancie_danger() { |
187 | return view('employers.add_vacancy_danger'); | 187 | return view('employers.add_vacancy_danger'); |
188 | } | 188 | } |
189 | 189 | ||
190 | // Сохранение вакансии | 190 | // Сохранение вакансии |
191 | public function cabinet_vacancy_save1(VacancyRequestEdit $request) { | 191 | public function cabinet_vacancy_save1(VacancyRequestEdit $request) { |
192 | $params_emp = $request->all(); | 192 | $params_emp = $request->all(); |
193 | 193 | ||
194 | $params_job["job_title_id"] = $params_emp['job_title_id']; | 194 | $params_job["job_title_id"] = $params_emp['job_title_id']; |
195 | //$params_job["min_salary"] = $params_emp['min_salary']; | 195 | //$params_job["min_salary"] = $params_emp['min_salary']; |
196 | //$params_job["max_salary"] = $params_emp['max_salary']; | 196 | //$params_job["max_salary"] = $params_emp['max_salary']; |
197 | //$params_job["region"] = $params_emp['region']; | 197 | //$params_job["region"] = $params_emp['region']; |
198 | //$params_job["power"] = $params_emp['power']; | 198 | //$params_job["power"] = $params_emp['power']; |
199 | //$params_job["sytki"] = $params_emp['sytki']; | 199 | //$params_job["sytki"] = $params_emp['sytki']; |
200 | //$params_job["start"] = $params_emp['start']; | 200 | //$params_job["start"] = $params_emp['start']; |
201 | //$params_job["flot"] = $params_emp['flot']; | 201 | //$params_job["flot"] = $params_emp['flot']; |
202 | //$params_job["description"] = $params_emp['description']; | 202 | //$params_job["description"] = $params_emp['description']; |
203 | 203 | ||
204 | $ad_jobs = Ad_employer::create($params_emp); | 204 | $ad_jobs = Ad_employer::create($params_emp); |
205 | //$params_job['ad_employer_id'] = $ad_jobs->id; | 205 | //$params_job['ad_employer_id'] = $ad_jobs->id; |
206 | //Ad_jobs::create($params_job); | 206 | //Ad_jobs::create($params_job); |
207 | $ad_jobs->jobs()->sync($request->get('job_title_id')); | 207 | $ad_jobs->jobs()->sync($request->get('job_title_id')); |
208 | 208 | ||
209 | return redirect()->route('employer.vacancy_list'); | 209 | return redirect()->route('employer.vacancy_list'); |
210 | } | 210 | } |
211 | 211 | ||
212 | // Список вакансий | 212 | // Список вакансий |
213 | public function vacancy_list(Request $request) { | 213 | public function vacancy_list(Request $request) { |
214 | $id = Auth()->user()->id; | 214 | $id = Auth()->user()->id; |
215 | |||
216 | //dd($request->all()); | ||
215 | $Employer = Employer::query()->where('user_id', $id)->first(); | 217 | $Employer = Employer::query()->where('user_id', $id)->first(); |
216 | $vacancy_list = Ad_employer::query()->with('jobs')-> | 218 | $vacancy_list = Ad_employer::query()->with('jobs')-> |
217 | with('jobs_code')-> | 219 | with('jobs_code')-> |
218 | where('employer_id', $Employer->id); | 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 | if ($request->get('sort')) { | 227 | if ($request->get('sort')) { |
221 | $sort = $request->get('sort'); | 228 | $sort = $request->get('sort'); |
222 | switch ($sort) { | 229 | switch ($sort) { |
223 | case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break; | 230 | case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break; |
224 | case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break; | 231 | case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break; |
225 | case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break; | 232 | case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break; |
226 | case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break; | 233 | case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break; |
227 | case 'default': $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; | 234 | case 'default': $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; |
228 | default: $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; | 235 | default: $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; |
229 | } | 236 | } |
230 | } | 237 | } |
231 | $vacancy_list = $vacancy_list->paginate(4); | 238 | $vacancy_list = $vacancy_list->paginate(4); |
232 | 239 | ||
233 | //ajax | 240 | //ajax |
234 | if ($request->ajax()) { | 241 | if ($request->ajax()) { |
235 | return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); | 242 | return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); |
236 | } else { | 243 | } else { |
237 | return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); | 244 | return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); |
238 | } | 245 | } |
239 | } | 246 | } |
240 | 247 | ||
241 | // Карточка вакансии | 248 | // Карточка вакансии |
242 | public function vacancy_edit(Ad_employer $ad_employer) { | 249 | public function vacancy_edit(Ad_employer $ad_employer) { |
243 | $id = Auth()->user()->id; | 250 | $id = Auth()->user()->id; |
244 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); | 251 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); |
245 | $jobs = Job_title::query()->OrderBy('name')-> | 252 | $jobs = Job_title::query()->OrderBy('name')-> |
246 | where('is_remove', 0)->where('is_bd', '=' , '0')->get(); | 253 | where('is_remove', 0)->where('is_bd', '=' , '0')->get(); |
247 | 254 | ||
248 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 255 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
249 | where('user_id', $id)->first(); | 256 | where('user_id', $id)->first(); |
250 | 257 | ||
251 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); | 258 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); |
252 | } | 259 | } |
253 | 260 | ||
254 | // Сохранение-редактирование записи | 261 | // Сохранение-редактирование записи |
255 | public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { | 262 | public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { |
256 | $params = $request->all(); | 263 | $params = $request->all(); |
257 | 264 | ||
258 | //$jobs['flot'] = $params['flot']; | 265 | //$jobs['flot'] = $params['flot']; |
259 | //$jobs['job_title_id'] = $params['job_title_id']; | 266 | //$jobs['job_title_id'] = $params['job_title_id']; |
260 | //$titles['position_id'] = $params['position_id']; | 267 | //$titles['position_id'] = $params['position_id']; |
261 | //unset($params['job_title_id']); | 268 | //unset($params['job_title_id']); |
262 | 269 | ||
263 | $ad_employer->update($params); | 270 | $ad_employer->update($params); |
264 | 271 | ||
265 | //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])-> | 272 | //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])-> |
266 | // where('ad_employer_id', $ad_employer->id)->first(); | 273 | // where('ad_employer_id', $ad_employer->id)->first(); |
267 | //$data = Ad_jobs::find($job_->id); | 274 | //$data = Ad_jobs::find($job_->id); |
268 | //$ad_jobs = $data->update($jobs); | 275 | //$ad_jobs = $data->update($jobs); |
269 | 276 | ||
270 | return redirect()->route('employer.vacancy_list'); | 277 | return redirect()->route('employer.vacancy_list'); |
271 | } | 278 | } |
272 | 279 | ||
273 | // Сохранение карточки вакансии | 280 | // Сохранение карточки вакансии |
274 | public function vacancy_save(Request $request, Ad_employer $ad_employer) { | 281 | public function vacancy_save(Request $request, Ad_employer $ad_employer) { |
275 | $all = $request->all(); | 282 | $all = $request->all(); |
276 | $ad_employer->update($all); | 283 | $ad_employer->update($all); |
277 | return redirect()->route('employer.cabinet_vacancie'); | 284 | return redirect()->route('employer.cabinet_vacancie'); |
278 | } | 285 | } |
279 | 286 | ||
280 | // Удаление карточки вакансии | 287 | // Удаление карточки вакансии |
281 | public function vacancy_delete(Ad_employer $ad_employer) { | 288 | public function vacancy_delete(Ad_employer $ad_employer) { |
282 | $ad_employer->delete(); | 289 | $ad_employer->delete(); |
283 | 290 | ||
284 | return redirect()->route('employer.vacancy_list') | 291 | return redirect()->route('employer.vacancy_list') |
285 | ->with('success', 'Данные были успешно сохранены'); | 292 | ->with('success', 'Данные были успешно сохранены'); |
286 | } | 293 | } |
287 | 294 | ||
288 | // Обновление даты | 295 | // Обновление даты |
289 | public function vacancy_up(Ad_employer $ad_employer) { | 296 | public function vacancy_up(Ad_employer $ad_employer) { |
290 | $up = date('m/d/Y h:i:s', time());; | 297 | $up = date('m/d/Y h:i:s', time());; |
291 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); | 298 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); |
292 | $vac_emp->updated_at = $up; | 299 | $vac_emp->updated_at = $up; |
293 | $vac_emp->save(); | 300 | $vac_emp->save(); |
294 | 301 | ||
295 | return redirect()->route('employer.vacancy_list'); | 302 | return redirect()->route('employer.vacancy_list'); |
296 | // начало конца | 303 | // начало конца |
297 | } | 304 | } |
298 | 305 | ||
299 | //Видимость вакансии | 306 | //Видимость вакансии |
300 | public function vacancy_eye(Ad_employer $ad_employer, $status) { | 307 | public function vacancy_eye(Ad_employer $ad_employer, $status) { |
301 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); | 308 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); |
302 | $vac_emp->active_is = $status; | 309 | $vac_emp->active_is = $status; |
303 | $vac_emp->save(); | 310 | $vac_emp->save(); |
304 | 311 | ||
305 | return redirect()->route('employer.vacancy_list'); | 312 | return redirect()->route('employer.vacancy_list'); |
306 | } | 313 | } |
307 | 314 | ||
308 | //Вакансия редактирования (шаблон) | 315 | //Вакансия редактирования (шаблон) |
309 | public function vacancy_update(Ad_employer $id) { | 316 | public function vacancy_update(Ad_employer $id) { |
310 | 317 | ||
311 | } | 318 | } |
312 | 319 | ||
313 | //Отклики на вакансию - лист | 320 | //Отклики на вакансию - лист |
314 | public function answers(Employer $employer, Request $request) { | 321 | public function answers(Employer $employer, Request $request) { |
315 | $user_id = Auth()->user()->id; | 322 | $user_id = Auth()->user()->id; |
316 | $answer = Ad_employer::query()->where('employer_id', $employer->id); | 323 | $answer = Ad_employer::query()->where('employer_id', $employer->id); |
317 | if ($request->has('search')) { | 324 | if ($request->has('search')) { |
318 | $search = trim($request->get('search')); | 325 | $search = trim($request->get('search')); |
319 | if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); | 326 | if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); |
320 | } | 327 | } |
321 | 328 | ||
322 | $answer = $answer->with('response')->OrderByDESC('id')->get(); | 329 | $answer = $answer->with('response')->OrderByDESC('id')->get(); |
323 | 330 | ||
324 | return view('employers.list_answer', compact('answer', 'user_id', 'employer')); | 331 | return view('employers.list_answer', compact('answer', 'user_id', 'employer')); |
325 | } | 332 | } |
326 | 333 | ||
327 | //Обновление статуса | 334 | //Обновление статуса |
328 | public function supple_status(employer $employer, ad_response $ad_response, $flag) { | 335 | public function supple_status(employer $employer, ad_response $ad_response, $flag) { |
329 | $ad_response->update(Array('flag' => $flag)); | 336 | $ad_response->update(Array('flag' => $flag)); |
330 | return redirect()->route('employer.answers', ['employer' => $employer->id]); | 337 | return redirect()->route('employer.answers', ['employer' => $employer->id]); |
331 | } | 338 | } |
332 | 339 | ||
333 | //Страницы сообщений список | 340 | //Страницы сообщений список |
334 | public function messages($type_message) { | 341 | public function messages($type_message) { |
335 | $user_id = Auth()->user()->id; | 342 | $user_id = Auth()->user()->id; |
336 | 343 | ||
337 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> | 344 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> |
338 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); | 345 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); |
339 | 346 | ||
340 | $messages_output = Message::query()->with('vacancies')-> | 347 | $messages_output = Message::query()->with('vacancies')-> |
341 | with('user_to')->where('user_id', $user_id)-> | 348 | with('user_to')->where('user_id', $user_id)-> |
342 | OrderByDesc('created_at'); | 349 | OrderByDesc('created_at'); |
343 | 350 | ||
344 | 351 | ||
345 | $count_input = $messages_input->count(); | 352 | $count_input = $messages_input->count(); |
346 | $count_output = $messages_output->count(); | 353 | $count_output = $messages_output->count(); |
347 | 354 | ||
348 | if ($type_message == 'input') { | 355 | if ($type_message == 'input') { |
349 | $messages = $messages_input->paginate(5); | 356 | $messages = $messages_input->paginate(5); |
350 | } | 357 | } |
351 | 358 | ||
352 | if ($type_message == 'output') { | 359 | if ($type_message == 'output') { |
353 | $messages = $messages_output->paginate(5); | 360 | $messages = $messages_output->paginate(5); |
354 | } | 361 | } |
355 | 362 | ||
356 | //dd($user_id, $messages[2]->vacancies); | 363 | //dd($user_id, $messages[2]->vacancies); |
357 | //jobs); | 364 | //jobs); |
358 | 365 | ||
359 | return view('employers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); | 366 | return view('employers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); |
360 | } | 367 | } |
361 | 368 | ||
362 | // Диалог между пользователями | 369 | // Диалог между пользователями |
363 | public function dialog(Request $request, User_Model $user1, User_Model $user2) { | 370 | public function dialog(Request $request, User_Model $user1, User_Model $user2) { |
364 | // Получение параметров. | 371 | // Получение параметров. |
365 | if ($request->has('ad_employer')){ | 372 | if ($request->has('ad_employer')){ |
366 | $ad_employer = $request->get('ad_employer'); | 373 | $ad_employer = $request->get('ad_employer'); |
367 | } else { | 374 | } else { |
368 | $ad_employer = 0; | 375 | $ad_employer = 0; |
369 | } | 376 | } |
370 | 377 | ||
371 | if (isset($user2->id)) { | 378 | if (isset($user2->id)) { |
372 | $companion = User_Model::query()->with('workers')-> | 379 | $companion = User_Model::query()->with('workers')-> |
373 | with('employers')-> | 380 | with('employers')-> |
374 | where('id', $user2->id)->first(); | 381 | where('id', $user2->id)->first(); |
375 | } | 382 | } |
376 | 383 | ||
377 | $Messages = Message::query()-> | 384 | $Messages = Message::query()-> |
378 | where('ad_employer_id', '=', $ad_employer)-> | 385 | where('ad_employer_id', '=', $ad_employer)-> |
379 | where(function($query) use ($user1, $user2) { | 386 | where(function($query) use ($user1, $user2) { |
380 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); | 387 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); |
381 | })->orWhere(function($query) use ($user1, $user2) { | 388 | })->orWhere(function($query) use ($user1, $user2) { |
382 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); | 389 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); |
383 | })->where('ad_employer_id', '=', $ad_employer)->OrderBy('created_at')->get(); | 390 | })->where('ad_employer_id', '=', $ad_employer)->OrderBy('created_at')->get(); |
384 | 391 | ||
385 | $id_vac = $Messages[$Messages->count() - 1]->ad_employer_id; | 392 | $id_vac = $Messages[$Messages->count() - 1]->ad_employer_id; |
386 | 393 | ||
387 | //$ad_employer = null; | 394 | //$ad_employer = null; |
388 | //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); | 395 | //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); |
389 | $sender = $user1; | 396 | $sender = $user1; |
390 | 397 | ||
391 | return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); | 398 | return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); |
392 | } | 399 | } |
393 | 400 | ||
394 | // Регистрация работодателя | 401 | // Регистрация работодателя |
395 | public function register_employer(Request $request) { | 402 | public function register_employer(Request $request) { |
396 | $params = $request->all(); | 403 | $params = $request->all(); |
397 | 404 | ||
398 | $rules = [ | 405 | $rules = [ |
399 | //'surname' => ['required', 'string', 'max:255'], | 406 | //'surname' => ['required', 'string', 'max:255'], |
400 | //'name_man' => ['required', 'string', 'max:255'], | 407 | //'name_man' => ['required', 'string', 'max:255'], |
401 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], | 408 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], |
402 | 'name_company' => ['required', 'string', 'max:255'], | 409 | 'name_company' => ['required', 'string', 'max:255'], |
403 | 'password' => ['required', 'string', 'min:6'], | 410 | 'password' => ['required', 'string', 'min:6'], |
404 | ]; | 411 | ]; |
405 | 412 | ||
406 | 413 | ||
407 | $messages = [ | 414 | $messages = [ |
408 | 'required' => 'Укажите обязательное поле', | 415 | 'required' => 'Укажите обязательное поле', |
409 | 'min' => [ | 416 | 'min' => [ |
410 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 417 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
411 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 418 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
412 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 419 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
413 | ], | 420 | ], |
414 | 'max' => [ | 421 | 'max' => [ |
415 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 422 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
416 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 423 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
417 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 424 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
418 | ] | 425 | ] |
419 | ]; | 426 | ]; |
420 | 427 | ||
421 | $email = $request->get('email'); | 428 | $email = $request->get('email'); |
422 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { | 429 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { |
423 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); | 430 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); |
424 | } | 431 | } |
425 | 432 | ||
426 | if ($request->get('password') !== $request->get('confirmed')){ | 433 | if ($request->get('password') !== $request->get('confirmed')){ |
427 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); | 434 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); |
428 | } | 435 | } |
429 | 436 | ||
430 | if (strlen($request->get('password')) < 6) { | 437 | if (strlen($request->get('password')) < 6) { |
431 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); | 438 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); |
432 | } | 439 | } |
433 | /* | 440 | /* |
434 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); | 441 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); |
435 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', | 442 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', |
436 | 'X', 'C', 'V', 'B', 'N', 'M'); | 443 | 'X', 'C', 'V', 'B', 'N', 'M'); |
437 | $spec_bool = false; | 444 | $spec_bool = false; |
438 | $alpha_bool = false; | 445 | $alpha_bool = false; |
439 | 446 | ||
440 | $haystack = $request->get('password'); | 447 | $haystack = $request->get('password'); |
441 | 448 | ||
442 | foreach ($specsumbol as $it) { | 449 | foreach ($specsumbol as $it) { |
443 | if (strpos($haystack, $it) !== false) { | 450 | if (strpos($haystack, $it) !== false) { |
444 | $spec_bool = true; | 451 | $spec_bool = true; |
445 | } | 452 | } |
446 | } | 453 | } |
447 | 454 | ||
448 | foreach ($alpha as $it) { | 455 | foreach ($alpha as $it) { |
449 | if (strpos($haystack, $it) !== false) { | 456 | if (strpos($haystack, $it) !== false) { |
450 | $alpha_bool = true; | 457 | $alpha_bool = true; |
451 | } | 458 | } |
452 | } | 459 | } |
453 | 460 | ||
454 | if ((!$spec_bool) || (!$alpha_bool)) { | 461 | if ((!$spec_bool) || (!$alpha_bool)) { |
455 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); | 462 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); |
456 | }*/ | 463 | }*/ |
457 | 464 | ||
458 | if (empty($request->get('surname'))) { | 465 | if (empty($request->get('surname'))) { |
459 | $params['surname'] = 'Неизвестно'; | 466 | $params['surname'] = 'Неизвестно'; |
460 | } | 467 | } |
461 | if (empty($request->get('name_man'))) { | 468 | if (empty($request->get('name_man'))) { |
462 | $params['name_man'] = 'Неизвестно'; | 469 | $params['name_man'] = 'Неизвестно'; |
463 | } | 470 | } |
464 | $validator = Validator::make($params, $rules, $messages); | 471 | $validator = Validator::make($params, $rules, $messages); |
465 | 472 | ||
466 | if ($validator->fails()) { | 473 | if ($validator->fails()) { |
467 | return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); | 474 | return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); |
468 | } else { | 475 | } else { |
469 | $user = $this->create($params); | 476 | $user = $this->create($params); |
470 | event(new Registered($user)); | 477 | event(new Registered($user)); |
471 | Auth::guard()->login($user); | 478 | Auth::guard()->login($user); |
472 | } | 479 | } |
473 | 480 | ||
474 | if ($user) { | 481 | if ($user) { |
475 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; | 482 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; |
476 | } else { | 483 | } else { |
477 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); | 484 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); |
478 | } | 485 | } |
479 | } | 486 | } |
480 | 487 | ||
481 | // Создание пользователя | 488 | // Создание пользователя |
482 | protected function create(array $data) | 489 | protected function create(array $data) |
483 | { | 490 | { |
484 | $Use = new User_Model(); | 491 | $Use = new User_Model(); |
485 | $Code_user = $Use->create([ | 492 | $Code_user = $Use->create([ |
486 | 'name' => $data['surname']." ".$data['name_man'], | 493 | 'name' => $data['surname']." ".$data['name_man'], |
487 | 'name_man' => $data['name_man'], | 494 | 'name_man' => $data['name_man'], |
488 | 'surname' => $data['surname'], | 495 | 'surname' => $data['surname'], |
489 | 'surname2' => $data['surname2'], | 496 | 'surname2' => $data['surname2'], |
490 | 'subscribe_email' => $data['email'], | 497 | 'subscribe_email' => $data['email'], |
491 | 'email' => $data['email'], | 498 | 'email' => $data['email'], |
492 | 'telephone' => $data['telephone'], | 499 | 'telephone' => $data['telephone'], |
493 | 'is_worker' => 0, | 500 | 'is_worker' => 0, |
494 | 'password' => Hash::make($data['password']), | 501 | 'password' => Hash::make($data['password']), |
495 | 'pubpassword' => base64_encode($data['password']), | 502 | 'pubpassword' => base64_encode($data['password']), |
496 | 'email_verified_at' => Carbon::now() | 503 | 'email_verified_at' => Carbon::now() |
497 | ]); | 504 | ]); |
498 | 505 | ||
499 | if ($Code_user->id > 0) { | 506 | if ($Code_user->id > 0) { |
500 | $Employer = new Employer(); | 507 | $Employer = new Employer(); |
501 | $Employer->user_id = $Code_user->id; | 508 | $Employer->user_id = $Code_user->id; |
502 | $Employer->name_company = $data['name_company']; | 509 | $Employer->name_company = $data['name_company']; |
503 | $Employer->email = $data['email']; | 510 | $Employer->email = $data['email']; |
504 | $Employer->telephone = $data['telephone']; | 511 | $Employer->telephone = $data['telephone']; |
505 | $Employer->code = Tools::generator_id(10); | 512 | $Employer->code = Tools::generator_id(10); |
506 | $Employer->save(); | 513 | $Employer->save(); |
507 | 514 | ||
508 | return $Code_user; | 515 | return $Code_user; |
509 | } | 516 | } |
510 | } | 517 | } |
511 | 518 | ||
512 | // Отправка сообщения от работодателя | 519 | // Отправка сообщения от работодателя |
513 | public function send_message(MessagesRequiest $request) { | 520 | public function send_message(MessagesRequiest $request) { |
514 | $params = $request->all(); | 521 | $params = $request->all(); |
515 | dd($params); | 522 | dd($params); |
516 | $user1 = $params['user_id']; | 523 | $user1 = $params['user_id']; |
517 | $user2 = $params['to_user_id']; | 524 | $user2 = $params['to_user_id']; |
518 | 525 | ||
519 | if ($request->has('file')) { | 526 | if ($request->has('file')) { |
520 | $params['file'] = $request->file('file')->store("messages", 'public'); | 527 | $params['file'] = $request->file('file')->store("messages", 'public'); |
521 | } | 528 | } |
522 | Message::create($params); | 529 | Message::create($params); |
523 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); | 530 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); |
524 | } | 531 | } |
525 | 532 | ||
526 | public function test123(Request $request) { | 533 | public function test123(Request $request) { |
527 | $params = $request->all(); | 534 | $params = $request->all(); |
528 | $user1 = $params['user_id']; | 535 | $user1 = $params['user_id']; |
529 | $user2 = $params['to_user_id']; | 536 | $user2 = $params['to_user_id']; |
530 | 537 | ||
531 | $rules = [ | 538 | $rules = [ |
532 | 'text' => 'required|min:1|max:150000', | 539 | 'text' => 'required|min:1|max:150000', |
533 | 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' | 540 | 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' |
534 | ]; | 541 | ]; |
535 | $messages = [ | 542 | $messages = [ |
536 | 'required' => 'Укажите обязательное поле', | 543 | 'required' => 'Укажите обязательное поле', |
537 | 'min' => [ | 544 | 'min' => [ |
538 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 545 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
539 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 546 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
540 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 547 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
541 | ], | 548 | ], |
542 | 'max' => [ | 549 | 'max' => [ |
543 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 550 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
544 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 551 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
545 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 552 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
546 | ] | 553 | ] |
547 | ]; | 554 | ]; |
548 | 555 | ||
549 | $validator = Validator::make($request->all(), $rules, $messages); | 556 | $validator = Validator::make($request->all(), $rules, $messages); |
550 | 557 | ||
551 | if ($validator->fails()) { | 558 | if ($validator->fails()) { |
552 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]) | 559 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]) |
553 | ->withErrors($validator); | 560 | ->withErrors($validator); |
554 | } else { | 561 | } else { |
555 | if ($request->has('file')) { | 562 | if ($request->has('file')) { |
556 | $params['file'] = $request->file('file')->store("messages", 'public'); | 563 | $params['file'] = $request->file('file')->store("messages", 'public'); |
557 | } | 564 | } |
558 | Message::create($params); | 565 | Message::create($params); |
559 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); | 566 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); |
560 | 567 | ||
561 | } | 568 | } |
562 | } | 569 | } |
563 | 570 | ||
564 | //Избранные люди | 571 | //Избранные люди |
565 | public function favorites(Request $request) { | 572 | public function favorites(Request $request) { |
566 | $IP_address = RusDate::ip_addr_client(); | 573 | $IP_address = RusDate::ip_addr_client(); |
567 | $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); | 574 | $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); |
568 | 575 | ||
569 | if ($Arr->count()) { | 576 | if ($Arr->count()) { |
570 | $A = Array(); | 577 | $A = Array(); |
571 | foreach ($Arr as $it) { | 578 | foreach ($Arr as $it) { |
572 | $A[] = $it->code_record; | 579 | $A[] = $it->code_record; |
573 | } | 580 | } |
574 | 581 | ||
575 | $Workers = Worker::query()->whereIn('id', $A); | 582 | $Workers = Worker::query()->whereIn('id', $A); |
576 | } else { | 583 | } else { |
577 | $Workers = Worker::query()->where('id', '=', '0'); | 584 | $Workers = Worker::query()->where('id', '=', '0'); |
578 | } | 585 | } |
579 | 586 | ||
580 | if (($request->has('search')) && (!empty($request->get('search')))) { | 587 | if (($request->has('search')) && (!empty($request->get('search')))) { |
581 | $search = $request->get('search'); | 588 | $search = $request->get('search'); |
582 | 589 | ||
583 | $Workers = $Workers->WhereHas('users', | 590 | $Workers = $Workers->WhereHas('users', |
584 | function (Builder $query) use ($search) { | 591 | function (Builder $query) use ($search) { |
585 | $query->Where('surname', 'LIKE', "%$search%") | 592 | $query->Where('surname', 'LIKE', "%$search%") |
586 | ->orWhere('name_man', 'LIKE', "%$search%") | 593 | ->orWhere('name_man', 'LIKE', "%$search%") |
587 | ->orWhere('surname2', 'LIKE', "%$search%"); | 594 | ->orWhere('surname2', 'LIKE', "%$search%"); |
588 | }); | 595 | }); |
589 | } else { | 596 | } else { |
590 | $Workers = $Workers->with('users'); | 597 | $Workers = $Workers->with('users'); |
591 | } | 598 | } |
592 | 599 | ||
593 | $Workers = $Workers->get(); | 600 | $Workers = $Workers->get(); |
594 | 601 | ||
595 | 602 | ||
596 | return view('employers.favorite', compact('Workers')); | 603 | return view('employers.favorite', compact('Workers')); |
597 | } | 604 | } |
598 | 605 | ||
599 | // База данных | 606 | // База данных |
600 | public function bd(Request $request) { | 607 | public function bd(Request $request) { |
601 | // для типа BelongsTo | 608 | // для типа BelongsTo |
602 | //$documents = Document::query()->orderBy(Location::select('name') | 609 | //$documents = Document::query()->orderBy(Location::select('name') |
603 | // ->whereColumn('locations.id', 'documents.location_id') | 610 | // ->whereColumn('locations.id', 'documents.location_id') |
604 | //); | 611 | //); |
605 | 612 | ||
606 | // для типа HasOne/Many | 613 | // для типа HasOne/Many |
607 | // $documents = Document::::query()->orderBy(Location::select('name') | 614 | // $documents = Document::::query()->orderBy(Location::select('name') |
608 | // ->whereColumn('locations.document_id', 'documents.id') | 615 | // ->whereColumn('locations.document_id', 'documents.id') |
609 | //); | 616 | //); |
610 | 617 | ||
611 | 618 | ||
612 | $users = User_Model::query()->with('workers'); | 619 | $users = User_Model::query()->with('workers'); |
613 | 620 | ||
614 | if ($request->has('search')) { | 621 | if ($request->has('search')) { |
615 | $find_key = $request->get('search'); | 622 | $find_key = $request->get('search'); |
616 | $users = $users->where('name', 'LIKE', "%$find_key%") | 623 | $users = $users->where('name', 'LIKE', "%$find_key%") |
617 | ->orWhere('surname', 'LIKE', "%$find_key%") | 624 | ->orWhere('surname', 'LIKE', "%$find_key%") |
618 | ->orWhere('name_man', 'LIKE', "%$find_key%") | 625 | ->orWhere('name_man', 'LIKE', "%$find_key%") |
619 | ->orWhere('email', 'LIKE', "%$find_key%") | 626 | ->orWhere('email', 'LIKE', "%$find_key%") |
620 | ->orWhere('telephone', 'LIKE', "%$find_key%"); | 627 | ->orWhere('telephone', 'LIKE', "%$find_key%"); |
621 | } | 628 | } |
622 | 629 | ||
623 | // Данные | 630 | // Данные |
624 | $users = $users->Baseuser()-> | 631 | $users = $users->Baseuser()-> |
625 | orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id')); | 632 | orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id')); |
626 | $count_users = $users; | 633 | $count_users = $users; |
627 | $users = $users->paginate(5); | 634 | $users = $users->paginate(5); |
628 | 635 | ||
629 | 636 | ||
630 | return view('employers.bd', compact('users', 'count_users')); | 637 | return view('employers.bd', compact('users', 'count_users')); |
631 | } | 638 | } |
632 | 639 | ||
633 | //Настройка уведомлений | 640 | //Настройка уведомлений |
634 | public function subscribe() { | 641 | public function subscribe() { |
635 | return view('employers.subcribe'); | 642 | return view('employers.subcribe'); |
636 | } | 643 | } |
637 | 644 | ||
638 | //Установка уведомлений сохранение | 645 | //Установка уведомлений сохранение |
639 | public function save_subscribe(Request $request) { | 646 | public function save_subscribe(Request $request) { |
640 | dd($request->all()); | 647 | dd($request->all()); |
641 | $msg = $request->validate([ | 648 | $msg = $request->validate([ |
642 | 'subscribe_email' => 'required|email|min:5|max:255', | 649 | 'subscribe_email' => 'required|email|min:5|max:255', |
643 | ]); | 650 | ]); |
644 | return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); | 651 | return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); |
645 | } | 652 | } |
646 | 653 | ||
647 | //Сбросить форму с паролем | 654 | //Сбросить форму с паролем |
648 | public function password_reset() { | 655 | public function password_reset() { |
649 | $email = Auth()->user()->email; | 656 | $email = Auth()->user()->email; |
650 | return view('employers.password-reset', compact('email')); | 657 | return view('employers.password-reset', compact('email')); |
651 | } | 658 | } |
652 | 659 | ||
653 | //Обновление пароля | 660 | //Обновление пароля |
654 | public function new_password(Request $request) { | 661 | public function new_password(Request $request) { |
655 | $use = Auth()->user(); | 662 | $use = Auth()->user(); |
656 | $request->validate([ | 663 | $request->validate([ |
657 | 'password' => 'required|string', | 664 | 'password' => 'required|string', |
658 | 'new_password' => 'required|string', | 665 | 'new_password' => 'required|string', |
659 | 'new_password2' => 'required|string' | 666 | 'new_password2' => 'required|string' |
660 | ]); | 667 | ]); |
661 | 668 | ||
662 | if ($request->get('new_password') == $request->get('new_password2')) | 669 | if ($request->get('new_password') == $request->get('new_password2')) |
663 | if ($request->get('password') !== $request->get('new_password')) { | 670 | if ($request->get('password') !== $request->get('new_password')) { |
664 | $credentials = $request->only('email', 'password'); | 671 | $credentials = $request->only('email', 'password'); |
665 | if (Auth::attempt($credentials)) { | 672 | if (Auth::attempt($credentials)) { |
666 | 673 | ||
667 | if (!is_null($use->email_verified_at)){ | 674 | if (!is_null($use->email_verified_at)){ |
668 | 675 | ||
669 | $user_data = User_Model::find($use->id); | 676 | $user_data = User_Model::find($use->id); |
670 | $user_data->update([ | 677 | $user_data->update([ |
671 | 'password' => Hash::make($request->get('new_password')), | 678 | 'password' => Hash::make($request->get('new_password')), |
672 | 'pubpassword' => base64_encode($request->get('new_password')), | 679 | 'pubpassword' => base64_encode($request->get('new_password')), |
673 | ]); | 680 | ]); |
674 | return redirect() | 681 | return redirect() |
675 | ->route('employer.password_reset') | 682 | ->route('employer.password_reset') |
676 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); | 683 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); |
677 | } | 684 | } |
678 | 685 | ||
679 | return redirect() | 686 | return redirect() |
680 | ->route('employer.password_reset') | 687 | ->route('employer.password_reset') |
681 | ->withError('Данная учетная запись не было верифицированна!'); | 688 | ->withError('Данная учетная запись не было верифицированна!'); |
682 | } | 689 | } |
683 | } | 690 | } |
684 | 691 | ||
685 | return redirect() | 692 | return redirect() |
686 | ->route('employer.password_reset') | 693 | ->route('employer.password_reset') |
687 | ->withErrors('Не совпадение данных, обновите пароли!'); | 694 | ->withErrors('Не совпадение данных, обновите пароли!'); |
688 | } | 695 | } |
689 | 696 | ||
690 | 697 | ||
691 | 698 | ||
692 | // Форма Удаление пипла | 699 | // Форма Удаление пипла |
693 | public function delete_people() { | 700 | public function delete_people() { |
694 | $login = Auth()->user()->email; | 701 | $login = Auth()->user()->email; |
695 | return view('employers.delete_people', compact('login')); | 702 | return view('employers.delete_people', compact('login')); |
696 | } | 703 | } |
697 | 704 | ||
698 | // Удаление аккаунта | 705 | // Удаление аккаунта |
699 | public function action_delete_user(Request $request) { | 706 | public function action_delete_user(Request $request) { |
700 | $Answer = $request->all(); | 707 | $Answer = $request->all(); |
701 | $user_id = Auth()->user()->id; | 708 | $user_id = Auth()->user()->id; |
702 | $request->validate([ | 709 | $request->validate([ |
703 | 'password' => 'required|string', | 710 | 'password' => 'required|string', |
704 | ]); | 711 | ]); |
705 | 712 | ||
706 | $credentials = $request->only('email', 'password'); | 713 | $credentials = $request->only('email', 'password'); |
707 | if (Auth::attempt($credentials)) { | 714 | if (Auth::attempt($credentials)) { |
708 | Auth::logout(); | 715 | Auth::logout(); |
709 | $it = User_Model::find($user_id); | 716 | $it = User_Model::find($user_id); |
710 | $it->delete(); | 717 | $it->delete(); |
711 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); | 718 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); |
712 | } else { | 719 | } else { |
713 | return redirect()->route('employer.delete_people') | 720 | return redirect()->route('employer.delete_people') |
714 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); | 721 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); |
715 | } | 722 | } |
716 | } | 723 | } |
717 | 724 | ||
718 | public function ajax_delete_user(Request $request) { | 725 | public function ajax_delete_user(Request $request) { |
719 | $Answer = $request->all(); | 726 | $Answer = $request->all(); |
720 | $user_id = Auth()->user()->id; | 727 | $user_id = Auth()->user()->id; |
721 | $request->validate([ | 728 | $request->validate([ |
722 | 'password' => 'required|string', | 729 | 'password' => 'required|string', |
723 | ]); | 730 | ]); |
724 | $credentials = $request->only('email', 'password'); | 731 | $credentials = $request->only('email', 'password'); |
725 | if (Auth::attempt($credentials)) { | 732 | if (Auth::attempt($credentials)) { |
726 | 733 | ||
727 | return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', | 734 | return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', |
728 | 'email' => $request->get('email'), | 735 | 'email' => $request->get('email'), |
729 | 'password' => $request->get('password'))); | 736 | 'password' => $request->get('password'))); |
730 | } else { | 737 | } else { |
731 | return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); | 738 | return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); |
732 | } | 739 | } |
733 | } | 740 | } |
734 | 741 | ||
735 | // FAQ - Вопросы/ответы для работодателей и соискателей | 742 | // FAQ - Вопросы/ответы для работодателей и соискателей |
736 | public function faq() { | 743 | public function faq() { |
737 | return view('employers.faq'); | 744 | return view('employers.faq'); |
738 | } | 745 | } |
739 | 746 | ||
740 | // Рассылка сообщений | 747 | // Рассылка сообщений |
741 | public function send_all_messages() { | 748 | public function send_all_messages() { |
742 | $id = Auth()->user()->id; | 749 | $id = Auth()->user()->id; |
743 | $sending = Employer::query()->where('user_id', '=', "$id")->first(); | 750 | $sending = Employer::query()->where('user_id', '=', "$id")->first(); |
744 | if ($sending->sending_is) | 751 | if ($sending->sending_is) |
745 | return view('employers.send_all'); | 752 | return view('employers.send_all'); |
746 | else | 753 | else |
747 | return view('employers.send_all_danger'); | 754 | return view('employers.send_all_danger'); |
748 | } | 755 | } |
749 | 756 | ||
750 | // Отправка сообщений для информации | 757 | // Отправка сообщений для информации |
751 | public function send_all_post(Request $request) { | 758 | public function send_all_post(Request $request) { |
752 | $data = $request->all(); | 759 | $data = $request->all(); |
753 | 760 | ||
754 | $emails = User_Model::query()->where('is_worker', '1')->get(); | 761 | $emails = User_Model::query()->where('is_worker', '1')->get(); |
755 | 762 | ||
756 | foreach ($emails as $e) { | 763 | foreach ($emails as $e) { |
757 | Mail::to($e->email)->send(new SendAllMessages($data)); | 764 | Mail::to($e->email)->send(new SendAllMessages($data)); |
758 | } | 765 | } |
759 | 766 | ||
760 | return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены'); | 767 | return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены'); |
761 | } | 768 | } |
762 | 769 | ||
763 | // База резюме | 770 | // База резюме |
764 | public function bd_tupe(Request $request) { | 771 | public function bd_tupe(Request $request) { |
765 | $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); | 772 | $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); |
766 | 773 | ||
767 | return view('employers.bd_tupe', compact('Resume')); | 774 | return view('employers.bd_tupe', compact('Resume')); |
768 | } | 775 | } |
769 | 776 | ||
770 | ////////////////////////////////////////////////////////////////// | 777 | ////////////////////////////////////////////////////////////////// |
771 | // Отправил сообщение | 778 | // Отправил сообщение |
772 | ////////////////////////////////////////////////////////////////// | 779 | ////////////////////////////////////////////////////////////////// |
773 | public function new_message(Request $request) { | 780 | public function new_message(Request $request) { |
774 | $params = $request->all(); | 781 | $params = $request->all(); |
775 | $id = $params['_user_id']; | 782 | $id = $params['_user_id']; |
776 | $message = new Message(); | 783 | $message = new Message(); |
777 | $message->user_id = $params['_user_id']; | 784 | $message->user_id = $params['_user_id']; |
778 | $message->to_user_id = $params['_to_user_id']; | 785 | $message->to_user_id = $params['_to_user_id']; |
779 | $message->title = $params['title']; | 786 | $message->title = $params['title']; |
780 | $message->text = $params['text']; | 787 | $message->text = $params['text']; |
781 | if ($request->has('_file')) { | 788 | if ($request->has('_file')) { |
782 | $message->file = $request->file('_file')->store("worker/$id", 'public'); | 789 | $message->file = $request->file('_file')->store("worker/$id", 'public'); |
783 | } | 790 | } |
784 | $message->ad_employer_id = $params['_vacancy']; | 791 | $message->ad_employer_id = $params['_vacancy']; |
785 | $message->flag_new = 1; | 792 | $message->flag_new = 1; |
786 | $id_message = $message->save(); | 793 | $id_message = $message->save(); |
787 | 794 | ||
788 | //$data['message_id'] = $id_message; | 795 | //$data['message_id'] = $id_message; |
789 | //$data['ad_employer_id'] = $params['_vacancy']; | 796 | //$data['ad_employer_id'] = $params['_vacancy']; |
790 | //$data['job_title_id'] = 0; | 797 | //$data['job_title_id'] = 0; |
791 | 798 | ||
792 | $data['flag'] = 1; | 799 | $data['flag'] = 1; |
793 | //$ad_responce = ad_response::create($data); | 800 | //$ad_responce = ad_response::create($data); |
794 | return redirect()->route('employer.messages', ['type_message' => 'output']); | 801 | return redirect()->route('employer.messages', ['type_message' => 'output']); |
795 | } | 802 | } |
796 | 803 | ||
797 | // Восстановление пароля | 804 | // Восстановление пароля |
798 | public function repair_password(Request $request) { | 805 | public function repair_password(Request $request) { |
799 | $params = $request->get('email'); | 806 | $params = $request->get('email'); |
800 | } | 807 | } |
801 | 808 | ||
802 | // Избранные люди на корабль | 809 | // Избранные люди на корабль |
803 | public function selected_people(Request $request) { | 810 | public function selected_people(Request $request) { |
804 | $id = $request->get('id'); | 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 | return view('favorite_people', compact('favorite_people')); | 817 | return view('favorite_people', compact('favorite_people')); |
807 | } | 818 | } |
808 | } | 819 | } |
809 | 820 |
app/Providers/MyServiceProvider.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Providers; | 3 | namespace App\Providers; |
4 | 4 | ||
5 | use App\Models\Company; | 5 | use App\Models\Company; |
6 | use App\Models\ContentRoles; | 6 | use App\Models\ContentRoles; |
7 | use App\Models\Employer; | 7 | use App\Models\Employer; |
8 | use App\Models\Job_title; | 8 | use App\Models\Job_title; |
9 | use App\Models\Worker; | 9 | use App\Models\Worker; |
10 | use Illuminate\Support\Facades\Auth; | 10 | use Illuminate\Support\Facades\Auth; |
11 | use Illuminate\Support\Facades\DB; | 11 | use Illuminate\Support\Facades\DB; |
12 | use Illuminate\Support\Facades\View; | 12 | use Illuminate\Support\Facades\View; |
13 | use Illuminate\Support\ServiceProvider; | 13 | use Illuminate\Support\ServiceProvider; |
14 | 14 | ||
15 | class MyServiceProvider extends ServiceProvider | 15 | class MyServiceProvider extends ServiceProvider |
16 | { | 16 | { |
17 | /** | 17 | /** |
18 | * Register services. | 18 | * Register services. |
19 | * | 19 | * |
20 | * @return void | 20 | * @return void |
21 | */ | 21 | */ |
22 | public function register() | 22 | public function register() |
23 | { | 23 | { |
24 | // | 24 | // |
25 | } | 25 | } |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * Bootstrap services. | 28 | * Bootstrap services. |
29 | * | 29 | * |
30 | * @return void | 30 | * @return void |
31 | */ | 31 | */ |
32 | public function boot() | 32 | public function boot() |
33 | { | 33 | { |
34 | $views = ['admin.job_titles.parent_id']; | 34 | $views = ['admin.job_titles.parent_id']; |
35 | View::composer($views, | 35 | View::composer($views, |
36 | function($view) | 36 | function($view) |
37 | { | 37 | { |
38 | static $items = null; | 38 | static $items = null; |
39 | 39 | ||
40 | if (is_null($items)) { | 40 | if (is_null($items)) { |
41 | $items = Job_title::query()-> | 41 | $items = Job_title::query()-> |
42 | orderByDesc('sort')-> | 42 | orderByDesc('sort')-> |
43 | orderBy('name')-> | 43 | orderBy('name')-> |
44 | active()-> | 44 | active()-> |
45 | get(); | 45 | get(); |
46 | $parent = 0; | 46 | $parent = 0; |
47 | $view->with(['items' => $items, 'parent' => $parent]); | 47 | $view->with(['items' => $items, 'parent' => $parent]); |
48 | } else { | 48 | } else { |
49 | $view->with(['items' => $items]); | 49 | $view->with(['items' => $items]); |
50 | } | 50 | } |
51 | 51 | ||
52 | } | 52 | } |
53 | ); | 53 | ); |
54 | 54 | ||
55 | $views2 = ['layout.admin', 'admin.index']; | 55 | $views2 = ['layout.admin', 'admin.index']; |
56 | 56 | ||
57 | View::composer($views2, | 57 | View::composer($views2, |
58 | function($view){ | 58 | function($view){ |
59 | $id = Auth::user()->id; | 59 | $id = Auth::user()->id; |
60 | $is_manager = Auth::user()->is_manager; | 60 | $is_manager = Auth::user()->is_manager; |
61 | $admin = Auth::user()->admin; | 61 | $admin = Auth::user()->admin; |
62 | 62 | ||
63 | $contents = ContentRoles::query()->get(); | 63 | $contents = ContentRoles::query()->get(); |
64 | 64 | ||
65 | $query = DB::select(DB::raw('SELECT count(*) as MsgCount | 65 | $query = DB::select(DB::raw('SELECT count(*) as MsgCount |
66 | FROM messages m1 | 66 | FROM messages m1 |
67 | Where ((m1.flag_new = 1) and (m1.to_user_id = :uid)) | 67 | Where ((m1.flag_new = 1) and (m1.to_user_id = :uid)) |
68 | '), ['uid' => $id] | 68 | '), ['uid' => $id] |
69 | ); | 69 | ); |
70 | 70 | ||
71 | $view->with(['MsgCount' => $query[0]->MsgCount, | 71 | $view->with(['MsgCount' => $query[0]->MsgCount, |
72 | 'UserId' => $id, | 72 | 'UserId' => $id, |
73 | 'is_manager' => $is_manager, | 73 | 'is_manager' => $is_manager, |
74 | 'admin' => $admin, | 74 | 'admin' => $admin, |
75 | 'contents' => $contents]); | 75 | 'contents' => $contents]); |
76 | } | 76 | } |
77 | ); | 77 | ); |
78 | 78 | ||
79 | $views3 = ['layout.frontend', 'index']; | 79 | $views3 = ['layout.frontend', 'index']; |
80 | 80 | ||
81 | View::composer($views3, | 81 | View::composer($views3, |
82 | function($view){ | 82 | function($view){ |
83 | $id = Auth::user(); | 83 | $id = Auth::user(); |
84 | $companies = Company::query()->limit(1)->get(); | 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 | $view->with(['UserId' => $id, 'companies' => $companies, 'jobs' => $jobs]); | 90 | $view->with(['UserId' => $id, 'companies' => $companies, 'jobs' => $jobs]); |
87 | } | 91 | } |
88 | ); | 92 | ); |
89 | 93 | ||
90 | $view1 = ['employers.menu', 'employers.emblema', 'employers.send_all']; | 94 | $view1 = ['employers.menu', 'employers.emblema', 'employers.send_all']; |
91 | View::composer($view1, | 95 | View::composer($view1, |
92 | function($view){ | 96 | function($view){ |
93 | $user = Auth::user(); | 97 | $user = Auth::user(); |
94 | $id = $user->id; | 98 | $id = $user->id; |
95 | $employer = Employer::query()->where('user_id', $id)->get(); | 99 | $employer = Employer::query()->where('user_id', $id)->get(); |
96 | $id_employer = $employer[0]->id; | 100 | $id_employer = $employer[0]->id; |
97 | $view->with(['id_employer' => $id_employer, 'Employer' => $employer]); | 101 | $view->with(['id_employer' => $id_employer, 'Employer' => $employer]); |
98 | } | 102 | } |
99 | ); | 103 | ); |
100 | 104 | ||
101 | $view_worker = ['workers.emblema']; | 105 | $view_worker = ['workers.emblema']; |
102 | View::composer($view_worker, | 106 | View::composer($view_worker, |
103 | function($view_worker) { | 107 | function($view_worker) { |
104 | $user = Auth::user(); | 108 | $user = Auth::user(); |
105 | $id = $user->id; | 109 | $id = $user->id; |
106 | $Worker = Worker::query()->where('user_id', $id)->get(); | 110 | $Worker = Worker::query()->where('user_id', $id)->get(); |
107 | $id_worker = $Worker[0]->id; | 111 | $id_worker = $Worker[0]->id; |
108 | $view_worker->with(['id_worker' => $id_worker, 'Worker' => $Worker, 'User' => $user]); | 112 | $view_worker->with(['id_worker' => $id_worker, 'Worker' => $Worker, 'User' => $user]); |
109 | } | 113 | } |
110 | ); | 114 | ); |
111 | 115 | ||
112 | $view_job_title = ['modals.register']; | 116 | $view_job_title = ['modals.register']; |
113 | View::composer($view_job_title, | 117 | View::composer($view_job_title, |
114 | function($view_job_title) { | 118 | function($view_job_title) { |
119 | //$Job_titles = Job_title::query()->where('is_remove', '=', '0')-> | ||
120 | // where('is_bd', '=' , '1')->get(); | ||
115 | $Job_titles = Job_title::query()->where('is_remove', '=', '0')-> | 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 | $view_job_title->with(['Job_titles' => $Job_titles]); | 125 | $view_job_title->with(['Job_titles' => $Job_titles]); |
118 | } | 126 | } |
119 | ); | 127 | ); |
120 | 128 | ||
121 | } | 129 | } |
122 | } | 130 | } |
123 | 131 |
resources/views/employers/add_ad_jobs.blade.php
1 | @extends('layout.frontend', ['title' => 'Добавление вакансии РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Добавление вакансии РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | <script> | 4 | <script> |
5 | console.log('Приближаемся к системе, нас рой тут...'); | 5 | console.log('Приближаемся к системе, нас рой тут...'); |
6 | $(document).on('change', '#position_id', function() { | 6 | $(document).on('change', '#position_id', function() { |
7 | var this_ = $(this); | 7 | var this_ = $(this); |
8 | var val_ = this_.val(); | 8 | var val_ = this_.val(); |
9 | var ajax_ = $('#job_title_id'); | 9 | var ajax_ = $('#job_title_id'); |
10 | 10 | ||
11 | console.log('Создания списка людей, которые поднимутся на корабль...'); | 11 | console.log('Создания списка людей, которые поднимутся на корабль...'); |
12 | 12 | ||
13 | $.ajax({ | 13 | $.ajax({ |
14 | type: "GET", | 14 | type: "GET", |
15 | url: "{{ route('employer.selected_people') }}", | 15 | url: "{{ route('employer.selected_people') }}", |
16 | data: "id="+val_, | 16 | data: "id="+val_, |
17 | success: function (data) { | 17 | success: function (data) { |
18 | console.log('Ответка пришла'); | 18 | console.log('Ответка пришла'); |
19 | console.log('Список избранных людей создан'); | 19 | console.log('Список избранных людей создан'); |
20 | ajax_.html(data); | 20 | ajax_.html(data); |
21 | }, | 21 | }, |
22 | headers: { | 22 | headers: { |
23 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 23 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
24 | }, | 24 | }, |
25 | error: function (data) { | 25 | error: function (data) { |
26 | console.log('Обрыв связи'); | 26 | console.log('Обрыв связи'); |
27 | console.log('Error: ' + data); | 27 | console.log('Error: ' + data); |
28 | } | 28 | } |
29 | }); | 29 | }); |
30 | }); | 30 | }); |
31 | </script> | 31 | </script> |
32 | @endsection | 32 | @endsection |
33 | @section('content') | 33 | @section('content') |
34 | <section class="cabinet"> | 34 | <section class="cabinet"> |
35 | <div class="container"> | 35 | <div class="container"> |
36 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 36 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
37 | <li><a href="{{ route('index') }}">Главная</a></li> | 37 | <li><a href="{{ route('index') }}">Главная</a></li> |
38 | <li><b>Личный кабинет</b></li> | 38 | <li><b>Личный кабинет</b></li> |
39 | </ul> | 39 | </ul> |
40 | <div class="cabinet__wrapper"> | 40 | <div class="cabinet__wrapper"> |
41 | <div class="cabinet__side"> | 41 | <div class="cabinet__side"> |
42 | <div class="cabinet__side-toper"> | 42 | <div class="cabinet__side-toper"> |
43 | 43 | ||
44 | @include('employers.emblema') | 44 | @include('employers.emblema') |
45 | 45 | ||
46 | </div> | 46 | </div> |
47 | 47 | ||
48 | @include('employers.menu', ['item' => 2]) | 48 | @include('employers.menu', ['item' => 2]) |
49 | 49 | ||
50 | </div> | 50 | </div> |
51 | 51 | ||
52 | <form class="cabinet__body" action="{{ route('employer.add_job_in_vac_save') }}" method="POST"> | 52 | <form class="cabinet__body" action="{{ route('employer.add_job_in_vac_save') }}" method="POST"> |
53 | @csrf | 53 | @csrf |
54 | <input type="hidden" name="ad_employer_id" value="{{ $ad_employer->id }}"/> | 54 | <input type="hidden" name="ad_employer_id" value="{{ $ad_employer->id }}"/> |
55 | <div class="cabinet__body-item"> | 55 | <div class="cabinet__body-item"> |
56 | <div class="cabinet__descr"> | 56 | <div class="cabinet__descr"> |
57 | <h2 class="title cabinet__title">Разместить должность в вакансии</h2> | 57 | <h2 class="title cabinet__title">Разместить должность в вакансии</h2> |
58 | <p class="cabinet__text"><b>Вакансия {{ $ad_employer->name }}</b></p> | 58 | <p class="cabinet__text"><b>Вакансия {{ $ad_employer->name }}</b></p> |
59 | </div> | 59 | </div> |
60 | </div> | 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 | <label class="form-group__label">Категория вакансии</label> | 63 | <label class="form-group__label">Категория вакансии</label> |
64 | <div class="form-group__item"> | 64 | <div class="form-group__item"> |
65 | <div class="select"> | 65 | <div class="select"> |
66 | <select class="js-select2" name="position_id" id="position_id"> | 66 | <select class="js-select2" name="position_id" id="position_id"> |
67 | @foreach ($Positions as $it) | 67 | @foreach ($Positions as $it) |
68 | <option value="{{ $it->id }}">{{ $it->name }}</option> | 68 | <option value="{{ $it->id }}">{{ $it->name }}</option> |
69 | @endforeach | 69 | @endforeach |
70 | </select> | 70 | </select> |
71 | @error('postion_id') | 71 | @error('postion_id') |
72 | <span class="text-xs text-red-600 dark:text-red-400"> | 72 | <span class="text-xs text-red-600 dark:text-red-400"> |
73 | {{ $message }} | 73 | {{ $message }} |
74 | </span> | 74 | </span> |
75 | @enderror | 75 | @enderror |
76 | </div> | 76 | </div> |
77 | </div> | 77 | </div> |
78 | </div> | 78 | </div> |
79 | 79 | ||
80 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 80 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
81 | <label class="form-group__label">Должность соискателя</label> | 81 | <label class="form-group__label">Должность соискателя</label> |
82 | <div class="form-group__item"> | 82 | <div class="form-group__item"> |
83 | <div class="select"> | 83 | <div class="select"> |
84 | <select class="js-select2" name="job_title_id" id="job_title_id"> | 84 | <select class="js-select2" name="job_title_id" id="job_title_id"> |
85 | @php $i = 1 @endphp | 85 | @php $i = 1; |
86 | @if ($jobs->count()) | 86 | @endphp |
87 | @foreach($jobs as $j) | 87 | <option value="0"> Выберите должность из списка</option> |
88 | @if ($i == 1) <option selected> Выберите должность из списка</option> | 88 | @foreach($jobs as $j) |
89 | @else | 89 | <option value="{{ $j->id }}">{{ $j->name }}</option> |
90 | <option value="{{ $j->id }}">{{ $j->name }}</option> | 90 | @php $i++ @endphp |
91 | @endif | 91 | @endforeach |
92 | @php $i++ @endphp | ||
93 | @endforeach | ||
94 | @endif | ||
95 | </select> | 92 | </select> |
93 | |||
96 | @error('job_title_id') | 94 | @error('job_title_id') |
97 | <span class="text-xs text-red-600 dark:text-red-400"> | 95 | <span class="text-xs text-red-600 dark:text-red-400"> |
98 | {{ $message }} | 96 | {{ $message }} |
99 | </span> | 97 | </span> |
100 | @enderror | 98 | @enderror |
101 | </div> | 99 | </div> |
102 | </div> | 100 | </div> |
103 | </div> | 101 | </div> |
104 | 102 | ||
105 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 103 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
106 | <label class="form-group__label">Минимальная зарплата</label> | 104 | <label class="form-group__label">Минимальная зарплата</label> |
107 | <div class="form-group__item"> | 105 | <div class="form-group__item"> |
108 | <input type="text" class="input" name="min_salary" id="min_salary" value="{{ old('min_salary') ?? '' }}" placeholder="Минимальная зарплата"> | 106 | <input type="text" class="input" name="min_salary" id="min_salary" value="{{ old('min_salary') ?? '' }}" placeholder="Минимальная зарплата"> |
109 | @error('min_salary') | 107 | @error('min_salary') |
110 | <span class="text-xs text-red-600"> | 108 | <span class="text-xs text-red-600"> |
111 | {{ $message }} | 109 | {{ $message }} |
112 | </span> | 110 | </span> |
113 | @enderror | 111 | @enderror |
114 | </div> | 112 | </div> |
115 | </div> | 113 | </div> |
116 | 114 | ||
117 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 115 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
118 | <label class="form-group__label">Максимальная зарплата</label> | 116 | <label class="form-group__label">Максимальная зарплата</label> |
119 | <div class="form-group__item"> | 117 | <div class="form-group__item"> |
120 | <input type="text" class="input" name="max_salary" id="max_salary" value="{{ old('max_salary') ?? '' }}" placeholder="Максимальная зарплата"> | 118 | <input type="text" class="input" name="max_salary" id="max_salary" value="{{ old('max_salary') ?? '' }}" placeholder="Максимальная зарплата"> |
121 | @error('salary') | 119 | @error('salary') |
122 | <span class="text-xs text-red-600 dark:text-red-400"> | 120 | <span class="text-xs text-red-600 dark:text-red-400"> |
123 | {{ $message }} | 121 | {{ $message }} |
124 | </span> | 122 | </span> |
125 | @enderror | 123 | @enderror |
126 | </div> | 124 | </div> |
127 | </div> | 125 | </div> |
128 | 126 | ||
129 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 127 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
130 | <label class="form-group__label">Регион отплытия</label> | 128 | <label class="form-group__label">Регион отплытия</label> |
131 | <div class="form-group__item"> | 129 | <div class="form-group__item"> |
132 | <input type="text" class="input" name="region" id="region" value="{{ old('region') ?? $Employer->city ?? '' }}" placeholder="Севастополь"> | 130 | <input type="text" class="input" name="region" id="region" value="{{ old('region') ?? $Employer->city ?? '' }}" placeholder="Севастополь"> |
133 | @error('region') | 131 | @error('region') |
134 | <span class="text-xs text-red-600"> | 132 | <span class="text-xs text-red-600"> |
135 | {{ $message }} | 133 | {{ $message }} |
136 | </span> | 134 | </span> |
137 | @enderror | 135 | @enderror |
138 | </div> | 136 | </div> |
139 | </div> | 137 | </div> |
140 | 138 | ||
141 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 139 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
142 | <label class="form-group__label">Мощность</label> | 140 | <label class="form-group__label">Мощность</label> |
143 | <div class="form-group__item"> | 141 | <div class="form-group__item"> |
144 | <input type="text" class="input" name="power" id="power" value="{{ old('power') ?? '' }}" placeholder="POWER-45"> | 142 | <input type="text" class="input" name="power" id="power" value="{{ old('power') ?? '' }}" placeholder="POWER-45"> |
145 | @error('power') | 143 | @error('power') |
146 | <span class="text-xs text-red-600"> | 144 | <span class="text-xs text-red-600"> |
147 | {{ $message }} | 145 | {{ $message }} |
148 | </span> | 146 | </span> |
149 | @enderror | 147 | @enderror |
150 | </div> | 148 | </div> |
151 | </div> | 149 | </div> |
152 | 150 | ||
153 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 151 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
154 | <label class="form-group__label">Суточные выплаты</label> | 152 | <label class="form-group__label">Суточные выплаты</label> |
155 | <div class="form-group__item"> | 153 | <div class="form-group__item"> |
156 | <input type="text" class="input" name="sytki" id="sytki" value="{{ old('sytki') ?? '' }}" placeholder="2000"> | 154 | <input type="text" class="input" name="sytki" id="sytki" value="{{ old('sytki') ?? '' }}" placeholder="2000"> |
157 | @error('power') | 155 | @error('power') |
158 | <span class="text-xs text-red-600"> | 156 | <span class="text-xs text-red-600"> |
159 | {{ $message }} | 157 | {{ $message }} |
160 | </span> | 158 | </span> |
161 | @enderror | 159 | @enderror |
162 | </div> | 160 | </div> |
163 | </div> | 161 | </div> |
164 | 162 | ||
165 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 163 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
166 | <label class="form-group__label">Начало отплытия</label> | 164 | <label class="form-group__label">Начало отплытия</label> |
167 | <div class="form-group__item"> | 165 | <div class="form-group__item"> |
168 | <input type="text" class="input" name="start" id="start" value="{{ old('start') ?? '' }}" placeholder="20 сентября 2024"> | 166 | <input type="text" class="input" name="start" id="start" value="{{ old('start') ?? '' }}" placeholder="20 сентября 2024"> |
169 | @error('power') | 167 | @error('power') |
170 | <span class="text-xs text-red-600"> | 168 | <span class="text-xs text-red-600"> |
171 | {{ $message }} | 169 | {{ $message }} |
172 | </span> | 170 | </span> |
173 | @enderror | 171 | @enderror |
174 | </div> | 172 | </div> |
175 | </div> | 173 | </div> |
176 | 174 | ||
177 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 175 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
178 | <label class="form-group__label">Корабль для посадки</label> | 176 | <label class="form-group__label">Корабль для посадки</label> |
179 | <div class="form-group__item"> | 177 | <div class="form-group__item"> |
180 | <div class="select"> | 178 | <div class="select"> |
181 | <select class="js-select2" name="flot" id="flot"> | 179 | <select class="js-select2" name="flot" id="flot"> |
182 | <option value="" selected> Не указан корабль</option> | 180 | <option value="" selected> Не указан корабль</option> |
183 | @if ($Employer->flots->count()) | 181 | @if ($Employer->flots->count()) |
184 | @foreach($Employer->flots as $j) | 182 | @foreach($Employer->flots as $j) |
185 | <option value="{{ $j->name }}">{{ $j->name }} ({{ $j->id }})</option> | 183 | <option value="{{ $j->name }}">{{ $j->name }} ({{ $j->id }})</option> |
186 | @endforeach | 184 | @endforeach |
187 | @endif | 185 | @endif |
188 | </select> | 186 | </select> |
189 | @error('flot') | 187 | @error('flot') |
190 | <span class="text-xs text-red-600"> | 188 | <span class="text-xs text-red-600"> |
191 | {{ $message }} | 189 | {{ $message }} |
192 | </span> | 190 | </span> |
193 | @enderror | 191 | @enderror |
194 | </div> | 192 | </div> |
195 | </div> | 193 | </div> |
196 | </div> | 194 | </div> |
197 | 195 | ||
198 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 196 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
199 | <label class="form-group__label">Дополнительная информация</label> | 197 | <label class="form-group__label">Дополнительная информация</label> |
200 | <div class="form-group__item"> | 198 | <div class="form-group__item"> |
201 | <textarea class="textarea" name="description" id="description">{{ old('description') ?? '' }}</textarea> | 199 | <textarea class="textarea" name="description" id="description">{{ old('description') ?? '' }}</textarea> |
202 | @error('description') | 200 | @error('description') |
203 | <span class="text-xs text-red-600"> | 201 | <span class="text-xs text-red-600"> |
204 | {{ $message }} | 202 | {{ $message }} |
205 | </span> | 203 | </span> |
206 | @enderror | 204 | @enderror |
207 | </div> | 205 | </div> |
208 | </div> | 206 | </div> |
209 | 207 | ||
210 | <button type="submit" class="button cabinet__submit">Опубликовать</button> | 208 | <button type="submit" class="button cabinet__submit">Опубликовать</button> |
211 | </form> | 209 | </form> |
212 | </div> | 210 | </div> |
213 | </div> | 211 | </div> |
214 | </section> | 212 | </section> |
215 | </div> | 213 | </div> |
216 | @endsection | 214 | @endsection |
resources/views/employers/edit_ad_jobs.blade.php
1 | @extends('layout.frontend', ['title' => 'Добавление вакансии РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Добавление вакансии РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | <script> | 4 | <script> |
5 | console.log('Приближаемся к системе, нас рой тут...'); | 5 | console.log('Приближаемся к системе, нас рой тут...'); |
6 | $(document).on('change', '#position_id', function() { | 6 | $(document).on('change', '#position_id', function() { |
7 | var this_ = $(this); | 7 | var this_ = $(this); |
8 | var val_ = this_.val(); | 8 | var val_ = this_.val(); |
9 | var ajax_ = $('#job_title_id'); | 9 | var ajax_ = $('#job_title_id'); |
10 | 10 | ||
11 | console.log('Создания списка людей, которые поднимутся на корабль...'); | 11 | console.log('Создания списка людей, которые поднимутся на корабль...'); |
12 | 12 | ||
13 | $.ajax({ | 13 | $.ajax({ |
14 | type: "GET", | 14 | type: "GET", |
15 | url: "{{ route('employer.selected_people') }}", | 15 | url: "{{ route('employer.selected_people') }}", |
16 | data: "id="+val_, | 16 | data: "id="+val_, |
17 | success: function (data) { | 17 | success: function (data) { |
18 | console.log('Ответка пришла'); | 18 | console.log('Ответка пришла'); |
19 | console.log('Список избранных людей создан'); | 19 | console.log('Список избранных людей создан'); |
20 | ajax_.html(data); | 20 | ajax_.html(data); |
21 | }, | 21 | }, |
22 | headers: { | 22 | headers: { |
23 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 23 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
24 | }, | 24 | }, |
25 | error: function (data) { | 25 | error: function (data) { |
26 | console.log('Обрыв связи'); | 26 | console.log('Обрыв связи'); |
27 | console.log('Error: ' + data); | 27 | console.log('Error: ' + data); |
28 | } | 28 | } |
29 | }); | 29 | }); |
30 | }); | 30 | }); |
31 | </script> | 31 | </script> |
32 | @endsection | 32 | @endsection |
33 | @section('content') | 33 | @section('content') |
34 | <section class="cabinet"> | 34 | <section class="cabinet"> |
35 | <div class="container"> | 35 | <div class="container"> |
36 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 36 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
37 | <li><a href="{{ route('index') }}">Главная</a></li> | 37 | <li><a href="{{ route('index') }}">Главная</a></li> |
38 | <li><b>Личный кабинет</b></li> | 38 | <li><b>Личный кабинет</b></li> |
39 | </ul> | 39 | </ul> |
40 | <div class="cabinet__wrapper"> | 40 | <div class="cabinet__wrapper"> |
41 | <div class="cabinet__side"> | 41 | <div class="cabinet__side"> |
42 | <div class="cabinet__side-toper"> | 42 | <div class="cabinet__side-toper"> |
43 | 43 | ||
44 | @include('employers.emblema') | 44 | @include('employers.emblema') |
45 | 45 | ||
46 | </div> | 46 | </div> |
47 | 47 | ||
48 | @include('employers.menu', ['item' => 2]) | 48 | @include('employers.menu', ['item' => 2]) |
49 | 49 | ||
50 | </div> | 50 | </div> |
51 | 51 | ||
52 | <form class="cabinet__body" action="{{ route('employer.edit_job_in_vac_save', ['ad_job' => $ad_job->id]) }}" method="POST"> | 52 | <form class="cabinet__body" action="{{ route('employer.edit_job_in_vac_save', ['ad_job' => $ad_job->id]) }}" method="POST"> |
53 | @csrf | 53 | @csrf |
54 | <input type="hidden" name="ad_employer_id" value="{{ $ad_employer->id }}"/> | 54 | <input type="hidden" name="ad_employer_id" value="{{ $ad_employer->id }}"/> |
55 | <div class="cabinet__body-item"> | 55 | <div class="cabinet__body-item"> |
56 | <div class="cabinet__descr"> | 56 | <div class="cabinet__descr"> |
57 | <h2 class="title cabinet__title">Редактировать должность в вакансии</h2> | 57 | <h2 class="title cabinet__title">Редактировать должность в вакансии</h2> |
58 | <p class="cabinet__text"><b>Вакансия {{ $ad_employer->name }}</b></p> | 58 | <p class="cabinet__text"><b>Вакансия {{ $ad_employer->name }}</b></p> |
59 | </div> | 59 | </div> |
60 | </div> | 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 | <label class="form-group__label">Категория должности</label> | 63 | <label class="form-group__label">Категория должности</label> |
64 | <div class="form-group__item"> | 64 | <div class="form-group__item"> |
65 | <div class="select"> | 65 | <div class="select"> |
66 | <select class="js-select2" name="position_id" id="position_id"> | 66 | <select class="js-select2" name="position_id" id="position_id"> |
67 | @foreach ($Positions as $it) | 67 | @foreach ($Positions as $it) |
68 | <option value="{{ $it->id }}" @if (isset($ad_job->job_title)) @if($ad_job->job_title->position_id == $it->id) selected @endif @endif>{{ $it->name }}</option> | 68 | <option value="{{ $it->id }}" @if (isset($ad_job->job_title)) @if($ad_job->job_title->position_id == $it->id) selected @endif @endif>{{ $it->name }}</option> |
69 | @endforeach | 69 | @endforeach |
70 | </select> | 70 | </select> |
71 | @error('postion_id') | 71 | @error('postion_id') |
72 | <span class="text-xs text-red-600 dark:text-red-400"> | 72 | <span class="text-xs text-red-600 dark:text-red-400"> |
73 | {{ $message }} | 73 | {{ $message }} |
74 | </span> | 74 | </span> |
75 | @enderror | 75 | @enderror |
76 | </div> | 76 | </div> |
77 | </div> | 77 | </div> |
78 | </div> | 78 | </div> |
79 | 79 | ||
80 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 80 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
81 | <label class="form-group__label">Должность соискателя</label> | 81 | <label class="form-group__label">Должность соискателя</label> |
82 | <div class="form-group__item"> | 82 | <div class="form-group__item"> |
83 | <div class="select"> | 83 | <div class="select"> |
84 | <pre><? print_r($jobs123)?></pre> | ||
85 | |||
84 | <select class="js-select2" name="job_title_id" id="job_title_id"> | 86 | <select class="js-select2" name="job_title_id" id="job_title_id"> |
85 | @php $i = 1; | 87 | @php $i = 1; |
86 | @endphp | 88 | @endphp |
87 | <option value="0"> Выберите должность из списка</option> | 89 | <option value="0"> Выберите должность из списка</option> |
88 | @foreach($jobs123 as $j) | 90 | @foreach($jobs123 as $j) |
89 | <option value="{{ $j->id }}" @if ($job_title_id == $j->id) selected @endif>{{ $j->name }}</option> | 91 | <option value="{{ $j->id }}" @if ($job_title_id == $j->id) selected @endif>{{ $j->name }}</option> |
90 | @php $i++ @endphp | 92 | @php $i++ @endphp |
91 | @endforeach | 93 | @endforeach |
92 | </select> | 94 | </select> |
93 | @error('job_title_id') | 95 | @error('job_title_id') |
94 | <span class="text-xs text-red-600 dark:text-red-400"> | 96 | <span class="text-xs text-red-600 dark:text-red-400"> |
95 | {{ $message }} | 97 | {{ $message }} |
96 | </span> | 98 | </span> |
97 | @enderror | 99 | @enderror |
98 | </div> | 100 | </div> |
99 | </div> | 101 | </div> |
100 | </div> | 102 | </div> |
101 | 103 | ||
102 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 104 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
103 | <label class="form-group__label">Минимальная зарплата</label> | 105 | <label class="form-group__label">Минимальная зарплата</label> |
104 | <div class="form-group__item"> | 106 | <div class="form-group__item"> |
105 | <input type="text" class="input" name="min_salary" id="min_salary" value="{{ old('min_salary') ?? $ad_job->min_salary ?? '' }}" placeholder="Минимальная зарплата"> | 107 | <input type="text" class="input" name="min_salary" id="min_salary" value="{{ old('min_salary') ?? $ad_job->min_salary ?? '' }}" placeholder="Минимальная зарплата"> |
106 | @error('min_salary') | 108 | @error('min_salary') |
107 | <span class="text-xs text-red-600"> | 109 | <span class="text-xs text-red-600"> |
108 | {{ $message }} | 110 | {{ $message }} |
109 | </span> | 111 | </span> |
110 | @enderror | 112 | @enderror |
111 | </div> | 113 | </div> |
112 | </div> | 114 | </div> |
113 | 115 | ||
114 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 116 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
115 | <label class="form-group__label">Максимальная зарплата</label> | 117 | <label class="form-group__label">Максимальная зарплата</label> |
116 | <div class="form-group__item"> | 118 | <div class="form-group__item"> |
117 | <input type="text" class="input" name="max_salary" id="max_salary" value="{{ old('max_salary') ?? $ad_job->max_salary ?? '' }}" placeholder="Максимальная зарплата"> | 119 | <input type="text" class="input" name="max_salary" id="max_salary" value="{{ old('max_salary') ?? $ad_job->max_salary ?? '' }}" placeholder="Максимальная зарплата"> |
118 | @error('salary') | 120 | @error('salary') |
119 | <span class="text-xs text-red-600 dark:text-red-400"> | 121 | <span class="text-xs text-red-600 dark:text-red-400"> |
120 | {{ $message }} | 122 | {{ $message }} |
121 | </span> | 123 | </span> |
122 | @enderror | 124 | @enderror |
123 | </div> | 125 | </div> |
124 | </div> | 126 | </div> |
125 | 127 | ||
126 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 128 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
127 | <label class="form-group__label">Регион отплытия</label> | 129 | <label class="form-group__label">Регион отплытия</label> |
128 | <div class="form-group__item"> | 130 | <div class="form-group__item"> |
129 | <input type="text" class="input" name="region" id="region" value="{{ old('region') ?? $ad_job->region ?? '' }}" placeholder="Севастополь"> | 131 | <input type="text" class="input" name="region" id="region" value="{{ old('region') ?? $ad_job->region ?? '' }}" placeholder="Севастополь"> |
130 | @error('region') | 132 | @error('region') |
131 | <span class="text-xs text-red-600"> | 133 | <span class="text-xs text-red-600"> |
132 | {{ $message }} | 134 | {{ $message }} |
133 | </span> | 135 | </span> |
134 | @enderror | 136 | @enderror |
135 | </div> | 137 | </div> |
136 | </div> | 138 | </div> |
137 | 139 | ||
138 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 140 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
139 | <label class="form-group__label">Мощность</label> | 141 | <label class="form-group__label">Мощность</label> |
140 | <div class="form-group__item"> | 142 | <div class="form-group__item"> |
141 | <input type="text" class="input" name="power" id="power" value="{{ old('power') ?? $ad_job->power ?? '' }}" placeholder="POWER-45"> | 143 | <input type="text" class="input" name="power" id="power" value="{{ old('power') ?? $ad_job->power ?? '' }}" placeholder="POWER-45"> |
142 | @error('power') | 144 | @error('power') |
143 | <span class="text-xs text-red-600"> | 145 | <span class="text-xs text-red-600"> |
144 | {{ $message }} | 146 | {{ $message }} |
145 | </span> | 147 | </span> |
146 | @enderror | 148 | @enderror |
147 | </div> | 149 | </div> |
148 | </div> | 150 | </div> |
149 | 151 | ||
150 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 152 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
151 | <label class="form-group__label">Суточные выплаты</label> | 153 | <label class="form-group__label">Суточные выплаты</label> |
152 | <div class="form-group__item"> | 154 | <div class="form-group__item"> |
153 | <input type="text" class="input" name="sytki" id="sytki" value="{{ old('sytki') ?? $ad_job->sytki ??'' }}" placeholder="2000"> | 155 | <input type="text" class="input" name="sytki" id="sytki" value="{{ old('sytki') ?? $ad_job->sytki ??'' }}" placeholder="2000"> |
154 | @error('power') | 156 | @error('power') |
155 | <span class="text-xs text-red-600"> | 157 | <span class="text-xs text-red-600"> |
156 | {{ $message }} | 158 | {{ $message }} |
157 | </span> | 159 | </span> |
158 | @enderror | 160 | @enderror |
159 | </div> | 161 | </div> |
160 | </div> | 162 | </div> |
161 | 163 | ||
162 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 164 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
163 | <label class="form-group__label">Начало отплытия</label> | 165 | <label class="form-group__label">Начало отплытия</label> |
164 | <div class="form-group__item"> | 166 | <div class="form-group__item"> |
165 | <input type="text" class="input" name="start" id="start" value="{{ old('start') ?? $ad_job->start ??'' }}" placeholder="20 сентября 2024"> | 167 | <input type="text" class="input" name="start" id="start" value="{{ old('start') ?? $ad_job->start ??'' }}" placeholder="20 сентября 2024"> |
166 | @error('power') | 168 | @error('power') |
167 | <span class="text-xs text-red-600"> | 169 | <span class="text-xs text-red-600"> |
168 | {{ $message }} | 170 | {{ $message }} |
169 | </span> | 171 | </span> |
170 | @enderror | 172 | @enderror |
171 | </div> | 173 | </div> |
172 | </div> | 174 | </div> |
173 | 175 | ||
174 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 176 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
175 | <label class="form-group__label">Корабль для посадки</label> | 177 | <label class="form-group__label">Корабль для посадки</label> |
176 | <div class="form-group__item"> | 178 | <div class="form-group__item"> |
177 | <div class="select"> | 179 | <div class="select"> |
178 | <select class="js-select2" name="flot" id="flot"> | 180 | <select class="js-select2" name="flot" id="flot"> |
179 | <option value=""> Не указан корабль</option> | 181 | <option value=""> Не указан корабль</option> |
180 | @if ($Employer->flots->count()) | 182 | @if ($Employer->flots->count()) |
181 | @foreach($Employer->flots as $j) | 183 | @foreach($Employer->flots as $j) |
182 | <option value="{{ $j->name }}" @if ($ad_job->flot == $j->name) selected @endif>{{ $j->name }} ({{ $j->id }})</option> | 184 | <option value="{{ $j->name }}" @if ($ad_job->flot == $j->name) selected @endif>{{ $j->name }} ({{ $j->id }})</option> |
183 | @endforeach | 185 | @endforeach |
184 | @endif | 186 | @endif |
185 | </select> | 187 | </select> |
186 | @error('flot') | 188 | @error('flot') |
187 | <span class="text-xs text-red-600"> | 189 | <span class="text-xs text-red-600"> |
188 | {{ $message }} | 190 | {{ $message }} |
189 | </span> | 191 | </span> |
190 | @enderror | 192 | @enderror |
191 | </div> | 193 | </div> |
192 | </div> | 194 | </div> |
193 | </div> | 195 | </div> |
194 | 196 | ||
195 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 197 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
196 | <label class="form-group__label">Дополнительная информация</label> | 198 | <label class="form-group__label">Дополнительная информация</label> |
197 | <div class="form-group__item"> | 199 | <div class="form-group__item"> |
198 | <textarea class="textarea" name="description" id="description">{{ old('description') ??$ad_job->description ?? '' }}</textarea> | 200 | <textarea class="textarea" name="description" id="description">{{ old('description') ??$ad_job->description ?? '' }}</textarea> |
199 | @error('description') | 201 | @error('description') |
200 | <span class="text-xs text-red-600"> | 202 | <span class="text-xs text-red-600"> |
201 | {{ $message }} | 203 | {{ $message }} |
202 | </span> | 204 | </span> |
203 | @enderror | 205 | @enderror |
204 | </div> | 206 | </div> |
205 | </div> | 207 | </div> |
206 | 208 | ||
207 | <button type="submit" class="button cabinet__submit">Опубликовать</button> | 209 | <button type="submit" class="button cabinet__submit">Опубликовать</button> |
208 | </form> | 210 | </form> |
209 | </div> | 211 | </div> |
210 | </div> | 212 | </div> |
211 | </section> | 213 | </section> |
212 | </div> | 214 | </div> |
213 | @endsection | 215 | @endsection |
214 | 216 |
resources/views/employers/list_vacancy.blade.php
1 | @extends('layout.frontend', ['title' => 'Список вакансий - РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Список вакансий - РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | <script> | 4 | <script> |
5 | console.log('Test system'); | 5 | console.log('Test system'); |
6 | $(document).on('change', '#sort_ajax', function() { | 6 | $(document).on('change', '#sort_ajax', function() { |
7 | var this_ = $(this); | 7 | var this_ = $(this); |
8 | var val_ = this_.val(); | 8 | var val_ = this_.val(); |
9 | console.log('sort items '+val_); | 9 | console.log('sort items '+val_); |
10 | 10 | ||
11 | $.ajax({ | 11 | $.ajax({ |
12 | type: "GET", | 12 | type: "GET", |
13 | url: "{{ route('employer.vacancy_list') }}", | 13 | url: "{{ url()->current() }}", |
14 | data: "sort="+val_, | 14 | data: "sort="+val_+"&search=@if ((isset($_GET['search']))&&(!empty($_GET['search']))){{$_GET['search']}}@endif", |
15 | success: function (data) { | 15 | success: function (data) { |
16 | console.log('Выбор сортировки'); | 16 | console.log('Выбор сортировки'); |
17 | console.log(data); | 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 | $('#main_ockar').html(data); | 19 | $('#main_ockar').html(data); |
20 | }, | 20 | }, |
21 | headers: { | 21 | headers: { |
22 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 22 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
23 | }, | 23 | }, |
24 | error: function (data) { | 24 | error: function (data) { |
25 | data = JSON.stringify(data); | 25 | data = JSON.stringify(data); |
26 | console.log('Error: ' + data); | 26 | console.log('Error: ' + data); |
27 | } | 27 | } |
28 | }); | 28 | }); |
29 | }); | 29 | }); |
30 | </script> | 30 | </script> |
31 | @endsection | 31 | @endsection |
32 | 32 | ||
33 | @section('content') | 33 | @section('content') |
34 | <section class="cabinet"> | 34 | <section class="cabinet"> |
35 | <div class="container"> | 35 | <div class="container"> |
36 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 36 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
37 | <li><a href="{{ route('index') }}">Главная</a></li> | 37 | <li><a href="{{ route('index') }}">Главная</a></li> |
38 | <li><b>Личный кабинет</b></li> | 38 | <li><b>Личный кабинет</b></li> |
39 | </ul> | 39 | </ul> |
40 | <div class="cabinet__wrapper"> | 40 | <div class="cabinet__wrapper"> |
41 | <div class="cabinet__side"> | 41 | <div class="cabinet__side"> |
42 | <div class="cabinet__side-toper"> | 42 | <div class="cabinet__side-toper"> |
43 | 43 | ||
44 | @include('employers.emblema') | 44 | @include('employers.emblema') |
45 | 45 | ||
46 | </div> | 46 | </div> |
47 | 47 | ||
48 | @include('employers.menu', ['item' => 3]) | 48 | @include('employers.menu', ['item' => 3]) |
49 | </div> | 49 | </div> |
50 | <div class="cabinet__body"> | 50 | <div class="cabinet__body"> |
51 | <div class="cabinet__body-item"> | 51 | <div class="cabinet__body-item"> |
52 | <h2 class="title cabinet__title">Мои вакансии</h2> | 52 | <h2 class="title cabinet__title">Мои вакансии</h2> |
53 | </div> | 53 | </div> |
54 | <div class="cabinet__body-item"> | 54 | <div class="cabinet__body-item"> |
55 | <div class="cabinet__filters"> | 55 | <div class="cabinet__filters"> |
56 | <div class="cabinet__filters-item"> | 56 | <div class="cabinet__filters-item"> |
57 | <form class="search"> | 57 | <form class="search" action="{{ url()->current() }}" method="GET"> |
58 | <input type="search" class="input" placeholder="Поиск…" required> | 58 | <input type="search" name="search" class="input" placeholder="Поиск…" value="@if ((isset($_GET['search'])) && (!empty($_GET['search']))) {{ $_GET['search'] }}@endif"> |
59 | <button type="submit" class="button">Найти</button> | 59 | <button type="submit" class="button">Найти</button> |
60 | <span> | 60 | <span> |
61 | <svg> | 61 | <svg> |
62 | <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> | 62 | <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> |
63 | </svg> | 63 | </svg> |
64 | </span> | 64 | </span> |
65 | </form> | 65 | </form> |
66 | </div> | 66 | </div> |
67 | <div class="cabinet__filters-item"> | 67 | <div class="cabinet__filters-item"> |
68 | <div class="select"> | 68 | <div class="select"> |
69 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> | 69 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> |
70 | <option value="default">Сортировка (по умолчанию)</option> | 70 | <option value="default">Сортировка (по умолчанию)</option> |
71 | <option value="name_up">По имени (возрастание)</option> | 71 | <option value="name_up">По имени (возрастание)</option> |
72 | <option value="name_down">По имени (убывание)</option> | 72 | <option value="name_down">По имени (убывание)</option> |
73 | <option value="created_at_up">По дате (возрастание)</option> | 73 | <option value="created_at_up">По дате (возрастание)</option> |
74 | <option value="created_at_down">По дате (убывание)</option> | 74 | <option value="created_at_down">По дате (убывание)</option> |
75 | </select> | 75 | </select> |
76 | </div> | 76 | </div> |
77 | </div> | 77 | </div> |
78 | </div> | 78 | </div> |
79 | 79 | ||
80 | <div class="table table_spoiler" id="main_ockar" name="main_oskar"> | 80 | <div class="table table_spoiler" id="main_ockar" name="main_oskar"> |
81 | @if ($vacancy_list->count()) | 81 | @if ($vacancy_list->count()) |
82 | <div class="table__scroll"> | 82 | <div class="table__scroll"> |
83 | <div class="table__body table__body_min-width"> | 83 | <div class="table__body table__body_min-width"> |
84 | <table> | 84 | <table> |
85 | <thead> | 85 | <thead> |
86 | <tr> | 86 | <tr> |
87 | <th>№</th> | 87 | <th>№</th> |
88 | <th>Название</th> | 88 | <th>Название</th> |
89 | <th>Дата добавления<br>/ обновления</th> | 89 | <th>Дата добавления<br>/ обновления</th> |
90 | <th style="display:none">Должности</th> | 90 | <th style="display:none">Должности</th> |
91 | <th>Статус</th> | 91 | <th>Статус</th> |
92 | <th>Действия</th> | 92 | <th>Действия</th> |
93 | </tr> | 93 | </tr> |
94 | </thead> | 94 | </thead> |
95 | <tbody> | 95 | <tbody> |
96 | @foreach($vacancy_list as $it) | 96 | @foreach($vacancy_list as $it) |
97 | <tr> | 97 | <tr> |
98 | <td>{{ $it->id }}</td> | 98 | <td>{{ $it->id }}</td> |
99 | <td>{{ $it->name }}</td> | 99 | <td>{{ $it->name }}</td> |
100 | <td>{{ date('d.m.Y', strtotime($it->created_at)) }} <br>/ {{ date('d.m.Y', strtotime($it->updated_at)) }}</td> | 100 | <td>{{ date('d.m.Y', strtotime($it->created_at)) }} <br>/ {{ date('d.m.Y', strtotime($it->updated_at)) }}</td> |
101 | <td style="display:none"> <a href="{{ route('employer.add_job_in_vac', ['ad_employer' => $it->id]) }}" class="button">Добавить</a> | 101 | <td style="display:none"> <a href="{{ route('employer.add_job_in_vac', ['ad_employer' => $it->id]) }}" class="button">Добавить</a> |
102 | 102 | ||
103 | @if ($it->jobs->count()) | 103 | @if ($it->jobs->count()) |
104 | @foreach ($it->jobs as $key => $it_um) | 104 | @foreach ($it->jobs as $key => $it_um) |
105 | <p>@if (isset($it->jobs_code[$key])) | 105 | <p>@if (isset($it->jobs_code[$key])) |
106 | <a href="{{ route('employer.edit_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id, 'ad_employer' => $it->id, 'job_title_id' => $it_um->id]) }}" style="text-decoration: underline">{{$it_um->name}}</a> | 106 | <a href="{{ route('employer.edit_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id, 'ad_employer' => $it->id, 'job_title_id' => $it_um->id]) }}" style="text-decoration: underline">{{$it_um->name}}</a> |
107 | <a href="{{ route('employer.delete_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id]) }}" style="text-decoration: underline">(Del)</a> | 107 | <a href="{{ route('employer.delete_job_in_vac', ['ad_job' => $it->jobs_code[$key]->id]) }}" style="text-decoration: underline">(Del)</a> |
108 | @endif | 108 | @endif |
109 | </p> | 109 | </p> |
110 | @endforeach | 110 | @endforeach |
111 | @else | 111 | @else |
112 | Нет связанных <br> с вакансией должностей | 112 | Нет связанных <br> с вакансией должностей |
113 | @endif | 113 | @endif |
114 | </td> | 114 | </td> |
115 | <td> | 115 | <td> |
116 | @if ($it->active_is) | 116 | @if ($it->active_is) |
117 | <span class="table__status green"><i></i>Опубликовано</span> | 117 | <span class="table__status green"><i></i>Опубликовано</span> |
118 | @else | 118 | @else |
119 | <span class="table__status"><i></i>Не опубликовано</span> | 119 | <span class="table__status"><i></i>Не опубликовано</span> |
120 | @endif | 120 | @endif |
121 | </td> | 121 | </td> |
122 | <td> | 122 | <td> |
123 | <span class="table__controls"> | 123 | <span class="table__controls"> |
124 | <a class="table__controls-item up-it" href="{{ route('employer.vacancy_up', ['ad_employer' => $it->id]) }}"> | 124 | <a class="table__controls-item up-it" href="{{ route('employer.vacancy_up', ['ad_employer' => $it->id]) }}"> |
125 | <svg> | 125 | <svg> |
126 | <use xlink:href="{{ asset('images/sprite.svg#arrow-radius') }}"></use> | 126 | <use xlink:href="{{ asset('images/sprite.svg#arrow-radius') }}"></use> |
127 | </svg> | 127 | </svg> |
128 | </a> | 128 | </a> |
129 | <a href="{{ route('employer.vacancy_edit', ['ad_employer' => $it->id]) }}" class="table__controls-item"> | 129 | <a href="{{ route('employer.vacancy_edit', ['ad_employer' => $it->id]) }}" class="table__controls-item"> |
130 | <svg> | 130 | <svg> |
131 | <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use> | 131 | <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use> |
132 | </svg> | 132 | </svg> |
133 | </a> | 133 | </a> |
134 | <a class="table__controls-item" href="{{ route('employer.vacancy_delete', ['ad_employer' => $it->id]) }}"> | 134 | <a class="table__controls-item" href="{{ route('employer.vacancy_delete', ['ad_employer' => $it->id]) }}"> |
135 | <svg> | 135 | <svg> |
136 | <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use> | 136 | <use xlink:href="{{ asset('images/sprite.svg#cross') }}"></use> |
137 | </svg> | 137 | </svg> |
138 | </a> | 138 | </a> |
139 | @if ($it->active_is) | 139 | @if ($it->active_is) |
140 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 0]) }}" class="table__controls-item"> | 140 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 0]) }}" class="table__controls-item"> |
141 | <svg> | 141 | <svg> |
142 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> | 142 | <use xlink:href="{{ asset('images/sprite.svg#eye') }}"></use> |
143 | </svg> | 143 | </svg> |
144 | </a> | 144 | </a> |
145 | @else | 145 | @else |
146 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 1]) }}" class="table__controls-item"> | 146 | <a href="{{ route('employer.vacancy_eye', ['ad_employer' => $it->id, 'status' => 1]) }}" class="table__controls-item"> |
147 | <svg> | 147 | <svg> |
148 | <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use> | 148 | <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use> |
149 | </svg> | 149 | </svg> |
150 | </a> | 150 | </a> |
151 | @endif | 151 | @endif |
152 | @if ($Employer->social_is == 1) | 152 | @if ($Employer->social_is == 1) |
153 | <a href="https://telegram.me/share/url?url={{ route('vacancie', ['vacancy' => $it->id]) }}&text={{ $it->text }}" class="table__controls-item"> | 153 | <a href="https://telegram.me/share/url?url={{ route('vacancie', ['vacancy' => $it->id]) }}&text={{ $it->text }}" class="table__controls-item"> |
154 | <svg> | 154 | <svg> |
155 | <use xlink:href="{{ asset('images/sprite.svg#tg') }}"></use> | 155 | <use xlink:href="{{ asset('images/sprite.svg#tg') }}"></use> |
156 | </svg> | 156 | </svg> |
157 | </a> | 157 | </a> |
158 | @endif | 158 | @endif |
159 | <!--<a class="btn_telegram_share table__controls-item" href="https://telegram.me/share/url?url=ВАШ_URL&text={{ $it->name }}"> | 159 | <!--<a class="btn_telegram_share table__controls-item" href="https://telegram.me/share/url?url=ВАШ_URL&text={{ $it->name }}"> |
160 | <svg> | 160 | <svg> |
161 | <use xlink:href=" asset('images/sprite.svg#arrow-radius') }}"></use> | 161 | <use xlink:href=" asset('images/sprite.svg#arrow-radius') }}"></use> |
162 | </svg> | 162 | </svg> |
163 | </a>--> | 163 | </a>--> |
164 | 164 | ||
165 | <!--<button type="button" class="table__controls-item"> | 165 | <!--<button type="button" class="table__controls-item"> |
166 | <svg> | 166 | <svg> |
167 | <use xlink:href=" asset('images/sprite.svg#tg') }}"></use> | 167 | <use xlink:href=" asset('images/sprite.svg#tg') }}"></use> |
168 | </svg> | 168 | </svg> |
169 | </button> | 169 | </button> |
170 | --> | 170 | --> |
171 | </span> | 171 | </span> |
172 | </td> | 172 | </td> |
173 | </tr> | 173 | </tr> |
174 | @endforeach | 174 | @endforeach |
175 | </tbody> | 175 | </tbody> |
176 | </table> | 176 | </table> |
177 | </div><br> | 177 | </div><br> |
178 | {{ $vacancy_list->appends($_GET)->links('paginate') }} | 178 | {{ $vacancy_list->appends($_GET)->links('paginate') }} |
179 | </div> | 179 | </div> |
180 | 180 | ||
181 | 181 | ||
182 | @else | 182 | @else |
183 | 183 | ||
184 | <div class="notify"> | 184 | <div class="notify"> |
185 | <svg> | 185 | <svg> |
186 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> | 186 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> |
187 | </svg> | 187 | </svg> |
188 | <span>Вы ещё не разместили ни одной вакансии</span> | 188 | <span>Вы ещё не разместили ни одной вакансии</span> |
189 | </div> | 189 | </div> |
190 | @endif | 190 | @endif |
191 | </div> | 191 | </div> |
192 | </div> | 192 | </div> |
193 | </div> | 193 | </div> |
194 | </div> | 194 | </div> |
195 | </div> | 195 | </div> |
196 | </section> | 196 | </section> |
197 | </div> | 197 | </div> |
198 | @endsection | 198 | @endsection |
199 | 199 |