<?php $__env->startSection('content'); ?>
    <div class="container-fluid px-4">

        <h5 class="mt-4">Tambah Proyek</h5>

        <div class="card mb-4">

            <div class="card-header">
                <i class="fas fa-table me-1"></i>
                Tambah Data Proyek
            </div>

            <div class="card-body">

                <form action="<?php echo e(route('project.store')); ?>" method="POST" enctype="multipart/form-data">
                    <?php echo csrf_field(); ?>

                    <div class="mb-3">
                        <label class="form-label">Nama Aplikasi</label>
                        <input type="text" name="nama_aplikasi" class="form-control">
                    </div>

                    <div class="mb-3">
                        <label class="form-label">Deskripsi</label>
                        <textarea name="deskripsi" class="form-control"></textarea>
                    </div>

                    <div class="mb-3">
                        <label class="form-label">Link</label>
                        <input type="text" name="link" class="form-control">
                    </div>

                    <div class="mb-3">
                        <label class="form-label">Upload Gambar</label>

                        <div class="row" id="previewContainer"></div>

                        <input type="file" name="gambar[]" class="form-control" multiple accept="image/*"
                            id="gambarInput">
                    </div>

                    <button type="submit" class="btn btn-primary mt-3">
                        Simpan
                    </button>
                    <a href="<?php echo e(route('project.index')); ?>" class="btn btn-secondary mt-3">Kembali</a>

                </form>

            </div>
        </div>

    </div>

    <script>
        document.getElementById('gambarInput').addEventListener('change', function(event) {

            const preview = document.getElementById('previewContainer');
            preview.innerHTML = '';

            const files = event.target.files;

            for (let i = 0; i < files.length; i++) {
                const reader = new FileReader();

                reader.onload = function(e) {
                    const col = document.createElement('div');
                    col.className = "col-md-3 mb-3";

                    col.innerHTML = `
                    <div class="card">
                        <img src="${e.target.result}" class="card-img-top" style="height:150px;object-fit:cover;">
                    </div>
                `;

                    preview.appendChild(col);
                }

                reader.readAsDataURL(files[i]);
            }

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

<?php echo $__env->make('app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH D:\PROJECT\profile\resources\views/project/create.blade.php ENDPATH**/ ?>