EVOLUTION-NINJA
Edit File: renewal_list.php
<?php $this->load->view('includes/admin_header');?> <link rel="stylesheet" href="<?php echo base_url('admin_assets/toastr/toastr.min.css');?>"> <script src="<?php echo base_url('admin_assets/toastr/toastr.min.js');?>"></script> <script type="text/ecmascript" src="<?php echo base_url('admin_assets/jqgrid/js/jquery.jqGrid.min.js'); ?>"></script> <script type="text/ecmascript" src="<?php echo base_url('admin_assets/jqgrid/js/i18n/grid.locale-en.js'); ?>"></script> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('admin_assets/css/jquery-ui.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('admin_assets/jqgrid/css/ui.jqgrid.css'); ?>" /> <script src="<?php echo base_url('admin_assets/js/jquery-ui.js'); ?>" type="text/javascript"></script> <div class="page-content"> <div class="row"> <div class="col-xs-12"> <!-- PAGE CONTENT BEGINS --> <div class="row" style="background-color:#f8f8f8;padding-top: 10px;padding-bottom: 10px;"> <div class="col-sm-12 col-md-2"> <span style="font-size:25px;">Renewal List</span> </div> <div class="col-sm-7"></div> </div> </div> </div><!-- /.col --> <div id ="jaytab" style="margin-top:3%" class="col-sm-12 col-md-12grid"> <div class="grid_div"></div><table id="list2"></table> <div id="pager2"></div> <div id="dialogSelectRow" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> <!-- Modal --> <div class="modal fade" id="access_modal" role="dialog"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title"></h4> </div> <div class="modal-body"> <form id="land_owner" class="form-inline asset_update_form" enctype="multipart/form-data"> <div id="fields_div"></div> <div class="row land_owner_a"> <div class="col-sm-4 col-md-4"></div> <div class="col-sm-4 col-md-4"> <button type="submit" class="btn btn-primary center-block update_submit">Submit</button> </div> <div class="col-sm-4 col-md-4"></div> </div> <!-- row 3--> </form> </div> </div> </div> </div> </div><!-- /.row --> <script type="text/javascript"> if('ontouchstart' in document.documentElement) document.write("<script src='assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>"); </script> <script src="<?php echo base_url('admin_assets/assets/js/ace-elements.min.js');?>"></script> <script src="<?php echo base_url('admin_assets/assets/js/ace.min.js');?>"></script> <!-- inline scripts related to this page --> </body> </html> <style type="text/css"> .form-control:focus, input[type="Submit"]:focus, input[type="button"]:focus { border-color: #FF0000; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(255, 0, 0, 0.6); } #FrmGrid_list2 { width: 100% !important; } .ui-jqdialog .ui-jqdialog-titlebar { height: 29px !important; background-color: #001a00; color: white; padding-left: 10px; } .fm-button { height: 21px !important; padding: 1px; margin-right: 10px !important; height: 21px !important; width: 43%; margin-top: -7px !important; } .ui-jqdialog-content td.navButton { padding-top: 12px !important; } .ui-jqgrid .ui-jqgrid-titlebar { height: 27px !important; background:#1e7ad7 !important; color:white !important; } .ui-jqgrid-bdiv { height: 232px !important; } .ui-widget-overlay { z-index:0 !important; } .ui-widget-header { background: #1e7ad7 !important; } .ui-jqgrid-hdiv ui-state-default { width: 873px !important; cursor: default!important } ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight { border: 1px solid #fed22f; background: #ffe45c; } .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { font-weight: bold; color: black; } .ui-widget-content { border: 1px solid #dddddd; background: #ffffff ; color: #333333; } #list2 { overflow-x: auto; } </style> <script type="text/javascript"> $(document).ready(function(){ MasterList(); function MasterList() { $.ajax({ type : 'get', url : '<?php echo site_url("all_client_assets")?>', success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { } } }); } CallGrid(); function CallGrid() { jQuery("#list2").jqGrid({ url:"<?php echo site_url('yaskawa/get_renewal_list_data')?>", mtype : "get", datatype: "json", colNames:['id','Category','Product Name','Product Start','AMC Date','Notify Before Expiry','Document Name','Document Renewal Date','Agreement Name','Agreement Renewal Date','ACTION'], colModel:[ {name:'id',index:'id', hidden:true,width:100,editable:false,}, {name:'category',index:'category', width:100, editable:false}, {name:'product_name',index:'product_name', width:200, editable:false}, {name:'product_start_date',index:'product_start_date', width:100, editable:false, formatter: 'date', formatoptions: { newformat: 'd-m-Y'}}, {name:'amc_date',index:'amc_date', width:100, editable:false}, {name:'notify_before_date',index:'notify_before_date', width:100, editable:false, formatter: 'date', formatoptions: { newformat: 'd-m-Y'}}, {name:'document_name',index:'document_name', width:200, editable:false}, {name:'doc_renewal_date',index:'doc_renewal_date', width:200, editable:false, formatter: 'date', formatoptions: { newformat: 'd-m-Y'}}, {name:'agreement_name',index:'agreement_name', width:200, editable:false}, {name:'agree_renewal_date',index:'agree_renewal_date', width:200, editable:false, formatter: 'date', formatoptions: { newformat: 'd-m-Y'}}, { name: 'EditAction', index: 'id', align: 'center', width: 100, formatter: function (cellvalue, options, rowObject) { return '<a href="javascript:void(0);" class="edit_asset" onclick="fun_edit('+rowObject.id+')" id="'+rowObject.id+'"><span class="glyphicon glyphicon-pencil"></span></a> <a class="delete_req" asset_id="'+rowObject.id+'" href="javascript:void(0);"><span class="glyphicon glyphicon-trash"></span></a>'; } }, ], rowNum:20, rowTotal: 2000, rowList : [20,30], rownumbers: true, rownumWidth: 60, pager:"#pager2", sortname:'id', viewrecords: true, gridview: true, autowidth: true, sortorder:"asc", shrinkToFit: true, loadonce:true, caption:" Renewal List", }); $("#list2").jqGrid("setLabel", "rn", "SL"); $("#list2").jqGrid('filterToolbar',{searchOperators : false}); //for multisearch code,remove if not required $("#list2").jqGrid('navGrid','#pager2', {edit:false,add:false,del:false,search:true,refreshstate:"current"}, { }, { }, { }, { sopt:['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true, closeAfterDelete:true, closeAfterEdit:true }, ); } }); $(document).on('click','.delete_req',function(){ var asset_id = $(this).attr('asset_id'); var test = $(this); var row = $(this).closest('tr'); swal({ title: "Are you sure?", text: "You will not be able to recover this data!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, delete it!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); test.attr('disabled', 'disabled'); test.text("Deleting..."); $.ajax({ type : 'post', url : '<?php echo site_url("yaskawa/delete_products_renewal")?>', data : {id:asset_id}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { toastr["success"](response.message); $("#list2").setGridParam({datatype:'json', page:1}).trigger('reloadGrid'); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); }); function fun_edit(rowId) { var id = rowId; window.location.href = '<?php echo site_url('edit-renewal');?>/'+id; } $('.asset_update_form').submit(function(e){ e.preventDefault(); formdata = new FormData($(this)[0]); $(".update_submit").attr('disabled', 'disabled'); $(".update_submit").text("Submitting..."); $.ajax({ type : 'post', url : '<?php echo site_url("update_client_asset")?>', data : formdata, contentType: false, processData: false, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { toastr["success"](response.message); //$('.client_form')[0].reset(); $(".update_submit").text("Submit"); $(".update_submit").removeAttr('disabled'); $("#access_modal").modal('hide'); $("#list2").setGridParam({datatype:'json', page:1}).trigger('reloadGrid'); } else if(response.result == 2) { toastr["error"](response.message); $(".update_submit").text("Submit"); $(".update_submit").removeAttr('disabled'); } else { toastr["error"](response.message); $(".update_submit").text("Submit"); $(".update_submit").removeAttr('disabled'); } } }); }); </script> <?php $this->load->view('includes/admin_footer');?> <style type="text/css"> .form-group{ margin-bottom: 15px !important; } .form-control{ width:100% !important; } </style>