<?php 
    require_once("../_ayarlar.php");
    require_once("../_fonksiyonlar.php");
?>
<!DOCTYPE html>
<html lang="tr">

<head>
    <?php include("_head.php") ?>
    <script src="../ckeditor5/build/ckeditor.js"></script>
    <title>Haber Ekle</title>
</head>

<body id="page-top">

    <!-- Page Wrapper -->
    <div id="wrapper">

        <?php include("_sidebar.php") ?>

        <!-- Content Wrapper -->
        <div id="content-wrapper" class="d-flex flex-column">

            <!-- Main Content -->
            <div id="content">

                <?php include("_topbar.php") ?>

                <!-- Sayfaya Özel İçerik -->
                <div class="container-fluid">

                    <div class="card shadow mb-4">
                        <div class="card-header py-3">
                            <h6 class="m-0 font-weight-bold text-primary">Haber Ekle</h6>
                        </div>
                        <div class="card-body">

                            <form action="haber-kaydet.php" method="post" enctype="multipart/form-data">
                                <div class="mb-3">
                                    <label for="baslik" class="form-label">Başlık</label>
                                    <input type="text" class="form-control" id="baslik" name="baslik">
                                </div>
                                <div class="mb-3">
                                    <label for="icerik" class="form-label">Haber Metni</label>
                                    <textarea class="form-control" id="icerik" name="icerik"></textarea>
                                </div>
                                <div class="mb-3">
                                    <label for="kategori" class="form-label">Kategori</label>
                                    <select class="form-control" id="kategori" name="kategori">
                                        <?php kategori_listele(); ?>
                                    </select>
                                </div>
                                <div class="mb-3">
                                    <label for="kapak" class="form-label">Kapak Görseli</label>
                                    <input type="file" class="form-control" id="kapak" name="kapak">
                                </div>
                                <div class="form-group">
                                    <button class="btn btn-primary btn-user btn-block">Haberi Kaydet</button>
                                </div>
                            </form>

                        </div>
                    </div>

                </div>
                <!-- /.container-fluid -->

            </div>
            <!-- End of Main Content -->

            <?php include("_footer.php") ?>

        </div>
        <!-- End of Content Wrapper -->

    </div>
    <!-- End of Page Wrapper -->

    <!-- Scroll to Top Button-->
    <a class="scroll-to-top rounded" href="#page-top">
        <i class="fas fa-angle-up"></i>
    </a>

    <?php include("_script.php") ?>
    <script>
        ClassicEditor
            .create( document.querySelector( '#icerik' ) )
            .catch( error => {
                console.error( error );
            } );
    </script>
</body>

</html>