Commit bc10647766586acdc1984cf507ddb0231622b623

Authored by Андрей Ларионов
Exists in master

Merge branch 'master' of http://gitlab.nologostudio.ru/alarionov/rekamore-su

Showing 9 changed files Side-by-side Diff

app/Http/Controllers/WorkerController.php
... ... @@ -874,9 +874,10 @@ class WorkerController extends Controller
874 874  
875 875 $Sertificate = new sertification();
876 876 $Sertificate->create($params);
877   - $Docs = sertification::query()->where('worker_id', $request->get('worker_id'))->get();
878   - return redirect()->route('worker.cabinet');
879   - //return view('ajax.documents', compact('Docs'));
  877 +
  878 + return response()->json([
  879 + 'success' => true
  880 + ]);
880 881 }
881 882  
882 883 // Удалить сертификат
public/css/helpers.css
... ... @@ -902,4 +902,8 @@
902 902 box-shadow: 0px 0px 8px 1px rgba(66, 68, 90, 1);
903 903 }
904 904  
  905 +.border-red{
  906 + border-color: red;
  907 +}
  908 +
905 909 /*# sourceMappingURL=helpers.css.map */
public/css/style_may2024.css
... ... @@ -6760,7 +6760,7 @@ main + .news {
6760 6760 border-radius: 8px;
6761 6761 border: 1px solid #e7e7e7;
6762 6762 background: linear-gradient(95deg, #f2f5fc 59.82%, #ebf2fc 99.99%);
6763   - padding: 10px;
  6763 + padding: 0px;
6764 6764 font-size: 12px;
6765 6765 display: flex;
6766 6766 justify-content: space-between;
... ... @@ -6768,7 +6768,6 @@ main + .news {
6768 6768 }
6769 6769 @media (min-width: 768px) {
6770 6770 .messages__item {
6771   - padding: 20px;
6772 6771 font-size: 18px;
6773 6772 }
6774 6773 }
... ... @@ -6780,6 +6779,7 @@ main + .news {
6780 6779 -ms-flex-align: center;
6781 6780 align-items: center;
6782 6781 width: calc(100% - 90px);
  6782 + padding: 20px;
6783 6783 }
6784 6784 @media (min-width: 768px) {
6785 6785 .messages__item-info {
... ... @@ -6848,7 +6848,7 @@ main + .news {
6848 6848 color: #000;
6849 6849 }
6850 6850 .messages__item-actions{
6851   -
  6851 + padding: 20px;
6852 6852 }
6853 6853 .messages__item-buttons{
6854 6854 float: right;
... ... @@ -7074,7 +7074,6 @@ main + .news {
7074 7074 }
7075 7075 @media (min-width: 768px) {
7076 7076 .chatbox__toper {
7077   - padding: 20px;
7078 7077 -webkit-box-orient: horizontal;
7079 7078 -webkit-box-direction: normal;
7080 7079 -ms-flex-direction: row;
... ... @@ -9303,6 +9302,10 @@ body .cke_notifications_area{
9303 9302 display: flex;
9304 9303 justify-content: space-between;
9305 9304 }
  9305 +.modal-dialog .modal-dialog-footer.center{
  9306 + display: flex;
  9307 + justify-content: center;
  9308 +}
9306 9309  
9307 9310 .button-loader {
9308 9311 border: 2px solid #f3f3f3;
... ... @@ -9317,3 +9320,8 @@ body .cke_notifications_area{
9317 9320 0% { transform: rotate(0deg); }
9318 9321 100% { transform: rotate(360deg); }
9319 9322 }
  9323 +.error-block{
  9324 + color:red;
  9325 + padding: 0;
  9326 + width: 100%;
  9327 +}
resources/views/chats/chats_list.blade.php
... ... @@ -2,35 +2,31 @@
2 2 @csrf
3 3 @foreach($chats as $chat)
4 4 <div class="messages__item hover-shadow {{ intval($chat->is_fixed) == 1 ? 'chat-fixed' : '' }}">
5   - <div class="messages__item-info">
  5 + <a class="messages__item-info" href="{{ route($user_type . '.dialog', ['user1' => $chat->user_id, 'user2' => $chat->to_user_id, 'ad_employer' => 0]) }}">
6 6 <div class="messages__item-photo">
7   - <a class="" href="{{ route($user_type . '.dialog', ['user1' => $chat->user_id, 'user2' => $chat->to_user_id, 'ad_employer' => 0]) }}">
8   - @if (isset($chat->employer->logo))
9   - <img src="{{ asset(Storage::url($chat->employer->logo)) }}" alt="">
10   - @elseif(isset($chat->worker->photo))
11   - <img src="{{ asset(Storage::url($chat->worker->photo)) }}" alt="">
12   - @else
13   - <img src="{{ asset('images/default_man.jpg') }}" alt="">
14   - @endif
15   - </a>
  7 + @if (isset($chat->employer->logo))
  8 + <img src="{{ asset(Storage::url($chat->employer->logo)) }}" alt="">
  9 + @elseif(isset($chat->worker->photo))
  10 + <img src="{{ asset(Storage::url($chat->worker->photo)) }}" alt="">
  11 + @else
  12 + <img src="{{ asset('images/default_man.jpg') }}" alt="">
  13 + @endif
16 14 </div>
17 15 <div class="messages__item-text">
18 16 <div>
19   - <a class="messages__item-target" href="{{ route($user_type . '.dialog', ['user1' => $chat->user_id, 'user2' => $chat->to_user_id, 'ad_employer' => 0]) }}">
20   - <b>
21   - @if ($chat->employer && $chat->employer->name_company)
22   - {{ $chat->employer->name_company }}
23   - @else
24   - {{ $chat->user->surname . ' ' . $chat->user->name_man . ' ' . $chat->user->surname2 }}
25   - @endif
26   - </b>
27   - </a>
  17 + <b>
  18 + @if ($chat->employer && $chat->employer->name_company)
  19 + {{ $chat->employer->name_company }}
  20 + @else
  21 + {{ $chat->user->surname . ' ' . $chat->user->name_man . ' ' . $chat->user->surname2 }}
  22 + @endif
  23 + </b>
28 24 </div>
29 25 <div>
30 26 {{ $chat->last_message->text }}
31 27 </div>
32 28 </div>
33   - </div>
  29 + </a>
34 30  
35 31 <div class="messages__item-actions" data-chat-id="{{ $chat->id }}">
36 32 <div class="messages__item-date max-content">{{ date(' H:i, d.m.Y', strtotime($chat->created_at)) }}</div>
resources/views/employers/dialog.blade.php
... ... @@ -99,7 +99,7 @@
99 99 <svg>
100 100 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use>
101 101 </svg>
102   - Перейти в резюме
  102 + Перейти в профиль
103 103 </a>
104 104 @endif
105 105 @else
... ... @@ -125,7 +125,7 @@
125 125 <svg>
126 126 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use>
127 127 </svg>
128   - Перейти в резюме
  128 + Перейти в профиль
129 129 </a>
130 130 @endif
131 131 @endif
resources/views/modals/chats/remove_chat.blade.php
1   -<div id="remove_chat" class="modal-dialog">
2   - <div class="modal-dialog-title">
3   - <h2>Удалить чат</h2>
4   - </div>
5   - <div class="modal-dialog-body">
6   - <p>Вы действительно хотите удалить час с "<b><span class="target-chat"></span></b>"?</p>
7   - </div>
8   - <div class="modal-dialog-footer">
9   - <button type="button" class="button remove-chat-button">Удалить</button>
10   - <button type="button" class="button button_light" onclick="$.fancybox.close();">Закрыть</button>
  1 +<div class="hide">
  2 + <div id="remove_chat" class="modal-dialog">
  3 + <div class="modal-dialog-title">
  4 + <h2>Удалить чат</h2>
  5 + </div>
  6 + <div class="modal-dialog-body">
  7 + <p>Вы действительно хотите удалить час с "<b><span class="target-chat"></span></b>"?</p>
  8 + </div>
  9 + <div class="modal-dialog-footer">
  10 + <button type="button" class="button remove-chat-button">Удалить</button>
  11 + <button type="button" class="button button_light" onclick="$.fancybox.close();">Закрыть</button>
  12 + </div>
11 13 </div>
12 14 </div>
13 15  
resources/views/workers/dialog.blade.php
... ... @@ -96,7 +96,7 @@
96 96 <svg>
97 97 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use>
98 98 </svg>
99   - Перейти в резюме
  99 + Перейти в профиль
100 100 </a>
101 101 @endif
102 102 @else
... ... @@ -122,7 +122,7 @@
122 122 <svg>
123 123 <use xlink:href="{{ asset('images/sprite.svg#cabinet-1') }}"></use>
124 124 </svg>
125   - Перейти в резюме
  125 + Перейти в профиль
126 126 </a>
127 127 @endif
128 128 @endif
resources/views/workers/sertificate_add.blade.php
... ... @@ -2,10 +2,12 @@
2 2  
3 3 @section('cabinet_content')
4 4 <h3 class="cabinet__h4 font30">Сертификат / документ</h3>
5   -<form id="submit_form" name="submit_form" action="{{ route('worker.add_serificate') }}" class="cabinet__inputs" method="GET">
  5 +<div class="cabinet__inputs">
6 6 @csrf
7 7 <input type="hidden" name="worker_id" id="worker_id" class="input" value="{{ $worker->id }}">
8 8  
  9 + <div class="error-block"></div>
  10 +
9 11 <div class="cabinet__body-item width100">
10 12 <div class="cabinet__inputs">
11 13 <div class="cabinet__inputs-item form-group">
... ... @@ -29,9 +31,80 @@
29 31 </div>
30 32  
31 33 <div class="flex">
32   - <button type="submit" class="button mr-10">Сохранить</button>
33   - <a href="{{ route('worker.cabinet') }}" class="button button_light">Отменить</a>
  34 + <button class="button add-serificate-button mr-10">Сохранить</button>
  35 + <a href="{{ route('worker.cabinet') }}" class="button button_light">Назад</a>
  36 + </div>
  37 + </div>
  38 +</div>
  39 +
  40 +<div class="hide">
  41 + <div id="after_add_serificate_chat" class="modal-dialog">
  42 + <div class="modal-dialog-title">
  43 + <h2>Сертификат / документ успешно добавлен</h2>
  44 + </div>
  45 + <div class="modal-dialog-body pt-20"></div>
  46 + <div class="modal-dialog-footer center">
  47 + <a href="{{ route('worker.new_sertificate',['worker' => $worker->id]) }}" class="button remove-chat-button mr-20">Добавить еще</a>
  48 + <a href="{{ route('worker.cabinet') }}" class="button button_light" onclick="$.fancybox.close();">Закончить</a>
34 49 </div>
35 50 </div>
36   -</form>
  51 + <button class="open-after_add_serificate_chat-button" data-fancybox data-src="#after_add_serificate_chat"></button>
  52 +</div>
  53 +@endsection
  54 +
  55 +@section('scripts')
  56 + <script>
  57 + $(function(){
  58 + $('.add-serificate-button').click(function(){
  59 + var this_btn = $(this);
  60 + spinStart(this_btn);
  61 + var wrap = this_btn.closest('.cabinet__inputs');
  62 + var name = wrap.find('[name="name"]').val();
  63 + var end_date = wrap.find('[name="end_begin"]').val();
  64 + var worker_id = wrap.find('[name="worker_id"]').val();
  65 +
  66 + wrap.find('.error-block').html('');
  67 + wrap.find('input').removeClass('border-red');
  68 +
  69 + if (!name) {
  70 + wrap.find('[name="name"]').addClass('border-red');
  71 + spinStop(this_btn);
  72 + return;
  73 + }
  74 + if (!end_date) {
  75 + wrap.find('[name="end_begin"]').addClass('border-red');
  76 + spinStop(this_btn);
  77 + return;
  78 + }
  79 +
  80 + $.ajax({
  81 + type: 'POST',
  82 + url: "{{ route('worker.add_serificate') }}",
  83 + data: {
  84 + worker_id: worker_id,
  85 + name: name,
  86 + end_begin: end_date
  87 + },
  88 + dataType: 'json',
  89 + headers: {
  90 + 'X-CSRF-TOKEN': $('[name="_token"]').val()
  91 + },
  92 + success: function(res){
  93 + console.log('success');
  94 + console.log(res);
  95 + spinStop(this_btn);
  96 + $('.open-after_add_serificate_chat-button').click();
  97 + },
  98 + error: function(jqXHR, exception){
  99 + if (jqXHR && jqXHR.responseJSON && jqXHR.responseJSON.message){
  100 + wrap.find('.error-block').html(jqXHR.responseJSON.message);
  101 + }
  102 + spinStop(this_btn);
  103 + }
  104 + });
  105 + });
  106 +
  107 +
  108 + });
  109 + </script>
37 110 @endsection
... ... @@ -535,7 +535,7 @@ Route::group([
535 535  
536 536 // Добавление сертификата
537 537 Route::get('кабинет/new_sertificate/{worker}', [WorkerController::class, 'new_sertificate'])->name('new_sertificate');
538   - Route::get('кабинет/add_sertificate', [WorkerController::class, 'add_serificate'])->name('add_serificate');
  538 + Route::post('кабинет/add_sertificate', [WorkerController::class, 'add_serificate'])->name('add_serificate');
539 539 Route::get('кабинет/edit_sertificate/{worker}/{doc}', [WorkerController::class, 'edit_sertificate'])->name('edit_sertificate');
540 540 Route::get('кабинет/edit_sertificate/{doc}', [WorkerController::class, 'update_serificate'])->name('update_serificate');
541 541 Route::get('кабинет/delete_sertificate/{doc}', [WorkerController::class, 'delete_sertificate'])->name('delete_sertificate');