EVOLUTION-NINJA
Edit File: user-expiry-list.php
<?php echo view('includes/admin-header', $user_management, $org); $role_id = session()->get('role_id'); ?> <div class="col-sm-10" style="padding:3%;"> <div class="row" id="mobile-div"> <div class="col-sm-4"> <h4 class="user-tag">Subscription Expiry List</h4> </div> <div class="col-sm-4"></div> <div class="col-sm-4"> <button type="button" id="btnExport" class="btn-excel" onclick="usermanagement_excel()">Export to Excel</button> </div> </div> <div class="row"> <div class="col-sm-8"></div> <div class="col-sm-4"> <a href="<?php echo base_url('user-management');?>"><button type="button" class="btn-excel mt-4 ">Back</button></a> </div> </div> <div id="jaytab3" style="margin-top:6%;" > <div class="grid_div"></div> <div id="list2"> <table id="list3"> </table> <div style="display:none;"> <table border="1" style="border-spacing: 0px !important;" id="user_excel" class="user_excel"></table> </div> </div> <div id="pager3"></div> </div> </div> </div><!--col-10--> <script type="text/ecmascript" src="<?php echo base_url('public/jqgrid/js/jquery.jqGrid.min.js'); ?>"></script> <!-- This is the localization file of the grid controlling messages, labels, etc.--> <!-- We support more than 40 localizations --> <script type="text/ecmascript" src="<?php echo base_url('public/jqgrid/js/i18n/grid.locale-en.js'); ?>"></script> <!-- A link to a jQuery UI ThemeRoller theme, more than 22 built-in and many more custom --> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('public/assets/css/jquery-ui.css'); ?>" /> <!-- The link to the CSS that the grid needs --> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('public/jqgrid/css/ui.jqgrid.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('public/jqgrid/css/ui.jqgrid-bootstrap.css'); ?>" /> <script src="<?php echo base_url('public/assets/js/jquery-ui.js'); ?>" type="text/javascript"></script> <script type="text/ecmascript" src="<?php echo base_url('public/jqgrid/js/jquery.table2excel.js'); ?>"></script> <script src="<?php echo base_url('public/assets/js/jquery.table2excel.js');?>"></script> <script> $(document).ready(function(){ jQuery("#list3").jqGrid({ url:"<?php echo site_url('expiry-list');?>", //console.log(response.details); datatype: "json", colNames:['Sl','First Name','Last Name','Phone No','Email','Gamer_Id','Subscription_Till'], colModel:[ {name:'id',index:'id',hidden:true, width:50, editable:false}, {name:'f_name',index:'f_name', width:140, editable:false }, {name:'l_name',index:'l_name', width:130, editable:false}, {name:'mobile',index:'mobile', width:130, editable:false}, {name:'email',index:'email',width:150, editable:false}, {name:'gamer_id',index:'gamer_id', width:120, editable:false }, { name: 'suscription_till', // Note the corrected name here index: 'sucscription_till', width: 140, editable: false, formatter: 'date', // Use a date formatter formatoptions: { srcformat: 'Y-m-d', newformat: 'd/m/Y' } // Adjust the format as needed }, ], rowNum:20, rowList:[20,30,50,100,200,300], rownumbers: true, pager: '#pager3', sortname:'id', autowidth: true, height: '100%', // width: '100%', viewrecords: true, loadonce:true, gridview: true, sortorder:"desc", shrinkToFit: true, caption:"Subscription Expiry List", loadComplete: function () { var rows = $("#list3").getDataIDs(); for (var i = 0; i < rows.length; i++){ var rowData = $('#list3').jqGrid('getRowData', rows[i]); var enable = $("#list3").getCell(rows[i],"role_id"); } }, }); $("#list3").jqGrid("setLabel", "rn", "SL"); $("#list3").jqGrid('filterToolbar',{stringResult: true,searchOperators : true}); //for multisearch code,remove if not required $("#list3").jqGrid('navGrid','#pager3', {edit:false,add:false,del:false,search:true,refresh:true}, { }, { }, { }, { sopt:['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true } ); }); function fun_excel(){ $.ajax({ url:"<?php echo site_url('expiry-list');?>", type:"GET", success:function(response) { // response = jQuery.parseJSON(response); // console.log(response[0]); $('.user_excel').empty(); var con = ''; con +='<thead><tr><th>First Name</th><th>Last Name</th><th>Phone no</th><th>Email</th><th>Gamer Id</th><th>Subscription Till</th></tr></thead>'; $.each( response, function( key, value ) { con += '<tr>'; con += '<td>'+value.f_name+'</td>'; con += '<td>'+value.l_name+'</td>'; con += '<td>'+value.mobile+'</td>'; con += '<td>'+value.email+'</td>'; con += '<td>'+value.gamer_id+'</td>'; con += '<td>'+value.suscription_till+'</td>'; con += '</tr>'; }); $('.user_excel').append(con); } }); } fun_excel(); </script> <script type="text/javascript"> function usermanagement_excel(){ $(".user_excel").table2excel({ exclude: ".noExl", name: "Excel Document Name", filename: "User Expiry List", fileext: ".xls", exclude_img: true, exclude_links: true, exclude_inputs: true }); } </script> <style> .ui-jqgrid-sdiv{ display : none !important; } .ui-jqgrid-titlebar { background-color:#0065A3; } .ui-jqgrid-title{ color:#fff; font-weight: 600; font-size: 18px; } .user-tag{ color: #0065A3; font-weight: 600; font-size: 24px; } .soptclass{ display : none; } @media only screen and (max-width:600px){ #mobile-div{ padding: 20px; } } </style> <?php echo view('includes/admin-footer'); ?>