EVOLUTION-NINJA
Edit File: associative_executive_logistic_list_old.php
<?php echo view('includes/header');?> <script src="<?php echo base_url('public/assets/admin_dashboard/js/jquery.table2excel.js');?>"></script> <section class="content-header"> <h1> Associate / Executive / Logistic 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="grid_div"></div><table id="list3"></table> <div id="pager3"></div> <div id="dialogSelectRow3" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> <div style="display:none;"><table border="1" style="border-spacing: 0px !important;" id="export_table" class="export_table"></table></div> <div style="display:none;"> <table border="1" style="border-spacing: 0px !important;" id="print_table" class="print_table"></table> </div> <script src="<?php echo base_url('public/assets/admin_dashboard/js/jquery.table2excel.js');?>"></script> <script> function print_page1() { var divToPrint=document.getElementById('print_table'); newWin= window.open(""); newWin.document.write('<html><head><title></title>'); newWin.document.write('</head>'); newWin.document.write(divToPrint.outerHTML); newWin.document.write('</html>'); newWin.print(); document.getElementById('print_table').style.display=''; newWin.close(); location.reload(); } </script> <div class="row" id="print_broker_report" style="padding-left:10px; padding-top:25px;"> <div class="col-sm-12 col-md-9"> <div style=""> <h3><center>Brokers List</center></h3> <table class="table table-striped table-hover broker_report_table" style="width:100%;" border="1"> <thead> <tr class="default" style="height:40px;padding-bottom:10px;"> <th class="col-xs-1">Sl No.</th> <th class="col-xs-2">Type</th> <th class="col-xs-2">Name</th> <th class="col-xs-3">Email</th> <th class="col-xs-2">Mobile</th> </tr> </thead> <tbody id="report_table_body"> </tbody> </table> </div> </div> </div> <div class="col-sm-0 col-md-2"></div> </section> <!--- section 2 ----> <!-- Edit Modal --> <div class="modal fade" id="edit_modal" role="dialog"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">Update broker details</h4> </div> <div class="modal-body"> <form id="logistic" class="form-inline update_form" enctype="multipart/form-data"> <input type="hidden" class="form-control col-sm-8 broker_id_pk" name="broker_id" required="required"> <div class="row" style="padding-bottom:20px; padding-top:10px;"> <div class="col-sm-0 col-md-3"></div> <div class="col-sm-12 col-md-6 radio_button_class"> <!-- <label class="radio-inline"><input type="radio" value="Executives" name="type">Executives</label> <label class="radio-inline"><input type="radio" value="Associate" name="type">Associate</label> <label class="radio-inline"><input type="radio" value="Logistic" name="type">Logistic</label> --> </div> <div class="col-sm-0 col-md-3"></div> </div> <!-- row 1----> <div class="row land_owner_a"> <div class="form-group col-sm-12 col-md-6"> <label class="col-sm-4">Name or ID</label> <input type="text" class="form-control col-sm-8 name_or_id" name="name_or_id"> </div> <div class="form-group col-sm-12 col-md-6"> <label class="col-sm-4">Name</label> <input type="text" class="form-control col-sm-8 associate_name" name="associate_name" required="required"> </div> </div> <!-- row 2----> <div class="row land_owner_a"> <div class="form-group col-sm-12 col-md-6"> <label class="col-sm-4">Address</label> <input type="text" class="form-control col-sm-8 address" name="address"> </div> <div class="form-group col-sm-12 col-md-6"> <label class="col-sm-4 ">Mail Id</label> <input type="email" class="form-control col-sm-8 email" name="email" pattern="[A-Za-z0-9._%+-]{3,}@[a-zA-Z]{3,}([.]{1}[a-zA-Z]{2,}|[.]{1}[a-zA-Z]{2,}[.]{1}[a-zA-Z]{2,})"> </div> </div> <!-- row 3----> <div class="row land_owner_a"> <div class="form-group col-sm-12 col-md-6"> <label class="col-sm-4">Contact No</label> <input type="text" pattern="[789][0-9]{9}" class="form-control col-sm-8 mobile" name="mobile" style="width: 29% !important; margin-right:10px;" required="required"> <input type="text" class="form-control col-sm-8 col-xs-6 mobile2" pattern="^[0-9]{10}$" name="mobile2" style="width: 29% !important;"> </div> <div class="form-group col-sm-12 col-md-6"> <label class="col-sm-4">Reference Details</label> <input type="text" class="form-control col-sm-8 reference_details" name="reference_details"> </div> </div> <!-- row 4----> <div class="row land_owner_a"> <div class="form-group col-sm-12 col-md-6"> <label class="col-sm-4">PAN No</label> <input type="text" class="form-control col-sm-8 pan_number" name="pan_number" pattern="[a-zA-Z0-9]{10}$"> </div> <div class="form-group col-sm-12 col-md-6"> <label class="col-sm-4">Adhar No</label> <input type="text" class="form-control col-sm-8 adhar_number" pattern="[0-9]{12}" name="adhar_number"> </div> </div> <!-- row 5----> <div class="row land_owner_a"> <div class="form-group col-sm-12 col-md-6"> <label class="col-sm-4 col-md-4">Scan copy</label> <input type="file" class="col-sm-8 text-center center-block well well-sm scan_copy" name="scan_copy"> </div> <div class="form-group col-sm-12 col-md-6"> <label class="col-sm-4 col-md-4">Scanned copy</label> <div class="scanned_image"></div> </div> </div> <!-- row 5----> <div class="row land_owner_a"> <div class="col-sm-4 col-md-4"></div> <div class="col-sm-4 col-md-4"> <button type="submit" class="btn btn-primary center-block submit">Submit</button> </div> <div class="col-sm-4 col-md-4"></div> </div> <!-- row 5----> </form> </div> </div> </div> </div> <style type="text/css"> a{ color: inherit; } #print_broker_report{ display:none; } </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('brokers-list')?>", mtype : "post", datatype: "json", colNames:['SI','Type','Name','Associate','Email','Mobile','Address','Pan','Reference','Adhar no','Edit','Delete'], colModel:[ {name:'broker_id',index:'broker_id', width:50, hidden:true,editable:false,key:true}, {name:'type',index:'type', width:75, editable:false}, {name:'name_or_id',index:'name_or_id', width:125, editable:false}, {name:'associate_name',index:'associate_name', width:125, editable:false}, {name:'email',index:'email', width:175, editable:false}, {name:'mobile',index:'mobile', width:100, editable:false}, {name:'address',index:'address', width:175, editable:false}, {name:'pan_number',index:'pan_number', width:100, editable:false}, {name:'reference_details',index:'reference_details', width:125, editable:false}, {name:'adhar_number',index:'adhar_number', width:100, editable:false}, {name:' ',index:' ',editable:false,align: "center",editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='EDIT' onclick='some_function' data-toggle='modal' data-target='#edit_modal' \>"; }}, {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, emptyrecords: 'No records to display', // multiselect: true, // multiboxonly: true, loadonce:true, caption:" Broker List", }); $("#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 } ).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 fun(rowId) { var id = rowId.closest('tr').attr('id'); $.ajax({ type : 'post', url : '<?php echo site_url("edit-broker")?>', data : {broker_id:id}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { $(".broker_id_pk").val(response.broker_details.broker_id); $(".name_or_id").val(response.broker_details.name_or_id); $(".associate_name").val(response.broker_details.associate_name); $(".address").val(response.broker_details.address); $(".email").val(response.broker_details.email); $(".mobile").val(response.broker_details.mobile); $(".mobile2").val(response.broker_details.mobile2); $(".reference_details").val(response.broker_details.reference_details); $(".pan_number").val(response.broker_details.pan_number); $(".adhar_number").val(response.broker_details.adhar_number); var ext = response.broker_details.scan_copy.split('.').pop(); if(ext == 'JPG' || ext == 'jpg' || ext == 'JPEG' || ext == 'jpeg' || ext == 'png' || ext == 'PNG') { $(".scanned_image").html('<img src ="<?php echo base_url("broker_uploads");?>/'+response.broker_details.scan_copy+'" style="width:250px;height:350px"/>'); } else if(ext == 'pdf') { $(".scanned_image").html('<embed src ="<?php echo base_url("broker_uploads");?>/'+response.broker_details.scan_copy+'" style="width:250px;height:350px"/>'); } var content = ''; if(response.broker_details.type == "Executives") { content += '<label class="radio-inline"><input type="radio" value="Executives" name="type" checked>Executives</label>'; } else { content +='<label class="radio-inline"><input type="radio" value="Executives" name="type">Executives</label>'; } if(response.broker_details.type == "Associate") { content += '<label class="radio-inline"><input type="radio" value="Associate" name="type" checked>Associate</label>'; } else { content +='<label class="radio-inline"><input type="radio" value="Associate" name="type">Associate</label>'; } if(response.broker_details.type == "Logistic") { content += '<label class="radio-inline"><input type="radio" value="Logistic" name="type" checked>Logistic</label>'; } else { content +='<label class="radio-inline"><input type="radio" value="Logistic" name="type">Logistic</label>'; } $(".radio_button_class").html(content); $("#edit_modal").modal("show"); $("#list3").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } }); } function fun_delete(rowId) { var id = rowId.closest('tr').attr('id'); var broker_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-broker")?>', data : {broker_id:broker_id}, success:function(response) { //response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { toastr["success"](response.message); //BrokersList(); $("#list3").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } $('.update_form').submit(function(e){ e.preventDefault(); formdata = new FormData($(this)[0]); $(".submit").attr('disabled', 'disabled'); $(".submit").text("Updating..."); $.ajax({ type : 'post', url : '<?php echo site_url("update-broker")?>', data : formdata, contentType: false, processData: false, success:function(response){ //response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { $("#edit_modal").modal("hide"); $("#list3").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); toastr["success"](response.message); $('.update_form')[0].reset(); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } else if(response.result==2) { toastr["error"](response.message); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } else { toastr["error"](response.message); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } } }); }); function SortedResult(brokers_list) { tbody.empty(); var table_row = []; var slno = 1; var index = 1; $.each(brokers_list,function(idx,vx){ var row = []; var image = ""; row.push(slno); image='<img src ="<?php echo base_url("broker_uploads");?>/'+vx.scan_copy+'" style="width:80px;height:70px"/>'; row.push(vx.type); row.push(vx.name_or_id); row.push(vx.associate_name); row.push(vx.email); row.push(vx.mobile); row.push(vx.address); row.push(vx.pan_number); row.push(vx.reference_details); row.push(vx.adhar_number); var table_content = ''; table_content += '<div style="float:left;">'; table_content += '<a data-toggle="tooltip" title="Edit" class="edit" broker_id="'+vx.broker_id+'" href="javascript:void(0);"><span class="glyphicon glyphicon-edit"></span></a> <a data-toggle="tooltip" title="Delete" class="delete" broker_id="'+vx.broker_id+'" href="javascript:void(0);"><span class="glyphicon glyphicon-trash"></span></a>'; table_content += '</div>' row.push(table_content); table_row.push(row); slno++; index ++; }); datatable.clear(); datatable.rows.add(table_row).draw(); datatable.draw(); } </script> <style type="text/css"> .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); } #FrmGrid_list3 { width: 100% !important; } .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: 232px !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; } .ui-jqgrid .ui-jqgrid-bdiv { overflow-y: scroll; //overflow-x: hidden; } </style> <script type="text/javascript"> $(document).ready(function(){ $("#sites_print").click(function(){ var divToPrint=document.getElementById("print_sites_report"); newWin= window.open(""); newWin.document.write(divToPrint.outerHTML); newWin.print(); newWin.close(); }); $("#sites_export").click(function(){ $(".sites_table_print").table2excel({ exclude: ".noExl", name: "Excel Document Name", filename: "Broker List", fileext: ".xls", exclude_img: true, exclude_links: true, exclude_inputs: true }); }); }); function export_page() { //alert(); id = jQuery("#list3").jqGrid('getDataIDs'); $.ajax({ type : 'post', url : '<?php echo site_url("gss/get_table_details")?>', data : {id:id}, success:function(data){ response=jQuery.parseJSON(data); console.log(response); var count =1; var content = ''; content +='<thead><tr><th>Sl No</th> <th>Type</th> <th>Name</th> <th>Associate</th> <th>Email</th> <th>Mobile</th> <th>Address</th><th>Pan</th><th>Reference</th><th>Adhar.No</th></tr></thead>'; $.each(response,function(key,vas){ $.each(vas,function(key,va){ content +='<tr><td>'+count+'</td> <td>'+va.type+'</td> <td>'+va.name_or_id+'</td> <td>'+va.associate_name+'</td> <td>'+va.email+'</td><td>'+va.mobile+'</td> <td>'+va.address+'</td><td>'+va.pan_number+'</td><td>'+va.reference_details+'</td> <td>'+va.adhar_number+'</td></tr>'; count++; }); }); $('.export_table').append(content); export_data(); } }); } function export_data(){ $("#export_table").table2excel({ exclude: ".noExl", name: "Excel Document Name", filename: "Broker List", fileext: ".xls", exclude_img: true, exclude_links: true, exclude_inputs: true }); } function print_page() { //alert(); id = jQuery("#list3").jqGrid('getDataIDs'); //alert(id); $.ajax({ type : 'post', url : '<?php echo site_url("gss/get_table_details")?>', data : {id:id}, success:function(data){ response=jQuery.parseJSON(data); console.log(response); var count =1; var content = ''; content +='<thead><tr><th>Sl No</th> <th>Type</th> <th>Name</th> <th>Associate</th> <th>Email</th> <th>Mobile</th> <th>Address</th><th>Pan</th><th>Reference</th><th>Adhar.No</th></tr></thead>'; $.each(response,function(key,val){ $.each(val,function(key,va){ content +='<tr><td>'+count+'</td> <td>'+va.type+'</td> <td>'+va.name_or_id+'</td> <td>'+va.associate_name+'</td> <td>'+va.email+'</td><td>'+va.mobile+'</td> <td>'+va.address+'</td><td>'+va.pan_number+'</td><td>'+va.reference_details+'</td> <td>'+va.adhar_number+'</td></tr>'; count++; }); }); // alert(content); $('.print_table').append(content); print_page1(); } }); } </script> <style type="text/css"> .content-wrapper, .right-side { //min-height:900px !important; } a { color: inherit; } </style> <?php echo view('includes/footer');?>