profile.blade.php 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. @extends('layouts.app', ['title' => 'Профиль', 'experience' => $user->experience])
  2. @section('content')
  3. <div class="px-3 col-xxl-8 offset-xxl-1">
  4. <form action="{{ route('profile.store') }}" method="post">
  5. @csrf
  6. @include('partials.input', ['name' => 'email', 'title' => 'E-mail', 'disabled' => true, 'value' => $user->email])
  7. @include('partials.input', ['name' => 'name', 'title' => 'Имя', 'required' => true, 'value' => $user->name])
  8. @include('partials.input', ['name' => 'surname', 'title' => 'Фамилия', 'value' => $user->surname])
  9. @include('partials.avatars', ['user' => auth()->user()])
  10. @include('partials.color', ['name' => 'bg_color', 'title' => 'Фон', 'value' => $user->bg_color ?? '#55def7'])
  11. @if(auth()->user()->experience > $max_subscribe_experience)
  12. <div class="visually-hidden">
  13. @include('partials.input', ['name' => 'e_mail', 'title' => 'E-mail', 'value' => $user->email])
  14. </div>
  15. @include('partials.input', ['name' => 'subscribe', 'title' => 'Подпись', 'value' => $user->subscribe ?? '', 'datalist' => $subscribes->pluck('caption')])
  16. @else
  17. @include('partials.select', ['name' => 'subscribe', 'title' => 'Подпись', 'options' => $subscribes->pluck('caption', 'caption')->toArray(), 'value' => $user->subscribe ?? ''])
  18. @endif
  19. @include('partials.input', ['name' => 'role', 'title' => 'Роли', 'disabled' => true, 'value' => implode(', ', $user->roles->pluck('title')->toArray())])
  20. <div class="my-2">
  21. <div class="row">
  22. <div class="col-md-4 text-md-end mt-1 fw-bold pe-3">Уведомления</div>
  23. <div class="col-md-8 mt-1 fst-italic">Выберите типы уведомлений, которые будем присылать вам на E-mail</div>
  24. </div>
  25. @foreach($notification_types as $type_id => $t)
  26. @include('partials.checkbox', ['name' => 'types[]', 'title' => $t, 'value' => $type_id, 'checked' => in_array($type_id, auth()->user()->notification_types->pluck('id')->toArray())])
  27. @endforeach
  28. </div>
  29. <div class="row pwd-change-link mb-3">
  30. <div class="offset-md-4">
  31. <a onclick="$('.pwg-change').removeClass('d-none'); $('.pwd-change-link').addClass('d-none');" class="text-info" href="#">Сменить пароль</a>
  32. </div>
  33. </div>
  34. <div class="pwg-change d-none">
  35. @include('partials.input', ['name' => 'current_password', 'type' => 'password', 'title' => 'Текущий пароль'])
  36. @include('partials.input', ['name' => 'password', 'type' => 'password', 'title' => 'Новый пароль'])
  37. @include('partials.input', ['name' => 'password_confirmation', 'type' => 'password', 'title' => 'Подтверждение пароля'])
  38. </div>
  39. @include('partials.submit', [''])
  40. <a href="#" class="btn btn-outline-info my-3 d-inline-block d-md-none" onclick="$('#logout').submit();">Выход</a>
  41. </form>
  42. </div>
  43. @endsection
  44. @push('scripts')
  45. <script type="module">
  46. $('#subscribe').on('keyup', function (){
  47. if($(this).val() === '') {
  48. $('#dl-subscribe').attr('open', 'open');
  49. }
  50. });
  51. </script>
  52. @endpush