Recaje-New/resources/views/profile/index.blade.php

113 lines
8.2 KiB
PHP

@extends('layouts.app')
@section('title', ' - Profil dan Pengaturan')
@section('content')
<div class="bg-gradient-to-b from-blue-50 to-white dark:from-gray-900 dark:to-gray-800 min-h-screen py-12">
<div class="max-w-5xl mx-auto px-4 sm:px-6">
@if(session('success'))
<div class="mb-8 bg-green-100 border-l-4 border-green-500 text-green-700 p-4 rounded-md shadow-md" role="alert">
<div class="flex items-center">
<svg class="h-5 w-5 mr-2 text-green-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />
</svg>
<span class="font-medium">{{ session('success') }}</span>
</div>
</div>
@endif
<div class="bg-white dark:bg-gray-800 rounded-xl shadow-xl overflow-hidden rounded-lg mt-4">
<div class="bg-gradient-to-r from-blue-600 to-purple-600 px-6 py-8 rounded-lg">
<div class="flex flex-col md:flex-row items-center justify-between">
<div class="flex flex-col md:flex-row items-center">
<div class="w-24 h-24 bg-white dark:bg-gray-700 rounded-full flex items-center justify-center shadow-lg mb-4 md:mb-0 border-4 border-white">
<svg xmlns="http://www.w3.org/2000/svg" class="h-12 w-12 text-blue-600 dark:text-blue-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />
</svg>
</div>
<div class="md:ml-6 text-center md:text-left">
<h1 class="text-2xl font-bold text-gray-800 dark:text-white">{{ Auth::user()->name }}</h1>
<p class="text-gray-800 dark:text-white">{{ Auth::user()->email }}</p>
<p class="mt-1 text-sm text-gray-800 dark:text-white">Bergabung: {{ Auth::user()->created_at->format('d F Y') }}</p>
</div>
</div>
</div>
</div>
<!-- Profile Content -->
<div class="p-6 mb-8">
<div class="max-w-3xl mx-auto">
<h2 class="text-xl font-semibold text-gray-800 dark:text-white mb-6 text-center">Edit Informasi Profil</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-8">
<!-- Form untuk informasi profil (kiri) -->
<div class="md:col-span-2">
<form action="{{ route('profile.update') }}" method="POST" class="space-y-6">
@csrf
@method('PUT')
<div>
<label for="name" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Nama Lengkap</label>
<input type="text" name="name" id="name" value="{{ Auth::user()->name }}" class="w-full px-4 py-3 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white shadow-sm transition-colors" required>
@error('name')
<p class="text-red-500 text-xs mt-1">{{ $message }}</p>
@enderror
</div>
<div>
<label for="email" class="block text-sm font-medium text-gray-500 dark:text-gray-400 mb-1">Alamat Email</label>
<input type="email" name="email" id="email" value="{{ Auth::user()->email }}" class="w-full px-4 py-3 border border-gray-200 dark:border-gray-700 rounded-lg bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 cursor-not-allowed" disabled>
</div>
<div class="flex justify-end">
<button type="submit" class="w-full px-4 py-3 bg-gradient-to-r from-blue-500 to-purple-600 text-white font-medium rounded-lg hover:from-blue-600 hover:to-purple-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-all duration-200 shadow-md flex items-center justify-center">
<svg class="w-5 h-5 mr-1.5" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
</svg>
Simpan Perubahan
</button>
</div>
</form>
</div>
<!-- Form untuk password (kanan) -->
<div class="md:col-span-1">
<form action="{{ route('profile.update-password') }}" method="POST" class="space-y-4">
@csrf
@method('PUT')
<div>
<label for="current_password" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Password Saat Ini</label>
<input type="password" name="current_password" id="current_password" class="w-full px-4 py-3 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white shadow-sm transition-colors mb-6" required>
@error('current_password')
<p class="text-red-500 text-xs mt-1">{{ $message }}</p>
@enderror
</div>
<div>
<label for="password" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Password Baru</label>
<input type="password" name="password" id="password" class="w-full px-4 py-3 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white shadow-sm transition-colors mb-6" required>
@error('password')
<p class="text-red-500 text-xs mt-1">{{ $message }}</p>
@enderror
</div>
<div class="pt-2">
<button type="submit" class="w-full px-4 py-3 bg-gradient-to-r from-blue-500 to-purple-600 text-white font-medium rounded-lg hover:from-blue-600 hover:to-purple-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-all duration-200 shadow-md flex items-center justify-center">
<svg class="w-5 h-5 mr-1.5" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"></path>
</svg>
Update Password
</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection