Server IP : 111.118.215.189 / Your IP : 18.116.82.179 Web Server : Apache System : Linux md-in-83.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 User : a1673wkz ( 2475) PHP Version : 8.2.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home1/a1673wkz/propstonerealty.com/Admin/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php session_start(); if(empty($_SESSION['username'])) { echo '<script>window.location.href="login.php"</script>'; } ?> <!DOCTYPE html> <html> <?php //header link include("header_link.php"); ?> <body> <?php //database file link include("config.php"); ?> <!-- Main Wrapper --> <div class="main-wrapper"> <!-- Page Wrapper --> <div class="page-wrapper"> <!-- Page Content --> <div class="content container-fluid"> <!-- Page Header --> <div class="page-header"> <div class="row align-items-center"> <div class="col"> <h3 class="page-title">Menu</h3> <ul class="breadcrumb"> <li class="breadcrumb-item"><a href="index.html">Dashboard</a></li> <li class="breadcrumb-item active">Menu</li> </ul> </div> <div class="col-auto float-right ml-auto"> <a href="#" class="btn add-btn" data-toggle="modal" data-target="#add_holiday"><i class="fa fa-plus"></i> Add Menu</a> </div> </div> </div> <!-- /Page Header --> <script src="js/jquery-3.2.1.min.js"></script> <div class="row"> <div class="col-md-12"> <div class="table-responsive"> <table class="table table-striped datatable custom-table mb-0" id="menu-load"> <thead> <tr> <th>#</th> <th>Menu</th> <th>Link</th> <th class="text-right">Action</th> </tr> </thead> <tbody> <?php $cnt='0'; $selct=$obj->fetch("SELECT * FROM menu ORDER BY id DESC"); foreach($selct as $val) { $cnt++; ?> <tr class="holiday-upcoming"> <td><?php echo $cnt; ?></td> <td><?php echo $val['menu'] ?></td> <td><?php echo $val['link'] ?></td> <td class="text-right"> <div class="dropdown dropdown-action"> <a href="#" class="action-icon dropdown-toggle" data-toggle="dropdown" aria-expanded="false"><i class="material-icons">more_vert</i></a> <div class="dropdown-menu dropdown-menu-right"> <a class="dropdown-item" href="#" data-toggle="modal" data-target="#edit_holiday<?php echo $cnt; ?>"><i class="fa fa-pencil m-r-5"></i> Edit</a> <a class="dropdown-item" href="#" data-toggle="modal" data-target="#delete_holiday<?php echo $cnt; ?>"><i class="fa fa-trash-o m-r-5"></i> Delete</a> </div> </div> </td> </tr> <!-- Edit Menu Modal --> <div class="modal custom-modal fade" id="edit_holiday<?php echo $cnt; ?>" role="dialog"> <div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title">Edit Menu</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <form id="edit_menu"> <div class="form-group"> <label>Menu Name <span class="text-danger">*</span></label> <input id="menu<?php echo $val['id']; ?>" class="form-control" value="<?php echo $val['menu']; ?>" type="text" /> <span class="preview2"></span> </div> <div class="form-group"> <label>Menu Link</label> <input id="link<?php echo $val['id']; ?>" class="form-control" value="<?php echo $val['link']; ?>" type="text" /> <input id="menu_id<?php echo $val['id']; ?>" class="form-control" value="<?php echo $val['id']; ?>" type="hidden" /> </div> <div class="submit-section"> <input type="button" name="submit" id="edit_menu_btn<?php echo $val['id']; ?>" class="btn btn-primary edit_menu_btn" value="Submit" /> </div> <div class="preview1" style="text-align: center;"></div> </form> </div> </div> </div> </div> <!-- / End Edit Menu Modal --> <!-- Delete Menu Modal --> <div class="modal custom-modal fade" id="delete_holiday<?php echo $cnt; ?>" role="dialog"> <div class="modal-dialog modal-dialog-centered"> <div class="modal-content"> <div class="modal-body"> <div class="form-header"> <h3>Delete Menu</h3> <p>Are you sure want to delete?</p> </div> <div class="modal-btn delete-action"> <div class="row"> <div class="col-6"> <button class="btn btn-primary continue-btn" value="<?php echo $val['id']; ?>" id="dlt_btn<?php echo $val['id']; ?>" style="width: 100%;">Delete</button> </div> <div class="col-6"> <a href="javascript:void(0);" data-dismiss="modal" class="btn btn-primary cancel-btn">Cancel</a> </div> </div> <div class="row"> <div class="col-12" align="center" style="padding-top: 15px;"><span id="preview2"></span></div> </div> </div> </div> </div> </div> </div> <!-- / End Delete Menu Modal --> <!-- Edit script Modal --> <script> $("#edit_menu_btn<?php echo $val['id']; ?>").click("submit", function() { var menu1 = $('#menu<?php echo $val['id']; ?>').val(); var link1 = $('#link<?php echo $val['id']; ?>').val(); var menu_id = $('#menu_id<?php echo $val['id']; ?>').val(); $("add_holiday").modal('show'); var flag = true; /********validate all our form fields***********/ if(menu1==""){ $('#menu1').css('border-color','red'); $('.menu1').html('Empty Field'); flag = false; } if(link1==""){ $('#link1').css('border-color','red'); $('.link1').html('Empty Field'); flag = false; } if(flag) { $.ajax({ url:"edit_menu.php", method:"POST", data:{menu1:menu1,link1:link1,menu_id:menu_id}, success:function(data) { //var result=JSON.parse(data); //alert(data); $(".preview1").html(data); //alert("success"); //location.reload(); setTimeout(function () { setTimeout(location.reload.bind(location), 1500); }, 1000); } }); } }); </script> <!-- End Edit Script Modal --> <!-- Delete Script Modal --> <script> $("#dlt_btn<?php echo $val['id']; ?>").click("submit", function () { var dlt_btn = $(this).val(); var flag = true; /********validate all our form fields***********/ if (dlt_btn == "") { $("#dlt_btn").css("border-color", "red"); $(".dlt_btn").html("Empty Field"); flag = false; } if (flag) { $.ajax({ url: "delete_menu.php", method: "POST", data: { dlt_btn: dlt_btn }, success: function (data) { //var result=JSON.parse(data); //alert(data); $("#preview2").html(data); //alert("success"); //location.reload(); setTimeout(function () { setTimeout(location.reload.bind(location), 1500); }, 1000); }, }); } }); </script> <!-- End Delete Script Modal --> <?php } ?> </tbody> </table> </div> </div> </div> </div> <!-- /Page Content --> <!-- Add Menu Modal --> <div class="modal custom-modal fade" id="add_holiday" role="dialog"> <div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title">Add Menu</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <form id="add_menu"> <div class="form-group"> <label>Menu Name <span class="text-danger">*</span></label> <input class="form-control" type="text" name="menu" id="menu" /> <span class="menu" style="color: red;"></span> </div> <div class="form-group"> <label>Menu Link</label> <input class="form-control" type="text" name="link" id="link" /> <span class="link" style="color: red;"></span> </div> <div class="submit-section"> <input type="button" name="" class="btn btn-primary submit-btn" id="submit" value="Submit" /> </div> <div class="preview" style="text-align: center;"></div> </form> </div> </div> </div> </div> <!-- /Add Menu Modal --> <?php // header include("header.php"); ?> </div> </div> <?php //footer link include("footer_link.php"); //footer include("footer.php"); ?> </body> </html> <script type="text/javascript"> $("#submit").click(function () { //get input field values var menu = $("#menu").val(); var link = $("#link").val(); $("add_holiday").modal("show"); var flag = true; /********validate all our form fields***********/ if (menu == "") { $("#menu").css("border-color", "red"); $(".menu").html("Empty Field"); flag = false; } if (link == "") { $("#link").css("border-color", "red"); $(".link").html("Empty Field"); flag = false; } if (flag) { $.ajax({ url: "add_menu.php", method: "POST", data: { menu: menu, link: link }, success: function (data) { //var result=JSON.parse(data); //alert(data); $(".preview").html(data); //alert("success"); //location.reload(); setTimeout(function () { setTimeout(location.reload.bind(location), 1500); }, 1000); }, }); } }); //reset previously set border colors on .keyup() $("#menu").keyup(function () { $("menu").css("border-color", ""); }); </script>