312 lines
12 KiB
PHP
312 lines
12 KiB
PHP
<?php
|
|
include '../auth.php';
|
|
include '../../koneksi.php';
|
|
|
|
$query = "SELECT id_detail_artikel, judul_artikel, kategori, DATE_FORMAT(tanggal, '%d-%m-%Y') as tanggal FROM detail_artikel";
|
|
$result = mysqli_query($conn, $query);
|
|
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta content="width=device-width, initial-scale=1.0" name="viewport">
|
|
|
|
<title>Kelola Artikel | Admin</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">
|
|
|
|
|
|
<ul class="sidebar-nav sidebar-nav">
|
|
|
|
<li class="nav-item mb-2">
|
|
<a class="nav-link d-flex align-items-center" href="../">
|
|
<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="../landingpage">
|
|
<i class="bi bi-journal-richtext"></i>
|
|
<span>Landing Page</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li class="nav-item mb-2">
|
|
<a class="nav-link d-flex align-items-center collapsed" href="../artikel">
|
|
<i class="bi bi-newspaper"></i>
|
|
<span>Artikel</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li class="nav-item mb-2">
|
|
<a class="nav-link d-flex align-items-center" href="../pengguna">
|
|
<i class="bi bi-people"></i>
|
|
<span>Pengguna</span>
|
|
</a>
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</aside><!-- End Sidebar-->
|
|
|
|
<main id="main" class="main">
|
|
|
|
<div class="pagetitle">
|
|
<h1>Kelola Artikel</h1>
|
|
<nav>
|
|
<ol class="breadcrumb">
|
|
<li class="breadcrumb-item"><a href="">Beranda</a></li>
|
|
<li class="breadcrumb-item">Artikel</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">
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
|
|
<div class="card">
|
|
<div class="card-body mt-3">
|
|
<div class="d-flex justify-content-end">
|
|
<a href="tambah.php" class="btn btn-primary mb-3">
|
|
<i class="bi bi-plus-circle"></i> Tambahkan Artikel
|
|
</a>
|
|
</div>
|
|
|
|
<!-- Table with stripped rows -->
|
|
<div class="table-responsive">
|
|
<table class="table datatable">
|
|
<thead>
|
|
<tr>
|
|
<th>No.</th>
|
|
<th>Judul</th>
|
|
<th>Kategori</th>
|
|
<th data-type="date" data-format="YYYY/DD/MM">Tanggal Publish</th>
|
|
<th>Aksi</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$no = 1;
|
|
while ($row = mysqli_fetch_assoc($result)) :
|
|
?>
|
|
<tr>
|
|
<td><?= $no++; ?></td>
|
|
<td><?= htmlspecialchars($row['judul_artikel']); ?></td>
|
|
<td><?= htmlspecialchars($row['kategori']); ?></td>
|
|
<td><?= $row['tanggal']; ?></td>
|
|
<td>
|
|
<a href="update.php?id=<?= $row['id_detail_artikel']; ?>" class="btn btn-sm btn-primary mt-1"><i class="bi bi-pencil-square mt-1"></i></a>
|
|
<button class="btn btn-sm btn-danger mt-1" data-bs-toggle="modal" data-bs-target="#confirmDeleteModal" data-id="<?= $row['id_detail_artikel']; ?>">
|
|
<i class="bi bi-trash"></i>
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
<?php endwhile; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="modal fade" id="confirmDeleteModal" tabindex="-1" aria-labelledby="deleteModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="deleteModalLabel">Konfirmasi Hapus</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
Apakah Anda yakin ingin menghapus artikel ini?
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
|
|
<a href="" id="deleteConfirmBtn" class="btn btn-danger">Hapus</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- End Table with stripped rows -->
|
|
|
|
</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>
|
|
|
|
<script>
|
|
document.addEventListener("DOMContentLoaded", function() {
|
|
var deleteModal = document.getElementById('confirmDeleteModal');
|
|
deleteModal.addEventListener('show.bs.modal', function(event) {
|
|
var button = event.relatedTarget; // Tombol yang diklik
|
|
var id = button.getAttribute('data-id'); // Ambil ID produk
|
|
var deleteLink = document.getElementById('deleteConfirmBtn');
|
|
deleteLink.href = "deleteartikel.php?id=" + id; // Set href untuk hapus
|
|
});
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|