/
var
/
www
/
html
/
gnet_live
/
storage
/
framework
/
views
/
Upload File
HOME
<!doctype html> <html lang="id-ID"> <head> <?php echo app('Illuminate\Foundation\Vite')(['resources/css/cgm.min.css', 'resources/css/section-usp.min.css']); ?> <!-- Google Tag Manager --> <script nonce="<?php echo e($nonce); ?>" id="gtm-script" data-gtm-id="<?php echo e(config('app.gtm.id')); ?>" src="<?php echo e(asset('/assets/js/gtm.js')); ?>"></script> <!-- End Google Tag Manager --> <meta name="facebook-domain-verification" content="2h9qi0cwx3smddu6aiwh9gg9xzo0x6" /> <meta charset="utf-8"> <title>Admin | GNET Indonesia</title> <meta name="description" content="GNET Building Solutions"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="shortcut icon" type="image/x-icon" href="<?php echo e(asset('assets/img/gnet.webp')); ?>"> <meta name="csrf-token" content="<?php echo e(csrf_token()); ?>"> <?php if(isset($metaTags) && $metaTags->custom_tags !== null): ?> <?php echo html_entity_decode($metaTags->custom_tags); ?> <?php endif; ?> <!-- Google Fonts --> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="<?php echo e(asset('assets/css/font.css')); ?>" rel="stylesheet"> <!-- All CSS Plugins here --> <link rel="stylesheet" href="<?php echo e(asset('assets/css/plugins/swiper-bundle.min.css')); ?>"> <link rel="stylesheet" href="<?php echo e(asset('assets/css/plugins/glightbox.min.css')); ?>"> <link rel="stylesheet" href="<?php echo e(asset('assets/css/vendor/bootstrap.min.css')); ?>"> <link nonce="<?php echo e($nonce); ?>" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css"> <link nonce="<?php echo e($nonce); ?>" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css"> <!-- Custom Style CSS --> <link rel="stylesheet" href="<?php echo e(asset('assets/css/style.min.css')); ?>"> <link rel="stylesheet" href="<?php echo e(asset('assets/css/chosen.min.css')); ?>"> <link rel="stylesheet" href="<?php echo e(asset('assets/css/about-section-homepage.min.css')); ?>"> <!-- Inline Style CSS --> <link rel="stylesheet" href="<?php echo e(asset('assets/css/inline-style.css')); ?>"> <style nonce="<?php echo e($nonce); ?>"> .only-admin .dropdown-menu { display: none; position: absolute; background-color: #fff; box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2); padding: 8px 0; z-index: 1; right: 0; margin-top: 23px; } .only-admin .dropdown-menu a { color: #000; font-size: 14px; padding: 8px 16px; text-decoration: none; display: block; } .only-admin .dropdown-menu a:hover { background-color: #ddd; } .only-admin .show { display: block; z-index: 9999; } .modal-backdrop { display: none; } .section__heading-official-brand-partner { border-bottom: 1px solid white; padding-top: 15px; padding-bottom: 15px; background-color: #ededed; } @media only screen and (max-width: 767px) { .section__heading-official-brand-partner { padding-top: 10px; padding-bottom: 10px; } } </style> </head> <body> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=<?php echo e(config('app.gtm.id')); ?>" height="0" width="0" class="inline-iframe"></iframe></noscript> <!-- End Google Tag Manager (noscript) --> <!-- Start header area --> <?php echo $__env->make('components.header', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?> <!-- End header area --> <main class="main__content_wrapper"> <!-- Start slider section --> <section class="hero__slider--section"> <div class="hero__slider--inner hero__slider--activation swiper"> <div class="hero__slider--wrapper swiper-wrapper"> <?php $__currentLoopData = $banner; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <div class="swiper-slide"> <div class="hero__slider--items"> <a href="<?php echo e($item->url); ?>" target="_blank" class="image-banner-wrapper"> <img src="<?php echo e(asset('assets/img/products/' . $item->image)); ?>.webp" class="hero__slider--bg" alt=""> </a> </div> </div> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </div> <div class="swiper__nav--btn swiper-button-next"></div> <div class="swiper__nav--btn swiper-button-prev"></div> </div> <div class="add-banner-button"> <!-- <a href="#" id="openBannerModalBtn" data-target="modal-banner"> <i class="fas fa-plus"></i> <span>Tambah Banner</span> </a> --> <a href="/master-banner" id="editBannerBtn" data-target="modal-edit-banner"> <i class="fas fa-edit"></i> <span>Edit Banner</span> </a> </div> </section> <!-- End slider section --> <!-- Start Company Value --> <?php echo $__env->make('components.company-value', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?> <!-- Start Company Value --> <!-- Start product section --> <section class="product__section inline-product__section section--padding pt-0"> <div class="container-fluid"> <div class="d-flex justify-content-between flex-wrap mb-4"> <div class="section__heading text-center mb-20"> <h3 class="section__heading--maintitle text-brand">Jelajahi Lini Produk!</h3> </div> </div> <div> <div class="product__homepage__swiper--activation"> <div class="swiper-wrapper"> <?php $__currentLoopData = $category; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <div class="swiper-slide"> <a class="instagram__thumbnail--link display-block" href="<?php if($item->url === 'lantai'): ?> https://flooring.gnetindonesia.com/ <?php else: ?> /product/<?php echo e($item->url); ?> <?php endif; ?>"> <img class="instagram__thumbnail--img display-block lazyload" src="<?php echo e(asset('assets/img/products/' . $item->image)); ?>" alt="Image <?php echo e($item->name); ?>"> <p><?php echo e($item->name); ?></p> </a> </div> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </div> <div class="product__homepage__swiper-nav-container"> <div class="product__homepage__swiper__nav--btn product__homepage-swiper-button-prev"> <i class="fa-solid fa-chevron-left fa-2xl"></i> </div> <div class="product__homepage__swiper__nav--btn product__homepage-swiper-button-next"> <i class="fa-solid fa-chevron-right fa-2xl"></i> </div> </div> </div> </div> </div> </section> <!-- End product section --> <!-- Start banner section --> <?php echo $__env->make('components.iklan-home', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?> <!-- End banner section --> <section class="about__section__homepage section--padding"> <div class="container-fluid"> <h2 class="section__heading--maintitle"><?php echo e($dataSectionAbout['title_section_about_homepage'] ?? 'Sekilas Tentang Kami'); ?></h2> <div class="about__section__homepage--wrapper"> <div class="about__section__homepage--image"> <img class="" width="640" height="457" src="<?php echo e(asset('assets/img/products/' . $dataSectionAbout['image_section_about_homepage']['image'])); ?>" alt="<?php echo e($dataSectionAbout['image_section_about_homepage']['value']); ?>"> </div> <div class="about__section__homepage--info"> <form id="editorjs-form" method="POST" action="<?php echo e(route('global.update', $descId)); ?>"> <?php echo csrf_field(); ?> <?php echo method_field('PUT'); ?> <input type="hidden" name="key" value="desc_section_about_homepage"> <div class="cms-editable" data-storage="desc_section_about_homepage" data-content="<?php echo e($dataSectionAbout['desc_section_about_homepage']); ?>"></div> <button class="save-button" data-storage="desc_section_about_homepage"> <i class="fa fa-save"></i> Save</button> </form> <a href="<?php echo e($dataSectionAbout['button_link_section_about_homepage'] ?? '#'); ?>"> <?php echo e($dataSectionAbout['button_label_section_about_homepage'] ?? 'Read More'); ?> </a> </div> </div> </div> </section> <!-- Start blog section --> <section class="blog__section section--padding pt-0"> <div class="container-fluid"> <div class="section__heading text-center mb-30"> <h2 class="section__heading--maintitle text-brand">News & Articles</h2> </div> <div class="blog__section--inner blog__swiper--activation swiper"> <div class="swiper-wrapper"> <?php $__currentLoopData = $articles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $article): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <div class="swiper-slide"> <div class="blog__items"> <div class="blog__thumbnail"> <a class="blog__thumbnail--link display-block" href="/blogs/<?php echo e($article->url); ?>"> <img class="blog__thumbnail--img display-block" src="<?php echo e(asset('uploads/' . $article->banner_image)); ?>" alt="<?php echo e($article->alt_text); ?>"> </a> </div> <div class="blog__content"> <a href="/blogs/<?php echo e($article->url); ?>"> <h3 class="blog__content--title"><?php echo e($article->title); ?></h3> <button class="blog__content--btn primary__btn">Read more </button> </a> </div> </div> </div> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </div> <div class="swiper__nav--btn swiper-button-next"></div> <div class="swiper__nav--btn swiper-button-prev"></div> </div> </div> </section> <!-- End blog section --> <!-- Start brand logo section --> <?php echo $__env->make('components.logo-swiper',['hideTitle' => true], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?> <!-- End brand logo section --> </main> <!-- Start footer section --> <?php echo $__env->make('components.footer', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?> <!-- End footer section --> <!-- <div class="modal" id="modal-create"> <div class="popup__main--wrapper"> <div class="popup__header__input"> <h4 class="inline-margin-right-auto">Create Data</h4> <button class="close-modal popup__close--btn" aria-label="close modal" data-close>✕ </button> </div> <div class="popup__info__input"> <form id="form-tambah-product"> <div class="form-group"> <label for="name">Product Name:</label> <input class="form-input" type="text" id="name" name="name"> </div> <div class="form-group"> <label for="description">Url:</label> <input class="form-input" type="text" id="url" name="url"> </div> <div class="form-group"> <label for="description">Category:</label> <select name="category_id" id="category_id"> <option value="" disabled selected>Choose Category</option> <?php $__currentLoopData = json_decode(@$category); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ctgy): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($ctgy->id); ?>"><?php echo e($ctgy->name); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> </div> <div class="form-group"> <label for="description">Brand:</label> <select name="brand_id"> <option value="" disabled selected>Choose Brand</option> <?php $__currentLoopData = json_decode(@$brand); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $brnd): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($brnd->id); ?>"><?php echo e($brnd->name); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> </div> <div class="form-group"> <label for="description">Keywords:</label> <input class="form-input" type="text" id="keywords" name="keywords"> </div> <div class="form-group"> <label for="description">Short Text:</label> <textarea class="form-input" name="short_text" id="short_text"></textarea> </div> <div class="form-group"> <label for="description">Information Product:</label> <textarea class="form-input" name="product_info" id="product_info"></textarea> </div> <div class="form-group"> <label for="description">Additional Information:</label> <textarea class="form-input" name="additional_info" id="additional_info"></textarea> </div> <div class="form-group mb-4"> <label for="description">Tags:</label> <select name="tags[]" id="tags-miltiple" data-placeholder="Choose Tags" multiple> <?php $__currentLoopData = $tags; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tag): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($tag->id); ?>"><?php echo e($tag->name); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> </div> <button type="submit" id="submitBtn" class="primary__btn">Submit</button> </form> </div> </div> </div> --> <div class="modal" id="modal-news"> <div class="popup__main--wrapper"> <div class="popup__header__input"> <h4 class="inline-margin-right-auto">Create Data</h4> <button class="close-modal popup__close--btn" aria-label="close modal" data-close>✕ </button> </div> <div class="popup__info__input"> <!-- Input Fields --> <form id="form-tambah-news"> <div class="form-group"> <label for="name">Title:</label> <input class="form-input" type="text" id="title" name="title" required> </div> <div class="form-group"> <label for="description">Url:</label> <input class="form-input" type="text" id="url" name="url" required> </div> <div class="form-group"> <label for="author">Author:</label> <input class="form-input" type="text" id="author" name="author" required> </div> <div class="form-group"> <label for="tanggal">Date:</label> <input class="form-input" type="date" id="date" name="date" required> </div> <div class="form-group"> <label for="banner">Banner Image:</label> <input class="form-input" type="file" id="banner_image" name="banner_image" accept="image/*" required> </div> <div class="form-group"> <label for="bannerLow">Banner Image Low:</label> <input class="form-input" type="file" id="banner_image_low" name="banner_image_low" accept="image/*"> </div> <div class="form-group"> <label for="bannerMobile">Banner Image Mobile:</label> <input class="form-input" type="file" id="banner_image_mobile" name="banner_image_mobile" accept="image/*"> </div> <div class="form-group"> <label for="bannerMobileLow">Banner Image Mobile Low:</label> <input class="form-input" type="file" id="banner_image_mobile" name="banner_image_mobile_low" accept="image/*"> </div> <div class="form-group"> <label for="bannerMobileLow">Alt Text:</label> <input class="form-input" type="text" id="alt_alt" name="alt_text"> </div> <div class="form-group"> <label for="bannerMobileLow">Meta Title:</label> <input class="form-input" type="text" id="meta_title" name="meta_title" required> </div> <div class="form-group"> <label for="bannerMobileLow">Meta Description:</label> <input class="form-input" type="text" id="meta_description" name="meta_description" required> </div> <div class="form-group"> <label for="bannerMobileLow">Content:</label> <textarea class="form-input" name="content" id="content" required></textarea> </div> <div class="form-group"> <label for="bannerMobileLow">Keywords:</label> <input class="form-input" type="text" id="keywords" name="keywords" required> </div> <button type="submit" class="primary__btn">Submit</button> </form> </div> </div> </div> <div class="modal" id="modal-banner"> <div class="popup__main--wrapper"> <div class="popup__header__input"> <h4 class="inline-margin-right-auto">Create Data</h4> <button class="close-modal popup__close--btn" aria-label="close modal" data-close>✕ </button> </div> <div class="popup__info__input"> <!-- Input Fields --> <form id="form-tambah-banner"> <div class="form-group"> <label for="page">Page:</label> <input class="form-input" type="text" id="page" name="page" required> </div> <div class="form-group"> <label for="page">Url:</label> <input class="form-input" type="text" id="url" name="url"> </div> <div class="form-group"> <label for="image">Image:</label> <input class="form-input" type="file" id="image" name="image" accept="image/*" required> </div> <div class="form-group"> <label for="headline">Headline:</label> <input class="form-input" type="text" id="headline" name="headline" required> </div> <div class="form-group"> <label for="deskripsi">Description:</label> <input class="form-input" type="text" id="description" name="description" required> </div> <div class="form-group"> <label for="cta">CTA:</label> <input class="form-input" type="text" id="cta" name="cta" required> </div> <button type="submit" class="primary__btn">Submit</button> </form> </div> </div> </div> <div class="modal" id="modal-edit"> <div class="popup__main--wrapper"> <div class="popup__header__input"> <h4 class="inline-margin-right-auto">Edit Product Recommendations</h4> <button class="close-modal popup__close--btn" aria-label="close modal" data-close>✕ </button> </div> <div class="popup__info__input"> <!-- Input Fields --> <div class="modal-body" id="modal-body-edit"> </div> </div> </div> </div> <!-- Scroll top bar --> <button aria-label="scroll top btn" id="scroll__top"> <svg xmlns="http://www.w3.org/2000/svg" class="ionicon" viewBox="0 0 512 512"> <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="M112 244l144-144 144 144M256 120v292" /> </svg> </button> <!-- Floating WhatsApp --> <?php echo $__env->make('components.floating-whatsapp', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?> <!-- All Script JS Plugins here --> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script nonce="<?php echo e($nonce); ?>" src="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.js"></script> <link nonce="<?php echo e($nonce); ?>" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/multiple-select-js/dist/css/multiple-select.css"> <script nonce="<?php echo e($nonce); ?>" src="https://cdn.jsdelivr.net/npm/multiple-select-js/dist/js/multiple-select.js"></script> <script src="assets/js/vendor/popper.js" defer="defer"></script> <script src="assets/js/vendor/bootstrap.min.js" defer="defer"></script> <script src="assets/js/plugins/swiper-bundle.min.js" defer="defer"></script> <script src="assets/js/plugins/glightbox.min.js" defer="defer"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/lazysizes/5.3.2/lazysizes.min.js" integrity="sha512-q583ppKrCRc7N5O0n2nzUiJ+suUv7Et1JGels4bXOaMFQcamPk9HjdUknZuuFjBNs7tsMuadge5k9RzdmO+1GQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> <!-- IF LOGIN ADMIN --> <script src="<?php echo e(asset('assets/js/editorjs.umd.min.js')); ?>"></script> <!-- END LOGIN ADMIN --> <!-- Customscript js --> <script src="assets/js/script.min.js" defer="defer"></script> <script src="assets/js/swiper-products-homepage.min.js" defer="defer"></script> <script nonce="<?php echo e($nonce); ?>"> new MultipleSelect('#tags-multiple', { placeholder: 'Pilih Tag' }) function openModal() { var modalId = this.getAttribute('data-target'); var modal = document.getElementById(modalId); if (modal) { modal.classList.add('is-visible'); } } function openModal_news() { var modalId = this.getAttribute('data-target'); var modal = document.getElementById(modalId); if (modal) { modal.classList.add('is-visible'); } } function openModal_banner() { var modalId = this.getAttribute('data-target'); var modal = document.getElementById(modalId); if (modal) { modal.classList.add('is-visible'); } } document.addEventListener('DOMContentLoaded', function() { var closeModalBtn = document.getElementById('closeModalBtn'); // Product Modal var openProductModalBtn = document.getElementById('openProductModalBtn'); if (openProductModalBtn) { openProductModalBtn.addEventListener('click', openModal); } // News Modal var openNewsModalBtn = document.getElementById('openNewsModalBtn'); if (openNewsModalBtn) { openNewsModalBtn.addEventListener('click', openModal_news); } // Banner Modal var openBannerModalBtn = document.getElementById('openBannerModalBtn'); if (openBannerModalBtn) { openBannerModalBtn.addEventListener('click', openModal_banner); } if (closeModalBtn) { closeModalBtn.addEventListener('click', closeModal); } }); </script> <script nonce="<?php echo e($nonce); ?>"> $(document).ready(function() { $('#form-tambah-product').submit(function(e) { e.preventDefault(); var formData = new FormData($('#form-tambah-product')[0]); $.ajax({ url: '/simpan-product', type: 'POST', data: formData, processData: false, contentType: false, headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') }, success: function(response) { console.log(response.message); if (response.success) { handleSuccess(); } else { handleError(response.message); } }, error: function(xhr) { console.error('AJAX Error:', xhr); } }); }); function handleSuccess() { $('#modal-create').removeClass('is-visible'); Swal.fire({ text: 'Data berhasil ditambahkan.', icon: 'success', showConfirmButton: false, }); location.reload(); var categoryId = $('#category_id').val(); $.ajax({ url: '/product/' + categoryId, type: 'GET', success: function(response) { var categoryName = response.category_name; var redirectUrl = '/product/' + categoryName; window.location.href = redirectUrl; }, error: function(xhr) { console.error('AJAX Error:', xhr); } }); } function handleError(errorMessage) { Swal.fire({ text: errorMessage, icon: 'error' }); } }); </script> <script nonce="<?php echo e($nonce); ?>"> $(document).ready(function() { $('#form-tambah-news').submit(function(e) { e.preventDefault(); var formData = new FormData(this); $.ajax({ url: '/simpan-news', type: 'POST', data: formData, processData: false, contentType: false, headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') }, success: function(response) { console.log(response.message); if (response.success) { handleSuccess(); } else { handleError(response.message); } }, error: function(xhr) { console.error('AJAX Error:', xhr); } }); }); function handleSuccess() { $('#modal-news').removeClass('is-visible'); Swal.fire({ text: 'Data berhasil ditambahkan.', icon: 'success', showConfirmButton: false, }); location.reload(); var categoryId = $('#category_id').val(); $.ajax({ url: '/news/' + categoryId, type: 'GET', success: function(response) { var categoryName = response.category_name; var redirectUrl = '/news/' + categoryName; window.location.href = redirectUrl; }, error: function(xhr) { console.error('AJAX Error:', xhr); } }); } function handleError(errorMessage) { Swal.fire({ text: errorMessage, icon: 'error' }); } }); </script> <script nonce="<?php echo e($nonce); ?>"> $(document).ready(function() { $('#form-tambah-banner').submit(function(e) { e.preventDefault(); var formData = new FormData($('#form-tambah-banner')[0]); $.ajax({ url: '/simpan-banner', type: 'POST', data: formData, processData: false, contentType: false, headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') }, success: function(response) { console.log(response.message); if (response.success) { handleSuccess(); } else { handleError(response.message); } }, error: function(xhr) { console.error('AJAX Error:', xhr); } }); }); function handleSuccess() { $('#modal-banner').removeClass('is-visible'); Swal.fire({ text: 'Data berhasil ditambahkan.', icon: 'success', showConfirmButton: false, }); location.reload(); } function handleError(errorMessage) { Swal.fire({ text: errorMessage, icon: 'error' }); } }); </script> <script nonce="<?php echo e($nonce); ?>"> $(document).ready(function() { $('.open-modal-edit').on('click', function() { var dataURL = $(this).attr('href'); $('#modal-body-edit').load(dataURL, function() { $('#modal-edit').addClass('is-visible'); }); }); }) </script> <script nonce="<?php echo e($nonce); ?>"> $(document).ready(function() { $('.logout-link').on('click', function(e) { e.preventDefault(); $('#logout-form').submit(); }); }); </script> <script nonce="<?php echo e($nonce); ?>" type="module"> document.addEventListener("DOMContentLoaded", function () { function convertDataToHtml(blocks) { var convertedHtml = ""; blocks.map((block) => { switch (block.type) { case "header": convertedHtml += `<h${block.data.level}>${block.data.text}</h${block.data.level}>`; break; case "embded": convertedHtml += `<div><iframe width="560" height="315" src="${block.data.embed}" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe></div>`; break; case "paragraph": convertedHtml += `<p>${block.data.text}</p>`; break; case "delimiter": convertedHtml += "<hr />"; break; case "image": convertedHtml += `<img class="img-fluid" src="${block.data.file.url}" title="${block.data.caption}" /><br /><em>${block.data.caption}</em>`; break; case "imageupload": convertedHtml += `<img class="inline-width-100" src="${block.data.url}" />`; break; case "list": if ((block.data.style = "unordered")) { convertedHtml += "<ul>"; block.data.items.forEach(function (li) { convertedHtml += `<li>- ${li.content}</li>`; }); convertedHtml += "</ul>"; } else { convertedHtml += "<ol>"; block.data.items.forEach(function (li) { convertedHtml += `<li>${li.content}</li>`; }); convertedHtml += "</ol>"; } break; case "table": convertedHtml += '<div class="table-responsive"><table class="table table-bordered">'; block.data.content.forEach(function (tr) { convertedHtml += `<tr>`; tr.forEach(function (td) { convertedHtml += `<td>${td}</td>`; }); convertedHtml += `</tr>`; }); convertedHtml += "</table></div>"; break; default: console.log("Unknown block type", block.type); break; } }); return convertedHtml; } let editors = {}; document.querySelectorAll(".cms-editable").forEach((element) => { const storageKey = element.getAttribute("data-storage"); element.setAttribute("id", storageKey); // Get the database content from a data attribute const dbContent = element.getAttribute("data-content"); // Initialize EditorJS with the database content editors[storageKey] = new EditorJS({ holder: storageKey, inlineToolbar: true, tools: { // }, data: { blocks: dbContent ? [ { type: "paragraph", data: { text: dbContent } } ] : [ { type: "paragraph", data: { text: element.innerHTML.trim() } } ] } }); }); // Event listener untuk tombol save document .getElementById("editorjs-form") .addEventListener("submit", function (event) { event.preventDefault(); let form = this; let formData = new FormData(form); const storageKey = document .querySelector(".cms-editable") .getAttribute("data-storage"); if (editors[storageKey]) { editors[storageKey].save().then((outputData) => { let convertedHtml = convertDataToHtml(outputData.blocks); formData.append("value", convertedHtml); fetch(form.action, { method: "POST", body: formData, headers: { "X-Requested-With": "XMLHttpRequest", "X-CSRF-TOKEN": document.querySelector( 'input[name="_token"]' ).value, }, }) .then((response) => response.json()) .then((data) => { if (data.success) { Swal.fire({ title: "Berhasil!", text: data.message, icon: "success", }).then(() => { location.reload(); }); } else { Swal.fire({ title: "Gagal!", text: data.message || "Terjadi kesalahan.", icon: "error", }); } }) .catch((error) => { console.error("Error:", error); Swal.fire({ title: "Error!", text: "Terjadi kesalahan saat mengirim data.", icon: "error", }); }); }); } }); }); </script> </body> </html> <?php /**PATH /var/www/html/gnet_live/resources/views/index_admin.blade.php ENDPATH**/ ?>