@extends('layouts.master')

@section('content')
<!-- DataTables -->
<link rel="stylesheet" href="{{ asset('/assets/') }}/css/dataTables.bootstrap.min.css">
<link rel="stylesheet" href="{{ asset('/assets/') }}/switch/rcswitcher.css">
<link rel="stylesheet" href="{{ asset('/assets/') }}/alert/pnotify.css">
<link rel="stylesheet" href="{{ asset('/assets/') }}/alert/sweetalert.css">
<link rel="stylesheet" href="{{ asset('/assets/') }}/alert/sweet-alert-animations.css">
<div class="row">
    <div class="col-md-8 col-md-offset-2">
        <div class="panel panel-default">
    <!-- Default panel contents -->
            <div class="panel-heading"></div>
                <header class="panel-heading" style="height:50px;">
                    <div class="pull-left">
                        {{$title}}
                    </div>
                    <div>
                      <a href="{{ url('admin/notice_board/my_notice') }}" class="btn btn-sm btn-info pull-right"><i class="fa fa-list"></i> My Notice</a> <a style="margin-right: 5px" href="{{ url('admin/notice_board/add') }}" class="btn btn-sm btn-info pull-right"><i class="fa fa-plus"></i> Add Notice</a> <br><br> 
                    </div>
                </header>
            <div class="panel-body no-padding">
                      
              <div class="table-responsive ">
                <table class="table table-hover">
                    <thead>
                        <tr>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                        </tr>
                    </thead>
                  <tbody>
                    @foreach($notices as $info)
                  <tr>
                    <td><i class="fa fa-envelope"> </i></td>
                    <td class="mailbox-name"><a href="{{ url('admin/notice_board/details/'.$info->id) }}">{{ $info->name }}</a></td>
                    <td class="mailbox-subject"><b>{{ str_limit($info->notice_title , 15, '...')}}</b> {{ str_limit($info->description, 30, '...') }}...
                    </td>
                    <td class="mailbox-attachment">@if($info->attached == NULL)@else<i class="fa fa-paperclip"></i>@endif</td>
                    <td class="mailbox-date">{{ date('d/m/Y', strtotime($info->created_at)) }}</td>
                  </tr>
                  @endforeach
                  </tbody>
                </table>
                <!-- /.table -->
              </div>
              <!-- /.mail-box-messages -->
            </div>

        </div>
    
    </div>
</div>

<div class="modal fade" id="modalPreview">
    <div class="modal-dialog" style='width: 70%;'>
    
    </div>
</div>
@stop

@section('style')
<style>
    .modal-dialog {
      width: 70% !important;
      height: 70% !important;
    }

    .modal-content {
      height: auto;
      min-height: 70% !important;
      border-radius: 0;
    }
</style>
@stop
@section('script')
<script src="{{ asset('/assets/') }}/js/jquery.dataTables.min.js"></script>
<script src="{{ asset('/assets/') }}/js/dataTables.bootstrap.min.js"></script>
<script src="{{ asset('/assets/') }}/switch/rcswitcher.js"></script>
<script src="{{ asset('/assets/') }}/alert/sweetalert.min.js"></script>
<script src="{{ asset('/assets/') }}/alert/pnotify-init.js"></script>
<script src="{{ asset('/assets/') }}/alert/notify.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    $('[data-toggle="tooltip"]').tooltip();
    $("input[type='checkbox']").rcSwitcher();
});
$(document).ready(function() {
    $('body').on('hidden.bs.modal', '.modal', function () {
      $(this).removeData('bs.modal');
    });
    var table=$("#example").DataTable({
         "searching": true,
         "lengthChange": false,
         "info": false,
         "paging": false,
         "ordering": false,
         "showNEntries": false
    });
    $("input[type='checkbox']").rcSwitcher().on({'toggle.rcSwitcher': function( e, dataObj, changeType ){
                var id = $(this).data('id');
                var urll="{{ url('admin/education_level/status') }}/"+id;
                var msg_success = 'Status Updated Successfully.';
                var msg_error = 'Something went wrong!';
                $.ajax({
                    url:urll,
                    success: function(data){
                       notify('success',msg_success);
                    },
                    error: function (data) {
                        notify('error',msg_error);
                    }
                });
            },
        });

});
</script>
@if(Session::has('msg'))
    <div class="alert alert-success center-block msg_alt" >
        <a class="close" data-dismiss="alert" href="#">&times;</a>
        <strong><i class="fa fa-check"></i></strong>&nbsp;
    {{Session::get('msg')}}
    </div>
@endif
@stop