Commit 5da8a8bd46493ff27777b197b70e161eb41ad61e

Authored by Fedor K
Exists in master

Merge branch 'task-132985' into 'master'

task-132985 autoresponder & autolift added to worker cabinet

Showing 23 changed files Inline Diff

app/Console/Commands/DeleteExpiredAutoliftOptions.php
1 <?php 1 <?php
2 2
3 namespace App\Console\Commands; 3 namespace App\Console\Commands;
4 4
5 use App\Models\EmployerAutoliftOption; 5 use App\Models\EmployerAutoliftOption;
6 use App\Models\WorkerAutoliftOption;
6 use Illuminate\Console\Command; 7 use Illuminate\Console\Command;
7 8
8 class DeleteExpiredAutoliftOptions extends Command 9 class DeleteExpiredAutoliftOptions extends Command
9 { 10 {
10 protected $signature = 'vacancy:delete_expired'; 11 protected $signature = 'vacancy:delete_expired';
11 12
12 protected $description = 'Command description'; 13 protected $description = 'Command description';
13 14
14 public function handle() 15 public function handle()
15 { 16 {
16 EmployerAutoliftOption::query() 17 EmployerAutoliftOption::query()
17 ->whereRaw('`updated_at` < DATE_SUB(NOW(), INTERVAL `days_repeat` DAY)') 18 ->whereRaw('`updated_at` < DATE_SUB(NOW(), INTERVAL `days_repeat` DAY)')
18 ->update([ 19 ->update([
19 'is_enabled' => false 20 'is_enabled' => false
20 ]); 21 ]);
22 WorkerAutoliftOption::query()
23 ->whereRaw('`updated_at` < DATE_SUB(NOW(), INTERVAL `days_repeat` DAY)')
24 ->update([
25 'is_enabled' => false
26 ]);
21 return Command::SUCCESS; 27 return Command::SUCCESS;
22 } 28 }
23 } 29 }
24 30
app/Console/Commands/DispatchResumeLiftJobCommand.php
File was created 1 <?php
2
3 namespace App\Console\Commands;
4
5 use App\Jobs\LiftVacancyJob;
6 use App\Jobs\SendVacancyToTelegramJob;
7 use App\Models\EmployerAutoliftOption;
8 use App\Models\WorkerAutoliftOption;
9 use Illuminate\Console\Command;
10
11 class DispatchResumeLiftJobCommand extends Command
12 {
13 protected $signature ='resume:dispatch';
14
15 public function handle()
16 {
17 $now = now()->timezone('Europe/Moscow')->format('H:i');
18
19 $employers = WorkerAutoliftOption::query()
20 ->where(function ($query) use ($now) {
21 $query->where('times_per_day', 1)
22 ->where('time_send_first', $now);
23 })
24 ->orWhere(function ($query) use ($now) {
25 $query->where('times_per_day', 2)
26 ->where('time_send_first', $now)
27 ->where('time_send_second', $now);
28 })
29 ->orWhere(function ($query) use ($now) {
30 $query->where('times_per_day', 3)
31 ->where('time_send_first', $now)
32 ->where('time_send_second', $now)
33 ->where('time_send_third', $now);
34 })
35 ->get();
36
37 LiftVacancyJob::dispatch($employers->pluck('employer_id')->toArray());
38
39 return Command::SUCCESS;
40 }
41 }
42
app/Console/Commands/DispatchVacancyLiftJobCommand.php
1 <?php 1 <?php
2 2
3 namespace App\Console\Commands; 3 namespace App\Console\Commands;
4 4
5 use App\Jobs\LiftVacancyJob; 5 use App\Jobs\LiftVacancyJob;
6 use App\Jobs\SendVacancyToTelegramJob; 6 use App\Jobs\SendVacancyToTelegramJob;
7 use App\Models\EmployerAutoliftOption; 7 use App\Models\EmployerAutoliftOption;
8 use Illuminate\Console\Command; 8 use Illuminate\Console\Command;
9 9
10 class DispatchVacancyLiftJobCommand extends Command 10 class DispatchVacancyLiftJobCommand extends Command
11 { 11 {
12 protected $signature ='vacancy:dispatch'; 12 protected $signature ='vacancy:dispatch';
13 13
14 public function handle() 14 public function handle()
15 { 15 {
16 $now = now()->format('H:i'); 16 $now = now()->timezone('Europe/Moscow')->format('H:i');
17 17
18 $employers = EmployerAutoliftOption::query() 18 $employers = EmployerAutoliftOption::query()
19 ->where(function ($query) use ($now) { 19 ->where(function ($query) use ($now) {
20 $query->where('times_per_day', 1) 20 $query->where('times_per_day', 1)
21 ->where('time_send_first', $now); 21 ->where('time_send_first', $now);
22 }) 22 })
23 ->orWhere(function ($query) use ($now) { 23 ->orWhere(function ($query) use ($now) {
24 $query->where('times_per_day', 2) 24 $query->where('times_per_day', 2)
25 ->where('time_send_first', $now) 25 ->where('time_send_first', $now)
26 ->where('time_send_second', $now); 26 ->where('time_send_second', $now);
27 }) 27 })
28 ->orWhere(function ($query) use ($now) { 28 ->orWhere(function ($query) use ($now) {
29 $query->where('times_per_day', 3) 29 $query->where('times_per_day', 3)
30 ->where('time_send_first', $now) 30 ->where('time_send_first', $now)
31 ->where('time_send_second', $now) 31 ->where('time_send_second', $now)
32 ->where('time_send_third', $now); 32 ->where('time_send_third', $now);
33 }) 33 })
34 ->orWhere('time_send_tg', $now) 34 ->orWhere('time_send_tg', $now)
35 ->get(); 35 ->get();
36 36
37 LiftVacancyJob::dispatch( 37 LiftVacancyJob::dispatch(
38 $employers->whereNotNull('time_send_first')->pluck('employer_id')->toArray(), 38 $employers->whereNotNull('time_send_first')->pluck('employer_id')->toArray(),
39 ); 39 );
40 40
41 SendVacancyToTelegramJob::dispatch( 41 SendVacancyToTelegramJob::dispatch(
42 $employers->whereNotNull('time_send_tg')->pluck('employer_id')->toArray() 42 $employers->whereNotNull('time_send_tg')->pluck('employer_id')->toArray()
43 ); 43 );
44 44
45 return Command::SUCCESS; 45 return Command::SUCCESS;
46 } 46 }
47 } 47 }
48 48
app/Console/Kernel.php
1 <?php 1 <?php
2 2
3 namespace App\Console; 3 namespace App\Console;
4 4
5 use Illuminate\Console\Scheduling\Schedule; 5 use Illuminate\Console\Scheduling\Schedule;
6 use Illuminate\Foundation\Console\Kernel as ConsoleKernel; 6 use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
7 7
8 class Kernel extends ConsoleKernel 8 class Kernel extends ConsoleKernel
9 { 9 {
10 protected function schedule(Schedule $schedule) 10 protected function schedule(Schedule $schedule)
11 { 11 {
12 $schedule->command('vacancy:delete_expired')->dailyAt('00:00'); 12 $schedule->command('vacancy:delete_expired')->dailyAt('00:00');
13 $schedule->command('vacancy:dispatch')->everyMinute(); 13 $schedule->command('vacancy:dispatch')->everyMinute();
14 $schedule->command('resume:dispatch')->everyMinute();
14 } 15 }
15 16
16 protected function commands() 17 protected function commands()
17 { 18 {
18 $this->load(__DIR__.'/Commands'); 19 $this->load(__DIR__.'/Commands');
19 20
20 require base_path('routes/console.php'); 21 require base_path('routes/console.php');
21 } 22 }
22 } 23 }
23 24
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\FlotRequest; 8 use App\Http\Requests\FlotRequest;
9 use App\Http\Requests\MessagesRequiest; 9 use App\Http\Requests\MessagesRequiest;
10 use App\Http\Requests\VacancyRequestEdit; 10 use App\Http\Requests\VacancyRequestEdit;
11 use App\Mail\MailCreateEmployer; 11 use App\Mail\MailCreateEmployer;
12 use App\Mail\MailSotrudnichestvo; 12 use App\Mail\MailSotrudnichestvo;
13 use App\Mail\MassSendingMessages; 13 use App\Mail\MassSendingMessages;
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_response; 16 use App\Models\ad_response;
17 use App\Models\Category; 17 use App\Models\Category;
18 use App\Models\Chat; 18 use App\Models\Chat;
19 use App\Models\Employer; 19 use App\Models\Employer;
20 use App\Models\EmployerAutoliftOption; 20 use App\Models\EmployerAutoliftOption;
21 use App\Models\Flot; 21 use App\Models\Flot;
22 use App\Models\Job_title; 22 use App\Models\Job_title;
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\Worker; 25 use App\Models\Worker;
26 use App\Models\MessagesRequests; 26 use App\Models\MessagesRequests;
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\Http\RedirectResponse; 30 use Illuminate\Http\RedirectResponse;
31 use Illuminate\Http\Request; 31 use Illuminate\Http\Request;
32 use Illuminate\Support\Facades\Auth; 32 use Illuminate\Support\Facades\Auth;
33 use Illuminate\Support\Facades\Hash; 33 use Illuminate\Support\Facades\Hash;
34 use Illuminate\Support\Facades\Log; 34 use Illuminate\Support\Facades\Log;
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 use App\Enums\DbExportColumns; 39 use App\Enums\DbExportColumns;
40 use Illuminate\View\View; 40 use Illuminate\View\View;
41 use JsonException; 41 use JsonException;
42 use Throwable; 42 use Throwable;
43 43
44 class EmployerController extends Controller 44 class EmployerController extends Controller
45 { 45 {
46 public function vacancie($vacancy, Request $request) { 46 public function vacancie($vacancy, Request $request) {
47 $title = 'Заголовок вакансии'; 47 $title = 'Заголовок вакансии';
48 $Query = Ad_employer::with('jobs')-> 48 $Query = Ad_employer::with('jobs')->
49 with('cat')-> 49 with('cat')->
50 with('employer')-> 50 with('employer')->
51 with('jobs_code')-> 51 with('jobs_code')->
52 select('ad_employers.*')-> 52 select('ad_employers.*')->
53 where('id', '=', $vacancy)->get(); 53 where('id', '=', $vacancy)->get();
54 54
55 if (isset(Auth()->user()->id)) 55 if (isset(Auth()->user()->id))
56 $uid = Auth()->user()->id; 56 $uid = Auth()->user()->id;
57 else 57 else
58 $uid = 0; 58 $uid = 0;
59 $title = $Query[0]->name; 59 $title = $Query[0]->name;
60 if ($request->ajax()) { 60 if ($request->ajax()) {
61 return view('ajax.vacance-item', compact('Query','uid')); 61 return view('ajax.vacance-item', compact('Query','uid'));
62 } else { 62 } else {
63 return view('vacance-item', compact('title', 'Query', 'uid')); 63 return view('vacance-item', compact('title', 'Query', 'uid'));
64 } 64 }
65 } 65 }
66 66
67 public function logout() { 67 public function logout() {
68 Auth::logout(); 68 Auth::logout();
69 return redirect()->route('index') 69 return redirect()->route('index')
70 ->with('success', 'Вы вышли из личного кабинета'); 70 ->with('success', 'Вы вышли из личного кабинета');
71 } 71 }
72 72
73 public function employer_info() { 73 public function employer_info() {
74 // код юзера 74 // код юзера
75 $user_info = Auth()->user(); 75 $user_info = Auth()->user();
76 // вьюшка для вывода данных 76 // вьюшка для вывода данных
77 return view('employers.info', compact('user_info')); 77 return view('employers.info', compact('user_info'));
78 } 78 }
79 79
80 public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { 80 public function employer_info_save(User_Model $user, BaseUser_min_Request $request) {
81 // Все данные через реквест 81 // Все данные через реквест
82 $all = $request->all(); 82 $all = $request->all();
83 unset($all['_token']); 83 unset($all['_token']);
84 // обновление 84 // обновление
85 $user->update($all); 85 $user->update($all);
86 return redirect()->route('employer.employer_info'); 86 return redirect()->route('employer.employer_info');
87 } 87 }
88 88
89 public function cabinet() { 89 public function cabinet() {
90 $id = Auth()->user()->id; 90 $id = Auth()->user()->id;
91 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 91 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
92 WhereHas('users', 92 WhereHas('users',
93 function (Builder $query) use ($id) {$query->Where('id', $id); 93 function (Builder $query) use ($id) {$query->Where('id', $id);
94 })->get(); 94 })->get();
95 return view('employers.cabinet45', compact('Employer')); 95 return view('employers.cabinet45', compact('Employer'));
96 } 96 }
97 97
98 public function slider_flot() { 98 public function slider_flot() {
99 $id = Auth()->user()->id; 99 $id = Auth()->user()->id;
100 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 100 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
101 WhereHas('users', 101 WhereHas('users',
102 function (Builder $query) use ($id) {$query->Where('id', $id); 102 function (Builder $query) use ($id) {$query->Where('id', $id);
103 })->get(); 103 })->get();
104 return view('employers.fly-flot', compact('Employer')); 104 return view('employers.fly-flot', compact('Employer'));
105 } 105 }
106 106
107 public function cabinet_save(Employer $Employer, Request $request) { 107 public function cabinet_save(Employer $Employer, Request $request) {
108 $params = $request->all(); 108 $params = $request->all();
109 $params['user_id'] = Auth()->user()->id; 109 $params['user_id'] = Auth()->user()->id;
110 $id = $Employer->id; 110 $id = $Employer->id;
111 111
112 if ($request->has('logo')) { 112 if ($request->has('logo')) {
113 if (!empty($Employer->logo)) { 113 if (!empty($Employer->logo)) {
114 Storage::delete($Employer->logo); 114 Storage::delete($Employer->logo);
115 } 115 }
116 $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); 116 $params['logo'] = $request->file('logo')->store("employer/$id", 'public');
117 } 117 }
118 118
119 $Employer->update($params); 119 $Employer->update($params);
120 120
121 return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); 121 return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены');
122 } 122 }
123 123
124 public function save_add_flot(FlotRequest $request) { 124 public function save_add_flot(FlotRequest $request) {
125 // отмена 125 // отмена
126 $params = $request->all(); 126 $params = $request->all();
127 127
128 if ($request->has('image')) { 128 if ($request->has('image')) {
129 $params['image'] = $request->file('image')->store("flot", 'public'); 129 $params['image'] = $request->file('image')->store("flot", 'public');
130 } 130 }
131 Flot::create($params); 131 Flot::create($params);
132 $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); 132 $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get();
133 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); 133 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен');
134 } 134 }
135 135
136 public function edit_flot(Flot $Flot, Employer $Employer) { 136 public function edit_flot(Flot $Flot, Employer $Employer) {
137 return view('employers.edit-flot', compact('Flot', 'Employer')); 137 return view('employers.edit-flot', compact('Flot', 'Employer'));
138 } 138 }
139 139
140 public function update_flot(FlotRequest $request, Flot $Flot) { 140 public function update_flot(FlotRequest $request, Flot $Flot) {
141 $params = $request->all(); 141 $params = $request->all();
142 142
143 if ($request->has('image')) { 143 if ($request->has('image')) {
144 if (!empty($flot->image)) { 144 if (!empty($flot->image)) {
145 Storage::delete($flot->image); 145 Storage::delete($flot->image);
146 } 146 }
147 $params['image'] = $request->file('image')->store("flot", 'public'); 147 $params['image'] = $request->file('image')->store("flot", 'public');
148 } else { 148 } else {
149 if (!empty($flot->image)) $params['image'] = $flot->image; 149 if (!empty($flot->image)) $params['image'] = $flot->image;
150 } 150 }
151 151
152 $Flot->update($params); 152 $Flot->update($params);
153 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); 153 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен');
154 } 154 }
155 155
156 public function delete_flot(Flot $Flot) { 156 public function delete_flot(Flot $Flot) {
157 $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); 157 $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get();
158 158
159 if (isset($Flot->id)) $Flot->delete(); 159 if (isset($Flot->id)) $Flot->delete();
160 return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); 160 return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален');
161 } 161 }
162 162
163 // Форма добавления вакансий 163 // Форма добавления вакансий
164 public function cabinet_vacancie() { 164 public function cabinet_vacancie() {
165 /** @var User_Model $user */ 165 /** @var User_Model $user */
166 $user = Auth()->user(); 166 $user = Auth()->user();
167 167
168 if ($user->is_public) { 168 if ($user->is_public) {
169 $categories = Category::query()->active()->get(); 169 $categories = Category::query()->active()->get();
170 170
171 $jobs = Job_title::query() 171 $jobs = Job_title::query()
172 ->orderByDesc('sort') 172 ->orderByDesc('sort')
173 ->OrderBy('name') 173 ->OrderBy('name')
174 ->where('is_remove', '=', '0') 174 ->where('is_remove', '=', '0')
175 ->where('is_bd', '=', '0') 175 ->where('is_bd', '=', '0')
176 ->get(); 176 ->get();
177 177
178 $Employer = Employer::query() 178 $Employer = Employer::query()
179 ->with(['users', 'ads', 'flots']) 179 ->with(['users', 'ads', 'flots'])
180 ->whereHas('users', fn (Builder $query) => $query->where('id', $user->id)) 180 ->whereHas('users', fn (Builder $query) => $query->where('id', $user->id))
181 ->get(); 181 ->get();
182 182
183 return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); 183 return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories'));
184 } 184 }
185 185
186 return redirect()->route('employer.cabinet_vacancie_danger'); 186 return redirect()->route('employer.cabinet_vacancie_danger');
187 } 187 }
188 188
189 // Форма предупреждения об оплате 189 // Форма предупреждения об оплате
190 public function cabinet_vacancie_danger() { 190 public function cabinet_vacancie_danger() {
191 return view('employers.add_vacancy_danger'); 191 return view('employers.add_vacancy_danger');
192 } 192 }
193 193
194 // Сохранение вакансии 194 // Сохранение вакансии
195 public function cabinet_vacancy_save1(VacancyRequestEdit $request) { 195 public function cabinet_vacancy_save1(VacancyRequestEdit $request) {
196 $params_emp = $request->all(); 196 $params_emp = $request->all();
197 197
198 $params_job["job_title_id"] = $params_emp['job_title_id']; 198 $params_job["job_title_id"] = $params_emp['job_title_id'];
199 199
200 $ad_jobs = Ad_employer::create($params_emp); 200 $ad_jobs = Ad_employer::create($params_emp);
201 $ad_jobs->jobs()->sync($request->get('job_title_id')); 201 $ad_jobs->jobs()->sync($request->get('job_title_id'));
202 202
203 return redirect()->route('employer.vacancy_list'); 203 return redirect()->route('employer.vacancy_list');
204 } 204 }
205 205
206 // Список вакансий 206 // Список вакансий
207 public function vacancy_list(Request $request) { 207 public function vacancy_list(Request $request) {
208 $id = Auth()->user()->id; 208 $id = Auth()->user()->id;
209 209
210 $Employer = Employer::query()->where('user_id', $id)->first(); 210 $Employer = Employer::query()->where('user_id', $id)->first();
211 $vacancy_list = Ad_employer::query() 211 $vacancy_list = Ad_employer::query()
212 ->with('jobs') 212 ->with('jobs')
213 ->with('jobs_code') 213 ->with('jobs_code')
214 ->where('employer_id', $Employer->id) 214 ->where('employer_id', $Employer->id)
215 ->where('is_remove', 0) 215 ->where('is_remove', 0)
216 ->orderbyDesc('updated_at') 216 ->orderbyDesc('updated_at')
217 ; 217 ;
218 218
219 if (($request->has('search')) && (!empty($request->get('search')))) { 219 if (($request->has('search')) && (!empty($request->get('search')))) {
220 $search = $request->get('search'); 220 $search = $request->get('search');
221 $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%"); 221 $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%");
222 } 222 }
223 223
224 if ($request->get('sort')) { 224 if ($request->get('sort')) {
225 $sort = $request->get('sort'); 225 $sort = $request->get('sort');
226 switch ($sort) { 226 switch ($sort) {
227 case 'nopublic': $vacancy_list->orderByDesc('updated_at') 227 case 'nopublic': $vacancy_list->orderByDesc('updated_at')
228 ->where('active_is', 0); 228 ->where('active_is', 0);
229 break; 229 break;
230 case 'public': $vacancy_list->orderByDesc('updated_at') 230 case 'public': $vacancy_list->orderByDesc('updated_at')
231 ->where('active_is',1); 231 ->where('active_is',1);
232 break; 232 break;
233 default: $vacancy_list->orderByDesc('updated_at'); 233 default: $vacancy_list->orderByDesc('updated_at');
234 break; 234 break;
235 } 235 }
236 } else { 236 } else {
237 $vacancy_list = $vacancy_list->orderByDesc('updated_at')->orderBy('id'); 237 $vacancy_list = $vacancy_list->orderByDesc('updated_at')->orderBy('id');
238 } 238 }
239 239
240 $vacancy_list = $vacancy_list->paginate(10); 240 $vacancy_list = $vacancy_list->paginate(10);
241 241
242 if ($request->ajax()) { 242 if ($request->ajax()) {
243 return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); 243 return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer'));
244 } else { 244 } else {
245 return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); 245 return view('employers.list_vacancy', compact('vacancy_list', 'Employer'));
246 } 246 }
247 } 247 }
248 248
249 // Карточка вакансии 249 // Карточка вакансии
250 public function vacancy_edit(Ad_employer $ad_employer) { 250 public function vacancy_edit(Ad_employer $ad_employer) {
251 $id = Auth()->user()->id; 251 $id = Auth()->user()->id;
252 $Positions = Category::query()->where('is_remove', '=', '0')->get(); 252 $Positions = Category::query()->where('is_remove', '=', '0')->get();
253 253
254 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> 254 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')->
255 where('is_remove', '=', '0')-> 255 where('is_remove', '=', '0')->
256 where('is_bd', '=', '0')->get(); 256 where('is_bd', '=', '0')->get();
257 257
258 $Employer = Employer::query()->with('users')->with('ads')-> 258 $Employer = Employer::query()->with('users')->with('ads')->
259 with('flots')->where('user_id', $id)->first(); 259 with('flots')->where('user_id', $id)->first();
260 260
261 return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); 261 return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs'));
262 } 262 }
263 263
264 // Сохранение-редактирование записи 264 // Сохранение-редактирование записи
265 public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { 265 public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) {
266 $params = $request->all(); 266 $params = $request->all();
267 $params_job["job_title_id"] = $params['job_title_id']; 267 $params_job["job_title_id"] = $params['job_title_id'];
268 268
269 $ad_employer->update($params); 269 $ad_employer->update($params);
270 $ad_employer->jobs()->sync($request->get('job_title_id')); 270 $ad_employer->jobs()->sync($request->get('job_title_id'));
271 271
272 $id = Auth()->user()->id; 272 $id = Auth()->user()->id;
273 $Positions = Category::query()->where('is_remove', '=', '0')->get(); 273 $Positions = Category::query()->where('is_remove', '=', '0')->get();
274 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name') 274 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')
275 ->where('is_remove', '=', '0') 275 ->where('is_remove', '=', '0')
276 ->where('is_bd', '=', '0') 276 ->where('is_bd', '=', '0')
277 ->get(); 277 ->get();
278 278
279 $Employer = Employer::query() 279 $Employer = Employer::query()
280 ->with('users')->with('ads')->with('flots')->where('user_id', $id)->first(); 280 ->with('users')->with('ads')->with('flots')->where('user_id', $id)->first();
281 return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); 281 return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs'));
282 } 282 }
283 283
284 // Сохранение карточки вакансии 284 // Сохранение карточки вакансии
285 public function vacancy_save(Request $request, Ad_employer $ad_employer) { 285 public function vacancy_save(Request $request, Ad_employer $ad_employer) {
286 $all = $request->all(); 286 $all = $request->all();
287 $ad_employer->update($all); 287 $ad_employer->update($all);
288 return redirect()->route('employer.cabinet_vacancie'); 288 return redirect()->route('employer.cabinet_vacancie');
289 } 289 }
290 290
291 // Удаление карточки вакансии 291 // Удаление карточки вакансии
292 public function vacancy_delete(Ad_employer $ad_employer) { 292 public function vacancy_delete(Ad_employer $ad_employer) {
293 $ad_employer->delete(); 293 $ad_employer->delete();
294 294
295 return redirect()->route('employer.vacancy_list') 295 return redirect()->route('employer.vacancy_list')
296 ->with('success', 'Данные были успешно сохранены'); 296 ->with('success', 'Данные были успешно сохранены');
297 } 297 }
298 298
299 // Обновление даты 299 // Обновление даты
300 public function vacancy_up(Ad_employer $ad_employer) { 300 public function vacancy_up(Ad_employer $ad_employer) {
301 $up = date('m/d/Y h:i:s', time()); 301 $up = date('m/d/Y h:i:s', time());
302 $ad_employer->updated_at = $up; 302 $ad_employer->updated_at = $up;
303 $ad_employer->save(); 303 $ad_employer->save();
304 304
305 return redirect()->back(); 305 return redirect()->back();
306 } 306 }
307 307
308 //Видимость вакансии 308 //Видимость вакансии
309 public function vacancy_eye(Ad_employer $ad_employer, $status) { 309 public function vacancy_eye(Ad_employer $ad_employer, $status) {
310 $vac_emp = Ad_employer::findOrFail($ad_employer->id); 310 $vac_emp = Ad_employer::findOrFail($ad_employer->id);
311 $vac_emp->active_is = $status; 311 $vac_emp->active_is = $status;
312 $vac_emp->save(); 312 $vac_emp->save();
313 313
314 return redirect()->route('employer.vacancy_list'); 314 return redirect()->route('employer.vacancy_list');
315 } 315 }
316 316
317 //Вакансия редактирования (шаблон) 317 //Вакансия редактирования (шаблон)
318 public function vacancy_update(Ad_employer $id) { 318 public function vacancy_update(Ad_employer $id) {
319 319
320 } 320 }
321 321
322 //Отклики на вакансию - лист 322 //Отклики на вакансию - лист
323 public function answers(Employer $employer, Request $request) { 323 public function answers(Employer $employer, Request $request) {
324 $user_id = Auth()->user()->id; 324 $user_id = Auth()->user()->id;
325 $answer = Ad_employer::query()->where('employer_id', $employer->id); 325 $answer = Ad_employer::query()->where('employer_id', $employer->id);
326 if ($request->has('search')) { 326 if ($request->has('search')) {
327 $search = trim($request->get('search')); 327 $search = trim($request->get('search'));
328 if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); 328 if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%");
329 } 329 }
330 330
331 $answer = $answer->with('response')->OrderByDESC('id')->get(); 331 $answer = $answer->with('response')->OrderByDESC('id')->get();
332 332
333 return view('employers.list_answer', compact('answer', 'user_id', 'employer')); 333 return view('employers.list_answer', compact('answer', 'user_id', 'employer'));
334 } 334 }
335 335
336 //Обновление статуса 336 //Обновление статуса
337 public function supple_status(employer $employer, ad_response $ad_response, $flag) { 337 public function supple_status(employer $employer, ad_response $ad_response, $flag) {
338 $ad_response->update(Array('flag' => $flag)); 338 $ad_response->update(Array('flag' => $flag));
339 return redirect()->route('employer.answers', ['employer' => $employer->id]); 339 return redirect()->route('employer.answers', ['employer' => $employer->id]);
340 } 340 }
341 341
342 //Страницы сообщений список 342 //Страницы сообщений список
343 public function messages($type_message) { 343 public function messages($type_message) {
344 $user_id = Auth()->user()->id; 344 $user_id = Auth()->user()->id;
345 345
346 $chats = Chat::get_user_chats($user_id); 346 $chats = Chat::get_user_chats($user_id);
347 $user_type = 'employer'; 347 $user_type = 'employer';
348 $admin_chat = false; 348 $admin_chat = false;
349 349
350 return view('employers.messages', compact('chats', 'admin_chat', 'user_id', 'user_type')); 350 return view('employers.messages', compact('chats', 'admin_chat', 'user_id', 'user_type'));
351 } 351 }
352 352
353 // Диалог между пользователями 353 // Диалог между пользователями
354 public function dialog(Chat $chat, Request $request) { 354 public function dialog(Chat $chat, Request $request) {
355 // Получение параметров. 355 // Получение параметров.
356 if ($request->has('ad_employer')){ 356 if ($request->has('ad_employer')){
357 $ad_employer = $request->get('ad_employer'); 357 $ad_employer = $request->get('ad_employer');
358 } else { 358 } else {
359 $ad_employer = 0; 359 $ad_employer = 0;
360 } 360 }
361 361
362 $sender = User_Model::query()->with('workers')->with('employers')->where('id', $chat->user_id)->first(); 362 $sender = User_Model::query()->with('workers')->with('employers')->where('id', $chat->user_id)->first();
363 $companion = User_Model::query()->with('workers')->with('employers')->where('id', $chat->to_user_id)->first(); 363 $companion = User_Model::query()->with('workers')->with('employers')->where('id', $chat->to_user_id)->first();
364 364
365 $Messages = Chat::get_chat_messages($chat); 365 $Messages = Chat::get_chat_messages($chat);
366 366
367 Message::where('user_id', '=', $chat->to_user_id)->where('to_user_id', '=', $chat->user_id)->update(['flag_new' => 0]); 367 Message::where('user_id', '=', $chat->to_user_id)->where('to_user_id', '=', $chat->user_id)->update(['flag_new' => 0]);
368 368
369 return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); 369 return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages'));
370 } 370 }
371 371
372 public function pin_chat(Request $request){ 372 public function pin_chat(Request $request){
373 $chat_id = $request->get('id'); 373 $chat_id = $request->get('id');
374 $is_fixed = $request->get('is_fixed'); 374 $is_fixed = $request->get('is_fixed');
375 375
376 Chat::pin_chat($chat_id, $is_fixed); 376 Chat::pin_chat($chat_id, $is_fixed);
377 } 377 }
378 378
379 public function remove_chat(Request $request){ 379 public function remove_chat(Request $request){
380 $chat_id = $request->get('id'); 380 $chat_id = $request->get('id');
381 Chat::remove_chat($chat_id); 381 Chat::remove_chat($chat_id);
382 } 382 }
383 383
384 // Регистрация работодателя 384 // Регистрация работодателя
385 public function register_employer(Request $request) { 385 public function register_employer(Request $request) {
386 $params = $request->all(); 386 $params = $request->all();
387 387
388 $rules = [ 388 $rules = [
389 //'surname' => ['required', 'string', 'max:255'], 389 //'surname' => ['required', 'string', 'max:255'],
390 //'name_man' => ['required', 'string', 'max:255'], 390 //'name_man' => ['required', 'string', 'max:255'],
391 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 391 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
392 'name_company' => ['required', 'string', 'max:255'], 392 'name_company' => ['required', 'string', 'max:255'],
393 'password' => ['required', 'string', 'min:6'], 393 'password' => ['required', 'string', 'min:6'],
394 ]; 394 ];
395 395
396 $messages = [ 396 $messages = [
397 'required' => 'Укажите обязательное поле', 397 'required' => 'Укажите обязательное поле',
398 'min' => [ 398 'min' => [
399 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 399 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
400 'integer' => 'Поле «:attribute» должно быть :min или больше', 400 'integer' => 'Поле «:attribute» должно быть :min или больше',
401 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 401 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
402 ], 402 ],
403 'max' => [ 403 'max' => [
404 'string' => 'Поле «:attribute» должно быть не больше :max символов', 404 'string' => 'Поле «:attribute» должно быть не больше :max символов',
405 'integer' => 'Поле «:attribute» должно быть :max или меньше', 405 'integer' => 'Поле «:attribute» должно быть :max или меньше',
406 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 406 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
407 ] 407 ]
408 ]; 408 ];
409 409
410 $email = $request->get('email'); 410 $email = $request->get('email');
411 if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { 411 if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) {
412 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); 412 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл"));
413 } 413 }
414 414
415 if ($request->get('password') !== $request->get('confirmed')){ 415 if ($request->get('password') !== $request->get('confirmed')){
416 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); 416 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля"));
417 } 417 }
418 418
419 if (strlen($request->get('password')) < 6) { 419 if (strlen($request->get('password')) < 6) {
420 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); 420 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!"));
421 } 421 }
422 422
423 if (empty($request->get('surname'))) { 423 if (empty($request->get('surname'))) {
424 $params['surname'] = 'Неизвестно'; 424 $params['surname'] = 'Неизвестно';
425 } 425 }
426 if (empty($request->get('name_man'))) { 426 if (empty($request->get('name_man'))) {
427 $params['name_man'] = 'Неизвестно'; 427 $params['name_man'] = 'Неизвестно';
428 } 428 }
429 $validator = Validator::make($params, $rules, $messages); 429 $validator = Validator::make($params, $rules, $messages);
430 430
431 if ($validator->fails()) { 431 if ($validator->fails()) {
432 return json_encode(Array("ERROR" => "Error: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); 432 return json_encode(Array("ERROR" => "Error: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе."));
433 } else { 433 } else {
434 $user = $this->create($params); 434 $user = $this->create($params);
435 event(new Registered($user)); 435 event(new Registered($user));
436 436
437 try { 437 try {
438 Mail::to(env('EMAIL_ADMIN'))->send(new MailCreateEmployer($params)); 438 Mail::to(env('EMAIL_ADMIN'))->send(new MailCreateEmployer($params));
439 } catch (Throwable $e) { 439 } catch (Throwable $e) {
440 Log::error($e); 440 Log::error($e);
441 } 441 }
442 442
443 Auth::guard()->login($user); 443 Auth::guard()->login($user);
444 } 444 }
445 445
446 if ($user) { 446 if ($user) {
447 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; 447 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));;
448 } else { 448 } else {
449 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); 449 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!"));
450 } 450 }
451 } 451 }
452 452
453 // Создание пользователя 453 // Создание пользователя
454 protected function create(array $data) 454 protected function create(array $data)
455 { 455 {
456 $Use = new User_Model(); 456 $Use = new User_Model();
457 $Code_user = $Use->create([ 457 $Code_user = $Use->create([
458 'name' => $data['surname']." ".$data['name_man'], 458 'name' => $data['surname']." ".$data['name_man'],
459 'name_man' => $data['name_man'], 459 'name_man' => $data['name_man'],
460 'surname' => $data['surname'], 460 'surname' => $data['surname'],
461 'surname2' => $data['surname2'], 461 'surname2' => $data['surname2'],
462 'subscribe_email' => $data['email'], 462 'subscribe_email' => $data['email'],
463 'email' => $data['email'], 463 'email' => $data['email'],
464 'telephone' => $data['telephone'], 464 'telephone' => $data['telephone'],
465 'is_worker' => 0, 465 'is_worker' => 0,
466 'password' => Hash::make($data['password']), 466 'password' => Hash::make($data['password']),
467 'pubpassword' => base64_encode($data['password']), 467 'pubpassword' => base64_encode($data['password']),
468 'email_verified_at' => Carbon::now() 468 'email_verified_at' => Carbon::now()
469 ]); 469 ]);
470 470
471 if ($Code_user->id > 0) { 471 if ($Code_user->id > 0) {
472 $Employer = new Employer(); 472 $Employer = new Employer();
473 $Employer->user_id = $Code_user->id; 473 $Employer->user_id = $Code_user->id;
474 $Employer->name_company = $data['name_company']; 474 $Employer->name_company = $data['name_company'];
475 $Employer->email = $data['email']; 475 $Employer->email = $data['email'];
476 $Employer->telephone = $data['telephone']; 476 $Employer->telephone = $data['telephone'];
477 $Employer->code = Tools::generator_id(10); 477 $Employer->code = Tools::generator_id(10);
478 $Employer->save(); 478 $Employer->save();
479 479
480 return $Code_user; 480 return $Code_user;
481 } 481 }
482 } 482 }
483 483
484 // Отправка сообщения от работодателя 484 // Отправка сообщения от работодателя
485 public function send_message(MessagesRequiest $request) { 485 public function send_message(MessagesRequiest $request) {
486 $params = $request->all(); 486 $params = $request->all();
487 dd($params); 487 dd($params);
488 $user1 = $params['user_id']; 488 $user1 = $params['user_id'];
489 $user2 = $params['to_user_id']; 489 $user2 = $params['to_user_id'];
490 490
491 if ($request->has('file')) { 491 if ($request->has('file')) {
492 $params['file'] = $request->file('file')->store("messages", 'public'); 492 $params['file'] = $request->file('file')->store("messages", 'public');
493 } 493 }
494 Message::create($params); 494 Message::create($params);
495 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); 495 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]);
496 } 496 }
497 497
498 public function test123(Request $request) { 498 public function test123(Request $request) {
499 $params = $request->all(); 499 $params = $request->all();
500 $user1 = $params['user_id']; 500 $user1 = $params['user_id'];
501 $user2 = $params['to_user_id']; 501 $user2 = $params['to_user_id'];
502 502
503 $rules = [ 503 $rules = [
504 'text' => 'nullable|required_without:file|min:1|max:150000', 504 'text' => 'nullable|required_without:file|min:1|max:150000',
505 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' 505 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000'
506 ]; 506 ];
507 $messages = [ 507 $messages = [
508 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен', 508 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен',
509 'min' => [ 509 'min' => [
510 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 510 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
511 'integer' => 'Поле «:attribute» должно быть :min или больше', 511 'integer' => 'Поле «:attribute» должно быть :min или больше',
512 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 512 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
513 ], 513 ],
514 'max' => [ 514 'max' => [
515 'string' => 'Поле «:attribute» должно быть не больше :max символов', 515 'string' => 'Поле «:attribute» должно быть не больше :max символов',
516 'integer' => 'Поле «:attribute» должно быть :max или меньше', 516 'integer' => 'Поле «:attribute» должно быть :max или меньше',
517 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 517 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
518 ] 518 ]
519 ]; 519 ];
520 520
521 $validator = Validator::make($request->all(), $rules, $messages); 521 $validator = Validator::make($request->all(), $rules, $messages);
522 522
523 if ($validator->fails()) { 523 if ($validator->fails()) {
524 return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator); 524 return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator);
525 } 525 }
526 526
527 $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages'); 527 $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages');
528 return redirect()->route('employer.dialog', ['chat' => $new_message->chat_id_from]); 528 return redirect()->route('employer.dialog', ['chat' => $new_message->chat_id_from]);
529 529
530 } 530 }
531 531
532 //Избранные люди 532 //Избранные люди
533 public function favorites(Request $request) 533 public function favorites(Request $request)
534 { 534 {
535 $likedWorkersIds = Like_worker::query() 535 $likedWorkersIds = Like_worker::query()
536 ->where('user_id', Auth::user()->id) 536 ->where('user_id', Auth::user()->id)
537 ->get() 537 ->get()
538 ->pluck('code_record') 538 ->pluck('code_record')
539 ->toArray(); 539 ->toArray();
540 540
541 $workerBuilder = Worker::query() 541 $workerBuilder = Worker::query()
542 ->whereIn('id', $likedWorkersIds); 542 ->whereIn('id', $likedWorkersIds);
543 543
544 if (($request->has('search')) && (!empty($request->get('search')))) { 544 if (($request->has('search')) && (!empty($request->get('search')))) {
545 $search = $request->get('search'); 545 $search = $request->get('search');
546 546
547 $workerBuilder->whereHas('users', function (Builder $query) use ($search) { 547 $workerBuilder->whereHas('users', function (Builder $query) use ($search) {
548 $query->where('surname', 'LIKE', "%$search%") 548 $query->where('surname', 'LIKE', "%$search%")
549 ->orWhere('name_man', 'LIKE', "%$search%") 549 ->orWhere('name_man', 'LIKE', "%$search%")
550 ->orWhere('surname2', 'LIKE', "%$search%"); 550 ->orWhere('surname2', 'LIKE', "%$search%");
551 }); 551 });
552 } 552 }
553 553
554 $Workers = $workerBuilder->get(); 554 $Workers = $workerBuilder->get();
555 555
556 return view('employers.favorite', compact('Workers')); 556 return view('employers.favorite', compact('Workers'));
557 } 557 }
558 558
559 // База данных 559 // База данных
560 public function bd(Request $request) { 560 public function bd(Request $request) {
561 $users = User_Model::query()->with('workers')->with('jobtitles'); 561 $users = User_Model::query()->with('workers')->with('jobtitles');
562 562
563 if ($request->has('search')) { 563 if ($request->has('search')) {
564 $find_key = $request->get('search'); 564 $find_key = $request->get('search');
565 $users = $users->where('name', 'LIKE', "%$find_key%") 565 $users = $users->where('name', 'LIKE', "%$find_key%")
566 ->orWhere('surname', 'LIKE', "%$find_key%") 566 ->orWhere('surname', 'LIKE', "%$find_key%")
567 ->orWhere('name_man', 'LIKE', "%$find_key%") 567 ->orWhere('name_man', 'LIKE', "%$find_key%")
568 ->orWhere('email', 'LIKE', "%$find_key%") 568 ->orWhere('email', 'LIKE', "%$find_key%")
569 ->orWhere('telephone', 'LIKE', "%$find_key%"); 569 ->orWhere('telephone', 'LIKE', "%$find_key%");
570 } 570 }
571 571
572 // Данные 572 // Данные
573 $users = $users 573 $users = $users
574 ->Baseuser() 574 ->Baseuser()
575 ->orderByDesc(Worker::select('created_at') 575 ->orderByDesc(Worker::select('created_at')
576 ->whereColumn('workers.user_id', 'users.id')); 576 ->whereColumn('workers.user_id', 'users.id'));
577 $count_users = $users->count(); 577 $count_users = $users->count();
578 $users = $users->paginate(10); 578 $users = $users->paginate(10);
579 579
580 $export_options = DbExportColumns::toArray(); 580 $export_options = DbExportColumns::toArray();
581 581
582 $jobs_titles = Job_title::select('id', 'name') 582 $jobs_titles = Job_title::select('id', 'name')
583 ->where('is_remove', '=', 0) 583 ->where('is_remove', '=', 0)
584 ->where('is_bd', '=', 2) 584 ->where('is_bd', '=', 2)
585 ->orderByDesc('sort') 585 ->orderByDesc('sort')
586 ->orderBy('name', 'asc') 586 ->orderBy('name', 'asc')
587 ->get() 587 ->get()
588 ->toArray() 588 ->toArray()
589 ; 589 ;
590 590
591 return view('employers.bd', compact('users', 'count_users', 'export_options', 'jobs_titles')); 591 return view('employers.bd', compact('users', 'count_users', 'export_options', 'jobs_titles'));
592 } 592 }
593 593
594 //Настройка уведомлений 594 //Настройка уведомлений
595 public function subscribe() { 595 public function subscribe() {
596 return view('employers.subcribe'); 596 return view('employers.subcribe');
597 } 597 }
598 598
599 //Установка уведомлений сохранение 599 //Установка уведомлений сохранение
600 public function save_subscribe(Request $request) { 600 public function save_subscribe(Request $request) {
601 dd($request->all()); 601 dd($request->all());
602 $msg = $request->validate([ 602 $msg = $request->validate([
603 'subscribe_email' => 'required|email|min:5|max:255', 603 'subscribe_email' => 'required|email|min:5|max:255',
604 ]); 604 ]);
605 return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); 605 return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку');
606 } 606 }
607 607
608 //Сбросить форму с паролем 608 //Сбросить форму с паролем
609 public function password_reset() { 609 public function password_reset() {
610 $email = Auth()->user()->email; 610 $email = Auth()->user()->email;
611 return view('employers.password-reset', compact('email')); 611 return view('employers.password-reset', compact('email'));
612 } 612 }
613 613
614 //Обновление пароля 614 //Обновление пароля
615 public function new_password(Request $request) { 615 public function new_password(Request $request) {
616 $use = Auth()->user(); 616 $use = Auth()->user();
617 $request->validate([ 617 $request->validate([
618 'password' => 'required|string', 618 'password' => 'required|string',
619 'new_password' => 'required|string', 619 'new_password' => 'required|string',
620 'new_password2' => 'required|string' 620 'new_password2' => 'required|string'
621 ]); 621 ]);
622 622
623 if ($request->get('new_password') == $request->get('new_password2')) 623 if ($request->get('new_password') == $request->get('new_password2'))
624 if ($request->get('password') !== $request->get('new_password')) { 624 if ($request->get('password') !== $request->get('new_password')) {
625 $credentials = $request->only('email', 'password'); 625 $credentials = $request->only('email', 'password');
626 if (Auth::attempt($credentials)) { 626 if (Auth::attempt($credentials)) {
627 627
628 if (!is_null($use->email_verified_at)){ 628 if (!is_null($use->email_verified_at)){
629 629
630 $user_data = User_Model::find($use->id); 630 $user_data = User_Model::find($use->id);
631 $user_data->update([ 631 $user_data->update([
632 'password' => Hash::make($request->get('new_password')), 632 'password' => Hash::make($request->get('new_password')),
633 'pubpassword' => base64_encode($request->get('new_password')), 633 'pubpassword' => base64_encode($request->get('new_password')),
634 ]); 634 ]);
635 return redirect() 635 return redirect()
636 ->route('employer.password_reset') 636 ->route('employer.password_reset')
637 ->with('success', 'Поздравляю! Вы обновили свой пароль!'); 637 ->with('success', 'Поздравляю! Вы обновили свой пароль!');
638 } 638 }
639 639
640 return redirect() 640 return redirect()
641 ->route('employer.password_reset') 641 ->route('employer.password_reset')
642 ->withError('Данная учетная запись не было верифицированна!'); 642 ->withError('Данная учетная запись не было верифицированна!');
643 } 643 }
644 } 644 }
645 645
646 return redirect() 646 return redirect()
647 ->route('employer.password_reset') 647 ->route('employer.password_reset')
648 ->withErrors('Не совпадение данных, обновите пароли!'); 648 ->withErrors('Не совпадение данных, обновите пароли!');
649 } 649 }
650 650
651 651
652 652
653 // Форма Удаление пипла 653 // Форма Удаление пипла
654 public function delete_people() { 654 public function delete_people() {
655 $login = Auth()->user()->email; 655 $login = Auth()->user()->email;
656 return view('employers.delete_people', compact('login')); 656 return view('employers.delete_people', compact('login'));
657 } 657 }
658 658
659 // Удаление аккаунта 659 // Удаление аккаунта
660 public function action_delete_user(Request $request) { 660 public function action_delete_user(Request $request) {
661 $Answer = $request->all(); 661 $Answer = $request->all();
662 $user_id = Auth()->user()->id; 662 $user_id = Auth()->user()->id;
663 $request->validate([ 663 $request->validate([
664 'password' => 'required|string', 664 'password' => 'required|string',
665 ]); 665 ]);
666 666
667 $credentials = $request->only('email', 'password'); 667 $credentials = $request->only('email', 'password');
668 if (Auth::attempt($credentials)) { 668 if (Auth::attempt($credentials)) {
669 Auth::logout(); 669 Auth::logout();
670 $it = User_Model::find($user_id); 670 $it = User_Model::find($user_id);
671 $it->delete(); 671 $it->delete();
672 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); 672 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт');
673 } else { 673 } else {
674 return redirect()->route('employer.delete_people') 674 return redirect()->route('employer.delete_people')
675 ->withErrors( 'Неверный пароль! Нужен корректный пароль'); 675 ->withErrors( 'Неверный пароль! Нужен корректный пароль');
676 } 676 }
677 } 677 }
678 678
679 public function ajax_delete_user(Request $request) { 679 public function ajax_delete_user(Request $request) {
680 $Answer = $request->all(); 680 $Answer = $request->all();
681 $user_id = Auth()->user()->id; 681 $user_id = Auth()->user()->id;
682 $request->validate([ 682 $request->validate([
683 'password' => 'required|string', 683 'password' => 'required|string',
684 ]); 684 ]);
685 $credentials = $request->only('email', 'password'); 685 $credentials = $request->only('email', 'password');
686 if (Auth::attempt($credentials)) { 686 if (Auth::attempt($credentials)) {
687 687
688 return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', 688 return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт',
689 'email' => $request->get('email'), 689 'email' => $request->get('email'),
690 'password' => $request->get('password'))); 690 'password' => $request->get('password')));
691 } else { 691 } else {
692 return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); 692 return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль'));
693 } 693 }
694 } 694 }
695 695
696 // Рассылка сообщений 696 // Рассылка сообщений
697 public function send_all_messages() { 697 public function send_all_messages() {
698 $id = Auth()->user()->id; 698 $id = Auth()->user()->id;
699 $sending = Employer::query()->where('user_id', '=', "$id")->first(); 699 $sending = Employer::query()->where('user_id', '=', "$id")->first();
700 700
701 $job_titles = Job_title::query() 701 $job_titles = Job_title::query()
702 ->where('is_remove', '=', 0) 702 ->where('is_remove', '=', 0)
703 ->where('is_bd', '=', 1) 703 ->where('is_bd', '=', 1)
704 ->orderByDesc('sort') 704 ->orderByDesc('sort')
705 ->get(); 705 ->get();
706 706
707 if ($sending->sending_is) 707 if ($sending->sending_is)
708 return view('employers.send_all', compact('job_titles')); 708 return view('employers.send_all', compact('job_titles'));
709 else 709 else
710 return view('employers.send_all_danger'); 710 return view('employers.send_all_danger');
711 } 711 }
712 712
713 // Отправка сообщений для информации 713 // Отправка сообщений для информации
714 public function send_all_post(Request $request) { 714 public function send_all_post(Request $request) {
715 $data = $request->all(); 715 $data = $request->all();
716 $data['user'] = Auth()->user(); 716 $data['user'] = Auth()->user();
717 717
718 $id = MessagesRequests::create([ 718 $id = MessagesRequests::create([
719 'user_id' => $data['user']->id, 719 'user_id' => $data['user']->id,
720 'job_titles' => isset($data['job_title_ids']) ? json_encode($data['job_title_ids']) : null, 720 'job_titles' => isset($data['job_title_ids']) ? json_encode($data['job_title_ids']) : null,
721 'text' => $data['message_text'], 721 'text' => $data['message_text'],
722 ]); 722 ]);
723 723
724 try { 724 try {
725 if (!empty($id)) { 725 if (!empty($id)) {
726 Mail::to(env('EMAIL_ADMIN'))->send(new MassSendingMessages($data)); 726 Mail::to(env('EMAIL_ADMIN'))->send(new MassSendingMessages($data));
727 } 727 }
728 } catch (Throwable $e) { 728 } catch (Throwable $e) {
729 Log::error($e); 729 Log::error($e);
730 return redirect()->route('employer.send_all_messages')->with('error', 'Ошибка почтового сервера, пожалуйста, повторите рассылку позднее'); 730 return redirect()->route('employer.send_all_messages')->with('error', 'Ошибка почтового сервера, пожалуйста, повторите рассылку позднее');
731 } 731 }
732 732
733 return redirect()->route('employer.send_all_messages')->with('success', 'Запрос на рассылку был успешно отправлен.'); 733 return redirect()->route('employer.send_all_messages')->with('success', 'Запрос на рассылку был успешно отправлен.');
734 } 734 }
735 735
736 // База резюме 736 // База резюме
737 public function bd_tupe(Request $request) { 737 public function bd_tupe(Request $request) {
738 $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); 738 $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get();
739 739
740 return view('employers.bd_tupe', compact('Resume')); 740 return view('employers.bd_tupe', compact('Resume'));
741 } 741 }
742 742
743 ////////////////////////////////////////////////////////////////// 743 //////////////////////////////////////////////////////////////////
744 // Отправил сообщение 744 // Отправил сообщение
745 ////////////////////////////////////////////////////////////////// 745 //////////////////////////////////////////////////////////////////
746 public function new_message(Request $request) 746 public function new_message(Request $request)
747 { 747 {
748 $params = $request->all(); 748 $params = $request->all();
749 749
750 $id = $params['_user_id']; 750 $id = $params['_user_id'];
751 $message_params = [ 751 $message_params = [
752 'title' => $params['title'], 752 'title' => $params['title'],
753 'text' => $params['text'], 753 'text' => $params['text'],
754 'ad_employer_id' => $params['_vacancy'], 754 'ad_employer_id' => $params['_vacancy'],
755 'flag_new' => 1 755 'flag_new' => 1
756 ]; 756 ];
757 757
758 $message = Message::add_message( 758 $message = Message::add_message(
759 $request, 759 $request,
760 $params['_user_id'], 760 $params['_user_id'],
761 $params['_to_user_id'], 761 $params['_to_user_id'],
762 $message_params, 762 $message_params,
763 file_store_path: "worker/$id" 763 file_store_path: "worker/$id"
764 ); 764 );
765 765
766 return redirect()->route('employer.dialog', ['chat' => $message->chat_id_to]); 766 return redirect()->route('employer.dialog', ['chat' => $message->chat_id_to]);
767 } 767 }
768 768
769 // Восстановление пароля 769 // Восстановление пароля
770 public function repair_password(Request $request) { 770 public function repair_password(Request $request) {
771 $params = $request->get('email'); 771 $params = $request->get('email');
772 } 772 }
773 773
774 // Избранные люди на корабль 774 // Избранные люди на корабль
775 public function selected_people(Request $request) { 775 public function selected_people(Request $request) {
776 $id = $request->get('id'); 776 $id = $request->get('id');
777 $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> 777 $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')->
778 where('is_remove', '=', '0')-> 778 where('is_remove', '=', '0')->
779 where('is_bd', '=', '0')-> 779 where('is_bd', '=', '0')->
780 where('position_id', $id)-> 780 where('position_id', $id)->
781 get(); 781 get();
782 return view('favorite_people', compact('favorite_people')); 782 return view('favorite_people', compact('favorite_people'));
783 } 783 }
784 784
785 /** 785 /**
786 * @throws JsonException 786 * @throws JsonException
787 */ 787 */
788 public function vacancyAutoLiftForm(): View 788 public function vacancyAutoLiftForm(): View
789 { 789 {
790 $employer = Auth::user()->employers[0]; 790 $employer = Auth::user()->employers[0];
791 $vacancies = $employer 791 $vacancies = $employer
792 ->ads() 792 ->ads()
793 ->where('is_remove', 0) 793 ->where('is_remove', 0)
794 ->where('active_is', 1) 794 ->where('active_is', 1)
795 ->get(); 795 ->get();
796 796
797 $options = $employer->autoliftOptions ?? new EmployerAutoliftOption(); 797 $options = $employer->autoliftOptions ?? new EmployerAutoliftOption();
798 798
799 return view('employers.vacancy_autolift', compact('vacancies', 'options')); 799 return view('employers.vacancy_autolift', compact('vacancies', 'options'));
800 } 800 }
801 801
802 /** 802 /**
803 * @throws JsonException 803 * @throws JsonException
804 */ 804 */
805 public function vacancyAutoLiftSave(Request $request) 805 public function vacancyAutoLiftSave(Request $request)
806 { 806 {
807 $employer = Auth::user()->employers[0]; 807 $employer = Auth::user()->employers[0];
808 808
809 $employer->autoliftOptions()->updateOrCreate( 809 $employer->autoliftOptions()->updateOrCreate(
810 [ 810 [
811 'employer_id' => $employer->id, 811 'employer_id' => $employer->id,
812 ], 812 ],
813 [ 813 [
814 'is_enabled' => $request->get('is_enabled'),
814 'times_per_day' => $request->get('times_per_day'), 815 'times_per_day' => $request->get('times_per_day'),
815 'days_repeat' => $request->get('days_repeat'), 816 'days_repeat' => $request->get('days_repeat'),
816 'time_send_first' => $request->get('time_send_first'), 817 'time_send_first' => $request->get('time_send_first'),
817 'time_send_second' => $request->get('time_send_second'), 818 'time_send_second' => $request->get('time_send_second'),
818 'time_send_third' => $request->get('time_send_third'), 819 'time_send_third' => $request->get('time_send_third'),
819 'time_send_tg' => $request->get('time_send_tg'), 820 'time_send_tg' => $request->get('time_send_tg'),
820 ] 821 ]
821 ); 822 );
822 823
823 foreach ($request->get('vacancies') as $vacancy) { 824 foreach ($request->get('vacancies') as $vacancy) {
824 Ad_employer::query() 825 Ad_employer::query()
825 ->where('id', $vacancy['id']) 826 ->where('id', $vacancy['id'])
826 ->update([ 827 ->update([
827 'autolift_site' => $vacancy['autolift_site'] === 'true', //they're arriving as strings 828 'autolift_site' => $vacancy['autolift_site'] === 'true', //they're arriving as strings
828 'autosend_tg' => $vacancy['autosend_tg'] === 'true', 829 'autosend_tg' => $vacancy['autosend_tg'] === 'true',
829 ]); 830 ]);
830 } 831 }
831 832
832 return response(['success' => true]); 833 return response(['success' => true]);
833 } 834 }
834 835
835 public function autoresponder() 836 public function autoresponder()
836 { 837 {
837 $employer = Auth::user()->employers[0]; 838 $user = Auth::user();
838 return view('employers.autoresponder', compact('employer')); 839 return view('employers.autoresponder', compact('user'));
839 } 840 }
840 841
841 public function autoresponderSave(Request $request): RedirectResponse 842 public function autoresponderSave(Request $request): RedirectResponse
842 { 843 {
843 /** @var Employer $employer */ 844 $user = Auth::user();
844 $employer = Auth::user()->employers[0]; 845 $user->autoresponder = $request->get('autoresponder', false) === 'on';
845 $employer->autoresponder = $request->get('autoresponder', false) === 'on'; 846 $user->autoresponder_message = $request->get('autoresponder_message');
846 $employer->autoresponder_message = $request->get('autoresponder_message'); 847 $user->save();
847 $employer->save();
848 848
849 return redirect(route('employer.autoresponder')); 849 return redirect(route('employer.autoresponder'));
850 } 850 }
851 } 851 }
app/Http/Controllers/WorkerController.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\DocumentsRequest; 7 use App\Http\Requests\DocumentsRequest;
8 use App\Http\Requests\PrevCompanyRequest; 8 use App\Http\Requests\PrevCompanyRequest;
9 use App\Http\Requests\SertificationRequest; 9 use App\Http\Requests\SertificationRequest;
10 use App\Models\Ad_employer; 10 use App\Models\Ad_employer;
11 use App\Models\ad_response; 11 use App\Models\ad_response;
12 use App\Models\Chat; 12 use App\Models\Chat;
13 use App\Models\Dop_info; 13 use App\Models\Dop_info;
14 use App\Models\Employer;
15 use App\Models\EmployerAutoliftOption;
14 use App\Models\infobloks; 16 use App\Models\infobloks;
15 use App\Models\Job_title; 17 use App\Models\Job_title;
16 use App\Models\Like_vacancy; 18 use App\Models\Like_vacancy;
17 use App\Models\Message; 19 use App\Models\Message;
18 use App\Models\place_works; 20 use App\Models\place_works;
19 use App\Models\PrevCompany; 21 use App\Models\PrevCompany;
20 use App\Models\ResponseWork; 22 use App\Models\ResponseWork;
21 use App\Models\sertification; 23 use App\Models\sertification;
22 use App\Models\Static_worker; 24 use App\Models\Static_worker;
23 use App\Models\Title_worker; 25 use App\Models\Title_worker;
24 use App\Models\User; 26 use App\Models\User;
25 use App\Models\User as User_Model; 27 use App\Models\User as User_Model;
26 use App\Models\Worker; 28 use App\Models\Worker;
29 use App\Models\WorkerAutoliftOption;
27 use Barryvdh\DomPDF\Facade\Pdf; 30 use Barryvdh\DomPDF\Facade\Pdf;
28 use Carbon\Carbon; 31 use Carbon\Carbon;
29 use Illuminate\Auth\Events\Registered; 32 use Illuminate\Auth\Events\Registered;
30 use Illuminate\Database\Eloquent\Builder; 33 use Illuminate\Database\Eloquent\Builder;
34 use Illuminate\Http\RedirectResponse;
31 use Illuminate\Http\Request; 35 use Illuminate\Http\Request;
32 use Illuminate\Pagination\LengthAwarePaginator; 36 use Illuminate\Pagination\LengthAwarePaginator;
33 use Illuminate\Support\Facades\Auth; 37 use Illuminate\Support\Facades\Auth;
34 use Illuminate\Support\Facades\DB; 38 use Illuminate\Support\Facades\DB;
35 use Illuminate\Support\Facades\Hash; 39 use Illuminate\Support\Facades\Hash;
36 use Illuminate\Support\Facades\Storage; 40 use Illuminate\Support\Facades\Storage;
37 use Illuminate\Support\Facades\Validator; 41 use Illuminate\Support\Facades\Validator;
42 use Illuminate\View\View;
43 use JsonException;
38 use PhpOffice\PhpSpreadsheet\Spreadsheet; 44 use PhpOffice\PhpSpreadsheet\Spreadsheet;
39 use PhpOffice\PhpSpreadsheet\Writer\Xlsx; 45 use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
40 use Symfony\Component\HttpFoundation\StreamedResponse; 46 use Symfony\Component\HttpFoundation\StreamedResponse;
41 use App\Enums\DbExportColumns; 47 use App\Enums\DbExportColumns;
42 use App\Enums\WorkerStatuses; 48 use App\Enums\WorkerStatuses;
43 use DateTime; 49 use DateTime;
44 50
45 class WorkerController extends Controller 51 class WorkerController extends Controller
46 { 52 {
47 //профиль 53 //профиль
48 public function profile(Worker $worker) 54 public function profile(Worker $worker)
49 { 55 {
50 $get_date = date('Y.m'); 56 $get_date = date('Y.m');
51 57
52 $c = Static_worker::query()->where('year_month', '=', $get_date) 58 $c = Static_worker::query()->where('year_month', '=', $get_date)
53 ->where('user_id', '=', $worker->users->id) 59 ->where('user_id', '=', $worker->users->id)
54 ->get(); 60 ->get();
55 61
56 if ($c->count() > 0) { 62 if ($c->count() > 0) {
57 $upd = Static_worker::find($c[0]->id); 63 $upd = Static_worker::find($c[0]->id);
58 $upd->lookin = $upd->lookin + 1; 64 $upd->lookin = $upd->lookin + 1;
59 $upd->save(); 65 $upd->save();
60 } else { 66 } else {
61 $crt = new Static_worker(); 67 $crt = new Static_worker();
62 $crt->lookin = 1; 68 $crt->lookin = 1;
63 $crt->year_month = $get_date; 69 $crt->year_month = $get_date;
64 $crt->user_id = $worker->user_id; 70 $crt->user_id = $worker->user_id;
65 $crt->save(); 71 $crt->save();
66 } 72 }
67 73
68 $stat = Static_worker::query()->where('year_month', '=', $get_date) 74 $stat = Static_worker::query()->where('year_month', '=', $get_date)
69 ->where('user_id', '=', $worker->users->id) 75 ->where('user_id', '=', $worker->users->id)
70 ->get(); 76 ->get();
71 77
72 return view('public.workers.profile', compact('worker', 'stat')); 78 return view('public.workers.profile', compact('worker', 'stat'));
73 } 79 }
74 80
75 // лист база резюме 81 // лист база резюме
76 public function bd_resume(Request $request) 82 public function bd_resume(Request $request)
77 { 83 {
78 if (isset(Auth()->user()->id)) { 84 if (isset(Auth()->user()->id)) {
79 if ((Auth()->user()->is_worker) || (!Auth()->user()->is_lookin)) 85 if ((Auth()->user()->is_worker) || (!Auth()->user()->is_lookin))
80 return redirect()->route('index')->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]); 86 return redirect()->route('index')->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]);
81 } 87 }
82 88
83 $status_work = WorkerStatuses::getWorkerStatuses(); 89 $status_work = WorkerStatuses::getWorkerStatuses();
84 90
85 $resumes = Worker::query()->with('users')->with('job_titles')->orderByDesc('updated_at'); 91 $resumes = Worker::query()->with('users')->with('job_titles')->orderByDesc('updated_at');
86 $resumes = $resumes->whereHas('users', function (Builder $query) { 92 $resumes = $resumes->whereHas('users', function (Builder $query) {
87 $query->Where('is_worker', '=', '1') 93 $query->Where('is_worker', '=', '1')
88 ->Where('is_bd', '=', '0'); 94 ->Where('is_bd', '=', '0');
89 }); 95 });
90 96
91 if (($request->has('job')) && ($request->get('job') > 0)) { 97 if (($request->has('job')) && ($request->get('job') > 0)) {
92 $resumes = $resumes->whereHas('job_titles', function (Builder $query) use ($request) { 98 $resumes = $resumes->whereHas('job_titles', function (Builder $query) use ($request) {
93 $query->Where('job_titles.id', $request->get('job')); 99 $query->Where('job_titles.id', $request->get('job'));
94 }); 100 });
95 } 101 }
96 102
97 $Job_title = Job_title::query() 103 $Job_title = Job_title::query()
98 ->where('is_remove', '=', '0') 104 ->where('is_remove', '=', '0')
99 ->where('is_bd', '=' , '1') 105 ->where('is_bd', '=' , '1')
100 ->orderByDesc('sort') 106 ->orderByDesc('sort')
101 ->get(); 107 ->get();
102 108
103 if ($request->get('sort')) { 109 if ($request->get('sort')) {
104 $sort = $request->get('sort'); 110 $sort = $request->get('sort');
105 switch ($sort) { 111 switch ($sort) {
106 case 'looking_for_work': 112 case 'looking_for_work':
107 $resumes->where('status_work', '=', WorkerStatuses::LookingForWork->value); 113 $resumes->where('status_work', '=', WorkerStatuses::LookingForWork->value);
108 break; 114 break;
109 case 'considering_offers': 115 case 'considering_offers':
110 $resumes->where('status_work', '=', WorkerStatuses::ConsideringOffers->value); 116 $resumes->where('status_work', '=', WorkerStatuses::ConsideringOffers->value);
111 break; 117 break;
112 case 'not_looking_for_work': 118 case 'not_looking_for_work':
113 $resumes->where('status_work', '=', WorkerStatuses::NotLookingForWork->value); 119 $resumes->where('status_work', '=', WorkerStatuses::NotLookingForWork->value);
114 break; 120 break;
115 } 121 }
116 } 122 }
117 123
118 $resumes = $resumes->get()->filter(function ($worker) { 124 $resumes = $resumes->get()->filter(function ($worker) {
119 return Tools::getWorkerProfilePercent($worker) >= 50; 125 return Tools::getWorkerProfilePercent($worker) >= 50;
120 }); 126 });
121 127
122 $res_count = $resumes->count(); 128 $res_count = $resumes->count();
123 129
124 $currentPage = $_GET['page'] ?? 1; 130 $currentPage = $_GET['page'] ?? 1;
125 $resumes = new LengthAwarePaginator( 131 $resumes = new LengthAwarePaginator(
126 items: $resumes->slice(4 * ($currentPage - 1), 4), 132 items: $resumes->slice(4 * ($currentPage - 1), 4),
127 total: $res_count, 133 total: $res_count,
128 perPage: 4, 134 perPage: 4,
129 ); 135 );
130 $resumes->setPath('bd-resume'); 136 $resumes->setPath('bd-resume');
131 137
132 if ($request->ajax()) { 138 if ($request->ajax()) {
133 // Условия обставлены 139 // Условия обставлены
134 if ($request->has('block') && ($request->get('block') == 1)) { 140 if ($request->has('block') && ($request->get('block') == 1)) {
135 return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count')); 141 return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count'));
136 } 142 }
137 } else { 143 } else {
138 return view('resume', compact('resumes', 'status_work', 'res_count', 'Job_title')); 144 return view('resume', compact('resumes', 'status_work', 'res_count', 'Job_title'));
139 } 145 }
140 } 146 }
141 147
142 public function basic_information(){ 148 public function basic_information(){
143 if (!isset(Auth()->user()->id)) { 149 if (!isset(Auth()->user()->id)) {
144 abort(404); 150 abort(404);
145 } 151 }
146 152
147 $user_id = Auth()->user()->id; 153 $user_id = Auth()->user()->id;
148 154
149 $user = User::query() 155 $user = User::query()
150 ->with('workers') 156 ->with('workers')
151 ->with(['jobtitles' => function ($query) { 157 ->with(['jobtitles' => function ($query) {
152 $query->select('job_titles.id'); 158 $query->select('job_titles.id');
153 }]) 159 }])
154 ->where('id', '=', $user_id) 160 ->where('id', '=', $user_id)
155 ->first(); 161 ->first();
156 $user->workers[0]->job_titles = $user->workers[0]->job_titles->pluck('id')->toArray(); 162 $user->workers[0]->job_titles = $user->workers[0]->job_titles->pluck('id')->toArray();
157 163
158 $job_titles = Job_title::query() 164 $job_titles = Job_title::query()
159 ->where('is_remove', '=', 0) 165 ->where('is_remove', '=', 0)
160 ->where('is_bd', '=', 1) 166 ->where('is_bd', '=', 1)
161 ->orderByDesc('sort') 167 ->orderByDesc('sort')
162 ->get() 168 ->get()
163 ; 169 ;
164 170
165 return view('workers.form_basic_information', compact('user', 'job_titles')); 171 return view('workers.form_basic_information', compact('user', 'job_titles'));
166 } 172 }
167 173
168 public function additional_documents(){ 174 public function additional_documents(){
169 if (!isset(Auth()->user()->id)) { 175 if (!isset(Auth()->user()->id)) {
170 abort(404); 176 abort(404);
171 } 177 }
172 178
173 $user_id = Auth()->user()->id; 179 $user_id = Auth()->user()->id;
174 180
175 $info_blocks = infobloks::query()->OrderBy('name')->get(); 181 $info_blocks = infobloks::query()->OrderBy('name')->get();
176 $additional_document_statuses = [0 => 'Не указано', 1 => 'В наличии', 2 => 'Отсутствует']; 182 $additional_document_statuses = [0 => 'Не указано', 1 => 'В наличии', 2 => 'Отсутствует'];
177 183
178 $worker = Worker::query() 184 $worker = Worker::query()
179 ->with('users') 185 ->with('users')
180 ->with('infobloks') 186 ->with('infobloks')
181 ->WhereHas('users', function (Builder $query) use ($user_id) { 187 ->WhereHas('users', function (Builder $query) use ($user_id) {
182 $query->Where('id', $user_id); 188 $query->Where('id', $user_id);
183 }) 189 })
184 ->first(); 190 ->first();
185 if ($worker->dop_info->count()){ 191 if ($worker->dop_info->count()){
186 $worker->dop_info = $worker->dop_info->keyBy('infoblok_id')->toArray(); 192 $worker->dop_info = $worker->dop_info->keyBy('infoblok_id')->toArray();
187 } 193 }
188 194
189 return view('workers.form_additional_documents', compact('worker', 'info_blocks', 'additional_document_statuses')); 195 return view('workers.form_additional_documents', compact('worker', 'info_blocks', 'additional_document_statuses'));
190 } 196 }
191 197
192 //Лайк резюме 198 //Лайк резюме
193 public function like_controller() { 199 public function like_controller() {
194 200
195 } 201 }
196 202
197 // анкета соискателя 203 // анкета соискателя
198 public function resume_profile(Worker $worker) 204 public function resume_profile(Worker $worker)
199 { 205 {
200 if (isset(Auth()->user()->id)) { 206 if (isset(Auth()->user()->id)) {
201 $idiot = Auth()->user()->id; 207 $idiot = Auth()->user()->id;
202 } else { 208 } else {
203 $idiot = 0; 209 $idiot = 0;
204 } 210 }
205 211
206 $status_work = WorkerStatuses::getWorkerStatuses(); 212 $status_work = WorkerStatuses::getWorkerStatuses();
207 $Query = Worker::query()->with('users')->with('job_titles') 213 $Query = Worker::query()->with('users')->with('job_titles')
208 ->with('place_worker')->with('sertificate')->with('prev_company') 214 ->with('place_worker')->with('sertificate')->with('prev_company')
209 ->with('infobloks')->with('response'); 215 ->with('infobloks')->with('response');
210 $Query = $Query->where('id', '=', $worker->id); 216 $Query = $Query->where('id', '=', $worker->id);
211 $Query = $Query->get(); 217 $Query = $Query->get();
212 218
213 $get_date = date('Y.m'); 219 $get_date = date('Y.m');
214 220
215 $infoblocks = infobloks::query()->get(); 221 $infoblocks = infobloks::query()->get();
216 222
217 $c = Static_worker::query()->where('year_month', '=', $get_date) 223 $c = Static_worker::query()->where('year_month', '=', $get_date)
218 ->where('user_id', '=', $worker->user_id) 224 ->where('user_id', '=', $worker->user_id)
219 ->get(); 225 ->get();
220 226
221 if ($c->count() > 0) { 227 if ($c->count() > 0) {
222 $upd = Static_worker::find($c[0]->id); 228 $upd = Static_worker::find($c[0]->id);
223 $upd->lookin = $upd->lookin + 1; 229 $upd->lookin = $upd->lookin + 1;
224 $upd->save(); 230 $upd->save();
225 } else { 231 } else {
226 $crt = new Static_worker(); 232 $crt = new Static_worker();
227 $crt->lookin = 1; 233 $crt->lookin = 1;
228 $crt->year_month = $get_date; 234 $crt->year_month = $get_date;
229 $crt->user_id = $worker->user_id; 235 $crt->user_id = $worker->user_id;
230 $status = $crt->save(); 236 $status = $crt->save();
231 } 237 }
232 238
233 $stat = Static_worker::query()->where('year_month', '=', $get_date) 239 $stat = Static_worker::query()->where('year_month', '=', $get_date)
234 ->where('user_id', '=', $worker->user_id) 240 ->where('user_id', '=', $worker->user_id)
235 ->get(); 241 ->get();
236 242
237 return view('worker', compact('Query', 'infoblocks', 'status_work', 'idiot', 'stat')); 243 return view('worker', compact('Query', 'infoblocks', 'status_work', 'idiot', 'stat'));
238 } 244 }
239 245
240 // скачать анкету соискателя 246 // скачать анкету соискателя
241 public function resume_download(Worker $worker) 247 public function resume_download(Worker $worker)
242 { 248 {
243 $status_work = WorkerStatuses::getWorkerStatuses(); 249 $status_work = WorkerStatuses::getWorkerStatuses();
244 $Query = Worker::query()->with('users')->with('job_titles') 250 $Query = Worker::query()->with('users')->with('job_titles')
245 ->with('place_worker')->with('sertificate')->with('prev_company') 251 ->with('place_worker')->with('sertificate')->with('prev_company')
246 ->with('infobloks'); 252 ->with('infobloks');
247 $Query = $Query->where('id', '=', $worker->id); 253 $Query = $Query->where('id', '=', $worker->id);
248 $Query = $Query->get(); 254 $Query = $Query->get();
249 255
250 view()->share('Query',$Query); 256 view()->share('Query',$Query);
251 257
252 $status_work = WorkerStatuses::getWorkerStatuses(); 258 $status_work = WorkerStatuses::getWorkerStatuses();
253 $infoblocks = infobloks::query()->get(); 259 $infoblocks = infobloks::query()->get();
254 260
255 //return view('layout.pdf', compact('Query', 'status_work', 'infoblocks')); 261 //return view('layout.pdf', compact('Query', 'status_work', 'infoblocks'));
256 $pdf = PDF::loadView('layout.pdf', [ 262 $pdf = PDF::loadView('layout.pdf', [
257 'Query' => $Query, 263 'Query' => $Query,
258 'status_work' => $status_work, 264 'status_work' => $status_work,
259 'infoblocks' => $infoblocks 265 'infoblocks' => $infoblocks
260 ])->setPaper('a4', 'landscape'); 266 ])->setPaper('a4', 'landscape');
261 267
262 return $pdf->download(); 268 return $pdf->download();
263 } 269 }
264 270
265 public function resume_download_all(Request $request) { 271 public function resume_download_all(Request $request) {
266 $spreadsheet = new Spreadsheet(); 272 $spreadsheet = new Spreadsheet();
267 $sheet = $spreadsheet->getActiveSheet(); 273 $sheet = $spreadsheet->getActiveSheet();
268 274
269 $columnMap = range('A', 'Z'); 275 $columnMap = range('A', 'Z');
270 $columns = []; 276 $columns = [];
271 277
272 foreach (DbExportColumns::toArray() as $key => $value){ 278 foreach (DbExportColumns::toArray() as $key => $value){
273 if ($request->input($key, 0)){ 279 if ($request->input($key, 0)){
274 $sheet->setCellValue("{$columnMap[count($columns)]}1", ucfirst($value)); 280 $sheet->setCellValue("{$columnMap[count($columns)]}1", ucfirst($value));
275 $columns[] = str_replace('__', '.', $key); 281 $columns[] = str_replace('__', '.', $key);
276 } 282 }
277 } 283 }
278 284
279 if (empty($columns)) { 285 if (empty($columns)) {
280 return redirect()->back()->with('error', 'Пожалуйста выберите хотя бы 1 колонку для экспорта.'); 286 return redirect()->back()->with('error', 'Пожалуйста выберите хотя бы 1 колонку для экспорта.');
281 } 287 }
282 288
283 $jobIds = $request->input('job_title_list', []); 289 $jobIds = $request->input('job_title_list', []);
284 290
285 $users = DB::select( 291 /* //query for mysql ver 8.0 or higher
292 $users = DB::select(
286 "select `job_titles`.`name`, `users`.`surname`, `users`.`name_man`, `users`.`surname2`, `users`.`email`, `users`.`telephone` 293 "select `job_titles`.`name`, `users`.`surname`, `users`.`name_man`, `users`.`surname2`, `users`.`email`, `users`.`telephone`
287 from users 294 from users
288 join workers on `users`.`id` = `workers`.`user_id` 295 join workers on `users`.`id` = `workers`.`user_id`
289 join `job_titles` 296 join `job_titles`
290 where `users`.`is_bd` = 1 297 where `users`.`is_bd` = 1
291 and (`workers`.`position_work` = `job_titles`.`id` 298 and (`workers`.`position_work` = `job_titles`.`id`
292 or exists (select 1 299 or exists (select 1
293 from JSON_TABLE( 300 from JSON_TABLE(
294 workers.positions_work, 301 workers.positions_work,
295 '$[*]' COLUMNS (id INT PATH '$')) pw 302 '$[*]' COLUMNS (id INT PATH '$')) pw
296 where pw.id = job_titles.id) 303 where pw.id = job_titles.id)
297 )". ((!empty($jobIds)) ? 'and job_titles.id in ('. implode(',', $jobIds).')' : '') 304 )". ((!empty($jobIds)) ? 'and job_titles.id in ('. implode(',', $jobIds).')' : '')
305 );*/
306
307 $users = DB::select(
308 "select `job_titles`.`name`, `users`.`surname`, `users`.`name_man`, `users`.`surname2`, `users`.`email`, `users`.`telephone`
309 from users
310 join workers on `users`.`id` = `workers`.`user_id`
311 join `job_titles`
312 where `users`.`is_bd` = 1
313 and (`workers`.`position_work` = `job_titles`.`id`
314 or `workers`.`positions_work`
315 )". ((!empty($jobIds)) ? 'and job_titles.id in ('. implode(',', $jobIds).')' : '')
298 ); 316 );
299 317
300 $users = collect($users); 318 $users = collect($users);
301 319
302 if ($users->count()) { 320 if ($users->count()) {
303 $i = 2; 321 $i = 2;
304 foreach ($users->toArray() as $user){ 322 foreach ($users->toArray() as $user){
305 $j = 0; 323 $j = 0;
306 foreach ($user as $field){ 324 foreach ($user as $field){
307 $sheet->setCellValue("{$columnMap[$j++]}$i", $field); 325 $sheet->setCellValue("{$columnMap[$j++]}$i", $field);
308 } 326 }
309 $i++; 327 $i++;
310 } 328 }
311 } 329 }
312 $writer = new Xlsx($spreadsheet); 330 $writer = new Xlsx($spreadsheet);
313 $fileName = 'DB.xlsx'; 331 $fileName = 'DB.xlsx';
314 332
315 $response = new StreamedResponse(function() use ($writer) { 333 $response = new StreamedResponse(function() use ($writer) {
316 $writer->save('php://output'); 334 $writer->save('php://output');
317 }); 335 });
318 336
319 $response->headers->set('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); 337 $response->headers->set('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
320 $response->headers->set('Content-Disposition', 'attachment;filename="' . $fileName . '"'); 338 $response->headers->set('Content-Disposition', 'attachment;filename="' . $fileName . '"');
321 $response->headers->set('Cache-Control', 'max-age=0'); 339 $response->headers->set('Cache-Control', 'max-age=0');
322 340
323 return $response; 341 return $response;
324 } 342 }
325 343
326 // Кабинет работника 344 // Кабинет работника
327 public function cabinet(Request $request) 345 public function cabinet(Request $request)
328 { 346 {
329 // дата год и месяц 347 // дата год и месяц
330 $get_date = date('Y.m'); 348 $get_date = date('Y.m');
331 349
332 $id = Auth()->user()->id; 350 $id = Auth()->user()->id;
333 351
334 $Infobloks = infobloks::query()->get(); 352 $Infobloks = infobloks::query()->get();
335 353
336 $Worker = Worker::query() 354 $Worker = Worker::query()
337 ->with(['users', 'sertificate', 'prev_company', 'infobloks', 'place_worker']) 355 ->with(['users', 'sertificate', 'prev_company', 'infobloks', 'place_worker'])
338 ->WhereHas('users', function (Builder $query) use ($id) { 356 ->WhereHas('users', function (Builder $query) use ($id) {
339 $query->Where('id', $id); 357 $query->Where('id', $id);
340 })->first(); 358 })->first();
341 359
342 $Job_titles = Job_title::query()->where('is_remove', '=', '0') 360 $Job_titles = Job_title::query()->where('is_remove', '=', '0')
343 ->where('is_bd', '=' , '1') 361 ->where('is_bd', '=' , '1')
344 ->OrderByDesc('sort')->OrderBy('name') 362 ->OrderByDesc('sort')->OrderBy('name')
345 ->get(); 363 ->get();
346 364
347 $stat = Static_worker::query()->where('year_month', '=', $get_date) 365 $stat = Static_worker::query()->where('year_month', '=', $get_date)
348 ->where('user_id', '=', $id) 366 ->where('user_id', '=', $id)
349 ->get(); 367 ->get();
350 368
351 $persent = Tools::getWorkerProfilePercent($Worker); 369 $persent = Tools::getWorkerProfilePercent($Worker);
352 370
353 $status_work = WorkerStatuses::getWorkerStatuses(); 371 $status_work = WorkerStatuses::getWorkerStatuses();
354 $additional_document_statuses = [0 => 'Не указано', 1 => 'В наличии', 2 => 'Отсутствует']; 372 $additional_document_statuses = [0 => 'Не указано', 1 => 'В наличии', 2 => 'Отсутствует'];
355 $info_blocks = infobloks::query()->OrderBy('name')->get(); 373 $info_blocks = infobloks::query()->OrderBy('name')->get();
356 374
357 $worker = Worker::query() 375 $worker = Worker::query()
358 ->with('users') 376 ->with('users')
359 ->with('sertificate') 377 ->with('sertificate')
360 ->with('prev_company') 378 ->with('prev_company')
361 ->with('infobloks') 379 ->with('infobloks')
362 ->with('place_worker') 380 ->with('place_worker')
363 ->with('job_titles') 381 ->with('job_titles')
364 ->WhereHas('users', function (Builder $query) use ($id) { 382 ->WhereHas('users', function (Builder $query) use ($id) {
365 $query->Where('id', $id); 383 $query->Where('id', $id);
366 }) 384 })
367 ->first(); 385 ->first();
368 if ($worker->dop_info->count()){ 386 if ($worker->dop_info->count()){
369 $worker->dop_info = $worker->dop_info->keyBy('infoblok_id')->toArray(); 387 $worker->dop_info = $worker->dop_info->keyBy('infoblok_id')->toArray();
370 } 388 }
371 389
372 //dd($worker->dop_info); 390 //dd($worker->dop_info);
373 391
374 if ($request->has('print')) { 392 if ($request->has('print')) {
375 dd($Worker); 393 dd($Worker);
376 } else { 394 } else {
377 return view('workers.cabinet', compact( 'persent', 'Job_titles', 'stat', 395 return view('workers.cabinet', compact( 'persent', 'Job_titles', 'stat',
378 'worker', 'info_blocks', 'status_work', 'additional_document_statuses' 396 'worker', 'info_blocks', 'status_work', 'additional_document_statuses'
379 )); 397 ));
380 } 398 }
381 } 399 }
382 400
383 // Сохранение данных 401 // Сохранение данных
384 public function cabinet_save(Worker $worker, Request $request) 402 public function cabinet_save(Worker $worker, Request $request)
385 { 403 {
386 $id = $worker->id; 404 $id = $worker->id;
387 $params = $request->all(); 405 $params = $request->all();
388 $job_title_id = $request->get('job_title_id'); 406 $job_title_id = $request->get('job_title_id');
389 407
390 $rules = [ 408 $rules = [
391 'surname' => ['required', 'string', 'max:255'], 409 'surname' => ['required', 'string', 'max:255'],
392 'name_man' => ['required', 'string', 'max:255'], 410 'name_man' => ['required', 'string', 'max:255'],
393 'email' => ['required', 'string', 'email', 'max:255'], 411 'email' => ['required', 'string', 'email', 'max:255'],
394 412
395 ]; 413 ];
396 414
397 $messages = [ 415 $messages = [
398 'required' => 'Укажите обязательное поле', 416 'required' => 'Укажите обязательное поле',
399 'min' => [ 417 'min' => [
400 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 418 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
401 'integer' => 'Поле «:attribute» должно быть :min или больше', 419 'integer' => 'Поле «:attribute» должно быть :min или больше',
402 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 420 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
403 ], 421 ],
404 'max' => [ 422 'max' => [
405 'string' => 'Поле «:attribute» должно быть не больше :max символов', 423 'string' => 'Поле «:attribute» должно быть не больше :max символов',
406 'integer' => 'Поле «:attribute» должно быть :max или меньше', 424 'integer' => 'Поле «:attribute» должно быть :max или меньше',
407 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 425 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
408 ] 426 ]
409 ]; 427 ];
410 428
411 $validator = Validator::make($params, $rules, $messages); 429 $validator = Validator::make($params, $rules, $messages);
412 430
413 if ($validator->fails()) { 431 if ($validator->fails()) {
414 return redirect()->route('worker.cabinet')->withErrors($validator); 432 return redirect()->route('worker.cabinet')->withErrors($validator);
415 } else { 433 } else {
416 434
417 if ($request->has('photo')) { 435 if ($request->has('photo')) {
418 if (!empty($worker->photo)) { 436 if (!empty($worker->photo)) {
419 Storage::delete($worker->photo); 437 Storage::delete($worker->photo);
420 } 438 }
421 $params['photo'] = $request->file('photo')->store("worker/$id", 'public'); 439 $params['photo'] = $request->file('photo')->store("worker/$id", 'public');
422 } 440 }
423 441
424 if ($request->has('file')) { 442 if ($request->has('file')) {
425 if (!empty($worker->file)) { 443 if (!empty($worker->file)) {
426 Storage::delete($worker->file); 444 Storage::delete($worker->file);
427 } 445 }
428 $params['file'] = $request->file('file')->store("worker/$id", 'public'); 446 $params['file'] = $request->file('file')->store("worker/$id", 'public');
429 } 447 }
430 448
431 $worker->update($params); 449 $worker->update($params);
432 $use = User::find($worker->user_id); 450 $use = User::find($worker->user_id);
433 $use->surname = $request->get('surname'); 451 $use->surname = $request->get('surname');
434 $use->name_man = $request->get('name_man'); 452 $use->name_man = $request->get('name_man');
435 $use->surname2 = $request->get('surname2'); 453 $use->surname2 = $request->get('surname2');
436 454
437 $use->save(); 455 $use->save();
438 $worker->job_titles()->sync($job_title_id); 456 $worker->job_titles()->sync($job_title_id);
439 457
440 return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены'); 458 return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены');
441 } 459 }
442 } 460 }
443 461
444 public function cabinet_save_foto(Worker $worker, Request $request){ 462 public function cabinet_save_foto(Worker $worker, Request $request){
445 $params = ['photo' => null]; 463 $params = ['photo' => null];
446 464
447 if ($request->has('photo')) { 465 if ($request->has('photo')) {
448 if (!empty($worker->photo)) { 466 if (!empty($worker->photo)) {
449 Storage::delete($worker->photo); 467 Storage::delete($worker->photo);
450 } 468 }
451 $params['photo'] = $request->file('photo')->store("worker/$worker->id", 'public'); 469 $params['photo'] = $request->file('photo')->store("worker/$worker->id", 'public');
452 } 470 }
453 471
454 if ($request->has('file')) { 472 if ($request->has('file')) {
455 if (!empty($worker->file)) { 473 if (!empty($worker->file)) {
456 Storage::delete($worker->file); 474 Storage::delete($worker->file);
457 } 475 }
458 $params['file'] = $request->file('file')->store("worker/$worker->id", 'public'); 476 $params['file'] = $request->file('file')->store("worker/$worker->id", 'public');
459 } 477 }
460 478
461 $worker->update($params); 479 $worker->update($params);
462 480
463 return redirect()->route('worker.cabinet'); 481 return redirect()->route('worker.cabinet');
464 } 482 }
465 483
466 // Сообщения данные 484 // Сообщения данные
467 public function messages($type_message) 485 public function messages($type_message)
468 { 486 {
469 $user_id = Auth()->user()->id; 487 $user_id = Auth()->user()->id;
470 488
471 $chats = Chat::get_user_chats($user_id); 489 $chats = Chat::get_user_chats($user_id);
472 $admin_chat = Chat::get_user_admin_chat($user_id); 490 $admin_chat = Chat::get_user_admin_chat($user_id);
473 $user_type = 'worker'; 491 $user_type = 'worker';
474 492
475 return view('workers.messages', compact('chats', 'admin_chat','user_id', 'user_type')); 493 return view('workers.messages', compact('chats', 'admin_chat','user_id', 'user_type'));
476 } 494 }
477 495
478 // Избранный 496 // Избранный
479 public function favorite() 497 public function favorite()
480 { 498 {
481 return view('workers.favorite'); 499 return view('workers.favorite');
482 } 500 }
483 501
484 // Сменить пароль 502 // Сменить пароль
485 public function new_password() 503 public function new_password()
486 { 504 {
487 $email = Auth()->user()->email; 505 $email = Auth()->user()->email;
488 return view('workers.new_password', compact('email')); 506 return view('workers.new_password', compact('email'));
489 } 507 }
490 508
491 // Обновление пароля 509 // Обновление пароля
492 public function save_new_password(Request $request) { 510 public function save_new_password(Request $request) {
493 $use = Auth()->user(); 511 $use = Auth()->user();
494 $request->validate([ 512 $request->validate([
495 'password' => 'required|string', 513 'password' => 'required|string',
496 'new_password' => 'required|string', 514 'new_password' => 'required|string',
497 'new_password2' => 'required|string' 515 'new_password2' => 'required|string'
498 ]); 516 ]);
499 517
500 if ($request->get('new_password') == $request->get('new_password2')) 518 if ($request->get('new_password') == $request->get('new_password2'))
501 if ($request->get('password') !== $request->get('new_password')) { 519 if ($request->get('password') !== $request->get('new_password')) {
502 $credentials = $request->only('email', 'password'); 520 $credentials = $request->only('email', 'password');
503 if (Auth::attempt($credentials, $request->has('save_me'))) { 521 if (Auth::attempt($credentials, $request->has('save_me'))) {
504 522
505 if (!is_null($use->email_verified_at)){ 523 if (!is_null($use->email_verified_at)){
506 524
507 $user_data = User_Model::find($use->id); 525 $user_data = User_Model::find($use->id);
508 $user_data->update([ 526 $user_data->update([
509 'password' => Hash::make($request->get('new_password')), 527 'password' => Hash::make($request->get('new_password')),
510 'pubpassword' => base64_encode($request->get('new_password')), 528 'pubpassword' => base64_encode($request->get('new_password')),
511 ]); 529 ]);
512 return redirect() 530 return redirect()
513 ->route('worker.new_password') 531 ->route('worker.new_password')
514 ->with('success', 'Поздравляю! Вы обновили свой пароль!'); 532 ->with('success', 'Поздравляю! Вы обновили свой пароль!');
515 } 533 }
516 534
517 return redirect() 535 return redirect()
518 ->route('worker.new_password') 536 ->route('worker.new_password')
519 ->withError('Данная учетная запись не было верифицированна!'); 537 ->withError('Данная учетная запись не было верифицированна!');
520 } 538 }
521 } 539 }
522 540
523 return redirect() 541 return redirect()
524 ->route('worker.new_password') 542 ->route('worker.new_password')
525 ->withErrors('Не совпадение данных, обновите пароли!'); 543 ->withErrors('Не совпадение данных, обновите пароли!');
526 } 544 }
527 545
528 // Удаление профиля форма 546 // Удаление профиля форма
529 public function delete_profile() 547 public function delete_profile()
530 { 548 {
531 $login = Auth()->user()->email; 549 $login = Auth()->user()->email;
532 return view('workers.delete_profile', compact('login')); 550 return view('workers.delete_profile', compact('login'));
533 } 551 }
534 552
535 // Удаление профиля код 553 // Удаление профиля код
536 public function delete_profile_result(Request $request) { 554 public function delete_profile_result(Request $request) {
537 $Answer = $request->all(); 555 $Answer = $request->all();
538 $user_id = Auth()->user()->id; 556 $user_id = Auth()->user()->id;
539 $request->validate([ 557 $request->validate([
540 'password' => 'required|string', 558 'password' => 'required|string',
541 ]); 559 ]);
542 560
543 $credentials = $request->only('email', 'password'); 561 $credentials = $request->only('email', 'password');
544 if (Auth::attempt($credentials)) { 562 if (Auth::attempt($credentials)) {
545 Auth::logout(); 563 Auth::logout();
546 $it = User_Model::find($user_id); 564 $it = User_Model::find($user_id);
547 $it->delete(); 565 $it->delete();
548 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); 566 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт');
549 } else { 567 } else {
550 return redirect()->route('worker.delete_profile') 568 return redirect()->route('worker.delete_profile')
551 ->withErrors( 'Неверный пароль! Нужен корректный пароль'); 569 ->withErrors( 'Неверный пароль! Нужен корректный пароль');
552 } 570 }
553 } 571 }
554 572
555 // Регистрация соискателя 573 // Регистрация соискателя
556 public function register_worker(Request $request) 574 public function register_worker(Request $request)
557 { 575 {
558 $params = $request->all(); 576 $params = $request->all();
559 $params['is_worker'] = 1; 577 $params['is_worker'] = 1;
560 578
561 $rules = [ 579 $rules = [
562 'surname' => ['required', 'string', 'max:255'], 580 'surname' => ['required', 'string', 'max:255'],
563 'name_man' => ['required', 'string', 'max:255'], 581 'name_man' => ['required', 'string', 'max:255'],
564 'email' => ['required', 'email', 'max:255', 'unique:users'], 582 'email' => ['required', 'email', 'max:255', 'unique:users'],
565 'password' => ['required', 'string', 'min:6'] 583 'password' => ['required', 'string', 'min:6']
566 ]; 584 ];
567 585
568 $messages = [ 586 $messages = [
569 'required' => 'Укажите обязательное поле', 587 'required' => 'Укажите обязательное поле',
570 'min' => [ 588 'min' => [
571 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 589 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
572 'integer' => 'Поле «:attribute» должно быть :min или больше', 590 'integer' => 'Поле «:attribute» должно быть :min или больше',
573 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 591 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
574 ], 592 ],
575 'max' => [ 593 'max' => [
576 'string' => 'Поле «:attribute» должно быть не больше :max символов', 594 'string' => 'Поле «:attribute» должно быть не больше :max символов',
577 'integer' => 'Поле «:attribute» должно быть :max или меньше', 595 'integer' => 'Поле «:attribute» должно быть :max или меньше',
578 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 596 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
579 ] 597 ]
580 ]; 598 ];
581 599
582 $email = $request->get('email'); 600 $email = $request->get('email');
583 if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { 601 if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) {
584 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); 602 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл"));
585 } 603 }
586 604
587 if ($request->get('password') !== $request->get('confirmed')){ 605 if ($request->get('password') !== $request->get('confirmed')){
588 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); 606 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля"));
589 } 607 }
590 608
591 if (strlen($request->get('password')) < 6) { 609 if (strlen($request->get('password')) < 6) {
592 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); 610 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!"));
593 } 611 }
594 612
595 if (($request->has('politik')) && ($request->get('politik') == 1)) { 613 if (($request->has('politik')) && ($request->get('politik') == 1)) {
596 $validator = Validator::make($params, $rules, $messages); 614 $validator = Validator::make($params, $rules, $messages);
597 615
598 if ($validator->fails()) { 616 if ($validator->fails()) {
599 return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); 617 return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе."));
600 } else { 618 } else {
601 $user = $this->create($params); 619 $user = $this->create($params);
602 event(new Registered($user)); 620 event(new Registered($user));
603 Auth::guard()->login($user); 621 Auth::guard()->login($user);
604 } 622 }
605 if ($user) { 623 if ($user) {
606 return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));; 624 return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));;
607 } else { 625 } else {
608 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); 626 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!"));
609 } 627 }
610 628
611 } else { 629 } else {
612 return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!")); 630 return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!"));
613 } 631 }
614 } 632 }
615 633
616 // Звездная оценка и ответ 634 // Звездная оценка и ответ
617 public function stars_answer(Request $request) { 635 public function stars_answer(Request $request) {
618 $params = $request->all(); 636 $params = $request->all();
619 $rules = [ 637 $rules = [
620 'message' => ['required', 'string', 'max:255'], 638 'message' => ['required', 'string', 'max:255'],
621 ]; 639 ];
622 640
623 $messages = [ 641 $messages = [
624 'required' => 'Укажите обязательное поле', 642 'required' => 'Укажите обязательное поле',
625 'min' => [ 643 'min' => [
626 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 644 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
627 'integer' => 'Поле «:attribute» должно быть :min или больше', 645 'integer' => 'Поле «:attribute» должно быть :min или больше',
628 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 646 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
629 ], 647 ],
630 'max' => [ 648 'max' => [
631 'string' => 'Поле «:attribute» должно быть не больше :max символов', 649 'string' => 'Поле «:attribute» должно быть не больше :max символов',
632 'integer' => 'Поле «:attribute» должно быть :max или меньше', 650 'integer' => 'Поле «:attribute» должно быть :max или меньше',
633 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 651 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
634 ] 652 ]
635 ]; 653 ];
636 $response_worker = ResponseWork::create($params); 654 $response_worker = ResponseWork::create($params);
637 return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!'); 655 return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!');
638 } 656 }
639 657
640 public function TestWorker() 658 public function TestWorker()
641 { 659 {
642 $Use = new User(); 660 $Use = new User();
643 661
644 $Code_user = $Use->create([ 662 $Code_user = $Use->create([
645 'name' => 'surname name_man', 663 'name' => 'surname name_man',
646 'name_man' => 'name_man', 664 'name_man' => 'name_man',
647 'surname' => 'surname', 665 'surname' => 'surname',
648 'surname2' => 'surname2', 666 'surname2' => 'surname2',
649 'subscribe_email' => '1', 667 'subscribe_email' => '1',
650 'email' => 'email@mail.com', 668 'email' => 'email@mail.com',
651 'telephone' => '1234567890', 669 'telephone' => '1234567890',
652 'password' => Hash::make('password'), 670 'password' => Hash::make('password'),
653 'pubpassword' => base64_encode('password'), 671 'pubpassword' => base64_encode('password'),
654 'email_verified_at' => Carbon::now(), 672 'email_verified_at' => Carbon::now(),
655 'is_worker' => 1, 673 'is_worker' => 1,
656 ]); 674 ]);
657 675
658 if ($Code_user->id > 0) { 676 if ($Code_user->id > 0) {
659 $Worker = new Worker(); 677 $Worker = new Worker();
660 $Worker->user_id = $Code_user->id; 678 $Worker->user_id = $Code_user->id;
661 $Worker->position_work = 1; //'job_titles'; 679 $Worker->position_work = 1; //'job_titles';
662 $Worker->email = 'email@email.com'; 680 $Worker->email = 'email@email.com';
663 $Worker->telephone = '1234567890'; 681 $Worker->telephone = '1234567890';
664 $status = $Worker->save(); 682 $status = $Worker->save();
665 683
666 $Title_Worker = new Title_worker(); 684 $Title_Worker = new Title_worker();
667 $Title_Worker->worker_id = $Worker->id; 685 $Title_Worker->worker_id = $Worker->id;
668 $Title_Worker->job_title_id = 1; 686 $Title_Worker->job_title_id = 1;
669 $Title_Worker->save(); 687 $Title_Worker->save();
670 } 688 }
671 } 689 }
672 690
673 // Создание пользователя 691 // Создание пользователя
674 protected function create(array $data) 692 protected function create(array $data)
675 { 693 {
676 $Use = new User(); 694 $Use = new User();
677 695
678 $Code_user = $Use->create([ 696 $Code_user = $Use->create([
679 'name' => $data['surname']." ".$data['name_man'], 697 'name' => $data['surname']." ".$data['name_man'],
680 'name_man' => $data['name_man'], 698 'name_man' => $data['name_man'],
681 'surname' => $data['surname'], 699 'surname' => $data['surname'],
682 'surname2' => $data['surname2'], 700 'surname2' => $data['surname2'],
683 'subscribe_email' => $data['email'], 701 'subscribe_email' => $data['email'],
684 'email' => $data['email'], 702 'email' => $data['email'],
685 'telephone' => $data['telephone'], 703 'telephone' => $data['telephone'],
686 'password' => Hash::make($data['password']), 704 'password' => Hash::make($data['password']),
687 'pubpassword' => base64_encode($data['password']), 705 'pubpassword' => base64_encode($data['password']),
688 'email_verified_at' => Carbon::now(), 706 'email_verified_at' => Carbon::now(),
689 'is_worker' => $data['is_worker'], 707 'is_worker' => $data['is_worker'],
690 ]); 708 ]);
691 709
692 if ($Code_user->id > 0) { 710 if ($Code_user->id > 0) {
693 $Worker = new Worker(); 711 $Worker = new Worker();
694 $Worker->user_id = $Code_user->id; 712 $Worker->user_id = $Code_user->id;
695 $Worker->position_work = $data['job_titles']; 713 $Worker->position_work = $data['job_titles'];
696 $Worker->email = $data['email']; 714 $Worker->email = $data['email'];
697 $Worker->telephone = $data['telephone']; 715 $Worker->telephone = $data['telephone'];
698 $Worker->save(); 716 $Worker->save();
699 717
700 if (isset($Worker->id)) { 718 if (isset($Worker->id)) {
701 $Title_Worker = new Title_worker(); 719 $Title_Worker = new Title_worker();
702 $Title_Worker->worker_id = $Worker->id; 720 $Title_Worker->worker_id = $Worker->id;
703 $Title_Worker->job_title_id = $data['job_titles']; 721 $Title_Worker->job_title_id = $data['job_titles'];
704 $Title_Worker->save(); 722 $Title_Worker->save();
705 } 723 }
706 724
707 return $Code_user; 725 return $Code_user;
708 } 726 }
709 } 727 }
710 728
711 // Вакансии избранные 729 // Вакансии избранные
712 public function colorado(Request $request) { 730 public function colorado(Request $request) {
713 $Arr = Like_vacancy::Query() 731 $Arr = Like_vacancy::Query()
714 ->select('code_record') 732 ->select('code_record')
715 ->where('user_id', Auth::user()->id) 733 ->where('user_id', Auth::user()->id)
716 ->get(); 734 ->get();
717 735
718 if ($Arr->count()) { 736 if ($Arr->count()) {
719 $A = Array(); 737 $A = Array();
720 foreach ($Arr as $it) { 738 foreach ($Arr as $it) {
721 $A[] = $it->code_record; 739 $A[] = $it->code_record;
722 } 740 }
723 741
724 $Query = Ad_employer::query()->whereIn('id', $A); 742 $Query = Ad_employer::query()->whereIn('id', $A);
725 } else { 743 } else {
726 $Query = Ad_employer::query()->where('id', '=', '0'); 744 $Query = Ad_employer::query()->where('id', '=', '0');
727 } 745 }
728 746
729 $Query = $Query->with(['jobs', 'cat', 'employer']) 747 $Query = $Query->with(['jobs', 'cat', 'employer'])
730 ->whereHas('jobs_code', function ($query) use ($request) { 748 ->whereHas('jobs_code', function ($query) use ($request) {
731 if ($request->ajax()) { 749 if ($request->ajax()) {
732 if (null !== ($request->get('job'))) { 750 if (null !== ($request->get('job'))) {
733 $query->where('job_title_id', $request->get('job')); 751 $query->where('job_title_id', $request->get('job'));
734 } 752 }
735 } 753 }
736 }) 754 })
737 ->select('ad_employers.*'); 755 ->select('ad_employers.*');
738 756
739 if ($request->get('search') !== null) { 757 if ($request->get('search') !== null) {
740 $search = $request->get('search'); 758 $search = $request->get('search');
741 $Query->where('name', 'LIKE', "%$search%"); 759 $Query->where('name', 'LIKE', "%$search%");
742 } 760 }
743 761
744 //dd($Query->get()); 762 //dd($Query->get());
745 763
746 $Job_title = Job_title::query()->OrderBy('name')->get(); 764 $Job_title = Job_title::query()->OrderBy('name')->get();
747 765
748 $Query_count = $Query->count(); 766 $Query_count = $Query->count();
749 767
750 $Query = $Query->OrderBy('updated_at')->paginate(3); 768 $Query = $Query->OrderBy('updated_at')->paginate(3);
751 769
752 return view('workers.favorite', compact('Query', 770 return view('workers.favorite', compact('Query',
753 'Query_count', 771 'Query_count',
754 'Job_title')); 772 'Job_title'));
755 773
756 } 774 }
757 775
758 //Переписка 776 //Переписка
759 public function dialog(Chat $chat, Request $request) { 777 public function dialog(Chat $chat, Request $request) {
760 // Получение параметров. 778 // Получение параметров.
761 if ($request->has('ad_employer')){ 779 if ($request->has('ad_employer')){
762 $ad_employer = $request->get('ad_employer'); 780 $ad_employer = $request->get('ad_employer');
763 } else { 781 } else {
764 $ad_employer = 0; 782 $ad_employer = 0;
765 } 783 }
766 784
767 $sender = User_Model::query()->with('workers')->with('employers')->where('id', $chat->user_id)->first(); 785 $sender = User_Model::query()->with('workers')->with('employers')->where('id', $chat->user_id)->first();
768 $companion = User_Model::query()->with('workers')->with('employers')->where('id', $chat->to_user_id)->first(); 786 $companion = User_Model::query()->with('workers')->with('employers')->where('id', $chat->to_user_id)->first();
769 787
770 $Messages = Chat::get_chat_messages($chat); 788 $Messages = Chat::get_chat_messages($chat);
771 789
772 Message::where('chat_id_to', '=', $chat->id)->update(['flag_new' => 0]); 790 Message::where('chat_id_to', '=', $chat->id)->update(['flag_new' => 0]);
773 791
774 return view('workers.dialog', compact('companion', 'sender', 'chat', 'Messages', 'ad_employer')); 792 return view('workers.dialog', compact('companion', 'sender', 'chat', 'Messages', 'ad_employer'));
775 } 793 }
776 794
777 // Даунылоады 795 // Даунылоады
778 public function download(Worker $worker) { 796 public function download(Worker $worker) {
779 $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...']; 797 $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...'];
780 view()->share('house',$arr_house); 798 view()->share('house',$arr_house);
781 $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape'); 799 $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape');
782 return $pdf->stream(); 800 return $pdf->stream();
783 } 801 }
784 802
785 // Поднятие анкеты 803 // Поднятие анкеты
786 public function up(Worker $worker) { 804 public function up(Worker $worker) {
787 $worker->updated_at = Carbon::now(); 805 $worker->updated_at = Carbon::now();
788 $worker->save(); 806 $worker->save();
789 // 0 807 // 0
790 return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); 808 return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных');
791 } 809 }
792 810
793 // Форма сертификате 811 // Форма сертификате
794 public function new_sertificate(Worker $worker) { 812 public function new_sertificate(Worker $worker) {
795 return view('workers.sertificate_add', compact('worker')); 813 return view('workers.sertificate_add', compact('worker'));
796 } 814 }
797 815
798 // Добавление сертификата 816 // Добавление сертификата
799 public function add_serificate(SertificationRequest $request) { 817 public function add_serificate(SertificationRequest $request) {
800 $request->validate([ 818 $request->validate([
801 'name' => 'required|string|max:255', 819 'name' => 'required|string|max:255',
802 'end_begin' => 'required|date|date_format:d.m.Y' 820 'end_begin' => 'required|date|date_format:d.m.Y'
803 ], 821 ],
804 [ 822 [
805 'name' => 'Навание сертификата обязательно для заполнения.', 823 'name' => 'Навание сертификата обязательно для заполнения.',
806 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг' 824 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг'
807 ]); 825 ]);
808 826
809 $params = $request->all(); 827 $params = $request->all();
810 828
811 $end_begin = DateTime::createFromFormat('d.m.Y', $params['end_begin']); 829 $end_begin = DateTime::createFromFormat('d.m.Y', $params['end_begin']);
812 $params['end_begin'] = $end_begin->format('Y-m-d'); 830 $params['end_begin'] = $end_begin->format('Y-m-d');
813 831
814 $Sertificate = new sertification(); 832 $Sertificate = new sertification();
815 $Sertificate->create($params); 833 $Sertificate->create($params);
816 834
817 return response()->json([ 835 return response()->json([
818 'success' => true 836 'success' => true
819 ]); 837 ]);
820 } 838 }
821 839
822 // Удалить сертификат 840 // Удалить сертификат
823 public function delete_sertificate(sertification $doc) { 841 public function delete_sertificate(sertification $doc) {
824 $doc->delete(); 842 $doc->delete();
825 843
826 return redirect()->route('worker.cabinet'); 844 return redirect()->route('worker.cabinet');
827 } 845 }
828 846
829 // Редактирование сертификата 847 // Редактирование сертификата
830 public function edit_sertificate(Worker $worker, sertification $doc) { 848 public function edit_sertificate(Worker $worker, sertification $doc) {
831 return view('workers.sertificate_edit', compact('doc', 'worker')); 849 return view('workers.sertificate_edit', compact('doc', 'worker'));
832 } 850 }
833 851
834 // Редактирование обновление сертификата 852 // Редактирование обновление сертификата
835 public function update_serificate(SertificationRequest $request, sertification $doc) { 853 public function update_serificate(SertificationRequest $request, sertification $doc) {
836 $request->validate([ 854 $request->validate([
837 'name' => 'required|string|max:255', 855 'name' => 'required|string|max:255',
838 'end_begin' => 'required|date|date_format:d.m.Y' 856 'end_begin' => 'required|date|date_format:d.m.Y'
839 ], 857 ],
840 [ 858 [
841 'name' => 'Навание сертификата обязательно для заполнения.', 859 'name' => 'Навание сертификата обязательно для заполнения.',
842 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг' 860 'end_begin' => 'Формат даты должен соответствовать дд.мм.гггг'
843 ]); 861 ]);
844 862
845 $all = $request->all(); 863 $all = $request->all();
846 864
847 $end_begin = DateTime::createFromFormat('d.m.Y', $all['end_begin']); 865 $end_begin = DateTime::createFromFormat('d.m.Y', $all['end_begin']);
848 $all['end_begin'] = $end_begin->format('Y-m-d'); 866 $all['end_begin'] = $end_begin->format('Y-m-d');
849 867
850 $doc->worker_id = $all['worker_id']; 868 $doc->worker_id = $all['worker_id'];
851 $doc->name = $all['name']; 869 $doc->name = $all['name'];
852 $doc->end_begin = $all['end_begin']; 870 $doc->end_begin = $all['end_begin'];
853 $doc->save(); 871 $doc->save();
854 872
855 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); 873 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!');
856 } 874 }
857 875
858 public function edit_diploms(Request $request, Worker $worker) { 876 public function edit_diploms(Request $request, Worker $worker) {
859 $dop_info_data = $request->input('diploms'); 877 $dop_info_data = $request->input('diploms');
860 878
861 if (empty($dop_info_data)) { 879 if (empty($dop_info_data)) {
862 return redirect()->route('worker.additional_documents')->with('error', 'Данные не предоставлены!'); 880 return redirect()->route('worker.additional_documents')->with('error', 'Данные не предоставлены!');
863 } 881 }
864 882
865 foreach ($dop_info_data as $infoblok_id => $status) { 883 foreach ($dop_info_data as $infoblok_id => $status) {
866 Dop_info::updateOrCreate( 884 Dop_info::updateOrCreate(
867 ['worker_id' => $worker->id, 'infoblok_id' => $infoblok_id], 885 ['worker_id' => $worker->id, 'infoblok_id' => $infoblok_id],
868 ['status' => $status] 886 ['status' => $status]
869 ); 887 );
870 } 888 }
871 889
872 return redirect()->route('worker.additional_documents')->with('success', 'Успешно сохранено!'); 890 return redirect()->route('worker.additional_documents')->with('success', 'Успешно сохранено!');
873 } 891 }
874 892
875 public function delete_add_diplom(Request $request, Worker $worker) { 893 public function delete_add_diplom(Request $request, Worker $worker) {
876 $infoblok_id = $request->get('infoblok_id'); 894 $infoblok_id = $request->get('infoblok_id');
877 895
878 if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0) 896 if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0)
879 $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete(); 897 $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete();
880 else { 898 else {
881 $params['infoblok_id'] = $infoblok_id; 899 $params['infoblok_id'] = $infoblok_id;
882 $params['worker_id'] = $worker->id; 900 $params['worker_id'] = $worker->id;
883 $params['status'] = $request->get('val'); 901 $params['status'] = $request->get('val');
884 $id = Dop_info::create($params); 902 $id = Dop_info::create($params);
885 //$id = $worker->infobloks()->sync([$infoblok_id]); 903 //$id = $worker->infobloks()->sync([$infoblok_id]);
886 } 904 }
887 905
888 //$Infoblocks = infobloks::query()->get(); 906 //$Infoblocks = infobloks::query()->get();
889 return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); 907 return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks'));
890 } 908 }
891 909
892 910
893 911
894 // Добавление диплома 912 // Добавление диплома
895 public function add_diplom_ajax(Request $request) { 913 public function add_diplom_ajax(Request $request) {
896 // конец 914 // конец
897 $params = $request->all(); 915 $params = $request->all();
898 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); 916 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count();
899 917
900 if ($count == 0) $dop_info = Dop_info::create($params); 918 if ($count == 0) $dop_info = Dop_info::create($params);
901 $Infoblocks = infobloks::query()->get(); 919 $Infoblocks = infobloks::query()->get();
902 $Worker = Worker::query()->where('id', $request->get('worker_id'))->get(); 920 $Worker = Worker::query()->where('id', $request->get('worker_id'))->get();
903 $data = Dop_info::query()->where('worker_id', $request->has('worker_id')); 921 $data = Dop_info::query()->where('worker_id', $request->has('worker_id'));
904 return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker')); 922 return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker'));
905 } 923 }
906 924
907 // Добавление диплома без ajax 925 // Добавление диплома без ajax
908 public function add_diplom(Worker $worker) { 926 public function add_diplom(Worker $worker) {
909 $worker_id = $worker->id; 927 $worker_id = $worker->id;
910 $Infoblocks = infobloks::query()->get(); 928 $Infoblocks = infobloks::query()->get();
911 return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks')); 929 return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks'));
912 } 930 }
913 // Сохранить 931 // Сохранить
914 // Сохраняю диплом 932 // Сохраняю диплом
915 public function add_diplom_save(Request $request) { 933 public function add_diplom_save(Request $request) {
916 $params = $request->all(); 934 $params = $request->all();
917 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); 935 $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count();
918 if ($count == 0) $dop_info = Dop_info::create($params); 936 if ($count == 0) $dop_info = Dop_info::create($params);
919 return redirect()->route('worker.cabinet'); 937 return redirect()->route('worker.cabinet');
920 } 938 }
921 939
922 // Добавление стандартного документа 940 // Добавление стандартного документа
923 public function add_document(Worker $worker) { 941 public function add_document(Worker $worker) {
924 return view('workers.docs', compact('worker')); 942 return view('workers.docs', compact('worker'));
925 } 943 }
926 944
927 //Сохранение стандартого документа 945 //Сохранение стандартого документа
928 public function add_document_save(DocumentsRequest $request) { 946 public function add_document_save(DocumentsRequest $request) {
929 $params = $request->all(); 947 $params = $request->all();
930 place_works::create($params); 948 place_works::create($params);
931 return response()->json(['success' => true]); 949 return response()->json(['success' => true]);
932 } 950 }
933 951
934 // Редактирование документа 952 // Редактирование документа
935 public function edit_document(place_works $doc, Worker $worker) { 953 public function edit_document(place_works $doc, Worker $worker) {
936 return view('workers.docs-edit', compact('doc', 'worker')); 954 return view('workers.docs-edit', compact('doc', 'worker'));
937 } 955 }
938 956
939 //Сохранение отредактированного документа 957 //Сохранение отредактированного документа
940 public function edit_document_save(DocumentsRequest $request, place_works $doc) { 958 public function edit_document_save(DocumentsRequest $request, place_works $doc) {
941 $params = $request->all(); 959 $params = $request->all();
942 $doc->update($params); 960 $doc->update($params);
943 961
944 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); 962 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!');
945 } 963 }
946 964
947 // Удаление документа 965 // Удаление документа
948 public function delete_document(place_works $doc) { 966 public function delete_document(place_works $doc) {
949 $doc->delete(); 967 $doc->delete();
950 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); 968 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!');
951 } 969 }
952 970
953 //Отправка нового сообщения 971 //Отправка нового сообщения
954 public function new_message(Request $request) 972 public function new_message(Request $request)
955 { 973 {
956 $params = $request->all(); 974 $params = $request->all();
957 975
958 $id = $params['user_from']; 976 $id = $params['user_from'];
959 977
960 Message::add_message( 978 Message::add_message(
961 $request, 979 $request,
962 $params['user_from'], 980 $params['user_from'],
963 $params['user_to'], 981 $params['user_to'],
964 [ 982 [
965 'text' => $params['comment'] ?? null, 983 'text' => $params['comment'] ?? null,
966 'ad_employer_id' => $params['vacancy'], 984 'ad_employer_id' => $params['vacancy'],
967 'flag_new' => 1 985 'flag_new' => 1
968 ], 986 ],
969 file_store_path: "worker/$id" 987 file_store_path: "worker/$id"
970 ); 988 );
971 989
972 if ($request->ajax()) { 990 if ($request->ajax()) {
973 return response([]); 991 return response([]);
974 } 992 }
975 return redirect()->back(); 993 return redirect()->back();
976 } 994 }
977 995
978 996
979 public function test123(Request $request) { 997 public function test123(Request $request) {
980 $params = $request->all(); 998 $params = $request->all();
981 $user1 = $params['user_id']; 999 $user1 = $params['user_id'];
982 $user2 = $params['to_user_id']; 1000 $user2 = $params['to_user_id'];
983 1001
984 $rules = [ 1002 $rules = [
985 'text' => 'nullable|required_without:file|min:1|max:150000', 1003 'text' => 'nullable|required_without:file|min:1|max:150000',
986 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' 1004 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000'
987 ]; 1005 ];
988 $messages = [ 1006 $messages = [
989 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен', 1007 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен',
990 'min' => [ 1008 'min' => [
991 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 1009 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
992 'integer' => 'Поле «:attribute» должно быть :min или больше', 1010 'integer' => 'Поле «:attribute» должно быть :min или больше',
993 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 1011 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
994 ], 1012 ],
995 'max' => [ 1013 'max' => [
996 'string' => 'Поле «:attribute» должно быть не больше :max символов', 1014 'string' => 'Поле «:attribute» должно быть не больше :max символов',
997 'integer' => 'Поле «:attribute» должно быть :max или меньше', 1015 'integer' => 'Поле «:attribute» должно быть :max или меньше',
998 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 1016 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
999 ] 1017 ]
1000 ]; 1018 ];
1001 1019
1002 $validator = Validator::make($request->all(), $rules, $messages); 1020 $validator = Validator::make($request->all(), $rules, $messages);
1003 1021
1004 if ($validator->fails()) { 1022 if ($validator->fails()) {
1005 $chat = Chat::where('user_id', $user1) 1023 $chat = Chat::where('user_id', $user1)
1006 ->where('to_user_id', $user2) 1024 ->where('to_user_id', $user2)
1007 ->where('is_removed', 0) 1025 ->where('is_removed', 0)
1008 ->first() 1026 ->first()
1009 ; 1027 ;
1010 1028
1011 if ($chat->id){ 1029 if ($chat->id){
1012 return redirect()->route('worker.dialog', ['chat' => $chat->id])->withErrors($validator); 1030 return redirect()->route('worker.dialog', ['chat' => $chat->id])->withErrors($validator);
1013 } else { 1031 } else {
1014 return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator); 1032 return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator);
1015 } 1033 }
1016 } else { 1034 } else {
1017 $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages'); 1035 $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages');
1018 1036
1019 return redirect()->route('worker.dialog', ['chat' => $new_message->chat_id_from]); 1037 return redirect()->route('worker.dialog', ['chat' => $new_message->chat_id_from]);
1020 1038
1021 } 1039 }
1022 } 1040 }
1023 1041
1024 // Информация о предыдущих компаниях 1042 // Информация о предыдущих компаниях
1025 public function new_prev_company(Worker $worker) { 1043 public function new_prev_company(Worker $worker) {
1026 return view('workers.prev_company_form', compact('worker')); 1044 return view('workers.prev_company_form', compact('worker'));
1027 } 1045 }
1028 1046
1029 // Добавление контакта компании 1047 // Добавление контакта компании
1030 public function add_prev_company(PrevCompanyRequest $request) { 1048 public function add_prev_company(PrevCompanyRequest $request) {
1031 // Возвращение параметров 1049 // Возвращение параметров
1032 $all = $request->all(); 1050 $all = $request->all();
1033 PrevCompany::create($all); 1051 PrevCompany::create($all);
1034 1052
1035 return response()->json(['success' => true]); 1053 return response()->json(['success' => true]);
1036 } 1054 }
1037 1055
1038 // Редактирование контакта компании 1056 // Редактирование контакта компании
1039 public function edit_prev_company(PrevCompany $doc, Worker $worker) { 1057 public function edit_prev_company(PrevCompany $doc, Worker $worker) {
1040 return view('workers.prev_company_edit_form', compact('doc', 'worker')); 1058 return view('workers.prev_company_edit_form', compact('doc', 'worker'));
1041 } 1059 }
1042 1060
1043 //Сохранение редактирования контакта компании 1061 //Сохранение редактирования контакта компании
1044 public function update_prev_company(PrevCompany $doc, Request $request){ 1062 public function update_prev_company(PrevCompany $doc, Request $request){
1045 $all = $request->all(); 1063 $all = $request->all();
1046 $doc->update($all); 1064 $doc->update($all);
1047 1065
1048 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); 1066 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись');
1049 } 1067 }
1050 1068
1051 // Удаление контакта предыдущей компании 1069 // Удаление контакта предыдущей компании
1052 public function delete_prev_company(PrevCompany $doc) { 1070 public function delete_prev_company(PrevCompany $doc) {
1053 $doc->delete(); 1071 $doc->delete();
1054 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); 1072 return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!');
1055 } 1073 }
1074
1075 public function autoresponder()
1076 {
1077 $user = Auth::user();
1078 return view('workers.autoresponder', compact('user'));
1079 }
1080
1081 public function autoresponderSave(Request $request): RedirectResponse
1082 {
1083 /** @var Employer $employer */
1084 $employer = Auth::user();
1085 $employer->autoresponder = $request->get('autoresponder', false) === 'on';
1086 $employer->autoresponder_message = $request->get('autoresponder_message');
1087 $employer->save();
1088
1089 return redirect(route('worker.autoresponder'));
1090 }
1091 /**
1092 * @throws JsonException
1093 */
1094 public function resumeAutoLiftForm(): View
1095 {
1096 $worker = Auth::user()->workers[0];
1097
1098 $options = $worker->autoliftOptions ?? new WorkerAutoliftOption();
1099
1100 return view('workers.resume_autolift', compact('worker', 'options'));
1101 }
1102
1103 /**
1104 * @throws JsonException
1105 */
1106 public function resumeAutoLiftSave(Request $request)
1107 {
1108 $worker = Auth::user()->workers[0];
1109
1110 $worker->autoliftOptions()->updateOrCreate(
1111 [
1112 'worker_id' => $worker->id,
1113 ],
1114 [
1115 'is_enabled' => $request->get('is_enabled') === 'on',
1116 'times_per_day' => $request->get('times_per_day'),
1117 'days_repeat' => $request->get('days_repeat'),
1118 'time_send_first' => $request->get('time_send_first'),
1119 'time_send_second' => $request->get('time_send_second'),
1120 'time_send_third' => $request->get('time_send_third'),
1121 'time_send_tg' => $request->get('time_send_tg'),
1122 'autolift_site' => $request->get('autolift_site') === 'on',
1123 ]
1124 );
1125
1126 return response()->json(['success' => true]);
1127 }
1056 } 1128 }
1057 1129
1058 1130
app/Jobs/LiftResumeJob.php
File was created 1 <?php
2
3 namespace App\Jobs;
4
5 use App\Models\Ad_employer;
6 use App\Models\Worker;
7 use Illuminate\Bus\Queueable;
8 use Illuminate\Contracts\Queue\ShouldQueue;
9 use Illuminate\Foundation\Bus\Dispatchable;
10 use Illuminate\Queue\InteractsWithQueue;
11 use Illuminate\Queue\SerializesModels;
12
13 class LiftResumeJob implements ShouldQueue
14 {
15 use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
16
17 private array $workerIds;
18
19 public function __construct(array $workerIds)
20 {
21 $this->workerIds = $workerIds;
22 }
23
24 public function handle()
25 {
26 Worker::query()
27 ->whereIn('id', $this->workerIds)
28 ->update([
29 'updated_at' => now()
30 ]);
31 }
32 }
33
app/Models/Employer.php
1 <?php 1 <?php
2 2
3 namespace App\Models; 3 namespace App\Models;
4 4
5 use Illuminate\Database\Eloquent\Casts\Attribute; 5 use Illuminate\Database\Eloquent\Casts\Attribute;
6 use Illuminate\Database\Eloquent\Factories\HasFactory; 6 use Illuminate\Database\Eloquent\Factories\HasFactory;
7 use Illuminate\Database\Eloquent\Model; 7 use Illuminate\Database\Eloquent\Model;
8 use Illuminate\Database\Eloquent\Relations\HasMany; 8 use Illuminate\Database\Eloquent\Relations\HasMany;
9 9
10 class Employer extends Model 10 class Employer extends Model
11 { 11 {
12 use HasFactory; 12 use HasFactory;
13 13
14 protected $fillable = [ 14 protected $fillable = [
15 'name_company', 15 'name_company',
16 'email', 16 'email',
17 'telephone', 17 'telephone',
18 'logo', 18 'logo',
19 'rate', 19 'rate',
20 'user_id', 20 'user_id',
21 'sort', 21 'sort',
22 'text', 22 'text',
23 'address', 23 'address',
24 'map', 24 'map',
25 'site', 25 'site',
26 'coord', 26 'coord',
27 'plus', 27 'plus',
28 'is_remove', 28 'is_remove',
29 'oficial_status', 29 'oficial_status',
30 'social_is', 30 'social_is',
31 'sending_is', 31 'sending_is',
32 'category', 32 'category',
33 'comment_admin', 33 'comment_admin',
34 'code', 34 'code',
35 'status_hidden', 35 'status_hidden',
36 'email_2', 36 'email_2',
37 'telephone_2', 37 'telephone_2',
38 'autoresponder',
39 'autoresponder_message',
40 ]; 38 ];
41 39
42 /* 40 /*
43 * Связь таблицы users с таблицей employers 41 * Связь таблицы users с таблицей employers
44 */ 42 */
45 public function users() { 43 public function users() {
46 return $this->belongsTo(User::class, 'user_id'); 44 return $this->belongsTo(User::class, 'user_id');
47 } 45 }
48 46
49 /* 47 /*
50 * Связь Работодателя с вакансиями 48 * Связь Работодателя с вакансиями
51 */ 49 */
52 public function ads(): HasMany 50 public function ads(): HasMany
53 { 51 {
54 return $this->hasMany(Ad_employer::class); 52 return $this->hasMany(Ad_employer::class);
55 } 53 }
56 54
57 // связь Работодателя с флотом 55 // связь Работодателя с флотом
58 public function flots(){ 56 public function flots(){
59 return $this->hasMany(Flot::class); 57 return $this->hasMany(Flot::class);
60 } 58 }
61 59
62 // связь Работодателя с Должностями в Вакансиях 60 // связь Работодателя с Должностями в Вакансиях
63 //public function ad_jobs() { 61 //public function ad_jobs() {
64 // return $this->belongsToMany(Ad_jobs::class, 'ad_employers'); 62 // return $this->belongsToMany(Ad_jobs::class, 'ad_employers');
65 //} 63 //}
66 64
67 public function scopeActive($query) { 65 public function scopeActive($query) {
68 return $query->where('is_remove', '=', '0'); 66 return $query->where('is_remove', '=', '0');
69 } 67 }
70 68
71 public function autoliftOptions() 69 public function autoliftOptions()
72 { 70 {
73 return $this->hasOne(EmployerAutoliftOption::class); 71 return $this->hasOne(EmployerAutoliftOption::class);
74 } 72 }
75 } 73 }
76 74
1 <?php 1 <?php
2 2
3 namespace App\Models; 3 namespace App\Models;
4 4
5 // use Illuminate\Contracts\Auth\MustVerifyEmail; 5 // use Illuminate\Contracts\Auth\MustVerifyEmail;
6 use Illuminate\Database\Eloquent\Factories\HasFactory; 6 use Illuminate\Database\Eloquent\Factories\HasFactory;
7 use Illuminate\Database\Eloquent\Relations\HasMany; 7 use Illuminate\Database\Eloquent\Relations\HasMany;
8 use Illuminate\Foundation\Auth\User as Authenticatable; 8 use Illuminate\Foundation\Auth\User as Authenticatable;
9 use Illuminate\Notifications\Notifiable; 9 use Illuminate\Notifications\Notifiable;
10 use JsonException; 10 use JsonException;
11 use Laravel\Sanctum\HasApiTokens; 11 use Laravel\Sanctum\HasApiTokens;
12 12
13 class User extends Authenticatable 13 class User extends Authenticatable
14 { 14 {
15 use HasApiTokens, HasFactory, Notifiable; 15 use HasApiTokens, HasFactory, Notifiable;
16 16
17 /** 17 /**
18 * The attributes that are mass assignable. 18 * The attributes that are mass assignable.
19 * 19 *
20 * @var array<int, string> 20 * @var array<int, string>
21 */ 21 */
22 22
23 protected $fillable = [ 23 protected $fillable = [
24 'name', 24 'name',
25 'email', 25 'email',
26 'password', 26 'password',
27 'admin', 27 'admin',
28 'telephone', 28 'telephone',
29 'surname', 29 'surname',
30 'name_man', 30 'name_man',
31 'surname2', 31 'surname2',
32 'is_worker', 32 'is_worker',
33 'is_lookin', 33 'is_lookin',
34 'is_message', 34 'is_message',
35 'is_public', 35 'is_public',
36 'is_worker', 36 'is_worker',
37 'is_remove', 37 'is_remove',
38 'is_ban', 38 'is_ban',
39 'is_new', 39 'is_new',
40 'is_bd', 40 'is_bd',
41 'email_verified_at', 41 'email_verified_at',
42 'created_at', 42 'created_at',
43 'updated_at', 43 'updated_at',
44 'birthday', 44 'birthday',
45 'file', 45 'file',
46 'pubpassword', 46 'pubpassword',
47 'is_manager', 47 'is_manager',
48 'subscribe_email', 48 'subscribe_email',
49 'subscribe', 49 'subscribe',
50 'autoresponder',
51 'autoresponder_message',
50 ]; 52 ];
51 53
52 /** 54 /**
53 * The attributes that should be hidden for serialization. 55 * The attributes that should be hidden for serialization.
54 * 56 *
55 * @var array<int, string> 57 * @var array<int, string>
56 */ 58 */
57 protected $hidden = [ 59 protected $hidden = [
58 'password', 60 'password',
59 'remember_token', 61 'remember_token',
60 ]; 62 ];
61 63
62 /** 64 /**
63 * The attributes that should be cast. 65 * The attributes that should be cast.
64 * 66 *
65 * @var array<string, string> 67 * @var array<string, string>
66 */ 68 */
67 protected $casts = [ 69 protected $casts = [
68 'email_verified_at' => 'datetime', 70 'email_verified_at' => 'datetime',
69 ]; 71 ];
70 72
71 /* 73 /*
72 * Связь Пользователей системы с работодателями 74 * Связь Пользователей системы с работодателями
73 * users - employers 75 * users - employers
74 */ 76 */
75 public function employers(): HasMany 77 public function employers(): HasMany
76 { 78 {
77 return $this->hasMany(Employer::class, 'user_id'); 79 return $this->hasMany(Employer::class, 'user_id');
78 } 80 }
79 81
80 /* 82 /*
81 * Связь Пользователей системы с работниками 83 * Связь Пользователей системы с работниками
82 * users - workers 84 * users - workers
83 */ 85 */
84 public function workers() { 86 public function workers() {
85 return $this->hasMany(Worker::class, 'user_id'); 87 return $this->hasMany(Worker::class, 'user_id');
86 } 88 }
87 89
88 /* 90 /*
89 * Связь Пользователей системы с работниками 91 * Связь Пользователей системы с работниками
90 * users - workers 92 * users - workers
91 */ 93 */
92 public function work() { 94 public function work() {
93 return $this->hasMany(Worker::class, 'user_id') 95 return $this->hasMany(Worker::class, 'user_id')
94 ->select('telephone', 'email', 'position_work', 'persent_anketa'); 96 ->select('telephone', 'email', 'position_work', 'persent_anketa');
95 } 97 }
96 98
97 /* 99 /*
98 * Связь Модели Пользователей(Users) с Группами (Group_users) 100 * Связь Модели Пользователей(Users) с Группами (Group_users)
99 * users - group_users 101 * users - group_users
100 многие-ко-многим 102 многие-ко-многим
101 */ 103 */
102 public function ingroup() { 104 public function ingroup() {
103 return $this->belongsToMany(Group_user::class, 'group_works'); 105 return $this->belongsToMany(Group_user::class, 'group_works');
104 } 106 }
105 107
106 /* 108 /*
107 * Связь Пользователей системы с ссобщениями 109 * Связь Пользователей системы с ссобщениями
108 * users - messages 110 * users - messages
109 */ 111 */
110 public function messages() { 112 public function messages() {
111 return $this->hasMany(Message::class); 113 return $this->hasMany(Message::class);
112 } 114 }
113 115
114 /* 116 /*
115 * Связь Пользователей системы с статистика 117 * Связь Пользователей системы с статистика
116 * users - static_workers 118 * users - static_workers
117 */ 119 */
118 public function static_user() { 120 public function static_user() {
119 return $this->hasMany(Static_worker::class); 121 return $this->hasMany(Static_worker::class);
120 } 122 }
121 123
122 /* 124 /*
123 * Связь модели Юзеры (users) с моделью Группы пользователей (Group_works) 125 * Связь модели Юзеры (users) с моделью Группы пользователей (Group_works)
124 один-ко-многим 126 один-ко-многим
125 */ 127 */
126 public function peoples() { 128 public function peoples() {
127 return $this->hasMany(Group_works::class); 129 return $this->hasMany(Group_works::class);
128 } 130 }
129 131
130 /* 132 /*
131 * Связь Модели Пользователей(Users) с Группами (Group_users) 133 * Связь Модели Пользователей(Users) с Группами (Group_users)
132 * users - group_users 134 * users - group_users
133 многие-ко-многим 135 многие-ко-многим
134 */ 136 */
135 public function jobtitles() { 137 public function jobtitles() {
136 return $this->belongsToMany(Job_title::class, 'workers', 'user_id', 'position_work'); 138 return $this->belongsToMany(Job_title::class, 'workers', 'user_id', 'position_work');
137 } 139 }
138 140
139 public function scopeActive($query) { 141 public function scopeActive($query) {
140 return $query->where('is_remove', '=', '0'); 142 return $query->where('is_remove', '=', '0');
141 } 143 }
142 144
143 public function scopeWorker($query) { 145 public function scopeWorker($query) {
144 return $query->where('is_worker', '=', '1'); 146 return $query->where('is_worker', '=', '1');
145 } 147 }
146 148
147 public function scopeBaseuser($query) { 149 public function scopeBaseuser($query) {
148 return $query->where('is_bd', '=', '1'); 150 return $query->where('is_bd', '=', '1');
149 } 151 }
150 152
151 public function scopeRealuser($query) { 153 public function scopeRealuser($query) {
152 return $query->where('is_bd', '=', '0'); 154 return $query->where('is_bd', '=', '0');
153 } 155 }
154 156
155 public function scopeAdmin($query) { 157 public function scopeAdmin($query) {
156 return $query->where('admin', '=', '1'); 158 return $query->where('admin', '=', '1');
157 } 159 }
158 160
159 public function scopeNotadmin($query) { 161 public function scopeNotadmin($query) {
160 return $query->where('admin', '=', '0'); 162 return $query->where('admin', '=', '0');
161 } 163 }
162 164
163 /** 165 /**
164 * @throws JsonException 166 * @throws JsonException
165 */ 167 */
166 public function getJobAttribute(): ?string 168 public function getJobAttribute(): ?string
167 { 169 {
168 $positions = $this->workers[0]?->positions_work; 170 $positions = $this->workers[0]?->positions_work;
169 if (is_string($positions)) { 171 if (is_string($positions)) {
170 $jobIds = json_decode($positions, true, 512, JSON_THROW_ON_ERROR); 172 $jobIds = json_decode($positions, true, 512, JSON_THROW_ON_ERROR);
171 } else { 173 } else {
172 $jobIds = $positions; 174 $jobIds = $positions;
173 } 175 }
174 176
175 if ($jobIds !== null && count($jobIds) > 0) { 177 if ($jobIds !== null && count($jobIds) > 0) {
176 return Job_title::whereIn('id', $jobIds)->first()->name; 178 return Job_title::whereIn('id', $jobIds)->first()?->name;
177 } 179 }
178 return null; 180 return null;
179 } 181 }
180 182
181 } 183 }
182 184
app/Models/Worker.php
1 <?php 1 <?php
2 2
3 namespace App\Models; 3 namespace App\Models;
4 4
5 use Illuminate\Database\Eloquent\Builder; 5 use Illuminate\Database\Eloquent\Builder;
6 use Illuminate\Database\Eloquent\Factories\HasFactory; 6 use Illuminate\Database\Eloquent\Factories\HasFactory;
7 use Illuminate\Database\Eloquent\Model; 7 use Illuminate\Database\Eloquent\Model;
8 8
9 class Worker extends Model 9 class Worker extends Model
10 { 10 {
11 use HasFactory; 11 use HasFactory;
12 12
13 protected $table = 'workers'; 13 protected $table = 'workers';
14 14
15 protected $fillable = [ 15 protected $fillable = [
16 'user_id', 16 'user_id',
17 'status_work', 17 'status_work',
18 'position_work', 18 'position_work',
19 'positions_work', 19 'positions_work',
20 'telephone', 20 'telephone',
21 'telephone2', 21 'telephone2',
22 'persent_anketa', 22 'persent_anketa',
23 'photo', 23 'photo',
24 'email_data', 24 'email_data',
25 'status_profile', 25 'status_profile',
26 'old_year', 26 'old_year',
27 'experience', 27 'experience',
28 'en_is', 28 'en_is',
29 'education', 29 'education',
30 'email', 30 'email',
31 'interpassport', 31 'interpassport',
32 'mk', 32 'mk',
33 'vvp', 33 'vvp',
34 'vlm', 34 'vlm',
35 'reka_diplom', 35 'reka_diplom',
36 'more_diplom', 36 'more_diplom',
37 'mpss', 37 'mpss',
38 'tanker', 38 'tanker',
39 'gmssb', 39 'gmssb',
40 'resume', 40 'resume',
41 'sort', 41 'sort',
42 'updated_at', 42 'updated_at',
43 'text', 43 'text',
44 'address', 44 'address',
45 'city', 45 'city',
46 'coord', 46 'coord',
47 'file', 47 'file',
48 'is_remove', 48 'is_remove',
49 'favorite_user', 49 'favorite_user',
50 'sroch_user', 50 'sroch_user',
51 'salary_expectations', 51 'salary_expectations',
52 'english_level', 52 'english_level',
53 'ready_boart_date', 53 'ready_boart_date',
54 'boart_type_preference', 54 'boart_type_preference',
55 'visa_available', 55 'visa_available',
56 'tanker_documents_available', 56 'tanker_documents_available',
57 'confirmation_work_for_vvp', 57 'confirmation_work_for_vvp',
58 'military_id_available', 58 'military_id_available',
59 'comment' 59 'comment'
60 ]; 60 ];
61 61
62 /** 62 /**
63 * Получить значение поля positions_work как массив. 63 * Получить значение поля positions_work как массив.
64 * 64 *
65 * @param string $value 65 * @param string $value
66 * @return array 66 * @return array
67 */ 67 */
68 public function getPositionsWorkAttribute($value) 68 public function getPositionsWorkAttribute($value)
69 { 69 {
70 return json_decode($value, true); 70 return json_decode($value, true);
71 } 71 }
72 72
73 /** 73 /**
74 * Установить значение поля positions_work как JSON. 74 * Установить значение поля positions_work как JSON.
75 * 75 *
76 * @param array|string $value 76 * @param array|string $value
77 * @return void 77 * @return void
78 */ 78 */
79 public function setPositionsWorkAttribute($value) 79 public function setPositionsWorkAttribute($value)
80 { 80 {
81 $this->attributes['positions_work'] = is_array($value) ? json_encode($value) : $value; 81 $this->attributes['positions_work'] = is_array($value) ? json_encode($value) : $value;
82 } 82 }
83 83
84 /* 84 /*
85 * Связь таблицы users с таблицей workers 85 * Связь таблицы users с таблицей workers
86 */ 86 */
87 public function users() { 87 public function users() {
88 return $this->belongsTo(User::class, 'user_id'); 88 return $this->belongsTo(User::class, 'user_id');
89 } 89 }
90 90
91 // Связь Работника с сертификами (0-0 - 1) 91 // Связь Работника с сертификами (0-0 - 1)
92 public function sertificate() { 92 public function sertificate() {
93 return $this->hasMany(sertification::class); 93 return $this->hasMany(sertification::class);
94 } 94 }
95 95
96 // Связь Работника с должностями (0-0 - 1) 96 // Связь Работника с должностями (0-0 - 1)
97 public function job_titles() { 97 public function job_titles() {
98 return $this->belongsToMany(Job_title::class, 'title_workers'); 98 return $this->belongsToMany(Job_title::class, 'title_workers');
99 } 99 }
100 100
101 //Связь Работника с опытом работы (1 - 0-0) 101 //Связь Работника с опытом работы (1 - 0-0)
102 public function place_worker() { 102 public function place_worker() {
103 return $this->hasMany(place_works::class); 103 return $this->hasMany(place_works::class);
104 } 104 }
105 105
106 public function scopeActive($query) { 106 public function scopeActive($query) {
107 return $query->where('is_remove', '=', '0'); 107 return $query->where('is_remove', '=', '0');
108 } 108 }
109 109
110 //Связь Работника с предыдущими компаниями 110 //Связь Работника с предыдущими компаниями
111 public function prev_company() { 111 public function prev_company() {
112 return $this->hasMany(PrevCompany::class); 112 return $this->hasMany(PrevCompany::class);
113 } 113 }
114 114
115 //Связь Работника с инфоблоками (0-0 - 0-0) 115 //Связь Работника с инфоблоками (0-0 - 0-0)
116 public function infobloks() { 116 public function infobloks() {
117 return $this->belongsToMany( 117 return $this->belongsToMany(
118 infobloks::class, 118 infobloks::class,
119 'dop_info', 119 'dop_info',
120 'worker_id', 120 'worker_id',
121 'infoblok_id' 121 'infoblok_id'
122 )->withPivot('status'); 122 )->withPivot('status');
123 } 123 }
124 124
125 //Связи Работника с дополнительными 125 //Связи Работника с дополнительными
126 public function dop_info() { 126 public function dop_info() {
127 return $this->hasMany(Dop_info::class, 'worker_id'); 127 return $this->hasMany(Dop_info::class, 'worker_id');
128 } 128 }
129 129
130 public function response() { 130 public function response() {
131 return $this->hasMany(ResponseWork::class); 131 return $this->hasMany(ResponseWork::class);
132 } 132 }
133 133
134 public function getJobsAttribute() 134 public function getJobsAttribute()
135 { 135 {
136 $job_titles_ids = json_decode($this->attributes['positions_work'], true); 136 $job_titles_ids = json_decode($this->attributes['positions_work'], true);
137 return Job_title::whereIn('id', $job_titles_ids)->get(); 137 return Job_title::whereIn('id', $job_titles_ids)->get();
138 } 138 }
139
140 public function autoliftOptions()
141 {
142 return $this->hasOne(WorkerAutoliftOption::class);
143 }
139 } 144 }
140 145
app/Models/WorkerAutoliftOption.php
File was created 1 <?php
2
3 namespace App\Models;
4
5 use Illuminate\Database\Eloquent\Casts\Attribute;
6 use Illuminate\Database\Eloquent\Model;
7 use Illuminate\Database\Eloquent\Relations\BelongsTo;
8
9 /**
10 * @property int $employer_id
11 * @property bool $autolift_site
12 * @property int $times_per_day
13 * @property int $days_repeat
14 * @property string $time_send_first
15 * @property string $time_send_second
16 * @property string $time_send_third
17 * @property bool $is_enabled
18 */
19 class WorkerAutoliftOption extends Model
20 {
21 protected $guarded = [
22 'created_at',
23 'updated_at'
24 ];
25
26 public function isEnabled(): Attribute
27 {
28 return Attribute::make(
29 get: fn ($value) => $value === null ? 0 : 1
30 );
31 }
32
33 public function worker(): BelongsTo
34 {
35 return $this->belongsTo(Worker::class);
36 }
37 }
38
app/Observers/MessageObserver.php
1 <?php 1 <?php
2 2
3 namespace App\Observers; 3 namespace App\Observers;
4 4
5 use App\Models\Chat; 5 use App\Models\Chat;
6 use App\Models\Employer; 6 use App\Models\Employer;
7 use App\Models\Message; 7 use App\Models\Message;
8 use App\Models\User;
8 use Illuminate\Http\Request; 9 use Illuminate\Http\Request;
9 10
10 class MessageObserver 11 class MessageObserver
11 { 12 {
12 public function created(Message $message): void 13 public function created(Message $message): void
13 { 14 {
14 /** @var Employer $employer */ 15 /** @var User $user */
15 $employer = Employer::query() 16 $user = User::find($message->to_user_id);
16 ->where('user_id', $message->to_user_id)
17 ->first();
18 17
19 if ($employer === null || !$employer->autoresponder) { 18 if ($user === null || !$user->autoresponder) {
20 return; 19 return;
21 } 20 }
22 21
23 $recentAutoresponderMessage = Message::query() 22 $recentAutoresponderMessage = Message::query()
24 ->where('user_id', $message->to_user_id) 23 ->where('user_id', $message->to_user_id)
25 ->where('to_user_id', $message->user_id) 24 ->where('to_user_id', $message->user_id)
26 ->where('text', $employer->autoresponder_message) 25 ->where('text', $user->autoresponder_message)
27 ->where('created_at', '>', now()->subDays(4)) 26 ->where('created_at', '>', now()->subDays(4))
28 ->orderBy('id', 'desc') 27 ->orderBy('id', 'desc')
29 ->first(); 28 ->first();
30 29
31 if ($recentAutoresponderMessage !== null) { 30 if ($recentAutoresponderMessage !== null) {
32 return; 31 return;
33 } 32 }
34 33
35 Message::add_message( 34 Message::add_message(
36 request: new Request(), 35 request: new Request(),
37 user_id: $message->to_user_id, 36 user_id: $message->to_user_id,
38 to_user_id: $message->user_id, 37 to_user_id: $message->user_id,
39 message_params: [ 38 message_params: [
40 'text' => $employer->autoresponder_message, 39 'text' => $user->autoresponder_message,
41 'flag_new' => 1 40 'flag_new' => 1
42 ] 41 ]
43 ); 42 );
44 } 43 }
45 44
46 /** 45 /**
47 * Handle the Message "updated" event. 46 * Handle the Message "updated" event.
48 * 47 *
49 * @param \App\Models\Message $message 48 * @param \App\Models\Message $message
50 * @return void 49 * @return void
51 */ 50 */
52 public function updated(Message $message) 51 public function updated(Message $message)
53 { 52 {
54 // 53 //
55 } 54 }
56 55
57 /** 56 /**
58 * Handle the Message "deleted" event. 57 * Handle the Message "deleted" event.
59 * 58 *
60 * @param \App\Models\Message $message 59 * @param \App\Models\Message $message
61 * @return void 60 * @return void
62 */ 61 */
63 public function deleted(Message $message) 62 public function deleted(Message $message)
64 { 63 {
65 // 64 //
66 } 65 }
67 66
68 /** 67 /**
69 * Handle the Message "restored" event. 68 * Handle the Message "restored" event.
70 * 69 *
71 * @param \App\Models\Message $message 70 * @param \App\Models\Message $message
72 * @return void 71 * @return void
73 */ 72 */
74 public function restored(Message $message) 73 public function restored(Message $message)
75 { 74 {
76 // 75 //
77 } 76 }
78 77
79 /** 78 /**
80 * Handle the Message "force deleted" event. 79 * Handle the Message "force deleted" event.
81 * 80 *
82 * @param \App\Models\Message $message 81 * @param \App\Models\Message $message
83 * @return void 82 * @return void
84 */ 83 */
85 public function forceDeleted(Message $message) 84 public function forceDeleted(Message $message)
86 { 85 {
87 // 86 //
88 } 87 }
89 } 88 }
database/migrations/2024_10_25_120802_move_autoresponder_colomns.php
File was created 1 <?php
2
3 use Illuminate\Database\Migrations\Migration;
4 use Illuminate\Database\Schema\Blueprint;
5 use Illuminate\Support\Facades\Schema;
6
7 return new class extends Migration
8 {
9 /**
10 * Run the migrations.
11 *
12 * @return void
13 */
14 public function up()
15 {
16 Schema::table('employers', function (Blueprint $table) {
17 $table->dropColumn('autoresponder');
18 $table->dropColumn('autoresponder_message');
19 });
20
21 Schema::table('users', function (Blueprint $table) {
22 $table->boolean('autoresponder')->default(false);
23 $table->text('autoresponder_message')->nullable();
24 });
25 }
26
27 /**
28 * Reverse the migrations.
29 *
30 * @return void
31 */
32 public function down()
33 {
34 //
35 }
36 };
37
database/migrations/2024_10_28_114521_create_worker_autolift_options_table.php
File was created 1 <?php
2
3 use Illuminate\Database\Migrations\Migration;
4 use Illuminate\Database\Schema\Blueprint;
5 use Illuminate\Support\Facades\Schema;
6
7 return new class extends Migration
8 {
9 /**
10 * Run the migrations.
11 *
12 * @return void
13 */
14 public function up()
15 {
16 Schema::create('worker_autolift_options', function (Blueprint $table) {
17 $table->id();
18 $table->unsignedBigInteger('worker_id');
19 $table->foreign('worker_id')->references('id')->on('workers')->onDelete('cascade');
20 $table->boolean('autolift_site')->default(true);
21 $table->integer('times_per_day')->index()->default(1);
22 $table->integer('days_repeat')->default(1);
23 $table->string('time_send_first')->index();
24 $table->string('time_send_second')->index()->nullable();
25 $table->string('time_send_third')->index()->nullable();
26 $table->boolean('is_enabled')->default(true);
27 $table->timestamps();
28 });
29 }
30
31 /**
32 * Reverse the migrations.
33 *
34 * @return void
35 */
36 public function down()
37 {
38 Schema::dropIfExists('worker_autolift_options');
39 }
40 };
41
public/js/script-vc.js
1 let scripts = function () { 1 let scripts = function () {
2 2
3 $('.js-toggle').on('click', function () { 3 $('.js-toggle').on('click', function () {
4 $(this).toggleClass('active'); 4 $(this).toggleClass('active');
5 }); 5 });
6 $('.js-parent-toggle').on('click', function () { 6 $('.js-parent-toggle').on('click', function () {
7 $(this).parent().toggleClass('active'); 7 $(this).parent().toggleClass('active');
8 }); 8 });
9 $('.js-parent-remove').on('click', function () { 9 $('.js-parent-remove').on('click', function () {
10 $(this).parent().remove(); 10 $(this).parent().remove();
11 }); 11 });
12 $('.js-menu-toggle').on('click', function () { 12 $('.js-menu-toggle').on('click', function () {
13 window.scrollTo(0, 0); 13 window.scrollTo(0, 0);
14 $('#body').toggleClass('menu-is-actived'); 14 $('#body').toggleClass('menu-is-actived');
15 }); 15 });
16 $('.js-cookies-close').on('click', function () { 16 $('.js-cookies-close').on('click', function () {
17 $('#body').removeClass('cookies-is-actived'); 17 $('#body').removeClass('cookies-is-actived');
18 }); 18 });
19 $('.js-works-edit').on('click', function () { 19 $('.js-works-edit').on('click', function () {
20 $(this).parent().parent().parent().addClass('active'); 20 $(this).parent().parent().parent().addClass('active');
21 }); 21 });
22 $('.js-works-remove').on('click', function () { 22 $('.js-works-remove').on('click', function () {
23 $(this).parent().parent().parent().parent().remove(); 23 $(this).parent().parent().parent().parent().remove();
24 }); 24 });
25 25
26 $('[data-tab]').on('click', function () { 26 $('[data-tab]').on('click', function () {
27 $('[data-tab]').removeClass('active'); 27 $('[data-tab]').removeClass('active');
28 $('[data-body]').removeClass('showed'); 28 $('[data-body]').removeClass('showed');
29 $(this).addClass('active'); 29 $(this).addClass('active');
30 var id = $(this).data('tab'); 30 var id = $(this).data('tab');
31 $('[data-body=' + id + ']').addClass('showed'); 31 $('[data-body=' + id + ']').addClass('showed');
32 }); 32 });
33 33
34 $('.js-password-show').on('click', function () { 34 $('.js-password-show').on('click', function () {
35 $(this).parent().addClass('active'); 35 $(this).parent().addClass('active');
36 $(this).parent().parent().find('input').attr('type', 'text'); 36 $(this).parent().parent().find('input').attr('type', 'text');
37 }); 37 });
38 38
39 $('.js-password-hide').on('click', function () { 39 $('.js-password-hide').on('click', function () {
40 $(this).parent().removeClass('active'); 40 $(this).parent().removeClass('active');
41 $(this).parent().parent().find('input').attr('type', 'password'); 41 $(this).parent().parent().find('input').attr('type', 'password');
42 }); 42 });
43 43
44 let checkScrollTop = function () { 44 let checkScrollTop = function () {
45 if ($(document).scrollTop() == 0) { 45 if ($(document).scrollTop() == 0) {
46 $('#body').removeClass('begin'); 46 $('#body').removeClass('begin');
47 } else { 47 } else {
48 $('#body').addClass('begin'); 48 $('#body').addClass('begin');
49 } 49 }
50 } 50 }
51 checkScrollTop(); 51 checkScrollTop();
52 $(document).on('scroll', function () { 52 $(document).on('scroll', function () {
53 checkScrollTop(); 53 checkScrollTop();
54 }); 54 });
55 55
56 let closeAll = function () { 56 let closeAll = function () {
57 $('.js-toggle').removeClass('active'); 57 $('.js-toggle').removeClass('active');
58 $('.js-parent-toggle').parent().removeClass('active'); 58 $('.js-parent-toggle').parent().removeClass('active');
59 $('#body').removeClass('menu-is-actived'); 59 $('#body').removeClass('menu-is-actived');
60 $('#body').removeClass('cookies-is-actived'); 60 $('#body').removeClass('cookies-is-actived');
61 } 61 }
62 62
63 $(document).keyup(function (e) { 63 $(document).keyup(function (e) {
64 if (e.key === "Escape") { 64 if (e.key === "Escape") {
65 closeAll(); 65 closeAll();
66 } 66 }
67 }); 67 });
68 68
69 $('.js-scroll-to').bind('click', function (e) { 69 $('.js-scroll-to').bind('click', function (e) {
70 let anchor = $(this); 70 let anchor = $(this);
71 $('html,body').stop().animate({ 71 $('html,body').stop().animate({
72 scrollTop: $(anchor.attr('href')).offset().top 72 scrollTop: $(anchor.attr('href')).offset().top
73 }, 300); 73 }, 300);
74 e.preventDefault(); 74 e.preventDefault();
75 }); 75 });
76 76
77 if ($('[type=tel]').is('[type=tel]')) { 77 if ($('[type=tel]').is('[type=tel]')) {
78 $('[type=tel]').mask('+7 (999) 999-99-99'); 78 $('[type=tel]').mask('+7 (999) 999-99-99');
79 } 79 }
80 80
81 if ($('.js-select2').is('.js-select2')) { 81 if ($('.js-select2').is('.js-select2')) {
82 $('.js-select2').select2(); 82 $('.js-select2').select2();
83 } 83 }
84 84
85 const starRating = document.querySelectorAll(".js-stars"); 85 const starRating = document.querySelectorAll(".js-stars");
86 if (starRating.length) { 86 if (starRating.length) {
87 starRating.forEach(item => { 87 starRating.forEach(item => {
88 new StarRating(item); 88 new StarRating(item);
89 }); 89 });
90 } 90 }
91 91
92 const checkboxes = document.querySelectorAll(".checkbox"); 92 const checkboxes = document.querySelectorAll(".checkbox");
93 if (checkboxes.length) { 93 if (checkboxes.length) {
94 checkboxes.forEach(checkbox => { 94 checkboxes.forEach(checkbox => {
95 const input = checkbox.querySelector("input"); 95 const input = checkbox.querySelector("input");
96 checkbox.addEventListener("input", () => { 96 checkbox.addEventListener("input", () => {
97 if (input.checked) { 97 if (input.checked) {
98 input.setAttribute("checked", ""); 98 input.setAttribute("checked", "");
99 } else { 99 } else {
100 input.removeAttribute("checked"); 100 input.removeAttribute("checked");
101 } 101 }
102 }); 102 });
103 }); 103 });
104 } 104 }
105 const fullPicker = document.querySelectorAll(".js-picker"); 105 const fullPicker = document.querySelectorAll(".js-picker");
106 if (fullPicker.length) { 106 if (fullPicker.length) {
107 fullPicker.forEach(picker => { 107 fullPicker.forEach(picker => {
108 new Picker(picker, { 108 new Picker(picker, {
109 controls: true, 109 controls: true,
110 format: 'HH:mm', 110 format: 'HH:mm',
111 headers: true, 111 headers: true,
112 text: { 112 text: {
113 title: 'Выберите первое время обновления', 113 title: 'Выберите первое время обновления',
114 cancel: 'Отменить', 114 cancel: 'Отменить',
115 confirm: 'Сохранить', 115 confirm: 'Сохранить',
116 hour: 'Часы', 116 hour: 'Часы',
117 minute: 'Минуты', 117 minute: 'Минуты',
118 }, 118 },
119 }); 119 });
120 }); 120 });
121 } 121 }
122 122
123 function controlAutoraiseToggle() { 123 function controlAutoraiseToggle() {
124 124
125 const toggle = document.querySelector('.js_autoraise_toggle'); 125 const toggle = document.querySelector('.js_autoraise_toggle');
126 const prompts = document.querySelectorAll('.js_autoraise_prompt'); 126 const prompts = document.querySelectorAll('.js_autoraise_prompt');
127 127
128 if (toggle && prompts.length) { 128 if (toggle && prompts.length) {
129 129
130 toggle.addEventListener('change', () => { 130 toggle.addEventListener('change', () => {
131 131
132 if (toggle.checked) { 132 if (toggle.checked) {
133 toggle.disabled = true;
134 prompts[0].classList.add('hidden'); 133 prompts[0].classList.add('hidden');
135 prompts[1].classList.remove('hidden'); 134 prompts[1].classList.remove('hidden');
136 } else { 135 } else {
137 prompts[0].classList.remove('hidden'); 136 prompts[0].classList.remove('hidden');
138 prompts[1].classList.add('hidden'); 137 prompts[1].classList.add('hidden');
139 } 138 }
140 139
141 }); 140 });
142 141
143 } 142 }
144 143
145 } 144 }
146 145
147 controlAutoraiseToggle(); 146 controlAutoraiseToggle();
148 147
149 function controlAutoraiseSelect() { 148 function controlAutoraiseSelect() {
150 149
151 const inputs = document.querySelectorAll('.js-picker'); 150 const inputs = document.querySelectorAll('.js-picker');
152 151
153 if (inputs.length && $('.js_autoraise_select').length) { 152 if (inputs.length && $('.js_autoraise_select').length) {
154 153
155 $('.js_autoraise_select').on('select2:select', function (e) { 154 $('.js_autoraise_select').on('select2:select', function (e) {
156 155
157 const optionVal = +e.params.data.id; 156 const optionVal = +e.params.data.id;
158 console.log(optionVal); 157 console.log(optionVal);
159 158
160 inputs.forEach((input, i) => { 159 inputs.forEach((input, i) => {
161 160
162 if (i < optionVal) { 161 if (i < optionVal) {
163 input.disabled = false; 162 input.disabled = false;
164 } else { 163 } else {
165 input.disabled = true; 164 input.disabled = true;
166 } 165 }
167 166
168 }); 167 });
169 }); 168 });
170 169
171 } 170 }
172 171
173 } 172 }
174 173
175 controlAutoraiseSelect(); 174 controlAutoraiseSelect();
176 }; 175 };
177 176
178 let swipers = function () { 177 let swipers = function () {
179 178
180 if ($('.js-employer-swiper').is('.js-employer-swiper')) { 179 if ($('.js-employer-swiper').is('.js-employer-swiper')) {
181 let slider = new Swiper('.js-employer-swiper', { 180 let slider = new Swiper('.js-employer-swiper', {
182 autoplay: { 181 autoplay: {
183 delay: 5000, 182 delay: 5000,
184 }, 183 },
185 pagination: { 184 pagination: {
186 el: '.swiper-pagination', 185 el: '.swiper-pagination',
187 clickable: true 186 clickable: true
188 }, 187 },
189 breakpoints: { 188 breakpoints: {
190 768: { 189 768: {
191 slidesPerView: 2, 190 slidesPerView: 2,
192 }, 191 },
193 992: { 192 992: {
194 slidesPerView: 3, 193 slidesPerView: 3,
195 }, 194 },
196 1280: { 195 1280: {
197 slidesPerView: 4, 196 slidesPerView: 4,
198 }, 197 },
199 } 198 }
200 }); 199 });
201 } 200 }
202 201
203 if ($('.js-news-swiper').is('.js-news-swiper')) { 202 if ($('.js-news-swiper').is('.js-news-swiper')) {
204 let slider = new Swiper('.js-news-swiper', { 203 let slider = new Swiper('.js-news-swiper', {
205 spaceBetween: 20, 204 spaceBetween: 20,
206 pagination: { 205 pagination: {
207 el: '.swiper-pagination', 206 el: '.swiper-pagination',
208 clickable: true 207 clickable: true
209 }, 208 },
210 navigation: { 209 navigation: {
211 prevEl: '.js-news-swiper-button-prev', 210 prevEl: '.js-news-swiper-button-prev',
212 nextEl: '.js-news-swiper-button-next', 211 nextEl: '.js-news-swiper-button-next',
213 }, 212 },
214 breakpoints: { 213 breakpoints: {
215 768: { 214 768: {
216 slidesPerView: 2, 215 slidesPerView: 2,
217 }, 216 },
218 992: { 217 992: {
219 slidesPerView: 3, 218 slidesPerView: 3,
220 }, 219 },
221 } 220 }
222 }); 221 });
223 } 222 }
224 223
225 }; 224 };
226 225
227 document.addEventListener("DOMContentLoaded", () => { 226 document.addEventListener("DOMContentLoaded", () => {
228 scripts(); 227 scripts();
229 swipers(); 228 swipers();
230 }); 229 });
231 230
232 $(window).resize(function () { 231 $(window).resize(function () {
233 swipers(); 232 swipers();
234 }); 233 });
235 234
resources/views/employers/autoresponder.blade.php
1 @extends('layout.frontend', ['title' => 'Автоответчик']) 1 @extends('layout.frontend', ['title' => 'Автоответчик'])
2 2
3 @section('content') 3 @section('content')
4 <section class="cabinet"> 4 <section class="cabinet">
5 <div class="container"> 5 <div class="container">
6 <ul class="breadcrumbs cabinet__breadcrumbs"> 6 <ul class="breadcrumbs cabinet__breadcrumbs">
7 <li><a href="{{ route('index') }}">Главная</a></li> 7 <li><a href="{{ route('index') }}">Главная</a></li>
8 <li><b>Личный кабинет</b></li> 8 <li><b>Личный кабинет</b></li>
9 </ul> 9 </ul>
10 <div class="cabinet__wrapper"> 10 <div class="cabinet__wrapper">
11 <div class="cabinet__side"> 11 <div class="cabinet__side">
12 <div class="cabinet__side-toper"> 12 <div class="cabinet__side-toper">
13 @include('employers.emblema') 13 @include('employers.emblema')
14 </div> 14 </div>
15 @include('employers.menu', ['item' => 16]) 15 @include('employers.menu', ['item' => 16])
16 </div> 16 </div>
17 17
18 <form class="cabinet__body" action="{{ route('employer.autoresponder_save') }}"> 18 <form class="cabinet__body" action="{{ route('employer.autoresponder_save') }}">
19 <div class="cabinet__body-item"> 19 <div class="cabinet__body-item">
20 <h2 class="title cabinet__title">Автоответчик</h2> 20 <h2 class="title cabinet__title">Автоответчик</h2>
21 <div class="cabinet__inputs"> 21 <div class="cabinet__inputs">
22 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth"> 22 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth">
23 <label class="toggle"> 23 <label class="toggle">
24 <input name="autoresponder" type="checkbox" class="toggle__input" @if($employer->autoresponder) checked @endif> 24 <input name="autoresponder" type="checkbox" class="toggle__input"
25 @if($user->autoresponder) checked @endif>
25 <span class="toggle__icon"></span> 26 <span class="toggle__icon"></span>
26 <span class="toggle__text">Деактивировано</span> 27 <span class="toggle__text">Деактивировано</span>
27 <span class="toggle__text">Активировано</span> 28 <span class="toggle__text">Активировано</span>
28 </label> 29 </label>
29 </div> 30 </div>
30 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth"> 31 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth">
31 <p>В этом разделе вы сможете задать автоматический ответ на письма, поступающие в почтовый ящик.</p> 32 <p>В этом разделе вы сможете задать автоматический ответ на письма, поступающие в
33 почтовый ящик.</p>
32 </div> 34 </div>
33 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 35 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
34 <label class="form-group__label">Введите текст</label> 36 <label class="form-group__label">Введите текст</label>
35 <div class="form-group__item"> 37 <div class="form-group__item">
36 <textarea 38 <textarea
37 name="autoresponder_message" 39 name="autoresponder_message"
38 class="textarea" 40 class="textarea"
39 placeholder="Ваше сообщение" 41 placeholder="Ваше сообщение"
40 required 42 required
41 >{{$employer->autoresponder_message}}</textarea> 43 >{{$user->autoresponder_message}}</textarea>
42 </div> 44 </div>
43 </div> 45 </div>
44 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth"> 46 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth">
45 <button type="submit" class="button">Сохранить</button> 47 <button type="submit" class="button">Сохранить</button>
46 </div> 48 </div>
47 </div> 49 </div>
48 </div> 50 </div>
49 </form> 51 </form>
50 </div> 52 </div>
51 </div> 53 </div>
52 </section> 54 </section>
53 </div> 55 </div>
54 @endsection 56 @endsection
55 57
resources/views/employers/menu.blade.php
1 <div class="cabinet__side-item"> 1 <div class="cabinet__side-item">
2 <div class="cabinet__menu"> 2 <div class="cabinet__menu">
3 <button type="button" class="cabinet__menu-toper js-toggle"> 3 <button type="button" class="cabinet__menu-toper js-toggle">
4 <span class="cabinet__menu-toper-text"></span> 4 <span class="cabinet__menu-toper-text"></span>
5 <i class="cabinet__menu-toper-arrow"> 5 <i class="cabinet__menu-toper-arrow">
6 <svg> 6 <svg>
7 <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> 7 <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use>
8 </svg> 8 </svg>
9 </i> 9 </i>
10 </button> 10 </button>
11 <div class="cabinet__menu-body"> 11 <div class="cabinet__menu-body">
12 <div class="cabinet__menu-items"> 12 <div class="cabinet__menu-items">
13 <a href="{{ route('employer.employer_info') }}" class="cabinet__menu-item @if ($item==0) active @endif"> 13 <a href="{{ route('employer.employer_info') }}" class="cabinet__menu-item @if ($item==0) active @endif">
14 <i> 14 <i>
15 <svg> 15 <svg>
16 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> 16 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use>
17 </svg> 17 </svg>
18 </i> 18 </i>
19 <span>Личные данные</span> 19 <span>Личные данные</span>
20 </a> 20 </a>
21 <a href="{{ route('employer.cabinet') }}" class="cabinet__menu-item @if ($item==1) active @endif"> 21 <a href="{{ route('employer.cabinet') }}" class="cabinet__menu-item @if ($item==1) active @endif">
22 <i> 22 <i>
23 <svg> 23 <svg>
24 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> 24 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use>
25 </svg> 25 </svg>
26 </i> 26 </i>
27 <span>Профиль</span> 27 <span>Профиль</span>
28 </a> 28 </a>
29 @if ((!Auth()->user()->is_worker) && (Auth()->user()->is_public)) 29 @if ((!Auth()->user()->is_worker) && (Auth()->user()->is_public))
30 <a href="{{ route('employer.cabinet_vacancie') }}" class="cabinet__menu-item @if ($item==2) active @endif"> 30 <a href="{{ route('employer.cabinet_vacancie') }}" class="cabinet__menu-item @if ($item==2) active @endif">
31 <i> 31 <i>
32 <svg> 32 <svg>
33 <use xlink:href="{{ asset('images/sprite.svg#cabinet-2') }}"></use> 33 <use xlink:href="{{ asset('images/sprite.svg#cabinet-2') }}"></use>
34 </svg> 34 </svg>
35 </i> 35 </i>
36 <span>Разместить вакансию</span> 36 <span>Разместить вакансию</span>
37 </a> 37 </a>
38 @else 38 @else
39 <a href="{{ route('employer.cabinet_vacancie_danger') }}" class="cabinet__menu-item @if ($item==2) active @endif"> 39 <a href="{{ route('employer.cabinet_vacancie_danger') }}" class="cabinet__menu-item @if ($item==2) active @endif">
40 <i> 40 <i>
41 <svg> 41 <svg>
42 <use xlink:href="{{ asset('images/sprite.svg#cabinet-2') }}"></use> 42 <use xlink:href="{{ asset('images/sprite.svg#cabinet-2') }}"></use>
43 </svg> 43 </svg>
44 </i> 44 </i>
45 <span>Разместить вакансию</span> 45 <span>Разместить вакансию</span>
46 </a> 46 </a>
47 @endif 47 @endif
48 <a href="{{ route('employer.vacancy_list') }}" class="cabinet__menu-item @if ($item==3) active @endif"> 48 <a href="{{ route('employer.vacancy_list') }}" class="cabinet__menu-item @if ($item==3) active @endif">
49 <i> 49 <i>
50 <svg> 50 <svg>
51 <use xlink:href="{{ asset('images/sprite.svg#cabinet-3') }}"></use> 51 <use xlink:href="{{ asset('images/sprite.svg#cabinet-3') }}"></use>
52 </svg> 52 </svg>
53 </i> 53 </i>
54 <span>Мои вакансии</span> 54 <span>Мои вакансии</span>
55 </a> 55 </a>
56 <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="cabinet__menu-item @if ($item==5) active @endif"> 56 <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="cabinet__menu-item @if ($item==5) active @endif">
57 <i> 57 <i>
58 <svg> 58 <svg>
59 <use xlink:href="{{ asset('images/sprite.svg#cabinet-5') }}"></use> 59 <use xlink:href="{{ asset('images/sprite.svg#cabinet-5') }}"></use>
60 </svg> 60 </svg>
61 </i> 61 </i>
62 <span>Сообщения</span> 62 <span>Сообщения</span>
63 </a> 63 </a>
64 <a href="{{ route('employer.favorites') }}" class="cabinet__menu-item @if ($item==6) active @endif"> 64 <a href="{{ route('employer.favorites') }}" class="cabinet__menu-item @if ($item==6) active @endif">
65 <i> 65 <i>
66 <svg> 66 <svg>
67 <use xlink:href="{{ asset('images/sprite.svg#cabinet-6') }}"></use> 67 <use xlink:href="{{ asset('images/sprite.svg#cabinet-6') }}"></use>
68 </svg> 68 </svg>
69 </i> 69 </i>
70 <span>Избранные кандидаты</span> 70 <span>Избранные кандидаты</span>
71 </a> 71 </a>
72 <a href="{{ route('employer.autolift') }}" class="cabinet__menu-item @if ($item==15 ) active @endif"> 72 <a href="{{ route('employer.autolift') }}" class="cabinet__menu-item @if ($item==15) active @endif">
73 <i> 73 <i>
74 <svg> 74 <svg>
75 <use xlink:href="{{ asset('images/sprite.svg#refresh') }}"></use> 75 <use xlink:href="{{ asset('images/sprite.svg#refresh') }}"></use>
76 </svg> 76 </svg>
77 </i> 77 </i>
78 <span>Автоподнятие вакансий</span> 78 <span>Автоподнятие вакансий</span>
79 </a> 79 </a>
80 @if ((!Auth()->user()->is_worker) && (Auth()->user()->is_lookin)) 80 @if ((!Auth()->user()->is_worker) && (Auth()->user()->is_lookin))
81 <a href="{{ route('employer.bd') }}" class="cabinet__menu-item @if ($item==7) active @endif"> 81 <a href="{{ route('employer.bd') }}" class="cabinet__menu-item @if ($item==7) active @endif">
82 <i> 82 <i>
83 <svg> 83 <svg>
84 <use xlink:href="{{ asset('images/sprite.svg#cabinet-7')}}"></use> 84 <use xlink:href="{{ asset('images/sprite.svg#cabinet-7')}}"></use>
85 </svg> 85 </svg>
86 </i> 86 </i>
87 <span>База данных</span> 87 <span>База данных</span>
88 </a> 88 </a>
89 <a href="{{ route('bd_resume') }}" target="_blank" class="cabinet__menu-item @if ($item==8) active @endif"> 89 <a href="{{ route('bd_resume') }}" target="_blank" class="cabinet__menu-item @if ($item==8) active @endif">
90 <i> 90 <i>
91 <svg> 91 <svg>
92 <use xlink:href="{{ asset('images/sprite.svg#cabinet-8') }}"></use> 92 <use xlink:href="{{ asset('images/sprite.svg#cabinet-8') }}"></use>
93 </svg> 93 </svg>
94 </i> 94 </i>
95 <span>База резюме</span> 95 <span>База резюме</span>
96 </a> 96 </a>
97 @endif 97 @endif
98 <a href="{{ route('employer.send_all_messages') }}" class="cabinet__menu-item @if ($item==9) active @endif"> 98 <a href="{{ route('employer.send_all_messages') }}" class="cabinet__menu-item @if ($item==9) active @endif">
99 <i> 99 <i>
100 <svg> 100 <svg>
101 <use xlink:href="{{ asset('images/sprite.svg#cabinet-9') }}"></use> 101 <use xlink:href="{{ asset('images/sprite.svg#cabinet-9') }}"></use>
102 </svg> 102 </svg>
103 </i> 103 </i>
104 <span>Рассылка сообщений</span> 104 <span>Рассылка сообщений</span>
105 </a> 105 </a>
106 <a href="{{ route('employer.autoresponder') }}" class="cabinet__menu-item @if ($item==16) active @endif"> 106 <a href="{{ route('employer.autoresponder') }}" class="cabinet__menu-item @if ($item==16) active @endif">
107 <i> 107 <i>
108 <svg> 108 <svg>
109 <use xlink:href="{{ asset('images/sprite.svg#answering') }}"></use> 109 <use xlink:href="{{ asset('images/sprite.svg#answering') }}"></use>
110 </svg> 110 </svg>
111 </i> 111 </i>
112 <span>Автоответчик</span> 112 <span>Автоответчик</span>
113 </a> 113 </a>
114 <a href="{{ route('employer.faq') }}" class="cabinet__menu-item @if ($item==10) active @endif"> 114 <a href="{{ route('employer.faq') }}" class="cabinet__menu-item @if ($item==10) active @endif">
115 <i> 115 <i>
116 <svg> 116 <svg>
117 <use xlink:href="{{ asset('images/sprite.svg#cabinet-10') }}"></use> 117 <use xlink:href="{{ asset('images/sprite.svg#cabinet-10') }}"></use>
118 </svg> 118 </svg>
119 </i> 119 </i>
120 <span>FAQ</span> 120 <span>FAQ</span>
121 </a> 121 </a>
122 <a href="{{ route('employer.slider_flot') }}" class="cabinet__menu-item @if ($item==12) active @endif"> 122 <a href="{{ route('employer.slider_flot') }}" class="cabinet__menu-item @if ($item==12) active @endif">
123 <i> 123 <i>
124 <svg> 124 <svg>
125 <use xlink:href="{{ asset('images/sprite.svg#cabinet-11') }}"></use> 125 <use xlink:href="{{ asset('images/sprite.svg#cabinet-11') }}"></use>
126 </svg> 126 </svg>
127 </i> 127 </i>
128 <span>Мой флот</span> 128 <span>Мой флот</span>
129 </a> 129 </a>
130 130
131 <nav> 131 <nav>
132 <ul class="drop-down closed"> 132 <ul class="drop-down closed">
133 <li> 133 <li>
134 <a style="background-color: white" class="nav-button cabinet__menu-item"> 134 <a style="background-color: white" class="nav-button cabinet__menu-item">
135 <i> 135 <i>
136 <svg> 136 <svg>
137 <use xlink:href="{{ asset('images/sprite.svg#cabinet-11') }}"></use> 137 <use xlink:href="{{ asset('images/sprite.svg#cabinet-11') }}"></use>
138 </svg> 138 </svg>
139 </i> 139 </i>
140 <span>Настройки</span> 140 <span>Настройки</span>
141 </a> 141 </a>
142 </li> 142 </li>
143 <li> 143 <li>
144 <a href="{{ route('employer.subscribe') }}" class="cabinet__menu-item @if ($item==11) active @endif"> 144 <a href="{{ route('employer.subscribe') }}" class="cabinet__menu-item @if ($item==11) active @endif">
145 <i><svg> 145 <i><svg>
146 <use xlink:href="{{ asset('images/sprite.svg#cabinet-11') }}"></use> 146 <use xlink:href="{{ asset('images/sprite.svg#cabinet-11') }}"></use>
147 </svg></i> 147 </svg></i>
148 <span>Настройки уведомлений</span> 148 <span>Настройки уведомлений</span>
149 </a> 149 </a>
150 </li> 150 </li>
151 <li> 151 <li>
152 <a href="{{ route('employer.password_reset') }}" class="cabinet__menu-item green @if ($item==13) active @endif"> 152 <a href="{{ route('employer.password_reset') }}" class="cabinet__menu-item green @if ($item==13) active @endif">
153 <i></i> 153 <i></i>
154 <span>Сменить пароль</span> 154 <span>Сменить пароль</span>
155 </a> 155 </a>
156 </li> 156 </li>
157 <li> 157 <li>
158 <a href="{{ route('employer.delete_people') }}" class="cabinet__menu-item red @if ($item==14) active @endif"> 158 <a href="{{ route('employer.delete_people') }}" class="cabinet__menu-item red @if ($item==14) active @endif">
159 <i></i> 159 <i></i>
160 <span>Удалить профиль</span> 160 <span>Удалить профиль</span>
161 </a> 161 </a>
162 </li> 162 </li>
163 </ul> 163 </ul>
164 </nav> 164 </nav>
165 </div> 165 </div>
166 <div class="cabinet__menu-bottom"> 166 <div class="cabinet__menu-bottom">
167 <a href="{{ route('logout') }}" class="button cabinet__menu-leave"> 167 <a href="{{ route('logout') }}" class="button cabinet__menu-leave">
168 <svg> 168 <svg>
169 <use xlink:href="{{ asset('images/sprite.svg#leave') }}"></use> 169 <use xlink:href="{{ asset('images/sprite.svg#leave') }}"></use>
170 </svg> 170 </svg>
171 Выход 171 Выход
172 </a> 172 </a>
173 <span class="cabinet__menu-copy"> 173 <span class="cabinet__menu-copy">
174 &copy; 2020 &ndash; Rekamore.su 174 &copy; 2020 &ndash; Rekamore.su
175 </span> 175 </span>
176 </div> 176 </div>
177 </div> 177 </div>
178 </div> 178 </div>
179 </div> 179 </div>
180 180
181 <script> 181 <script>
182 $(function(){ 182 $(function(){
183 var active_menu = $('.cabinet__menu-item.active'); 183 var active_menu = $('.cabinet__menu-item.active');
184 if (active_menu.length === 1){ 184 if (active_menu.length === 1){
185 $('.cabinet__menu-toper-text').html(active_menu.html()); 185 $('.cabinet__menu-toper-text').html(active_menu.html());
186 } 186 }
187 }); 187 });
188 188
189 $(function() { 189 $(function() {
190 // Bind Click event to the drop down navigation button 190 // Bind Click event to the drop down navigation button
191 $(".nav-button").click(function() { 191 $(".nav-button").click(function() {
192 /* Toggle the CSS closed class which reduces the height of the UL thus 192 /* Toggle the CSS closed class which reduces the height of the UL thus
193 hiding all LI apart from the first */ 193 hiding all LI apart from the first */
194 $(this).parent().parent().toggleClass("closed"); 194 $(this).parent().parent().toggleClass("closed");
195 }); 195 });
196 196
197 }); 197 });
198 </script> 198 </script>
199 199
resources/views/employers/vacancy_autolift.blade.php
1 @extends('layout.frontend', ['title' => 'Автоподнятие вакансий']) 1 @extends('layout.frontend', ['title' => 'Автоподнятие вакансий'])
2 @section('scripts') 2 @section('scripts')
3 <script> 3 <script>
4 $(document).on('click', '#submit', function () { 4 $(document).on('click', '#submit', function () {
5 let data = {}; 5 let data = {};
6 data.is_enabled = $('[name="is_enabled"]').checked;
6 data.times_per_day = $('[name="times_per_day"]').chosen().val(); 7 data.times_per_day = $('[name="times_per_day"]').chosen().val();
7 data.days_repeat = $('[name="days_repeat"]').chosen().val(); 8 data.days_repeat = $('[name="days_repeat"]').chosen().val();
8 data.time_send_first = $('[name="time_send_first"]').val(); 9 data.time_send_first = $('[name="time_send_first"]').val();
9 data.time_send_second = $('[name="time_send_second"]').val(); 10 data.time_send_second = $('[name="time_send_second"]').val();
10 data.time_send_third = $('[name="time_send_third"]').val(); 11 data.time_send_third = $('[name="time_send_third"]').val();
11 data.time_send_tg = $('[name="time_send_tg"]').val(); 12 data.time_send_tg = $('[name="time_send_tg"]').val();
12 13
13 data.vacancies = []; 14 data.vacancies = [];
14 15
15 document.getElementsByName('vacancy_table_row').forEach(function(field) { 16 document.getElementsByName('vacancy_table_row').forEach(function(field) {
16 data.vacancies.push({ 17 data.vacancies.push({
17 'id': field.dataset.id, 18 'id': field.dataset.id,
18 'autolift_site': field.querySelector('input[name="autolift_site"]').checked, 19 'autolift_site': field.querySelector('input[name="autolift_site"]').checked,
19 'autosend_tg': field.querySelector('input[name="autosend_tg"]').checked 20 'autosend_tg': field.querySelector('input[name="autosend_tg"]').checked
20 }) 21 })
21 }); 22 });
22 23
23 $.ajax({ 24 $.ajax({
24 url: '{{ route('employer.autolift_save') }}', 25 url: '{{ route('employer.autolift_save') }}',
25 type: 'POST', 26 type: 'POST',
26 data: data, 27 data: data,
27 headers: { 28 headers: {
28 'X-CSRF-TOKEN': '{{ csrf_token() }}' 29 'X-CSRF-TOKEN': '{{ csrf_token() }}'
29 }, 30 },
30 success: function (result) { 31 success: function (result) {
31 location.reload(); 32 location.reload();
32 }, 33 },
33 error: function (result) { 34 error: function (result) {
34 //todo пульнуть какуюнить модалку 35 //todo пульнуть какуюнить модалку
35 }, 36 },
36 }); 37 });
37 }) 38 })
38 </script> 39 </script>
39 @endsection 40 @endsection
40 @section('content') 41 @section('content')
41 <section class="cabinet"> 42 <section class="cabinet">
42 <div class="container"> 43 <div class="container">
43 <ul class="breadcrumbs cabinet__breadcrumbs"> 44 <ul class="breadcrumbs cabinet__breadcrumbs">
44 <li><a href="{{ route('index') }}">Главная</a></li> 45 <li><a href="{{ route('index') }}">Главная</a></li>
45 <li><b>Личный кабинет</b></li> 46 <li><b>Личный кабинет</b></li>
46 </ul> 47 </ul>
47 <div class="cabinet__wrapper"> 48 <div class="cabinet__wrapper">
48 <div class="cabinet__side"> 49 <div class="cabinet__side">
49 <div class="cabinet__side-toper"> 50 <div class="cabinet__side-toper">
50 @include('employers.emblema') 51 @include('employers.emblema')
51 </div> 52 </div>
52 @include('employers.menu', ['item' => 15]) 53 @include('employers.menu', ['item' => 15])
53 </div> 54 </div>
54 <form class="cabinet__body"> 55 <form class="cabinet__body">
55 @csrf 56 @csrf
56 <div class="cabinet__body-item"> 57 <div class="cabinet__body-item">
57 <h2 class="title cabinet__title">Автоподнятие вакансий</h2> 58 <h2 class="title cabinet__title">Автоподнятие вакансий</h2>
58 <div class="cabinet__inputs"> 59 <div class="cabinet__inputs">
59 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth"> 60 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth">
60 <?php 61 <?php
61 $createdAtClone = clone($options->created_at); 62 $createdAtClone = isset($options->created_at) ? clone($options->created_at) : now();
62 $diff = $createdAtClone->addDays($options->days_repeat)->diffInDays($options->created_at); 63 $diff = $createdAtClone->addDays($options->days_repeat)->diffInDays($options->created_at);
63 ?> 64 ?>
64 <label class="toggle"> 65 <label class="toggle">
65 <input type="checkbox" @if($options->is_enabled) checked @endif class="toggle__input js_autoraise_toggle"> 66 <input type="checkbox" @if($options->is_enabled) checked disabled @endif class="toggle__input js_autoraise_toggle">
66 <span class="toggle__icon"></span> 67 <span class="toggle__icon"></span>
67 <span class="toggle__text">Деактивировано</span> 68 <span class="toggle__text">Деактивировано</span>
68 <span class="toggle__text">Активировано</span> 69 <span class="toggle__text">Активировано</span>
69 </label> 70 </label>
70 <p class="mod js_autoraise_prompt @if($options->is_enabled === 1) hidden @endif">Срок действия автоподнятия вакансии истек. Желаете его возобновить?</p> 71 <p class="mod js_autoraise_prompt @if($options->is_enabled === 1) hidden @endif">Срок действия автоподнятия вакансии истек. Желаете его возобновить?</p>
71 <p class="mod js_autoraise_prompt @if($options->is_enabled === 0) hidden @endif">Автоподнятие вакансии продолжит действовать в течение следующих дней: <span>{{$diff}}</span></p> 72 <p class="mod js_autoraise_prompt @if($options->is_enabled === 0) hidden @endif">Автоподнятие вакансии продолжит действовать в течение следующих дней: <span>{{$diff}}</span></p>
72 </div> 73 </div>
73 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> 74 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
74 <label class="form-group__label">Сколько раз в день необходимо обновлять 75 <label class="form-group__label">Сколько раз в день необходимо обновлять
75 вакансии?</label> 76 вакансии?</label>
76 <div class="form-group__item"> 77 <div class="form-group__item">
77 <div class="select"> 78 <div class="select">
78 <select name="times_per_day" class="js-select2 js_autoraise_select"> 79 <select name="times_per_day" class="js-select2 js_autoraise_select">
79 <option @if($options['times_per_day'] === null) selected @endif disabled>Выберите вариант из списка</option> 80 <option @if($options['times_per_day'] === null) selected @endif disabled>Выберите вариант из списка</option>
80 <option @if($options['times_per_day'] === 1) selected @endif value="1">1 раз</option> 81 <option @if($options['times_per_day'] === 1) selected @endif value="1">1 раз</option>
81 <option @if($options['times_per_day'] === 2) selected @endif value="2">2 раза</option> 82 <option @if($options['times_per_day'] === 2) selected @endif value="2">2 раза</option>
82 <option @if($options['times_per_day'] === 3) selected @endif value="3">3 раза</option> 83 <option @if($options['times_per_day'] === 3) selected @endif value="3">3 раза</option>
83 </select> 84 </select>
84 </div> 85 </div>
85 </div> 86 </div>
86 </div> 87 </div>
87 <label class="cabinet__inputs-item form-group"> 88 <label class="cabinet__inputs-item form-group">
88 <div class="form-group__label">Выберите первое время обновления (по 89 <div class="form-group__label">Выберите первое время обновления (по
89 МСК)</div> 90 МСК)</div>
90 <div class="form-group__item"> 91 <div class="form-group__item">
91 <span class="form-group__item-icon"> 92 <span class="form-group__item-icon">
92 <svg> 93 <svg>
93 <use xlink:href="images/sprite.svg#date"></use> 94 <use xlink:href="images/sprite.svg#date"></use>
94 </svg> 95 </svg>
95 </span> 96 </span>
96 <input 97 <input
97 name="time_send_first" 98 name="time_send_first"
98 type="text" 99 type="text"
99 class="input js-picker input-picker" 100 class="input js-picker input-picker"
100 placeholder="Время" 101 placeholder="Время"
101 value="{{ $options['time_send_first'] }}" 102 value="{{ $options['time_send_first'] }}"
102 > 103 >
103 </div> 104 </div>
104 </label> 105 </label>
105 <label class="cabinet__inputs-item form-group"> 106 <label class="cabinet__inputs-item form-group">
106 <div class="form-group__label">Выберите второе время обновления (по 107 <div class="form-group__label">Выберите второе время обновления (по
107 МСК)</div> 108 МСК)</div>
108 <div class="form-group__item"> 109 <div class="form-group__item">
109 <span class="form-group__item-icon"> 110 <span class="form-group__item-icon">
110 <svg> 111 <svg>
111 <use xlink:href="images/sprite.svg#date"></use> 112 <use xlink:href="images/sprite.svg#date"></use>
112 </svg> 113 </svg>
113 </span> 114 </span>
114 <input 115 <input
115 name="time_send_second" 116 name="time_send_second"
116 type="text" 117 type="text"
117 class="input js-picker input-picker" 118 class="input js-picker input-picker"
118 placeholder="Время" 119 placeholder="Время"
119 value="{{ $options['time_send_second'] }}" 120 value="{{ $options['time_send_second'] }}"
120 @if($options['times_per_day'] < 2) disabled @endif 121 @if($options['times_per_day'] < 2) disabled @endif
121 > 122 >
122 </div> 123 </div>
123 </label> 124 </label>
124 <label class="cabinet__inputs-item form-group"> 125 <label class="cabinet__inputs-item form-group">
125 <div class="form-group__label">Выберите третье время обновления (по МСК)</div> 126 <div class="form-group__label">Выберите третье время обновления (по МСК)</div>
126 <div class="form-group__item"> 127 <div class="form-group__item">
127 <span class="form-group__item-icon"> 128 <span class="form-group__item-icon">
128 <svg> 129 <svg>
129 <use xlink:href="images/sprite.svg#date"></use> 130 <use xlink:href="images/sprite.svg#date"></use>
130 </svg> 131 </svg>
131 </span> 132 </span>
132 <input 133 <input
133 name="time_send_third" 134 name="time_send_third"
134 type="text" 135 type="text"
135 class="input js-picker input-picker" 136 class="input js-picker input-picker"
136 placeholder="Время" 137 placeholder="Время"
137 value="{{ $options['time_send_third'] }}" 138 value="{{ $options['time_send_third'] }}"
138 @if($options['times_per_day'] < 3) disabled @endif 139 @if($options['times_per_day'] < 3) disabled @endif
139 > 140 >
140 </div> 141 </div>
141 </label> 142 </label>
142 <label class="cabinet__inputs-item form-group"> 143 <label class="cabinet__inputs-item form-group">
143 <div class="form-group__label">Выберите время отправки в телеграм (по МСК)</div> 144 <div class="form-group__label">Выберите время отправки в телеграм (по МСК)</div>
144 <div class="form-group__item"> 145 <div class="form-group__item">
145 <span class="form-group__item-icon"> 146 <span class="form-group__item-icon">
146 <svg> 147 <svg>
147 <use xlink:href="images/sprite.svg#date"></use> 148 <use xlink:href="images/sprite.svg#date"></use>
148 </svg> 149 </svg>
149 </span> 150 </span>
150 <input 151 <input
151 name="time_send_tg" 152 name="time_send_tg"
152 type="text" 153 type="text"
153 class="input js-picker" 154 class="input js-picker"
154 placeholder="Время" 155 placeholder="Время"
155 value="{{ $options['time_send_tg'] }}" 156 value="{{ $options['time_send_tg'] }}"
156 > 157 >
157 </div> 158 </div>
158 </label> 159 </label>
159 <div class="cabinet__inputs-item form-group"> 160 <div class="cabinet__inputs-item form-group">
160 <label class="form-group__label">Выполнять это действие на протяжении</label> 161 <label class="form-group__label">Выполнять это действие на протяжении</label>
161 <div class="form-group__item"> 162 <div class="form-group__item">
162 <div class="select"> 163 <div class="select">
163 <select name="days_repeat" class="js-select2"> 164 <select name="days_repeat" class="js-select2">
164 <option @if($options['days_repeat'] === null) selected @endif disabled>Выполнять это действие на протяжении</option> 165 <option @if($options['days_repeat'] === null) selected @endif disabled>Выполнять это действие на протяжении</option>
165 <option @if($options['days_repeat'] === 1) selected @endif value="1">1 день</option> 166 <option @if($options['days_repeat'] === 1) selected @endif value="1">1 день</option>
166 <option @if($options['days_repeat'] === 3) selected @endif value="3">3 дня</option> 167 <option @if($options['days_repeat'] === 3) selected @endif value="3">3 дня</option>
167 <option @if($options['days_repeat'] === 5) selected @endif value="5">5 дней</option> 168 <option @if($options['days_repeat'] === 5) selected @endif value="5">5 дней</option>
168 <option @if($options['days_repeat'] === 7) selected @endif value="7">7 дней</option> 169 <option @if($options['days_repeat'] === 7) selected @endif value="7">7 дней</option>
169 <option @if($options['days_repeat'] === 10) selected @endif value="10">10 дней</option> 170 <option @if($options['days_repeat'] === 10) selected @endif value="10">10 дней</option>
170 <option @if($options['days_repeat'] === 15) selected @endif value="15">15 дней</option> 171 <option @if($options['days_repeat'] === 15) selected @endif value="15">15 дней</option>
171 <option @if($options['days_repeat'] === 30) selected @endif value="30">30 дней</option> 172 <option @if($options['days_repeat'] === 30) selected @endif value="30">30 дней</option>
172 </select> 173 </select>
173 </div> 174 </div>
174 </div> 175 </div>
175 </div> 176 </div>
176 </div> 177 </div>
177 <div class="table table_spoiler"> 178 <div class="table table_spoiler">
178 <button type="button" 179 <button type="button"
179 class="table__button js-toggle js-parent-toggle button button_light button_more"> 180 class="table__button js-toggle js-parent-toggle button button_light button_more">
180 <span>Показать ещё</span> 181 <span>Показать ещё</span>
181 <span>Свернуть</span> 182 <span>Свернуть</span>
182 </button> 183 </button>
183 <div class="table__scroll"> 184 <div class="table__scroll">
184 <div class="table__body table__body_min-width"> 185 <div class="table__body table__body_min-width">
185 <table> 186 <table>
186 <thead> 187 <thead>
187 <tr> 188 <tr>
188 <th>Название</th> 189 <th>Название</th>
189 <th>Обновлять на сайте</th> 190 <th>Обновлять на сайте</th>
190 <th>Отправлять в ТГ</th> 191 <th>Отправлять в ТГ</th>
191 </tr> 192 </tr>
192 </thead> 193 </thead>
193 <tbody> 194 <tbody>
194 @foreach($vacancies as $vacancy) 195 @foreach($vacancies as $vacancy)
195 <tr name="vacancy_table_row" data-id="{{ $vacancy->id }}"> 196 <tr name="vacancy_table_row" data-id="{{ $vacancy->id }}">
196 <td>{{ $vacancy->name }}</td> 197 <td>{{ $vacancy->name }}</td>
197 <td > 198 <td >
198 <span class="checkbox-empty"> 199 <span class="checkbox-empty">
199 <label class="checkbox"> 200 <label class="checkbox">
200 <input 201 <input
201 type="checkbox" 202 type="checkbox"
202 class="checkbox__input" 203 class="checkbox__input"
203 @if($vacancy->autolift_site) checked @endif 204 @if($vacancy->autolift_site) checked @endif
204 name="autolift_site" 205 name="autolift_site"
205 > 206 >
206 <span class="checkbox__icon"> 207 <span class="checkbox__icon">
207 <svg> 208 <svg>
208 <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use> 209 <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use>
209 </svg> 210 </svg>
210 </span> 211 </span>
211 </label> 212 </label>
212 </span> 213 </span>
213 </td> 214 </td>
214 <td> 215 <td>
215 <span class="checkbox-empty"> 216 <span class="checkbox-empty">
216 <label class="checkbox"> 217 <label class="checkbox">
217 <input 218 <input
218 type="checkbox" 219 type="checkbox"
219 class="checkbox__input" 220 class="checkbox__input"
220 @if($vacancy->autosend_tg) checked @endif 221 @if($vacancy->autosend_tg) checked @endif
221 name="autosend_tg" 222 name="autosend_tg"
222 > 223 >
223 <span class="checkbox__icon"> 224 <span class="checkbox__icon">
224 <svg> 225 <svg>
225 <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use> 226 <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use>
226 </svg> 227 </svg>
227 </span> 228 </span>
228 </label> 229 </label>
229 </span> 230 </span>
230 </td> 231 </td>
231 </tr> 232 </tr>
232 @endforeach 233 @endforeach
233 </tbody> 234 </tbody>
234 </table> 235 </table>
235 </div> 236 </div>
236 </div> 237 </div>
237 <div class="mrg-wrapper" style="display: flex; justify-content: center; clear: both;"> 238 <div class="mrg-wrapper" style="display: flex; justify-content: center; clear: both;">
238 <ins class="mrg-tag" data-ad-client="ad-595528" data-ad-slot="595528" style="display: flex; align-items: center; justify-content: center; width: 300px; z-index: 1;"> 239 <ins class="mrg-tag" data-ad-client="ad-595528" data-ad-slot="595528" style="display: flex; align-items: center; justify-content: center; width: 300px; z-index: 1;">
239 240
240 </ins> 241 </ins>
241 </div> 242 </div>
242 </div> 243 </div>
243 <div class="cabinet__inputs"> 244 <div class="cabinet__inputs">
244 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth"> 245 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth">
245 <button id="submit" type="button" class="button">Сохранить</button> 246 <button id="submit" type="button" class="button">Сохранить</button>
246 </div> 247 </div>
247 </div> 248 </div>
248 </div> 249 </div>
249 </form> 250 </form>
250 </div> 251 </div>
251 </div> 252 </div>
252 </section> 253 </section>
253 </div> 254 </div>
254 @endsection 255 @endsection
255 256
resources/views/workers/autoresponder.blade.php
File was created 1 @extends('layout.frontend', ['title' => 'Автоответчик'])
2
3 @section('content')
4 <section class="cabinet">
5 <div class="container">
6 <ul class="breadcrumbs cabinet__breadcrumbs">
7 <li><a href="{{ route('index') }}">Главная</a></li>
8 <li><b>Личный кабинет</b></li>
9 </ul>
10 <div class="cabinet__wrapper">
11 <div class="cabinet__side">
12 <div class="cabinet__side-toper">
13 @include('workers.emblema')
14 </div>
15 @include('workers.menu', ['item' => 16])
16 </div>
17
18 <form class="cabinet__body" action="{{ route('worker.autoresponder_save') }}">
19 <div class="cabinet__body-item">
20 <h2 class="title cabinet__title">Автоответчик</h2>
21 <div class="cabinet__inputs">
22 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth">
23 <label class="toggle">
24 <input name="autoresponder" type="checkbox" class="toggle__input"
25 @if($user->autoresponder) checked @endif>
26 <span class="toggle__icon"></span>
27 <span class="toggle__text">Деактивировано</span>
28 <span class="toggle__text">Активировано</span>
29 </label>
30 </div>
31 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth">
32 <p>В этом разделе вы сможете задать автоматический ответ на письма, поступающие в
33 почтовый ящик.</p>
34 </div>
35 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
36 <label class="form-group__label">Введите текст</label>
37 <div class="form-group__item">
38 <textarea
39 name="autoresponder_message"
40 class="textarea"
41 placeholder="Ваше сообщение"
42 required
43 >{{$user->autoresponder_message}}</textarea>
44 </div>
45 </div>
46 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth">
47 <button type="submit" class="button">Сохранить</button>
48 </div>
49 </div>
50 </div>
51 </form>
52 </div>
53 </div>
54 </section>
55 </div>
56 @endsection
57
resources/views/workers/dialog.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 $(function(){ 5 $(function(){
6 var chatbox_div = $('.chatbox__list'); 6 var chatbox_div = $('.chatbox__list');
7 chatbox_div.scrollTop(chatbox_div.prop("scrollHeight")); 7 chatbox_div.scrollTop(chatbox_div.prop("scrollHeight"));
8 8
9 $('form.chatbox__bottom [name="file"]').on('change', function() { 9 $('form.chatbox__bottom [name="file"]').on('change', function() {
10 var fileName = $(this).val().split('\\').pop(); 10 var fileName = $(this).val().split('\\').pop();
11 $('.chatbox-file-name-wrap').text('Добавлен файл: ' + fileName); 11 $('.chatbox-file-name-wrap').text('Добавлен файл: ' + fileName);
12 }); 12 });
13 13
14 $('.admin-chat-answer').click(function(){ 14 $('.admin-chat-answer').click(function(){
15 var modal = $('#answer_from_admin_chat_modal'); 15 var modal = $('#answer_from_admin_chat_modal');
16 16
17 modal.data('to-user-id', $(this).data('to-user-id')); 17 modal.data('to-user-id', $(this).data('to-user-id'));
18 modal.data('message-id', $(this).data('message-id')); 18 modal.data('message-id', $(this).data('message-id'));
19 }); 19 });
20 }); 20 });
21 21
22 $(document).on('change', '#send_btn', function() { 22 $(document).on('change', '#send_btn', function() {
23 var this_ = $(this); 23 var this_ = $(this);
24 var val_ = this_.val(); 24 var val_ = this_.val();
25 console.log('sort items '+val_); 25 console.log('sort items '+val_);
26 26
27 $.ajax({ 27 $.ajax({
28 type: "GET", 28 type: "GET",
29 url: "{{ route('shipping_companies') }}", 29 url: "{{ route('shipping_companies') }}",
30 data: "sort="+val_+"&block=1", 30 data: "sort="+val_+"&block=1",
31 success: function (data) { 31 success: function (data) {
32 console.log('Выбор сортировки'); 32 console.log('Выбор сортировки');
33 console.log(data); 33 console.log(data);
34 $('#block_1').html(data); 34 $('#block_1').html(data);
35 }, 35 },
36 headers: { 36 headers: {
37 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 37 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
38 }, 38 },
39 error: function (data) { 39 error: function (data) {
40 data = JSON.stringify(data); 40 data = JSON.stringify(data);
41 console.log('Error: ' + data); 41 console.log('Error: ' + data);
42 } 42 }
43 }); 43 });
44 44
45 $.ajax({ 45 $.ajax({
46 type: "GET", 46 type: "GET",
47 url: "{{ route('shipping_companies') }}", 47 url: "{{ route('shipping_companies') }}",
48 data: "sort="+val_+"&block=2", 48 data: "sort="+val_+"&block=2",
49 success: function (data) { 49 success: function (data) {
50 console.log('Выбор сортировки2'); 50 console.log('Выбор сортировки2');
51 console.log(data); 51 console.log(data);
52 history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); 52 history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif");
53 $('#block_2').html(data); 53 $('#block_2').html(data);
54 }, 54 },
55 headers: { 55 headers: {
56 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 56 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
57 }, 57 },
58 error: function (data) { 58 error: function (data) {
59 data = JSON.stringify(data); 59 data = JSON.stringify(data);
60 console.log('Error: ' + data); 60 console.log('Error: ' + data);
61 } 61 }
62 }); 62 });
63 }); 63 });
64 </script> 64 </script>
65 @endsection 65 @endsection
66 66
67 @section('content') 67 @section('content')
68 <section class="cabinet"> 68 <section class="cabinet">
69 <div class="container"> 69 <div class="container">
70 <ul class="breadcrumbs cabinet__breadcrumbs"> 70 <ul class="breadcrumbs cabinet__breadcrumbs">
71 <li><a href="{{ route('index') }}">Главная</a></li> 71 <li><a href="{{ route('index') }}">Главная</a></li>
72 <li><b>Личный кабинет</b></li> 72 <li><b>Личный кабинет</b></li>
73 </ul> 73 </ul>
74 <div class="cabinet__wrapper"> 74 <div class="cabinet__wrapper">
75 <div class="cabinet__side"> 75 <div class="cabinet__side">
76 <div class="cabinet__side-toper"> 76 <div class="cabinet__side-toper">
77 @include('workers.emblema') 77 @include('workers.emblema')
78 </div> 78 </div>
79 @include('workers.menu', ['item' => 2]) 79 @include('workers.menu', ['item' => 2])
80 </div> 80 </div>
81 <div class="cabinet__body"> 81 <div class="cabinet__body">
82 <div class="cabinet__body-item"> 82 <div class="cabinet__body-item">
83 <h2 class="title cabinet__title">Сообщения</h2> 83 <h2 class="title cabinet__title">Сообщения</h2>
84 </div> 84 </div>
85 <div class="cabinet__body-item"> 85 <div class="cabinet__body-item">
86 <a href="{{ route('worker.messages', ['type_message' => 'input']) }}" class="back"> 86 <a href="{{ route('worker.messages', ['type_message' => 'input']) }}" class="back">
87 <svg> 87 <svg>
88 <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use> 88 <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use>
89 </svg> 89 </svg>
90 <span> 90 <span>
91 К списку чатов 91 К списку чатов
92 </span> 92 </span>
93 </a> 93 </a>
94 <div class="chatbox"> 94 <div class="chatbox">
95 <div class="chatbox__toper"> 95 <div class="chatbox__toper">
96 @if($chat->is_admin_chat) 96 @if($chat->is_admin_chat)
97 <div class="chatbox__toper-info messages__item-info"> 97 <div class="chatbox__toper-info messages__item-info">
98 @include('svg.logo_icon') 98 @include('svg.logo_icon')
99 <div class="messages__item-text bold font20"> 99 <div class="messages__item-text bold font20">
100 Администратор сайта 100 Администратор сайта
101 </div> 101 </div>
102 </div> 102 </div>
103 @elseif ($companion->is_worker) 103 @elseif ($companion->is_worker)
104 <div class="chatbox__toper-info messages__item-info"> 104 <div class="chatbox__toper-info messages__item-info">
105 <div class="messages__item-photo"> 105 <div class="messages__item-photo">
106 <svg> 106 <svg>
107 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> 107 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
108 </svg> 108 </svg>
109 @if ((isset($companion->workers[0]->photo)) && 109 @if ((isset($companion->workers[0]->photo)) &&
110 (!empty($companion->workers[0]->photo))) 110 (!empty($companion->workers[0]->photo)))
111 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->workers[0]->photo)) }}" alt=""> 111 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->workers[0]->photo)) }}" alt="">
112 @else 112 @else
113 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 113 <img src="{{ asset('images/default_man.jpg') }}" alt="">
114 @endif 114 @endif
115 </div> 115 </div>
116 </div> 116 </div>
117 @if (isset($companion->workers[0]->id)) 117 @if (isset($companion->workers[0]->id))
118 <a href="{{ route('resume_profile', ['worker' => $companion->workers[0]->id]) }}" class="button chatbox__toper-button"> 118 <a href="{{ route('resume_profile', ['worker' => $companion->workers[0]->id]) }}" class="button chatbox__toper-button">
119 <svg> 119 <svg>
120 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> 120 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use>
121 </svg> 121 </svg>
122 Перейти в профиль 122 Перейти в профиль
123 </a> 123 </a>
124 @endif 124 @endif
125 @else 125 @else
126 <div class="chatbox__toper-info messages__item-info"> 126 <div class="chatbox__toper-info messages__item-info">
127 <div class="messages__item-photo"> 127 <div class="messages__item-photo">
128 <svg> 128 <svg>
129 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> 129 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
130 </svg> 130 </svg>
131 @if ((isset($companion->employers[0]->logo)) && 131 @if ((isset($companion->employers[0]->logo)) &&
132 (!empty($companion->employers[0]->logo))) 132 (!empty($companion->employers[0]->logo)))
133 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->employers[0]->logo)) }}" alt=""> 133 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->employers[0]->logo)) }}" alt="">
134 @else 134 @else
135 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 135 <img src="{{ asset('images/default_man.jpg') }}" alt="">
136 @endif 136 @endif
137 </div> 137 </div>
138 <div class="messages__item-text"> 138 <div class="messages__item-text">
139 <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div> 139 <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div>
140 <div><span>Статус:</span> Работодатель или Администратор</div> 140 <div><span>Статус:</span> Работодатель или Администратор</div>
141 </div> 141 </div>
142 </div> 142 </div>
143 @if (isset($companion->employers[0]->id)) 143 @if (isset($companion->employers[0]->id))
144 <a href="{{ route('info_company', ['company' => $companion->employers[0]->id]) }}" class="button chatbox__toper-button"> 144 <a href="{{ route('info_company', ['company' => $companion->employers[0]->id]) }}" class="button chatbox__toper-button">
145 <svg> 145 <svg>
146 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> 146 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use>
147 </svg> 147 </svg>
148 Перейти в профиль 148 Перейти в профиль
149 </a> 149 </a>
150 @endif 150 @endif
151 @endif 151 @endif
152 </div> 152 </div>
153 153
154 @if ($errors->any()) 154 @if ($errors->any())
155 <div class="red bold"> 155 <div class="red bold">
156 <ul> 156 <ul>
157 @foreach ($errors->all() as $error) 157 @foreach ($errors->all() as $error)
158 <li>{{ $error }}</li> 158 <li>{{ $error }}</li>
159 @endforeach 159 @endforeach
160 </ul> 160 </ul>
161 </div> 161 </div>
162 @endif 162 @endif
163 163
164 <div class="chatbox__list" id="dialogs" name="dialogs"> 164 <div class="chatbox__list" id="dialogs" name="dialogs">
165 @if ($Messages->count()) 165 @if ($Messages->count())
166 @foreach ($Messages as $it) 166 @foreach ($Messages as $it)
167 @if ($it->user_id == $companion->id) 167 @if ($it->user_id == $companion->id)
168 <div class="chatbox__item"> 168 <div class="chatbox__item">
169 <div class="chatbox__item-photo"> 169 <div class="chatbox__item-photo">
170 <svg> 170 <svg>
171 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> 171 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
172 </svg> 172 </svg>
173 @if($companion->is_worker) 173 @if($companion->is_worker)
174 @if ((isset($companion->workers[0]->photo)) && 174 @if ((isset($companion->workers[0]->photo)) &&
175 (!empty($companion->workers[0]->photo))) 175 (!empty($companion->workers[0]->photo)))
176 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->workers[0]->photo)) }}" alt=""> 176 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->workers[0]->photo)) }}" alt="">
177 @else 177 @else
178 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 178 <img src="{{ asset('images/default_man.jpg') }}" alt="">
179 @endif 179 @endif
180 @else 180 @else
181 @if ((isset($companion->employers[0]->logo)) && 181 @if ((isset($companion->employers[0]->logo)) &&
182 (!empty($companion->employers[0]->logo))) 182 (!empty($companion->employers[0]->logo)))
183 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->employers[0]->logo)) }}" alt=""> 183 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->employers[0]->logo)) }}" alt="">
184 @else 184 @else
185 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 185 <img src="{{ asset('images/default_man.jpg') }}" alt="">
186 @endif 186 @endif
187 @endif 187 @endif
188 </div> 188 </div>
189 <div class="chatbox__item-body"> 189 <div class="chatbox__item-body">
190 @if($it->ad_employer_id > 0) 190 @if($it->ad_employer_id > 0)
191 <div class="chatbox__item-text"> 191 <div class="chatbox__item-text">
192 Отклик на вакансию {{ \App\Models\Ad_employer::find($it->ad_employer_id)->name }} 192 Отклик на вакансию {{ \App\Models\Ad_employer::find($it->ad_employer_id)->name }}
193 @if($it->text) 193 @if($it->text)
194 Комментарий: {{ $it->text }} 194 Комментарий: {{ $it->text }}
195 @endif 195 @endif
196 </div> 196 </div>
197 @else 197 @else
198 @if($it->text) 198 @if($it->text)
199 {{ $it->text }} 199 {{ $it->text }}
200 @endif 200 @endif
201 @endif 201 @endif
202 @if ((isset($it->file)) && (!empty($it->file))) 202 @if ((isset($it->file)) && (!empty($it->file)))
203 <div class="chatbox__item-text chatbox__item-body-file-name-wrap"> 203 <div class="chatbox__item-text chatbox__item-body-file-name-wrap">
204 <div class=""> 204 <div class="">
205 @if($it->original_file_name) 205 @if($it->original_file_name)
206 {{ $it->original_file_name }} 206 {{ $it->original_file_name }}
207 @else 207 @else
208 <svg> 208 <svg>
209 <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> 209 <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use>
210 </svg> 210 </svg>
211 @endif 211 @endif
212 </div> 212 </div>
213 <a href="{{ asset(Storage::url($it->file)) }}" class=""> 213 <a href="{{ asset(Storage::url($it->file)) }}" class="">
214 Скачать 214 Скачать
215 </a> 215 </a>
216 </div> 216 </div>
217 @endif 217 @endif
218 </div> 218 </div>
219 <div class="chatbox__item-time">{{ $it->created_at }}</div> 219 <div class="chatbox__item-time">{{ $it->created_at }}</div>
220 </div> 220 </div>
221 @else 221 @else
222 <div class="chatbox__item chatbox__item_reverse"> 222 <div class="chatbox__item chatbox__item_reverse">
223 <div class="@if(!$chat->is_admin_chat) chatbox__item-photo @endif"> 223 <div class="@if(!$chat->is_admin_chat) chatbox__item-photo @endif">
224 @if($chat->is_admin_chat) 224 @if($chat->is_admin_chat)
225 @include('svg.logo_icon') 225 @include('svg.logo_icon')
226 @else 226 @else
227 @if ($sender->is_worker) 227 @if ($sender->is_worker)
228 @if ((isset($sender->workers[0]->photo)) && 228 @if ((isset($sender->workers[0]->photo)) &&
229 (!empty($sender->workers[0]->photo))) 229 (!empty($sender->workers[0]->photo)))
230 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($sender->workers[0]->photo)) }}" alt=""> 230 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($sender->workers[0]->photo)) }}" alt="">
231 @else 231 @else
232 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 232 <img src="{{ asset('images/default_man.jpg') }}" alt="">
233 @endif 233 @endif
234 @else 234 @else
235 <svg> 235 <svg>
236 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> 236 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
237 </svg> 237 </svg>
238 238
239 @if ((isset($sender->employers[0]->logo)) && 239 @if ((isset($sender->employers[0]->logo)) &&
240 (!empty($sender->employers[0]->logo))) 240 (!empty($sender->employers[0]->logo)))
241 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($sender->employers[0]->logo)) }}" alt=""> 241 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($sender->employers[0]->logo)) }}" alt="">
242 @else 242 @else
243 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 243 <img src="{{ asset('images/default_man.jpg') }}" alt="">
244 @endif 244 @endif
245 @endif 245 @endif
246 @endif 246 @endif
247 </div> 247 </div>
248 <div class="chatbox__item-body"> 248 <div class="chatbox__item-body">
249 @if($chat->is_admin_chat || $it->text || $it->reply_message_id || $it->ad_employer_id > 0) 249 @if($chat->is_admin_chat || $it->text || $it->reply_message_id || $it->ad_employer_id > 0)
250 <div class="chatbox__item-text"> 250 <div class="chatbox__item-text">
251 @if($chat->is_admin_chat) 251 @if($chat->is_admin_chat)
252 <button class="button admin-chat-answer" data-fancybox data-src="#answer_from_admin_chat_modal" 252 <button class="button admin-chat-answer" data-fancybox data-src="#answer_from_admin_chat_modal"
253 data-to-user-id="{{ $it->user_id }}" data-message-id="{{ $it->id }}" 253 data-to-user-id="{{ $it->user_id }}" data-message-id="{{ $it->id }}"
254 > 254 >
255 Ответить 255 Ответить
256 </button> 256 </button>
257 @endif 257 @endif
258 258
259 @if($it->ad_employer_id > 0) 259 @if(\App\Models\Ad_employer::where('id', $it->ad_employer_id)->exists()))
260 <b>Отклик на вакансию</b> "{{ \App\Models\Ad_employer::find($it->ad_employer_id)->name }}"<br> 260 <b>Отклик на вакансию</b> "{{ \App\Models\Ad_employer::find($it->ad_employer_id)->name }}"<br>
261 @if($it->text) 261 @if($it->text)
262 <b>Комментарий:</b> {{ $it->text }} 262 <b>Комментарий:</b> {{ $it->text }}
263 @endif 263 @endif
264 @else 264 @else
265 @if($it->text) 265 @if($it->text)
266 {{ $it->text }} 266 {{ $it->text }}
267 @endif 267 @endif
268 @endif 268 @endif
269 269
270 @if($it->reply_message_id) 270 @if($it->reply_message_id)
271 <div class="reply-message"> 271 <div class="reply-message">
272 {{ $it->reply_message->text }} 272 {{ $it->reply_message->text }}
273 </div> 273 </div>
274 @endif 274 @endif
275 </div> 275 </div>
276 @endif 276 @endif
277 @if ((isset($it->file)) && (!empty($it->file))) 277 @if ((isset($it->file)) && (!empty($it->file)))
278 <div class="chatbox__item-text chatbox__item-body-file-name-wrap"> 278 <div class="chatbox__item-text chatbox__item-body-file-name-wrap">
279 <a href="{{ asset(Storage::url($it->file)) }}" class=""> 279 <a href="{{ asset(Storage::url($it->file)) }}" class="">
280 Скачать 280 Скачать
281 </a> 281 </a>
282 <div class=""> 282 <div class="">
283 @if($it->original_file_name) 283 @if($it->original_file_name)
284 {{ $it->original_file_name }} 284 {{ $it->original_file_name }}
285 @else 285 @else
286 <svg> 286 <svg>
287 <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> 287 <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use>
288 </svg> 288 </svg>
289 @endif 289 @endif
290 </div> 290 </div>
291 </div> 291 </div>
292 @endif 292 @endif
293 </div> 293 </div>
294 <div class="chatbox__item-time">{{ $it->created_at }}</div> 294 <div class="chatbox__item-time">{{ $it->created_at }}</div>
295 </div> 295 </div>
296 @endif 296 @endif
297 297
298 @endforeach 298 @endforeach
299 @endif 299 @endif
300 </div> 300 </div>
301 @if(!$chat->is_admin_chat) 301 @if(!$chat->is_admin_chat)
302 <div> 302 <div>
303 <form action="{{ route('worker.test123') }}" class="chatbox__bottom" enctype="multipart/form-data" method="POST" > 303 <form action="{{ route('worker.test123') }}" class="chatbox__bottom" enctype="multipart/form-data" method="POST" >
304 @csrf 304 @csrf
305 <label class="chatbox__bottom-file"> 305 <label class="chatbox__bottom-file">
306 <input id="file" name="file" type="file"> 306 <input id="file" name="file" type="file">
307 <svg> 307 <svg>
308 <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> 308 <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use>
309 </svg> 309 </svg>
310 </label> 310 </label>
311 <input type="hidden" name="_token" value="{{ csrf_token() }}"/> 311 <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
312 <input type="hidden" id="user_id" name="user_id" value="{{ $sender->id }}"/> 312 <input type="hidden" id="user_id" name="user_id" value="{{ $sender->id }}"/>
313 <input type="hidden" id="to_user_id" name="to_user_id" value="{{ $companion->id }}"/> 313 <input type="hidden" id="to_user_id" name="to_user_id" value="{{ $companion->id }}"/>
314 <input type="hidden" id="ad_employer_id" name="ad_employer_id" value="{{ $ad_employer }}"/> 314 <input type="hidden" id="ad_employer_id" name="ad_employer_id" value="{{ $ad_employer }}"/>
315 <input type="hidden" id="ad_name" name="ad_name" value="@if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }} @endif"/> 315 <input type="hidden" id="ad_name" name="ad_name" value="@if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }} @endif"/>
316 <input id="text" name="text" type="text" class="input chatbox__bottom-text" placeholder="Ответить"> 316 <input id="text" name="text" type="text" class="input chatbox__bottom-text" placeholder="Ответить">
317 <button type="submit" id="send_btn" name="send_btn" class="chatbox__bottom-send"> 317 <button type="submit" id="send_btn" name="send_btn" class="chatbox__bottom-send">
318 <svg> 318 <svg>
319 <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> 319 <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use>
320 </svg> 320 </svg>
321 </button> 321 </button>
322 </form> 322 </form>
323 <div class="chatbox-file-name-wrap mt-5 fw600"></div> 323 <div class="chatbox-file-name-wrap mt-5 fw600"></div>
324 </div> 324 </div>
325 @endif 325 @endif
326 </div> 326 </div>
327 </div> 327 </div>
328 </div> 328 </div>
329 </div> 329 </div>
330 </div> 330 </div>
331 </section> 331 </section>
332 </div> 332 </div>
333 333
334 @include('modals.chats.answer_from_admin_chat') 334 @include('modals.chats.answer_from_admin_chat')
335 @endsection 335 @endsection
336 336
resources/views/workers/menu.blade.php
1 <div class="cabinet__side-item"> 1 <div class="cabinet__side-item">
2 <div class="cabinet__menu"> 2 <div class="cabinet__menu">
3 <button type="button" class="cabinet__menu-toper js-toggle"> 3 <button type="button" class="cabinet__menu-toper js-toggle">
4 <span class="cabinet__menu-toper-text"></span> 4 <span class="cabinet__menu-toper-text"></span>
5 <i class="cabinet__menu-toper-arrow"> 5 <i class="cabinet__menu-toper-arrow">
6 <svg> 6 <svg>
7 <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> 7 <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use>
8 </svg> 8 </svg>
9 </i> 9 </i>
10 </button> 10 </button>
11 <div class="cabinet__menu-body"> 11 <div class="cabinet__menu-body">
12 <div class="cabinet__menu-items"> 12 <div class="cabinet__menu-items">
13 <a href="{{ route('worker.cabinet') }}" class="cabinet__menu-item @if ($item==1) active @endif"> 13 <a href="{{ route('worker.cabinet') }}" class="cabinet__menu-item @if ($item==1) active @endif">
14 <i> 14 <i>
15 <svg> 15 <svg>
16 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> 16 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use>
17 </svg> 17 </svg>
18 </i> 18 </i>
19 <span>Моя анкета</span> 19 <span>Моя анкета</span>
20 </a> 20 </a>
21 <a href="{{ route('worker.messages', ['type_message' => 'input']) }}" class="cabinet__menu-item @if ($item==2) active @endif"> 21 <a href="{{ route('worker.messages', ['type_message' => 'input']) }}" class="cabinet__menu-item @if ($item==2) active @endif">
22 <i> 22 <i>
23 <svg> 23 <svg>
24 <use xlink:href="{{ asset('images/sprite.svg#cabinet-5') }}"></use> 24 <use xlink:href="{{ asset('images/sprite.svg#cabinet-5') }}"></use>
25 </svg> 25 </svg>
26 </i> 26 </i>
27 <span>Сообщения</span> 27 <span>Сообщения</span>
28 </a> 28 </a>
29 <a href="{{ route('worker.autolift') }}" class="cabinet__menu-item @if ($item==7) active @endif">
30 <i>
31 <svg>
32 <use xlink:href="{{ asset('images/sprite.svg#refresh') }}"></use>
33 </svg>
34 </i>
35 <span>Автоподнятие резюме</span>
36 </a>
37 <a href="{{ route('worker.autoresponder') }}" class="cabinet__menu-item @if ($item==6) active @endif">
38 <i>
39 <svg>
40 <use xlink:href="{{ asset('images/sprite.svg#answering') }}"></use>
41 </svg>
42 </i>
43 <span>Автоответчик</span>
44 </a>
29 <a href="{{ route('worker.colorado') }}" class="cabinet__menu-item @if ($item==3) active @endif"> 45 <a href="{{ route('worker.colorado') }}" class="cabinet__menu-item @if ($item==3) active @endif">
30 <i> 46 <i>
31 <svg> 47 <svg>
32 <use xlink:href="{{ asset('images/sprite.svg#cabinet-6') }}"></use> 48 <use xlink:href="{{ asset('images/sprite.svg#cabinet-6') }}"></use>
33 </svg> 49 </svg>
34 </i> 50 </i>
35 <span>Избранные вакансии</span> 51 <span>Избранные вакансии</span>
36 </a> 52 </a>
37 <a href="{{ route('worker.new_password') }}" class="cabinet__menu-item green @if ($item==4) active @endif"> 53 <a href="{{ route('worker.new_password') }}" class="cabinet__menu-item green @if ($item==4) active @endif">
38 <i></i> 54 <i></i>
39 <span>Сменить пароль</span> 55 <span>Сменить пароль</span>
40 </a> 56 </a>
41 <a href="{{ route('worker.delete_profile') }}" class="cabinet__menu-item red @if ($item==5) active @endif"> 57 <a href="{{ route('worker.delete_profile') }}" class="cabinet__menu-item red @if ($item==5) active @endif">
42 <i></i> 58 <i></i>
43 <span>Удалить профиль</span> 59 <span>Удалить профиль</span>
44 </a> 60 </a>
45 </div> 61 </div>
46 <div class="cabinet__menu-bottom"> 62 <div class="cabinet__menu-bottom">
47 <a href="{{ route('logout') }}" class="button cabinet__menu-leave"> 63 <a href="{{ route('logout') }}" class="button cabinet__menu-leave">
48 <svg> 64 <svg>
49 <use xlink:href="{{ asset('images/sprite.svg#leave') }}"></use> 65 <use xlink:href="{{ asset('images/sprite.svg#leave') }}"></use>
50 </svg> 66 </svg>
51 Выход 67 Выход
52 </a> 68 </a>
53 <span class="cabinet__menu-copy"> 69 <span class="cabinet__menu-copy">
54 &copy; 2020 &ndash; Rekamore.su 70 &copy; 2020 &ndash; Rekamore.su
55 </span> 71 </span>
56 </div> 72 </div>
57 </div> 73 </div>
58 </div> 74 </div>
59 </div> 75 </div>
60 76
61 <script> 77 <script>
62 $(function(){ 78 $(function(){
63 var active_menu = $('.cabinet__menu-item.active'); 79 var active_menu = $('.cabinet__menu-item.active');
64 if (active_menu.length === 1){ 80 if (active_menu.length === 1){
65 $('.cabinet__menu-toper-text').html(active_menu.html()); 81 $('.cabinet__menu-toper-text').html(active_menu.html());
66 } 82 }
67 }); 83 });
68 </script> 84 </script>
69 85
resources/views/workers/resume_autolift.blade.php
File was created 1 @extends('layout.frontend', ['title' => 'Автоподнятие вакансий'])
2 @section('scripts')
3 <script>
4 $(document).on('click', '#submit', function () {
5 let data = {};
6 console.log($('[name="is_enabled"]').val());
7 data.is_enabled = $('[name="is_enabled"]').val();
8 data.times_per_day = $('[name="times_per_day"]').chosen().val();
9 data.days_repeat = $('[name="days_repeat"]').chosen().val();
10 data.time_send_first = $('[name="time_send_first"]').val();
11 data.time_send_second = $('[name="time_send_second"]').val();
12 data.time_send_third = $('[name="time_send_third"]').val();
13 data.autolift_site = $('[name="autolift_site"]').val();
14
15 $.ajax({
16 url: '{{ route('worker.autolift_save') }}',
17 type: 'POST',
18 data: data,
19 headers: {
20 'X-CSRF-TOKEN': '{{ csrf_token() }}'
21 },
22 success: function (result) {
23 location.reload();
24 },
25 error: function (result) {
26 //todo пульнуть какуюнить модалку
27 },
28 });
29 })
30 </script>
31 @endsection
32 @section('content')
33 <section class="cabinet">
34 <div class="container">
35 <ul class="breadcrumbs cabinet__breadcrumbs">
36 <li><a href="{{ route('index') }}">Главная</a></li>
37 <li><b>Личный кабинет</b></li>
38 </ul>
39 <div class="cabinet__wrapper">
40 <div class="cabinet__side">
41 <div class="cabinet__side-toper">
42 @include('workers.emblema')
43 </div>
44 @include('workers.menu', ['item' => 15])
45 </div>
46 <form class="cabinet__body">
47 @csrf
48 <div class="cabinet__body-item">
49 <h2 class="title cabinet__title">Автоподнятие вакансий</h2>
50 <div class="cabinet__inputs">
51 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth">
52 <?php
53 $createdAtClone = isset($options->created_at) ? clone($options->created_at) : now();
54 $diff = $createdAtClone->addDays($options->days_repeat)->diffInDays($options->created_at);
55 ?>
56 <label class="toggle">
57 <input name="is_enabled" type="checkbox" @if($options->is_enabled) checked disabled @endif class="toggle__input js_autoraise_toggle">
58 <span class="toggle__icon"></span>
59 <span class="toggle__text">Деактивировано</span>
60 <span class="toggle__text">Активировано</span>
61 </label>
62 <p class="mod js_autoraise_prompt @if($options->is_enabled === 1) hidden @endif">Срок действия автоподнятия резюме истек. Желаете его возобновить?</p>
63 <p class="mod js_autoraise_prompt @if($options->is_enabled === 0) hidden @endif">Автоподнятие резюме продолжит действовать в течение следующих дней: <span>{{$diff}}</span></p>
64 </div>
65 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group">
66 <label class="form-group__label">Сколько раз в день необходимо обновлять
67 вакансии?</label>
68 <div class="form-group__item">
69 <div class="select">
70 <select name="times_per_day" class="js-select2 js_autoraise_select">
71 <option @if($options['times_per_day'] === null) selected @endif disabled>Выберите вариант из списка</option>
72 <option @if($options['times_per_day'] === 1) selected @endif value="1">1 раз</option>
73 <option @if($options['times_per_day'] === 2) selected @endif value="2">2 раза</option>
74 <option @if($options['times_per_day'] === 3) selected @endif value="3">3 раза</option>
75 </select>
76 </div>
77 </div>
78 </div>
79 <label class="cabinet__inputs-item form-group">
80 <div class="form-group__label">Выберите первое время обновления (по
81 МСК)</div>
82 <div class="form-group__item">
83 <span class="form-group__item-icon">
84 <svg>
85 <use xlink:href="images/sprite.svg#date"></use>
86 </svg>
87 </span>
88 <input
89 name="time_send_first"
90 type="text"
91 class="input js-picker input-picker"
92 placeholder="Время"
93 value="{{ $options['time_send_first'] }}"
94 >
95 </div>
96 </label>
97 <label class="cabinet__inputs-item form-group">
98 <div class="form-group__label">Выберите второе время обновления (по
99 МСК)</div>
100 <div class="form-group__item">
101 <span class="form-group__item-icon">
102 <svg>
103 <use xlink:href="images/sprite.svg#date"></use>
104 </svg>
105 </span>
106 <input
107 name="time_send_second"
108 type="text"
109 class="input js-picker input-picker"
110 placeholder="Время"
111 value="{{ $options['time_send_second'] }}"
112 @if($options['times_per_day'] < 2) disabled @endif
113 >
114 </div>
115 </label>
116 <label class="cabinet__inputs-item form-group">
117 <div class="form-group__label">Выберите третье время обновления (по МСК)</div>
118 <div class="form-group__item">
119 <span class="form-group__item-icon">
120 <svg>
121 <use xlink:href="images/sprite.svg#date"></use>
122 </svg>
123 </span>
124 <input
125 name="time_send_third"
126 type="text"
127 class="input js-picker input-picker"
128 placeholder="Время"
129 value="{{ $options['time_send_third'] }}"
130 @if($options['times_per_day'] < 3) disabled @endif
131 >
132 </div>
133 </label>
134 <div class="cabinet__inputs-item form-group">
135 <label class="form-group__label">Выполнять это действие на протяжении</label>
136 <div class="form-group__item">
137 <div class="select">
138 <select name="days_repeat" class="js-select2">
139 <option @if($options['days_repeat'] === null) selected @endif disabled>Выполнять это действие на протяжении</option>
140 <option @if($options['days_repeat'] === 1) selected @endif value="1">1 день</option>
141 <option @if($options['days_repeat'] === 3) selected @endif value="3">3 дня</option>
142 <option @if($options['days_repeat'] === 5) selected @endif value="5">5 дней</option>
143 <option @if($options['days_repeat'] === 7) selected @endif value="7">7 дней</option>
144 <option @if($options['days_repeat'] === 10) selected @endif value="10">10 дней</option>
145 <option @if($options['days_repeat'] === 15) selected @endif value="15">15 дней</option>
146 <option @if($options['days_repeat'] === 30) selected @endif value="30">30 дней</option>
147 </select>
148 </div>
149 </div>
150 </div>
151 </div>
152 <div class="table table_spoiler">
153 <div class="table__scroll">
154 <div class="table__body table__body_min-width">
155 <table>
156 <thead>
157 <tr>
158 <th>Название</th>
159 <th>Обновлять на сайте</th>
160 </tr>
161 </thead>
162 <tbody>
163 <tr name="resume_table_row" data-id="{{ $worker->id }}">
164 <td>Резюме</td>
165 <td >
166 <span class="checkbox-empty">
167 <label class="checkbox">
168 <input
169 type="checkbox"
170 class="checkbox__input"
171 @if($options->autolift_site) checked @endif
172 name="autolift_site"
173 >
174 <span class="checkbox__icon">
175 <svg>
176 <use xlink:href="{{ asset('images/sprite.svg#v') }}"></use>
177 </svg>
178 </span>
179 </label>
180 </span>
181 </td>
182 </tr>
183 </tbody>
184 </table>
185 </div>
186 </div>
187 <div class="mrg-wrapper" style="display: flex; justify-content: center; clear: both;">
188 <ins class="mrg-tag" data-ad-client="ad-595528" data-ad-slot="595528" style="display: flex; align-items: center; justify-content: center; width: 300px; z-index: 1;">
189
190 </ins>
191 </div>
192 </div>
193 <div class="cabinet__inputs">
194 <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth">
195 <button id="submit" type="button" class="button">Сохранить</button>
196 </div>
197 </div>
198 </div>
199 </form>
200 </div>
201 </div>
202 </section>
203 </div>
204 @endsection
205
1 <?php 1 <?php
2 2
3 use App\Http\Controllers\Ad_jobsController; 3 use App\Http\Controllers\Ad_jobsController;
4 use App\Http\Controllers\AdEmployerController; 4 use App\Http\Controllers\AdEmployerController;
5 use App\Http\Controllers\Admin\AdminController; 5 use App\Http\Controllers\Admin\AdminController;
6 use App\Http\Controllers\Admin\CategoryController; 6 use App\Http\Controllers\Admin\CategoryController;
7 use App\Http\Controllers\Admin\CategoryEmpController; 7 use App\Http\Controllers\Admin\CategoryEmpController;
8 use App\Http\Controllers\Admin\EducationController; 8 use App\Http\Controllers\Admin\EducationController;
9 use App\Http\Controllers\EducationController as EducationFrontController; 9 use App\Http\Controllers\EducationController as EducationFrontController;
10 use App\Http\Controllers\Admin\EmployersController; 10 use App\Http\Controllers\Admin\EmployersController;
11 use App\Http\Controllers\EmployerController as FrontEmployersController; 11 use App\Http\Controllers\EmployerController as FrontEmployersController;
12 use App\Http\Controllers\Admin\InfoBloksController; 12 use App\Http\Controllers\Admin\InfoBloksController;
13 use App\Http\Controllers\Admin\JobTitlesController; 13 use App\Http\Controllers\Admin\JobTitlesController;
14 use App\Http\Controllers\Admin\UsersController; 14 use App\Http\Controllers\Admin\UsersController;
15 use App\Http\Controllers\Admin\WorkersController; 15 use App\Http\Controllers\Admin\WorkersController;
16 use App\Http\Controllers\Auth\ForgotPasswordController; 16 use App\Http\Controllers\Auth\ForgotPasswordController;
17 use App\Http\Controllers\Auth\LoginController; 17 use App\Http\Controllers\Auth\LoginController;
18 use App\Http\Controllers\Auth\RegisterController; 18 use App\Http\Controllers\Auth\RegisterController;
19 use App\Http\Controllers\CKEditorController; 19 use App\Http\Controllers\CKEditorController;
20 use App\Http\Controllers\FaqController; 20 use App\Http\Controllers\FaqController;
21 use App\Http\Controllers\MediaController; 21 use App\Http\Controllers\MediaController;
22 use App\Http\Controllers\WorkerController; 22 use App\Http\Controllers\WorkerController;
23 use App\Models\Ad_jobs; 23 use App\Models\Ad_jobs;
24 use App\Models\User; 24 use App\Models\User;
25 use App\Http\Controllers\MainController; 25 use App\Http\Controllers\MainController;
26 use App\Http\Controllers\HomeController; 26 use App\Http\Controllers\HomeController;
27 use Illuminate\Support\Facades\Route; 27 use Illuminate\Support\Facades\Route;
28 use App\Http\Controllers\Admin\CompanyController; 28 use App\Http\Controllers\Admin\CompanyController;
29 use App\Http\Controllers\Admin\Ad_EmployersController; 29 use App\Http\Controllers\Admin\Ad_EmployersController;
30 use App\Http\Controllers\Admin\MsgAnswersController; 30 use App\Http\Controllers\Admin\MsgAnswersController;
31 use App\Http\Controllers\Admin\GroupsController; 31 use App\Http\Controllers\Admin\GroupsController;
32 use App\Http\Controllers\PagesController; 32 use App\Http\Controllers\PagesController;
33 use Illuminate\Support\Facades\Storage; 33 use Illuminate\Support\Facades\Storage;
34 use App\Http\Controllers\EmployerController; 34 use App\Http\Controllers\EmployerController;
35 use App\Http\Controllers\CompanyController as FrontCompanyController; 35 use App\Http\Controllers\CompanyController as FrontCompanyController;
36 36
37 37
38 /* 38 /*
39 |-------------------------------------------------------------------------- 39 |--------------------------------------------------------------------------
40 | Web Routes 40 | Web Routes
41 |-------------------------------------------------------------------------- 41 |--------------------------------------------------------------------------
42 | 42 |
43 | Here is where you can register web routes for your application. These 43 | Here is where you can register web routes for your application. These
44 | routes are loaded by the RouteServiceProvider within a group which 44 | routes are loaded by the RouteServiceProvider within a group which
45 | contains the "web" middleware group. Now create something great! 45 | contains the "web" middleware group. Now create something great!
46 | 46 |
47 */ 47 */
48 /* 48 /*
49 Route::get('/', function () { 49 Route::get('/', function () {
50 return view('welcome'); 50 return view('welcome');
51 })->name('index'); 51 })->name('index');
52 */ 52 */
53 53
54 Route::get('/', [MainController::class, 'index'])->name('index'); 54 Route::get('/', [MainController::class, 'index'])->name('index');
55 55
56 //Роуты авторизации, регистрации, восстановления, аутентификации 56 //Роуты авторизации, регистрации, восстановления, аутентификации
57 Auth::routes(['verify' => true]); 57 Auth::routes(['verify' => true]);
58 58
59 //Личный кабинет пользователя 59 //Личный кабинет пользователя
60 Route::get('/home', [HomeController::class, 'index'])->name('home'); 60 Route::get('/home', [HomeController::class, 'index'])->name('home');
61 61
62 // Авторизация, регистрация в админку 62 // Авторизация, регистрация в админку
63 Route::group([ 63 Route::group([
64 'as' => 'admin.', // имя маршрута, например auth.index 64 'as' => 'admin.', // имя маршрута, например auth.index
65 'prefix' => 'admin', // префикс маршрута, например auth/index 65 'prefix' => 'admin', // префикс маршрута, например auth/index
66 'middleware' => ['guest'], 66 'middleware' => ['guest'],
67 ], function () { 67 ], function () {
68 // Форма регистрации 68 // Форма регистрации
69 Route::get('register', [AdminController::class, 'register'])->name('register'); 69 Route::get('register', [AdminController::class, 'register'])->name('register');
70 // Создание пользователя 70 // Создание пользователя
71 Route::post('register', [AdminController::class, 'create'])->name('create'); 71 Route::post('register', [AdminController::class, 'create'])->name('create');
72 72
73 //Форма входа 73 //Форма входа
74 Route::get('login', [AdminController::class, 'login'])->name('login'); 74 Route::get('login', [AdminController::class, 'login'])->name('login');
75 75
76 // аутентификация 76 // аутентификация
77 Route::post('login', [AdminController::class, 'autenticate'])->name('auth'); 77 Route::post('login', [AdminController::class, 'autenticate'])->name('auth');
78 78
79 }); 79 });
80 80
81 // Личный кабинет админки 81 // Личный кабинет админки
82 Route::group([ 82 Route::group([
83 'as' => 'admin.', // имя маршрута, например auth.index 83 'as' => 'admin.', // имя маршрута, например auth.index
84 'prefix' => 'admin', // префикс маршрута, например auth/index 84 'prefix' => 'admin', // префикс маршрута, например auth/index
85 'middleware' => ['auth', 'admin'], 85 'middleware' => ['auth', 'admin'],
86 ], function() { 86 ], function() {
87 87
88 // выход 88 // выход
89 Route::get('logout', [AdminController::class, 'logout'])->name('logout'); 89 Route::get('logout', [AdminController::class, 'logout'])->name('logout');
90 90
91 // кабинет главная страница 91 // кабинет главная страница
92 Route::get('cabinet', [AdminController::class, 'index'])->name('index'); 92 Route::get('cabinet', [AdminController::class, 'index'])->name('index');
93 Route::get('/', function () { 93 Route::get('/', function () {
94 return redirect()->route('admin.index'); 94 return redirect()->route('admin.index');
95 }); 95 });
96 96
97 // кабинет профиль админа - форма 97 // кабинет профиль админа - форма
98 Route::get('profile', [AdminController::class, 'profile'])->name('profile'); 98 Route::get('profile', [AdminController::class, 'profile'])->name('profile');
99 // кабинет профиль админа - сохранение формы 99 // кабинет профиль админа - сохранение формы
100 Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile'); 100 Route::post('profile', [AdminController::class, 'store_profile'])->name('store_profile');
101 101
102 //кабинет сообщения админа 102 //кабинет сообщения админа
103 //Route::get('messages', [AdminController::class, 'profile'])->name('profile'); 103 //Route::get('messages', [AdminController::class, 'profile'])->name('profile');
104 104
105 105
106 // кабинет профиль - форма пароли 106 // кабинет профиль - форма пароли
107 Route::get('password', [AdminController::class, 'profile_password'])->name('password'); 107 Route::get('password', [AdminController::class, 'profile_password'])->name('password');
108 // кабинет профиль - сохранение формы пароля 108 // кабинет профиль - сохранение формы пароля
109 Route::post('password', [AdminController::class, 'profile_password_new'])->name('password'); 109 Route::post('password', [AdminController::class, 'profile_password_new'])->name('password');
110 110
111 111
112 // кабинет профиль пользователя - форма 112 // кабинет профиль пользователя - форма
113 Route::get('user-profile/{user}', [AdminController::class, 'profile_user'])->name('user-profile'); 113 Route::get('user-profile/{user}', [AdminController::class, 'profile_user'])->name('user-profile');
114 // кабинет профиль пользователя - сохранение формы 114 // кабинет профиль пользователя - сохранение формы
115 Route::post('user-profile/{user}', [AdminController::class, 'store_profile_user'])->name('user-store_profile'); 115 Route::post('user-profile/{user}', [AdminController::class, 'store_profile_user'])->name('user-store_profile');
116 116
117 // кабинет профиль работодатель - форма 117 // кабинет профиль работодатель - форма
118 Route::get('employer-profile/{employer}', [EmployersController::class, 'form_update_employer'])->name('employer-profile'); 118 Route::get('employer-profile/{employer}', [EmployersController::class, 'form_update_employer'])->name('employer-profile');
119 // кабинет профиль работодатель - сохранение формы 119 // кабинет профиль работодатель - сохранение формы
120 Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile'); 120 Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile');
121 // кабинет удаление профиль работодателя и юзера 121 // кабинет удаление профиль работодателя и юзера
122 Route::delete('employers/delete/{employer}/{user}', [EmployersController::class, 'delete_employer'])->name('delete-employer'); 122 Route::delete('employers/delete/{employer}/{user}', [EmployersController::class, 'delete_employer'])->name('delete-employer');
123 123
124 // кабинет профиль работник - форма 124 // кабинет профиль работник - форма
125 Route::get('worker-profile/add/{user}', [WorkersController::class, 'form_add_worker'])->name('worker-profile-add'); 125 Route::get('worker-profile/add/{user}', [WorkersController::class, 'form_add_worker'])->name('worker-profile-add');
126 Route::post('worker-profile/add/{user}', [WorkersController::class, 'form_store_worker'])->name('worker-profile-store'); 126 Route::post('worker-profile/add/{user}', [WorkersController::class, 'form_store_worker'])->name('worker-profile-store');
127 Route::get('worker-profile/{worker}', [WorkersController::class, 'form_edit_worker'])->name('worker-profile-edit'); 127 Route::get('worker-profile/{worker}', [WorkersController::class, 'form_edit_worker'])->name('worker-profile-edit');
128 // кабинет профиль работник - сохранение формы 128 // кабинет профиль работник - сохранение формы
129 Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile-update'); 129 Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile-update');
130 130
131 // Медиа 131 // Медиа
132 Route::get('media', [MediaController::class, 'index'])->name('media'); 132 Route::get('media', [MediaController::class, 'index'])->name('media');
133 Route::delete('media/{media}', [MediaController::class, 'delete'])->name('delete-media'); 133 Route::delete('media/{media}', [MediaController::class, 'delete'])->name('delete-media');
134 134
135 // кабинет настройки сайта - форма 135 // кабинет настройки сайта - форма
136 Route::get('config', [AdminController::class, 'config_form'])->name('config'); 136 Route::get('config', [AdminController::class, 'config_form'])->name('config');
137 // кабинет настройки сайта сохранение формы 137 // кабинет настройки сайта сохранение формы
138 Route::post('config', [AdminController::class, 'store_config'])->name('store_config'); 138 Route::post('config', [AdminController::class, 'store_config'])->name('store_config');
139 139
140 // кабинет - новости 140 // кабинет - новости
141 Route::get('news-list', [AdminController::class, 'news_admin'])->name('news_admin'); 141 Route::get('news-list', [AdminController::class, 'news_admin'])->name('news_admin');
142 Route::get('news/add', [AdminController::class, 'new_admin_add'])->name('new_admin_add'); 142 Route::get('news/add', [AdminController::class, 'new_admin_add'])->name('new_admin_add');
143 Route::post('news/add', [AdminController::class, 'new_admin_add_save'])->name('new_admin_save_add'); 143 Route::post('news/add', [AdminController::class, 'new_admin_add_save'])->name('new_admin_save_add');
144 Route::get('news/edit/{new}', [AdminController::class, 'new_admin_edit'])->name('new_admin_edit'); 144 Route::get('news/edit/{new}', [AdminController::class, 'new_admin_edit'])->name('new_admin_edit');
145 Route::post('news/edit/{new}', [AdminController::class, 'new_admin_update_save'])->name('new_admin_update'); 145 Route::post('news/edit/{new}', [AdminController::class, 'new_admin_update_save'])->name('new_admin_update');
146 Route::get('news/delete/{new}', [AdminController::class, 'new_admin_delete'])->name('new_admin_delete'); 146 Route::get('news/delete/{new}', [AdminController::class, 'new_admin_delete'])->name('new_admin_delete');
147 147
148 // кабинет - пользователи 148 // кабинет - пользователи
149 Route::get('users', [UsersController::class, 'index'])->name('users'); 149 Route::get('users', [UsersController::class, 'index'])->name('users');
150 Route::get('user-delete/{user}', [UsersController::class, 'user_delete'])->name('user_delete'); 150 Route::get('user-delete/{user}', [UsersController::class, 'user_delete'])->name('user_delete');
151 151
152 // кабинет - пользователи 152 // кабинет - пользователи
153 Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users'); 153 Route::get('admin-users', [AdminController::class, 'index_admin'])->name('admin-users');
154 154
155 // кабинет - работодатели 155 // кабинет - работодатели
156 Route::get('employers', [EmployersController::class, 'index'])->name('employers'); 156 Route::get('employers', [EmployersController::class, 'index'])->name('employers');
157 157
158 Route::get('employers/comment/{employer}', [EmployersController::class, 'comment_read'])->name('comment-employer'); 158 Route::get('employers/comment/{employer}', [EmployersController::class, 'comment_read'])->name('comment-employer');
159 159
160 Route::get('flot/add/{employer}', [EmployersController::class, 'add_flot'])->name('flot_add'); 160 Route::get('flot/add/{employer}', [EmployersController::class, 'add_flot'])->name('flot_add');
161 Route::post('flot/add', [EmployersController::class, 'save_add_flot'])->name('flot_add_save'); 161 Route::post('flot/add', [EmployersController::class, 'save_add_flot'])->name('flot_add_save');
162 Route::get('flot/{flot}/{employer}', [EmployersController::class, 'edit_flot'])->name('flot'); 162 Route::get('flot/{flot}/{employer}', [EmployersController::class, 'edit_flot'])->name('flot');
163 Route::put('flot/{flot}', [EmployersController::class, 'edit_save_flot'])->name('flot_edit'); 163 Route::put('flot/{flot}', [EmployersController::class, 'edit_save_flot'])->name('flot_edit');
164 Route::get('flot/{flot}/{employer_id}/delete', [EmployersController::class, 'delete_flot'])->name('flot_delete'); 164 Route::get('flot/{flot}/{employer_id}/delete', [EmployersController::class, 'delete_flot'])->name('flot_delete');
165 165
166 // кабинет - соискатели 166 // кабинет - соискатели
167 Route::get('workers', [WorkersController::class, 'index'])->name('workers'); 167 Route::get('workers', [WorkersController::class, 'index'])->name('workers');
168 168
169 // кабинет - база данных 169 // кабинет - база данных
170 Route::get('basedata', [UsersController::class, 'index_bd'])->name('basedata'); 170 Route::get('basedata', [UsersController::class, 'index_bd'])->name('basedata');
171 Route::get('basedata/add', [UsersController::class, 'add_bd'])->name('add-basedata'); 171 Route::get('basedata/add', [UsersController::class, 'add_bd'])->name('add-basedata');
172 Route::post('basedata/add', [UsersController::class, 'add_store_bd'])->name('add-store-basedata'); 172 Route::post('basedata/add', [UsersController::class, 'add_store_bd'])->name('add-store-basedata');
173 Route::get('basedata/edit/{user}', [UsersController::class, 'edit_bd'])->name('edit-basedata'); 173 Route::get('basedata/edit/{user}', [UsersController::class, 'edit_bd'])->name('edit-basedata');
174 Route::put('basedata/edit/{user}', [UsersController::class, 'update_bd'])->name('update-basedata'); 174 Route::put('basedata/edit/{user}', [UsersController::class, 'update_bd'])->name('update-basedata');
175 Route::delete('basedata/delete/{user}', [UsersController::class, 'destroy_bd'])->name('delete-basedata'); 175 Route::delete('basedata/delete/{user}', [UsersController::class, 'destroy_bd'])->name('delete-basedata');
176 Route::get('basedata/doc/{user}', [UsersController::class, 'doc_bd'])->name('doc-basedata'); 176 Route::get('basedata/doc/{user}', [UsersController::class, 'doc_bd'])->name('doc-basedata');
177 177
178 // кабинет - вакансии 178 // кабинет - вакансии
179 Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers'); 179 Route::get('ad-employers', [Ad_EmployersController::class, 'index'])->name('ad-employers');
180 Route::get('ad-employers/add', [Ad_EmployersController::class, 'create'])->name('add-ad-employers'); 180 Route::get('ad-employers/add', [Ad_EmployersController::class, 'create'])->name('add-ad-employers');
181 Route::post('ad-employers/add', [Ad_EmployersController::class, 'store'])->name('store-ad-employers'); 181 Route::post('ad-employers/add', [Ad_EmployersController::class, 'store'])->name('store-ad-employers');
182 Route::get('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'edit'])->name('edit-ad-employers'); 182 Route::get('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'edit'])->name('edit-ad-employers');
183 Route::post('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'update'])->name('update-ad-employers'); 183 Route::post('ad-employers/edit/{ad_employer}', [Ad_EmployersController::class, 'update'])->name('update-ad-employers');
184 Route::delete('ad-employers/delete/{ad_employer}', [Ad_EmployersController::class, 'destroy'])->name('delete-ad-employer'); 184 Route::delete('ad-employers/delete/{ad_employer}', [Ad_EmployersController::class, 'destroy'])->name('delete-ad-employer');
185 185
186 // Редактирование должности в вакансии 186 // Редактирование должности в вакансии
187 Route::put('update-jobs/{ad_jobs}', [Ad_EmployersController::class, 'update_ad_jobs'])->name('update_jobs'); 187 Route::put('update-jobs/{ad_jobs}', [Ad_EmployersController::class, 'update_ad_jobs'])->name('update_jobs');
188 Route::get('edit-jobs/{ad_jobs}', [Ad_EmployersController::class, 'edit_jobs'])->name('edit_jobs'); 188 Route::get('edit-jobs/{ad_jobs}', [Ad_EmployersController::class, 'edit_jobs'])->name('edit_jobs');
189 189
190 190
191 // кабинет - категории 191 // кабинет - категории
192 //Route::get('categories', [AdminController::class, 'index'])->name('categories'); 192 //Route::get('categories', [AdminController::class, 'index'])->name('categories');
193 193
194 // СRUD-операции над Справочником Категории 194 // СRUD-операции над Справочником Категории
195 195
196 Route::resource('categories', CategoryController::class, ['except' => ['show']]); 196 Route::resource('categories', CategoryController::class, ['except' => ['show']]);
197 197
198 // CRUD-операции над справочником Категории для работодателей 198 // CRUD-операции над справочником Категории для работодателей
199 Route::resource('category-emp', CategoryEmpController::class, ['except' => ['show']]); 199 Route::resource('category-emp', CategoryEmpController::class, ['except' => ['show']]);
200 200
201 // CRUD-операции над справочником Образование 201 // CRUD-операции над справочником Образование
202 Route::resource('education', EducationController::class, ['except' => ['show']]); 202 Route::resource('education', EducationController::class, ['except' => ['show']]);
203 203
204 Route::get('rename-program-education', [EducationController::class, 'rename_program'])->name('rename-program-education'); 204 Route::get('rename-program-education', [EducationController::class, 'rename_program'])->name('rename-program-education');
205 Route::get('program-education', [EducationController::class, 'add_program'])->name('add-program-education'); 205 Route::get('program-education', [EducationController::class, 'add_program'])->name('add-program-education');
206 Route::post('program-education', [EducationController::class, 'store_program'])->name('store-program-education'); 206 Route::post('program-education', [EducationController::class, 'store_program'])->name('store-program-education');
207 207
208 Route::get('program-education/edit/{program}/{education}', [EducationController::class, 'edit_program'])->name('edit-program-education'); 208 Route::get('program-education/edit/{program}/{education}', [EducationController::class, 'edit_program'])->name('edit-program-education');
209 Route::post('program-education/edit/{program}/{education}', [EducationController::class, 'update_program'])->name('update-program-education'); 209 Route::post('program-education/edit/{program}/{education}', [EducationController::class, 'update_program'])->name('update-program-education');
210 210
211 Route::get('program-education/delete/{program}/{education}', [EducationController::class, 'delete_program'])->name('delete-program-education'); 211 Route::get('program-education/delete/{program}/{education}', [EducationController::class, 'delete_program'])->name('delete-program-education');
212 212
213 /* 213 /*
214 * кабинет - CRUD-операции по справочнику должности 214 * кабинет - CRUD-операции по справочнику должности
215 * 215 *
216 */ 216 */
217 Route::resource('job-titles', JobTitlesController::class, ['except' => ['show']]); 217 Route::resource('job-titles', JobTitlesController::class, ['except' => ['show']]);
218 218
219 // кабинет - сообщения (чтение чужих) 219 // кабинет - сообщения (чтение чужих)
220 Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages'); 220 Route::get('messages', [MsgAnswersController::class, 'messages'])->name('messages');
221 // кабинет - просмотр сообщения чужого (чтение) 221 // кабинет - просмотр сообщения чужого (чтение)
222 Route::get('messages/{message}', [MsgAnswersController::class, 'read_message'])->name('read-message'); 222 Route::get('messages/{message}', [MsgAnswersController::class, 'read_message'])->name('read-message');
223 223
224 // кабинет - сообщения (админские) 224 // кабинет - сообщения (админские)
225 Route::get('admin-messages', [MsgAnswersController::class, 'admin_messages'])->name('admin-messages'); 225 Route::get('admin-messages', [MsgAnswersController::class, 'admin_messages'])->name('admin-messages');
226 // кабинет - сообщения (админские) 226 // кабинет - сообщения (админские)
227 Route::post('admin-messages', [MsgAnswersController::class, 'admin_messages_post'])->name('admin-messages-post'); 227 Route::post('admin-messages', [MsgAnswersController::class, 'admin_messages_post'])->name('admin-messages-post');
228 // кабинет - sql - конструкция запросов 228 // кабинет - sql - конструкция запросов
229 Route::get('messages-sql', [MsgAnswersController::class, 'messages_sql'])->name('messages-sql'); 229 Route::get('messages-sql', [MsgAnswersController::class, 'messages_sql'])->name('messages-sql');
230 230
231 Route::post('admin-reject-message', [MsgAnswersController::class, 'reject_message'])->name('reject_message'); 231 Route::post('admin-reject-message', [MsgAnswersController::class, 'reject_message'])->name('reject_message');
232 Route::post('admin-send-message', [MsgAnswersController::class, 'send_message'])->name('send_message'); 232 Route::post('admin-send-message', [MsgAnswersController::class, 'send_message'])->name('send_message');
233 233
234 /* 234 /*
235 * Расписанный подход в описании каждой директорий групп пользователей. 235 * Расписанный подход в описании каждой директорий групп пользователей.
236 */ 236 */
237 // кабинет - группы пользователей 237 // кабинет - группы пользователей
238 Route::get('groups', [GroupsController::class, 'index'])->name('groups'); 238 Route::get('groups', [GroupsController::class, 'index'])->name('groups');
239 // кабинет - добавление форма группы пользователей 239 // кабинет - добавление форма группы пользователей
240 Route::get('groups/add', [GroupsController::class, 'add'])->name('add-group'); 240 Route::get('groups/add', [GroupsController::class, 'add'])->name('add-group');
241 // кабинет - сохранение формы группы пользователей 241 // кабинет - сохранение формы группы пользователей
242 Route::post('groups/add', [GroupsController::class, 'store'])->name('add-group-store'); 242 Route::post('groups/add', [GroupsController::class, 'store'])->name('add-group-store');
243 // кабинет - редактирование форма группы пользователей 243 // кабинет - редактирование форма группы пользователей
244 Route::get('groups/edit/{group}', [GroupsController::class, 'edit'])->name('edit-group'); 244 Route::get('groups/edit/{group}', [GroupsController::class, 'edit'])->name('edit-group');
245 // кабинет - сохранение редактированной формы группы пользователей 245 // кабинет - сохранение редактированной формы группы пользователей
246 Route::post('groups/edit/{group}', [GroupsController::class, 'update'])->name('update-group'); 246 Route::post('groups/edit/{group}', [GroupsController::class, 'update'])->name('update-group');
247 // кабинет - удаление группы пользователей 247 // кабинет - удаление группы пользователей
248 Route::delete('groups/delete/{group}', [GroupsController::class, 'destroy'])->name('delete-group'); 248 Route::delete('groups/delete/{group}', [GroupsController::class, 'destroy'])->name('delete-group');
249 249
250 250
251 // кабинет - список админов 251 // кабинет - список админов
252 Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin'); 252 Route::get('group-admin', [AdminController::class, 'index'])->name('group-admin');
253 253
254 // справочник Позиции 254 // справочник Позиции
255 Route::get('positions', [AdminController::class, 'position'])->name('position'); 255 Route::get('positions', [AdminController::class, 'position'])->name('position');
256 Route::get('positions/add', [AdminController::class, 'position_add'])->name('add-position'); 256 Route::get('positions/add', [AdminController::class, 'position_add'])->name('add-position');
257 Route::post('positions/add', [AdminController::class, 'position_add_save'])->name('add-save-position'); 257 Route::post('positions/add', [AdminController::class, 'position_add_save'])->name('add-save-position');
258 Route::get('positions/edit/{position}', [AdminController::class, 'position_edit'])->name('edit-position'); 258 Route::get('positions/edit/{position}', [AdminController::class, 'position_edit'])->name('edit-position');
259 Route::post('position/edit/{position}', [AdminController::class, 'position_update'])->name('update-position'); 259 Route::post('position/edit/{position}', [AdminController::class, 'position_update'])->name('update-position');
260 Route::get('position/delete/{position}', [AdminController::class, 'position_delete'])->name('delete-position'); 260 Route::get('position/delete/{position}', [AdminController::class, 'position_delete'])->name('delete-position');
261 261
262 /////редактор////// кабинет - редактор сайта//////////////////////// 262 /////редактор////// кабинет - редактор сайта////////////////////////
263 Route::get('editor-site', function() { 263 Route::get('editor-site', function() {
264 return view('admin.editor.index'); 264 return view('admin.editor.index');
265 })->name('editor-site'); 265 })->name('editor-site');
266 266
267 267
268 // кабинет - редактор шапки-футера сайта 268 // кабинет - редактор шапки-футера сайта
269 Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks'); 269 Route::get('edit-blocks', [CompanyController::class, 'editblocks'])->name('edit-blocks');
270 Route::get('edit-bloks/add', [CompanyController::class, 'editblock_add'])->name('add-block'); 270 Route::get('edit-bloks/add', [CompanyController::class, 'editblock_add'])->name('add-block');
271 Route::post('edit-bloks/add', [CompanyController::class, 'editblock_store'])->name('add-block-store'); 271 Route::post('edit-bloks/add', [CompanyController::class, 'editblock_store'])->name('add-block-store');
272 Route::get('edit-bloks/ajax', [CompanyController::class, 'editblock_ajax'])->name('ajax.block'); 272 Route::get('edit-bloks/ajax', [CompanyController::class, 'editblock_ajax'])->name('ajax.block');
273 Route::get('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_edit'])->name('edit-block'); 273 Route::get('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_edit'])->name('edit-block');
274 Route::put('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_update'])->name('update-block'); 274 Route::put('edit-bloks/edit/{block}', [CompanyController::class, 'editblock_update'])->name('update-block');
275 Route::delete('edit-bloks/delete/{block}', [CompanyController::class, 'editblock_destroy'])->name('delete-block'); 275 Route::delete('edit-bloks/delete/{block}', [CompanyController::class, 'editblock_destroy'])->name('delete-block');
276 276
277 277
278 // кабинет - редактор должности на главной 278 // кабинет - редактор должности на главной
279 Route::get('job-titles-main', [CompanyController::class, 'job_titles_main'])->name('job-titles-main'); 279 Route::get('job-titles-main', [CompanyController::class, 'job_titles_main'])->name('job-titles-main');
280 280
281 // кабинет - счетчики на главной 281 // кабинет - счетчики на главной
282 Route::get('counters-main', [CompanyController::class, 'counters_main'])->name('counters-main'); 282 Route::get('counters-main', [CompanyController::class, 'counters_main'])->name('counters-main');
283 Route::post('counters-main/edit/{name}', [CompanyController::class, 'counters_main_update'])->name('counters-main-update'); 283 Route::post('counters-main/edit/{name}', [CompanyController::class, 'counters_main_update'])->name('counters-main-update');
284 284
285 // кабинет - редактор работодатели на главной 285 // кабинет - редактор работодатели на главной
286 Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main'); 286 Route::get('employers-main', [CompanyController::class, 'employers_main'])->name('employers-main');
287 Route::post('employers-main-add', [CompanyController::class, 'employers_main_add'])->name('employers-main-add'); 287 Route::post('employers-main-add', [CompanyController::class, 'employers_main_add'])->name('employers-main-add');
288 Route::post('employers-main-remove', [CompanyController::class, 'employers_main_remove'])->name('employers-main-remove'); 288 Route::post('employers-main-remove', [CompanyController::class, 'employers_main_remove'])->name('employers-main-remove');
289 289
290 290
291 // кабинет - редактор seo-сайта 291 // кабинет - редактор seo-сайта
292 Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo'); 292 Route::get('editor-seo', [CompanyController::class, 'editor_seo'])->name('editor-seo');
293 Route::get('editor-seo/add', [CompanyController::class, 'editor_seo_add'])->name('add-seo'); 293 Route::get('editor-seo/add', [CompanyController::class, 'editor_seo_add'])->name('add-seo');
294 Route::post('editor-seo/add', [CompanyController::class, 'editor_seo_store'])->name('add-seo-store'); 294 Route::post('editor-seo/add', [CompanyController::class, 'editor_seo_store'])->name('add-seo-store');
295 Route::get('editor-seo/ajax', [CompanyController::class, 'editor_seo_ajax'])->name('ajax.seo'); 295 Route::get('editor-seo/ajax', [CompanyController::class, 'editor_seo_ajax'])->name('ajax.seo');
296 Route::get('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_edit'])->name('edit-seo'); 296 Route::get('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_edit'])->name('edit-seo');
297 Route::put('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_update'])->name('update-seo'); 297 Route::put('editor-seo/edit/{page}', [CompanyController::class, 'editor_seo_update'])->name('update-seo');
298 Route::delete('editor-seo/delete/{page}', [CompanyController::class, 'editor_seo_destroy'])->name('delete-seo'); 298 Route::delete('editor-seo/delete/{page}', [CompanyController::class, 'editor_seo_destroy'])->name('delete-seo');
299 299
300 300
301 // кабинет - редактор страниц 301 // кабинет - редактор страниц
302 Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages'); 302 Route::get('editor-pages', [CompanyController::class, 'editor_pages'])->name('editor-pages');
303 // кабинет - добавление страницы 303 // кабинет - добавление страницы
304 Route::get('editor-pages/add', [CompanyController::class, 'editor_pages_add'])->name('add-page'); 304 Route::get('editor-pages/add', [CompanyController::class, 'editor_pages_add'])->name('add-page');
305 // кабинет - сохранение формы страницы 305 // кабинет - сохранение формы страницы
306 Route::post('editor-page/add', [CompanyController::class, 'editor_pages_store'])->name('add-page-store'); 306 Route::post('editor-page/add', [CompanyController::class, 'editor_pages_store'])->name('add-page-store');
307 // кабинет - редактирование форма страницы 307 // кабинет - редактирование форма страницы
308 Route::get('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_edit'])->name('edit-page'); 308 Route::get('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_edit'])->name('edit-page');
309 // кабинет - сохранение редактированной формы страницы 309 // кабинет - сохранение редактированной формы страницы
310 Route::put('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_update'])->name('update-page'); 310 Route::put('editor-pages/edit/{page}', [CompanyController::class, 'editor_pages_update'])->name('update-page');
311 // кабинет - удаление страницы 311 // кабинет - удаление страницы
312 Route::delete('editor-pages/delete/{page}', [CompanyController::class, 'editor_pages_destroy'])->name('delete-page'); 312 Route::delete('editor-pages/delete/{page}', [CompanyController::class, 'editor_pages_destroy'])->name('delete-page');
313 313
314 314
315 // кабинет - реклама сайта 315 // кабинет - реклама сайта
316 Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames'); 316 Route::get('reclames', [CompanyController::class, 'reclames'])->name('reclames');
317 Route::get('reclames/add', [CompanyController::class, 'reclames_add'])->name('add-reclames'); 317 Route::get('reclames/add', [CompanyController::class, 'reclames_add'])->name('add-reclames');
318 Route::post('reclames/add', [CompanyController::class, 'reclames_store'])->name('add-reclames-store'); 318 Route::post('reclames/add', [CompanyController::class, 'reclames_store'])->name('add-reclames-store');
319 Route::get('reclames/edit/{reclame}', [CompanyController::class, 'reclames_edit'])->name('edit-reclames'); 319 Route::get('reclames/edit/{reclame}', [CompanyController::class, 'reclames_edit'])->name('edit-reclames');
320 Route::put('reclames/edit/{reclame}', [CompanyController::class, 'reclames_update'])->name('update-reclames'); 320 Route::put('reclames/edit/{reclame}', [CompanyController::class, 'reclames_update'])->name('update-reclames');
321 Route::delete('reclames/delete/{reclame}', [CompanyController::class, 'reclames_destroy'])->name('delete-reclames'); 321 Route::delete('reclames/delete/{reclame}', [CompanyController::class, 'reclames_destroy'])->name('delete-reclames');
322 //////////////////////////////////////////////////////////////////////// 322 ////////////////////////////////////////////////////////////////////////
323 323
324 324
325 // кабинет - отзывы о работодателе для модерации 325 // кабинет - отзывы о работодателе для модерации
326 Route::get('answers', [EmployersController::class, 'answers'])->name('answers'); 326 Route::get('answers', [EmployersController::class, 'answers'])->name('answers');
327 327
328 // Общая страница статистики 328 // Общая страница статистики
329 Route::get('statics', function () { 329 Route::get('statics', function () {
330 return view('admin.static.index'); 330 return view('admin.static.index');
331 })->name('statics'); 331 })->name('statics');
332 332
333 // кабинет - статистика работников 333 // кабинет - статистика работников
334 Route::get('static-workers', [WorkersController::class, 'static_workers'])->name('static-workers'); 334 Route::get('static-workers', [WorkersController::class, 'static_workers'])->name('static-workers');
335 335
336 // кабинет - статистика вакансий работодателя 336 // кабинет - статистика вакансий работодателя
337 Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads'); 337 Route::get('static-ads', [EmployersController::class, 'static_ads'])->name('static-ads');
338 338
339 // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника 339 // кабинет - справочник - блоки информации (дипломы и документы) для резюме работника
340 /* 340 /*
341 * CRUD-операции над справочником дипломы и документы 341 * CRUD-операции над справочником дипломы и документы
342 */ 342 */
343 //Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks'); 343 //Route::get('infobloks', [WorkersController::class, 'infobloks'])->name('infobloks');
344 Route::resource('infobloks', InfoBloksController::class, ['except' => ['show']]); 344 Route::resource('infobloks', InfoBloksController::class, ['except' => ['show']]);
345 345
346 // кабинет - роли пользователя 346 // кабинет - роли пользователя
347 Route::get('roles', [UsersController::class, 'roles'])->name('roles'); 347 Route::get('roles', [UsersController::class, 'roles'])->name('roles');
348 348
349 Route::get('admin_roles', [UsersController::class, 'admin_roles'])->name('admin_roles'); 349 Route::get('admin_roles', [UsersController::class, 'admin_roles'])->name('admin_roles');
350 350
351 Route::get('logs', function() { 351 Route::get('logs', function() {
352 $files = Storage::files('logs/laravel.log'); 352 $files = Storage::files('logs/laravel.log');
353 })->name('logs'); 353 })->name('logs');
354 354
355 Route::prefix('faq')->as('faq.')->group(function () { 355 Route::prefix('faq')->as('faq.')->group(function () {
356 Route::middleware('admin')->group(function () { 356 Route::middleware('admin')->group(function () {
357 Route::get('/', [FaqController::class, 'showListForAdmin'])->name('list'); 357 Route::get('/', [FaqController::class, 'showListForAdmin'])->name('list');
358 Route::get('/create', [FaqController::class, 'create'])->name('create'); 358 Route::get('/create', [FaqController::class, 'create'])->name('create');
359 Route::post('/create', [FaqController::class, 'store'])->name('store'); 359 Route::post('/create', [FaqController::class, 'store'])->name('store');
360 Route::get('/edit/{id}', [FaqController::class, 'edit'])->name('edit'); 360 Route::get('/edit/{id}', [FaqController::class, 'edit'])->name('edit');
361 Route::put('/edit/{id}', [FaqController::class, 'update'])->name('update'); 361 Route::put('/edit/{id}', [FaqController::class, 'update'])->name('update');
362 Route::get('/destroy/{id}', [FaqController::class, 'destroy'])->name('destroy'); 362 Route::get('/destroy/{id}', [FaqController::class, 'destroy'])->name('destroy');
363 }); 363 });
364 }); 364 });
365 }); 365 });
366 366
367 // Инструментальные страницы 367 // Инструментальные страницы
368 Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload'); 368 Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload');
369 369
370 Route::get('redis/', [PagesController::class, 'redis'])->name('redis'); 370 Route::get('redis/', [PagesController::class, 'redis'])->name('redis');
371 371
372 Route::get('excel/', [PagesController::class, 'excel'])->name('excel'); 372 Route::get('excel/', [PagesController::class, 'excel'])->name('excel');
373 373
374 // Страницы с произвольным контентом 374 // Страницы с произвольным контентом
375 Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page'); 375 Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page');
376 376
377 // Форма обратной связи 377 // Форма обратной связи
378 Route::post('form_feedback', [PagesController::class, 'form_feedback'])->name('form_feedback'); 378 Route::post('form_feedback', [PagesController::class, 'form_feedback'])->name('form_feedback');
379 379
380 // Публичные страницы соискателя 380 // Публичные страницы соискателя
381 Route::get('workers/profile/{worker}', [WorkerController::class, 'profile'])->name('worker_page'); 381 Route::get('workers/profile/{worker}', [WorkerController::class, 'profile'])->name('worker_page');
382 382
383 //Страница вакансии 383 //Страница вакансии
384 Route::get('employer/ad/{ad_employer}', [AdEmployerController::class, 'ad_employer'])->name('ad-employer'); 384 Route::get('employer/ad/{ad_employer}', [AdEmployerController::class, 'ad_employer'])->name('ad-employer');
385 385
386 //Вакансии 386 //Вакансии
387 Route::get('vacancies', [MainController::class, 'vacancies'])->name('vacancies'); 387 Route::get('vacancies', [MainController::class, 'vacancies'])->name('vacancies');
388 388
389 //Вакансии поиск на главной 389 //Вакансии поиск на главной
390 Route::get('search-vacancies', [MainController::class, 'search_vacancies'])->name('search_vacancies'); 390 Route::get('search-vacancies', [MainController::class, 'search_vacancies'])->name('search_vacancies');
391 391
392 //Вакансии категория детальная 392 //Вакансии категория детальная
393 Route::get('list-vacancies/{categories?}', [MainController::class, 'list_vacancies'])->name('list-vacancies'); 393 Route::get('list-vacancies/{categories?}', [MainController::class, 'list_vacancies'])->name('list-vacancies');
394 394
395 // Лайк вакансии 395 // Лайк вакансии
396 Route::get('like-vacancy', [MainController::class, 'like_vacancy'])->name('like-vacancy'); 396 Route::get('like-vacancy', [MainController::class, 'like_vacancy'])->name('like-vacancy');
397 397
398 //Детальная страница вакансии - работодателя 398 //Детальная страница вакансии - работодателя
399 Route::get('vacancie/{vacancy}', [FrontEmployersController::class, 'vacancie'])->name('vacancie'); 399 Route::get('vacancie/{vacancy}', [FrontEmployersController::class, 'vacancie'])->name('vacancie');
400 400
401 Route::get('vacancy/{vacancy}', [AdEmployerController::class, 'getById'])->name('get-vacancy-by-id'); 401 Route::get('vacancy/{vacancy}', [AdEmployerController::class, 'getById'])->name('get-vacancy-by-id');
402 402
403 //Судоходные компании 403 //Судоходные компании
404 Route::get('shipping-companies', [FrontCompanyController::class, 'shipping_companies'])->name('shipping_companies'); 404 Route::get('shipping-companies', [FrontCompanyController::class, 'shipping_companies'])->name('shipping_companies');
405 405
406 //Детальная инфа о компании 406 //Детальная инфа о компании
407 Route::get('info-company/{company}', [FrontCompanyController::class, 'info_company'])->name('info_company'); 407 Route::get('info-company/{company}', [FrontCompanyController::class, 'info_company'])->name('info_company');
408 408
409 //Образование 409 //Образование
410 Route::get('education', [EducationFrontController::class, 'index'])->name('education'); 410 Route::get('education', [EducationFrontController::class, 'index'])->name('education');
411 Route::get('education/{education}', [EducationFrontController::class, 'show'])->name('show_education')->where('education', '[0-9]+');; 411 Route::get('education/{education}', [EducationFrontController::class, 'show'])->name('show_education')->where('education', '[0-9]+');;
412 412
413 //Новости 413 //Новости
414 Route::get('news', [MainController::class, 'news'])->name('news'); 414 Route::get('news', [MainController::class, 'news'])->name('news');
415 Route::get('detail-new/{new}', [MainController::class, 'detail_new'])->name('detail_new'); 415 Route::get('detail-new/{new}', [MainController::class, 'detail_new'])->name('detail_new');
416 416
417 //Контакты 417 //Контакты
418 Route::get('contacts', [MainController::class, 'contacts'])->name('contacts'); 418 Route::get('contacts', [MainController::class, 'contacts'])->name('contacts');
419 419
420 //База резюме 420 //База резюме
421 Route::get('bd-resume', [WorkerController::class, 'bd_resume'])->name('bd_resume'); 421 Route::get('bd-resume', [WorkerController::class, 'bd_resume'])->name('bd_resume');
422 Route::get('bd_resume_danger', function(){ 422 Route::get('bd_resume_danger', function(){
423 return view('employers.bd_resume_danger'); 423 return view('employers.bd_resume_danger');
424 })->name('bd_resume_danger'); 424 })->name('bd_resume_danger');
425 425
426 Route::get('like-resume', [MainController::class, 'like_worker'])->name('like_resume'); 426 Route::get('like-resume', [MainController::class, 'like_worker'])->name('like_resume');
427 427
428 //Анкета соискателя 428 //Анкета соискателя
429 Route::get('resume-profile/{worker}', [WorkerController::class, 'resume_profile'])->name('resume_profile'); 429 Route::get('resume-profile/{worker}', [WorkerController::class, 'resume_profile'])->name('resume_profile');
430 430
431 //Скачать резюме 431 //Скачать резюме
432 Route::get('resume-download/{worker}', [WorkerController::class, 'resume_download'])->name('resume_download'); 432 Route::get('resume-download/{worker}', [WorkerController::class, 'resume_download'])->name('resume_download');
433 Route::get('resume-download/all', [WorkerController::class, 'resume_download_all'])->name('resume_download_all2'); 433 Route::get('resume-download/all', [WorkerController::class, 'resume_download_all'])->name('resume_download_all2');
434 Route::get('resume-download', [WorkerController::class, 'resume_download_all'])->name('resume_download_all'); 434 Route::get('resume-download', [WorkerController::class, 'resume_download_all'])->name('resume_download_all');
435 435
436 436
437 //Вход в кабинет 437 //Вход в кабинет
438 Route::get('login', [MainController::class, 'input_login'])->name('login'); 438 Route::get('login', [MainController::class, 'input_login'])->name('login');
439 439
440 // Выход из кабинета 440 // Выход из кабинета
441 Route::get('logout', [EmployerController::class, 'logout'])->name('logout'); 441 Route::get('logout', [EmployerController::class, 'logout'])->name('logout');
442 442
443 Route::get( 'register_worker', [WorkerController::class, 'register_worker'])->name('register_worker'); 443 Route::get( 'register_worker', [WorkerController::class, 'register_worker'])->name('register_worker');
444 Route::get('register_employer', [EmployerController::class, 'register_employer'])->name('register_employer'); 444 Route::get('register_employer', [EmployerController::class, 'register_employer'])->name('register_employer');
445 445
446 //восстановление пароля 446 //восстановление пароля
447 Route::get('repair-password', [MainController::class, 'repair_password'])->name('repair_password'); 447 Route::get('repair-password', [MainController::class, 'repair_password'])->name('repair_password');
448 // Звезда сообщения 448 // Звезда сообщения
449 Route::post('stars-answer', [WorkerController::class, 'stars_answer'])->name('stars_answer'); 449 Route::post('stars-answer', [WorkerController::class, 'stars_answer'])->name('stars_answer');
450 450
451 // Борьба 451 // Борьба
452 Route::get('clear_cookie', function() { 452 Route::get('clear_cookie', function() {
453 \App\Classes\Cookies_vacancy::clear_vacancy(); 453 \App\Classes\Cookies_vacancy::clear_vacancy();
454 return redirect()->route('index'); 454 return redirect()->route('index');
455 })->name('clear_cookie'); 455 })->name('clear_cookie');
456 456
457 Route::get('cookies', function() { 457 Route::get('cookies', function() {
458 return view('cookies'); 458 return view('cookies');
459 })->name('cookies'); 459 })->name('cookies');
460 460
461 // Личный кабинет работник 461 // Личный кабинет работник
462 Route::group([ 462 Route::group([
463 'as' => 'worker.', // имя маршрута, например auth.index 463 'as' => 'worker.', // имя маршрута, например auth.index
464 'prefix' => 'worker', // префикс маршрута, например auth/index 464 'prefix' => 'worker', // префикс маршрута, например auth/index
465 'middleware' => ['auth', 'is_worker'], 465 'middleware' => ['auth', 'is_worker'],
466 ], function() { 466 ], function() {
467 // Формы редактирования 467 // Формы редактирования
468 Route::get('cabinet/basic_information', [WorkerController::class, 'basic_information'])->name('basic_information'); 468 Route::get('cabinet/basic_information', [WorkerController::class, 'basic_information'])->name('basic_information');
469 Route::get('cabinet/additional_documents', [WorkerController::class, 'additional_documents'])->name('additional_documents'); 469 Route::get('cabinet/additional_documents', [WorkerController::class, 'additional_documents'])->name('additional_documents');
470 470
471 // 1 страница - Моя анкета 471 // 1 страница - Моя анкета
472 Route::get('cabinet', [WorkerController::class, 'cabinet'])->name('cabinet'); 472 Route::get('cabinet', [WorkerController::class, 'cabinet'])->name('cabinet');
473 Route::post('cabinet/{worker}', [WorkerController::class, 'cabinet_save'])->name('cabinet_save'); 473 Route::post('cabinet/{worker}', [WorkerController::class, 'cabinet_save'])->name('cabinet_save');
474 Route::post('cabinet/cabinet_save_foto/{worker}', [WorkerController::class, 'cabinet_save_foto'])->name('cabinet_save_foto'); 474 Route::post('cabinet/cabinet_save_foto/{worker}', [WorkerController::class, 'cabinet_save_foto'])->name('cabinet_save_foto');
475 475
476 476
477 // 2 страница - Сообщения 477 // 2 страница - Сообщения
478 Route::get('cabinet/messages/{type_message}', [WorkerController::class, 'messages'])->name('messages'); 478 Route::get('cabinet/messages/{type_message}', [WorkerController::class, 'messages'])->name('messages');
479 Route::get('cabinet/dialog/{chat}', [WorkerController::class, 'dialog'])->name('dialog'); 479 Route::get('cabinet/dialog/{chat}', [WorkerController::class, 'dialog'])->name('dialog');
480 // 3 страница - Избранные вакансии 480 // 3 страница - Избранные вакансии
481 Route::get('cabinet/favorite', [WorkerController::class, 'favorite'])->name('favorite'); 481 Route::get('cabinet/favorite', [WorkerController::class, 'favorite'])->name('favorite');
482 // Продолжение борьбы против колорадов - избранные вакансии 482 // Продолжение борьбы против колорадов - избранные вакансии
483 Route::get('кабинет/favorite', [WorkerController::class, 'colorado'])->name('colorado'); 483 Route::get('кабинет/favorite', [WorkerController::class, 'colorado'])->name('colorado');
484 484
485 // 4 страница - Сменить пароль 485 // 4 страница - Сменить пароль
486 Route::get('кабинет/new_password', [WorkerController::class, 'new_password'])->name('new_password'); 486 Route::get('кабинет/new_password', [WorkerController::class, 'new_password'])->name('new_password');
487 Route::post('кабинет/new_password/save', [WorkerController::class, 'save_new_password'])->name('save_new_password'); 487 Route::post('кабинет/new_password/save', [WorkerController::class, 'save_new_password'])->name('save_new_password');
488 488
489 // 5 страница - Удалить профиль 489 // 5 страница - Удалить профиль
490 Route::get('кабинет/delete_profile', [WorkerController::class, 'delete_profile'])->name('delete_profile'); 490 Route::get('кабинет/delete_profile', [WorkerController::class, 'delete_profile'])->name('delete_profile');
491 Route::post('кабинет/delete_profile/delete', [WorkerController::class, 'delete_profile_result'])->name('deleteprofile_result'); 491 Route::post('кабинет/delete_profile/delete', [WorkerController::class, 'delete_profile_result'])->name('deleteprofile_result');
492 492
493 // Резюме -pdf 493 // Резюме -pdf
494 Route::get('кабинет/download/{worker}', [WorkerController::class, 'download'])->name('download'); 494 Route::get('кабинет/download/{worker}', [WorkerController::class, 'download'])->name('download');
495 495
496 // Поднятие анкеты 496 // Поднятие анкеты
497 Route::get('кабинет/up/{worker}', [WorkerController::class, 'up'])->name('up'); 497 Route::get('кабинет/up/{worker}', [WorkerController::class, 'up'])->name('up');
498 498
499 Route::post('test123', [WorkerController::class, 'test123'])->name('test123'); 499 Route::post('test123', [WorkerController::class, 'test123'])->name('test123');
500 500
501 // Добавление сертификата 501 // Добавление сертификата
502 Route::get('кабинет/new_sertificate/{worker}', [WorkerController::class, 'new_sertificate'])->name('new_sertificate'); 502 Route::get('кабинет/new_sertificate/{worker}', [WorkerController::class, 'new_sertificate'])->name('new_sertificate');
503 Route::post('кабинет/add_sertificate', [WorkerController::class, 'add_serificate'])->name('add_serificate'); 503 Route::post('кабинет/add_sertificate', [WorkerController::class, 'add_serificate'])->name('add_serificate');
504 Route::get('кабинет/edit_sertificate/{worker}/{doc}', [WorkerController::class, 'edit_sertificate'])->name('edit_sertificate'); 504 Route::get('кабинет/edit_sertificate/{worker}/{doc}', [WorkerController::class, 'edit_sertificate'])->name('edit_sertificate');
505 Route::get('кабинет/edit_sertificate/{doc}', [WorkerController::class, 'update_serificate'])->name('update_serificate'); 505 Route::get('кабинет/edit_sertificate/{doc}', [WorkerController::class, 'update_serificate'])->name('update_serificate');
506 Route::get('кабинет/delete_sertificate/{doc}', [WorkerController::class, 'delete_sertificate'])->name('delete_sertificate'); 506 Route::get('кабинет/delete_sertificate/{doc}', [WorkerController::class, 'delete_sertificate'])->name('delete_sertificate');
507 507
508 // Добавление предыдущих контактов компании 508 // Добавление предыдущих контактов компании
509 Route::get('кабинет/prev_company/{worker}', [WorkerController::class, 'new_prev_company'])->name('new_prev_company'); 509 Route::get('кабинет/prev_company/{worker}', [WorkerController::class, 'new_prev_company'])->name('new_prev_company');
510 Route::post('кабинет/add_prev_company', [WorkerController::class, 'add_prev_company'])->name('add_prev_company'); 510 Route::post('кабинет/add_prev_company', [WorkerController::class, 'add_prev_company'])->name('add_prev_company');
511 Route::get('кабинет/edit_prev_company/{doc}/{worker}', [WorkerController::class, 'edit_prev_company'])->name('edit_prev_company'); 511 Route::get('кабинет/edit_prev_company/{doc}/{worker}', [WorkerController::class, 'edit_prev_company'])->name('edit_prev_company');
512 Route::post('кабинет/update_prev_company/{doc}', [WorkerController::class, 'update_prev_company'])->name('update_prev_company'); 512 Route::post('кабинет/update_prev_company/{doc}', [WorkerController::class, 'update_prev_company'])->name('update_prev_company');
513 Route::get('кабинет/delete_prev_company/{doc}', [WorkerController::class, 'delete_prev_company'])->name('delete_prev_company'); 513 Route::get('кабинет/delete_prev_company/{doc}', [WorkerController::class, 'delete_prev_company'])->name('delete_prev_company');
514 514
515 // Добавление документа-диплома 515 // Добавление документа-диплома
516 Route::get('кабинет/add_diplom/{worker}', [WorkerController::class, 'add_diplom'])->name('add_diplom'); 516 Route::get('кабинет/add_diplom/{worker}', [WorkerController::class, 'add_diplom'])->name('add_diplom');
517 Route::post('кабинет/add_diplom', [WorkerController::class, 'add_diplom_save'])->name('dop_info_save'); 517 Route::post('кабинет/add_diplom', [WorkerController::class, 'add_diplom_save'])->name('dop_info_save');
518 Route::put('кабинет/edit_diploms/{worker}', [WorkerController::class, 'edit_diploms'])->name('edit_diploms'); 518 Route::put('кабинет/edit_diploms/{worker}', [WorkerController::class, 'edit_diploms'])->name('edit_diploms');
519 Route::get('кабинет/delete_ad_diplom/{worker}', [WorkerController::class, 'delete_add_diplom'])->name('delete_add_diplom'); 519 Route::get('кабинет/delete_ad_diplom/{worker}', [WorkerController::class, 'delete_add_diplom'])->name('delete_add_diplom');
520 520
521 // Добавление стандартного диплома 521 // Добавление стандартного диплома
522 Route::get('кабинет/add_document/{worker}', [WorkerController::class, 'add_document'])->name('add_document'); 522 Route::get('кабинет/add_document/{worker}', [WorkerController::class, 'add_document'])->name('add_document');
523 Route::post('кабинет/add_document/', [WorkerController::class, 'add_document_save'])->name('add_document_save'); 523 Route::post('кабинет/add_document/', [WorkerController::class, 'add_document_save'])->name('add_document_save');
524 Route::get('кабинет/edit_document/{doc}/{worker}', [WorkerController::class, 'edit_document'])->name('edit_document'); 524 Route::get('кабинет/edit_document/{doc}/{worker}', [WorkerController::class, 'edit_document'])->name('edit_document');
525 Route::post('кабинет/edit_document/{doc}', [WorkerController::class, 'edit_document_save'])->name('edit_document_save'); 525 Route::post('кабинет/edit_document/{doc}', [WorkerController::class, 'edit_document_save'])->name('edit_document_save');
526 Route::get('кабинет/delete_document/{doc}', [WorkerController::class, 'delete_document'])->name('delete_document'); 526 Route::get('кабинет/delete_document/{doc}', [WorkerController::class, 'delete_document'])->name('delete_document');
527 527
528 // Отправка сообщения работодателю от соискателя 528 // Отправка сообщения работодателю от соискателя
529 Route::post('сообщение/', [WorkerController::class, 'new_message']) 529 Route::post('сообщение/', [WorkerController::class, 'new_message'])
530 ->withoutMiddleware('is_worker') 530 ->withoutMiddleware('is_worker')
531 ->name('new_message'); 531 ->name('new_message');
532
533 Route::get('cabinet/autoresponder', [WorkerController::class, 'autoresponder'])->name('autoresponder');
534 Route::get('cabinet/autoresponder_save', [WorkerController::class, 'autoresponderSave'])->name('autoresponder_save');
535
536 Route::get('cabinet/autolift', [WorkerController::class, 'resumeAutoLiftForm'])->name('autolift');
537 Route::post('cabinet/autolift/save', [WorkerController::class, 'resumeAutoLiftSave'])->name('autolift_save');
532 }); 538 });
533 539
534 // Личный кабинет работодателя 540 // Личный кабинет работодателя
535 Route::group([ 541 Route::group([
536 'as' => 'employer.', // имя маршрута, например auth.index 542 'as' => 'employer.', // имя маршрута, например auth.index
537 'prefix' => 'employer', // префикс маршрута, например auth/index 543 'prefix' => 'employer', // префикс маршрута, например auth/index
538 'middleware' => ['auth', 'is_employer'], 544 'middleware' => ['auth', 'is_employer'],
539 ], function() { 545 ], function() {
540 // 0 страница - Личные данные работодателя 546 // 0 страница - Личные данные работодателя
541 Route::get('cabinet/employer_info', [EmployerController::class, 'employer_info'])->name('employer_info'); 547 Route::get('cabinet/employer_info', [EmployerController::class, 'employer_info'])->name('employer_info');
542 Route::post('cabinet/employer_info/{user}', [EmployerController::class, 'employer_info_save'])->name('employer_info_save'); 548 Route::post('cabinet/employer_info/{user}', [EmployerController::class, 'employer_info_save'])->name('employer_info_save');
543 549
544 // 1 страница - Профиль 550 // 1 страница - Профиль
545 Route::get('cabinet', [EmployerController::class, 'cabinet'])->name('cabinet'); 551 Route::get('cabinet', [EmployerController::class, 'cabinet'])->name('cabinet');
546 Route::post('cabinet/{Employer}', [EmployerController::class, 'cabinet_save'])->name('cabinet_save'); 552 Route::post('cabinet/{Employer}', [EmployerController::class, 'cabinet_save'])->name('cabinet_save');
547 Route::post('flot_add_ajax', [EmployerController::class, 'save_add_flot'])->name('save_add_flot'); 553 Route::post('flot_add_ajax', [EmployerController::class, 'save_add_flot'])->name('save_add_flot');
548 Route::get('flot_delete_ajax/{Flot}', [EmployerController::class, 'delete_flot'])->name('delete_flot'); 554 Route::get('flot_delete_ajax/{Flot}', [EmployerController::class, 'delete_flot'])->name('delete_flot');
549 Route::get('cabinet/flot_edit/{Flot}/{Employer}', [EmployerController::class, 'edit_flot'])->name('edit_flot'); 555 Route::get('cabinet/flot_edit/{Flot}/{Employer}', [EmployerController::class, 'edit_flot'])->name('edit_flot');
550 Route::post('cabinet/flot_edit/{Flot}', [EmployerController::class, 'update_flot'])->name('update_flot_save'); 556 Route::post('cabinet/flot_edit/{Flot}', [EmployerController::class, 'update_flot'])->name('update_flot_save');
551 Route::get('cabinet/flot', [EmployerController::class, 'slider_flot'])->name('slider_flot'); 557 Route::get('cabinet/flot', [EmployerController::class, 'slider_flot'])->name('slider_flot');
552 558
553 Route::get('social/{social}/{vacancy}', [Ad_jobsController::class, 'sendVacancyToSocial']) 559 Route::get('social/{social}/{vacancy}', [Ad_jobsController::class, 'sendVacancyToSocial'])
554 ->name('send-vacancy-to-social'); 560 ->name('send-vacancy-to-social');
555 561
556 // 2 страница - Добавление вакансий 562 // 2 страница - Добавление вакансий
557 Route::get('cabinet/vacancie', [EmployerController::class, 'cabinet_vacancie'])->name('cabinet_vacancie'); 563 Route::get('cabinet/vacancie', [EmployerController::class, 'cabinet_vacancie'])->name('cabinet_vacancie');
558 Route::post('vacancie', [EmployerController::class, 'cabinet_vacancy_save1'])->name('vac_save'); 564 Route::post('vacancie', [EmployerController::class, 'cabinet_vacancy_save1'])->name('vac_save');
559 //Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people'); 565 //Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people');
560 566
561 Route::get('cabinet/vacancie_danger', [EmployerController::class, 'cabinet_vacancie_danger'])->name('cabinet_vacancie_danger'); 567 Route::get('cabinet/vacancie_danger', [EmployerController::class, 'cabinet_vacancie_danger'])->name('cabinet_vacancie_danger');
562 568
563 569
564 570
565 Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people'); 571 Route::get('selected_people', [EmployerController::class, 'selected_people'])->name('selected_people');
566 572
567 // 3 страница - Мои вакансии 573 // 3 страница - Мои вакансии
568 Route::get('cabinet/vacancy_list', [EmployerController::class, 'vacancy_list'])->name('vacancy_list'); 574 Route::get('cabinet/vacancy_list', [EmployerController::class, 'vacancy_list'])->name('vacancy_list');
569 Route::get('cabinet/vacancy/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit'); 575 Route::get('cabinet/vacancy/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit');
570 Route::get('cabinet/vacancy-delete/{ad_employer}', [EmployerController::class, 'vacancy_delete'])->name('vacancy_delete'); 576 Route::get('cabinet/vacancy-delete/{ad_employer}', [EmployerController::class, 'vacancy_delete'])->name('vacancy_delete');
571 Route::get('cabinet/vacancy-up/{ad_employer}', [EmployerController::class, 'vacancy_up'])->name('vacancy_up'); 577 Route::get('cabinet/vacancy-up/{ad_employer}', [EmployerController::class, 'vacancy_up'])->name('vacancy_up');
572 Route::get('cabinet/vacancy-eye/{ad_employer}/{status}', [EmployerController::class, 'vacancy_eye'])->name('vacancy_eye'); 578 Route::get('cabinet/vacancy-eye/{ad_employer}/{status}', [EmployerController::class, 'vacancy_eye'])->name('vacancy_eye');
573 Route::get('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit'); 579 Route::get('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_edit'])->name('vacancy_edit');
574 Route::post('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_save_me'])->name('vacancy_save_me'); 580 Route::post('cabinet/vacancy-edit/{ad_employer}', [EmployerController::class, 'vacancy_save_me'])->name('vacancy_save_me');
575 581
576 // 4.1Ю. 582 // 4.1Ю.
577 Route::get('cabinet/ad_jobs/create/{ad_employer}', [Ad_jobsController::class, 'add_job_in_vac'])->name('add_job_in_vac'); 583 Route::get('cabinet/ad_jobs/create/{ad_employer}', [Ad_jobsController::class, 'add_job_in_vac'])->name('add_job_in_vac');
578 Route::post('cabinet/ad_jobs/create', [Ad_jobsController::class, 'add_job_in_vac_save'])->name('add_job_in_vac_save'); 584 Route::post('cabinet/ad_jobs/create', [Ad_jobsController::class, 'add_job_in_vac_save'])->name('add_job_in_vac_save');
579 Route::get('cabinet/ad_jobs/edit/{ad_job}/{ad_employer}', [Ad_jobsController::class, 'edit_job_in_vac'])->name('edit_job_in_vac'); 585 Route::get('cabinet/ad_jobs/edit/{ad_job}/{ad_employer}', [Ad_jobsController::class, 'edit_job_in_vac'])->name('edit_job_in_vac');
580 Route::post('cabinet/ad_jobs/edit/{ad_job}', [Ad_jobsController::class, 'edit_job_in_vac_save'])->name('edit_job_in_vac_save'); 586 Route::post('cabinet/ad_jobs/edit/{ad_job}', [Ad_jobsController::class, 'edit_job_in_vac_save'])->name('edit_job_in_vac_save');
581 Route::get('cabinet/ad_jobs/delete/{ad_job}', [Ad_jobsController::class, 'delete_job_in_vac'])->name('delete_job_in_vac'); 587 Route::get('cabinet/ad_jobs/delete/{ad_job}', [Ad_jobsController::class, 'delete_job_in_vac'])->name('delete_job_in_vac');
582 588
583 // 4 страница - Отклики на вакансии 589 // 4 страница - Отклики на вакансии
584 Route::get('cabinet/answers/{employer}', [EmployerController::class, 'answers'])->name('answers'); 590 Route::get('cabinet/answers/{employer}', [EmployerController::class, 'answers'])->name('answers');
585 Route::get('cabinet/status/{employer}', [EmployerController::class, 'supple_status2'])->name('supple'); 591 Route::get('cabinet/status/{employer}', [EmployerController::class, 'supple_status2'])->name('supple');
586 Route::get('status/{employer}/{ad_response}/{flag}', [EmployerController::class, 'supple_status'])->name('status_msg'); 592 Route::get('status/{employer}/{ad_response}/{flag}', [EmployerController::class, 'supple_status'])->name('status_msg');
587 593
588 // 5 страница - Сообщения 594 // 5 страница - Сообщения
589 Route::get('cabinet/messages/{type_message}', [EmployerController::class, 'messages'])->name('messages'); 595 Route::get('cabinet/messages/{type_message}', [EmployerController::class, 'messages'])->name('messages');
590 Route::get('cabinet/dialog/{chat}', [EmployerController::class, 'dialog'])->name('dialog'); 596 Route::get('cabinet/dialog/{chat}', [EmployerController::class, 'dialog'])->name('dialog');
591 Route::post('cabinet/send-message', [EmployerController::class, 'send_message'])->name('send_message'); 597 Route::post('cabinet/send-message', [EmployerController::class, 'send_message'])->name('send_message');
592 Route::post('test123', [EmployerController::class, 'test123'])->name('test123'); 598 Route::post('test123', [EmployerController::class, 'test123'])->name('test123');
593 599
594 // 6 страница - Избранный 600 // 6 страница - Избранный
595 Route::get('cabinet/favorites', [EmployerController::class, 'favorites'])->name('favorites'); 601 Route::get('cabinet/favorites', [EmployerController::class, 'favorites'])->name('favorites');
596 602
597 Route::get('cabinet/autolift', [EmployerController::class, 'vacancyAutoLiftForm'])->name('autolift'); 603 Route::get('cabinet/autolift', [EmployerController::class, 'vacancyAutoLiftForm'])->name('autolift');
598 Route::post('cabinet/autolift/save', [EmployerController::class, 'vacancyAutoLiftSave'])->name('autolift_save'); 604 Route::post('cabinet/autolift/save', [EmployerController::class, 'vacancyAutoLiftSave'])->name('autolift_save');
599 605
600 //7 страница - База данных 606 //7 страница - База данных
601 Route::get('cabinet/bd', [EmployerController::class, 'bd'])->name('bd'); 607 Route::get('cabinet/bd', [EmployerController::class, 'bd'])->name('bd');
602 608
603 //8 страница - База резюме 609 //8 страница - База резюме
604 Route::get('cabinet/bd-tupe', [EmployerController::class, 'bd_tupe'])->name('bd-tupe'); 610 Route::get('cabinet/bd-tupe', [EmployerController::class, 'bd_tupe'])->name('bd-tupe');
605 611
606 // 9 рассылка сообщений 612 // 9 рассылка сообщений
607 Route::get('cabinet/send-all-messages', [EmployerController::class, 'send_all_messages'])->name('send_all_messages'); 613 Route::get('cabinet/send-all-messages', [EmployerController::class, 'send_all_messages'])->name('send_all_messages');
608 Route::post('cabinet/send-all-messages/send', [EmployerController::class, 'send_all_post'])->name('send_all_post'); 614 Route::post('cabinet/send-all-messages/send', [EmployerController::class, 'send_all_post'])->name('send_all_post');
609 615
610 // 10 страница FAQ вопрос 616 // 10 страница FAQ вопрос
611 Route::get('cabinet/faq', [FaqController::class, 'showListForUser'])->name('faq'); 617 Route::get('cabinet/faq', [FaqController::class, 'showListForUser'])->name('faq');
612 618
613 Route::get('cabinet/autoresponder', [EmployerController::class, 'autoresponder'])->name('autoresponder'); 619 Route::get('cabinet/autoresponder', [EmployerController::class, 'autoresponder'])->name('autoresponder');
614 Route::get('cabinet/autoresponder_save', [EmployerController::class, 'autoresponderSave'])->name('autoresponder_save'); 620 Route::get('cabinet/autoresponder_save', [EmployerController::class, 'autoresponderSave'])->name('autoresponder_save');
615 621
616 // 11 страница - Настройка уведомлений 622 // 11 страница - Настройка уведомлений
617 Route::get('cabinet/subscribe', [EmployerController::class, 'subscribe'])->name('subscribe'); 623 Route::get('cabinet/subscribe', [EmployerController::class, 'subscribe'])->name('subscribe');
618 Route::get('cabinet/subscribe/save', [EmployerController::class, 'save_subscribe'])->name('save_subscribe'); 624 Route::get('cabinet/subscribe/save', [EmployerController::class, 'save_subscribe'])->name('save_subscribe');
619 625
620 // 12 страница - Сменить пароль 626 // 12 страница - Сменить пароль
621 Route::get('cabinet/password-reset', [EmployerController::class, 'password_reset'])->name('password_reset'); 627 Route::get('cabinet/password-reset', [EmployerController::class, 'password_reset'])->name('password_reset');
622 Route::get('cabinet/password-reset/new', [EmployerController::class, 'new_password'])->name('new_password'); 628 Route::get('cabinet/password-reset/new', [EmployerController::class, 'new_password'])->name('new_password');
623 629
624 // 13 страница - Удаление профиля 630 // 13 страница - Удаление профиля
625 Route::get('cabinet/delete-people', [EmployerController::class, 'delete_people'])->name('delete_people'); 631 Route::get('cabinet/delete-people', [EmployerController::class, 'delete_people'])->name('delete_people');
626 Route::get('cabinet/action-delete-people', [EmployerController::class, 'action_delete_user'])->name('action_delete_user'); 632 Route::get('cabinet/action-delete-people', [EmployerController::class, 'action_delete_user'])->name('action_delete_user');
627 Route::get('cabinet/action-ajax-delete-people', [EmployerController::class, 'ajax_delete_user'])->name('ajax_delete_user'); 633 Route::get('cabinet/action-ajax-delete-people', [EmployerController::class, 'ajax_delete_user'])->name('ajax_delete_user');
628 634
629 // Отправил сообщение 635 // Отправил сообщение
630 Route::post('сообщение/', [EmployerController::class, 'new_message']) 636 Route::post('сообщение/', [EmployerController::class, 'new_message'])
631 ->withoutMiddleware('is_employer') 637 ->withoutMiddleware('is_employer')
632 ->name('new_message'); 638 ->name('new_message');
633 639
634 Route::post('pin_chat/', [EmployerController::class, 'pin_chat'])->name('pin_chat'); 640 Route::post('pin_chat/', [EmployerController::class, 'pin_chat'])->name('pin_chat');
635 Route::post('remove_chat/', [EmployerController::class, 'remove_chat'])->name('remove_chat'); 641 Route::post('remove_chat/', [EmployerController::class, 'remove_chat'])->name('remove_chat');
636 }); 642 });
637 643
638 Route::get('TestWorker', [WorkerController::class, 'TestWorker'])->name('TestWorker'); 644 Route::get('TestWorker', [WorkerController::class, 'TestWorker'])->name('TestWorker');
639 645
640 Route::post('send_message', [HomeController::class, 'send_message'])->name('send_message'); 646 Route::post('send_message', [HomeController::class, 'send_message'])->name('send_message');
641 647
642 648