EVOLUTION-NINJA
Edit File: new_reception_list.php
<?php echo view('includes/header');?> <!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/free-jqgrid/css/ui.jqgrid.min.css"> <script src="https://cdn.jsdelivr.net/npm/free-jqgrid/dist/jquery.jqgrid.min.js"></script> --> <link href="<?php echo base_url('public/assets/admin_dashboard/css/jquery-ui.css');?>" rel="stylesheet"> <script src="<?php echo base_url('public/assets/js/jquery-ui.js');?>"></script> <script src="<?php echo base_url('public/assets/admin_dashboard/js/jquery.table2excel.js');?>"></script> <section class="content-header"> <h1>Reception List </h1> </section> <!--- section 1 ----> <section class="content"> <div class="row"> <form id="land_owner" class="form-inline reception_report"> <div class="row land_owner_a"> <div class="form-group col-sm-12 col-md-4"> <label class="col-sm-4 ">Project</label> <select class="form-control col-sm-8 project_list" name="project_id_datewise" id="project_id"> <option value="">All</option> <?php foreach($projects as $val) { ?> <option value="<?php echo $val->project_id;?>"><?php echo $val->project_name;?></option> <?php } ?> </select> </div> <div class="form-group col-sm-12 col-md-4"> <label class="col-sm-4 ">From date</label> <input type="text" class="form-control col-sm-8 from_date_picker_report" name="from_date_datewise"> </div> <div class="form-group col-sm-12 col-md-4"> <label class="col-sm-4">To date</label> <input type="text" class="form-control col-sm-5 to_date_picker_report" name="to_date_datewise"> </div> </div> <div class="row land_owner_a"> <div class="form-group col-sm-12 col-md-offset-4 col-md-4"> <button type="submit" id="reception_report_submit_datewise" style="margin-top: 40px !important" class="btn btn-primary center-block submit">Submit</button> </div> </div> </form> </div> <div id="menu1" class="tab-panecol-sm-12 col-md-12 "> <div class="col-sm-1"></div> <div id = "jaytab3" style="margin-top:3%;" class="col-sm-10 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> </section> <!--- section 2 ----> <div id="print_div" style="display:none;"></div> <style type="text/css"> .content-wrapper, .right-side { min-height: 2000px !important; } .bok-details{ background: gainsboro; text-align: center; padding-top: 7px; padding-bottom: 7px; margin-bottom: 30px; margin-top: 33px; } a { color: inherit; } .calendar-table thead{ background: #fff !important; color:#777 !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"> // $(function(){ // $(".from_date_picker_report").datepicker({ // dateFormat: 'dd-mm-yy', // }).on('changeDate', function(ev){ // $('.to_date_picker_report').datepicker('hide'); // }); // }); // $('.from_date_picker_report').on('change', function(){ // var date = $(this).val(); // $('.to_date_picker_report').datepicker({ // dateFormat: 'dd-mm-yy', // minDate: date, // }); // }); // $(document).ready(function (){ // jQuery("#list3").jqGrid({ // url:"<?php echo site_url('get-new-reception-list')?>", // mtype : "post", // datatype: "json", // colNames:['SI','Project','Site','Client Name','Contact','Mobile','Dispatched','Dispatched Date','View','Edit','Delete'], // colModel:[ // {name:'id',index:'id', width:50, hidden:true,editable:false,key:true}, // {name:'project_name',index:'project_name', width:200, editable:false}, // {name:'site_number',index:'site_number', width:100, editable:false}, // {name:'customer_name',index:'customer_name', width:175, editable:false}, // {name:'contact1',index:'contact1', width:100, editable:false}, // {name:'contact2',index:'contact2', width:100, editable:false}, // {name:'dispatched',index:'dispatched', width:100, editable:false}, // {name:'dispatched_date',index:'dispatched_date', width:125,editable:false}, // {name:' ',index:' ',editable:false,align: "center",editrules:{required: true}, width:110,cellattr: function (rowId, tv, rawObject, cm, rdata) // { // return ' onclick="fun_view($(this))" '; // },formatter:function (cellvalue, options, rowObject) { // return "<input type='button' value='VIEW' onclick='some_function' data-toggle='modal' data-target='#edit_modal' \>"; // }}, // {name:' ',index:' ',editable:false,align: "center",editrules:{required: true}, width:110,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:110,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:"Reception 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 } // ); // $("#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 fun(rowId) // { // var reception_id = rowId.closest('tr').attr('id'); // $.ajax({ // url:"<?php echo site_url('edit-new-reception-details')?>/"+ reception_id, // type:"POST", // //data:{project_id:project_id}, // success:function(response) { // //alert(response); // window.location.href="<?php echo site_url('edit-new-reception-details')?>/"+ reception_id; // } // }); // } // function fun_view(rowId) // { // var reception_id = rowId.closest('tr').attr('id'); // $.ajax({ // url:"<?php echo site_url('view-new-reception')?>/"+ reception_id, // type:"POST", // //data:{project_id:project_id}, // success:function(response) { // //alert(response); // window.location.href="<?php echo site_url('view-new-reception')?>/"+ reception_id; // } // }); // } // function fun_delete(rowId) // { // var id = rowId.closest('tr').attr('id'); // var reception_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-new-reception")?>', // data : {reception_id:reception_id}, // success:function(response) { // response=jQuery.parseJSON(response); // console.log(response); // if(response.result == 1) // { // toastr["success"](response.message); // //ReceptionList(); // $("#list3").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); // } // } // }); // } // else { // $(".sweet-alert").hide(); // $(".sweet-overlay").hide(); // } // }); // } // </script> <script type="text/javascript"> $(document).ready(function (){ $(".from_date_picker_report").datepicker({ dateFormat: 'dd-mm-yy', }).on('changeDate', function(ev){ $('.to_date_picker_report').datepicker('hide'); }); $('.from_date_picker_report').on('change', function(){ var date = $(this).val(); $('.to_date_picker_report').datepicker({ dateFormat: 'dd-mm-yy', minDate: date, }); }); $('.reception_report').submit(function(e){ e.preventDefault(); // formdata = new FormData($(this)[0]); $("#reception_report_submit_datewise").attr('disabled', 'disabled'); $("#reception_report_submit_datewise").text("submitting..."); $("#reception_report_submit_datewise").text("Submit"); $("#reception_report_submit_datewise").removeAttr('disabled'); var project = $("select[name=project_id_datewise]").val(); var from_date = $("input[name=from_date_datewise]").val(); var to_date = $("input[name=to_date_datewise]").val(); jQuery("#list3").jqGrid({ url:"<?php echo site_url('get-reception-reports-datewise')?>?project="+project+'&from_date='+from_date+'&to_date='+to_date, mtype : "post", datatype: "json", colNames:['SI','Project','Site','Client Name','Contact','Mobile','Dispatched','Dispatched Date','View','Edit','Delete'], colModel:[ {name:'id',index:'id', width:50, hidden:true,editable:false,key:true}, {name:'project_name',index:'project_name', width:200, editable:false}, {name:'site_number',index:'site_number', width:100, editable:false}, {name:'customer_name',index:'customer_name', width:175, editable:false}, {name:'contact1',index:'contact1', width:100, editable:false}, {name:'contact2',index:'contact2', width:100, editable:false}, {name:'dispatched',index:'dispatched', width:100, editable:false}, {name:'dispatched_date',index:'dispatched_date', width:125,editable:false}, {name:' ',index:' ',editable:false,align: "center",editrules:{required: true}, width:110,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_view($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='VIEW' onclick='some_function' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:' ',index:' ',editable:false,align: "center",editrules:{required: true}, width:110,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:110,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:"Reception 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 } ); $("#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 fun(rowId) { var reception_id = rowId.closest('tr').attr('id'); $.ajax({ url:"<?php echo site_url('edit-new-reception-details')?>/"+ reception_id, type:"POST", //data:{project_id:project_id}, success:function(response) { //alert(response); window.location.href="<?php echo site_url('edit-new-reception-details')?>/"+ reception_id; } }); } function fun_view(rowId) { var reception_id = rowId.closest('tr').attr('id'); $.ajax({ url:"<?php echo site_url('view-new-reception')?>/"+ reception_id, type:"POST", //data:{project_id:project_id}, success:function(response) { //alert(response); window.location.href="<?php echo site_url('view-new-reception')?>/"+ reception_id; } }); } function fun_delete(rowId) { var id = rowId.closest('tr').attr('id'); var reception_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-new-reception")?>', data : {reception_id:reception_id}, success:function(response) { // response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { toastr["success"](response.message); //ReceptionList(); $("#list3").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } function print_page() { //alert(); var project = $("select[name=project_id_datewise]").val(); var from_date = $("input[name=from_date_datewise]").val(); var to_date = $("input[name=to_date_datewise]").val(); $.ajax({ url:"<?php echo site_url('get-reception-reports-datewise')?>?project="+project+'&from_date='+from_date+'&to_date='+to_date, type : "GET", success:function(data){ console.log(response); var count =1; var content = ''; content +='<thead><tr><th>Sl No</th><th>Project</th><th>Site</th><th>Client</th><th>Contact</th><th>Mobile</th><th>Dispatched</th><th>Dispatched Date</th></tr></thead>'; $.each(response,function(key,va){ //$.each(val,function(key,va){ content +='<tr><td>'+count+'</td> <td>'+va.project_name+'</td><td>'+va.site_number+'</td><td>'+va.customer_name+'</td><td>'+va.contact1+'</td><td>'+va.contact2+'</td><td>'+va.dispatched+'</td><td>'+va.dispatched_date+'</td></tr>'; count++; //}); }); // alert(content); $('.print_table').append(content); print_page1(); } }); } 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(); } function export_page() { $('.export_table').empty(); id = jQuery("#list3").jqGrid('getDataIDs'); var project = $("select[name=project_id_datewise]").val(); var from_date = $("input[name=from_date_datewise]").val(); var to_date = $("input[name=to_date_datewise]").val(); $.ajax({ url:"<?php echo site_url('get-reception-reports-datewise')?>?project="+project+'&from_date='+from_date+'&to_date='+to_date, type : "GET", 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>Project</th><th>Site</th><th>Client</th><th>Contact</th><th>Mobile</th><th>Dispatched</th><th>Dispatched Date</th></tr></thead>'; $.each(response,function(key,va){ content +='<tr><td>'+count+'</td> <td>'+va.project_name+'</td><td>'+va.site_number+'</td><td>'+va.customer_name+'</td><td>'+va.contact1+'</td><td>'+va.contact2+'</td><td>'+va.dispatched+'</td><td>'+va.dispatched_date+'</td></tr>'; count++; }); $('.export_table').append(content); export_data(); } }); } function export_data(){ $("#export_table").table2excel({ exclude: ".noExl", name: "Excel Document Name", filename: "Reception List", fileext: ".xls", exclude_img: true, exclude_links: true, exclude_inputs: true }); } </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_list2 { 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> <?php echo view('includes/footer');?>