EVOLUTION-NINJA
Edit File: edit-industry.php
<?php echo view('includes/flow-header'); ?> <link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=Inter&family=Jost:ital,wght@0,300;0,400;0,500;1,400&family=Montserrat&family=Ms+Madi&family=My+Soul&family=Nunito&family=Open+Sans&family=Poppins:wght@200;400&family=Roboto:ital,wght@0,300;0,400;0,500;1,300;1,400&family=Updock&display=swap" rel="stylesheet"> <section class="add-exhibition"> <div class="row"> <div class="col-sm-3"> <div class="spec-left"> <h5>INDUSTRY EXHIBITION</h5> <ul class="indust-menu"> <li><a href="<?php echo base_url('exhibition') ?>"><i class="fa fa-long-arrow-right" aria-hidden="true"></i>Add</a></li> <li><a href="<?php echo base_url('exhibition-list')?>"><i class="fa fa-long-arrow-right" aria-hidden="true"></i>List</a></li> </ul> </div> </div> <div class="col-sm-9"> <div class="industry-right"> <div class="row"> <div class="col-sm-9"></div> <div class="col-sm-3" id="go-back-new"> <a href="<?php echo base_url("Super-Admin-Dashboard")?>"><i class="fa fa-arrow-left" aria-hidden="true"></i>Back</a> </div> </div> <h3 class="mt-0">Industry Exhibition List</h3> <div class="table-responsive pt-4" id="list-table"> <table class="table"> <thead> <tr> <th>Sl No.</th> <th>Company Name</th> <th>E-Mail ID</th> <th>Contact Number</th> <th>View Count</th> <th>Action</th> <th>Select Trend</th> <th>Order</th> </tr> </thead> <tbody> <?php foreach($details as $key=>$val){ ?> <tr id="tr-bg"> <td><p><?php echo $key+1; ?></p></td> <td><p><?php echo $val['company_name']; ?></p></td> <td><p><?php echo $val['mail']; ?></p></td> <td><p><?php echo $val['phone']; ?></p></td> <td><p><?php echo $val['view_count']; ?></p></td> <td> <button type="button" class="btn-edit" data-toggle="modal" onclick="edit_industry(<?php echo $val['id'];?>)" >Edit</button> <button type="button" class="btn-delete" onclick="delete_industry(<?php echo $val['id'];?>)">Delete</button> </td> <td> <div class="form-check"> <label class="form-check-label"> <?php if($val['trend_active'] != 0){?> <input type="checkbox" id="<?php echo 'trend'.$val['id']; ?>" onclick="trending(<?php echo $val['id'];?>)" checked> <?php }else{ ?> <input type="checkbox" id="<?php echo 'trend'.$val['id']; ?>" onclick="trending(<?php echo $val['id'];?>)"> <?php } ?> </label> </div> </td> <td> <select class="form-control"> <option>4</option> <option>5</option> <option>6</option> </select> </td> <!-- <td><p><?php echo $val['trend_active']; ?></p></td> --> </tr> <?php } ?> </tbody> </table> </div> </div> </div> </div> </section> <!-- The Modal --> <div class="modal fade" id="myModal"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <!-- Modal Header --> <div class="modal-header"> <h4 class="modal-title">Edit Industry Exhibition</h4> <button type="button" class="close" data-dismiss="modal">×</button> </div> <form id="update_industry" encType="multipart/form-data"> <!-- Modal body --> <div class="modal-body"> <!-- <div class="row"> <div class="col-sm-3"> <label>Company Name</label> <div class="form-group"> <input type="text" class="form-control" name="company_name" id="company_name"> <input type="hidden" name="id_company" id="id_company"> </div> </div> <div class="col-sm-9"> <label>About Company</label> <div class="form-group"> <input type="text" class="form-control" name="about_company" id="about_company"> </div> </div> </div> --> <div class="row"> <div class="col-sm-3"><label>Logo</label></div> <div class="col-sm-9"> <div class="form-group"> <input type="file" class="form-control" name="logo_name" id="logo_name"> </div> </div> </div> <div class="row"> <div class="col-sm-3"></div> <div class="col-sm-9"> <div class="logo-pic"> <img class="img-fluid" name="logo" alt="preview image" id="logo1" /> </div> </div> </div> <div class="row pt-3"> <div class="col-sm-3"> <label>Company Name</label> </div> <div class="col-sm-9"> <div class="form-group"> <input type="text" class="form-control" name="company_name" id="company_name"> <input type="hidden" name="id_company" id="id_company"> </div> </div> </div> <div class="row"> <div class="col-sm-3"> <label>About Company</label> </div> <div class="col-sm-9"> <div class="form-group"> <textarea class="form-control" rows="6" name="about_company" id="about_company"></textarea> </div> </div> </div> <!-- <div class="row"> <div class="col-sm-6"> <label>Website</label> <div class="form-group"> <input type="text" class="form-control" name="website" id="website"> </div> </div> <div class="col-sm-6"> <label>E-mail Address</label> <div class="form-group"> <input type="text" class="form-control" name="mail" id="mail"> </div> </div> </div> --> <div class="row"> <div class="col-sm-3"> <label>Website</label> </div> <div class="col-sm-9"> <div class="form-group"> <input type="text" class="form-control" name="website" id="website"> </div> </div> </div> <div class="row"> <div class="col-sm-3"> <label>E-mail Address</label> </div> <div class="col-sm-9"> <div class="form-group"> <input type="text" class="form-control" name="mail" id="mail"> </div> </div> </div> <!-- <div class="row"> <div class="col-sm-6"> <label>Contact Person Name</label> <div class="form-group"> <input type="text" class="form-control" name="person_name" id="person_name"> </div> </div> <div class="col-sm-6"> <label>Phone Number</label> <div class="form-group"> <input type="text" class="form-control" name="phone_number" id="phone_number"> </div> </div> </div> --> <div class="row"> <div class="col-sm-3"> <label>Contact Person Name</label> </div> <div class="col-sm-9"> <div class="form-group"> <input type="text" class="form-control" name="person_name" id="person_name"> </div> </div> </div> <div class="row"> <div class="col-sm-3"> <label>Phone Number</label> </div> <div class="col-sm-9"> <div class="form-group"> <input type="text" class="form-control" name="phone_number" id="phone_number"> </div> </div> </div> <!-- <div class="row"> <div class="col-sm-6"> <label>Products</label> <div class="form-group"> <input type="text" class="form-control" name="products" id="products"> </div> </div> <div class="col-sm-6"> <label>Logo</label> <div class="form-group"> <input type="file" class="form-control" name="logo_name" id="logo_name"> </div> </div> </div> --> <div class="row"> <div class="col-sm-3"> <label>Products</label> </div> <div class="col-sm-9"> <div class="form-group"> <textarea class="form-control" rows="6" name="products" id="products"> </textarea> </div> </div> </div> </div> <!-- Modal footer --> <div class="modal-footer"> <button type="submit" class="btn btn-primary">Update</button> <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button> </div> </form> </div> </div> </div> <!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> --> <!-- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"> --> <script> function trending(id){ // alert(id); $.ajax({ url:"<?php echo base_url("trending")?>", type:"POST", data:{id:id}, success:function(response){ response = jQuery.parseJSON(response); if(response.result==1){ toastr["success"](response.message); }else{ toastr["error"](response.message); $('#trend'+id).prop('checked',false); } } }); } function edit_industry(key){ // alert(key); var industry_id = key; $.ajax({ url:"<?php echo base_url("edit-industry")?>", type:"POST", data:{id:industry_id}, success:function(response){ response = jQuery.parseJSON(response); // console.log(response.message); if(response.result == 1){ $("#myModal").modal("show"); $('#company_name').val(response.message.company_name); $('#id_company').val(response.message.id); // $('#about_company').val(response.message.about_company); $('#website').val(response.message.website); $('#mail').val(response.message.mail); $('#person_name').val(response.message.contact_person); $('#phone_number').val(response.message.phone); $('.Editor-editor').eq(1).html(response.message.products); $('.Editor-editor').eq(0).html(response.message.about_company); // console.log($("#products").Editor("getText")); // alert(response.message.logo); // $('#logo').val(response.message.logo); var image_name = response.message.logo; // var logo = document.getElementById('logo'); document.getElementById('logo1').src = '../public/uploads/exhibition/'+image_name; } } }); } function delete_industry(id){ // alert(id); swal({ title: "Are you sure?", text: "do you want to delete industry exhibition from this list", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes", cancelButtonText: "No", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if(isConfirm){ $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $.ajax({ type : "POST", url : '<?php echo base_url("delete-industry")?>', data : {id:id}, success:function(response){ response = jQuery.parseJSON(response); if(response.result==1){ toastr["success"](response.message); window.setTimeout(function() { window.location = '<?php echo base_url("exhibition-list")?>'; }, 2000); } else toastr["error"](response.message); } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } $('#update_industry').submit(function(e){ e.preventDefault(); var about_company = $('#about_company').Editor("getText"); var products = $("#products").Editor("getText"); var formData = new FormData(this); formData.append('about_company',about_company); formData.append('products',products); $.ajax({ type : 'POST', url : '<?php echo base_url("update-industry-exhibition")?>', data : formData, contentType: false, processData: false, success:function(response){ response = jQuery.parseJSON(response); if(response.result == 1){ toastr["success"](response.message); window.location = '<?php echo base_url("exhibition-list")?>'; }else{ toastr["error"](response.message); } } }); }); </script> <script> $(document).ready(function() { $("#products").Editor(); }); $(document).ready(function() { $("#about_company").Editor(); }); </script> <?php echo view('includes/flow-footer'); ?> <style> .logo-pic{ width:150px; height:150px; border:2px solid #000; } .modal-header{ background: linear-gradient(to left, #0198CD,#0160A2); } .modal-header h4{ color: #fff; } </style>