Current File : //home/tradevaly/www/storage/framework/views/68ea2b6fe0404ce7e070f31233d2547097edb96f.php
<?php $__env->startPush('title','Inbox'); ?>
<?php $__env->startPush('style'); ?>
<?php $__env->stopPush(); ?>

<?php $__env->startSection('content'); ?>
    <div class="container-fluid">
        <div class="container-fluid">
            <div class="row">
                <div class="col-12 col">
                    <div class="page-title-box d-sm-flex align-items-center justify-content-between">
                        <h4 class="mb-sm-0 font-size-18">Inbox</h4>
                        <div class="page-title-right">
                            <ol class="breadcrumb m-0">
                                <li class="breadcrumb-item"><a href="/email-inbox">Email</a></li>
                                <li class="active breadcrumb-item" aria-current="page"><a href="/email-inbox">Inbox</a></li>
                            </ol>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-12">
                   <?php echo $__env->make('backend.pages.setting.home.side_bar', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                    <div class="email-rightbar mb-3">
                        <div class="card">
                            <div class="card-header">
                                <h4>Category Add</h4>
                            </div>
                            <div class="card-body">

                                <form action="<?php echo e(route('admin.setting.cwp.store')); ?>" method="POST"
                                    enctype="multipart/form-data">
                                    <?php echo csrf_field(); ?>
                                    <div class="row">




                                        <div class="col-sm-12">
                                            <div class="mb-3">
                                                <select class="form-select" aria-label=" example" name="category_id">
                                                    <option selected>Select a Category</option>
                                                    <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <option value="<?php echo e($category->id); ?>"><?php echo e($category->name); ?></option>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                  </select>
                                            </div>
                                        </div>
                                        <div class="col-sm-12">
                                            <div class="mb-3">
                                                <label for="metadescription">Sorting</label>
                                                <input id="metatitle" name="sorting" type="text" class="form-control"
                                                    value="" required>
                                            </div>
                                        </div>
                                        <div class="col-md-12">
                                            <div class="mb-3">
                                                <label for="metadescription">Photo (450*760)</label>
                                                <div class="fallback">
                                                    <input name="image" type="file"
                                                        oninput="preview_image(this, '.image_preview_container')" />
                                                </div>

                                                <div class="dz-message needsclick">
                                                    <div class="image_preview_container">
                                                        </div>
                                                </div>

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

                                    <div class="d-flex flex-wrap gap-2">
                                        <button type="submit" class="btn btn-primary waves-effect waves-light">Save
                                            Changes</button>
                                        <button type="submit"
                                            class="btn btn-secondary waves-effect waves-light">Cancel</button>
                                    </div>
                                </form>

                            </div>
                        </div>
                        <div class="card">
                            <div class="card-body">
                                <table class="table">
                                    <thead>
                                      <tr>
                                        <th scope="col">SL</th>
                                        <th scope="col">Category</th>
                                        <th scope="col">sl</th>
                                        <th scope="col">Photo</th>
                                        <th scope="col">Created At</th>
                                        <th scope="col">Action</th>
                                      </tr>
                                    </thead>
                                    <tbody>
                                        <?php $__currentLoopData = $cwps; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cwp): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                      <tr>
                                        <th scope="row"><?php echo e($loop->index+1); ?></th>
                                        <td><?php echo e($cwp->category->name); ?></td>
                                        <td><?php echo e($cwp->sorting); ?></td>
                                        <td>
                                            <img height="50" src="<?php echo e(asset('storage/setting/cwp/'.$cwp->photo)); ?>" alt="">
                                        </td>
                                        <td><?php echo e($cwp->created_at->format('d M Y')); ?></td>
                                        <td>
                                            <div class="button-grou">
                                            <a href="<?php echo e(route('admin.setting.cwp.destroy',$cwp->id)); ?>" class="btn btn-danger">Delete</a>
                                            <a href="<?php echo e(route('admin.setting.cwp.edit',$cwp->id)); ?>" class="btn btn-info">Edit</a>
                                            <a href="<?php echo e(route('admin.setting.cwp.product.index',$cwp->id)); ?>" class="btn btn-info">Add Product</a>
                                         </div>
                                        </td>
                                      </tr>
                                      <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </tbody>
                                  </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    <?php $__env->stopSection(); ?>

    <?php $__env->startPush('script'); ?>
        <script>
            function preview_image(F, image_container) {
                let my_container = document.querySelector(image_container);

                let new_container = document.createElement('div');
                new_container.className = 'image_preview_container';

                F = F.files;
                F = Array.from(F);

                F.forEach(file => {
                    let my_url = URL.createObjectURL(file);

                    let my_image = getImage(my_url);
                    new_container.append(my_image);
                });

                my_container.replaceWith(new_container);
            }

            function getImage(url) {
                let img = document.createElement('img');
                img.src = url;
                img.alt = "Image Not Found";

                return img;
            }

            $(document).on('change', '[name=parent_id]', function() {
                var child_id = $(this).val();
                get_child(child_id);
            });


            function get_child(child_id) {
                $('[name="sub_id"]').html("");
                $.ajax({
                    headers: {
                        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                    },
                    url: "<?php echo e(route('ajax.cat')); ?>",
                    type: 'POST',
                    data: {
                        sub_id: child_id
                    },
                    success: function(response) {
                        var obj = JSON.parse(response);
                        if (obj != '') {
                            $('[name="sub_id"]').html(obj);
                        }
                    }
                });
            }
        </script>
    <?php $__env->stopPush(); ?>

<?php echo $__env->make('backend.ayaan.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/tradevaly/public_html/resources/views/backend/pages/setting/home/cwp/index.blade.php ENDPATH**/ ?>