<?php
if(Auth::user()->user_type == 'organization_user')
{
    $layout = 'bmviews.layouts.user';
    $dashboard='user-dashboard';
    $fdashboard='user-dashboard';
}

elseif(Auth::user()->user_type == 'organization')
{
 $layout = 'bmviews.layouts.customer';
 $dashboard='customer-dashboard';
 $fdashboard='customer-dashboard';

}
else
{
 $layout = 'bmviews.layouts.admin';
 $dashboard='admin-dashboard';
 $fdashboard='admin-dashboard';
}
?>

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

<style>
.dropdown-menu a:hover{ background:#f27200;color:#fff;}
</style>
<div class="main-panel">
    <div class="content"> 
    <div id="vue-admin-user">
            <div class="panel-header">
                <div class="page-inner py-5 text-white"  style="background:#313232">
                    <div class="d-flex align-items-left align-items-md-center flex-column flex-md-row">
                        <div><div class="page-header">
                            <h4 class="page-title text-white">Business Numbers</h4>
                            <ul class="breadcrumbs">
                                    <li class="nav-home">
                                        <a class="text-white" href="<?php echo e(route($dashboard)); ?>">
                                            <i class="flaticon-home"></i>
                                        </a>                                       
                                    </li>
                                    <li class="nav-item">
                                        <i class="flaticon-right-arrow"></i>
                                    </li>
                                    <li>
                                        <?php echo e($customer_name); ?>

                                    </li>
                                    <li class="separator">
                                        <i class="flaticon-right-arrow"></i>
                                    </li>
                                    <li class="nav-item">
                                        <a class="text-white" href="">Business Numbers</a>
                                    </li>
                                </ul>
                        </div></div>
                        <div class="ml-md-auto py-2 py-md-0">
                            <a href="<?php echo e(route($fdashboard)); ?>" class="btn btn-white btn-border btn-round mr-2"><i class="fas fa-arrow-circle-left"></i> Back</a>
                            <?php if(Auth::user()->user_type != 'organization' && Auth::user()->user_type != 'organization_user'): ?>
                             <button class="btn btn-white btn-round mr-2" data-toggle="modal" data-target="#add" id="show-modal"><i class="fa fa-plus"></i> Add</button>
                            <?php endif; ?>
                       
                       
                        </div>
                    </div>
                </div>
                <div class="page-category">
                <div class="page-inner mt--5">
                    <div class="row mt--2">
                            <div class="col-md-12">
                                <div class="card full-height">
                                
                                    <div class="card-body">
                                    <?php echo $__env->make('bmviews.partials.filter-contacts', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                                    <div class="text-right mb-3 border-bottom pb-3">
                                    <div class="card-title pull-left">Business Numbers</div>
                                        <a class="btn btn-success btn-border btn-round btn-sm" data-toggle="collapse" data-target="#filter-panel">
                                            <i class="fas fa-filter"></i> Filter
                                        </a>
                                    </div>
                                        <?php if($errors->any()): ?>
                                            <div class="alert alert-danger alert-dismissible" role="alert">
                                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                                            <strong>Error! </strong>There were some errors with inputs.
                                            <ul>
                                                <?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <li><?php echo e($error); ?></li>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </ul>
                                            </div>

                                        <?php endif; ?>
                                        <?php echo $__env->make('layouts.messages', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                                        <?php if(!$businessnos->count()): ?>
                                        <?php echo $__env->make('layouts.nodata', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                                        <?php else: ?>
                                        
                                        <div class="table-responsive">
                                        <table  id="table" class="display table table-striped table-hover">
                                            <thead>
                                                <tr>
                                                <th>Number.</th>
                                                <th>Name</th>
                                                <th>Tariff</th>
                                                <th>Status</th> 
                                                <?php if(Auth::user()->user_type != 'organization' && Auth::user()->user_type != 'organization_user'): ?>
                                                    <th class="text-center" style="width: 10%">Action</th>
                                                <?php endif; ?>
                                                </tr>
                                            </thead>
                                            <tfoot>
                                                <tr>
                                                <th>Number.</th>
                                                <th>Name</th>
                                                <th>Tariff</th>
                                                <th>Status</th> 
                                               <?php if(Auth::user()->user_type != 'organization' && Auth::user()->user_type != 'organization_user'): ?>
                                                <th class="text-center">Action</th>
                                                <?php endif; ?>
                                                </tr>
                                            </tfoot>
                                            <tbody>
                                            <?php $__currentLoopData = $businessnos; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $CustomerClient): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <tr>
                                                
                                            <td><?php echo e($CustomerClient->business_number); ?></td>
                                            <td><?php echo e($CustomerClient->account_name); ?></td>
                                            <td> <?php echo e($CustomerClient->B2BTariff->tariff_name); ?></td>
                                            
                                            <td><?php if($CustomerClient->business_number_status == 1): ?>
                                            <span class="badge badge-success">Active</span>
                                            <?php elseif($CustomerClient->business_number_status == 0): ?>
                                            <span class="badge badge-danger">Inactive</span>
                                            <?php endif; ?>
                                            </td>
                                            <?php if(Auth::user()->user_type != 'organization' && Auth::user()->user_type != 'organization_user'): ?>
                                            <td>
                                            <div class="form-button-action" role="group" aria-label="Actions">
                                            
                                            <button class="btn btn-primary btn-sm" data-toggle="modal" data-target="#myModalEdit-<?php echo e($CustomerClient->business_number_id); ?>" id="show-modal"><i class="fa fa-edit"></i> </button>

                                            <button  @click.prevent="deleteItem('businessbilldeletepath',<?php echo e($CustomerClient->business_number_id); ?>)" data-toggle="tooltip"  data-original-title="Delete" name="delete" class="btn btn-danger btn-sm" title="delete">
                                                        <i class="fa fa-trash-alt"></i> 
                                            </button>  
                                            
                                            </div>
                                             <!-- modal -->
                                             <div id="myModalEdit-<?php echo e($CustomerClient->business_number_id); ?>" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
                                                <div class="modal-dialog modal-dialog-centered" role="document">
                                                    <div class="modal-content">
                                                        <div class="modal-header">
                                                            <h5 class="modal-title">Edit Business<strong></strong></h5>
                                                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                                <span aria-hidden="true">&times;</span>
                                                            </button>
                                                        </div>
                                                        <div class="modal-body panel-default bg-light">
                                                        <form action="<?php echo e(route('business-numbers.update')); ?>" method="post" class="form-group row">
                                                            <?php echo csrf_field(); ?>
                                                            
                                                            <div class="col-md-12">
                                                                <label>Number</label>
                                                                <input type="hidden" name="business_customer_id" value="<?php echo e($CustomerClient->business_customer_id); ?>">
                                                                <input type="hidden" name="id" value="<?php echo e($CustomerClient->business_number_id); ?>">
                                                                <input type="text" name="business_number" class="form-control" value="<?php echo e($CustomerClient->business_number); ?>">
                                                            </div>
                                                            <div class="col-md-12">
                                                                <label>Name</label>
                                                                <input type="text" name="account_name" class="form-control" value="<?php echo e($CustomerClient->account_name); ?>">
                                                            </div>
                                                            <div class="col-md-12">
                                                                <label>Tariff</label>
                                                               
                                                                <select class="form-control custom-form-control" name="tariff_id" id="tariff_id">
                                                                         <option value=""> Select </option>
                                                                        <?php $__currentLoopData = $b2btariffs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $b2btariff): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>                                                               
                                                                         <option  value="<?php echo e($b2btariff['tariff_id']); ?>" <?php echo e(old('tariff_id') ? ($b2btariff['tariff_id'] == old('tariff_id') ? "selected='selected'" : "" ) : ""); ?>> <?php echo e($CustomerClient->B2BTariff->tariff_name); ?> </option>
                                                                        
                                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                                </select>
                                                            </div>
                                                            <?php if(Auth::user()->user_type != 'organization' && Auth::user()->user_type != 'organization_user'): ?>
                                                            <div class="col-md-12">
                                                                <label>Status</label>
                                                                <?php if($CustomerClient->business_number_status == 1): ?>
                                                                <input type="checkbox" name="business_number_status" checked value="1" class="form-control">
                                                                <?php else: ?>
                                                                <input type="checkbox" name="business_number_status" value="0" class="form-control">
                                                                <?php endif; ?>
                                                            </div>
                                                            <?php endif; ?>
                                                            <div class="col-md-12">
                                                                <button class="btn btn-success" type="submit">Save</button>
                                                            </div>
                                                        </form>
                                                        </div>    
                                                    </div>
                                                </div>
                                            </div>
                                            <!-- /end modal -->
                                            </td>
                                            <?php endif; ?>
                                            </tr>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </tbody>
                                        </table>
                                         
                                    </div>
                                </div>
                            </div>
                            <?php endif; ?>     </div>
                    <!-- client import -->
            
                                      
            </div>
            </div>
            </div>
        </div>
       

         <!-- add busno modal -->
     
      <div id="add" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalLongTitle">Add Business number<strong></strong></h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body panel-default bg-light">
                <form action="<?php echo e(route('business-numbers.store')); ?>" method="post" class="form-group row">
                    <?php echo csrf_field(); ?>
                    <div class="col-md-12">
                        <label>Number</label>
                        <input type="hidden" name="business_customer_id" value="<?php echo e($id); ?>">
                        <input type="text" name="business_number" class="form-control">
                    </div>
                    <div class="col-md-12">
                        <label>Name</label>
                        <input type="text" name="account_name" class="form-control">
                    </div>
                    <div class="col-md-12">
                        <label>Tariff</label>
                        <select class="form-control custom-form-control" name="tariff_id" id="tariff_id">
                                                                         <option value=""> Select </option>
                                                                        <?php $__currentLoopData = $b2btariffs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $b2btariff): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>                                                               
                                                                         <option  value="<?php echo e($b2btariff['tariff_id']); ?>" <?php echo e(old('tariff_id') ? ($b2btariff['tariff_id'] == old('tariff_id') ? "selected='selected'" : "" ) : ""); ?>><?php echo e($b2btariff['tariff_name']); ?> </option>
                                                                        
                                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                                </select>
                    </div>
                    <div class="col-md-12">
                        <button class="btn btn-success" type="submit">Save</button>
                    </div>
                </form>
                </div>                                                        
            </div>
        </div>
    </div>
    <!-- /end modal -->
    </div>
    </div>
    <script src='https://code.jquery.com/jquery-3.2.0.min.js'></script>
    <script src='https://unpkg.com/popper.js@1.11.1'></script>
    <script src='https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js'></script>
    <?php $__env->stopSection(); ?>

<?php echo $__env->make($layout, \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/dashmobisky/public_html/Accounts/resources/views/bmviews/businessnos/index.blade.php ENDPATH**/ ?>