Skip to content

Commit

Permalink
update booking details content
Browse files Browse the repository at this point in the history
  • Loading branch information
PathumChinthaka committed Nov 16, 2023
1 parent 3b818ff commit 6c97543
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 163 deletions.
4 changes: 3 additions & 1 deletion config/serverUrl.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//server URL
// const baseURL = "http://localhost:8085/NextTravel/api/";
const baseURL = "http://localhost:8075/NextTravel/api/v1/package/";
const baseURL = "http://localhost:8075/NextTravel/api/v1/";

const vehicleBaseURL = "http://localhost:8065/NextTravel/api/v1/vehicle";

const baseWebURL="http://localhost:8080/NextTravel/api/";

Expand Down
76 changes: 75 additions & 1 deletion controller/BookingDetails.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
$(document).ready(function () {
getAllPackageDetails();
getAllVehicleDetails();
});

function getAllPackageDetails() {
$.ajax({
url: baseURL + "getAll",
url: baseURL + "package/getAll",
method: "GET",
success: function (response) {
$("#package-table tbody").empty();
Expand Down Expand Up @@ -57,4 +58,77 @@ function getAllPackageDetails() {
alert("An error occurred: " + error);
}
});
}

function getAllVehicleDetails(){
$.ajax({
url: vehicleBaseURL + "/getAll",
method: "GET",
success: function (response) {
$("#package-table tbody").empty();
response.forEach(element => {
const cardData =
`<div class="card my-3" style="width:35rem;">
<div class="card-body">
<h5 class="card-title">${element.data.vehicleCategory}</h5>
<div class="d-flex justify-content-between">
<div class="w-40">
<div class="my-2">
<span class="font-weight-bold">Vehicle Name :</span>
${element.data.vehicleName}
</div>
<div class="my-2">
<span class="font-weight-bold">Fuel type :</span>
${element.data.fuelType}
</div>
<div class="my-2">
<span>Fuel usage :</span>
${element.data.fuelUsage}
</div>
<div class="my-2">
<span>Is Hybrid :</span>
${element.data.isHybrid}
</div>
<div class="my-2">
<span>Seat Count :</span>
${element.data.seatCount}
</div>
</div>
<div class="mx-5">
<div class="my-2">
<span>Auto/Menual type :</span>
${element.data.transmissionType}
</div>
<div class="my-2">
<span>Fuel Usage Cost :</span>
${element.data.fuelUsageCost}
</div>
<div class="my-2">
<span>Per Day Charge :</span>
${element.data.perDayCharge}
</div>
<div class="my-2">
<span>Per 1 km charge :</span>
${element.data.vehicle1kmCharge}
</div>
<div class="my-2">
<span>Policy Types :</span>
${element.data.policyType}
</div>
</div>
</div>
<div class="my-2">
<span>Vehicle Remarks</span>
<p class="card-text my-1">${element.data.remarks}</p>
</div>
<button class="btn btn-primary my-2">Select vehicle</button>
</div>
</div>`;
$("#Vehicle-Details").append(cardData);
});
},
error: function (xhr, status, error) {
alert("An error occurred: " + error);
}
});
}
11 changes: 5 additions & 6 deletions controller/VehicleDetailsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ $("#vehicle-save-btn").click(function (e) {

// Create Post Request
$.ajax({
url: baseURL + "vehicle/save",
url: vehicleBaseURL + "/save",
method: "post",
data: JSON.stringify(vehicleDetailsObj),
contentType: "application/json",
Expand All @@ -141,7 +141,6 @@ $("#vehicle-save-btn").click(function (e) {
alert(response.message);
getAllVehicleDetails();
clearVehicleInputs();

}
},
error: function (xhr, status, error) {
Expand All @@ -154,7 +153,7 @@ $("#vehicle-save-btn").click(function (e) {
//get All vehicle details
function getAllVehicleDetails() {
$.ajax({
url: baseURL + "vehicle/getAll",
url: vehicleBaseURL + "/getAll",
method: "GET",
success: function (response) {
//load 1 st table data
Expand Down Expand Up @@ -198,7 +197,7 @@ getAllVehicleDetails();
$("#vehicle-tbody-one,#vehicle-tbody-two").on('click', 'tr', (event) => {
const vehicleId=$(event.target).closest('tr').find('td').eq(0).text();
$.ajax({
url: baseURL + "vehicle/" + vehicleId,
url: vehicleBaseURL + "/" + vehicleId,
method: "GET",
success: function (response) {
console.log(response.data);
Expand Down Expand Up @@ -230,7 +229,7 @@ $("#vehicle-update-btn").click(function (e) {

//create put mapping ajax
$.ajax({
url: baseURL + "vehicle/update",
url: vehicleBaseURL + "vehicle/update",
method: "put",
data: JSON.stringify(vehicleDetailsObj),
contentType: "application/json",
Expand All @@ -256,7 +255,7 @@ $("#vehicle-delete-btn").click(function (e) {
if (choice == true) {
const vehicleId = $('#vehicle_id').val();
$.ajax({
url: baseURL + "vehicle/" + vehicleId,
url: vehicleBaseURL + "vehicle/" + vehicleId,
method: "delete",
dataType: "json",
success: function (response) {
Expand Down
159 changes: 8 additions & 151 deletions custompackage.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,175 +24,32 @@
<h1>Travel packages 🗳</h1>
</div>
<div class="d-flex pt-5 flex-column justify-content-center align-items-center m-4" id="Booking-cards">
</div>
<div class="mt-4 p-3 m-4">
<!-- <table class="table table-hover rounded-1 w-100">
<thead class="table-secondary">
<tr>
<th scope="col">PackageId</th>
<th scope="col">Package Name</th>
<th scope="col">Discount</th>
<th scope="col">Select/Remove</th>
</tr>
</thead>
<tbody>
<tr>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
<td>@mdo</td>
</tr>
</tbody>
</table> -->

</div>
</div>
<!-- travel Area window -->
<!-- Hotel Details window -->
<div class="carousel-item">
<div class="d-flex justify-content-center align-items-center flex-column bg-primary mb-3 text-white p-2">
<h1>Travel-Area</h1>
<h1>Hotel Details</h1>
</div>
<div class="d-flex justify-content-center mt-4">
<input type="text" class="form-control w-25" placeholder="Search area"><button
class="btn btn-primary mx-1">Search</button>
</div>
<div class="d-flex pt-5 justify-content-center m-4">
<div class="card mx-3" style="width: 20rem; height:22rem;">
<img
src="https://images.pexels.com/photos/11442148/pexels-photo-11442148.jpeg?auto=compress&cs=tinysrgb&w=600"
class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Regular</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the
card's content.</p>
</div>
</div>
<div class="card mx-3" style="width: 20rem; height:22rem;">
<img
src="https://images.unsplash.com/photo-1580910527739-556eb89f9d65?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MzV8fHNyaSUyMGxhbmthfGVufDB8fDB8fHww&auto=format&fit=crop&w=500&q=60"
class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Mid-level</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the
card's content.</p>
</div>
</div>
<div class="card mx-3" style="width: 20rem; height:22rem;">
<img
src="https://images.pexels.com/photos/9505333/pexels-photo-9505333.jpeg?auto=compress&cs=tinysrgb&w=600"
class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Luxury</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the
card's content.</p>
</div>
</div>
<div class="card mx-3" style="width: 20rem; height:22rem;">
<img
src="https://images.unsplash.com/photo-1552055568-f8c4fb8c6320?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MTR8fHNyaSUyMGxhbmthfGVufDB8fDB8fHww&auto=format&fit=crop&w=500&q=60"
class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Super Luxury</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the
card's content.</p>
</div>
</div>
</div>
<div class="mt-4 p-3 m-4">
<!-- <table class="table table-hover rounded-1 w-100">
<thead class="table-secondary">
<tr>
<th scope="col">AreaID</th>
<th scope="col">Travel Area Name</th>
<th scope="col">Description</th>
<th scope="col">Select/Remove</th>
</tr>
</tr>
</thead>
<tbody>
<tr>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
<td>@mdo</td>
</tr>
</tbody>
</table> -->
<div class="d-flex pt-5 justify-content-center m-4" id="Hotel-Details">

</div>
</div>
<div class="carousel-item">
<div class="d-flex justify-content-center align-items-center flex-column bg-primary mb-3 text-white p-2">
<h1>Hotels</h1>
<h1>Vehicle Details</h1>
</div>
<div class="d-flex justify-content-center mt-4">
<input type="text" class="form-control w-25" placeholder="Search hotel"><button
class="btn btn-primary mx-1">Search</button>
</div>
<div class="d-flex pt-5 justify-content-center m-4">
<div class="card mx-3" style="width: 20rem; height:21rem;">
<img
src="https://images.pexels.com/photos/2844474/pexels-photo-2844474.jpeg?auto=compress&cs=tinysrgb&w=600"
class="card-img-top" alt="..." width="15rem">
<div class="card-body">
<h5 class="card-title">Regular</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the
card's content.</p>
</div>
</div>
<div class="card mx-3" style="width: 20rem; height:21rem;">
<img
src="https://images.pexels.com/photos/1591361/pexels-photo-1591361.jpeg?auto=compress&cs=tinysrgb&w=600"
class="card-img-top" alt="..." width="15rem">
<div class="card-body">
<h5 class="card-title">Mid-level</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the
card's content.</p>
</div>
</div>
<div class="card mx-3" style="width: 20rem; height:21rem;">
<img
src="https://images.pexels.com/photos/258154/pexels-photo-258154.jpeg?auto=compress&cs=tinysrgb&w=600"
class="card-img-top" alt="..." width="15rem">
<div class="card-body">
<h5 class="card-title">Luxury</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the
card's content.</p>
</div>
</div>
<div class="card mx-3" style="width: 20rem; height:21rem;">
<img
src="https://images.pexels.com/photos/1134176/pexels-photo-1134176.jpeg?auto=compress&cs=tinysrgb&w=600"
class="card-img-top" alt="..." width="15rem">
<div class="card-body">
<h5 class="card-title">Super Luxury</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the
card's content.</p>
</div>
</div>
</div>
<div class="mt-4 p-3 m-4">
<!-- <table class="table table-hover rounded-1 w-100">
<thead class="table-secondary">
<tr>
<th scope="col">HotelID</th>
<th scope="col">HotelName</th>
<th scope="col">Discount</th>
<th scope="col">hotelPrice</th>
<th scope="col">status</th>
<th scope="col">Select/Remove</th>
<!<th scope="col">NicPic</th> -->
<!-- <th scope="col">Remarks</th> -->
<!-- </tr>
</thead>
<tbody>
<tr>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
<td>@mdo</td>
<td>@mdo</td>
</tr>
</tbody>
</table> -->
<div class="d-flex pt-5 justify-content-center m-4" id="Vehicle-Details">

</div>
</div>
<div class="carousel-item">
Expand Down
6 changes: 2 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -358,18 +358,16 @@ <h6 class="text-uppercase mb-4 font-weight-bold">Follow us</h6>
<script src="Lib\bootstrap-5.3.2-dist\js\bootstrap.bundle.min.js"></script>
<script src="config\serverUrl.js"></script>
<script src="controller\TravelerRegisterController.js"></script>
<!-- <script>
<script>
// $('#login-as').change(function (e) {
// alert(e.target.value);
// });

$('#custom-package-btn').click(function () {
$('body').load('custompackage.html');
});

</script> -->
</script>
</body>

</html>

0 comments on commit 6c97543

Please sign in to comment.