Commit dec44072 authored by Mihiranga G.L.V - IT18500790's avatar Mihiranga G.L.V - IT18500790

Merge branch 'IT18500790' into 'master'

Correct final changes

See merge request !28
parents af6a5c9a a1669263
images/
.history/
\ No newline at end of file
......@@ -557,7 +557,7 @@
lineList.splice(lineIndex, 1);
lineList.splice(0, 0, lineno);
// alert(lineList);
savePredictValue(lineList);
savePredictValue(lineList, changeStationInitially);
}
}
......@@ -611,7 +611,7 @@
catList.splice(catIndex, 1);
catList.splice(0, 0, catno);
// alert(catList);
savePredictCatList(catList);
savePredictCatList(catList, changeLocationList);
}
}
......@@ -711,7 +711,7 @@
}
function savePredictValue(lineList){
function savePredictValue(lineList, callback){
let logUserid = document.getElementById(`logUserid`).value;
......@@ -729,6 +729,7 @@
if (req.status == 200) {
// alert(req.responseText);
document.getElementById(`lineDrop`).innerHTML = req.responseText;
callback();
}
}
}
......@@ -739,7 +740,7 @@
}
function savePredictCatList(catList) {
function savePredictCatList(catList, callback) {
let logUserid = document.getElementById(`logUserid`).value;
......@@ -758,6 +759,7 @@
// alert(req.responseText);
document.getElementById(`catDrop`).innerHTML = req.responseText;
saveOverAllSummary();
callback();
}
}
}
......@@ -936,6 +938,12 @@
</div>
<script>
function changeStationInitially(){
let id = document.getElementById('lineDrop').value;
changeStations(id);
}
function changeStations(id) {
var formData = new FormData();
formData.append('id', id);
......
<?php
session_start();
include "db_connect.php";
$logUserid = mysqli_real_escape_string($con,$_POST['logUserid']);
$status = 1;
$sql1 = "SELECT * FROM train_info WHERE logUserId = $logUserid ";
$result1 = mysqli_query($con, $sql1) or die(mysqli_error($con));
while($row1 = mysqli_fetch_array($result1)) {
$train_id = $row1['train_id'];
$sql2 = "SELECT * FROM select_seat_temp WHERE train_id = $train_id AND logUserId = $logUserid";
$result2 = mysqli_query($con, $sql2) or die(mysqli_error($con));
$rowcount2 = mysqli_num_rows($result2);
if($rowcount2 == 0) {
$status = 0;
break;
}
}
echo $status;
\ No newline at end of file
......@@ -29,6 +29,7 @@
$best_line = $row5['next_line'];
for($i = 1; $i <= 4; $i++ ){
$sql6 = "SELECT * FROM select_seat WHERE `train_id` = '$train_id' AND `date` = '$train_date' AND `arrival` = '$train_arrival' AND `row` = '$i' AND `seat` = '$best_line'";
$result6 = mysqli_query($con,$sql6) or die(mysqli_error($con));
$rowcount6 = mysqli_num_rows($result6);
......@@ -101,24 +102,33 @@
$result4 = mysqli_query($con,$sql4) or die(mysqli_error($con));
$rowcount4 = mysqli_num_rows($result4);
if($i == 1) {
$first = $i + 2;
} else {
$first = $first + 4;
}
if($rowcount3 == 0) {
if($rowcount4 == 0) {
?>
<button class="btn btn-primary" onclick="selectSeat('<?php echo $logUserid ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>','<?php echo $r?>','<?php echo $i ?>','no');" id="seatbtn_<?php echo $r?>_<?php echo $i ?>">1</button>
<button class="btn btn-primary" onclick="selectSeat('<?php echo $logUserid ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>','<?php echo $r?>','<?php echo $i ?>','no');" id="seatbtn_<?php echo $r?>_<?php echo $i ?>"><?php echo $first ?></button>
<?php
} else if($rowcount4 == 1) {
?>
<button class="btn btn-danger tooltip" id="seatbtn_<?php echo $r?>_<?php echo $i ?>" disabled>1 <span class="tooltiptext">Selected Seat</span></button>
<button class="btn btn-danger tooltip" id="seatbtn_<?php echo $r?>_<?php echo $i ?>" disabled><?php echo $first ?> <span class="tooltiptext">Selected Seat</span></button>
<?php
}
} else if($rowcount3 == 1) {
?>
<button class="btn btn-success" onclick="selectSeat('<?php echo $logUserid ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>','<?php echo $r?>','<?php echo $i ?>','yes');" id="seatbtn_<?php echo $r?>_<?php echo $i ?>">1</button>
<button class="btn btn-success" onclick="selectSeat('<?php echo $logUserid ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>','<?php echo $r?>','<?php echo $i ?>','yes');" id="seatbtn_<?php echo $r?>_<?php echo $i ?>"><?php echo $first ?></button>
<?php
......@@ -154,24 +164,30 @@
$result4 = mysqli_query($con,$sql4) or die(mysqli_error($con));
$rowcount4 = mysqli_num_rows($result4);
if($i == 1) {
$second = $i + 3;
} else {
$second = $second + 4;
}
if($rowcount3 == 0) {
if($rowcount4 == 0) {
?>
<button class="btn btn-primary" onclick="selectSeat('<?php echo $logUserid ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>','<?php echo $r?>','<?php echo $i ?>','no');" id="seatbtn_<?php echo $r?>_<?php echo $i ?>">1</button>
<button class="btn btn-primary" onclick="selectSeat('<?php echo $logUserid ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>','<?php echo $r?>','<?php echo $i ?>','no');" id="seatbtn_<?php echo $r?>_<?php echo $i ?>"><?php echo $second ?></button>
<?php
} else if($rowcount4 == 1) {
?>
<button class="btn btn-danger tooltip" id="seatbtn_<?php echo $r?>_<?php echo $i ?>" disabled>1 <span class="tooltiptext">Selected Seat</span></button>
<button class="btn btn-danger tooltip" id="seatbtn_<?php echo $r?>_<?php echo $i ?>" disabled><?php echo $second ?> <span class="tooltiptext">Selected Seat</span></button>
<?php
}
} else if($rowcount3 == 1) {
?>
<button class="btn btn-success" onclick="selectSeat('<?php echo $logUserid ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>','<?php echo $r?>','<?php echo $i ?>','yes');" id="seatbtn_<?php echo $r?>_<?php echo $i ?>">1</button>
<button class="btn btn-success" onclick="selectSeat('<?php echo $logUserid ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>','<?php echo $r?>','<?php echo $i ?>','yes');" id="seatbtn_<?php echo $r?>_<?php echo $i ?>"><?php echo $second ?></button>
<?php
......@@ -213,24 +229,30 @@
$result4 = mysqli_query($con,$sql4) or die(mysqli_error($con));
$rowcount4 = mysqli_num_rows($result4);
if($i == 1) {
$third = $i + 1;
} else {
$third = $third + 4;
}
if($rowcount3 == 0) {
if($rowcount4 == 0) {
?>
<button class="btn btn-primary" onclick="selectSeat('<?php echo $logUserid ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>','<?php echo $r?>','<?php echo $i ?>','no');" id="seatbtn_<?php echo $r?>_<?php echo $i ?>">1</button>
<button class="btn btn-primary" onclick="selectSeat('<?php echo $logUserid ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>','<?php echo $r?>','<?php echo $i ?>','no');" id="seatbtn_<?php echo $r?>_<?php echo $i ?>"><?php echo $third ?></button>
<?php
} else if($rowcount4 == 1) {
?>
<button class="btn btn-danger tooltip" id="seatbtn_<?php echo $r?>_<?php echo $i ?>" disabled>1 <span class="tooltiptext">Selected Seat</span></button>
<button class="btn btn-danger tooltip" id="seatbtn_<?php echo $r?>_<?php echo $i ?>" disabled><?php echo $third ?> <span class="tooltiptext">Selected Seat</span></button>
<?php
}
} else if($rowcount3 == 1) {
?>
<button class="btn btn-success" onclick="selectSeat('<?php echo $logUserid ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>','<?php echo $r?>','<?php echo $i ?>','yes');" id="seatbtn_<?php echo $r?>_<?php echo $i ?>">1</button>
<button class="btn btn-success" onclick="selectSeat('<?php echo $logUserid ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>','<?php echo $r?>','<?php echo $i ?>','yes');" id="seatbtn_<?php echo $r?>_<?php echo $i ?>"><?php echo $third ?></button>
<?php
......@@ -266,24 +288,30 @@
$result4 = mysqli_query($con,$sql4) or die(mysqli_error($con));
$rowcount4 = mysqli_num_rows($result4);
if($i == 1) {
$fourth = $i;
} else {
$fourth = $fourth + 4;
}
if($rowcount3 == 0) {
if($rowcount4 == 0) {
?>
<button class="btn btn-primary" onclick="selectSeat('<?php echo $logUserid ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>','<?php echo $r?>','<?php echo $i ?>','no');" id="seatbtn_<?php echo $r?>_<?php echo $i ?>">1</button>
<button class="btn btn-primary" onclick="selectSeat('<?php echo $logUserid ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>','<?php echo $r?>','<?php echo $i ?>','no');" id="seatbtn_<?php echo $r?>_<?php echo $i ?>"><?php echo $fourth ?></button>
<?php
} else if($rowcount4 == 1) {
?>
<button class="btn btn-danger tooltip" id="seatbtn_<?php echo $r?>_<?php echo $i ?>" disabled>1 <span class="tooltiptext">Selected Seat</span></button>
<button class="btn btn-danger tooltip" id="seatbtn_<?php echo $r?>_<?php echo $i ?>" disabled><?php echo $fourth ?> <span class="tooltiptext">Selected Seat</span></button>
<?php
}
} else if($rowcount3 == 1) {
?>
<button class="btn btn-success" onclick="selectSeat('<?php echo $logUserid ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>','<?php echo $r?>','<?php echo $i ?>','yes');" id="seatbtn_<?php echo $r?>_<?php echo $i ?>">1</button>
<button class="btn btn-success" onclick="selectSeat('<?php echo $logUserid ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>','<?php echo $r?>','<?php echo $i ?>','yes');" id="seatbtn_<?php echo $r?>_<?php echo $i ?>"><?php echo $fourth ?></button>
<?php
......
......@@ -11,6 +11,36 @@
$seat = mysqli_real_escape_string($con,$_POST['seat']);
$status = mysqli_real_escape_string($con,$_POST['status']);
if($row == 1) {
$iniSeat = 3;
if($seat == 1){
$currentSeat = $iniSeat;
} else {
$currentSeat = $iniSeat + ($seat - 1) * 4 ;
}
} else if($row == 2) {
$iniSeat = 4;
if($seat == 1){
$currentSeat = $iniSeat;
} else {
$currentSeat = $iniSeat + ($seat - 1) * 4 ;
}
} else if($row == 3) {
$iniSeat = 2;
if($seat == 1){
$currentSeat = $iniSeat;
} else {
$currentSeat = $iniSeat + ($seat - 1) * 4 ;
}
} else if($row == 4) {
$iniSeat = 1;
if($seat == 1){
$currentSeat = $iniSeat;
} else {
$currentSeat = $iniSeat + ($seat - 1) * 4 ;
}
}
$sql2 = "SELECT * FROM train_info WHERE logUserId = '$logUserid' AND train_id = '$train_id' AND train_start_station = '$train_start_station' ";
$result2 = mysqli_query($con,$sql2) or die(mysqli_error($con));
$row2 = mysqli_fetch_assoc($result2);
......@@ -32,7 +62,7 @@
if($result4){
?>
<button class="btn btn-success" onclick="selectSeat('<?php echo $logUserid ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>','<?php echo $row ?>','<?php echo $seat ?>','yes');" id="seatbtn_<?php echo $row ?>_<?php echo $seat ?>">1</button>
<button class="btn btn-success" onclick="selectSeat('<?php echo $logUserid ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>','<?php echo $row ?>','<?php echo $seat ?>','yes');" id="seatbtn_<?php echo $row ?>_<?php echo $seat ?>"><?php echo $currentSeat ?></button>
<?php
} else {
......
......@@ -11,6 +11,36 @@
$seat = mysqli_real_escape_string($con,$_POST['seat']);
$status = mysqli_real_escape_string($con,$_POST['status']);
if($row == 1) {
$iniSeat = 3;
if($seat == 1){
$currentSeat = $iniSeat;
} else {
$currentSeat = $iniSeat + ($seat - 1) * 4 ;
}
} else if($row == 2) {
$iniSeat = 4;
if($seat == 1){
$currentSeat = $iniSeat;
} else {
$currentSeat = $iniSeat + ($seat - 1) * 4 ;
}
} else if($row == 3) {
$iniSeat = 2;
if($seat == 1){
$currentSeat = $iniSeat;
} else {
$currentSeat = $iniSeat + ($seat - 1) * 4 ;
}
} else if($row == 4) {
$iniSeat = 1;
if($seat == 1){
$currentSeat = $iniSeat;
} else {
$currentSeat = $iniSeat + ($seat - 1) * 4 ;
}
}
$sql2 = "SELECT * FROM train_info WHERE logUserId = '$logUserid' AND train_id = '$train_id' AND train_start_station = '$train_start_station' ";
$result2 = mysqli_query($con,$sql2) or die(mysqli_error($con));
$row2 = mysqli_fetch_assoc($result2);
......@@ -29,7 +59,7 @@
if($result3){
?>
<button class="btn btn-primary" onclick="selectSeat('<?php echo $logUserid ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>','<?php echo $row ?>','<?php echo $seat ?>','no');" id="seatbtn_<?php echo $row ?>_<?php echo $seat ?>">1</button>
<button class="btn btn-primary" onclick="selectSeat('<?php echo $logUserid ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>','<?php echo $row ?>','<?php echo $seat ?>','no');" id="seatbtn_<?php echo $row ?>_<?php echo $seat ?>"><?php echo $currentSeat ?></button>
<?php
} else {
......
......@@ -26,9 +26,6 @@
}
?>
<option value="select">Filter By Location Category</option>
<?php
for($i = 0; $i < 6; $i++) {
$catNo = $catListArray[$i];
......
......@@ -26,9 +26,6 @@
}
?>
<option value="select">Filter By Railway Line</option>
<?php
for($i = 0; $i < 6; $i++) {
$lineNo = $lineListArray[$i];
......
<?php
session_start();
include "db_connect.php";
$logUserid = mysqli_real_escape_string($con,$_POST['logUserid']);
$sql1 = "SELECT * FROM select_seat_temp WHERE logUserId = $logUserid";
$result1 = mysqli_query($con, $sql1) or die(mysqli_error($con));
while($row1 = mysqli_fetch_array($result1)) {
$logUserid = $row1['logUserid'];
$train_id = $row1['train_id'];
$date = $row1['date'];
$arrival = $row1['arrival'];
$train_start_station = $row1['train_start_station'];
$row = $row1['row'];
$seat = $row1['seat'];
$sql2 = " INSERT INTO `select_seat`(`logUserid`, `train_id`, `date`, `arrival`, `train_start_station`, `row`, `seat`) VALUES ('$logUserid', '$train_id', '$date', '$arrival', '$train_start_station', '$row', '$seat') ";
$result2 = mysqli_query($con, $sql2) or die(mysqli_error($con));
}
\ No newline at end of file
......@@ -201,6 +201,7 @@
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {
console.log(req.responseText);
document.getElementById(`seatPlanAdd`).innerHTML = req.responseText;
$(`#train_${train_id}_${train_start_station}`).modal('show');
highlightBest(logUserid, train_id, train_start_station);
......@@ -596,7 +597,7 @@
<div class="col-md-12">
<div class="contect_btn contect_btn_contact">
<ul>
<li><a href="javascript:void(0)">Confirm Plan <i class="fa fa-arrow-right"></i></a>
<li><a href="javascript:void(0)" onclick="confirmTripPlan();">Confirm Plan <i class="fa fa-arrow-right"></i></a>
</li>
</ul>
</div>
......@@ -630,6 +631,35 @@
}
</style>
<style>
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black;
}
.tooltip .tooltiptext {
visibility: hidden;
width: 120px;
background-color: black;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
/* Position the tooltip */
position: absolute;
z-index: 1;
bottom: 100%;
left: 50%;
margin-left: -60px;
}
.tooltip:hover .tooltiptext {
visibility: visible;
}
</style>
......@@ -641,6 +671,70 @@
<?php include('common_chatbot.php'); ?>
<script>
function confirmTripPlan() {
let logUserid = document.getElementById(`logUserid`).value;
var formData = new FormData();
formData.append('logUserid', logUserid);
var req = getXmlHttpRequestObject();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {
// alert(req.responseText);
// console.log(req.responseText);
if(req.responseText.trim() == '1') {
// alert('yes');
confirmAllSeat();
} else {
Lobibox.notify('error', {
size: 'normal',
sound: false,
title: 'Oops...',
icon: 'fa fa-times-circle',
msg: 'Please select all seats.'
});
}
}
}
}
req.open("POST", 'sub_check_seat_select.php', true);
req.send(formData);
}
}
function confirmAllSeat() {
let logUserid = document.getElementById(`logUserid`).value;
var formData = new FormData();
formData.append('logUserid', logUserid);
var req = getXmlHttpRequestObject();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {
Lobibox.notify('success', {
size: 'normal',
sound: false,
title: 'Success',
icon: 'fa fa-check-circle',
msg: 'Successfully confirm your plan.'
});
}
}
}
req.open("POST", 'sub_seat_deails_to_db.php', true);
req.send(formData);
}
}
function MsgSend() {
var msg = document.getElementById("msg_value").value;
let logUserid = document.getElementById(`logUserid`).value;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment