<?php
if(Auth::user()->user_type == 'organization')
{
    $layout = 'fcviews.layouts.org';
}
elseif(Auth::user()->user_type == 'organization_user')
{
    $layout = 'fcviews.layouts.user';
}
?>

<?php $__env->startSection('content'); ?>
<style>
.dropdown-menu a:hover{ background:#f27200;color:#fff;}
</style>

<div class="main-panel">
    <div class="content">
            <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">Excel Uploads</h4>
                            <ul class="breadcrumbs">
                                    <li class="nav-home">
                                        <a class="text-white" href="">
                                            <i class="flaticon-home"></i>
                                        </a>
                                    </li>
                                    <li class="separator">
                                        <i class="flaticon-right-arrow"></i>
                                    </li>
                                    <li class="nav-item">
                                        <a class="text-white" href="">Excel Uploads</a>
                                    </li>
                                </ul>
                        </div></div>

                

                        <div class="ml-md-auto py-2 py-md-0">
                       
                            <div class="btn-group dropdown">
                       
                                
                                <button class="btn btn-white btn-round dropdown-toggle" type="button" data-toggle="dropdown" aria-expanded="true">
                                   <i class="fas fa-plus"></i> Add Contacts
                                </button>
                                <ul class="dropdown-menu" role="menu" x-placement="top-start" style="position: absolute; transform: translate3d(0px, -117px, 0px); top: 0px; left: 0px; will-change: transform;">
                                <li>

                                <a href="#" data-toggle="modal" data-target="#importClient" id="show-modal" class="dropdown-item"><i class="fas fa-file-import"></i> Import contact</a>
                                </li>
                                </ul>
                            </div>
                            <a href="" class="btn btn-white btn-border btn-round mr-2"><i class="fas fa-arrow-circle-left"></i> Back</a>
                        
                         
                        </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">
                                    

                                    <div class="text-right mb-3 border-bottom pb-3">
                                    <div class="card-title pull-left">Excel Uploads Details
                                    
                                  
                                    
                                    </div>
                                      
                                 
                                        <a class="btn btn-primary btn-border btn-round btn-sm" data-toggle="modal" data-target="#confirmsms">
            
                                            <i class="fab fa-telegram-plane"></i>Send
                                        </a>
                                    </div>
                                    <!----------     ---------------------------------->
                                    
                                      <div class="modal fade" id="confirmsms" tabindex="-1" role="dialog" aria-hidden="true">
                                            <div class="modal-dialog" role="document">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                    <h4>Confirm Recipients</h4>
                                                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                            <span aria-hidden="true">&times;</span>
                                                        </button>
                                                    </div>
                                                    <form action="<?php echo e(route('sendMessageExcel')); ?>" method="post">
                                                        <?php echo csrf_field(); ?>
                                                        <div class="modal-body">
                                                             <h4>Send SMS to: <?php echo e(count($contacts)); ?> Recipients </h4>
                                                             <input type="hidden" value="<?php echo e($contacts); ?>" name="contactsv"/>
                                                        </div>
                                                        
                                                        <div class="modal-footer">
                                                            <button type="submit" class="btn btn-success btn-round btn-md"><i class="fa fa-check"></i> Confirm</button>
                                                            <button type="button" class="btn btn-danger btn-round btn-md" data-dismiss="modal">Close</button>
                                                        </div>
                                                    </form>
                                                </div>
                                            </div>
                                        </div>
                                    
                                    <!------------------------------------------------->


                                   
                                   <div id="app">
                                        
                                        <?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(); ?>
                                        <!-- tabs -->
                                       
                                        <!--/tabs  -->
                                        <br>
                                    <div class="tab-content" id="pills-tabContent">
                                        <div id="initiated" role="tabpanel" aria-labelledby="initiated-tab" class="tab-pane fade show active">
                                       

                                        <div class="table-responsive">
                                        <table  id="table" class="display table table-striped table-hover">
                                            <thead>
                                            <tr>
                                                <th>ID#</th>
                                                <th>Contact Name</th>
                                                <th>Phone</th>
                                                <th>SMS</th>
                                  <th>Actions</th>
                                                </tr>
                                            </thead>
                                            <tfoot>
                                            <tr>
                                                <th>ID#</th>
                                                <th>Contact Name</th>
                                                <th>Phone</th>
                                                <th>SMS</th>
                                       
                                       <th>Actions</th>
                                                </tr>
                                            </tfoot>
                                            <tbody>
                                            <?php $__currentLoopData = $contacts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $contact): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <tr>
                                            <td><?php echo e($contact->import_id); ?></td>
                                            <td><?php echo e(ucfirst($contact->import_name)); ?></td>   
                                            <td><?php echo e($contact->phone); ?></td>
                                            <td><?php echo e($contact->message); ?></td>
                                       <td>
                                            <div class="form-button-action" role="group" aria-label="Actions">
                                            <a href="#" data-target="#edit-<?php echo e($contact->import_id); ?>" data-toggle="modal" id="show-modal"> <button class="btn btn-success btn-sm" data-toggle="tooltip"  data-original-title="View"><i class="far fa-eye"></i> </button>  </a>
                                            <a href="#" data-target="#view-<?php echo e($contact->import_id); ?>" data-toggle="modal" id="show-modal"> <button class="btn btn-primary btn-sm" data-toggle="tooltip"  data-original-title="Edit"><i class="fa fa-edit"></i> </button></a>
                                            <button  @click.prevent="deleteItem('ExcelUploadDeletepath',<?php echo e($contact->import_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>
                                            
                                            </form>
                                            </div>
                                            </td>
                                     
                                            </tr>
                                            <!-- edit modal -->
                                            <div class="modal fade" id="edit-<?php echo e($contact->import_id); ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
                                                <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
                                                    <div class="modal-content">
                                                        <div class="modal-header">
                                                            <h5 class="modal-title" id="exampleModalLongTitle">View Contact </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">
                                                        <importsview_component :contactsdata="<?php echo e(json_encode($contact)); ?>"/>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            
                                             <div class="modal fade" id="view-<?php echo e($contact->import_id); ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
                                                <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
                                                    <div class="modal-content">
                                                        <div class="modal-header">
                                                            <h5 class="modal-title" id="exampleModalLongTitle">Edit Contact </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">
                                                         
                                                         <importsedit_component :contactsdata="<?php echo e(json_encode($contact)); ?>"/>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            
                                            
                                            
                                            
                                            <!-- end edit modal -->
                                            <!-- view modal -->
                                            <div class="modal fade" id="view-<?php echo e($contact->import_id); ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
                                                <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
                                                    <div class="modal-content">
                                                        <div class="modal-header">
                                                            <h5 class="modal-title" id="exampleModalLongTitle">Edit Contact </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">
                                                         
                                                         <importsedit_component :contactsdata="<?php echo e(json_encode($contact)); ?>"/>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <!-- end view modal -->
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </tbody>
                                        </table>
                                         
                                    
                                    </div>


                                            </div>
                                        </div>
                                        
  
                         
                                        
                                
                                   
                                            <!--  import -->              
                                        <div class="modal fade" id="importClient" tabindex="-1" role="dialog" aria-hidden="true">
                                            <div class="modal-dialog" role="document">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                    <h4>Import SMS Contacts</h4>
                                                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                            <span aria-hidden="true">&times;</span>
                                                        </button>
                                                    </div>
                                                    <form action="<?php echo e(route('batchimportsms')); ?>" method="post" enctype="multipart/form-data">
                                                        <?php echo csrf_field(); ?>
                                                        <div class="modal-body bg-light">
                                                            <div class="alert alert-info shadow-sm">
                                                                <p class="mb-0">Download <a href="<?php echo e(url('/sample/Imports.xlsx')); ?>">sample file</a></p>
                                                            </div>
                                                            <div class="col form-group">
                                                                <label for="import-file">Select excel file to import* <div style="color:red;">(Can Only send to ) 
                                                                
                   




  
        
      
        

                                                                
                                                               </div> <?php $__currentLoopData = $mycountries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $object): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                              <?php echo e($object->rateCountry->name); ?>

                                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></label>
                                                                <input name="file" id="import-file" type="file" class="form-control">
                                                            </div>
                                                        </div>
                                                        <div class="modal-footer">
                                                            <button type="submit" class="btn btn-success btn-round btn-md"><i class="fa fa-check"></i> Save</button>
                                                            <button type="button" class="btn btn-danger btn-round btn-md" data-dismiss="modal">Close</button>
                                                        </div>
                                                    </form>
                                                </div>
                                            </div>
                                        </div>
                                        <!-- / import -->
                                        
                                    
                                        </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>   </div>
            </div>
        </div>
    </div>
        
<?php $__env->stopSection(); ?>
     
        <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->startSection('scripts'); ?>
<script>

        $(document).ready(() => {
            let url = location.href.replace(/\/$/, "");

            if (location.hash) {
                const hash = url.split("#");
                console.log(hash);
                $('#pills-tab a[href="#'+hash[1]+'"]').tab("show");
                url = location.href.replace(/\/#/, "#");
                console.log(url);
                history.replaceState(null, null, url);
                setTimeout(() => {
                    $(window).scrollTop(0);
                }, 0);
            }
        });

</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/fcviews/exceluploads/index.blade.php ENDPATH**/ ?>