Commit ac606bc382b783237712bdcd3ac407a9c6caf2c6
1 parent
a2e1d104eb
Exists in
master
Работа на сервере.
Showing 17 changed files with 326 additions and 135 deletions Side-by-side Diff
- app/Classes/Cookies_vacancy.php
- app/Classes/RusDate.php
- app/Http/Controllers/EmployerController.php
- app/Http/Controllers/MainController.php
- app/Http/Controllers/WorkerController.php
- resources/views/ajax/list_vacancies.blade.php
- resources/views/block_real.blade.php
- resources/views/js/favorite-vacancy-1.blade.php
- resources/views/js/favorite-vacancy.blade.php
- resources/views/layout/frontend.blade.php
- resources/views/list_vacancies.blade.php
- resources/views/modals/send_employer.blade.php
- resources/views/modals/send_employer_new.blade.php
- resources/views/resume.blade.php
- resources/views/vacance-item.blade.php
- resources/views/workers/favorite.blade.php
- routes/web.php
app/Classes/Cookies_vacancy.php
... | ... | @@ -9,10 +9,10 @@ use DateTime; |
9 | 9 | class Cookies_vacancy |
10 | 10 | { |
11 | 11 | public static function selected_vacancy($item) { |
12 | - if (empty($_COOKIE['favorite_vacancy'])) | |
12 | + if (empty($_COOKIE['favorit_vacancy'])) | |
13 | 13 | return ""; |
14 | 14 | else { |
15 | - $Str = json_decode($_COOKIE['favorite_vacancy'], true); | |
15 | + $Str = json_decode($_COOKIE['favorit_vacancy'], true); | |
16 | 16 | //$Arr = explode(",", $Str); |
17 | 17 | if (in_array($item, $Str)) |
18 | 18 | return " active "; |
... | ... | @@ -23,11 +23,11 @@ class Cookies_vacancy |
23 | 23 | |
24 | 24 | // Вывод избранных вакансий |
25 | 25 | public static function count_vacancy_fav() { |
26 | - if (empty($_COOKIE['favorite_vacancy'])) | |
26 | + if (empty($_COOKIE['favorit_vacancy'])) | |
27 | 27 | return 0; |
28 | 28 | else { |
29 | 29 | |
30 | - $Arr = json_decode($_COOKIE['favorite_vacancy'], true); | |
30 | + $Arr = json_decode($_COOKIE['favorit_vacancy'], true); | |
31 | 31 | |
32 | 32 | |
33 | 33 | return count($Arr); |
... | ... | @@ -36,8 +36,8 @@ class Cookies_vacancy |
36 | 36 | |
37 | 37 | // Удаление избранных вакансий |
38 | 38 | public static function clear_vacancy() { |
39 | - if (!empty($_COOKIE['favorite_vacancy'])) | |
40 | - unset($_COOKIE['favorite_vacancy']); | |
39 | + if (!empty($_COOKIE['favorit_vacancy'])) | |
40 | + unset($_COOKIE['favorit_vacancy']); | |
41 | 41 | } |
42 | 42 | |
43 | 43 | } |
app/Classes/RusDate.php
... | ... | @@ -61,10 +61,10 @@ class RusDate |
61 | 61 | } |
62 | 62 | // Избранные вакансии |
63 | 63 | public static function selected_vacancy($item) { |
64 | - if (empty($_COOKIE['favorite_vac'])) | |
64 | + if (empty($_COOKIE['favorit_vacancy'])) | |
65 | 65 | return ""; |
66 | 66 | else { |
67 | - $Str = json_decode($_COOKIE['favorite_vac'], true); | |
67 | + $Str = json_decode($_COOKIE['favorit_vacancy'], true); | |
68 | 68 | //$Arr = explode(",", $Str); |
69 | 69 | if (in_array($item, $Str)) |
70 | 70 | return " active "; |
... | ... | @@ -135,11 +135,11 @@ class RusDate |
135 | 135 | |
136 | 136 | // Вывод избранных вакансий |
137 | 137 | public static function count_vacancy_fav() { |
138 | - if (empty($_COOKIE['favorite_vac'])) | |
138 | + if (empty($_COOKIE['favorit_vacancy'])) | |
139 | 139 | return 0; |
140 | 140 | else { |
141 | 141 | |
142 | - $Arr = json_decode($_COOKIE['favorite_vac'], true); | |
142 | + $Arr = json_decode($_COOKIE['favorit_vacancy'], true); | |
143 | 143 | |
144 | 144 | |
145 | 145 | return count($Arr); |
... | ... | @@ -148,8 +148,8 @@ class RusDate |
148 | 148 | |
149 | 149 | // Удаление избранных вакансий |
150 | 150 | public static function clear_vacancy() { |
151 | - if (!empty($_COOKIE['favorite_vac'])) | |
152 | - unset($_COOKIE['favorite_vac']); | |
151 | + if (!empty($_COOKIE['favorit_vacancy'])) | |
152 | + unset($_COOKIE['favorit_vacancy']); | |
153 | 153 | } |
154 | 154 | |
155 | 155 | } |
app/Http/Controllers/EmployerController.php
... | ... | @@ -38,7 +38,6 @@ class EmployerController extends Controller |
38 | 38 | { |
39 | 39 | public function vacancie($vacancy, Request $request) { |
40 | 40 | $title = 'Заголовок вакансии'; |
41 | - | |
42 | 41 | $Query = Ad_employer::with('jobs')-> |
43 | 42 | with('cat')-> |
44 | 43 | with('employer')-> |
... | ... | @@ -46,12 +45,15 @@ class EmployerController extends Controller |
46 | 45 | select('ad_employers.*')-> |
47 | 46 | where('id', '=', $vacancy)->get(); |
48 | 47 | |
48 | + if (isset(Auth()->user()->id)) | |
49 | + $uid = Auth()->user()->id; | |
50 | + else | |
51 | + $uid = 0; | |
49 | 52 | $title = $Query[0]->name; |
50 | - | |
51 | 53 | if ($request->ajax()) { |
52 | - return view('ajax.vacance-item', compact('Query')); | |
54 | + return view('ajax.vacance-item', compact('Query','uid')); | |
53 | 55 | } else { |
54 | - return view('vacance-item', compact('title', 'Query')); | |
56 | + return view('vacance-item', compact('title', 'Query', 'uid')); | |
55 | 57 | } |
56 | 58 | } |
57 | 59 |
app/Http/Controllers/MainController.php
... | ... | @@ -117,23 +117,26 @@ class MainController extends Controller |
117 | 117 | with('cat')-> |
118 | 118 | with('employer')-> |
119 | 119 | whereHas('jobs_code', function ($query) use ($request) { |
120 | - if ($request->ajax()) { | |
121 | 120 | if (null !== ($request->get('job')) && ($request->get('job') !== 0)) { |
122 | 121 | $query->where('job_title_id', $request->get('job')); |
123 | 122 | } |
124 | - } | |
125 | 123 | }) |
126 | 124 | ->select('ad_employers.*'); |
127 | 125 | |
128 | 126 | |
129 | - | |
130 | - if ($categories->id > 0) { | |
127 | + if (isset($categories->id) && ($categories->id > 0)) { | |
131 | 128 | $Query = $Query->where('category_id', '=', $categories->id); |
132 | 129 | $Name_categori = Category::query()->where('id', '=', $categories->id)->get(); |
130 | + } else { | |
131 | + $Name_categori = ''; | |
133 | 132 | } |
134 | 133 | |
134 | + | |
135 | + | |
135 | 136 | if ($request->get('sort')) { |
136 | 137 | $sort = $request->get('sort'); |
138 | + | |
139 | + | |
137 | 140 | switch ($sort) { |
138 | 141 | case 'name_up': $Query = $Query->orderBy('name')->orderBy('id'); break; |
139 | 142 | case 'name_down': $Query = $Query->orderByDesc('name')->orderby('id'); break; |
app/Http/Controllers/WorkerController.php
... | ... | @@ -497,15 +497,15 @@ class WorkerController extends Controller |
497 | 497 | |
498 | 498 | // Борьба против колорадских жуков, хотя жуков победил все таки 45. |
499 | 499 | public function colorado(Request $request) { |
500 | - if (isset($_COOKIE['favorite_vac'])) { | |
500 | + if (isset($_COOKIE['favorit_vacancy'])) { | |
501 | 501 | $items = RusDate::count_vacancy_fav(); |
502 | - $it = $_COOKIE['favorite_vac']; | |
502 | + $it = $_COOKIE['favorit_vacancy']; | |
503 | 503 | $it = str_replace('"', "", $it); |
504 | 504 | $it = str_replace('[', "", $it); |
505 | 505 | $it = str_replace(']', "", $it); |
506 | 506 | $Arr = explode(",", $it); |
507 | 507 | } else { |
508 | - $Arr = Array(); | |
508 | + $Arr = Array('$0'); | |
509 | 509 | } |
510 | 510 | |
511 | 511 | $Query = Ad_employer::Query(); |
resources/views/ajax/list_vacancies.blade.php
1 | -@if ($Query->count()) | |
1 | +@php $i = ($Query->currentPage() * $Query->perPage() - $Query->count() - 1) @endphp | |
2 | + | |
2 | 3 | @foreach ($Query as $Q) |
3 | -<div class="main__vacancies-item main__employer-page-two-item"> | |
4 | - <a href="{{ route('list-vacancies', ['categories' => $categories->id]) }}" class="back main__employer-page-two-item-back"> | |
5 | - <svg> | |
6 | - <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use> | |
7 | - </svg> | |
8 | - <span> | |
9 | - Вернуться к списку вакансий | |
10 | - </span> | |
11 | - </a> | |
12 | - <div class="main__employer-page-two-item-toper"> | |
13 | - @if (isset($Q->employer)) | |
14 | - <img src="{{ asset(Storage::url($Q->employer->logo)) }}" alt="{{ $Q->employer->name }}"> | |
4 | + @foreach ($Reclama as $Rec) | |
5 | + @if ($Rec->position == $i) | |
6 | + <div class="main__vacancies-thing"> | |
7 | + @if (!empty($Rec->image)) | |
8 | + <img src="{{ asset(Storage::url($Rec->image)) }}" alt="{{ $Rec->title }}" class="main__vacancies-thing-pic"> | |
9 | + @else | |
10 | + <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $Rec->title }}" class="main__vacancies-thing-pic"> | |
11 | + @endif | |
12 | + <div class="main__vacancies-thing-body"> | |
13 | + <h2>{{ $Rec->title }}</h2> | |
14 | + <div class="main__vacancies-thing-scroll"> | |
15 | + {!! $Rec->text !!} | |
16 | + </div> | |
17 | + <a href="{{ $Rec->link }}" class="button">Узнать больше</a> | |
18 | + </div> | |
19 | + </div> | |
15 | 20 | @endif |
16 | - <span>@if (!empty($Q->name)) {{ $Q->name }} @endif</span> | |
17 | - </div> | |
18 | - <div class="main__employer-page-two-item-text"> | |
19 | - <div class="main__employer-page-two-item-text-name">Судоходная компания ведет набор | |
20 | - специалистов на следующие должности:</div> | |
21 | - <div class="main__employer-page-two-item-text-links"> | |
22 | - @if (isset($Q->jobs)) | |
23 | - @foreach ($Q->jobs as $key => $j) | |
24 | - <a>“{{ $j->name }}” – з/п от @if (isset($Q->jobs_code[$key]->min_salary)) {{ $Q->jobs_code[$key]->min_salary }} @endif - @if (isset($Q->jobs_code[$key]->max_salary)) {{ $Q->jobs_code[$key]->max_salary }} @endif рублей (на руки)</a> | |
25 | - @endforeach | |
21 | + @endforeach | |
22 | + <div class="main__vacancies-item main__employer-page-two-item"> | |
23 | + | |
24 | + <a href="{{ route('list-vacancies', ['categories' => $categories->id]) }}" class="back main__employer-page-two-item-back"> | |
25 | + <svg> | |
26 | + <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use> | |
27 | + </svg> | |
28 | + <span> | |
29 | + Вернуться к списку вакансий | |
30 | + </span> | |
31 | + </a> | |
32 | + | |
33 | + <div class="main__employer-page-two-item-toper"> | |
34 | + @if (!empty($Q->employer->logo)) | |
35 | + <img src="{{ asset(Storage::url($Q->employer->logo)) }}" alt="{{ $Q->employer->name }}"> | |
36 | + @else | |
37 | + <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $Rec->title }}" class="main__vacancies-thing-pic"> | |
26 | 38 | @endif |
39 | + <span>@if (!empty($Q->name)) {{ $Q->name }} @endif</span> | |
27 | 40 | </div> |
28 | - </div> | |
29 | - <div class="main__employer-page-two-item-text"> | |
30 | - <div class="main__employer-page-two-item-text-name">Мы предлагаем:</div> | |
31 | - <div class="main__employer-page-two-item-text-body"> | |
32 | - {!! $Q->text !!} | |
41 | + | |
42 | + <div class="main__employer-page-two-item-text"> | |
43 | + <div class="main__employer-page-two-item-text-name">Судоходная компания ведет набор | |
44 | + специалистов на следующие должности:</div> | |
45 | + <div class="main__employer-page-two-item-text-links"> | |
46 | + @if (isset($Q->jobs)) | |
47 | + @foreach ($Q->jobs as $key => $j) | |
48 | + <a>“{{ $j->name }}” – з/п от @if (isset($Q->jobs_code[$key]->min_salary)) {{ $Q->jobs_code[$key]->min_salary }} @endif - @if (isset($Q->jobs_code[$key]->max_salary)) {{ $Q->jobs_code[$key]->max_salary }} @endif рублей (на руки)</a> | |
49 | + @endforeach | |
50 | + @endif | |
51 | + </div> | |
33 | 52 | </div> |
34 | - </div> | |
35 | - <div class="main__employer-page-two-item-text"> | |
36 | - <div class="main__employer-page-two-item-text-name">Наши ожидания:</div> | |
37 | - <div class="main__employer-page-two-item-text-body"> | |
38 | - {!! $Q->description !!} | |
53 | + | |
54 | + <div class="main__employer-page-two-item-text"> | |
55 | + <div class="main__employer-page-two-item-text-name">Мы предлагаем:</div> | |
56 | + <div class="main__employer-page-two-item-text-body"> | |
57 | + {!! $Q->text !!} | |
58 | + </div> | |
39 | 59 | </div> |
40 | - </div> | |
41 | - <div class="main__employer-page-two-item-text"> | |
42 | - <div class="main__employer-page-two-item-text-name">Резюме направляйте на почту:</div> | |
43 | - <div class="main__employer-page-two-item-text-body"> | |
44 | - {!! $Q->contacts_emails !!} | |
60 | + <div class="main__employer-page-two-item-text"> | |
61 | + <div class="main__employer-page-two-item-text-name">Наши ожидания:</div> | |
62 | + <div class="main__employer-page-two-item-text-body"> | |
63 | + {!! $Q->description !!} | |
64 | + </div> | |
45 | 65 | </div> |
46 | - </div> | |
47 | - <div class="main__employer-page-two-item-text"> | |
48 | - <div class="main__employer-page-two-item-text-name">Или звоните:</div> | |
49 | - <div class="main__employer-page-two-item-text-body"> | |
50 | - {!! $Q->contacts_telephones !!} | |
66 | + <div class="main__employer-page-two-item-text"> | |
67 | + <div class="main__employer-page-two-item-text-name">Резюме направляйте на почту:</div> | |
68 | + <div class="main__employer-page-two-item-text-body"> | |
69 | + {!! $Q->contacts_emails !!} | |
70 | + </div> | |
71 | + </div> | |
72 | + <div class="main__employer-page-two-item-text"> | |
73 | + <div class="main__employer-page-two-item-text-name">Или звоните:</div> | |
74 | + <div class="main__employer-page-two-item-text-body"> | |
75 | + {!! $Q->contacts_telephones !!} | |
76 | + </div> | |
77 | + </div> | |
78 | + | |
79 | + <div class="main__employer-page-two-item-tags"> | |
80 | + @if (!empty($Q->jobs_code[0]->position_ship)) | |
81 | + <span class="main__employer-page-two-item-tag"> #{{ $Q->jobs_code[0]->position_ship }}</span> | |
82 | + @else | |
83 | + @if (isset($Q->jobs)) | |
84 | + @foreach ($Q->jobs as $key => $j) | |
85 | + <span class="main__employer-page-two-item-tag"> #{{ $j->name }}</span> | |
86 | + @endforeach | |
87 | + @endif | |
88 | + @endif | |
89 | + </div> | |
90 | + <div class="main__employer-page-two-item-buttons"> | |
91 | + @guest | |
92 | + <button type="button" data-fancybox data-src="#question" data-options='{"touch":false,"autoFocus":false}' | |
93 | + class="button main__employer-page-two-item-button">Откликнуться</button> | |
94 | + @else | |
95 | + @if (App\Classes\StatusUser::Status()==1) | |
96 | + <button type="button" data-fancybox data-src="#send" data-vacancy="{{ $Q->id }}" data-uid="{{ $uid }}" data-tuid="{{ $Q->employer->user_id }}" data-options='{"touch":false,"autoFocus":false}' | |
97 | + class="button main__employer-page-two-item-button js_send_it_button">Откликнуться</button> | |
98 | + @else | |
99 | + <button type="button" data-fancybox data-src="#send2" data-vacancy="{{ $Q->id }}" data-uid="{{ $uid }}" data-tuid="{{ $Q->employer->user_id }}" data-options='{"touch":false,"autoFocus":false}' | |
100 | + class="button main__employer-page-two-item-button js_send_it_button">Откликнуться</button> | |
101 | + @endif | |
102 | + @endguest | |
103 | + <a href="{{ route('vacancie', ['vacancy' => $Q->id]) }}" class="button button_light main__employer-page-two-item-button">Подробнее</a> | |
104 | + </div> | |
105 | + <div class="main__employer-page-two-item-bottom"> | |
106 | + <div class="main__employer-page-two-item-bottom-date">{{ date('d.m.Y H:i:s', strtotime($Q->created_at)) }}</div> | |
107 | + <button type="button" data-val="{{ $Q->id }}" class="like main__employer-page-two-item-bottom-like js-toggle js_vacancy_favorites <?=App\Classes\Cookies_vacancy::selected_vacancy($Q->id);?>"> | |
108 | + <svg> | |
109 | + <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> | |
110 | + </svg> | |
111 | + </button> | |
51 | 112 | </div> |
52 | 113 | </div> |
53 | - <div class="main__employer-page-two-item-tags"> | |
54 | - @if (isset($Q->jobs)) | |
55 | - @foreach ($Q->jobs as $key => $j) | |
56 | - <span class="main__employer-page-two-item-tag">#{{ $j->name }}</span> | |
57 | - @endforeach | |
58 | - @endif | |
59 | - </div> | |
60 | - <div class="main__employer-page-two-item-buttons"> | |
61 | - <button type="button" | |
62 | - class="button main__employer-page-two-item-button">Откликнуться</button> | |
63 | - <a href="{{ route('vacancie', ['vacancy' => $Q->id]) }}" class="button button_light main__employer-page-two-item-button">Подробнее</a> | |
64 | - </div> | |
65 | - <div class="main__employer-page-two-item-bottom"> | |
66 | - <div class="main__employer-page-two-item-bottom-date">{{ date('d.m.Y H:i:s', strtotime($Q->created_at)) }}</div> | |
67 | - <button type="button" data-val="{{ $Q->id }}" class="like main__employer-page-two-item-bottom-like js-toggle <?=App\Classes\Cookies_vacancy::selected_vacancy($Q->id);?>"> | |
68 | - <svg> | |
69 | - <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> | |
70 | - </svg> | |
71 | - </button> | |
72 | - </div> | |
73 | -</div> | |
114 | + @php $i++ @endphp | |
74 | 115 | @endforeach |
75 | 116 | <div style="margin-top: 20px"> |
76 | 117 | {{ $Query->appends($_GET)->links('paginate') }} |
77 | -</div> | |
78 | -@else | |
79 | - <div class="main__vacancies-item main__employer-page-two-item"> | |
80 | - Нет вакансий по данному запросу | |
81 | - </div> | |
82 | -@endif | |
118 | +</div><!-- конец --> |
resources/views/block_real.blade.php
... | ... | @@ -7,7 +7,7 @@ |
7 | 7 | @if ($k == 0) |
8 | 8 | <div class="vacancies__list-label">{{ $title }}</div> |
9 | 9 | @endif |
10 | - <a href="{{ route('list-vacancies', ['categories' => $cat->id_title]) }}" class="vacancies__item"> | |
10 | + <a href="{{ route('list-vacancies', ['job' => $cat->id_title]) }}" class="vacancies__item"> | |
11 | 11 | <span style="border-color:{{$colors[$i]}}"> |
12 | 12 | <b>{{ $cat->name }}</b> |
13 | 13 | <i>Вакансий: <span>{{ $cat->cnt }}</span></i> |
resources/views/js/favorite-vacancy-1.blade.php
... | ... | @@ -0,0 +1,120 @@ |
1 | + | |
2 | +<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script> | |
3 | +<script> | |
4 | + console.log('js выполняется...'); | |
5 | + console.log($.cookie('favorite_vacancy')); | |
6 | + console.log('...................'); | |
7 | + | |
8 | + $(document).ready(function() { | |
9 | + $(document).on('click', '.js_vacancy_favorites', function () { | |
10 | + var _this = $(this); | |
11 | + var id_worker = _this.attr('data-val'); | |
12 | + | |
13 | + console.log('Test test test test test...'); | |
14 | + console.log('id_worker='+id_worker); | |
15 | + | |
16 | + if (_this.hasClass('active')) { | |
17 | + //add_in_array(id_worker); | |
18 | + add_new_element(id_worker); | |
19 | + console.log('Добавлено в избранное id=' + id_worker); | |
20 | + } else { | |
21 | + //delete_in_array(id_worker); | |
22 | + console.log('Удалено из избранных id='+id_worker) | |
23 | + } | |
24 | + var str = $.cookie('favorite_vacancy'); | |
25 | + console.log("Вывод куков "+str); | |
26 | + | |
27 | + }); | |
28 | + }); | |
29 | + | |
30 | + function add_new_element(obj) { | |
31 | + var dataArr = $.cookie('favorite_vacancy');//считываем данные из куков | |
32 | + var Arr; | |
33 | + | |
34 | + if(dataArr===null){ | |
35 | + dataArr = JSON.stringify(new Array()); | |
36 | + } | |
37 | + | |
38 | + console.log('data='+dataArr); | |
39 | + Arr = JSON.parse(dataArr); | |
40 | + Arr[Arr.length] = obj; | |
41 | + $.cookie("favorite_vacancy", JSON.stringify(Arr), '/'); | |
42 | + } | |
43 | + | |
44 | + function delete_new_element(obj) { | |
45 | + var dataArr=$.cookie('favorite_vacancy');//считываем данные из куков | |
46 | + | |
47 | + if(dataArr===null){ | |
48 | + dataArr = JSON.stringify(new Array()); | |
49 | + } | |
50 | + | |
51 | + var unique = [...new Set(dataArr)] | |
52 | + var index = unique.indexOf(obj); | |
53 | + | |
54 | + unique.splice(index, 1); | |
55 | + console.log('Вывод массива='+dataArr); | |
56 | + $.cookie("favorite_vacancy", JSON.stringify(index), '/'); | |
57 | + | |
58 | + } | |
59 | + | |
60 | + //помеченный элемент | |
61 | + function selected_item(obj) { | |
62 | + var arr = read_array(); | |
63 | + var index = arr.indexOf(obj); | |
64 | + | |
65 | + if (index > 0) | |
66 | + return "active"; | |
67 | + else | |
68 | + return ""; | |
69 | + } | |
70 | + | |
71 | + // запись элемента массива в cookie | |
72 | + function add_in_array(obj){ | |
73 | + var arr = read_array();//получаем текущее состояние массива | |
74 | + console.log(obj); | |
75 | + arr[arr.length]=obj; //добавляем элемент в конец | |
76 | + //var str = JSON.stringify(arr);//конвертируем в строку | |
77 | + //$.cookie('arr',str);//записываем массив в куки | |
78 | + //$.cookie('favorite_vac', JSON.stringify(arr)); | |
79 | + //console.log(obj); | |
80 | + //SetCookie("favorite_vacancy", JSON.stringify(arr), time()+60*60*24*1, '/'); | |
81 | + } | |
82 | + | |
83 | + // удаление элемента из массива в cookie | |
84 | + function delete_in_array(obj) { | |
85 | + var arr = read_array(); | |
86 | + var unique = [...new Set(arr)] | |
87 | + var index = unique.indexOf(obj); | |
88 | + | |
89 | + unique.splice(index, 1); | |
90 | + | |
91 | + //var str = JSON.stringify(arr);//конвертируем в строку | |
92 | + //$.cookie('arr',str);//записываем массив в куки | |
93 | + //$.cookie('favorite_vac', JSON.stringify(unique)); | |
94 | + SetCookie("favorite_vacancy", JSON.stringify(unique), time()+60*60*24*1, '/'); | |
95 | + | |
96 | + } | |
97 | + | |
98 | + function read_array(){ | |
99 | + var dataArr=$.cookie('favorite_vacancy');//считываем данные из куков | |
100 | + | |
101 | + //если массив не был обнаружен, иницилизируем его | |
102 | + if(dataArr===null){ | |
103 | + dataArr = init_array(); //возвращаем инициализированный пустой маасив | |
104 | + } | |
105 | + //возвращаем полученный массив | |
106 | + //return JSON.parse(dataArr); | |
107 | + console.log(dataArr); | |
108 | + return JSON.parse(dataArr); | |
109 | + } | |
110 | + | |
111 | + //другими словами создаем пустой массив | |
112 | + function init_array(){ | |
113 | + //var str = JSON.stringify(new Array());//конвертируем в строку | |
114 | + var str = JSON.stringify(new Array()); | |
115 | + //$.cookie('favorite_vac',str);//записываем массив в куки | |
116 | + //SetCookie("favorite_vacancy", str, time()+60*60*24*1, '/'); | |
117 | + $.cookie("favorite_vacancy", str); | |
118 | + return str; | |
119 | + } | |
120 | +</script> |
resources/views/js/favorite-vacancy.blade.php
1 | + | |
2 | +<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script> | |
1 | 3 | <script> |
4 | + console.log('js выполняется...'); | |
2 | 5 | console.log(read_array()); |
3 | 6 | $(document).ready(function() { |
4 | 7 | $(document).on('click', '.js_vacancy_favorites', function () { |
5 | 8 | var _this = $(this); |
6 | 9 | var id_worker = _this.attr('data-val'); |
7 | 10 | |
11 | + console.log('Test test test test test...'); | |
12 | + console.log('id_worker='+id_worker); | |
13 | + | |
8 | 14 | if (_this.hasClass('active')) { |
9 | 15 | add_in_array(id_worker); |
10 | 16 | console.log('Добавлено в избранное id=' + id_worker); |
... | ... | @@ -12,7 +18,7 @@ |
12 | 18 | delete_in_array(id_worker); |
13 | 19 | console.log('Удалено из избранных id='+id_worker) |
14 | 20 | } |
15 | - var str = $.cookie('favorite_vacancy'); | |
21 | + var str = $.cookie('favorit_vacancy'); | |
16 | 22 | console.log("Вывод куков "+str); |
17 | 23 | |
18 | 24 | }); |
... | ... | @@ -36,7 +42,8 @@ |
36 | 42 | //var str = JSON.stringify(arr);//конвертируем в строку |
37 | 43 | //$.cookie('arr',str);//записываем массив в куки |
38 | 44 | //$.cookie('favorite_vac', JSON.stringify(arr)); |
39 | - SetCookie("favorite_vacancy", JSON.stringify(arr), time()+60*60*24*1, '/'); | |
45 | + console.log(arr); | |
46 | + $.cookie("favorit_vacancy", JSON.stringify(arr), { expires: 360, path: '/' }); | |
40 | 47 | |
41 | 48 | } |
42 | 49 | |
... | ... | @@ -51,15 +58,16 @@ |
51 | 58 | //var str = JSON.stringify(arr);//конвертируем в строку |
52 | 59 | //$.cookie('arr',str);//записываем массив в куки |
53 | 60 | //$.cookie('favorite_vac', JSON.stringify(unique)); |
54 | - SetCookie("favorite_vacancy", JSON.stringify(unique), time()+60*60*24*1, '/'); | |
61 | + $.cookie("favorit_vacancy", JSON.stringify(unique), { expires: 360, path: '/' }); | |
55 | 62 | |
56 | 63 | } |
57 | 64 | |
58 | 65 | function read_array(){ |
66 | + // у-тв-арь | |
59 | 67 | var dataArr=$.cookie('favorite_vacancy');//считываем данные из куков |
60 | 68 | |
61 | 69 | //если массив не был обнаружен, иницилизируем его |
62 | - if(dataArr===null){ | |
70 | + if(dataArr===undefined) { | |
63 | 71 | dataArr = init_array(); //возвращаем инициализированный пустой маасив |
64 | 72 | } |
65 | 73 | //возвращаем полученный массив |
... | ... | @@ -72,7 +80,8 @@ |
72 | 80 | //var str = JSON.stringify(new Array());//конвертируем в строку |
73 | 81 | var str = JSON.stringify(new Array()); |
74 | 82 | //$.cookie('favorite_vac',str);//записываем массив в куки |
75 | - SetCookie("favorite_vacancy", str, time()+60*60*24*1, '/'); | |
83 | + $.cookie("favorit_vacancy", str, { expires: 360, path: '/' }); | |
76 | 84 | return str; |
77 | 85 | } |
86 | + | |
78 | 87 | </script> |
resources/views/layout/frontend.blade.php
... | ... | @@ -7,7 +7,7 @@ |
7 | 7 | <meta name="viewport" content="width=device-width,initial-scale=1"> |
8 | 8 | <meta name="theme-color" content="#377D87"> |
9 | 9 | <script src="{{ asset('js/jquery.js') }}"></script> |
10 | - <script type="text/javascript" src="{{ asset('js/jquery.cookie.js') }}"></script> | |
10 | + <!--<script type="text/javascript" src=" asset('js/jquery.cookie.js') }}"></script>--> | |
11 | 11 | <link rel="stylesheet" href="{{ asset('css/style_21march.css') }}"> |
12 | 12 | <link rel="stylesheet" href="{{ asset('css/star-rating.min.css') }}"> |
13 | 13 | <style> |
... | ... | @@ -215,6 +215,7 @@ |
215 | 215 | <span></span> |
216 | 216 | <a href="{{ route('page', ['pages' => "Polzovatelskoe-soglashenie"]) }}">Пользовательское соглашение</a> |
217 | 217 | </nav> |
218 | + <div> @if (isset($_COOKIE['favorite_vacancy'])) Куки вакансий: {{ print_r($_COOKIE['favorite_vacancy']) }} @endif</div> | |
218 | 219 | <a href="{{ route('index') }}" class="nls" target="_blank"> |
219 | 220 | <svg> |
220 | 221 | <use xlink:href="{{ asset('images/sprite.svg#nls') }}"></use> |
... | ... | @@ -235,7 +236,7 @@ |
235 | 236 | @include('modals.send_worker_new') |
236 | 237 | |
237 | 238 | <!-- Работодатель отправляет сообщение соискателю --> |
238 | - @include('modals.send_employer_new') | |
239 | + @include('modals.send_employer') | |
239 | 240 | |
240 | 241 | <!-- Сообщение-предупреждение о том, что сообщения только можно отправить авторизованным пользователям --> |
241 | 242 | @include('modals.send_message_noaut') |
resources/views/list_vacancies.blade.php
... | ... | @@ -22,7 +22,7 @@ |
22 | 22 | console.log('Выбор сделан!'); |
23 | 23 | |
24 | 24 | main_oskar.html(data); |
25 | - history.pushState({}, '', "{{ route('list-vacancies', ['categories' => $categories->id]) }}?sort="+val+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); | |
25 | + history.pushState({}, '', "{{ route('list-vacancies', ['categories' => $categories->id]) }}?job="+val+"@if (isset($_GET['sort']))&sort={{ $_GET['sort'] }}@endif"+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); | |
26 | 26 | }, |
27 | 27 | headers: { |
28 | 28 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
... | ... | @@ -38,7 +38,7 @@ |
38 | 38 | } else { |
39 | 39 | $.ajax({ |
40 | 40 | type: "GET", |
41 | - url: "{{ route('list-vacancies', ['categories' => $categories->id]) }}", | |
41 | + url: "{{ route('list-vacancies', ['categories' => $categories->id]) }}?@if (isset($_GET['sort']))&sort={{ $_GET['sort'] }}@endif", | |
42 | 42 | data: "job=" + val +"&title=1", |
43 | 43 | success: function (data) { |
44 | 44 | |
... | ... | @@ -87,7 +87,7 @@ |
87 | 87 | console.log('Выбор сортировки'); |
88 | 88 | console.log(data); |
89 | 89 | $('#main_ockar').html(data); |
90 | - history.pushState({}, '', "{{ route('list-vacancies', ['categories' => $categories->id]) }}?sort="+val_+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); | |
90 | + history.pushState({}, '', "{{ route('list-vacancies', ['categories' => $categories->id]) }}?sort="+val_+"@if (isset($_GET['job']))&job={{ $_GET['job'] }}@endif"+"@if (isset($_GET['page']))&page={{ $_GET['page'] }}@endif"); | |
91 | 91 | }, |
92 | 92 | headers: { |
93 | 93 | 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') |
... | ... | @@ -125,7 +125,7 @@ |
125 | 125 | @section('content') |
126 | 126 | <section class="thing"> |
127 | 127 | <div class="container"> |
128 | - <form class="thing__body" action="{{ route('list-vacancies', ['categories' => $Name_categori[0]->id]) }}" method="POST"> | |
128 | + <form class="thing__body" action="{{ route('list-vacancies', ['categories' => (!empty($Name_categori)) ? $Name_categori[0]->id : '0']) }}" method="POST"> | |
129 | 129 | <ul class="breadcrumbs thing__breadcrumbs"> |
130 | 130 | <li><a href="{{ route('index') }}">Главная</a></li> |
131 | 131 | <li><a href="{{ route('vacancies') }}">Вакансии</a></li> |
... | ... | @@ -197,14 +197,14 @@ |
197 | 197 | </div> |
198 | 198 | @endif |
199 | 199 | @endforeach |
200 | - <div class="main__vacancies-item main__employer-page-two-item"> | |
200 | + <div class="main__vacancies-item main__employer-page-two-item" data-id="{{ $Q->id }}"> | |
201 | 201 | |
202 | 202 | <a href="{{ route('list-vacancies', ['categories' => $categories->id]) }}" class="back main__employer-page-two-item-back"> |
203 | 203 | <svg> |
204 | 204 | <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use> |
205 | 205 | </svg> |
206 | 206 | <span> |
207 | - Вернуться к списку вакансий | |
207 | + Вернуться к списку вакансий 123 | |
208 | 208 | </span> |
209 | 209 | </a> |
210 | 210 | |
... | ... | @@ -294,6 +294,7 @@ |
294 | 294 | <div style="margin-top: 20px"> |
295 | 295 | {{ $Query->appends($_GET)->links('paginate') }} |
296 | 296 | </div><!-- конец --> |
297 | + | |
297 | 298 | </div> |
298 | 299 | </div> |
299 | 300 | </div> |
resources/views/modals/send_employer.blade.php
... | ... | @@ -12,11 +12,11 @@ |
12 | 12 | </script> |
13 | 13 | <div id="send2" class="modal"> |
14 | 14 | <div class="modal__body"> |
15 | - <div class="modal__title">Отправить сообщение соискателю</div> | |
16 | - <div class="modal__text">Если у вас есть предложение для соискателя, вы можете сделать предложение</div> | |
15 | + <div class="modal__title">Отправить сообщение</div> | |
16 | + <div class="modal__text">Если у вас есть предложение, вы можете сделать конретное предложение</div> | |
17 | 17 | <form class="modal__form" id="form_from_emp" name="form_from_emp" enctype="multipart/form-data" action="{{ route('employer.new_message') }}" method="POST"> |
18 | 18 | @csrf |
19 | - <div class="modal__form-item"> | |
19 | + <div class="modal__form-item" style="display:none"> | |
20 | 20 | Отправитель сообщения: |
21 | 21 | <input type="text" id="_user_id" name="_user_id" class="input" placeholder="user_id" value=""> |
22 | 22 | Получатель сообщения: |
... | ... | @@ -40,7 +40,7 @@ |
40 | 40 | <svg> |
41 | 41 | <use xlink:href="{{ asset('images/sprite.svg#share') }}"></use> |
42 | 42 | </svg> |
43 | - Прикрепить резюме | |
43 | + Прикрепить документ | |
44 | 44 | </span> |
45 | 45 | </label> |
46 | 46 |
resources/views/modals/send_employer_new.blade.php
No preview for this file type
resources/views/resume.blade.php
1 | 1 | @extends('layout.frontend', ['title' => 'База резюме - РекаМоре']) |
2 | 2 | |
3 | 3 | @section('scripts') |
4 | + <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script> | |
4 | 5 | <script> |
5 | 6 | console.log('Test system'); |
6 | 7 | $(document).on('change', '#jobs', function() { |
resources/views/vacance-item.blade.php
1 | +@php | |
2 | + use App\Classes\StatusUser; | |
3 | +@endphp | |
4 | + | |
1 | 5 | @extends('layout.frontend', ['title' => $title]) |
2 | 6 | |
3 | 7 | @section('scripts') |
4 | 8 | @include('js.favorite-vacancy') |
9 | + <script> | |
10 | + $(document).on('click', '.js_send_it_button', function() { | |
11 | + var this_ = $(this); | |
12 | + var code_user_id = this_.attr('data-uid'); | |
13 | + var code_to_user_id = this_.attr('data-tuid'); | |
14 | + var code_vacancy = this_.attr('data-vacancy'); | |
15 | + var user_id = $('#_user_id'); | |
16 | + var to_user_id = $('#_to_user_id'); | |
17 | + var vacancy = $('#_vacancy'); | |
18 | + | |
19 | + console.log('Клик на кнопки...'); | |
20 | + | |
21 | + user_id.val(code_user_id); | |
22 | + to_user_id.val(code_to_user_id); | |
23 | + vacancy.val(code_vacancy); | |
24 | + }); | |
25 | + </script> | |
5 | 26 | @endsection |
6 | 27 | |
7 | 28 | @section('content') |
... | ... | @@ -115,7 +136,18 @@ |
115 | 136 | </div> |
116 | 137 | <br> |
117 | 138 | <div class="main__employer-page-two-item-buttons"> |
118 | - <button type="button" class="button main__employer-page-two-item-button">Откликнуться</button> | |
139 | + @guest | |
140 | + <button type="button" data-fancybox data-src="#question" data-options='{"touch":false,"autoFocus":false}' | |
141 | + class="button main__employer-page-two-item-button">Откликнуться</button> | |
142 | + @else | |
143 | + @if (App\Classes\StatusUser::Status()==1) | |
144 | + <button type="button" data-fancybox data-src="#send" data-vacancy="{{ $Q->id }}" data-uid="{{ $uid }}" data-tuid="{{ $Q->employer->user_id }}" data-options='{"touch":false,"autoFocus":false}' | |
145 | + class="button main__employer-page-two-item-button js_send_it_button">Откликнуться</button> | |
146 | + @else | |
147 | + <button type="button" data-fancybox data-src="#send2" data-vacancy="{{ $Q->id }}" data-uid="{{ $uid }}" data-tuid="{{ $Q->employer->user_id }}" data-options='{"touch":false,"autoFocus":false}' | |
148 | + class="button main__employer-page-two-item-button js_send_it_button">Откликнуться</button> | |
149 | + @endif | |
150 | + @endguest | |
119 | 151 | </div> |
120 | 152 | <div class="main__employer-page-two-item-bottom"> |
121 | 153 | <div class="main__employer-page-two-item-bottom-date">{{ date('d.m.Y H:i:s', strtotime($Q->created_at)) }}</div> |
resources/views/workers/favorite.blade.php
1 | 1 | @extends('layout.frontend', ['title' => 'Избранные - РекаМоре']) |
2 | 2 | |
3 | 3 | @section('scripts') |
4 | - | |
4 | + @include('js.favorite-vacancy') | |
5 | 5 | @endsection |
6 | 6 | |
7 | 7 | @section('content') |
... | ... | @@ -54,7 +54,7 @@ |
54 | 54 | <div id="main_ockar" name="main_ockar" class="cabinet__vacs-body" style="width:100%;"> |
55 | 55 | @foreach ($Query as $Q) |
56 | 56 | <div class="main__vacancies-item main__employer-page-two-item"> |
57 | - <a href="" class="back main__employer-page-two-item-back"> | |
57 | + <a href="{{ route('list-vacancies') }}" class="back main__employer-page-two-item-back"> | |
58 | 58 | <svg> |
59 | 59 | <use xlink:href="{{ asset('images/sprite.svg#back') }}"></use> |
60 | 60 | </svg> |
... | ... | @@ -63,9 +63,11 @@ |
63 | 63 | </span> |
64 | 64 | </a> |
65 | 65 | <div class="main__employer-page-two-item-toper"> |
66 | - @if (isset($Q->employer)) | |
67 | - <img src="{{ asset(Storage::url($Q->employer->logo)) }}" alt="{{ $Q->employer->name }}"> | |
68 | - @endif | |
66 | + @if (!empty($Q->employer->logo)) | |
67 | + <img src="{{ asset(Storage::url($Q->employer->logo)) }}" alt="{{ $Q->employer->name }}"> | |
68 | + @else | |
69 | + <img src="{{ asset('images/default_ship.jpg') }}" alt="{{ $Q->employer->name }}" class="main__vacancies-thing-pic"> | |
70 | + @endif | |
69 | 71 | <span>@if (!empty($Q->name)) {{ $Q->name }} @endif</span> |
70 | 72 | </div> |
71 | 73 | <div class="main__employer-page-two-item-text"> |
... | ... | @@ -117,7 +119,7 @@ |
117 | 119 | </div> |
118 | 120 | <div class="main__employer-page-two-item-bottom"> |
119 | 121 | <div class="main__employer-page-two-item-bottom-date">{{ $Q->created_at }}</div> |
120 | - <button type="button" class="like main__employer-page-two-item-bottom-like js-toggle"> | |
122 | + <button type="button" class="like main__employer-page-two-item-bottom-like js-toggle js_vacancy_favorites <?=App\Classes\Cookies_vacancy::selected_vacancy($Q->id);?>"> | |
121 | 123 | <svg> |
122 | 124 | <use xlink:href="{{ asset('images/sprite.svg#heart') }}"></use> |
123 | 125 | </svg> |
routes/web.php
... | ... | @@ -401,7 +401,7 @@ Route::get('vacancies', [MainController::class, 'vacancies'])->name('vacancies') |
401 | 401 | Route::get('search-vacancies', [MainController::class, 'search_vacancies'])->name('search_vacancies'); |
402 | 402 | |
403 | 403 | //Вакансии категория детальная |
404 | -Route::get('list-vacancies/{categories}', [MainController::class, 'list_vacancies'])->name('list-vacancies'); | |
404 | +Route::get('list-vacancies/{categories?}', [MainController::class, 'list_vacancies'])->name('list-vacancies'); | |
405 | 405 | |
406 | 406 | //Детальная страница вакансии - работодателя |
407 | 407 | Route::get('vacancie/{vacancy}', [FrontEmployersController::class, 'vacancie'])->name('vacancie'); |