
<?php $__env->startSection('title'); ?> Service | Beauty Parlour <?php $__env->stopSection(); ?>
<?php $__env->startSection('lead'); ?> active <?php $__env->stopSection(); ?>
<?php $__env->startSection('lead.index'); ?> active <?php $__env->stopSection(); ?>
<?php $__env->startSection('styles'); ?>
<?php $__env->stopSection(); ?>


<?php $__env->startSection('main_content_section'); ?>
<div class="row py-3 ps-2">
    <div class="heading d-flex justify-content-start align-items-center">
        <h3 class="mb-0"><span> Service List</span></h3>
    </div>
</div>

<div class="table_wrapper py-1 card">
    <div class="row my-2 aggregate-section-div">
        <div class="px-3 ">
            <div class=" d-flex justify-content-between align-items-center aggregate-section border">
                <div class="d-flex align-items-center">
                    <p class="mb-0"><a href="<?php echo e(route('service.index')); ?>"
                            class="text-primary py-2 px-3 active">All(<?php echo e($allServiceCount); ?>)</a>
                    </p>

                    <p class="mb-0"><a href="<?php echo e(route('active-service-list')); ?>"
                            class="text-primary py-2 px-3">Active(<?php echo e($activeServiceCount); ?>)</a></p>
                    <p class="mb-0"><a href="<?php echo e(route('inactive-service-list')); ?>"
                            class="text-primary py-2 px-3">Inactive(<?php echo e($inactiveServiceCount); ?>)</a></p>
                </div>
                <div class="d-none d-sm-block">
                    <?php if(Auth::user()->can('service-create')): ?>
                    <a href="javascript:void(0)"
                        class="btn btn-success rounded-0 d-flex align-items-center px-2 border-0" data-bs-toggle="modal"
                        data-bs-target="#addService"><span class="">New Service</span></a>
                    <?php endif; ?>
                </div>
            </div>

            <?php if(Auth::user()->can('service-create')): ?>
            <div class="mt-2 btn btn-success d-block rounded-0 d-sm-none" data-bs-toggle="modal"
                data-bs-target="#addService">
                New Service</div>
            <?php endif; ?>
        </div>
    </div>



    <div class="row px-3">
        <div class="table-container table-responsive">
            <table id="" class="table table-bordered">
                <thead class="text-uppercase">
                    <tr class="me-3">
                        <th class="text-center" scope="col"><span>Image</span></th>
                        <th class="text-center" scope="col"><span>Category Name</span></th>
                        <th class="text-center" scope="col"><span>Service Name</span></th>
                        <th class="text-center" scope="col"><span>Service Price</span></th>
                        <th class="text-center" scope="col"><span>Status</span></th>
                    </tr>
                </thead>
                <tbody class="text-center">

                    <?php $__currentLoopData = $serviceData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php if(isset($item) && $item != null): ?>
                    <tr class="">
                        <td>
                            <?php if(isset($item->service_image) && $item->service_image != null): ?>
                            <a href="<?php echo e(asset('uploads/service/'.$item->service_image)); ?>" data-rel="lightcase">
                                <img src="<?php echo e(asset('uploads/service/'.$item->service_image)); ?>" height="70" width="80">
                            </a>
                            <?php else: ?>
                            <a href="<?php echo e(asset('backend/template-assets/')); ?>/images/img_preview.png" data-rel="lightcase">
                                <img src="<?php echo e(asset('backend/template-assets/')); ?>/images/img_preview.png" height="70" width="80">
                            </a>
                            <?php endif; ?>
                        </td>
                        <td>
                            <div class="row_title">
                                <?php echo e($item->serviceCategoryData->category_name); ?>

                            </div>
                            <div class="row-actions mt-2">

                                <?php if(Auth::user()->can('service-edit')): ?>
                                <span><button class="text-primary border-0 bg-transparent fw-bolder" value="<?php echo e($item->id); ?>"
                                        onclick="updateService(<?php echo e($item->id); ?>)"> Edit </button> | </span>
                                <?php endif; ?>

                                <?php if($item->status == true): ?>
                                <span><a class="text-warning fw-bolder"
                                        href="<?php echo e(route('service-inactive', $item->id)); ?>">Inactive</a></span>
                                <?php else: ?>
                                <span><a class="text-success fw-bolder"
                                        href="<?php echo e(route('service-active', $item->id)); ?>">Active</a></span>
                                <?php endif; ?>
                                <?php if(Auth::user()->can('service-delete')): ?>
                                    
                                <?php endif; ?>
                            </div>
                        </td>

                        <td><?php echo e($item->service_name); ?></td>
                        <td><?php echo e($item->service_price); ?> TK</td>

                        <td>
                            <?php if($item->status == true): ?>
                            <span class="badge bg-success">Active</span>
                            <?php else: ?>
                            <span class="badge bg-danger">Inactive</span>
                            <?php endif; ?>
                        </td>

                    </tr>

                    
                    <div class="modal fade" id="updateService<?php echo e($item->id); ?>" tabindex="-1" aria-labelledby="oneInputModalLabel" aria-hidden="true" data-bs-backdrop='static'>
                        <div class="modal-dialog modal-dialog-centered max-width-900px">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <h1 class="modal-title fs-5" id="oneInputModalLabel">Update Service</h1>
                                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                                </div>
                                <form action="<?php echo e(route('service.update', $item->id)); ?>" method="post" enctype="multipart/form-data">
                                    <?php echo csrf_field(); ?>
                                    <?php echo method_field('put'); ?>
                                    <div class="modal-body p-0">
                                        <div class="row px-4 my-4">
                                            <div class="col-md-8 mb-3">
                                                <div class="mb-3">
                                                    <div class="form-group custom-select2-form">
                                                        <label for="category_id">Service Category <span class=" text-danger">(required)</span>
                                                        </label>
                                                        <select name="category_id" id="category_id<?php echo e($item->id); ?>" class="form-select select2" required>
                                                            <?php $__currentLoopData = $serviceCategoryData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $singleCategory): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                            <option value="<?php echo e($singleCategory->id); ?>" <?php echo e($singleCategory->id == $item->category_id ? "selected":""); ?>>
                                                                <?php echo e($singleCategory->category_name); ?>

                                                            </option>
                                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                        </select>
                                                    </div>
                                                    
                                                    <?php $__errorArgs = ['category_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                                    <span class=text-danger><?php echo e($message); ?></span>
                                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                                </div>
                                                
                                                <div class="mb-3">
                                                    <div class="form-group">
                                                        <label for="service_name">Service Name<span class="text-danger">(required)</span>
                                                        </label>
                                                        <input type="text" name="service_name" required class="form-control form-control-solid"
                                                            value="<?php echo e($item->service_name); ?>" placeholder="Name">
                                                    </div>
                                                    
                                                    <?php $__errorArgs = ['service_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                                    <span class=text-danger><?php echo e($message); ?></span>
                                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                                </div>
                                                
                                                <div class="">
                                                    <div class="form-group">
                                                        <label for="service_price">Service Price<span class="text-danger">(required)</span>
                                                        </label>
                                                        <input type="number" name="service_price" required class="form-control form-control-solid"
                                                            value="<?php echo e($item->service_price); ?>" placeholder="Price">
                                                    </div>
                                                    
                                                    <?php $__errorArgs = ['service_price'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                                    <span class=text-danger><?php echo e($message); ?></span>
                                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                                </div>
                                            </div>
                    
                                            <div class="col-md-4 mb-3">
                                                <div class="form-group">
                                                    <label for="name">Service Photo <span class=" text-danger"></span></label> <br>
                                                    <div class=" position-relative custom-soft-setting dropzone">
                                                        <div class="select_imgWith_preview custom-product-img py-2">
                                                            <?php if(isset($item->service_image) && $item->service_image != null): ?>
                                                            <img id="uploadPreviewFSU<?php echo e($item->id); ?>" src="<?php echo e(asset('uploads/service/'.$item->service_image)); ?>">
                                                            
                                                            <div id="dropzone-block" class="custom-media-upload-block mt-3">
                                                                
                                                            </div>
                                                            <?php else: ?>
                                                            <img id="uploadPreviewFSU<?php echo e($item->id); ?>" src="<?php echo e(asset('backend/template-assets/')); ?>/images/img_preview.png">
                                                            
                                                            <div id="dropzone-block" class="custom-media-upload-block mt-3">
                                                                
                                                            </div>
                                                            <?php endif; ?>

                                                            <input id="uploadImageFSU<?php echo e($item->id); ?>" type="file" name="service_image"
                                                                onchange="PreviewImage('uploadImageFSU<?php echo e($item->id); ?>','uploadPreviewFSU<?php echo e($item->id); ?>');" />
                                                
                                                            <span onclick="cancelPreview('uploadImageFSU<?php echo e($item->id); ?>','uploadPreviewFSU<?php echo e($item->id); ?>')" class="material-symbols-outlined"
                                                                id="image_remove_buttton">
                                                                close </span>
                                                        </div>
                                                    </div>
                                                
                                                    <?php $__errorArgs = ['service_image'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                                    <span class=text-danger><?php echo e($message); ?></span>
                                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                                </div>
                                            </div>

                                            <div class="col-md-12 mb-3">
                                                <div class="form-group">
                                                    <label for="service_details">Service Details<span class="text-danger">(required)</span>
                                                    </label>
                                                    <textarea rows="3" cols="3" name="service_details" class="form-control form-control-solid"
                                                        value="<?php echo e(old('service_details')); ?>" placeholder="Details" required><?php echo e($item->service_details); ?></textarea>
                                                </div>
                                            
                                                <?php $__errorArgs = ['service_details'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                                <span class=text-danger><?php echo e($message); ?></span>
                                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                            </div>
                    
                                        </div>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="submit" class="btn btn-success">Update</button>
                                        <button type="button" class="btn btn-danger" data-bs-dismiss="modal">Cancel</button>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>

                    <?php endif; ?>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>


                </tbody>
            </table>
        </div>

        <?php if(isset($allServiceCount) && $allServiceCount > 10): ?>
        <div class="clearfix d-flex">
            <div class="float-left">
                <p class="text-muted">
                    <?php echo e(__('Showing')); ?>

                    <span class="font-weight-bold"><?php echo e($serviceData->firstItem()); ?></span>
                    <?php echo e(__('to')); ?>

                    <span class="font-weight-bold"><?php echo e($serviceData->lastItem()); ?></span>
                    <?php echo e(__('of')); ?>

                    <span class="font-weight-bold"><?php echo e($serviceData->total()); ?></span>
                    <?php echo e(__('results')); ?>

                </p>
            </div>

            <div class="float-right custom-table-pagination">
                <?php echo $serviceData->links('pagination::bootstrap-4'); ?>

            </div>
        </div>
        <?php endif; ?>
    </div>
</div>



<div class="modal fade" id="addService" tabindex="-1" aria-labelledby="oneInputModalLabel" aria-hidden="true" data-bs-backdrop='static'>
    <div class="modal-dialog modal-dialog-centered max-width-900px">
        <div class="modal-content">
            <div class="modal-header">
                <h1 class="modal-title fs-5" id="oneInputModalLabel">New Service</h1>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-header">
                <p class="fs-5 text-center mb-0" id="oneInputModalLabel">সার্ভিস একবার তৈরী হয়ে গেলে Delete করা সম্ভব না
                    , প্রয়োজনে
                    edit বা inactive করতে পারবেন। তাই অপ্রয়োজনীয় সার্ভিস তৈরী থেকে বিরত
                    থাকুন।</p>
            </div>
            <form action="<?php echo e(route('service.store')); ?>" method="post" enctype="multipart/form-data">
                <?php echo csrf_field(); ?>
                <div class="modal-body p-0">
                    <div class="row px-4 my-4">

                        <div class="col-md-8 mb-3">
                            <div class="mb-3">
                                <div class="form-group custom-select2-form 
                                <?php echo e($serviceCategoryData->count() > 0 ? '' : 'custom-null-select2-body'); ?>

                                ">
                                    <label for="category_id">Service Category <span class=" text-danger">(required)</span>
                                    </label>
                                    <select name="category_id" id="category_id" class="form-select select2">
                                        <?php $__currentLoopData = $serviceCategoryData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $singleCategory): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($singleCategory->id); ?>"><?php echo e($singleCategory->category_name); ?></option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                </div>
                            
                                <?php $__errorArgs = ['category_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <span class=text-danger><?php echo e($message); ?></span>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>
                            
                            <div class="mb-3">
                                <div class="form-group">
                                    <label for="service_name">Service Name<span class="text-danger">(required)</span>
                                    </label>
                                    <input type="text" name="service_name" required class="form-control form-control-solid"
                                        value="<?php echo e(old('service_name')); ?>" placeholder="Name">
                                </div>
                                
                                <?php $__errorArgs = ['service_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <span class=text-danger><?php echo e($message); ?></span>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>
                            
                            <div class="">
                                <div class="form-group">
                                    <label for="service_price">Service Price<span class="text-danger">(required)</span>
                                    </label>
                                    <input type="number" name="service_price" required class="form-control form-control-solid"
                                        value="<?php echo e(old('service_price')); ?>" placeholder="Price">
                                </div>
                                
                                <?php $__errorArgs = ['service_price'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <span class=text-danger><?php echo e($message); ?></span>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>
                        </div>

                        <div class="col-md-4 mb-3">
                            <div class="form-group">
                                <label for="name">Service Photo <span class=" text-danger">(required)</span></label> <br>
                                <div class=" position-relative custom-soft-setting dropzone">
                                    <div class="select_imgWith_preview custom-product-img py-2">
                                        <img id="uploadPreview" src="<?php echo e(asset('backend/template-assets/')); ?>/images/img_preview.png">
                            
                                        <div id="dropzone-block" class="custom-media-upload-block mt-3">
                                            
                                        </div>
                                        <input id="uploadImage" type="file" name="service_image"
                                            onchange="PreviewImage('uploadImage','uploadPreview');" required/>
                            
                                        <span onclick="cancelPreview('uploadImage','uploadPreview')" class="material-symbols-outlined"
                                            id="image_remove_buttton">
                                            close </span>
                                    </div>
                                </div>
                            
                                <?php $__errorArgs = ['service_image'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <span class=text-danger><?php echo e($message); ?></span>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>
                        </div>
                        
                        <div class="col-md-12 mb-3">
                            <div class="form-group">
                                <label for="service_details">Service Details<span class="text-danger">(required)</span>
                                </label>
                                <textarea rows="3" cols="3" name="service_details" class="form-control form-control-solid"
                                    value="<?php echo e(old('service_details')); ?>" placeholder="Details" required></textarea>
                            </div>
                        
                            <?php $__errorArgs = ['service_details'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <span class=text-danger><?php echo e($message); ?></span>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>

                    </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-success">Save</button>
                    <button type="button" class="btn btn-danger" data-bs-dismiss="modal">Cancel</button>
                </div>
            </form>
        </div>
    </div>
</div>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>

<script>
    
    $(document).ready(function(){
        $("#category_id").select2({
            dropdownParent: $('#addService')
        });
    });
    
    //To show update modal...
    function updateService(id) {
        $("#updateService"+id).modal('show');
        $("#category_id"+id).select2({
            dropdownParent: $('#updateService'+id)
        });
    }
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH E:\Project\Personal-Project\Office-Project\update\skin-care\resources\views/admin/service/index.blade.php ENDPATH**/ ?>