Commit 9d2ae55e9b5d836e6362507b6f1de22d49fc5989

Authored by Сергей П
1 parent 505f4f18d2
Exists in master

Анкета работника + фиксы

Showing 4 changed files with 76 additions and 144 deletions Side-by-side Diff

app/Http/Controllers/WorkerController.php
... ... @@ -473,6 +473,28 @@ class WorkerController extends Controller
473 473 }
474 474 }
475 475  
  476 + public function cabinet_save_foto(Worker $worker, Request $request){
  477 + $params = ['photo' => null];
  478 +
  479 + if ($request->has('photo')) {
  480 + if (!empty($worker->photo)) {
  481 + Storage::delete($worker->photo);
  482 + }
  483 + $params['photo'] = $request->file('photo')->store("worker/$worker->id", 'public');
  484 + }
  485 +
  486 + if ($request->has('file')) {
  487 + if (!empty($worker->file)) {
  488 + Storage::delete($worker->file);
  489 + }
  490 + $params['file'] = $request->file('file')->store("worker/$worker->id", 'public');
  491 + }
  492 +
  493 + $worker->update($params);
  494 +
  495 + return redirect()->route('worker.cabinet');
  496 + }
  497 +
476 498 // Сообщения данные
477 499 public function messages($type_message)
478 500 {
resources/views/resume.blade.php
... ... @@ -382,7 +382,7 @@
382 382 </div>
383 383 <div>
384 384 <b>Предпочтение по типу судна:</b>
385   - <span></span>
  385 + <span>{{ $res->boart_type_preference ?? '-' }}</span>
386 386 </div>
387 387 <div>
388 388 <b>ФИО:</b>
... ... @@ -390,13 +390,15 @@
390 390 </div>
391 391 <div>
392 392 <b>Наличие визы:</b>
  393 + <span>{{ $res->visa_available ?? '-' }}</span>
393 394 </div>
394 395 <div>
395 396 <b>Возраст:</b>
396   - <span>@if (isset($res->old_year)) {{ $res->old_year }} @else - @endif</span>
  397 + <span>{{ $res->old_year ?? '-' }}</span>
397 398 </div>
398 399 <div>
399 400 <b>Наличие танкерных документов:</b>
  401 + <span>{{ $res->tanker_documents_available ?? '-' }}</span>
400 402 </div>
401 403 <div>
402 404 <b>Желаемые вакансии:</b>
... ... @@ -406,14 +408,18 @@
406 408 {{ $job_title->name }}
407 409 @if (!$loop->last) / @endif
408 410 @endforeach
  411 + @else
  412 + -
409 413 @endif
410 414 </span>
411 415 </div>
412 416 <div>
413 417 <b>Наличие подтверждения для работы на ВВП:</b>
  418 + <span>{{ $res->confirmation_work_for_vvp ?? '-' }}</span>
414 419 </div>
415 420 <div>
416 421 <b>Пожелание к З/П:</b>
  422 + <span>{{ $res->salary_expectations ?? '-' }}</span>
417 423 </div>
418 424 <div>
419 425 <b>Город проживания</b>
... ... @@ -421,13 +427,15 @@
421 427 </div>
422 428 <div>
423 429 <b>Уровень английского:</b>
  430 + <span>{{ $res->english_level ?? '-' }}</span>
424 431 </div>
425 432 <div>
426 433 <b>Номер телефона</b>
427   - <span><a href="tel:{{ $res->telephone }}">{{ $res->telephone }}</a></span>
  434 + <span><a href="tel:{{ $res->telephone }}">{{ $res->telephone ?? '-' }}</a></span>
428 435 </div>
429 436 <div>
430 437 <b>Дата готовности к посадке:</b>
  438 + <span>{{ $res->ready_boart_date ?? '-' }}</span>
431 439 </div>
432 440 <div>
433 441 <b>E-mail:</b>
resources/views/workers/cabinet.blade.php
... ... @@ -4,6 +4,7 @@
4 4 <script>
5 5 $(function() {
6 6 $('.cabinet__avatar-form [type="file"][name="photo"]').change(function (event) {
  7 + var form = $(this).closest('form');
7 8 const file = event.target.files[0];
8 9  
9 10 if (file) {
... ... @@ -15,6 +16,10 @@
15 16 img.attr('src', e.target.result);
16 17 img_wrap.find('svg, img').remove();
17 18 img_wrap.append(img);
  19 +
  20 + setTimeout(function () {
  21 + form.submit();
  22 + }, 1000);
18 23 };
19 24  
20 25 reader.readAsDataURL(file);
... ... @@ -22,120 +27,12 @@
22 27 });
23 28 });
24 29  
25   - $(document).on('click', '#button_new_doc123', function() {
26   - var this_ = $(this);
27   - var val_ = this_.attr('data-val');
28   - var new_diplom = $('#new_diplom');
29   - var new_diplom_val = new_diplom.val();
30   - var new_data_begin = $('#new_data_begin');
31   - var new_data_begin_val = new_data_begin.val();
32   - var new_data_end = $('#new_data_end');
33   - var new_data_end_val = new_data_end.val();
34   - var education = $('#education');
35   - var education_val = education.val();
36   - var worker_id = $('#new_id');
37   - var worker_val = worker_id.val();
38   -
39   - console.log('sort items ' + val_);
40   -
41   - if (new_diplom_val == '') {
42   - new_diplom.addClass('err_red');
43   - console.log('Border Up');
44   - } else {
45   - $.ajax({
46   - type: "GET",
47   - url: "{{ route('worker.add_serificate') }}",
48   - data: "worker_id="+worker_val+"&date_begin="+new_data_begin_val + "&end_begin=" + new_data_end_val + "&name=" + new_diplom_val + "&education="+education_val,
49   - success: function (data) {
50   - console.log('Блокировка...');
51   - console.log(data);
52   - $('#sertificate').html(data);
53   - if (new_diplom.hasClass('err_red')) new_diplom.removeClass('err_red');
54   - },
55   - headers: {
56   - 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
57   - },
58   - error: function (data) {
59   - data = JSON.stringify(data);
60   - console.log('Error: ' + data);
61   - }
62   - });
63   - }
64   - });
65   -
66   - $(document).on('click', '#btn_new_diplom123', function() {
67   - var this_ = $(this);
68   - var val_ = this_.attr('data-val');
69   - var documents = $('#documents');
70   - var doc_val = documents.val();
71   - var block = $('#ajax_dop_diplomi');
72   -
73   - console.log('worker_id='+val_+'it_infoblock='+ doc_val);
74   -
75   - $.ajax({
76   - type: "GET",
77   - url: "",
78   - data: "worker_id="+val_+"&infoblok_id="+doc_val,
79   - success: function (data) {
80   - location.url = data;
81   - console.log('Добавление документа-диплома');
82   - console.log(data);
83   - block.html(data);
84   - },
85   - headers: {
86   - 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
87   - },
88   - error: function (data) {
89   - data = JSON.stringify(data);
90   - console.log('Error: ' + data);
91   - }
92   - });
93   - });
94   -
95   - $(document).on('click', '#new_work', function() {
96   - var this_ = $(this);
97   - var val_ = this_.attr('data-val');
98   - var new_diplom = $('#new_diplom').val();
99   - var new_data_begin = $('#new_data_begin').val();
100   - var new_data_end = $('#new_data_end').val();
101   - var new_job_title = $('#new_job_title').val();
102   - var new_teplohod = $('#new_teplohod').val();
103   - var new_GWT = $('#new_GWT').val();
104   - var new_KBT = $('#new_KBT').val();
105   - var new_Begin_work = $('#new_Begin_work').val();
106   - var new_End_work = $('#new_End_work').val();
107   - var new_name_company = $('#new_name_company').val();
108   -
109   - console.log('worker_id='+val_+'it_infoblock='+ doc_val);
110   -
111   - $.ajax({
112   - type: "GET",
113   - url: "",
114   - data: "worker_id="+val_+"&infoblok_id="+doc_val,
115   - success: function (data) {
116   - location.url = data;
117   - console.log('Добавление документа-диплома');
118   - console.log(data);
119   - block.html(data);
120   - },
121   - headers: {
122   - 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
123   - },
124   - error: function (data) {
125   - data = JSON.stringify(data);
126   - console.log('Error: ' + data);
127   - }
128   - });
129   - });
130   -
131 30 $(document).on('click', '#old_year', function() {
132 31 var this_ = $(this);
133 32 var val = this_.val();
134 33  
135 34 if (val < 0)
136 35 $('#old_year').val(0);
137   -
138   - console.log('Возраст не может выполнить такую операцию');
139 36 });
140 37 </script>
141 38 @endsection
... ... @@ -159,9 +56,7 @@
159 56  
160 57 @include('workers.menu', ['item' => 1])
161 58 </div>
162   - <form class="cabinet__body" action="{{ route('worker.cabinet_save', ['worker' => $worker->id]) }}" enctype="multipart/form-data" method="POST">
163   - @csrf
164   - @include('messages_error')
  59 + <div class="cabinet__body">
165 60 <div class="cabinet__body-item">
166 61 <div class="cabinet__anketa">
167 62 <h2 class="title cabinet__title">Моя анкета</h2>
... ... @@ -176,6 +71,7 @@
176 71 </div>
177 72 </div>
178 73 </div>
  74 +
179 75 <div class="cabinet__body-item">
180 76 <div class="cabinet__stats">
181 77 <h3 class="cabinet__subtitle cabinet__stats-title">Статистика</h3>
... ... @@ -202,37 +98,42 @@
202 98 <div class="cabinet__stats-bottom">Заполните профиль, чтобы повысить процент анкеты на 80%</div>
203 99 </div>
204 100 </div>
205   - <div class="cabinet__body-item">
206   - <h3 class="cabinet__subtitle">Профиль</h3>
207   - <div class="cabinet__avatar">
208   - <div class="cabinet__avatar-pic">
209   -
210   - @if (!empty($worker->photo))
211   - <img src="{{ asset(Storage::url($worker->photo)) }}"/>
212   - @else
213   - <svg>
214   - <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
215   - </svg>
216   - @endif
217   - </div>
218   - <div class="cabinet__avatar-form">
219   - <label class="file">
220   - <span class="file__input">
221   - <input type="file" name="photo" id="photo">
222   -
223   - <span class="button">
224   - <svg>
225   - <use xlink:href="{{ asset('images/sprite.svg#plus') }}"></use>
226   - </svg>
227   - Загрузить
  101 +
  102 + <form class="" action="{{ route('worker.cabinet_save_foto', ['worker' => $worker->id]) }}" enctype="multipart/form-data" method="POST">
  103 + @csrf
  104 + @include('messages_error')
  105 +
  106 + <div class="cabinet__body-item">
  107 + <h3 class="cabinet__subtitle">Профиль</h3>
  108 + <div class="cabinet__avatar">
  109 + <div class="cabinet__avatar-pic">
  110 +
  111 + @if (!empty($worker->photo))
  112 + <img src="{{ asset(Storage::url($worker->photo)) }}"/>
  113 + @else
  114 + <svg>
  115 + <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use>
  116 + </svg>
  117 + @endif
  118 + </div>
  119 + <div class="cabinet__avatar-form">
  120 + <label class="file">
  121 + <span class="file__input">
  122 + <input type="file" name="photo" id="photo">
  123 +
  124 + <span class="button">
  125 + <svg>
  126 + <use xlink:href="{{ asset('images/sprite.svg#plus') }}"></use>
  127 + </svg>
  128 + Загрузить
  129 + </span>
228 130 </span>
229   - </span>
230   - </label>
231   - <p class="cabinet__text">Загрузите фотографию в формате svg., jpg., jpeg., png.</p>
  131 + </label>
  132 + <p class="cabinet__text">Загрузите фотографию в формате svg., jpg., jpeg., png.</p>
  133 + </div>
232 134 </div>
233 135 </div>
234   - </div>
235   -
  136 + </form>
236 137  
237 138 <div class="cabinet__body-item mb-40">
238 139 <h3 class="cabinet__subtitle font30">Основная информация</h3>
... ... @@ -586,8 +487,7 @@
586 487 Добавить контакт для рекомендации
587 488 </a>
588 489 </div>
589   -
590   - </form>
  490 + </div>
591 491 </div>
592 492 </div>
593 493 </section>
... ... @@ -506,6 +506,8 @@ Route::group([
506 506 // 1 страница - Моя анкета
507 507 Route::get('cabinet', [WorkerController::class, 'cabinet'])->name('cabinet');
508 508 Route::post('cabinet/{worker}', [WorkerController::class, 'cabinet_save'])->name('cabinet_save');
  509 + Route::post('cabinet/cabinet_save_foto/{worker}', [WorkerController::class, 'cabinet_save_foto'])->name('cabinet_save_foto');
  510 +
509 511  
510 512 // 2 страница - Сообщения
511 513 Route::get('cabinet/messages/{type_message}', [WorkerController::class, 'messages'])->name('messages');