<!DOCTYPE html>
<html lang="id">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes">
<meta name="csrd-token" content="{{ csrf_token() }}">
<meta property="og:site_name" content="Hayyu Mart">
<meta property="og:title" content="Hayyu Mart">
<meta property="og:description" content="
Menyediakan berbagai sayur segar dan buah segar import dan lokal berkualitas, serta menyediakan Kebutuhan Pokok dan Rumah Tangga dan Aneka kebutuhan lainnya.">
<meta property="og:type" content="website">
<title>Hayyu Mart</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" integrity="sha512-1ycn6IcaQQ40/MKBW2W4Rhis/DbILU74C1vSrLJxCq57o941Ym01SwNsOMqvEBFlcgUa6xLiPY/NS5R+E6ztJQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
{{-- <link rel="stylesheet" href="https://unpkg.com/aos@next/dist/aos.css" /> --}}
<style type="text/css">
:root {
/* --website-color: #e67e22; */
--website-color: #2acd2f;
--background-color: #f7f7f9;
}
.cart-content-detail-list{
padding: 5px 10px;
}
.splide__slide{
margin: 0 10px !important;
border-radius: 10px;
}
.desc-kategori{
border-radius: 10px;
display: block;
width: 100%;
height: 100%;
background: rgba(0,0,0,.6);
color: white !important;
text-decoration: none !important;
font-size: 18px;
line-height: 76px;
padding-left: 30px;
text-align: left;
}
.category-scroll {
overflow-x: auto;
overflow-y: auto;
display: inline-flex;
max-width: 100%;
}
.category-scroll-item {
min-width: 150px;
max-width: 150px;
height: auto;
flex: 1;
overflow: hidden;
margin: 8px;
cursor: pointer;
}
.category-scroll-item-img {
background: white;
border-radius: 8px;
margin: auto;
border: 1px solid rgb(232, 232, 232);
}
.category-scroll-item-txt {
text-align: center;
margin: 8px 0px;
font-size: 13px;
font-weight: 500;
color: black;
max-height: 24px;
}
@media only screen and (max-width: 360px) {
.category-scroll-item {
min-width: 65px;
max-width: 65px;
height: auto;
flex: 1;
overflow: hidden;
margin: 8px;
cursor: pointer;
}
.category-scroll-item-img {
background: white;
border-radius: 8px;
margin: auto;
}
.category-scroll-item-txt {
text-align: center;
margin: 8px 0px;
font-size: 12px;
font-weight: 500;
color: black;
}
}
.btn-note.delete {
width: 40px !important;
color: var(--website-color);
}
.btn-note.delete .delete-icon {
width: 18px;
vertical-align: middle;
}
#note-popup {
position: fixed;
top: 0;
height: 100%;
max-width: 480px;
background: rgba(0, 0, 0, .5);
margin: auto;
z-index: 9999999;
}
#note-popup .card {
top: 50%;
position: relative;
transform: translateY(-50%);
margin: 8px;
}
#note-popup #title h4 {
margin: 24px;
float: left;
}
#note-popup #title {
width: 100%;
border-bottom: 1px solid #e8e8e8;
}
#note-popup #content {
margin: 8px;
}
#note-popup #title #btn-close {
float: right;
height: 24px;
width: 24px;
margin: 12px;
}
#note-popup #btn-save {
background: var(--website-color);
width: 60px;
border: 1px solid var(--website-color);
cursor: pointer;
margin: 0;
font-size: 14px;
line-height: 0;
text-align: center;
height: 30px;
padding: 0;
margin: 12px;
float: right;
color: #fff;
font-weight: 700;
border-radius: 6px;
}
</style>
<link rel="stylesheet" href="{{ asset('landing_assets/style-v2.css') }}" type="text/css" media="all">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tiny-slider/2.9.3/tiny-slider.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/tiny-slider/2.9.2/min/tiny-slider.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@splidejs/[email protected]/dist/css/splide.min.css">
<link rel="shortcut icon" type="image/png" href="{{ asset('favicon.png') }}">
<link href="{{ asset('favicon.png') }}" rel="icon" sizes="32x32">
<meta content="{{ asset('favicon.png') }}" name="msapplication-TileImage">
</head>
<body style="overflow: auto;background:var(--background-color);" cz-shortcut-listen="true">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<header>
<div class="site-header">
<div class="wrapper">
<div class="headerbox">
<div class="logo-img">
<a href="{{ url('') }}">
<img src="{{asset('images/'.Helper::logo()) }}" width="auto" height="auto" data-was-processed="true">
</a>
</div>
<div class="searchbox">
<form method="get" action="{{ url('') }}">
<input type="text" name="q" placeholder="Cari Produk.." value="">
<button type="submit">
<i class="fa fa-search"></i>
</button>
</form>
</div>
</div>
</div>
</div>
</header>
<div class="container-wrapper" style="padding-top: 15px;">
{{-- Jika Tidak Ada Pencarian nama Barang --}}
@if(!Request()->get('q'))
<div class="slider content-area" id="slider-wrapper">
@foreach ($slider as $s)
<div class="slide text-center">
<!-- <a href="#" target="_blank"> -->
<img src="{{ asset('images/slider/'.$s->foto_path) }}" class="beacon">
{{-- <div class="spinner-border" role="status">
<span class="visually-hidden">Loading...</span>
</div> --}}
<!-- </a> -->
</div>
@endforeach
</div>
<div class="mb-2 p-3" style="background-color:#ffffff;">
<div class="pt-3">
<h1 class="fw-bold">
<a href="#" style="color: #404040;">
Kategori
</a>
</h1>
</div>
<hr>
<div id="image-slider" class="splide">
<div class="splide__track">
<ul class="splide__list">
@foreach ($kategori as $k)
<li class="splide__slide text-center">
<img src="{{ asset('images/kategori/'.$k->foto_path) }}">
<a href="{{ url('k/'. $k->kd_kategori) }}" class="desc-kategori">
{{ $k->nm_kategori }}
</a>
</li>
@endforeach
</ul>
</div>
</div>
<!-- /Category Scroll -->
</div>
{{-- Barang Yang Promo --}}
<main class="main p-3 mb-4" style="background-color:#ffffff;">
<div class="pt-3">
<h1 class="fw-bold">
<a href="#" style="color: #4B79DF;">
Promo
<i class="fa fa-star"></i>
</a>
</h1>
</div>
<hr>
<div class="wrapper">
@foreach ($barangPromo as $b)
<section class="productbox" data-id="{{ $b->kd_barang }}"
data-image="{{ url('images/barang/'.$b->gambar_barang) }}" data-name="{{ $b->nm_barang }}"
data-price="{{ $b->harga_barang[0]->harga_jual - $b->harga_barang[0]->diskon }}" data-stok="{{ $b->stok }}">
<div class="content" style="padding-bottom: 20px;">
<div class="image">
<img class="lazy" data-src="{{ url('images/barang/'.$b->gambar_barang) }}"
data-was-processed="true">
@if($b->harga_barang[0]->diskon > 0)
<span class="ribbon">Promo</span>
@endif
</div>
<div class="detail">
<h3>
<a href="#" rel="bookmark"> {{ $b->nm_barang }} </a>
</h3>
<div class="desc">
<p>{{ $b->desk }}</p>
</div>
<div class="pricing">
<div id="atc-item-1" class="atc clear">
<input type="hidden" name="note" value="">
<div class="qty qty-selector clear" style="display: none;">
<input type="hidden" value="{{ $b->kd_barang }}" name="produk_id">
<button class="btn-note">+ Catatan</button>
<div class="qty-selector-button">
<button type="button" class="minus button-qty"
data-qty-action="minus">-</button>
<input min="0" type="number" value=1 name="item_qty">
<button type="button" class="plus button-qty"
data-qty-action="plus">+</button>
</div>
</div>
<button class="add button-add" style="display: block;">Beli +</button>
</div>
{{-- <span class="price">Rp. {{ number_format($b->harga_barang[0]->harga_jual - $b->harga_barang[0]->diskon) }}</span>
@if($b->harga_barang[0]->diskon > 0)
<span class="price-silk">Rp. {{ number_format($b->harga_barang[0]->harga_jual) }}</span>
@endif --}}
</div>
</div>
</div>
</section>
@endforeach
</div>
</main>
{{-- List Barang Terlaris --}}
<main class="main p-3 mb-4" style="background-color:#ffffff;">
<div class="pt-3">
<h1 class="fw-bold">
<a href="#" style="color: #A27549;">
Barang Terlaris
<i class="fa fa-fire"></i>
</a>
</h1>
<hr>
<div class="wrapper">
</div>
@foreach ($barangTerlaris as $b)
<section class="productbox" data-id="{{ $b->kd_barang }}"
data-image="{{ url('images/barang/'.$b->gambar_barang) }}" data-name="{{ $b->nm_barang }}"
data-price="{{ $b->harga_barang[0]->harga_jual - $b->harga_barang[0]->diskon }}" data-stok="{{ $b->stok }}" >
<div class="content" style="padding-bottom: 20px;">
<div class="image">
<img class="lazy" data-src="{{ url('images/barang/'.$b->gambar_barang) }}"
data-was-processed="true">
@if($b->harga_barang[0]->diskon > 0)
<span class="ribbon">Promo</span>
@endif
<span class="ribbon-terlaris">Terlaris</span>
</div>
<div class="detail">
<h3>
<a href="#" rel="bookmark"> {{ $b->nm_barang }} </a>
</h3>
<div class="desc">
<p>{{ $b->desk }}</p>
</div>
<div class="pricing">
<div id="atc-item-1" class="atc clear">
<input type="hidden" name="note" value="">
<div class="qty qty-selector clear" style="display: none;">
<input type="hidden" value="{{ $b->kd_barang }}" name="produk_id">
<button class="btn-note">+ Catatan</button>
<div class="qty-selector-button">
<button type="button" class="minus button-qty"
data-qty-action="minus">-</button>
<input min="0" type="number" value=1 name="item_qty">
<button type="button" class="plus button-qty"
data-qty-action="plus">+</button>
</div>
</div>
<button class="add button-add" style="display: block;">Beli +</button>
</div>
{{-- <span class="price">Rp. {{ number_format($b->harga_barang[0]->harga_jual - $b->harga_barang[0]->diskon) }}</span>
@if($b->harga_barang[0]->diskon > 0)
<span class="price-silk">Rp. {{ number_format($b->harga_barang[0]->harga_jual) }}</span>
@endif --}}
</div>
</div>
</div>
</section>
@endforeach
</div>
</main>
@else
<div class="mb-2 p-3 text-center" style="background-color: var(--website-color);">
<div class="pt-3">
<h1 class="fw-bold">
Hasil Pencarian "{{ Request()->get('q') }}"
</h1>
</div>
</div>
@endif
{{-- List Barang --}}
@foreach ($kategoriBarang as $k)
<main class="main p-3 mb-4" style="background-color:#ffffff;">
<div class="pt-3">
<h1 class="fw-bold">
<a href="{{ url('k/'. $k->kd_kategori) }}" style="color: #404040;">
{{ $k->nm_kategori }}
</a>
</h1>
<hr>
<div class="wrapper">
</div>
@foreach ((Request::is('/')) ? $k->barang->take(5) : $k->barang as $b)
<section class="productbox" data-id="{{ $b->kd_barang }}"
data-image="{{ url('images/barang/'.$b->gambar_barang) }}" data-name="{{ $b->nm_barang }}"
data-price="{{ $b->harga_barang[0]->harga_jual - $b->harga_barang[0]->diskon }}" data-stok="{{ $b->stok }}" >
<div class="content" style="padding-bottom: 20px;">
<div class="image">
<img class="lazy" data-src="{{ url('images/barang/'.$b->gambar_barang) }}"
data-was-processed="true">
@if($b->harga_barang[0]->diskon > 0)
<span class="ribbon">Promo</span>
@endif
</div>
<div class="detail">
<h3>
<a href="#" rel="bookmark"> {{ $b->nm_barang }} </a>
</h3>
<div class="desc">
<p>{{ $b->desk }}</p>
</div>
<div class="pricing">
<div id="atc-item-1" class="atc clear">
<input type="hidden" name="note" value="">
<div class="qty qty-selector clear" style="display: none;">
<input type="hidden" value="{{ $b->kd_barang }}" name="produk_id">
<button class="btn-note">+ Catatan</button>
<div class="qty-selector-button">
<button type="button" class="minus button-qty"
data-qty-action="minus">-</button>
<input min="0" type="number" value=1 name="item_qty">
<button type="button" class="plus button-qty"
data-qty-action="plus">+</button>
</div>
</div>
<button class="add button-add" style="display: block;">Beli +</button>
</div>
{{-- <span class="price">Rp. {{ number_format($b->harga_barang[0]->harga_jual - $b->harga_barang[0]->diskon) }}</span>
@if($b->harga_barang[0]->diskon > 0)
<span class="price-silk">Rp. {{ number_format($b->harga_barang[0]->harga_jual) }}</span>
@endif --}}
</div>
</div>
</div>
</section>
@endforeach
@if($k->barang->count() > 5)
@if(Request::is('/'))
<div class="text-center" style="color: var(--website-color) !important;">
<a href="{{ url('k/'. $k->kd_kategori) }}" >
Tampilkan Lebih Banyak
</a>
</div>
@endif
@endif
</div>
</main>
@endforeach
<footer class="product-footer">
<div class="site-footer">
<div style="display: inline-flex;width: 100%;">
<div class="footer-logo" style="display:inline-flex;width:calc(100% - 100px);margin-left:8px;">
<a href="{{ url('') }}" class="footer-logo a">
<img src="{{asset('images/'.Helper::logo()) }}" width="64px" style="border-radius:10px;">
</a>
<div>
<div class="footer-logo name">
<a href="{{ url('') }}">{{ $profil->nama }}</a>
</div>
<div class="footer-logo address">
{{ $profil->alamat }}</div>
</div>
</div>
<div style="text-align:right;max-width:85px !important;margin:0px 4px">
<div>
</div>
</div>
</div>
<hr style="margin-bottom: 0;margin-top: 18px;">
<div style="padding-bottom: 8px;text-align: center;color: black">
<div class="copyright" style="margin-top: 0 !important; margin-bottom: 12px;"><b>
Copyright © 2021 <a href="http://green-nusa.net/" target="_blank">Green Nusa</a> </b>
</div>
</div>
</div>
<div class="basketbox" style="display: none;">
<div class="wrapper" style="padding:0px 4px;">
<div class="basket-body" style="background: var(--website-color)">
<div class="basket">
<div class="basket-detail">
<div class="basket-items">
<span class="basket-items-qty"></span> |
<span class="basket-items-prices"></span>
</div>
<div class="basket-items-store">Klik disini untuk lanjut</div>
</div>
<div class="basket-icon">
<img src="{{ asset('landing_assets/cart.svg') }}">
</div>
</div>
</div>
</div>
</div>
<div id="cart" class="cart" style="display: none;">
<div class="cart-inner">
<div class="cart-head">
<div class="wrapper-cart">
<div class="back">
<span class="cart-head-store">{{ $profil->nama }}</span>
</div>
</div>
</div>
<div class="cart-content">
<div class="wrapper-cart">
<div class="cart-content-items">
<div class="cart-content-items-head">
<div class="cart-content-items-head-title">
Total Belanja Anda
</div>
<div class="cart-content-items-head-add"><a href="{{ url('') }}">Kembali</a></div>
</div>
<div class="cart-content-items-list">
</div>
</div>
<div class="cart-content-form">
<div class="cart-content-form-head">
<div class="cart-content-form-head-title">
Data Anda
</div>
</div>
<div class="cart-content-form-list">
<div class="customer">
<div class="customer-field">
<label>Nama:</label>
<input type="text" name="name" value="dummy">
</div>
<div class="customer-field">
<label>Nomor Handphone:</label>
<input type="number" name="phone" value="081347997165">
</div>
<div class="customer-field">
<label>Alamat Lengkap:</label>
<textarea name="address">samarinda</textarea>
</div>
<div class="customer-field">
<label>Pesan untuk Penjual:</label>
<textarea name="note"></textarea>
</div>
</div>
</div>
</div>
<div class="cart-content-form" id="shipping">
<div class="cart-content-form-head">
<div class="cart-content-form-head-title">
Pilih Jenis Pengiriman
</div>
</div>
<div class="cart-content-form-list">
<div class="customer">
<div class="customer-field">
<select class="customer-field" id="shipping-dropdown" style="width: 100%">
<option value="wa" selected="">Konfirmasi biaya kirim via WA</option>
</select>
</div>
<div class="customer-field">
<label></label>
</div>
</div>
</div>
</div>
<div class="cart-content-form">
<div class="cart-content-form-head">
<div class="cart-content-form-head-title">
Pilih Cara Pembayaran
</div>
</div>
<div class="cart-content-form-list">
<div class="customer">
<div class="customer-field">
<select class="customer-field" id="payment-dropdown" style="width: 100%">
<option value="cod" selected="selected">Bayar Tunai atau COD (Cash On Delivery)</option>
<option value="transfer" selected="selected">Bank Transfer</option>
</select>
</div>
</div>
</div>
</div>
<div class="cart-content-detail">
<div class="cart-content-detail-head">
<div class="cart-content-detail-head-title">
Total Pesanan
</div>
</div>
<div class="cart-content-detail-list">
<table width="100%">
<tbody>
<tr>
<td>Total Harga</td>
<td class="ttl-harga">Rp. 45.000</td>
</tr>
<tr id="ongkir-row">
<td>Biaya Kirim</td>
<td id="ongkir-value">(belum termasuk biaya kirim)</td>
</tr>
<tr id="total-payment">
<td>Total Pembayaran</td>
<td class="ttl-pembayaran"><b>Rp. 45.000</b></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="cart-content-submit">
<div style="text-align:center;font-size:13px;margin-bottom: 10px;">
<div>
Pesanan Anda akan langsung dikirimkan ke <strong>WhatsApp Penjual.</strong></div>
<div>
Harga sewaktu-waktu dapat berubah. Ketersediaan stok barang akan di-infokan.</div>
</div>
<button type="button" id="submit">Pesan</button>
</div>
</div>
</div>
</div>
</div>
<div id="note-popup" class="container" style="display: none;" data-produkid="">
<div class="card">
<div>
<div id="title">
<h4>Tambahkan Catatan</h4>
<img id="btn-close" src="{{ asset('landing_assets/close.png') }}">
<div class="clear"></div>
</div>
<div id="content">
<textarea name="note" placeholder="Masukkan catatan disini.."></textarea>
</div>
<button id="btn-save">Simpan</button>
<div class="clear"></div>
</div>
</div>
</div>
</footer>
</div>
<div class="fab-container">
<a href="https://wa.me/{{ $profil->no_telepon }}" style="text-decoration: none;" target="_blank">
<div class="fab2 fab-icon-holder">
<i class="fab fa-whatsapp" aria-hidden="true" style="margin-left: 0px;"></i>
</div>
</a>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-migrate-1.4.1.min.js"></script>
{{-- <script src="https://unpkg.com/aos@next/dist/aos.js"></script> --}}
<script src="https://cdn.jsdelivr.net/npm/@splidejs/[email protected]/dist/js/splide.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.lazy/1.7.9/jquery.lazy.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.lazy/1.7.9/jquery.lazy.plugins.min.js"></script>
<script>
$(document).ready(function(){
$('.lazy').Lazy();
// AOS.init();
new Splide('.splide', {
'perPage': 3,
'perMove': 2,
'lazyLoad': 'nearby',
'height': '5.3rem',
'rewind': false,
'cover' : true,
'heightRatio': 0.5,
'pagination': false
}).mount();
let produks = [];
let ls = localStorage;
/*
Function Mengubah Format Menjadi Money
*/
function money(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
/*
Function Save array produks ke local Storage Browser
*/
function saveLocalStorage(){
localStorage.setItem('cart', JSON.stringify(produks));
proceedCart();
}
/*
Function Tambah produk, dengan parameter object produk itu sendiri
*/
function addProduk(produk){
produks.push(produk);
saveLocalStorage();
}
/*
Function Delete produk berdasarkan index pada array produks
*/
function deleteProduk(indexProduk){
produks.splice(indexProduk, 1);
saveLocalStorage();
}
/*
Function Delete produk berdasarkan id produk
*/
function cartDeleteProduk(idProduk){
const index = produks.findIndex((produk) => produk.item_id == idProduk)
if (index !== -1) {
produks.splice(index, 1);
saveLocalStorage();
proceedBasketBox();
}
}
/*
Function Update produk berdasarkan idProduk
*/
function updateProdukQty(idProduk, qty, e){
const index = produks.findIndex((produk) => produk.item_id == idProduk)
if (index !== -1) {
if (qty <= 0) {
// show button beli
$(e).parent().parent().css('display', 'none')
$(e).parent().parent().siblings('.button-add').css('display', 'block')
$('.basketbox').css('display', 'none')
deleteProduk(index)
}else{
produks[index].item_qty = qty
saveLocalStorage();
}
}
}
/*
Function Yang dipanggil ketika tombol plus / min diclick
Function untuk memproses qty dan mengirimnya ke function updateProdukQty
*/
function proceedProduk(e){
let produkId = $(e).parent().parent().find('input[name="produk_id"]').val();
console.log($(e));
let qty = 0;
// Cek Apakah e (element) merupakan input item_qty
if ($(e).is('input')) {
qty = parseInt($(e).val());
}else{
qty = parseInt($(e).siblings('input[name=item_qty]').val());
}
// Cek Tombol Plus atau Minus
if ($(e).hasClass("plus")) {
qty++;
$(e).siblings('input[name=item_qty]').val(qty);
}else if($(e).hasClass("minus")){
qty--;
$(e).siblings('input[name=item_qty]').val(qty);
}
updateProdukQty(produkId, qty, e);
}
/*
Function Cek Jika local storage cart exist
maka isi total qty, total price, qty per barang
remove button beli
display button selector
Display BasketBox
*/
function proceedCart(){
const cart = JSON.parse(localStorage.getItem('cart'));
produks = cart ? cart : [];
let ttlQty = 0;
let ttlPrice = 0;
if (produks.length > 0) {
produks.forEach((p) => {
const produkSection = $(`.productbox[data-id="${p.item_id}"]`)
ttlQty += parseInt(p.item_qty);
ttlPrice += parseInt(p.item_price * p.item_qty);
produkSection.find('input[name="item_qty"]').val(p.item_qty)
produkSection.find('.qty-selector').css('display', 'block')
produkSection.find('.button-add').css('display', 'none')
})
$('.basketbox').css('display', 'block')
$('.basket-items-qty').html(`${ttlQty} Item`)
// $('.basket-items-prices').html(`Rp. ${money(ttlPrice)}`)
// $('.ttl-harga').html(`Rp. ${money(ttlPrice)}`)
// $('.ttl-pembayaran').html(`<b>Rp. ${money(ttlPrice)}</b>`)
}else{
// $('.ttl-harga').html(`Rp. 0`)
// $('.ttl-pembayaran').html(`<b>Rp. 0</b>`)
}
}
proceedCart();
/*
Function Menyimpan Note beradarkan Pesanan / Produk id
*/
function saveNote(id, note){
const index = produks.findIndex((produk) => produk.item_id == id )
if (index !== -1) {
produks[index].note = note;
saveLocalStorage();
}
}
/*
Function Menampilkan Note Jika Exist
*/
function isNoteExist(produkId){
const index = produks.findIndex((produk) => produk.item_id == produkId)
if (index !== -1) {
$('#note-popup').find('textarea').val(produks[index].note)
}
}
/*
Function Generate List Cart
*/
function proceedBasketBox(){
const cart = JSON.parse(localStorage.getItem('cart'));
let elProdukCart = '';
cart.forEach((produk) => {
elProdukCart += `
<div class="productcart">
<div class="content">
<div class="image">
<img src="${produk.item_image}">
</div>
<div class="detail">
<h3>${produk.item_name}</h3>
<div class="pricing" style="margin: 4px 0px"><span class="price">Rp. ${money(produk.item_price)}</span></div>
<div class="atc clear">
<div class="qty qty-selector clear" style="display: block;">
<div class="qty-selector-button">
<button type="button" class="minus cart-button-qty"
data-qty-action="minus">-</button>
<input min="0" type="number" value="${produk.item_qty}" name="item_qty">
<button type="button" class="plus cart-button-qty"
data-qty-action="plus">+</button>
</div>
<button class="btn-note delete" style="margin-right: 8px;float: right;" data-id="${produk.item_id}"><img class="delete-icon" src="${deleteIcon()}"></button>
<button class="btn-note" style="float: right;margin-top: 8px">+ Catatan</button>
<input type="hidden" value="${produk.item_id}" name="produk_id">
</div>
</div>
</div>
</div>
</div>
`;
})
$('.cart-content-items-list').html(elProdukCart)
init()
}
/*
Function init
*/
function init(){
// Tambah QTY Barang
$('.plus').click(function(){
proceedProduk(this);
})
// Kurang QTY Barang
$('.minus').click(function(){
proceedProduk(this);
})
// Jika Input Qty Change
$('input[name="item_qty"]').change(function(){
proceedProduk(this);
})
// Jika Tombol catatan di click,
// display block, tampilkan catatan jika ada
$('.btn-note:not(.delete)').click(function(){
const produkId = $(this).siblings('input[name="produk_id"]').val()
$('#note-popup').css('display', 'block')
$('#note-popup').data('produkid', produkId)
isNoteExist(produkId)
})
$('#btn-save').click(function(){
const container = $(this).parent().parent().parent();
const text = container.find('textarea').val()
const produkId = container.data('produkid')
saveNote(produkId, text)
$('#note-popup').css('display', 'none')
})
$('#btn-close').click(function(){
$('#note-popup').css('display', 'none')
})
$('.delete').click(function(){
const idProduk = $(this).data("id")
cartDeleteProduk(idProduk)
})
}
init();
// Tombol Beli Di Klik
$('.button-add').click(function(){
// get data produk
let thisSection = $(this).parent().parent().parent().parent().parent();
let item_id = thisSection.data('id')
let item_image = thisSection.data('image')
let item_name = thisSection.data('name')
let item_price = thisSection.data('price')
let note = $(this).siblings('input[name=note]').val()
let item_qty = $(this).siblings('.qty-selector').find('input[name=item_qty]').val(1)
item_qty = item_qty.val()
// remove button beli, display button selector
$(this).siblings('.qty-selector').css('display', 'block')
$(this).css('display', 'none')
let produk = {item_id, item_image, item_name, item_price, note, item_qty};
addProduk(produk)
});
// $('.cart-content-items-head-add').click(function(){
// $('#cart') .css('display', 'none')
// })
// Store basketbox
$('.basketbox').click(function(){
$('#cart') .css('display', 'block')
proceedBasketBox()
});
$('#submit').click(function(){
$(this).attr('disabled', 'true')
$(this).css('opacity', '0.5')
const name = $('input[name="name"]').val()
const phone = $('input[name="phone"]').val()
const address = $('textarea[name="address"]').val()
const note = $('textarea[name="note"]').val()
const jenis_pembayaran = $('#shipping-dropdown').val()
const cara_pembayaran = $('#payment-dropdown').val()
let data = {
name,
phone,
address,
note,
jenis_pembayaran,
cara_pembayaran,
produks
};
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
url: '{{ url("api/penjualan-etalase") }}',
type: "POST",
data: data,
success: (res) => {
const no = '{{ $profil->no_telepon }}'
localStorage.removeItem('cart');
window.open("https://wa.me/"+no+"?text="+res.data['url_wa']);
window.location.replace(res.data['url_redirect']);
},
error: (err) => {
alert(err.statusText);
}
});
})
// $.fn.imageLoad = function(fn){
// this.load(fn);
// this.each( function() {
// if ( this.complete && this.naturalWidth !== 0 ) {
// $(this).trigger('load');
// }
// });
// }
// $('.beacon').each(function(i, obj){
// console.log($(obj))
// $(obj).imageLoad(function(){
// $(this).siblings('.spinner-border').remove()
// // console.log('loaded')
// // console.log($(this).siblings('.spinner-border'))
// });
// });
function deleteIcon(){
return "data:image/svg+xml;base64,PHN2ZyBpZD0idHJhc2gtc3ZnIiBoZWlnaHQ9IjQyN3B0IiB2aWV3Qm94PSItNDAgMCA0MjcgNDI3LjAwMTMxIiB3aWR0aD0iNDI3cHQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3R5bGU9ImRpc3BsYXk6bm9uZTtmaWxsOiNlNjdlMjIiPgogICAgICAgIDxwYXRoIHN0eWxlPSJmaWxsOiNlNjdlMjIiIGQ9Im0yMzIuMzk4NDM4IDE1NC43MDMxMjVjLTUuNTIzNDM4IDAtMTAgNC40NzY1NjMtMTAgMTB2MTg5YzAgNS41MTk1MzEgNC40NzY1NjIgMTAgMTAgMTAgNS41MjM0MzcgMCAxMC00LjQ4MDQ2OSAxMC0xMHYtMTg5YzAtNS41MjM0MzctNC40NzY1NjMtMTAtMTAtMTB6bTAgMCIvPgogICAgICAgIDxwYXRoIHN0eWxlPSJmaWxsOiNlNjdlMjIiIGQ9Im0xMTQuMzk4NDM4IDE1NC43MDMxMjVjLTUuNTIzNDM4IDAtMTAgNC40NzY1NjMtMTAgMTB2MTg5YzAgNS41MTk1MzEgNC40NzY1NjIgMTAgMTAgMTAgNS41MjM0MzcgMCAxMC00LjQ4MDQ2OSAxMC0xMHYtMTg5YzAtNS41MjM0MzctNC40NzY1NjMtMTAtMTAtMTB6bTAgMCIvPgogICAgICAgIDxwYXRoIHN0eWxlPSJmaWxsOiNlNjdlMjIiIGQ9Im0yOC4zOTg0MzggMTI3LjEyMTA5NHYyNDYuMzc4OTA2YzAgMTQuNTYyNSA1LjMzOTg0MyAyOC4yMzgyODEgMTQuNjY3OTY4IDM4LjA1MDc4MSA5LjI4NTE1NiA5LjgzOTg0NCAyMi4yMDcwMzIgMTUuNDI1NzgxIDM1LjczMDQ2OSAxNS40NDkyMTloMTg5LjIwMzEyNWMxMy41MjczNDQtLjAyMzQzOCAyNi40NDkyMTktNS42MDkzNzUgMzUuNzMwNDY5LTE1LjQ0OTIxOSA5LjMyODEyNS05LjgxMjUgMTQuNjY3OTY5LTIzLjQ4ODI4MSAxNC42Njc5NjktMzguMDUwNzgxdi0yNDYuMzc4OTA2YzE4LjU0Mjk2OC00LjkyMTg3NSAzMC41NTg1OTMtMjIuODM1OTM4IDI4LjA3ODEyNC00MS44NjMyODItMi40ODQzNzQtMTkuMDIzNDM3LTE4LjY5MTQwNi0zMy4yNTM5MDYtMzcuODc4OTA2LTMzLjI1NzgxMmgtNTEuMTk5MjE4di0xMi41Yy4wNTg1OTMtMTAuNTExNzE5LTQuMDk3NjU3LTIwLjYwNTQ2OS0xMS41MzkwNjMtMjguMDMxMjUtNy40NDE0MDYtNy40MjE4NzUtMTcuNTUwNzgxLTExLjU1NDY4NzUtMjguMDYyNS0xMS40Njg3NWgtODguNzk2ODc1Yy0xMC41MTE3MTktLjA4NTkzNzUtMjAuNjIxMDk0IDQuMDQ2ODc1LTI4LjA2MjUgMTEuNDY4NzUtNy40NDE0MDYgNy40MjU3ODEtMTEuNTk3NjU2IDE3LjUxOTUzMS0xMS41MzkwNjIgMjguMDMxMjV2MTIuNWgtNTEuMTk5MjE5Yy0xOS4xODc1LjAwMzkwNi0zNS4zOTQ1MzEgMTQuMjM0Mzc1LTM3Ljg3ODkwNyAzMy4yNTc4MTItMi40ODA0NjggMTkuMDI3MzQ0IDkuNTM1MTU3IDM2Ljk0MTQwNyAyOC4wNzgxMjYgNDEuODYzMjgyem0yMzkuNjAxNTYyIDI3OS44Nzg5MDZoLTE4OS4yMDMxMjVjLTE3LjA5NzY1NiAwLTMwLjM5ODQzNy0xNC42ODc1LTMwLjM5ODQzNy0zMy41di0yNDUuNWgyNTB2MjQ1LjVjMCAxOC44MTI1LTEzLjMwMDc4MiAzMy41LTMwLjM5ODQzOCAzMy41em0tMTU4LjYwMTU2Mi0zNjcuNWMtLjA2NjQwNy01LjIwNzAzMSAxLjk4MDQ2OC0xMC4yMTg3NSA1LjY3NTc4MS0xMy44OTQ1MzEgMy42OTE0MDYtMy42NzU3ODEgOC43MTQ4NDMtNS42OTUzMTMgMTMuOTI1NzgxLTUuNjA1NDY5aDg4Ljc5Njg3NWM1LjIxMDkzNy0uMDg5ODQ0IDEwLjIzNDM3NSAxLjkyOTY4OCAxMy45MjU3ODEgNS42MDU0NjkgMy42OTUzMTMgMy42NzE4NzUgNS43NDIxODggOC42ODc1IDUuNjc1NzgyIDEzLjg5NDUzMXYxMi41aC0xMjh6bS03MS4xOTkyMTkgMzIuNWgyNzAuMzk4NDM3YzkuOTQxNDA2IDAgMTggOC4wNTg1OTQgMTggMThzLTguMDU4NTk0IDE4LTE4IDE4aC0yNzAuMzk4NDM3Yy05Ljk0MTQwNyAwLTE4LTguMDU4NTk0LTE4LTE4czguMDU4NTkzLTE4IDE4LTE4em0wIDAiLz4KICAgICAgICA8cGF0aCBzdHlsZT0iZmlsbDojZTY3ZTIyIiBkPSJtMTczLjM5ODQzOCAxNTQuNzAzMTI1Yy01LjUyMzQzOCAwLTEwIDQuNDc2NTYzLTEwIDEwdjE4OWMwIDUuNTE5NTMxIDQuNDc2NTYyIDEwIDEwIDEwIDUuNTIzNDM3IDAgMTAtNC40ODA0NjkgMTAtMTB2LTE4OWMwLTUuNTIzNDM3LTQuNDc2NTYzLTEwLTEwLTEwem0wIDAiLz4KICAgIDwvc3ZnPg==";
}
let slider = tns({
"container": ".slider",
"items": 1,
"speed": 300,
"autoplay": true,
"controls": false,
"autoplayHoverPause": true,
"autoplayTimeout": 3000,
"swipeAngle": false,
"autoHeight": true,
});
});
</script>
</body>
</html>
Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]