<?php $__env->startSection('styles'); ?>
    <link href="/assets/global/plugins/typeahead/typeahead.css" rel="stylesheet" type="text/css"/>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
    <?php if(session()->has('error')): ?>
        <div class="alert alert-danger"><?php echo e(session()->get('error')); ?></div>
    <?php endif; ?>
    <?php if(session()->has('success')): ?>
        <div class="alert alert-success"><?php echo e(session()->get('success')); ?></div>
    <?php endif; ?>
    <?php if(count($errors) > 0): ?>
        <div class="alert alert-danger">
            <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; ?>
    <div class="row">
        <div class="col-md-6 col-md-offset-3">
            <!-- BEGIN SAMPLE FORM PORTLET-->
            <div class="portlet light bordered">
                <div class="portlet-title">
                    <div class="caption font-red-sunglo">
                        <i class="icon-settings font-red-sunglo"></i>
                        <span class="caption-subject bold uppercase"> Gửi tin nhắn hệ thống</span>
                    </div>
                </div>
                <div class="portlet-body form">
                    <form role="form" action="<?php echo e(url('admin/message/send')); ?>" method="post">
                        <div class="form-body">
                          <?php echo csrf_field(); ?>

                            <div class="form-group">
                                <label>Chọn hình thức gửi</label>
                                <select class="form-control" name="type" required="" id="type">
                                    <option value="">Vui lòng chọn</option>
                                    <option value="all">Gửi cho tất cả chủ trọ và người thuê</option>
                                    <option value="owner">Gửi cho tất cả chủ trọ</option>
                                    <option value="renter">Gửi cho tất cả người thuê</option>
                                    <option value="exclude">Gửi cho user ngoại trừ các SĐT sau</option>
                                    <option value="include">Chỉ gửi cho các SĐT sau</option>
                                </select>
                            </div>
                            <div class="form-group" id="phone-select" style="display: none">
                                <label>SĐT</label>
                                <select class="form-control select2" multiple name="phones[]">
                                    <option value="">Vui lòng chọn</option>
<?php $__currentLoopData = $phones; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $phone): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
    <option value="<?php echo e($phone); ?>"> <?php echo e($phone); ?></option>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                            </div>


                            <div class="form-group">
                                <label>Nội dung</label>
                                <textarea name="content" class="form-control" required></textarea>
                            </div>

                        </div>
                        <div class="form-actions">
                            <button type="submit" class="btn blue">Gửi</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('scripts'); ?>
<script src="/assets/global/plugins/typeahead/handlebars.min.js" type="text/javascript"></script>
<script src="/assets/global/plugins/typeahead/typeahead.bundle.min.js" type="text/javascript"></script>

<script>

    $('#type').change(function(e) {
       var type = $(this).val();
       if(type == 'include' || type == 'exclude')
       {
           $('#phone-select').show();
       } else {
           $('#phone-select').hide();
       }
    });

    
        
            
            
                
                    
                

                
                
            
        
    

    
        
        
        
        
        
            
                
                
                
                
                
                    
                
            
        
        
            


            
            
                
            
        
        
            
            
        
    

        
    
</script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('admin', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>