
<?php $__env->startSection('title'); ?> Inactive Branch | Beauty Parlour <?php $__env->stopSection(); ?>
<?php $__env->startSection('inactive-branch-list'); ?> active <?php $__env->stopSection(); ?>
<?php $__env->startSection('inactive-branch-list'); ?> 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> Inactive Branch 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('branch.index')); ?>"
                            class="text-primary py-2 px-3">All(<?php echo e($allBranchCount); ?>)</a>
                    </p>

                    <p class="mb-0"><a href="<?php echo e(route('active-branch-list')); ?>"
                            class="text-primary py-2 px-3">Active(<?php echo e($activeBranchCount); ?>)</a></p>
                    <p class="mb-0"><a href="<?php echo e(route('inactive-branch-list')); ?>"
                            class="text-primary py-2 px-3 active">Inactive(<?php echo e($inactiveBranchCount); ?>)</a></p>
                </div>
                <div class="d-none d-sm-block">
                    <?php if(Auth::user()->can('branch-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="#addBranch"><span class="">New Branch</span></a>
                    <?php endif; ?>
                </div>
            </div>

            <?php if(Auth::user()->can('branch-create')): ?>
            <div class="mt-2 btn btn-success d-block rounded-0 d-sm-none" data-bs-toggle="modal"
                data-bs-target="#addBranch">
                New Branch</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>Branch</span></th>
                        <th class="text-center custom-mx-w-250" scope="col"><span>Address</span></th>
                        <th class="text-center" scope="col"><span>Status</span></th>
                    </tr>
                </thead>
                <tbody class="text-center">

                    <?php $__currentLoopData = $branchData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php if(isset($item) && $item != null): ?>
                    <tr class="">

                        <td class="text-start">
                            <div class="row_title">
                                <b>Name: </b> <?php echo e($item->branch_title); ?> <br>
                                <b>Phone: </b> <?php echo e($item->phone1); ?> <br>
                                <b>Email: </b> <?php echo e($item->email); ?> <br>
                            </div>
                            <div class="row-actions mt-2">

                                <?php if(Auth::user()->can('branch-edit')): ?>
                                <span><button class="text-primary border-0 bg-transparent fw-bolder" value="<?php echo e($item->id); ?>"
                                        onclick="updateBranch(<?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('branch-inactive', $item->id)); ?>">Inactive</a></span>
                                <?php else: ?>
                                <span><a class="text-success fw-bolder" href="<?php echo e(route('branch-active', $item->id)); ?>">Active</a>
                                </span>
                                <?php endif; ?>

                                <?php if($item->status == true): ?>
                                <?php if($item->is_default == false): ?>
                                <span> | <a class="text-info fw-bolder" href="<?php echo e(route('branch-default', $item->id)); ?>">Make Default</a></span>
                                <?php else: ?>
                                <span> | <a class="text-success fw-bolder" href="#">Default</a>
                                </span>
                                <?php endif; ?>
                                <?php endif; ?>

                                <?php if(Auth::user()->can('branch-delete')): ?>
                                
                                <?php endif; ?>
                            </div>
                        </td>

                        <td class="custom-mx-w-250">
                            <?php echo e($item->branch_address); ?>

                        </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="updateBranch<?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 Branch</h1>
                                    <button type="button" class="btn-close" data-bs-dismiss="modal"
                                        aria-label="Close"></button>
                                </div>
                                <form action="<?php echo e(route('branch.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-6 mb-3">
                                                <div class="form-group">
                                                    <label for="branch_title">Branch Name<span
                                                            class="text-danger">(required)</span>
                                                    </label>
                                                    <input type="text" name="branch_title" required
                                                        class="form-control form-control-solid"
                                                        value="<?php echo e($item->branch_title); ?>" placeholder="Name">
                                                </div>

                                                <?php $__errorArgs = ['branch_title'];
$__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="col-md-6 mb-3">
                                                <div class="form-group">
                                                    <label for="email">Branch Email<span class="text-danger">(required)</span></label>
                                                    <input type="email" name="email" id="email" class="form-control form-control-solid" value="<?php echo e($item->email); ?>"
                                                        placeholder="Email" required>
                                                </div>
                                            
                                                <?php $__errorArgs = ['email'];
$__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="col-md-6 mb-3">
                                                <div class="form-group">
                                                    <label for="phone1">Branch Phone 1<span
                                                            class="text-danger">(required)</span>
                                                    </label>
                                                    <input type="number" name="phone1" id="phone1<?php echo e($item->id); ?>" required
                                                        class="form-control form-control-solid"
                                                        value="<?php echo e($item->phone1); ?>" placeholder="Phone 1">
                                                </div>

                                                <?php $__errorArgs = ['phone1'];
$__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="col-md-6 mb-3">
                                                <div class="form-group">
                                                    <label for="phone2">Branch Phone 2</label>
                                                    <input type="number" name="phone2" id="phone2<?php echo e($item->id); ?>"
                                                        class="form-control form-control-solid"
                                                        value="<?php echo e($item->phone2); ?>" placeholder="Phone 2">
                                                </div>

                                                <?php $__errorArgs = ['phone2'];
$__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="col-md-6 mb-3">
                                                <div class="form-group">
                                                    <label for="invoice_color">Branch Invoice Background<span
                                                            class="text-danger">(required)</span></label>
                                                    <input type="color" name="invoice_color" id="invoice_color"
                                                        class="form-control form-control-solid custom-invoice-form-color custom-cursor-pointer"
                                                        value="<?php echo e($item->invoice_color); ?>" required>
                                                </div>

                                                <?php $__errorArgs = ['invoice_color'];
$__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="col-md-6 mb-3">
                                                <div class="form-group">
                                                    <label for="branch_address">Branch Address<span class="text-danger">(required)</span>
                                                    </label>
                                                    <textarea type="text" name="branch_address" required class="form-control form-control-solid" value=""
                                                        placeholder="Enter Address" rows="3" cols="3"><?php echo e($item->branch_address); ?></textarea>
                                                </div>
                                            
                                                <?php $__errorArgs = ['branch_address'];
$__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"
                                            onclick="return checkValidateForUpdate(<?php echo e($item->id); ?>)">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($inactiveBranchCount) && $inactiveBranchCount > 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($branchData->firstItem()); ?></span>
                    <?php echo e(__('to')); ?>

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

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

                </p>
            </div>

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

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



<div class="modal fade" id="addBranch" 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 Branch</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('branch.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-6 mb-3">
                            <div class="form-group">
                                <label for="branch_title">Branch Name<span class="text-danger">(required)</span>
                                </label>
                                <input type="text" name="branch_title" required class="form-control form-control-solid"
                                    value="" placeholder="Name">
                            </div>

                            <?php $__errorArgs = ['branch_title'];
$__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="col-md-6 mb-3">
                            <div class="form-group">
                                <label for="email">Branch Email<span class="text-danger">(required)</span></label>
                                <input type="email" name="email" id="email" class="form-control form-control-solid" value="" placeholder="Email"
                                    required>
                            </div>
                        
                            <?php $__errorArgs = ['email'];
$__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="col-md-6 mb-3">
                            <div class="form-group">
                                <label for="phone1">Branch Phone 1<span class="text-danger">(required)</span>
                                </label>
                                <input type="number" name="phone1" id="phone1" required
                                    class="form-control form-control-solid" value="" placeholder="Phone 1">
                            </div>

                            <?php $__errorArgs = ['phone1'];
$__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="col-md-6 mb-3">
                            <div class="form-group">
                                <label for="phone2">Branch Phone 2</label>
                                <input type="number" name="phone2" id="phone2" class="form-control form-control-solid"
                                    value="" placeholder="Phone 2">
                            </div>

                            <?php $__errorArgs = ['phone2'];
$__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="col-md-6 mb-3">
                            <div class="form-group">
                                <label for="invoice_color">Branch Invoice Background<span
                                        class="text-danger">(required)</span></label>
                                <input type="color" name="invoice_color" id="invoice_color"
                                    class="form-control form-control-solid custom-invoice-form-color custom-cursor-pointer"
                                    value="#ffffff" required>
                            </div>

                            <?php $__errorArgs = ['invoice_color'];
$__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="col-md-6 mb-3">
                            <div class="form-group">
                                <label for="branch_address">Branch Address<span class="text-danger">(required)</span>
                                </label>
                                <textarea type="text" name="branch_address" required class="form-control form-control-solid" value=""
                                    placeholder="Enter Address" rows="2" cols="2"></textarea>
                            </div>
                        
                            <?php $__errorArgs = ['branch_address'];
$__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" onclick="return checkValidate()">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>
    function checkValidate() {
        var mobileNumber1 = $("#phone1").val();
        var mobileNumber2 = $("#phone2").val();

        if (mobileNumber1 != '' && mobileNumber1.length != 11) { 
            event.preventDefault();
            toastr.error("Mobile number 1 must be 11 digit."); 
        }
       
        if (mobileNumber2 != '' && mobileNumber2.length != 11) { 
            event.preventDefault();
            toastr.error("Mobile number 2 must be 11 digit."); 
        }

        return true;
    }
    
    //For update...
    function checkValidateForUpdate(id) {
        var mobileNumber1 = $("#phone1"+id).val();
        var mobileNumber2 = $("#phone2"+id).val();
        
        if (mobileNumber1 != '' && mobileNumber1.length != 11) {
            event.preventDefault();
            toastr.error("Mobile number 1 must be 11 digit.");
        }
        
        if (mobileNumber2 != '' && mobileNumber2.length != 11) {
            event.preventDefault();
            toastr.error("Mobile number 2 must be 11 digit.");
        }

        return true;
    }

    //To show update modal...
    function updateBranch(id) {
        $("#updateBranch"+id).modal('show');
    }
</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/branch/inActiveList.blade.php ENDPATH**/ ?>