EVOLUTION-NINJA
Edit File: accounts.php
<?php echo view('includes/header');?> <link href="http://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet"> <section class="content-header"> <h1> Accounts </h1> </section> <!--- section 1 --> <section class="content"> <div class="row"> <div class="col-md-8" id="notification_div"> </div> </div> <div class="row" style="padding-left:10px; padding-top:25px;"> <div class="col-md-12"> <table class="table table-striped table-hover management_table" style=""> <thead> <tr class="default" > <th class="col-xs-1">Sl.No</th> <th class="col-xs-1">Customer</th> <th class="col-xs-1">Contact</th> <th class="col-xs-2">Project</th> <th class="col-xs-2">Site no.</th> <th class="col-xs-2">Executive</th> <!-- <th class="col-xs-2">Commission in %</th> <th class="col-xs-2">Commission in RS</th> <th class="col-xs-2">On agreement</th> <th class="col-xs-2">On registration</th> <th class="col-xs-3">Areement executed on</th> <th class="col-xs-2">Registration on</th> <th class="col-xs-1">Status</th> --> <th class="col-xs-1">Action</th> </tr> </thead> <tbody id="table_body"> <?php $i=1; foreach($accounts as $value){ if($value->agreement_status=="APPROVED" || $value->registration_status=="APPROVED"){ ?> <tr> <td><?php echo $i; ?></td> <td><?php echo $value->customer_name; ?></td> <td><?php echo $value->customer_contact; ?></td> <td><?php echo $value->project_name; ?></td> <td><?php echo $value->site_number; ?></td> <td><?php echo $value->associate_name; ?></td> <td><a data-toggle="tooltip" title="View" class="" href="<?php echo site_url("commission-details/$value->booking_id")?>"><span class="glyphicon glyphicon-search"></span></a></td> </tr> <?php $i++; } ?> <?php } ?> </tbody> </table> </div> </div> <div class="col-sm-0 col-md-1"></div> </section> <!--- section 2 --> <style type="text/css"> .content-wrapper, .right-side { min-height: 1700px !important; } </style> <script type="text/javascript"> function ManagementList() { console.log("ManagementList function is called!"); // Your logic to refresh management list (e.g., AJAX call) } $(document).ready(function(){ setInterval(notifications, 2000); notifications(); function notifications() { $.ajax({ type : 'get', url : '<?php echo site_url("accounts-notifications")?>', success:function(response){ //response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { var i = 1; var content = ''; $.each(response.notifications,function(key,val){ if(val.final_status == "PENDING") { if(val.agreement_status == 'APPROVED' && val.registration_status == 'APPROVED')// && val.registration_date > '0000-00-00') { content += '<p style="color:red;">'+i+'. Agreement & Registration commission has approved for site number '+val.site_number+' of project - '+val.project_name+'</p>'; } else if(val.agreement_status == 'APPROVED') { content += '<p style="color:red;">'+i+'. Agreement commission has approved for site number '+val.site_number+' of project - '+val.project_name+'</p>'; } else if(val.registration_status == 'APPROVED') { content += '<p style="color:red;">'+i+'. Registration commission has approved for site number '+val.site_number+' of project - '+val.project_name+'</p>'; } } i++; }); $("#notification_div").html(content); } else { $("#notification_div").empty(); } } }); } var datatable; var tbody = $('#table_body'); datatable = $('.management_table').DataTable({ "scrollY": 350, "scrollX": true, "ordering": false, }); ManagementList(); // function ManagementList() // { // tbody.empty(); // var table_row = []; // $.ajax({ // type : 'get', // url : '<//?php echo site_url("account-management-list")?>', // success:function(response){ // response=jQuery.parseJSON(response); // console.log(response); // if(response.result==1) // { // var slno = 1; // var index = 1; // var table_content = ''; // $.each(response.management_list,function(idx,vx){ // if(vx.agreement_status == "APPROVED" || vx.registration_status == "APPROVED") // { // if(vx.booking_status == "CANCELLED" || vx.booking_status == "REFUNDED") // { // table_content += '<tr class="danger">'; // } // else // { // table_content += '<tr>'; // } // table_content += '<td>'+slno+'</td>'; // table_content += '<td>'+vx.customer_name+'</td>'; // table_content += '<td>'+$.parseJSON(vx.customer_contact)+'</td>'; // table_content += '<td>'+vx.project_name+'</td>'; // table_content += '<td>'+vx.site_number+'</td>'; // table_content += '<td>'+vx.associate_name+'</td>'; // table_content += '<td>'; // if(vx.booking_status == "CANCELLED" || vx.booking_status == "REFUNDED") // { // table_content += '<div style="float:left;">CANCELLED</div>'; // } // else // { // table_content += '<div style="float:left;">'; // //table_content += '<button type="button" management_id="'+vx.management_id+'" class="btn btn-success btn-xs dis_appr_button">Payment</button>'; // table_content += '<a data-toggle="tooltip" title="View" class="" href="<?php echo site_url("commission-details")?>/'+vx.booking_id+'"><span class="glyphicon glyphicon-search"></span></a> '; // table_content += '</div>'; // } // table_content += '</td>'; // table_content += '</tr>'; // slno++; // index ++; // } // }); // $("#table_body").html(table_content); // $(".table").DataTable(); // $('[data-toggle="tooltip"]').tooltip(); // } // } // }); // } // toastr.options.timeOut = 1000; $(".site_number").keyup(function (e) { var site_number = $(this).val(); $(".submit").attr('disabled', 'disabled'); $.ajax({ type : 'post', url : '<?php echo site_url("details-for-management")?>', data : {site_number:site_number}, success:function(response){ // response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { $(".submit").removeAttr('disabled'); $("input[name=booking_id]").val(response.booking_details.booking_id); $("input[name=detail_id]").val(response.booking_details.detail_id); $("input[name=tsv]").val(response.booking_details.tsv); $("select option[value='"+response.booking_details.project_id+"']").attr("selected","selected"); $("input[name=site_number]").val(response.booking_details.site_number); $("input[name=site_dimension]").val(response.booking_details.dimension); $("input[name=per_sqft]").val(response.booking_details.tsv_per_sft_rs); $(".project_list option[value='" + response.booking_details.project_id + "']").attr("selected","selected"); $(".reference option[value='" + response.booking_details.reference + "']").attr("selected","selected"); $(".associate option[value='" + response.booking_details.associate + "']").attr("selected","selected"); $('.date_picker').datepicker({ dateFormat: 'yy-mm-dd' }); } else if(response.result==2) { toastr["error"](response.message); $('.cancellation_form')[0].reset(); $(".submit").removeAttr('disabled'); } else if(response.result == 3) { toastr["error"](response.message); $('.cancellation_form')[0].reset(); $(".submit").removeAttr('disabled'); } else if(response.result==0) { toastr["error"](response.message); $(".submit").removeAttr('disabled'); //$('.cancellation_form')[0].reset(); } } }); }); $('.management_form').submit(function(e){ e.preventDefault(); formdata = new FormData($(this)[0]); $(".submit").attr('disabled', 'disabled'); $(".submit_button").text("Submitting..."); $.ajax({ type : 'post', url : '<?php echo site_url("add-management-details")?>', data : formdata, contentType: false, processData: false, success:function(response){ // response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { ManagementList(); toastr["success"](response.message); $('.management_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 if(response.result==3) { toastr["error"](response.message); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } else { toastr["error"](response.message); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } } }); }); }); </script> <?php echo view('includes/footer');?>