EVOLUTION-NINJA
Edit File: commission_list.php
<?php echo view('includes/header');?> <section class="content-header"> <h1> Commission List </h1> </section> <!--- section 1 --> <section class="content"> <div id="menu1" class="tab-panecol-sm-12 col-md-12 "> <div id = "jaytab3" style="margin-top:3%;margin-left: -28px;" class="col-sm-12 grid"> <div class="col-sm-12" style="//overflow: scroll !important;"> <div class="grid_div"></div> <table id="list3" > </table> </div> <div id="pager3"></div> <div id="dialogSelectRow3" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> </section> <!--- section 2 --> <style type="text/css"> .content-wrapper, .right-side { //min-height: 1100px !important; } </style> <!-- This is the Javascript file of jqGrid --> <script type="text/ecmascript" src="<?php echo base_url('public/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('public/jqgrid/js/i18n/grid.locale-en.js'); ?>"></script> <!-- A link to a jQuery UI ThemeRoller theme, more than 22 built-in and many more custom --> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('public/assets/css/jquery-ui.css'); ?>" /> <!-- The link to the CSS that the grid needs --> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('public/jqgrid/css/ui.jqgrid.css'); ?>" /> <script src="<?php echo base_url('public/assets/js/jquery-ui.js'); ?>" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function (){ jQuery("#list3").jqGrid({ url:"<?php echo site_url('management-list')?>", mtype : "post", datatype: "json", colNames:['SI','Associate','Sub Associate','Date','Project','Site','In %','In Rs.','Agreement Date','Agreement Payment','Agreement Status','Edit Agreement','Agreement Approval','Registration Date','Registration Payment','Registration Status','Edit Registration','Registration Approval','Delete'], colModel:[ {name:'management_id',index:'management_id', width:50, hidden:true,editable:false,key:true}, {name:'associate',index:'associate', width:100, editable:false}, {name:'subassociate',index:'subassociate', width:100, editable:false}, {name:'commission_date',index:'commission_date', width:100,formatter: 'date', formatoptions: { srcformat: 'Y/m/d', newformat: 'd/m/Y'}, editable:false}, {name:'project_name',index:'project_name', width:175, editable:false}, {name:'site_number',index:'site_number', width:75, editable:false}, {name:'total_commission_perc',index:'total_commission_perc', width:75, editable:false}, {name:'total_commission_rs',index:'total_commission_rs', width:100, editable:false}, {name:'agreement_executed_on',index:'agreement_executed_on', width:100,formatter: 'date', formatoptions: { srcformat: 'Y/m/d', newformat: 'd/m/Y'}, editable:false}, {name:'payment_on_agreement',index:'payment_on_agreement', width:100, editable:false}, {name:'agreement_status',index:'agreement_status', width:100, editable:false}, {name:' ',index:' ',editable:false,align: "center",editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="agree_fun($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='EDIT' onclick='some_function' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:'agreement_approval',index:'agreement_approval',classes:'agr_appr',align: "center",editable:false,editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="agreement($(this))" '; }}, {name:'registration_on',index:'registration_on', width:100,formatter: 'date', formatoptions: { srcformat: 'Y/m/d', newformat: 'd/m/Y'}, editable:false}, {name:'payment_on_registration',index:'payment_on_registration', width:175, editable:false}, {name:'registration_status',index:'registration_status', width:100, editable:false}, {name:' ',index:' ',editable:false,align: "center",editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="reg_fun($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='EDIT' onclick='some_function' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:'registration_approval',classes:'agr_appr',index:'registration_approval',align: "center",editable:false,editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="registration($(this))" '; }}, {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' \>"; }}, ], rowNum:20, rowTotal: 2000, rowList : [10,20,30,50,100,500,1000], rownumbers: true, rownumWidth: 40, pager:"#pager3", sortname:'owner_id', viewrecords: true, gridview: true, autowidth: true, sortorder:"asc", shrinkToFit: false, subGrid: true, emptyrecords: 'No records to display', // multiselect: true, // multiboxonly: true, loadonce:true, caption:" Commission List", subGridRowExpanded: function(subgrid_id, row_id) { 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 site_url('submanagement-list')?>?id="+swan_id, type : "GET", datatype: "json", colNames:['SI','Sub Associate','Date','In %','In Rs.','Agreement Date','Agreement Payment','Registration Date','Registration Payment'], colModel:[ {name:'management_id',index:'management_id', width:50, hidden:true,editable:false,key:true}, {name:'subassociate',index:'subassociate', width:100, editable:false}, {name:'commission_date',index:'commission_date', width:100,formatter: 'date', formatoptions: { srcformat: 'Y/m/d', newformat: 'd/m/Y'}, editable:false}, {name:'total_commission_perc',index:'total_commission_perc', width:75, editable:false}, {name:'total_commission_rs',index:'total_commission_rs', width:100, editable:false}, {name:'agreement_executed_on',index:'agreement_executed_on', width:100, editable:false}, {name:'payment_on_agreement',index:'payment_on_agreement', width:100, editable:false}, {name:'registration_on',index:'registration_on', width:100,formatter: 'date', formatoptions: { srcformat: 'Y/m/d', newformat: 'd/m/Y'}, editable:false}, {name:'payment_on_registration',index:'payment_on_registration', width:175, editable:false}, ], height: 'auto', rowNum:20, sortname: 'num', sortorder: "asc" }); } }); $("#list3").jqGrid("setLabel", "rn", "SL"); $("#list3").jqGrid('filterToolbar',{searchOperators : false}); //for multisearch code,remove if not required $("#list3").jqGrid('navGrid','#pager3', {edit:true,add:false,del:false,search:true,refreshstate:"current"}, { }, { }, { }, { sopt:['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true } ); $("#list3").navButtonAdd('#pager3', { caption:"Change Status", buttonicon:"ui-icon-pencil", onClickButton: change_status, position: "last", title:"", cursor: "pointer", id:"client_edit_new" } ); $("#list3").navButtonAdd('#pager3', { caption:"Print", buttonicon:"ui-icon-print", onClickButton:print_page, position: "last", title:"", cursor: "pointer", id:"client_delete_new" } ); $("#list3").navButtonAdd('#pager3', { caption:"Export", buttonicon:"", onClickButton: export_page, position: "last", title:"", cursor: "pointer", id:"client_delete" } ); }); function registration(rowId) { var management_id = rowId.closest('tr').attr('id'); var app = $("#list3").jqGrid('getRowData',management_id); app=app.registration_status; if(app=="PENDING") { swal({ title: "Are you sure?", text: "Do you want to approve this commission?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes,proceed!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); // test.attr('disabled', 'disabled'); // test.text("Updating..."); $.ajax({ type : 'post', url : '<?php echo site_url("approve-reg-commission")?>', data : {management_id:management_id}, success:function(response) { // response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { toastr["success"](response.message); location.reload(); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } else { swal({ title: "Are you sure?", text: "Do you want to approve this commission?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes,proceed!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); // test.attr('disabled', 'disabled'); // test.text("Updating..."); $.ajax({ type : 'post', url : '<?php echo site_url("dis-approve-reg-commission")?>', data : {management_id:management_id}, success:function(response) { // response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { toastr["success"](response.message); location.reload(); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } } function agreement(rowId) { //alert(); var management_id = rowId.closest('tr').attr('id'); var app = $("#list3").jqGrid('getRowData',management_id); app=app.agreement_status; if(app=="PENDING") { swal({ title: "Are you sure?", text: "Do you want to approve this commission?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes,proceed!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); // test.attr('disabled', 'disabled'); // test.text("Updating..."); $.ajax({ type : 'post', url : '<?php echo site_url("approve-aggr-commission")?>', data : {management_id:management_id}, success:function(response) { // response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { toastr["success"](response.message); location.reload(); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } else { swal({ title: "Are you sure?", text: "Do you want to approve this commission?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes,proceed!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); // test.attr('disabled', 'disabled'); // test.text("Updating..."); $.ajax({ type : 'post', url : '<?php echo site_url("dis-approve-aggr-commission")?>', data : {management_id:management_id}, success:function(response) { // response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { toastr["success"](response.message); location.reload(); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } } function agree_fun(rowId) { //alert(); var id = rowId.closest('tr').attr('id'); var management_id=id; $.ajax({ url:"<?php echo site_url('edit-agreecommission')?>/"+ management_id, type:"POST", //data:{project_id:project_id}, success:function(response) { //alert(response); window.location.href="<?php echo site_url('edit-agreecommission')?>/"+ management_id; } }); } function reg_fun(rowId) { //alert(); var id = rowId.closest('tr').attr('id'); var management_id=id; $.ajax({ url:"<?php echo site_url('edit-regcommission')?>/"+ management_id, type:"POST", //data:{project_id:project_id}, success:function(response) { //alert(response); window.location.href="<?php echo site_url('edit-regcommission')?>/"+ management_id; } }); } function fun_delete(rowId) { var id = rowId.closest('tr').attr('id'); var management_id=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(); // test.attr('disabled', 'disabled'); // test.text("Deleting..."); $.ajax({ type : 'post', url : '<?php echo site_url("delete-commission")?>', data : {management_id:management_id}, success:function(response) { // response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { toastr["success"](response.message); location.reload(); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } </script> <style> .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-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: 50%; margin-top: -7px !important; } .ui-jqdialog-content td.navButton { padding-top: 12px !important; } .ui-jqgrid .ui-jqgrid-titlebar { height: 27px !important; background:#AF0100 !important; color:white !important; } .ui-jqgrid-bdiv { height: auto !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; } .agr_appr { font-weight:bold !important; color:#AF0100; cursor: pointer; } .tablediv { float: left; } #gview_list3 { height: auto !important; } </style> <?php echo view('includes/footer');?>