File "audit.blade.php"

Full path: /home/qooetu/costes.qooetu.com/resources/views/layout/audit.blade.php
File size: 4.95 B (4.95 KB bytes)
MIME-type: text/html
Charset: utf-8

Download   Open   Edit   Advanced Editor &nnbsp; Back

@extends('layout.main')

 <style type="text/css">
       td.details-control {
    background: url('http://www.datatables.net/examples/resources/details_open.png') no-repeat center center;
    cursor: pointer;
}
tr.shown td.details-control {
    background: url('http://www.datatables.net/examples/resources/details_close.png') no-repeat center center;
}

  </style>
@section('breadcrumb')
<ol class="breadcrumb pull-right">
                 <li><a href="<?=url('/home')?>"><span class="glyphicon glyphicon-home"></span>&nbsp;Home</a></li>
				
				<li class="active">Audit Trail</li>
</ol>
@stop

@section('content')
	
	<div class="row"> 
	<div class="col-lg-12">
		
		<div class="panel panel-info" data-sortable-id="index-1">
        <div class="panel-heading">
            <div class="panel-heading-btn">
                <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-expand"><i class="fa fa-expand"></i></a>
                <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-success" data-click="panel-reload"><i class="fa fa-repeat"></i></a>
                <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-warning" data-click="panel-collapse"><i class="fa fa-minus"></i></a>
               
            </div>
            <h4 class="panel-title">System Audit Trail</h4>
        </div>
       <div class="panel-body">
		 <div class="table-responsive">
<table class="table table-striped table-bordered" id="my-audit-trail">
<thead>
<tr class="info">
<th>#</th>
<th>Author Name</th>
<th>Author Email</th>
<th>Ip Address</th>
<th>Action</th>
<th>Date</th>
</tr> 
</thead>
<tbody>
<?php foreach($logs  as $log):?>
 <tr data-key-review="<?=$log->id;?>">
<td class="details-control"></td>
<td>{{$log->user->name}}</td>
<td>{{$log->user->email}}</td>
<td>{{$log->ip_address}}</td>

<td>{{$log->event}}</td>
<td>{{$log->created_at}}</td>
    


  </tr>




  <?php endforeach;?>
  
</tbody>
  

</table>


</div>
				

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

@stop
@push('scripts')
	 <script>


function format ( dataSource ) {
        
      var html="";


        $.each( dataSource, function( x, y ) {
            var key=y;

        var url='<?=url("/system/audit_trail/get_my_trail/");?>/'+key;
            html += '<div class="row"><div class="col-md-12 table-responsive">'
             +'<table class="table table-bordered table-striped" cellpadding="5" cellspacing="0" border="0" style="margin-left:1%;">'
              +'<thead><tr class="warning">'
              +'<th>ID</th><th>Field</th>'
              +'<th>Old Value</th>'
              +'<th>New Value</th>'
             
              +'</tr></thead>'
              +'<tbody>';
    
        $.ajax({
          url:url,
          async:false,
          dataType:'json'
        }).done(function(data){
          var i=1;
          $.each( data, function( key, y ) {
                  var myurl="#";
                  
                  var url_to="<?=url('/customer/booking/cancel')?>/"+y.type+"/"+y.id;
                   var status=y.status;
                    if(status=="Pending"){
                        var action='<a class="customer-popup"title="Cancel This Booking"  data-href='+url_to+' data-title="Booking Details"><span class="btn btn-xs btn-primary customer-popup confirm-reverse" style="cursor:pointer" data-title="Booking Details">View Details</span></a> ';
                    }else{
                        var action='<a class="customer-popup"title="Cancel This Booking"  data-href='+url_to+' data-title="Booking Details"><span class="btn btn-xs btn-primary customer-popup confirm-reverse" style="cursor:pointer" data-title="Booking Details">View Details</span></a> ';
                    }
                   
                    html +='<tr><td>'+i+'<td><a href="'+myurl+'">'+y.field+'</a> </td>' 
                          +'<td>'+y.old_value+'</td>' 
                          +'<td>'+y.new_value+'</td>' 
                          +'</tr>';
                           
                          i++;



             
        });
        });

            
        });
   
return html += '</tbody></table></div></div>';  
    }


    var table = $('#my-audit-trail').DataTable();

     // Add event listener for opening and closing details
      $('#my-audit-trail').on('click', 'td.details-control', function (e) {

       e.preventDefault();
       
          var tr = $(this).closest('tr');
          var row = table.row(tr);

          if (row.child.isShown()) {
              // This row is already open - close it
              row.child.hide();
              tr.removeClass('shown');
          } else {
              // Open this row
              row.child(format({
                  'key-review' : tr.data('key-review')
              })).show();
              tr.addClass('shown');
          }
          });

        
  
  </script>

@endpush