Commit 127b2097de55ab574a90115719798728fef6c077

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

правки в личном кабинете работника

Showing 8 changed files with 253 additions and 131 deletions Side-by-side Diff

app/Http/Controllers/WorkerController.php
... ... @@ -988,8 +988,8 @@ class WorkerController extends Controller
988 988 //Сохранение стандартого документа
989 989 public function add_document_save(DocumentsRequest $request) {
990 990 $params = $request->all();
991   - $place_work = place_works::create($params);
992   - return redirect()->route('worker.cabinet')->with('success', 'Вы успешно добавили запись!');
  991 + place_works::create($params);
  992 + return response()->json(['success' => true]);
993 993 }
994 994  
995 995 // Редактирование документа
... ... @@ -1088,9 +1088,9 @@ class WorkerController extends Controller
1088 1088 public function add_prev_company(PrevCompanyRequest $request) {
1089 1089 // Возвращение параметров
1090 1090 $all = $request->all();
1091   - $PrevCompany = PrevCompany::create($all);
  1091 + PrevCompany::create($all);
1092 1092  
1093   - return redirect()->route('worker.cabinet')->with('success', 'Вы успешно отредактировали запись');
  1093 + return response()->json(['success' => true]);
1094 1094 }
1095 1095  
1096 1096 // Редактирование контакта компании
public/css/style_may2024.css
... ... @@ -9325,3 +9325,7 @@ body .cke_notifications_area{
9325 9325 padding: 0;
9326 9326 width: 100%;
9327 9327 }
  9328 +
  9329 +.review-image-modal{
  9330 + cursor: pointer;
  9331 +}
  1 +$(function(){
  2 + $('.review-image-modal').click(function(){
  3 + cl($(this));
  4 + $(this).fancybox({
  5 + 'autoScale': true,
  6 + 'transitionIn': 'elastic',
  7 + 'transitionOut': 'elastic',
  8 + 'speedIn': 500,
  9 + 'speedOut': 300,
  10 + 'autoDimensions': true,
  11 + 'centerOnScroll': true
  12 + })
  13 + });
  14 +});
  15 +
1 16  
2 17 var spinStart = function(button) {
3 18 button.prop('disabled', true);
... ... @@ -10,3 +25,9 @@ var spinStop= function(button) {
10 25 button.prop('disabled', false);
11 26 button.find('.button-loader').remove();
12 27 };
  28 +
  29 +var cl = function(obj){
  30 + console.log(obj);
  31 +}
  32 +
  33 +
resources/views/info_company_new.blade.php
... ... @@ -101,7 +101,7 @@
101 101 @endif
102 102  
103 103 @if (!empty($company[0]->logo))
104   - <img src="{{ asset(Storage::url($company[0]->logo)) }}" alt="{{ $company[0]->name_company }}" class="thing__pic">
  104 + <img src="{{ asset(Storage::url($company[0]->logo)) }}" alt="{{ $company[0]->name_company }}" class="thing__pic review-image-modal">
105 105 @else
106 106 <img src="{{ asset('images/logo_emp.png') }}" alt="{{ $company[0]->name_company }}" class="thing__pic">
107 107 @endif
resources/views/workers/docs.blade.php
1   -@extends('layout.frontend', ['title' => 'Добавление стандартного документа - РекаМоре'])
  1 +@extends('workers.cabinet_layout', ['title' => 'Добавление стандартного документа - РекаМоре'])
2 2  
3   -@section('scripts')
  3 +@section('cabinet_content')
  4 +<h3 class="cabinet__h4 font30">Место работы</h3>
  5 +<div class="cabinet__inputs">
  6 + @csrf
  7 + <input type="hidden" name="worker_id" id="worker_id" class="input" value="{{ $worker->id }}">
4 8  
5   -@endsection
  9 + <div class="error-block"></div>
6 10  
7   -@section('content')
8   - <section class="cabinet">
9   - <div class="container">
10   - <ul class="breadcrumbs cabinet__breadcrumbs">
11   - <li><a href="{{ route('index') }}">Главная</a></li>
12   - <li><b>Личный кабинет</b></li>
13   - </ul>
14   - <div class="cabinet__wrapper">
15   - <div class="cabinet__side">
16   - <div class="cabinet__side-toper">
17   - @include('workers.emblema')
18   -
19   - </div>
20   -
21   - @include('workers.menu', ['item' => 1])
  11 + <div class="cabinet__body-item width100">
  12 + <div class="cabinet__inputs">
  13 + <div class="cabinet__inputs-item form-group">
  14 + <label class="form-group__label">Должность</label>
  15 + <div class="form-group__item">
  16 + <input type="text" name="job_title" id="job_title" class="input" value="{{ old('job_title') ?? $doc->job_title ?? '' }}" required>
22 17 </div>
  18 + </div>
23 19  
24   - <form class="cabinet__body" action="{{ route('worker.add_document_save') }}" method="POST">
25   - @csrf
26   - <div class="cabinet__works-item">
27   - @include('messages_error')
28   - <div class="cabinet__works-spoiler active">
29   - <div class="cabinet__works-spoiler-left">
30   - <div class="cabinet__works-spoiler-text">Новая работа</div>
31   - </div>
32   - <button type="button" class="cabinet__works-spoiler-right js-parent-toggle">
33   - <svg>
34   - <use xlink:href="{{ asset('images/sprite.svg#arrow-bold') }}"></use>
35   - </svg>
36   - </button>
37   - </div>
38   - <div class="cabinet__works-body">
39   - <div class="cabinet__inputs">
40   - <input type="hidden" name="worker_id" id="worker_id" value="{{ $worker->id }}"/>
41   - <div class="cabinet__inputs-item form-group">
42   - <label class="form-group__label">Должность*</label>
43   - <div class="form-group__item">
44   - <input type="text" name="job_title" id="job_title" class="input" value="{{ old('job_title') ?? $doc->job_title ?? '' }}">
45   - </div>
46   - </div>
47   - <!--<div class="cabinet__inputs-item form-group">
48   - <label class="form-group__label">Опыт работы в танкерном флоте</label>
49   - <div class="form-group__item">
50   - <select class="js-select2" name="tanker" id="tanker">
51   - <option value="0" if ($doc->tanker == 0) seleted endif>Нет</option>
52   - <option value="1" if ($doc->tanker == 1) seleted endif>Да</option>
53   - </select>
54   - </div>
55   - </div>-->
56   - <div class="cabinet__inputs-item form-group">
57   - <label class="form-group__label">Название т/х*</label>
58   - <div class="form-group__item">
59   - <input type="text" name="teplohod" id="teplohod" class="input" value="{{ old('teplohod') ?? $doc->teplohod ?? '' }}">
60   - </div>
61   - </div>
62   - <div class="cabinet__inputs-item form-group">
63   - <label class="form-group__label">Тип судна*</label>
64   - <div class="form-group__item">
65   - <input type="text" name="GWT" id="GWT" class="input" value="{{ old('GWT') ?? $doc->GWT ?? '' }}">
66   - </div>
67   - </div>
68   -
69   - <div class="cabinet__inputs-item form-group">
70   - <label class="form-group__label">Марка ГД</label>
71   - <div class="form-group__item">
72   - <input type="text" name="Marka_GD" id="Marka_GD" class="input" value="{{ old('Marka_GD') ?? $doc->Marka_GD ?? '' }}">
73   - </div>
74   - </div>
75   -
76   - <div class="cabinet__inputs-item form-group">
77   - <label class="form-group__label">Мощность (кВт)</label>
78   - <div class="form-group__item">
79   - <input type="text" name="KBT" id="KBT" class="input" value="{{ old('KBT') ?? $doc->KBT ?? '' }}">
80   - </div>
81   - </div>
82   -
83   - <div class="cabinet__inputs-item form-group">
84   - <label class="form-group__label">Водоизмещение (GRT)*</label>
85   - <div class="form-group__item">
86   - <input type="text" name="GRT" id="GRT" class="input" value="{{ old('GRT') ?? $doc->GRT ?? '' }}">
87   - </div>
88   - </div>
89   -
90   - <div class="cabinet__inputs-item form-group">
91   - <label class="form-group__label">Название компании*</label>
92   - <div class="form-group__item">
93   - <input type="text" name="name_company" id="name_company" class="input" value="{{ old('name_company') ?? $doc->name_company ?? '' }}">
94   - </div>
95   - </div>
96   -
97   - <div class="cabinet__inputs-item form-group">
98   - <label class="form-group__label">Начало контракта</label>
99   - <div class="form-group__item">
100   - <input type="text" name="Begin_work" id="Begin_work" class="input" value="{{ old('begin_work') ?? $doc->begin_work ?? '' }}">
101   - </div>
102   - </div>
103   -
104   - <div class="cabinet__inputs-item form-group">
105   - <label class="form-group__label">Окончание контракта</label>
106   - <div class="form-group__item">
107   - <input type="text" name="End_work" id="End_work" class="input" value="{{ old('end_work') ?? $doc->end_work ?? '' }}">
108   - </div>
109   - </div>
110   -
111   - <button type="submit" class="button">Сохранить</button>
112   - </div>
113   - </div>
114   - </div>
115   - </form>
  20 + <div class="cabinet__inputs-item form-group">
  21 + <label class="form-group__label">Название т/х</label>
  22 + <div class="form-group__item">
  23 + <input type="text" name="teplohod" id="teplohod" class="input" value="{{ old('teplohod') ?? $doc->teplohod ?? '' }}" required>
  24 + </div>
  25 + </div>
  26 +
  27 + <div class="cabinet__inputs-item form-group">
  28 + <label class="form-group__label">Тип судна</label>
  29 + <div class="form-group__item">
  30 + <input type="text" name="GWT" id="GWT" class="input" value="{{ old('GWT') ?? $doc->GWT ?? '' }}" required>
  31 + </div>
  32 + </div>
  33 +
  34 + <div class="cabinet__inputs-item form-group">
  35 + <label class="form-group__label">Марка ГД</label>
  36 + <div class="form-group__item">
  37 + <input type="text" name="Marka_GD" id="Marka_GD" class="input" value="{{ old('Marka_GD') ?? $doc->Marka_GD ?? '' }}">
  38 + </div>
  39 + </div>
  40 +
  41 + <div class="cabinet__inputs-item form-group">
  42 + <label class="form-group__label">Мощность (кВт)</label>
  43 + <div class="form-group__item">
  44 + <input type="text" name="KBT" id="KBT" class="input" value="{{ old('KBT') ?? $doc->KBT ?? '' }}">
  45 + </div>
  46 + </div>
  47 +
  48 + <div class="cabinet__inputs-item form-group">
  49 + <label class="form-group__label">Водоизмещение (GRT)</label>
  50 + <div class="form-group__item">
  51 + <input type="text" name="GRT" id="GRT" class="input" value="{{ old('GRT') ?? $doc->GRT ?? '' }}" required>
  52 + </div>
  53 + </div>
  54 +
  55 + <div class="cabinet__inputs-item form-group">
  56 + <label class="form-group__label">Название компании</label>
  57 + <div class="form-group__item">
  58 + <input type="text" name="name_company" id="name_company" class="input" value="{{ old('name_company') ?? $doc->name_company ?? '' }}" required>
  59 + </div>
  60 + </div>
  61 +
  62 + <div class="cabinet__inputs-item form-group">
  63 + <label class="form-group__label">Начало контракта</label>
  64 + <div class="form-group__item">
  65 + <input type="text" name="Begin_work" id="Begin_work" class="input" value="{{ old('begin_work') ?? $doc->begin_work ?? '' }}">
  66 + </div>
  67 + </div>
  68 +
  69 + <div class="cabinet__inputs-item form-group">
  70 + <label class="form-group__label">Окончание контракта</label>
  71 + <div class="form-group__item">
  72 + <input type="text" name="End_work" id="End_work" class="input" value="{{ old('end_work') ?? $doc->end_work ?? '' }}">
  73 + </div>
  74 + </div>
116 75 </div>
  76 +
  77 + <div class="flex">
  78 + <button class="button add-place-of-work-button mr-10">Сохранить</button>
  79 + <a href="{{ route('worker.cabinet') }}" class="button button_light">Назад</a>
  80 + </div>
  81 + </div>
  82 +</div>
  83 +
  84 +<div class="hide">
  85 + <div id="after_add_place_of_work_chat" class="modal-dialog">
  86 + <div class="modal-dialog-title">
  87 + <h2>Место работы успешно добавлено</h2>
  88 + </div>
  89 + <div class="modal-dialog-body pt-20"></div>
  90 + <div class="modal-dialog-footer center">
  91 + <a href="{{ route('worker.add_document', ['worker' => $worker->id]) }}" class="button remove-chat-button mr-20">Добавить еще</a>
  92 + <a href="{{ route('worker.cabinet') }}" class="button button_light" onclick="$.fancybox.close();">Закончить</a>
117 93 </div>
118   - </section>
119 94 </div>
  95 + <button class="open-after_add_place_of_work_chat-button" data-fancybox data-src="#after_add_place_of_work_chat"></button>
  96 +</div>
  97 +@endsection
  98 +
  99 +@section('scripts')
  100 + <script>
  101 + $(function(){
  102 + $('.add-place-of-work-button').click(function(){
  103 + var this_btn = $(this);
  104 + spinStart(this_btn);
  105 + var wrap = this_btn.closest('.cabinet__inputs');
  106 + var data = {};
  107 + var form_is_not_filled = false;
  108 +
  109 + wrap.find('.error-block').html('');
  110 + wrap.find('input').removeClass('border-red');
  111 +
  112 + wrap.find('input').each(function(){
  113 + var val = $(this).val().trim();
  114 +
  115 + if ($(this).is('[required]') && !val){
  116 + $(this).addClass('border-red');
  117 + form_is_not_filled = true;
  118 + }
  119 +
  120 + var name = $(this).attr('name');
  121 + data[name] = val;
  122 + });
  123 +
  124 + if (form_is_not_filled){
  125 + spinStop(this_btn);
  126 + return;
  127 + }
  128 +
  129 + $.ajax({
  130 + type: 'POST',
  131 + url: "{{ route('worker.add_document_save') }}",
  132 + data: data,
  133 + dataType: 'json',
  134 + headers: {
  135 + 'X-CSRF-TOKEN': $('[name="_token"]').val()
  136 + },
  137 + success: function(res){
  138 + spinStop(this_btn);
  139 + $('.open-after_add_place_of_work_chat-button').click();
  140 + },
  141 + error: function(jqXHR, exception){
  142 + if (jqXHR && jqXHR.responseJSON && jqXHR.responseJSON.message){
  143 + wrap.find('.error-block').html(jqXHR.responseJSON.message);
  144 + }
  145 + spinStop(this_btn);
  146 + }
  147 + });
  148 + });
  149 +
  150 +
  151 + });
  152 + </script>
120 153 @endsection
resources/views/workers/prev_company_form.blade.php
1 1 @extends('workers.cabinet_layout', ['title' => 'Рекомендация - РекаМоре'])
2 2  
3 3 @section('cabinet_content')
4   -<form id="submit_form" name="submit_form" action="{{ route('worker.add_prev_company') }}" class="cabinet__inputs" method="GET">
  4 +<h3 class="cabinet__h4 font30">Рекомендация</h3>
  5 +<div class="cabinet__inputs">
5 6 @csrf
6 7 <input type="hidden" name="worker_id" id="worker_id" class="input" value="{{ $worker->id }}">
7 8  
8   - <div class="cabinet__body-item">
9   - <div class="cabinet__anketa">
10   - <h2 class="title cabinet__title mb-0">Рекомендация</h2>
11   - </div>
12   - </div>
  9 + <div class="error-block"></div>
13 10  
14   - <div class="cabinet__body-item">
  11 + <div class="cabinet__body-item width100">
15 12 <div class="cabinet__inputs">
16 13 <div class="cabinet__inputs-item form-group">
17 14 <label class="form-group__label">Название компании:<span class="red">*</span></label>
... ... @@ -37,13 +34,82 @@
37 34 <input type="text" name="telephone2" id="telephone2" class="input" value="{{ old('telephone2') ?? '' }}">
38 35 </div>
39 36 </div>
  37 + </div>
40 38  
41   - <div class="flex">
42   - <button type="submit" class="button mr-10">Сохранить</button>
43   - <a href="{{ route('worker.cabinet') }}" class="button button_light">Отменить</a>
44   - </div>
  39 + <div class="flex">
  40 + <button class="button add-company-button mr-10">Сохранить</button>
  41 + <a href="{{ route('worker.cabinet') }}" class="button button_light">Назад</a>
45 42 </div>
46 43 </div>
  44 +</div>
  45 +
  46 +<div class="hide">
  47 + <div id="after_add_company_chat" class="modal-dialog">
  48 + <div class="modal-dialog-title">
  49 + <h2>Рекомендация успешно добавлена</h2>
  50 + </div>
  51 + <div class="modal-dialog-body pt-20"></div>
  52 + <div class="modal-dialog-footer center">
  53 + <a href="{{ route('worker.new_prev_company',['worker' => $worker->id]) }}" class="button remove-chat-button mr-20">Добавить еще</a>
  54 + <a href="{{ route('worker.cabinet') }}" class="button button_light" onclick="$.fancybox.close();">Закончить</a>
  55 + </div>
  56 + </div>
  57 + <button class="open-after_add_company_chat-button" data-fancybox data-src="#after_add_company_chat"></button>
  58 +</div>
  59 +@endsection
  60 +
  61 +@section('scripts')
  62 + <script>
  63 + $(function(){
  64 + $('.add-company-button').click(function(){
  65 + var this_btn = $(this);
  66 + spinStart(this_btn);
  67 + var wrap = this_btn.closest('.cabinet__inputs');
  68 + var data = {};
  69 + var form_is_not_filled = false;
  70 +
  71 + wrap.find('.error-block').html('');
  72 + wrap.find('input').removeClass('border-red');
  73 +
  74 + wrap.find('input').each(function(){
  75 + var val = $(this).val().trim();
  76 +
  77 + if ($(this).is('[required]') && !val){
  78 + $(this).addClass('border-red');
  79 + form_is_not_filled = true;
  80 + }
  81 +
  82 + var name = $(this).attr('name');
  83 + data[name] = val;
  84 + });
  85 +
  86 + if (form_is_not_filled){
  87 + spinStop(this_btn);
  88 + return;
  89 + }
  90 +
  91 + $.ajax({
  92 + type: 'POST',
  93 + url: "{{ route('worker.add_prev_company') }}",
  94 + data: data,
  95 + dataType: 'json',
  96 + headers: {
  97 + 'X-CSRF-TOKEN': $('[name="_token"]').val()
  98 + },
  99 + success: function(res){
  100 + spinStop(this_btn);
  101 + $('.open-after_add_company_chat-button').click();
  102 + },
  103 + error: function(jqXHR, exception){
  104 + if (jqXHR && jqXHR.responseJSON && jqXHR.responseJSON.message){
  105 + wrap.find('.error-block').html(jqXHR.responseJSON.message);
  106 + }
  107 + spinStop(this_btn);
  108 + }
  109 + });
  110 + });
  111 +
47 112  
48   -</form>
  113 + });
  114 + </script>
49 115 @endsection
resources/views/workers/sertificate_add.blade.php
... ... @@ -90,8 +90,6 @@
90 90 'X-CSRF-TOKEN': $('[name="_token"]').val()
91 91 },
92 92 success: function(res){
93   - console.log('success');
94   - console.log(res);
95 93 spinStop(this_btn);
96 94 $('.open-after_add_serificate_chat-button').click();
97 95 },
... ... @@ -542,7 +542,7 @@ Route::group([
542 542  
543 543 // Добавление предыдущих контактов компании
544 544 Route::get('кабинет/prev_company/{worker}', [WorkerController::class, 'new_prev_company'])->name('new_prev_company');
545   - Route::get('кабинет/add_prev_company', [WorkerController::class, 'add_prev_company'])->name('add_prev_company');
  545 + Route::post('кабинет/add_prev_company', [WorkerController::class, 'add_prev_company'])->name('add_prev_company');
546 546 Route::get('кабинет/edit_prev_company/{doc}/{worker}', [WorkerController::class, 'edit_prev_company'])->name('edit_prev_company');
547 547 Route::post('кабинет/update_prev_company/{doc}', [WorkerController::class, 'update_prev_company'])->name('update_prev_company');
548 548 Route::get('кабинет/delete_prev_company/{doc}', [WorkerController::class, 'delete_prev_company'])->name('delete_prev_company');