

<?php $__env->startSection('content'); ?>
<div class="content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-12">
                <div class="card">
                    <div class="card-body">
                        
                        <?php
                            if($data){
                                $nama = $data != null ? $data->nama : "";
                                $id = $data != null ? $data->id : "";
                                $jenisDoc = $data != null ? $data->jenis_dokumen_id : "";
                                $file = $data != null ? $data->file : "";
                            }
                            
                        ?>
                        
                        <form action="<?php echo e(route('doc.update')); ?>" method="post" enctype="multipart/form-data">
                            <?php echo e(csrf_field()); ?>

                            <div class="form-group">
                                <label for="Product Name">Nama Dokumen</label>
                                <input type="text" name="nama" class="form-control" value="<?php echo e($nama); ?>" placeholder="Product Name">
                                <input type="hidden" name="id" class="form-control" value="<?php echo e($id); ?>" placeholder="Product Name">
                            </div>
                            <div class="form-group">
                                <label class="form-control-label" for="jenisDoc">
                                    <?php echo e(__('Jenis Dokumen')); ?>

                                </label>
                                <select id="jenisDoc" class="form-control" name="jenis_doc">
                                    <?php $__currentLoopData = $getJenis; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key  => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($value->id); ?>" <?php echo e(($value->id == $jenisDoc) ? 'selected' : ''); ?>><?php echo e($value->nama); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                            </div>
                            <label for="Product Name">File Dokumen</label>
                            <br />
                            <input type="file" class="form-control" value="<?php echo e($file); ?>" name="doc" />
                            <input type="hidden" name="old_file" value="<?php echo e($file); ?>">
                            <br /><br />
                            <input type="submit" class="btn btn-primary" value="Upload" />
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('js'); ?>

<script type="text/javascript">
    
    $(document).ready(function () {
        // Javascript method's body can be found in assets/js/demos.js
        // getJenis();

    });

    function getJenis(){
        $.ajax({
            // data: $('#docForm').serialize(),
            url: "<?php echo e(route('jenis.all')); ?>",
            type: "GET",
            dataType: 'json',
            success: function (data) {
                $("#jenisDoc").empty();

                for( var i = 0; i<data.data.length; i++){
                    var id = data.data[i]['id'];
                    var name = data.data[i]['nama'];
                    
                    $("#jenisDoc").append("<option value='"+id+"'>"+name+"</option>");

                }

            },
            error: function (data) {
                console.log('Error:', data);
                // $('#saveBtn').html('Save Changes');
            }
        });
    }

</script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('layouts.app', ['activePage' => 'dokumen', 'title' => 'Edit Dokumen', 'navName' => 'Edit Dokumen', 'activeButton' =>
'laravel'], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\Sayang\project-g\resources\views/Dokumens/edit.blade.php ENDPATH**/ ?>