update final

This commit is contained in:
ericko-cyber 2025-05-18 00:40:08 +07:00
parent b6f071cd4c
commit 9edc876fca
10 changed files with 764 additions and 467 deletions

View File

@ -12,20 +12,42 @@ public function index()
{
// Get the authenticated user details
$account = Auth::user();
// Return the profile view with the authenticated user details
return view('layouts.profile', ['account' => $account]);
}
public function updatePassword(Request $request)
{
$request->validate([
'passupdate' => 'required|string|min:8',
]);
$user = auth()->user();
$user->password = Hash::make($request->passupdate);
$user->save();
return back()->with('success', 'Password berhasil diperbarui.');
}
}
public function updateProfile(Request $request)
{
$request->validate([
'username' => 'required|string|max:255',
'email' => 'required|string|email|max:255',
'umur' => 'nullable|numeric',
'telp' => 'nullable|string|max:15',
'alamat' => 'nullable|string',
]);
$user = auth()->user();
$user->username = $request->username;
$user->email = $request->email;
$user->umur = $request->umur;
$user->telp = $request->telp;
$user->alamat = $request->alamat;
$user->save();
return back()->with('success', 'Profile berhasil diperbarui.');
}
}

BIN
public/bawang.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View File

View File

@ -7,7 +7,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="Sistem Pakar" />
<meta name="author" content="Nama Author" />
<title>@yield('title', 'Sistem Pakar')</title>
<link rel="icon" href="{{ asset('bawang.ico') }}" type="image/x-icon">
<title>@yield('title', 'ShallotDetect')</title>
<!-- CSS -->
<link href="https://cdn.jsdelivr.net/npm/simple-datatables@7.1.2/dist/style.min.css" rel="stylesheet" />
@ -17,7 +18,7 @@
<body class="sb-nav-fixed">
<!-- Navbar -->
<div id="layoutSidenav">
<!-- Sidebar -->

View File

@ -1,12 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,minimum-scale=1">
<title>@yield('title', 'Login System')</title>
<link href="{{ asset('assets/css/app.css') }}" rel="stylesheet" type="text/css">
</head>
<body>
@yield('content')
</body>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,minimum-scale=1">
<title>@yield('title', 'Login System')</title>
<link href="{{ asset('assets/css/app.css') }}" rel="stylesheet" type="text/css">
<link rel="icon" href="{{ asset('bawang.ico') }}" type="image/x-icon">
</head>
<body>
@yield('content')
</body>
</html>

View File

@ -11,6 +11,7 @@
<base href="{{ url('/') }}/">
<!-- Bootstrap core CSS -->
<link href="{{ asset('vendor/bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<link rel="icon" href="{{ asset('bawang.ico') }}" type="image/x-icon">
<!-- Additional CSS Files -->
<link rel="stylesheet" href="{{ asset('assets/css/fontawesome.css') }}">
@ -19,46 +20,9 @@
<link rel="stylesheet" href="{{ asset('assets/css/owl.css') }}">
<style>
.main-red-button {
margin-right: 10px;
/* Memberikan jarak kanan antar tombol */
}
.popup-box h2 {
margin-bottom: 20px !important;
font-weight: 600 !important;
}
.popup-box p {
font-size: 17px !important;
font-weight: 400 !important;
margin-bottom: 5px;
}
/* Tombol untuk membuka popup */
.btn-open-popup {
padding: 12px 24px;
font-size: 18px;
background-color: green;
color: #fff;
border: none;
border-radius: 8px;
cursor: pointer;
transition: background-color 0.3s ease;
position: fixed;
top: 20px;
right: 20px;
}
.btn-open-popup:hover {
background-color: #4caf50;
}
/* Overlay untuk popup */
.overlay-container {
/* Bungkus semua selector popup profile di dalam .popup-overlay */
.popup-overlay .overlay-container {
display: none;
/* Awalnya tersembunyi */
position: fixed;
top: 0;
left: 0;
@ -67,79 +31,23 @@
background: rgba(0, 0, 0, 0.6);
justify-content: center;
align-items: center;
opacity: 0;
transition: opacity 0.3s ease;
z-index: 9999;
/* Pastikan di atas elemen lain */
}
/* Popup aktif */
.popup-overlay .overlay-container.show {
display: flex;
}
/* Kotak popup */
.popup-box {
.popup-overlay .popup-box {
background: #fff;
padding: 24px;
padding: 20px;
border-radius: 12px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
width: 320px;
text-align: center;
opacity: 0;
transform: scale(0.8);
animation: fadeInUp 0.5s ease-out forwards;
z-index: 10000;
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
max-width: 90%;
position: relative;
}
/* Form di dalam popup */
.form-container {
display: flex;
flex-direction: column;
gap: 10px;
}
/* Label input */
.form-label {
font-size: 16px;
color: #444;
text-align: left;
}
/* Input field */
.form-input {
padding: 10px;
border: 1px solid #ccc;
border-radius: 8px;
font-size: 16px;
width: 100%;
box-sizing: border-box;
}
/* Tombol Submit dan Close */
.btn-submit,
.btn-close-popup {
padding: 12px 24px;
border: none;
border-radius: 8px;
cursor: pointer;
transition: background-color 0.3s ease;
width: 100%;
}
.btn-submit {
background-color: green;
color: #fff;
}
.btn-submit:hover {
background-color: #4caf50;
}
.btn-close-popup {
margin-top: 12px;
background-color: #e74c3c;
color: #fff;
}
.btn-close-popup:hover {
background-color: #c0392b;
animation: fadeInUp 0.3s ease-out forwards;
}
/* Animasi untuk fade-in popup */
@ -155,15 +63,168 @@
}
}
/* Overlay aktif */
.overlay-container.show {
.popup-overlay .popup-box h2 {
margin-bottom: 15px;
font-weight: 600;
color: #fe3f40;
text-align: center;
}
/* Tab navigation styles */
.popup-overlay .tab-navigation {
display: flex;
opacity: 1;
margin-bottom: 15px;
border-bottom: 1px solid #ddd;
}
.popup-overlay .tab-button {
flex: 1;
padding: 8px 12px;
background: #f8f8f8;
border: none;
border-radius: 8px 8px 0 0;
cursor: pointer;
font-weight: 500;
transition: all 0.2s ease;
color: #555;
}
.popup-overlay .tab-button:hover {
background: #f0f0f0;
}
.popup-overlay .tab-button.active {
background: #fe3f40;
color: white;
}
/* Tab content styles */
.popup-overlay .tab-content {
display: none;
}
.popup-overlay .tab-content.active {
display: block;
}
/* Form container */
.popup-overlay .form-container {
display: flex;
flex-direction: column;
gap: 12px;
}
/* Form layout improvements */
.popup-overlay .form-row {
display: flex;
gap: 10px;
}
.popup-overlay .form-group {
flex: 1;
display: flex;
flex-direction: column;
gap: 5px;
}
/* Label and input styling */
.popup-overlay .form-label {
font-size: 14px;
color: #444;
font-weight: 500;
}
.popup-overlay .form-input {
padding: 8px 10px;
border: 1px solid #ddd;
border-radius: 6px;
font-size: 14px;
transition: border-color 0.2s;
}
.popup-overlay .form-input:focus {
border-color: #fe3f40;
outline: none;
box-shadow: 0 0 0 2px rgba(254, 63, 64, 0.1);
}
.popup-overlay textarea.form-input {
resize: vertical;
min-height: 60px;
}
/* Button styling */
.popup-overlay .btn-submit,
.popup-overlay .btn-close-popup {
padding: 10px;
border: none;
border-radius: 6px;
cursor: pointer;
font-weight: 500;
transition: all 0.2s ease;
margin-top: 5px;
}
.popup-overlay .btn-submit {
background-color: #fe3f40;
color: white;
}
.popup-overlay .btn-submit:hover {
background-color: #e53638;
}
.popup-overlay .btn-close-popup {
background-color: #f2f2f2;
color: #333;
margin-top: 10px;
}
.popup-overlay .btn-close-popup:hover {
background-color: #e8e8e8;
}
/* Success notification */
.popup-overlay .notification {
position: fixed;
top: 80px;
right: 20px;
background: #4CAF50;
color: white;
padding: 12px 20px;
border-radius: 6px;
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
z-index: 10001;
animation: slideIn 0.3s ease-out forwards;
}
@keyframes slideIn {
from {
opacity: 0;
transform: translateX(50px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
/* Responsive adjustments */
@media (max-width: 480px) {
.popup-overlay .form-row {
flex-direction: column;
gap: 12px;
}
.popup-overlay .popup-box {
width: 85%;
padding: 15px;
}
}
</style>
</head>
@stack('scripts')
<body>
@ -174,7 +235,9 @@
<nav class="main-nav">
<!-- ***** Logo Start ***** -->
<a href="index.html" class="logo">
<h4>Sistem<span>Pakar</span></h4>
<a href="" class="logo">
<h4>Shallot<span>Detect</span></h4>
</a>
</a>
<!-- ***** Logo End ***** -->
<!-- ***** Menu Start ***** -->
@ -190,14 +253,14 @@
<li class="{{ request()->routeIs('history') ? 'active' : '' }}">
<a href="{{ route('history') }}">Riwayat</a>
</li>
<li class="d-flex align-items-center ">
<li class="d-flex align-items-center">
@if(Auth::check())
<a href="javascript:void(0);" class="main-red-button " onclick="togglePopup()">Profil</a>
<a href="#" class="main-red-button"
<a href="javascript:void(0);" class="main-red-button" onclick="togglePopup()">Profil</a>
<a href="#" class="main-red-button" style="margin-left: 10px;"
onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
Logout
</a>
<form id="logout-form" class="" action="{{ route('logout') }}" method="POST" style="display: none;">
<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
@csrf
</form>
@else
@ -216,84 +279,120 @@
</div>
</header>
<!-- Popup Profil -->
@if(session('success'))
<div id="flash-success" style="position: fixed; top: 10px; right: 10px; background: green; color: white; padding: 10px 20px; border-radius: 6px; z-index: 10001;">
<div id="flash-success" class="notification">
{{ session('success') }}
</div>
<script>
setTimeout(() => {
const flash = document.getElementById('flash-success');
if (flash) flash.remove();
if (flash) {
flash.style.opacity = '0';
flash.style.transform = 'translateX(50px)';
flash.style.transition = 'all 0.3s ease';
setTimeout(() => flash.remove(), 300);
}
}, 3000);
</script>
@endif
<!-- Popup Profil -->
<div id="popupOverlay"
class="overlay-container">
<div class="popup-box">
<h2 style="color: #fe3f40;">PROFIL</h2>
<form id="updatePasswordForm" class="form-container" method="POST" action="{{ route('user.updatePassword') }}">
@csrf
<label class="form-label"
for="name">
Username:
</label>
<p>{{ Auth::user()->username ?? 'Guest' }}</p>
<label class="form-label"
for="name">
Umur:
</label>
<p>{{ Auth::user()->umur ?? 'Guest' }}</p>
<label class="form-label"
for="name">
Telp:
</label>
<p>{{ Auth::user()->telp ?? 'Guest' }}</p>
<label class="form-label"
for="name">
Email:
</label>
<p>{{ Auth::user()->email ?? 'Guest' }}</p>
<label class="form-label"
for="name">
Alamat:
</label>
<p>{{ Auth::user()->alamat ?? 'Guest' }}</p>
<label class="form-label" for="passupdate">Update Password:</label>
<input class="form-input"
type="password"
placeholder="Masukkan Password Baru"
id="passupdate"
name="passupdate" required>
<button class="btn-submit" id="submitBtn" type="submit" disabled>
Submit
</button>
</form>
<button class="btn-close-popup"
onclick="togglePopup()">
Close
</button>
<!-- Popup Profil -->
<div class="popup-overlay">
<div id="popupOverlay" class="overlay-container">
<div class="popup-box">
<h2>PROFIL</h2>
<!-- Tab Navigation -->
<div class="tab-navigation">
<button class="tab-button active" onclick="openTab('profileTab', this)">Profile</button>
<button class="tab-button" onclick="openTab('passwordTab', this)">Password</button>
</div>
<!-- Profile Tab Content -->
<div id="profileTab" class="tab-content active">
<form id="updateProfileForm" class="form-container" method="POST" action="{{ route('user.updateProfile') }}">
@csrf
<div class="form-row">
<div class="form-group">
<label class="form-label" for="username">Username</label>
<input class="form-input" type="text" id="username" name="username" value="{{ Auth::user()->username ?? 'Guest' }}" required>
</div>
<div class="form-group">
<label class="form-label" for="email">Email</label>
<input class="form-input" type="email" id="email" name="email" value="{{ Auth::user()->email ?? 'Guest' }}" required>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label class="form-label" for="umur">Umur</label>
<input class="form-input" type="number" id="umur" name="umur" value="{{ Auth::user()->umur ?? '' }}">
</div>
<div class="form-group">
<label class="form-label" for="telp">Telp</label>
<input class="form-input" type="text" id="telp" name="telp" value="{{ Auth::user()->telp ?? '' }}">
</div>
</div>
<div class="form-group">
<label class="form-label" for="alamat">Alamat</label>
<textarea class="form-input" id="alamat" name="alamat" rows="2">{{ Auth::user()->alamat ?? '' }}</textarea>
</div>
<button class="btn-submit" type="submit">
Update Profile
</button>
</form>
</div>
<!-- Password Tab Content -->
<div id="passwordTab" class="tab-content">
<form id="updatePasswordForm" class="form-container" method="POST" action="{{ route('user.updatePassword') }}">
@csrf
<div class="form-group">
<label class="form-label" for="passupdate">Password Baru</label>
<input class="form-input" type="password" id="passupdate" name="passupdate" placeholder="Masukkan Password Baru" required>
</div>
<button class="btn-submit" type="submit">
Update Password
</button>
</form>
</div>
<button class="btn-close-popup" onclick="togglePopup()">
Close
</button>
</div>
</div>
</div>
<!-- Scripts -->
<script>
// Toggle popup visibility
function togglePopup() {
const overlay = document.getElementById('popupOverlay');
overlay.classList.toggle('show');
const popup = document.getElementById('popupOverlay');
popup.classList.toggle('show');
}
document.addEventListener("DOMContentLoaded", function() {
const passwordInput = document.getElementById("passupdate");
const submitBtn = document.getElementById("submitBtn");
// Tab switching functionality
function openTab(tabName, buttonElement) {
// Hide all tab contents
const tabContents = document.getElementsByClassName("tab-content");
for (let i = 0; i < tabContents.length; i++) {
tabContents[i].classList.remove("active");
}
passwordInput.addEventListener("input", function() {
const value = passwordInput.value;
submitBtn.disabled = value.length < 8;
});
});
// Remove active class from all tab buttons
const tabButtons = document.getElementsByClassName("tab-button");
for (let i = 0; i < tabButtons.length; i++) {
tabButtons[i].classList.remove("active");
}
// Show the selected tab content
document.getElementById(tabName).classList.add("active");
// Add active class to the clicked button
buttonElement.classList.add("active");
}
</script>
<div class="content">

View File

@ -6,7 +6,7 @@
<div class="login">
<h1>Login Dulu Sob</h1>
<h1>Login Dulu </h1>
<form action="{{ route('login') }}" method="post" class="form login-form">
@ -14,20 +14,32 @@
<label class="form-label" for="username">Username</label>
<div class="form-group">
<svg class="form-icon-left" width="14" height="14" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M224 256A128 128 0 1 0 224 0a128 128 0 1 0 0 256zm-45.7 48C79.8 304 0 383.8 0 482.3C0 498.7 13.3 512 29.7 512H418.3c16.4 0 29.7-13.3 29.7-29.7C448 383.8 368.2 304 269.7 304H178.3z"/></svg>
<svg class="form-icon-left" width="14" height="14" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.-->
<path d="M224 256A128 128 0 1 0 224 0a128 128 0 1 0 0 256zm-45.7 48C79.8 304 0 383.8 0 482.3C0 498.7 13.3 512 29.7 512H418.3c16.4 0 29.7-13.3 29.7-29.7C448 383.8 368.2 304 269.7 304H178.3z" />
</svg>
<input class="form-input" type="text" name="username" placeholder="Username" id="username" value="{{ old('username') }}" required>
</div>
<label class="form-label" for="password">Password</label>
<div class="form-group mar-bot-5">
<svg class="form-icon-left" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 448 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M144 144v48H304V144c0-44.2-35.8-80-80-80s-80 35.8-80 80zM80 192V144C80 64.5 144.5 0 224 0s144 64.5 144 144v48h16c35.3 0 64 28.7 64 64V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V256c0-35.3 28.7-64 64-64H80z"/></svg>
<div class="form-group mar-bot-5" style="position: relative;">
<svg class="form-icon-left" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 448 512">
<path d="M144 144v48H304V144c0-44.2-35.8-80-80-80s-80 35.8-80 80zM80 192V144C80 64.5 144.5 0 224 0s144 64.5 144 144v48h16c35.3 0 64 28.7 64 64V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V256c0-35.3 28.7-64 64-64H80z" />
</svg>
<input class="form-input" type="password" name="password" placeholder="Password" id="password" required>
<button type="button" onclick="togglePassword()" style="position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: transparent; border: none;">
<svg id="eye-icon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="gray" viewBox="0 0 576 512">
<path d="M572.52 241.4C518.36 135.45 407.34 64 288 64S57.64 135.45 3.48 241.4a48.14 48.14 0 0 0 0 29.2C57.64 376.55 168.66 448 288 448s230.36-71.45 284.52-177.4a48.14 48.14 0 0 0 0-29.2zM288 400c-97 0-189.09-57.82-238.3-144C98.91 169.82 191 112 288 112s189.09 57.82 238.3 144C477.09 342.18 385 400 288 400zm0-272a128 128 0 1 0 128 128 128.14 128.14 0 0 0-128-128zm0 208a80 80 0 1 1 80-80 80.09 80.09 0 0 1-80 80z" />
</svg>
</button>
</div>
@if ($errors->any())
<div class="msg error">
@foreach ($errors->all() as $error)
<p>{{ $error }}</p>
<p>{{ $error }}</p>
@endforeach
</div>
@endif
@ -39,4 +51,19 @@
</form>
</div>
<script>
function togglePassword() {
const passwordInput = document.getElementById('password');
const eyeIcon = document.getElementById('eye-icon');
if (passwordInput.type === 'password') {
passwordInput.type = 'text';
eyeIcon.innerHTML = '<path d="M320 320c-17.67 0-32-14.33-32-32s14.33-32 32-32 32 14.33 32 32-14.33 32-32 32zM288 400c-97 0-189.1-57.82-238.3-144C98.9 169.8 191 112 288 112c44.2 0 86.1 13.3 120.4 36.1l46.4-35.4c4.5-3.5 11.1-2.7 14.6 1.8s2.7 11.1-1.8 14.6L421.2 164.4c28.2 23.5 51.5 53.9 67.8 89.6-49.2 86.2-141.3 144-238.3 144zm288-144c0 8.2-2.6 16.2-7.5 23.1C518.4 376.6 407.3 448 288 448S57.6 376.6 3.5 279.1a47.91 47.91 0 0 1 0-46.2C57.6 135.4 168.7 64 288 64c65.6 0 127 23.6 176.1 66.5l46.4-35.4c4.5-3.5 11.1-2.7 14.6 1.8s2.7 11.1-1.8 14.6l-46.4 35.4c20.2 21.6 37.6 46.3 51.3 73.7 5 6.9 7.8 15 7.8 23.2z"/>';
} else {
passwordInput.type = 'password';
eyeIcon.innerHTML = '<path d="M572.52 241.4C518.36 135.45 407.34 64 288 64S57.64 135.45 3.48 241.4a48.14 48.14 0 0 0 0 29.2C57.64 376.55 168.66 448 288 448s230.36-71.45 284.52-177.4a48.14 48.14 0 0 0 0-29.2zM288 400c-97 0-189.09-57.82-238.3-144C98.91 169.82 191 112 288 112s189.09 57.82 238.3 144C477.09 342.18 385 400 288 400zm0-272a128 128 0 1 0 128 128 128.14 128.14 0 0 0-128-128zm0 208a80 80 0 1 1 80-80 80.09 80.09 0 0 1-80 80z"/>';
}
}
</script>
@endsection

View File

@ -2,310 +2,404 @@
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,minimum-scale=1">
<title>@yield('title', 'Login System')</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,minimum-scale=1">
<title>@yield('title', 'Login System')</title>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet">
<!-- Bootstrap core CSS -->
<link href="{{ asset('vendor/bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<link rel="icon" href="{{ asset('favicon.ico') }}" type="image/x-icon">
<!-- Bootstrap core CSS -->
<link href="{{ asset('vendor/bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<link rel="icon" href="{{ asset('bawang.ico') }}" type="image/x-icon">
<!-- Additional CSS Files -->
<link rel="stylesheet" href="{{ asset('assets/css/fontawesome.css') }}">
<link rel="stylesheet" href="{{ asset('assets/css/templatemo-space-dynamic.css') }}">
<link rel="stylesheet" href="{{ asset('assets/css/animated.css') }}">
<link rel="stylesheet" href="{{ asset('assets/css/owl.css') }}">
<!-- Additional CSS Files -->
<link rel="stylesheet" href="{{ asset('assets/css/fontawesome.css') }}">
<link rel="stylesheet" href="{{ asset('assets/css/templatemo-space-dynamic.css') }}">
<link rel="stylesheet" href="{{ asset('assets/css/animated.css') }}">
<link rel="stylesheet" href="{{ asset('assets/css/owl.css') }}">
<style>
/* Overlay untuk popup */
.overlay-container {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.6);
justify-content: center;
align-items: center;
z-index: 9999;
}
<style>
.popup-box h2 {
margin-bottom: 20px !important;
font-weight: 600 !important;
}
/* Popup aktif */
.overlay-container.show {
display: flex;
}
.popup-box p {
font-size: 17px !important;
font-weight: 400 !important;
margin-bottom: 5px;
}
/* Kotak popup */
.popup-box {
background: #fff;
padding: 20px;
border-radius: 12px;
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
max-width: 90%;
position: relative;
animation: fadeInUp 0.3s ease-out forwards;
}
/* Animasi untuk fade-in popup */
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* Tombol untuk membuka popup */
.btn-open-popup {
padding: 12px 24px;
font-size: 18px;
background-color: green;
color: #fff;
border: none;
border-radius: 8px;
cursor: pointer;
transition: background-color 0.3s ease;
position: fixed;
top: 20px;
right: 20px;
}
.popup-box h2 {
margin-bottom: 15px;
font-weight: 600;
color: #fe3f40;
text-align: center;
}
.btn-open-popup:hover {
background-color: #4caf50;
}
/* Tab navigation styles */
.tab-navigation {
display: flex;
margin-bottom: 15px;
border-bottom: 1px solid #ddd;
}
/* Overlay untuk popup */
.overlay-container {
display: none;
/* Awalnya tersembunyi */
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.6);
justify-content: center;
align-items: center;
opacity: 0;
transition: opacity 0.3s ease;
z-index: 9999;
/* Pastikan di atas elemen lain */
}
.tab-button {
flex: 1;
padding: 8px 12px;
background: #f8f8f8;
border: none;
border-radius: 8px 8px 0 0;
cursor: pointer;
font-weight: 500;
transition: all 0.2s ease;
color: #555;
}
/* Kotak popup */
.popup-box {
background: #fff;
padding: 24px;
border-radius: 12px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
width: 320px;
text-align: center;
opacity: 0;
transform: scale(0.8);
animation: fadeInUp 0.5s ease-out forwards;
z-index: 10000;
position: relative;
}
.tab-button:hover {
background: #f0f0f0;
}
/* Form di dalam popup */
.form-container {
display: flex;
flex-direction: column;
gap: 10px;
}
.tab-button.active {
background: #fe3f40;
color: white;
}
/* Label input */
.form-label {
font-size: 16px;
color: #444;
text-align: left;
}
/* Tab content styles */
.tab-content {
display: none;
}
/* Input field */
.form-input {
padding: 10px;
border: 1px solid #ccc;
border-radius: 8px;
font-size: 16px;
width: 100%;
box-sizing: border-box;
}
.tab-content.active {
display: block;
}
/* Tombol Submit dan Close */
.btn-submit,
.btn-close-popup {
padding: 12px 24px;
border: none;
border-radius: 8px;
cursor: pointer;
transition: background-color 0.3s ease;
width: 100%;
}
/* Form container */
.form-container {
display: flex;
flex-direction: column;
gap: 12px;
}
.btn-submit {
background-color: green;
color: #fff;
}
/* Form layout improvements */
.form-row {
display: flex;
gap: 10px;
}
.btn-submit:hover {
background-color: #4caf50;
}
.form-group {
flex: 1;
display: flex;
flex-direction: column;
gap: 5px;
}
.btn-close-popup {
margin-top: 12px;
background-color: #e74c3c;
color: #fff;
}
/* Label and input styling */
.form-label {
font-size: 14px;
color: #444;
font-weight: 500;
}
.btn-close-popup:hover {
background-color: #c0392b;
}
.form-input {
padding: 8px 10px;
border: 1px solid #ddd;
border-radius: 6px;
font-size: 14px;
transition: border-color 0.2s;
}
/* Animasi untuk fade-in popup */
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
.form-input:focus {
border-color: #fe3f40;
outline: none;
box-shadow: 0 0 0 2px rgba(254, 63, 64, 0.1);
}
to {
opacity: 1;
transform: translateY(0);
}
}
textarea.form-input {
resize: vertical;
min-height: 60px;
}
/* Overlay aktif */
.overlay-container.show {
display: flex;
opacity: 1;
}
</style>
/* Button styling */
.btn-submit, .btn-close-popup {
padding: 10px;
border: none;
border-radius: 6px;
cursor: pointer;
font-weight: 500;
transition: all 0.2s ease;
margin-top: 5px;
}
.btn-submit {
background-color: #fe3f40;
color: white;
}
.btn-submit:hover {
background-color: #e53638;
}
.btn-close-popup {
background-color: #f2f2f2;
color: #333;
margin-top: 10px;
}
.btn-close-popup:hover {
background-color: #e8e8e8;
}
/* Success notification */
.notification {
position: fixed;
top: 80px;
right: 20px;
background: #4CAF50;
color: white;
padding: 12px 20px;
border-radius: 6px;
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
z-index: 10001;
animation: slideIn 0.3s ease-out forwards;
}
@keyframes slideIn {
from {
opacity: 0;
transform: translateX(50px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
/* Responsive adjustments */
@media (max-width: 480px) {
.form-row {
flex-direction: column;
gap: 12px;
}
.popup-box {
width: 85%;
padding: 15px;
}
}
</style>
</head>
<body>
<header class="header-area header-sticky wow slideInDown" data-wow-duration="0.75s" data-wow-delay="0s">
<div class="container">
<div class="row">
<div class="col-12">
<nav class="main-nav">
<!-- ***** Logo Start ***** -->
<a href="" class="logo">
<h4>Shallot<span>Detect</span></h4>
</a>
<!-- ***** Logo End ***** -->
<!-- ***** Menu Start ***** -->
<ul class="nav">
<li class="scroll-to-section"><a href="#top" class="active">Home</a></li>
<li class="scroll-to-section"><a href="#about">Basic Pengetahuan</a></li>
<li class="scroll-to-section"><a href="#PP">Panduan Penggunaan</a></li>
<li class="scroll-to-section"><a href="#tentang">Tentang Pakar</a></li>
<li><a href="{{ route('diagnosa') }}">Diagnosa</a></li>
<li class="d-flex align-items-center">
@if(Auth::check())
<a href="#" class="main-red-button" onclick="togglePopup()">Profil</a>
<a href="#" class="main-red-button"
onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
Logout
</a>
<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
@csrf
</form>
@else
<a href="{{ route('login') }}" class="main-red-button">Login</a>
@endif
</li>
</ul>
<a class='menu-trigger'>
<span>Menu</span>
</a>
</nav>
</div>
</div>
</div>
</header>
<header class="header-area header-sticky wow slideInDown" data-wow-duration="0.75s" data-wow-delay="0s">
<div class="container">
<div class="row">
<div class="col-12">
<nav class="main-nav">
<!-- ***** Logo Start ***** -->
<a href="index.html" class="logo">
<h4>Sistem<span>Pakar</span></h4>
</a>
<!-- ***** Logo End ***** -->
<!-- ***** Menu Start ***** -->
<ul class="nav">
<li class="scroll-to-section"><a href="#top" class="active">Home</a></li>
<li class="scroll-to-section"><a href="#about">Basic Pengetahuan</a></li>
<li class="scroll-to-section"><a href="#PP">Panduan Penggunaan</a></li>
<li class="scroll-to-section"><a href="#tentang">Tentang Pakar</a></li>
<li><a href="{{ route('diagnosa') }}">Diagnosa</a></li>
<li class="d-flex align-items-center">
@if(Auth::check())
<a href="#" class="main-red-button" onclick="togglePopup()">Profil</a>
<a href="#" class="main-red-button"
onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
Logout
</a>
<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
@csrf
</form>
@else
<a href="{{ route('login') }}" class="main-red-button">Login</a>
@endif
</li>
</ul>
<a class='menu-trigger'>
<span>Menu</span>
</a>
</nav>
</div>
</div>
</div>
</header>
@if(session('success'))
<div id="flash-success" style="position: fixed; top: 10px; right: 10px; background: green; color: white; padding: 10px 20px; border-radius: 6px; z-index: 10001;">
{{ session('success') }}
</div>
<script>
setTimeout(() => {
const flash = document.getElementById('flash-success');
if (flash) flash.remove();
}, 3000);
</script>
@endif
<!-- Popup Profil -->
<div id="popupOverlay"
class="overlay-container">
<div class="popup-box">
<h2 style="color: #fe3f40;">PROFIL</h2>
<form id="updatePasswordForm" class="form-container" method="POST" action="{{ route('user.updatePassword') }}">
@csrf
<label class="form-label"
for="name">
Username:
</label>
<p>{{ Auth::user()->username ?? 'Guest' }}</p>
<label class="form-label"
for="name">
Umur:
</label>
<p>{{ Auth::user()->umur ?? 'Guest' }}</p>
<label class="form-label"
for="name">
Telp:
</label>
<p>{{ Auth::user()->telp ?? 'Guest' }}</p>
<label class="form-label"
for="name">
Email:
</label>
<p>{{ Auth::user()->email ?? 'Guest' }}</p>
<label class="form-label"
for="name">
Alamat:
</label>
<p>{{ Auth::user()->alamat ?? 'Guest' }}</p>
<label class="form-label" for="passupdate">Update Password:</label>
<input class="form-input"
type="password"
placeholder="Masukkan Password Baru"
id="passupdate"
name="passupdate" required>
<button class="btn-submit" id="submitBtn" type="submit" disabled>
Submit
</button>
</form>
@if(session('success'))
<div id="flash-success" class="notification">
{{ session('success') }}
</div>
<script>
setTimeout(() => {
const flash = document.getElementById('flash-success');
if (flash) {
flash.style.opacity = '0';
flash.style.transform = 'translateX(50px)';
flash.style.transition = 'all 0.3s ease';
setTimeout(() => flash.remove(), 300);
}
}, 3000);
</script>
@endif
<button class="btn-close-popup"
onclick="togglePopup()">
Close
</button>
</div>
</div>
<!-- Popup Profil -->
<div id="popupOverlay" class="overlay-container">
<div class="popup-box">
<h2>PROFIL</h2>
<!-- Scripts -->
<script>
function togglePopup() {
const overlay = document.getElementById('popupOverlay');
overlay.classList.toggle('show');
}
<!-- Tab Navigation -->
<div class="tab-navigation">
<button class="tab-button active" onclick="openTab('profileTab', this)">Profile</button>
<button class="tab-button" onclick="openTab('passwordTab', this)">Password</button>
</div>
document.addEventListener("DOMContentLoaded", function() {
const passwordInput = document.getElementById("passupdate");
const submitBtn = document.getElementById("submitBtn");
<!-- Profile Tab Content -->
<div id="profileTab" class="tab-content active">
<form id="updateProfileForm" class="form-container" method="POST" action="{{ route('user.updateProfile') }}">
@csrf
<div class="form-row">
<div class="form-group">
<label class="form-label" for="username">Username</label>
<input class="form-input" type="text" id="username" name="username" value="{{ Auth::user()->username ?? 'Guest' }}" required>
</div>
<div class="form-group">
<label class="form-label" for="email">Email</label>
<input class="form-input" type="email" id="email" name="email" value="{{ Auth::user()->email ?? 'Guest' }}" required>
</div>
</div>
passwordInput.addEventListener("input", function() {
const value = passwordInput.value;
submitBtn.disabled = value.length < 8;
});
});
</script>
<div class="form-row">
<div class="form-group">
<label class="form-label" for="umur">Umur</label>
<input class="form-input" type="number" id="umur" name="umur" value="{{ Auth::user()->umur ?? '' }}">
</div>
<div class="form-group">
<label class="form-label" for="telp">Telp</label>
<input class="form-input" type="text" id="telp" name="telp" value="{{ Auth::user()->telp ?? '' }}">
</div>
</div>
<div class="form-group">
<label class="form-label" for="alamat">Alamat</label>
<textarea class="form-input" id="alamat" name="alamat" rows="2">{{ Auth::user()->alamat ?? '' }}</textarea>
</div>
<div class="content">
@yield('content')
</div>
<button class="btn-submit" type="submit">
Update Profile
</button>
</form>
</div>
<footer>
<div class="container">
<div class="row">
<div class="col-lg-12 wow fadeIn" data-wow-duration="1s" data-wow-delay="0.25s">
<p>© Copyright 2024 by Ihya Ulumuddin</p>
</div>
</div>
</div>
</footer>
<!-- Password Tab Content -->
<div id="passwordTab" class="tab-content">
<form id="updatePasswordForm" class="form-container" method="POST" action="{{ route('user.updatePassword') }}">
@csrf
<div class="form-group">
<label class="form-label" for="passupdate">Password Baru</label>
<input class="form-input" type="password" id="passupdate" name="passupdate" placeholder="Masukkan Password Baru" required>
</div>
<button class="btn-submit" type="submit">
Update Password
</button>
</form>
</div>
<button class="btn-close-popup" onclick="togglePopup()">
Close
</button>
</div>
</div>
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="assets/js/owl-carousel.js"></script>
<script src="assets/js/animation.js"></script>
<script src="assets/js/imagesloaded.js"></script>
<script src="assets/js/templatemo-custom.js"></script>
<div class="content">
@yield('content')
</div>
<footer>
<div class="container">
<div class="row">
<div class="col-lg-12 wow fadeIn" data-wow-duration="1s" data-wow-delay="0.25s">
<p>© Copyright 2024 by Ihya Ulumuddin</p>
</div>
</div>
</div>
</footer>
<!-- Scripts -->
<script src="{{ asset('vendor/jquery/jquery.min.js') }}"></script>
<script src="{{ asset('vendor/bootstrap/js/bootstrap.bundle.min.js') }}"></script>
<script src="{{ asset('assets/js/owl-carousel.js') }}"></script>
<script src="{{ asset('assets/js/animation.js') }}"></script>
<script src="{{ asset('assets/js/imagesloaded.js') }}"></script>
<script src="{{ asset('assets/js/templatemo-custom.js') }}"></script>
<script>
// Toggle popup visibility
function togglePopup() {
const popup = document.getElementById('popupOverlay');
popup.classList.toggle('show');
}
// Tab switching functionality
function openTab(tabName, buttonElement) {
// Hide all tab contents
const tabContents = document.getElementsByClassName("tab-content");
for (let i = 0; i < tabContents.length; i++) {
tabContents[i].classList.remove("active");
}
// Remove active class from all tab buttons
const tabButtons = document.getElementsByClassName("tab-button");
for (let i = 0; i < tabButtons.length; i++) {
tabButtons[i].classList.remove("active");
}
// Show the selected tab content
document.getElementById(tabName).classList.add("active");
// Add active class to the clicked button
buttonElement.classList.add("active");
}
</script>
</body>
</html>

View File

@ -8,6 +8,26 @@
button {
margin-top: 10px !important;
}
.form-group {
position: relative;
/* agar tombol bisa absolute relatif ke sini */
}
.form-input {
padding-right: 30px;
/* beri ruang untuk tombol mata */
}
button.toggle-password {
position: absolute;
right: 10px;
top: 50%;
transform: translateY(-50%);
background: transparent;
border: none;
cursor: pointer;
}
</style>
<div class="login">
@ -20,10 +40,17 @@
<label class="form-label" for="new_password">Sandi Baru</label>
<div class="form-group">
<svg class="form-icon-left" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 512 512">
<path d="M48 64C21.5 64 0 85.5 0 112c0 15.1 7.1 29.3 19.2 38.4L236.8 313.6c11.4 8.5 27 8.5 38.4 0L492.8 150.4c12.1-9.1 19.2-23.3 19.2-38.4c0-26.5-21.5-48-48-48H48zM0 176V384c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V176L294.4 339.2c-22.8 17.1-54 17.1-76.8 0L0 176z" />
<svg class="form-icon-left" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 448 512">
<path d="M144 144v48H304V144c0-44.2-35.8-80-80-80s-80 35.8-80 80zM80 192V144C80 64.5 144.5 0 224 0s144 64.5 144 144v48h16c35.3 0 64 28.7 64 64V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V256c0-35.3 28.7-64 64-64H80z" />
</svg>
<input class="form-input" type="password" name="password" placeholder="Sandi Baru" id="new_password" required minlength="8">
<button type="button" class="toggle-password" style="position: absolute; right: 10px; top: 30%; transform: translateY(-50%); background: transparent; border: none;" onclick="togglePassword('new_password', 'eye-icon')" aria-label="Toggle Password Visibility">
<svg id="eye-icon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="gray" viewBox="0 0 576 512">
<path d="M572.52 241.4C518.36 135.45 407.34 64 288 64S57.64 135.45 3.48 241.4a48.14 48.14 0 0 0 0 29.2C57.64 376.55 168.66 448 288 448s230.36-71.45 284.52-177.4a48.14 48.14 0 0 0 0-29.2zM288 400c-97 0-189.09-57.82-238.3-144C98.91 169.82 191 112 288 112s189.09 57.82 238.3 144C477.09 342.18 385 400 288 400zm0-272a128 128 0 1 0 128 128 128.14 128.14 0 0 0-128-128zm0 208a80 80 0 1 1 80-80 80.09 80.09 0 0 1-80 80z" />
</svg>
</button>
</div>
@error('password')
@ -34,10 +61,17 @@
<label class="form-label" for="new_password_confirmation">Konfirmasi Sandi Baru</label>
<div class="form-group">
<svg class="form-icon-left" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 512 512">
<path d="M48 64C21.5 64 0 85.5 0 112c0 15.1 7.1 29.3 19.2 38.4L236.8 313.6c11.4 8.5 27 8.5 38.4 0L492.8 150.4c12.1-9.1 19.2-23.3 19.2-38.4c0-26.5-21.5-48-48-48H48zM0 176V384c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V176L294.4 339.2c-22.8 17.1-54 17.1-76.8 0L0 176z" />
<svg class="form-icon-left" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 448 512">
<path d="M144 144v48H304V144c0-44.2-35.8-80-80-80s-80 35.8-80 80zM80 192V144C80 64.5 144.5 0 224 0s144 64.5 144 144v48h16c35.3 0 64 28.7 64 64V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V256c0-35.3 28.7-64 64-64H80z" />
</svg>
<input class="form-input" type="password" name="password_confirmation" placeholder="Konfirmasi Sandi Baru" id="new_password_confirmation" required>
<button type="button" class="toggle-password" style="position: absolute; right: 10px; top: 30%; transform: translateY(-50%); background: transparent; border: none;" onclick="togglePassword('new_password_confirmation', 'eye-icon2')" aria-label="Toggle Password Visibility">
<svg id="eye-icon2" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="gray" viewBox="0 0 576 512">
<path d="M572.52 241.4C518.36 135.45 407.34 64 288 64S57.64 135.45 3.48 241.4a48.14 48.14 0 0 0 0 29.2C57.64 376.55 168.66 448 288 448s230.36-71.45 284.52-177.4a48.14 48.14 0 0 0 0-29.2zM288 400c-97 0-189.09-57.82-238.3-144C98.91 169.82 191 112 288 112s189.09 57.82 238.3 144C477.09 342.18 385 400 288 400zm0-272a128 128 0 1 0 128 128 128.14 128.14 0 0 0-128-128zm0 208a80 80 0 1 1 80-80 80.09 80.09 0 0 1-80 80z" />
</svg>
</button>
</div>
@error('password_confirmation')
@ -56,4 +90,19 @@
</form>
</div>
@endsection
<script>
function togglePassword(inputId, iconId) {
const passwordInput = document.getElementById(inputId);
const eyeIcon = document.getElementById(iconId);
if (passwordInput.type === 'password') {
passwordInput.type = 'text';
eyeIcon.innerHTML = '<path d="M320 320c-17.67 0-32-14.33-32-32s14.33-32 32-32 32 14.33 32 32-14.33 32-32 32zM288 400c-97 0-189.1-57.82-238.3-144C98.9 169.8 191 112 288 112c44.2 0 86.1 13.3 120.4 36.1l46.4-35.4c4.5-3.5 11.1-2.7 14.6 1.8s2.7 11.1-1.8 14.6L421.2 164.4c28.2 23.5 51.5 53.9 67.8 89.6-49.2 86.2-141.3 144-238.3 144zm288-144c0 8.2-2.6 16.2-7.5 23.1C518.4 376.6 407.3 448 288 448S57.6 376.6 3.5 279.1a47.91 47.91 0 0 1 0-46.2C57.6 135.4 168.7 64 288 64c65.6 0 127 23.6 176.1 66.5l46.4-35.4c4.5-3.5 11.1-2.7 14.6 1.8s2.7 11.1-1.8 14.6l-46.4 35.4c20.2 21.6 37.6 46.3 51.3 73.7 5 6.9 7.8 15 7.8 23.2z"/>';
} else {
passwordInput.type = 'password';
eyeIcon.innerHTML = '<path d="M572.52 241.4C518.36 135.45 407.34 64 288 64S57.64 135.45 3.48 241.4a48.14 48.14 0 0 0 0 29.2C57.64 376.55 168.66 448 288 448s230.36-71.45 284.52-177.4a48.14 48.14 0 0 0 0-29.2zM288 400c-97 0-189.09-57.82-238.3-144C98.91 169.82 191 112 288 112s189.09 57.82 238.3 144C477.09 342.18 385 400 288 400zm0-272a128 128 0 1 0 128 128 128.14 128.14 0 0 0-128-128zm0 208a80 80 0 1 1 80-80 80.09 80.09 0 0 1-80 80z"/>';
}
}
</script>
@endsection

View File

@ -120,6 +120,7 @@
// Profile Route
Route::get('profile', [ProfileController::class, 'index'])->name('profile')->middleware('auth');
Route::post('/profile/update', [ProfileController::class, 'updateProfile'])->name('user.updateProfile');
// Gejala Routes
// Route::get('/diagnosa', [GejalaController::class, 'index'])->name('diagnosa')->middleware('auth');