fhdfhdfhdfhdfhdfhdfdfhdfhdfhdhfdfhdfhdfhd dfhdfhdfhdfhdfhdfhdfhdfdfhdfhdfhdhfdfhdfhdfhdfh
DIR:/home/tcfq2ylb8mbt/public_html/tanpureinterior.com/admin_panel/ |
Current File : /home/tcfq2ylb8mbt/public_html/tanpureinterior.com/admin_panel/all_plots.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_sub_service_data = all_sub_services(); $all_data = all_plots(); if (isset($_POST['submit'])) { $response = add_plots($_POST); if ($response === 422) { ?> <script> alert("Data Not Store"); window.location.href = "./all_plots.php" </script> <?php } else { ?> <script> alert("Data saved successfully"); window.location.href = "./all_plots.php" </script> <?php } } if (isset($_POST['delete'])) { $response = delete_plots($_POST); if ($response === 201) { ?> <script> alert("Service deleted successfully"); window.location.href = "./all_plots.php" </script> <?php } else { ?> <script> alert("Service not deleted"); window.location.href = "./all_plots.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 Plote / Design</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>Sub Service</th> <th class="text-center">Designing Cost</th> <th>Area</th> <th class="text-center">Estimated Cost</th> <th>Action</th> </tr> </thead> <tbody> <?php for ($i = 0; $i < count($all_data); $i++) { ?> <tr> <td> <?php echo $all_data[$i]['plot_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> <?php for ($j = 0; $j < count($all_sub_service_data); $j++) { if ($all_data[$i]["sub_service_id"] === $all_sub_service_data[$j]['id']) { echo $all_sub_service_data[$j]['sub_service_name']; } } ?> </td> <td class="text-center"> <?php echo $all_data[$i]['designing_cost']; ?> /- </td> <td> <?php echo $all_data[$i]['plot_area']; ?> </td> <td class="text-center"> <?php echo $all_data[$i]['estimated_cost_of_constructions']; ?> </td> <td class="d-flex"> <button class="btn btn-outline-primary me-1 btn-sm" data-bs-toggle="modal" data-bs-target="#viewPlotDesignModal<?php echo $all_data[$i]['id']; ?>"><i class="fa fa-eye"></i></button> <button class="btn btn-outline-info me-1 btn-sm"><i class="fa fa-pencil"></i></button> <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 btn-sm"><i class="fa fa-trash "></i></button> </form> </td> </tr> <!-- Modal --> <div class="modal fade" id="viewPlotDesignModal<?php echo $all_data[$i]['id']; ?>" tabindex="-1" aria-labelledby="viewPlotDesignModalLabel" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header py-2"> <h5 class="modal-title" id="viewPlotDesignModalLabel">Plot / Design Details</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <!-- `plot_name`, `service_id`, `sub_service_id`, `description`, `designing_cost`, `plot_area`, `total_builtup_area`, `width`, `length`, `building_type`, `style`, `estimated_cost_of_constructions`, `bedroom`, `bathroom`, `living_room`, `kitchen`, `plot_code`, `dddd`, `plot_images`, `status`, --> <div class="modal-body"> <div class="row"> <div class="col-lg-8"> <p><b>Plot Name</b> : <?php echo $all_data[$i]['plot_name']; ?> </p> </div> <div class="col-lg-4"> <p><b>Plot Code</b> : <?php echo $all_data[$i]['plot_code']; ?> </p> </div> <hr class="mt-0 mb-1" /> <div class="col-lg-9"> <p><b>Description</b> : <?php echo $all_data[$i]['description']; ?> </p> </div> <div class="col-lg-3"> <img src="./upload/<?php echo $all_data[$i]['plot_images']; ?>" width="100" height="100" alt=""> </div> </div> <hr class="mt-0 mb-1" /> <div class="row"> <div class="col-lg-6"> <p><b>Designing Cost</b> : <?php echo $all_data[$i]['designing_cost']; ?> /- </p> </div> <div class="col-lg-6"> <p><b>Plot Area</b> <?php echo $all_data[$i]['plot_area']; ?> </p> </div> </div> <hr class="mt-0 mb-1" /> <div class="row"> <div class="col-lg-6"> <p><b>Total Builtup Area</b> : <?php echo $all_data[$i]['total_builtup_area']; ?> </p> </div> <div class="col-lg-6"> <p><b>Width</b> : <?php echo $all_data[$i]['width']; ?> </p> </div> </div> <hr class="mt-0 mb-1" /> <div class="row"> <div class="col-lg-6"> <p><b>Length </b> : <?php echo $all_data[$i]['length']; ?> </p> </div> <div class="col-lg-6"> <p><b>Building Type</b> : <?php echo $all_data[$i]['building_type']; ?> </p> </div> </div> <hr class="mt-0 mb-1" /> <div class="row"> <div class="col-lg-6"> <p><b>Style</b> : <?php echo $all_data[$i]['style']; ?> </p> </div> <div class="col-lg-6"> <p><b>Estimated Cost of Constructions</b> : <?php echo $all_data[$i]['estimated_cost_of_constructions']; ?> </p> </div> </div> <hr class="mt-0 mb-1" /> <div class="row"> <div class="col-lg-6"> <p><b>Bedrooms</b> : <?php echo $all_data[$i]['bedroom']; ?> </p> </div> <div class="col-lg-6"> <p><b>Bathroom</b> : <?php echo $all_data[$i]['bathroom']; ?> </p> </div> </div> <hr class="mt-0 mb-1" /> <div class="row"> <div class="col-lg-6"> <p><b>Living Room</b> : <?php echo $all_data[$i]['living_room']; ?> </p> </div> <div class="col-lg-6"> <p><b>Kitchen</b> : <?php echo $all_data[$i]['kitchen']; ?> </p> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> </div> </div> </div> </div> <?php } ?> </tbody> </table> <!-- Modal --> <div class="modal fade" id="addSubServiceModal" tabindex="-1" aria-labelledby="addSubServiceModalLabel" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="addSubServiceModalLabel">Add Plot</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-6"> <label for="">Select Service <span class="text-danger">*</span></label> <select name="serviceId" id="" class="form-control form-select" onchange="getSubservices(this.value)" required> <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-6"> <label for="">Sub Service Name <span class="text-danger">*</span></label> <select name="subServiceName" id="subServiceName" class="form-control form-select" required> <option value="">Select Sub Service</option> </select> </div> </div> <div class="row mt-2"> <div class="col-lg-8"> <label for="">Plot / Design Name <span class="text-danger">*</span></label> <input type="text" name="plot_name" id="" class="form-control" placeholder="Enter Plot / Design Name" required> </div> <div class="col-lg-4"> <label for="">Image <span class="text-danger">*</span></label> <input type="file" name="image" id="image" class="form-control" required> </div> </div> <div class="row mt-2"> <div class="col-lg-12"> <label for="">Description</label> <textarea type="text" name="description" id="" class="form-control" placeholder="Enter Discription" rows="2"></textarea> </div> </div> <div class="row mt-2"> <div class="col-lg-4"> <label for="">Designing Cost <span class="text-danger">*</span></label> <input type="text" name="cost" id="" class="form-control" placeholder="Enter Designing Cost" required> </div> <div class="col-lg-4"> <label for="">Plot Area <span class="text-danger">*</span></label> <input type="text" name="area" id="" class="form-control" placeholder="Enter Plot Area" required> </div> <div class="col-lg-4"> <label for="">Builtup Area <span class="text-danger">*</span></label> <input type="text" name="builtup_area" id="" class="form-control" placeholder="Enter Total Builtup Area" required> </div> </div> <div class="row mt-2"> <div class="col-lg-4"> <label for="">Width <span class="text-danger">*</span></label> <input type="text" name="width" id="" class="form-control" placeholder="Enter Width" required> </div> <div class="col-lg-4"> <label for="">Length <span class="text-danger">*</span></label> <input type="text" name="length" id="" class="form-control" placeholder="Enter Length" required> </div> <div class="col-lg-4"> <label for="">Building Type <span class="text-danger">*</span></label> <input type="text" name="building_type" id="" class="form-control" placeholder="Enter Building Type" required> </div> </div> <div class="row mt-2"> <div class="col-lg-4"> <label for="">Style <span class="text-danger">*</span></label> <input type="text" name="style" id="" class="form-control" placeholder="Enter Style" required> </div> <div class="col-lg-4"> <label for="">Estimated Cost Of Cunstruction <span class="text-danger">*</span></label> <input type="text" name="estimated_cost" id="" class="form-control" placeholder="Enter Estimated Cost Of Cunstruction" required> </div> <div class="col-lg-4"> <label for="">No. of Bedrooms</label> <input type="number" name="bedrooms" id="" class="form-control" placeholder="Enter No. of Bedrooms" > </div> </div> <div class="row mt-2"> <div class="col-lg-4"> <label for="">No. of Bathrooms</label> <input type="number" name="bathrooms" id="" class="form-control" placeholder="Enter No. of Bathrooms" > </div> <div class="col-lg-4"> <label for=""> No. of Living Room</label> <input type="number" name="living_room" id="" class="form-control" placeholder="Enter No. of Living Room" > </div> <div class="col-lg-4"> <label for="">No. of Kitchen</label> <input type="number" name="kitchen" id="" class="form-control" placeholder="Enter No. of Kitchen" > </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> <script> const getSubservices = (id) => { $('#subServiceName').empty(); $.ajax({ url: "sub_service_data.php", type: "post", data: { datas: "GetSubService", serviceId: id }, success: function (result) { if (result !== "") { $('#subServiceName').append(result); } else { alert("Data not found"); } } }) } </script> <?php include('./common/footer.php'); ?> |