EVOLUTION-NINJA
Edit File: add_indent_details.php
<?php $this->load->view('includes/header.php')?> <link rel="stylesheet" href="<?php echo base_url('assets/css/jquery-ui.css');?>" /> <link rel="stylesheet" href="<?php echo base_url('assets/css/bootstrap-datepicker.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'); ?>" /> <link rel="stylesheet" href="<?php echo base_url('assets/sumoselect/sumoselect.css');?>"> <script src="<?php echo base_url('assets/sumoselect/jquery.sumoselect.min.js');?>"></script> <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');?>"></script> <script src="<?php echo base_url('assets/js/bootstrap-datepicker.js');?>"></script> <div class="content-wrapper"> <div class="content-wrapper2"> <section class="content-header"> <h1 style="padding-left: 60px; padding-top: 20px;">Add Indent<small></small> </h1> </section> <section class="content"> <form id="emp_submit" class="regis-block" method="POST"> <input type="hidden" id="product_group_id" /> <div class="row"> <div class="col-sm-3"> <label class="">Indent No</label> <div class="yes_form"> <?php if($indent != "") { $value2 = $indent->sl_indent_no; //str_pad($value2, 2, '0', STR_PAD_LEFT); $value3 = 01+$value2; $cur_date = date('Y-m-d'); $current_date = date('d.m.Y',strtotime($cur_date)); ?> <input type="text" class="form-control indent_no" name="indent_no" id="indent_no" value="<?php echo $value3." MC.".$current_date;?>" readonly > <input type="hidden" class="form-control sl_indent_no" name="sl_indent_no" id="sl_indent_no" value="<?php echo $value3;?>" readonly > <?php } else { $cur_date = date('Y-m-d'); $current_date = date('d.m.Y',strtotime($cur_date)); ?> <input type="text" class="form-control indent_no" name="indent_no" id="indent_no" value="<?php echo "1 MC.".$current_date;?>" readonly > <input type="hidden" class="form-control sl_indent_no" name="sl_indent_no" id="sl_indent_no" value="1" readonly > <?php }?> </div> </div> <div class="col-sm-3"> <label class="">Selection</label> <div class="yes_form"> <select name="cus_layout" class="form-control cus_layout" onchange="selection_hide()" required> <option value="">Select</option> <option value="customer">Customer</option> <option value="layouts">Layout</option> </select> </div> </div> <!-- <div class="col-sm-12 col-xs-12 col-md-6"> <label class="col-sm-4">Department</label> <div class="col-sm-12 yes_form"> <select name="department" class="form-control" id="department" required> <option value="">Select</option> <?php foreach($dept_list as $key => $value) { ?> <option value="<?php echo $value->id; ?>"><?php echo $value->department_name; ?></option> <?php } ?> </select> </div> </div> --> <div class="col-sm-3 indent_layout1"> <label class="">Layouts</label> <div class="yes_form"> <select name="layout" class="form-control layout" id="layout" required > <option value="">Select</option> <?php foreach($layout_names as $value) { ?> <option value="<?php echo $value->id; ?>"><?php echo $value->layout_name;?></option> <?php } ?> </select> </div> </div> <div class="col-sm-3 indent_layout2"> <label class="">Site</label> <div class="yes_form"> <select name="site_number" class="form-control site_number" id="site_number" required > </select> </div> </div> </div> <div class="row"> <div class="col-sm-3 indent_send_to" > <label class="">Send To</label> <div class="yes_form"> <select name="send_to" class="form-control send_to" id="send_to" required > <option value="">Select</option> <option value="Site">Site</option> <option value="Godown">Godown</option> </select> </div> </div> <div class="col-sm-3 indent_level" > <label class="">Level</label> <div class="yes_form"> <select name="level" class="form-control level" id="level" required > <option value="">Select</option> <?php foreach($level as $value) { ?> <option value="<?php echo $value->id; ?>"><?php echo $value->level_name;?></option> <?php } ?> </select> </div> </div> <div class="col-sm-3"> <label class="">Tax</label> <div class="yes_form"> <!-- <select name="tax" id="tax" class="form-control tax" required > <option value="">Select</option> <option value="YES">With Tax</option> <option value="NO">Without Tax</option> </select> --> <label style="padding-top: 0px !important;">With Tax</label> <input type="radio" name="tax" value="YES" required style="height: auto !important;" > <label style="padding-top: 0px !important;"> Without Tax</label> <input type="radio" name="tax" value="NO" style="height: auto !important;"> </div> </div> <div class="col-sm-3"> <label class="">Product Type</label> <select name="ref_type" class="form-control ref_type" onchange="change_product_group(this.value)" required> <option value="">Select</option> <?php foreach($product_type as $key => $value) { ?> <option value="<?php echo $value->product_group_id; ?>"><?php echo $value->product_group_name;?></option> <?php } ?> </select> </div> </div> <!-- <div class="row"> <div class="col-sm-12 col-xs-12 col-md-6"> <label class="col-sm-4"></label> <div class="col-sm-8 yes_form"> <input type="button" class="btn btn-primary add_products" value="Add Products"/> </div> </div> <div class="col-sm-12 col-xs-12 col-md-6"></div> </div>--> <div class="row"> <div class="modal-body"> <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> <br/> <table id="list10_d"></table> <div id="pager10_d"></div> <div id="dialogSelectRow" title="Warning" style="display:none"> <a href="javascript:void(0)" id="ms1">Get Selected id's</a> </div> </div> </div> </div> <div class="row show-remaining" style="display:none; "> <div class="col-sm-12"> <table class="table-responsive tab_vendor" style="width:100%;"> <thead> <tr style="background:#367fa9;color:#ffffff;"> <th style="width:220px;border-top: 1px solid #367fa9;">Product Name</th> <!--<th style="width:180px;border-top: 1px solid #367fa9;">Product Type</th>--> <th style="width:80px;border-top: 1px solid #367fa9;">Quantity</th> <th style="width:80px;border-top: 1px solid #367fa9;">Unit</th> <th style="width:300px;border-top: 1px solid #367fa9;">Reason</th> <th style="width:60px;border-top: 1px solid #367fa9;">Action</th> </tr> </thead> <tbody id="hidden_table"> </tbody> </table> </div> </div> <div class="row "> <div class="col-sm-4 location"> <label class="">Location</label> <div class="yes_form"> <select name="consumed_at" class="form-control consumed_at" id="consumed_at" > <option value="">Select</option> <?php foreach($location as $value) { ?> <option value="<?php echo $value->id; ?>"><?php echo $value->consumed_at;?></option> <?php } ?> </select> </div> </div> <div class="col-sm-4"> <label class="">Required On or Before</label> <div class="yes_form"> <input type="text" class="form-control required_before" name="required_before" id="datepick1" required> </div> </div> </div> <div class="but" style="text-align: center; margin-top: 40px;"> <!-- <input class="btn btn-primary more_add" type="button" value="ADD More"/> --> <button type="submit" class="btn center-block btn-primary submit">Submit</button> <!-- <button type="button" class="btn center-block new_indent">Create New Indent</button> --> <button type="reset" class="btn center-block cancel" style="background: #E6E6E6; margin-left: 10px;">Cancel</button> </div> </form> <div class="modal fade" id="edit_modal" tabindex="-1" role="dialog" aria-labelledby="ModalLabel" aria-hidden="true"> <div class="modal-dialog modal-xl" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="ModalLabel">Add Products</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <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 class="modal-footer"> <!-- <button type="submit" class="btn btn-primary submit">Submit</button> --> <button type="button" class="btn btn-light" data-dismiss="modal">Close</button> </div> </div> </div> </div> </section> </div> </div> <style type="text/css"> .content-wrapper2{ border:1px solid #E6E6E6; } .content-wrapper { max-width: 1460px !important; } .row-form { width:100%; } #emp_submit label{ padding-top: 20px; } </style> <script type="text/javascript"> $(".location").hide(); $(document).ready(function() { $(".indent_layout1").hide(); $(".indent_layout2").hide(); $(".indent_send_to").hide(); $(".indent_level").hide(); }); function selection_hide() { var indent_owner=$(".cus_layout").val(); if(indent_owner == "customer") { $(".indent_layout1").hide(); $('#layout').removeAttr('required'); $(".indent_layout2").hide(); $('#site_number').removeAttr('required'); $(".indent_send_to").hide(); $('#send_to').removeAttr('required'); $(".indent_level").hide(); $('#level').removeAttr('required'); } else { $(".indent_layout1").show(); $('#layout').attr('required', 'required'); $(".indent_layout2").show(); $('#site_number').attr('required', 'required'); $(".indent_send_to").show(); $('#send_to').attr('required', 'required'); $(".indent_level").show(); $('#level').attr('required', 'required'); } } $('.cancel').click(function(){ window.location = '<?php echo site_url("indent")?>'; }); $('.add_products').click(function(){ $('#edit_modal').modal('show'); }) $('#layout').change(function() { var layout_name = $(this).val(); $.ajax({ type:'post', url:'<?php echo site_url('fetch-site-id');?>', data:{"layout_name":layout_name}, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { var con = ''; con += '<option value="">select</option>'; $.each( response.message, function( key, value ) { con += '<option value="'+value.id+'">'+value.site_no+'</option>'; }); $('.site_number').empty(); $('.site_number').append(con); } else { toastr["error"](response.message); } } }); }); $('#datepick1').datepicker({ startDate: new Date(), format: "dd-mm-yyyy", minDate : 0, }).on('changeDate', function(ev){ $('#datepick1').datepicker('hide'); }); change_product_group(); function change_product_group(str) { var product_group_id = str; $("#product_group_id").val(product_group_id); $("#list2").setGridParam( { url:"<?php echo site_url('product-details')?>/"+product_group_id, page:1 } ).trigger("reloadGrid");//Reload grid trigger $("#list2").setGridParam({datatype:'json', page:1}).trigger('reloadGrid'); } var current_page=0; var currids =[]; jQuery("#list2").jqGrid({ url:"<?php echo site_url('get-products/0')?>", mtype : "get", datatype: "json", colNames:['ID','Product Group','Product Name','HSN Code','Unit','Supply Date From','Supply Date To','Supply Days'], colModel:[ {name:'product_id',index:'product_id',width:100, key:true,hidden:true,editable:false}, // {name:'product_id',index:'product_id',hidden:true, width:100,editable:false}, {name:'product_group_name',index:'product_group_name',width:250, hidden:false,editable:false}, {name:'product_name',index:'product_name',width:250, hidden:false,editable:false}, {name:'hsn_code',index:'hsn_code',width:130, hidden:false,editable:false}, // {name:'product_quantity',index:'product_quantity',width:100, hidden:false,editable:false}, {name:'unit_name',index:'unit_name',width:80, hidden:false,editable:false}, {name:'credit_date',index:'credit_date',width:120, hidden:false,editable:false}, {name:'till_date',index:'till_date',width:120, hidden:false,editable:false}, {name:'supply_days',index:'supply_days',width:80, hidden:false,editable:false}, ], rowNum:50, rowTotal: 2000, rowList : [50,100,200,400,800,1600], toolbar: [true, "top"], rownumbers: true, //rownumWidth: 60, pager:"#pager2", viewrecords: true, loadonce:true, gridview: true, //autowidth: true, sortorder:"asc", shrinkToFit: true, multiselect: true, autoencode: true, caption:"Product List", //Subgrid1... subGrid: false, onSelectRow: function(ids) { if(ids == null) { ids=0; if(jQuery("#list10_d").jqGrid('getGridParam','records') >0 ) { changefunction(cellValues1); } } else { var id=jQuery("#list2").jqGrid('getGridParam','selrow'); currids.push(id); var result = []; $.each(currids, function(i, e) { if ($.inArray(e, result) == -1) result.push(e); }); changefunction(result); } }, onSelectAll:function(ids) { changefunction(ids); }, }); var myGrid = $("#list2"); //$("#cb_"+myGrid[0].id).hide(); $('#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; }); pro_id=[];var lastSelection; function updateIdsOfSelectedRows() { id = jQuery("#list2").jqGrid('getGridParam','selarrrow'); // alert(id); $.ajax({ type : 'post', url : '<?php echo site_url("get-product-details")?>', data : {'product_id':pro_id}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); //alert(response); if(response.result == 1) { var con = ''; } } }); } function changefunction(cellValues1) { var id; id = jQuery("#list2").jqGrid('getGridParam','selarrrow'); $.ajax({ type : 'post', url : '<?php echo site_url("get-product-details")?>', data : {'product_id':cellValues1}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); //alert(response); if(response.result == 1) { var con = ''; $.each(response.message, function(key, val) { con += '<tr class="new_product"><td style="width:220px;"><input type="hidden" name="add_products[]" value="'+val.product_id+'" readonly /><input style="width:450px;" type="text" name="product_name" value="'+val.product_name+'" readonly /></td><input type="hidden" name="product_type[]" value="'+val.product_group_id+'" readonly /><input style="width:180px;" type="hidden" name="product_type_name" value="'+val.product_group_name+'" readonly /><td style="width:80px;"><input style="width:80px;" type="text" name="quantity[]" value="" pattern="[0-9]+" title="Please enter numbers only" required/></td><td style="width:80px;"><input type="hidden" name="unit_id[]" value="'+val.u_id+'" readonly /><input style="width:80px;" type="text" name="unit_name" value="'+val.unit_name+'" readonly /></td><td style="width:300px;"><input style="width:300px;" type="text" name="prod_reason[]" /></td><td style="width:60px;"><a class="remove" href="javascript:void(0);"><center><i class="fa fa-trash" style="color:red;" aria-hidden="true"></i></center></a></td></tr>'; }); $('#hidden_table').empty(); $('#hidden_table').append(con); $(".remove").click(function(){ $(this).closest('.new_product').remove(); }); } } }); $('#list2'+i).addClass( "ui-state-highlight" ); $('#edit_modal').modal('hide'); $('.show-remaining').show(); /*} else $( "#dialogSelectRow" ).dialog();*/ } $('#emp_submit').submit(function(e){ e.preventDefault(); var id = jQuery("#list2").jqGrid('getGridParam','selarrrow'); if(id == '') { swal({ title: "Please select atleast one Product!!", type: "warning", showCancelButton: false, confirmButtonColor: "#DD6B55", confirmButtonText: "OK" }); } else { formdata = new FormData($(this)[0]); swal({ title: "Are you sure?", text: "You want to Save 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('insert-indent-details');?>", data : formdata, contentType: false, processData: false, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { toastr["success"](response.message); setTimeout(function wait(){ window.location = '<?php echo site_url("indent")?>'; }, 1000); } else { toastr["error"](response.message); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } }); $('table#tab_vendor').keydown(function (e) { //$('ul#example1 li').keydown(function (e) { alert(2); var c = ""; if (e.which == 39) { // Right Arrow c = currCell.next(); } else if (e.which == 37) { // Left Arrow c = currCell.prev(); } else if (e.which == 38) { // Up Arrow c = currCell.closest('tr').prev().find('td:eq(' + currCell.index() + ')'); } else if (e.which == 40) { // Down Arrow c = currCell.closest('tr').next().find('td:eq(' + currCell.index() + ')'); } else if (!editing && (e.which == 13 || e.which == 32 || e.which == 113)) { // Enter, Spacebar, F2 - edit cell e.preventDefault(); edit(); } else if (!editing && (e.which == 9 && !e.shiftKey)) { // Tab e.preventDefault(); c = currCell.next(); } else if (!editing && (e.which == 9 && e.shiftKey)) { // Shift + Tab e.preventDefault(); c = currCell.prev(); } // If we didn't hit a boundary, update the current cell if (c.length > 0) { currCell = c; currCell.focus(); } }); // User can cancel edit by pressing escape $('#edit').keydown(function (e) { if (editing && e.which == 27) { editing = false; $('#edit').hide(); currCell.toggleClass("editing"); currCell.focus(); } }); </script> <style type="text/css"> .tab_vendor > thead > tr > th, .tab_vendor > tbody > tr > td { border: 1px solid #367fa9 !important; white-space: nowrap; } #globalSearchText { width: 451px; margin-top: 2px; } #pager2_center { padding-left: 0px !important; } .regis-block{ padding: 15px; background: #fff; margin-right: 50px; margin-left: 50px; margin-bottom: 50px; } .indent-button{ margin-top: 10px; } .regist-button{ text-align: center; padding-top: 20px; } .modal-backdrop{ z-index: 1 !important; } #hidden_table input{ border:none; padding: 10px; font-size: 12px; } .show-remaining th{ padding: 10px !important; text-align: center; } #list3 { overflow-x: scroll; } #gbox_list2,#gview_list2,#t_list2,#pager2{ width:1100px !important; } .ui-jqgrid-hdiv,.ui-jqgrid-bdiv{ width:1100px; } #jaytab{ text-align: -webkit-center; } #emp_submit input{ height: 30px; padding: 2px; } #emp_submit select{ height: 30px; padding: 2px; } 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); } .ui-jqgrid-hdiv,.ui-jqgrid-bdiv,#list2{ width:1100px !important; } </style> <?php $this->load->view('includes/footer.php')?>