Commit bcd682aa038c79a4148a8523c952d8b9784feaa3

Authored by Fedor K
Exists in master

Merge branch 'task-132687' into 'master'

task-132687 minor changes

Showing 10 changed files Inline Diff

app/Classes/Tools.php
1 <?php 1 <?php
2 2
3 3
4 namespace App\Classes; 4 namespace App\Classes;
5 5
6 6
7 use App\Models\Worker; 7 use App\Models\Worker;
8 8
9 class Tools 9 class Tools
10 { 10 {
11 static function generator_id($length = 6) 11 static function generator_id($length = 6)
12 { 12 {
13 $word = ''; 13 $word = '';
14 $arr = array( 14 $arr = array(
15 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 15 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
16 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 16 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
17 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 17 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
18 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 18 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
19 '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' 19 '1', '2', '3', '4', '5', '6', '7', '8', '9', '0'
20 ); 20 );
21 21
22 for ($i = 0; $i < $length; $i++) { 22 for ($i = 0; $i < $length; $i++) {
23 $word .= $arr[random_int(0, count($arr) - 1)]; 23 $word .= $arr[random_int(0, count($arr) - 1)];
24 } 24 }
25 return $word; 25 return $word;
26 } 26 }
27 27
28 public static function getWorkerProfilePercent(Worker $Worker): int 28 public static function getWorkerProfilePercent(Worker $Worker): int
29 { 29 {
30 $persent = 10; 30 $persent = 0;
31 31
32 if ((!empty($Worker->telephone)) && 32 if (
33 (!empty($Worker->email)) && (!empty($Worker->experience)) && 33 (!empty($Worker->users->surname)) &&
34 (!empty($Worker->city)) && (!empty($Worker->old_year))) { 34 (!empty($Worker->users->name_man)) &&
35 $persent = $persent + 40; 35 (!empty($Worker->users->surname2)) &&
36 (!empty($Worker->old_year)) &&
37 ($Worker->job_titles->count() > 0) &&
38 (!empty($Worker->salary_expectations)) &&
39 (!empty($Worker->experience)) &&
40 (!empty($Worker->english_level)) &&
41 (!empty($Worker->ready_boart_date)) &&
42 (!empty($Worker->boart_type_preference)) &&
43 (!empty($Worker->visa_available)) &&
44 (!empty($Worker->confirmation_work_for_vvp)) &&
45 (!empty($Worker->military_id_available)) &&
46 (!empty($Worker->city)) &&
47 (!empty($Worker->telephone)) &&
48 (!empty($Worker->email)) &&
49 (!empty($Worker->telephone2))
50 ) {
51 $persent += 50;
36 } 52 }
37 53
38 if ($Worker->sertificate->count() > 0) { 54 if ($Worker->sertificate->count() > 0) {
39 $persent = $persent + 15; 55 $persent += 10;
40 } 56 }
41 57
42 if ($Worker->infobloks->count() > 0) { 58 if ($Worker->infobloks->count() > 0) {
43 $persent = $persent + 20; 59 $persent += 10;
44 } 60 }
45 61
46 if ($Worker->prev_company->count() > 0) { 62 if ($Worker->place_worker->count() > 0) {
47 $persent = $persent + 10; 63 $persent += 25;
48 } 64 }
49 65
50 if (!empty($Worker->photo)) { 66 if ($Worker->prev_company->count() > 0) {
51 $persent = $persent + 5; 67 $persent += 5;
52 } 68 }
53 69
54 return $persent; 70 return $persent;
55 } 71 }
56 } 72 }
57 73
app/Components/Integrations/Telegram/VacancyChannel.php
1 <?php 1 <?php
2 2
3 namespace App\Components\Integrations\Telegram; 3 namespace App\Components\Integrations\Telegram;
4 4
5 use App\Models\Ad_employer; 5 use App\Models\Ad_employer;
6 use Str; 6 use Str;
7 use Telegram\Bot\Api; 7 use Telegram\Bot\Api;
8 use Telegram\Bot\Exceptions\TelegramSDKException; 8 use Telegram\Bot\Exceptions\TelegramSDKException;
9 use Telegram\Bot\Laravel\Facades\Telegram; 9 use Telegram\Bot\Laravel\Facades\Telegram;
10 use Telegram\Bot\Objects\Update; 10 use Telegram\Bot\Objects\Update;
11 11
12 class VacancyChannel 12 class VacancyChannel
13 { 13 {
14 const REKAMORE_CHANNEL_ID = 'REKAMORE_CHANNEL_ID'; 14 const REKAMORE_CHANNEL_ID = 'REKAMORE_CHANNEL_ID';
15 15
16 private Api $botApi; 16 private Api $botApi;
17 17
18 public function __construct() 18 public function __construct()
19 { 19 {
20 $this->botApi = Telegram::bot('channel_bot'); 20 $this->botApi = Telegram::bot('channel_bot');
21 } 21 }
22 22
23 /** 23 /**
24 * @throws TelegramSDKException 24 * @throws TelegramSDKException
25 */ 25 */
26 private function getChatId() 26 private function getChatId()
27 { 27 {
28 $updates = $this->botApi->getUpdates(); 28 $updates = $this->botApi->getUpdates();
29 /** @var Update $update*/ 29 /** @var Update $update*/
30 $chatId = null; 30 $chatId = null;
31 foreach ($updates as $update) { 31 foreach ($updates as $update) {
32 if ($update->message?->chat->title === config('services.telegram.chat_title')) { 32 if ($update->message?->chat->title === config('services.telegram.chat_title')) {
33 $chatId = $update->message->chat->id; 33 $chatId = $update->message->chat->id;
34 \Cache::set(self::REKAMORE_CHANNEL_ID, $chatId, null); 34 \Cache::set(self::REKAMORE_CHANNEL_ID, $chatId, null);
35 break; 35 break;
36 } 36 }
37 } 37 }
38 38
39 if ($chatId === null) { 39 if ($chatId === null) {
40 $chatId = \Cache::get(self::REKAMORE_CHANNEL_ID); 40 $chatId = \Cache::get(self::REKAMORE_CHANNEL_ID);
41 if ($chatId === null) { 41 if ($chatId === null) {
42 throw new TelegramSDKException('Cant locate group chat id'); 42 throw new TelegramSDKException('Cant locate group chat id');
43 } 43 }
44 } 44 }
45 45
46 return $chatId; 46 return $chatId;
47 } 47 }
48 48
49 /** 49 /**
50 * @throws TelegramSDKException 50 * @throws TelegramSDKException
51 */ 51 */
52 public function sendVacancy(Ad_employer $vacancy): void 52 public function sendVacancy(Ad_employer $vacancy): void
53 { 53 {
54 $chatId = $this->getChatId(); 54 $chatId = $this->getChatId();
55 55
56 $text = str_ireplace('<p>', '', $vacancy->text); 56 $text = str_ireplace('<p>', '', $vacancy->text);
57 $text = str_ireplace('</p>', '', $text); 57 $text = str_ireplace('</p>', '', $text);
58 $text = str_ireplace('<br>', '', $text);
58 59
59 $this->botApi->sendMessage([ 60 $this->botApi->sendMessage([
60 'chat_id' => $chatId, 61 'chat_id' => $chatId,
61 'text' => $text, 62 'text' => $text,
62 'disable_web_page_preview' => true, 63 'disable_web_page_preview' => true,
63 'parse_mode' => 'HTML' 64 'parse_mode' => 'HTML'
64 ]); 65 ]);
65 } 66 }
66 } 67 }
67 68
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\Flot; 20 use App\Models\Flot;
21 use App\Models\Job_title; 21 use App\Models\Job_title;
22 use App\Models\Like_worker; 22 use App\Models\Like_worker;
23 use App\Models\Message; 23 use App\Models\Message;
24 use App\Models\Worker; 24 use App\Models\Worker;
25 use App\Models\MessagesRequests; 25 use App\Models\MessagesRequests;
26 use Carbon\Carbon; 26 use Carbon\Carbon;
27 use Illuminate\Auth\Events\Registered; 27 use Illuminate\Auth\Events\Registered;
28 use Illuminate\Database\Eloquent\Builder; 28 use Illuminate\Database\Eloquent\Builder;
29 use Illuminate\Http\Request; 29 use Illuminate\Http\Request;
30 use Illuminate\Support\Facades\Auth; 30 use Illuminate\Support\Facades\Auth;
31 use Illuminate\Support\Facades\Hash; 31 use Illuminate\Support\Facades\Hash;
32 use Illuminate\Support\Facades\Log; 32 use Illuminate\Support\Facades\Log;
33 use Illuminate\Support\Facades\Mail; 33 use Illuminate\Support\Facades\Mail;
34 use Illuminate\Support\Facades\Storage; 34 use Illuminate\Support\Facades\Storage;
35 use App\Models\User as User_Model; 35 use App\Models\User as User_Model;
36 use Illuminate\Support\Facades\Validator; 36 use Illuminate\Support\Facades\Validator;
37 use App\Enums\DbExportColumns; 37 use App\Enums\DbExportColumns;
38 use Throwable; 38 use Throwable;
39 39
40 class EmployerController extends Controller 40 class EmployerController extends Controller
41 { 41 {
42 public function vacancie($vacancy, Request $request) { 42 public function vacancie($vacancy, Request $request) {
43 $title = 'Заголовок вакансии'; 43 $title = 'Заголовок вакансии';
44 $Query = Ad_employer::with('jobs')-> 44 $Query = Ad_employer::with('jobs')->
45 with('cat')-> 45 with('cat')->
46 with('employer')-> 46 with('employer')->
47 with('jobs_code')-> 47 with('jobs_code')->
48 select('ad_employers.*')-> 48 select('ad_employers.*')->
49 where('id', '=', $vacancy)->get(); 49 where('id', '=', $vacancy)->get();
50 50
51 if (isset(Auth()->user()->id)) 51 if (isset(Auth()->user()->id))
52 $uid = Auth()->user()->id; 52 $uid = Auth()->user()->id;
53 else 53 else
54 $uid = 0; 54 $uid = 0;
55 $title = $Query[0]->name; 55 $title = $Query[0]->name;
56 if ($request->ajax()) { 56 if ($request->ajax()) {
57 return view('ajax.vacance-item', compact('Query','uid')); 57 return view('ajax.vacance-item', compact('Query','uid'));
58 } else { 58 } else {
59 return view('vacance-item', compact('title', 'Query', 'uid')); 59 return view('vacance-item', compact('title', 'Query', 'uid'));
60 } 60 }
61 } 61 }
62 62
63 public function logout() { 63 public function logout() {
64 Auth::logout(); 64 Auth::logout();
65 return redirect()->route('index') 65 return redirect()->route('index')
66 ->with('success', 'Вы вышли из личного кабинета'); 66 ->with('success', 'Вы вышли из личного кабинета');
67 } 67 }
68 68
69 public function employer_info() { 69 public function employer_info() {
70 // код юзера 70 // код юзера
71 $user_info = Auth()->user(); 71 $user_info = Auth()->user();
72 // вьюшка для вывода данных 72 // вьюшка для вывода данных
73 return view('employers.info', compact('user_info')); 73 return view('employers.info', compact('user_info'));
74 } 74 }
75 75
76 public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { 76 public function employer_info_save(User_Model $user, BaseUser_min_Request $request) {
77 // Все данные через реквест 77 // Все данные через реквест
78 $all = $request->all(); 78 $all = $request->all();
79 unset($all['_token']); 79 unset($all['_token']);
80 // обновление 80 // обновление
81 $user->update($all); 81 $user->update($all);
82 return redirect()->route('employer.employer_info'); 82 return redirect()->route('employer.employer_info');
83 } 83 }
84 84
85 public function cabinet() { 85 public function cabinet() {
86 $id = Auth()->user()->id; 86 $id = Auth()->user()->id;
87 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 87 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
88 WhereHas('users', 88 WhereHas('users',
89 function (Builder $query) use ($id) {$query->Where('id', $id); 89 function (Builder $query) use ($id) {$query->Where('id', $id);
90 })->get(); 90 })->get();
91 return view('employers.cabinet45', compact('Employer')); 91 return view('employers.cabinet45', compact('Employer'));
92 } 92 }
93 93
94 public function slider_flot() { 94 public function slider_flot() {
95 $id = Auth()->user()->id; 95 $id = Auth()->user()->id;
96 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 96 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
97 WhereHas('users', 97 WhereHas('users',
98 function (Builder $query) use ($id) {$query->Where('id', $id); 98 function (Builder $query) use ($id) {$query->Where('id', $id);
99 })->get(); 99 })->get();
100 return view('employers.fly-flot', compact('Employer')); 100 return view('employers.fly-flot', compact('Employer'));
101 } 101 }
102 102
103 public function cabinet_save(Employer $Employer, Request $request) { 103 public function cabinet_save(Employer $Employer, Request $request) {
104 $params = $request->all(); 104 $params = $request->all();
105 $params['user_id'] = Auth()->user()->id; 105 $params['user_id'] = Auth()->user()->id;
106 $id = $Employer->id; 106 $id = $Employer->id;
107 107
108 if ($request->has('logo')) { 108 if ($request->has('logo')) {
109 if (!empty($Employer->logo)) { 109 if (!empty($Employer->logo)) {
110 Storage::delete($Employer->logo); 110 Storage::delete($Employer->logo);
111 } 111 }
112 $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); 112 $params['logo'] = $request->file('logo')->store("employer/$id", 'public');
113 } 113 }
114 114
115 $Employer->update($params); 115 $Employer->update($params);
116 116
117 return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); 117 return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены');
118 } 118 }
119 119
120 public function save_add_flot(FlotRequest $request) { 120 public function save_add_flot(FlotRequest $request) {
121 // отмена 121 // отмена
122 $params = $request->all(); 122 $params = $request->all();
123 123
124 if ($request->has('image')) { 124 if ($request->has('image')) {
125 $params['image'] = $request->file('image')->store("flot", 'public'); 125 $params['image'] = $request->file('image')->store("flot", 'public');
126 } 126 }
127 Flot::create($params); 127 Flot::create($params);
128 $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); 128 $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get();
129 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); 129 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен');
130 } 130 }
131 131
132 public function edit_flot(Flot $Flot, Employer $Employer) { 132 public function edit_flot(Flot $Flot, Employer $Employer) {
133 return view('employers.edit-flot', compact('Flot', 'Employer')); 133 return view('employers.edit-flot', compact('Flot', 'Employer'));
134 } 134 }
135 135
136 public function update_flot(FlotRequest $request, Flot $Flot) { 136 public function update_flot(FlotRequest $request, Flot $Flot) {
137 $params = $request->all(); 137 $params = $request->all();
138 138
139 if ($request->has('image')) { 139 if ($request->has('image')) {
140 if (!empty($flot->image)) { 140 if (!empty($flot->image)) {
141 Storage::delete($flot->image); 141 Storage::delete($flot->image);
142 } 142 }
143 $params['image'] = $request->file('image')->store("flot", 'public'); 143 $params['image'] = $request->file('image')->store("flot", 'public');
144 } else { 144 } else {
145 if (!empty($flot->image)) $params['image'] = $flot->image; 145 if (!empty($flot->image)) $params['image'] = $flot->image;
146 } 146 }
147 147
148 $Flot->update($params); 148 $Flot->update($params);
149 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); 149 return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен');
150 } 150 }
151 151
152 public function delete_flot(Flot $Flot) { 152 public function delete_flot(Flot $Flot) {
153 $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); 153 $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get();
154 154
155 if (isset($Flot->id)) $Flot->delete(); 155 if (isset($Flot->id)) $Flot->delete();
156 return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); 156 return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален');
157 } 157 }
158 158
159 // Форма добавления вакансий 159 // Форма добавления вакансий
160 public function cabinet_vacancie() { 160 public function cabinet_vacancie() {
161 $id = Auth()->user()->id; 161 $id = Auth()->user()->id;
162 162
163 if (Auth()->user()->is_public) { 163 if (Auth()->user()->is_public) {
164 $categories = Category::query()->active()->get(); 164 $categories = Category::query()->active()->get();
165 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> 165 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')->
166 where('is_remove', '=', '0')-> 166 where('is_remove', '=', '0')->
167 where('is_bd', '=', '0')-> 167 where('is_bd', '=', '0')->
168 get(); 168 get();
169 $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> 169 $Employer = Employer::query()->with('users')->with('ads')->with('flots')->
170 WhereHas('users', 170 WhereHas('users',
171 function (Builder $query) use ($id) { 171 function (Builder $query) use ($id) {
172 $query->Where('id', $id); 172 $query->Where('id', $id);
173 })->get(); 173 })->get();
174 return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); 174 return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories'));
175 } else { 175 } else {
176 return redirect()->route('employer.cabinet_vacancie_danger'); 176 return redirect()->route('employer.cabinet_vacancie_danger');
177 } 177 }
178 } 178 }
179 179
180 // Форма предупреждения об оплате 180 // Форма предупреждения об оплате
181 public function cabinet_vacancie_danger() { 181 public function cabinet_vacancie_danger() {
182 return view('employers.add_vacancy_danger'); 182 return view('employers.add_vacancy_danger');
183 } 183 }
184 184
185 // Сохранение вакансии 185 // Сохранение вакансии
186 public function cabinet_vacancy_save1(VacancyRequestEdit $request) { 186 public function cabinet_vacancy_save1(VacancyRequestEdit $request) {
187 $params_emp = $request->all(); 187 $params_emp = $request->all();
188 188
189 $params_job["job_title_id"] = $params_emp['job_title_id']; 189 $params_job["job_title_id"] = $params_emp['job_title_id'];
190 //$params_job["min_salary"] = $params_emp['min_salary']; 190 //$params_job["min_salary"] = $params_emp['min_salary'];
191 //$params_job["max_salary"] = $params_emp['max_salary']; 191 //$params_job["max_salary"] = $params_emp['max_salary'];
192 //$params_job["region"] = $params_emp['region']; 192 //$params_job["region"] = $params_emp['region'];
193 //$params_job["power"] = $params_emp['power']; 193 //$params_job["power"] = $params_emp['power'];
194 //$params_job["sytki"] = $params_emp['sytki']; 194 //$params_job["sytki"] = $params_emp['sytki'];
195 //$params_job["start"] = $params_emp['start']; 195 //$params_job["start"] = $params_emp['start'];
196 //$params_job["flot"] = $params_emp['flot']; 196 //$params_job["flot"] = $params_emp['flot'];
197 //$params_job["description"] = $params_emp['description']; 197 //$params_job["description"] = $params_emp['description'];
198 198
199 $ad_jobs = Ad_employer::create($params_emp); 199 $ad_jobs = Ad_employer::create($params_emp);
200 //$params_job['ad_employer_id'] = $ad_jobs->id; 200 //$params_job['ad_employer_id'] = $ad_jobs->id;
201 //Ad_jobs::create($params_job); 201 //Ad_jobs::create($params_job);
202 $ad_jobs->jobs()->sync($request->get('job_title_id')); 202 $ad_jobs->jobs()->sync($request->get('job_title_id'));
203 203
204 return redirect()->route('employer.vacancy_list'); 204 return redirect()->route('employer.vacancy_list');
205 } 205 }
206 206
207 // Список вакансий 207 // Список вакансий
208 public function vacancy_list(Request $request) { 208 public function vacancy_list(Request $request) {
209 $id = Auth()->user()->id; 209 $id = Auth()->user()->id;
210 210
211 //dd($request->all()); 211 //dd($request->all());
212 $Employer = Employer::query()->where('user_id', $id)->first(); 212 $Employer = Employer::query()->where('user_id', $id)->first();
213 $vacancy_list = Ad_employer::query() 213 $vacancy_list = Ad_employer::query()
214 ->with('jobs') 214 ->with('jobs')
215 ->with('jobs_code') 215 ->with('jobs_code')
216 ->where('employer_id', $Employer->id) 216 ->where('employer_id', $Employer->id)
217 ->where('is_remove', 0) 217 ->where('is_remove', 0)
218 ->orderbyDesc('updated_at') 218 ->orderbyDesc('updated_at')
219 ; 219 ;
220 220
221 if (($request->has('search')) && (!empty($request->get('search')))) { 221 if (($request->has('search')) && (!empty($request->get('search')))) {
222 $search = $request->get('search'); 222 $search = $request->get('search');
223 $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%"); 223 $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%");
224 } 224 }
225 225
226 if ($request->get('sort')) { 226 if ($request->get('sort')) {
227 $sort = $request->get('sort'); 227 $sort = $request->get('sort');
228 switch ($sort) { 228 switch ($sort) {
229 case 'nopublic': $vacancy_list->where('active_is', '=', 0);break; 229 case 'nopublic': $vacancy_list->where('active_is', '=', 0);break;
230 case 'public':$vacancy_list->where('active_is', '=', 1);break; 230 case 'public':$vacancy_list->where('active_is', '=', 1);break;
231 default: $vacancy_list = $vacancy_list->orderByDesc('id'); break; 231 default: $vacancy_list = $vacancy_list->orderByDesc('id'); break;
232 } 232 }
233 } else { 233 } else {
234 $vacancy_list = $vacancy_list->orderByDesc('updated_at')->orderBy('id'); 234 $vacancy_list = $vacancy_list->orderByDesc('updated_at')->orderBy('id');
235 } 235 }
236 236
237 $vacancy_list = $vacancy_list->paginate(10); 237 $vacancy_list = $vacancy_list->paginate(10);
238 238
239 //ajax 239 //ajax
240 if ($request->ajax()) { 240 if ($request->ajax()) {
241 return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); 241 return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer'));
242 } else { 242 } else {
243 return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); 243 return view('employers.list_vacancy', compact('vacancy_list', 'Employer'));
244 } 244 }
245 } 245 }
246 246
247 // Карточка вакансии 247 // Карточка вакансии
248 public function vacancy_edit(Ad_employer $ad_employer) { 248 public function vacancy_edit(Ad_employer $ad_employer) {
249 $id = Auth()->user()->id; 249 $id = Auth()->user()->id;
250 $Positions = Category::query()->where('is_remove', '=', '0')->get(); 250 $Positions = Category::query()->where('is_remove', '=', '0')->get();
251 251
252 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> 252 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')->
253 where('is_remove', '=', '0')-> 253 where('is_remove', '=', '0')->
254 where('is_bd', '=', '0')->get(); 254 where('is_bd', '=', '0')->get();
255 255
256 $Employer = Employer::query()->with('users')->with('ads')-> 256 $Employer = Employer::query()->with('users')->with('ads')->
257 with('flots')->where('user_id', $id)->first(); 257 with('flots')->where('user_id', $id)->first();
258 258
259 return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); 259 return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs'));
260 } 260 }
261 261
262 // Сохранение-редактирование записи 262 // Сохранение-редактирование записи
263 public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { 263 public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) {
264 $params = $request->all(); 264 $params = $request->all();
265 $params_job["job_title_id"] = $params['job_title_id']; 265 $params_job["job_title_id"] = $params['job_title_id'];
266 266
267 $ad_employer->update($params); 267 $ad_employer->update($params);
268 $ad_employer->jobs()->sync($request->get('job_title_id')); 268 $ad_employer->jobs()->sync($request->get('job_title_id'));
269 269
270 $id = Auth()->user()->id; 270 $id = Auth()->user()->id;
271 $Positions = Category::query()->where('is_remove', '=', '0')->get(); 271 $Positions = Category::query()->where('is_remove', '=', '0')->get();
272 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name') 272 $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')
273 ->where('is_remove', '=', '0') 273 ->where('is_remove', '=', '0')
274 ->where('is_bd', '=', '0') 274 ->where('is_bd', '=', '0')
275 ->get(); 275 ->get();
276 276
277 $Employer = Employer::query() 277 $Employer = Employer::query()
278 ->with('users')->with('ads')->with('flots')->where('user_id', $id)->first(); 278 ->with('users')->with('ads')->with('flots')->where('user_id', $id)->first();
279 return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); 279 return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs'));
280 } 280 }
281 281
282 // Сохранение карточки вакансии 282 // Сохранение карточки вакансии
283 public function vacancy_save(Request $request, Ad_employer $ad_employer) { 283 public function vacancy_save(Request $request, Ad_employer $ad_employer) {
284 $all = $request->all(); 284 $all = $request->all();
285 $ad_employer->update($all); 285 $ad_employer->update($all);
286 return redirect()->route('employer.cabinet_vacancie'); 286 return redirect()->route('employer.cabinet_vacancie');
287 } 287 }
288 288
289 // Удаление карточки вакансии 289 // Удаление карточки вакансии
290 public function vacancy_delete(Ad_employer $ad_employer) { 290 public function vacancy_delete(Ad_employer $ad_employer) {
291 $ad_employer->delete(); 291 $ad_employer->delete();
292 292
293 return redirect()->route('employer.vacancy_list') 293 return redirect()->route('employer.vacancy_list')
294 ->with('success', 'Данные были успешно сохранены'); 294 ->with('success', 'Данные были успешно сохранены');
295 } 295 }
296 296
297 // Обновление даты 297 // Обновление даты
298 public function vacancy_up(Ad_employer $ad_employer) { 298 public function vacancy_up(Ad_employer $ad_employer) {
299 $up = date('m/d/Y h:i:s', time());; 299 $up = date('m/d/Y h:i:s', time());
300 $vac_emp = Ad_employer::findOrFail($ad_employer->id); 300 $ad_employer->updated_at = $up;
301 $vac_emp->updated_at = $up; 301 $ad_employer->save();
302 $vac_emp->save();
303 302
304 return redirect()->back(); //route('employer.vacancy_list'); 303 return redirect()->back();
305 // начало конца
306 } 304 }
307 305
308 //Видимость вакансии 306 //Видимость вакансии
309 public function vacancy_eye(Ad_employer $ad_employer, $status) { 307 public function vacancy_eye(Ad_employer $ad_employer, $status) {
310 $vac_emp = Ad_employer::findOrFail($ad_employer->id); 308 $vac_emp = Ad_employer::findOrFail($ad_employer->id);
311 $vac_emp->active_is = $status; 309 $vac_emp->active_is = $status;
312 $vac_emp->save(); 310 $vac_emp->save();
313 311
314 return redirect()->route('employer.vacancy_list'); 312 return redirect()->route('employer.vacancy_list');
315 } 313 }
316 314
317 //Вакансия редактирования (шаблон) 315 //Вакансия редактирования (шаблон)
318 public function vacancy_update(Ad_employer $id) { 316 public function vacancy_update(Ad_employer $id) {
319 317
320 } 318 }
321 319
322 //Отклики на вакансию - лист 320 //Отклики на вакансию - лист
323 public function answers(Employer $employer, Request $request) { 321 public function answers(Employer $employer, Request $request) {
324 $user_id = Auth()->user()->id; 322 $user_id = Auth()->user()->id;
325 $answer = Ad_employer::query()->where('employer_id', $employer->id); 323 $answer = Ad_employer::query()->where('employer_id', $employer->id);
326 if ($request->has('search')) { 324 if ($request->has('search')) {
327 $search = trim($request->get('search')); 325 $search = trim($request->get('search'));
328 if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); 326 if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%");
329 } 327 }
330 328
331 $answer = $answer->with('response')->OrderByDESC('id')->get(); 329 $answer = $answer->with('response')->OrderByDESC('id')->get();
332 330
333 return view('employers.list_answer', compact('answer', 'user_id', 'employer')); 331 return view('employers.list_answer', compact('answer', 'user_id', 'employer'));
334 } 332 }
335 333
336 //Обновление статуса 334 //Обновление статуса
337 public function supple_status(employer $employer, ad_response $ad_response, $flag) { 335 public function supple_status(employer $employer, ad_response $ad_response, $flag) {
338 $ad_response->update(Array('flag' => $flag)); 336 $ad_response->update(Array('flag' => $flag));
339 return redirect()->route('employer.answers', ['employer' => $employer->id]); 337 return redirect()->route('employer.answers', ['employer' => $employer->id]);
340 } 338 }
341 339
342 //Страницы сообщений список 340 //Страницы сообщений список
343 public function messages($type_message) { 341 public function messages($type_message) {
344 $user_id = Auth()->user()->id; 342 $user_id = Auth()->user()->id;
345 343
346 $chats = Chat::get_user_chats($user_id); 344 $chats = Chat::get_user_chats($user_id);
347 $user_type = 'employer'; 345 $user_type = 'employer';
348 $admin_chat = false; 346 $admin_chat = false;
349 347
350 return view('employers.messages', compact('chats', 'admin_chat', 'user_id', 'user_type')); 348 return view('employers.messages', compact('chats', 'admin_chat', 'user_id', 'user_type'));
351 } 349 }
352 350
353 // Диалог между пользователями 351 // Диалог между пользователями
354 public function dialog(Chat $chat, Request $request) { 352 public function dialog(Chat $chat, Request $request) {
355 // Получение параметров. 353 // Получение параметров.
356 if ($request->has('ad_employer')){ 354 if ($request->has('ad_employer')){
357 $ad_employer = $request->get('ad_employer'); 355 $ad_employer = $request->get('ad_employer');
358 } else { 356 } else {
359 $ad_employer = 0; 357 $ad_employer = 0;
360 } 358 }
361 359
362 $sender = User_Model::query()->with('workers')->with('employers')->where('id', $chat->user_id)->first(); 360 $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(); 361 $companion = User_Model::query()->with('workers')->with('employers')->where('id', $chat->to_user_id)->first();
364 362
365 $Messages = Chat::get_chat_messages($chat); 363 $Messages = Chat::get_chat_messages($chat);
366 364
367 Message::where('user_id', '=', $chat->to_user_id)->where('to_user_id', '=', $chat->user_id)->update(['flag_new' => 0]); 365 Message::where('user_id', '=', $chat->to_user_id)->where('to_user_id', '=', $chat->user_id)->update(['flag_new' => 0]);
368 366
369 return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); 367 return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages'));
370 } 368 }
371 369
372 public function pin_chat(Request $request){ 370 public function pin_chat(Request $request){
373 $chat_id = $request->get('id'); 371 $chat_id = $request->get('id');
374 $is_fixed = $request->get('is_fixed'); 372 $is_fixed = $request->get('is_fixed');
375 373
376 Chat::pin_chat($chat_id, $is_fixed); 374 Chat::pin_chat($chat_id, $is_fixed);
377 } 375 }
378 376
379 public function remove_chat(Request $request){ 377 public function remove_chat(Request $request){
380 $chat_id = $request->get('id'); 378 $chat_id = $request->get('id');
381 Chat::remove_chat($chat_id); 379 Chat::remove_chat($chat_id);
382 } 380 }
383 381
384 // Регистрация работодателя 382 // Регистрация работодателя
385 public function register_employer(Request $request) { 383 public function register_employer(Request $request) {
386 $params = $request->all(); 384 $params = $request->all();
387 385
388 $rules = [ 386 $rules = [
389 //'surname' => ['required', 'string', 'max:255'], 387 //'surname' => ['required', 'string', 'max:255'],
390 //'name_man' => ['required', 'string', 'max:255'], 388 //'name_man' => ['required', 'string', 'max:255'],
391 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 389 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
392 'name_company' => ['required', 'string', 'max:255'], 390 'name_company' => ['required', 'string', 'max:255'],
393 'password' => ['required', 'string', 'min:6'], 391 'password' => ['required', 'string', 'min:6'],
394 ]; 392 ];
395 393
396 $messages = [ 394 $messages = [
397 'required' => 'Укажите обязательное поле', 395 'required' => 'Укажите обязательное поле',
398 'min' => [ 396 'min' => [
399 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 397 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
400 'integer' => 'Поле «:attribute» должно быть :min или больше', 398 'integer' => 'Поле «:attribute» должно быть :min или больше',
401 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 399 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
402 ], 400 ],
403 'max' => [ 401 'max' => [
404 'string' => 'Поле «:attribute» должно быть не больше :max символов', 402 'string' => 'Поле «:attribute» должно быть не больше :max символов',
405 'integer' => 'Поле «:attribute» должно быть :max или меньше', 403 'integer' => 'Поле «:attribute» должно быть :max или меньше',
406 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 404 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
407 ] 405 ]
408 ]; 406 ];
409 407
410 $email = $request->get('email'); 408 $email = $request->get('email');
411 if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { 409 if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) {
412 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); 410 return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл"));
413 } 411 }
414 412
415 if ($request->get('password') !== $request->get('confirmed')){ 413 if ($request->get('password') !== $request->get('confirmed')){
416 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); 414 return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля"));
417 } 415 }
418 416
419 if (strlen($request->get('password')) < 6) { 417 if (strlen($request->get('password')) < 6) {
420 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); 418 return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!"));
421 } 419 }
422 420
423 if (empty($request->get('surname'))) { 421 if (empty($request->get('surname'))) {
424 $params['surname'] = 'Неизвестно'; 422 $params['surname'] = 'Неизвестно';
425 } 423 }
426 if (empty($request->get('name_man'))) { 424 if (empty($request->get('name_man'))) {
427 $params['name_man'] = 'Неизвестно'; 425 $params['name_man'] = 'Неизвестно';
428 } 426 }
429 $validator = Validator::make($params, $rules, $messages); 427 $validator = Validator::make($params, $rules, $messages);
430 428
431 if ($validator->fails()) { 429 if ($validator->fails()) {
432 return json_encode(Array("ERROR" => "Error: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); 430 return json_encode(Array("ERROR" => "Error: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе."));
433 } else { 431 } else {
434 $user = $this->create($params); 432 $user = $this->create($params);
435 event(new Registered($user)); 433 event(new Registered($user));
436 434
437 try { 435 try {
438 Mail::to(env('EMAIL_ADMIN'))->send(new MailCreateEmployer($params)); 436 Mail::to(env('EMAIL_ADMIN'))->send(new MailCreateEmployer($params));
439 } catch (Throwable $e) { 437 } catch (Throwable $e) {
440 Log::error($e); 438 Log::error($e);
441 } 439 }
442 440
443 Auth::guard()->login($user); 441 Auth::guard()->login($user);
444 } 442 }
445 443
446 if ($user) { 444 if ($user) {
447 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; 445 return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));;
448 } else { 446 } else {
449 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); 447 return json_encode(Array("ERROR" => "Error2: Данные были утеряны!"));
450 } 448 }
451 } 449 }
452 450
453 // Создание пользователя 451 // Создание пользователя
454 protected function create(array $data) 452 protected function create(array $data)
455 { 453 {
456 $Use = new User_Model(); 454 $Use = new User_Model();
457 $Code_user = $Use->create([ 455 $Code_user = $Use->create([
458 'name' => $data['surname']." ".$data['name_man'], 456 'name' => $data['surname']." ".$data['name_man'],
459 'name_man' => $data['name_man'], 457 'name_man' => $data['name_man'],
460 'surname' => $data['surname'], 458 'surname' => $data['surname'],
461 'surname2' => $data['surname2'], 459 'surname2' => $data['surname2'],
462 'subscribe_email' => $data['email'], 460 'subscribe_email' => $data['email'],
463 'email' => $data['email'], 461 'email' => $data['email'],
464 'telephone' => $data['telephone'], 462 'telephone' => $data['telephone'],
465 'is_worker' => 0, 463 'is_worker' => 0,
466 'password' => Hash::make($data['password']), 464 'password' => Hash::make($data['password']),
467 'pubpassword' => base64_encode($data['password']), 465 'pubpassword' => base64_encode($data['password']),
468 'email_verified_at' => Carbon::now() 466 'email_verified_at' => Carbon::now()
469 ]); 467 ]);
470 468
471 if ($Code_user->id > 0) { 469 if ($Code_user->id > 0) {
472 $Employer = new Employer(); 470 $Employer = new Employer();
473 $Employer->user_id = $Code_user->id; 471 $Employer->user_id = $Code_user->id;
474 $Employer->name_company = $data['name_company']; 472 $Employer->name_company = $data['name_company'];
475 $Employer->email = $data['email']; 473 $Employer->email = $data['email'];
476 $Employer->telephone = $data['telephone']; 474 $Employer->telephone = $data['telephone'];
477 $Employer->code = Tools::generator_id(10); 475 $Employer->code = Tools::generator_id(10);
478 $Employer->save(); 476 $Employer->save();
479 477
480 return $Code_user; 478 return $Code_user;
481 } 479 }
482 } 480 }
483 481
484 // Отправка сообщения от работодателя 482 // Отправка сообщения от работодателя
485 public function send_message(MessagesRequiest $request) { 483 public function send_message(MessagesRequiest $request) {
486 $params = $request->all(); 484 $params = $request->all();
487 dd($params); 485 dd($params);
488 $user1 = $params['user_id']; 486 $user1 = $params['user_id'];
489 $user2 = $params['to_user_id']; 487 $user2 = $params['to_user_id'];
490 488
491 if ($request->has('file')) { 489 if ($request->has('file')) {
492 $params['file'] = $request->file('file')->store("messages", 'public'); 490 $params['file'] = $request->file('file')->store("messages", 'public');
493 } 491 }
494 Message::create($params); 492 Message::create($params);
495 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); 493 return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]);
496 } 494 }
497 495
498 public function test123(Request $request) { 496 public function test123(Request $request) {
499 $params = $request->all(); 497 $params = $request->all();
500 $user1 = $params['user_id']; 498 $user1 = $params['user_id'];
501 $user2 = $params['to_user_id']; 499 $user2 = $params['to_user_id'];
502 500
503 $rules = [ 501 $rules = [
504 'text' => 'nullable|required_without:file|min:1|max:150000', 502 'text' => 'nullable|required_without:file|min:1|max:150000',
505 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' 503 'file' => 'nullable|file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000'
506 ]; 504 ];
507 $messages = [ 505 $messages = [
508 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен', 506 'required_without' => 'Поле «:attribute» обязательно, если файл не прикреплен',
509 'min' => [ 507 'min' => [
510 'string' => 'Поле «:attribute» должно быть не меньше :min символов', 508 'string' => 'Поле «:attribute» должно быть не меньше :min символов',
511 'integer' => 'Поле «:attribute» должно быть :min или больше', 509 'integer' => 'Поле «:attribute» должно быть :min или больше',
512 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' 510 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт'
513 ], 511 ],
514 'max' => [ 512 'max' => [
515 'string' => 'Поле «:attribute» должно быть не больше :max символов', 513 'string' => 'Поле «:attribute» должно быть не больше :max символов',
516 'integer' => 'Поле «:attribute» должно быть :max или меньше', 514 'integer' => 'Поле «:attribute» должно быть :max или меньше',
517 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' 515 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт'
518 ] 516 ]
519 ]; 517 ];
520 518
521 $validator = Validator::make($request->all(), $rules, $messages); 519 $validator = Validator::make($request->all(), $rules, $messages);
522 520
523 if ($validator->fails()) { 521 if ($validator->fails()) {
524 return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator); 522 return redirect()->route('cabinet.messages', ['type_message' => 'input'])->withErrors($validator);
525 } 523 }
526 524
527 $new_message = Message::add_message($request, $user1, $user2, $request->all(), file_store_path: 'messages'); 525 $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]); 526 return redirect()->route('employer.dialog', ['chat' => $new_message->chat_id_from]);
529 527
530 } 528 }
531 529
532 //Избранные люди 530 //Избранные люди
533 public function favorites(Request $request) 531 public function favorites(Request $request)
534 { 532 {
535 $likedWorkersIds = Like_worker::query() 533 $likedWorkersIds = Like_worker::query()
536 ->where('user_id', Auth::user()->id) 534 ->where('user_id', Auth::user()->id)
537 ->get() 535 ->get()
538 ->pluck('code_record') 536 ->pluck('code_record')
539 ->toArray(); 537 ->toArray();
540 538
541 $workerBuilder = Worker::query() 539 $workerBuilder = Worker::query()
542 ->whereIn('id', $likedWorkersIds); 540 ->whereIn('id', $likedWorkersIds);
543 541
544 if (($request->has('search')) && (!empty($request->get('search')))) { 542 if (($request->has('search')) && (!empty($request->get('search')))) {
545 $search = $request->get('search'); 543 $search = $request->get('search');
546 544
547 $workerBuilder->whereHas('users', function (Builder $query) use ($search) { 545 $workerBuilder->whereHas('users', function (Builder $query) use ($search) {
548 $query->where('surname', 'LIKE', "%$search%") 546 $query->where('surname', 'LIKE', "%$search%")
549 ->oWhere('name_man', 'LIKE', "%$search%") 547 ->orWhere('name_man', 'LIKE', "%$search%")
550 ->orWhere('surname2', 'LIKE', "%$search%"); 548 ->orWhere('surname2', 'LIKE', "%$search%");
551 }); 549 });
552 } 550 }
553 551
554 $Workers = $workerBuilder->get(); 552 $Workers = $workerBuilder->get();
555 553
556 return view('employers.favorite', compact('Workers')); 554 return view('employers.favorite', compact('Workers'));
557 } 555 }
558 556
559 // База данных 557 // База данных
560 public function bd(Request $request) { 558 public function bd(Request $request) {
561 $users = User_Model::query()->with('workers')->with('jobtitles'); 559 $users = User_Model::query()->with('workers')->with('jobtitles');
562 560
563 if ($request->has('search')) { 561 if ($request->has('search')) {
564 $find_key = $request->get('search'); 562 $find_key = $request->get('search');
565 $users = $users->where('name', 'LIKE', "%$find_key%") 563 $users = $users->where('name', 'LIKE', "%$find_key%")
566 ->orWhere('surname', 'LIKE', "%$find_key%") 564 ->orWhere('surname', 'LIKE', "%$find_key%")
567 ->orWhere('name_man', 'LIKE', "%$find_key%") 565 ->orWhere('name_man', 'LIKE', "%$find_key%")
568 ->orWhere('email', 'LIKE', "%$find_key%") 566 ->orWhere('email', 'LIKE', "%$find_key%")
569 ->orWhere('telephone', 'LIKE', "%$find_key%"); 567 ->orWhere('telephone', 'LIKE', "%$find_key%");
570 } 568 }
571 569
572 // Данные 570 // Данные
573 $users = $users->Baseuser()-> 571 $users = $users->Baseuser()->
574 orderByDesc(Worker::select('created_at')->whereColumn('workers.user_id', 'users.id')); 572 orderByDesc(Worker::select('created_at')->whereColumn('workers.user_id', 'users.id'));
575 $count_users = $users; 573 $count_users = $users;
576 $users = $users->paginate(5); 574 $users = $users->paginate(5);
577 575
578 $export_options = DbExportColumns::toArray(); 576 $export_options = DbExportColumns::toArray();
579 577
580 $jobs_titles = Job_title::select('id', 'name') 578 $jobs_titles = Job_title::select('id', 'name')
581 ->where('is_remove', '=', 0) 579 ->where('is_remove', '=', 0)
582 ->where('is_bd', '=', 2) 580 ->where('is_bd', '=', 2)
583 ->orderByDesc('sort') 581 ->orderByDesc('sort')
584 ->orderBy('name', 'asc') 582 ->orderBy('name', 'asc')
585 ->get() 583 ->get()
586 ->toArray() 584 ->toArray()
587 ; 585 ;
588 586
589 return view('employers.bd', compact('users', 'count_users', 'export_options', 'jobs_titles')); 587 return view('employers.bd', compact('users', 'count_users', 'export_options', 'jobs_titles'));
590 } 588 }
591 589
592 //Настройка уведомлений 590 //Настройка уведомлений
593 public function subscribe() { 591 public function subscribe() {
594 return view('employers.subcribe'); 592 return view('employers.subcribe');
595 } 593 }
596 594
597 //Установка уведомлений сохранение 595 //Установка уведомлений сохранение
598 public function save_subscribe(Request $request) { 596 public function save_subscribe(Request $request) {
599 dd($request->all()); 597 dd($request->all());
600 $msg = $request->validate([ 598 $msg = $request->validate([
601 'subscribe_email' => 'required|email|min:5|max:255', 599 'subscribe_email' => 'required|email|min:5|max:255',
602 ]); 600 ]);
603 return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); 601 return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку');
604 } 602 }
605 603
606 //Сбросить форму с паролем 604 //Сбросить форму с паролем
607 public function password_reset() { 605 public function password_reset() {
608 $email = Auth()->user()->email; 606 $email = Auth()->user()->email;
609 return view('employers.password-reset', compact('email')); 607 return view('employers.password-reset', compact('email'));
610 } 608 }
611 609
612 //Обновление пароля 610 //Обновление пароля
613 public function new_password(Request $request) { 611 public function new_password(Request $request) {
614 $use = Auth()->user(); 612 $use = Auth()->user();
615 $request->validate([ 613 $request->validate([
616 'password' => 'required|string', 614 'password' => 'required|string',
617 'new_password' => 'required|string', 615 'new_password' => 'required|string',
618 'new_password2' => 'required|string' 616 'new_password2' => 'required|string'
619 ]); 617 ]);
620 618
621 if ($request->get('new_password') == $request->get('new_password2')) 619 if ($request->get('new_password') == $request->get('new_password2'))
622 if ($request->get('password') !== $request->get('new_password')) { 620 if ($request->get('password') !== $request->get('new_password')) {
623 $credentials = $request->only('email', 'password'); 621 $credentials = $request->only('email', 'password');
624 if (Auth::attempt($credentials)) { 622 if (Auth::attempt($credentials)) {
625 623
626 if (!is_null($use->email_verified_at)){ 624 if (!is_null($use->email_verified_at)){
627 625
628 $user_data = User_Model::find($use->id); 626 $user_data = User_Model::find($use->id);
629 $user_data->update([ 627 $user_data->update([
630 'password' => Hash::make($request->get('new_password')), 628 'password' => Hash::make($request->get('new_password')),
631 'pubpassword' => base64_encode($request->get('new_password')), 629 'pubpassword' => base64_encode($request->get('new_password')),
632 ]); 630 ]);
633 return redirect() 631 return redirect()
634 ->route('employer.password_reset') 632 ->route('employer.password_reset')
635 ->with('success', 'Поздравляю! Вы обновили свой пароль!'); 633 ->with('success', 'Поздравляю! Вы обновили свой пароль!');
636 } 634 }
637 635
638 return redirect() 636 return redirect()
639 ->route('employer.password_reset') 637 ->route('employer.password_reset')
640 ->withError('Данная учетная запись не было верифицированна!'); 638 ->withError('Данная учетная запись не было верифицированна!');
641 } 639 }
642 } 640 }
643 641
644 return redirect() 642 return redirect()
645 ->route('employer.password_reset') 643 ->route('employer.password_reset')
646 ->withErrors('Не совпадение данных, обновите пароли!'); 644 ->withErrors('Не совпадение данных, обновите пароли!');
647 } 645 }
648 646
649 647
650 648
651 // Форма Удаление пипла 649 // Форма Удаление пипла
652 public function delete_people() { 650 public function delete_people() {
653 $login = Auth()->user()->email; 651 $login = Auth()->user()->email;
654 return view('employers.delete_people', compact('login')); 652 return view('employers.delete_people', compact('login'));
655 } 653 }
656 654
657 // Удаление аккаунта 655 // Удаление аккаунта
658 public function action_delete_user(Request $request) { 656 public function action_delete_user(Request $request) {
659 $Answer = $request->all(); 657 $Answer = $request->all();
660 $user_id = Auth()->user()->id; 658 $user_id = Auth()->user()->id;
661 $request->validate([ 659 $request->validate([
662 'password' => 'required|string', 660 'password' => 'required|string',
663 ]); 661 ]);
664 662
665 $credentials = $request->only('email', 'password'); 663 $credentials = $request->only('email', 'password');
666 if (Auth::attempt($credentials)) { 664 if (Auth::attempt($credentials)) {
667 Auth::logout(); 665 Auth::logout();
668 $it = User_Model::find($user_id); 666 $it = User_Model::find($user_id);
669 $it->delete(); 667 $it->delete();
670 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); 668 return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт');
671 } else { 669 } else {
672 return redirect()->route('employer.delete_people') 670 return redirect()->route('employer.delete_people')
673 ->withErrors( 'Неверный пароль! Нужен корректный пароль'); 671 ->withErrors( 'Неверный пароль! Нужен корректный пароль');
674 } 672 }
675 } 673 }
676 674
677 public function ajax_delete_user(Request $request) { 675 public function ajax_delete_user(Request $request) {
678 $Answer = $request->all(); 676 $Answer = $request->all();
679 $user_id = Auth()->user()->id; 677 $user_id = Auth()->user()->id;
680 $request->validate([ 678 $request->validate([
681 'password' => 'required|string', 679 'password' => 'required|string',
682 ]); 680 ]);
683 $credentials = $request->only('email', 'password'); 681 $credentials = $request->only('email', 'password');
684 if (Auth::attempt($credentials)) { 682 if (Auth::attempt($credentials)) {
685 683
686 return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', 684 return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт',
687 'email' => $request->get('email'), 685 'email' => $request->get('email'),
688 'password' => $request->get('password'))); 686 'password' => $request->get('password')));
689 } else { 687 } else {
690 return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); 688 return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль'));
691 } 689 }
692 } 690 }
693 691
694 // Рассылка сообщений 692 // Рассылка сообщений
695 public function send_all_messages() { 693 public function send_all_messages() {
696 $id = Auth()->user()->id; 694 $id = Auth()->user()->id;
697 $sending = Employer::query()->where('user_id', '=', "$id")->first(); 695 $sending = Employer::query()->where('user_id', '=', "$id")->first();
698 696
699 $job_titles = Job_title::query() 697 $job_titles = Job_title::query()
700 ->where('is_remove', '=', 0) 698 ->where('is_remove', '=', 0)
701 ->where('is_bd', '=', 1) 699 ->where('is_bd', '=', 1)
702 ->orderByDesc('sort') 700 ->orderByDesc('sort')
703 ->get(); 701 ->get();
704 702
705 if ($sending->sending_is) 703 if ($sending->sending_is)
706 return view('employers.send_all', compact('job_titles')); 704 return view('employers.send_all', compact('job_titles'));
707 else 705 else
708 return view('employers.send_all_danger'); 706 return view('employers.send_all_danger');
709 } 707 }
710 708
711 // Отправка сообщений для информации 709 // Отправка сообщений для информации
712 public function send_all_post(Request $request) { 710 public function send_all_post(Request $request) {
713 $data = $request->all(); 711 $data = $request->all();
714 $data['user'] = Auth()->user(); 712 $data['user'] = Auth()->user();
715 713
716 $id = MessagesRequests::create([ 714 $id = MessagesRequests::create([
717 'user_id' => $data['user']->id, 715 'user_id' => $data['user']->id,
718 'job_titles' => isset($data['job_title_ids']) ? json_encode($data['job_title_ids']) : null, 716 'job_titles' => isset($data['job_title_ids']) ? json_encode($data['job_title_ids']) : null,
719 'text' => $data['message_text'], 717 'text' => $data['message_text'],
720 ]); 718 ]);
721 719
722 try { 720 try {
723 if (!empty($id)) { 721 if (!empty($id)) {
724 Mail::to(env('EMAIL_ADMIN'))->send(new MassSendingMessages($data)); 722 Mail::to(env('EMAIL_ADMIN'))->send(new MassSendingMessages($data));
725 } 723 }
726 } catch (Throwable $e) { 724 } catch (Throwable $e) {
727 Log::error($e); 725 Log::error($e);
728 return redirect()->route('employer.send_all_messages')->with('error', 'Ошибка почтового сервера, пожалуйста, повторите рассылку позднее'); 726 return redirect()->route('employer.send_all_messages')->with('error', 'Ошибка почтового сервера, пожалуйста, повторите рассылку позднее');
729 } 727 }
730 728
731 return redirect()->route('employer.send_all_messages')->with('success', 'Запрос на рассылку был успешно отправлен.'); 729 return redirect()->route('employer.send_all_messages')->with('success', 'Запрос на рассылку был успешно отправлен.');
732 } 730 }
733 731
734 // База резюме 732 // База резюме
735 public function bd_tupe(Request $request) { 733 public function bd_tupe(Request $request) {
736 $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); 734 $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get();
737 735
738 return view('employers.bd_tupe', compact('Resume')); 736 return view('employers.bd_tupe', compact('Resume'));
739 } 737 }
740 738
741 ////////////////////////////////////////////////////////////////// 739 //////////////////////////////////////////////////////////////////
742 // Отправил сообщение 740 // Отправил сообщение
743 ////////////////////////////////////////////////////////////////// 741 //////////////////////////////////////////////////////////////////
744 public function new_message(Request $request) 742 public function new_message(Request $request)
745 { 743 {
746 $params = $request->all(); 744 $params = $request->all();
747 745
748 $id = $params['_user_id']; 746 $id = $params['_user_id'];
749 $message_params = [ 747 $message_params = [
750 'title' => $params['title'], 748 'title' => $params['title'],
751 'text' => $params['text'], 749 'text' => $params['text'],
752 'ad_employer_id' => $params['_vacancy'], 750 'ad_employer_id' => $params['_vacancy'],
753 'flag_new' => 1 751 'flag_new' => 1
754 ]; 752 ];
755 753
756 $message = Message::add_message( 754 $message = Message::add_message(
757 $request, 755 $request,
758 $params['_user_id'], 756 $params['_user_id'],
759 $params['_to_user_id'], 757 $params['_to_user_id'],
760 $message_params, 758 $message_params,
761 file_store_path: "worker/$id" 759 file_store_path: "worker/$id"
762 ); 760 );
763 761
764 return redirect()->route('worker.dialog', ['chat' => $message->chat_id_to]); 762 return redirect()->route('worker.dialog', ['chat' => $message->chat_id_to]);
765 } 763 }
766 764
767 // Восстановление пароля 765 // Восстановление пароля
768 public function repair_password(Request $request) { 766 public function repair_password(Request $request) {
769 $params = $request->get('email'); 767 $params = $request->get('email');
770 } 768 }
771 769
772 // Избранные люди на корабль 770 // Избранные люди на корабль
773 public function selected_people(Request $request) { 771 public function selected_people(Request $request) {
774 $id = $request->get('id'); 772 $id = $request->get('id');
775 $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> 773 $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')->
776 where('is_remove', '=', '0')-> 774 where('is_remove', '=', '0')->
777 where('is_bd', '=', '0')-> 775 where('is_bd', '=', '0')->
778 where('position_id', $id)-> 776 where('position_id', $id)->
779 get(); 777 get();
780 return view('favorite_people', compact('favorite_people')); 778 return view('favorite_people', compact('favorite_people'));
781 } 779 }
782 } 780 }
783 781
resources/views/admin/users/form.blade.php
1 <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"> 1 <div class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800">
2 @error('name') 2 @error('name')
3 {{ $message }} 3 {{ $message }}
4 @enderror 4 @enderror
5 5
6 <input name="name" id="name" type="hidden" 6 <input name="name" id="name" type="hidden"
7 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" 7 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
8 placeholder="Имя/Псевдоним" value="{{ old('name') ?? $user->name ?? 'Пользователь базы данных' }}" 8 placeholder="Имя/Псевдоним" value="{{ old('name') ?? $user->name ?? 'Пользователь базы данных' }}"
9 /> 9 />
10 10
11 <label class="block text-sm"> 11 <label class="block text-sm">
12 <span class="text-gray-700 dark:text-gray-400">Должность</span> 12 <span class="text-gray-700 dark:text-gray-400">Должность</span>
13 <select name="positions_work[]" id="positions_work[]" data-placeholder="Выберите должность..." multiple="multiple"> 13 <select name="positions_work[]" id="positions_work[]" data-placeholder="Выберите должность..." multiple="multiple">
14 @isset($list_job_titles) 14 @isset($list_job_titles)
15 @foreach($list_job_titles as $job_title) 15 @foreach($list_job_titles as $job_title)
16 <option value="{{ $job_title->id }}" 16 <option value="{{ $job_title->id }}"
17 @if ($user?->workers[0]?->positions_work && in_array($job_title->id , $user->workers[0]->positions_work)) 17 @if (isset($user) && $user?->workers[0]?->positions_work && in_array($job_title->id , $user->workers[0]->positions_work))
18 selected 18 selected
19 @endif 19 @endif
20 > 20 >
21 {{ $job_title->name }} ({{ $job_title->id }}) 21 {{ $job_title->name }} ({{ $job_title->id }})
22 </option> 22 </option>
23 @endforeach 23 @endforeach
24 @endisset 24 @endisset
25 </select> 25 </select>
26 @error('name') 26 @error('name')
27 <span class="text-xs text-red-600 dark:text-red-400"> 27 <span class="text-xs text-red-600 dark:text-red-400">
28 {{ $message }} 28 {{ $message }}
29 </span> 29 </span>
30 @enderror 30 @enderror
31 </label><br> 31 </label><br>
32 32
33 <label class="block text-sm"> 33 <label class="block text-sm">
34 <span class="text-gray-700 dark:text-gray-400">Фамилия</span> 34 <span class="text-gray-700 dark:text-gray-400">Фамилия</span>
35 <input name="surname" id="surname" 35 <input name="surname" id="surname"
36 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" 36 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
37 placeholder="Фамилия" value="{{ old('surname') ?? $user->surname ?? '' }}" 37 placeholder="Фамилия" value="{{ old('surname') ?? $user->surname ?? '' }}"
38 /> 38 />
39 @error('surname') 39 @error('surname')
40 <span class="text-xs text-red-600 dark:text-red-400"> 40 <span class="text-xs text-red-600 dark:text-red-400">
41 {{ $message }} 41 {{ $message }}
42 </span> 42 </span>
43 @enderror 43 @enderror
44 </label><br> 44 </label><br>
45 45
46 <label class="block text-sm"> 46 <label class="block text-sm">
47 <span class="text-gray-700 dark:text-gray-400">Имя</span> 47 <span class="text-gray-700 dark:text-gray-400">Имя</span>
48 <input name="name_man" id="name_man" 48 <input name="name_man" id="name_man"
49 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" 49 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
50 placeholder="Имя" value="{{ old('name_man') ?? $user->name_man ?? '' }}" 50 placeholder="Имя" value="{{ old('name_man') ?? $user->name_man ?? '' }}"
51 /> 51 />
52 @error('name_man') 52 @error('name_man')
53 <span class="text-xs text-red-600 dark:text-red-400"> 53 <span class="text-xs text-red-600 dark:text-red-400">
54 {{ $message }} 54 {{ $message }}
55 </span> 55 </span>
56 @enderror 56 @enderror
57 </label><br> 57 </label><br>
58 58
59 <input type="hidden" name="is_worker" id="is_worker" value="1"/> 59 <input type="hidden" name="is_worker" id="is_worker" value="1"/>
60 <input type="hidden" name="is_bd" id="is_bd" value="1"/> 60 <input type="hidden" name="is_bd" id="is_bd" value="1"/>
61 <input type="hidden" name="admin" id="admin" value="0"/> 61 <input type="hidden" name="admin" id="admin" value="0"/>
62 <input type="hidden" name="password" id="password" value="1234567890"/> 62 <input type="hidden" name="password" id="password" value="1234567890"/>
63 63
64 <label class="block text-sm"> 64 <label class="block text-sm">
65 <span class="text-gray-700 dark:text-gray-400">Отчество</span> 65 <span class="text-gray-700 dark:text-gray-400">Отчество</span>
66 <input name="surname2" id="surname2" 66 <input name="surname2" id="surname2"
67 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" 67 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
68 placeholder="Отчество" value="{{ old('surname2') ?? $user->surname2 ?? '' }}" 68 placeholder="Отчество" value="{{ old('surname2') ?? $user->surname2 ?? '' }}"
69 /> 69 />
70 @error('surname2') 70 @error('surname2')
71 <span class="text-xs text-red-600 dark:text-red-400"> 71 <span class="text-xs text-red-600 dark:text-red-400">
72 {{ $message }} 72 {{ $message }}
73 </span> 73 </span>
74 @enderror 74 @enderror
75 </label><br> 75 </label><br>
76 76
77 <label class="block text-sm"> 77 <label class="block text-sm">
78 <span class="text-gray-700 dark:text-gray-400">Email</span> 78 <span class="text-gray-700 dark:text-gray-400">Email</span>
79 <input name="email" id="email" 79 <input name="email" id="email"
80 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" 80 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
81 placeholder="Email" value="{{ old('email') ?? $user->email ?? '' }}" 81 placeholder="Email" value="{{ old('email') ?? $user->email ?? '' }}"
82 /> 82 />
83 @error('email') 83 @error('email')
84 <span class="text-xs text-red-600 dark:text-red-400"> 84 <span class="text-xs text-red-600 dark:text-red-400">
85 {{ $message }} 85 {{ $message }}
86 </span> 86 </span>
87 @enderror 87 @enderror
88 </label><br> 88 </label><br>
89 89
90 <label class="block text-sm"> 90 <label class="block text-sm">
91 <span class="text-gray-700 dark:text-gray-400">Телефон</span> 91 <span class="text-gray-700 dark:text-gray-400">Телефон</span>
92 <input name="telephone" id="telephone" 92 <input name="telephone" id="telephone"
93 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input" 93 class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
94 placeholder="Телефон" value="{{ old('telephone') ?? $user->telephone ?? '' }}" 94 placeholder="Телефон" value="{{ old('telephone') ?? $user->telephone ?? '' }}"
95 /> 95 />
96 @error('telephone') 96 @error('telephone')
97 <span class="text-xs text-red-600 dark:text-red-400"> 97 <span class="text-xs text-red-600 dark:text-red-400">
98 {{ $message }} 98 {{ $message }}
99 </span> 99 </span>
100 @enderror 100 @enderror
101 </label><br> 101 </label><br>
102 102
103 <label class="block text-sm"> 103 <label class="block text-sm">
104 <span class="text-gray-700 dark:text-gray-400">Файл-анкета</span> 104 <span class="text-gray-700 dark:text-gray-400">Файл-анкета</span>
105 <input type="file" class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 105 <input type="file" class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700
106 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple 106 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple
107 dark:text-gray-300 dark:focus:shadow-outline-gray form-input" 107 dark:text-gray-300 dark:focus:shadow-outline-gray form-input"
108 id="file" name="file"> 108 id="file" name="file">
109 @error('file') 109 @error('file')
110 <span class="text-xs text-red-600 dark:text-red-400"> 110 <span class="text-xs text-red-600 dark:text-red-400">
111 {{ $message }} 111 {{ $message }}
112 </span> 112 </span>
113 @enderror 113 @enderror
114 @isset($user->file) 114 @isset($user->file)
115 <a class="text-gray-700 dark:text-gray-400" target="blank" href="{{ asset(Storage::url($user->file)) }}">{{ $user->file }}</a> 115 <a class="text-gray-700 dark:text-gray-400" target="blank" href="{{ asset(Storage::url($user->file)) }}">{{ $user->file }}</a>
116 @endisset 116 @endisset
117 </label><br> 117 </label><br>
118 118
119 <!--<label class="block text-sm"> 119 <!--<label class="block text-sm">
120 120
121 <input type="hidden" name="page_worker" value="0" /> 121 <input type="hidden" name="page_worker" value="0" />
122 <input name="page_worker" @php if (isset($user->workers->id)) echo "checked"; @endphp 122 <input name="page_worker" @php if (isset($user->workers->id)) echo "checked"; @endphp
123 class="block mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray " 123 class="block mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:text-gray-300 dark:focus:shadow-outline-gray "
124 placeholder="" style="float:left; margin-right: 5px" type="checkbox" value="1" 124 placeholder="" style="float:left; margin-right: 5px" type="checkbox" value="1"
125 /><p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Анкета </p><br> 125 /><p class="text-gray-700 dark:text-gray-400" style="float:left; margin-right: 10px">Анкета </p><br>
126 126
127 </label><br>--> 127 </label><br>-->
128 128
129 <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4"> 129 <div class="flex flex-col flex-wrap mb-4 space-y-4 md:flex-row md:items-end md:space-x-4">
130 <div> 130 <div>
131 <button type="submit" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"> 131 <button type="submit" class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple">
132 Сохранить 132 Сохранить
133 </button> 133 </button>
134 <a href="{{ route('admin.basedata') }}" 134 <a href="{{ route('admin.basedata') }}"
135 class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple" 135 class="px-3 py-1 text-sm font-medium leading-5 text-white transition-colors duration-150 bg-purple-600 border border-transparent rounded-md active:bg-purple-600 hover:bg-purple-700 focus:outline-none focus:shadow-outline-purple"
136 style="display: -webkit-inline-box; height: 30px!important;" 136 style="display: -webkit-inline-box; height: 30px!important;"
137 >Назад</a> 137 >Назад</a>
138 </div> 138 </div>
139 </div> 139 </div>
140 </div> 140 </div>
141 141
142 <script> 142 <script>
143 $(function(){ 143 $(function(){
144 $('[name="positions_work[]"]').chosen({ 144 $('[name="positions_work[]"]').chosen({
145 no_results_text: 'Не добавлено ни одной должности.', 145 no_results_text: 'Не добавлено ни одной должности.',
146 width: '100%' 146 width: '100%'
147 }) 147 })
148 }); 148 });
149 </script> 149 </script>
150 150
resources/views/employers/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 14
15 $(document).on('change', '#send_btn', function() { 15 $(document).on('change', '#send_btn', function() {
16 var this_ = $(this); 16 var this_ = $(this);
17 var val_ = this_.val(); 17 var val_ = this_.val();
18 console.log('sort items '+val_); 18 console.log('sort items '+val_);
19 19
20 $.ajax({ 20 $.ajax({
21 type: "GET", 21 type: "GET",
22 url: "{{ route('shipping_companies') }}", 22 url: "{{ route('shipping_companies') }}",
23 data: "sort="+val_+"&block=1", 23 data: "sort="+val_+"&block=1",
24 success: function (data) { 24 success: function (data) {
25 console.log('Выбор сортировки'); 25 console.log('Выбор сортировки');
26 console.log(data); 26 console.log(data);
27 $('#block_1').html(data); 27 $('#block_1').html(data);
28 }, 28 },
29 headers: { 29 headers: {
30 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 30 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
31 }, 31 },
32 error: function (data) { 32 error: function (data) {
33 data = JSON.stringify(data); 33 data = JSON.stringify(data);
34 console.log('Error: ' + data); 34 console.log('Error: ' + data);
35 } 35 }
36 }); 36 });
37 37
38 $.ajax({ 38 $.ajax({
39 type: "GET", 39 type: "GET",
40 url: "{{ route('shipping_companies') }}", 40 url: "{{ route('shipping_companies') }}",
41 data: "sort="+val_+"&block=2", 41 data: "sort="+val_+"&block=2",
42 success: function (data) { 42 success: function (data) {
43 console.log('Выбор сортировки2'); 43 console.log('Выбор сортировки2');
44 console.log(data); 44 console.log(data);
45 history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); 45 history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif");
46 $('#block_2').html(data); 46 $('#block_2').html(data);
47 }, 47 },
48 headers: { 48 headers: {
49 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 49 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
50 }, 50 },
51 error: function (data) { 51 error: function (data) {
52 data = JSON.stringify(data); 52 data = JSON.stringify(data);
53 console.log('Error: ' + data); 53 console.log('Error: ' + data);
54 } 54 }
55 }); 55 });
56 }); 56 });
57 </script> 57 </script>
58 @endsection 58 @endsection
59 59
60 @section('content') 60 @section('content')
61 <section class="cabinet"> 61 <section class="cabinet">
62 <div class="container"> 62 <div class="container">
63 <ul class="breadcrumbs cabinet__breadcrumbs"> 63 <ul class="breadcrumbs cabinet__breadcrumbs">
64 <li><a href="{{ route('index') }}">Главная</a></li> 64 <li><a href="{{ route('index') }}">Главная</a></li>
65 <li><b>Личный кабинет</b></li> 65 <li><b>Личный кабинет</b></li>
66 </ul> 66 </ul>
67 <div class="cabinet__wrapper"> 67 <div class="cabinet__wrapper">
68 <div class="cabinet__side"> 68 <div class="cabinet__side">
69 <div class="cabinet__side-toper"> 69 <div class="cabinet__side-toper">
70 @include('employers.emblema') 70 @include('employers.emblema')
71 </div> 71 </div>
72 @include('employers.menu', ['item' => 5]) 72 @include('employers.menu', ['item' => 5])
73 </div> 73 </div>
74 <div class="cabinet__body"> 74 <div class="cabinet__body">
75 <div class="cabinet__body-item"> 75 <div class="cabinet__body-item">
76 <h2 class="title cabinet__title">Сообщения</h2> 76 <h2 class="title cabinet__title">Сообщения</h2>
77 </div> 77 </div>
78 <div class="cabinet__body-item"> 78 <div class="cabinet__body-item">
79 <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="back"> 79 <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="back">
80 <svg> 80 <svg>
81 <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use> 81 <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use>
82 </svg> 82 </svg>
83 <span> 83 <span>
84 К списку чатов 84 К списку чатов
85 </span> 85 </span>
86 </a> 86 </a>
87 <div class="chatbox"> 87 <div class="chatbox">
88 <div class="chatbox__toper"> 88 <div class="chatbox__toper">
89 @if ($companion->is_worker) 89 @if ($companion->is_worker)
90 <div class="chatbox__toper-info messages__item-info"> 90 <div class="chatbox__toper-info messages__item-info">
91 <div class="messages__item-photo"> 91 <div class="messages__item-photo">
92 <svg> 92 <svg>
93 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> 93 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
94 </svg> 94 </svg>
95 @if ((isset($companion->workers[0]->photo)) && 95 @if ((isset($companion->workers[0]->photo)) &&
96 (!empty($companion->workers[0]->photo))) 96 (!empty($companion->workers[0]->photo)))
97 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->workers[0]->photo)) }}" alt=""> 97 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->workers[0]->photo)) }}" alt="">
98 @else 98 @else
99 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 99 <img src="{{ asset('images/default_man.jpg') }}" alt="">
100 @endif 100 @endif
101 </div> 101 </div>
102 <div class="messages__item-text"> 102 <div class="messages__item-text">
103 <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div> 103 <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div>
104 </div> 104 </div>
105 </div> 105 </div>
106 @if (isset($companion->workers[0]->id)) 106 @if (isset($companion->workers[0]->id))
107 <a href="{{ route('resume_profile', ['worker' => $companion->workers[0]->id]) }}" class="button chatbox__toper-button"> 107 <a href="{{ route('resume_profile', ['worker' => $companion->workers[0]->id]) }}" class="button chatbox__toper-button">
108 <svg> 108 <svg>
109 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> 109 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use>
110 </svg> 110 </svg>
111 Перейти в профиль 111 Перейти в профиль
112 </a> 112 </a>
113 @endif 113 @endif
114 @else 114 @else
115 <div class="chatbox__toper-info messages__item-info"> 115 <div class="chatbox__toper-info messages__item-info">
116 <div class="messages__item-photo"> 116 <div class="messages__item-photo">
117 <svg> 117 <svg>
118 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> 118 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
119 </svg> 119 </svg>
120 @if ((isset($companion->employers[0]->logo)) && 120 @if ((isset($companion->employers[0]->logo)) &&
121 (!empty($companion->employers[0]->logo))) 121 (!empty($companion->employers[0]->logo)))
122 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->employers[0]->logo)) }}" alt=""> 122 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->employers[0]->logo)) }}" alt="">
123 @else 123 @else
124 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 124 <img src="{{ asset('images/default_man.jpg') }}" alt="">
125 @endif 125 @endif
126 </div> 126 </div>
127 <div class="messages__item-text"> 127 <div class="messages__item-text">
128 <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div> 128 <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div>
129 <div><span>Статус:</span> Работодатель или Администратор</div> 129 <div><span>Статус:</span> Работодатель или Администратор</div>
130 </div> 130 </div>
131 </div> 131 </div>
132 @if (isset($companion->employer->id)) 132 @if (isset($companion->employer->id))
133 <a href="" class="button chatbox__toper-button"> 133 <a href="" class="button chatbox__toper-button">
134 <svg> 134 <svg>
135 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> 135 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use>
136 </svg> 136 </svg>
137 Перейти в профиль 137 Перейти в профиль
138 </a> 138 </a>
139 @endif 139 @endif
140 @endif 140 @endif
141 </div> 141 </div>
142 142
143 @if ($errors->any()) 143 @if ($errors->any())
144 <div class="red bold"> 144 <div class="red bold">
145 <ul> 145 <ul>
146 @foreach ($errors->all() as $error) 146 @foreach ($errors->all() as $error)
147 <li>{{ $error }}</li> 147 <li>{{ $error }}</li>
148 @endforeach 148 @endforeach
149 </ul> 149 </ul>
150 </div> 150 </div>
151 @endif 151 @endif
152 152
153 <div class="chatbox__list" id="dialogs" name="dialogs"> 153 <div class="chatbox__list" id="dialogs" name="dialogs">
154 @if ($Messages->count()) 154 @if ($Messages->count())
155 @foreach ($Messages as $it) 155 @foreach ($Messages as $it)
156 @if ($it->user_id == $companion->id) 156 @if ($it->user_id == $companion->id)
157 <div class="chatbox__item"> 157 <div class="chatbox__item">
158 <div class="chatbox__item-photo"> 158 <div class="chatbox__item-photo">
159 <svg> 159 <svg>
160 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> 160 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
161 </svg> 161 </svg>
162 162
163 @if ($companion->is_worker) 163 @if ($companion->is_worker)
164 @if ((isset($companion->workers[0]->photo)) && 164 @if ((isset($companion->workers[0]->photo)) &&
165 (!empty($companion->workers[0]->photo))) 165 (!empty($companion->workers[0]->photo)))
166 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->workers[0]->photo)) }}" alt=""> 166 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->workers[0]->photo)) }}" alt="">
167 @else 167 @else
168 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 168 <img src="{{ asset('images/default_man.jpg') }}" alt="">
169 @endif 169 @endif
170 @else 170 @else
171 @if ((isset($companion->employers[0]->logo)) && 171 @if ((isset($companion->employers[0]->logo)) &&
172 (!empty($companion->employers[0]->logo))) 172 (!empty($companion->employers[0]->logo)))
173 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->employers[0]->logo)) }}" alt=""> 173 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($companion->employers[0]->logo)) }}" alt="">
174 @else 174 @else
175 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 175 <img src="{{ asset('images/default_man.jpg') }}" alt="">
176 @endif 176 @endif
177 @endif 177 @endif
178
179 </div> 178 </div>
180 <div class="chatbox__item-body"> 179 <div class="chatbox__item-body">
181 @if($it->text || $it->reply_message_id) 180 @if($it->text || $it->reply_message_id)
182 <div class="chatbox__item-text"> 181 <div class="chatbox__item-text">
183 {{ $it->text ?? '' }} 182 @if($it->ad_employer_id > 0)
183 <b>Отклик на вакансию</b> "{{ \App\Models\Ad_employer::find($it->ad_employer_id)->name }}"<br>
184 @if($it->text)
185 <b>Комментарий:</b> {{ $it->text }}
186 @endif
187 @else
188 @if($it->text)
189 {{ $it->text }}
190 @endif
191 @endif
184 192
185 @if($it->reply_message_id) 193 @if($it->reply_message_id)
186 <div class="reply-message"> 194 <div class="reply-message">
187 {{ $it->reply_message->text }} 195 {{ $it->reply_message->text }}
188 </div> 196 </div>
189 @endif 197 @endif
190 </div> 198 </div>
191 @endif 199 @endif
192 @if ((isset($it->file)) && (!empty($it->file))) 200 @if ((isset($it->file)) && (!empty($it->file)))
193 <div class="chatbox__item-text chatbox__item-body-file-name-wrap"> 201 <div class="chatbox__item-text chatbox__item-body-file-name-wrap">
194 <div class=""> 202 <div class="">
195 @if($it->original_file_name) 203 @if($it->original_file_name)
196 {{ $it->original_file_name }} 204 {{ $it->original_file_name }}
197 @else 205 @else
198 <svg> 206 <svg>
199 <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> 207 <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use>
200 </svg> 208 </svg>
201 @endif 209 @endif
202 </div> 210 </div>
203 <a href="{{ asset(Storage::url($it->file)) }}" class=""> 211 <a href="{{ asset(Storage::url($it->file)) }}" class="">
204 Скачать 212 Скачать
205 </a> 213 </a>
206 </div> 214 </div>
207 @endif 215 @endif
208 </div> 216 </div>
209 <div class="chatbox__item-time">{{ $it->created_at }}</div> 217 <div class="chatbox__item-time">{{ $it->created_at }}</div>
210 </div> 218 </div>
211 @else 219 @else
212 <div class="chatbox__item chatbox__item_reverse"> 220 <div class="chatbox__item chatbox__item_reverse">
213 <div class="chatbox__item-photo"> 221 <div class="chatbox__item-photo">
214 <svg> 222 <svg>
215 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> 223 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
216 </svg> 224 </svg>
217 225
218 @if ($sender->is_worker) 226 @if ($sender->is_worker)
219 @if ((isset($sender->workers[0]->photo)) && 227 @if ((isset($sender->workers[0]->photo)) &&
220 (!empty($sender->workers[0]->photo))) 228 (!empty($sender->workers[0]->photo)))
221 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($sender->workers[0]->photo)) }}" alt=""> 229 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($sender->workers[0]->photo)) }}" alt="">
222 @else 230 @else
223 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 231 <img src="{{ asset('images/default_man.jpg') }}" alt="">
224 @endif 232 @endif
225 @else 233 @else
226 @if ((isset($sender->employers[0]->logo)) && 234 @if ((isset($sender->employers[0]->logo)) &&
227 (!empty($sender->employers[0]->logo))) 235 (!empty($sender->employers[0]->logo)))
228 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($sender->employers[0]->logo)) }}" alt=""> 236 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($sender->employers[0]->logo)) }}" alt="">
229 @else 237 @else
230 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 238 <img src="{{ asset('images/default_man.jpg') }}" alt="">
231 @endif 239 @endif
232 @endif 240 @endif
233 241
234 </div> 242 </div>
235 <div class="chatbox__item-body"> 243 <div class="chatbox__item-body">
236 @if($it->text) 244 @if($it->text)
237 <div class="chatbox__item-text">{{ $it->text }}</div> 245 <div class="chatbox__item-text">
246 @if($it->ad_employer_id > 0)
247 <b>Отклик на вакансию</b> "{{ \App\Models\Ad_employer::find($it->ad_employer_id)->name }}"<br>
248 @if($it->text)
249 <b>Комментарий:</b> {{ $it->text }}
250 @endif
251 @else
252 @if($it->text)
253 {{ $it->text }}
254 @endif
255 @endif</div>
238 @endif 256 @endif
239 @if ((isset($it->file)) && (!empty($it->file))) 257 @if ((isset($it->file)) && (!empty($it->file)))
240 <div class="chatbox__item-text chatbox__item-body-file-name-wrap"> 258 <div class="chatbox__item-text chatbox__item-body-file-name-wrap">
241 <a href="{{ asset(Storage::url($it->file)) }}" class=""> 259 <a href="{{ asset(Storage::url($it->file)) }}" class="">
242 Скачать 260 Скачать
243 </a> 261 </a>
244 <div class=""> 262 <div class="">
245 @if($it->original_file_name) 263 @if($it->original_file_name)
246 {{ $it->original_file_name }} 264 {{ $it->original_file_name }}
247 @else 265 @else
248 <svg> 266 <svg>
249 <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> 267 <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use>
250 </svg> 268 </svg>
251 @endif 269 @endif
252 </div> 270 </div>
253 </div> 271 </div>
254 @endif 272 @endif
255 </div> 273 </div>
256 <div class="chatbox__item-time">{{ $it->created_at }}</div> 274 <div class="chatbox__item-time">{{ $it->created_at }}</div>
257 </div> 275 </div>
258 @endif 276 @endif
259 277
260 @endforeach 278 @endforeach
261 @endif 279 @endif
262 </div> 280 </div>
263 <div> 281 <div>
264 <form action="{{ route('employer.test123') }}" class="chatbox__bottom" enctype="multipart/form-data" method="POST" > 282 <form action="{{ route('employer.test123') }}" class="chatbox__bottom" enctype="multipart/form-data" method="POST" >
265 @csrf 283 @csrf
266 <label class="chatbox__bottom-file"> 284 <label class="chatbox__bottom-file">
267 <input id="file" name="file" type="file"> 285 <input id="file" name="file" type="file">
268 <svg> 286 <svg>
269 <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> 287 <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use>
270 </svg> 288 </svg>
271 </label> 289 </label>
272 <input type="hidden" name="_token" value="{{ csrf_token() }}"/> 290 <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
273 <input type="hidden" id="user_id" name="user_id" value="{{ $sender->id }}"/> 291 <input type="hidden" id="user_id" name="user_id" value="{{ $sender->id }}"/>
274 <input type="hidden" id="to_user_id" name="to_user_id" value="{{ $companion->id }}"/> 292 <input type="hidden" id="to_user_id" name="to_user_id" value="{{ $companion->id }}"/>
275 <input type="hidden" id="ad_employer_id" name="ad_employer_id" value="{{ $ad_employer }}"/> 293 <input type="hidden" id="ad_employer_id" name="ad_employer_id" value="{{ $ad_employer }}"/>
276 <input type="hidden" id="ad_name" name="ad_name" value="@if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }} @endif"/> 294 <input type="hidden" id="ad_name" name="ad_name" value="@if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }} @endif"/>
277 <input id="text" name="text" type="text" class="input chatbox__bottom-text" placeholder="Ответить"> 295 <input id="text" name="text" type="text" class="input chatbox__bottom-text" placeholder="Ответить">
278 <button type="submit" id="send_btn" name="send_btn" class="chatbox__bottom-send"> 296 <button type="submit" id="send_btn" name="send_btn" class="chatbox__bottom-send">
279 <svg> 297 <svg>
280 <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> 298 <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use>
281 </svg> 299 </svg>
282 </button> 300 </button>
283 </form> 301 </form>
284 <div class="chatbox-file-name-wrap mt-5 fw600"></div> 302 <div class="chatbox-file-name-wrap mt-5 fw600"></div>
285 </div> 303 </div>
286 </div> 304 </div>
287 </div> 305 </div>
288 </div> 306 </div>
289 </div> 307 </div>
290 </div> 308 </div>
291 </section> 309 </section>
292 </div> 310 </div>
293 @endsection 311 @endsection
resources/views/employers/favorite.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 $(document).on('change', '#sort_ajax', function() { 5 $(document).on('change', '#sort_ajax', function() {
6 var this_ = $(this); 6 var this_ = $(this);
7 var val_ = this_.val(); 7 var val_ = this_.val();
8 console.log('sort items '+val_); 8 console.log('sort items '+val_);
9 9
10 $.ajax({ 10 $.ajax({
11 type: "GET", 11 type: "GET",
12 url: "{{ route('shipping_companies') }}", 12 url: "{{ route('shipping_companies') }}",
13 data: "sort="+val_+"&block=1", 13 data: "sort="+val_+"&block=1",
14 success: function (data) { 14 success: function (data) {
15 console.log('Выбор сортировки'); 15 console.log('Выбор сортировки');
16 console.log(data); 16 console.log(data);
17 $('#block_1').html(data); 17 $('#block_1').html(data);
18 }, 18 },
19 headers: { 19 headers: {
20 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 20 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
21 }, 21 },
22 error: function (data) { 22 error: function (data) {
23 data = JSON.stringify(data); 23 data = JSON.stringify(data);
24 console.log('Error: ' + data); 24 console.log('Error: ' + data);
25 } 25 }
26 }); 26 });
27 27
28 $.ajax({ 28 $.ajax({
29 type: "GET", 29 type: "GET",
30 url: "{{ route('shipping_companies') }}", 30 url: "{{ route('shipping_companies') }}",
31 data: "sort="+val_+"&block=2", 31 data: "sort="+val_+"&block=2",
32 success: function (data) { 32 success: function (data) {
33 console.log('Выбор сортировки2'); 33 console.log('Выбор сортировки2');
34 console.log(data); 34 console.log(data);
35 history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); 35 history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif");
36 $('#block_2').html(data); 36 $('#block_2').html(data);
37 }, 37 },
38 headers: { 38 headers: {
39 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 39 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
40 }, 40 },
41 error: function (data) { 41 error: function (data) {
42 data = JSON.stringify(data); 42 data = JSON.stringify(data);
43 console.log('Error: ' + data); 43 console.log('Error: ' + data);
44 } 44 }
45 }); 45 });
46 }); 46 });
47
48 $(document).ready(function() {
49 $(document).on('click', '.js_box_favorit', function () {
50 var id_worker = $(this).attr('data-val');
51 var data = {code_record: id_worker};
52
53 if ($(this).hasClass('active')){
54 data.delete = 1;
55 }
56
57 $.ajax({
58 type: "GET",
59 url: "{{ route('like_resume') }}",
60 data: data,
61 headers: {
62 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
63 },
64 success: function (data) {
65 if ($(this).hasClass('active')){
66 $(this).removeClass('active');
67 } else{
68 $(this).addClass('active');
69 }
70 },
71 error: function (data) {
72 data = JSON.stringify(data);
73 console.log('Error: ' + data);
74 }
75 });
76 });
77 });
47 </script> 78 </script>
48 @include('js.favorite-worker') 79
49 @endsection 80 @endsection
50 81
51 @section('content') 82 @section('content')
52 <section class="cabinet"> 83 <section class="cabinet">
53 <div class="container"> 84 <div class="container">
54 <ul class="breadcrumbs cabinet__breadcrumbs"> 85 <ul class="breadcrumbs cabinet__breadcrumbs">
55 <li><a href="{{ route('index') }}">Главная</a></li> 86 <li><a href="{{ route('index') }}">Главная</a></li>
56 <li><b>Личный кабинет</b></li> 87 <li><b>Личный кабинет</b></li>
57 </ul> 88 </ul>
58 <div class="cabinet__wrapper"> 89 <div class="cabinet__wrapper">
59 <div class="cabinet__side"> 90 <div class="cabinet__side">
60 <div class="cabinet__side-toper"> 91 <div class="cabinet__side-toper">
61 @include('employers.emblema') 92 @include('employers.emblema')
62 </div> 93 </div>
63 94
64 @include('employers.menu', ['item' => 6]) 95 @include('employers.menu', ['item' => 6])
65 96
66 </div> 97 </div>
67 98
68 <div class="cabinet__body"> 99 <div class="cabinet__body">
69 <div class="cabinet__body-item"> 100 <div class="cabinet__body-item">
70 <h2 class="title cabinet__title">Избранные кандидаты</h2> 101 <h2 class="title cabinet__title">Избранные кандидаты</h2>
71 </div> 102 </div>
72 <div class="cabinet__body-item"> 103 <div class="cabinet__body-item">
73 <div class="cabinet__filters"> 104 <div class="cabinet__filters">
74 <div class="cabinet__filters-item"> 105 <div class="cabinet__filters-item">
75 <form class="search" action="{{ route('employer.favorites') }}"> 106 <form class="search" action="{{ route('employer.favorites') }}">
76 <input type="search" name="search" id="search" class="input" placeholder="Поиск&hellip;" value="@if ((isset($_GET['search'])) && (!empty($_GET['search']))) {{ $_GET['search'] }} @endif"> 107 <input type="search" name="search" id="search" class="input" placeholder="Поиск&hellip;" value="@if ((isset($_GET['search'])) && (!empty($_GET['search']))) {{ $_GET['search'] }} @endif">
77 <button type="submit" class="button">Найти</button> 108 <button type="submit" class="button">Найти</button>
78 <span> 109 <span>
79 <svg> 110 <svg>
80 <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use> 111 <use xlink:href="{{ asset('images/sprite.svg#search') }}"></use>
81 </svg> 112 </svg>
82 </span> 113 </span>
83 </form> 114 </form>
84 </div> 115 </div>
85 </div> 116 </div>
86 <div class="cvs"> 117 <div class="cvs">
87 @if ((isset($Workers) && ($Workers->count()))) 118 @if ((isset($Workers) && ($Workers->count())))
88 @foreach ($Workers as $it) 119 @foreach ($Workers as $it)
89 <div class="cvs__body"> 120 <div class="cvs__body">
90 <div class="cvs__item"> 121 <div class="cvs__item">
91 122
92 <div class="cvs__item-header"> 123 <div class="cvs__item-header">
93 <div class="cvs__item-photo"> 124 <div class="cvs__item-photo">
94 <svg> 125 <svg>
95 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> 126 <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
96 </svg> 127 </svg>
97 @if (!empty($it->photo)) 128 @if (!empty($it->photo))
98 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($it->photo)) }}" alt=""> 129 <img src="{{ asset(\Illuminate\Support\Facades\Storage::url($it->photo)) }}" alt="">
99 @else 130 @else
100 <img src="{{ asset('images/default_man.jpg') }}" alt=""> 131 <img src="{{ asset('images/default_man.jpg') }}" alt="">
101 @endif 132 @endif
102 </div> 133 </div>
103 134
104 <div class="cvs__item-buttons"> 135 <div class="cvs__item-buttons">
105 <button type="button" id="elem_{{ $it->id }}" data-val="{{ $it->id }}" class="like cvs__item-like js_box_favorit js-toggle {{ \App\Classes\LikesClass::get_status_worker($it) }}"> 136 <button type="button"
137 id="elem_{{ $it->id }}"
138 data-val="{{ $it->id }}"
139 class="like cvs__item-like js_box_favorit {{ \App\Classes\LikesClass::get_status_worker($it) }}">
106 <svg class="mr-10"> 140 <svg class="mr-10">
107 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> 141 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use>
108 </svg> 142 </svg>
109 <span class="to-favorites">Добавить в избранное</span> 143 <span class="to-favorites">Добавить в избранное</span>
110 <span class="in-favorites">Убрать из избранного</span> 144 <span class="in-favorites">Убрать из избранного</span>
111 </button> 145 </button>
112 146
113 @guest 147 @guest
114 <button type="button" data-fancybox data-src="#question" data-options='{"touch":false,"autoFocus":false}' 148 <button type="button" data-fancybox data-src="#question" data-options='{"touch":false,"autoFocus":false}'
115 class="chat"> 149 class="chat">
116 <svg class="mr-10"> 150 <svg class="mr-10">
117 <use xlink:href="{{ asset('images/sprite.svg#chat') }}"></use> 151 <use xlink:href="{{ asset('images/sprite.svg#chat') }}"></use>
118 </svg> 152 </svg>
119 <span>Написать</span> 153 <span>Написать</span>
120 </button> 154 </button>
121 @else 155 @else
122 @if (App\Classes\StatusUser::Status()==0) 156 @if (App\Classes\StatusUser::Status()==0)
123 @if ((!Auth()->user()->is_worker) && (Auth()->user()->is_message)) 157 @if ((!Auth()->user()->is_worker) && (Auth()->user()->is_message))
124 <button type="button" class="chat" data-fancybox data-src="#send2" data-vacancy="0" data-uid="{{ Auth()->user()->id }}" data-tuid="{{ $it->users->id }}" data-options='{"touch":false,"autoFocus":false}'> 158 <button type="button" class="chat" data-fancybox data-src="#send2" data-vacancy="0" data-uid="{{ Auth()->user()->id }}" data-tuid="{{ $it->users->id }}" data-options='{"touch":false,"autoFocus":false}'>
125 <svg class="mr-10"> 159 <svg class="mr-10">
126 <use xlink:href="{{ asset('images/sprite.svg#chat') }}"></use> 160 <use xlink:href="{{ asset('images/sprite.svg#chat') }}"></use>
127 </svg> 161 </svg>
128 <span>Написать</span> 162 <span>Написать</span>
129 </button> 163 </button>
130 @endif 164 @endif
131 @else 165 @else
132 <button type="button" data-fancybox data-src="#question2" data-options='{"touch":false,"autoFocus":false}' 166 <button type="button" data-fancybox data-src="#question2" data-options='{"touch":false,"autoFocus":false}'
133 class="chat"> 167 class="chat">
134 <svg class="mr-10"> 168 <svg class="mr-10">
135 <use xlink:href="{{ asset('images/sprite.svg#chat') }}"></use> 169 <use xlink:href="{{ asset('images/sprite.svg#chat') }}"></use>
136 </svg> 170 </svg>
137 <span>Написать</span> 171 <span>Написать</span>
138 </button> 172 </button>
139 @endif 173 @endif
140 @endif 174 @endif
141 175
142 <a href="{{ route('resume_profile', ['worker' => $it->id]) }}" class="button">Подробнее</a> 176 <a href="{{ route('resume_profile', ['worker' => $it->id]) }}" class="button">Подробнее</a>
143 </div> 177 </div>
144 </div> 178 </div>
145 179
146 180
147 <div class="cvs__item-text"> 181 <div class="cvs__item-text">
148 <div class="cvs__item-text-row"> 182 <div class="cvs__item-text-row">
149 <div class="flex" style="align-items: start;"> 183 <div class="flex" style="align-items: start;">
150 <div class="cvs__item-text-status @if ($it->status_work == 0) looking-for-job @endif"> 184 <div class="cvs__item-text-status @if ($it->status_work == 0) looking-for-job @endif">
151 @php 185 @php
152 $worker_statuses = App\Enums\WorkerStatuses::getWorkerStatuses(); 186 $worker_statuses = App\Enums\WorkerStatuses::getWorkerStatuses();
153 @endphp 187 @endphp
154 {{ $worker_statuses[$it->status_work] }} 188 {{ $worker_statuses[$it->status_work] }}
155 </div> 189 </div>
156 <div class="cvs__item-text-updated-at"> 190 <div class="cvs__item-text-updated-at">
157 Обновлено: {{ date('d.m.Y', strtotime($it->updated_at)) }} 191 Обновлено: {{ date('d.m.Y', strtotime($it->updated_at)) }}
158 </div> 192 </div>
159 </div> 193 </div>
160 <div> 194 <div>
161 <b>Предпочтение по типу судна:</b> 195 <b>Предпочтение по типу судна:</b>
162 <div>{{ $it->boart_type_preference ?? '-' }}</div> 196 <div>{{ $it->boart_type_preference ?? '-' }}</div>
163 </div> 197 </div>
164 </div> 198 </div>
165 199
166 <div class="cvs__item-text-row"> 200 <div class="cvs__item-text-row">
167 <div> 201 <div>
168 <b>ФИО:</b> 202 <b>ФИО:</b>
169 <div>@if (isset($it->users)){{ $it->users->surname." ".$it->users->name_man." ".$it->users->surname2 }} @endif</div> 203 <div>@if (isset($it->users)){{ $it->users->surname." ".$it->users->name_man." ".$it->users->surname2 }} @endif</div>
170 </div> 204 </div>
171 <div> 205 <div>
172 <b>Наличие визы:</b> 206 <b>Наличие визы:</b>
173 <div>{{ $it->visa_available ?? '-' }}</div> 207 <div>{{ $it->visa_available ?? '-' }}</div>
174 </div> 208 </div>
175 </div> 209 </div>
176 210
177 <div class="cvs__item-text-row"> 211 <div class="cvs__item-text-row">
178 <div> 212 <div>
179 <b>Возраст:</b> 213 <b>Возраст:</b>
180 <div>{{ $it->old_year ?? '-' }}</div> 214 <div>{{ $it->old_year ?? '-' }}</div>
181 </div> 215 </div>
182 <div> 216 <div>
183 <b>Наличие танкерных документов:</b> 217 <b>Наличие танкерных документов:</b>
184 <div>{{ $it->tanker_documents_available ?? '-' }}</div> 218 <div>{{ $it->tanker_documents_available ?? '-' }}</div>
185 </div> 219 </div>
186 </div> 220 </div>
187 221
188 <div class="cvs__item-text-row"> 222 <div class="cvs__item-text-row">
189 <div> 223 <div>
190 <b>Желаемые вакансии:</b> 224 <b>Желаемые вакансии:</b>
191 <div> 225 <div>
192 @if ($it->job_titles->count()) 226 @if ($it->job_titles->count())
193 @foreach ($it->job_titles as $job_title) 227 @foreach ($it->job_titles as $job_title)
194 {{ $job_title->name }} 228 {{ $job_title->name }}
195 @if (!$loop->last) / @endif 229 @if (!$loop->last) / @endif
196 @endforeach 230 @endforeach
197 @else 231 @else
198 - 232 -
199 @endif 233 @endif
200 </div> 234 </div>
201 </div> 235 </div>
202 <div> 236 <div>
203 <b>Наличие подтверждения для работы на ВВП:</b> 237 <b>Наличие подтверждения для работы на ВВП:</b>
204 <div>{{ $it->confirmation_work_for_vvp ?? '-' }}</div> 238 <div>{{ $it->confirmation_work_for_vvp ?? '-' }}</div>
205 </div> 239 </div>
206 </div> 240 </div>
207 241
208 <div class="cvs__item-text-row"> 242 <div class="cvs__item-text-row">
209 <div> 243 <div>
210 <b>Пожелание к З/П:</b> 244 <b>Пожелание к З/П:</b>
211 <div>{{ $it->salary_expectations ?? '-' }}</div> 245 <div>{{ $it->salary_expectations ?? '-' }}</div>
212 </div> 246 </div>
213 <div> 247 <div>
214 <b>Город проживания</b> 248 <b>Город проживания</b>
215 <div>{{ $it->city ?? "-" }}</div> 249 <div>{{ $it->city ?? "-" }}</div>
216 </div> 250 </div>
217 </div> 251 </div>
218 252
219 <div class="cvs__item-text-row"> 253 <div class="cvs__item-text-row">
220 <div> 254 <div>
221 <b>Уровень английского:</b> 255 <b>Уровень английского:</b>
222 <div>{{ $it->english_level ?? '-' }}</div> 256 <div>{{ $it->english_level ?? '-' }}</div>
223 </div> 257 </div>
224 <div> 258 <div>
225 <b>Телефон:</b> 259 <b>Телефон:</b>
226 <div><a href="tel:{{ $it->telephone }}">{{ $it->telephone ?? '-' }}</a></div> 260 <div><a href="tel:{{ $it->telephone }}">{{ $it->telephone ?? '-' }}</a></div>
227 </div> 261 </div>
228 </div> 262 </div>
229 263
230 <div class="cvs__item-text-row"> 264 <div class="cvs__item-text-row">
231 <div> 265 <div>
232 <b>Дата готовности к посадке:</b> 266 <b>Дата готовности к посадке:</b>
233 <div>{{ $it->ready_boart_date ?? '-' }}</div> 267 <div>{{ $it->ready_boart_date ?? '-' }}</div>
234 </div> 268 </div>
235 <div> 269 <div>
236 <b>E-mail:</b> 270 <b>E-mail:</b>
237 <div><a href="mailto:{{ $it->email }}">{{ $it->email }}</a></div> 271 <div><a href="mailto:{{ $it->email }}">{{ $it->email }}</a></div>
238 </div> 272 </div>
239 </div> 273 </div>
240 </div> 274 </div>
241 </div> 275 </div>
242 </div> 276 </div>
243 @endforeach 277 @endforeach
244 </div> 278 </div>
245 @else 279 @else
246 <div class="notify"> 280 <div class="notify">
247 <svg> 281 <svg>
248 <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> 282 <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use>
249 </svg> 283 </svg>
250 <span>Нет избранных кандидатов</span> 284 <span>Нет избранных кандидатов</span>
251 </div> 285 </div>
252 @endif 286 @endif
253 </div> 287 </div>
254 </div> 288 </div>
255 </div> 289 </div>
256 </div> 290 </div>
257 291
258 </section> 292 </section>
259 </div> 293 </div>
260 @endsection 294 @endsection
261 295
resources/views/modals/vacancy/add_comment.blade.php
1 <div id="add_comment" class="modal"> 1 <div id="add_comment" class="modal">
2 <div class="modal__body"> 2 <div class="modal__body">
3 <div class="modal__title">Комментарий для работодателя</div> 3 <div class="modal__title">Комментарий для работодателя</div>
4 <form class="modal__form comment_form"> 4 <form class="modal__form comment_form">
5 @csrf 5 @csrf
6 <div class="modal__form-item" style="display:none"> 6 <div class="modal__form-item" style="display:none">
7 <!-- Отправитель сообщения: --> 7 <!-- Отправитель сообщения: -->
8 <input type="hidden" id="response_user_id" name="_user_id" class="input" placeholder="user_id" value=""> 8 <input type="hidden" id="response_user_id" name="_user_id" class="input" placeholder="user_id" value="">
9 <!-- Получатель сообщения: --> 9 <!-- Получатель сообщения: -->
10 <input type="hidden" id="response_to_user_id" name="_to_user_id" class="input" placeholder="to_user_id" value=""> 10 <input type="hidden" id="response_to_user_id" name="_to_user_id" class="input" placeholder="to_user_id" value="">
11 <!-- Вакансия: --> 11 <!-- Вакансия: -->
12 <input type="hidden" id="response_vacancy" name="_vacancy" class="input" placeholder="vacancy" value=""> 12 <input type="hidden" id="response_vacancy" name="_vacancy" class="input" placeholder="vacancy" value="">
13 </div> 13 </div>
14 <div class="modal__form-item"> 14 <div class="modal__form-item">
15 <textarea id="comment_text" class="textarea" name="text" placeholder="Комментарий" required value=""></textarea> 15 <textarea id="comment_text" class="textarea" name="text" placeholder="Комментарий" required value=""></textarea>
16 <label for="comment_text">Не заполнено поле</label> 16 <label for="comment_text">Не заполнено поле</label>
17 </div> 17 </div>
18 <div class="modal__form-item"> 18 <div class="modal__form-item">
19 {{--<a id="send_resume" class="button">Отправить</a>--}}
20 <button type="button" 19 <button type="button"
21 data-fancybox 20 data-fancybox
22 id="send_resume"
23 data-src="#response_sent" 21 data-src="#response_sent"
24 class="button main__employer-page-two-item-button">Отправить</button> 22 class="button main__employer-page-two-item-button send_resume">Отправить</button>
23 <button type="button"
24 data-fancybox
25 data-src="#response_sent_no_comment"
26 class="button main__employer-page-two-item-button send_resume">Пропустить</button>
25 </div> 27 </div>
26 </form> 28 </form>
27 </div> 29 </div>
28 </div> 30 </div>
29 31
30 <script> 32 <script>
31 $(document).on('click', '#send_resume', function(){ 33 $(document).on('click', '.send_resume', function(){
34 var data = {
35 user_from: $('#response_user_id').val(),
36 user_to: $('#response_to_user_id').val(),
37 vacancy: $('#response_vacancy').val(),
38 _token: '{{csrf_token()}}'
39 }
40
41 var comment = $('.comment_form textarea').serializeArray()[0].value;
42
43 if (comment !== '') {
44 data.comment = comment;
45 }
46
32 $.ajax({ 47 $.ajax({
33 url: '{{ route('worker.new_message') }}', 48 url: '{{ route('worker.new_message') }}',
34 type: 'POST', 49 type: 'POST',
35 data: { 50 data: data,
36 user_from: $('#response_user_id').val(),
37 user_to: $('#response_to_user_id').val(),
38 vacancy: $('#response_vacancy').val(),
39 comment: $('.comment_form textarea').serializeArray()[0].value,
40 _token: '{{csrf_token()}}'
resources/views/modals/vacancy/ask_for_resume_comment.blade.php
1 <div id="ask_comment" class="modal modal_bg"> 1 <div id="ask_comment" class="modal modal_bg">
2 <div style="display:none"> 2 <div style="display:none">
3 <!-- Отправитель сообщения: --> 3 <!-- Отправитель сообщения: -->
4 <input type="hidden" id="modal_user_id" value=""> 4 <input type="hidden" id="modal_user_id" value="">
5 <!-- Получатель сообщения: --> 5 <!-- Получатель сообщения: -->
6 <input type="hidden" id="modal_to_user_id" value=""> 6 <input type="hidden" id="modal_to_user_id" value="">
7 <!-- Вакансия: --> 7 <!-- Вакансия: -->
8 <input type="hidden" id="modal_vacancy" value=""> 8 <input type="hidden" id="modal_vacancy" value="">
9 </div> 9 </div>
10 10
11 <div class="modal__body"> 11 <div class="modal__body">
12 <div class="modal__title">Вы откликнулись на вакансию <span id="vac_name"></span></div> 12 <div class="modal__title">Вы откликнулись на вакансию <span id="vac_name"></span></div>
13 <div class="modal__text">Вы хотите добавить комментарий к вашему резюме?</div> 13 <div class="modal__text">Вы хотите добавить комментарий к вашему резюме?</div>
14 <div class="modal__buttons"> 14 <div class="modal__buttons">
15 <button type="button" 15 <button type="button"
16 id="comment" 16 id="comment"
17 data-fancybox 17 data-fancybox
18 data-src="#add_comment" 18 data-src="#add_comment"
19 class="button main__employer-page-two-item-button">Да</button> 19 class="button main__employer-page-two-item-button">Да</button>
20 <button type="button" 20 <button type="button"
21 data-fancybox 21 data-fancybox
22 id="send_resume_no_comment" 22 id="send_resume_no_comment"
23 data-src="#response_sent" 23 data-src="#response_sent_no_comment"
24 class="button main__employer-page-two-item-button">Нет</button> 24 class="button main__employer-page-two-item-button">Нет</button>
25 </div> 25 </div>
26 </div> 26 </div>
27 </div> 27 </div>
28 28
29 <script> 29 <script>
30 $(document).on('change', '#modal_user_id', function () { 30 $(document).on('change', '#modal_user_id', function () {
31 $('.js_send_wp_button').data('uid', $('#modal_user_id').val()); 31 $('.js_send_wp_button').data('uid', $('#modal_user_id').val());
32 }) 32 })
33 $(document).on('change', '#modal_to_user_id', function () { 33 $(document).on('change', '#modal_to_user_id', function () {
34 $('.js_send_wp_button').data('tuid', $('#modal_to_user_id').val()); 34 $('.js_send_wp_button').data('tuid', $('#modal_to_user_id').val());
35 }) 35 })
36 $(document).on('change', '#modal_vacancy', function () { 36 $(document).on('change', '#modal_vacancy', function () {
37 $('.js_send_wp_button').data('vacancy', $('#modal_vacancy').val()); 37 $('.js_send_wp_button').data('vacancy', $('#modal_vacancy').val());
38 $.ajax({ 38 $.ajax({
39 url: 'vacancy/'+$('#modal_vacancy').val(), 39 url: 'vacancy/'+$('#modal_vacancy').val(),
40 type: 'GET', 40 type: 'GET',
41 dataType: "json", 41 dataType: "json",
42 success: function (data) { 42 success: function (data) {
43 $('#vac_name').html(data.name) 43 $('#vac_name').html(data.name)
44 } 44 }
45 }) 45 })
46 }) 46 })
47 $(document).on('click', '#comment', function() { 47 $(document).on('click', '#comment', function() {
48 $('#response_user_id').val($('#modal_user_id').val()); 48 $('#response_user_id').val($('#modal_user_id').val());
49 $('#response_to_user_id').val($('#modal_to_user_id').val()); 49 $('#response_to_user_id').val($('#modal_to_user_id').val());
50 $('#response_vacancy').val($('#modal_vacancy').val()); 50 $('#response_vacancy').val($('#modal_vacancy').val());
51 }); 51 });
52 52
53 $(document).on('click', '#send_resume_no_comment', function(){ 53 $(document).on('click', '#send_resume_no_comment', function(){
54 $.ajax({ 54 $.ajax({
55 url: '{{ route('worker.new_message') }}', 55 url: '{{ route('worker.new_message') }}',
56 type: 'POST', 56 type: 'POST',
57 data: { 57 data: {
58 user_from: $('#modal_user_id').val(), 58 user_from: $('#modal_user_id').val(),
59 user_to: $('#modal_to_user_id').val(), 59 user_to: $('#modal_to_user_id').val(),
60 vacancy: $('#modal_vacancy').val(), 60 vacancy: $('#modal_vacancy').val(),
61 _token: '{{csrf_token()}}' 61 _token: '{{csrf_token()}}'
62 }, 62 },
63 success: function (data) { 63 success: function (data) {
64 // 64 //
65 } 65 }
66 }) 66 })
67 }) 67 })
68 68
69 </script> 69 </script>
70 70
resources/views/modals/vacancy/send_response_no_comment.blade.php
File was created 1 <div id="response_sent_no_comment" class="modal modal_bg">
2 <div class="modal__body">
3 <div class="modal__text">Ваше резюме отправлено работодателю.</div>
4 <div class="modal__text">Спасибо, что пользуетесь нашим сервисом.</div>
5 <div class="modal__text">Удачи Вам в поисках работы.</div>
6 <div class="modal__text"></div>
7 <div class="modal__text"></div>
8 <button type="button"
9 id="close-button"
10 class="button"
11 >
12 Вернуться
13 </button>
14 </div>
15 </div>
16 <script>
17 $('#close-button').click(function(){
18 $.fancybox.close();
19 $.fancybox.close();
20 $.fancybox.close();
21 });
22 </script>
23
resources/views/vacance-item.blade.php
1 @php 1 @php
2 use App\Classes\StatusUser; 2 use App\Classes\StatusUser;
3 @endphp 3 @endphp
4 4
5 @extends('layout.frontend', ['title' => $title]) 5 @extends('layout.frontend', ['title' => $title])
6 6
7 @section('scripts') 7 @section('scripts')
8 <script> 8 <script>
9 $(document).on('click', '.js_send_it_button', function() { 9 $(document).on('click', '.js_send_it_button', function() {
10 var this_ = $(this); 10 var this_ = $(this);
11 var code_user_id = this_.attr('data-uid'); 11 var code_user_id = this_.attr('data-uid');
12 var code_to_user_id = this_.attr('data-tuid'); 12 var code_to_user_id = this_.attr('data-tuid');
13 var code_vacancy = this_.attr('data-vacancy'); 13 var code_vacancy = this_.attr('data-vacancy');
14 var user_id = $('#_user_id'); 14 var user_id = $('#_user_id');
15 var to_user_id = $('#_to_user_id'); 15 var to_user_id = $('#_to_user_id');
16 var vacancy = $('#_vacancy'); 16 var vacancy = $('#_vacancy');
17 17
18 user_id.val(code_user_id); 18 user_id.val(code_user_id);
19 to_user_id.val(code_to_user_id); 19 to_user_id.val(code_to_user_id);
20 vacancy.val(code_vacancy); 20 vacancy.val(code_vacancy);
21 }); 21 });
22 </script> 22 </script>
23 <script> 23 <script>
24 $(document).on('click', '.js_send_for_emp', function() { 24 $(document).on('click', '.js_send_for_emp', function() {
25 var this_ = $(this); 25 var this_ = $(this);
26 var code_user_id = this_.attr('data-uid'); 26 var code_user_id = this_.attr('data-uid');
27 var code_to_user_id = this_.attr('data-tuid'); 27 var code_to_user_id = this_.attr('data-tuid');
28 var code_vacancy = this_.attr('data-vacancy'); 28 var code_vacancy = this_.attr('data-vacancy');
29 var user_id = $('#send_user_id'); 29 var user_id = $('#send_user_id');
30 var to_user_id = $('#send_to_user_id'); 30 var to_user_id = $('#send_to_user_id');
31 var vacancy = $('#send_vacancy'); 31 var vacancy = $('#send_vacancy');
32 32
33 user_id.val(code_user_id); 33 user_id.val(code_user_id);
34 to_user_id.val(code_to_user_id); 34 to_user_id.val(code_to_user_id);
35 vacancy.val(code_vacancy); 35 vacancy.val(code_vacancy);
36 }); 36 });
37 </script> 37 </script>
38 @include('js.favorite-vacancy-45') 38 @include('js.favorite-vacancy-45')
39 @endsection 39 @endsection
40 40
41 @section('content') 41 @section('content')
42 <main class="main"> 42 <main class="main">
43 <div class="container"> 43 <div class="container">
44 <ul class="breadcrumbs main__breadcrumbs"> 44 <ul class="breadcrumbs main__breadcrumbs">
45 <li><a href="{{ route('index') }}">Главная</a></li> 45 <li><a href="{{ route('index') }}">Главная</a></li>
46 <li><a href="{{ route('vacancies') }}">Вакансии</a></li> 46 <li><a href="{{ route('vacancies') }}">Вакансии</a></li>
47 <li><b>{{ $title }}</b></li> 47 <li><b>{{ $title }}</b></li>
48 </ul> 48 </ul>
49 <div class="main__employer-page"> 49 <div class="main__employer-page">
50 50
51 @if (isset($Query[0]->employer)) 51 @if (isset($Query[0]->employer))
52 <h2 class="main__employer-page-title">О компании</h2> 52 <h2 class="main__employer-page-title">О компании</h2>
53 <div class="main__employer-page-two-item-toper"> 53 <div class="main__employer-page-two-item-toper">
54 @if (!empty($Query[0]->employer->logo)) 54 @if (!empty($Query[0]->employer->logo))
55 <img src="{{ asset(Storage::url($Query[0]->employer->logo)) }}" alt="{{ $Query[0]->employer->name }}"> 55 <img src="{{ asset(Storage::url($Query[0]->employer->logo)) }}" alt="{{ $Query[0]->employer->name }}">
56 @else 56 @else
57 <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $Query[0]->employer->name }}"> 57 <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $Query[0]->employer->name }}">
58 @endif 58 @endif
59 <span>{{ $Query[0]->employer->name_company }}</span> 59 <span>{{ $Query[0]->employer->name_company }}</span>
60 </div> 60 </div>
61 61
62 <div class="main__employer-page-info"> 62 <div class="main__employer-page-info">
63 <div class="main__employer-page-item"> 63 <div class="main__employer-page-item">
64 <b> Адрес компании</b> 64 <b> Адрес компании</b>
65 <span> 65 <span>
66 {{ $Query[0]->employer->address }} 66 {{ $Query[0]->employer->address }}
67 </span> 67 </span>
68 </div> 68 </div>
69 <div class="main__employer-page-item"> 69 <div class="main__employer-page-item">
70 <b>Сайт</b> 70 <b>Сайт</b>
71 <span> 71 <span>
72 <a href="{{ $Query[0]->employer->site }}">{{ $Query[0]->employer->site }}</a> 72 {{ $Query[0]->employer->site }}
73 </span> 73 </span>
74 </div> 74 </div>
75 <div class="main__employer-page-item"> 75 <div class="main__employer-page-item">
76 <b>Почта</b> 76 <b>Почта</b>
77 <span> 77 <span>
78 <a href="{{ $Query[0]->employer->email }}">{{ $Query[0]->employer->email }}</a> 78 {{ $Query[0]->employer->email }}
79 </span> 79 </span>
80 </div> 80 </div>
81 <div class="main__employer-page-item"> 81 <div class="main__employer-page-item">
82 <b>Телефон</b> 82 <b>Телефон</b>
83 <span> 83 <span>
84 <a href="tel:{{ $Query[0]->employer->telephone }}">{{ $Query[0]->employer->telephone }}</a> 84 {{ $Query[0]->employer->telephone }}
85 </span> 85 </span>
86 </div> 86 </div>
87 </div> 87 </div>
88 @else 88 @else
89 <div class="main__employer-page-info"> 89 <div class="main__employer-page-info">
90 <div class="main__employer-page-item"> 90 <div class="main__employer-page-item">
91 <b>Ничего не найдено</b> 91 <b>Ничего не найдено</b>
92 <span> 92 <span>
93 Нет данных о компании 93 Нет данных о компании
94 </span> 94 </span>
95 </div> 95 </div>
96 </div> 96 </div>
97 @endif 97 @endif
98 <h2 class="main__employer-page-title">{{ $Query[0]->name }}</h2> 98 <h2 class="main__employer-page-title">{{ $Query[0]->name }}</h2>
99 <h3 class="main__employer-page-title_">Описание вакансии</h3> 99 <h3 class="main__employer-page-title_">Описание вакансии</h3>
100
101 </div> 100 </div>
102 101
103 @foreach ($Query as $Q) 102 @foreach ($Query as $Q)
104 <div class="main__vacancies-item-page main__employer-page-two-item"> 103 <div class="main__vacancies-item-page main__employer-page-two-item">
105 <div class="main__employer-page-two-item-text"> 104 <div class="main__employer-page-two-item-text">
106 <div class="main__employer-page-two-item-text-name">Мы предлагаем:</div> 105 <div class="main__employer-page-two-item-text-name">Мы предлагаем:</div>
107 <div class="main__employer-page-two-item-text-body"> 106 <div class="main__employer-page-two-item-text-body">
108 {!! $Q->text !!} 107 {!! $Q->text !!}
109 </div> 108 </div>
110 </div> 109 </div>
111 <div class="main__employer-page-two-item-tags"> 110 <div class="main__employer-page-two-item-tags">
112 @if (!empty($Q->jobs_code[0]->position_ship)) 111 @if (!empty($Q->jobs_code[0]->position_ship))
113 <span class="main__employer-page-two-item-tag">#{{ $Q->jobs_code[0]->position_ship }}</span> 112 <span class="main__employer-page-two-item-tag">#{{ $Q->jobs_code[0]->position_ship }}</span>
114 @else 113 @else
115 @if (isset($Q->jobs)) 114 @if (isset($Q->jobs))
116 @foreach ($Q->jobs as $key => $j) 115 @foreach ($Q->jobs as $key => $j)
117 <span class="main__employer-page-two-item-tag">#{{ $j->name }}</span> 116 <span class="main__employer-page-two-item-tag">#{{ $j->name }}</span>
118 @endforeach 117 @endforeach
119 @endif 118 @endif
120 @endif 119 @endif
121 </div> 120 </div>
122 <br> 121 <br>
123 <div class="main__employer-page-two-item-buttons"> 122 <div class="main__employer-page-two-item-buttons">
124 @guest 123 @guest
125 <button type="button" data-fancybox data-src="#question" data-options='{"touch":false,"autoFocus":false}' 124 <button type="button" data-fancybox data-src="#question" data-options='{"touch":false,"autoFocus":false}'
126 class="button main__employer-page-two-item-button">Откликнуться</button> 125 class="button main__employer-page-two-item-button">Откликнуться</button>
127 @else 126 @else
128 @if (App\Classes\StatusUser::Status()==1) 127 @if (App\Classes\StatusUser::Status()==1)
129 <button type="button" data-fancybox data-src="#send" data-vacancy="{{ $Q->id }}" data-uid="{{ $uid }}" data-tuid="{{ $Q->employer->user_id }}" data-options='{"touch":false,"autoFocus":false}' 128 <button type="button" data-fancybox data-src="#send" data-vacancy="{{ $Q->id }}" data-uid="{{ $uid }}" data-tuid="{{ $Q->employer->user_id }}" data-options='{"touch":false,"autoFocus":false}'
130 class="button main__employer-page-two-item-button js_send_for_emp">Откликнуться</button> 129 class="button main__employer-page-two-item-button js_send_for_emp">Откликнуться</button>
131 @else 130 @else
132 <button type="button" data-fancybox data-src="#send2" data-vacancy="{{ $Q->id }}" data-uid="{{ $uid }}" data-tuid="{{ $Q->employer->user_id }}" data-options='{"touch":false,"autoFocus":false}' 131 <button type="button" data-fancybox data-src="#send2" data-vacancy="{{ $Q->id }}" data-uid="{{ $uid }}" data-tuid="{{ $Q->employer->user_id }}" data-options='{"touch":false,"autoFocus":false}'
133 class="button main__employer-page-two-item-button js_send_it_button">Откликнуться</button> 132 class="button main__employer-page-two-item-button js_send_it_button">Откликнуться</button>
134 @endif 133 @endif
135 @endguest 134 @endguest
136 </div> 135 </div>
137 <div class="main__employer-page-two-item-bottom"> 136 <div class="main__employer-page-two-item-bottom">
138 <div class="main__employer-page-two-item-bottom-date">{{ date('d.m.Y', strtotime($Q->updated_at)) }}</div> 137 <div class="main__employer-page-two-item-bottom-date">{{ date('d.m.Y', strtotime($Q->updated_at)) }}</div>
139 <button type="button" id="like{{ $Q->id }}" data-val="{{ $Q->id }}" class="like main__employer-page-two-item-bottom-like js_vac_favorite js-toggle {{ \App\Classes\LikesClass::get_status_vacancy($Q) }}"> 138 <button type="button" id="like{{ $Q->id }}" data-val="{{ $Q->id }}" class="like main__employer-page-two-item-bottom-like js_vac_favorite js-toggle {{ \App\Classes\LikesClass::get_status_vacancy($Q) }}">
140 <svg> 139 <svg>
141 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> 140 <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use>
142 </svg> 141 </svg>
143 </button> 142 </button>
144 </div> 143 </div>
145 </div> 144 </div>
146 @endforeach 145 @endforeach
147 146
148 <a href="{{ redirect()->back()->getTargetUrl() }}" class="back"> 147 <a href="{{ redirect()->back()->getTargetUrl() }}" class="back">
149 <svg> 148 <svg>
150 <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use> 149 <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use>
151 </svg> 150 </svg>
152 <span>Вернуться к списку вакансий</span> 151 <span>Вернуться к списку вакансий</span>
153 </a> 152 </a>
154 </div> 153 </div>
155 </main> 154 </main>
156 </div> 155 </div>
157 @endsection 156 @endsection
158 157