update-profile-information-form.blade.php 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <x-jet-form-section submit="updateProfileInformation">
  2. <x-slot name="title">
  3. {{ __('Profile Information') }}
  4. </x-slot>
  5. <x-slot name="description">
  6. {{ __('Update your account\'s profile information and email address.') }}
  7. </x-slot>
  8. <x-slot name="form">
  9. <!-- Profile Photo -->
  10. @if (Laravel\Jetstream\Jetstream::managesProfilePhotos())
  11. <div x-data="{photoName: null, photoPreview: null}" class="col-span-6 sm:col-span-4">
  12. <!-- Profile Photo File Input -->
  13. <input type="file" class="hidden"
  14. wire:model="photo"
  15. x-ref="photo"
  16. x-on:change="
  17. photoName = $refs.photo.files[0].name;
  18. const reader = new FileReader();
  19. reader.onload = (e) => {
  20. photoPreview = e.target.result;
  21. };
  22. reader.readAsDataURL($refs.photo.files[0]);
  23. " />
  24. <x-jet-label for="photo" value="{{ __('Photo') }}" />
  25. <!-- Current Profile Photo -->
  26. <div class="mt-2" x-show="! photoPreview">
  27. <img src="{{ $this->user->profile_photo_url }}" alt="{{ $this->user->name }}" class="rounded-full h-20 w-20 object-cover">
  28. </div>
  29. <!-- New Profile Photo Preview -->
  30. <div class="mt-2" x-show="photoPreview">
  31. <span class="block rounded-full w-20 h-20"
  32. x-bind:style="'background-size: cover; background-repeat: no-repeat; background-position: center center; background-image: url(\'' + photoPreview + '\');'">
  33. </span>
  34. </div>
  35. <x-jet-secondary-button class="mt-2 mr-2" type="button" x-on:click.prevent="$refs.photo.click()">
  36. {{ __('Select A New Photo') }}
  37. </x-jet-secondary-button>
  38. @if ($this->user->profile_photo_path)
  39. <x-jet-secondary-button type="button" class="mt-2" wire:click="deleteProfilePhoto">
  40. {{ __('Remove Photo') }}
  41. </x-jet-secondary-button>
  42. @endif
  43. <x-jet-input-error for="photo" class="mt-2" />
  44. </div>
  45. @endif
  46. <!-- Name -->
  47. <div class="col-span-6 sm:col-span-4">
  48. <x-jet-label for="name" value="{{ __('Name') }}" />
  49. <x-jet-input id="name" type="text" class="mt-1 block w-full" wire:model.defer="state.name" autocomplete="name" />
  50. <x-jet-input-error for="name" class="mt-2" />
  51. </div>
  52. <!-- Email -->
  53. <div class="col-span-6 sm:col-span-4">
  54. <x-jet-label for="email" value="{{ __('Email') }}" />
  55. <x-jet-input id="email" type="email" class="mt-1 block w-full" wire:model.defer="state.email" />
  56. <x-jet-input-error for="email" class="mt-2" />
  57. </div>
  58. </x-slot>
  59. <x-slot name="actions">
  60. <x-jet-action-message class="mr-3" on="saved">
  61. {{ __('Saved.') }}
  62. </x-jet-action-message>
  63. <x-jet-button wire:loading.attr="disabled" wire:target="photo">
  64. {{ __('Save') }}
  65. </x-jet-button>
  66. </x-slot>
  67. </x-jet-form-section>