EVOLUTION-NINJA
Edit File: qc_verfication_page.php
<?php $this->load->view('includes/header.php')?> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/css/grid_style.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/css/jquery-ui.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/jqgrid/css/ui.jqgrid.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/jqgrid/css/ui.jqgrid-bootstrap.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/jqgrid/css/ui.jqgrid-bootstrap-ui.css'); ?>" /> <script type="text/javascript" src="<?php echo base_url('assets/jqgrid/js/jquery.jqGrid.min.js'); ?>"></script> <script type="text/javascript" src="<?php echo base_url('assets/jqgrid/js/i18n/grid.locale-en.js'); ?>"></script> <script src="<?php echo base_url('assets/js/jquery-ui.js'); ?>" type="text/javascript"></script> <div class="container bg" style="background: white; padding: 30px; border:1px solid #EEEEEE; margin-bottom: 30px; margin-top: 30px;"> <div class="content-header"> <div class="container-fluid"> <div class="row mb-2"> <div class="col-sm-6"> </div> <div class="col-sm-6"> <ol class="breadcrumb float-sm-right"> <li class="breadcrumb-item"><a href="#">Purchase</a></li> <li class="breadcrumb-item"> Qc Verification </li> </ol> </div> </div> </div> </div> <!--<h3 class="page-title" style="padding-bottom: 20px;">--> <!--QC Details--> <!--</h3>--> <div id="stock_details"> <div id ="jaytab" style="margin-top:3%" class="grid "> <table id="list2"></table> <div id="pager2"></div> <div id="dialogSelectRow" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> </div> <style type="text/css"> form{ padding-top: 30px; } #gbox_list3{ width: 1050px; } </style> <script type="text/javascript"> CallGrid(); function CallGrid() { $(document).ready(function (){ jQuery("#list2").jqGrid({ url:"<?php echo site_url('get-qc-details')?>", datatype: "json", colNames:['Id','PO No','Layout','Site','View','Created By','Created At','Approve'], colModel:[ {name:'id',index:'id',hidden:true, key:true,width:50,editable:true,width:100}, {name:'po_no',index:'po_no', width:100,editable:true,editrules:{required: true}}, {name:'layout',index:'layout', editable:true,editrules:{required: true},width:100}, {name:'site',index:'site', editable:true,editrules:{required: true},width:100}, {name:'',index:'',align: "center",editable:false,editrules:{required: true},search:false,width:100,cellattr: function (cellvalue, options, rowObject) { return ' onclick="fun_view('+rowObject.id+');" '; },formatter:function (cellvalue, options, rowObject) { // return "<input type='button' value='View' \>"; return "<button type='button' id='btn'><i class='fa fa-eye' aria-hidden='true'></i></button>"; } }, {name:'name',index:'name',width:100,hidden:false,editable:false}, {name:'created_on',index:'created_on', editable:true,editrules:{required: true},width:120,formatter: 'date',formatoptions: { srcformat: 'ISO8601Long', newformat: 'd-m-Y g:ia'}}, {name:'qc_approval',index:'qc_approval',editable:false,align:'center',editrules:{required: true},search:false, width:120,cellattr: function (rowId, tv, rawObject, cm, rdata) { return 'onclick="fun_approve('+rawObject.id+',\'' + rawObject.qc_approval + '\')"'; },formatter:function (cellvalue, options, rowObject) { if(cellvalue == 'APPROVED') return "<input type='checkbox' value='APPROVE' checked readonly \>"; else if(cellvalue == 'NOT_APPROVED') return "<input type='checkbox' value='APPROVE' \>"; }} ], height: 'auto', rowNum:50, rowTotal: 200000000000000000000000000, rowList : [50,100,200,300,500,1000,5000], rownumbers: true, rownumWidth: 40, pager:"#pager2", sortname:'id', viewrecords: true, gridview: true, autowidth: true, sortorder:"desc", //multiple: true, loadonce:true, loadonce:true, caption:"QC Details", subGrid: false, }); $("#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:false,refreshstate:"current"}, { }, { }, { }, { sopt:['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true, closeAfterDelete:true, closeAfterEdit:true }, ); }); } /*----------------------------------------------------------------------------*/ function fun_view(id) { window.location.href="<?php echo site_url('view-qc-details/');?>"+id; } function fun_approve(id,approval) { if(approval == 'APPROVED') { swal({ title: "This QC is already Verified!!", type: "warning", showCancelButton: false, confirmButtonColor: "#DD6B55", confirmButtonText: "OK" }); $("#list2").setGridParam({datatype:'json', page:2}).trigger('reloadGrid'); } else { swal({ title: "Are you sure?", text: "You want to Verified this?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $.ajax({ type : 'post', url : "<?php echo site_url('qc-approval');?>", data : {'po_id':id}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { toastr["success"](response.message); } else { toastr["error"](response.message); } } }); } }); } } </script> <?php $this->load->view('includes/footer.php')?>