<!-- Main content -->
<?php if (isset($component)) { $__componentOriginal566f40242755341fef381206827a6570 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal566f40242755341fef381206827a6570 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin.contents','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('admin.contents'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
     <?php $__env->slot('title', null, []); ?> <?php echo e($data['title']); ?> <?php $__env->endSlot(); ?>
     <?php $__env->slot('menuOpen', null, []); ?> <?php echo e($data['menuOpen']); ?>  <?php $__env->endSlot(); ?>
     <?php $__env->slot('menuActive', null, []); ?> <?php echo e($data['menuActive']); ?>  <?php $__env->endSlot(); ?>
     <?php $__env->slot('page', null, []); ?> <?php echo e($data['page']); ?> <?php $__env->endSlot(); ?>
     <?php $__env->slot('head', null, []); ?> 
        <link rel="stylesheet" href="<?php echo e(asset('')); ?>assets/admin/plugins/icheck-bootstrap/icheck-bootstrap.min.css">
        <link rel="stylesheet" href="<?php echo e(asset('assets/')); ?>/admin/plugins/sweetalert2/sweetalert2.min.css">

        <style>
            .tab tr td {
                font-size: 16px;
            }

            .tabdetail tr td {
                border-bottom: 1px solid #eaedf0;
            }

            td.inf {
                color: rgb(10, 109, 109);
            }
        </style>
     <?php $__env->endSlot(); ?>


    <section class="content">

        <!-- Default box -->
        <div class="row">
            <div class="col-lg-12">
                <?php if (isset($component)) { $__componentOriginal88b0e6813f5b80100a19437aa80e29ba = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal88b0e6813f5b80100a19437aa80e29ba = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.message','data' => []] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('message'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(Illuminate\View\AnonymousComponent::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?> <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal88b0e6813f5b80100a19437aa80e29ba)): ?>
<?php $attributes = $__attributesOriginal88b0e6813f5b80100a19437aa80e29ba; ?>
<?php unset($__attributesOriginal88b0e6813f5b80100a19437aa80e29ba); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal88b0e6813f5b80100a19437aa80e29ba)): ?>
<?php $component = $__componentOriginal88b0e6813f5b80100a19437aa80e29ba; ?>
<?php unset($__componentOriginal88b0e6813f5b80100a19437aa80e29ba); ?>
<?php endif; ?>
                <div class="card card-primary card-outline">
                    <div class="card-header">
                        <h3 class="card-title"><i class="fa fa-server text-primary"></i> <?php echo e($data['page']); ?></h3>
                        <form class="form-inline float-right">
                            <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search"
                                name="cari">
                            <button class="btn btn-primary " type="submit"> <i class="fa fa-search mr-2"></i>
                                Cari!</button>
                        </form>
                    </div>
                    <div class="card-body">
                        <a href="/produk-tambah" class="btn btn-success float-right mb-3"><i
                                class="fa fa-plus-circle mr-2"></i> Produk
                            Baru</a>


                        <div class="btn-group float-right mr-2 mb-3">
                            <button type="button" class="btn btn-info btn-flat">Action</button>
                            <button type="button" class="btn btn-info btn-flat dropdown-toggle dropdown-icon"
                                data-toggle="dropdown">
                                <span class="sr-only">Toggle Dropdown</span>
                            </button>
                            <div class="dropdown-menu" role="menu">
                                <a class="dropdown-item" href="#" id="cetak_induk">Cetak Data Induk</a>
                                <a class="dropdown-item" href="/download-format-produk">Download Format</a>
                                <div class="dropdown-divider"></div>
                                <a class="dropdown-item" href="#" data-toggle="modal" data-target="#import">Import
                                    Data Excel</a>
                            </div>
                        </div>

                        <button class="btn btn-default shadow-sm">
                            <div class="icheck-blue d-inline " style="margin-right: -7px">
                                <input type="checkbox" id="cekall">
                                <label for="cekall">
                                </label>
                            </div>
                        </button>
                        <button class="btn btn-danger" id="pilih_hapus"><i class="fa fa-trash"></i> Hapus</button>
                        <button class="btn btn-dark" id="cetak_barcode"><i class="fa fa-print"></i> Cetak
                            Barcode</button>


                        <table class="table table-bordered table-hover myTable tab">
                            <thead>
                                <tr>
                                    <th width="2%">No</th>
                                    <th>#</th>
                                    <th>#</th>
                                    <th>Nama Produk</th>
                                    <th>Berat</th>
                                    <th>Harga Beli</th>
                                    <th>Harga Jual</th>
                                    <th>Stok</th>
                                    <th>Terjual</th>
                                    <th>Satuan Jual</th>
                                    <th>Tgl. Input</th>
                                    <th width="9%">Opsi</th>
                                </tr>
                            </thead>
                            <tbody id="view">
                                <?php $__empty_1 = true; $__currentLoopData = $produk; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $p): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                    <tr>
                                        <td class="text-center"><?php echo e($no++); ?></td>
                                        <td class="text-center">
                                            <div class="icheck-blue d-inline " style="margin-right: -7px">
                                                <input type="checkbox" name="id[]" id="cek<?php echo e($p->id); ?>"
                                                    class="ceklis" value="<?php echo e($p->id); ?>">
                                                <label for="cek<?php echo e($p->id); ?>">
                                                </label>
                                            </div>
                                        </td>
                                        <td class="text-center">
                                            <?php if($p->gambar != null): ?>
                                                <img alt="Avatar" class="table-avatar"
                                                    src="<?php echo e(asset('/storage/produk/' . $p->gambar)); ?>" width="40px">
                                            <?php else: ?>
                                                <img alt="Avatar" class="table-avatar"
                                                    src="<?php echo e(asset('storage/produk/produk.jpg')); ?>" width="40px">
                                            <?php endif; ?>
                                        </td>
                                        <td>
                                            <?php echo e($p->nm_produk); ?> <br>
                                            <small class="text-primary">Kategori :
                                                <?php echo e($p->kategori->nm_kategori); ?></small>
                                        </td>
                                        <td><?php echo e(number_format($p->berat, 0, ',', '.')); ?> Gram</td>
                                        <td class="text-right"><?php echo e(number_format($p->harga_beli, 0, ',', '.')); ?> </td>
                                        <td class="text-center">
                                            <?php if($p->diskon == 0): ?>
                                                <?php echo e(number_format($p->harga_jual, 0, ',', '.')); ?>

                                            <?php else: ?>
                                                <del> <?php echo e(number_format($p->harga_jual, 0, ',', '.')); ?></del>
                                                <small class="text-danger">(Off : <?php echo e($p->diskon); ?>%)</small>
                                                <?php echo e(number_format($p->harga_jual - ($p->harga_jual * $p->diskon) / 100, 0, ',', '.')); ?>

                                            <?php endif; ?>

                                        </td>
                                        <td class="text-center bg-warning"><?php echo e(stok($p->id) - terjual($p->id)); ?></td>
                                        <td class="text-center bg-success"><?php echo e(terjual($p->id)); ?></td>
                                        <td class="text-center "><?php echo e($p->satuan->nm_satuan); ?></td>
                                        <td><?php echo e(tgl_inf($p->created_at)); ?> </td>
                                        <td class="text-center">
                                            <div class="btn-group" role="group">
                                                <button id="btnGroupDrop1" type="button"
                                                    class="btn btn-primary dropdown-toggle" data-toggle="dropdown"
                                                    aria-haspopup="true" aria-expanded="false">
                                                    <i class="fa fa-edit mr-3"></i>
                                                    Opsi
                                                </button>
                                                <div class="dropdown-menu" aria-labelledby="btnGroupDrop1">
                                                    <a class="dropdown-item"
                                                        href="/produk-edit/<?php echo e($p->link_produk); ?>">Edit </a>
                                                    <a class="dropdown-item disc" href="#"
                                                        data-id="<?php echo e($p->id); ?>" data-ds="<?php echo e($p->diskon); ?>"
                                                        data-nm="<?php echo e($p->nm_produk); ?>">Edit Diskon</a>
                                                    <a class="dropdown-item gambar" href="#"
                                                        data-id="<?php echo e($p->id); ?>">Upload Gambar</a>
                                                    <a class="dropdown-item detail" href="#"
                                                        data-id="<?php echo e($p->id); ?>">Detail</a>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <tr>
                                        <td colspan="15" class="text-center text-danger"> Data Produk masih
                                            kosong.
                                        </td>
                                    </tr>
                                <?php endif; ?>
                            </tbody>
                        </table>
                        <?php echo e($produk->links('components.admin.pagination')); ?>

                    </div>
                </div>
            </div>


        </div>
        <!-- /.card -->

    </section>

    <div id="hidedata">
        <div class="tampil_data" id="print"></div>
    </div>

    
    <div class="modal fade" id="uplgambar">
        <div class="modal-dialog ">
            <div class="modal-content">
                <div class="modal-header bg-primary ">
                    Upload Gambar Produk
                </div>
                <form action="/upload-gambar" method="post" enctype="multipart/form-data">
                    <?php echo csrf_field(); ?>
                    <input type="hidden" name="id" id="idp">
                    <input type="hidden" name="gbrlama" id="gbrlama">
                    <div class="modal-body">
                        <div class="form-group">
                            <label for="">Nama Produk</label>
                            <div class="custom-file">
                                <input type="text" id="nama" class="form-control" readonly>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="">(jpg,jpeg,png)</label>
                            <div class="custom-file">
                                <input type="file" name="gambar" class="custom-file-input"
                                    id="exampleInputFile">
                                <label class="custom-file-label" for="exampleInputFile">Cari
                                    file</label>
                            </div>
                        </div>
                        <div class="form-group d-flex justify-content-center">
                            <div style="height: 180px; width: 40%; border:1px solid  #eaedf0" class="gambar">
                                <div id="gam"></div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer justify-content-between">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                        <button type="submit" class="btn btn-primary ">Upload Gmabar</button>
                    </div>
                </form>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>

    
    <div class="modal fade" id="detail">
        <div class="modal-dialog ">
            <div class="modal-content">
                <div class="modal-header bg-primary ">
                    Detail Produk
                </div>
                <div class="modal-body" id="vdetail">
                </div>
                <div class="modal-footer justify-content-between">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>

    
    <div class="modal fade" id="diskon">
        <div class="modal-dialog ">
            <div class="modal-content">
                <div class="modal-header bg-primary ">
                    Edit Diskon
                </div>
                <form action="<?php echo e(route('produk.diskon')); ?>" method="post">
                    <?php echo csrf_field(); ?>
                    <div class="modal-body">
                        <label for="">
                            Produk : <span id="nmp"></span> <br>
                        </label> <br>
                        <label for="">Diskon (%)</label>
                        <input type="hidden" name="id" id="idpr" class="form-control">
                        <input type="text" name="diskon" id="disc" class="form-control numbers"
                            placeholder="0%">
                    </div>
                    <div class="modal-footer justify-content-between">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                        <button type="submit" class="btn btn-primary"><i class="fa fa-save mr-2"></i>
                            Simpan</button>
                    </div>
                </form>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>

    
    <div class="modal fade" id="import">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header bg-primary ">
                    <h4 class="modal-title">Upload Data</h4>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <form action="<?php echo e(route('produk.import')); ?>" method="POST" enctype="multipart/form-data">
                    <?php echo csrf_field(); ?>
                    <div class="modal-body">
                        <div class="form-group">
                            <label>PILIH FILE</label>
                            <input type="file" name="file" class="form-control" required>
                        </div>
                    </div>
                    <div class="modal-footer justify-content-between">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                        <button type="submit" class="btn btn-primary"><i class="fa fa-database mr-1"></i>
                            IMPORT</button>
                    </div>
                </form>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>






     <?php $__env->slot('foot', null, []); ?> 
        <script src="<?php echo e(asset('assets/')); ?>/admin/plugins/bs-custom-file-input/bs-custom-file-input.min.js"></script>
        <script src="<?php echo e(asset('assets/')); ?>/admin/plugins/sweetalert2/sweetalert2.all.min.js"></script>
        <script src="<?php echo e(asset('assets/')); ?>/admin/produk.js"></script>

     <?php $__env->endSlot(); ?>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal566f40242755341fef381206827a6570)): ?>
<?php $attributes = $__attributesOriginal566f40242755341fef381206827a6570; ?>
<?php unset($__attributesOriginal566f40242755341fef381206827a6570); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal566f40242755341fef381206827a6570)): ?>
<?php $component = $__componentOriginal566f40242755341fef381206827a6570; ?>
<?php unset($__componentOriginal566f40242755341fef381206827a6570); ?>
<?php endif; ?>
<?php /**PATH /Applications/XAMPP/xamppfiles/htdocs/e-CommerceLv11/resources/views/admin/produk/produk.blade.php ENDPATH**/ ?>