EVOLUTION-NINJA
Edit File: quotation_list.php
<?php $this->load->view('includes/admin_header');?> <style type="text/css"> /*#print{ display: none; }*/ </style> <div class="main-container " id="main-container"> <div class="main-content"> <div class="main-content-inner"> <div class=" page-content" style="background-color:#f0f0f0;"> <div class="row"> <div class="col-sm-10" style=""> <h3>Quotation List</h3> </div> <div class="col-sm-2 sort-by"> <ul class="breadcrumb"> </ul> </div> </div> <label><input type="radio" name="status" value="ALL" class="inv_st" checked>ALL</label>   <label><input type="radio" name="status" value="WAITING" class="inv_st" >WAITING</label>   <label><input type="radio" name="status" value="EXPIRED" class="inv_st">EXPIRED</label>   <label><input type="radio" name="status" value="CLOSED" class="inv_st">CLOSED</label>   <label><input type="radio" name="status" value="REJECTED" class="inv_st">REJECTED</label>   <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">Pls Confirm Email</h4> </div> <form class="quote_mail" method="post"> <div class="modal-body"> <i class="fa fa-user fa-3x"></i> <select name="email_settings_id"> <input type="hidden" class="quotation_id" name="lead_id"> </select> <div class="row row-form"> <div class="col-sm-12"> <label class="col-sm-2">To</label> <input type="text" name="email[]" placeholder="email" class="email" style="width: 230px; border-bottom: 1px solid #000;border-top:initial;border-right:initial; border-left:initial;"> </div> </div> <div class="row row-form"> <div class="col-sm-12"> <label class="col-sm-2">CC</label> <input type="text" name="cc" value="ajay@jayblues.com,subramanya@jayblues.com" style="width: 230px; border-bottom: 1px solid #000;border-top:initial;border-right:initial; border-left:initial;"> </div> </div> <div class="row row-form"> <div class="col-sm-12"> <label class="col-sm-2" >Subject</label> <input type="text" name="subject" class="col-sm-8" placeholder="Subject" required="required" value="Quotation"> </div> </div> <div class="row row-form"> <div class="col-sm-12"> <label class="col-sm-2">Text</label> <textarea type="text" name="body" rows="4" class="col-sm-8" placeholder="message"></textarea> </div> </div> <!-- <input type="hidden" class="new_body" name="body"> --> <div class="row" style="text-align:center;padding-top:50px;"> <button type="submit" style="background:blue;color:#fff;" id="submit">Send</button> </div> </div> </form> </div> </div> </div> <div class="modal fade" id="msgModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">Send Message</h4> </div> <form class="quote_msg" method="post"> <div class="modal-body"> <i class="fa fa-user fa-3x"></i> <select name="email_settings_id"> <input type="hidden" class="quotation_id" name="lead_id"> </select> <div class="row row-form"> <div class="col-sm-12"> <label class="col-sm-3">Phone Number</label> <input type="text" name="phone_number" placeholder="phone number" class="phone_number" style="width: 230px; border-bottom: 1px solid #000;border-top:initial;border-right:initial; border-left:initial;"> </div> </div> <div class="row row-form"> <div class="col-sm-12"> <label class="col-sm-2">Text</label> <textarea type="text" name="message_text" rows="4" class="col-sm-8" placeholder="message"></textarea> </div> </div> <!-- <input type="hidden" class="new_body" name="body"> --> <div class="row" style="text-align:center;padding-top:50px;"> <button type="submit" style="background:blue;color:#fff;" id="submit">Send</button> </div> </div> </form> </div> </div> </div> <div class="row" style="background-color:white;margin-top:10px;"> <div class="col-xs-12"> <!-- PAGE CONTENT BEGINS --> <div class="hr dotted"></div> <div> <div class="row search-page" id="search-page-1"> <div class="col-xs-12"> <div class="row"> <div class="col-xs-12 col-sm-12"> <div class="row"> <div id="addele_more"> <div class="col-sm-12 table-responsive"> <table class="table" id="maintable"> <thead> <tr id="column_id"> <th>Sl No</th> <th>Quotation Number</th> <th>Client Name</th> <th style="width:40%;">Description</th> <th style="width:30%;">Address</th> <th>Sub Total</th> <th>GST(%)</th> <th>GST Rs.</th> <th>Amount</th> <th>Quotation Date</th> <th style="width:10%; !important">Till Valid</th> <th>Invoice Convert</th> <th>Converted Status</th> <!-- <th>Quotation Status</th> --> <th >Action</th> <th>Delete</th> </tr> </thead> <tbody id="tbody_new"> <?php $i=1; foreach($quotation as $key=>$value){ ?> <tr class="hoverr click-on information row<?php echo $value->quotation_id;?>"> <td><?php echo $key+1; ?></td> <td><?php echo $value->quotation_number; ?></td> <td><a href="<?php echo site_url("quotation-edit");?>/<?php echo $value->quotation_id; ?>"><?php echo $value->client_name;?></a> </td> <td> <?php if(!empty($value->quote_des)){ if (strpos($value->quote_des, '["') !== false) { $old = ['[', ']', '"']; $new = ['', '', '']; $org_srt1=str_replace($old,$new,$value->quote_des); echo $org_srt1; }else { echo $value->quote_des; }} ?></td> <td><?php echo $value->quote_add; ?></td> <td><?php echo $value->subamount; ?></td> <td><?php if($value->tax_no_tax=='tax'){ echo $value->gst; } else { echo 'NO TAX'; } ?></td> <td><?php echo $value->gst_amount; ?></td> <td><?php $num=$value->q_amount;$explrestunits = "" ; if(strlen($num)>3) { $lastthree = substr($num, strlen($num)-3, strlen($num)); $restunits = substr($num, 0, strlen($num)-3); $restunits = (strlen($restunits)%2 == 1)?"0".$restunits:$restunits; $expunit = str_split($restunits, 2); for($i=0; $i<sizeof($expunit); $i++) { if($i==0) { $explrestunits .= (int)$expunit[$i].","; } else { $explrestunits .= $expunit[$i].","; } } $thecash = $explrestunits.$lastthree; echo $thecash; } else { $thecash = $num; echo $thecash; } ?></td> <td><?php echo date('d-m-Y',strtotime($value->quo_date)); ?></td> <td><?php echo date('d-m-Y',strtotime($value->quot_end_date)); ?></td> <td> <?php if($value->convert_status=='APPROVED') {?><a href="<?php echo site_url('Invoice_convert/');?><?php echo $value->quotation_id; ?>"><button>Convert</button></a><?php } else{ ?> <a href="JavaScript:void(0);" onclick="alert('Not Approved');"><button>Convert</button></a><?php } ?></td> <td><?php if($user_type_ids==1){ if($value->convert_status!='APPROVED') {?> <a href="javascript:void(0)" onclick="approve('<?php echo $value->quotation_id; ?>');"> <button class="button<?php echo $value->quotation_id; ?>" style="margin-bottom: 5px;">Approve</button></a></br> <?php if($value->quotation_status!='REJECTED'){ ?> <button class="reject<?php echo $value->quotation_id; ?> button1<?php echo $value->quotation_id; ?>" onclick="reject('<?php echo $value->quotation_id; ?>');">Reject</button> <?php } else { ?> <button class="button1<?php echo $value->quotation_id; ?>">Rejected</button> <?php } ?> <?php } else{ ?> <a href="#"><button disabled="disabled">APPROVED</button><?php } } else { echo $value->convert_status;} ?></a></td> <!-- <td> <?php echo $value->quotation_status; ?> </td> --> <td> <a href="<?php echo site_url('print-quotation');?>/<?php echo $value->quotation_id;?>"><button type="button"><i class="fa fa-print" aria-hidden="true"></i></button></a> <button onclick="send('<?php echo $value->quotation_id; ?>');" data-toggle='modal' data-target='#myModal' style="width: 30px !important; margin-right: 3px;"><i class="fa fa-envelope" aria-hidden="true"></i></button><button onclick="send('<?php echo $value->quotation_id; ?>');" data-toggle='modal' data-target='#msgModal' style="width:30px !important;margin-top: 10px;"><i class="fa fa-paper-plane" aria-hidden="true"></i></button> </td> <td> <a href="<?php echo site_url('old_quotation_details');?>/<?php echo $value->quotation_id; ?>"> <span class="fa fa-sign-out" > Old Quotation</span> </a> <span class="glyphicon glyphicon-trash" onclick='delete_quotation("<?php echo $value->quotation_id; ?>");'></span></td> </tr> <?php $i++; } ?> </tbody> </table> </div> <div id="print"></div> </div> </div> </div> </div> </div> </div> </div> </div><!-- /.col --> </div><!-- /.row --> </div><!-- /.page-content --> </div> </div><!-- /.main-content --> <!--<script src="<?php //echo base_url('admin_assets/assets/js/jquery-2.1.4.min.js'); ?>"></script>--> <!-- <script src="<?php echo base_url('admin_assets/assets/js/bootstrap.min.js'); ?>"></script> --> <!-- page specific plugin scripts --> <script src="<?php echo base_url('admin_assets/assets/js/tree.min.js'); ?>"></script> <script src="<?php echo base_url('admin_assets/assets/js/select2.min.js'); ?>"></script> <script src="<?php echo base_url('admin_assets/assets/js/jquery-ui.custom.min.js'); ?>"></script> <script src="<?php echo base_url('admin_assets/assets/js/jquery.ui.touch-punch.min.js'); ?>"></script> <script src="<?php echo base_url('admin_assets/assets/js/holder.min.js'); ?>"></script> <!-- ace scripts --> <script src="<?php echo base_url('admin_assets/assets/js/ace-elements.min.js'); ?>"></script> <script src="<?php echo base_url('admin_assets/assets/js/ace.min.js'); ?>"></script> <!-- inline scripts related to this page --> <script src="<?php echo base_url('admin_assets/assets/js/jquery-ui.js');?>"></script> <script src="<?php echo base_url('admin_assets/assets/js/jquery.table2excel.js');?>"></script> <script src="<?php echo base_url('admin_assets/assets/datatables/jquery.dataTables.min.js');?>"></script> <script src="<?php echo base_url('admin_assets/assets/datatables/dataTables.bootstrap.min.js');?>"></script> <link rel="stylesheet" href="<?php echo base_url('admin_assets/assets/datatables/dataTables.bootstrap.css');?>"> <script src="<?php echo base_url('admin_assets/assets/js/jquery.table2excel.js');?>"></script> <script type="text/javascript"> var datatable; //var tbody = $('#maintable'); datatable = $('#maintable').DataTable(); $("#potentials_list").click(function(){ //alert(); $("#maintable").table2excel({ exclude: ".noExl", name: "Excel Document Name", filename: "potential-list", fileext: ".xls", exclude_img: true, exclude_links: true, exclude_inputs: true }); }); function reject(id) { $.ajax({ type : 'post', url : '<?php echo site_url("reject-quotation")?>', data : {'id':id}, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response) { toastr['success']("Quotation Rejected"); $('.reject'+id).text('Rejected'); //$(this).closest('button').html() /*setInterval(function(){ location.reload(); }, 10);*/ } else { toastr['error']("Something went wrong..Try again"); } } }); } function approve(id) { $.ajax({ type : 'post', url : '<?php echo site_url("approve-quotation")?>', data : {'id':id}, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response) { //toastr['success'](""); $('.button'+id).text('APPROVED'); swal({ title: "Approved quotation ,DO you Want to Change quotation Amount?", // text: "You will not be able to recover this data!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, Change it!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $('.reject'+id).hide(); window.location.href="<?php echo site_url('quotation-edit');?>/"+id; } else { location.reload(); $('.reject'+id).hide(); $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } else { toastr['error']("Something went wrong..Try again"); } } }); } $(".table td").hover(function() { addclass(); }); function addclass(){ $('.table td').addClass("edit1"); } function send(id){ $('.quotation_id').val(id); $.ajax({ type : 'post', url : '<?php echo site_url("lead-data")?>', data : {'id':id}, success:function(response){ response=jQuery.parseJSON(response); $('.email').val(response.email); $('.phone_number').val(response.phone); } }); } $('.cc').click(function(e){ e.preventDefault(); var content=''; content+='<div class=" col-sm-12 col-xs-12 col-md-8">'; content+='<label class="col-sm-3">CC</label>'; content+='<div class="col-sm-9">'; content+='<input type="text" name="email[]" class="" style="width: 230px; border-bottom: 1px solid #000;border-top:initial;border-right:initial; border-left:initial;">'; content+='</div>'; content+='</div>'; $('.new_div').append(content); }); $('.inv_st').change(function(e){ e.preventDefault(); $('#maintable').DataTable().destroy(); var status=$("input[type=radio][name=status]:checked" ).val(); $.ajax({ type : 'post', url : '<?php echo site_url("quotation-status-data")?>', data : {'status':status}, success:function(response){ response=jQuery.parseJSON(response); var content=''; $.each(response,function(key,val){ key=key+1; content+='<tr>'; content+='<td>'+key+'</td>'; content+='<td>'+val.quotation_number+'</td>'; content+='<td><a href="<?php echo site_url("quotation-edit");?>/'+val.quotation_id+'">'+val.client_name+'</a></td>'; var ress=val.description; var res1 = ress.replace('"', ""); var res2 = res1.replace('[', ""); var res3 = res2.replace(']', ""); content+='<td>'+res3+'</td>'; content+='<td>'+val.address+'</td>'; var sub=val.sub_total; x=sub.toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; content+='<td>'+res+'</td>'; content+='<td>'+val.gst+'</td>'; content+='<td>'+val.gst_amount+'</td>'; var tot=val.amount; x=tot.toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; content+='<td>'+res+'</td>'; var q_date=val.quo_date; q_date=q_date.split("-"); var new_date=q_date[2]+'-'+q_date[1]+'-'+q_date[0]; content+='<td>'+new_date+'</td>'; var q_date=val.quot_end_date; q_date=q_date.split("-"); var new_date=q_date[2]+'-'+q_date[1]+'-'+q_date[0]; content+='<td style="width:10%; !important">'+new_date+'</td>'; content+='<td>'; if(val.convert_status=='APPROVED') { content+='<a href="<?php echo site_url('Invoice_convert');?>/'+val.quotation_id+'"><button>Convert</button></a>'; }else { content+='<a href="JavaScript:void(0);" onclick="alert(\'Not Approved\');"><button> Convert</button></a>'; } content+='</td>'; content+='<td>'; if(val.convert_status!='APPROVED') { content+='<a href="javascript:void(0)" onclick="approve('+val.quotation_id+');"><button style="margin-bottom: 5px;" class="button'+val.quotation_id+'" >Approve</button>'; if(val.quotation_status!='REJECTED' && status=="WAITING" || status=="ALL"){ content+='<button class="button1'+val.quotation_id+'" onclick="reject('+val.quotation_id+');">Reject</button>'; } } else if(val.convert_status=='APPROVED'){ content+='<a href="#"><button disabled="disabled">APPROVED</button>'; } else { content+=val.convert_status; } content+='</a>'; content+='</td>'; content+='<td><button onclick="send('+val.quotation_id+');" data-toggle=modal data-target=#myModal style="width: 30px !important; margin-right: 3px;"><i class="fa fa-envelope" aria-hidden="true"></i></button><button onclick="send('+val.quotation_id+');" data-toggle=modal data-target=#msgModal style="width:30px !important;margin-top: 10px;"><i class="fa fa-paper-plane" aria-hidden="true"></i></button></td>'; content+='<td><span class="glyphicon glyphicon-trash" onclick="delete_quotation('+val.quotation_id+')"></span></td>'; content+='</tr>'; }); $('#tbody_new').empty(); $('#tbody_new').append(content); $('#maintable').DataTable(); } }); }); </script> <style type="text/css"> #treeview-searchable .node-disabled { display: none; } .hoverr:hover .addd { display:block; } .addd{ display:none; } .add_more { padding: 0px 7px !important; font-size: 12px !important; } #block{display:none;padding-left:10px;} .pd-7{ padding-right:7px !important; padding-left:7px !important; } .pd-9{ padding:2px 9px !important; } </style> <style type="text/css"> .yes_form input{ width:100% !important; border:none !important; border-bottom:1px solid gray !important; margin-bottom:5%; } .yes_form select{ width:100% !important; border:none !important; border-bottom:1px solid gray !important; margin-bottom:5%; } .yes_form textarea{ width:100% !important; border:none !important; border-bottom:1px solid gray !important; margin-bottom:5%; } .glyphicon-plus-sign:before { font-size: 18px; } .glyphicon { top: 12px; } </style> <script> setInterval(Status_change, 45000); function Status_change(){ $.ajax({ url:"<?php echo site_url("quotation-status-change")?>", type:"GET", success:function(response) { response=jQuery.parseJSON(response); } }); } function delete_quotation(id) { var 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(); $.ajax({ url:"<?php echo site_url("delete-quotation")?>", type:"POST", data:{id:id}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { toastr["success"]("Deleted successfully"); $('.row'+id).hide(); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } $(".col1").click(function(){ var text = $(this).val(); var test = $(this); if($(this).is(':checked')) { $("#column_id").append('<th>'+text+'</th>'); } else { $(".column_id").empty(); $('input[name="columns[]"]:checked').each(function() { console.log(this.value); $(".column_id").append('<th>'+this.value+'</th>'); }); } }); $('.quote_mail').submit(function(e){ e.preventDefault(); //$('#submit'). $("#submit").attr('disabled', 'disabled'); $("#submit").text("Sending..."); formdata = new FormData($(this)[0]); $.ajax({ type : 'post', url : '<?php echo site_url("send-quotation")?>', data : formdata, contentType: false, processData: false, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result=='1') { toastr['success'](response.message); $("#submit").text("Sending"); $("#submit").removeAttr('disabled'); location.reload(); } else { toastr['error']('Something went wrong'); $("#submit").text("Sending"); $("#submit").removeAttr('disabled'); } } }); }); $('.quote_msg').submit(function(e){ e.preventDefault(); //$('#submit'). $("#submit").attr('disabled', 'disabled'); $("#submit").text("Sending..."); formdata = new FormData($(this)[0]); $.ajax({ type : 'post', url : '<?php echo site_url("yaskawa/send_quotation_message")?>', data : formdata, contentType: false, processData: false, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result=='1') { toastr['success'](response.message); $("#submit").text("Sending"); $("#submit").removeAttr('disabled'); $('.quote_msg')[0].reset(); $("#msgModal").modal('hide'); //location.reload(); } else { toastr['error']('Something went wrong'); $("#submit").text("Sending"); $("#submit").removeAttr('disabled'); } } }); }); </script> <script> $('#cbxShowHide').click(function(){ this.checked?$('#block').show():$('#block').hide(); }); </script> <?php $this->load->view('includes/admin_footer');?>