160 lines
11 KiB
PHP
Executable File
160 lines
11 KiB
PHP
Executable File
@extends('layouts.app')
|
|
|
|
@section('title', __('Profile'))
|
|
|
|
@section('content')
|
|
<div class="py-12">
|
|
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
|
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
|
|
<div class="p-6 text-gray-900">
|
|
<h2 class="text-2xl font-bold mb-6">{{ __('Profile') }}</h2>
|
|
|
|
@if(session('success'))
|
|
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded mb-4">
|
|
{{ session('success') }}
|
|
</div>
|
|
@endif
|
|
|
|
<form method="POST" action="{{ route('profile.update') }}">
|
|
@csrf
|
|
@method('PATCH')
|
|
|
|
<div class="mb-4">
|
|
<label for="name" class="block text-sm font-medium text-gray-700 mb-2">{{ __('Name') }}</label>
|
|
<input type="text" name="name" id="name" value="{{ old('name', $user->name) }}" required
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500">
|
|
</div>
|
|
|
|
<div class="mb-4">
|
|
<label for="email" class="block text-sm font-medium text-gray-700 mb-2">{{ __('Email') }}</label>
|
|
<input type="email" name="email" id="email" value="{{ old('email', $user->email) }}" required
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500">
|
|
</div>
|
|
|
|
<div class="mb-4">
|
|
<label for="phone" class="block text-sm font-medium text-gray-700 mb-2">{{ __('Phone') }}</label>
|
|
<input type="text" name="phone" id="phone" value="{{ old('phone', $user->phone) }}"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500">
|
|
</div>
|
|
|
|
<div class="mb-4">
|
|
<label for="locale" class="block text-sm font-medium text-gray-700 mb-2">{{ __('Language') }}</label>
|
|
<select name="locale" id="locale"
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500">
|
|
<option value="pt_BR" {{ old('locale', $user->locale) == 'pt_BR' ? 'selected' : '' }}>Português (Brasil)</option>
|
|
<option value="en" {{ old('locale', $user->locale) == 'en' ? 'selected' : '' }}>English</option>
|
|
<option value="es" {{ old('locale', $user->locale) == 'es' ? 'selected' : '' }}>Español</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="mb-4">
|
|
<label for="timezone" class="block text-sm font-medium text-gray-700 mb-2">{{ __('Timezone') }}</label>
|
|
<p class="text-xs text-gray-500 mb-2">{{ __('Your local timezone for scheduling insights correctly.') }}</p>
|
|
<select name="timezone" id="timezone" required
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500">
|
|
@php
|
|
$selectedTimezone = old('timezone', $user->timezone ?? 'America/Sao_Paulo');
|
|
$timezones = [
|
|
'America/Sao_Paulo' => '🇧🇷 São Paulo (GMT-3)',
|
|
'America/New_York' => '🇺🇸 New York (GMT-5)',
|
|
'America/Chicago' => '🇺🇸 Chicago (GMT-6)',
|
|
'America/Denver' => '🇺🇸 Denver (GMT-7)',
|
|
'America/Los_Angeles' => '🇺🇸 Los Angeles (GMT-8)',
|
|
'Europe/London' => '🇬🇧 London (GMT+0)',
|
|
'Europe/Madrid' => '🇪🇸 Madrid (GMT+1)',
|
|
'Europe/Berlin' => '🇩🇪 Berlin (GMT+1)',
|
|
'Europe/Paris' => '🇫🇷 Paris (GMT+1)',
|
|
'Asia/Tokyo' => '🇯🇵 Tokyo (GMT+9)',
|
|
'Asia/Shanghai' => '🇨🇳 Shanghai (GMT+8)',
|
|
'Asia/Dubai' => '🇦🇪 Dubai (GMT+4)',
|
|
'Australia/Sydney' => '🇦🇺 Sydney (GMT+11)',
|
|
'Pacific/Auckland' => '🇳🇿 Auckland (GMT+12)',
|
|
'UTC' => '🌐 UTC',
|
|
];
|
|
@endphp
|
|
@foreach($timezones as $value => $label)
|
|
<option value="{{ $value }}" {{ $selectedTimezone == $value ? 'selected' : '' }}>{{ $label }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
|
|
<div class="mt-8 pt-8 border-t border-gray-200">
|
|
<h3 class="text-xl font-semibold mb-4">{{ __('Update Password') }}</h3>
|
|
<p class="text-sm text-gray-500 mb-4">{{ __('Leave blank to keep current password') }}</p>
|
|
|
|
<div class="mb-4">
|
|
<label for="password" class="block text-sm font-medium text-gray-700 mb-2">{{ __('New Password') }}</label>
|
|
<div class="relative">
|
|
<input type="password" name="password" id="password"
|
|
class="w-full px-3 py-2 pr-10 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500">
|
|
<button type="button" onclick="togglePassword('password', this)" class="absolute inset-y-0 right-0 pr-3 flex items-center text-gray-400 hover:text-gray-600">
|
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>
|
|
</button>
|
|
</div>
|
|
@error('password')
|
|
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
|
|
<div class="mb-4">
|
|
<label for="password_confirmation" class="block text-sm font-medium text-gray-700 mb-2">{{ __('Confirm New Password') }}</label>
|
|
<div class="relative">
|
|
<input type="password" name="password_confirmation" id="password_confirmation"
|
|
class="w-full px-3 py-2 pr-10 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500">
|
|
<button type="button" onclick="togglePassword('password_confirmation', this)" class="absolute inset-y-0 right-0 pr-3 flex items-center text-gray-400 hover:text-gray-600">
|
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>
|
|
</button>
|
|
</div>
|
|
@error('password_confirmation')
|
|
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
|
|
@enderror
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex gap-2">
|
|
<button type="submit" class="px-4 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700">
|
|
{{ __('Update Profile') }}
|
|
</button>
|
|
</div>
|
|
</form>
|
|
|
|
<div class="mt-8 pt-8 border-t border-gray-200">
|
|
<h3 class="text-xl font-semibold mb-4 text-red-600">{{ __('Delete Account') }}</h3>
|
|
<p class="text-gray-600 mb-4">{{ __('Once your account is deleted, all of its resources and data will be permanently deleted.') }}</p>
|
|
|
|
<form method="POST" action="{{ route('profile.destroy') }}" onsubmit="return confirm('{{ __('Are you sure?') }}')">
|
|
@csrf
|
|
@method('DELETE')
|
|
|
|
<div class="mb-4">
|
|
<label for="password" class="block text-sm font-medium text-gray-700 mb-2">{{ __('Password') }}</label>
|
|
<input type="password" name="password" id="password" required
|
|
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-red-500">
|
|
</div>
|
|
|
|
<button type="submit" class="px-4 py-2 bg-red-600 text-white rounded-md hover:bg-red-700">
|
|
{{ __('Delete Account') }}
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
|
|
@push('scripts')
|
|
<script>
|
|
function togglePassword(fieldId, btn) {
|
|
var input = document.getElementById(fieldId);
|
|
if (input.type === 'password') {
|
|
input.type = 'text';
|
|
btn.innerHTML = '<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"/></svg>';
|
|
} else {
|
|
input.type = 'password';
|
|
btn.innerHTML = '<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>';
|
|
}
|
|
}
|
|
</script>
|
|
@endpush
|