HEX
Server: Apache/2.4.41 (Amazon) OpenSSL/1.0.2k-fips PHP/5.6.40
System: Linux ip-172-31-40-18 4.14.146-93.123.amzn1.x86_64 #1 SMP Tue Sep 24 00:45:23 UTC 2019 x86_64
User: apache (48)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: /var/www/html/taxicamera/old/application/views/admin/notification/notification_list.php
<div class="main-content">
  <div class="content-wrapper">
    <div class="container-fluid">
      <!-- Basic form layout section start -->
      <section id="basic-form-layouts">
      	<div class="row">
      		<div class="col-md-12">
      			<div class="card">
      				<div class="card-header">
      					<div class="page-title-wrap">
      						<h4 class="card-title">Notification List</h4>      						
      					</div>
      				</div>
      				<div class="card-body">
      					<div class="px-3">      						
                  <div id="report_list_div">
                    <div class="row">
                      <div class="table-responsive custom_table_area export_table_area">
                        <table class="table table-striped table-bordered export_btn_dt c_table_style notification_table">
                            <thead>
                                <tr>
                                  <th>SL No.</th>                                
                                  <th>Notification Id</th>
                                  <th>Title</th>
                                  <th>Description</th>
                                  <th>Status</th>
                                </tr>
                            </thead>
                            <tbody>
                            <?php if(!empty($notification_details)): ?>
                            <?php   foreach($notification_details as $key => $list): ?>
                                  <tr>
                                      <td><?php echo $key+1; ?></td>
                                      <td><?php echo "#N00".$list['notification_id']; ?></td>
                                    <?php  if($list['notification_flag'] =='0'): ?>
                                    <?php   $url_class      = 'notification_url'; ?>
                                    <?php   $url            = 'javascript:void(0)'; ?>                                    
                                    <?php   $status         = 'Unread'; ?>
                                    <?php   $status_class   = 'btn mr-1 btn-danger'; ?>
                                    <?php  else: ?>  
                                    <?php   $url_class      = ''; ?>
                                    <?php   $url            = base_url().$list['notification_link']; ?>
                                    <?php   $status         = 'Read'; ?>
                                    <?php   $status_class   = 'btn mr-1 btn-success'; ?> 
                                    <?php  endif; ?>
                                      <td><?php echo $list['notification_title']; ?></td>
                                      <td><?php echo $list['notification_description']; ?></td>                                   
                                      <td><a href="<?php echo $url; ?>" reL ="<?php echo $list['notification_type']."|".$list['notification_id']."|".$list['referrence_id']; ?>"  class="<?php echo $status_class.' '.$url_class; ?> "><?php echo $status; ?></a></td>
                                  </tr>
                            <?php   endforeach; ?>
                            <?php else: ?>
                                    <tr>
                                        <td colspan="4">No data found</td>
                                    </tr>
                            <?php endif; ?>
                            </tbody>
                        </table>
                      </div>
                    </div>
                  </div>
      					</div>                
      				</div>
      			</div>            
      		</div>
      	</div>
      </section>
      <!-- // Basic form layout section end -->      
    </div>
  </div>
</div>
<script>
$(document).ready(function() {
  var now = new Date();
  var date = now.getFullYear() + "-" + now.getMonth() + "-" + now.getDate();  
  $('.notification_table').DataTable({    
  });
  $(".js-select2").select2();
    var from_dt       = $('#from_dt').pickadate({format:'dd/mm/yyyy',autoclose:true}),
    from_dt_picker    = from_dt.pickadate('picker');

    var to_dt         = $('#to_dt').pickadate({format:'dd/mm/yyyy',autoclose:true}),
    to_dt_picker      = to_dt.pickadate('picker');
      
    // Check if there’s a “from” or “to” date to start with.
    // if ( from_dt_picker.get('value') ) {
    //     to_dt_picker.set('min', from_dt_picker.get('select'))
    // }
    // if ( to_dt_picker.get('value') ) {
    //     from_dt_picker.set('max', to_dt_picker.get('select'))
    // }

    // When something is selected, update the “from” and “to” limits.
    from_dt_picker.on('set', function(event) {
    
      if ( event.select ) {
        to_dt_picker.set('min', from_dt_picker.get('select'));    
      }
      else if ( 'clear' in event ) {
        to_dt_picker.set('min', false);
      }
    })

    to_dt_picker.on('set', function(event) {
    
      if ( event.select ) {
        from_dt_picker.set('max', to_dt_picker.get('select'));    
      }
      else if ( 'clear' in event ) {
        from_dt_picker.set('max', false);
      }
    })
});
$(document).on('change','#company_id',function(event){
    var company_id   = $("#company_id").val();
    $.ajax({
        type: "POST",
        url: '<?php echo base_url('admin/DocketReport/GetDocketsList')?>',
        data:{company_id : company_id},
        dataType:'json',
        success: function(response){            
          if(response != 'Blank')
          {
            $('#driver_id').find('option').remove().end();
            $.each( response, function( key, value ) {
              var name = response[key].docket_name;
               var docketid = response[key].docket_id;         
              $("<option></option>", {value: docketid, text: name}).appendTo('#docket_id');
            });
          }
          else{
            $('#docket_id').find('option').remove().end();
            $("<option></option>", {value: '', text: 'Select Docket'}).appendTo('#docket_id');
          }      
        },
        error:function(response){
          alert("error");
        }
    });
});
$(document).on('click','#search_btn',function(event){
    event.preventDefault();
    var company_id  = $("#company_id").val();
    var driver_id   = $("#driver_id").val();    
    var from_date   = $("#from_dt").val();
    var to_date     = $("#to_dt").val();
    var cnt =0;
    if(company_id == ""){
      alert("Please select company.");
      cnt++;
    }
    else{
      //nothing to do
    }
    if(driver_id == ""){
      alert("Please select driver.");
      cnt++;
    }
    else{
      //nothing to do
    }
    if(from_date == ""){
      alert("Please select  from date.");
      cnt++;
    }
    else{
      //nothing to do
    }
    if(to_date == ""){
      alert("Please select  to date.");
      cnt++;
    }
    else{
      //nothing to do
    }
    if(cnt == 0){
      $.ajax({
          type: "POST",
          url: '<?php echo base_url('admin/DocketReport/DocketReportGenerate')?>',
          data:{company_id : company_id,driver_id : driver_id,from_date:from_date,to_date:to_date},
          dataType:'JSON',
          success: function(response){  
            //alert(response);          
            $("#report_list_div").html(response['html']);
            var now = new Date();
            var date = now.getFullYear() + "-" + now.getMonth() + "-" + now.getDate();  
            $('.docket_report_table').DataTable({
              pageLength: 100,
              dom: 'Bfrtip',
              buttons: [{
                  extend: 'excel',        
                  text: 'Download Excel',
                  className: 'btn btn-outline-primary mr-1',
                  filename: 'docket_report_' + date,
                  exportOptions: {
                          columns: [0,1,2,3,4,5,6]
                  }
                }
                //'copy', 'csv', 'excel', 'pdf', 'print'
              ]
            });    
          },
          error:function(response){
            alert("error");
          }
      });
    }
});
</script>