EVOLUTION-NINJA
Edit File: products.php
<?php $this->load->view('includes/header.php')?> <link rel="stylesheet" href="<?php echo base_url('assets/css/jquery-ui.css');?>" /> <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/ecmascript" src="<?php echo base_url('assets/jqgrid/js/jquery.jqGrid.min.js'); ?>"></script> <script type="text/ecmascript" 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> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <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="#">Accounts</a></li> <li class="breadcrumb-item"><a href="#">Masters</a></li> <li class="breadcrumb-item"><a href="#">General</a></li> <li class="breadcrumb-item">Product </li> </ol> </div> </div> </div> </div> <div class="row"> <div class="col-md-12 grid-margin stretch-card"> <div class="card"> <div class="card-body"> <!-- <button class="add_product btn btn-primary">Add Product</button> --> <!-- <a href="<?php echo site_url('insert-product');?>"><button type="button" class="btn btn-sm btn-primary">Add Product</button></a> --> <div class="col-sm-11"> <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> </div> </div> </div> </div> <script type="text/javascript"> $(document).ready(function(){ CallGrid(); function CallGrid() { jQuery("#list2").jqGrid({ url:"<?php echo site_url('get-products')?>", mtype : "get", datatype: "json", colNames:['','ID','Product Name','Type','Unit','Unit Price','From Date','To Date','CGST %','SGST %','IGST %','HSN Code'], colModel:[ {name: 'myac', width:50, fixed:true, sortable:false, resize:false, formatter:'actions', formatoptions:{keys:true,delbutton:false}}, {name:'product_id',index:'product_id',width:50, hidden:true,editable:false,key:true}, {name:'product_name',index:'product_name',width:200, hidden:false,editable:false}, {name:'product_group_name',index:'product_group_name',width:300, hidden:false,editable:false}, // {name:'product_quantity',index:'product_quantity',width:80, hidden:false,editable:false}, {name:'unit_name',index:'unit_name',width:80, hidden:false,editable:false}, {name:'unit_price',index:'unit_price',width:80, hidden:false,editable:true}, {name:'from_date',index:'from_date',width:80, hidden:false,editable:true,editoptions:{size:20, dataInit:function(el){ $(el).datepicker({dateFormat:'dd-mm-yy'}); }},search:true,}, {name:'to_date',index:'to_date',width:80, hidden:false,editable:true,editoptions:{size:20, dataInit:function(el){ $(el).datepicker({dateFormat:'dd-mm-yy'}); }},search:true,}, {name:'cgst',index:'cgst',width:50, hidden:false,editable:false}, {name:'sgst',index:'sgst',width:50, hidden:false,editable:false}, {name:'igst',index:'igst',width:50, hidden:false,editable:false}, {name:'hsn_code',index:'hsn_code',width:100, hidden:false,editable:false}, ], rowNum:20, rowTotal: 2000, rowList : [20,30], rownumbers: true, toolbar: [true, "top"], pager:"#pager2", sortname:'id', viewrecords: true, gridview: true, //autowidth: true, sortorder:"asc", shrinkToFit: true, loadonce:true, autoencode: true, caption:"Product List", //Subgrid1... subGrid: false, editurl: "<?php echo site_url('update-product');?>", }); $('#t_list2') .append($("<div><input id=\"globalSearchText\" type=\"text\"></input> <button id=\"globalSearch\" type=\"button\">Search</button></div>")); $("#globalSearchText").keypress(function (e) { var key = e.charCode || e.keyCode || 0; if (key === $.ui.keyCode.ENTER) { // 13 $("#globalSearch").click(); } }); $("#globalSearch").button({ icons: { primary: "ui-icon-search" }, text: false }).click(function () { var rules = [], i, cm, postData = $("#list2").jqGrid("getGridParam", "postData"), colModel = $("#list2").jqGrid("getGridParam", "colModel"), searchText = $("#globalSearchText").val(), l = colModel.length; for (i = 0; i < l; i++) { cm = colModel[i]; if (cm.search !== false && (cm.stype === undefined || cm.stype === "text")) { rules.push({ field: cm.name, op: "cn", data: searchText }); } } postData.filters = JSON.stringify({ groupOp: "OR", rules: rules }); $("#list2").jqGrid("setGridParam", { search: true }); $("#list2").trigger("reloadGrid", [{page: 1, current: true}]); return false; }); } }); /*function fun_edit(id) { window.location.href = '<?php echo site_url('Edit-product-list');?>/'+id; } function delete_layout(id) { 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(); $.ajax({ url:"<?php echo site_url("delete-product-list")?>", type:"POST", data:{id:id}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { toastr["success"]("Deleted successfully"); $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } else { toastr["error"](response.message); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); }*/ </script> <?php $this->load->view('includes/footer'); ?> <style type="text/css"> #globalSearchText { width: 451px; margin-top: 2px; } .regis-block{ padding: 15px; background: #fff; } .regist-button{ text-align: center; padding-top: 20px; } .form_submit label{ padding-top: 20px; } pre { background-color: transparent; border: 1px solid transparent; line-height: 1.6; text-align: justify; } .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); } .regis-block{ padding: 15px; background: #fff; } .regist-button{ text-align: center; padding-top: 20px; } </style>