431 lines
17 KiB
PHP
431 lines
17 KiB
PHP
<?php
|
|
include '../auth.php';
|
|
include '../../koneksi.php';
|
|
include '../function/landingpage_helper.php';
|
|
|
|
$user_id = $_SESSION['user_id'];
|
|
|
|
$data = getLandingPageData($user_id, $conn);
|
|
$disabled = $data['disabled'];
|
|
$slug_url = $data['slug_url'];
|
|
$showLandingPage = $data['showLandingPage'];
|
|
|
|
// 🔹 Ambil data dari users berdasarkan user_id
|
|
$sql = "SELECT * FROM users WHERE id_user = ?";
|
|
$stmt = $conn->prepare($sql);
|
|
$stmt->bind_param("i", $user_id); // Mengikat parameter user_id sebagai integer
|
|
$stmt->execute();
|
|
$result = $stmt->get_result();
|
|
$row = $result->fetch_assoc(); // Mengambil hasil query sebagai array asosiasi
|
|
|
|
if ($result->num_rows > 0) {
|
|
$nama_lengkap = $row['nama_lengkap'];
|
|
$email = $row['email']; //
|
|
$no_hp = $row['no_hp'];
|
|
|
|
} else {
|
|
echo "User tidak ditemukan.";
|
|
}
|
|
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta content="width=device-width, initial-scale=1.0" name="viewport">
|
|
|
|
<title>Update Profile | User</title>
|
|
<meta content="" name="description">
|
|
<meta content="" name="keywords">
|
|
<meta name="robots" content="noindex">
|
|
|
|
<!-- Favicons -->
|
|
<link href="../../assets/img/favicon.png" rel="icon">
|
|
<link href="../../assets/img/apple-touch-icon.png" rel="apple-touch-icon">
|
|
|
|
<!-- Google Fonts -->
|
|
<link href="https://fonts.gstatic.com" rel="preconnect">
|
|
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Nunito:300,300i,400,400i,600,600i,700,700i|Poppins:300,300i,400,400i,500,500i,600,600i,700,700i" rel="stylesheet">
|
|
|
|
<!-- Vendor CSS Files -->
|
|
<link href="../../assets/template/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
|
<link href="../../assets/template/vendor/bootstrap-icons/bootstrap-icons.css" rel="stylesheet">
|
|
<link href="../../assets/template/vendor/boxicons/css/boxicons.min.css" rel="stylesheet">
|
|
<link href="../../assets/template/vendor/quill/quill.snow.css" rel="stylesheet">
|
|
<link href="../../assets/template/vendor/quill/quill.bubble.css" rel="stylesheet">
|
|
<link href="../../assets/template/vendor/remixicon/remixicon.css" rel="stylesheet">
|
|
<link href="../../assets/template/vendor/simple-datatables/style.css" rel="stylesheet">
|
|
|
|
<!-- Template Main CSS File -->
|
|
<link href="../../assets/template/css/style.css" rel="stylesheet">
|
|
|
|
<!-- =======================================================
|
|
* Template Name: NiceAdmin
|
|
* Template URL: https://bootstrapmade.com/nice-admin-bootstrap-admin-html-template/
|
|
* Updated: Apr 20 2024 with Bootstrap v5.3.3
|
|
* Author: BootstrapMade.com
|
|
* License: https://bootstrapmade.com/license/
|
|
======================================================== -->
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<!-- ======= Header ======= -->
|
|
<header id="header" class="header fixed-top d-flex align-items-center">
|
|
|
|
<div class="d-flex align-items-center justify-content-between">
|
|
<a href="" class="logo d-flex align-items-center">
|
|
<img src="../../assets/img/logo.png" alt="">
|
|
<span class="d-none d-lg-block">Portal UMKM</span>
|
|
</a>
|
|
<i class="bi bi-list toggle-sidebar-btn"></i>
|
|
</div><!-- End Logo -->
|
|
|
|
<nav class="header-nav ms-auto">
|
|
<ul class="d-flex align-items-center">
|
|
|
|
<li class="nav-item dropdown pe-3">
|
|
|
|
<a class="nav-link nav-profile d-flex align-items-center pe-0" href="#" data-bs-toggle="dropdown">
|
|
<span class="fw-semibold dropdown-toggle ps-2">Hai, <?php echo $_SESSION['nama_lengkap']; ?>!</span>
|
|
</a><!-- End Profile Iamge Icon -->
|
|
|
|
<ul class="dropdown-menu dropdown-menu-end dropdown-menu-arrow profile">
|
|
<li class="dropdown-header">
|
|
<h6><?php echo $_SESSION['nama_lengkap']; ?></h6>
|
|
<span><?php echo ucfirst($_SESSION['role']); ?></span>
|
|
</li>
|
|
<li>
|
|
<hr class="dropdown-divider">
|
|
</li>
|
|
|
|
<li>
|
|
<a class="dropdown-item d-flex align-items-center" href="../update-profile/">
|
|
<i class="bi bi-gear"></i>
|
|
<span>Pengaturan</span>
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<hr class="dropdown-divider">
|
|
</li>
|
|
|
|
<li>
|
|
<a class="dropdown-item d-flex align-items-center" href="#" data-bs-toggle="modal" data-bs-target="#confirmLogoutModal">
|
|
<i class="bi bi-box-arrow-right"></i>
|
|
<span>Keluar</span>
|
|
</a>
|
|
</li>
|
|
|
|
</ul><!-- End Profile Dropdown Items -->
|
|
</li><!-- End Profile Nav -->
|
|
|
|
</ul>
|
|
</nav><!-- End Icons Navigation -->
|
|
|
|
</header><!-- End Header -->
|
|
|
|
<!-- ======= Sidebar ======= -->
|
|
<aside id="sidebar" class="sidebar bg-gradient-primary text-white vh-100 p-3 shadow-lg">
|
|
|
|
<ul class="nav flex-column sidebar-nav">
|
|
|
|
<li class="nav-item mb-2">
|
|
<a class="nav-link d-flex align-items-center" href="../../users">
|
|
<i class="bi bi-columns-gap"></i>
|
|
<span>Dashboard</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li class="nav-item mb-2">
|
|
<a class="nav-link d-flex align-items-center" href="../data-usaha">
|
|
<i class="bi bi-shop"></i>
|
|
<span>Data Usaha</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li class="nav-item mb-2">
|
|
<a class="nav-link d-flex align-items-center" href="../produk">
|
|
<i class="bi bi-box-seam"></i>
|
|
<span>Produk</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li class="nav-item mb-2">
|
|
<a class="nav-link d-flex align-items-center" href="../keunggulan">
|
|
<i class="bi bi-patch-check"></i>
|
|
<span>Keunggulan</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li class="nav-item mb-2">
|
|
<a class="nav-link d-flex align-items-center" href="../testimoni">
|
|
<i class="bi bi-chat-dots"></i>
|
|
<span>Testimoni</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li class="nav-item mb-2">
|
|
<a class="nav-link d-flex align-items-center" href="../seo">
|
|
<i class="bi bi-search"></i>
|
|
<span>SEO</span>
|
|
</a>
|
|
</li>
|
|
|
|
<?php if ($showLandingPage): ?>
|
|
<li class="nav-item mb-2">
|
|
<a class="nav-link d-flex align-items-center" href="../landingpage">
|
|
<i class="bi bi-journal-richtext"></i>
|
|
<span>Landing Page</span>
|
|
</a>
|
|
</li>
|
|
<?php endif; ?>
|
|
|
|
<li class="nav-item text-center mt-3">
|
|
<a class="btn btn-primary px-4 fs-6 py-2 <?= $disabled ? 'disabled' : ''; ?>"
|
|
href="../../<?php echo $slug_url; ?>" target="_blank">
|
|
<i class="bi bi-eye"></i> Lihat Landing Page
|
|
</a>
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</aside>
|
|
|
|
<main id="main" class="main">
|
|
|
|
<div class="pagetitle">
|
|
<h1>Profil</h1>
|
|
<nav>
|
|
<ol class="breadcrumb">
|
|
<li class="breadcrumb-item"><a href="">Beranda</a></li>
|
|
<li class="breadcrumb-item">Profil</li>
|
|
</ol>
|
|
</nav>
|
|
</div><!-- End Page Title -->
|
|
|
|
<?php if (isset($_SESSION['success'])): ?>
|
|
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
|
<?php echo $_SESSION['success']; ?>
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
</div>
|
|
<?php unset($_SESSION['success']); // Hapus pesan setelah ditampilkan
|
|
?>
|
|
<?php endif; ?>
|
|
|
|
<?php if (isset($_SESSION['error'])): ?>
|
|
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
|
<?php echo $_SESSION['error']; ?>
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
</div>
|
|
<?php unset($_SESSION['error']); // Hapus pesan setelah ditampilkan
|
|
?>
|
|
<?php endif; ?>
|
|
|
|
<section class="section profile">
|
|
<div class="row">
|
|
<div class="col-xl-12">
|
|
|
|
<div class="card">
|
|
<div class="card-body pt-3">
|
|
<!-- Bordered Tabs -->
|
|
<ul class="nav nav-tabs nav-tabs-bordered">
|
|
|
|
<li class="nav-item">
|
|
<button class="nav-link active" data-bs-toggle="tab" data-bs-target="#profile-overview">Rangkuman</button>
|
|
</li>
|
|
|
|
<li class="nav-item">
|
|
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#profile-edit">Edit Profil</button>
|
|
</li>
|
|
|
|
|
|
<li class="nav-item">
|
|
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#profile-change-password">Ubah Kata Sandi</button>
|
|
</li>
|
|
|
|
</ul>
|
|
<div class="tab-content pt-2">
|
|
|
|
<div class="tab-pane fade show active profile-overview" id="profile-overview">
|
|
|
|
<h5 class="card-title">Profil Pengguna</h5>
|
|
|
|
<div class="row">
|
|
<div class="col-lg-2 col-md-4 label ">Nama Lengkap</div>
|
|
<div class="col-lg-10 col-md-8"><?php echo htmlspecialchars($nama_lengkap); ?></div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-lg-2 col-md-4 label">No. WhatsApp</div>
|
|
<div class="col-lg-10 col-md-8">+62<?php echo htmlspecialchars($no_hp); ?></div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-lg-2 col-md-4 label">Email</div>
|
|
<div class="col-lg-10 col-md-8"><?php echo htmlspecialchars($email); ?></div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="tab-pane fade profile-edit pt-3" id="profile-edit">
|
|
|
|
<!-- Profile Edit Form -->
|
|
<form method="POST" action="updateuser.php">
|
|
|
|
<div class="row mb-3">
|
|
<label for="fullName" class="col-md-4 col-lg-2 col-form-label">Nama Lengkap<span class="text-danger">*</span></label>
|
|
<div class="col-md-8 col-lg-10">
|
|
<input name="nama_lengkap" type="text" class="form-control" id="nama_lengkap" value="<?php echo htmlspecialchars($nama_lengkap); ?>" required>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row mb-3">
|
|
<label for="Phone" class="col-md-4 col-lg-2 col-form-label">No. WhatsApp<span class="text-danger">*</span></label>
|
|
<div class="col-md-8 col-lg-10">
|
|
<div class="input-group">
|
|
<span class="input-group-text">+62</span>
|
|
<input name="no_hp" type="number" class="form-control" id="no_hp" value="<?php echo htmlspecialchars($no_hp); ?>" required>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row mb-3">
|
|
<label for="Email" class="col-md-4 col-lg-2 col-form-label">Email<span class="text-danger">*</span></label>
|
|
<div class="col-md-8 col-lg-10">
|
|
<input name="email" type="email" class="form-control" id="email" value="<?php echo htmlspecialchars($email); ?>" required>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="text-center">
|
|
<button type="submit" class="btn btn-primary"><i class="bi bi-check-circle"></i> Simpan Perubahan</button>
|
|
</div>
|
|
</form><!-- End Profile Edit Form -->
|
|
|
|
</div>
|
|
|
|
<div class="tab-pane fade pt-3" id="profile-change-password">
|
|
<form method="POST" action="updatepass.php">
|
|
|
|
<div class="row mb-3">
|
|
<label for="currentPassword" class="col-md-4 col-lg-2 col-form-label">Kata Sandi Saat Ini</label>
|
|
<div class="col-md-8 col-lg-10">
|
|
<div class="input-group">
|
|
<input name="password" type="password" class="form-control" id="currentPassword">
|
|
<span class="input-group-text" onclick="togglePassword('currentPassword', 'iconCurrent')" style="cursor: pointer;">
|
|
<i class="fa fa-eye" id="iconCurrent"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row mb-3">
|
|
<label for="newPassword" class="col-md-4 col-lg-2 col-form-label">Kata Sandi Baru</label>
|
|
<div class="col-md-8 col-lg-10">
|
|
<div class="input-group">
|
|
<input name="newpassword" type="password" class="form-control" id="newPassword">
|
|
<span class="input-group-text" onclick="togglePassword('newPassword', 'iconNew')" style="cursor: pointer;">
|
|
<i class="fa fa-eye" id="iconNew"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row mb-3">
|
|
<label for="renewPassword" class="col-md-4 col-lg-2 col-form-label">Konfirmasi Kata Sandi Baru</label>
|
|
<div class="col-md-8 col-lg-10">
|
|
<div class="input-group">
|
|
<input name="renewpassword" type="password" class="form-control" id="renewPassword">
|
|
<span class="input-group-text" onclick="togglePassword('renewPassword', 'iconRenew')" style="cursor: pointer;">
|
|
<i class="fa fa-eye" id="iconRenew"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="text-center">
|
|
<button type="submit" class="btn btn-primary"><i class="bi bi-check-circle"></i> Ubah Kata Sandi</button>
|
|
</div>
|
|
</form><!-- End Change Password Form -->
|
|
|
|
</div>
|
|
|
|
</div><!-- End Bordered Tabs -->
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Modal Konfirmasi Logout -->
|
|
<div class="modal fade" id="confirmLogoutModal" tabindex="-1" aria-labelledby="logoutModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="logoutModalLabel">Konfirmasi Keluar</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
Apakah Anda yakin ingin keluar dari halaman ini?
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
|
|
<a href="../logout.php" id="logoutConfirmBtn" class="btn btn-danger">Keluar</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</main><!-- End #main -->
|
|
|
|
<!-- ======= Footer ======= -->
|
|
<footer id="footer" class="footer">
|
|
<div class="copyright">
|
|
© Copyright <strong><span>Portal UMKM</span></strong>. All Rights Reserved
|
|
</div>
|
|
<div class="credits">
|
|
<!-- All the links in the footer should remain intact. -->
|
|
<!-- You can delete the links only if you purchased the pro version. -->
|
|
<!-- Licensing information: https://bootstrapmade.com/license/ -->
|
|
<!-- Purchase the pro version with working PHP/AJAX contact form: https://bootstrapmade.com/nice-admin-bootstrap-admin-html-template/ -->
|
|
<!-- Designed by <a href="https://bootstrapmade.com/">BootstrapMade</a> -->
|
|
</div>
|
|
</footer><!-- End Footer -->
|
|
|
|
<a href="#" class="back-to-top d-flex align-items-center justify-content-center"><i class="bi bi-arrow-up-short"></i></a>
|
|
|
|
<!-- Vendor JS Files -->
|
|
<script src="../../assets/template/vendor/apexcharts/apexcharts.min.js"></script>
|
|
<script src="../../assets/template/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
|
|
<script src="../../assets/template/vendor/chart.js/chart.umd.js"></script>
|
|
<script src="../../assets/template/vendor/echarts/echarts.min.js"></script>
|
|
<script src="../../assets/template/vendor/quill/quill.js"></script>
|
|
<script src="../../assets/template/vendor/simple-datatables/simple-datatables.js"></script>
|
|
<script src="../../assets/template/vendor/tinymce/tinymce.min.js"></script>
|
|
<script src="../../assets/template/vendor/php-email-form/validate.js"></script>
|
|
|
|
<!-- Template Main JS File -->
|
|
<script src="../../assets/template/js/main.js"></script>
|
|
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
|
|
|
<script>
|
|
function togglePassword(inputId, iconId) {
|
|
const input = document.getElementById(inputId);
|
|
const icon = document.getElementById(iconId);
|
|
const isPassword = input.type === 'password';
|
|
input.type = isPassword ? 'text' : 'password';
|
|
icon.classList.toggle('fa-eye');
|
|
icon.classList.toggle('fa-eye-slash');
|
|
}
|
|
</script>
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|