JezK
Edit File: quotelist.php
<?php include("app/checkSession.php"); include("app/adminObj.php"); if(!isset($_SESSION['user_id'])){ $customerObj->redirect('login.php'); } $quote_list=$customerObj->QuoteList(); if (isset($_POST['btn_submit'])) { $customerObj->db->query("UPDATE uflexit_request_quote SET expected_rate='".$_POST['expected_rate']."', whadmin_description='".$_POST['whadmin_description']."' WHERE quotation_id=".$_POST['quotation_id']); $customerObj->db->query("INSERT INTO uflexit_request_quote_track (quotation_id,admin_id,change_datetime,expected_rate,quotation_status,closed_status,whadmin_description,customer_description,whadmin_id) VALUES(".$_POST['quotation_id'].",".$_SESSION['user_id'].",'".date("Y-m-d H:i:s")."',".$_POST['expected_rate'].",".$_POST['quotation_status'].",1,'".$_POST['whadmin_description']."','',".$_SESSION['user_id'].")"); $customerObj->setFlashMessage('Status updated successfully!','success'); $customerObj->redirect('quotelist.php'); } include("header.php"); ?> <!-- <link href="css/simplePagination.css" type="text/css" rel="stylesheet"/> --> <div class="tophead col-md-4"> <h6>Quotation List</h6> </div> <div class="container first-position"> <div class="container mt-3 position-2"> <div class="row px-md-4 px-0 "> <br/> <div class="col-md-4"> </div> <div class="col-md-4"> <!-- <div class="input-group search-button mb-2" style="margin-right:10px;"> <input class="form-control border-right-0 border align-self-right border-rad-left" type="text" value="" id="myInput"> <span class="input-group-append"> <button class="btn btn-outline-secondary border-left-0 border border-rad-right" type="button"> <i class="fa fa-search"></i> </button> </span> </div> --> </div> </div> </div> <div class="container "> <div class="table-responsive p-md-4 p-0 myquotation-table"> <?php echo $customerObj->flashMessage();?> <table id="example" class="table table-borderless dataTable bg-white tbl-border" style="width:100%"> <thead> <tr> <th>Warehouse Name</th> <th>Warehouse ID</th> <th>Customer Name</th> <th>Customer Type</th> <th>Expected Value</th> <th>Date of submission</th> <th>Response status</th> <th>Response date</th> <th>Closed status</th> </tr> </thead> <tbody> <?php if($quote_list){foreach ($quote_list as $qlist) { $wrow = $customerObj->db->get_row("SELECT * FROM uflexit_master_warehouse WHERE warehouse_id=".(int)$qlist['warehouse_id']); $urow = $customerObj->db->get_row("SELECT * FROM uflexit_users WHERE user_id=".(int)$qlist['user_id']); ?> <tr> <td><a href="viewhistory.php?uid=<?php echo $qlist['quotation_id'];?>"><?php echo $wrow['warehouse_name'];?></a></td> <td><?php echo $qlist['warehouse_id'];?></td> <td><?php echo $urow['first_name'];?> <?php echo $urow['last_name'];?></td> <td><?php echo $urow['role_id']==3?'Individual':'Business';?></td> <td><?php echo $customerObj->get_price($qlist['expected_rate']);?></td> <td><?php echo $qlist['created_dt'];?></td> <td><?php echo $qlist['quotation_status']?'Approved':'Pending';?></td> <td><?php echo $qlist['modify_dt'];?></td> <td><?php echo $qlist['closed_status']?'Closed':'Open';?> <?php if($qlist['closed_status']=='0' || $qlist['closed_status']=='') { ?> <a href='#' onclick="jQuery('#quotation_id').val(<?php echo $qlist['quotation_id'];?>)" data-toggle="modal" data-target="#myModal"><img src='warehouse_admin/images/view.png' alt='view'></a> <?php }else { ?> <a href='cnewasn.php?q_id=<?php echo $qlist['quotation_id']; ?>' title="ASN">ASN</a> <!-- <a href='asnlist.php?q_id=<?php echo $qlist['quotation_id']; ?>' title="ASN">ASN</a> --> <?php } ?> </td> </tr> <?php }} ?> </tbody> </table> </div> </div> <!-- <div class="container position-relative"> <div class="row export_csv"> <div class="col-md-3 offset-md-9 "> <button id="export" class="btn btn-primary"><i class="fa fa-upload"></i><span class="pl-2">EXPORT.CSV</span></button> </div> </div> </div> --> </div> <div id="myModal" class="modal fade" role="dialog"> <div class="modal-dialog"> <form method="post" id="quote_form"> <input type="hidden" name="quotation_id" id="quotation_id"> <input type="hidden" name="uid" id="uid" value="<?php echo $_SESSION['user_id']; ?>"> <!-- Modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">Quotation Rate</h4> </div> <div class="modal-body"> <p>Please update quotation rate</p> <div class="form-group"> <label>Expected Rate</label> <input type="number" name="expected_rate" id="expected_rate" class="form-control" required="required" /> </div> <div class="form-group"> <label>Status</label> <select name="quotation_status" id="quotation_status" class="form-control" required="required"> <option value="0">Pending</option> </select> </div> <div class="form-group"> <label>Message</label> <textarea name="whadmin_description" id="whadmin_description" class="form-control" required="required"></textarea> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="submit" class="btn btn-primary" name="btn_submit">Submit</button> </div> </div> </form> </div> </div> <!-- footer --> <?php include("footer.php"); ?> <script> let $ =jQuery; $(document).ready(function() { $('#example').DataTable( { language: { search: '', searchPlaceholder: "Search" }, "processing": true, "dataSrc": "", "sDom": 'Bfrtip', // "sDom": 'Rlfrtlip', // "serverSide": true, // dom: 'Bfrtip', buttons: [ { extend: 'csvHtml5', text: '<i class="fa fa-file-text-o"></i>Export to csv', titleAttr: 'CSV' }, ] } ); } ); $(document).ready(function (e) { $("#quote_form").on('submit', (function (e) { e.preventDefault(); $.ajax({ url: 'savequote.php', type: "POST", data: new FormData(this), contentType: false, cache: false, processData: false, success: function (data) { if(data==1) { alert("Quotation Rate Added successfully"); window.location.reload(true); } /* if (data.status == "fail") { var message = ""; $.each(data.error, function (index, value) { message += value; }); errorMsg(message); } else { successMsg(data.message); window.location.reload(true); }*/ }, error: function () { // alert("Fail") } }); })); }); </script>