fhdfhdfhdfhdfhdfhdfdfhdfhdfhdhfdfhdfhdfhd dfhdfhdfhdfhdfhdfhdfhdfdfhdfhdfhdhfdfhdfhdfhdfh
DIR:/home/tcfq2ylb8mbt/public_html/tanpureinterior.com/admin_panel/ |
Current File : /home/tcfq2ylb8mbt/public_html/tanpureinterior.com/admin_panel/all_services.php |
<?php session_start(); include "./controllers/Main.php"; include("./common/header.php"); include("./common/sidebar.php"); include("./common/navbar.php"); $all_data = all_services(); if (isset($_POST['submit'])) { $response = add_services($_POST); if ($response === 422) { ?> <script> alert("Data Not Store"); window.location.href = "./all_services.php" </script> <?php } else { ?> <script> alert("Data saved successfully"); window.location.href = "./all_services.php" </script> <?php } } if(isset($_POST['delete'])){ $response = delete_services($_POST); if ($response === 201) { ?> <script> alert("Service deleted successfully"); window.location.href = "./all_services.php" </script> <?php } else { ?> <script> alert("Service not deleted"); window.location.href = "./all_services.php" </script> <?php } } ?> <div class="body flex-grow-1 px-3"> <div class="container-lg"> <div class="row"> <div class="col-lg-8"> <h2>All Services</h2> </div> <div class="col-lg-4 text-end"> <button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#addServiceModal"> <i class="fa fa-plus"></i> Add </button> </div> </div> <hr class="mt-0 mb-1" /> <table id="example" class="table table-striped" style="width:100%"> <thead> <tr> <th>Name</th> <th>Description</th> <th>Image</th> <th>Action</th> </tr> </thead> <tbody> <?php for ($i = 0; $i < count($all_data); $i++) { ?> <tr> <td> <?php echo $all_data[$i]['service_name']; ?> </td> <td> <?php echo $all_data[$i]['description']; ?> </td> <td><img src="./upload/<?php echo $all_data[$i]['service_image']; ?>" width="100" alt=""></td> <td> <form action="" method="post"> <input type="hidden" name="serviceId" value="<?php echo $all_data[$i]['id']; ?>" id=""> <button type="submit" name="delete" class="btn btn-outline-danger"><i class="fa fa-trash "></i></button> </form> </td> </tr> <?php } ?> </tbody> </table> <!-- Modal --> <div class="modal fade" id="addServiceModal" tabindex="-1" aria-labelledby="addServiceModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="addServiceModalLabel">Add Service</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <form action="" method="post" enctype="multipart/form-data"> <div class="modal-body"> <div class="row"> <div class="col-lg-12"> <label for="">Service Name</label> <input type="text" name="serviceName" id="" class="form-control" placeholder="Enter Service Name" required> </div> <div class="col-lg-12 mt-1"> <label for="">Description</label> <textarea type="text" name="description" id="" class="form-control" rows="3" placeholder="Enter Description"></textarea> </div> <div class="col-lg-12 mt-1"> <label for="">Service Image</label> <input type="file" name="image" id="image" class="form-control"> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> <button type="submit" name="submit" class="btn btn-primary">Submit</button> </div> </form> </div> </div> </div> </div> </div> <?php include('./common/footer.php'); ?> |