EVOLUTION-NINJA
Edit File: assign_task_list_main.php
<?php $this->load->view('includes/admin_header');?> <link rel="stylesheet" href="<?php echo base_url('admin_assets/sumoselect/sumoselect.css');?>"> <script src="<?php echo base_url('admin_assets/sumoselect/jquery.sumoselect.min.js');?>"></script> <!-----------grid------------------------> <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="main-container " id="main-container"> <div class="main-content"> <div class="main-content-inner"> <div class=" page-content" style="background-color:#f0f0f0;"> <section class="content-header"> <h1>New Task List </h1> </section> <section class="content"> <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> </section> </div><!-- /.page-content --> </div> </div><!-- /.main-content --> <div class="footer"> <div class="footer-inner"> <div class="footer-content"> <span class="blue">All Right Reserved © 2017</span> <a href=""> Jay Blues Technologies</a> </div> </div> </div> <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse"> <i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i> </a> </div><!-- /.main-container --> <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(){ CallGrid(); function CallGrid() { jQuery("#list2").jqGrid({ url:"<?php echo site_url('view_assign_task_list')?>", mtype : "get", datatype: "json", colNames:['SI','Project','Client','Task Title','Task Description','Resposible','Deadline','Priority','Attachment','Action'], colModel:[ {name:'id',index:'id', width:50, hidden:true,editable:false,key:true}, {name:'account_name',index:'account_name',editable:false, width:100}, {name:'client_name',index:'client_name',editable:false, width:100}, {name:'title',index:'title',edittype:'text',editable:false,width:100}, {name:'description',index:'description',editable:false, width:100}, {name:'responsible_person',index:'responsible_person',editable:false, width:120, }, {name:'deadline',index:'deadline',editable:false, width:50,edittype:"text"}, {name:'priority',index:'priority',editable:false, width:70,edittype:"text"}, {name:'attachment',index:'attachment',editable:false,search:false,editrules:{}, width:50, formatter: function (cellvalue, options, rowObject) { if(rowObject.attachment){ var upload_file=jQuery.parseJSON(rowObject.attachment); console.log(upload_file); var retVal = ''; $.each(upload_file, function(key, val){ retVal +='<a href="<?php echo base_url('taskattachment');?>/'+val+'" target="_blank" ><img width="30px" height="30px" src="<?php echo base_url('taskattachment');?>/'+val+'" class="profile-pic"/></a>'; }); return retVal; } else{ return ''; } }}, { name: 'EditAction', index: 'id',search:false, align: 'center', width: 30, formatter: function (cellvalue, options, rowObject) { return ' <a class="delete_task" 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:" Task Assign 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 }, ); // $("#list2").navButtonAdd('#pager2', // { caption:"Edit", // buttonicon:"ui-icon-pencil", // onClickButton: editRow, // position: "last", // title:"", // cursor: "pointer", // id:"client_edit" // } // ); // $("#list2").navButtonAdd('#pager2', // { caption:"Delete", // buttonicon:"ui-icon-trash", // onClickButton: deleteRow, // position: "last", // title:"", // cursor: "pointer", // id:"client_delete" // } // ); } }); $(document).on('click','.delete_task',function(){ var id = $(this).attr('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("delete_assign_task_main")?>', data : {id: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(); } }); }); </script>