EVOLUTION-NINJA
Edit File: sam_sdk_pgm.php
<style> .ui-jqgrid { text-transform: capitalize !important; } .tablediv { text-transform: uppercase !important; } .ui-jqgrid tr.jqgrow td{ text-transform: uppercase !important; } .badge { background: -webkit-radial-gradient( 1px -11px, circle, rgba(17, 208, 85, 0.98) 8%, rgb(7, 46, 80) 26px ); background-color: #ef0e0e; border: 1px solid white; border-radius: 12px; color: white; font: bold 12px/9px Helvetica, Verdana, Tahoma; height: 17px; padding: 3px 3px 0 3px; text-align: center; min-width: 19px; margin-bottom: 16px; } </style> <script> function planningtypes(str) { if(str=="sam") { $('#table_stk_indent').hide(); $('#table_sam_indent').show(); } else if(str=="stk") { $('#table_stk_indent').show(); $('#table_sam_indent').hide(); var colPos = 0; } } </script> <?php //include("menu.php"); ?> <!-- BEGIN CONTENT --> <div class="page-content-wrapper"> <div class="page-content"> <!-- BEGIN PAGE HEADER--> <h3 class="page-title"> DTL SAM / STK Details </h3> <?php // echo $this->load->view('templates/nav_menu'); ?> <div class="page-bar"> <ul class="page-breadcrumb"> <li><i class="fa fa-home"></i> <a href="<?php echo base_url();?>dashboard">Home</a> <i class="fa fa-angle-right"></i> <a href="#" > SAM / STK Program </a></li> </ul> </div> <?php if(empty($access_row)) { } else { if($access_row->insert_id == '1') { ?> <form action="<?php echo base_url(); ?>planning/sam_syk_input_demo" method="post" class="form-horizontal"> <b>To insert data click here:</b> <input type="hidden" value="<?php echo $url_val; ?>" id="url_reference_val" name="url_reference_val" style="width: 230px;" > <input type="submit" name="Insert" value="Insert" /><br><br> </form> <?php } else { ?> <?php } }?> <input type="hidden" id="delete_id" class="delete_id" value="<?php if(empty($access_row)){ } else { echo $access_row->delete_id; } ?>" > <input type="hidden" id="insert_id" class="insert_id" value="<?php if(empty($access_row)){ } else { echo $access_row->insert_id; } ?>" > <input type="hidden" id="preview_id" class="preview_id" value="<?php if(empty($access_row)){ } else { echo $access_row->preview_id; } ?>" > <input type="hidden" id="edit_id" class="edit_id" value="<?php if(empty($access_row)){ } else { echo $access_row->edit_id; } ?>" > <div class="radio-list" style="margin-left: 2%;"> <input type="hidden" value="<?php echo $ref; ?>" id="ref_id" > <input type="hidden" value="<?php echo $url_val; ?>" id="url_ref" style="width: 230px;" > <?php if($ref == 'today_dashboard' || $ref == 'month_dashboard' || $ref == 'year_dashboard') { ?> <label class="radio-inline"> <input type="radio" checked="checked" name="planningorder" id="planningorder" onclick="planningtypes('sam')" /> DTL-SAM </label> <span class="badge"><?php echo $sam_marketing; ?></span> <label class="radio-inline"> <input type="radio" name="planningorder" id="planningorder" onclick="planningtypes('stk')" /> DTL-STK</label><span class="badge"><?php echo $stk_marketing; ?></span> <?php } else { ?> <label class="radio-inline"> <input type="radio" checked="checked" name="planningorder" id="planningorder" onclick="planningtypes('sam')" /> DTL-SAM </label> <label class="radio-inline"> <input type="radio" name="planningorder" id="planningorder" onclick="planningtypes('stk')" /> DTL-STK</label> <?php } ?> </div><br> <input type="hidden" id="delete_id" class="delete_id" value="<?php if(empty($access_row)){ } else { echo $access_row->delete_id; } ?>" > <input type="hidden" id="insert_id" class="insert_id" value="<?php if(empty($access_row)){ } else { echo $access_row->insert_id; } ?>" > <input type="hidden" id="preview_id" class="preview_id" value="<?php if(empty($access_row)){ } else { echo $access_row->preview_id; } ?>" > <input type="hidden" id="edit_id" class="edit_id" value="<?php if(empty($access_row)){ } else { echo $access_row->edit_id; } ?>" > <input type="hidden" id="approval_id" class="approval_id" value="<?php if(empty($access_row)){ } else { echo $access_row->approval_id; } ?>" > <!-- END PAGE HEADER--> <!-- BEGIN DASHBOARD STATS --> <!--<div class="caption"> <i class="fa fa-globe" style="border:1px solid"></i>Transaction Input details </div>--> <!--<a href="javascript:;" class="reload"> </a>--> <div id="table_sam_indent"> <div id = "jaytab" class="jaytab"> <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 id="table_stk_indent" style="display:none;"> <div id = "jaytab1" class="jaytab"> <table id="list3"></table> <div id="pager3"></div> <div id="dialogSelectRoww" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> <!-- END DASHBOARD STATS --> </div> </div> </div> <!-- End BEGIN CONTAINER --> <!-- BEGIN FOOTER --> <!-- BEGIN FOOTER --> <link rel="stylesheet" href="<?php echo base_url('assets/css/code_jquery.min.css');?>"> <script src="<?php echo base_url('assets/js/jquery-ui.min.js'); ?>" type="text/javascript"></script> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/css/jquery-ui.min.css'); ?>" /> <style> thead{ background-color:rgb(87,142,190) !important; color:white !important; } #search_list2 { display:none !important; } .ss{ padding-right: 0 !important; padding-left: 0 !important; } .form-control { width:65% !important; height:27px !important; padding: 3px 12px !important; border-radius: 0px !important; //margin-bottom:15px; } label { font-weight: normal; text-align: left; } .hr-line{ border-top: 1px solid #465A81; } .well-sm { padding: 3px !important; border-radius: 0px !important; } input[type="file"] { padding-bottom: 28px !important; height: 25px !important; color:transparent; } .portlet.box.blue-madison { border: 1px solid #fff !important; border-top: 0; background:#fff !important; } #productgrid{ //height:380px; //overflow-y: scroll; } @media only screen and (min-width:320px) and (min-height:640px){ } </style> <script> $("#generate").on('click', function () { //alert(); var checkbox_value = ""; $(":checkbox").each(function () { var ischecked = $(this).is(":checked"); if (ischecked) { checkbox_value += $(this).val() + "|"; } }); // alert(checkbox_value); if(checkbox_value=="") { swal({ title: "Please Select the Products.", text: "", }); } else { var ids= $(".ids").val(checkbox_value); $(".form").submit(); // <!-- $.ajax({ // type: "post", // url: "<?php echo base_url(); ?>vendor/generated_product_wish_list", // data: "checkbox_value=" + checkbox_value, // success: function (data) { // window.location.href = '<?php echo base_url('vendor/po_generate');?>'; // } // });--> } }); function getDesignAndQuality(articleNo) { $.ajax({ type: "post", url: "<?php echo base_url(); ?>marketing/getDesignAndQuality", data: "articleNo=" + articleNo, success: function (data) { var objData = jQuery.parseJSON(data); document.getElementById("design").value = objData.design; document.getElementById("quality").value = objData.quality; } }); } </script> <!-----------------datepicker-------------> <link href="<?php echo base_url('assets/css/sweetalert2.min.css');?>" rel="stylesheet"/> <script src="<?php echo base_url('assets/js/sweetalert2.min.js');?>"></script> <script type="text/ecmascript" src="<?php echo base_url('jqgrid/js/jquery.jqGrid.min.js'); ?>"></script> <!-- This is the localization file of the grid controlling messages, labels, etc. <!-- We support more than 40 localizations --> <script type="text/ecmascript" src="<?php echo base_url('jqgrid/js/i18n/grid.locale-en.min.js'); ?>"></script> <!-- A link to a jQuery UI ThemeRoller theme, more than 22 built-in and many more custom --> <!-- The link to the CSS that the grid needs --> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('jqgrid/css/ui.jqgrid.min.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('jqgrid/css/ui.jqgrid-bootstrap.min.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('jqgrid/css/ui.jqgrid-bootstrap-ui.min.css'); ?>" /> <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/css/bootstrap-datepicker.min.css"/> <script src="<?php echo base_url();?>assets/js/bootstrap-datepicker.min.js"></script> <script> $('.datepicker').datepicker({ format: 'yyyy/mm/dd', }); </script> <style type="text/css"> .ss{ padding-right: 0 !important; padding-left: 0 !important; } label { font-weight: normal; text-align: left; } .hr-line{ border-top: 1px solid #465A81; } .well-sm { padding: 3px !important; border-radius: 0px !important; } input[type="file"] { padding-bottom: 28px !important; height: 25px !important; color:transparent; } .portlet.box.blue-madison { border: 1px solid #fff !important; border-top: 0; background:#fff !important; } input[type=file] { display: none; } .ui-jqgrid .ui-jqgrid-caption { text-align: left; background: rgb(72,91,127); color: white; } .ui-jqdialog .ui-jqdialog-titlebar { padding: .1em .1em; min-height: 35px; background: rgb(72,91,127); color: white; } .ui-jqdialog .ui-jqdialog-titlebar-close span { display: block; margin: -9px; } #sData { height: 27px; } #cData { height: 27px; } #dData { height: 27px; } #eData { height: 27px; } .coledit { padding-bottom: 8px !important; display: initial !important; cursor:pointer; text-align: right; padding-right: 23px !important; padding-left: 13px !important; } .coleditt { padding-bottom: 8px !important; display: initial !important; padding-left: 9px !important; padding-right: 8px !important; } .coledit1 { text-align: right; padding-right: 27px !important; padding-left: 27px !important; } .ui-jqgrid .ui-jqgrid-btable tbody tr.jqgrow td { overflow: hidden; white-space: pre; } </style> <style> #table_planned { display:none; } #table_unplanned { display:none; } .jqgfirstrow { height: 0px !important; } .list1 { height: 0px !important; } </style> <!-----------------datepicker-------------> <!-- The link to the CSS that the grid needs --> <script> $(document).ready(function (){ var l=$("#ref_id").val(); jQuery("#list2").jqGrid({ url:"<?php echo base_url('marketing/getorder_sam_details')?>/s"+l+"/", mtype : "post", datatype: "json", colNames:['Id','DTL#','File No', 'Sample Reference', 'Party Order No','Order Input Details','Status','Plan Status'], colModel:[ {name:'id',index:'id',hidden:true, width:50,editable:true,width:100}, {name:'oslNo',index:'oslNo', width:50,editable:true,width:100}, {name:'fileNo',index:'fileNo',editable:true, width:100}, {name:'orderMode',index:'orderMode',editable:true,editrules:{required: true},editoptions: {size:10, maxlength: 10}, width:100}, {name:'orderNo',index:'orderNo',edittype:'text',editable:true,editrules:{required: true}, width:100}, {name:'preview3',index:'preview3',align: "center",editable:false,editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_preview3($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='PREVIEW' \>"; }}, {name:'confirm_status',index:'confirm_status',edittype:'text',editable:true,editrules:{required: true}, width:100}, {name:'planningStatus',index:'planningStatus',edittype:'text',editable:true,editrules:{required: true}, width:100}, ], height: 'auto', rowNum:50, rowTotal: 2000000000000000000000000, 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, caption:"DTL-SAM Order Details", subGrid: true, subGridRowExpanded: function(subgrid_id, row_id) { // we pass two parameters // subgrid_id is a id of the div tag created within a table // the row_id is the id of the row // If we want to pass additional parameters to the url we can use // the method getRowData(row_id) - which returns associative array in type name-value // here we can easy construct the following var subgrid_table_id; // alert(row_id); swan_id=row_id; //alert(swan_id); subgrid_table_id = subgrid_id+"_t"; jQuery("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table>"); jQuery("#"+subgrid_table_id).jqGrid({ url:"<?php echo base_url('marketing/subgrid');?>/s"+row_id+"/", //data:{'sub_id':123}, mtype : "get", datatype: "json", colNames: ['Id','Article No','Unit','Width','Sub Order Type','Design','Quality','Weave','Description','Created By','Order Confirm','Confirm By','Edit','Delete'], colModel: [ {name:'id',index:'id',hidden:true, width:50,editable:true,width:20}, {name:'articleNo',index:'articleNo', width:70,height:12}, //{name:'buyerShade',index:'buyerShade', width:80,height:12}, {name:'unit',index:'unit', width:60,height:12}, {name:'width',index:'width', width:80,height:12}, {name:'subOrderType',index:'subOrderType', width:110,height:12}, {name:'design',index:'design', width:100,height:12}, {name:'quality',index:'quality', width:100,height:12}, {name:'weave',index:'weave', width:100,height:12}, {name:'description',index:'description', width:100,height:12}, {name:'created_by',index:'created_by', width:90,height:12}, { name: 'orderConfirm', index: 'orderConfirm', width:80, align: 'center', formatter: 'checkbox', editoptions: { value: '1:0' }, formatoptions: { disabled: false }, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun($(this))" '; } }, {name:'confirm_by',index:'confirm_by', width:90,height:12}, {name:'edit',index:'edit',align: "center",editable:false,editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_editt($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='EDIT' \>"; }}, {name:'delete',index:'delete',align: "center",editable:false,editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_deletee($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='DELETE' \>"; }}, //{name:'edit',index:'edit',editable:true,editrules:{required: true}, width:66,formatter:'showlink',classes:'fa fa-pencil-square-o col_delete',formatoptions:{baseLinkUrl:'<?php echo base_url('marketing/edit_form')?>'}}, //{name:'delete',index:'delete',editable:true,editrules:{required: true}, width:80,classes:'fa fa-trash-o col_delete',formatter:'showlink',formatoptions:{baseLinkUrl:'<?php echo base_url('marketing/delete_form')?>'}}, ], height: 'auto', rowNum:2000000000000000000, sortname: 'num', sortorder: "asc" }); } }); //$("#list2").jqGrid('filterToolbar',{searchOperators : false}); //for multisearch code,remove if not required jQuery("#list2").jqGrid('filterToolbar', { stringResult: true, searchOnEnter: false, defaultSearch: "cn" }); $("#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 } ); $("#list2").navButtonAdd('#pager2', { caption:"Delete", buttonicon:"ui-icon-trash", onClickButton: deleteRow, position: "last", title:"", cursor: "pointer", id:"client_delete" } ); }); function deleteRow() { // Get the currently selected row var v=$('#delete_id').val(); if(v == 1) { var row = $("#list2").jqGrid('getGridParam','selrow'); $("#id").val(row); if( row != null ) $("#list2").jqGrid('delGridRow',row, { modal:true,jqModal:true, recreateForm: true, beforeSubmit: function(postdata,formid){ $.ajax({ url:"<?php echo base_url('marketing/customer_delete')?>", type:"POST", data:{'id':row}, async:false, success:function(data){ if(data==""){ alert('Successfully Deleted'); $("#delmodlist2").remove(); $("#list2").trigger("reloadGrid"); window.location.reload(); } else{ alert('Successfully Deleted'); $("#delmodlist2").remove(); $("#list2").trigger("reloadGrid"); window.location.reload(); } } }); }, closeAfterEdit: true, reloadAfterSubmit:false, afterSubmit : false }); else $( "#dialogSelectRow" ).dialog(); } else { swal({ title: "You Don't Have Access For This Delete", text: "", }); } } function fun_editt(rowId) { var id = rowId.closest('tr').attr('id'); var as=id; var v=$('#edit_id').val(); // var s='planning/sam_stk_program' //alert(v); if(v == 1) { $.ajax({ type:'post', url:'<?php echo base_url("marketing/sam_edit_form"); ?>', data:{'as':as}, async:false, success:function() { var url_r=$('#url_ref').val(); if(url_r == '1') { window.location.href = '<?php echo base_url('marketing/sam_edit_form');?>/'+ '?id='+as; } else if(url_r == '2') { window.location.href = '<?php echo base_url('marketing/sam_transaction_edit_form');?>/'+ '?id='+as; } else if(url_r == '3') { window.location.href = '<?php echo base_url('marketing/sam_edit_details');?>/'+ '?id='+as; } else if(url_r == '4') { window.location.href = '<?php echo base_url('marketing/sam_stk_edit_data');?>/'+ '?id='+as; } } }); } else { swal({ title: "You Don't Have Access For This Edit", text: "", }); } } function fun_deletee(rowId) { var id = rowId.closest('tr').attr('id'); var as=id; var v=$('#delete_id').val(); var s='planning/sam_stk_program' // alert(s); if(v == 1) { $.ajax({ type:'post', url:'<?php echo base_url("marketing/delete_sam_form"); ?>', data:{'as':as,'s':s}, async:false, success:function() { window.location.href = '<?php echo base_url('marketing/delete_sam_form');?>/'+ '?id='+as+'?link&'+s; } }); } else { swal({ title: "You Don't Have Access For This Edit", text: "", }); } } function fun_preview3(rowId) { var id = rowId.closest('tr').attr('id'); var as=id; var v=$('#preview_id').val(); if(v == 1) { $.ajax({ type:'post', url:'<?php echo base_url("marketing/sam_sdk_orderinput"); ?>', data:{'as':as}, async:false, success:function() { var url_r=$('#url_ref').val(); if(url_r == '1') { window.location.href = '<?php echo base_url('marketing/sam_sdk_orderinput');?>/'+ '?id='+as; } else if(url_r == '2') { window.location.href = '<?php echo base_url('marketing/sam_sdk_order_input');?>/'+ '?id='+as; } else if(url_r == '3') { window.location.href = '<?php echo base_url('marketing/sam_sdk_orderinput_preview');?>/'+ '?id='+as; } else if(url_r == '4') { window.location.href = '<?php echo base_url('marketing/sam_sdk_orderinput_view');?>/'+ '?id='+as; } } }); } else { swal({ title: "You Don't Have Access For This Preview", text: "", }); } } function fun_preview1(rowId) { var id = rowId.closest('tr').attr('id'); var as=id; var v=$('#preview_id').val(); if(v == 1) { $.ajax({ type:'post', url:'<?php echo base_url("marketing/preview"); ?>', data:{'as':as}, async:false, success:function() { window.location.href = '<?php echo base_url('marketing/preview');?>/'+ '?id='+as; } }); } else { swal({ title: "You Don't Have Access For This Preview", text: "", }); } } function fun_preview2(rowId) { var id = rowId.closest('tr').attr('id'); var as=id; var v=$('#preview_id').val(); if(v == 1) { $.ajax({ type:'post', url:'<?php echo base_url("marketing/orederconfirmation"); ?>', data:{'as':as}, async:false, success:function() { window.location.href = '<?php echo base_url('marketing/orederconfirmation');?>/'+ '?id='+as; } }); } else { swal({ title: "You Don't Have Access For This Preview", text: "", }); } } function fun(rowId) { var v=$('#approval_id').val(); if(v == 1) { var id = rowId.closest('tr').attr('id'); //alert(id); var confirmMsg= confirm("Do You Want To Confirm!"); if (confirmMsg==true) { $.ajax({ url:"<?php echo base_url('marketing/add_confirmation')?>", type:"POST", data:{'id':id}, success:function(data){ if(data==""){ $("#editmodlist2").remove(); $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } else{ } } }); } else if (confirmMsg==false) { $.ajax({ url:"<?php echo base_url('marketing/add')?>", type:"POST", data:{'id':id}, success:function(data){ if(data==""){ $("#editmodlist2").remove(); $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } else{ } } }); } } else { swal({ title: "You Don't Have Access For This Approval", text: "", }); $("#list2").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } function editRow() { // Get the currently selected row var row = $("#list2").jqGrid('getGridParam','selrow'); //alert('hai'); if( row != null ) $("#list2").jqGrid('editGridRow',row, { modal:true,jqModal:true, recreateForm: true, beforeSubmit: function(postdata,formid){ var id=$("#id").val(); //alert(id); var oslNo=$("#oslNo").val(); var fileNo=$("#fileNo").val(); var orderMode=$("#orderMode").val(); var orderNo=$("#orderNo").val(); //alert(id); $.ajax({ url:"<?php echo base_url('marketing/customer_update')?>", type:"POST", data:{'id':id,'oslNo':oslNo,'fileNo':fileNo,'orderMode':orderMode,'orderNo':orderNo}, async:false, success:function(data){ if(data==""){ alert('Successfully Updated.'); $("#editmodlist2").remove(); $("#list2").trigger("reloadGrid"); window.location.reload(); } else{ window.location.reload(); } } }); }, closeAfterEdit: true, reloadAfterSubmit:false, afterSubmit : false }); else $( "#dialogSelectRow" ).dialog(); } </script> <style> #refresh_list1 { display:none; } </style> <script> $(document).ready(function (){ var l=$("#ref_id").val(); jQuery("#list3").jqGrid({ url:"<?php echo base_url('marketing/getorder_stk_details')?>/s"+l+"/", mtype : "post", datatype: "json", colNames:['Id','DTL#','File No', 'Sample Reference', 'Party Order No','Order Input Details','Status','Plan Status'], colModel:[ {name:'id',index:'id',hidden:true, width:50,editable:true,width:100}, {name:'oslNo',index:'oslNo', width:170,editable:true,}, {name:'fileNo',index:'fileNo',editable:true, width:170}, {name:'orderMode',index:'orderMode',editable:true,editrules:{required: true},editoptions: {size:10, maxlength: 10}, width:170}, {name:'orderNo',index:'orderNo',edittype:'text',editable:true,editrules:{required: true}, width:170}, {name:'preview3',index:'preview3',align: "center",editable:false,editrules:{required: true}, width:170,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_preview3($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='PREVIEW' \>"; }}, {name:'confirm_status',index:'confirm_status',edittype:'text',editable:true,editrules:{required: true}, width:170}, {name:'planningStatus',index:'planningStatus',edittype:'text',editable:true,editrules:{required: true}, width:100}, ], height: 'auto', rowNum:50, rowTotal: 2000000000000000000000000, rowList : [50,100,200,300,500,1000,5000], rownumbers: true, rownumWidth: 40, pager:"#pager3", sortname:'id', viewrecords: true, gridview: true, autowidth: true, sortorder:"desc", //multiple: true, loadonce:true, caption:"STK Order Details", subGrid: true, subGridRowExpanded: function(subgrid_id, row_id) { // we pass two parameters // subgrid_id is a id of the div tag created within a table // the row_id is the id of the row // If we want to pass additional parameters to the url we can use // the method getRowData(row_id) - which returns associative array in type name-value // here we can easy construct the following var subgrid_table_id; // alert(row_id); swan_id=row_id; //alert(swan_id); subgrid_table_id = subgrid_id+"_t"; jQuery("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table>"); jQuery("#"+subgrid_table_id).jqGrid({ url:"<?php echo base_url('marketing/subgrid');?>/s"+row_id+"/", //data:{'sub_id':123}, mtype : "get", datatype: "json", colNames: ['Id','Article No','Unit','Width','Sub Order Type','Design','Quality','Weave','Description','Created By','Order Confirm','Confirm By','Edit','Delete'], colModel: [ {name:'id',index:'id',hidden:true, width:50,editable:true,width:20}, {name:'articleNo',index:'articleNo', width:70,height:12}, //{name:'buyerShade',index:'buyerShade', width:80,height:12}, {name:'unit',index:'unit', width:60,height:12}, {name:'width',index:'width', width:80,height:12}, {name:'subOrderType',index:'subOrderType', width:110,height:12}, {name:'design',index:'design', width:100,height:12}, {name:'quality',index:'quality', width:100,height:12}, {name:'weave',index:'weave', width:100,height:12}, {name:'description',index:'description', width:100,height:12}, {name:'created_by',index:'created_by', width:90,height:12}, { name: 'orderConfirm', index: 'orderConfirm', width:80, align: 'center', formatter: 'checkbox', editoptions: { value: '1:0' }, formatoptions: { disabled: false }, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_conf($(this))" '; } }, {name:'confirm_by',index:'confirm_by', width:90,height:12}, {name:'edit',index:'edit',align: "center",editable:false,editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_edit($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='EDIT' \>"; }}, {name:'delete',index:'delete',align: "center",editable:false,editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_delete($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='DELETE' \>"; }}, //{name:'edit',index:'edit',editable:true,editrules:{required: true}, width:66,formatter:'showlink',classes:'fa fa-pencil-square-o col_delete',formatoptions:{baseLinkUrl:'<?php echo base_url('marketing/edit_form')?>'}}, //{name:'delete',index:'delete',editable:true,editrules:{required: true}, width:80,classes:'fa fa-trash-o col_delete',formatter:'showlink',formatoptions:{baseLinkUrl:'<?php echo base_url('marketing/delete_form')?>'}}, ], height: 'auto', rowNum:20000000000000000, sortname: 'num', sortorder: "asc" }); } }); //$("#list2").jqGrid('filterToolbar',{searchOperators : false}); //for multisearch code,remove if not required jQuery("#list3").jqGrid('filterToolbar', { stringResult: true, searchOnEnter: false, defaultSearch: "cn" }); $("#list3").jqGrid('navGrid','#pager3', {edit:false,add:false,del:false,search:false,refreshstate:"current"}, { }, { }, { }, { sopt:['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true } ); $("#list3").navButtonAdd('#pager3', { caption:"Delete", buttonicon:"ui-icon-trash", onClickButton: deleteRoww, position: "last", title:"", cursor: "pointer", id:"client_delete" } ); }); function deleteRoww() { // Get the currently selected row var v=$('#delete_id').val(); if(v == 1) { var row = $("#list3").jqGrid('getGridParam','selrow'); $("#id").val(row); if( row != null ) $("#list3").jqGrid('delGridRow',row, { modal:true,jqModal:true, recreateForm: true, beforeSubmit: function(postdata,formid){ $.ajax({ url:"<?php echo base_url('marketing/customer_delete')?>", type:"POST", data:{'id':row}, async:false, success:function(data){ if(data==""){ alert('Successfully Deleted'); $("#delmodlist3").remove(); $("#list3").trigger("reloadGrid"); window.location.reload(); } else{ alert('Successfully Deleted'); $("#delmodlist3").remove(); $("#list3").trigger("reloadGrid"); window.location.reload(); } } }); }, closeAfterEdit: true, reloadAfterSubmit:false, afterSubmit : false }); else $( "#dialogSelectRow" ).dialog(); } else { swal({ title: "You Don't Have Access For This Delete", text: "", }); } } function fun_edit(rowId) { var id = rowId.closest('tr').attr('id'); var as=id; var v=$('#edit_id').val(); //alert(v); if(v == 1) { $.ajax({ type:'post', url:'<?php echo base_url("marketing/sam_edit_form"); ?>', data:{'as':as}, async:false, success:function() { var url_r=$('#url_ref').val(); if(url_r == '1') { window.location.href = '<?php echo base_url('marketing/sam_edit_form');?>/'+ '?id='+as; } else if(url_r == '2') { window.location.href = '<?php echo base_url('marketing/sam_transaction_edit_form');?>/'+ '?id='+as; } else if(url_r == '3') { window.location.href = '<?php echo base_url('marketing/sam_edit_details');?>/'+ '?id='+as; } else if(url_r == '4') { window.location.href = '<?php echo base_url('marketing/sam_stk_edit_data');?>/'+ '?id='+as; } } }); } else { swal({ title: "You Don't Have Access For This Edit", text: "", }); } } function fun_delete(rowId) { var id = rowId.closest('tr').attr('id'); var as=id; var v=$('#delete_id').val(); var s='planning/sam_stk_program' // alert(s); if(v == 1) { $.ajax({ type:'post', url:'<?php echo base_url("marketing/delete_sam_form"); ?>', data:{'as':as,'s':s}, async:false, success:function() { window.location.href = '<?php echo base_url('marketing/delete_sam_form');?>/'+ '?id='+as+'?link&'+s; } }); } else { swal({ title: "You Don't Have Access For This Edit", text: "", }); } } function fun_preview3(rowId) { var id = rowId.closest('tr').attr('id'); var as=id; var v=$('#preview_id').val(); if(v == 1) { $.ajax({ type:'post', url:'<?php echo base_url("marketing/sam_sdk_orderinput"); ?>', data:{'as':as}, async:false, success:function() { var url_r=$('#url_ref').val(); if(url_r == '1') { window.location.href = '<?php echo base_url('marketing/sam_sdk_orderinput');?>/'+ '?id='+as; } else if(url_r == '2') { window.location.href = '<?php echo base_url('marketing/sam_sdk_order_input');?>/'+ '?id='+as; } else if(url_r == '3') { window.location.href = '<?php echo base_url('marketing/sam_sdk_orderinput_preview');?>/'+ '?id='+as; } else if(url_r == '4') { window.location.href = '<?php echo base_url('marketing/sam_sdk_orderinput_view');?>/'+ '?id='+as; } } }); } else { swal({ title: "You Don't Have Access For This Preview", text: "", }); } } function fun_preview1(rowId) { var id = rowId.closest('tr').attr('id'); var as=id; var v=$('#preview_id').val(); // alert(v); if(v == 1) { $.ajax({ type:'post', url:'<?php echo base_url("marketing/preview"); ?>', data:{'as':as}, async:false, success:function() { window.location.href = '<?php echo base_url('marketing/preview');?>/'+ '?id='+as; } }); } else { swal({ title: "You Don't Have Access For This Preview", text: "", }); } } function fun_preview2(rowId) { var id = rowId.closest('tr').attr('id'); var as=id; var v=$('#preview_id').val(); if(v == 1) { $.ajax({ type:'post', url:'<?php echo base_url("marketing/orederconfirmation"); ?>', data:{'as':as}, async:false, success:function() { window.location.href = '<?php echo base_url('marketing/orederconfirmation');?>/'+ '?id='+as; } }); } else { swal({ title: "You Don't Have Access For This Preview", text: "", }); } } function fun_conf(rowId) { var v=$('#approval_id').val(); if(v == 1) { var id = rowId.closest('tr').attr('id'); //alert(id); var confirmMsg= confirm("Do You Want To Confirm!"); if (confirmMsg==true) { $.ajax({ url:"<?php echo base_url('marketing/add_confirmation')?>", type:"POST", data:{'id':id}, success:function(data){ if(data==""){ $("#editmodlist3").remove(); $("#list3").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } else{ } } }); } else if (confirmMsg==false) { $.ajax({ url:"<?php echo base_url('marketing/add')?>", type:"POST", data:{'id':id}, success:function(data){ if(data==""){ $("#editmodlist3").remove(); $("#list3").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } else{ } } }); } } else { swal({ title: "You Don't Have Access For This Approval", text: "", }); $("#list3").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } function editRow() { // Get the currently selected row var row = $("#list3").jqGrid('getGridParam','selrow'); //alert('hai'); if( row != null ) $("#list3").jqGrid('editGridRow',row, { modal:true,jqModal:true, recreateForm: true, beforeSubmit: function(postdata,formid){ var id=$("#id").val(); //alert(id); var oslNo=$("#oslNo").val(); var fileNo=$("#fileNo").val(); var orderMode=$("#orderMode").val(); var orderNo=$("#orderNo").val(); //alert(id); $.ajax({ url:"<?php echo base_url('marketing/customer_update')?>", type:"POST", data:{'id':id,'oslNo':oslNo,'fileNo':fileNo,'orderMode':orderMode,'orderNo':orderNo}, async:false, success:function(data){ if(data==""){ alert('Successfully Updated.'); $("#editmodlist3").remove(); $("#list3").trigger("reloadGrid"); window.location.reload(); } else{ window.location.reload(); } } }); }, closeAfterEdit: true, reloadAfterSubmit:false, afterSubmit : false }); else $( "#dialogSelectRow" ).dialog(); } </script> <link rel="stylesheet" href="<?php echo base_url('assets/css/code_jquery.min.css');?>"> <script src="<?php echo base_url('assets/js/jquery-ui.min.js'); ?>" type="text/javascript"></script> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/css/jquery-ui.min.css'); ?>" /> <script> $(document).ready(function() { $( "#customer" ).autocomplete({ source: '<?php echo base_url('request/auto_sea'); ?>', }); }); function searchname() { var customer = document.getElementById('customer').value; $.ajax({ url:"<?php echo base_url('request/search_by_fetch')?>", dataType: "json", data:{'customer':customer}, type:"POST", async:true, success:function(data) { // alert('hai'); var obj=JSON.parse(data); document.getElementById('customer_id').value=obj[0].customerID; } }); } </script> <style> #list2_122_t { height:0px !important; } list2_136_t { height:12px !important; } .scroll { height:12px !important; } .ui-jqgrid-btable { } .ui-common-table { height:12px !important; } #refresh_list2 { display:none !important; } #client_edit { padding-right:12px !important; } #list2 { width: 1050px; height: 0px !important; } #gbox_list2 { height: auto !important; } #gview_list2 { height: auto !important; } @media only screen and (min-width:320px) and (max-width:641px){ .ui-jqgrid { margin-left: 1px !important; } #jaytab{ margin-top: 0 !important; margin-left: 0 !important; overflow-x: scroll; width: 100% !important; padding-left: 0 !important; } #editmodlist2 { width:90% !important; } #sData span, #cData span { margin-left: 0 !important; } } @media only screen and (min-width:641px) and (max-width:991px){ .ui-jqgrid { margin-left: 1px !important; } #jaytab{ margin-top: 0 !important; margin-left: 0 !important; overflow-x: scroll; width: 100% !important; padding-left:0 !important; padding-right:9px !important; } } #sData span, #cData span { } #sData { height: 29px; } #cData { height: 29px; } .jqgfirstrow { height: 0px !important; } .jaytab { overflow-x:scroll; } </style>