Commit 066f7f9f852d605e6b9ac07bafaa1330d23d7979
1 parent
f9f63a2c48
Exists in
master
Коммит по диалогам
Showing 14 changed files with 77 additions and 18 deletions Inline Diff
- app/Http/Controllers/Admin/MsgAnswersController.php
- app/Http/Controllers/EmployerController.php
- app/Http/Controllers/MainController.php
- app/Http/Controllers/WorkerController.php
- app/Models/Ad_employer.php
- app/Models/ResponseWork.php
- app/Models/Worker.php
- app/Models/infobloks.php
- resources/views/admin/messages.blade.php
- resources/views/employers/dialog.blade.php
- resources/views/modals/send_worker_new.blade.php
- resources/views/worker.blade.php
- resources/views/workers/cabinet.blade.php
- resources/views/workers/messages.blade.php
app/Http/Controllers/Admin/MsgAnswersController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers\Admin; | 3 | namespace App\Http\Controllers\Admin; |
4 | 4 | ||
5 | use App\Http\Controllers\Controller; | 5 | use App\Http\Controllers\Controller; |
6 | use App\Models\Message; | 6 | use App\Models\Message; |
7 | use App\Models\User; | 7 | use App\Models\User; |
8 | use Illuminate\Database\Eloquent\Builder; | 8 | use Illuminate\Database\Eloquent\Builder; |
9 | use Illuminate\Http\Request; | 9 | use Illuminate\Http\Request; |
10 | use Illuminate\Support\Facades\Auth; | 10 | use Illuminate\Support\Facades\Auth; |
11 | use Illuminate\Support\Facades\DB; | 11 | use Illuminate\Support\Facades\DB; |
12 | use Illuminate\Support\Facades\Validator; | 12 | use Illuminate\Support\Facades\Validator; |
13 | 13 | ||
14 | class MsgAnswersController extends Controller | 14 | class MsgAnswersController extends Controller |
15 | { | 15 | { |
16 | public function messages(Request $request) { | 16 | public function messages(Request $request) { |
17 | $find_key = ""; | 17 | $find_key = ""; |
18 | $find_cat = ""; | 18 | $find_cat = ""; |
19 | $Msgs = Message::with('user_from')->with('user_to')->with('response'); | 19 | $Msgs = Message::with('user_from')->with('user_to'); //->with('response'); |
20 | 20 | ||
21 | $Msgs = $this->filter($Msgs, $request, $find_key, $find_cat); | 21 | $Msgs = $this->filter($Msgs, $request, $find_key, $find_cat); |
22 | 22 | ||
23 | $Msgs = $Msgs->orderByDesc('created_at')->paginate(25); | 23 | $Msgs = $Msgs->orderByDesc('created_at')->paginate(25); |
24 | 24 | ||
25 | return view('admin.messages', compact('Msgs', 'find_key', 'find_cat')); | 25 | return view('admin.messages', compact('Msgs', 'find_key', 'find_cat')); |
26 | } | 26 | } |
27 | 27 | ||
28 | public function read_message(Message $message) { | 28 | public function read_message(Message $message) { |
29 | return view('admin.message-read', compact('message')); | 29 | return view('admin.message-read', compact('message')); |
30 | } | 30 | } |
31 | 31 | ||
32 | public function filter($Msgs, Request $request, &$find_key, &$find_cat) { | 32 | public function filter($Msgs, Request $request, &$find_key, &$find_cat) { |
33 | if (isset($request->find)) { | 33 | if (isset($request->find)) { |
34 | $find_key = $request->find; | 34 | $find_key = $request->find; |
35 | $Msgs = $Msgs->where(function($q) use ($find_key) { | 35 | $Msgs = $Msgs->where(function($q) use ($find_key) { |
36 | $q->whereHas('user_from', | 36 | $q->whereHas('user_from', |
37 | function (Builder $query) use ($find_key) { | 37 | function (Builder $query) use ($find_key) { |
38 | $query->where('name', 'LIKE', "%$find_key%"); | 38 | $query->where('name', 'LIKE', "%$find_key%"); |
39 | } | 39 | } |
40 | )-> | 40 | )-> |
41 | orWhereHas('user_to', | 41 | orWhereHas('user_to', |
42 | function (Builder $query) use ($find_key) { | 42 | function (Builder $query) use ($find_key) { |
43 | $query->where('name', 'LIKE', "%$find_key%"); | 43 | $query->where('name', 'LIKE', "%$find_key%"); |
44 | } | 44 | } |
45 | ); | 45 | ); |
46 | }); | 46 | }); |
47 | } | 47 | } |
48 | 48 | ||
49 | if (isset($request->category)) { | 49 | if (isset($request->category)) { |
50 | $find_cat = $request->category; | 50 | $find_cat = $request->category; |
51 | 51 | ||
52 | switch ($find_cat) { | 52 | switch ($find_cat) { |
53 | case 'Работодатели': | 53 | case 'Работодатели': |
54 | $Msgs = $Msgs->where(function($q) { | 54 | $Msgs = $Msgs->where(function($q) { |
55 | $q->whereHas('user_to', | 55 | $q->whereHas('user_to', |
56 | function (Builder $query) { | 56 | function (Builder $query) { |
57 | $query->where('is_worker', '0'); | 57 | $query->where('is_worker', '0'); |
58 | } | 58 | } |
59 | )->orwhereHas('user_from', | 59 | )->orwhereHas('user_from', |
60 | function (Builder $query) { | 60 | function (Builder $query) { |
61 | $query->where('is_worker', '0'); | 61 | $query->where('is_worker', '0'); |
62 | } | 62 | } |
63 | ); | 63 | ); |
64 | }); | 64 | }); |
65 | break; | 65 | break; |
66 | case 'Соискатели': | 66 | case 'Соискатели': |
67 | $Msgs = $Msgs->where(function($q) { | 67 | $Msgs = $Msgs->where(function($q) { |
68 | $q->whereHas('user_to', | 68 | $q->whereHas('user_to', |
69 | function (Builder $query) { | 69 | function (Builder $query) { |
70 | $query->where('is_worker', '1'); | 70 | $query->where('is_worker', '1'); |
71 | } | 71 | } |
72 | )->orwhereHas('user_from', | 72 | )->orwhereHas('user_from', |
73 | function (Builder $query) { | 73 | function (Builder $query) { |
74 | $query->where('is_worker', '1'); | 74 | $query->where('is_worker', '1'); |
75 | } | 75 | } |
76 | ); | 76 | ); |
77 | }); | 77 | }); |
78 | break; | 78 | break; |
79 | case 'Администраторы': | 79 | case 'Администраторы': |
80 | $Msgs = $Msgs->where(function($q) { | 80 | $Msgs = $Msgs->where(function($q) { |
81 | $q->whereHas('user_to', | 81 | $q->whereHas('user_to', |
82 | function (Builder $query) { | 82 | function (Builder $query) { |
83 | $query->where('admin', '1'); | 83 | $query->where('admin', '1'); |
84 | } | 84 | } |
85 | )->orwhereHas('user_from', | 85 | )->orwhereHas('user_from', |
86 | function (Builder $query) { | 86 | function (Builder $query) { |
87 | $query->where('admin', '1'); | 87 | $query->where('admin', '1'); |
88 | } | 88 | } |
89 | ); | 89 | ); |
90 | }); | 90 | }); |
91 | break; | 91 | break; |
92 | default:break; | 92 | default:break; |
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
96 | return $Msgs; | 96 | return $Msgs; |
97 | 97 | ||
98 | } | 98 | } |
99 | 99 | ||
100 | public function admin_messages(Request $request) { | 100 | public function admin_messages(Request $request) { |
101 | if ($request->ajax()) { | 101 | if ($request->ajax()) { |
102 | $msg = Message::find($request->id); | 102 | $msg = Message::find($request->id); |
103 | $msg->flag_new = !($request->flag_new); | 103 | $msg->flag_new = !($request->flag_new); |
104 | $msg->save(); | 104 | $msg->save(); |
105 | } | 105 | } |
106 | 106 | ||
107 | $id_admin = Auth::user()->id; | 107 | $id_admin = Auth::user()->id; |
108 | $users = User::query()->OrderBy('name')->where('is_bd', '=', '0')->get(); | 108 | $users = User::query()->OrderBy('name')->where('is_bd', '=', '0')->get(); |
109 | 109 | ||
110 | $Msgs = Message::with('user_from')->with('user_to')->with('response') | 110 | $Msgs = Message::with('user_from')->with('user_to')->with('response') |
111 | ->where(function($query) use ($id_admin) { | 111 | ->where(function($query) use ($id_admin) { |
112 | $query->where('user_id', '=', $id_admin) | 112 | $query->where('user_id', '=', $id_admin) |
113 | ->orWhere('to_user_id', '=', $id_admin); | 113 | ->orWhere('to_user_id', '=', $id_admin); |
114 | }); | 114 | }); |
115 | 115 | ||
116 | $find_key = ''; | 116 | $find_key = ''; |
117 | $find_cat = ''; | 117 | $find_cat = ''; |
118 | 118 | ||
119 | $Msgs = $this->filter($Msgs, $request, $find_key, $find_cat); | 119 | $Msgs = $this->filter($Msgs, $request, $find_key, $find_cat); |
120 | 120 | ||
121 | $Msgs = $Msgs->orderByDesc('created_at')->paginate(5); | 121 | $Msgs = $Msgs->orderByDesc('created_at')->paginate(5); |
122 | 122 | ||
123 | if ($request->ajax()) | 123 | if ($request->ajax()) |
124 | return view('admin.message.index_ajax', compact('Msgs', 'id_admin', 'users')); | 124 | return view('admin.message.index_ajax', compact('Msgs', 'id_admin', 'users')); |
125 | else | 125 | else |
126 | return view('admin.message.index', compact('Msgs', 'id_admin', 'users', 'find_key', 'find_cat')); | 126 | return view('admin.message.index', compact('Msgs', 'id_admin', 'users', 'find_key', 'find_cat')); |
127 | } | 127 | } |
128 | 128 | ||
129 | public function messages_sql(Request $request) { | 129 | public function messages_sql(Request $request) { |
130 | $id = Auth::user()->id; | 130 | $id = Auth::user()->id; |
131 | DB::enableQueryLog(); | 131 | DB::enableQueryLog(); |
132 | //$query = DB::select('select * from users where id = :id', ['id' => 1]); | 132 | //$query = DB::select('select * from users where id = :id', ['id' => 1]); |
133 | $query = DB::select(DB::raw('SELECT u1.name as "To-user", u2.name as "From-user", m1.`text`, m1.created_at | 133 | $query = DB::select(DB::raw('SELECT u1.name as "To-user", u2.name as "From-user", m1.`text`, m1.created_at |
134 | FROM messages m1 | 134 | FROM messages m1 |
135 | JOIN (SELECT MAX(id) id FROM messages | 135 | JOIN (SELECT MAX(id) id FROM messages |
136 | GROUP BY LEAST(user_id, to_user_id), | 136 | GROUP BY LEAST(user_id, to_user_id), |
137 | GREATEST(user_id, to_user_id) | 137 | GREATEST(user_id, to_user_id) |
138 | ) m2 USING (id) | 138 | ) m2 USING (id) |
139 | JOIN users u1 ON u1.id = m1.user_id | 139 | JOIN users u1 ON u1.id = m1.user_id |
140 | JOIN users u2 ON u2.id = m1.to_user_id | 140 | JOIN users u2 ON u2.id = m1.to_user_id |
141 | Where ((m1.user_id = :uid) or (m1.to_user_id = :uid2)) | 141 | Where ((m1.user_id = :uid) or (m1.to_user_id = :uid2)) |
142 | '), ['uid' => $id, 'uid2' => $id]); | 142 | '), ['uid' => $id, 'uid2' => $id]); |
143 | //dump(DB::getQueryLog()); | 143 | //dump(DB::getQueryLog()); |
144 | dd($query); | 144 | dd($query); |
145 | return; | 145 | return; |
146 | } | 146 | } |
147 | 147 | ||
148 | public function admin_messages_post(Request $request) { | 148 | public function admin_messages_post(Request $request) { |
149 | $rules = [ | 149 | $rules = [ |
150 | 'title' => 'required|min:3|max:255', | 150 | 'title' => 'required|min:3|max:255', |
151 | 'text' => 'required|min:1' | 151 | 'text' => 'required|min:1' |
152 | ]; | 152 | ]; |
153 | 153 | ||
154 | $messages = [ | 154 | $messages = [ |
155 | 'required' => 'Поле не может быть пустым!', | 155 | 'required' => 'Поле не может быть пустым!', |
156 | ]; | 156 | ]; |
157 | 157 | ||
158 | $validator = Validator::make($request->all(), $rules, $messages); | 158 | $validator = Validator::make($request->all(), $rules, $messages); |
159 | 159 | ||
160 | if ($validator->fails()) { | 160 | if ($validator->fails()) { |
161 | return redirect()->route('admin.admin-messages')->withErrors($validator); | 161 | return redirect()->route('admin.admin-messages')->withErrors($validator); |
162 | } else { | 162 | } else { |
163 | $params = $request->all(); | 163 | $params = $request->all(); |
164 | $id_admin = Auth::user()->id; | 164 | $id_admin = Auth::user()->id; |
165 | if ($request->has('file')) { | 165 | if ($request->has('file')) { |
166 | $params['file'] = $request->file('file')->store("upload/".$id_admin, 'public'); | 166 | $params['file'] = $request->file('file')->store("upload/".$id_admin, 'public'); |
167 | } | 167 | } |
168 | Message::create($params); | 168 | Message::create($params); |
169 | return redirect()->route('admin.admin-messages'); | 169 | return redirect()->route('admin.admin-messages'); |
170 | } | 170 | } |
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 |
app/Http/Controllers/EmployerController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers; | 3 | namespace App\Http\Controllers; |
4 | 4 | ||
5 | use App\Classes\RusDate; | 5 | use App\Classes\RusDate; |
6 | use App\Classes\Tools; | 6 | use App\Classes\Tools; |
7 | use App\Http\Requests\BaseUser_min_Request; | 7 | use App\Http\Requests\BaseUser_min_Request; |
8 | use App\Http\Requests\BaseUserRequest; | 8 | use App\Http\Requests\BaseUserRequest; |
9 | use App\Http\Requests\FlotRequest; | 9 | use App\Http\Requests\FlotRequest; |
10 | use App\Http\Requests\MessagesRequiest; | 10 | use App\Http\Requests\MessagesRequiest; |
11 | use App\Http\Requests\VacancyRequestEdit; | 11 | use App\Http\Requests\VacancyRequestEdit; |
12 | use App\Http\Requests\VacansiaRequiest; | 12 | use App\Http\Requests\VacansiaRequiest; |
13 | use App\Mail\MailSotrudnichestvo; | 13 | use App\Mail\MailSotrudnichestvo; |
14 | use App\Mail\SendAllMessages; | 14 | use App\Mail\SendAllMessages; |
15 | use App\Models\Ad_employer; | 15 | use App\Models\Ad_employer; |
16 | use App\Models\Ad_jobs; | 16 | use App\Models\Ad_jobs; |
17 | use App\Models\ad_response; | 17 | use App\Models\ad_response; |
18 | use App\Models\Category; | 18 | use App\Models\Category; |
19 | use App\Models\Education; | 19 | use App\Models\Education; |
20 | use App\Models\Employer; | 20 | use App\Models\Employer; |
21 | use App\Models\employers_main; | 21 | use App\Models\employers_main; |
22 | use App\Models\Flot; | 22 | use App\Models\Flot; |
23 | use App\Models\Job_title; | 23 | use App\Models\Job_title; |
24 | use App\Models\Like_vacancy; | 24 | use App\Models\Like_vacancy; |
25 | use App\Models\Like_worker; | 25 | use App\Models\Like_worker; |
26 | use App\Models\Message; | 26 | use App\Models\Message; |
27 | use App\Models\Positions; | 27 | use App\Models\Positions; |
28 | use App\Models\Worker; | 28 | use App\Models\Worker; |
29 | use Carbon\Carbon; | 29 | use Carbon\Carbon; |
30 | use Illuminate\Auth\Events\Registered; | 30 | use Illuminate\Auth\Events\Registered; |
31 | use Illuminate\Database\Eloquent\Builder; | 31 | use Illuminate\Database\Eloquent\Builder; |
32 | use Illuminate\Database\Eloquent\Model; | 32 | use Illuminate\Database\Eloquent\Model; |
33 | use Illuminate\Foundation\Auth\User; | 33 | use Illuminate\Foundation\Auth\User; |
34 | use Illuminate\Http\Request; | 34 | use Illuminate\Http\Request; |
35 | use Illuminate\Support\Facades\Auth; | 35 | use Illuminate\Support\Facades\Auth; |
36 | use Illuminate\Support\Facades\Hash; | 36 | use Illuminate\Support\Facades\Hash; |
37 | use Illuminate\Support\Facades\Mail; | 37 | use Illuminate\Support\Facades\Mail; |
38 | use Illuminate\Support\Facades\Storage; | 38 | use Illuminate\Support\Facades\Storage; |
39 | use App\Models\User as User_Model; | 39 | use App\Models\User as User_Model; |
40 | use Illuminate\Support\Facades\Validator; | 40 | use Illuminate\Support\Facades\Validator; |
41 | 41 | ||
42 | class EmployerController extends Controller | 42 | class EmployerController extends Controller |
43 | { | 43 | { |
44 | public function vacancie($vacancy, Request $request) { | 44 | public function vacancie($vacancy, Request $request) { |
45 | $title = 'Заголовок вакансии'; | 45 | $title = 'Заголовок вакансии'; |
46 | $Query = Ad_employer::with('jobs')-> | 46 | $Query = Ad_employer::with('jobs')-> |
47 | with('cat')-> | 47 | with('cat')-> |
48 | with('employer')-> | 48 | with('employer')-> |
49 | with('jobs_code')-> | 49 | with('jobs_code')-> |
50 | select('ad_employers.*')-> | 50 | select('ad_employers.*')-> |
51 | where('id', '=', $vacancy)->get(); | 51 | where('id', '=', $vacancy)->get(); |
52 | 52 | ||
53 | if (isset(Auth()->user()->id)) | 53 | if (isset(Auth()->user()->id)) |
54 | $uid = Auth()->user()->id; | 54 | $uid = Auth()->user()->id; |
55 | else | 55 | else |
56 | $uid = 0; | 56 | $uid = 0; |
57 | $title = $Query[0]->name; | 57 | $title = $Query[0]->name; |
58 | if ($request->ajax()) { | 58 | if ($request->ajax()) { |
59 | return view('ajax.vacance-item', compact('Query','uid')); | 59 | return view('ajax.vacance-item', compact('Query','uid')); |
60 | } else { | 60 | } else { |
61 | return view('vacance-item', compact('title', 'Query', 'uid')); | 61 | return view('vacance-item', compact('title', 'Query', 'uid')); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | public function logout() { | 65 | public function logout() { |
66 | Auth::logout(); | 66 | Auth::logout(); |
67 | return redirect()->route('index') | 67 | return redirect()->route('index') |
68 | ->with('success', 'Вы вышли из личного кабинета'); | 68 | ->with('success', 'Вы вышли из личного кабинета'); |
69 | } | 69 | } |
70 | 70 | ||
71 | public function employer_info() { | 71 | public function employer_info() { |
72 | // код юзера | 72 | // код юзера |
73 | $user_info = Auth()->user(); | 73 | $user_info = Auth()->user(); |
74 | // вьюшка для вывода данных | 74 | // вьюшка для вывода данных |
75 | return view('employers.info', compact('user_info')); | 75 | return view('employers.info', compact('user_info')); |
76 | } | 76 | } |
77 | 77 | ||
78 | public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { | 78 | public function employer_info_save(User_Model $user, BaseUser_min_Request $request) { |
79 | // Все данные через реквест | 79 | // Все данные через реквест |
80 | $all = $request->all(); | 80 | $all = $request->all(); |
81 | unset($all['_token']); | 81 | unset($all['_token']); |
82 | // обновление | 82 | // обновление |
83 | $user->update($all); | 83 | $user->update($all); |
84 | return redirect()->route('employer.employer_info'); | 84 | return redirect()->route('employer.employer_info'); |
85 | } | 85 | } |
86 | 86 | ||
87 | public function cabinet() { | 87 | public function cabinet() { |
88 | $id = Auth()->user()->id; | 88 | $id = Auth()->user()->id; |
89 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 89 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
90 | WhereHas('users', | 90 | WhereHas('users', |
91 | function (Builder $query) use ($id) {$query->Where('id', $id); | 91 | function (Builder $query) use ($id) {$query->Where('id', $id); |
92 | })->get(); | 92 | })->get(); |
93 | return view('employers.cabinet45', compact('Employer')); | 93 | return view('employers.cabinet45', compact('Employer')); |
94 | } | 94 | } |
95 | 95 | ||
96 | public function slider_flot() { | 96 | public function slider_flot() { |
97 | $id = Auth()->user()->id; | 97 | $id = Auth()->user()->id; |
98 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 98 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
99 | WhereHas('users', | 99 | WhereHas('users', |
100 | function (Builder $query) use ($id) {$query->Where('id', $id); | 100 | function (Builder $query) use ($id) {$query->Where('id', $id); |
101 | })->get(); | 101 | })->get(); |
102 | return view('employers.fly-flot', compact('Employer')); | 102 | return view('employers.fly-flot', compact('Employer')); |
103 | } | 103 | } |
104 | 104 | ||
105 | public function cabinet_save(Employer $Employer, Request $request) { | 105 | public function cabinet_save(Employer $Employer, Request $request) { |
106 | $params = $request->all(); | 106 | $params = $request->all(); |
107 | $params['user_id'] = Auth()->user()->id; | 107 | $params['user_id'] = Auth()->user()->id; |
108 | $id = $Employer->id; | 108 | $id = $Employer->id; |
109 | 109 | ||
110 | if ($request->has('logo')) { | 110 | if ($request->has('logo')) { |
111 | if (!empty($Employer->logo)) { | 111 | if (!empty($Employer->logo)) { |
112 | Storage::delete($Employer->logo); | 112 | Storage::delete($Employer->logo); |
113 | } | 113 | } |
114 | $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); | 114 | $params['logo'] = $request->file('logo')->store("employer/$id", 'public'); |
115 | } | 115 | } |
116 | 116 | ||
117 | $Employer->update($params); | 117 | $Employer->update($params); |
118 | 118 | ||
119 | return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); | 119 | return redirect()->route('employer.cabinet')->with('success', 'Данные были успешно сохранены'); |
120 | } | 120 | } |
121 | 121 | ||
122 | public function save_add_flot(FlotRequest $request) { | 122 | public function save_add_flot(FlotRequest $request) { |
123 | // отмена | 123 | // отмена |
124 | $params = $request->all(); | 124 | $params = $request->all(); |
125 | 125 | ||
126 | if ($request->has('image')) { | 126 | if ($request->has('image')) { |
127 | $params['image'] = $request->file('image')->store("flot", 'public'); | 127 | $params['image'] = $request->file('image')->store("flot", 'public'); |
128 | } | 128 | } |
129 | Flot::create($params); | 129 | Flot::create($params); |
130 | $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); | 130 | $data_flots = Flot::query()->where('employer_id', $request->get('employer_if'))->get(); |
131 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); | 131 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); |
132 | } | 132 | } |
133 | 133 | ||
134 | public function edit_flot(Flot $Flot, Employer $Employer) { | 134 | public function edit_flot(Flot $Flot, Employer $Employer) { |
135 | return view('employers.edit-flot', compact('Flot', 'Employer')); | 135 | return view('employers.edit-flot', compact('Flot', 'Employer')); |
136 | } | 136 | } |
137 | 137 | ||
138 | public function update_flot(FlotRequest $request, Flot $Flot) { | 138 | public function update_flot(FlotRequest $request, Flot $Flot) { |
139 | $params = $request->all(); | 139 | $params = $request->all(); |
140 | 140 | ||
141 | if ($request->has('image')) { | 141 | if ($request->has('image')) { |
142 | if (!empty($flot->image)) { | 142 | if (!empty($flot->image)) { |
143 | Storage::delete($flot->image); | 143 | Storage::delete($flot->image); |
144 | } | 144 | } |
145 | $params['image'] = $request->file('image')->store("flot", 'public'); | 145 | $params['image'] = $request->file('image')->store("flot", 'public'); |
146 | } else { | 146 | } else { |
147 | if (!empty($flot->image)) $params['image'] = $flot->image; | 147 | if (!empty($flot->image)) $params['image'] = $flot->image; |
148 | } | 148 | } |
149 | 149 | ||
150 | $Flot->update($params); | 150 | $Flot->update($params); |
151 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); | 151 | return redirect()->route('employer.slider_flot')->with('success', 'Новый корабль был добавлен'); |
152 | } | 152 | } |
153 | 153 | ||
154 | public function delete_flot(Flot $Flot) { | 154 | public function delete_flot(Flot $Flot) { |
155 | $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); | 155 | $data_flots = Flot::query()->where('employer_id', $Flot->employer_id)->get(); |
156 | 156 | ||
157 | if (isset($Flot->id)) $Flot->delete(); | 157 | if (isset($Flot->id)) $Flot->delete(); |
158 | return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); | 158 | return redirect()->route('employer.slider_flot')->with('success', 'Корабль был удален'); |
159 | } | 159 | } |
160 | 160 | ||
161 | // Форма добавления вакансий | 161 | // Форма добавления вакансий |
162 | public function cabinet_vacancie() { | 162 | public function cabinet_vacancie() { |
163 | $id = Auth()->user()->id; | 163 | $id = Auth()->user()->id; |
164 | 164 | ||
165 | if (Auth()->user()->is_public) { | 165 | if (Auth()->user()->is_public) { |
166 | $categories = Category::query()->active()->get(); | 166 | $categories = Category::query()->active()->get(); |
167 | 167 | ||
168 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> | 168 | $jobs = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> |
169 | where('is_remove', '=', '0')-> | 169 | where('is_remove', '=', '0')-> |
170 | where('is_bd', '=', '0')-> | 170 | where('is_bd', '=', '0')-> |
171 | get(); | 171 | get(); |
172 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 172 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
173 | 173 | ||
174 | WhereHas('users', | 174 | WhereHas('users', |
175 | function (Builder $query) use ($id) { | 175 | function (Builder $query) use ($id) { |
176 | $query->Where('id', $id); | 176 | $query->Where('id', $id); |
177 | })->get(); | 177 | })->get(); |
178 | 178 | ||
179 | return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); | 179 | return view('employers.add_vacancy', compact('Employer', 'jobs', 'categories')); |
180 | } else { | 180 | } else { |
181 | return redirect()->route('employer.cabinet_vacancie_danger'); | 181 | return redirect()->route('employer.cabinet_vacancie_danger'); |
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | // Форма предупреждения об оплате | 185 | // Форма предупреждения об оплате |
186 | public function cabinet_vacancie_danger() { | 186 | public function cabinet_vacancie_danger() { |
187 | return view('employers.add_vacancy_danger'); | 187 | return view('employers.add_vacancy_danger'); |
188 | } | 188 | } |
189 | 189 | ||
190 | // Сохранение вакансии | 190 | // Сохранение вакансии |
191 | public function cabinet_vacancy_save1(VacancyRequestEdit $request) { | 191 | public function cabinet_vacancy_save1(VacancyRequestEdit $request) { |
192 | $params_emp = $request->all(); | 192 | $params_emp = $request->all(); |
193 | 193 | ||
194 | $params_job["job_title_id"] = $params_emp['job_title_id']; | 194 | $params_job["job_title_id"] = $params_emp['job_title_id']; |
195 | //$params_job["min_salary"] = $params_emp['min_salary']; | 195 | //$params_job["min_salary"] = $params_emp['min_salary']; |
196 | //$params_job["max_salary"] = $params_emp['max_salary']; | 196 | //$params_job["max_salary"] = $params_emp['max_salary']; |
197 | //$params_job["region"] = $params_emp['region']; | 197 | //$params_job["region"] = $params_emp['region']; |
198 | //$params_job["power"] = $params_emp['power']; | 198 | //$params_job["power"] = $params_emp['power']; |
199 | //$params_job["sytki"] = $params_emp['sytki']; | 199 | //$params_job["sytki"] = $params_emp['sytki']; |
200 | //$params_job["start"] = $params_emp['start']; | 200 | //$params_job["start"] = $params_emp['start']; |
201 | //$params_job["flot"] = $params_emp['flot']; | 201 | //$params_job["flot"] = $params_emp['flot']; |
202 | //$params_job["description"] = $params_emp['description']; | 202 | //$params_job["description"] = $params_emp['description']; |
203 | 203 | ||
204 | $ad_jobs = Ad_employer::create($params_emp); | 204 | $ad_jobs = Ad_employer::create($params_emp); |
205 | //$params_job['ad_employer_id'] = $ad_jobs->id; | 205 | //$params_job['ad_employer_id'] = $ad_jobs->id; |
206 | //Ad_jobs::create($params_job); | 206 | //Ad_jobs::create($params_job); |
207 | $ad_jobs->jobs()->sync($request->get('job_title_id')); | 207 | $ad_jobs->jobs()->sync($request->get('job_title_id')); |
208 | 208 | ||
209 | return redirect()->route('employer.vacancy_list'); | 209 | return redirect()->route('employer.vacancy_list'); |
210 | } | 210 | } |
211 | 211 | ||
212 | // Список вакансий | 212 | // Список вакансий |
213 | public function vacancy_list(Request $request) { | 213 | public function vacancy_list(Request $request) { |
214 | $id = Auth()->user()->id; | 214 | $id = Auth()->user()->id; |
215 | 215 | ||
216 | //dd($request->all()); | 216 | //dd($request->all()); |
217 | $Employer = Employer::query()->where('user_id', $id)->first(); | 217 | $Employer = Employer::query()->where('user_id', $id)->first(); |
218 | $vacancy_list = Ad_employer::query()->with('jobs')-> | 218 | $vacancy_list = Ad_employer::query()->with('jobs')-> |
219 | with('jobs_code')-> | 219 | with('jobs_code')-> |
220 | where('employer_id', $Employer->id); | 220 | where('employer_id', $Employer->id); |
221 | 221 | ||
222 | if (($request->has('search')) && (!empty($request->get('search')))) { | 222 | if (($request->has('search')) && (!empty($request->get('search')))) { |
223 | $search = $request->get('search'); | 223 | $search = $request->get('search'); |
224 | $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%"); | 224 | $vacancy_list = $vacancy_list->where('name', 'LIKE', "%$search%"); |
225 | } | 225 | } |
226 | 226 | ||
227 | if ($request->get('sort')) { | 227 | if ($request->get('sort')) { |
228 | $sort = $request->get('sort'); | 228 | $sort = $request->get('sort'); |
229 | switch ($sort) { | 229 | switch ($sort) { |
230 | case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break; | 230 | case 'name_up': $vacancy_list = $vacancy_list->orderBy('name')->orderBy('id'); break; |
231 | case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break; | 231 | case 'name_down': $vacancy_list = $vacancy_list->orderByDesc('name')->orderby('id'); break; |
232 | case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break; | 232 | case 'created_at_up': $vacancy_list = $vacancy_list->OrderBy('created_at')->orderBy('id'); break; |
233 | case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break; | 233 | case 'created_at_down': $vacancy_list = $vacancy_list->orderByDesc('created_at')->orderBy('id'); break; |
234 | case 'default': $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; | 234 | case 'default': $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; |
235 | default: $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; | 235 | default: $vacancy_list = $vacancy_list->orderBy('id')->orderby('updated_at'); break; |
236 | } | 236 | } |
237 | } | 237 | } |
238 | $vacancy_list = $vacancy_list->paginate(4); | 238 | $vacancy_list = $vacancy_list->paginate(4); |
239 | 239 | ||
240 | //ajax | 240 | //ajax |
241 | if ($request->ajax()) { | 241 | if ($request->ajax()) { |
242 | return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); | 242 | return view('employers.ajax.list_vacancy', compact('vacancy_list', 'Employer')); |
243 | } else { | 243 | } else { |
244 | return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); | 244 | return view('employers.list_vacancy', compact('vacancy_list', 'Employer')); |
245 | } | 245 | } |
246 | } | 246 | } |
247 | 247 | ||
248 | // Карточка вакансии | 248 | // Карточка вакансии |
249 | public function vacancy_edit(Ad_employer $ad_employer) { | 249 | public function vacancy_edit(Ad_employer $ad_employer) { |
250 | $id = Auth()->user()->id; | 250 | $id = Auth()->user()->id; |
251 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); | 251 | $Positions = Category::query()->where('is_remove', '=', '0')->get(); |
252 | 252 | ||
253 | $jobs = Job_title::query()->OrderBy('name')-> | 253 | $jobs = Job_title::query()->OrderBy('name')-> |
254 | where('is_remove', 0)->where('is_bd', '=' , '0')->get(); | 254 | where('is_remove', 0)->where('is_bd', '=' , '0')->get(); |
255 | 255 | ||
256 | 256 | ||
257 | $jobs = Job_title::query()->OrderBy('name')->where('is_remove', 0)->get(); | 257 | $jobs = Job_title::query()->OrderBy('name')->where('is_remove', 0)->get(); |
258 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> | 258 | $Employer = Employer::query()->with('users')->with('ads')->with('flots')-> |
259 | where('user_id', $id)->first(); | 259 | where('user_id', $id)->first(); |
260 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); | 260 | return view('employers.edit_vacancy', compact('ad_employer', 'Positions','Employer', 'jobs')); |
261 | } | 261 | } |
262 | 262 | ||
263 | // Сохранение-редактирование записи | 263 | // Сохранение-редактирование записи |
264 | public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { | 264 | public function vacancy_save_me(VacancyRequestEdit $request, Ad_employer $ad_employer) { |
265 | $params = $request->all(); | 265 | $params = $request->all(); |
266 | 266 | ||
267 | //$jobs['flot'] = $params['flot']; | 267 | //$jobs['flot'] = $params['flot']; |
268 | //$jobs['job_title_id'] = $params['job_title_id']; | 268 | //$jobs['job_title_id'] = $params['job_title_id']; |
269 | //$titles['position_id'] = $params['position_id']; | 269 | //$titles['position_id'] = $params['position_id']; |
270 | //unset($params['job_title_id']); | 270 | //unset($params['job_title_id']); |
271 | 271 | ||
272 | $ad_employer->update($params); | 272 | $ad_employer->update($params); |
273 | 273 | ||
274 | //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])-> | 274 | //$job_ = Ad_jobs::query()->where('job_title_id', $jobs['job_title_id'])-> |
275 | // where('ad_employer_id', $ad_employer->id)->first(); | 275 | // where('ad_employer_id', $ad_employer->id)->first(); |
276 | //$data = Ad_jobs::find($job_->id); | 276 | //$data = Ad_jobs::find($job_->id); |
277 | //$ad_jobs = $data->update($jobs); | 277 | //$ad_jobs = $data->update($jobs); |
278 | return redirect()->route('employer.vacancy_list'); | 278 | return redirect()->route('employer.vacancy_list'); |
279 | } | 279 | } |
280 | 280 | ||
281 | // Сохранение карточки вакансии | 281 | // Сохранение карточки вакансии |
282 | public function vacancy_save(Request $request, Ad_employer $ad_employer) { | 282 | public function vacancy_save(Request $request, Ad_employer $ad_employer) { |
283 | $all = $request->all(); | 283 | $all = $request->all(); |
284 | $ad_employer->update($all); | 284 | $ad_employer->update($all); |
285 | return redirect()->route('employer.cabinet_vacancie'); | 285 | return redirect()->route('employer.cabinet_vacancie'); |
286 | } | 286 | } |
287 | 287 | ||
288 | // Удаление карточки вакансии | 288 | // Удаление карточки вакансии |
289 | public function vacancy_delete(Ad_employer $ad_employer) { | 289 | public function vacancy_delete(Ad_employer $ad_employer) { |
290 | $ad_employer->delete(); | 290 | $ad_employer->delete(); |
291 | 291 | ||
292 | return redirect()->route('employer.vacancy_list') | 292 | return redirect()->route('employer.vacancy_list') |
293 | ->with('success', 'Данные были успешно сохранены'); | 293 | ->with('success', 'Данные были успешно сохранены'); |
294 | } | 294 | } |
295 | 295 | ||
296 | // Обновление даты | 296 | // Обновление даты |
297 | public function vacancy_up(Ad_employer $ad_employer) { | 297 | public function vacancy_up(Ad_employer $ad_employer) { |
298 | $up = date('m/d/Y h:i:s', time());; | 298 | $up = date('m/d/Y h:i:s', time());; |
299 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); | 299 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); |
300 | $vac_emp->updated_at = $up; | 300 | $vac_emp->updated_at = $up; |
301 | $vac_emp->save(); | 301 | $vac_emp->save(); |
302 | 302 | ||
303 | return redirect()->route('employer.vacancy_list'); | 303 | return redirect()->route('employer.vacancy_list'); |
304 | // начало конца | 304 | // начало конца |
305 | } | 305 | } |
306 | 306 | ||
307 | //Видимость вакансии | 307 | //Видимость вакансии |
308 | public function vacancy_eye(Ad_employer $ad_employer, $status) { | 308 | public function vacancy_eye(Ad_employer $ad_employer, $status) { |
309 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); | 309 | $vac_emp = Ad_employer::findOrFail($ad_employer->id); |
310 | $vac_emp->active_is = $status; | 310 | $vac_emp->active_is = $status; |
311 | $vac_emp->save(); | 311 | $vac_emp->save(); |
312 | 312 | ||
313 | return redirect()->route('employer.vacancy_list'); | 313 | return redirect()->route('employer.vacancy_list'); |
314 | } | 314 | } |
315 | 315 | ||
316 | //Вакансия редактирования (шаблон) | 316 | //Вакансия редактирования (шаблон) |
317 | public function vacancy_update(Ad_employer $id) { | 317 | public function vacancy_update(Ad_employer $id) { |
318 | 318 | ||
319 | } | 319 | } |
320 | 320 | ||
321 | //Отклики на вакансию - лист | 321 | //Отклики на вакансию - лист |
322 | public function answers(Employer $employer, Request $request) { | 322 | public function answers(Employer $employer, Request $request) { |
323 | $user_id = Auth()->user()->id; | 323 | $user_id = Auth()->user()->id; |
324 | $answer = Ad_employer::query()->where('employer_id', $employer->id); | 324 | $answer = Ad_employer::query()->where('employer_id', $employer->id); |
325 | if ($request->has('search')) { | 325 | if ($request->has('search')) { |
326 | $search = trim($request->get('search')); | 326 | $search = trim($request->get('search')); |
327 | if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); | 327 | if (!empty($search)) $answer = $answer->where('name', 'LIKE', "%$search%"); |
328 | } | 328 | } |
329 | 329 | ||
330 | $answer = $answer->with('response')->OrderByDESC('id')->get(); | 330 | $answer = $answer->with('response')->OrderByDESC('id')->get(); |
331 | 331 | ||
332 | return view('employers.list_answer', compact('answer', 'user_id', 'employer')); | 332 | return view('employers.list_answer', compact('answer', 'user_id', 'employer')); |
333 | } | 333 | } |
334 | 334 | ||
335 | //Обновление статуса | 335 | //Обновление статуса |
336 | public function supple_status(employer $employer, ad_response $ad_response, $flag) { | 336 | public function supple_status(employer $employer, ad_response $ad_response, $flag) { |
337 | $ad_response->update(Array('flag' => $flag)); | 337 | $ad_response->update(Array('flag' => $flag)); |
338 | return redirect()->route('employer.answers', ['employer' => $employer->id]); | 338 | return redirect()->route('employer.answers', ['employer' => $employer->id]); |
339 | } | 339 | } |
340 | 340 | ||
341 | //Страницы сообщений список | 341 | //Страницы сообщений список |
342 | public function messages($type_message) { | 342 | public function messages($type_message) { |
343 | $user_id = Auth()->user()->id; | 343 | $user_id = Auth()->user()->id; |
344 | 344 | ||
345 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> | 345 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> |
346 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); | 346 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); |
347 | 347 | ||
348 | $messages_output = Message::query()->with('vacancies')-> | 348 | $messages_output = Message::query()->with('vacancies')-> |
349 | with('user_to')->where('user_id', $user_id)-> | 349 | with('user_to')->where('user_id', $user_id)-> |
350 | OrderByDesc('created_at'); | 350 | OrderByDesc('created_at'); |
351 | 351 | ||
352 | |||
353 | $count_input = $messages_input->count(); | 352 | $count_input = $messages_input->count(); |
354 | $count_output = $messages_output->count(); | 353 | $count_output = $messages_output->count(); |
355 | 354 | ||
356 | if ($type_message == 'input') { | 355 | if ($type_message == 'input') { |
357 | $messages = $messages_input->paginate(5); | 356 | $messages = $messages_input->paginate(5); |
358 | } | 357 | } |
359 | 358 | ||
360 | if ($type_message == 'output') { | 359 | if ($type_message == 'output') { |
361 | $messages = $messages_output->paginate(5); | 360 | $messages = $messages_output->paginate(5); |
362 | } | 361 | } |
363 | 362 | ||
364 | //dd($user_id, $messages[2]->vacancies); | 363 | //dd($user_id, $messages[2]->vacancies); |
365 | //jobs); | 364 | //jobs); |
366 | 365 | ||
367 | return view('employers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); | 366 | return view('employers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); |
368 | } | 367 | } |
369 | 368 | ||
370 | // Диалог между пользователями | 369 | // Диалог между пользователями |
371 | public function dialog(Request $request, User_Model $user1, User_Model $user2) { | 370 | public function dialog(Request $request, User_Model $user1, User_Model $user2) { |
372 | // Получение параметров. | 371 | // Получение параметров. |
373 | if ($request->has('ad_employer')){ | 372 | if ($request->has('ad_employer')){ |
374 | $ad_employer = $request->get('ad_employer'); | 373 | $ad_employer = $request->get('ad_employer'); |
375 | } else { | 374 | } else { |
376 | $ad_employer = 0; | 375 | $ad_employer = 0; |
377 | } | 376 | } |
378 | 377 | ||
379 | if (isset($user2->id)) { | 378 | if (isset($user2->id)) { |
380 | $companion = User_Model::query()->with('workers')-> | 379 | $companion = User_Model::query()->with('workers')-> |
381 | with('employers')-> | 380 | with('employers')-> |
382 | where('id', $user2->id)->first(); | 381 | where('id', $user2->id)->first(); |
383 | } | 382 | } |
384 | 383 | ||
385 | $Messages = Message::query()-> | 384 | $Messages = Message::query()-> |
386 | where('ad_employer_id', '=', $ad_employer)-> | 385 | where('ad_employer_id', '=', $ad_employer)-> |
387 | where(function($query) use ($user1, $user2) { | 386 | where(function($query) use ($user1, $user2) { |
388 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); | 387 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); |
389 | })->orWhere(function($query) use ($user1, $user2) { | 388 | })->orWhere(function($query) use ($user1, $user2) { |
390 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); | 389 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); |
391 | })->where('ad_employer_id', '=', $ad_employer)->OrderBy('created_at')->get(); | 390 | })->where('ad_employer_id', '=', $ad_employer)->OrderBy('created_at')->get(); |
392 | 391 | ||
393 | $id_vac = $Messages[$Messages->count() - 1]->ad_employer_id; | 392 | $id_vac = $Messages[$Messages->count() - 1]->ad_employer_id; |
394 | 393 | ||
395 | //$ad_employer = null; | 394 | //$ad_employer = null; |
396 | //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); | 395 | //if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); |
397 | $sender = $user1; | 396 | $sender = $user1; |
398 | 397 | ||
399 | return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); | 398 | return view('employers.dialog', compact('companion', 'sender', 'ad_employer', 'Messages')); |
400 | } | 399 | } |
401 | 400 | ||
402 | // Регистрация работодателя | 401 | // Регистрация работодателя |
403 | public function register_employer(Request $request) { | 402 | public function register_employer(Request $request) { |
404 | $params = $request->all(); | 403 | $params = $request->all(); |
405 | 404 | ||
406 | $rules = [ | 405 | $rules = [ |
407 | //'surname' => ['required', 'string', 'max:255'], | 406 | //'surname' => ['required', 'string', 'max:255'], |
408 | //'name_man' => ['required', 'string', 'max:255'], | 407 | //'name_man' => ['required', 'string', 'max:255'], |
409 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], | 408 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], |
410 | 'name_company' => ['required', 'string', 'max:255'], | 409 | 'name_company' => ['required', 'string', 'max:255'], |
411 | 'password' => ['required', 'string', 'min:6'], | 410 | 'password' => ['required', 'string', 'min:6'], |
412 | ]; | 411 | ]; |
413 | 412 | ||
414 | 413 | ||
415 | $messages = [ | 414 | $messages = [ |
416 | 'required' => 'Укажите обязательное поле', | 415 | 'required' => 'Укажите обязательное поле', |
417 | 'min' => [ | 416 | 'min' => [ |
418 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 417 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
419 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 418 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
420 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 419 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
421 | ], | 420 | ], |
422 | 'max' => [ | 421 | 'max' => [ |
423 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 422 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
424 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 423 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
425 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 424 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
426 | ] | 425 | ] |
427 | ]; | 426 | ]; |
428 | 427 | ||
429 | $email = $request->get('email'); | 428 | $email = $request->get('email'); |
430 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { | 429 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { |
431 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); | 430 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); |
432 | } | 431 | } |
433 | 432 | ||
434 | if ($request->get('password') !== $request->get('confirmed')){ | 433 | if ($request->get('password') !== $request->get('confirmed')){ |
435 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); | 434 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); |
436 | } | 435 | } |
437 | 436 | ||
438 | if (strlen($request->get('password')) < 6) { | 437 | if (strlen($request->get('password')) < 6) { |
439 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); | 438 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); |
440 | } | 439 | } |
441 | /* | 440 | /* |
442 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); | 441 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); |
443 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', | 442 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', |
444 | 'X', 'C', 'V', 'B', 'N', 'M'); | 443 | 'X', 'C', 'V', 'B', 'N', 'M'); |
445 | $spec_bool = false; | 444 | $spec_bool = false; |
446 | $alpha_bool = false; | 445 | $alpha_bool = false; |
447 | 446 | ||
448 | $haystack = $request->get('password'); | 447 | $haystack = $request->get('password'); |
449 | 448 | ||
450 | foreach ($specsumbol as $it) { | 449 | foreach ($specsumbol as $it) { |
451 | if (strpos($haystack, $it) !== false) { | 450 | if (strpos($haystack, $it) !== false) { |
452 | $spec_bool = true; | 451 | $spec_bool = true; |
453 | } | 452 | } |
454 | } | 453 | } |
455 | 454 | ||
456 | foreach ($alpha as $it) { | 455 | foreach ($alpha as $it) { |
457 | if (strpos($haystack, $it) !== false) { | 456 | if (strpos($haystack, $it) !== false) { |
458 | $alpha_bool = true; | 457 | $alpha_bool = true; |
459 | } | 458 | } |
460 | } | 459 | } |
461 | 460 | ||
462 | if ((!$spec_bool) || (!$alpha_bool)) { | 461 | if ((!$spec_bool) || (!$alpha_bool)) { |
463 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); | 462 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); |
464 | }*/ | 463 | }*/ |
465 | 464 | ||
466 | if (empty($request->get('surname'))) { | 465 | if (empty($request->get('surname'))) { |
467 | $params['surname'] = 'Неизвестно'; | 466 | $params['surname'] = 'Неизвестно'; |
468 | } | 467 | } |
469 | if (empty($request->get('name_man'))) { | 468 | if (empty($request->get('name_man'))) { |
470 | $params['name_man'] = 'Неизвестно'; | 469 | $params['name_man'] = 'Неизвестно'; |
471 | } | 470 | } |
472 | $validator = Validator::make($params, $rules, $messages); | 471 | $validator = Validator::make($params, $rules, $messages); |
473 | 472 | ||
474 | if ($validator->fails()) { | 473 | if ($validator->fails()) { |
475 | return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); | 474 | return json_encode(Array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); |
476 | } else { | 475 | } else { |
477 | $user = $this->create($params); | 476 | $user = $this->create($params); |
478 | event(new Registered($user)); | 477 | event(new Registered($user)); |
479 | Auth::guard()->login($user); | 478 | Auth::guard()->login($user); |
480 | } | 479 | } |
481 | 480 | ||
482 | if ($user) { | 481 | if ($user) { |
483 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; | 482 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl()));; |
484 | } else { | 483 | } else { |
485 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); | 484 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); |
486 | } | 485 | } |
487 | } | 486 | } |
488 | 487 | ||
489 | // Создание пользователя | 488 | // Создание пользователя |
490 | protected function create(array $data) | 489 | protected function create(array $data) |
491 | { | 490 | { |
492 | $Use = new User_Model(); | 491 | $Use = new User_Model(); |
493 | $Code_user = $Use->create([ | 492 | $Code_user = $Use->create([ |
494 | 'name' => $data['surname']." ".$data['name_man'], | 493 | 'name' => $data['surname']." ".$data['name_man'], |
495 | 'name_man' => $data['name_man'], | 494 | 'name_man' => $data['name_man'], |
496 | 'surname' => $data['surname'], | 495 | 'surname' => $data['surname'], |
497 | 'surname2' => $data['surname2'], | 496 | 'surname2' => $data['surname2'], |
498 | 'subscribe_email' => $data['email'], | 497 | 'subscribe_email' => $data['email'], |
499 | 'email' => $data['email'], | 498 | 'email' => $data['email'], |
500 | 'telephone' => $data['telephone'], | 499 | 'telephone' => $data['telephone'], |
501 | 'is_worker' => 0, | 500 | 'is_worker' => 0, |
502 | 'password' => Hash::make($data['password']), | 501 | 'password' => Hash::make($data['password']), |
503 | 'pubpassword' => base64_encode($data['password']), | 502 | 'pubpassword' => base64_encode($data['password']), |
504 | 'email_verified_at' => Carbon::now() | 503 | 'email_verified_at' => Carbon::now() |
505 | ]); | 504 | ]); |
506 | 505 | ||
507 | if ($Code_user->id > 0) { | 506 | if ($Code_user->id > 0) { |
508 | $Employer = new Employer(); | 507 | $Employer = new Employer(); |
509 | $Employer->user_id = $Code_user->id; | 508 | $Employer->user_id = $Code_user->id; |
510 | $Employer->name_company = $data['name_company']; | 509 | $Employer->name_company = $data['name_company']; |
511 | $Employer->email = $data['email']; | 510 | $Employer->email = $data['email']; |
512 | $Employer->telephone = $data['telephone']; | 511 | $Employer->telephone = $data['telephone']; |
513 | $Employer->code = Tools::generator_id(10); | 512 | $Employer->code = Tools::generator_id(10); |
514 | $Employer->save(); | 513 | $Employer->save(); |
515 | 514 | ||
516 | return $Code_user; | 515 | return $Code_user; |
517 | } | 516 | } |
518 | } | 517 | } |
519 | 518 | ||
520 | // Отправка сообщения от работодателя | 519 | // Отправка сообщения от работодателя |
521 | public function send_message(MessagesRequiest $request) { | 520 | public function send_message(MessagesRequiest $request) { |
522 | $params = $request->all(); | 521 | $params = $request->all(); |
523 | dd($params); | 522 | dd($params); |
524 | $user1 = $params['user_id']; | 523 | $user1 = $params['user_id']; |
525 | $user2 = $params['to_user_id']; | 524 | $user2 = $params['to_user_id']; |
526 | 525 | ||
527 | if ($request->has('file')) { | 526 | if ($request->has('file')) { |
528 | $params['file'] = $request->file('file')->store("messages", 'public'); | 527 | $params['file'] = $request->file('file')->store("messages", 'public'); |
529 | } | 528 | } |
530 | Message::create($params); | 529 | Message::create($params); |
531 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); | 530 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); |
532 | } | 531 | } |
533 | 532 | ||
534 | public function test123(Request $request) { | 533 | public function test123(Request $request) { |
535 | $params = $request->all(); | 534 | $params = $request->all(); |
536 | $user1 = $params['user_id']; | 535 | $user1 = $params['user_id']; |
537 | $user2 = $params['to_user_id']; | 536 | $user2 = $params['to_user_id']; |
537 | $id_vacancy = $params['ad_employer_id']; | ||
538 | $ad_name = $params['ad_name']; | ||
538 | 539 | ||
539 | $rules = [ | 540 | $rules = [ |
540 | 'text' => 'required|min:1|max:150000', | 541 | 'text' => 'required|min:1|max:150000', |
541 | 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' | 542 | 'file' => 'file|mimes:doc,docx,xlsx,csv,txt,xlx,xls,pdf|max:150000' |
542 | ]; | 543 | ]; |
543 | $messages = [ | 544 | $messages = [ |
544 | 'required' => 'Укажите обязательное поле', | 545 | 'required' => 'Укажите обязательное поле', |
545 | 'min' => [ | 546 | 'min' => [ |
546 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 547 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
547 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 548 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
548 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 549 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
549 | ], | 550 | ], |
550 | 'max' => [ | 551 | 'max' => [ |
551 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 552 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
552 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 553 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
553 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 554 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
554 | ] | 555 | ] |
555 | ]; | 556 | ]; |
556 | 557 | ||
557 | $validator = Validator::make($request->all(), $rules, $messages); | 558 | $validator = Validator::make($request->all(), $rules, $messages); |
558 | 559 | ||
559 | if ($validator->fails()) { | 560 | if ($validator->fails()) { |
560 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]) | 561 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]) |
561 | ->withErrors($validator); | 562 | ->withErrors($validator); |
562 | } else { | 563 | } else { |
563 | if ($request->has('file')) { | 564 | if ($request->has('file')) { |
564 | $params['file'] = $request->file('file')->store("messages", 'public'); | 565 | $params['file'] = $request->file('file')->store("messages", 'public'); |
565 | } | 566 | } |
566 | Message::create($params); | 567 | Message::create($params); |
567 | return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); | 568 | //return redirect()->route('employer.dialog', ['user1' => $user1, 'user2' => $user2]); |
569 | return redirect()->route('employer.dialog', | ||
570 | ['user1' => $user1, 'user2' => $user2, 'ad_employer' => $id_vacancy, 'ad_name' => $ad_name]); | ||
568 | 571 | ||
569 | } | 572 | } |
570 | } | 573 | } |
571 | 574 | ||
572 | //Избранные люди | 575 | //Избранные люди |
573 | public function favorites(Request $request) { | 576 | public function favorites(Request $request) { |
574 | $IP_address = RusDate::ip_addr_client(); | 577 | $IP_address = RusDate::ip_addr_client(); |
575 | $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); | 578 | $Arr = Like_worker::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); |
576 | 579 | ||
577 | if ($Arr->count()) { | 580 | if ($Arr->count()) { |
578 | $A = Array(); | 581 | $A = Array(); |
579 | foreach ($Arr as $it) { | 582 | foreach ($Arr as $it) { |
580 | $A[] = $it->code_record; | 583 | $A[] = $it->code_record; |
581 | } | 584 | } |
582 | 585 | ||
583 | $Workers = Worker::query()->whereIn('id', $A); | 586 | $Workers = Worker::query()->whereIn('id', $A); |
584 | } else { | 587 | } else { |
585 | $Workers = Worker::query()->where('id', '=', '0'); | 588 | $Workers = Worker::query()->where('id', '=', '0'); |
586 | } | 589 | } |
587 | 590 | ||
588 | if (($request->has('search')) && (!empty($request->get('search')))) { | 591 | if (($request->has('search')) && (!empty($request->get('search')))) { |
589 | $search = $request->get('search'); | 592 | $search = $request->get('search'); |
590 | 593 | ||
591 | $Workers = $Workers->WhereHas('users', | 594 | $Workers = $Workers->WhereHas('users', |
592 | function (Builder $query) use ($search) { | 595 | function (Builder $query) use ($search) { |
593 | $query->Where('surname', 'LIKE', "%$search%") | 596 | $query->Where('surname', 'LIKE', "%$search%") |
594 | ->orWhere('name_man', 'LIKE', "%$search%") | 597 | ->orWhere('name_man', 'LIKE', "%$search%") |
595 | ->orWhere('surname2', 'LIKE', "%$search%"); | 598 | ->orWhere('surname2', 'LIKE', "%$search%"); |
596 | }); | 599 | }); |
597 | } else { | 600 | } else { |
598 | $Workers = $Workers->with('users'); | 601 | $Workers = $Workers->with('users'); |
599 | } | 602 | } |
600 | 603 | ||
601 | $Workers = $Workers->get(); | 604 | $Workers = $Workers->get(); |
602 | 605 | ||
603 | 606 | ||
604 | return view('employers.favorite', compact('Workers')); | 607 | return view('employers.favorite', compact('Workers')); |
605 | } | 608 | } |
606 | 609 | ||
607 | // База данных | 610 | // База данных |
608 | public function bd(Request $request) { | 611 | public function bd(Request $request) { |
609 | // для типа BelongsTo | 612 | // для типа BelongsTo |
610 | //$documents = Document::query()->orderBy(Location::select('name') | 613 | //$documents = Document::query()->orderBy(Location::select('name') |
611 | // ->whereColumn('locations.id', 'documents.location_id') | 614 | // ->whereColumn('locations.id', 'documents.location_id') |
612 | //); | 615 | //); |
613 | 616 | ||
614 | // для типа HasOne/Many | 617 | // для типа HasOne/Many |
615 | // $documents = Document::::query()->orderBy(Location::select('name') | 618 | // $documents = Document::::query()->orderBy(Location::select('name') |
616 | // ->whereColumn('locations.document_id', 'documents.id') | 619 | // ->whereColumn('locations.document_id', 'documents.id') |
617 | //); | 620 | //); |
618 | 621 | ||
619 | 622 | ||
620 | $users = User_Model::query()->with('workers'); | 623 | $users = User_Model::query()->with('workers'); |
621 | 624 | ||
622 | if ($request->has('search')) { | 625 | if ($request->has('search')) { |
623 | $find_key = $request->get('search'); | 626 | $find_key = $request->get('search'); |
624 | $users = $users->where('name', 'LIKE', "%$find_key%") | 627 | $users = $users->where('name', 'LIKE', "%$find_key%") |
625 | ->orWhere('surname', 'LIKE', "%$find_key%") | 628 | ->orWhere('surname', 'LIKE', "%$find_key%") |
626 | ->orWhere('name_man', 'LIKE', "%$find_key%") | 629 | ->orWhere('name_man', 'LIKE', "%$find_key%") |
627 | ->orWhere('email', 'LIKE', "%$find_key%") | 630 | ->orWhere('email', 'LIKE', "%$find_key%") |
628 | ->orWhere('telephone', 'LIKE', "%$find_key%"); | 631 | ->orWhere('telephone', 'LIKE', "%$find_key%"); |
629 | } | 632 | } |
630 | 633 | ||
631 | // Данные | 634 | // Данные |
632 | $users = $users->Baseuser()-> | 635 | $users = $users->Baseuser()-> |
633 | orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id')); | 636 | orderBy(Worker::select('position_work')->whereColumn('Workers.user_id', 'users.id')); |
634 | $count_users = $users; | 637 | $count_users = $users; |
635 | $users = $users->paginate(5); | 638 | $users = $users->paginate(5); |
636 | 639 | ||
637 | 640 | ||
638 | return view('employers.bd', compact('users', 'count_users')); | 641 | return view('employers.bd', compact('users', 'count_users')); |
639 | } | 642 | } |
640 | 643 | ||
641 | //Настройка уведомлений | 644 | //Настройка уведомлений |
642 | public function subscribe() { | 645 | public function subscribe() { |
643 | return view('employers.subcribe'); | 646 | return view('employers.subcribe'); |
644 | } | 647 | } |
645 | 648 | ||
646 | //Установка уведомлений сохранение | 649 | //Установка уведомлений сохранение |
647 | public function save_subscribe(Request $request) { | 650 | public function save_subscribe(Request $request) { |
648 | dd($request->all()); | 651 | dd($request->all()); |
649 | $msg = $request->validate([ | 652 | $msg = $request->validate([ |
650 | 'subscribe_email' => 'required|email|min:5|max:255', | 653 | 'subscribe_email' => 'required|email|min:5|max:255', |
651 | ]); | 654 | ]); |
652 | return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); | 655 | return redirect()->route('employer.subscribe')->with('Вы успешно подписались на рассылку'); |
653 | } | 656 | } |
654 | 657 | ||
655 | //Сбросить форму с паролем | 658 | //Сбросить форму с паролем |
656 | public function password_reset() { | 659 | public function password_reset() { |
657 | $email = Auth()->user()->email; | 660 | $email = Auth()->user()->email; |
658 | return view('employers.password-reset', compact('email')); | 661 | return view('employers.password-reset', compact('email')); |
659 | } | 662 | } |
660 | 663 | ||
661 | //Обновление пароля | 664 | //Обновление пароля |
662 | public function new_password(Request $request) { | 665 | public function new_password(Request $request) { |
663 | $use = Auth()->user(); | 666 | $use = Auth()->user(); |
664 | $request->validate([ | 667 | $request->validate([ |
665 | 'password' => 'required|string', | 668 | 'password' => 'required|string', |
666 | 'new_password' => 'required|string', | 669 | 'new_password' => 'required|string', |
667 | 'new_password2' => 'required|string' | 670 | 'new_password2' => 'required|string' |
668 | ]); | 671 | ]); |
669 | 672 | ||
670 | if ($request->get('new_password') == $request->get('new_password2')) | 673 | if ($request->get('new_password') == $request->get('new_password2')) |
671 | if ($request->get('password') !== $request->get('new_password')) { | 674 | if ($request->get('password') !== $request->get('new_password')) { |
672 | $credentials = $request->only('email', 'password'); | 675 | $credentials = $request->only('email', 'password'); |
673 | if (Auth::attempt($credentials)) { | 676 | if (Auth::attempt($credentials)) { |
674 | 677 | ||
675 | if (!is_null($use->email_verified_at)){ | 678 | if (!is_null($use->email_verified_at)){ |
676 | 679 | ||
677 | $user_data = User_Model::find($use->id); | 680 | $user_data = User_Model::find($use->id); |
678 | $user_data->update([ | 681 | $user_data->update([ |
679 | 'password' => Hash::make($request->get('new_password')), | 682 | 'password' => Hash::make($request->get('new_password')), |
680 | 'pubpassword' => base64_encode($request->get('new_password')), | 683 | 'pubpassword' => base64_encode($request->get('new_password')), |
681 | ]); | 684 | ]); |
682 | return redirect() | 685 | return redirect() |
683 | ->route('employer.password_reset') | 686 | ->route('employer.password_reset') |
684 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); | 687 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); |
685 | } | 688 | } |
686 | 689 | ||
687 | return redirect() | 690 | return redirect() |
688 | ->route('employer.password_reset') | 691 | ->route('employer.password_reset') |
689 | ->withError('Данная учетная запись не было верифицированна!'); | 692 | ->withError('Данная учетная запись не было верифицированна!'); |
690 | } | 693 | } |
691 | } | 694 | } |
692 | 695 | ||
693 | return redirect() | 696 | return redirect() |
694 | ->route('employer.password_reset') | 697 | ->route('employer.password_reset') |
695 | ->withErrors('Не совпадение данных, обновите пароли!'); | 698 | ->withErrors('Не совпадение данных, обновите пароли!'); |
696 | } | 699 | } |
697 | 700 | ||
698 | 701 | ||
699 | 702 | ||
700 | // Форма Удаление пипла | 703 | // Форма Удаление пипла |
701 | public function delete_people() { | 704 | public function delete_people() { |
702 | $login = Auth()->user()->email; | 705 | $login = Auth()->user()->email; |
703 | return view('employers.delete_people', compact('login')); | 706 | return view('employers.delete_people', compact('login')); |
704 | } | 707 | } |
705 | 708 | ||
706 | // Удаление аккаунта | 709 | // Удаление аккаунта |
707 | public function action_delete_user(Request $request) { | 710 | public function action_delete_user(Request $request) { |
708 | $Answer = $request->all(); | 711 | $Answer = $request->all(); |
709 | $user_id = Auth()->user()->id; | 712 | $user_id = Auth()->user()->id; |
710 | $request->validate([ | 713 | $request->validate([ |
711 | 'password' => 'required|string', | 714 | 'password' => 'required|string', |
712 | ]); | 715 | ]); |
713 | 716 | ||
714 | $credentials = $request->only('email', 'password'); | 717 | $credentials = $request->only('email', 'password'); |
715 | if (Auth::attempt($credentials)) { | 718 | if (Auth::attempt($credentials)) { |
716 | Auth::logout(); | 719 | Auth::logout(); |
717 | $it = User_Model::find($user_id); | 720 | $it = User_Model::find($user_id); |
718 | $it->delete(); | 721 | $it->delete(); |
719 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); | 722 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); |
720 | } else { | 723 | } else { |
721 | return redirect()->route('employer.delete_people') | 724 | return redirect()->route('employer.delete_people') |
722 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); | 725 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); |
723 | } | 726 | } |
724 | } | 727 | } |
725 | 728 | ||
726 | public function ajax_delete_user(Request $request) { | 729 | public function ajax_delete_user(Request $request) { |
727 | $Answer = $request->all(); | 730 | $Answer = $request->all(); |
728 | $user_id = Auth()->user()->id; | 731 | $user_id = Auth()->user()->id; |
729 | $request->validate([ | 732 | $request->validate([ |
730 | 'password' => 'required|string', | 733 | 'password' => 'required|string', |
731 | ]); | 734 | ]); |
732 | $credentials = $request->only('email', 'password'); | 735 | $credentials = $request->only('email', 'password'); |
733 | if (Auth::attempt($credentials)) { | 736 | if (Auth::attempt($credentials)) { |
734 | 737 | ||
735 | return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', | 738 | return json_encode(Array('SUCCESS' => 'Вы успешно удалили свой аккаунт', |
736 | 'email' => $request->get('email'), | 739 | 'email' => $request->get('email'), |
737 | 'password' => $request->get('password'))); | 740 | 'password' => $request->get('password'))); |
738 | } else { | 741 | } else { |
739 | return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); | 742 | return json_encode(Array('ERROR' => 'Неверный пароль! Нужен корректный пароль')); |
740 | } | 743 | } |
741 | } | 744 | } |
742 | 745 | ||
743 | // FAQ - Вопросы/ответы для работодателей и соискателей | 746 | // FAQ - Вопросы/ответы для работодателей и соискателей |
744 | public function faq() { | 747 | public function faq() { |
745 | return view('employers.faq'); | 748 | return view('employers.faq'); |
746 | } | 749 | } |
747 | 750 | ||
748 | // Рассылка сообщений | 751 | // Рассылка сообщений |
749 | public function send_all_messages() { | 752 | public function send_all_messages() { |
750 | $id = Auth()->user()->id; | 753 | $id = Auth()->user()->id; |
751 | $sending = Employer::query()->where('user_id', '=', "$id")->first(); | 754 | $sending = Employer::query()->where('user_id', '=', "$id")->first(); |
752 | 755 | ||
753 | if ($sending->sending_is) | 756 | if ($sending->sending_is) |
754 | return view('employers.send_all'); | 757 | return view('employers.send_all'); |
755 | else | 758 | else |
756 | return view('employers.send_all_danger'); | 759 | return view('employers.send_all_danger'); |
757 | } | 760 | } |
758 | 761 | ||
759 | // Отправка сообщений для информации | 762 | // Отправка сообщений для информации |
760 | public function send_all_post(Request $request) { | 763 | public function send_all_post(Request $request) { |
761 | $data = $request->all(); | 764 | $data = $request->all(); |
762 | 765 | ||
763 | $emails = User_Model::query()->where('is_worker', '1')->get(); | 766 | $emails = User_Model::query()->where('is_worker', '1')->get(); |
764 | 767 | ||
765 | foreach ($emails as $e) { | 768 | foreach ($emails as $e) { |
766 | Mail::to($e->email)->send(new SendAllMessages($data)); | 769 | Mail::to($e->email)->send(new SendAllMessages($data)); |
767 | } | 770 | } |
768 | 771 | ||
769 | return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены'); | 772 | return redirect()->route('employer.send_all_messages')->with('success', 'Письма были отправлены'); |
770 | } | 773 | } |
771 | 774 | ||
772 | // База резюме | 775 | // База резюме |
773 | public function bd_tupe(Request $request) { | 776 | public function bd_tupe(Request $request) { |
774 | $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); | 777 | $Resume = User_Model::query()->with('workers')->where('is_bd', '=', '1')->get(); |
775 | 778 | ||
776 | return view('employers.bd_tupe', compact('Resume')); | 779 | return view('employers.bd_tupe', compact('Resume')); |
777 | } | 780 | } |
778 | 781 | ||
779 | ////////////////////////////////////////////////////////////////// | 782 | ////////////////////////////////////////////////////////////////// |
780 | // Отправил сообщение | 783 | // Отправил сообщение |
781 | ////////////////////////////////////////////////////////////////// | 784 | ////////////////////////////////////////////////////////////////// |
782 | public function new_message(Request $request) { | 785 | public function new_message(Request $request) { |
783 | $params = $request->all(); | 786 | $params = $request->all(); |
784 | $id = $params['_user_id']; | 787 | $id = $params['_user_id']; |
785 | $message = new Message(); | 788 | $message = new Message(); |
786 | $message->user_id = $params['_user_id']; | 789 | $message->user_id = $params['_user_id']; |
787 | $message->to_user_id = $params['_to_user_id']; | 790 | $message->to_user_id = $params['_to_user_id']; |
788 | $message->title = $params['title']; | 791 | $message->title = $params['title']; |
789 | $message->text = $params['text']; | 792 | $message->text = $params['text']; |
790 | if ($request->has('_file')) { | 793 | if ($request->has('_file')) { |
791 | $message->file = $request->file('_file')->store("worker/$id", 'public'); | 794 | $message->file = $request->file('_file')->store("worker/$id", 'public'); |
792 | } | 795 | } |
793 | $message->ad_employer_id = $params['_vacancy']; | 796 | $message->ad_employer_id = $params['_vacancy']; |
794 | $message->flag_new = 1; | 797 | $message->flag_new = 1; |
795 | $id_message = $message->save(); | 798 | $id_message = $message->save(); |
796 | 799 | ||
797 | //$data['message_id'] = $id_message; | 800 | //$data['message_id'] = $id_message; |
798 | //$data['ad_employer_id'] = $params['_vacancy']; | 801 | //$data['ad_employer_id'] = $params['_vacancy']; |
799 | //$data['job_title_id'] = 0; | 802 | //$data['job_title_id'] = 0; |
800 | 803 | ||
801 | $data['flag'] = 1; | 804 | $data['flag'] = 1; |
802 | //$ad_responce = ad_response::create($data); | 805 | //$ad_responce = ad_response::create($data); |
803 | return redirect()->route('employer.messages', ['type_message' => 'output']); | 806 | return redirect()->route('employer.messages', ['type_message' => 'output']); |
804 | } | 807 | } |
805 | 808 | ||
806 | // Восстановление пароля | 809 | // Восстановление пароля |
807 | public function repair_password(Request $request) { | 810 | public function repair_password(Request $request) { |
808 | $params = $request->get('email'); | 811 | $params = $request->get('email'); |
809 | } | 812 | } |
810 | 813 | ||
811 | // Избранные люди на корабль | 814 | // Избранные люди на корабль |
812 | public function selected_people(Request $request) { | 815 | public function selected_people(Request $request) { |
813 | $id = $request->get('id'); | 816 | $id = $request->get('id'); |
814 | $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> | 817 | $favorite_people = Job_title::query()->orderByDesc('sort')->OrderBy('name')-> |
815 | where('is_remove', '=', '0')-> | 818 | where('is_remove', '=', '0')-> |
816 | where('is_bd', '=', '0')-> | 819 | where('is_bd', '=', '0')-> |
817 | where('position_id', $id)-> | 820 | where('position_id', $id)-> |
818 | get(); | 821 | get(); |
819 | return view('favorite_people', compact('favorite_people')); | 822 | return view('favorite_people', compact('favorite_people')); |
820 | } | 823 | } |
821 | } | 824 | } |
app/Http/Controllers/MainController.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\Mail\MailRegistration; | 7 | use App\Mail\MailRegistration; |
8 | use App\Mail\MailRepair; | 8 | use App\Mail\MailRepair; |
9 | use App\Models\Ad_employer; | 9 | use App\Models\Ad_employer; |
10 | use App\Models\Ad_jobs; | 10 | use App\Models\Ad_jobs; |
11 | use App\Models\Category; | 11 | use App\Models\Category; |
12 | use App\Models\Education; | 12 | use App\Models\Education; |
13 | use App\Models\Employer; | 13 | use App\Models\Employer; |
14 | use App\Models\employers_main; | 14 | use App\Models\employers_main; |
15 | use App\Models\Job_title; | 15 | use App\Models\Job_title; |
16 | use App\Models\Like_vacancy; | 16 | use App\Models\Like_vacancy; |
17 | use App\Models\Like_worker; | 17 | use App\Models\Like_worker; |
18 | use App\Models\News; | 18 | use App\Models\News; |
19 | use App\Models\Positions; | 19 | use App\Models\Positions; |
20 | use App\Models\reclame; | 20 | use App\Models\reclame; |
21 | use App\Models\User; | 21 | use App\Models\User; |
22 | use Illuminate\Http\Request; | 22 | use Illuminate\Http\Request; |
23 | use Illuminate\Support\Facades\Auth; | 23 | use Illuminate\Support\Facades\Auth; |
24 | use Illuminate\Support\Facades\DB; | 24 | use Illuminate\Support\Facades\DB; |
25 | use Illuminate\Support\Facades\Hash; | 25 | use Illuminate\Support\Facades\Hash; |
26 | use Illuminate\Support\Facades\Mail; | 26 | use Illuminate\Support\Facades\Mail; |
27 | use Illuminate\Support\Facades\Validator; | 27 | use Illuminate\Support\Facades\Validator; |
28 | use App\Classes\StatusUser; | 28 | use App\Classes\StatusUser; |
29 | 29 | ||
30 | class MainController extends Controller | 30 | class MainController extends Controller |
31 | { | 31 | { |
32 | // Главная страница публичной части | 32 | // Главная страница публичной части |
33 | public function index() { | 33 | public function index() { |
34 | $news = News::query()->orderByDesc('id')->limit(6)->get(); | 34 | $news = News::query()->orderByDesc('id')->limit(6)->get(); |
35 | 35 | ||
36 | $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') | 36 | $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') |
37 | ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') | 37 | ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') |
38 | ->OrderByDesc('created_at') | 38 | ->OrderByDesc('created_at') |
39 | ->GroupBy('categories.id') | 39 | ->GroupBy('categories.id') |
40 | ->get(); | 40 | ->get(); |
41 | 41 | ||
42 | //$Position = Category::query()->where('is_remove', '=', '0')->get(); | 42 | //$Position = Category::query()->where('is_remove', '=', '0')->get(); |
43 | $Job_title = Job_title::query()->where('is_remove', '=', '0')-> | 43 | $Job_title = Job_title::query()->where('is_remove', '=', '0')-> |
44 | where('is_bd', '=', '0')->orderBy('name')->get(); | 44 | where('is_bd', '=', '0')->orderBy('name')->get(); |
45 | 45 | ||
46 | /*$BigFlot = Array(); | 46 | /*$BigFlot = Array(); |
47 | foreach ($Position as $position) { | 47 | foreach ($Position as $position) { |
48 | $BigFlot[] = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> | 48 | $BigFlot[] = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> |
49 | orderBy('job_titles.sort')-> | 49 | orderBy('job_titles.sort')-> |
50 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | 50 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> |
51 | where('position_ship', "$position->name")-> | 51 | where('position_ship', "$position->name")-> |
52 | groupby('job_title_id','position_ship')-> | 52 | groupby('job_title_id','position_ship')-> |
53 | get(); | 53 | get(); |
54 | } | 54 | } |
55 | $BigFlot = Array(); | 55 | $BigFlot = Array(); |
56 | foreach ($Position as $position) { | 56 | foreach ($Position as $position) { |
57 | $BigFlot[] = Ad_jobs::query()->with(['job_title' => function($query) { | 57 | $BigFlot[] = Ad_jobs::query()->with(['job_title' => function($query) { |
58 | $query->OrderBy('sort'); | 58 | $query->OrderBy('sort'); |
59 | }])->whereHas('job_title', function ($query) use ($position) { | 59 | }])->whereHas('job_title', function ($query) use ($position) { |
60 | $query->where('position_id', $position->id); | 60 | $query->where('position_id', $position->id); |
61 | })-> | 61 | })-> |
62 | distinct('job_title_id')-> | 62 | distinct('job_title_id')-> |
63 | get(); | 63 | get(); |
64 | }*/ | 64 | }*/ |
65 | /*$BigFlot = Array(); | 65 | /*$BigFlot = Array(); |
66 | foreach ($Position as $position) { | 66 | foreach ($Position as $position) { |
67 | $BigFlot[$position->id] = DB::table('ad_jobs')-> | 67 | $BigFlot[$position->id] = DB::table('ad_jobs')-> |
68 | selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name, job_titles.position_id')-> | 68 | selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name, job_titles.position_id')-> |
69 | orderByDesc('job_titles.sort')-> | 69 | orderByDesc('job_titles.sort')-> |
70 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | 70 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> |
71 | where('job_titles.position_id', $position->id)-> | 71 | where('job_titles.position_id', $position->id)-> |
72 | groupby('job_title_id')-> | 72 | groupby('job_title_id')-> |
73 | get(); | 73 | get(); |
74 | }*/ | 74 | }*/ |
75 | $Data = DB::table('job_titles')-> | 75 | $Data = DB::table('job_titles')-> |
76 | selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> | 76 | selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> |
77 | where('categories.is_remove', '=', '0')-> | 77 | where('categories.is_remove', '=', '0')-> |
78 | where('job_titles.is_remove', '=', '0')-> | 78 | where('job_titles.is_remove', '=', '0')-> |
79 | where('job_titles.is_bd', '=' , '0')-> | 79 | where('job_titles.is_bd', '=' , '0')-> |
80 | leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')-> | 80 | leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')-> |
81 | join('categories', 'categories.id', '=', 'job_titles.position_id')-> | 81 | join('categories', 'categories.id', '=', 'job_titles.position_id')-> |
82 | groupBy('job_titles.id')->orderBy('categories.id')->orderByDesc('job_titles.position_id')-> | 82 | groupBy('job_titles.id')->orderBy('categories.id')->orderByDesc('job_titles.position_id')-> |
83 | orderByDesc('job_titles.sort')->get()->toArray(); | 83 | orderByDesc('job_titles.sort')->get()->toArray(); |
84 | 84 | ||
85 | $Main_Job = array(); | 85 | $Main_Job = array(); |
86 | $name_cat = ''; | 86 | $name_cat = ''; |
87 | foreach ($Data as $it) { | 87 | foreach ($Data as $it) { |
88 | $it_arr = (array)$it; | 88 | $it_arr = (array)$it; |
89 | if ($name_cat != $it_arr['catname']) $name_cat = $it_arr['catname']; | 89 | if ($name_cat != $it_arr['catname']) $name_cat = $it_arr['catname']; |
90 | $Main_Job[$name_cat][] = $it_arr; | 90 | $Main_Job[$name_cat][] = $it_arr; |
91 | } | 91 | } |
92 | 92 | ||
93 | $employers = employers_main::query()->with('employer')-> | 93 | $employers = employers_main::query()->with('employer')-> |
94 | whereHas('employer', function ($query) { | 94 | whereHas('employer', function ($query) { |
95 | $query->where('status_hidden', '=', '0'); | 95 | $query->where('status_hidden', '=', '0'); |
96 | })-> | 96 | })-> |
97 | orderBy('id')->limit(8)->get(); | 97 | orderBy('sort')->get(); |
98 | $vacancy = Ad_jobs::query()->with('job_title')->orderBy('position_ship')->get(); | 98 | $vacancy = Ad_jobs::query()->with('job_title')->orderBy('position_ship')->get(); |
99 | return view('index', compact('news', 'Job_title', 'categories', 'employers', 'vacancy', 'Main_Job')); | 99 | return view('index', compact('news', 'Job_title', 'categories', 'employers', 'vacancy', 'Main_Job')); |
100 | } | 100 | } |
101 | 101 | ||
102 | public function search_vacancies(Request $request) { | 102 | public function search_vacancies(Request $request) { |
103 | if ($request->has('search')) { | 103 | if ($request->has('search')) { |
104 | $search = $request->get('search'); | 104 | $search = $request->get('search'); |
105 | $job_titles = Job_title::query()->where('name', 'LIKE', "%$search%")->first(); | 105 | $job_titles = Job_title::query()->where('name', 'LIKE', "%$search%")->first(); |
106 | if (isset($job_titles->id)) | 106 | if (isset($job_titles->id)) |
107 | if ($job_titles->id > 0) | 107 | if ($job_titles->id > 0) |
108 | return redirect()->route('vacancies', ['job' => $job_titles->id]); | 108 | return redirect()->route('vacancies', ['job' => $job_titles->id]); |
109 | } | 109 | } |
110 | } | 110 | } |
111 | 111 | ||
112 | // Лайк вакансии | 112 | // Лайк вакансии |
113 | public function like_vacancy(Request $request) { | 113 | public function like_vacancy(Request $request) { |
114 | $IP_address = RusDate::ip_addr_client(); | 114 | $IP_address = RusDate::ip_addr_client(); |
115 | 115 | ||
116 | if ($request->has('code_record')) { | 116 | if ($request->has('code_record')) { |
117 | if ($request->has('delete')) { | 117 | if ($request->has('delete')) { |
118 | $code = $request->get('code_record'); | 118 | $code = $request->get('code_record'); |
119 | $atomic_era = Like_vacancy::select('id')-> | 119 | $atomic_era = Like_vacancy::select('id')-> |
120 | where('code_record', '=', $code)->toSql(); | 120 | where('code_record', '=', $code)->toSql(); |
121 | DB::table('like_vacancy')->where('code_record', $request->get('code_record'))->delete(); | 121 | DB::table('like_vacancy')->where('code_record', $request->get('code_record'))->delete(); |
122 | 122 | ||
123 | } else { | 123 | } else { |
124 | $params = $request->all(); | 124 | $params = $request->all(); |
125 | $params['ip_address'] = $IP_address; | 125 | $params['ip_address'] = $IP_address; |
126 | Like_vacancy::create($params); | 126 | Like_vacancy::create($params); |
127 | } | 127 | } |
128 | } | 128 | } |
129 | } | 129 | } |
130 | 130 | ||
131 | // Лайк соискателю. | 131 | // Лайк соискателю. |
132 | public function like_worker(Request $request) { | 132 | public function like_worker(Request $request) { |
133 | $IP_address = RusDate::ip_addr_client(); | 133 | $IP_address = RusDate::ip_addr_client(); |
134 | 134 | ||
135 | if ($request->has('code_record')) { | 135 | if ($request->has('code_record')) { |
136 | if ($request->has('delete')) { | 136 | if ($request->has('delete')) { |
137 | $atomic_era = Like_worker::select('id')-> | 137 | $atomic_era = Like_worker::select('id')-> |
138 | where('code_record', '=', $request-> | 138 | where('code_record', '=', $request-> |
139 | get('code_record'))->first(); | 139 | get('code_record'))->first(); |
140 | 140 | ||
141 | DB::table('like_worker')->where('code_record', $request->get('code_record'))->delete(); | 141 | DB::table('like_worker')->where('code_record', $request->get('code_record'))->delete(); |
142 | 142 | ||
143 | return "Вот и результат удаления!"; | 143 | return "Вот и результат удаления!"; |
144 | 144 | ||
145 | } else { | 145 | } else { |
146 | $params = $request->all(); | 146 | $params = $request->all(); |
147 | $params['ip_address'] = $IP_address; | 147 | $params['ip_address'] = $IP_address; |
148 | Like_worker::create($params); | 148 | Like_worker::create($params); |
149 | } | 149 | } |
150 | } | 150 | } |
151 | } | 151 | } |
152 | 152 | ||
153 | public function vacancies(Request $request) { | 153 | public function vacancies(Request $request) { |
154 | //должности | 154 | //должности |
155 | $Job_title = Job_title::query()->where('is_remove', '=', '0')-> | 155 | $Job_title = Job_title::query()->where('is_remove', '=', '0')-> |
156 | where('is_bd', '=', '0')->orderBy('name')->get(); | 156 | where('is_bd', '=', '0')->orderBy('name')->get(); |
157 | 157 | ||
158 | $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') | 158 | $categories = Category::query()->selectRaw('count(ad_employers.id) as cnt, categories.*') |
159 | ->selectRaw('min(ad_employers.salary) as min_salary, max(ad_employers.salary) as max_salary') | 159 | ->selectRaw('min(ad_employers.salary) as min_salary, max(ad_employers.salary) as max_salary') |
160 | ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') | 160 | ->join('ad_employers', 'ad_employers.category_id', '=', 'categories.id') |
161 | ->join('ad_jobs', 'ad_jobs.ad_employer_id', '=', 'ad_employers.id'); | 161 | ->join('ad_jobs', 'ad_jobs.ad_employer_id', '=', 'ad_employers.id'); |
162 | 162 | ||
163 | //категории и вакансии | 163 | //категории и вакансии |
164 | if (($request->has('job')) && ($request->get('job') > 0)) { | 164 | if (($request->has('job')) && ($request->get('job') > 0)) { |
165 | $categories = $categories->Where('job_title_id', '=', $request->get('job')); | 165 | $categories = $categories->Where('job_title_id', '=', $request->get('job')); |
166 | } | 166 | } |
167 | 167 | ||
168 | $categories = $categories->OrderByDesc('created_at')->GroupBy('categories.id')->get(); | 168 | $categories = $categories->OrderByDesc('created_at')->GroupBy('categories.id')->get(); |
169 | 169 | ||
170 | //$Position = Category::query()->where('is_remove', '=', '0')->get(); | 170 | //$Position = Category::query()->where('is_remove', '=', '0')->get(); |
171 | 171 | ||
172 | 172 | ||
173 | /*$BigFlot = Array(); | 173 | /*$BigFlot = Array(); |
174 | foreach ($Position as $position) { | 174 | foreach ($Position as $position) { |
175 | $War_flot = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> | 175 | $War_flot = DB::table('ad_jobs')->selectRaw('name, job_titles.id as id_title, count(`ad_jobs`.`id`) as cnt, ad_jobs.position_ship')-> |
176 | orderBy('job_titles.sort')-> | 176 | orderBy('job_titles.sort')-> |
177 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | 177 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> |
178 | where('position_ship', "$position->name"); | 178 | where('position_ship', "$position->name"); |
179 | if (($request->has('job')) && ($request->get('job') > 0)) { | 179 | if (($request->has('job')) && ($request->get('job') > 0)) { |
180 | $War_flot = $War_flot->where('job_title_id', $request->get('job')); | 180 | $War_flot = $War_flot->where('job_title_id', $request->get('job')); |
181 | } | 181 | } |
182 | $War_flot = $War_flot->groupby('job_title_id','position_ship')->get(); | 182 | $War_flot = $War_flot->groupby('job_title_id','position_ship')->get(); |
183 | $BigFlot[] = $War_flot; | 183 | $BigFlot[] = $War_flot; |
184 | }*/ | 184 | }*/ |
185 | /* | 185 | /* |
186 | $BigFlot = Array(); | 186 | $BigFlot = Array(); |
187 | foreach ($Position as $position) { | 187 | foreach ($Position as $position) { |
188 | $WarFlot = DB::table('ad_jobs')-> | 188 | $WarFlot = DB::table('ad_jobs')-> |
189 | selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')-> | 189 | selectRaw('name, count(`ad_jobs`.`id`) as cnt, job_title_id, job_titles.name')-> |
190 | orderByDesc('job_titles.sort')-> | 190 | orderByDesc('job_titles.sort')-> |
191 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> | 191 | join('job_titles', 'job_titles.id', '=', 'ad_jobs.job_title_id')-> |
192 | where('job_titles.position_id', $position->id); | 192 | where('job_titles.position_id', $position->id); |
193 | if (($request->has('job')) && ($request->get('job') > 0)) { | 193 | if (($request->has('job')) && ($request->get('job') > 0)) { |
194 | $WarFlot = $WarFlot->where('job_title_id', $request->get('job')); | 194 | $WarFlot = $WarFlot->where('job_title_id', $request->get('job')); |
195 | } | 195 | } |
196 | $WarFlot = $WarFlot->groupby('job_title_id')->get(); | 196 | $WarFlot = $WarFlot->groupby('job_title_id')->get(); |
197 | $BigFlot[] = $WarFlot; | 197 | $BigFlot[] = $WarFlot; |
198 | } | 198 | } |
199 | */ | 199 | */ |
200 | 200 | ||
201 | $Data = DB::table('job_titles')-> | 201 | $Data = DB::table('job_titles')-> |
202 | selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> | 202 | selectRaw('job_titles.name as jn, count(`ad_jobs`.`job_title_id`) as cnt, job_titles.id as id_job, categories.name as catname, categories.id as id_cat')-> |
203 | where('categories.is_remove', '=', '0')-> | 203 | where('categories.is_remove', '=', '0')-> |
204 | where('job_titles.is_bd', '=' , '0')-> | 204 | where('job_titles.is_bd', '=' , '0')-> |
205 | where('job_titles.is_remove', '=', '0'); | 205 | where('job_titles.is_remove', '=', '0'); |
206 | if (($request->has('job')) && ($request->get('job') > 0)) { | 206 | if (($request->has('job')) && ($request->get('job') > 0)) { |
207 | $Data = $Data->where('job_title_id', $request->get('job')); | 207 | $Data = $Data->where('job_title_id', $request->get('job')); |
208 | } | 208 | } |
209 | $Data = $Data->leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')-> | 209 | $Data = $Data->leftJoin('ad_jobs', 'ad_jobs.job_title_id', '=', 'job_titles.id')-> |
210 | join('categories', 'categories.id', '=', 'job_titles.position_id')-> | 210 | join('categories', 'categories.id', '=', 'job_titles.position_id')-> |
211 | groupBy('job_titles.id')->orderBy('categories.id')->orderByDesc('job_titles.position_id')-> | 211 | groupBy('job_titles.id')->orderBy('categories.id')->orderByDesc('job_titles.position_id')-> |
212 | orderByDesc('job_titles.sort')->get()->toArray(); | 212 | orderByDesc('job_titles.sort')->get()->toArray(); |
213 | 213 | ||
214 | $Main_Job = array(); | 214 | $Main_Job = array(); |
215 | $name_cat = ''; | 215 | $name_cat = ''; |
216 | foreach ($Data as $it) { | 216 | foreach ($Data as $it) { |
217 | $it_arr = (array)$it; | 217 | $it_arr = (array)$it; |
218 | if ($name_cat != $it_arr['catname']) | 218 | if ($name_cat != $it_arr['catname']) |
219 | $name_cat = $it_arr['catname']; | 219 | $name_cat = $it_arr['catname']; |
220 | $Main_Job[$name_cat][] = $it_arr; | 220 | $Main_Job[$name_cat][] = $it_arr; |
221 | } | 221 | } |
222 | 222 | ||
223 | if ($request->ajax()) { | 223 | if ($request->ajax()) { |
224 | return view('ajax.new_sky', compact('categories', 'Main_Job')); | 224 | return view('ajax.new_sky', compact('categories', 'Main_Job')); |
225 | } else { | 225 | } else { |
226 | return view('new_sky', compact('Job_title', 'categories', 'Main_Job')); | 226 | return view('new_sky', compact('Job_title', 'categories', 'Main_Job')); |
227 | } | 227 | } |
228 | } | 228 | } |
229 | 229 | ||
230 | //Вакансии категория детальная | 230 | //Вакансии категория детальная |
231 | public function list_vacancies(Category $categories, Request $request) { | 231 | public function list_vacancies(Category $categories, Request $request) { |
232 | if (isset(Auth()->user()->id)) | 232 | if (isset(Auth()->user()->id)) |
233 | $uid = Auth()->user()->id; | 233 | $uid = Auth()->user()->id; |
234 | else | 234 | else |
235 | $uid = 0; | 235 | $uid = 0; |
236 | 236 | ||
237 | if ($request->get('job') == 0) | 237 | if ($request->get('job') == 0) |
238 | $job_search = ''; | 238 | $job_search = ''; |
239 | else | 239 | else |
240 | $job_search = $request->get('job'); | 240 | $job_search = $request->get('job'); |
241 | 241 | ||
242 | $Query = Ad_employer::with('jobs')-> | 242 | $Query = Ad_employer::with('jobs')-> |
243 | with('cat')-> | 243 | with('cat')-> |
244 | with('employer')-> | 244 | with('employer')-> |
245 | 245 | ||
246 | whereHas('jobs_code', function ($query) use ($job_search) { | 246 | whereHas('jobs_code', function ($query) use ($job_search) { |
247 | if (!empty($job_search)) { | 247 | if (!empty($job_search)) { |
248 | $query->where('job_title_id', $job_search); | 248 | $query->where('job_title_id', $job_search); |
249 | } | 249 | } |
250 | })->select('ad_employers.*'); | 250 | })->select('ad_employers.*'); |
251 | 251 | ||
252 | if (isset($categories->id) && ($categories->id > 0)) { | 252 | if (isset($categories->id) && ($categories->id > 0)) { |
253 | $Query = $Query->where('category_id', '=', $categories->id); | 253 | $Query = $Query->where('category_id', '=', $categories->id); |
254 | $Name_categori = Category::query()->where('id', '=', $categories->id)->get(); | 254 | $Name_categori = Category::query()->where('id', '=', $categories->id)->get(); |
255 | } else { | 255 | } else { |
256 | $Name_categori = ''; | 256 | $Name_categori = ''; |
257 | } | 257 | } |
258 | 258 | ||
259 | if ($request->get('sort')) { | 259 | if ($request->get('sort')) { |
260 | $sort = $request->get('sort'); | 260 | $sort = $request->get('sort'); |
261 | switch ($sort) { | 261 | switch ($sort) { |
262 | case 'name_up': $Query = $Query->orderBy('name')->orderBy('id'); break; | 262 | case 'name_up': $Query = $Query->orderBy('name')->orderBy('id'); break; |
263 | case 'name_down': $Query = $Query->orderByDesc('name')->orderby('id'); break; | 263 | case 'name_down': $Query = $Query->orderByDesc('name')->orderby('id'); break; |
264 | case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; | 264 | case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; |
265 | case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; | 265 | case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; |
266 | case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; | 266 | case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; |
267 | default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; | 267 | default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; |
268 | } | 268 | } |
269 | } | 269 | } |
270 | 270 | ||
271 | $Job_title = Job_title::query()->where('is_bd', '=', '0')->OrderBy('name')->get(); | 271 | $Job_title = Job_title::query()->where('is_bd', '=', '0')->OrderBy('name')->get(); |
272 | 272 | ||
273 | $Query_count = $Query->count(); | 273 | $Query_count = $Query->count(); |
274 | 274 | ||
275 | $Query = $Query->OrderBy('updated_at')->paginate(3); | 275 | $Query = $Query->OrderBy('updated_at')->paginate(3); |
276 | 276 | ||
277 | $Reclama = reclame::query()->get(); | 277 | $Reclama = reclame::query()->get(); |
278 | 278 | ||
279 | if ($request->ajax()) { | 279 | if ($request->ajax()) { |
280 | if ($request->has('title')) { | 280 | if ($request->has('title')) { |
281 | return view('ajax.list_category', compact( | 281 | return view('ajax.list_category', compact( |
282 | 'Name_categori' | 282 | 'Name_categori' |
283 | )); | 283 | )); |
284 | } else { | 284 | } else { |
285 | return view('ajax.list_vacancies', compact('Query', | 285 | return view('ajax.list_vacancies', compact('Query', |
286 | 'Query_count', | 286 | 'Query_count', |
287 | 'Name_categori', | 287 | 'Name_categori', |
288 | 'Reclama', | 288 | 'Reclama', |
289 | 'categories', | 289 | 'categories', |
290 | 'Job_title', | 290 | 'Job_title', |
291 | 'uid')); | 291 | 'uid')); |
292 | } | 292 | } |
293 | } else { | 293 | } else { |
294 | //Вернуть все | 294 | //Вернуть все |
295 | return view('list_vacancies', compact('Query', | 295 | return view('list_vacancies', compact('Query', |
296 | 'Query_count', | 296 | 'Query_count', |
297 | 'Reclama', | 297 | 'Reclama', |
298 | 'Name_categori', | 298 | 'Name_categori', |
299 | 'categories', | 299 | 'categories', |
300 | 'Job_title', | 300 | 'Job_title', |
301 | 'uid')); | 301 | 'uid')); |
302 | } | 302 | } |
303 | } | 303 | } |
304 | 304 | ||
305 | // Образование | 305 | // Образование |
306 | public function education(Request $request) { | 306 | public function education(Request $request) { |
307 | $educations = Education::query(); | 307 | $educations = Education::query(); |
308 | if (($request->has('search')) && (!empty($request->get('search')))) { | 308 | if (($request->has('search')) && (!empty($request->get('search')))) { |
309 | $search = trim($request->get('search')); | 309 | $search = trim($request->get('search')); |
310 | $educations = $educations->where('name', 'LIKE', "%$search%"); | 310 | $educations = $educations->where('name', 'LIKE', "%$search%"); |
311 | } | 311 | } |
312 | 312 | ||
313 | if ($request->get('sort')) { | 313 | if ($request->get('sort')) { |
314 | $sort = $request->get('sort'); | 314 | $sort = $request->get('sort'); |
315 | switch ($sort) { | 315 | switch ($sort) { |
316 | case 'name_up': $educations = $educations->orderBy('name')->orderBy('id'); break; | 316 | case 'name_up': $educations = $educations->orderBy('name')->orderBy('id'); break; |
317 | case 'name_down': $educations = $educations->orderByDesc('name')->orderby('id'); break; | 317 | case 'name_down': $educations = $educations->orderByDesc('name')->orderby('id'); break; |
318 | case 'created_at_up': $educations = $educations->OrderBy('created_at')->orderBy('id'); break; | 318 | case 'created_at_up': $educations = $educations->OrderBy('created_at')->orderBy('id'); break; |
319 | case 'created_at_down': $educations = $educations->orderByDesc('created_at')->orderBy('id'); break; | 319 | case 'created_at_down': $educations = $educations->orderByDesc('created_at')->orderBy('id'); break; |
320 | case 'default': $educations = $educations->orderBy('id')->orderby('updated_at'); break; | 320 | case 'default': $educations = $educations->orderBy('id')->orderby('updated_at'); break; |
321 | default: $educations = $educations->orderBy('id')->orderby('updated_at'); break; | 321 | default: $educations = $educations->orderBy('id')->orderby('updated_at'); break; |
322 | } | 322 | } |
323 | } | 323 | } |
324 | 324 | ||
325 | $count_edu = $educations->count(); | 325 | $count_edu = $educations->count(); |
326 | $educations = $educations->paginate(6); | 326 | $educations = $educations->paginate(6); |
327 | if ($request->ajax()) { | 327 | if ($request->ajax()) { |
328 | return view('ajax.education', compact('educations')); | 328 | return view('ajax.education', compact('educations')); |
329 | } else { | 329 | } else { |
330 | return view('education', compact('educations', 'count_edu')); | 330 | return view('education', compact('educations', 'count_edu')); |
331 | } | 331 | } |
332 | } | 332 | } |
333 | 333 | ||
334 | // Контакты | 334 | // Контакты |
335 | public function contacts() { | 335 | public function contacts() { |
336 | return view('contacts'); | 336 | return view('contacts'); |
337 | } | 337 | } |
338 | 338 | ||
339 | // Вход в личный кабинет | 339 | // Вход в личный кабинет |
340 | public function input_login(Request $request) | 340 | public function input_login(Request $request) |
341 | { | 341 | { |
342 | $params = $request->all(); | 342 | $params = $request->all(); |
343 | 343 | ||
344 | 344 | ||
345 | $rules = [ | 345 | $rules = [ |
346 | 'email' => 'required|string|email', | 346 | 'email' => 'required|string|email', |
347 | 'password' => 'required|string|min:3|max:25', | 347 | 'password' => 'required|string|min:3|max:25', |
348 | ]; | 348 | ]; |
349 | 349 | ||
350 | $messages = [ | 350 | $messages = [ |
351 | 'required' => 'Укажите обязательное поле «:attribute»', | 351 | 'required' => 'Укажите обязательное поле «:attribute»', |
352 | 'email' => 'Введите корректный email', | 352 | 'email' => 'Введите корректный email', |
353 | 'min' => [ | 353 | 'min' => [ |
354 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 354 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
355 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 355 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
356 | ], | 356 | ], |
357 | 'max' => [ | 357 | 'max' => [ |
358 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 358 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
359 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 359 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
360 | ], | 360 | ], |
361 | ]; | 361 | ]; |
362 | $validator = Validator::make($request->all(), $rules, $messages); | 362 | $validator = Validator::make($request->all(), $rules, $messages); |
363 | if ($validator->fails()) { | 363 | if ($validator->fails()) { |
364 | if (Auth::check()) | 364 | if (Auth::check()) |
365 | $user_id = $request->user()->id; | 365 | $user_id = $request->user()->id; |
366 | else | 366 | else |
367 | $user_id = 0; | 367 | $user_id = 0; |
368 | 368 | ||
369 | if ($user_id > 0) | 369 | if ($user_id > 0) |
370 | return json_encode(Array("ERROR" => "Email или пароль невалидный!")); | 370 | return json_encode(Array("ERROR" => "Email или пароль невалидный!")); |
371 | else | 371 | else |
372 | return redirect()->route('index')->with('Error', "Email или пароль невалидный"); | 372 | return redirect()->route('index')->with('Error', "Email или пароль невалидный"); |
373 | } else { | 373 | } else { |
374 | $credentials = $request->only('email', 'password'); | 374 | $credentials = $request->only('email', 'password'); |
375 | 375 | ||
376 | if (Auth::attempt($credentials, $request->has('remember'))) { | 376 | if (Auth::attempt($credentials, $request->has('remember'))) { |
377 | 377 | ||
378 | if (is_null(Auth::user()->email_verified_at)) { | 378 | if (is_null(Auth::user()->email_verified_at)) { |
379 | Auth::logout(); | 379 | Auth::logout(); |
380 | return json_encode(Array("ERROR" => "Адрес почты не подтвержден")); | 380 | return json_encode(Array("ERROR" => "Адрес почты не подтвержден")); |
381 | } | 381 | } |
382 | 382 | ||
383 | if (Auth::user()->is_worker) { | 383 | if (Auth::user()->is_worker) { |
384 | return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl())); | 384 | return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl())); |
385 | } else { | 385 | } else { |
386 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl())); | 386 | return json_encode(Array("REDIRECT" => redirect()->route('employer.cabinet')->getTargetUrl())); |
387 | } | 387 | } |
388 | 388 | ||
389 | return json_encode(Array("SUCCESS" => "Вы успешно вошли в личный кабинет")); | 389 | return json_encode(Array("SUCCESS" => "Вы успешно вошли в личный кабинет")); |
390 | //->route('index') | 390 | //->route('index') |
391 | //->with('success', 'Вы вошли в личный кабинет.'); | 391 | //->with('success', 'Вы вошли в личный кабинет.'); |
392 | } else { | 392 | } else { |
393 | return json_encode(Array("ERROR" => "Неверный логин или пароль!")); | 393 | return json_encode(Array("ERROR" => "Неверный логин или пароль!")); |
394 | } | 394 | } |
395 | } | 395 | } |
396 | } | 396 | } |
397 | 397 | ||
398 | // Восстановление пароля | 398 | // Восстановление пароля |
399 | public function repair_password(Request $request) { | 399 | public function repair_password(Request $request) { |
400 | $rules = [ | 400 | $rules = [ |
401 | 'email' => 'required|string|email', | 401 | 'email' => 'required|string|email', |
402 | ]; | 402 | ]; |
403 | 403 | ||
404 | $messages = [ | 404 | $messages = [ |
405 | 'required' => 'Укажите обязательное поле «:attribute»', | 405 | 'required' => 'Укажите обязательное поле «:attribute»', |
406 | 'email' => 'Введите корректный email', | 406 | 'email' => 'Введите корректный email', |
407 | 'min' => [ | 407 | 'min' => [ |
408 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 408 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
409 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 409 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
410 | ], | 410 | ], |
411 | 'max' => [ | 411 | 'max' => [ |
412 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 412 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
413 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 413 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
414 | ], | 414 | ], |
415 | ]; | 415 | ]; |
416 | 416 | ||
417 | $validator = Validator::make($request->all(), $rules, $messages); | 417 | $validator = Validator::make($request->all(), $rules, $messages); |
418 | 418 | ||
419 | if ($validator->fails()) { | 419 | if ($validator->fails()) { |
420 | return redirect()->back()->with('Error', "Email невалидный"); | 420 | return redirect()->back()->with('Error', "Email невалидный"); |
421 | } else { | 421 | } else { |
422 | $new_password = Tools::generator_id(10); | 422 | $new_password = Tools::generator_id(10); |
423 | $hash_password = Hash::make($new_password); | 423 | $hash_password = Hash::make($new_password); |
424 | $user = User::query()->where('email', $request->get('email'))->first(); | 424 | $user = User::query()->where('email', $request->get('email'))->first(); |
425 | $EditRec = User::find($user->id); | 425 | $EditRec = User::find($user->id); |
426 | $EditRec->password = $hash_password; | 426 | $EditRec->password = $hash_password; |
427 | $EditRec->save(); | 427 | $EditRec->save(); |
428 | 428 | ||
429 | foreach ([$request->get('email')] as $recipient) { | 429 | foreach ([$request->get('email')] as $recipient) { |
430 | Mail::to($recipient)->send(new MailRepair($new_password)); | 430 | Mail::to($recipient)->send(new MailRepair($new_password)); |
431 | } | 431 | } |
432 | return redirect()->route('index'); | 432 | return redirect()->route('index'); |
433 | 433 | ||
434 | } | 434 | } |
435 | 435 | ||
436 | } | 436 | } |
437 | 437 | ||
438 | // Вывод новостей | 438 | // Вывод новостей |
439 | public function news(Request $request) { | 439 | public function news(Request $request) { |
440 | $Query = News::query(); | 440 | $Query = News::query(); |
441 | if ($request->has('search')) { | 441 | if ($request->has('search')) { |
442 | $search = $request->get('search'); | 442 | $search = $request->get('search'); |
443 | $Query = $Query->where('title', 'LIKE', "%$search%")-> | 443 | $Query = $Query->where('title', 'LIKE', "%$search%")-> |
444 | orWhere('text', 'LIKE', "%$search%"); | 444 | orWhere('text', 'LIKE', "%$search%"); |
445 | } | 445 | } |
446 | 446 | ||
447 | if ($request->ajax()) { | 447 | if ($request->ajax()) { |
448 | if ($request->get('sort')) { | 448 | if ($request->get('sort')) { |
449 | $sort = $request->get('sort'); | 449 | $sort = $request->get('sort'); |
450 | switch ($sort) { | 450 | switch ($sort) { |
451 | case 'name_up': $Query = $Query->orderBy('title')->orderBy('id'); break; | 451 | case 'name_up': $Query = $Query->orderBy('title')->orderBy('id'); break; |
452 | case 'name_down': $Query = $Query->orderByDesc('title')->orderby('id'); break; | 452 | case 'name_down': $Query = $Query->orderByDesc('title')->orderby('id'); break; |
453 | case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; | 453 | case 'created_at_up': $Query = $Query->OrderBy('created_at')->orderBy('id'); break; |
454 | case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; | 454 | case 'created_at_down': $Query = $Query->orderByDesc('created_at')->orderBy('id'); break; |
455 | case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; | 455 | case 'default': $Query = $Query->orderBy('id')->orderby('updated_at'); break; |
456 | default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; | 456 | default: $Query = $Query->orderBy('id')->orderby('updated_at'); break; |
457 | } | 457 | } |
458 | } | 458 | } |
459 | } | 459 | } |
460 | $Query_count = $Query->count(); | 460 | $Query_count = $Query->count(); |
461 | $Query = $Query->paginate(6); | 461 | $Query = $Query->paginate(6); |
462 | 462 | ||
463 | if ($request->ajax()) { | 463 | if ($request->ajax()) { |
464 | return view('ajax.news-list', compact('Query', 'Query_count')); | 464 | return view('ajax.news-list', compact('Query', 'Query_count')); |
465 | } else { | 465 | } else { |
466 | return view('news-list', compact('Query', 'Query_count')); | 466 | return view('news-list', compact('Query', 'Query_count')); |
467 | } | 467 | } |
468 | } | 468 | } |
469 | 469 | ||
470 | //Детальная новость | 470 | //Детальная новость |
471 | public function detail_new(News $new) { | 471 | public function detail_new(News $new) { |
472 | // Наборка | 472 | // Наборка |
473 | $Query = News::query()->where('id', $new->id)->get(); | 473 | $Query = News::query()->where('id', $new->id)->get(); |
474 | $title = $Query[0]->title; | 474 | $title = $Query[0]->title; |
475 | $All_Query = News::query()->paginate(8); | 475 | $All_Query = News::query()->paginate(8); |
476 | return view('detail_new', compact('Query', 'All_Query', 'title')); | 476 | return view('detail_new', compact('Query', 'All_Query', 'title')); |
477 | } | 477 | } |
478 | } | 478 | } |
479 | 479 |
app/Http/Controllers/WorkerController.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Http\Controllers; | 3 | namespace App\Http\Controllers; |
4 | 4 | ||
5 | use App\Classes\RusDate; | 5 | use App\Classes\RusDate; |
6 | use App\Http\Requests\DocumentsRequest; | 6 | use App\Http\Requests\DocumentsRequest; |
7 | use App\Http\Requests\PrevCompanyRequest; | 7 | use App\Http\Requests\PrevCompanyRequest; |
8 | use App\Http\Requests\SertificationRequest; | 8 | use App\Http\Requests\SertificationRequest; |
9 | use App\Models\Ad_employer; | 9 | use App\Models\Ad_employer; |
10 | use App\Models\ad_response; | 10 | use App\Models\ad_response; |
11 | use App\Models\Category; | 11 | use App\Models\Category; |
12 | use App\Models\Dop_info; | 12 | use App\Models\Dop_info; |
13 | use App\Models\Employer; | 13 | use App\Models\Employer; |
14 | use App\Models\infobloks; | 14 | use App\Models\infobloks; |
15 | use App\Models\Job_title; | 15 | use App\Models\Job_title; |
16 | use App\Models\Like_vacancy; | 16 | use App\Models\Like_vacancy; |
17 | use App\Models\Like_worker; | 17 | use App\Models\Like_worker; |
18 | use App\Models\Message; | 18 | use App\Models\Message; |
19 | use App\Models\place_works; | 19 | use App\Models\place_works; |
20 | use App\Models\PrevCompany; | 20 | use App\Models\PrevCompany; |
21 | use App\Models\reclame; | 21 | use App\Models\reclame; |
22 | use App\Models\ResponseWork; | 22 | use App\Models\ResponseWork; |
23 | use App\Models\sertification; | 23 | use App\Models\sertification; |
24 | use App\Models\Static_worker; | 24 | use App\Models\Static_worker; |
25 | use App\Models\Title_worker; | 25 | use App\Models\Title_worker; |
26 | use App\Models\User; | 26 | use App\Models\User; |
27 | use App\Models\User as User_Model; | 27 | use App\Models\User as User_Model; |
28 | use App\Models\Worker; | 28 | use App\Models\Worker; |
29 | use Barryvdh\DomPDF\Facade\Pdf; | 29 | use Barryvdh\DomPDF\Facade\Pdf; |
30 | use Carbon\Carbon; | 30 | use Carbon\Carbon; |
31 | use Illuminate\Auth\Events\Registered; | 31 | use Illuminate\Auth\Events\Registered; |
32 | use Illuminate\Database\Eloquent\Builder; | 32 | use Illuminate\Database\Eloquent\Builder; |
33 | use Illuminate\Database\Eloquent\Model; | 33 | use Illuminate\Database\Eloquent\Model; |
34 | use Illuminate\Http\JsonResponse; | 34 | use Illuminate\Http\JsonResponse; |
35 | use Illuminate\Http\Request; | 35 | use Illuminate\Http\Request; |
36 | use Illuminate\Support\Facades\Auth; | 36 | use Illuminate\Support\Facades\Auth; |
37 | use Illuminate\Support\Facades\Hash; | 37 | use Illuminate\Support\Facades\Hash; |
38 | use Illuminate\Support\Facades\Storage; | 38 | use Illuminate\Support\Facades\Storage; |
39 | use Illuminate\Support\Facades\Validator; | 39 | use Illuminate\Support\Facades\Validator; |
40 | 40 | ||
41 | class WorkerController extends Controller | 41 | class WorkerController extends Controller |
42 | { | 42 | { |
43 | public $status_work = array(0 => 'Ищу работу', 1 => 'Не указано', 2 => 'Не ищу работу'); | 43 | public $status_work = array(0 => 'Ищу работу', 1 => 'Не указано', 2 => 'Не ищу работу'); |
44 | 44 | ||
45 | //профиль | 45 | //профиль |
46 | public function profile(Worker $worker) | 46 | public function profile(Worker $worker) |
47 | { | 47 | { |
48 | $get_date = date('Y.m'); | 48 | $get_date = date('Y.m'); |
49 | 49 | ||
50 | $c = Static_worker::query()->where('year_month', '=', $get_date) | 50 | $c = Static_worker::query()->where('year_month', '=', $get_date) |
51 | ->where('user_id', '=', $worker->users->id) | 51 | ->where('user_id', '=', $worker->users->id) |
52 | ->get(); | 52 | ->get(); |
53 | 53 | ||
54 | if ($c->count() > 0) { | 54 | if ($c->count() > 0) { |
55 | $upd = Static_worker::find($c[0]->id); | 55 | $upd = Static_worker::find($c[0]->id); |
56 | $upd->lookin = $upd->lookin + 1; | 56 | $upd->lookin = $upd->lookin + 1; |
57 | $upd->save(); | 57 | $upd->save(); |
58 | } else { | 58 | } else { |
59 | $crt = new Static_worker(); | 59 | $crt = new Static_worker(); |
60 | $crt->lookin = 1; | 60 | $crt->lookin = 1; |
61 | $crt->year_month = $get_date; | 61 | $crt->year_month = $get_date; |
62 | $crt->user_id = $worker->user_id; | 62 | $crt->user_id = $worker->user_id; |
63 | $crt->save(); | 63 | $crt->save(); |
64 | } | 64 | } |
65 | 65 | ||
66 | $stat = Static_worker::query()->where('year_month', '=', $get_date) | 66 | $stat = Static_worker::query()->where('year_month', '=', $get_date) |
67 | ->where('user_id', '=', $worker->users->id) | 67 | ->where('user_id', '=', $worker->users->id) |
68 | ->get(); | 68 | ->get(); |
69 | 69 | ||
70 | return view('public.workers.profile', compact('worker', 'stat')); | 70 | return view('public.workers.profile', compact('worker', 'stat')); |
71 | } | 71 | } |
72 | 72 | ||
73 | // лист база резюме | 73 | // лист база резюме |
74 | public function bd_resume(Request $request) | 74 | public function bd_resume(Request $request) |
75 | { | 75 | { |
76 | $look = false; | 76 | $look = false; |
77 | $idiot = 0; | 77 | $idiot = 0; |
78 | if (isset(Auth()->user()->id)) { | 78 | if (isset(Auth()->user()->id)) { |
79 | $idiot = Auth()->user()->id; | 79 | $idiot = Auth()->user()->id; |
80 | if ((!Auth()->user()->is_worker) && (Auth()->user()->is_lookin)) | 80 | if ((!Auth()->user()->is_worker) && (Auth()->user()->is_lookin)) |
81 | $look = true; | 81 | $look = true; |
82 | } | 82 | } |
83 | 83 | ||
84 | if ($look) { | 84 | if ($look) { |
85 | $status_work = $this->status_work; | 85 | $status_work = $this->status_work; |
86 | $resumes = Worker::query()->with('users')->with('job_titles'); | 86 | $resumes = Worker::query()->with('users')->with('job_titles'); |
87 | $resumes = $resumes->whereHas('users', function (Builder $query) { | 87 | $resumes = $resumes->whereHas('users', function (Builder $query) { |
88 | $query->Where('is_worker', '=', '1') | 88 | $query->Where('is_worker', '=', '1') |
89 | ->Where('is_bd', '=', '0'); | 89 | ->Where('is_bd', '=', '0'); |
90 | }); | 90 | }); |
91 | 91 | ||
92 | //dd($request->get('job')); | 92 | //dd($request->get('job')); |
93 | if (($request->has('job')) && ($request->get('job') > 0)) { | 93 | if (($request->has('job')) && ($request->get('job') > 0)) { |
94 | $resumes = $resumes->whereHas('job_titles', function (Builder $query) use ($request) { | 94 | $resumes = $resumes->whereHas('job_titles', function (Builder $query) use ($request) { |
95 | $query->Where('job_titles.id', $request->get('job')); | 95 | $query->Where('job_titles.id', $request->get('job')); |
96 | }); | 96 | }); |
97 | } | 97 | } |
98 | 98 | ||
99 | $Job_title = Job_title::query()-> | 99 | $Job_title = Job_title::query()-> |
100 | where('is_remove', '=', '0')-> | 100 | where('is_remove', '=', '0')-> |
101 | where('is_bd', '=' , '1')-> | 101 | where('is_bd', '=' , '1')-> |
102 | get(); | 102 | get(); |
103 | 103 | ||
104 | if ($request->get('sort')) { | 104 | if ($request->get('sort')) { |
105 | $sort = $request->get('sort'); | 105 | $sort = $request->get('sort'); |
106 | switch ($sort) { | 106 | switch ($sort) { |
107 | case 'name_up': | 107 | case 'name_up': |
108 | $resumes = $resumes->orderBy(User::select('surname') | 108 | $resumes = $resumes->orderBy(User::select('surname') |
109 | ->whereColumn('Workers.user_id', 'users.id') | 109 | ->whereColumn('Workers.user_id', 'users.id') |
110 | ); | 110 | ); |
111 | break; | 111 | break; |
112 | case 'name_down': | 112 | case 'name_down': |
113 | $resumes = $resumes->orderByDesc(User::select('surname') | 113 | $resumes = $resumes->orderByDesc(User::select('surname') |
114 | ->whereColumn('Workers.user_id', 'users.id') | 114 | ->whereColumn('Workers.user_id', 'users.id') |
115 | ); | 115 | ); |
116 | break; | 116 | break; |
117 | case 'created_at_up': | 117 | case 'created_at_up': |
118 | $resumes = $resumes->OrderBy('created_at')->orderBy('id'); | 118 | $resumes = $resumes->OrderBy('created_at')->orderBy('id'); |
119 | break; | 119 | break; |
120 | case 'created_at_down': | 120 | case 'created_at_down': |
121 | $resumes = $resumes->orderByDesc('created_at')->orderBy('id'); | 121 | $resumes = $resumes->orderByDesc('created_at')->orderBy('id'); |
122 | break; | 122 | break; |
123 | case 'default': | 123 | case 'default': |
124 | $resumes = $resumes->orderBy('id')->orderby('updated_at'); | 124 | $resumes = $resumes->orderBy('id')->orderby('updated_at'); |
125 | break; | 125 | break; |
126 | default: | 126 | default: |
127 | $resumes = $resumes->orderBy('id')->orderby('updated_at'); | 127 | $resumes = $resumes->orderBy('id')->orderby('updated_at'); |
128 | break; | 128 | break; |
129 | } | 129 | } |
130 | } | 130 | } |
131 | 131 | ||
132 | $res_count = $resumes->count(); | 132 | $res_count = $resumes->count(); |
133 | //$resumes = $resumes->get(); | 133 | //$resumes = $resumes->get(); |
134 | $resumes = $resumes->paginate(4); | 134 | $resumes = $resumes->paginate(4); |
135 | if ($request->ajax()) { | 135 | if ($request->ajax()) { |
136 | // Условия обставлены | 136 | // Условия обставлены |
137 | if ($request->has('block') && ($request->get('block') == 1)) { | 137 | if ($request->has('block') && ($request->get('block') == 1)) { |
138 | return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count', 'idiot')); | 138 | return view('ajax.resume_1', compact('resumes', 'status_work', 'res_count', 'idiot')); |
139 | } | 139 | } |
140 | 140 | ||
141 | if ($request->has('block') && ($request->get('block') == 2)) { | 141 | if ($request->has('block') && ($request->get('block') == 2)) { |
142 | return view('ajax.resume_2', compact('resumes', 'status_work', 'res_count', 'idiot')); | 142 | return view('ajax.resume_2', compact('resumes', 'status_work', 'res_count', 'idiot')); |
143 | } | 143 | } |
144 | } else { | 144 | } else { |
145 | return view('resume', compact('resumes', 'status_work', 'res_count', 'idiot', 'Job_title')); | 145 | return view('resume', compact('resumes', 'status_work', 'res_count', 'idiot', 'Job_title')); |
146 | } | 146 | } |
147 | } else { | 147 | } else { |
148 | return redirect()->route('index')->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]); | 148 | return redirect()->route('index')->withErrors(['errors' => ['Вы не можете просматривать базу резюме. Подробнее в меню: "Условия размещения"']]); |
149 | } | 149 | } |
150 | } | 150 | } |
151 | 151 | ||
152 | //Лайк резюме | 152 | //Лайк резюме |
153 | public function like_controller() { | 153 | public function like_controller() { |
154 | 154 | ||
155 | } | 155 | } |
156 | 156 | ||
157 | // анкета соискателя | 157 | // анкета соискателя |
158 | public function resume_profile(Worker $worker) | 158 | public function resume_profile(Worker $worker) |
159 | { | 159 | { |
160 | if (isset(Auth()->user()->id)) { | 160 | if (isset(Auth()->user()->id)) { |
161 | $idiot = Auth()->user()->id; | 161 | $idiot = Auth()->user()->id; |
162 | } else { | 162 | } else { |
163 | $idiot = 0; | 163 | $idiot = 0; |
164 | } | 164 | } |
165 | 165 | ||
166 | $status_work = $this->status_work; | 166 | $status_work = $this->status_work; |
167 | $Query = Worker::query()->with('users')->with('job_titles') | 167 | $Query = Worker::query()->with('users')->with('job_titles') |
168 | ->with('place_worker')->with('sertificate')->with('prev_company') | 168 | ->with('place_worker')->with('sertificate')->with('prev_company') |
169 | ->with('infobloks'); | 169 | ->with('infobloks')->with('response'); |
170 | $Query = $Query->where('id', '=', $worker->id); | 170 | $Query = $Query->where('id', '=', $worker->id); |
171 | $Query = $Query->get(); | 171 | $Query = $Query->get(); |
172 | 172 | ||
173 | $get_date = date('Y.m'); | 173 | $get_date = date('Y.m'); |
174 | $c = Static_worker::query()->where('year_month', '=', $get_date) | 174 | $c = Static_worker::query()->where('year_month', '=', $get_date) |
175 | ->where('user_id', '=', $worker->user_id) | 175 | ->where('user_id', '=', $worker->user_id) |
176 | ->get(); | 176 | ->get(); |
177 | 177 | ||
178 | if ($c->count() > 0) { | 178 | if ($c->count() > 0) { |
179 | $upd = Static_worker::find($c[0]->id); | 179 | $upd = Static_worker::find($c[0]->id); |
180 | $upd->lookin = $upd->lookin + 1; | 180 | $upd->lookin = $upd->lookin + 1; |
181 | $upd->save(); | 181 | $upd->save(); |
182 | } else { | 182 | } else { |
183 | $crt = new Static_worker(); | 183 | $crt = new Static_worker(); |
184 | $crt->lookin = 1; | 184 | $crt->lookin = 1; |
185 | $crt->year_month = $get_date; | 185 | $crt->year_month = $get_date; |
186 | $crt->user_id = $worker->user_id; | 186 | $crt->user_id = $worker->user_id; |
187 | $status = $crt->save(); | 187 | $status = $crt->save(); |
188 | } | 188 | } |
189 | $stat = Static_worker::query()->where('year_month', '=', $get_date) | 189 | $stat = Static_worker::query()->where('year_month', '=', $get_date) |
190 | ->where('user_id', '=', $worker->id) | 190 | ->where('user_id', '=', $worker->user_id) |
191 | ->get(); | 191 | ->get(); |
192 | return view('worker', compact('Query', 'status_work', 'idiot')); | 192 | |
193 | return view('worker', compact('Query', 'status_work', 'idiot', 'stat')); | ||
193 | } | 194 | } |
194 | 195 | ||
195 | // скачать анкету соискателя | 196 | // скачать анкету соискателя |
196 | public function resume_download(Worker $worker) | 197 | public function resume_download(Worker $worker) |
197 | { | 198 | { |
198 | $status_work = $this->status_work; | 199 | $status_work = $this->status_work; |
199 | $Query = Worker::query()->with('users')->with('job_titles') | 200 | $Query = Worker::query()->with('users')->with('job_titles') |
200 | ->with('place_worker')->with('sertificate')->with('prev_company') | 201 | ->with('place_worker')->with('sertificate')->with('prev_company') |
201 | ->with('infobloks'); | 202 | ->with('infobloks'); |
202 | $Query = $Query->where('id', '=', $worker->id); | 203 | $Query = $Query->where('id', '=', $worker->id); |
203 | $Query = $Query->get()->toArray(); | 204 | $Query = $Query->get()->toArray(); |
204 | 205 | ||
205 | view()->share('Query',$Query); | 206 | view()->share('Query',$Query); |
206 | 207 | ||
207 | 208 | ||
208 | $pdf = PDF::loadView('layout.pdf', $Query); //->setPaper('a4', 'landscape'); | 209 | $pdf = PDF::loadView('layout.pdf', $Query); //->setPaper('a4', 'landscape'); |
209 | 210 | ||
210 | return $pdf->stream(); | 211 | return $pdf->stream(); |
211 | } | 212 | } |
212 | 213 | ||
213 | public function resume_download_all() { | 214 | public function resume_download_all() { |
214 | $status_work = $this->status_work; | 215 | $status_work = $this->status_work; |
215 | $Query = Worker::query()->with('users')->with('job_titles') | 216 | $Query = Worker::query()->with('users')->with('job_titles') |
216 | ->with('place_worker')->with('sertificate')->with('prev_company') | 217 | ->with('place_worker')->with('sertificate')->with('prev_company') |
217 | ->with('infobloks')-> | 218 | ->with('infobloks')-> |
218 | whereHas('users', function (Builder $query) { | 219 | whereHas('users', function (Builder $query) { |
219 | $query->Where('is_worker', '=', '1') | 220 | $query->Where('is_worker', '=', '1') |
220 | ->Where('is_bd', '=', '1'); | 221 | ->Where('is_bd', '=', '1'); |
221 | }); | 222 | }); |
222 | //$Query = $Query->where('id', '=', $worker->id); | 223 | //$Query = $Query->where('id', '=', $worker->id); |
223 | $Query = $Query->get()->toArray(); | 224 | $Query = $Query->get()->toArray(); |
224 | 225 | ||
225 | view()->share('Query',$Query); | 226 | view()->share('Query',$Query); |
226 | 227 | ||
227 | $pdf = PDF::loadView('layout.pdf-list-people', $Query); //->setPaper('a4', 'landscape'); | 228 | $pdf = PDF::loadView('layout.pdf-list-people', $Query); //->setPaper('a4', 'landscape'); |
228 | 229 | ||
229 | return $pdf->stream(); | 230 | return $pdf->stream(); |
230 | } | 231 | } |
231 | 232 | ||
232 | // Кабинет работника | 233 | // Кабинет работника |
233 | public function cabinet(Request $request) | 234 | public function cabinet(Request $request) |
234 | { | 235 | { |
235 | // дата год и месяц | 236 | // дата год и месяц |
236 | $get_date = date('Y.m'); | 237 | $get_date = date('Y.m'); |
237 | 238 | ||
238 | $id = Auth()->user()->id; | 239 | $id = Auth()->user()->id; |
239 | 240 | ||
240 | $Infobloks = infobloks::query()->get(); | 241 | $Infobloks = infobloks::query()->get(); |
241 | 242 | ||
242 | $Worker = Worker::query()->with('users')->with('sertificate')->with('prev_company')-> | 243 | $Worker = Worker::query()->with('users')->with('sertificate')->with('prev_company')-> |
243 | with('infobloks')->with('place_worker')-> | 244 | with('infobloks')->with('place_worker')-> |
244 | WhereHas('users', | 245 | WhereHas('users', |
245 | function (Builder $query) use ($id) {$query->Where('id', $id); | 246 | function (Builder $query) use ($id) {$query->Where('id', $id); |
246 | })->get(); | 247 | })->get(); |
247 | 248 | ||
248 | $Job_titles = Job_title::query()->where('is_remove', '=', '0')-> | 249 | $Job_titles = Job_title::query()->where('is_remove', '=', '0')-> |
249 | where('is_bd', '=' , '1')-> | 250 | where('is_bd', '=' , '1')-> |
250 | OrderByDesc('sort')->OrderBy('name')->get(); | 251 | OrderByDesc('sort')->OrderBy('name')->get(); |
251 | $Infoblocks = infobloks::query()->OrderBy('name')->get(); | 252 | $Infoblocks = infobloks::query()->OrderBy('name')->get(); |
252 | 253 | ||
253 | $stat = Static_worker::query()->where('year_month', '=', $get_date) | 254 | $stat = Static_worker::query()->where('year_month', '=', $get_date) |
254 | ->where('user_id', '=', $Worker[0]->id) | 255 | ->where('user_id', '=', $Worker[0]->id) |
255 | ->get(); | 256 | ->get(); |
256 | 257 | ||
257 | // 10% | 258 | // 10% |
258 | 259 | ||
259 | $persent = 10; | 260 | $persent = 10; |
260 | $persent1 = 0; | 261 | $persent1 = 0; |
261 | $persent2 = 0; | 262 | $persent2 = 0; |
262 | $persent3 = 0; | 263 | $persent3 = 0; |
263 | $persent4 = 0; | 264 | $persent4 = 0; |
264 | $persent5 = 0; | 265 | $persent5 = 0; |
265 | 266 | ||
266 | if ((!empty($Worker[0]->telephone)) && | 267 | if ((!empty($Worker[0]->telephone)) && |
267 | (!empty($Worker[0]->email)) && (!empty($Worker[0]->experience)) && | 268 | (!empty($Worker[0]->email)) && (!empty($Worker[0]->experience)) && |
268 | (!empty($Worker[0]->city)) && (!empty($Worker[0]->old_year))) { | 269 | (!empty($Worker[0]->city)) && (!empty($Worker[0]->old_year))) { |
269 | // 40% | 270 | // 40% |
270 | $persent = $persent + 40; | 271 | $persent = $persent + 40; |
271 | $persent1 = 40; | 272 | $persent1 = 40; |
272 | } | 273 | } |
273 | 274 | ||
274 | //dd($Worker[0]->status_work, $Worker[0]->telephone, $Worker[0]->email, $Worker[0]->experience, $Worker[0]->city, $Worker[0]->old_year); | 275 | //dd($Worker[0]->status_work, $Worker[0]->telephone, $Worker[0]->email, $Worker[0]->experience, $Worker[0]->city, $Worker[0]->old_year); |
275 | 276 | ||
276 | if ($Worker[0]->sertificate->count() > 0) { | 277 | if ($Worker[0]->sertificate->count() > 0) { |
277 | // 15% | 278 | // 15% |
278 | $persent = $persent + 15; | 279 | $persent = $persent + 15; |
279 | $persent2 = 15; | 280 | $persent2 = 15; |
280 | } | 281 | } |
281 | 282 | ||
282 | if ($Worker[0]->infobloks->count() > 0) { | 283 | if ($Worker[0]->infobloks->count() > 0) { |
283 | // 20% | 284 | // 20% |
284 | $persent = $persent + 20; | 285 | $persent = $persent + 20; |
285 | $persent3 = 20; | 286 | $persent3 = 20; |
286 | } | 287 | } |
287 | 288 | ||
288 | if ($Worker[0]->prev_company->count() > 0) { | 289 | if ($Worker[0]->prev_company->count() > 0) { |
289 | // 10% | 290 | // 10% |
290 | $persent = $persent + 10; | 291 | $persent = $persent + 10; |
291 | $persent4 = 10; | 292 | $persent4 = 10; |
292 | } | 293 | } |
293 | 294 | ||
294 | if (!empty($Worker[0]->photo)) { | 295 | if (!empty($Worker[0]->photo)) { |
295 | // 5% | 296 | // 5% |
296 | $persent = $persent + 5; | 297 | $persent = $persent + 5; |
297 | $persent5 = 5; | 298 | $persent5 = 5; |
298 | } | 299 | } |
299 | if ($request->has('print')) { | 300 | if ($request->has('print')) { |
300 | dd($Worker); | 301 | dd($Worker); |
301 | } else { | 302 | } else { |
302 | return view('workers.cabinet', compact('Worker', 'Infobloks', 'persent', 'Job_titles', 'Infoblocks', 'stat')); | 303 | return view('workers.cabinet', compact('Worker', 'Infobloks', 'persent', 'Job_titles', 'Infoblocks', 'stat')); |
303 | } | 304 | } |
304 | } | 305 | } |
305 | 306 | ||
306 | // Сохранение данных | 307 | // Сохранение данных |
307 | public function cabinet_save(Worker $worker, Request $request) | 308 | public function cabinet_save(Worker $worker, Request $request) |
308 | { | 309 | { |
309 | $id = $worker->id; | 310 | $id = $worker->id; |
310 | $params = $request->all(); | 311 | $params = $request->all(); |
311 | 312 | ||
312 | $job_title_id = $request->get('job_title_id'); | 313 | $job_title_id = $request->get('job_title_id'); |
313 | 314 | ||
314 | unset($params['new_diplom']); | 315 | unset($params['new_diplom']); |
315 | unset($params['new_data_begin']); | 316 | unset($params['new_data_begin']); |
316 | unset($params['new_data_end']); | 317 | unset($params['new_data_end']); |
317 | unset($params['new_job_title']); | 318 | unset($params['new_job_title']); |
318 | unset($params['new_teplohod']); | 319 | unset($params['new_teplohod']); |
319 | unset($params['new_GWT']); | 320 | unset($params['new_GWT']); |
320 | unset($params['new_KBT']); | 321 | unset($params['new_KBT']); |
321 | unset($params['new_Begin_work']); | 322 | unset($params['new_Begin_work']); |
322 | unset($params['new_End_work']); | 323 | unset($params['new_End_work']); |
323 | unset($params['new_name_company']); | 324 | unset($params['new_name_company']); |
324 | 325 | ||
325 | $rules = [ | 326 | $rules = [ |
326 | 'surname' => ['required', 'string', 'max:255'], | 327 | 'surname' => ['required', 'string', 'max:255'], |
327 | 'name_man' => ['required', 'string', 'max:255'], | 328 | 'name_man' => ['required', 'string', 'max:255'], |
328 | 'email' => ['required', 'string', 'email', 'max:255'], | 329 | 'email' => ['required', 'string', 'email', 'max:255'], |
329 | 330 | ||
330 | ]; | 331 | ]; |
331 | 332 | ||
332 | $messages = [ | 333 | $messages = [ |
333 | 'required' => 'Укажите обязательное поле', | 334 | 'required' => 'Укажите обязательное поле', |
334 | 'min' => [ | 335 | 'min' => [ |
335 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 336 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
336 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 337 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
337 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 338 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
338 | ], | 339 | ], |
339 | 'max' => [ | 340 | 'max' => [ |
340 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 341 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
341 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 342 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
342 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 343 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
343 | ] | 344 | ] |
344 | ]; | 345 | ]; |
345 | 346 | ||
346 | $validator = Validator::make($params, $rules, $messages); | 347 | $validator = Validator::make($params, $rules, $messages); |
347 | 348 | ||
348 | if ($validator->fails()) { | 349 | if ($validator->fails()) { |
349 | return redirect()->route('worker.cabinet')->withErrors($validator); | 350 | return redirect()->route('worker.cabinet')->withErrors($validator); |
350 | } else { | 351 | } else { |
351 | 352 | ||
352 | if ($request->has('photo')) { | 353 | if ($request->has('photo')) { |
353 | if (!empty($Worker->photo)) { | 354 | if (!empty($Worker->photo)) { |
354 | Storage::delete($Worker->photo); | 355 | Storage::delete($Worker->photo); |
355 | } | 356 | } |
356 | $params['photo'] = $request->file('photo')->store("worker/$id", 'public'); | 357 | $params['photo'] = $request->file('photo')->store("worker/$id", 'public'); |
357 | } | 358 | } |
358 | 359 | ||
359 | if ($request->has('file')) { | 360 | if ($request->has('file')) { |
360 | if (!empty($Worker->file)) { | 361 | if (!empty($Worker->file)) { |
361 | Storage::delete($Worker->file); | 362 | Storage::delete($Worker->file); |
362 | } | 363 | } |
363 | $params['file'] = $request->file('file')->store("worker/$id", 'public'); | 364 | $params['file'] = $request->file('file')->store("worker/$id", 'public'); |
364 | } | 365 | } |
365 | 366 | ||
366 | $id_wor = $worker->update($params); | 367 | $id_wor = $worker->update($params); |
367 | $use = User::find($worker->user_id); | 368 | $use = User::find($worker->user_id); |
368 | $use->surname = $request->get('surname'); | 369 | $use->surname = $request->get('surname'); |
369 | $use->name_man = $request->get('name_man'); | 370 | $use->name_man = $request->get('name_man'); |
370 | $use->surname2 = $request->get('surname2'); | 371 | $use->surname2 = $request->get('surname2'); |
371 | 372 | ||
372 | $use->save(); | 373 | $use->save(); |
373 | $worker->job_titles()->sync($job_title_id); | 374 | $worker->job_titles()->sync($job_title_id); |
374 | 375 | ||
375 | return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены'); | 376 | return redirect()->route('worker.cabinet')->with('success', 'Данные были успешно сохранены'); |
376 | } | 377 | } |
377 | } | 378 | } |
378 | 379 | ||
379 | // Сообщения данные | 380 | // Сообщения данные |
380 | public function messages($type_message) | 381 | public function messages($type_message) |
381 | { | 382 | { |
382 | $user_id = Auth()->user()->id; | 383 | $user_id = Auth()->user()->id; |
383 | 384 | ||
384 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> | 385 | $messages_input = Message::query()->with('vacancies')->with('user_from')-> |
385 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); | 386 | Where('to_user_id', $user_id)->OrderByDesc('created_at'); |
386 | 387 | ||
387 | $messages_output = Message::query()->with('vacancies')-> | 388 | $messages_output = Message::query()->with('vacancies')-> |
388 | with('user_to')->where('user_id', $user_id)-> | 389 | with('user_to')->where('user_id', $user_id)-> |
389 | OrderByDesc('created_at'); | 390 | OrderByDesc('created_at'); |
390 | 391 | ||
391 | 392 | ||
392 | $count_input = $messages_input->count(); | 393 | $count_input = $messages_input->count(); |
393 | $count_output = $messages_output->count(); | 394 | $count_output = $messages_output->count(); |
394 | 395 | ||
395 | if ($type_message == 'input') { | 396 | if ($type_message == 'input') { |
396 | $messages = $messages_input->paginate(5); | 397 | $messages = $messages_input->paginate(5); |
397 | } | 398 | } |
398 | 399 | ||
399 | if ($type_message == 'output') { | 400 | if ($type_message == 'output') { |
400 | $messages = $messages_output->paginate(5); | 401 | $messages = $messages_output->paginate(5); |
401 | } | 402 | } |
402 | 403 | ||
403 | // Вернуть все 100% | 404 | // Вернуть все 100% |
404 | return view('workers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); | 405 | return view('workers.messages', compact('messages', 'count_input', 'count_output', 'type_message', 'user_id')); |
405 | } | 406 | } |
406 | 407 | ||
407 | // Избранный | 408 | // Избранный |
408 | public function favorite() | 409 | public function favorite() |
409 | { | 410 | { |
410 | return view('workers.favorite'); | 411 | return view('workers.favorite'); |
411 | } | 412 | } |
412 | 413 | ||
413 | // Сменить пароль | 414 | // Сменить пароль |
414 | public function new_password() | 415 | public function new_password() |
415 | { | 416 | { |
416 | $email = Auth()->user()->email; | 417 | $email = Auth()->user()->email; |
417 | return view('workers.new_password', compact('email')); | 418 | return view('workers.new_password', compact('email')); |
418 | } | 419 | } |
419 | 420 | ||
420 | // Обновление пароля | 421 | // Обновление пароля |
421 | public function save_new_password(Request $request) { | 422 | public function save_new_password(Request $request) { |
422 | $use = Auth()->user(); | 423 | $use = Auth()->user(); |
423 | $request->validate([ | 424 | $request->validate([ |
424 | 'password' => 'required|string', | 425 | 'password' => 'required|string', |
425 | 'new_password' => 'required|string', | 426 | 'new_password' => 'required|string', |
426 | 'new_password2' => 'required|string' | 427 | 'new_password2' => 'required|string' |
427 | ]); | 428 | ]); |
428 | 429 | ||
429 | if ($request->get('new_password') == $request->get('new_password2')) | 430 | if ($request->get('new_password') == $request->get('new_password2')) |
430 | if ($request->get('password') !== $request->get('new_password')) { | 431 | if ($request->get('password') !== $request->get('new_password')) { |
431 | $credentials = $request->only('email', 'password'); | 432 | $credentials = $request->only('email', 'password'); |
432 | if (Auth::attempt($credentials, $request->has('save_me'))) { | 433 | if (Auth::attempt($credentials, $request->has('save_me'))) { |
433 | 434 | ||
434 | if (!is_null($use->email_verified_at)){ | 435 | if (!is_null($use->email_verified_at)){ |
435 | 436 | ||
436 | $user_data = User_Model::find($use->id); | 437 | $user_data = User_Model::find($use->id); |
437 | $user_data->update([ | 438 | $user_data->update([ |
438 | 'password' => Hash::make($request->get('new_password')), | 439 | 'password' => Hash::make($request->get('new_password')), |
439 | 'pubpassword' => base64_encode($request->get('new_password')), | 440 | 'pubpassword' => base64_encode($request->get('new_password')), |
440 | ]); | 441 | ]); |
441 | return redirect() | 442 | return redirect() |
442 | ->route('worker.new_password') | 443 | ->route('worker.new_password') |
443 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); | 444 | ->with('success', 'Поздравляю! Вы обновили свой пароль!'); |
444 | } | 445 | } |
445 | 446 | ||
446 | return redirect() | 447 | return redirect() |
447 | ->route('worker.new_password') | 448 | ->route('worker.new_password') |
448 | ->withError('Данная учетная запись не было верифицированна!'); | 449 | ->withError('Данная учетная запись не было верифицированна!'); |
449 | } | 450 | } |
450 | } | 451 | } |
451 | 452 | ||
452 | return redirect() | 453 | return redirect() |
453 | ->route('worker.new_password') | 454 | ->route('worker.new_password') |
454 | ->withErrors('Не совпадение данных, обновите пароли!'); | 455 | ->withErrors('Не совпадение данных, обновите пароли!'); |
455 | } | 456 | } |
456 | 457 | ||
457 | // Удаление профиля форма | 458 | // Удаление профиля форма |
458 | public function delete_profile() | 459 | public function delete_profile() |
459 | { | 460 | { |
460 | $login = Auth()->user()->email; | 461 | $login = Auth()->user()->email; |
461 | return view('workers.delete_profile', compact('login')); | 462 | return view('workers.delete_profile', compact('login')); |
462 | } | 463 | } |
463 | 464 | ||
464 | // Удаление профиля код | 465 | // Удаление профиля код |
465 | public function delete_profile_result(Request $request) { | 466 | public function delete_profile_result(Request $request) { |
466 | $Answer = $request->all(); | 467 | $Answer = $request->all(); |
467 | $user_id = Auth()->user()->id; | 468 | $user_id = Auth()->user()->id; |
468 | $request->validate([ | 469 | $request->validate([ |
469 | 'password' => 'required|string', | 470 | 'password' => 'required|string', |
470 | ]); | 471 | ]); |
471 | 472 | ||
472 | $credentials = $request->only('email', 'password'); | 473 | $credentials = $request->only('email', 'password'); |
473 | if (Auth::attempt($credentials)) { | 474 | if (Auth::attempt($credentials)) { |
474 | Auth::logout(); | 475 | Auth::logout(); |
475 | $it = User_Model::find($user_id); | 476 | $it = User_Model::find($user_id); |
476 | $it->delete(); | 477 | $it->delete(); |
477 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); | 478 | return redirect()->route('index')->with('success', 'Вы успешно удалили свой аккаунт'); |
478 | } else { | 479 | } else { |
479 | return redirect()->route('worker.delete_profile') | 480 | return redirect()->route('worker.delete_profile') |
480 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); | 481 | ->withErrors( 'Неверный пароль! Нужен корректный пароль'); |
481 | } | 482 | } |
482 | } | 483 | } |
483 | 484 | ||
484 | // Регистрация соискателя | 485 | // Регистрация соискателя |
485 | public function register_worker(Request $request) | 486 | public function register_worker(Request $request) |
486 | { | 487 | { |
487 | $params = $request->all(); | 488 | $params = $request->all(); |
488 | $params['is_worker'] = 1; | 489 | $params['is_worker'] = 1; |
489 | 490 | ||
490 | $rules = [ | 491 | $rules = [ |
491 | 'surname' => ['required', 'string', 'max:255'], | 492 | 'surname' => ['required', 'string', 'max:255'], |
492 | 'name_man' => ['required', 'string', 'max:255'], | 493 | 'name_man' => ['required', 'string', 'max:255'], |
493 | 'email' => ['required', 'email', 'max:255', 'unique:users'], | 494 | 'email' => ['required', 'email', 'max:255', 'unique:users'], |
494 | 'password' => ['required', 'string', 'min:6'] | 495 | 'password' => ['required', 'string', 'min:6'] |
495 | ]; | 496 | ]; |
496 | 497 | ||
497 | $messages = [ | 498 | $messages = [ |
498 | 'required' => 'Укажите обязательное поле', | 499 | 'required' => 'Укажите обязательное поле', |
499 | 'min' => [ | 500 | 'min' => [ |
500 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 501 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
501 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 502 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
502 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 503 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
503 | ], | 504 | ], |
504 | 'max' => [ | 505 | 'max' => [ |
505 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 506 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
506 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 507 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
507 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 508 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
508 | ] | 509 | ] |
509 | ]; | 510 | ]; |
510 | 511 | ||
511 | $email = $request->get('email'); | 512 | $email = $request->get('email'); |
512 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { | 513 | if (!preg_match("/^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$/", $email)) { |
513 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); | 514 | return json_encode(Array("ERROR" => "Error: Отсутствует емайл или некорректный емайл")); |
514 | } | 515 | } |
515 | 516 | ||
516 | if ($request->get('password') !== $request->get('confirmed')){ | 517 | if ($request->get('password') !== $request->get('confirmed')){ |
517 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); | 518 | return json_encode(Array("ERROR" => "Error: Не совпадают пароль и подтверждение пароля")); |
518 | } | 519 | } |
519 | 520 | ||
520 | if (strlen($request->get('password')) < 6) { | 521 | if (strlen($request->get('password')) < 6) { |
521 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); | 522 | return json_encode(Array("ERROR" => "Error: Недостаточная длина пароля! Увеличьте себе длину пароля!")); |
522 | } | 523 | } |
523 | 524 | ||
524 | /*$haystack = $request->get('password'); | 525 | /*$haystack = $request->get('password'); |
525 | 526 | ||
526 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); | 527 | $specsumbol = Array('!','~', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', ';', ':', '<', '>', '?'); |
527 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', | 528 | $alpha = Array('Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', |
528 | 'X', 'C', 'V', 'B', 'N', 'M'); | 529 | 'X', 'C', 'V', 'B', 'N', 'M'); |
529 | $lenpwd_bool = true; | 530 | $lenpwd_bool = true; |
530 | $spec_bool = false; | 531 | $spec_bool = false; |
531 | $alpha_bool = false; | 532 | $alpha_bool = false; |
532 | 533 | ||
533 | if (strlen($haystack) < 8) $lenpwd_bool = false; | 534 | if (strlen($haystack) < 8) $lenpwd_bool = false; |
534 | 535 | ||
535 | foreach ($specsumbol as $it) { | 536 | foreach ($specsumbol as $it) { |
536 | if (strpos($haystack, $it) !== false) { | 537 | if (strpos($haystack, $it) !== false) { |
537 | $spec_bool = true; | 538 | $spec_bool = true; |
538 | } | 539 | } |
539 | } | 540 | } |
540 | 541 | ||
541 | foreach ($alpha as $it) { | 542 | foreach ($alpha as $it) { |
542 | if (strpos($haystack, $it) !== false) { | 543 | if (strpos($haystack, $it) !== false) { |
543 | $alpha_bool = true; | 544 | $alpha_bool = true; |
544 | } | 545 | } |
545 | } | 546 | } |
546 | 547 | ||
547 | if ((!$spec_bool) || (!$alpha_bool)) { | 548 | if ((!$spec_bool) || (!$alpha_bool)) { |
548 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); | 549 | return json_encode(Array("ERROR" => "Error: Нет спецсимволов в пароле, латинские буквы заглавные, а также один из символов: !~#$%^&*()-=;,:<>?")); |
549 | }*/ | 550 | }*/ |
550 | 551 | ||
551 | if (($request->has('politik')) && ($request->get('politik') == 1)) { | 552 | if (($request->has('politik')) && ($request->get('politik') == 1)) { |
552 | $validator = Validator::make($params, $rules, $messages); | 553 | $validator = Validator::make($params, $rules, $messages); |
553 | 554 | ||
554 | if ($validator->fails()) { | 555 | if ($validator->fails()) { |
555 | return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); | 556 | return json_encode(array("ERROR" => "Error1: Регистрация оборвалась ошибкой! Не все обязательные поля заполнены. Либо вы уже были зарегистрированы в системе.")); |
556 | } else { | 557 | } else { |
557 | //dd($params); | 558 | //dd($params); |
558 | $user = $this->create($params); | 559 | $user = $this->create($params); |
559 | event(new Registered($user)); | 560 | event(new Registered($user)); |
560 | Auth::guard()->login($user); | 561 | Auth::guard()->login($user); |
561 | } | 562 | } |
562 | if ($user) { | 563 | if ($user) { |
563 | return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));; | 564 | return json_encode(Array("REDIRECT" => redirect()->route('worker.cabinet')->getTargetUrl()));; |
564 | } else { | 565 | } else { |
565 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); | 566 | return json_encode(Array("ERROR" => "Error2: Данные были утеряны!")); |
566 | } | 567 | } |
567 | 568 | ||
568 | } else { | 569 | } else { |
569 | return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!")); | 570 | return json_encode(Array("ERROR" => "Error3: Вы не согласились с политикой конфидициальности!")); |
570 | } | 571 | } |
571 | } | 572 | } |
572 | 573 | ||
573 | // Звездная оценка и ответ | 574 | // Звездная оценка и ответ |
574 | public function stars_answer(Request $request) { | 575 | public function stars_answer(Request $request) { |
575 | $params = $request->all(); | 576 | $params = $request->all(); |
576 | $rules = [ | 577 | $rules = [ |
577 | 'message' => ['required', 'string', 'max:255'], | 578 | 'message' => ['required', 'string', 'max:255'], |
578 | ]; | 579 | ]; |
579 | 580 | ||
580 | $messages = [ | 581 | $messages = [ |
581 | 'required' => 'Укажите обязательное поле', | 582 | 'required' => 'Укажите обязательное поле', |
582 | 'min' => [ | 583 | 'min' => [ |
583 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', | 584 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
584 | 'integer' => 'Поле «:attribute» должно быть :min или больше', | 585 | 'integer' => 'Поле «:attribute» должно быть :min или больше', |
585 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' | 586 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
586 | ], | 587 | ], |
587 | 'max' => [ | 588 | 'max' => [ |
588 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', | 589 | 'string' => 'Поле «:attribute» должно быть не больше :max символов', |
589 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', | 590 | 'integer' => 'Поле «:attribute» должно быть :max или меньше', |
590 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' | 591 | 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' |
591 | ] | 592 | ] |
592 | ]; | 593 | ]; |
593 | $response_worker = ResponseWork::create($params); | 594 | $response_worker = ResponseWork::create($params); |
594 | return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!'); | 595 | return redirect()->route('resume_profile', ['worker' => $request->get('worker_id')])->with('success', 'Ваше сообщение было отправлено!'); |
595 | } | 596 | } |
596 | 597 | ||
597 | public function TestWorker() | 598 | public function TestWorker() |
598 | { | 599 | { |
599 | $Use = new User(); | 600 | $Use = new User(); |
600 | 601 | ||
601 | $Code_user = $Use->create([ | 602 | $Code_user = $Use->create([ |
602 | 'name' => 'surname name_man', | 603 | 'name' => 'surname name_man', |
603 | 'name_man' => 'name_man', | 604 | 'name_man' => 'name_man', |
604 | 'surname' => 'surname', | 605 | 'surname' => 'surname', |
605 | 'surname2' => 'surname2', | 606 | 'surname2' => 'surname2', |
606 | 'subscribe_email' => '1', | 607 | 'subscribe_email' => '1', |
607 | 'email' => 'email@mail.com', | 608 | 'email' => 'email@mail.com', |
608 | 'telephone' => '1234567890', | 609 | 'telephone' => '1234567890', |
609 | 'password' => Hash::make('password'), | 610 | 'password' => Hash::make('password'), |
610 | 'pubpassword' => base64_encode('password'), | 611 | 'pubpassword' => base64_encode('password'), |
611 | 'email_verified_at' => Carbon::now(), | 612 | 'email_verified_at' => Carbon::now(), |
612 | 'is_worker' => 1, | 613 | 'is_worker' => 1, |
613 | ]); | 614 | ]); |
614 | 615 | ||
615 | if ($Code_user->id > 0) { | 616 | if ($Code_user->id > 0) { |
616 | $Worker = new Worker(); | 617 | $Worker = new Worker(); |
617 | $Worker->user_id = $Code_user->id; | 618 | $Worker->user_id = $Code_user->id; |
618 | $Worker->position_work = 1; //'job_titles'; | 619 | $Worker->position_work = 1; //'job_titles'; |
619 | $Worker->email = 'email@email.com'; | 620 | $Worker->email = 'email@email.com'; |
620 | $Worker->telephone = '1234567890'; | 621 | $Worker->telephone = '1234567890'; |
621 | $status = $Worker->save(); | 622 | $status = $Worker->save(); |
622 | 623 | ||
623 | $Title_Worker = new Title_worker(); | 624 | $Title_Worker = new Title_worker(); |
624 | $Title_Worker->worker_id = $Worker->id; | 625 | $Title_Worker->worker_id = $Worker->id; |
625 | $Title_Worker->job_title_id = 1; | 626 | $Title_Worker->job_title_id = 1; |
626 | $Title_Worker->save(); | 627 | $Title_Worker->save(); |
627 | } | 628 | } |
628 | } | 629 | } |
629 | 630 | ||
630 | // Создание пользователя | 631 | // Создание пользователя |
631 | protected function create(array $data) | 632 | protected function create(array $data) |
632 | { | 633 | { |
633 | $Use = new User(); | 634 | $Use = new User(); |
634 | 635 | ||
635 | $Code_user = $Use->create([ | 636 | $Code_user = $Use->create([ |
636 | 'name' => $data['surname']." ".$data['name_man'], | 637 | 'name' => $data['surname']." ".$data['name_man'], |
637 | 'name_man' => $data['name_man'], | 638 | 'name_man' => $data['name_man'], |
638 | 'surname' => $data['surname'], | 639 | 'surname' => $data['surname'], |
639 | 'surname2' => $data['surname2'], | 640 | 'surname2' => $data['surname2'], |
640 | 'subscribe_email' => $data['email'], | 641 | 'subscribe_email' => $data['email'], |
641 | 'email' => $data['email'], | 642 | 'email' => $data['email'], |
642 | 'telephone' => $data['telephone'], | 643 | 'telephone' => $data['telephone'], |
643 | 'password' => Hash::make($data['password']), | 644 | 'password' => Hash::make($data['password']), |
644 | 'pubpassword' => base64_encode($data['password']), | 645 | 'pubpassword' => base64_encode($data['password']), |
645 | 'email_verified_at' => Carbon::now(), | 646 | 'email_verified_at' => Carbon::now(), |
646 | 'is_worker' => $data['is_worker'], | 647 | 'is_worker' => $data['is_worker'], |
647 | ]); | 648 | ]); |
648 | 649 | ||
649 | if ($Code_user->id > 0) { | 650 | if ($Code_user->id > 0) { |
650 | $Worker = new Worker(); | 651 | $Worker = new Worker(); |
651 | $Worker->user_id = $Code_user->id; | 652 | $Worker->user_id = $Code_user->id; |
652 | $Worker->position_work = $data['job_titles']; | 653 | $Worker->position_work = $data['job_titles']; |
653 | $Worker->email = $data['email']; | 654 | $Worker->email = $data['email']; |
654 | $Worker->telephone = $data['telephone']; | 655 | $Worker->telephone = $data['telephone']; |
655 | $Worker->save(); | 656 | $Worker->save(); |
656 | 657 | ||
657 | if (isset($Worker->id)) { | 658 | if (isset($Worker->id)) { |
658 | $Title_Worker = new Title_worker(); | 659 | $Title_Worker = new Title_worker(); |
659 | $Title_Worker->worker_id = $Worker->id; | 660 | $Title_Worker->worker_id = $Worker->id; |
660 | $Title_Worker->job_title_id = $data['job_titles']; | 661 | $Title_Worker->job_title_id = $data['job_titles']; |
661 | $Title_Worker->save(); | 662 | $Title_Worker->save(); |
662 | } | 663 | } |
663 | 664 | ||
664 | return $Code_user; | 665 | return $Code_user; |
665 | } | 666 | } |
666 | } | 667 | } |
667 | 668 | ||
668 | // Вакансии избранные | 669 | // Вакансии избранные |
669 | public function colorado(Request $request) { | 670 | public function colorado(Request $request) { |
670 | $IP_address = RusDate::ip_addr_client(); | 671 | $IP_address = RusDate::ip_addr_client(); |
671 | $Arr = Like_vacancy::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); | 672 | $Arr = Like_vacancy::Query()->select('code_record')->where('ip_address', '=', $IP_address)->get(); |
672 | 673 | ||
673 | if ($Arr->count()) { | 674 | if ($Arr->count()) { |
674 | $A = Array(); | 675 | $A = Array(); |
675 | foreach ($Arr as $it) { | 676 | foreach ($Arr as $it) { |
676 | $A[] = $it->code_record; | 677 | $A[] = $it->code_record; |
677 | } | 678 | } |
678 | 679 | ||
679 | $Query = Ad_employer::query()->whereIn('id', $A); | 680 | $Query = Ad_employer::query()->whereIn('id', $A); |
680 | } else { | 681 | } else { |
681 | $Query = Ad_employer::query()->where('id', '=', '0'); | 682 | $Query = Ad_employer::query()->where('id', '=', '0'); |
682 | } | 683 | } |
683 | 684 | ||
684 | $Query = $Query->with('jobs')-> | 685 | $Query = $Query->with('jobs')-> |
685 | with('cat')-> | 686 | with('cat')-> |
686 | with('employer')-> | 687 | with('employer')-> |
687 | whereHas('jobs_code', function ($query) use ($request) { | 688 | whereHas('jobs_code', function ($query) use ($request) { |
688 | if ($request->ajax()) { | 689 | if ($request->ajax()) { |
689 | if (null !== ($request->get('job'))) { | 690 | if (null !== ($request->get('job'))) { |
690 | $query->where('job_title_id', $request->get('job')); | 691 | $query->where('job_title_id', $request->get('job')); |
691 | } | 692 | } |
692 | } | 693 | } |
693 | })->select('ad_employers.*'); | 694 | })->select('ad_employers.*'); |
694 | 695 | ||
695 | $Job_title = Job_title::query()->OrderBy('name')->get(); | 696 | $Job_title = Job_title::query()->OrderBy('name')->get(); |
696 | 697 | ||
697 | $Query_count = $Query->count(); | 698 | $Query_count = $Query->count(); |
698 | 699 | ||
699 | $Query = $Query->OrderBy('updated_at')->paginate(3); | 700 | $Query = $Query->OrderBy('updated_at')->paginate(3); |
700 | 701 | ||
701 | 702 | ||
702 | return view('workers.favorite', compact('Query', | 703 | return view('workers.favorite', compact('Query', |
703 | 'Query_count', | 704 | 'Query_count', |
704 | 'Job_title')); | 705 | 'Job_title')); |
705 | 706 | ||
706 | } | 707 | } |
707 | 708 | ||
708 | //Переписка | 709 | //Переписка |
709 | public function dialog(User_Model $user1, User_Model $user2) { | 710 | public function dialog(User_Model $user1, User_Model $user2) { |
710 | if (isset($user2->id)) { | 711 | if (isset($user2->id)) { |
711 | $companion = User_Model::query()->with('workers')-> | 712 | $companion = User_Model::query()->with('workers')-> |
712 | with('employers')-> | 713 | with('employers')-> |
713 | where('id', $user2->id)->first(); | 714 | where('id', $user2->id)->first(); |
714 | } | 715 | } |
715 | 716 | ||
716 | $Messages = Message::query()->with('response')->where(function($query) use ($user1, $user2) { | 717 | $Messages = Message::query()-> |
718 | //with('response')-> | ||
719 | where(function($query) use ($user1, $user2) { | ||
717 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); | 720 | $query->where('user_id', $user1->id)->where('to_user_id', $user2->id); |
718 | })->orWhere(function($query) use ($user1, $user2) { | 721 | })->orWhere(function($query) use ($user1, $user2) { |
719 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); | 722 | $query->where('user_id', $user2->id)->where('to_user_id', $user1->id); |
720 | })->OrderBy('created_at')->get(); | 723 | })->OrderBy('created_at')->get(); |
721 | 724 | ||
722 | $id_vac = null; | 725 | $id_vac = null; |
723 | foreach ($Messages as $it) { | 726 | /*foreach ($Messages as $it) { |
724 | if (isset($it->response)) { | 727 | if (isset($it->response)) { |
725 | foreach ($it->response as $r) { | 728 | foreach ($it->response as $r) { |
726 | if (isset($r->ad_employer_id)) { | 729 | if (isset($r->ad_employer_id)) { |
727 | $id_vac = $r->ad_employer_id; | 730 | $id_vac = $r->ad_employer_id; |
728 | break; | 731 | break; |
729 | } | 732 | } |
730 | } | 733 | } |
731 | } | 734 | } |
732 | if (!is_null($id_vac)) break; | 735 | if (!is_null($id_vac)) break; |
733 | } | 736 | }*/ |
734 | 737 | ||
735 | $ad_employer = null; | 738 | $ad_employer = null; |
736 | if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); | 739 | if (!is_null($id_vac)) $ad_employer = Ad_employer::query()->where('id', $id_vac)->first(); |
737 | $sender = $user1; | 740 | $sender = $user1; |
738 | 741 | ||
739 | return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer')); | 742 | return view('workers.dialog', compact('companion', 'sender', 'Messages', 'ad_employer')); |
740 | } | 743 | } |
741 | 744 | ||
742 | // Даунылоады | 745 | // Даунылоады |
743 | public function download(Worker $worker) { | 746 | public function download(Worker $worker) { |
744 | $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...']; | 747 | $arr_house = ['0' => 'Проверка, проверка, проверка, проверка, проверка...']; |
745 | view()->share('house',$arr_house); | 748 | view()->share('house',$arr_house); |
746 | $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape'); | 749 | $pdf = PDF::loadView('layout.pdf', $arr_house)->setPaper('a4', 'landscape'); |
747 | return $pdf->stream(); | 750 | return $pdf->stream(); |
748 | } | 751 | } |
749 | 752 | ||
750 | // Поднятие анкеты | 753 | // Поднятие анкеты |
751 | public function up(Worker $worker) { | 754 | public function up(Worker $worker) { |
752 | $worker->updated_at = Carbon::now(); | 755 | $worker->updated_at = Carbon::now(); |
753 | $worker->save(); | 756 | $worker->save(); |
754 | // 0 | 757 | // 0 |
755 | return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); | 758 | return redirect()->route('worker.cabinet')->with('success', 'Ваша анкета была поднята выше остальных'); |
756 | } | 759 | } |
757 | 760 | ||
758 | // Форма сертификате | 761 | // Форма сертификате |
759 | public function new_sertificate(Worker $worker) { | 762 | public function new_sertificate(Worker $worker) { |
760 | return view('workers.sertificate_add', compact('worker')); | 763 | return view('workers.sertificate_add', compact('worker')); |
761 | } | 764 | } |
762 | 765 | ||
763 | // Добавление сертификата | 766 | // Добавление сертификата |
764 | public function add_serificate(SertificationRequest $request) { | 767 | public function add_serificate(SertificationRequest $request) { |
765 | $params = $request->all(); | 768 | $params = $request->all(); |
766 | 769 | ||
767 | $Sertificate = new sertification(); | 770 | $Sertificate = new sertification(); |
768 | $Sertificate->create($params); | 771 | $Sertificate->create($params); |
769 | $Docs = sertification::query()->where('worker_id', $request->get('worker_id'))->get(); | 772 | $Docs = sertification::query()->where('worker_id', $request->get('worker_id'))->get(); |
770 | return redirect()->route('worker.cabinet'); | 773 | return redirect()->route('worker.cabinet'); |
771 | //return view('ajax.documents', compact('Docs')); | 774 | //return view('ajax.documents', compact('Docs')); |
772 | } | 775 | } |
773 | 776 | ||
774 | // Удалить сертификат | 777 | // Удалить сертификат |
775 | public function delete_sertificate(sertification $doc) { | 778 | public function delete_sertificate(sertification $doc) { |
776 | $doc->delete(); | 779 | $doc->delete(); |
777 | 780 | ||
778 | return redirect()->route('worker.cabinet'); | 781 | return redirect()->route('worker.cabinet'); |
779 | } | 782 | } |
780 | 783 | ||
781 | // Редактирование сертификата | 784 | // Редактирование сертификата |
782 | public function edit_sertificate(Worker $worker, sertification $doc) { | 785 | public function edit_sertificate(Worker $worker, sertification $doc) { |
783 | return view('workers.sertificate_edit', compact('doc', 'worker')); | 786 | return view('workers.sertificate_edit', compact('doc', 'worker')); |
784 | } | 787 | } |
785 | 788 | ||
786 | // Редактирование обновление сертификата | 789 | // Редактирование обновление сертификата |
787 | public function update_serificate(SertificationRequest $request, sertification $doc) { | 790 | public function update_serificate(SertificationRequest $request, sertification $doc) { |
788 | $all = $request->all(); | 791 | $all = $request->all(); |
789 | $doc->worker_id = $all['worker_id']; | 792 | $doc->worker_id = $all['worker_id']; |
790 | $doc->name = $all['name']; | 793 | $doc->name = $all['name']; |
791 | $doc->end_begin = $all['end_begin']; | 794 | $doc->end_begin = $all['end_begin']; |
792 | $doc->save(); | 795 | $doc->save(); |
793 | 796 | ||
794 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); | 797 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); |
795 | } | 798 | } |
796 | 799 | ||
797 | public function delete_add_diplom(Request $request, Worker $worker) { | 800 | public function delete_add_diplom(Request $request, Worker $worker) { |
798 | $infoblok_id = $request->get('infoblok_id'); | 801 | $infoblok_id = $request->get('infoblok_id'); |
799 | 802 | ||
800 | if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0) | 803 | if (Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->count() > 0) |
801 | $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete(); | 804 | $id = Dop_info::query()->where('worker_id', $worker->id)->where('infoblok_id', $infoblok_id)->delete(); |
802 | else { | 805 | else { |
803 | $params['infoblok_id'] = $infoblok_id; | 806 | $params['infoblok_id'] = $infoblok_id; |
804 | $params['worker_id'] = $worker->id; | 807 | $params['worker_id'] = $worker->id; |
805 | $params['status'] = $request->get('val'); | 808 | $params['status'] = $request->get('val'); |
806 | $id = Dop_info::create($params); | 809 | $id = Dop_info::create($params); |
807 | //$id = $worker->infobloks()->sync([$infoblok_id]); | 810 | //$id = $worker->infobloks()->sync([$infoblok_id]); |
808 | } | 811 | } |
809 | 812 | ||
810 | //$Infoblocks = infobloks::query()->get(); | 813 | //$Infoblocks = infobloks::query()->get(); |
811 | return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); | 814 | return $id; //redirect()->route('worker.cabinet')->getTargetUrl(); //view('workers.ajax.diploms_dop', compact('worker', 'Infoblocks')); |
812 | } | 815 | } |
813 | 816 | ||
814 | 817 | ||
815 | 818 | ||
816 | // Добавление диплома | 819 | // Добавление диплома |
817 | public function add_diplom_ajax(Request $request) { | 820 | public function add_diplom_ajax(Request $request) { |
818 | // конец | 821 | // конец |
819 | $params = $request->all(); | 822 | $params = $request->all(); |
820 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); | 823 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); |
821 | 824 | ||
822 | if ($count == 0) $dop_info = Dop_info::create($params); | 825 | if ($count == 0) $dop_info = Dop_info::create($params); |
823 | $Infoblocks = infobloks::query()->get(); | 826 | $Infoblocks = infobloks::query()->get(); |
824 | $Worker = Worker::query()->where('id', $request->get('worker_id'))->get(); | 827 | $Worker = Worker::query()->where('id', $request->get('worker_id'))->get(); |
825 | $data = Dop_info::query()->where('worker_id', $request->has('worker_id')); | 828 | $data = Dop_info::query()->where('worker_id', $request->has('worker_id')); |
826 | return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker')); | 829 | return view('ajax.dop_info', compact('data', 'Infoblocks', 'Worker')); |
827 | } | 830 | } |
828 | 831 | ||
829 | // Добавление диплома без ajax | 832 | // Добавление диплома без ajax |
830 | public function add_diplom(Worker $worker) { | 833 | public function add_diplom(Worker $worker) { |
831 | $worker_id = $worker->id; | 834 | $worker_id = $worker->id; |
832 | $Infoblocks = infobloks::query()->get(); | 835 | $Infoblocks = infobloks::query()->get(); |
833 | return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks')); | 836 | return view('workers.dop_info', compact('worker_id', 'worker', 'Infoblocks')); |
834 | } | 837 | } |
835 | // Сохранить | 838 | // Сохранить |
836 | // Сохраняю диплом | 839 | // Сохраняю диплом |
837 | public function add_diplom_save(Request $request) { | 840 | public function add_diplom_save(Request $request) { |
838 | $params = $request->all(); | 841 | $params = $request->all(); |
839 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); | 842 | $count = Dop_info::query()->where('worker_id', $request->get('worker_id'))->where('infoblok_id', $request->get('infoblok_id'))->count(); |
840 | if ($count == 0) $dop_info = Dop_info::create($params); | 843 | if ($count == 0) $dop_info = Dop_info::create($params); |
841 | return redirect()->route('worker.cabinet'); | 844 | return redirect()->route('worker.cabinet'); |
842 | } | 845 | } |
843 | 846 | ||
844 | // Добавление стандартного документа | 847 | // Добавление стандартного документа |
845 | public function add_document(Worker $worker) { | 848 | public function add_document(Worker $worker) { |
846 | return view('workers.docs', compact('worker')); | 849 | return view('workers.docs', compact('worker')); |
847 | } | 850 | } |
848 | 851 | ||
849 | //Сохранение стандартого документа | 852 | //Сохранение стандартого документа |
850 | public function add_document_save(DocumentsRequest $request) { | 853 | public function add_document_save(DocumentsRequest $request) { |
851 | $params = $request->all(); | 854 | $params = $request->all(); |
852 | $place_work = place_works::create($params); | 855 | $place_work = place_works::create($params); |
853 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно добавили запись!'); | 856 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно добавили запись!'); |
854 | } | 857 | } |
855 | 858 | ||
856 | // Редактирование документа | 859 | // Редактирование документа |
857 | public function edit_document(place_works $doc, Worker $worker) { | 860 | public function edit_document(place_works $doc, Worker $worker) { |
858 | return view('workers.docs-edit', compact('doc', 'worker')); | 861 | return view('workers.docs-edit', compact('doc', 'worker')); |
859 | } | 862 | } |
860 | 863 | ||
861 | //Сохранение отредактированного документа | 864 | //Сохранение отредактированного документа |
862 | public function edit_document_save(DocumentsRequest $request, place_works $doc) { | 865 | public function edit_document_save(DocumentsRequest $request, place_works $doc) { |
863 | $params = $request->all(); | 866 | $params = $request->all(); |
864 | $doc->update($params); | 867 | $doc->update($params); |
865 | 868 | ||
866 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); | 869 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись!'); |
867 | } | 870 | } |
868 | 871 | ||
869 | // Удаление документа | 872 | // Удаление документа |
870 | public function delete_document(place_works $doc) { | 873 | public function delete_document(place_works $doc) { |
871 | $doc->delete(); | 874 | $doc->delete(); |
872 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); | 875 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); |
873 | } | 876 | } |
874 | 877 | ||
875 | //Отправка нового сообщения | 878 | //Отправка нового сообщения |
876 | public function new_message(Request $request) { | 879 | public function new_message(Request $request) { |
877 | $params = $request->all(); | 880 | $params = $request->all(); |
878 | 881 | ||
879 | $id = $params['send_user_id']; | 882 | $id = $params['send_user_id']; |
880 | $message = new Message(); | 883 | $message = new Message(); |
881 | $message->user_id = $params['send_user_id']; | 884 | $message->user_id = $params['send_user_id']; |
882 | $message->to_user_id = $params['send_to_user_id']; | 885 | $message->to_user_id = $params['send_to_user_id']; |
883 | $message->title = $params['send_title']; | 886 | $message->title = $params['send_title']; |
884 | $message->text = $params['send_text']; | 887 | $message->text = $params['send_text']; |
885 | $message->ad_employer_id = $params['send_vacancy']; | 888 | $message->ad_employer_id = $params['send_vacancy']; |
886 | if ($request->has('send_file')) { | 889 | if ($request->has('send_file')) { |
887 | $message->file = $request->file('send_file')->store("worker/$id", 'public'); | 890 | $message->file = $request->file('send_file')->store("worker/$id", 'public'); |
888 | } | 891 | } |
889 | $message->flag_new = 1; | 892 | $message->flag_new = 1; |
890 | $id_message = $message->save(); | 893 | $id_message = $message->save(); |
891 | 894 | ||
892 | $data['message_id'] = $id_message; | 895 | $data['message_id'] = $id_message; |
893 | $data['ad_employer_id'] = $params['send_vacancy']; | 896 | $data['ad_employer_id'] = $params['send_vacancy']; |
894 | $data['job_title_id'] = $params['send_job_title_id']; | 897 | $data['job_title_id'] = $params['send_job_title_id']; |
895 | $data['flag'] = 1; | 898 | $data['flag'] = 1; |
896 | $ad_responce = ad_response::create($data); | 899 | $ad_responce = ad_response::create($data); |
897 | return redirect()->route('worker.messages', ['type_message' => 'output']); | 900 | return redirect()->route('worker.messages', ['type_message' => 'output']); |
898 | } | 901 | } |
899 | 902 | ||
900 | // Информация о предыдущих компаниях | 903 | // Информация о предыдущих компаниях |
901 | public function new_prev_company(Worker $worker) { | 904 | public function new_prev_company(Worker $worker) { |
902 | return view('workers.prev_company_form', compact('worker')); | 905 | return view('workers.prev_company_form', compact('worker')); |
903 | } | 906 | } |
904 | 907 | ||
905 | // Добавление контакта компании | 908 | // Добавление контакта компании |
906 | public function add_prev_company(PrevCompanyRequest $request) { | 909 | public function add_prev_company(PrevCompanyRequest $request) { |
907 | // Возвращение параметров | 910 | // Возвращение параметров |
908 | $all = $request->all(); | 911 | $all = $request->all(); |
909 | $PrevCompany = PrevCompany::create($all); | 912 | $PrevCompany = PrevCompany::create($all); |
910 | 913 | ||
911 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); | 914 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); |
912 | } | 915 | } |
913 | 916 | ||
914 | // Редактирование контакта компании | 917 | // Редактирование контакта компании |
915 | public function edit_prev_company(PrevCompany $doc, Worker $worker) { | 918 | public function edit_prev_company(PrevCompany $doc, Worker $worker) { |
916 | return view('workers.prev_company_edit_form', compact('doc', 'worker')); | 919 | return view('workers.prev_company_edit_form', compact('doc', 'worker')); |
917 | } | 920 | } |
918 | 921 | ||
919 | //Сохранение редактирования контакта компании | 922 | //Сохранение редактирования контакта компании |
920 | public function update_prev_company(PrevCompany $doc, Request $request){ | 923 | public function update_prev_company(PrevCompany $doc, Request $request){ |
921 | $all = $request->all(); | 924 | $all = $request->all(); |
922 | $doc->update($all); | 925 | $doc->update($all); |
923 | 926 | ||
924 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); | 927 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись'); |
925 | } | 928 | } |
926 | 929 | ||
927 | // Удаление контакта предыдущей компании | 930 | // Удаление контакта предыдущей компании |
928 | public function delete_prev_company(PrevCompany $doc) { | 931 | public function delete_prev_company(PrevCompany $doc) { |
929 | $doc->delete(); | 932 | $doc->delete(); |
930 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); | 933 | return redirect()->route('worker.cabinet')->with('success', 'Вы успешно удалили запись!'); |
931 | } | 934 | } |
932 | } | 935 | } |
933 | 936 | ||
934 | 937 |
app/Models/Ad_employer.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Models; | 3 | namespace App\Models; |
4 | 4 | ||
5 | use Illuminate\Database\Eloquent\Factories\HasFactory; | 5 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
6 | use Illuminate\Database\Eloquent\Model; | 6 | use Illuminate\Database\Eloquent\Model; |
7 | 7 | ||
8 | class Ad_employer extends Model | 8 | class Ad_employer extends Model |
9 | { | 9 | { |
10 | use HasFactory; | 10 | use HasFactory; |
11 | 11 | ||
12 | protected $fillable = [ | 12 | protected $fillable = [ |
13 | 'name', | 13 | 'name', |
14 | 'telephone', | 14 | 'telephone', |
15 | 'email', | 15 | 'email', |
16 | 'salary', | 16 | 'salary', |
17 | 'category_id', | 17 | 'category_id', |
18 | 'text', | 18 | 'text', |
19 | 'employer_id', | 19 | 'employer_id', |
20 | 'city', | 20 | 'city', |
21 | 'sort', | 21 | 'sort', |
22 | 'is_remove', | 22 | 'is_remove', |
23 | 'active_is', | 23 | 'active_is', |
24 | 'status', | 24 | 'status', |
25 | 'sroch_vacancy', | 25 | 'sroch_vacancy', |
26 | 'favorite_vacancy' | 26 | 'favorite_vacancy' |
27 | ]; | 27 | ]; |
28 | /* | 28 | /* |
29 | * Связь таблицы employers с таблицей ad_employers | 29 | * Связь таблицы employers с таблицей ad_employers |
30 | многие-к-одному | 30 | многие-к-одному |
31 | */ | 31 | */ |
32 | public function employer() { | 32 | public function employer() { |
33 | return $this->belongsTo(Employer::class, 'employer_id'); | 33 | return $this->belongsTo(Employer::class, 'employer_id'); |
34 | } | 34 | } |
35 | 35 | ||
36 | /* | 36 | /* |
37 | * Связь модели Вакансии (Ad_employer) с моделью Должности (Job_title) | 37 | * Связь модели Вакансии (Ad_employer) с моделью Должности (Job_title) |
38 | многие-ко-многим | 38 | многие-ко-многим |
39 | */ | 39 | */ |
40 | public function jobs() { | 40 | public function jobs() { |
41 | return $this->belongsToMany(Job_title::class, 'ad_jobs'); | 41 | return $this->belongsToMany(Job_title::class, 'ad_jobs'); |
42 | } | 42 | } |
43 | 43 | ||
44 | // Связь модели Вакансии с моделью Коды должностей и вакансий | 44 | // Связь модели Вакансии с моделью Коды должностей и вакансий |
45 | public function jobs_code() { | 45 | public function jobs_code() { |
46 | return $this->hasMany(Ad_jobs::class); | 46 | return $this->hasMany(Ad_jobs::class); |
47 | } | 47 | } |
48 | 48 | ||
49 | /* | 49 | /* |
50 | * Связь модели Вакансия (Ad_employers) с моделью Отклик на Вакансию (Ad_response) | 50 | * Связь модели Вакансия (Ad_employers) с моделью Отклик на Вакансию (Ad_response) |
51 | один-ко-многим | 51 | один-ко-многим |
52 | */ | 52 | */ |
53 | public function response() { | 53 | public function response() { |
54 | return $this->hasMany(ad_response::class); | 54 | return $this->hasMany(ad_response::class); |
55 | } | 55 | } |
56 | 56 | ||
57 | // Связь модели Категории (Categories) с моделью Вакансии | 57 | // Связь модели Категории (Categories) с моделью Вакансии |
58 | public function cat() { | 58 | public function cat() { |
59 | return $this->hasMany(Category::class, 'id'); | 59 | return $this->hasMany(Category::class, 'id'); |
60 | } | 60 | } |
61 | 61 | ||
62 | |||
63 | public function scopeActive($query) { | 62 | public function scopeActive($query) { |
64 | return $query->where('is_remove', '=', '0'); | 63 | return $query->where('is_remove', '=', '0'); |
65 | } | 64 | } |
66 | 65 | ||
67 | // | 66 | // |
68 | public function ad_job() { | 67 | public function ad_job() { |
69 | return $this->hasMany(Ad_jobs::class); | 68 | return $this->hasMany(Ad_jobs::class); |
70 | } | 69 | } |
71 | 70 | ||
72 | // Связь Вакансии с должностями (0-0 - 1) | 71 | // Связь Вакансии с должностями (0-0 - 1) |
73 | public function job_titles() { | 72 | public function job_titles() { |
74 | return $this->belongsToMany(Job_title::class, 'title_workers'); | 73 | return $this->belongsToMany(Job_title::class, 'title_workers'); |
75 | } | 74 | } |
76 | } | 75 | } |
77 | 76 |
app/Models/ResponseWork.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Models; | 3 | namespace App\Models; |
4 | 4 | ||
5 | use Illuminate\Database\Eloquent\Factories\HasFactory; | 5 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
6 | use Illuminate\Database\Eloquent\Model; | 6 | use Illuminate\Database\Eloquent\Model; |
7 | use Illuminate\Database\Eloquent\Relations\BelongsTo; | ||
7 | 8 | ||
8 | class ResponseWork extends Model | 9 | class ResponseWork extends Model |
9 | { | 10 | { |
10 | use HasFactory; | 11 | use HasFactory; |
11 | 12 | ||
12 | public $fillable = [ | 13 | public $fillable = [ |
13 | 'worker_id', | 14 | 'worker_id', |
14 | 'stars', | 15 | 'stars', |
15 | 'message' | 16 | 'message' |
16 | ]; | 17 | ]; |
18 | |||
17 | } | 19 | } |
18 | 20 |
app/Models/Worker.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Models; | 3 | namespace App\Models; |
4 | 4 | ||
5 | use Illuminate\Database\Eloquent\Factories\HasFactory; | 5 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
6 | use Illuminate\Database\Eloquent\Model; | 6 | use Illuminate\Database\Eloquent\Model; |
7 | 7 | ||
8 | class Worker extends Model | 8 | class Worker extends Model |
9 | { | 9 | { |
10 | use HasFactory; | 10 | use HasFactory; |
11 | 11 | ||
12 | protected $table = 'Workers'; | 12 | protected $table = 'Workers'; |
13 | 13 | ||
14 | protected $fillable = [ | 14 | protected $fillable = [ |
15 | 'user_id', | 15 | 'user_id', |
16 | 'status_work', | 16 | 'status_work', |
17 | 'position_work', | 17 | 'position_work', |
18 | 'telephone', | 18 | 'telephone', |
19 | 'telephone2', | 19 | 'telephone2', |
20 | 'persent_anketa', | 20 | 'persent_anketa', |
21 | 'photo', | 21 | 'photo', |
22 | 'email_data', | 22 | 'email_data', |
23 | 'status_profile', | 23 | 'status_profile', |
24 | 'old_year', | 24 | 'old_year', |
25 | 'experience', | 25 | 'experience', |
26 | 'en_is', | 26 | 'en_is', |
27 | 'education', | 27 | 'education', |
28 | 'email', | 28 | 'email', |
29 | 'interpassport', | 29 | 'interpassport', |
30 | 'mk', | 30 | 'mk', |
31 | 'vvp', | 31 | 'vvp', |
32 | 'vlm', | 32 | 'vlm', |
33 | 'reka_diplom', | 33 | 'reka_diplom', |
34 | 'more_diplom', | 34 | 'more_diplom', |
35 | 'mpss', | 35 | 'mpss', |
36 | 'tanker', | 36 | 'tanker', |
37 | 'gmssb', | 37 | 'gmssb', |
38 | 'resume', | 38 | 'resume', |
39 | 'sort', | 39 | 'sort', |
40 | 'updated_at', | 40 | 'updated_at', |
41 | 'text', | 41 | 'text', |
42 | 'address', | 42 | 'address', |
43 | 'city', | 43 | 'city', |
44 | 'coord', | 44 | 'coord', |
45 | 'file', | 45 | 'file', |
46 | 'is_remove', | 46 | 'is_remove', |
47 | 'favorite_user', | 47 | 'favorite_user', |
48 | 'sroch_user' | 48 | 'sroch_user' |
49 | ]; | 49 | ]; |
50 | 50 | ||
51 | /* | 51 | /* |
52 | * Связь таблицы users с таблицей workers | 52 | * Связь таблицы users с таблицей workers |
53 | */ | 53 | */ |
54 | public function users() { | 54 | public function users() { |
55 | return $this->belongsTo(User::class, 'user_id'); | 55 | return $this->belongsTo(User::class, 'user_id'); |
56 | } | 56 | } |
57 | 57 | ||
58 | // Связь Работника с сертификами (0-0 - 1) | 58 | // Связь Работника с сертификами (0-0 - 1) |
59 | public function sertificate() { | 59 | public function sertificate() { |
60 | return $this->hasMany(sertification::class); | 60 | return $this->hasMany(sertification::class); |
61 | } | 61 | } |
62 | 62 | ||
63 | // Связь Работника с должностями (0-0 - 1) | 63 | // Связь Работника с должностями (0-0 - 1) |
64 | public function job_titles() { | 64 | public function job_titles() { |
65 | return $this->belongsToMany(Job_title::class, 'title_workers'); | 65 | return $this->belongsToMany(Job_title::class, 'title_workers'); |
66 | } | 66 | } |
67 | 67 | ||
68 | //Связь Работника с опытом работы (1 - 0-0) | 68 | //Связь Работника с опытом работы (1 - 0-0) |
69 | public function place_worker() { | 69 | public function place_worker() { |
70 | return $this->hasMany(place_works::class); | 70 | return $this->hasMany(place_works::class); |
71 | } | 71 | } |
72 | 72 | ||
73 | public function scopeActive($query) { | 73 | public function scopeActive($query) { |
74 | return $query->where('is_remove', '=', '0'); | 74 | return $query->where('is_remove', '=', '0'); |
75 | } | 75 | } |
76 | 76 | ||
77 | //Связь Работника с предыдущими компаниями | 77 | //Связь Работника с предыдущими компаниями |
78 | public function prev_company() { | 78 | public function prev_company() { |
79 | return $this->hasMany(PrevCompany::class); | 79 | return $this->hasMany(PrevCompany::class); |
80 | } | 80 | } |
81 | 81 | ||
82 | //Связь Работника с инфоблоками (0-0 - 0-0) | 82 | //Связь Работника с инфоблоками (0-0 - 0-0) |
83 | public function infobloks() { | 83 | public function infobloks() { |
84 | return $this->belongsToMany(infobloks::class,'dop_info', 'worker_id', 'infoblok_id'); | 84 | return $this->belongsToMany(infobloks::class,'dop_info', 'worker_id', 'infoblok_id'); |
85 | } | 85 | } |
86 | 86 | ||
87 | //Связи Работника с дополнительными | 87 | //Связи Работника с дополнительными |
88 | public function dop_info() { | 88 | public function dop_info() { |
89 | return $this->hasMany(Dop_info::class, 'worker_id'); | 89 | return $this->hasMany(Dop_info::class, 'worker_id'); |
90 | } | 90 | } |
91 | 91 | ||
92 | public function response() { | ||
93 | return $this->hasMany(ResponseWork::class); | ||
94 | } | ||
95 | |||
92 | } | 96 | } |
93 | 97 |
app/Models/infobloks.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Models; | 3 | namespace App\Models; |
4 | 4 | ||
5 | use Illuminate\Database\Eloquent\Factories\HasFactory; | 5 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
6 | use Illuminate\Database\Eloquent\Model; | 6 | use Illuminate\Database\Eloquent\Model; |
7 | 7 | ||
8 | class infobloks extends Model | 8 | class infobloks extends Model |
9 | { | 9 | { |
10 | use HasFactory; | 10 | use HasFactory; |
11 | 11 | ||
12 | protected $fillable = [ | 12 | protected $fillable = [ |
13 | 'name', | 13 | 'name', |
14 | 'is_remove', | 14 | 'is_remove', |
15 | 'sort', | 15 | 'sort', |
16 | ]; | 16 | ]; |
17 | 17 | ||
18 | public function ScopeActive($query) { | 18 | public function ScopeActive($query) { |
19 | return $query->where('is_remove', '=', '0'); | 19 | return $query->where('is_remove', '=', '0'); |
20 | } | 20 | } |
21 | |||
22 | /* | ||
23 | * Связь модели Инфоблоки (Infobloks) с моделью Доп.информация (dop_info) | ||
24 | один-ко-многим | ||
25 | */ | ||
26 | public function model_dop_info() { | ||
27 | return $this->hasMany(dop_info::class, 'infoblok_id'); | ||
28 | } | ||
21 | } | 29 | } |
22 | 30 |
resources/views/admin/messages.blade.php
1 | @extends('layout.admin', ['title' => 'Админка - Сообщения']) | 1 | @extends('layout.admin', ['title' => 'Админка - Сообщения']) |
2 | 2 | ||
3 | @section('script') | 3 | @section('script') |
4 | @endsection | 4 | @endsection |
5 | 5 | ||
6 | @section('search') | 6 | @section('search') |
7 | @include('admin.find_message') | 7 | @include('admin.find_message') |
8 | @endsection | 8 | @endsection |
9 | 9 | ||
10 | @section('content') | 10 | @section('content') |
11 | <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> | 11 | <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> |
12 | <div class="w-full overflow-x-auto"> | 12 | <div class="w-full overflow-x-auto"> |
13 | <table class="w-full whitespace-no-wrap"> | 13 | <table class="w-full whitespace-no-wrap"> |
14 | <thead> | 14 | <thead> |
15 | <tr | 15 | <tr |
16 | class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800" | 16 | class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800" |
17 | > | 17 | > |
18 | <th class="px-4 py-3">№</th> | 18 | <th class="px-4 py-3">№</th> |
19 | <th class="px-4 py-3">От юзера</th> | 19 | <th class="px-4 py-3">От юзера</th> |
20 | <th class="px-4 py-3">К юзеру</th> | 20 | <th class="px-4 py-3">К юзеру</th> |
21 | <th class="px-4 py-3">Отклик</th> | 21 | <th class="px-4 py-3" style="display:none">Отклик</th> |
22 | <th class="px-4 py-3">Читать</th> | 22 | <th class="px-4 py-3">Читать</th> |
23 | <th class="px-4 py-3">Дата</th> | 23 | <th class="px-4 py-3">Дата</th> |
24 | </tr> | 24 | </tr> |
25 | </thead> | 25 | </thead> |
26 | <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> | 26 | <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> |
27 | @foreach($Msgs as $msg) | 27 | @foreach($Msgs as $msg) |
28 | <tr class="text-gray-700 dark:text-gray-400"> | 28 | <tr class="text-gray-700 dark:text-gray-400"> |
29 | <td class="px-4 py-3"> | 29 | <td class="px-4 py-3"> |
30 | {{$msg->id}} | 30 | {{$msg->id}} |
31 | </td> | 31 | </td> |
32 | <td class="px-4 py-3"> | 32 | <td class="px-4 py-3"> |
33 | @if (isset($msg->user_from->id)) | 33 | @if (isset($msg->user_from->id)) |
34 | {{$msg->user_from->name}} ({{$msg->user_from->id}}) | 34 | {{$msg->user_from->name}} ({{$msg->user_from->id}}) |
35 | @else | 35 | @else |
36 | Пользователь удален | 36 | Пользователь удален |
37 | @endif | 37 | @endif |
38 | </td> | 38 | </td> |
39 | <td class="px-4 py-3"> | 39 | <td class="px-4 py-3"> |
40 | @if (isset($msg->user_to->id)) | 40 | @if (isset($msg->user_to->id)) |
41 | {{$msg->user_to->name}} ({{$msg->user_to->id}}) | 41 | {{$msg->user_to->name}} ({{$msg->user_to->id}}) |
42 | @else | 42 | @else |
43 | Пользователь удален | 43 | Пользователь удален |
44 | @endif | 44 | @endif |
45 | </td> | 45 | </td> |
46 | <td class="px-4 py-3"> | 46 | <td class="px-4 py-3" style="display:none"> |
47 | <div class="flex items-center text-sm"> | 47 | <div class="flex items-center text-sm"> |
48 | <div> | 48 | <div> |
49 | @if ($msg->response->count()) | 49 | @if (true) //$msg->response->count()) |
50 | Да | 50 | Да |
51 | @else | 51 | @else |
52 | Нет | 52 | Нет |
53 | @endif | 53 | @endif |
54 | </div> | 54 | </div> |
55 | </div> | 55 | </div> |
56 | </td> | 56 | </td> |
57 | <td class="px-4 py-3 text-sm"> | 57 | <td class="px-4 py-3 text-sm"> |
58 | <a style="text-decoration: underline;" href="{{ route('admin.read-message', ['message' => $msg->id]) }}">Читать</a> | 58 | <a style="text-decoration: underline;" href="{{ route('admin.read-message', ['message' => $msg->id]) }}">Читать</a> |
59 | </td> | 59 | </td> |
60 | <td class="px-4 py-3 text-sm"> | 60 | <td class="px-4 py-3 text-sm"> |
61 | {{ $msg->created_at }} | 61 | {{ $msg->created_at }} |
62 | </td> | 62 | </td> |
63 | </tr> | 63 | </tr> |
64 | @endforeach | 64 | @endforeach |
65 | </tbody> | 65 | </tbody> |
66 | </table> | 66 | </table> |
67 | </div> | 67 | </div> |
68 | 68 | ||
69 | <div class="grid px-4 py-3 text-xs font-semibold tracking-wide text-gray-500 uppercase border-t dark:border-gray-700 bg-gray-50 sm:grid-cols-9 dark:text-gray-400 dark:bg-gray-800"> | 69 | <div class="grid px-4 py-3 text-xs font-semibold tracking-wide text-gray-500 uppercase border-t dark:border-gray-700 bg-gray-50 sm:grid-cols-9 dark:text-gray-400 dark:bg-gray-800"> |
70 | <?=$Msgs->appends($_GET)->links('admin.pagginate'); ?> | 70 | <?=$Msgs->appends($_GET)->links('admin.pagginate'); ?> |
71 | </div> | 71 | </div> |
72 | </div> | 72 | </div> |
73 | @endsection | 73 | @endsection |
74 | 74 |
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 | console.log('Test system'); | 5 | console.log('Test system'); |
6 | $(document).on('change', '#send_btn', function() { | 6 | $(document).on('change', '#send_btn', function() { |
7 | var this_ = $(this); | 7 | var this_ = $(this); |
8 | var val_ = this_.val(); | 8 | var val_ = this_.val(); |
9 | console.log('sort items '+val_); | 9 | console.log('sort items '+val_); |
10 | 10 | ||
11 | $.ajax({ | 11 | $.ajax({ |
12 | type: "GET", | 12 | type: "GET", |
13 | url: "{{ route('shipping_companies') }}", | 13 | url: "{{ route('shipping_companies') }}", |
14 | data: "sort="+val_+"&block=1", | 14 | data: "sort="+val_+"&block=1", |
15 | success: function (data) { | 15 | success: function (data) { |
16 | console.log('Выбор сортировки'); | 16 | console.log('Выбор сортировки'); |
17 | console.log(data); | 17 | console.log(data); |
18 | $('#block_1').html(data); | 18 | $('#block_1').html(data); |
19 | }, | 19 | }, |
20 | headers: { | 20 | headers: { |
21 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 21 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
22 | }, | 22 | }, |
23 | error: function (data) { | 23 | error: function (data) { |
24 | data = JSON.stringify(data); | 24 | data = JSON.stringify(data); |
25 | console.log('Error: ' + data); | 25 | console.log('Error: ' + data); |
26 | } | 26 | } |
27 | }); | 27 | }); |
28 | 28 | ||
29 | $.ajax({ | 29 | $.ajax({ |
30 | type: "GET", | 30 | type: "GET", |
31 | url: "{{ route('shipping_companies') }}", | 31 | url: "{{ route('shipping_companies') }}", |
32 | data: "sort="+val_+"&block=2", | 32 | data: "sort="+val_+"&block=2", |
33 | success: function (data) { | 33 | success: function (data) { |
34 | console.log('Выбор сортировки2'); | 34 | console.log('Выбор сортировки2'); |
35 | console.log(data); | 35 | console.log(data); |
36 | history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); | 36 | history.pushState({}, '', "{{ route('shipping_companies') }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); |
37 | $('#block_2').html(data); | 37 | $('#block_2').html(data); |
38 | }, | 38 | }, |
39 | headers: { | 39 | headers: { |
40 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 40 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
41 | }, | 41 | }, |
42 | error: function (data) { | 42 | error: function (data) { |
43 | data = JSON.stringify(data); | 43 | data = JSON.stringify(data); |
44 | console.log('Error: ' + data); | 44 | console.log('Error: ' + data); |
45 | } | 45 | } |
46 | }); | 46 | }); |
47 | }); | 47 | }); |
48 | </script> | 48 | </script> |
49 | @endsection | 49 | @endsection |
50 | 50 | ||
51 | @section('content') | 51 | @section('content') |
52 | <section class="cabinet"> | 52 | <section class="cabinet"> |
53 | <div class="container"> | 53 | <div class="container"> |
54 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 54 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
55 | <li><a href="{{ route('index') }}">Главная</a></li> | 55 | <li><a href="{{ route('index') }}">Главная</a></li> |
56 | <li><b>Личный кабинет</b></li> | 56 | <li><b>Личный кабинет</b></li> |
57 | </ul> | 57 | </ul> |
58 | <div class="cabinet__wrapper"> | 58 | <div class="cabinet__wrapper"> |
59 | <div class="cabinet__side"> | 59 | <div class="cabinet__side"> |
60 | <div class="cabinet__side-toper"> | 60 | <div class="cabinet__side-toper"> |
61 | @include('employers.emblema') | 61 | @include('employers.emblema') |
62 | </div> | 62 | </div> |
63 | @include('employers.menu', ['item' => 5]) | 63 | @include('employers.menu', ['item' => 5]) |
64 | </div> | 64 | </div> |
65 | <div class="cabinet__body"> | 65 | <div class="cabinet__body"> |
66 | <div class="cabinet__body-item"> | 66 | <div class="cabinet__body-item"> |
67 | <h2 class="title cabinet__title">Сообщения</h2> | 67 | <h2 class="title cabinet__title">Сообщения</h2> |
68 | </div> | 68 | </div> |
69 | <div class="cabinet__body-item"> | 69 | <div class="cabinet__body-item"> |
70 | <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="back"> | 70 | <a href="{{ route('employer.messages', ['type_message' => 'input']) }}" class="back"> |
71 | <svg> | 71 | <svg> |
72 | <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use> | 72 | <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use> |
73 | </svg> | 73 | </svg> |
74 | <span> | 74 | <span> |
75 | К списку чатов | 75 | К списку чатов |
76 | </span> | 76 | </span> |
77 | </a> | 77 | </a> |
78 | <div class="chatbox"> | 78 | <div class="chatbox"> |
79 | <div class="chatbox__toper"> | 79 | <div class="chatbox__toper"> |
80 | @if ($companion->is_worker) | 80 | @if ($companion->is_worker) |
81 | <div class="chatbox__toper-info messages__item-info"> | 81 | <div class="chatbox__toper-info messages__item-info"> |
82 | <div class="messages__item-photo"> | 82 | <div class="messages__item-photo"> |
83 | <svg> | 83 | <svg> |
84 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> | 84 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> |
85 | </svg> | 85 | </svg> |
86 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 86 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
87 | </div> | 87 | </div> |
88 | <div class="messages__item-text"> | 88 | <div class="messages__item-text"> |
89 | <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div> | 89 | <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div> |
90 | <div><span>Вакансия:</span> | 90 | <div><span>Вакансия:</span> |
91 | @if ($ad_employer == 0) | 91 | @if ($ad_employer == 0) |
92 | @if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }}@else Не указано @endif | 92 | @if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }}@else Не указано @endif |
93 | @else | 93 | @else |
94 | <a href="{{ route('vacancie', ['vacancy' => $ad_employer]) }}"> | 94 | <a href="{{ route('vacancie', ['vacancy' => $ad_employer]) }}"> |
95 | @if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }} ({{ $ad_employer }}) @else Не указано @endif | 95 | @if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }} ({{ $ad_employer }}) @else Не указано @endif |
96 | </a> | 96 | </a> |
97 | @endif | 97 | @endif |
98 | </div> | 98 | </div> |
99 | </div> | 99 | </div> |
100 | </div> | 100 | </div> |
101 | @if (isset($companion->worker->id)) | 101 | @if (isset($companion->workers[0]->id)) |
102 | <a href="{{ route('resume_profile', ['worker' => $companion->worker->id]) }}" class="button chatbox__toper-button"> | 102 | <a href="{{ route('resume_profile', ['worker' => $companion->workers[0]->id]) }}" class="button chatbox__toper-button"> |
103 | <svg> | 103 | <svg> |
104 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> | 104 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> |
105 | </svg> | 105 | </svg> |
106 | Перейти в резюме | 106 | Перейти в резюме |
107 | </a> | 107 | </a> |
108 | @endif | 108 | @endif |
109 | @else | 109 | @else |
110 | <div class="chatbox__toper-info messages__item-info"> | 110 | <div class="chatbox__toper-info messages__item-info"> |
111 | <div class="messages__item-photo"> | 111 | <div class="messages__item-photo"> |
112 | <svg> | 112 | <svg> |
113 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> | 113 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> |
114 | </svg> | 114 | </svg> |
115 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 115 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
116 | </div> | 116 | </div> |
117 | <div class="messages__item-text"> | 117 | <div class="messages__item-text"> |
118 | <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div> | 118 | <div>{{ $companion->surname." ".$companion->name_man." ".$companion->surname2." (".$companion->id.")" }} </div> |
119 | <div><span>Статус:</span> Работодатель или Администратор</div> | 119 | <div><span>Статус:</span> Работодатель или Администратор</div> |
120 | </div> | 120 | </div> |
121 | </div> | 121 | </div> |
122 | @if (isset($companion->employer->id)) | 122 | @if (isset($companion->employer->id)) |
123 | <a href="" class="button chatbox__toper-button"> | 123 | <a href="" class="button chatbox__toper-button"> |
124 | <svg> | 124 | <svg> |
125 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> | 125 | <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use> |
126 | </svg> | 126 | </svg> |
127 | Перейти в резюме | 127 | Перейти в резюме |
128 | </a> | 128 | </a> |
129 | @endif | 129 | @endif |
130 | @endif | 130 | @endif |
131 | </div> | 131 | </div> |
132 | 132 | ||
133 | <div class="chatbox__list" id="dialogs" name="dialogs"> | 133 | <div class="chatbox__list" id="dialogs" name="dialogs"> |
134 | @if ($Messages->count()) | 134 | @if ($Messages->count()) |
135 | @foreach ($Messages as $it) | 135 | @foreach ($Messages as $it) |
136 | @if ($it->user_id == $companion->id) | 136 | @if ($it->user_id == $companion->id) |
137 | <div class="chatbox__item"> | 137 | <div class="chatbox__item"> |
138 | <div class="chatbox__item-photo"> | 138 | <div class="chatbox__item-photo"> |
139 | <svg> | 139 | <svg> |
140 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> | 140 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> |
141 | </svg> | 141 | </svg> |
142 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 142 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
143 | </div> | 143 | </div> |
144 | <div class="chatbox__item-body"> | 144 | <div class="chatbox__item-body"> |
145 | <div class="chatbox__item-text">{{ $it->text }}</div> | 145 | <div class="chatbox__item-text">{{ $it->text }}</div> |
146 | </div> | 146 | </div> |
147 | <div class="chatbox__item-time">{{ $it->created_at }}</div> | 147 | <div class="chatbox__item-time">{{ $it->created_at }}</div> |
148 | </div> | 148 | </div> |
149 | @else | 149 | @else |
150 | <div class="chatbox__item chatbox__item_reverse"> | 150 | <div class="chatbox__item chatbox__item_reverse"> |
151 | <div class="chatbox__item-photo"> | 151 | <div class="chatbox__item-photo"> |
152 | <svg> | 152 | <svg> |
153 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> | 153 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> |
154 | </svg> | 154 | </svg> |
155 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 155 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
156 | </div> | 156 | </div> |
157 | <div class="chatbox__item-body"> | 157 | <div class="chatbox__item-body"> |
158 | <div class="chatbox__item-text">{{ $it->text }}</div> | 158 | <div class="chatbox__item-text">{{ $it->text }}</div> |
159 | @if ((isset($it->file)) && (!empty($it->file))) | 159 | @if ((isset($it->file)) && (!empty($it->file))) |
160 | <a href="{{ asset(Storage::url($it->file)) }}" class="chatbox__item-text"> | 160 | <a href="{{ asset(Storage::url($it->file)) }}" class="chatbox__item-text"> |
161 | <svg> | 161 | <svg> |
162 | <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> | 162 | <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> |
163 | </svg> | 163 | </svg> |
164 | </a> | 164 | </a> |
165 | @endif | 165 | @endif |
166 | </div> | 166 | </div> |
167 | <div class="chatbox__item-time">{{ $it->created_at }}</div> | 167 | <div class="chatbox__item-time">{{ $it->created_at }}</div> |
168 | </div> | 168 | </div> |
169 | @endif | 169 | @endif |
170 | 170 | ||
171 | @endforeach | 171 | @endforeach |
172 | @endif | 172 | @endif |
173 | </div> | 173 | </div> |
174 | <form action="{{ route('employer.test123') }}" class="chatbox__bottom" enctype="multipart/form-data" method="POST" > | 174 | <form action="{{ route('employer.test123') }}" class="chatbox__bottom" enctype="multipart/form-data" method="POST" > |
175 | @csrf | 175 | @csrf |
176 | <label class="chatbox__bottom-file"> | 176 | <label class="chatbox__bottom-file"> |
177 | <input id="file" name="file" type="file"> | 177 | <input id="file" name="file" type="file"> |
178 | <svg> | 178 | <svg> |
179 | <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> | 179 | <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> |
180 | </svg> | 180 | </svg> |
181 | </label> | 181 | </label> |
182 | <input type="hidden" name="_token" value="{{ csrf_token() }}"/> | 182 | <input type="hidden" name="_token" value="{{ csrf_token() }}"/> |
183 | <input type="hidden" id="user_id" name="user_id" value="{{ $sender->id }}"/> | 183 | <input type="hidden" id="user_id" name="user_id" value="{{ $sender->id }}"/> |
184 | <input type="hidden" id="to_user_id" name="to_user_id" value="{{ $companion->id }}"/> | 184 | <input type="hidden" id="to_user_id" name="to_user_id" value="{{ $companion->id }}"/> |
185 | <input type="hidden" id="ad_employer_id" name="ad_employer_id" value="{{ $ad_employer }}"/> | ||
186 | <input type="hidden" id="ad_name" name="ad_name" value="@if (isset($_GET['ad_name'])){{ $_GET['ad_name'] }} @endif"/> | ||
185 | <input id="text" name="text" type="text" class="input chatbox__bottom-text" placeholder="Ответить"> | 187 | <input id="text" name="text" type="text" class="input chatbox__bottom-text" placeholder="Ответить"> |
186 | <button type="submit" id="send_btn" name="send_btn" class="chatbox__bottom-send"> | 188 | <button type="submit" id="send_btn" name="send_btn" class="chatbox__bottom-send"> |
187 | <svg> | 189 | <svg> |
188 | <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> | 190 | <use xlink:href="{{ asset('images/sprite.svg#arrow') }}"></use> |
189 | </svg> | 191 | </svg> |
190 | </button> | 192 | </button> |
191 | </form> | 193 | </form> |
192 | </div> | 194 | </div> |
193 | </div> | 195 | </div> |
194 | </div> | 196 | </div> |
195 | </div> | 197 | </div> |
196 | </div> | 198 | </div> |
197 | </section> | 199 | </section> |
198 | </div> | 200 | </div> |
199 | @endsection | 201 | @endsection |
200 | 202 |
resources/views/modals/send_worker_new.blade.php
1 | <script> | 1 | <script> |
2 | console.log('Сообщение работнику'); | 2 | console.log('Сообщение работнику'); |
3 | $("#form_worker" ).submit(function(event) { | 3 | $("#form_worker" ).submit(function(event) { |
4 | var val = $(this).val(); | 4 | var val = $(this).val(); |
5 | var send_title = $('#send_title'); | 5 | var send_title = $('#send_title'); |
6 | var send_title_val = send_title.val(); | 6 | var send_title_val = send_title.val(); |
7 | 7 | ||
8 | console.log('Click form.'); | 8 | console.log('Click form.'); |
9 | }); | 9 | }); |
10 | 10 | ||
11 | $(document).on('change', '#btn_send_file', function() { | 11 | $(document).on('change', '#btn_send_file', function() { |
12 | 12 | ||
13 | var send_name = $('#send_name'); | 13 | var send_name = $('#send_name'); |
14 | var send_name_val = send_name.val(); | 14 | var send_name_val = send_name.val(); |
15 | var send_name_file = $('#send_name_file'); | 15 | var send_name_file = $('#send_name_file'); |
16 | 16 | ||
17 | console.log(send_name_val); | 17 | console.log(send_name_val); |
18 | send_name_file.html(send_name_val); | 18 | send_name_file.html(send_name_val); |
19 | 19 | ||
20 | }); | 20 | }); |
21 | </script> | 21 | </script> |
22 | <div id="send" class="modal"> | 22 | <div id="send" class="modal"> |
23 | <div class="modal__body"> | 23 | <div class="modal__body"> |
24 | <div class="modal__title">Отправить сообщение работодателю</div> | 24 | <div class="modal__title">Отправить сообщение работодателю</div> |
25 | <div class="modal__text">Если вы готовы владеете компитентыми навыками, напишите данному работодателю письмо</div> | 25 | <div class="modal__text">Если вы готовы владеете компитентыми навыками, напишите данному работодателю письмо</div> |
26 | <form class="modal__form" id="form_worker" name="form_worker" enctype="multipart/form-data" action="{{ route('worker.new_message') }}" method="POST"> | 26 | <form class="modal__form" id="form_worker" name="form_worker" enctype="multipart/form-data" action="{{ route('worker.new_message') }}" method="POST"> |
27 | @csrf | 27 | @csrf |
28 | <div class="modal__form-item"> | 28 | <div class="modal__form-item"> |
29 | Отправитель сообщения: | 29 | Отправитель сообщения: |
30 | <input type="text" id="send_user_id" name="send_user_id" class="input" placeholder="user_id" value=""> | 30 | <input type="text" id="send_user_id" name="send_user_id" class="input" placeholder="user_id" value=""> |
31 | Получатель сообщения: | 31 | Получатель сообщения: |
32 | <input type="text" id="send_to_user_id" name="send_to_user_id" class="input" placeholder="to_user_id" value=""> | 32 | <input type="text" id="send_to_user_id" name="send_to_user_id" class="input" placeholder="to_user_id" value=""> |
33 | Вакансия: | 33 | Вакансия: |
34 | <input type="text" id="send_vacancy" name="send_vacancy" class="input" placeholder="vacancy" value=""> | 34 | <input type="text" id="send_vacancy" name="send_vacancy" class="input" placeholder="vacancy" value=""> |
35 | Должность: | ||
36 | <input type="text" id="send_job_title_id" name="send_job_title_id" class="input" placeholder="vacancy" value="0"> | ||
37 | |||
35 | </div> | 38 | </div> |
36 | <div class="modal__form-item send_title_div error_"> | 39 | <div class="modal__form-item send_title_div error_"> |
37 | <input id="send_title" name="send_title" type="text" class="input" placeholder="Тема" required> | 40 | <input id="send_title" name="send_title" type="text" class="input" placeholder="Тема" required> |
38 | <label for="title">Не заполнено поле</label> | 41 | <label for="title">Не заполнено поле</label> |
39 | </div> | 42 | </div> |
40 | <!--<div class="modal__form-item send_title_div error_"> | 43 | <!--<div class="modal__form-item send_title_div error_"> |
41 | <select class="js-select2" name="send_job_title_id" id="send_job_title_id"> | 44 | <select class="js-select2" name="send_job_title_id" id="send_job_title_id"> |
42 | if ($jobs->count()) | 45 | if ($jobs->count()) |
43 | foreach($jobs as $j) | 46 | foreach($jobs as $j) |
44 | <option value=" $j->id }}"> $j->name }} ( $j->id }})</option> | 47 | <option value=" $j->id }}"> $j->name }} ( $j->id }})</option> |
45 | endforeach | 48 | endforeach |
46 | endif | 49 | endif |
47 | </select> | 50 | </select> |
48 | <label for="title">Не заполнено поле</label> | 51 | <label for="title">Не заполнено поле</label> |
49 | </div>--> | 52 | </div>--> |
50 | <div class="modal__form-item send_text_div"> | 53 | <div class="modal__form-item send_text_div"> |
51 | <textarea id="i2" class="textarea" id="send_text" name="send_text" placeholder="Напишите текст с предложением о работе" required></textarea> | 54 | <textarea id="i2" class="textarea" id="send_text" name="send_text" placeholder="Напишите текст с предложением о работе" required></textarea> |
52 | <label for="i2">Не заполнено поле</label> | 55 | <label for="i2">Не заполнено поле</label> |
53 | </div> | 56 | </div> |
54 | <div class="modal__form-item"> | 57 | <div class="modal__form-item"> |
55 | <div class="file"> | 58 | <div class="file"> |
56 | <label class="file__input" id="btn_send_file" name="btn_send_file"> | 59 | <label class="file__input" id="btn_send_file" name="btn_send_file"> |
57 | <input type="file" name="send_file" id="send_name"> | 60 | <input type="file" name="send_file" id="send_name"> |
58 | <span class="button button_light"> | 61 | <span class="button button_light"> |
59 | <svg> | 62 | <svg> |
60 | <use xlink:href="{{ asset('images/sprite.svg#share') }}"></use> | 63 | <use xlink:href="{{ asset('images/sprite.svg#share') }}"></use> |
61 | </svg> | 64 | </svg> |
62 | Прикрепить файл-документ | 65 | Прикрепить файл-документ |
63 | </span> | 66 | </span> |
64 | </label> | 67 | </label> |
65 | 68 | ||
66 | <div class="file__list" id="div_file" name="div_file"> | 69 | <div class="file__list" id="div_file" name="div_file"> |
67 | <div class="file__list-item"> | 70 | <div class="file__list-item"> |
68 | <div class="file__list-item-left"> | 71 | <div class="file__list-item-left"> |
69 | <svg> | 72 | <svg> |
70 | <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> | 73 | <use xlink:href="{{ asset('images/sprite.svg#clip') }}"></use> |
71 | </svg> | 74 | </svg> |
72 | <span id="send_name_file" name="send_name_file"></span> | 75 | <span id="send_name_file" name="send_name_file"></span> |
73 | </div> | 76 | </div> |
74 | <button type="button" class="file__list-item-right js-parent-remove"> | 77 | <button type="button" class="file__list-item-right js-parent-remove"> |
75 | <svg> | 78 | <svg> |
76 | <use xlink:href="{{ asset('images/sprite.svg#cross-bold') }}"></use> | 79 | <use xlink:href="{{ asset('images/sprite.svg#cross-bold') }}"></use> |
77 | </svg> | 80 | </svg> |
78 | </button> | 81 | </button> |
79 | </div> | 82 | </div> |
80 | </div> | 83 | </div> |
81 | </div> | 84 | </div> |
82 | </div> | 85 | </div> |
83 | <div class="modal__form-item"> | 86 | <div class="modal__form-item"> |
84 | <button type="submit" id="submit_form_worker" name="submit_form_worker" class="button">Отправить</button> | 87 | <button type="submit" id="submit_form_worker" name="submit_form_worker" class="button">Отправить</button> |
85 | </div> | 88 | </div> |
86 | </form> | 89 | </form> |
87 | </div> | 90 | </div> |
88 | </div> | 91 | </div> |
89 | 92 | ||
90 | 93 |
resources/views/worker.blade.php
1 | @extends('layout.frontend', ['title' => 'Карточка соискателя - РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Карточка соискателя - РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | <script> | 4 | <script> |
5 | console.log('Test system'); | 5 | console.log('Test system'); |
6 | $(document).on('change', '#jobs', function() { | 6 | $(document).on('change', '#jobs', function() { |
7 | var val = $(this).val(); | 7 | var val = $(this).val(); |
8 | var main_oskar = $('#main_ockar'); | 8 | var main_oskar = $('#main_ockar'); |
9 | 9 | ||
10 | console.log('Code='+val); | 10 | console.log('Code='+val); |
11 | console.log('Click change...'); | 11 | console.log('Click change...'); |
12 | $.ajax({ | 12 | $.ajax({ |
13 | type: "GET", | 13 | type: "GET", |
14 | url: "", | 14 | url: "", |
15 | data: "job="+val, | 15 | data: "job="+val, |
16 | success: function (data) { | 16 | success: function (data) { |
17 | console.log('Выбор сделан!'); | 17 | console.log('Выбор сделан!'); |
18 | console.log(data); | 18 | console.log(data); |
19 | main_oskar.html(data); | 19 | main_oskar.html(data); |
20 | }, | 20 | }, |
21 | headers: { | 21 | headers: { |
22 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 22 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
23 | }, | 23 | }, |
24 | error: function (data) { | 24 | error: function (data) { |
25 | data = JSON.stringify(data); | 25 | data = JSON.stringify(data); |
26 | console.log('Error: ' + data); | 26 | console.log('Error: ' + data); |
27 | } | 27 | } |
28 | }); | 28 | }); |
29 | }); | 29 | }); |
30 | </script> | 30 | </script> |
31 | 31 | ||
32 | <script> | 32 | <script> |
33 | $(document).on('click', '.js_it_button', function() { | 33 | $(document).on('click', '.js_it_button', function() { |
34 | var this_ = $(this); | 34 | var this_ = $(this); |
35 | var code_user_id = this_.attr('data-uid'); | 35 | var code_user_id = this_.attr('data-uid'); |
36 | var code_to_user_id = this_.attr('data-tuid'); | 36 | var code_to_user_id = this_.attr('data-tuid'); |
37 | var code_vacancy = this_.attr('data-vacancy'); | 37 | var code_vacancy = this_.attr('data-vacancy'); |
38 | var user_id = $('#_user_id'); | 38 | var user_id = $('#_user_id'); |
39 | var to_user_id = $('#_to_user_id'); | 39 | var to_user_id = $('#_to_user_id'); |
40 | var vacancy = $('#_vacancy'); | 40 | var vacancy = $('#_vacancy'); |
41 | 41 | ||
42 | console.log('code_to_user_id='+code_to_user_id); | 42 | console.log('code_to_user_id='+code_to_user_id); |
43 | console.log('code_user_id='+code_user_id); | 43 | console.log('code_user_id='+code_user_id); |
44 | console.log('code_vacancy='+code_vacancy); | 44 | console.log('code_vacancy='+code_vacancy); |
45 | console.log('Клик на кнопке...'); | 45 | console.log('Клик на кнопке...'); |
46 | 46 | ||
47 | user_id.val(code_user_id); | 47 | user_id.val(code_user_id); |
48 | to_user_id.val(code_to_user_id); | 48 | to_user_id.val(code_to_user_id); |
49 | vacancy.val(code_vacancy); | 49 | vacancy.val(code_vacancy); |
50 | }); | 50 | }); |
51 | </script> | 51 | </script> |
52 | @include('js.favorite-worker') | 52 | @include('js.favorite-worker') |
53 | @endsection | 53 | @endsection |
54 | 54 | ||
55 | @section('content') | 55 | @section('content') |
56 | <section class="thing"> | 56 | <section class="thing"> |
57 | <div class="container"> | 57 | <div class="container"> |
58 | <ul class="breadcrumbs thing__breadcrumbs"> | 58 | <ul class="breadcrumbs thing__breadcrumbs"> |
59 | <li><a href="{{ route('index') }}">Главная</a></li> | 59 | <li><a href="{{ route('index') }}">Главная</a></li> |
60 | <li><a href="{{ route('bd_resume') }}">База резюме</a></li> | 60 | <li><a href="{{ route('bd_resume') }}">База резюме</a></li> |
61 | <li><b>@if (isset($Query[0]->users)) {{ $Query[0]->users->surname." ".$Query[0]->users->name_man." ".$Query[0]->users->surname2 }} @else Неизвестно @endif</b></li> | 61 | <li><b>@if (isset($Query[0]->users)) {{ $Query[0]->users->surname." ".$Query[0]->users->name_man." ".$Query[0]->users->surname2 }} @else Неизвестно @endif</b></li> |
62 | </ul> | 62 | </ul> |
63 | <div class="thing__profile"> | 63 | <div class="thing__profile"> |
64 | <img src="@if (isset($Query[0]->photo)) {{ asset(Storage::url($Query[0]->photo)) }} @else {{ asset('images/default_man.jpg') }} @endif" alt="" class="main__resume-base-body-item-photo"> | 64 | <img src="@if (isset($Query[0]->photo)) {{ asset(Storage::url($Query[0]->photo)) }} @else {{ asset('images/default_man.jpg') }} @endif" alt="" class="main__resume-base-body-item-photo"> |
65 | <div class="thing__profile-body"> | 65 | <div class="thing__profile-body"> |
66 | <h1 class="thing__title">@if (isset($Query[0]->users)) {{ $Query[0]->users->surname." ".$Query[0]->users->name_man." ".$Query[0]->users->surname2 }} @else Неизвестно @endif</h1> | 66 | <h1 class="thing__title">@if (isset($Query[0]->users)) {{ $Query[0]->users->surname." ".$Query[0]->users->name_man." ".$Query[0]->users->surname2 }} @else Неизвестно @endif</h1> |
67 | <p class="thing__text">Сложно сказать, почему ключевые особенности структуры проекта рассмотрены | 67 | <p class="thing__text">Сложно сказать, почему ключевые особенности структуры проекта рассмотрены |
68 | исключительно в разрезе маркетинговых и финансовых предпосылок.</p> | 68 | исключительно в разрезе маркетинговых и финансовых предпосылок.</p> |
69 | <div class="thing__bottom"> | 69 | <div class="thing__bottom"> |
70 | <a class="button" href="{{ route('resume_download', ['worker' => $Query[0]->id]) }}"> | 70 | <a class="button" href="{{ route('resume_download', ['worker' => $Query[0]->id]) }}"> |
71 | Скачать резюме | 71 | Скачать резюме |
72 | <svg> | 72 | <svg> |
73 | <use xlink:href="{{ asset('images/sprite.svg#download') }}"></use> | 73 | <use xlink:href="{{ asset('images/sprite.svg#download') }}"></use> |
74 | </svg> | 74 | </svg> |
75 | </a> | 75 | </a> |
76 | <button type="button" class="like js-toggle js_box_favorit {{ \App\Classes\LikesClass::get_status_worker($Query[0]) }}" data-val="{{ $Query[0]->id }}" id="elem{{ $Query[0]->id }}"> | 76 | <button type="button" class="like js-toggle js_box_favorit {{ \App\Classes\LikesClass::get_status_worker($Query[0]) }}" data-val="{{ $Query[0]->id }}" id="elem{{ $Query[0]->id }}"> |
77 | <svg> | 77 | <svg> |
78 | <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> | 78 | <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> |
79 | </svg> | 79 | </svg> |
80 | </button> | 80 | </button> |
81 | </div> | 81 | </div> |
82 | </div> | 82 | </div> |
83 | </div> | 83 | </div> |
84 | </div> | 84 | </div> |
85 | </section> | 85 | </section> |
86 | <main class="main"> | 86 | <main class="main"> |
87 | <div class="container"> | 87 | <div class="container"> |
88 | <div class="main__resume-profile"> | 88 | <div class="main__resume-profile"> |
89 | <div class="main__content"> | 89 | <div class="main__content"> |
90 | <div class="main__spoiler"> | 90 | <div class="main__spoiler"> |
91 | <button type="button" class="main__spoiler-toper js-toggle active"> | 91 | <button type="button" class="main__spoiler-toper js-toggle active"> |
92 | Основная информация</button> | 92 | Основная информация</button> |
93 | 93 | ||
94 | <div class="main__spoiler-body"> | 94 | <div class="main__spoiler-body"> |
95 | <table class="main__table"> | 95 | <table class="main__table"> |
96 | <tbody> | 96 | <tbody> |
97 | <tr> | 97 | <tr> |
98 | <td>Имя:</td> | 98 | <td>Имя:</td> |
99 | <td><b>{{ $Query[0]->users->name_man }}</b></td> | 99 | <td><b>{{ $Query[0]->users->name_man }}</b></td> |
100 | </tr> | 100 | </tr> |
101 | <tr> | 101 | <tr> |
102 | <td>Должность:</td> | 102 | <td>Должность:</td> |
103 | <td> | 103 | <td> |
104 | @if ($Query[0]->job_titles->count()) | 104 | @if ($Query[0]->job_titles->count()) |
105 | @foreach ($Query[0]->job_titles as $it) | 105 | @foreach ($Query[0]->job_titles as $it) |
106 | @if ($it->is_remove == 0) | 106 | @if ($it->is_remove == 0) |
107 | <b>{{ $it->name }}</b> | 107 | <b>{{ $it->name }}</b> |
108 | @endif | 108 | @endif |
109 | @endforeach | 109 | @endforeach |
110 | @endif | 110 | @endif |
111 | </td> | 111 | </td> |
112 | </tr> | 112 | </tr> |
113 | <tr> | 113 | <tr> |
114 | <td>Телефон:</td> | 114 | <td>Телефон:</td> |
115 | <td><b><a href="tel:{{ $Query[0]->telephone }}">{{ $Query[0]->telephone }}</a></b></td> | 115 | <td><b><a href="tel:{{ $Query[0]->telephone }}">{{ $Query[0]->telephone }}</a></b></td> |
116 | </tr> | 116 | </tr> |
117 | <tr> | 117 | <tr> |
118 | <td>E-mail:</td> | 118 | <td>E-mail:</td> |
119 | <td><b><a href="mailto:{{ $Query[0]->email }}">{{ $Query[0]->email }}</a></b></td> | 119 | <td><b><a href="mailto:{{ $Query[0]->email }}">{{ $Query[0]->email }}</a></b></td> |
120 | </tr> | 120 | </tr> |
121 | <tr> | 121 | <tr> |
122 | <td>Возраст:</td> | 122 | <td>Возраст:</td> |
123 | <td><b>{{ $Query[0]->old_year }}</b></td> | 123 | <td><b>{{ $Query[0]->old_year }}</b></td> |
124 | </tr> | 124 | </tr> |
125 | <tr> | 125 | <tr> |
126 | <td>Статус:</td> | 126 | <td>Статус:</td> |
127 | <td><b>{{ $status_work[$Query[0]->status_work] }}</b></td> | 127 | <td><b>{{ $status_work[$Query[0]->status_work] }}</b></td> |
128 | </tr> | 128 | </tr> |
129 | <tr> | 129 | <tr> |
130 | <td>Город проживания:</td> | 130 | <td>Город проживания:</td> |
131 | <td><b>{{ $Query[0]->city }}</b></td> | 131 | <td><b>{{ $Query[0]->city }}</b></td> |
132 | </tr> | 132 | </tr> |
133 | <tr> | 133 | <tr> |
134 | <td>Уровень английского:</td> | 134 | <td>Уровень английского:</td> |
135 | <td><b>{{ $Query[0]->en_is }}</b></td> | 135 | <td><b>{{ $Query[0]->en_is }}</b></td> |
136 | </tr> | 136 | </tr> |
137 | <tr> | 137 | <tr> |
138 | <td>Опыт работы:</td> | 138 | <td>Опыт работы:</td> |
139 | <td><b>{{ $Query[0]->experience }}</b></td> | 139 | <td><b>{{ $Query[0]->experience }}</b></td> |
140 | </tr> | 140 | </tr> |
141 | </tbody> | 141 | </tbody> |
142 | </table> | 142 | </table> |
143 | </div> | 143 | </div> |
144 | </div> | 144 | </div> |
145 | <div class="main__spoiler"> | 145 | <div class="main__spoiler"> |
146 | <button type="button" class="main__spoiler-toper js-toggle">Сертификаты / документы</button> | 146 | <button type="button" class="main__spoiler-toper js-toggle">Сертификаты / документы</button> |
147 | <div class="main__spoiler-body"> | 147 | <div class="main__spoiler-body"> |
148 | 148 | ||
149 | @if (isset($Query[0]->sertificate)) | 149 | @if (isset($Query[0]->sertificate)) |
150 | @if ($Query[0]->sertificate->count()) | 150 | @if ($Query[0]->sertificate->count()) |
151 | @foreach($Query[0]->sertificate as $it) | 151 | @foreach($Query[0]->sertificate as $it) |
152 | <table class="main__table"> | 152 | <table class="main__table"> |
153 | <tbody> | 153 | <tbody> |
154 | <tr> | 154 | <tr> |
155 | <td>Название сертификата:</td> | 155 | <td>Название сертификата:</td> |
156 | <td><b>{{ $it->name }}</b></td> | 156 | <td><b>{{ $it->name }}</b></td> |
157 | </tr> | 157 | </tr> |
158 | <tr> | 158 | <tr> |
159 | <td>Организация выдавшая документ:</td> | 159 | <td>Организация выдавшая документ:</td> |
160 | <td><b>{{ $it->education }}</b></td> | 160 | <td><b>{{ $it->education }}</b></td> |
161 | </tr> | 161 | </tr> |
162 | <tr> | 162 | <tr> |
163 | <td>Дата начала обучения:</td> | 163 | <td>Дата начала обучения:</td> |
164 | <td><b>{{ $it->date_begin }}</b></td> | 164 | <td><b>{{ $it->date_begin }}</b></td> |
165 | </tr> | 165 | </tr> |
166 | <tr> | 166 | <tr> |
167 | <td>Дата конца обучения:</td> | 167 | <td>Дата конца обучения:</td> |
168 | <td><b>{{ $it->end_begin }}</b></td> | 168 | <td><b>{{ $it->end_begin }}</b></td> |
169 | </tr> | 169 | </tr> |
170 | </tbody> | 170 | </tbody> |
171 | </table> | 171 | </table> |
172 | <br> | 172 | <br> |
173 | @endforeach | 173 | @endforeach |
174 | @endif | 174 | @endif |
175 | @endif | 175 | @endif |
176 | </div> | 176 | </div> |
177 | </div> | 177 | </div> |
178 | 178 | ||
179 | <div class="main__spoiler"> | 179 | <div class="main__spoiler"> |
180 | <button type="button" class="main__spoiler-toper js-toggle">Опыт работы</button> | 180 | <button type="button" class="main__spoiler-toper js-toggle">Опыт работы</button> |
181 | <div class="main__spoiler-body"> | 181 | <div class="main__spoiler-body"> |
182 | 182 | ||
183 | @if (isset($Query[0]->place_worker)) | 183 | @if (isset($Query[0]->place_worker)) |
184 | @if ($Query[0]->place_worker->count()) | 184 | @if ($Query[0]->place_worker->count()) |
185 | @foreach($Query[0]->place_worker as $it) | 185 | @foreach($Query[0]->place_worker as $it) |
186 | 186 | ||
187 | <table class="main__table"> | 187 | <table class="main__table"> |
188 | <tbody> | 188 | <tbody> |
189 | <tr> | 189 | <tr> |
190 | <td>Должность:</td> | 190 | <td>Должность:</td> |
191 | <td><b>{{ $it->job_title }}</b></td> | 191 | <td><b>{{ $it->job_title }}</b></td> |
192 | </tr> | 192 | </tr> |
193 | <tr> | 193 | <tr> |
194 | <td>Опыт работы в танкерном флоте:</td> | 194 | <td>Опыт работы в танкерном флоте:</td> |
195 | <td><b>@if($it->tanker==1) Есть @else Нет @endif</b></td> | 195 | <td><b>@if($it->tanker==1) Есть @else Нет @endif</b></td> |
196 | </tr> | 196 | </tr> |
197 | <tr> | 197 | <tr> |
198 | <td>Дата начала работы:</td> | 198 | <td>Дата начала работы:</td> |
199 | <td><b>{{ $it->begin_work }}</b></td> | 199 | <td><b>{{ $it->begin_work }}</b></td> |
200 | </tr> | 200 | </tr> |
201 | <tr> | 201 | <tr> |
202 | <td>Дата конца работы:</td> | 202 | <td>Дата конца работы:</td> |
203 | <td><b>{{ $it->end_work }}</b></td> | 203 | <td><b>{{ $it->end_work }}</b></td> |
204 | </tr> | 204 | </tr> |
205 | <tr> | 205 | <tr> |
206 | <td>Название компании:</td> | 206 | <td>Название компании:</td> |
207 | <td><b>{{ $it->name_company }}</b></td> | 207 | <td><b>{{ $it->name_company }}</b></td> |
208 | </tr> | 208 | </tr> |
209 | <tr> | 209 | <tr> |
210 | <td>GWT тип</td> | 210 | <td>GWT тип</td> |
211 | <td><b>{{ $it->GWT }}</b></td> | 211 | <td><b>{{ $it->GWT }}</b></td> |
212 | </tr> | 212 | </tr> |
213 | <tr> | 213 | <tr> |
214 | <td>ГД:</td> | 214 | <td>ГД:</td> |
215 | <td><b>{{ $it->KBT }}</b></td> | 215 | <td><b>{{ $it->KBT }}</b></td> |
216 | </tr> | 216 | </tr> |
217 | </tbody> | 217 | </tbody> |
218 | </table> | 218 | </table> |
219 | <br> | 219 | <br> |
220 | @endforeach | 220 | @endforeach |
221 | @endif | 221 | @endif |
222 | @endif | 222 | @endif |
223 | </div> | 223 | </div> |
224 | </div> | 224 | </div> |
225 | 225 | ||
226 | <div class="main__spoiler"> | 226 | <div class="main__spoiler"> |
227 | <button type="button" class="main__spoiler-toper js-toggle">Дополнительные документы</button> | 227 | <button type="button" class="main__spoiler-toper js-toggle">Дополнительные документы</button> |
228 | <div class="main__spoiler-body"> | 228 | <div class="main__spoiler-body"> |
229 | 229 | ||
230 | @if (isset($Query[0]->infobloks)) | 230 | @if (isset($Query[0]->infobloks)) |
231 | @if ($Query[0]->infobloks->count()) | 231 | @if ($Query[0]->infobloks->count()) |
232 | <table class="main__table"> | 232 | <table class="main__table"> |
233 | <tbody> | 233 | <tbody> |
234 | @foreach($Query[0]->infobloks as $it) | 234 | @foreach($Query[0]->infobloks as $it) |
235 | <tr> | 235 | <tr> |
236 | <td>Документ:</td> | 236 | <td>Документ:</td> |
237 | <td><b>{{ $it->name }}</b></td> | 237 | <td><b>{{ $it->name }}</b></td> |
238 | <td> | ||
239 | @if ($it->model_dop_info[0]->status == 0) Не указано | ||
240 | @elseif($it->model_dop_info[0]->status==1) В наличии | ||
241 | @else Отсутствует | ||
242 | @endif | ||
243 | </td> | ||
238 | </tr> | 244 | </tr> |
239 | @endforeach | 245 | @endforeach |
240 | </tbody> | 246 | </tbody> |
241 | </table> | 247 | </table> |
242 | @endif | 248 | @endif |
243 | @endif | 249 | @endif |
244 | </div> | 250 | </div> |
245 | </div> | 251 | </div> |
246 | </div> | 252 | </div> |
247 | 253 | ||
248 | <div class="main__resume-profile-about"> | 254 | <div class="main__resume-profile-about"> |
249 | <h2 class="main__resume-profile-about-title">О себе</h2> | 255 | <h2 class="main__resume-profile-about-title">О себе</h2> |
250 | <p class="main__resume-profile-about-text">{{ $Query[0]->text }}</p> | 256 | <p class="main__resume-profile-about-text">{{ $Query[0]->text }}</p> |
251 | @if (App\Classes\StatusUser::Status()==0) | 257 | @if (App\Classes\StatusUser::Status()==0) |
252 | @if ((!Auth()->user()->is_worker) && (Auth()->user()->is_message)) | 258 | @if ((!Auth()->user()->is_worker) && (Auth()->user()->is_message)) |
253 | <div class="button main__resume-profile-about-button js_it_button" data-fancybox data-src="#send2" data-vacancy="0" data-uid="{{ $idiot }}" data-tuid="{{ $Query[0]->users->id }}" data-options='{"touch":false,"autoFocus":false}'>Написать сообщение</div> | 259 | <div class="button main__resume-profile-about-button js_it_button" data-fancybox data-src="#send2" data-vacancy="0" data-uid="{{ $idiot }}" data-tuid="{{ $Query[0]->users->id }}" data-options='{"touch":false,"autoFocus":false}'>Написать сообщение</div> |
254 | @endif | 260 | @endif |
255 | @endif | 261 | @endif |
256 | </div> | 262 | </div> |
257 | <div class="main__resume-profile-info"> | 263 | <div class="main__resume-profile-info"> |
258 | <h2 class="main__resume-profile-info-title">Данные о прошлых компаниях</h2> | 264 | <h2 class="main__resume-profile-info-title">Данные о прошлых компаниях</h2> |
259 | <div class="main__resume-profile-info-body"> | 265 | <div class="main__resume-profile-info-body"> |
260 | @if ((isset($Query[0]->prev_company)) && ($Query[0]->prev_company->count())) | 266 | @if ((isset($Query[0]->prev_company)) && ($Query[0]->prev_company->count())) |
261 | @foreach ($Query[0]->prev_company as $it) | 267 | @foreach ($Query[0]->prev_company as $it) |
262 | <div class="main__resume-profile-info-body-item"> | 268 | <div class="main__resume-profile-info-body-item"> |
263 | <h3 class="main__resume-profile-info-body-subtitle">{{ $it->name_company }}</h3> | 269 | <h3 class="main__resume-profile-info-body-subtitle">{{ $it->name_company }}</h3> |
264 | <ul class="main__resume-profile-info-body-inner"> | 270 | <ul class="main__resume-profile-info-body-inner"> |
265 | <li> | 271 | <li> |
266 | <b>Руководитель</b> | 272 | <b>Руководитель</b> |
267 | <span>{{ $it->direct }}</span> | 273 | <span>{{ $it->direct }}</span> |
268 | </li> | 274 | </li> |
269 | <li> | 275 | <li> |
270 | <b>Телефон того, кто может дать рекомендацию</b> | 276 | <b>Телефон того, кто может дать рекомендацию</b> |
271 | <span> | 277 | <span> |
272 | @if (!empty($it->telephone)) | 278 | @if (!empty($it->telephone)) |
273 | <a href="tel:{{$it->telephone }}">{{ $it->telephone }}</a> | 279 | <a href="tel:{{$it->telephone }}">{{ $it->telephone }}</a> |
274 | @endif | 280 | @endif |
275 | @if (!empty($it->telephone2)) | 281 | @if (!empty($it->telephone2)) |
276 | <a href="tel:{{$it->telephone2 }}">{{ $it->telephone2 }}</a> | 282 | <a href="tel:{{$it->telephone2 }}">{{ $it->telephone2 }}</a> |
277 | @endif | 283 | @endif |
278 | </span> | 284 | </span> |
279 | </li> | 285 | </li> |
280 | </ul> | 286 | </ul> |
281 | </div> | 287 | </div> |
282 | @endforeach | 288 | @endforeach |
283 | @else | 289 | @else |
284 | <div class="main__resume-profile-info-body-item"> | 290 | <div class="main__resume-profile-info-body-item"> |
285 | <h3 class="main__resume-profile-info-body-subtitle">Нету данных о компании</h3> | 291 | <h3 class="main__resume-profile-info-body-subtitle">Нету данных о компании</h3> |
286 | </div> | 292 | </div> |
287 | @endif | 293 | @endif |
288 | </div> | 294 | </div> |
289 | </div> | 295 | </div> |
290 | 296 | ||
297 | <div class="main__resume-profile-info"> | ||
298 | <h2 class="main__resume-profile-info-title">Количество просмотров страницы: ({{ $stat[0]->lookin }})</h2> | ||
299 | </div> | ||
300 | |||
301 | <div class="main__resume-profile-info"> | ||
302 | <h2 class="main__resume-profile-info-title">Отзывы о работнике ({{ $Query[0]->response->count() }})</h2> | ||
303 | <div class="main__resume-profile-info-body"> | ||
304 | @if ((isset($Query[0]->response)) && ($Query[0]->response->count())) | ||
305 | <div class="main__resume-profile-info-body-item"> | ||
306 | <ul class="main__resume-profile-info-body-inner"> | ||
307 | @php $i = 1; @endphp | ||
308 | @foreach($Query[0]->response as $it) | ||
309 | <li> | ||
310 | <span><h3>Комментарий №{{$i}}</h3></span> | ||
311 | <span><b>Оценка человека: {{ $it->stars }}</b></span> | ||
312 | <span><b>Сообщение: </b>{{ $it->message }}</span> | ||
313 | </li> | ||
314 | @php $i++; @endphp | ||
315 | @endforeach | ||
316 | </ul> | ||
317 | </div> | ||
318 | @else | ||
319 | <div class="main__resume-profile-info-body-item"> | ||
320 | <h3 class="main__resume-profile-info-body-subtitle">Нету комментариев</h3> | ||
321 | </div> | ||
322 | @endif | ||
323 | </div> | ||
324 | </div> | ||
325 | |||
291 | <div class="main__resume-profile-review"> | 326 | <div class="main__resume-profile-review"> |
292 | <form action="{{ route('stars_answer') }}" method="POST"> | 327 | <form action="{{ route('stars_answer') }}" method="POST"> |
293 | @csrf | 328 | @csrf |
294 | <h2 class="main__resume-profile-review-title">Оставить отзыв о работнике</h2> | 329 | <h2 class="main__resume-profile-review-title">Оставить отзыв о работнике</h2> |
295 | <div class="rate"> | 330 | <div class="rate"> |
296 | <div class="rate__label">Ваша оценка:</div> | 331 | <div class="rate__label">Ваша оценка:</div> |
297 | <div class="rate__stars"> | 332 | <div class="rate__stars"> |
298 | <select name="stars" id="stars" class="star-rating js-stars"> | 333 | <select name="stars" id="stars" class="star-rating js-stars"> |
299 | <option value="5">5</option> | 334 | <option value="5">5</option> |
300 | <option value="4">4</option> | 335 | <option value="4">4</option> |
301 | <option value="3">3</option> | 336 | <option value="3">3</option> |
302 | <option value="2">2</option> | 337 | <option value="2">2</option> |
303 | <option value="1" selected>1</option> | 338 | <option value="1" selected>1</option> |
304 | </select> | 339 | </select> |
305 | </div> | 340 | </div> |
306 | </div> | 341 | </div> |
307 | <input type="hidden" name="worker_id" id="worker_id" value="{{ $Query[0]->id }}"/> | 342 | <input type="hidden" name="worker_id" id="worker_id" value="{{ $Query[0]->id }}"/> |
308 | <div class="main__resume-profile-review-body"> | 343 | <div class="main__resume-profile-review-body"> |
309 | <h3>Ваш отзыв</h3> | 344 | <h3>Ваш отзыв</h3> |
310 | <textarea class="textarea" name="message" id="message" placeholder="Текст отзыва…" required></textarea> | 345 | <textarea class="textarea" name="message" id="message" placeholder="Текст отзыва…" required></textarea> |
311 | <button type="submit" class="button">Оставить отзыв</button> | 346 | <button type="submit" class="button">Оставить отзыв</button> |
312 | </div> | 347 | </div> |
313 | </form> | 348 | </form> |
314 | </div> | 349 | </div> |
315 | </div> | 350 | </div> |
316 | </div> | 351 | </div> |
317 | </main> | 352 | </main> |
318 | </div> | 353 | </div> |
319 | @endsection | 354 | @endsection |
320 | 355 |
resources/views/workers/cabinet.blade.php
1 | @extends('layout.frontend', ['title' => 'Моя анкета - РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Моя анкета - РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | <script> | 4 | <script> |
5 | console.log('Test system'); | 5 | console.log('Test system'); |
6 | $(document).on('click', '#button_new_doc123', function() { | 6 | $(document).on('click', '#button_new_doc123', function() { |
7 | var this_ = $(this); | 7 | var this_ = $(this); |
8 | var val_ = this_.attr('data-val'); | 8 | var val_ = this_.attr('data-val'); |
9 | var new_diplom = $('#new_diplom'); | 9 | var new_diplom = $('#new_diplom'); |
10 | var new_diplom_val = new_diplom.val(); | 10 | var new_diplom_val = new_diplom.val(); |
11 | var new_data_begin = $('#new_data_begin'); | 11 | var new_data_begin = $('#new_data_begin'); |
12 | var new_data_begin_val = new_data_begin.val(); | 12 | var new_data_begin_val = new_data_begin.val(); |
13 | var new_data_end = $('#new_data_end'); | 13 | var new_data_end = $('#new_data_end'); |
14 | var new_data_end_val = new_data_end.val(); | 14 | var new_data_end_val = new_data_end.val(); |
15 | var education = $('#education'); | 15 | var education = $('#education'); |
16 | var education_val = education.val(); | 16 | var education_val = education.val(); |
17 | var worker_id = $('#new_id'); | 17 | var worker_id = $('#new_id'); |
18 | var worker_val = worker_id.val(); | 18 | var worker_val = worker_id.val(); |
19 | 19 | ||
20 | console.log('sort items ' + val_); | 20 | console.log('sort items ' + val_); |
21 | 21 | ||
22 | if (new_diplom_val == '') { | 22 | if (new_diplom_val == '') { |
23 | new_diplom.addClass('err_red'); | 23 | new_diplom.addClass('err_red'); |
24 | console.log('Border Up'); | 24 | console.log('Border Up'); |
25 | } else { | 25 | } else { |
26 | $.ajax({ | 26 | $.ajax({ |
27 | type: "GET", | 27 | type: "GET", |
28 | url: "{{ route('worker.add_serificate') }}", | 28 | url: "{{ route('worker.add_serificate') }}", |
29 | data: "worker_id="+worker_val+"&date_begin="+new_data_begin_val + "&end_begin=" + new_data_end_val + "&name=" + new_diplom_val + "&education="+education_val, | 29 | data: "worker_id="+worker_val+"&date_begin="+new_data_begin_val + "&end_begin=" + new_data_end_val + "&name=" + new_diplom_val + "&education="+education_val, |
30 | success: function (data) { | 30 | success: function (data) { |
31 | console.log('Блокировка...'); | 31 | console.log('Блокировка...'); |
32 | console.log(data); | 32 | console.log(data); |
33 | $('#sertificate').html(data); | 33 | $('#sertificate').html(data); |
34 | if (new_diplom.hasClass('err_red')) new_diplom.removeClass('err_red'); | 34 | if (new_diplom.hasClass('err_red')) new_diplom.removeClass('err_red'); |
35 | }, | 35 | }, |
36 | headers: { | 36 | headers: { |
37 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 37 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
38 | }, | 38 | }, |
39 | error: function (data) { | 39 | error: function (data) { |
40 | data = JSON.stringify(data); | 40 | data = JSON.stringify(data); |
41 | console.log('Error: ' + data); | 41 | console.log('Error: ' + data); |
42 | } | 42 | } |
43 | }); | 43 | }); |
44 | } | 44 | } |
45 | }); | 45 | }); |
46 | 46 | ||
47 | $(document).on('click', '#btn_new_diplom123', function() { | 47 | $(document).on('click', '#btn_new_diplom123', function() { |
48 | var this_ = $(this); | 48 | var this_ = $(this); |
49 | var val_ = this_.attr('data-val'); | 49 | var val_ = this_.attr('data-val'); |
50 | var documents = $('#documents'); | 50 | var documents = $('#documents'); |
51 | var doc_val = documents.val(); | 51 | var doc_val = documents.val(); |
52 | var block = $('#ajax_dop_diplomi'); | 52 | var block = $('#ajax_dop_diplomi'); |
53 | 53 | ||
54 | console.log('worker_id='+val_+'it_infoblock='+ doc_val); | 54 | console.log('worker_id='+val_+'it_infoblock='+ doc_val); |
55 | 55 | ||
56 | $.ajax({ | 56 | $.ajax({ |
57 | type: "GET", | 57 | type: "GET", |
58 | url: "", | 58 | url: "", |
59 | data: "worker_id="+val_+"&infoblok_id="+doc_val, | 59 | data: "worker_id="+val_+"&infoblok_id="+doc_val, |
60 | success: function (data) { | 60 | success: function (data) { |
61 | location.url = data; | 61 | location.url = data; |
62 | console.log('Добавление документа-диплома'); | 62 | console.log('Добавление документа-диплома'); |
63 | console.log(data); | 63 | console.log(data); |
64 | block.html(data); | 64 | block.html(data); |
65 | }, | 65 | }, |
66 | headers: { | 66 | headers: { |
67 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 67 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
68 | }, | 68 | }, |
69 | error: function (data) { | 69 | error: function (data) { |
70 | data = JSON.stringify(data); | 70 | data = JSON.stringify(data); |
71 | console.log('Error: ' + data); | 71 | console.log('Error: ' + data); |
72 | } | 72 | } |
73 | }); | 73 | }); |
74 | }); | 74 | }); |
75 | 75 | ||
76 | $(document).on('click', '#new_work', function() { | 76 | $(document).on('click', '#new_work', function() { |
77 | var this_ = $(this); | 77 | var this_ = $(this); |
78 | var val_ = this_.attr('data-val'); | 78 | var val_ = this_.attr('data-val'); |
79 | var new_diplom = $('#new_diplom').val(); | 79 | var new_diplom = $('#new_diplom').val(); |
80 | var new_data_begin = $('#new_data_begin').val(); | 80 | var new_data_begin = $('#new_data_begin').val(); |
81 | var new_data_end = $('#new_data_end').val(); | 81 | var new_data_end = $('#new_data_end').val(); |
82 | var new_job_title = $('#new_job_title').val(); | 82 | var new_job_title = $('#new_job_title').val(); |
83 | var new_teplohod = $('#new_teplohod').val(); | 83 | var new_teplohod = $('#new_teplohod').val(); |
84 | var new_GWT = $('#new_GWT').val(); | 84 | var new_GWT = $('#new_GWT').val(); |
85 | var new_KBT = $('#new_KBT').val(); | 85 | var new_KBT = $('#new_KBT').val(); |
86 | var new_Begin_work = $('#new_Begin_work').val(); | 86 | var new_Begin_work = $('#new_Begin_work').val(); |
87 | var new_End_work = $('#new_End_work').val(); | 87 | var new_End_work = $('#new_End_work').val(); |
88 | var new_name_company = $('#new_name_company').val(); | 88 | var new_name_company = $('#new_name_company').val(); |
89 | 89 | ||
90 | console.log('worker_id='+val_+'it_infoblock='+ doc_val); | 90 | console.log('worker_id='+val_+'it_infoblock='+ doc_val); |
91 | 91 | ||
92 | $.ajax({ | 92 | $.ajax({ |
93 | type: "GET", | 93 | type: "GET", |
94 | url: "", | 94 | url: "", |
95 | data: "worker_id="+val_+"&infoblok_id="+doc_val, | 95 | data: "worker_id="+val_+"&infoblok_id="+doc_val, |
96 | success: function (data) { | 96 | success: function (data) { |
97 | location.url = data; | 97 | location.url = data; |
98 | console.log('Добавление документа-диплома'); | 98 | console.log('Добавление документа-диплома'); |
99 | console.log(data); | 99 | console.log(data); |
100 | block.html(data); | 100 | block.html(data); |
101 | }, | 101 | }, |
102 | headers: { | 102 | headers: { |
103 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 103 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
104 | }, | 104 | }, |
105 | error: function (data) { | 105 | error: function (data) { |
106 | data = JSON.stringify(data); | 106 | data = JSON.stringify(data); |
107 | console.log('Error: ' + data); | 107 | console.log('Error: ' + data); |
108 | } | 108 | } |
109 | }); | 109 | }); |
110 | }); | 110 | }); |
111 | 111 | ||
112 | $(document).on('click', '#old_year', function() { | 112 | $(document).on('click', '#old_year', function() { |
113 | var this_ = $(this); | 113 | var this_ = $(this); |
114 | var val = this_.val(); | 114 | var val = this_.val(); |
115 | 115 | ||
116 | if (val < 0) | 116 | if (val < 0) |
117 | $('#old_year').val(0); | 117 | $('#old_year').val(0); |
118 | 118 | ||
119 | console.log('Возраст не может выполнить такую операцию'); | 119 | console.log('Возраст не может выполнить такую операцию'); |
120 | }); | 120 | }); |
121 | 121 | ||
122 | $(document).on('change', '.sertificates_js', function() { | 122 | $(document).on('change', '.sertificates_js', function() { |
123 | var this_ = $(this); | 123 | var this_ = $(this); |
124 | var infoblock_id = this_.attr('data-info'); | 124 | var infoblock_id = this_.attr('data-info'); |
125 | var val = this_.val(); | 125 | var val = this_.val(); |
126 | var block = $('#block_sertificate'); | 126 | var block = $('#block_sertificate'); |
127 | 127 | ||
128 | console.log('infoblok='+infoblock_id); | 128 | console.log('infoblok='+infoblock_id); |
129 | console.log('val='+val); | 129 | console.log('val='+val); |
130 | 130 | ||
131 | $.ajax({ | 131 | $.ajax({ |
132 | type: "GET", | 132 | type: "GET", |
133 | url: "{{ route('worker.delete_add_diplom', ['worker' => $Worker[0]->id]) }}", | 133 | url: "{{ route('worker.delete_add_diplom', ['worker' => $Worker[0]->id]) }}", |
134 | data: "&infoblok_id=" + infoblock_id+"&val="+val, | 134 | data: "&infoblok_id=" + infoblock_id+"&val="+val, |
135 | success: function (data) { | 135 | success: function (data) { |
136 | location.url = data; | 136 | location.url = data; |
137 | console.log('Удаление левых документов + добавление реальных документов'); | 137 | console.log('Удаление левых документов + добавление реальных документов'); |
138 | 138 | ||
139 | console.log('Info 100% +'+ data); | 139 | console.log('Info 100% +'+ data); |
140 | //window.location.href = data; | 140 | //window.location.href = data; |
141 | //block.html(data); | 141 | //block.html(data); |
142 | }, | 142 | }, |
143 | headers: { | 143 | headers: { |
144 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | 144 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
145 | }, | 145 | }, |
146 | error: function (data) { | 146 | error: function (data) { |
147 | data = JSON.stringify(data); | 147 | data = JSON.stringify(data); |
148 | console.log('Error: ' + data); | 148 | console.log('Error: ' + data); |
149 | } | 149 | } |
150 | }); | 150 | }); |
151 | 151 | ||
152 | }); | 152 | }); |
153 | 153 | ||
154 | </script> | 154 | </script> |
155 | @endsection | 155 | @endsection |
156 | 156 | ||
157 | @section('content') | 157 | @section('content') |
158 | <section class="cabinet"> | 158 | <section class="cabinet"> |
159 | <div class="container"> | 159 | <div class="container"> |
160 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 160 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
161 | <li><a href="{{ route('index') }}">Главная</a></li> | 161 | <li><a href="{{ route('index') }}">Главная</a></li> |
162 | <li><b>Личный кабинет</b></li> | 162 | <li><b>Личный кабинет</b></li> |
163 | </ul> | 163 | </ul> |
164 | <div class="cabinet__wrapper"> | 164 | <div class="cabinet__wrapper"> |
165 | <div class="cabinet__side"> | 165 | <div class="cabinet__side"> |
166 | <div class="cabinet__side-toper"> | 166 | <div class="cabinet__side-toper"> |
167 | @include('workers.emblema') | 167 | @include('workers.emblema') |
168 | 168 | ||
169 | </div> | 169 | </div> |
170 | 170 | ||
171 | @include('workers.menu', ['item' => 1]) | 171 | @include('workers.menu', ['item' => 1]) |
172 | </div> | 172 | </div> |
173 | <form class="cabinet__body" action="{{ route('worker.cabinet_save', ['worker' => $Worker[0]->id]) }}" enctype="multipart/form-data" method="POST"> | 173 | <form class="cabinet__body" action="{{ route('worker.cabinet_save', ['worker' => $Worker[0]->id]) }}" enctype="multipart/form-data" method="POST"> |
174 | @csrf | 174 | @csrf |
175 | @include('messages_error') | 175 | @include('messages_error') |
176 | <div class="cabinet__body-item"> | 176 | <div class="cabinet__body-item"> |
177 | <div class="cabinet__anketa"> | 177 | <div class="cabinet__anketa"> |
178 | <h2 class="title cabinet__title">Моя анкета</h2> | 178 | <h2 class="title cabinet__title">Моя анкета</h2> |
179 | <div class="cabinet__anketa-buttons"> | 179 | <div class="cabinet__anketa-buttons"> |
180 | <a href="{{ route('worker.up', ['worker' => $Worker[0]->id]) }}" class="button">Поднять резюме</a> | 180 | <a href="{{ route('worker.up', ['worker' => $Worker[0]->id]) }}" class="button">Поднять резюме</a> |
181 | <a href="{{ route('resume_download', ['worker' => $Worker[0]->id]) }}" target="_blank" class="button"> | 181 | <a href="{{ route('resume_download', ['worker' => $Worker[0]->id]) }}" target="_blank" class="button"> |
182 | <svg> | 182 | <svg> |
183 | <use xlink:href="{{ asset('images/sprite.svg#share') }}"></use> | 183 | <use xlink:href="{{ asset('images/sprite.svg#share') }}"></use> |
184 | </svg> | 184 | </svg> |
185 | Скачать резюме | 185 | Скачать резюме |
186 | </a> | 186 | </a> |
187 | </div> | 187 | </div> |
188 | </div> | 188 | </div> |
189 | </div> | 189 | </div> |
190 | <div class="cabinet__body-item"> | 190 | <div class="cabinet__body-item"> |
191 | <div class="cabinet__stats"> | 191 | <div class="cabinet__stats"> |
192 | <h3 class="cabinet__subtitle cabinet__stats-title">Статистика</h3> | 192 | <h3 class="cabinet__subtitle cabinet__stats-title">Статистика</h3> |
193 | <div class="cabinet__stats-body"> | 193 | <div class="cabinet__stats-body"> |
194 | <div class="cabinet__stats-item"> | 194 | <div class="cabinet__stats-item"> |
195 | <svg> | 195 | <svg> |
196 | <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use> | 196 | <use xlink:href="{{ asset('images/sprite.svg#eye-3') }}"></use> |
197 | </svg> | 197 | </svg> |
198 | <span>Просмотров:</span> | 198 | <span>Просмотров:</span> |
199 | <b>@if (isset($stat[0]->lookin)) {{ $stat[0]->lookin }} @else 0 @endif</b> | 199 | <b>@if (isset($stat[0]->lookin)) {{ $stat[0]->lookin }} @else 0 @endif</b> |
200 | </div> | 200 | </div> |
201 | <div class="cabinet__stats-item"> | 201 | <div class="cabinet__stats-item"> |
202 | <svg> | 202 | <svg> |
203 | <use xlink:href="{{ asset('images/sprite.svg#warning') }}"></use> | 203 | <use xlink:href="{{ asset('images/sprite.svg#warning') }}"></use> |
204 | </svg> | 204 | </svg> |
205 | <span>Отзывов:</span> | 205 | <span>Отзывов:</span> |
206 | <b>@if (isset($stat[0]->message)) {{ $stat[0]->message }} @else 0 @endif</b> | 206 | <b>@if(isset($Worker[0]->response)) {{ $Worker[0]->response->count() }} @else 0 @endif</b> |
207 | </div> | 207 | </div> |
208 | </div> | 208 | </div> |
209 | <div class="cabinet__stats-subtitle">Анкета заполнена на {{ $persent }}%</div> | 209 | <div class="cabinet__stats-subtitle">Анкета заполнена на {{ $persent }}%</div> |
210 | <div class="cabinet__stats-line"> | 210 | <div class="cabinet__stats-line"> |
211 | <span style="width:{{ $persent }}%"></span> | 211 | <span style="width:{{ $persent }}%"></span> |
212 | </div> | 212 | </div> |
213 | <div class="cabinet__stats-bottom">Заполните профиль, чтобы повысить процент анкеты на 80%</div> | 213 | <div class="cabinet__stats-bottom">Заполните профиль, чтобы повысить процент анкеты на 80%</div> |
214 | </div> | 214 | </div> |
215 | </div> | 215 | </div> |
216 | <div class="cabinet__body-item"> | 216 | <div class="cabinet__body-item"> |
217 | <h3 class="cabinet__subtitle">Профиль</h3> | 217 | <h3 class="cabinet__subtitle">Профиль</h3> |
218 | <div class="cabinet__avatar"> | 218 | <div class="cabinet__avatar"> |
219 | <div class="cabinet__avatar-pic"> | 219 | <div class="cabinet__avatar-pic"> |
220 | 220 | ||
221 | @if (!empty($Worker[0]->photo)) | 221 | @if (!empty($Worker[0]->photo)) |
222 | <img src="{{ asset(Storage::url($Worker[0]->photo)) }}"/> | 222 | <img src="{{ asset(Storage::url($Worker[0]->photo)) }}"/> |
223 | @else | 223 | @else |
224 | <svg> | 224 | <svg> |
225 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> | 225 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> |
226 | </svg> | 226 | </svg> |
227 | @endif | 227 | @endif |
228 | </div> | 228 | </div> |
229 | <div class="cabinet__avatar-form"> | 229 | <div class="cabinet__avatar-form"> |
230 | <label class="file"> | 230 | <label class="file"> |
231 | <span class="file__input"> | 231 | <span class="file__input"> |
232 | <input type="file" name="photo" id="photo"> | 232 | <input type="file" name="photo" id="photo"> |
233 | 233 | ||
234 | <span class="button"> | 234 | <span class="button"> |
235 | <svg> | 235 | <svg> |
236 | <use xlink:href="{{ asset('images/sprite.svg#plus') }}"></use> | 236 | <use xlink:href="{{ asset('images/sprite.svg#plus') }}"></use> |
237 | </svg> | 237 | </svg> |
238 | Загрузить | 238 | Загрузить |
239 | </span> | 239 | </span> |
240 | </span> | 240 | </span> |
241 | </label> | 241 | </label> |
242 | <p class="cabinet__text">Загрузите фотографию в формате svg., jpg., jpeg., png.</p> | 242 | <p class="cabinet__text">Загрузите фотографию в формате svg., jpg., jpeg., png.</p> |
243 | </div> | 243 | </div> |
244 | </div> | 244 | </div> |
245 | </div> | 245 | </div> |
246 | <div class="cabinet__body-item"> | 246 | <div class="cabinet__body-item"> |
247 | <div class="cabinet__inputs"> | 247 | <div class="cabinet__inputs"> |
248 | <div class="cabinet__inputs-item form-group"> | 248 | <div class="cabinet__inputs-item form-group"> |
249 | <label class="form-group__label">Электронная почта *</label> | 249 | <label class="form-group__label">Электронная почта *</label> |
250 | <div class="form-group__item"> | 250 | <div class="form-group__item"> |
251 | <input type="email" name="email" id="email" value="{{ $Worker[0]->email }}" class="input" placeholder="info@rekamore.su" required> | 251 | <input type="email" name="email" id="email" value="{{ $Worker[0]->email }}" class="input" placeholder="info@rekamore.su" required> |
252 | </div> | 252 | </div> |
253 | </div> | 253 | </div> |
254 | <div class="cabinet__inputs-item form-group"> | 254 | <div class="cabinet__inputs-item form-group"> |
255 | <label class="form-group__label">Статус</label> | 255 | <label class="form-group__label">Статус</label> |
256 | <div class="form-group__item"> | 256 | <div class="form-group__item"> |
257 | <div class="select"> | 257 | <div class="select"> |
258 | <select class="js-select2" name="status_work" id="status_work"> | 258 | <select class="js-select2" name="status_work" id="status_work"> |
259 | <option value="1" @if ($Worker[0]->status_work == 1) selected @endif>Не указано</option> | 259 | <option value="1" @if ($Worker[0]->status_work == 1) selected @endif>Не указано</option> |
260 | <option value="2" @if ($Worker[0]->status_work == 2) selected @endif>Не ищу работу</option> | 260 | <option value="2" @if ($Worker[0]->status_work == 2) selected @endif>Не ищу работу</option> |
261 | <option value="0" @if ($Worker[0]->status_work == 0) selected @endif>Ищу работу</option> | 261 | <option value="0" @if ($Worker[0]->status_work == 0) selected @endif>Ищу работу</option> |
262 | </select> | 262 | </select> |
263 | </div> | 263 | </div> |
264 | </div> | 264 | </div> |
265 | </div> | 265 | </div> |
266 | <!--<div class="cabinet__inputs-item form-group"> | 266 | <!--<div class="cabinet__inputs-item form-group"> |
267 | <label class="form-group__label">Статус *</label> | 267 | <label class="form-group__label">Статус *</label> |
268 | <div class="form-group__item"> | 268 | <div class="form-group__item"> |
269 | <input type="text" class="input" required> | 269 | <input type="text" class="input" required> |
270 | </div> | 270 | </div> |
271 | </div>--> | 271 | </div>--> |
272 | @if (isset($Worker[0]->users)) | 272 | @if (isset($Worker[0]->users)) |
273 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 273 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
274 | <label class="form-group__label">Фамилия *</label> | 274 | <label class="form-group__label">Фамилия *</label> |
275 | <div class="form-group__item"> | 275 | <div class="form-group__item"> |
276 | <input type="text" name="surname" id="surmane" class="input" value="{{ $Worker[0]->users->surname }}" placeholder="Филиппов" required> | 276 | <input type="text" name="surname" id="surmane" class="input" value="{{ $Worker[0]->users->surname }}" placeholder="Филиппов" required> |
277 | </div> | 277 | </div> |
278 | </div> | 278 | </div> |
279 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 279 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
280 | <label class="form-group__label">Имя *</label> | 280 | <label class="form-group__label">Имя *</label> |
281 | <div class="form-group__item"> | 281 | <div class="form-group__item"> |
282 | <input type="text" name="name_man" id="name_man" class="input" value="{{ $Worker[0]->users->name_man }}" placeholder="Егор" required> | 282 | <input type="text" name="name_man" id="name_man" class="input" value="{{ $Worker[0]->users->name_man }}" placeholder="Егор" required> |
283 | </div> | 283 | </div> |
284 | </div> | 284 | </div> |
285 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 285 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
286 | <label class="form-group__label">Отчество *</label> | 286 | <label class="form-group__label">Отчество *</label> |
287 | <div class="form-group__item"> | 287 | <div class="form-group__item"> |
288 | <input type="text" class="input" name="surname2" id="surmane2" value="{{ $Worker[0]->users->surname2 }}" placeholder="Алексеевич"> | 288 | <input type="text" class="input" name="surname2" id="surmane2" value="{{ $Worker[0]->users->surname2 }}" placeholder="Алексеевич"> |
289 | </div> | 289 | </div> |
290 | </div> | 290 | </div> |
291 | @endif | 291 | @endif |
292 | </div> | 292 | </div> |
293 | </div> | 293 | </div> |
294 | <div class="cabinet__body-item"> | 294 | <div class="cabinet__body-item"> |
295 | <h3 class="cabinet__subtitle">Основная информация</h3> | 295 | <h3 class="cabinet__subtitle">Основная информация</h3> |
296 | <div class="cabinet__inputs"> | 296 | <div class="cabinet__inputs"> |
297 | <div class="cabinet__inputs-item cabinet__inputs-item_min form-group"> | 297 | <div class="cabinet__inputs-item cabinet__inputs-item_min form-group"> |
298 | <label class="form-group__label">Возраст</label> | 298 | <label class="form-group__label">Возраст</label> |
299 | <div class="form-group__item"> | 299 | <div class="form-group__item"> |
300 | <input type="number" name="old_year" id="old_year" value="{{ $Worker[0]->old_year }}" class="input" placeholder="0" required> | 300 | <input type="number" name="old_year" id="old_year" value="{{ $Worker[0]->old_year }}" class="input" placeholder="0" required> |
301 | </div> | 301 | </div> |
302 | </div> | 302 | </div> |
303 | <div class="cabinet__inputs-item cabinet__inputs-item_max form-group"> | 303 | <div class="cabinet__inputs-item cabinet__inputs-item_max form-group"> |
304 | <label class="form-group__label">Желаемые вакансии</label> | 304 | <label class="form-group__label">Желаемые вакансии</label> |
305 | <div class="form-group__item"> | 305 | <div class="form-group__item"> |
306 | <div class="select"> | 306 | <div class="select"> |
307 | <select class="js-select2" name="job_title_id[]" id="job_title_id[]" multiple="multiple"> | 307 | <select class="js-select2" name="job_title_id[]" id="job_title_id[]" multiple="multiple"> |
308 | @if ($Job_titles->count()) | 308 | @if ($Job_titles->count()) |
309 | @foreach($Job_titles as $it) | 309 | @foreach($Job_titles as $it) |
310 | @php $selected = false; @endphp | 310 | @php $selected = false; @endphp |
311 | @if (isset($Worker[0]->job_titles)) | 311 | @if (isset($Worker[0]->job_titles)) |
312 | @if ($Worker[0]->job_titles->count()) | 312 | @if ($Worker[0]->job_titles->count()) |
313 | @foreach($Worker[0]->job_titles as $select) | 313 | @foreach($Worker[0]->job_titles as $select) |
314 | @if ($it->id == $select->id) | 314 | @if ($it->id == $select->id) |
315 | @php $selected = true; @endphp | 315 | @php $selected = true; @endphp |
316 | @endif | 316 | @endif |
317 | @endforeach | 317 | @endforeach |
318 | @endif | 318 | @endif |
319 | @endif | 319 | @endif |
320 | <option value="{{ $it->id }}" @if ($selected) selected @endif>{{ $it->name }}</option> | 320 | <option value="{{ $it->id }}" @if ($selected) selected @endif>{{ $it->name }}</option> |
321 | @endforeach | 321 | @endforeach |
322 | @endif | 322 | @endif |
323 | </select> | 323 | </select> |
324 | </div> | 324 | </div> |
325 | </div> | 325 | </div> |
326 | </div> | 326 | </div> |
327 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 327 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
328 | <label class="form-group__label">Город</label> | 328 | <label class="form-group__label">Город</label> |
329 | <div class="form-group__item"> | 329 | <div class="form-group__item"> |
330 | <input type="text" name="city" id="city" value="{{ $Worker[0]->city }}" class="input" placeholder="Челябинск" required> | 330 | <input type="text" name="city" id="city" value="{{ $Worker[0]->city }}" class="input" placeholder="Челябинск" required> |
331 | </div> | 331 | </div> |
332 | </div> | 332 | </div> |
333 | <div class="cabinet__inputs-item form-group"> | 333 | <div class="cabinet__inputs-item form-group"> |
334 | <label class="form-group__label">Опыт работы</label> | 334 | <label class="form-group__label">Опыт работы</label> |
335 | <div class="form-group__item"> | 335 | <div class="form-group__item"> |
336 | <div class="select"> | 336 | <div class="select"> |
337 | <select class="js-select2" id="experience" name="experience"> | 337 | <select class="js-select2" id="experience" name="experience"> |
338 | <option value="Не указано" @if (empty($Worker[0]->experience)) selected @endif>Не указано</option> | 338 | <option value="Не указано" @if (empty($Worker[0]->experience)) selected @endif>Не указано</option> |
339 | <option value="меньше 1 года" @if ($Worker[0]->experience == 'меньше 1 года') selected @endif>меньше 1 года</option> | 339 | <option value="меньше 1 года" @if ($Worker[0]->experience == 'меньше 1 года') selected @endif>меньше 1 года</option> |
340 | <option value="от 1 года до 3 лет" @if ($Worker[0]->experience == 'от 1 года до 3 лет') selected @endif>от 1 года до 3 лет</option> | 340 | <option value="от 1 года до 3 лет" @if ($Worker[0]->experience == 'от 1 года до 3 лет') selected @endif>от 1 года до 3 лет</option> |
341 | <option value="от 3 до 5 лет" @if ($Worker[0]->experience == 'от 3 до 5 лет') selected @endif>от 3 до 5 лет</option> | 341 | <option value="от 3 до 5 лет" @if ($Worker[0]->experience == 'от 3 до 5 лет') selected @endif>от 3 до 5 лет</option> |
342 | <option value="от 5 до 10 лет" @if ($Worker[0]->experience == 'от 5 до 10 лет') selected @endif>от 5 до 10 лет</option> | 342 | <option value="от 5 до 10 лет" @if ($Worker[0]->experience == 'от 5 до 10 лет') selected @endif>от 5 до 10 лет</option> |
343 | <option value="Больше 10 лет" @if ($Worker[0]->experience == 'Больше 10 лет') selected @endif>Больше 10 лет</option> | 343 | <option value="Больше 10 лет" @if ($Worker[0]->experience == 'Больше 10 лет') selected @endif>Больше 10 лет</option> |
344 | </select> | 344 | </select> |
345 | </div> | 345 | </div> |
346 | </div> | 346 | </div> |
347 | </div> | 347 | </div> |
348 | 348 | ||
349 | <div class="cabinet__inputs-item form-group"> | 349 | <div class="cabinet__inputs-item form-group"> |
350 | <label class="form-group__label">Номер телефона 1</label> | 350 | <label class="form-group__label">Номер телефона 1</label> |
351 | <div class="form-group__item"> | 351 | <div class="form-group__item"> |
352 | <input type="tel" name="telephone" id="telephone" value="{{ old('telephone') ?? $Worker[0]->telephone ?? '' }}" class="input" placeholder="+7 (___) ___-__-__" required> | 352 | <input type="tel" name="telephone" id="telephone" value="{{ old('telephone') ?? $Worker[0]->telephone ?? '' }}" class="input" placeholder="+7 (___) ___-__-__" required> |
353 | </div> | 353 | </div> |
354 | </div> | 354 | </div> |
355 | <div class="cabinet__inputs-item form-group"> | 355 | <div class="cabinet__inputs-item form-group"> |
356 | <label class="form-group__label">Номер телефона 2</label> | 356 | <label class="form-group__label">Номер телефона 2</label> |
357 | <div class="form-group__item"> | 357 | <div class="form-group__item"> |
358 | <input type="tel" name="telephone2" id="telephon2" value="{{ old('telephone2') ?? $Worker[0]->telephone2 ?? '' }}" class="input" placeholder="+7 (___) ___-__-__"> | 358 | <input type="tel" name="telephone2" id="telephon2" value="{{ old('telephone2') ?? $Worker[0]->telephone2 ?? '' }}" class="input" placeholder="+7 (___) ___-__-__"> |
359 | </div> | 359 | </div> |
360 | </div> | 360 | </div> |
361 | </div> | 361 | </div> |
362 | </div> | 362 | </div> |
363 | 363 | ||
364 | <div class="cabinet__body-item"> | 364 | <div class="cabinet__body-item"> |
365 | <h4 class="cabinet__h4">О себе</h4> | 365 | <h4 class="cabinet__h4">О себе</h4> |
366 | <textarea class="textarea" name="text" id="text" placeholder="Не указано">{{ $Worker[0]->text }}</textarea> | 366 | <textarea class="textarea" name="text" id="text" placeholder="Не указано">{{ $Worker[0]->text }}</textarea> |
367 | <div class="cabinet__buttons"> | 367 | <div class="cabinet__buttons"> |
368 | <button type="submit" class="button">Сохранить</button> | 368 | <button type="submit" class="button">Сохранить</button> |
369 | <label class="file"> | 369 | <label class="file"> |
370 | <span class="file__input"> | 370 | <span class="file__input"> |
371 | <input type="file" name="file" id="file"> | 371 | <input type="file" name="file" id="file"> |
372 | <span class="button button_light">@if (empty($Worker[0]->file)) Прикрепить резюме @else Обновить резюме @endif</span> | 372 | <span class="button button_light">@if (empty($Worker[0]->file)) Прикрепить резюме @else Обновить резюме @endif</span> |
373 | </span> | 373 | </span> |
374 | </label> | 374 | </label> |
375 | </div> | 375 | </div> |
376 | </div> | 376 | </div> |
377 | 377 | ||
378 | 378 | ||
379 | <div id="sertificate" name="sertificate"> | 379 | <div id="sertificate" name="sertificate"> |
380 | @if ((isset($Worker[0]->sertificate)) && ($Worker[0]->sertificate->count() > 0)) | 380 | @if ((isset($Worker[0]->sertificate)) && ($Worker[0]->sertificate->count() > 0)) |
381 | @php $i = 0; @endphp | 381 | @php $i = 0; @endphp |
382 | @foreach($Worker[0]->sertificate as $it) | 382 | @foreach($Worker[0]->sertificate as $it) |
383 | <div style="margin-bottom: 20px" class="cabinet__body-item"> | 383 | <div style="margin-bottom: 20px" class="cabinet__body-item"> |
384 | @if ($i == 0) | 384 | @if ($i == 0) |
385 | <h3 class="cabinet__subtitle">Сертификаты / документы</h3> | 385 | <h3 class="cabinet__subtitle">Сертификаты / документы</h3> |
386 | @endif | 386 | @endif |
387 | <h4 class="cabinet__h4">Сертификат {{ $i+1 }}</h4> | 387 | <h4 class="cabinet__h4">Сертификат {{ $i+1 }}</h4> |
388 | <div class="cabinet__inputs"> | 388 | <div class="cabinet__inputs"> |
389 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 389 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
390 | <label class="form-group__label">Название сертификата:</label> | 390 | <label class="form-group__label">Название сертификата:</label> |
391 | <div class="form-group__item"> | 391 | <div class="form-group__item"> |
392 | <input type="text" class="input" value="{{ $it->name }}" > | 392 | <input type="text" class="input" value="{{ $it->name }}" > |
393 | </div> | 393 | </div> |
394 | </div> | 394 | </div> |
395 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 395 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
396 | <label class="form-group__label">Учебное заведение</label> | 396 | <label class="form-group__label">Учебное заведение</label> |
397 | <div class="form-group__item"> | 397 | <div class="form-group__item"> |
398 | <input type="text" class="input" value=" $it->education }}" disabled> | 398 | <input type="text" class="input" value=" $it->education }}" disabled> |
399 | </div> | 399 | </div> |
400 | </div>--> | 400 | </div>--> |
401 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 401 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
402 | <label class="form-group__label">Действителен до:</label> | 402 | <label class="form-group__label">Действителен до:</label> |
403 | <div class="form-group__item"> | 403 | <div class="form-group__item"> |
404 | <input type="text" class="input" value="{{ $it->end_begin }}"> | 404 | <input type="text" class="input" value="{{ $it->end_begin }}"> |
405 | </div> | 405 | </div> |
406 | </div> | 406 | </div> |
407 | <a href="{{ route('worker.delete_sertificate', ['doc' => $it->id]) }}" class="button button_light"> | 407 | <a href="{{ route('worker.delete_sertificate', ['doc' => $it->id]) }}" class="button button_light"> |
408 | <svg> | 408 | <svg> |
409 | <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> | 409 | <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> |
410 | </svg> | 410 | </svg> |
411 | Удалить | 411 | Удалить |
412 | </a> | 412 | </a> |
413 | <a href="{{ route('worker.edit_sertificate', ['worker' => $Worker[0]->id, 'doc' => $it->id ]) }}" class="button">Редактирование</a> | 413 | <a href="{{ route('worker.edit_sertificate', ['worker' => $Worker[0]->id, 'doc' => $it->id ]) }}" class="button">Редактирование</a> |
414 | </div> | 414 | </div> |
415 | </div> | 415 | </div> |
416 | @php $i++ @endphp | 416 | @php $i++ @endphp |
417 | @endforeach | 417 | @endforeach |
418 | @else | 418 | @else |
419 | <div style="margin-bottom: 20px" class="cabinet__body-item"> | 419 | <div style="margin-bottom: 20px" class="cabinet__body-item"> |
420 | <h3 class="cabinet__subtitle">Сертификаты / документы</h3> | 420 | <h3 class="cabinet__subtitle">Сертификаты / документы</h3> |
421 | Нет сертификатов | 421 | Нет сертификатов |
422 | </div> | 422 | </div> |
423 | @endif | 423 | @endif |
424 | </div> | 424 | </div> |
425 | 425 | ||
426 | <div class="cabinet__body-item"> | 426 | <div class="cabinet__body-item"> |
427 | <a class="button button_light" href="{{ route('worker.new_sertificate',['worker' => $Worker[0]->id]) }}" id="button_new_doc" name="button_new_doc"> | 427 | <a class="button button_light" href="{{ route('worker.new_sertificate',['worker' => $Worker[0]->id]) }}" id="button_new_doc" name="button_new_doc"> |
428 | Добавить сертификат | 428 | Добавить сертификат |
429 | </a> | 429 | </a> |
430 | </div> | 430 | </div> |
431 | 431 | ||
432 | <div class="cabinet__body-item" name="ajax_dop_diplomi" id="ajax_dop_diplomi"> | 432 | <div class="cabinet__body-item" name="ajax_dop_diplomi" id="ajax_dop_diplomi"> |
433 | <h4 class="cabinet__h4">Дополнительная информация</h4> | 433 | <h4 class="cabinet__h4">Дополнительная информация</h4> |
434 | <div class="cabinet__inputs" id="block_sertificate"> | 434 | <div class="cabinet__inputs" id="block_sertificate"> |
435 | @if ($Infobloks->count()) | 435 | @if ($Infobloks->count()) |
436 | @foreach ($Infobloks as $doc) | 436 | @foreach ($Infobloks as $doc) |
437 | <div class="cabinet__inputs-item form-group"> | 437 | <div class="cabinet__inputs-item form-group"> |
438 | <label class="form-group__label">{{ $doc->name }}</label> | 438 | <label class="form-group__label">{{ $doc->name }}</label> |
439 | <div class="form-group__item"> | 439 | <div class="form-group__item"> |
440 | <div class="select"> | 440 | <div class="select"> |
441 | @php $Selected = 0; @endphp | 441 | @php $Selected = 0; @endphp |
442 | @if ($Worker[0]->infobloks->count()) | 442 | @if ($Worker[0]->infobloks->count()) |
443 | @foreach ($Worker[0]->dop_info as $info) | 443 | @foreach ($Worker[0]->dop_info as $info) |
444 | @if ($info->infoblok_id == $doc->id) | 444 | @if ($info->infoblok_id == $doc->id) |
445 | @php $Selected = $info->status; @endphp | 445 | @php $Selected = $info->status; @endphp |
446 | @endif | 446 | @endif |
447 | @endforeach | 447 | @endforeach |
448 | @endif | 448 | @endif |
449 | <select data-info="{{ $doc->id }}" class="js-select2 sertificates_js"> | 449 | <select data-info="{{ $doc->id }}" class="js-select2 sertificates_js"> |
450 | <option value="0" @if ($Selected == 0) selected @endif>Не указано</option> | 450 | <option value="0" @if ($Selected == 0) selected @endif>Не указано</option> |
451 | <option value="1" @if ($Selected == 1) selected @endif>В наличии</option> | 451 | <option value="1" @if ($Selected == 1) selected @endif>В наличии</option> |
452 | <option value="2" @if ($Selected == 2) selected @endif>Отсутствует</option> | 452 | <option value="2" @if ($Selected == 2) selected @endif>Отсутствует</option> |
453 | </select> | 453 | </select> |
454 | </div> | 454 | </div> |
455 | </div> | 455 | </div> |
456 | </div> | 456 | </div> |
457 | @endforeach | 457 | @endforeach |
458 | @endif | 458 | @endif |
459 | <!--_if (isset($Worker[0]->infobloks)) | 459 | <!--_if (isset($Worker[0]->infobloks)) |
460 | _php dd($Worker[0]->infobloks) _endphp | 460 | _php dd($Worker[0]->infobloks) _endphp |
461 | _if ($Worker[0]->infobloks->count()) | 461 | _if ($Worker[0]->infobloks->count()) |
462 | _php $i = 1; _endphp | 462 | _php $i = 1; _endphp |
463 | _foreach ($Worker[0]->infobloks as $info) | 463 | _foreach ($Worker[0]->infobloks as $info) |
464 | <div class="cabinet__inputs-item form-group"> | 464 | <div class="cabinet__inputs-item form-group"> |
465 | <label class="form-group__label"> $info->name }}</label> | 465 | <label class="form-group__label"> $info->name }}</label> |
466 | <div class="form-group__item"> | 466 | <div class="form-group__item"> |
467 | <div class="select"> | 467 | <div class="select"> |
468 | <select data-info=" $info->id }}" class="js-select2 sertificates_js"> | 468 | <select data-info=" $info->id }}" class="js-select2 sertificates_js"> |
469 | <option value="0">Нет</option> | 469 | <option value="0">Нет</option> |
470 | <option value="1" selected>Да</option> | 470 | <option value="1" selected>Да</option> |
471 | </select> | 471 | </select> |
472 | </div> | 472 | </div> |
473 | </div> | 473 | </div> |
474 | </div> | 474 | </div> |
475 | _php $i++; _endphp | 475 | _php $i++; _endphp |
476 | _endforeach | 476 | _endforeach |
477 | _endif | 477 | _endif |
478 | _endif | 478 | _endif |
479 | --> | 479 | --> |
480 | 480 | ||
481 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 481 | <!--<div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
482 | <label class="form-group__label">Образцы дипломов и документов</label> | 482 | <label class="form-group__label">Образцы дипломов и документов</label> |
483 | <div class="form-group__item"> | 483 | <div class="form-group__item"> |
484 | <div class="select"> | 484 | <div class="select"> |
485 | <select class="js-select2" id="documents" name="documents"> | 485 | <select class="js-select2" id="documents" name="documents"> |
486 | _if ($Infoblocks->count()) | 486 | _if ($Infoblocks->count()) |
487 | _foreach ($Infoblocks as $it) | 487 | _foreach ($Infoblocks as $it) |
488 | <option value="_$it->id }}">_$it->name }}</option> | 488 | <option value="_$it->id }}">_$it->name }}</option> |
489 | _endforeach | 489 | _endforeach |
490 | _endif | 490 | _endif |
491 | </select> | 491 | </select> |
492 | </div> | 492 | </div> |
493 | </div> | 493 | </div> |
494 | </div>--> | 494 | </div>--> |
495 | </div> | 495 | </div> |
496 | <!--<a href=" route('worker.add_diplom', ['worker' => $Worker[0]->id]) }}" name="btn_new_diplom" data-val="{{ $Worker[0]->id }}" id="btn_new_diplom" class="button button_light"> | 496 | <!--<a href=" route('worker.add_diplom', ['worker' => $Worker[0]->id]) }}" name="btn_new_diplom" data-val="{{ $Worker[0]->id }}" id="btn_new_diplom" class="button button_light"> |
497 | Добавить документ | 497 | Добавить документ |
498 | </a>--> | 498 | </a>--> |
499 | </div> | 499 | </div> |
500 | <div class="cabinet__body-item"> | 500 | <div class="cabinet__body-item"> |
501 | <div class="cabinet__works"> | 501 | <div class="cabinet__works"> |
502 | @if (isset($Worker[0]->place_worker)) | 502 | @if (isset($Worker[0]->place_worker)) |
503 | @php $i = 1; @endphp | 503 | @php $i = 1; @endphp |
504 | @foreach($Worker[0]->place_worker as $company) | 504 | @foreach($Worker[0]->place_worker as $company) |
505 | <div class="cabinet__works-item"> | 505 | <div class="cabinet__works-item"> |
506 | <div class="cabinet__works-spoiler active"> | 506 | <div class="cabinet__works-spoiler active"> |
507 | <div class="cabinet__works-spoiler-left"> | 507 | <div class="cabinet__works-spoiler-left"> |
508 | <div class="cabinet__works-spoiler-buttons"> | 508 | <div class="cabinet__works-spoiler-buttons"> |
509 | <a href="{{ route('worker.delete_document', ['doc' => $company->id]) }}" class="button button_light js-works-remove"> | 509 | <a href="{{ route('worker.delete_document', ['doc' => $company->id]) }}" class="button button_light js-works-remove"> |
510 | <svg> | 510 | <svg> |
511 | <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> | 511 | <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> |
512 | </svg> | 512 | </svg> |
513 | </a> | 513 | </a> |
514 | <a href="{{ route('worker.edit_document', ['doc' => $company->id, 'worker' => $Worker[0]->id]) }}" type="button" class="button button_light js-works-edit"> | 514 | <a href="{{ route('worker.edit_document', ['doc' => $company->id, 'worker' => $Worker[0]->id]) }}" type="button" class="button button_light js-works-edit"> |
515 | <svg> | 515 | <svg> |
516 | <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use> | 516 | <use xlink:href="{{ asset('images/sprite.svg#pencil') }}"></use> |
517 | </svg> | 517 | </svg> |
518 | </a> | 518 | </a> |
519 | </div> | 519 | </div> |
520 | <div class="cabinet__works-spoiler-text">Место работы {{ $i }}</div> | 520 | <div class="cabinet__works-spoiler-text">Место работы {{ $i }}</div> |
521 | </div> | 521 | </div> |
522 | <button type="button" class="cabinet__works-spoiler-right js-parent-toggle"> | 522 | <button type="button" class="cabinet__works-spoiler-right js-parent-toggle"> |
523 | <svg> | 523 | <svg> |
524 | <use xlink:href="{{ asset('images/sprite.svg#arrow-bold') }}"></use> | 524 | <use xlink:href="{{ asset('images/sprite.svg#arrow-bold') }}"></use> |
525 | </svg> | 525 | </svg> |
526 | </button> | 526 | </button> |
527 | </div> | 527 | </div> |
528 | <div class="cabinet__works-body"> | 528 | <div class="cabinet__works-body"> |
529 | <div class="cabinet__inputs"> | 529 | <div class="cabinet__inputs"> |
530 | <div class="cabinet__inputs-item form-group"> | 530 | <div class="cabinet__inputs-item form-group"> |
531 | <label class="form-group__label">Должность</label> | 531 | <label class="form-group__label">Должность</label> |
532 | <div class="form-group__item"> | 532 | <div class="form-group__item"> |
533 | <input type="text" class="input" value="{{ $company->job_title }}" disabled> | 533 | <input type="text" class="input" value="{{ $company->job_title }}" disabled> |
534 | </div> | 534 | </div> |
535 | </div> | 535 | </div> |
536 | <!--<div class="cabinet__inputs-item form-group"> | 536 | <!--<div class="cabinet__inputs-item form-group"> |
537 | <label class="form-group__label">Опыт работы в танкерном флоте</label> | 537 | <label class="form-group__label">Опыт работы в танкерном флоте</label> |
538 | <div class="form-group__item"> | 538 | <div class="form-group__item"> |
539 | <input type="text" class="input" value="@if ($company->tanker) Есть @else Нет @endif"> | 539 | <input type="text" class="input" value="@if ($company->tanker) Есть @else Нет @endif"> |
540 | </div> | 540 | </div> |
541 | </div>--> | 541 | </div>--> |
542 | <div class="cabinet__inputs-item form-group"> | 542 | <div class="cabinet__inputs-item form-group"> |
543 | <label class="form-group__label">Название т/х</label> | 543 | <label class="form-group__label">Название т/х</label> |
544 | <div class="form-group__item"> | 544 | <div class="form-group__item"> |
545 | <input type="text" class="input" value="{{ $company->teplohod }}" disabled> | 545 | <input type="text" class="input" value="{{ $company->teplohod }}" disabled> |
546 | </div> | 546 | </div> |
547 | </div> | 547 | </div> |
548 | <div class="cabinet__inputs-item form-group"> | 548 | <div class="cabinet__inputs-item form-group"> |
549 | <label class="form-group__label">Тип суда (GWT)</label> | 549 | <label class="form-group__label">Тип суда (GWT)</label> |
550 | <div class="form-group__item"> | 550 | <div class="form-group__item"> |
551 | <input type="text" class="input" value="{{ $company->GWT }}" disabled> | 551 | <input type="text" class="input" value="{{ $company->GWT }}" disabled> |
552 | </div> | 552 | </div> |
553 | </div> | 553 | </div> |
554 | <div class="cabinet__inputs-item form-group"> | 554 | <div class="cabinet__inputs-item form-group"> |
555 | <label class="form-group__label">Марка ГД</label> | 555 | <label class="form-group__label">Марка ГД</label> |
556 | <div class="form-group__item"> | 556 | <div class="form-group__item"> |
557 | <input type="text" class="input" value="{{ $company->Marka_GD }}" disabled> | 557 | <input type="text" class="input" value="{{ $company->Marka_GD }}" disabled> |
558 | </div> | 558 | </div> |
559 | </div> | 559 | </div> |
560 | <div class="cabinet__inputs-item form-group"> | 560 | <div class="cabinet__inputs-item form-group"> |
561 | <label class="form-group__label">Мощность ГД (кВТ)</label> | 561 | <label class="form-group__label">Мощность ГД (кВТ)</label> |
562 | <div class="form-group__item"> | 562 | <div class="form-group__item"> |
563 | <input type="text" class="input" value="{{ $company->KBT }}" disabled> | 563 | <input type="text" class="input" value="{{ $company->KBT }}" disabled> |
564 | </div> | 564 | </div> |
565 | </div> | 565 | </div> |
566 | <div class="cabinet__inputs-item form-group"> | 566 | <div class="cabinet__inputs-item form-group"> |
567 | <label class="form-group__label">Водоизмещение (GRT)</label> | 567 | <label class="form-group__label">Водоизмещение (GRT)</label> |
568 | <div class="form-group__item"> | 568 | <div class="form-group__item"> |
569 | <input type="text" class="input" value="{{ $company->GRT }}" disabled> | 569 | <input type="text" class="input" value="{{ $company->GRT }}" disabled> |
570 | </div> | 570 | </div> |
571 | </div> | 571 | </div> |
572 | <div class="cabinet__inputs-item form-group"> | 572 | <div class="cabinet__inputs-item form-group"> |
573 | <label class="form-group__label">Название компании</label> | 573 | <label class="form-group__label">Название компании</label> |
574 | <div class="form-group__item"> | 574 | <div class="form-group__item"> |
575 | <input type="text" class="input" value="{{ $company->name_company }}" disabled> | 575 | <input type="text" class="input" value="{{ $company->name_company }}" disabled> |
576 | </div> | 576 | </div> |
577 | </div> | 577 | </div> |
578 | <div class="cabinet__inputs-item form-group"> | 578 | <div class="cabinet__inputs-item form-group"> |
579 | <label class="form-group__label">Начало контракта</label> | 579 | <label class="form-group__label">Начало контракта</label> |
580 | <div class="form-group__item"> | 580 | <div class="form-group__item"> |
581 | <input type="text" class="input" value="{{ $company->begin_work }}" disabled> | 581 | <input type="text" class="input" value="{{ $company->begin_work }}" disabled> |
582 | </div> | 582 | </div> |
583 | </div> | 583 | </div> |
584 | <div class="cabinet__inputs-item form-group"> | 584 | <div class="cabinet__inputs-item form-group"> |
585 | <label class="form-group__label">Окончание контракта</label> | 585 | <label class="form-group__label">Окончание контракта</label> |
586 | <div class="form-group__item"> | 586 | <div class="form-group__item"> |
587 | <input type="text" class="input" value="{{ $company->end_work }}" disabled> | 587 | <input type="text" class="input" value="{{ $company->end_work }}" disabled> |
588 | </div> | 588 | </div> |
589 | </div> | 589 | </div> |
590 | 590 | ||
591 | </div> | 591 | </div> |
592 | </div> | 592 | </div> |
593 | </div> | 593 | </div> |
594 | @php $i++ @endphp | 594 | @php $i++ @endphp |
595 | @endforeach | 595 | @endforeach |
596 | @endif | 596 | @endif |
597 | </div> | 597 | </div> |
598 | 598 | ||
599 | </div> | 599 | </div> |
600 | 600 | ||
601 | <a href="{{ route('worker.add_document', ['worker' => $Worker[0]->id]) }}" id="new_work" name="new_work" class="button button_light cabinet__works-add" style="width:100%; max-width:none;">Новое место работы</a> | 601 | <a href="{{ route('worker.add_document', ['worker' => $Worker[0]->id]) }}" id="new_work" name="new_work" class="button button_light cabinet__works-add" style="width:100%; max-width:none;">Новое место работы</a> |
602 | 602 | ||
603 | <div id="prev_worker" name="prev_worker"> | 603 | <div id="prev_worker" name="prev_worker"> |
604 | @if ((isset($Worker[0]->prev_company)) && ($Worker[0]->prev_company->count() > 0)) | 604 | @if ((isset($Worker[0]->prev_company)) && ($Worker[0]->prev_company->count() > 0)) |
605 | @php $i = 0; @endphp | 605 | @php $i = 0; @endphp |
606 | @foreach($Worker[0]->prev_company as $it) | 606 | @foreach($Worker[0]->prev_company as $it) |
607 | <div style="margin-bottom: 20px" class="cabinet__body-item"> | 607 | <div style="margin-bottom: 20px" class="cabinet__body-item"> |
608 | @if ($i == 0) | 608 | @if ($i == 0) |
609 | <h3 class="cabinet__subtitle">Контакты предыдущих компаний</h3> | 609 | <h3 class="cabinet__subtitle">Контакты предыдущих компаний</h3> |
610 | @endif | 610 | @endif |
611 | <h4 class="cabinet__h4">Компания {{ $i+1 }}</h4> | 611 | <h4 class="cabinet__h4">Компания {{ $i+1 }}</h4> |
612 | <div class="cabinet__inputs"> | 612 | <div class="cabinet__inputs"> |
613 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 613 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
614 | <label class="form-group__label">Название компании</label> | 614 | <label class="form-group__label">Название компании</label> |
615 | <div class="form-group__item"> | 615 | <div class="form-group__item"> |
616 | <input type="text" class="input" value="{{ $it->name_company }}" > | 616 | <input type="text" class="input" value="{{ $it->name_company }}" > |
617 | </div> | 617 | </div> |
618 | </div> | 618 | </div> |
619 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 619 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
620 | <label class="form-group__label">ФИО сотрудника</label> | 620 | <label class="form-group__label">ФИО сотрудника</label> |
621 | <div class="form-group__item"> | 621 | <div class="form-group__item"> |
622 | <input type="text" class="input" value="{{ $it->direct }}" > | 622 | <input type="text" class="input" value="{{ $it->direct }}" > |
623 | </div> | 623 | </div> |
624 | </div> | 624 | </div> |
625 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 625 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
626 | <label class="form-group__label">Должность сотрудника</label> | 626 | <label class="form-group__label">Должность сотрудника</label> |
627 | <div class="form-group__item"> | 627 | <div class="form-group__item"> |
628 | <input type="text" class="input" value="{{ $it->telephone }}" > | 628 | <input type="text" class="input" value="{{ $it->telephone }}" > |
629 | </div> | 629 | </div> |
630 | </div> | 630 | </div> |
631 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> | 631 | <div class="cabinet__inputs-item cabinet__inputs-item_fullwidth form-group"> |
632 | <label class="form-group__label">Телефон сотрудника</label> | 632 | <label class="form-group__label">Телефон сотрудника</label> |
633 | <div class="form-group__item"> | 633 | <div class="form-group__item"> |
634 | <input type="text" class="input" value="{{ $it->telephone2 }}" > | 634 | <input type="text" class="input" value="{{ $it->telephone2 }}" > |
635 | </div> | 635 | </div> |
636 | </div> | 636 | </div> |
637 | <a href="{{ route('worker.delete_prev_company', ['doc' => $it->id]) }}" class="button button_light"> | 637 | <a href="{{ route('worker.delete_prev_company', ['doc' => $it->id]) }}" class="button button_light"> |
638 | <svg> | 638 | <svg> |
639 | <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> | 639 | <use xlink:href="{{ asset('images/sprite.svg#del') }}"></use> |
640 | </svg> | 640 | </svg> |
641 | Удалить | 641 | Удалить |
642 | </a> | 642 | </a> |
643 | <a href="{{ route('worker.edit_prev_company', ['worker' => $Worker[0]->id, 'doc' => $it->id ]) }}" class="button">Редактирование</a> | 643 | <a href="{{ route('worker.edit_prev_company', ['worker' => $Worker[0]->id, 'doc' => $it->id ]) }}" class="button">Редактирование</a> |
644 | </div> | 644 | </div> |
645 | </div> | 645 | </div> |
646 | @php $i++ @endphp | 646 | @php $i++ @endphp |
647 | @endforeach | 647 | @endforeach |
648 | @else | 648 | @else |
649 | <div style="margin-bottom: 20px" class="cabinet__body-item"> | 649 | <div style="margin-bottom: 20px" class="cabinet__body-item"> |
650 | <h3 class="cabinet__subtitle">Предыдущие компании</h3> | 650 | <h3 class="cabinet__subtitle">Предыдущие компании</h3> |
651 | Нет предыдущих компаний | 651 | Нет предыдущих компаний |
652 | </div> | 652 | </div> |
653 | @endif | 653 | @endif |
654 | </div> | 654 | </div> |
655 | 655 | ||
656 | <div class="cabinet__body-item"> | 656 | <div class="cabinet__body-item"> |
657 | <a class="button button_light" href="{{ route('worker.new_prev_company',['worker' => $Worker[0]->id]) }}" id="button_new_doc" name="button_new_doc"> | 657 | <a class="button button_light" href="{{ route('worker.new_prev_company',['worker' => $Worker[0]->id]) }}" id="button_new_doc" name="button_new_doc"> |
658 | Добавить официльную контактную информацию | 658 | Добавить официльную контактную информацию |
659 | </a> | 659 | </a> |
660 | </div> | 660 | </div> |
661 | 661 | ||
662 | </form> | 662 | </form> |
663 | </div> | 663 | </div> |
664 | </div> | 664 | </div> |
665 | </section> | 665 | </section> |
666 | </div> | 666 | </div> |
667 | <div> | 667 | <div> |
668 | @endsection | 668 | @endsection |
669 | 669 |
resources/views/workers/messages.blade.php
1 | @extends('layout.frontend', ['title' => 'Мои сообщения - РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Мои сообщения - РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | 4 | ||
5 | @endsection | 5 | @endsection |
6 | 6 | ||
7 | @section('content') | 7 | @section('content') |
8 | <section class="cabinet"> | 8 | <section class="cabinet"> |
9 | <div class="container"> | 9 | <div class="container"> |
10 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 10 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
11 | <li><a href="{{ route('index') }}">Главная</a></li> | 11 | <li><a href="{{ route('index') }}">Главная</a></li> |
12 | <li><b>Личный кабинет</b></li> | 12 | <li><b>Личный кабинет</b></li> |
13 | </ul> | 13 | </ul> |
14 | <div class="cabinet__wrapper"> | 14 | <div class="cabinet__wrapper"> |
15 | <div class="cabinet__side"> | 15 | <div class="cabinet__side"> |
16 | <div class="cabinet__side-toper"> | 16 | <div class="cabinet__side-toper"> |
17 | @include('workers.emblema') | 17 | @include('workers.emblema') |
18 | 18 | ||
19 | </div> | 19 | </div> |
20 | 20 | ||
21 | @include('workers.menu', ['item' => 2]) | 21 | @include('workers.menu', ['item' => 2]) |
22 | </div> | 22 | </div> |
23 | <div class="cabinet__body"> | 23 | <div class="cabinet__body"> |
24 | <div class="cabinet__body-item"> | 24 | <div class="cabinet__body-item"> |
25 | <h2 class="title cabinet__title">Сообщения</h2> | 25 | <h2 class="title cabinet__title">Сообщения</h2> |
26 | </div> | 26 | </div> |
27 | <div class="cabinet__body-item"> | 27 | <div class="cabinet__body-item"> |
28 | <div class="cabinet__filters"> | 28 | <div class="cabinet__filters"> |
29 | <div class="cabinet__filters-item"> | 29 | <div class="cabinet__filters-item"> |
30 | <div class="cabinet__filters-buttons"> | 30 | <div class="cabinet__filters-buttons"> |
31 | <a href="{{ route('worker.messages', ['type_message' => 'input']) }}" class="button button_light @if ($type_message == 'input') active @endif">Входящие ({{ $count_input }})</a> | 31 | <a href="{{ route('worker.messages', ['type_message' => 'input']) }}" class="button button_light @if ($type_message == 'input') active @endif">Входящие ({{ $count_input }})</a> |
32 | <a href="{{ route('worker.messages', ['type_message' => 'output']) }}" class="button button_light @if ($type_message == 'output') active @endif">Исходящие ({{ $count_output }})</a> | 32 | <a href="{{ route('worker.messages', ['type_message' => 'output']) }}" class="button button_light @if ($type_message == 'output') active @endif">Исходящие ({{ $count_output }})</a> |
33 | </div> | 33 | </div> |
34 | </div> | 34 | </div> |
35 | <!--<div class="cabinet__filters-item"> | 35 | <!--<div class="cabinet__filters-item"> |
36 | <div class="select"> | 36 | <div class="select"> |
37 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> | 37 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> |
38 | <option value="default">Сортировка (по умолчанию)</option> | 38 | <option value="default">Сортировка (по умолчанию)</option> |
39 | <option value="name (asc)">По имени (возрастание)</option> | 39 | <option value="name (asc)">По имени (возрастание)</option> |
40 | <option value="name (desc)">По имени (убывание)</option> | 40 | <option value="name (desc)">По имени (убывание)</option> |
41 | <option value="created_at (asc)">По дате (возрастание)</option> | 41 | <option value="created_at (asc)">По дате (возрастание)</option> |
42 | <option value="created_at (desc)">По дате (убывание)</option> | 42 | <option value="created_at (desc)">По дате (убывание)</option> |
43 | </select> | 43 | </select> |
44 | </div> | 44 | </div> |
45 | </div>--> | 45 | </div>--> |
46 | </div> | 46 | </div> |
47 | 47 | ||
48 | @if ($messages->count()) | 48 | @if ($messages->count()) |
49 | @foreach($messages as $it) | 49 | @foreach($messages as $it) |
50 | <div class="messages__item"> | 50 | <div class="messages__item"> |
51 | <div class="messages__item-info"> | 51 | <div class="messages__item-info"> |
52 | <div class="messages__item-photo"> | 52 | <div class="messages__item-photo"> |
53 | <svg> | 53 | <svg> |
54 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> | 54 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> |
55 | </svg> | 55 | </svg> |
56 | 56 | ||
57 | @if ($type_message == 'input') | 57 | @if ($type_message == 'input') |
58 | @if ($it->user_to->is_worker) | 58 | @if ($it->user_to->is_worker) |
59 | @if (isset($it->user_to->workers->phote)) | 59 | @if (isset($it->user_to->workers->phote)) |
60 | <img src="{{ asset(Storage::url($it->user_to->workers->phote)) }}" alt=""> | 60 | <img src="{{ asset(Storage::url($it->user_to->workers->phote)) }}" alt=""> |
61 | @else | 61 | @else |
62 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 62 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
63 | @endif | 63 | @endif |
64 | @else | 64 | @else |
65 | @if (isset($it->user_to->employers->logo)) | 65 | @if (isset($it->user_to->employers->logo)) |
66 | <img src="{{ asset(Storage::url($it->user_to->employers->logo)) }}" alt=""> | 66 | <img src="{{ asset(Storage::url($it->user_to->employers->logo)) }}" alt=""> |
67 | @else | 67 | @else |
68 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 68 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
69 | @endif | 69 | @endif |
70 | @endif | 70 | @endif |
71 | @endif | 71 | @endif |
72 | 72 | ||
73 | @if ($type_message == 'output') | 73 | @if ($type_message == 'output') |
74 | @if ($it->user_from->is_worker) | 74 | @if ($it->user_from->is_worker) |
75 | @if (isset($it->user_from->workers->phote)) | 75 | @if (isset($it->user_from->workers->phote)) |
76 | <img src="{{ asset(Storage::url($it->user_from->workers->phote)) }}" alt=""> | 76 | <img src="{{ asset(Storage::url($it->user_from->workers->phote)) }}" alt=""> |
77 | @else | 77 | @else |
78 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 78 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
79 | @endif | 79 | @endif |
80 | @else | 80 | @else |
81 | @if (isset($it->user_from->employers->logo)) | 81 | @if (isset($it->user_from->employers->logo)) |
82 | <img src="{{ asset(Storage::url($it->user_from->employers->logo)) }}" alt=""> | 82 | <img src="{{ asset(Storage::url($it->user_from->employers->logo)) }}" alt=""> |
83 | @else | 83 | @else |
84 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 84 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
85 | @endif | 85 | @endif |
86 | @endif | 86 | @endif |
87 | @endif | 87 | @endif |
88 | </div> | 88 | </div> |
89 | <div class="messages__item-text"> | 89 | <div class="messages__item-text"> |
90 | <div> | 90 | <div> |
91 | От: @if (isset($it->user_from)) | 91 | От: @if (isset($it->user_from)) |
92 | @if ($it->user_from->id !== $user_id) | 92 | @if ($it->user_from->id !== $user_id) |
93 | <a href="{{ route('worker.dialog', ['user1' => $user_id, 'user2' => $it->user_from->id]) }}" style="text-decoration: underline"> | 93 | <a href="{{ route('worker.dialog', ['user1' => $user_id, 'user2' => $it->user_from->id]) }}" style="text-decoration: underline"> |
94 | {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }} | 94 | {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }} |
95 | </a> | 95 | </a> |
96 | @else | 96 | @else |
97 | {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }} | 97 | {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }} |
98 | @endif | 98 | @endif |
99 | @else | 99 | @else |
100 | Удаленный пользователь | 100 | Удаленный пользователь |
101 | @endif | 101 | @endif |
102 | <br> | 102 | <br> |
103 | К: @if (isset($it->user_to)) | 103 | К: @if (isset($it->user_to)) |
104 | @if ($it->user_to->id !== $user_id) | 104 | @if ($it->user_to->id !== $user_id) |
105 | <a href="{{ route('worker.dialog', ['user1' => $user_id, 'user2' => $it->user_to->id]) }}" style="text-decoration: underline"> | 105 | <a href="{{ route('worker.dialog', ['user1' => $user_id, 'user2' => $it->user_to->id]) }}" style="text-decoration: underline"> |
106 | {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }} | 106 | {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }} |
107 | </a> | 107 | </a> |
108 | @else | 108 | @else |
109 | {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }} | 109 | {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }} |
110 | @endif | 110 | @endif |
111 | @else | 111 | @else |
112 | Удаленный пользователь | 112 | Удаленный пользователь |
113 | @endif | 113 | @endif |
114 | </div> | 114 | </div> |
115 | <div><span>Вакансия:</span>@if (isset($it->vacancies[0])) {{ $it->vacancies[0]->name." (".($it->vacancies[0]->id).")" }} @else Удалена @endif</div> | 115 | <div><span>Вакансия:</span>@if (isset($it->vacancies)) {{ $it->vacancies->name." (".($it->vacancies->id).")" }} @else Удалена @endif</div> |
116 | <div><span>Текст:</span>{{ $it->text }}</div> | 116 | <div><span>Текст:</span>{{ $it->text }}</div> |
117 | </div> | 117 | </div> |
118 | </div> | 118 | </div> |
119 | <div class="messages__item-date">{{ $it->created_at }}</div> | 119 | <div class="messages__item-date">{{ $it->created_at }}</div> |
120 | </div> | 120 | </div> |
121 | @endforeach | 121 | @endforeach |
122 | 122 | ||
123 | <div style="margin-top: 20px"> | 123 | <div style="margin-top: 20px"> |
124 | {{ $messages->onEachSide(0)->appends($_GET)->links('paginate') }} | 124 | {{ $messages->onEachSide(0)->appends($_GET)->links('paginate') }} |
125 | </div><!-- конец --> | 125 | </div><!-- конец --> |
126 | 126 | ||
127 | @else | 127 | @else |
128 | <div class="notify"> | 128 | <div class="notify"> |
129 | <svg> | 129 | <svg> |
130 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> | 130 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> |
131 | </svg> | 131 | </svg> |
132 | <span>Сообщений не найдено</span> | 132 | <span>Сообщений не найдено</span> |
133 | </div> | 133 | </div> |
134 | @endif | 134 | @endif |
135 | </div> | 135 | </div> |
136 | </div> | 136 | </div> |
137 | </div> | 137 | </div> |
138 | </div> | 138 | </div> |
139 | </section> | 139 | </section> |
140 | </div> | 140 | </div> |
141 | <div> | 141 | <div> |
142 | @endsection | 142 | @endsection |
143 | 143 |