EVOLUTION-NINJA
Edit File: admin_follow_up_details.php
<?php echo view('includes/header');?> <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> <section class="content-header"> <h1> Follow Ups </h1> </section> <!--- section 1 ----> <div role="tabpanel" class="tab-pane" id="clients"> <form id="land_owner" class="form-inline follow_up_project_form"> <div class="row land_owner_a"> <div class="col-sm-12 col-md-4"> <label class="col-sm-4 ">Project</label> <select class="form-control col-sm-5 project_list" name="project" id="sel1" required> <option value="0">Select project</option> <?php foreach($projects as $val) { ?> <option value="<?php echo $val->project_id;?>"><?php echo $val->project_name;?></option> <?php } ?> </select> </div> <div class="col-sm-12 col-md-4"> <label class="col-sm-4 ">Site No.</label> <select class="form-control col-sm-5 sites_list" name="sites" id="sel1" required="required"> </select> </div> <div class="col-sm-12 col-md-4"> <label class="col-sm-4"></label> <button type="submit" style="margin-top: 0px !important" class="btn btn-primary center-block submit">Submit</button> </div> </div> </form> <form id="land_owner" class="form-inline follow_up_date_wise"> <div class="row land_owner_a"> <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 follow_up_from" id="followup_from" name="from_date"> </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 follow_up_to" id="followup_to" name="to_date"> </div> <div class="col-sm-12 col-md-4"> <label class="col-sm-4"></label> <button type="submit" style="margin-top: 0px !important" class="btn btn-primary center-block submit">Submit</button> </div> </div> </form> </div> <section class="content"> <table class="table reminder_table" style=""> <thead> <tr class="default"> <th class="col-xs-1">Project</th> <th class="col-xs-1">Site</th> <th class="col-xs-1">Handled By</th> <th class="col-xs-1">View</th> </tr> </thead> <tbody id="table_body"> <?php foreach($owners as $row) {?> <tr> <th><?php echo $row->project_name;?></th> <th><?php echo $row->site_type;?></th> <th><?php echo $row->username;?></th> <th><button type="button" onclick="myfunc(<?php echo $row->project_id;?>,<?php echo $row->site_number;?>);">View</button></th> </tr> <?php } ?> </tbody> </table> </section> <!--- section 2 --> <section class="content-header"> <h1> Customer Details </h1> </section> <!--- section 1 ----> <section class="content"> <table class="table detail_table" style="display:none;"> <thead> <tr class="default" > <th class="col-xs-1">Project Name</th> <th class="col-xs-1">Site Number</th> <th class="col-xs-1">Customer Name</th> <th class="col-xs-1">Address</th> <th class="col-xs-1">TSV</th> <th class="col-xs-1">SQFT</th> <th class="col-xs-1">Date</th> <?php if (session()->get('user_type_id') > 1) { ?>; <th class="col-xs-1"></th> <?php }?> <th class="col-xs-1"></th> </tr> </thead> <tbody id="dynamicTbody"> </tbody> </table> </section> <div class="modal fade" id="reminder_modal" role="dialog"> <div class="modal-dialog modal-md"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">Set Reminder</h4> </div> <div class="modal-body"> <form id="land_owner1" class="form-inline update_form"> <div class="form-group col-md-offset-2 col-md-8"> <label>Call Conversation<textarea type="text" class="col-md-12 call_convo" name="call_convo" rows="3"></textarea></label> <input type="hidden" class="form-control col-sm-8 reminder_id" id="reminder_id" name="reminder_id" required="required"> </div> <!-- row 1----> <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 4----> </form> </div> <!-- <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary" data-dismiss="modal">Submit</button> </div> --> </div> </div> </div> <style type="text/css"> .content-wrapper, .right-side { } a { color: inherit; } </style> <?php $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $today = $date->format('Y-m-d'); $date = new DateTime($today); $date->sub(new DateInterval('P3D')); $three_days_prior = $date->format('Y-m-d'); ?> <script type="text/javascript"> $('.from_date_picker').datepicker({ changeMonth:true, changeYear:true, yearRange: "2000:c", dateFormat: 'dd-mm-yy' }); $('.to_date_picker').datepicker({ changeMonth:true, changeYear:true, yearRange: "2000:c", dateFormat: 'dd-mm-yy' }); $('.date_picker').datepicker({ changeMonth:true, changeYear:true, yearRange: "2000:c", //dateFormat: 'yy-mm-dd' dateFormat: 'dd-mm-yy' }); // $('.date_picker').datepicker('setDate', 'now'); $(document).ready(function(){ function isNumberKey(evt){ var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57)) return false; return true; } }); $(".tsv_input").keyup(function (e) { var tsv_input = $(this).val(); var dimen_input = $(".dimen_input").val(); if(dimen_input == "") { toastr["error"]("Dimesion is not available"); } else { var per_sqft = (tsv_input / dimen_input).toFixed(2); $(".per_sqft_input").val(per_sqft); } }); function fun(str) { //alert(str); var id = str; //alert(id); $(".reminder_id").val(str); $('#reminder_modal').modal('show'); } function conv(str) { //alert(str); var as = str; //alert(as); $(".reminder_id").val(str); $.ajax({ type : 'post', url : '<?php echo site_url("call-follow-up")?>', data : {'reminder_id':as}, success:function(data) { window.location.href = '<?php echo site_url('call-follow-up');?>/'+ '?id='+as; } }); } $('#land_owner1').submit(function(e){ e.preventDefault(); formdata = new FormData($(this)[0]); $.ajax({ type : 'post', url:"<?php echo site_url('add_conversation');?>", data : formdata, contentType: false, processData: false, success:function(response) { $('#reminder_modal').modal('hide'); } }); }); function myfunc(str,str1) { var id = str; // alert(id); var site_number = str1; //alert(site_number); $.ajax({ type : 'post', url : '<?php echo site_url("get_admin_follow_project_details")?>', data : {'id':id,'site_number':site_number}, success:function(data) { var obj = jQuery.parseJSON(data); var detail = obj.details; var content = ''; $("#dynamicTbody").empty(); $.each(detail,function(key,val){ //alert(val.booking_id); $('.detail_table').show(); //content += '<tr id="rowCount1" class="rowCount">'; content += '<tr><td>'+val.project_name+'</td>'; content += '<td>'+val.site_number+'</td>'; content += '<td>'+val.customer_name+'</td>'; content += '<td>'+val.address+'</td>'; content += '<td>'+val.tsv+'</td>'; content += '<td>'+val.tsv_per_sft_rs+'</td>'; content += '<td>'+val.updated_at+'</td>'; //content += '</?php if($this->session->userdata('user_type_id')>1){?>'; content += '<th><button type="button" onclick="fun('+val.detail_id+');">ADD Conversation</button></th>'; //content += '</?php }?>'; content += '<th><button type="button" onclick="conv('+val.detail_id+');">View Conversation</button></th>'; content += '</tr>'; }); $("#dynamicTbody").html(content); // //window.location.href = '<?php echo site_url('call-follow-up');?>/'+ '?id='+as; } }); } $('.follow_up_project_form').submit(function(e){ e.preventDefault(); project_id = $('.project_list').val(); site_number = $('.sites_list').val(); $.ajax({ type : 'post', url : '<?php echo site_url("get_follow_up_project")?>', data : {'project_id':project_id,'site_number':site_number}, success:function(response) { //response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { var content = ''; $("#dynamicTbody").empty(); $('.detail_table').show(); content += '<tr><td>'+response.detail.project_name+'</td>'; content += '<td>'+response.detail.site_number+'</td>'; content += '<td>'+response.detail.customer_name+'</td>'; content += '<td>'+response.detail.address+'</td>'; content += '<td>'+response.detail.tsv+'</td>'; content += '<td>'+response.detail.tsv_per_sft_rs+'</td>'; content += '<td>'+response.detail.updated_at+'</td>'; content += '<?php if (session()->get('user_type_id') > 1) { ?>;'; content += '<th><button type="button" onclick="fun('+response.detail.detail_id+');">ADD Conversation</button></th>'; content += '<?php }?>'; content += '<th><button type="button" onclick="conv('+response.detail.detail_id+');">View Conversation</button></th>'; content += '</tr>'; $("#dynamicTbody").html(content); //window.location.href = '</?php echo site_url('call-follow-up');?>/'+ '?id='+as; } else { toastr["error"](response.message); } } }); }); $('.follow_up_date_wise').submit(function(e){ e.preventDefault(); var from_date= $("#followup_from").val(); var to_date= $("#followup_to").val(); $.ajax({ type : 'post', url : '<?php echo site_url("get_follow_up_project_datewise")?>', data : {'from_date':from_date,'to_date':to_date}, success:function(response) { //response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { var content = ''; $("#dynamicTbody").empty(); $('.detail_table').show(); $.each(response,function(key,val){ $.each(val,function(key,va){ content += '<tr><td>'+va.project_name+'</td>'; content += '<td>'+va.site_number+'</td>'; content += '<td>'+va.customer_name+'</td>'; content += '<td>'+va.address+'</td>'; content += '<td>'+va.tsv+'</td>'; content += '<td>'+va.tsv_per_sft_rs+'</td>'; content += '<td>'+va.updated_at+'</td>'; content += '<?php if (session()->get('user_type_id') > 1) { ?>;'; content += '<th><button type="button" onclick="fun('+va.detail_id+');">ADD Conversation</button></th>'; content += '<?php }?>'; content += '<th><button type="button" onclick="conv('+va.detail_id+');">View Conversation</button></th>'; content += '</tr>'; $("#dynamicTbody").html(content); //window.location.href = '<?php echo site_url('call-follow-up');?>/'+ '?id='+as; }); }); } else { toastr["error"](response.message); } } }); }); </script> <script> $(".project_list").change(function(){ var project_id = $('.project_list :selected').val(); //CallAjax(project_id); Sites(project_id); }); function Sites(project_id){ $.ajax({ type : 'post', url : '<?php echo site_url("single-project-sites")?>', data : {project_id:project_id}, success:function(response){ //response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { var options = ''; options += '<option value="0">Select site</option>'; $.each(response.sites,function(idx,vx){ options += '<option value="'+vx.site_number+'">'+vx.site_number+'</option>'; }); $(".sites_list").html(options); $(".sites_list").change(function(){ var projectid = $(".project_list :selected").val(); var site_number = $(this).val(); // alert(site_number); // $.ajax({ // type : 'post', // url : '<?php echo site_url("single-follow-up-project-details")?>', // data : {site_number:site_number}, // success:function(response){ // } }); } else { $(".sites_list").empty(); } } }); } </script> <?php echo view('includes/footer');?>