<?php $__env->startSection('title', 'Did List'); ?>

<?php $__env->startSection('content'); ?>
<style>
.badge
{font-size: 1rem;
    font-style: normal;
    font-weight: 400;
    font-family: "IBM Plex Sans", sans-serif;
    line-height: 1.5;}
    .table > tbody > tr > td, .table > tbody > tr > th {
     padding: 0.5rem; 
    vertical-align: middle;
}
.dropdown-item{
    padding:10px 15px;
}
    </style>
    <style>
      
      #preloader {
            background-color: black;
            bottom: 0;
            left: 0;
            position: fixed;
            right: 0;
            top: 0;
            z-index: 2147483647;
        }
        #preloader-status {
            background: center center no-repeat;
            height: 80px;
            left: 50%;
            top: 50%;
            position: absolute;
            width: 80px;
            margin: -40px 0 0 -40px;
        }
    </style>
<style>
      
      #preloader {
            background-color: black;
            bottom: 0;
            left: 0;
            position: fixed;
            right: 0;
            top: 0;
            z-index: 2147483647;
        }
        #preloader-status {
            background: center center no-repeat;
            height: 80px;
            left: 50%;
            top: 50%;
            position: absolute;
            width: 80px;
            margin: -40px 0 0 -40px;
        }
    </style>
<!-- Main content -->
        <section class="content">

      <div class="row">

       
        
        <div class="col-12">
          <div class="box">
             <div class="box-body">           
                       
            <div class="d-flex flex-column flex-md-row align-items-md-center justify-content-between mb-3">
    
    <h4 class="box-title text-info mb-2 mb-md-0">
        <i class="fa fa-user fa-sx"></i> Phone Number(s)
    </h4>

    
    <div class="d-flex flex-wrap justify-content-end">
        <div class="dropdown me-2 mb-2 mb-md-0">
            <button class="btn btn-dark btn-rounded dropdown-toggle px-3 py-1"
                    id="actionDropdown"
                    data-bs-toggle="dropdown"
                    aria-expanded="false">
                Action
            </button>
            <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="actionDropdown">
                <?php if(Session::get('level') > 7): ?>
                    <li><a id="openExcelForm" class="dropdown-item" href="#">Upload Excel</a></li>
                    <li><a class="dropdown-item" href="<?php echo e(url('/show-buy-did')); ?>">Buy Number From DIDForSale</a></li>
                    <li><a class="dropdown-item" href="<?php echo e(url('/show-buy-did-plivo')); ?>">Buy Number From Plivo</a></li>
                    <li><a class="dropdown-item" href="<?php echo e(url('/show-buy-did-telnyx')); ?>">Buy Number From Telnyx</a></li>
                    <li><a class="dropdown-item" href="<?php echo e(url('/show-buy-did-twilio')); ?>">Buy Number From Twilio</a></li>
                <?php endif; ?>
            </ul>
        </div>

        <?php $role = Session::get('role'); ?>
        <?php if(in_array($role, ['system_admin', 'system_administrator'])): ?>
            <a href="<?php echo e(url('add-did')); ?>"
               class="btn btn-primary btn-rounded btn-sm">
                <i class="fa fa-plus"></i> Add DID
            </a>
        <?php endif; ?>
    </div>
</div>

              <!-- <?php if(Session::get('level') > 9): ?>
              <a  id="openExcelForm" type="submit" style="float:right" class="waves-effect waves-light btn btn-rounded btn-primary btn-bitbucket btn-sm mb-5"><i class="fa fa-excel-o"></i>Upload Excel</a>
              <?php endif; ?>
              <?php if(Session::get('level') > 9): ?>

              <a href="<?php echo e(url('/show-buy-did')); ?>"  style="float:right;margin-right:5px;"type="button" class="waves-effect waves-light btn btn-rounded btn-primary btn-bitbucket btn-sm mb-5"><i class="fa fa-plus"></i>&nbsp; Buy Number From DIDForSale </a>
              <a href="<?php echo e(url('/show-buy-did-plivo')); ?>" style="float:right;margin-right:5px;" type="button" class="waves-effect waves-light btn btn-rounded btn-primary btn-bitbucket btn-sm mb-5"><i class="fa fa-plus"></i>&nbsp; Buy Number From Plivo </a>

              <?php endif; ?> -->
<hr class="my-15">

              <div class="table-responsive">
                <table id="tickets12" class="table mt-0 table-hover no-wrap" data-page-size="10">
                  <thead>
                    <tr>
                              <th>#</th>
                              <th>Phone numbers</th>
                              <th>CNAME</th>
                              <th>Destination Type</th>
                              <th>Destination</th>
                              <th>SMS</th>
                              <th>Assigned User</th>
                              <th>Exclusive User</th>                             
                              <th>Action</th>

                            </tr>
                  </thead>
                <tbody>
                  </tbody>
                </table>
              </div>
            </div>
          </div>
        </div>
        <div class="modal fade" id="myModalExcel" tabindex="-1" aria-labelledby="myModalExcelLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title"  id="upload-excel"></h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <form method="post" action="<?php echo e(url('did/uploadDid')); ?>" enctype="multipart/form-data">
      <?php echo csrf_field(); ?>
      <div class="modal-body">
      <div id="loader" style="display: none;">
                    <img src="<?php echo e(asset('assets/images/giphy.gif')); ?>" alt="Loading..."style="height:100px;width:100px;">
                </div>
                <input type="hidden" class="form-control" name="did" value="" >
                <label for="inputEmail3" class="form-label closed">Excel</label>
                    <input type="file" accept=".xls,.xlsx" class="form-control closed" required name="did_file" id="did_file" placeholder="Select Excel File">
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal">Close</button>
        <button type="submit"name="submit" class="btn btn-info btn-sm ">Save</button>
      </div>
        </form>
    </div>
  </div>
</div>

        <div class="modal fade" id="delete" tabindex="-1" aria-labelledby="deleteLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="myModalLabel">Confirm Delete</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <form method="post" action="" enctype="multipart/form-data">
      <?php echo csrf_field(); ?>
      <div class="modal-body">
      <p>You are about to delete <b><i class="title"></i></b>number.</p>
         <p>Do you want to proceed?</p>
         <input type="hidden" class="form-control" name="list_id" value="" id ="list_id" >
       
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal">Close</button>
        <button type="submit"name="submit" class="btn btn-danger btn-sm deleteListData">Delete</button>
      </div>
        </form>
    </div>
  </div>
</div>
      </div>
      <!-- /.row -->

    </section>
        <!-- /.content -->
        <script src="https://code.jquery.com/jquery-3.7.0.js" integrity="sha256-JlqSTELeR4TLqP0OG9dxM7yDPqX1ox/HfgiSLBj8+kM=" crossorigin="anonymous"></script>


        <script>

$("#openExcelForm").click(function() {
console.log('did_file');
$("#myModalExcel").modal('show');
$("#name").val('');
$("#status").val('1');
$("#id").val('');
$(".closed").show();
$("#upload-excel").html('Upload Excel');


});

$("#openListForm").click(function(){
$("#listModal").modal();
$("#name").val('');
$("#status").val('1');
$("#id").val('');
$("#add-edit").html('Add Did');
});



$(document).on('click', '.deleteList', function() {
    var delete_id = $(this).data('id');
    var camid = $(this).data('camid');

    $("#delete").modal('show');
    $("#list_id").val(delete_id);
    $("#camid").val(camid);
});


             $(document).on("click", ".deleteListData" , function() {
//if(confirm("Are you sure you want to delete this?")){
    var list_id = $('#list_id').val();

   //alert(group_id);
    var el = this;
    $.ajax({
        url: 'deleteDidData/'+list_id,
        type: 'get',
        success: function(response){
             window.location.reload(1);
        }
    });
 //   window.location.reload(1);

});

</script>

<script>$(document).ready(function() {
    $('#tickets12').DataTable({
        processing: true,
        serverSide: true,
        ajax: {
            url: "<?php echo e(url('did')); ?>",
            type: 'GET',
        },
           columns: [
            { data: 'DT_RowIndex', name: 'DT_RowIndex', orderable:false, searchable:false },
            { data: 'phone_numbers', name: 'phone_numbers' },
            { data: 'cnam', name: 'cnam' },
            { data: 'destination_type', name: 'destination_type' },
            { data: 'destination', name: 'destination' },
            { data: 'sms', name: 'sms', orderable:false, searchable:false },
            { data: 'assigned_user', name: 'assigned_user' },
            { data: 'exclusive_user', name: 'exclusive_user', orderable:false, searchable:false },
            { data: 'action', name: 'action', orderable:false, searchable:false }
        ],
language: {
    processing: `
        <span style="display:flex; align-items:center; justify-content:center; gap:8px;">
            <img src="https://i.gifer.com/ZZ5H.gif"
                 alt="Loading..." style="width:20px; height:20px;">
            Processing...
        </span>
    `
}
    });
});
</script>






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

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/html/leadmine/leadmine_pro/resources/views/did/did_list.blade.php ENDPATH**/ ?>