last day

parent 70e3f6e4
<div class="x_copyr_main_wrapper float_left" style="margin-top:5%;">
<button onclick="topFunction()" id="myBtn" title="Go to top"> <i class="fa fa-arrow-up"></i></button>
<button onclick="naviFunction();" id="myBtnPlan" title="Create Plan" > <i class="fa fa-calendar"></i> </button>
<button onclick="showChat(); minimizeChat();" id="myBtnChat" title="Chatbot" > <i class="fa fa-envelope"></i> </button>
<div class="container">
<p>Copyright © 2021 SLIIT (Research Project). All rights reserved.</p>
<a href="edit_place.php">aa</a>
</div>
</div>
\ No newline at end of file
<div class="x_copyr_main_wrapper float_left" style="margin-top:5%;">
<button onclick="topFunction()" id="myBtn" title="Go to top"> <i class="fa fa-arrow-up"></i></button>
<button onclick="naviFunction();" id="myBtnPlan" title="Create Plan" > <i class="fa fa-calendar"></i> </button>
<button onclick="showChat(); minimizeChat();" id="myBtnChat" title="Chatbot" > <i class="fa fa-envelope"></i> </button>
<div class="container">
<p>Copyright © 2021 SLIIT (Research Project). All rights reserved.</p>
<!-- <a href="edit_place.php">aa</a> -->
</div>
</div>
\ No newline at end of file
<?php
session_start();
include "db_connect.php";
$logUserid = mysqli_real_escape_string($con,$_POST['logUserid']);
$chatBot = 1100;
$createToday = new DateTime('now', new DateTimeZone('Asia/Colombo'));
$date= $createToday->format('Y-m-d');
$time= $createToday->format('H:i:s');
$datetime = $date." ". $time;
$sql1 = "SELECT * FROM chat_details WHERE logUserid = $logUserid AND chatBot = $chatBot AND `date` = '$date' ORDER BY id";
$result1 = mysqli_query($con,$sql1) or die(mysqli_error($con));
while($row1 = mysqli_fetch_array($result1)){
$type = $row1['type'];
if($type == 's'){
?>
<div class="row msg_container base_sent">
<div class="col-md-10 col-xs-10" style="padding:0;">
<div class="messages msg_sent">
<p><?php echo $row1['msg']; ?></p>
<time datetime="2009-11-13T20:00">User • Today <?php echo $row1['time']; ?></time>
</div>
</div>
<div class="col-md-2 col-xs-2 avatar" style="padding:0;">
<img src="./images/chatMan.png" class="chatimg img-responsive ">
</div>
</div>
<?php
} else if ($type == 'r') {
?>
<div class="row msg_container base_receive">
<div class="col-md-2 col-xs-2 avatar" style="padding:0;">
<img src="./images/chatTrain.png" class="chatimg img-responsive ">
</div>
<div class="col-md-10 col-xs-10" style="padding:0;">
<div class="messages msg_receive">
<p><?php echo $row1['msg']; ?></p>
<time datetime="2009-11-13T20:00">Railbot • Today <?php echo $row1['time']; ?></time>
</div>
</div>
</div>
<?php
}
}
?>
\ No newline at end of file
<?php
session_start();
include "db_connect.php";
$logUserid = mysqli_real_escape_string($con,$_POST['logUserid']);
$round = 'first';
$sql1 = "SELECT * FROM user_details WHERE logUserid = '$logUserid' ";
$result1 = mysqli_query($con,$sql1) or die(mysqli_error($con));
$row1 = mysqli_fetch_assoc($result1);
// Start and end dates
$ini_start_date = $row1['start'];
$ini_end_date = $row1['end'];
$diff = abs(strtotime($ini_end_date) - strtotime($ini_start_date));
$years = floor($diff / (365*60*60*24));
$months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
$days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
// Date count
$date_count = (int) $days + 1;
$full_hours = $date_count * 11;
$line_no = array();
$sql2 = "SELECT * FROM linelist WHERE logUserid = '$logUserid' ORDER BY id ";
$result2 = mysqli_query($con,$sql2) or die(mysqli_error($con));
$rowcount2 = mysqli_num_rows($result2);
$i = 0;
while($row2 = mysqli_fetch_array($result2)) {
// Line no list
$line_no[$i] = $row2['lineNo'];
$i ++;
}
$cat_no = array();
$sql3 = "SELECT * FROM catlist WHERE logUserid = '$logUserid' ORDER BY id ";
$result3 = mysqli_query($con,$sql3) or die(mysqli_error($con));
$rowcount3 = mysqli_num_rows($result3);
$i = 0;
while($row3 = mysqli_fetch_array($result3)) {
// Category no list
$cat_no[$i] = $row3['catNo'];
$i ++;
}
$get_line_no = $line_no[0];
$cat_no_count = count($cat_no);
// $final_cat_count = $cat_no_count / 2;
$place_list = array();
for($i = 0; $i < $cat_no_count; $i++){
$get_cat_no = $cat_no[$i];
// $sql5 = "SELECT * FROM category WHERE id = '$get_cat_no' ";
// $result5 = mysqli_query($con,$sql5) or die(mysqli_error($con));
// $row5 = mysqli_fetch_assoc($result5);
// $esti_time = $row5['eTime'];
$sql4 = "SELECT * FROM places WHERE line_id = '$get_line_no' AND category_id = '$get_cat_no' ORDER BY station_id DESC ";
$result4 = mysqli_query($con,$sql4) or die(mysqli_error($con));
$rowcount4 = mysqli_num_rows($result4);
$arr_cat_name = "arr_cat".$i;
$arr_cat_name = array();
$x = 0;
while($row4 = mysqli_fetch_array($result4)) {
$arr_cat_name[$x] = $row4['id'];
$x++;
}
$place_list[$i] = $arr_cat_name;
}
// print_r($place_list);
$place_array_count = count($place_list);
$temp_full_hours = $full_hours;
$select_full_array = array();
$time_checker = 1;
$sql9 = "SELECT * FROM visitplacetemp WHERE logUserid = '$logUserid' ";
$result9 = mysqli_query($con,$sql9) or die(mysqli_error($con));
$rowcount9 = mysqli_num_rows($result9);
if($rowcount9 > 0){
$sql10 = "DELETE FROM `visitplacetemp` WHERE logUserid = '$logUserid' ";
$result10 = mysqli_query($con,$sql10) or die(mysqli_error($con));
}
for($a = 0; $a < $place_array_count; $a++){
$place_category_list = $place_list[$a];
$inner_list_count = count($place_category_list);
for($b = 0; $b < $inner_list_count; $b++) {
$pick_place = $place_category_list[$b];
$sql7 = "SELECT * FROM places WHERE id = '$pick_place'";
$result7 = mysqli_query($con,$sql7) or die(mysqli_error($con));
$row7 = mysqli_fetch_assoc($result7);
$place_cat = $row7['category_id'];
$place_station = $row7['station_id'];
$sql5 = "SELECT * FROM category WHERE id = '$place_cat' ";
$result5 = mysqli_query($con,$sql5) or die(mysqli_error($con));
$row5 = mysqli_fetch_assoc($result5);
$esti_time = $row5['eTime'];
$sql6 = "SELECT * FROM final_railway_station WHERE line = '$get_line_no' ORDER BY id DESC ";
$result6 = mysqli_query($con,$sql6) or die(mysqli_error($con));
while($row6 = mysqli_fetch_array($result6)){
$station_list_station = $row6['id'];
$station_train_no = $row6['train_no'];
if($temp_full_hours >= 0 && $temp_full_hours < 5) {
$time_checker = 0;
break;
} else {
if($place_station == $station_list_station) {
$temp_full_hours = $temp_full_hours - $esti_time;
$select_place_id = $pick_place;
$select_cat_id = $place_cat;
$select_station = $station_list_station;
$select_es_time = $esti_time;
$select_train_no = $station_train_no;
$full_array_count = count($select_full_array);
$select_array_name = "selectLoc".$full_array_count;
$select_array_name = array();
$select_array_name["placeLineNo"] = $get_line_no;
$select_array_name["placeCatId"] = $select_cat_id;
$select_array_name["placeId"] = $select_place_id;
$select_array_name["placeStation"] = $select_station;
$select_array_name["placeTrainNo"] = $select_train_no;
$select_array_name["placeEsTime"] = $select_es_time;
array_push($select_full_array,$select_array_name);
$sql8 = "INSERT INTO `visitplacetemp`(`logUserid`, `placeLineNo`, `placeCatId`, `placeId`, `placeStation`, `placeTrainNo`, `placeEsTime`) VALUES ('$logUserid', '$get_line_no', '$select_cat_id', '$select_place_id', '$select_station', '$select_train_no', '$select_es_time')";
$result8 = mysqli_query($con,$sql8) or die(mysqli_error($con));
}
}
if($time_checker = 0) {
break;
}
}
if($time_checker = 0) {
break;
}
}
if($time_checker = 0) {
break;
}
}
// print_r($select_full_array);
$sql11 = "SELECT MAX(train_no) AS firstStop FROM final_railway_station WHERE `line` = '$get_line_no' ";
$result11 = mysqli_query($con,$sql11) or die(mysqli_error($con));
$row11 = mysqli_fetch_assoc($result11);
$first_railway_stop = $row11['firstStop'];
$start_location = $first_railway_stop;
$now_line_no = $get_line_no;
$sql12 = "SELECT MIN(placeTrainNo) AS lastStop FROM visitplacetemp WHERE logUserid = '$logUserid' ";
$result12 = mysqli_query($con,$sql12) or die(mysqli_error($con));
$row12 = mysqli_fetch_assoc($result12);
$last_railway_stop = $row12['lastStop'];
$start_date = $ini_start_date;
$end_date = $ini_end_date;
$start_time = '06:00:00';
$start_date_time = $ini_start_date ." ". $start_time;
?>
<table class="table table-bordered">
<thead class="thead-light">
<tr>
<th scope="col">Start Location</th>
<th scope="col">Places</th>
<th scope="col">Train Name</th>
<th scope="col">Seat</th>
<th scope="col">Arrival Time</th>
<th scope="col"> End Location </th>
<th scope="col"> Departure Time </th>
</tr>
</thead>
<tbody>
<?php
$all_station_id_list = array();
for($d = $start_location; $d >= $last_railway_stop; $d--) {
$sql15 = "SELECT * FROM visitplacetemp WHERE placeTrainNo = '$d' AND logUserid = $logUserid ";
$result15 = mysqli_query($con,$sql15) or die(mysqli_error($con));
$rowcount15 = mysqli_num_rows($result15);
$row15 = mysqli_fetch_assoc($result15);
if($rowcount15 > 0){
$station_id = $row15['placeTrainNo'];
array_push($all_station_id_list, $station_id);
}
}
$array_call_count = 1;
for($c = $start_location; $c >= $last_railway_stop; $c--) {
$sql15 = "SELECT * FROM visitplacetemp WHERE placeTrainNo = '$c' AND logUserid = $logUserid ";
$result15 = mysqli_query($con,$sql15) or die(mysqli_error($con));
$rowcount15 = mysqli_num_rows($result15);
$row15 = mysqli_fetch_assoc($result15);
if($c == $start_location){
//Colombo fort to relevent Location
// echo $start_date_time ."<br>";
// $start_date_time = date('Y-m-d H:i:s', strtotime($start_date_time.'+15 hour'));
$sql13 = "SELECT * FROM final_railway_station WHERE `line` = $now_line_no AND `train_no` = $start_location ";
$result13 = mysqli_query($con,$sql13) or die(mysqli_error($con));
$row13 = mysqli_fetch_assoc($result13);
$colombo_train_id_list = array();
$sql14 = "SELECT * FROM train_times WHERE `lineno` = $now_line_no AND `trainno` = $start_location AND `dirId` = 'f' ORDER BY `arrival` ASC ";
$result14 = mysqli_query($con,$sql14) or die(mysqli_error($con));
while($row14 = mysqli_fetch_array($result14)){
$colombo_start_time = $row14['arrival'];
$colombo_train_id = $row14['id'];
$str_start_time = strtotime($start_time);
$str_colombo_start_time = strtotime($colombo_start_time);
if($str_start_time < $str_colombo_start_time) {
array_push($colombo_train_id_list,$colombo_train_id);
}
}
$colombo_first_train = $colombo_train_id_list[0];
$sql16 = "SELECT * FROM train_times WHERE `id` = $colombo_first_train ";
$result16 = mysqli_query($con,$sql16) or die(mysqli_error($con));
$row16 = mysqli_fetch_assoc($result16);
$sql17 = "SELECT MAX(placeTrainNo) AS colombo_to_next FROM visitplacetemp WHERE logUserid = $logUserid AND placeLineNo = $now_line_no ";
$result17 = mysqli_query($con,$sql17) or die(mysqli_error($con));
$row17 = mysqli_fetch_assoc($result17);
$colombo_train_arrival_time = $row16['arrival'];
$colombo_train_dep_time = $row16['dep'];
$colombo_train_name = $row16['trainname']; //Train name
$colombo_name = "Colombo Fort"; // Start name;
$colombo_train_arrival_date_time = $start_date ." ".$colombo_train_arrival_time; // Arrival
$colombo_train_dep_date_time = $start_date ." ".trim($colombo_train_dep_time); //Departure
$start_date_time = $colombo_train_dep_date_time;
$colombo_to_next_station = $row17['colombo_to_next'];
$sql18 = "SELECT * FROM final_railway_station WHERE train_no = $colombo_to_next_station AND `line` = $now_line_no ";
$result18 = mysqli_query($con,$sql18) or die(mysqli_error($con));
$row18 = mysqli_fetch_assoc($result18);
$colombo_to_next_station_name = $row18['name']; //Colombo to next station
$seat_plan_open_start = "train_".$colombo_first_train."_".$c;
$train_id = $colombo_first_train;
$train_name = $colombo_train_name;
$train_date = $start_date;
$train_arrival = $colombo_train_arrival_time;
$train_start_station = $c;
$logUserId = $logUserid;
$sql28 = "SELECT * FROM train_info WHERE logUserId = $logUserId ";
$result28 = mysqli_query($con,$sql28) or die(mysqli_error($con));
$row28 = mysqli_fetch_assoc($result28);
$rowcount28 = mysqli_num_rows($result28);
if($rowcount28 > 0) {
$sql29 = "DELETE FROM `train_info` WHERE logUserId = $logUserId ";
$result29 = mysqli_query($con,$sql29) or die(mysqli_error($con));
}
$sql30 = "INSERT INTO `train_info`(`train_id`, `train_name`, `train_date`, `train_arrival`, `train_start_station`, `logUserId`) VALUES ('$train_id', '$train_name', '$train_date', '$train_arrival', '$train_start_station', '$logUserId')";
$result30 = mysqli_query($con,$sql30) or die(mysqli_error($con));
?>
<tr>
<td> <?php echo $colombo_name ?> </td>
<td align="center"></td>
<td align="center"> <?php echo $colombo_train_name ?> <br> <img class="animate__animated animate__slower animate__slideInLeft animate__infinite infinite" src="images/green_train.png" style="width:40px;" alt=""> </td>
<td align="center"><button type="button" class="btn btn-primary" data-toggle="modal" data-target="#seat_<?php echo $train_id ?>_<?php echo $train_start_station ?>" onclick="createSeatDesign('<?php echo $logUserId ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>',1)">
<i style="font-size:20px;" class="material-icons">airline_seat_recline_extra</i>
</button>
</td>
<td align="center"> <?php echo str_replace(' ', '<br>', $colombo_train_arrival_date_time) ?> </td>
<td> <?php echo $colombo_to_next_station_name ?> </td>
<td align="center"> <?php echo str_replace(' ', '<br>', $colombo_train_dep_date_time) ?> </td>
</tr>
<?php
} else if($rowcount15 > 0) {
// Place to place
// echo $start_date_time ."<br>";
// $start_date_time = date('Y-m-d H:i:s', strtotime($start_date_time.'+12 hour'));
// echo $main_start_time ."<br>";
$sql13 = "SELECT * FROM final_railway_station WHERE `line` = $now_line_no AND `train_no` = $c ";
$result13 = mysqli_query($con,$sql13) or die(mysqli_error($con));
$row13 = mysqli_fetch_assoc($result13);
$location_station_name = $row13['name'];
?>
<tr>
<td> <?php echo $location_station_name ?> </td>
<td align="center"> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#first<?php echo $c ?>"> <i class='fas fa-map-marker-alt'></i> </button>
<div class="modal fade" id="first<?php echo $c ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Location List</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<table class="table table-bordered">
<thead class="thead-light">
<tr>
<th>Location</th>
<th scope="col">Category</th>
<th scope="col">Estimate Time</th>
<th scope="col">Google Map</th>
</tr>
</thead>
<tbody>
<?php
$sql19 = "SELECT * FROM visitplacetemp WHERE placeLineNo = $now_line_no AND placeTrainNo = '$c' AND logUserid = $logUserid ";
$result19 = mysqli_query($con,$sql19) or die(mysqli_error($con));
while($row19 = mysqli_fetch_array($result19)){
$station_near_by_place_id = $row19['placeId'];
$station_near_by_cat_id = $row19['placeCatId'];
$station_near_by_es_time = $row19['placeEsTime'];
$start_date_time_array = explode(" ", $start_date_time);
$start_date_only = $start_date_time_array[0];
$start_time_only = $start_date_time_array[1];
$station_near_by_es_time_new = "+".$station_near_by_es_time." hour";
$max_time = "18:00:00";
$start_time_only_new = date('H:i:s', strtotime($start_time_only.$station_near_by_es_time_new));
$start_date_only_new = $start_date_only;
$start_time_only_new_str = strtotime($start_time_only_new);
$max_time_str = strtotime($max_time);
if($start_time_only_new_str > $max_time_str) {
$start_time_only_new = "06:00:00";
$start_date_only_new = date('Y-m-d', strtotime($start_date_time.'+1 day'));
}
$start_date_time = $start_date_only_new." ".$start_time_only_new;
$sql20 = "SELECT * FROM places WHERE id = $station_near_by_place_id ";
$result20 = mysqli_query($con,$sql20) or die(mysqli_error($con));
$row20 = mysqli_fetch_assoc($result20);
$station_near_by_place_name = $row20['place_name'];
$sql21 = "SELECT * FROM category WHERE id = $station_near_by_cat_id ";
$result21 = mysqli_query($con,$sql21) or die(mysqli_error($con));
$row21 = mysqli_fetch_assoc($result21);
$station_near_by_cat_name = $row21['name'];
?>
<tr>
<td> <?php echo $station_near_by_place_name ?> </td>
<td> <?php echo $station_near_by_cat_name ?> </td>
<td> <?php echo $station_near_by_es_time . " Hours" ?></td>
<td align="center">
<button class="btn btn-primary"><i class='fas fa-map'></i></button
></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</td>
<?php
// echo $start_date_time .'<br>';
$start_date_time_array_after_trip = explode(" ", $start_date_time);
$start_date_after_trip = $start_date_time_array_after_trip[0];
$start_time_after_trip = $start_date_time_array_after_trip[1];
$max_time_after_trip = "18:00:00";
$start_time_after_trip_str = strtotime($start_time_after_trip);
$max_time_after_trip_str = strtotime($max_time_after_trip);
$sql22 = "SELECT * FROM train_times WHERE `lineno` = $now_line_no AND `trainno` = $c AND dirId = 'f' AND CAST(arrival as time) >= '06:00:00' AND CAST(arrival as time) < '18:00:00' ORDER BY arrival ";
$result22 = mysqli_query($con,$sql22) or die(mysqli_error($con));
$after_trip_train_id_list = array();
$after_trip_train_id_list_sp = array();
while($row22 = mysqli_fetch_assoc($result22)){
$after_trip_train_name = $row22['trainname'];
$after_trip_train_arrival = $row22['arrival'];
$after_trip_train_dep = $row22['dep'];
$after_trip_train_id = $row22['id'];
$after_trip_train_arrival_str = strtotime($after_trip_train_arrival);
if($after_trip_train_arrival_str > $start_time_after_trip_str) {
array_push($after_trip_train_id_list,$after_trip_train_id);
}
array_push($after_trip_train_id_list_sp,$after_trip_train_id);
}
if (empty($after_trip_train_id_list)) {
$start_time_after_trip = "06:00:00";
$start_date_after_trip = date('Y-m-d', strtotime($start_date_time.'+1 day'));
}
// print_r($after_trip_train_id_list);
// print_r($after_trip_train_id_list_sp);
// echo $c;
$this_station_count = count($all_station_id_list);
$this_location_index = array_search($c, $all_station_id_list);
$next_location_index = $this_location_index + 1;
if($this_station_count > $next_location_index) {
$next_location_station = $all_station_id_list[$next_location_index];
if (!empty($after_trip_train_id_list)) {
$selected_train_id = $after_trip_train_id_list[0];
} else {
$selected_train_id = $after_trip_train_id_list_sp[0];
}
$sql23 = "SELECT * FROM train_times WHERE id = $selected_train_id ";
$result23 = mysqli_query($con,$sql23) or die(mysqli_error($con));
$row23 = mysqli_fetch_assoc($result23);
$final_train_name = $row23['trainname']; // Train name
$final_train_arrival = $row23['arrival'];
$final_train_dep = $row23['dep'];
$final_train_arrival = trim($final_train_arrival);
$final_train_dep = trim($final_train_dep);
$final_date_and_time = explode(" ", $start_date_time);
$final_now_date = $final_date_and_time[0];
$final_now_time = $final_date_and_time[1];
$final_train_arrival_date_and_time = $final_now_date ." ".$final_train_arrival; // Train Arrival
$final_train_dep_date_and_time = $final_now_date ." ".$final_train_dep; // Train Depature
$sql24 = "SELECT * FROM final_railway_station WHERE `line` = $now_line_no AND `train_no` = $next_location_station ";
$result24 = mysqli_query($con,$sql24) or die(mysqli_error($con));
$row24 = mysqli_fetch_assoc($result24);
$next_railway_location_name = $row24['name']; // next location name
$seat_plan_open = "train_".$selected_train_id."_".$c;
$train_id = $selected_train_id;
$train_name = $final_train_name;
$train_date = $final_now_date;
$train_arrival = $final_train_arrival;
$train_start_station = $c;
$logUserId = $logUserid;
$sql30 = "INSERT INTO `train_info`(`train_id`, `train_name`, `train_date`, `train_arrival`, `train_start_station`, `logUserId`) VALUES ('$train_id', '$train_name', '$train_date', '$train_arrival', '$train_start_station', '$logUserId')";
$result30 = mysqli_query($con,$sql30) or die(mysqli_error($con));
?>
<td align="center"> <?php echo $final_train_name ?> <br> <img class="animate__animated animate__slower animate__slideInLeft animate__infinite infinite" src="images/green_train.png" style="width:40px;" alt=""> </td>
<td align="center"><button type="button" class="btn btn-primary" data-toggle="modal" data-target="#seat_<?php echo $train_id ?>_<?php echo $train_start_station ?>" onclick="createSeatDesign('<?php echo $logUserId ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>',1)">
<i style="font-size:20px;" class="material-icons">airline_seat_recline_extra</i>
</button>
</td>
<td align="center"> <?php echo str_replace(' ', '<br>', $final_train_arrival_date_and_time) ?> </td>
<td> <?php echo $next_railway_location_name ?> </td>
<td align="center"> <?php echo str_replace(' ', '<br>', $final_train_dep_date_and_time) ?> </td>
<?php
$start_date_time = $final_train_dep_date_and_time;
} else if($this_station_count == $next_location_index) {
// echo "eq";
if (empty($after_trip_train_id_list)) {
$selected_train_id = "";
}
$end_date_and_time = explode(" ", $start_date_time);
$end_now_date = $end_date_and_time[0];
$end_now_time = $end_date_and_time[1];
$end_now_time_str = strtotime($end_now_time);
$sql25 = "SELECT * FROM train_times WHERE lineno = $now_line_no AND trainno = $c AND dirId = 'b' ORDER BY arrival";
$result25 = mysqli_query($con,$sql25) or die(mysqli_error($con));
$end_trip_train_id_list = array();
$end_trip_train_id_list_sp = array();
while($row25 = mysqli_fetch_assoc($result25)){
$end_trip_train_name = $row25['trainname'];
$end_trip_train_arrival = $row25['arrival'];
$end_trip_train_dep = $row25['dep'];
$end_trip_train_id = $row25['id'];
$end_trip_train_arrival_str = strtotime($end_trip_train_arrival);
if($end_trip_train_arrival_str > $end_now_time_str) {
array_push($end_trip_train_id_list,$end_trip_train_id);
}
array_push($end_trip_train_id_list_sp,$end_trip_train_id);
}
if (empty($end_trip_train_id_list)) {
$end_now_time = "06:00:00";
$end_now_date = date('Y-m-d', strtotime($start_date_time.'+1 day'));
}
if (!empty($end_trip_train_id_list)) {
$end_selected_train_id = $end_trip_train_id_list[0];
} else {
$end_selected_train_id = $end_trip_train_id_list_sp[0];
}
$sql26 = "SELECT * FROM train_times WHERE id = $end_selected_train_id ";
$result26 = mysqli_query($con,$sql26) or die(mysqli_error($con));
$row26 = mysqli_fetch_assoc($result26);
$end_train_name = $row26['trainname']; // Train name
$end_train_arrival = $row26['arrival'];
$end_train_dep = $row26['dep'];
$end_train_arrival = trim($end_train_arrival);
$end_train_dep = trim($end_train_dep);
if($date_count < 6){
$end_train_arrival_date_and_time = $end_now_date ." ".$end_train_arrival; // Train Arrival
$end_train_dep_date_and_time = $end_now_date ." ".$end_train_dep; // Train Depature
} else {
$sql27 = "SELECT * FROM user_details WHERE logUserid = $logUserid";
$result27 = mysqli_query($con,$sql27) or die(mysqli_error($con));
$row27 = mysqli_fetch_assoc($result27);
$end_date = $row27['end'];
$end_train_arrival_date_and_time = $end_date ." ".$end_train_arrival; // Train Arrival
$end_train_dep_date_and_time = $end_date ." ".$end_train_dep; // Train Depature
}
$end_next_railway_location_name = "Colombo Fort"; // next location name
$seat_plan_open_end = "train_".$end_selected_train_id."_".$c;
$train_id = $end_selected_train_id;
$train_name = $end_train_name;
$train_date = $end_now_date;
$train_arrival = $end_train_arrival;
$train_start_station = $c;
$logUserId = $logUserid;
$sql30 = "INSERT INTO `train_info`(`train_id`, `train_name`, `train_date`, `train_arrival`, `train_start_station`, `logUserId`) VALUES ('$train_id', '$train_name', '$train_date', '$train_arrival', '$train_start_station', '$logUserId')";
$result30 = mysqli_query($con,$sql30) or die(mysqli_error($con));
?>
<td align="center"> <?php echo $end_train_name ?><br><img class="animate__animated animate__slower animate__slideInRight animate__infinite infinite" src="images/red_train.png" style="width:40px;" alt=""> </td>
<td align="center"><button type="button" class="btn btn-primary" data-toggle="modal" data-target="#seat_<?php echo $train_id ?>_<?php echo $train_start_station ?>" onclick="createSeatDesign('<?php echo $logUserId ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>',1)">
<i style="font-size:20px;" class="material-icons">airline_seat_recline_extra</i>
</button></td>
<td align="center"> <?php echo str_replace(' ', '<br>', $end_train_arrival_date_and_time) ?> </td>
<td> <?php echo $end_next_railway_location_name ?> </td>
<td align="center"> <?php echo str_replace(' ', '<br>', $end_train_dep_date_and_time) ?> </td>
<?php
}
}else {
continue;
}
}
?>
</tbody>
</table>
</div>
<?php
?>
\ No newline at end of file
<?php
session_start();
include "db_connect.php";
$logUserid = mysqli_real_escape_string($con,$_POST['logUserid']);
$round = 'first';
$sql1 = "SELECT * FROM user_details WHERE logUserid = '$logUserid' ";
$result1 = mysqli_query($con,$sql1) or die(mysqli_error($con));
$row1 = mysqli_fetch_assoc($result1);
// Start and end dates
$ini_start_date = $row1['start'];
$ini_end_date = $row1['end'];
$diff = abs(strtotime($ini_end_date) - strtotime($ini_start_date));
$years = floor($diff / (365*60*60*24));
$months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
$days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
// Date count
$date_count = (int) $days + 1;
$full_hours = $date_count * 11;
$line_no = array();
$sql2 = "SELECT * FROM linelist WHERE logUserid = '$logUserid' ORDER BY id ";
$result2 = mysqli_query($con,$sql2) or die(mysqli_error($con));
$rowcount2 = mysqli_num_rows($result2);
$i = 0;
while($row2 = mysqli_fetch_array($result2)) {
// Line no list
$line_no[$i] = $row2['lineNo'];
$i ++;
}
$cat_no = array();
$sql3 = "SELECT * FROM catlist WHERE logUserid = '$logUserid' ORDER BY id ";
$result3 = mysqli_query($con,$sql3) or die(mysqli_error($con));
$rowcount3 = mysqli_num_rows($result3);
$i = 0;
while($row3 = mysqli_fetch_array($result3)) {
// Category no list
$cat_no[$i] = $row3['catNo'];
$i ++;
}
$get_line_no = $line_no[0];
$cat_no_count = count($cat_no);
// $final_cat_count = $cat_no_count / 2;
$place_list = array();
for($i = 0; $i < $cat_no_count; $i++){
$get_cat_no = $cat_no[$i];
// $sql5 = "SELECT * FROM category WHERE id = '$get_cat_no' ";
// $result5 = mysqli_query($con,$sql5) or die(mysqli_error($con));
// $row5 = mysqli_fetch_assoc($result5);
// $esti_time = $row5['eTime'];
$sql4 = "SELECT * FROM places WHERE line_id = '$get_line_no' AND category_id = '$get_cat_no' ORDER BY station_id DESC ";
$result4 = mysqli_query($con,$sql4) or die(mysqli_error($con));
$rowcount4 = mysqli_num_rows($result4);
$arr_cat_name = "arr_cat".$i;
$arr_cat_name = array();
$x = 0;
while($row4 = mysqli_fetch_array($result4)) {
$arr_cat_name[$x] = $row4['id'];
$x++;
}
$place_list[$i] = $arr_cat_name;
}
// print_r($place_list);
$place_array_count = count($place_list);
$temp_full_hours = $full_hours;
$select_full_array = array();
$time_checker = 1;
$sql9 = "SELECT * FROM visitplacetemp WHERE logUserid = '$logUserid' ";
$result9 = mysqli_query($con,$sql9) or die(mysqli_error($con));
$rowcount9 = mysqli_num_rows($result9);
if($rowcount9 > 0){
$sql10 = "DELETE FROM `visitplacetemp` WHERE logUserid = '$logUserid' ";
$result10 = mysqli_query($con,$sql10) or die(mysqli_error($con));
}
for($a = 0; $a < $place_array_count; $a++){
$place_category_list = $place_list[$a];
$inner_list_count = count($place_category_list);
for($b = 0; $b < $inner_list_count; $b++) {
$pick_place = $place_category_list[$b];
$sql7 = "SELECT * FROM places WHERE id = '$pick_place'";
$result7 = mysqli_query($con,$sql7) or die(mysqli_error($con));
$row7 = mysqli_fetch_assoc($result7);
$place_cat = $row7['category_id'];
$place_station = $row7['station_id'];
$sql5 = "SELECT * FROM category WHERE id = '$place_cat' ";
$result5 = mysqli_query($con,$sql5) or die(mysqli_error($con));
$row5 = mysqli_fetch_assoc($result5);
$esti_time = $row5['eTime'];
$sql6 = "SELECT * FROM final_railway_station WHERE line = '$get_line_no' ORDER BY id DESC ";
$result6 = mysqli_query($con,$sql6) or die(mysqli_error($con));
while($row6 = mysqli_fetch_array($result6)){
$station_list_station = $row6['id'];
$station_train_no = $row6['train_no'];
if($temp_full_hours >= 0 && $temp_full_hours < 5) {
$time_checker = 0;
break;
} else {
if($place_station == $station_list_station) {
$temp_full_hours = $temp_full_hours - $esti_time;
$select_place_id = $pick_place;
$select_cat_id = $place_cat;
$select_station = $station_list_station;
$select_es_time = $esti_time;
$select_train_no = $station_train_no;
$full_array_count = count($select_full_array);
$select_array_name = "selectLoc".$full_array_count;
$select_array_name = array();
$select_array_name["placeLineNo"] = $get_line_no;
$select_array_name["placeCatId"] = $select_cat_id;
$select_array_name["placeId"] = $select_place_id;
$select_array_name["placeStation"] = $select_station;
$select_array_name["placeTrainNo"] = $select_train_no;
$select_array_name["placeEsTime"] = $select_es_time;
array_push($select_full_array,$select_array_name);
$sql8 = "INSERT INTO `visitplacetemp`(`logUserid`, `placeLineNo`, `placeCatId`, `placeId`, `placeStation`, `placeTrainNo`, `placeEsTime`) VALUES ('$logUserid', '$get_line_no', '$select_cat_id', '$select_place_id', '$select_station', '$select_train_no', '$select_es_time')";
$result8 = mysqli_query($con,$sql8) or die(mysqli_error($con));
}
}
if($time_checker = 0) {
break;
}
}
if($time_checker = 0) {
break;
}
}
if($time_checker = 0) {
break;
}
}
// print_r($select_full_array);
$sql11 = "SELECT MAX(train_no) AS firstStop FROM final_railway_station WHERE `line` = '$get_line_no' ";
$result11 = mysqli_query($con,$sql11) or die(mysqli_error($con));
$row11 = mysqli_fetch_assoc($result11);
$first_railway_stop = $row11['firstStop'];
$start_location = $first_railway_stop;
$now_line_no = $get_line_no;
$sql12 = "SELECT MIN(placeTrainNo) AS lastStop FROM visitplacetemp WHERE logUserid = '$logUserid' ";
$result12 = mysqli_query($con,$sql12) or die(mysqli_error($con));
$row12 = mysqli_fetch_assoc($result12);
$last_railway_stop = $row12['lastStop'];
$start_date = $ini_start_date;
$end_date = $ini_end_date;
$start_time = '06:00:00';
$start_date_time = $ini_start_date ." ". $start_time;
?>
<table class="table table-bordered">
<thead class="thead-light">
<tr>
<th scope="col">Start Location</th>
<th scope="col">Places</th>
<th scope="col">Train Name</th>
<th scope="col">Seat</th>
<th scope="col">Arrival Time</th>
<th scope="col"> End Location </th>
<th scope="col"> Departure Time </th>
</tr>
</thead>
<tbody>
<?php
$all_station_id_list = array();
for($d = $start_location; $d >= $last_railway_stop; $d--) {
$sql15 = "SELECT * FROM visitplacetemp WHERE placeTrainNo = '$d' AND logUserid = $logUserid ";
$result15 = mysqli_query($con,$sql15) or die(mysqli_error($con));
$rowcount15 = mysqli_num_rows($result15);
$row15 = mysqli_fetch_assoc($result15);
if($rowcount15 > 0){
$station_id = $row15['placeTrainNo'];
array_push($all_station_id_list, $station_id);
}
}
$array_call_count = 1;
for($c = $start_location; $c >= $last_railway_stop; $c--) {
$sql15 = "SELECT * FROM visitplacetemp WHERE placeTrainNo = '$c' AND logUserid = $logUserid ";
$result15 = mysqli_query($con,$sql15) or die(mysqli_error($con));
$rowcount15 = mysqli_num_rows($result15);
$row15 = mysqli_fetch_assoc($result15);
if($c == $start_location){
//Colombo fort to relevent Location
// echo $start_date_time ."<br>";
// $start_date_time = date('Y-m-d H:i:s', strtotime($start_date_time.'+15 hour'));
$sql13 = "SELECT * FROM final_railway_station WHERE `line` = $now_line_no AND `train_no` = $start_location ";
$result13 = mysqli_query($con,$sql13) or die(mysqli_error($con));
$row13 = mysqli_fetch_assoc($result13);
$colombo_train_id_list = array();
$sql14 = "SELECT * FROM train_times WHERE `lineno` = $now_line_no AND `trainno` = $start_location AND `dirId` = 'f' ORDER BY `arrival` ASC ";
$result14 = mysqli_query($con,$sql14) or die(mysqli_error($con));
while($row14 = mysqli_fetch_array($result14)){
$colombo_start_time = $row14['arrival'];
$colombo_train_id = $row14['id'];
$str_start_time = strtotime($start_time);
$str_colombo_start_time = strtotime($colombo_start_time);
if($str_start_time < $str_colombo_start_time) {
array_push($colombo_train_id_list,$colombo_train_id);
}
}
$colombo_first_train = $colombo_train_id_list[0];
$sql16 = "SELECT * FROM train_times WHERE `id` = $colombo_first_train ";
$result16 = mysqli_query($con,$sql16) or die(mysqli_error($con));
$row16 = mysqli_fetch_assoc($result16);
$sql17 = "SELECT MAX(placeTrainNo) AS colombo_to_next FROM visitplacetemp WHERE logUserid = $logUserid AND placeLineNo = $now_line_no ";
$result17 = mysqli_query($con,$sql17) or die(mysqli_error($con));
$row17 = mysqli_fetch_assoc($result17);
$colombo_train_arrival_time = $row16['arrival'];
$colombo_train_dep_time = $row16['dep'];
$colombo_train_name = $row16['trainname']; //Train name
$colombo_name = "Colombo Fort"; // Start name;
$colombo_train_arrival_date_time = $start_date ." ".$colombo_train_arrival_time; // Arrival
$colombo_train_dep_date_time = $start_date ." ".trim($colombo_train_dep_time); //Departure
$start_date_time = $colombo_train_dep_date_time;
$colombo_to_next_station = $row17['colombo_to_next'];
$sql18 = "SELECT * FROM final_railway_station WHERE train_no = $colombo_to_next_station AND `line` = $now_line_no ";
$result18 = mysqli_query($con,$sql18) or die(mysqli_error($con));
$row18 = mysqli_fetch_assoc($result18);
$colombo_to_next_station_name = $row18['name']; //Colombo to next station
$seat_plan_open_start = "train_".$colombo_first_train."_".$c;
$train_id = $colombo_first_train;
$train_name = $colombo_train_name;
$train_date = $start_date;
$train_arrival = $colombo_train_arrival_time;
$train_start_station = $c;
$logUserId = $logUserid;
$sql28 = "SELECT * FROM train_info WHERE logUserId = $logUserId ";
$result28 = mysqli_query($con,$sql28) or die(mysqli_error($con));
$row28 = mysqli_fetch_assoc($result28);
$rowcount28 = mysqli_num_rows($result28);
if($rowcount28 > 0) {
$sql29 = "DELETE FROM `train_info` WHERE logUserId = $logUserId ";
$result29 = mysqli_query($con,$sql29) or die(mysqli_error($con));
}
$sql30 = "INSERT INTO `train_info`(`train_id`, `train_name`, `train_date`, `train_arrival`, `train_start_station`, `logUserId`) VALUES ('$train_id', '$train_name', '$train_date', '$train_arrival', '$train_start_station', '$logUserId')";
$result30 = mysqli_query($con,$sql30) or die(mysqli_error($con));
?>
<tr>
<td> <?php echo $colombo_name ?> </td>
<td align="center"></td>
<td align="center"> <?php echo $colombo_train_name ?> <br> <img class="animate__animated animate__slower animate__slideInLeft animate__infinite infinite" src="images/green_train.png" style="width:40px;" alt=""> </td>
<td align="center"><button type="button" class="btn btn-primary" data-toggle="modal" data-target="#seat_<?php echo $train_id ?>_<?php echo $train_start_station ?>" onclick="createSeatDesign('<?php echo $logUserId ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>',1)">
<i style="font-size:20px;" class="material-icons">airline_seat_recline_extra</i>
</button>
</td>
<td align="center"> <?php echo str_replace(' ', '<br>', $colombo_train_arrival_date_time) ?> </td>
<td> <?php echo $colombo_to_next_station_name ?> </td>
<td align="center"> <?php echo str_replace(' ', '<br>', $colombo_train_dep_date_time) ?> </td>
</tr>
<?php
} else if($rowcount15 > 0) {
// Place to place
// echo $start_date_time ."<br>";
// $start_date_time = date('Y-m-d H:i:s', strtotime($start_date_time.'+12 hour'));
// echo $main_start_time ."<br>";
$sql13 = "SELECT * FROM final_railway_station WHERE `line` = $now_line_no AND `train_no` = $c ";
$result13 = mysqli_query($con,$sql13) or die(mysqli_error($con));
$row13 = mysqli_fetch_assoc($result13);
$location_station_name = $row13['name'];
?>
<tr>
<td> <?php echo $location_station_name ?> </td>
<td align="center"> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#first<?php echo $c ?>"> <i class='fas fa-map-marker-alt'></i> </button>
<div class="modal fade" id="first<?php echo $c ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Location List</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<table class="table table-bordered">
<thead class="thead-light">
<tr>
<th>Location</th>
<th scope="col">Category</th>
<th scope="col">Estimate Time</th>
<th scope="col">Google Map</th>
</tr>
</thead>
<tbody>
<?php
$sql19 = "SELECT * FROM visitplacetemp WHERE placeLineNo = $now_line_no AND placeTrainNo = '$c' AND logUserid = $logUserid ";
$result19 = mysqli_query($con,$sql19) or die(mysqli_error($con));
while($row19 = mysqli_fetch_array($result19)){
$station_near_by_place_id = $row19['placeId'];
$station_near_by_cat_id = $row19['placeCatId'];
$station_near_by_es_time = $row19['placeEsTime'];
$start_date_time_array = explode(" ", $start_date_time);
$start_date_only = $start_date_time_array[0];
$start_time_only = $start_date_time_array[1];
$station_near_by_es_time_new = "+".$station_near_by_es_time." hour";
$max_time = "18:00:00";
$start_time_only_new = date('H:i:s', strtotime($start_time_only.$station_near_by_es_time_new));
$start_date_only_new = $start_date_only;
$start_time_only_new_str = strtotime($start_time_only_new);
$max_time_str = strtotime($max_time);
if($start_time_only_new_str > $max_time_str) {
$start_time_only_new = "06:00:00";
$start_date_only_new = date('Y-m-d', strtotime($start_date_time.'+1 day'));
}
$start_date_time = $start_date_only_new." ".$start_time_only_new;
$sql20 = "SELECT * FROM places WHERE id = $station_near_by_place_id ";
$result20 = mysqli_query($con,$sql20) or die(mysqli_error($con));
$row20 = mysqli_fetch_assoc($result20);
$station_near_by_place_name = $row20['place_name'];
$sql21 = "SELECT * FROM category WHERE id = $station_near_by_cat_id ";
$result21 = mysqli_query($con,$sql21) or die(mysqli_error($con));
$row21 = mysqli_fetch_assoc($result21);
$station_near_by_cat_name = $row21['name'];
?>
<tr>
<td> <?php echo $station_near_by_place_name ?> </td>
<td> <?php echo $station_near_by_cat_name ?> </td>
<td> <?php echo $station_near_by_es_time . " Hours" ?></td>
<td align="center">
<button class="btn btn-primary"><i class='fas fa-map'></i></button
></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</td>
<?php
// echo $start_date_time .'<br>';
$start_date_time_array_after_trip = explode(" ", $start_date_time);
$start_date_after_trip = $start_date_time_array_after_trip[0];
$start_time_after_trip = $start_date_time_array_after_trip[1];
$max_time_after_trip = "18:00:00";
$start_time_after_trip_str = strtotime($start_time_after_trip);
$max_time_after_trip_str = strtotime($max_time_after_trip);
$sql22 = "SELECT * FROM train_times WHERE `lineno` = $now_line_no AND `trainno` = $c AND dirId = 'f' AND CAST(arrival as time) >= '06:00:00' AND CAST(arrival as time) < '18:00:00' ORDER BY arrival ";
$result22 = mysqli_query($con,$sql22) or die(mysqli_error($con));
$after_trip_train_id_list = array();
$after_trip_train_id_list_sp = array();
while($row22 = mysqli_fetch_assoc($result22)){
$after_trip_train_name = $row22['trainname'];
$after_trip_train_arrival = $row22['arrival'];
$after_trip_train_dep = $row22['dep'];
$after_trip_train_id = $row22['id'];
$after_trip_train_arrival_str = strtotime($after_trip_train_arrival);
if($after_trip_train_arrival_str > $start_time_after_trip_str) {
array_push($after_trip_train_id_list,$after_trip_train_id);
}
array_push($after_trip_train_id_list_sp,$after_trip_train_id);
}
if (empty($after_trip_train_id_list)) {
$start_time_after_trip = "06:00:00";
$start_date_after_trip = date('Y-m-d', strtotime($start_date_time.'+1 day'));
}
// print_r($after_trip_train_id_list);
// print_r($after_trip_train_id_list_sp);
// echo $c;
$this_station_count = count($all_station_id_list);
$this_location_index = array_search($c, $all_station_id_list);
$next_location_index = $this_location_index + 1;
if($this_station_count > $next_location_index) {
$next_location_station = $all_station_id_list[$next_location_index];
if (!empty($after_trip_train_id_list)) {
$selected_train_id = $after_trip_train_id_list[0];
} else {
$selected_train_id = $after_trip_train_id_list_sp[0];
}
$sql23 = "SELECT * FROM train_times WHERE id = $selected_train_id ";
$result23 = mysqli_query($con,$sql23) or die(mysqli_error($con));
$row23 = mysqli_fetch_assoc($result23);
$final_train_name = $row23['trainname']; // Train name
$final_train_arrival = $row23['arrival'];
$final_train_dep = $row23['dep'];
$final_train_arrival = trim($final_train_arrival);
$final_train_dep = trim($final_train_dep);
$final_date_and_time = explode(" ", $start_date_time);
$final_now_date = $final_date_and_time[0];
$final_now_time = $final_date_and_time[1];
$final_train_arrival_date_and_time = $final_now_date ." ".$final_train_arrival; // Train Arrival
$final_train_dep_date_and_time = $final_now_date ." ".$final_train_dep; // Train Depature
$sql24 = "SELECT * FROM final_railway_station WHERE `line` = $now_line_no AND `train_no` = $next_location_station ";
$result24 = mysqli_query($con,$sql24) or die(mysqli_error($con));
$row24 = mysqli_fetch_assoc($result24);
$next_railway_location_name = $row24['name']; // next location name
$seat_plan_open = "train_".$selected_train_id."_".$c;
$train_id = $selected_train_id;
$train_name = $final_train_name;
$train_date = $final_now_date;
$train_arrival = $final_train_arrival;
$train_start_station = $c;
$logUserId = $logUserid;
$sql30 = "INSERT INTO `train_info`(`train_id`, `train_name`, `train_date`, `train_arrival`, `train_start_station`, `logUserId`) VALUES ('$train_id', '$train_name', '$train_date', '$train_arrival', '$train_start_station', '$logUserId')";
$result30 = mysqli_query($con,$sql30) or die(mysqli_error($con));
?>
<td align="center"> <?php echo $final_train_name ?> <br> <img class="animate__animated animate__slower animate__slideInLeft animate__infinite infinite" src="images/green_train.png" style="width:40px;" alt=""> </td>
<td align="center"><button type="button" class="btn btn-primary" data-toggle="modal" data-target="#seat_<?php echo $train_id ?>_<?php echo $train_start_station ?>" onclick="createSeatDesign('<?php echo $logUserId ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>',1)">
<i style="font-size:20px;" class="material-icons">airline_seat_recline_extra</i>
</button>
</td>
<td align="center"> <?php echo str_replace(' ', '<br>', $final_train_arrival_date_and_time) ?> </td>
<td> <?php echo $next_railway_location_name ?> </td>
<td align="center"> <?php echo str_replace(' ', '<br>', $final_train_dep_date_and_time) ?> </td>
<?php
$start_date_time = $final_train_dep_date_and_time;
} else if($this_station_count == $next_location_index) {
// echo "eq";
if (empty($after_trip_train_id_list)) {
$selected_train_id = "";
}
$end_date_and_time = explode(" ", $start_date_time);
$end_now_date = $end_date_and_time[0];
$end_now_time = $end_date_and_time[1];
$end_now_time_str = strtotime($end_now_time);
$sql25 = "SELECT * FROM train_times WHERE lineno = $now_line_no AND trainno = $c AND dirId = 'b' ORDER BY arrival";
$result25 = mysqli_query($con,$sql25) or die(mysqli_error($con));
$end_trip_train_id_list = array();
$end_trip_train_id_list_sp = array();
while($row25 = mysqli_fetch_assoc($result25)){
$end_trip_train_name = $row25['trainname'];
$end_trip_train_arrival = $row25['arrival'];
$end_trip_train_dep = $row25['dep'];
$end_trip_train_id = $row25['id'];
$end_trip_train_arrival_str = strtotime($end_trip_train_arrival);
if($end_trip_train_arrival_str > $end_now_time_str) {
array_push($end_trip_train_id_list,$end_trip_train_id);
}
array_push($end_trip_train_id_list_sp,$end_trip_train_id);
}
if (empty($end_trip_train_id_list)) {
$end_now_time = "06:00:00";
$end_now_date = date('Y-m-d', strtotime($start_date_time.'+1 day'));
}
if (!empty($end_trip_train_id_list)) {
$end_selected_train_id = $end_trip_train_id_list[0];
} else {
$end_selected_train_id = $end_trip_train_id_list_sp[0];
}
$sql26 = "SELECT * FROM train_times WHERE id = $end_selected_train_id ";
$result26 = mysqli_query($con,$sql26) or die(mysqli_error($con));
$row26 = mysqli_fetch_assoc($result26);
$end_train_name = $row26['trainname']; // Train name
$end_train_arrival = $row26['arrival'];
$end_train_dep = $row26['dep'];
$end_train_arrival = trim($end_train_arrival);
$end_train_dep = trim($end_train_dep);
if($date_count < 3){
$end_train_arrival_date_and_time = $end_now_date ." ".$end_train_arrival; // Train Arrival
$end_train_dep_date_and_time = $end_now_date ." ".$end_train_dep; // Train Depature
} else {
$sql27 = "SELECT * FROM user_details WHERE logUserid = $logUserid";
$result27 = mysqli_query($con,$sql27) or die(mysqli_error($con));
$row27 = mysqli_fetch_assoc($result27);
$end_date = $row27['end'];
$end_train_arrival_date_and_time = $end_date ." ".$end_train_arrival; // Train Arrival
$end_train_dep_date_and_time = $end_date ." ".$end_train_dep; // Train Depature
}
$end_next_railway_location_name = "Colombo Fort"; // next location name
$seat_plan_open_end = "train_".$end_selected_train_id."_".$c;
$train_id = $end_selected_train_id;
$train_name = $end_train_name;
$train_date = $end_now_date;
$train_arrival = $end_train_arrival;
$train_start_station = $c;
$logUserId = $logUserid;
$sql30 = "INSERT INTO `train_info`(`train_id`, `train_name`, `train_date`, `train_arrival`, `train_start_station`, `logUserId`) VALUES ('$train_id', '$train_name', '$train_date', '$train_arrival', '$train_start_station', '$logUserId')";
$result30 = mysqli_query($con,$sql30) or die(mysqli_error($con));
?>
<td align="center"> <?php echo $end_train_name ?><br><img class="animate__animated animate__slower animate__slideInRight animate__infinite infinite" src="images/red_train.png" style="width:40px;" alt=""> </td>
<td align="center"><button type="button" class="btn btn-primary" data-toggle="modal" data-target="#seat_<?php echo $train_id ?>_<?php echo $train_start_station ?>" onclick="createSeatDesign('<?php echo $logUserId ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>',1)">
<i style="font-size:20px;" class="material-icons">airline_seat_recline_extra</i>
</button></td>
<td align="center"> <?php echo str_replace(' ', '<br>', $end_train_arrival_date_and_time) ?> </td>
<td> <?php echo $end_next_railway_location_name ?> </td>
<td align="center"> <?php echo str_replace(' ', '<br>', $end_train_dep_date_and_time) ?> </td>
<?php
}
}else {
continue;
}
}
?>
</tbody>
</table>
</div>
<?php
?>
\ No newline at end of file
<?php
session_start();
include "db_connect.php";
$logUserid = mysqli_real_escape_string($con,$_POST['logUserid']);
$round = 'first';
$sql1 = "SELECT * FROM user_details WHERE logUserid = '$logUserid' ";
$result1 = mysqli_query($con,$sql1) or die(mysqli_error($con));
$row1 = mysqli_fetch_assoc($result1);
// Start and end dates
$ini_start_date = $row1['start'];
$ini_end_date = $row1['end'];
$diff = abs(strtotime($ini_end_date) - strtotime($ini_start_date));
$years = floor($diff / (365*60*60*24));
$months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
$days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
// Date count
$date_count = (int) $days + 1;
$full_hours = $date_count * 11;
$line_no = array();
$sql2 = "SELECT * FROM linelist WHERE logUserid = '$logUserid' ORDER BY id ";
$result2 = mysqli_query($con,$sql2) or die(mysqli_error($con));
$rowcount2 = mysqli_num_rows($result2);
$i = 0;
while($row2 = mysqli_fetch_array($result2)) {
// Line no list
$line_no[$i] = $row2['lineNo'];
$i ++;
}
$cat_no = array();
$sql3 = "SELECT * FROM catlist WHERE logUserid = '$logUserid' ORDER BY id ";
$result3 = mysqli_query($con,$sql3) or die(mysqli_error($con));
$rowcount3 = mysqli_num_rows($result3);
$i = 0;
while($row3 = mysqli_fetch_array($result3)) {
// Category no list
$cat_no[$i] = $row3['catNo'];
$i ++;
}
$get_line_no = $line_no[0];
$cat_no_count = count($cat_no);
// $final_cat_count = $cat_no_count / 2;
$place_list = array();
for($i = 0; $i < $cat_no_count; $i++){
$get_cat_no = $cat_no[$i];
// $sql5 = "SELECT * FROM category WHERE id = '$get_cat_no' ";
// $result5 = mysqli_query($con,$sql5) or die(mysqli_error($con));
// $row5 = mysqli_fetch_assoc($result5);
// $esti_time = $row5['eTime'];
$sql4 = "SELECT * FROM places WHERE line_id = '$get_line_no' AND category_id = '$get_cat_no' ORDER BY station_id DESC ";
$result4 = mysqli_query($con,$sql4) or die(mysqli_error($con));
$rowcount4 = mysqli_num_rows($result4);
$arr_cat_name = "arr_cat".$i;
$arr_cat_name = array();
$x = 0;
while($row4 = mysqli_fetch_array($result4)) {
$arr_cat_name[$x] = $row4['id'];
$x++;
}
$place_list[$i] = $arr_cat_name;
}
// print_r($place_list);
$place_array_count = count($place_list);
$temp_full_hours = $full_hours;
$select_full_array = array();
$time_checker = 1;
$sql9 = "SELECT * FROM visitplacetemp WHERE logUserid = '$logUserid' ";
$result9 = mysqli_query($con,$sql9) or die(mysqli_error($con));
$rowcount9 = mysqli_num_rows($result9);
if($rowcount9 > 0){
$sql10 = "DELETE FROM `visitplacetemp` WHERE logUserid = '$logUserid' ";
$result10 = mysqli_query($con,$sql10) or die(mysqli_error($con));
}
for($a = 0; $a < $place_array_count; $a++){
$place_category_list = $place_list[$a];
$inner_list_count = count($place_category_list);
for($b = 0; $b < $inner_list_count; $b++) {
$pick_place = $place_category_list[$b];
$sql7 = "SELECT * FROM places WHERE id = '$pick_place'";
$result7 = mysqli_query($con,$sql7) or die(mysqli_error($con));
$row7 = mysqli_fetch_assoc($result7);
$place_cat = $row7['category_id'];
$place_station = $row7['station_id'];
$sql5 = "SELECT * FROM category WHERE id = '$place_cat' ";
$result5 = mysqli_query($con,$sql5) or die(mysqli_error($con));
$row5 = mysqli_fetch_assoc($result5);
$esti_time = $row5['eTime'];
$sql6 = "SELECT * FROM final_railway_station WHERE line = '$get_line_no' ORDER BY id DESC ";
$result6 = mysqli_query($con,$sql6) or die(mysqli_error($con));
while($row6 = mysqli_fetch_array($result6)){
$station_list_station = $row6['id'];
$station_train_no = $row6['train_no'];
if($temp_full_hours >= 0 && $temp_full_hours < 5) {
$time_checker = 0;
break;
} else {
if($place_station == $station_list_station) {
$temp_full_hours = $temp_full_hours - $esti_time;
$select_place_id = $pick_place;
$select_cat_id = $place_cat;
$select_station = $station_list_station;
$select_es_time = $esti_time;
$select_train_no = $station_train_no;
$full_array_count = count($select_full_array);
$select_array_name = "selectLoc".$full_array_count;
$select_array_name = array();
$select_array_name["placeLineNo"] = $get_line_no;
$select_array_name["placeCatId"] = $select_cat_id;
$select_array_name["placeId"] = $select_place_id;
$select_array_name["placeStation"] = $select_station;
$select_array_name["placeTrainNo"] = $select_train_no;
$select_array_name["placeEsTime"] = $select_es_time;
array_push($select_full_array,$select_array_name);
$sql8 = "INSERT INTO `visitplacetemp`(`logUserid`, `placeLineNo`, `placeCatId`, `placeId`, `placeStation`, `placeTrainNo`, `placeEsTime`) VALUES ('$logUserid', '$get_line_no', '$select_cat_id', '$select_place_id', '$select_station', '$select_train_no', '$select_es_time')";
$result8 = mysqli_query($con,$sql8) or die(mysqli_error($con));
}
}
if($time_checker = 0) {
break;
}
}
if($time_checker = 0) {
break;
}
}
if($time_checker = 0) {
break;
}
}
// print_r($select_full_array);
$sql11 = "SELECT MAX(train_no) AS firstStop FROM final_railway_station WHERE `line` = '$get_line_no' ";
$result11 = mysqli_query($con,$sql11) or die(mysqli_error($con));
$row11 = mysqli_fetch_assoc($result11);
$first_railway_stop = $row11['firstStop'];
$start_location = $first_railway_stop;
$now_line_no = $get_line_no;
$sql12 = "SELECT MIN(placeTrainNo) AS lastStop FROM visitplacetemp WHERE logUserid = '$logUserid' ";
$result12 = mysqli_query($con,$sql12) or die(mysqli_error($con));
$row12 = mysqli_fetch_assoc($result12);
$last_railway_stop = $row12['lastStop'];
$start_date = $ini_start_date;
$end_date = $ini_end_date;
$start_time = '06:00:00';
$start_date_time = $ini_start_date ." ". $start_time;
?>
<table class="table table-bordered">
<thead class="thead-light">
<tr>
<th scope="col">Start Location</th>
<th scope="col">Places</th>
<th scope="col">Train Name</th>
<th scope="col">Seat</th>
<th scope="col">Arrival Time</th>
<th scope="col"> End Location </th>
<th scope="col"> Departure Time </th>
</tr>
</thead>
<tbody>
<?php
$all_station_id_list = array();
for($d = $start_location; $d >= $last_railway_stop; $d--) {
$sql15 = "SELECT * FROM visitplacetemp WHERE placeTrainNo = '$d' AND logUserid = $logUserid ";
$result15 = mysqli_query($con,$sql15) or die(mysqli_error($con));
$rowcount15 = mysqli_num_rows($result15);
$row15 = mysqli_fetch_assoc($result15);
if($rowcount15 > 0){
$station_id = $row15['placeTrainNo'];
array_push($all_station_id_list, $station_id);
}
}
$array_call_count = 1;
for($c = $start_location; $c >= $last_railway_stop; $c--) {
$sql15 = "SELECT * FROM visitplacetemp WHERE placeTrainNo = '$c' AND logUserid = $logUserid ";
$result15 = mysqli_query($con,$sql15) or die(mysqli_error($con));
$rowcount15 = mysqli_num_rows($result15);
$row15 = mysqli_fetch_assoc($result15);
if($c == $start_location){
//Colombo fort to relevent Location
// echo $start_date_time ."<br>";
// $start_date_time = date('Y-m-d H:i:s', strtotime($start_date_time.'+15 hour'));
$sql13 = "SELECT * FROM final_railway_station WHERE `line` = $now_line_no AND `train_no` = $start_location ";
$result13 = mysqli_query($con,$sql13) or die(mysqli_error($con));
$row13 = mysqli_fetch_assoc($result13);
$colombo_train_id_list = array();
$sql14 = "SELECT * FROM train_times WHERE `lineno` = $now_line_no AND `trainno` = $start_location AND `dirId` = 'f' ORDER BY `arrival` ASC ";
$result14 = mysqli_query($con,$sql14) or die(mysqli_error($con));
while($row14 = mysqli_fetch_array($result14)){
$colombo_start_time = $row14['arrival'];
$colombo_train_id = $row14['id'];
$str_start_time = strtotime($start_time);
$str_colombo_start_time = strtotime($colombo_start_time);
if($str_start_time < $str_colombo_start_time) {
array_push($colombo_train_id_list,$colombo_train_id);
}
}
$colombo_first_train = $colombo_train_id_list[0];
$sql16 = "SELECT * FROM train_times WHERE `id` = $colombo_first_train ";
$result16 = mysqli_query($con,$sql16) or die(mysqli_error($con));
$row16 = mysqli_fetch_assoc($result16);
$sql17 = "SELECT MAX(placeTrainNo) AS colombo_to_next FROM visitplacetemp WHERE logUserid = $logUserid AND placeLineNo = $now_line_no ";
$result17 = mysqli_query($con,$sql17) or die(mysqli_error($con));
$row17 = mysqli_fetch_assoc($result17);
$colombo_train_arrival_time = $row16['arrival'];
$colombo_train_dep_time = $row16['dep'];
$colombo_train_name = $row16['trainname']; //Train name
$colombo_name = "Colombo Fort"; // Start name;
$colombo_train_arrival_date_time = $start_date ." ".$colombo_train_arrival_time; // Arrival
$colombo_train_dep_date_time = $start_date ." ".trim($colombo_train_dep_time); //Departure
$start_date_time = $colombo_train_dep_date_time;
$colombo_to_next_station = $row17['colombo_to_next'];
$sql18 = "SELECT * FROM final_railway_station WHERE train_no = $colombo_to_next_station AND `line` = $now_line_no ";
$result18 = mysqli_query($con,$sql18) or die(mysqli_error($con));
$row18 = mysqli_fetch_assoc($result18);
$colombo_to_next_station_name = $row18['name']; //Colombo to next station
$seat_plan_open_start = "train_".$colombo_first_train."_".$c;
$train_id = $colombo_first_train;
$train_name = $colombo_train_name;
$train_date = $start_date;
$train_arrival = $colombo_train_arrival_time;
$train_start_station = $c;
$logUserId = $logUserid;
$sql28 = "SELECT * FROM train_info WHERE logUserId = $logUserId ";
$result28 = mysqli_query($con,$sql28) or die(mysqli_error($con));
$row28 = mysqli_fetch_assoc($result28);
$rowcount28 = mysqli_num_rows($result28);
if($rowcount28 > 0) {
$sql29 = "DELETE FROM `train_info` WHERE logUserId = $logUserId ";
$result29 = mysqli_query($con,$sql29) or die(mysqli_error($con));
}
$sql30 = "INSERT INTO `train_info`(`train_id`, `train_name`, `train_date`, `train_arrival`, `train_start_station`, `logUserId`) VALUES ('$train_id', '$train_name', '$train_date', '$train_arrival', '$train_start_station', '$logUserId')";
$result30 = mysqli_query($con,$sql30) or die(mysqli_error($con));
?>
<tr>
<td> <?php echo $colombo_name ?> </td>
<td align="center"></td>
<td align="center"> <?php echo $colombo_train_name ?> <br> <img class="animate__animated animate__slower animate__slideInLeft animate__infinite infinite" src="images/green_train.png" style="width:40px;" alt=""> </td>
<td align="center"><button type="button" class="btn btn-primary" data-toggle="modal" data-target="#seat_<?php echo $train_id ?>_<?php echo $train_start_station ?>" onclick="createSeatDesign('<?php echo $logUserId ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>',1)">
<i style="font-size:20px;" class="material-icons">airline_seat_recline_extra</i>
</button>
</td>
<td align="center"> <?php echo str_replace(' ', '<br>', $colombo_train_arrival_date_time) ?> </td>
<td> <?php echo $colombo_to_next_station_name ?> </td>
<td align="center"> <?php echo str_replace(' ', '<br>', $colombo_train_dep_date_time) ?> </td>
</tr>
<?php
} else if($rowcount15 > 0) {
// Place to place
// echo $start_date_time ."<br>";
// $start_date_time = date('Y-m-d H:i:s', strtotime($start_date_time.'+12 hour'));
// echo $main_start_time ."<br>";
$sql13 = "SELECT * FROM final_railway_station WHERE `line` = $now_line_no AND `train_no` = $c ";
$result13 = mysqli_query($con,$sql13) or die(mysqli_error($con));
$row13 = mysqli_fetch_assoc($result13);
$location_station_name = $row13['name'];
?>
<tr>
<td> <?php echo $location_station_name ?> </td>
<td align="center"> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#first<?php echo $c ?>"> <i class='fas fa-map-marker-alt'></i> </button>
<div class="modal fade" id="first<?php echo $c ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Location List</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<table class="table table-bordered">
<thead class="thead-light">
<tr>
<th>Location</th>
<th scope="col">Category</th>
<th scope="col">Estimate Time</th>
<th scope="col">Google Map</th>
</tr>
</thead>
<tbody>
<?php
$sql19 = "SELECT * FROM visitplacetemp WHERE placeLineNo = $now_line_no AND placeTrainNo = '$c' AND logUserid = $logUserid ";
$result19 = mysqli_query($con,$sql19) or die(mysqli_error($con));
while($row19 = mysqli_fetch_array($result19)){
$station_near_by_place_id = $row19['placeId'];
$station_near_by_cat_id = $row19['placeCatId'];
$station_near_by_es_time = $row19['placeEsTime'];
$start_date_time_array = explode(" ", $start_date_time);
$start_date_only = $start_date_time_array[0];
$start_time_only = $start_date_time_array[1];
$station_near_by_es_time_new = "+".$station_near_by_es_time." hour";
$max_time = "18:00:00";
$start_time_only_new = date('H:i:s', strtotime($start_time_only.$station_near_by_es_time_new));
$start_date_only_new = $start_date_only;
$start_time_only_new_str = strtotime($start_time_only_new);
$max_time_str = strtotime($max_time);
if($start_time_only_new_str > $max_time_str) {
$start_time_only_new = "06:00:00";
$start_date_only_new = date('Y-m-d', strtotime($start_date_time.'+1 day'));
}
$start_date_time = $start_date_only_new." ".$start_time_only_new;
$sql20 = "SELECT * FROM places WHERE id = $station_near_by_place_id ";
$result20 = mysqli_query($con,$sql20) or die(mysqli_error($con));
$row20 = mysqli_fetch_assoc($result20);
$station_near_by_place_name = $row20['place_name'];
$sql21 = "SELECT * FROM category WHERE id = $station_near_by_cat_id ";
$result21 = mysqli_query($con,$sql21) or die(mysqli_error($con));
$row21 = mysqli_fetch_assoc($result21);
$station_near_by_cat_name = $row21['name'];
?>
<tr>
<td> <?php echo $station_near_by_place_name ?> </td>
<td> <?php echo $station_near_by_cat_name ?> </td>
<td> <?php echo $station_near_by_es_time . " Hours" ?></td>
<td align="center">
<button class="btn btn-primary"><i class='fas fa-map'></i></button
></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</td>
<?php
// echo $start_date_time .'<br>';
$start_date_time_array_after_trip = explode(" ", $start_date_time);
$start_date_after_trip = $start_date_time_array_after_trip[0];
$start_time_after_trip = $start_date_time_array_after_trip[1];
$max_time_after_trip = "18:00:00";
$start_time_after_trip_str = strtotime($start_time_after_trip);
$max_time_after_trip_str = strtotime($max_time_after_trip);
$sql22 = "SELECT * FROM train_times WHERE `lineno` = $now_line_no AND `trainno` = $c AND dirId = 'f' AND CAST(arrival as time) >= '06:00:00' AND CAST(arrival as time) < '18:00:00' ORDER BY arrival ";
$result22 = mysqli_query($con,$sql22) or die(mysqli_error($con));
$after_trip_train_id_list = array();
$after_trip_train_id_list_sp = array();
while($row22 = mysqli_fetch_assoc($result22)){
$after_trip_train_name = $row22['trainname'];
$after_trip_train_arrival = $row22['arrival'];
$after_trip_train_dep = $row22['dep'];
$after_trip_train_id = $row22['id'];
$after_trip_train_arrival_str = strtotime($after_trip_train_arrival);
if($after_trip_train_arrival_str > $start_time_after_trip_str) {
array_push($after_trip_train_id_list,$after_trip_train_id);
}
array_push($after_trip_train_id_list_sp,$after_trip_train_id);
}
if (empty($after_trip_train_id_list)) {
$start_time_after_trip = "06:00:00";
$start_date_after_trip = date('Y-m-d', strtotime($start_date_time.'+1 day'));
}
// print_r($after_trip_train_id_list);
// print_r($after_trip_train_id_list_sp);
// echo $c;
$this_station_count = count($all_station_id_list);
$this_location_index = array_search($c, $all_station_id_list);
$next_location_index = $this_location_index + 1;
if($this_station_count > $next_location_index) {
$next_location_station = $all_station_id_list[$next_location_index];
if (!empty($after_trip_train_id_list)) {
$selected_train_id = $after_trip_train_id_list[0];
} else {
$selected_train_id = $after_trip_train_id_list_sp[0];
}
$sql23 = "SELECT * FROM train_times WHERE id = $selected_train_id ";
$result23 = mysqli_query($con,$sql23) or die(mysqli_error($con));
$row23 = mysqli_fetch_assoc($result23);
$final_train_name = $row23['trainname']; // Train name
$final_train_arrival = $row23['arrival'];
$final_train_dep = $row23['dep'];
$final_train_arrival = trim($final_train_arrival);
$final_train_dep = trim($final_train_dep);
$final_date_and_time = explode(" ", $start_date_time);
$final_now_date = $final_date_and_time[0];
$final_now_time = $final_date_and_time[1];
$final_train_arrival_date_and_time = $final_now_date ." ".$final_train_arrival; // Train Arrival
$final_train_dep_date_and_time = $final_now_date ." ".$final_train_dep; // Train Depature
$sql24 = "SELECT * FROM final_railway_station WHERE `line` = $now_line_no AND `train_no` = $next_location_station ";
$result24 = mysqli_query($con,$sql24) or die(mysqli_error($con));
$row24 = mysqli_fetch_assoc($result24);
$next_railway_location_name = $row24['name']; // next location name
$seat_plan_open = "train_".$selected_train_id."_".$c;
$train_id = $selected_train_id;
$train_name = $final_train_name;
$train_date = $final_now_date;
$train_arrival = $final_train_arrival;
$train_start_station = $c;
$logUserId = $logUserid;
$sql30 = "INSERT INTO `train_info`(`train_id`, `train_name`, `train_date`, `train_arrival`, `train_start_station`, `logUserId`) VALUES ('$train_id', '$train_name', '$train_date', '$train_arrival', '$train_start_station', '$logUserId')";
$result30 = mysqli_query($con,$sql30) or die(mysqli_error($con));
?>
<td align="center"> <?php echo $final_train_name ?> <br> <img class="animate__animated animate__slower animate__slideInLeft animate__infinite infinite" src="images/green_train.png" style="width:40px;" alt=""> </td>
<td align="center"><button type="button" class="btn btn-primary" data-toggle="modal" data-target="#seat_<?php echo $train_id ?>_<?php echo $train_start_station ?>" onclick="createSeatDesign('<?php echo $logUserId ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>',1)">
<i style="font-size:20px;" class="material-icons">airline_seat_recline_extra</i>
</button>
</td>
<td align="center"> <?php echo str_replace(' ', '<br>', $final_train_arrival_date_and_time) ?> </td>
<td> <?php echo $next_railway_location_name ?> </td>
<td align="center"> <?php echo str_replace(' ', '<br>', $final_train_dep_date_and_time) ?> </td>
<?php
$start_date_time = $final_train_dep_date_and_time;
} else if($this_station_count == $next_location_index) {
// echo "eq";
if (empty($after_trip_train_id_list)) {
$selected_train_id = "";
}
$end_date_and_time = explode(" ", $start_date_time);
$end_now_date = $end_date_and_time[0];
$end_now_time = $end_date_and_time[1];
$end_now_time_str = strtotime($end_now_time);
$sql25 = "SELECT * FROM train_times WHERE lineno = $now_line_no AND trainno = $c AND dirId = 'b' ORDER BY arrival";
$result25 = mysqli_query($con,$sql25) or die(mysqli_error($con));
$end_trip_train_id_list = array();
$end_trip_train_id_list_sp = array();
while($row25 = mysqli_fetch_assoc($result25)){
$end_trip_train_name = $row25['trainname'];
$end_trip_train_arrival = $row25['arrival'];
$end_trip_train_dep = $row25['dep'];
$end_trip_train_id = $row25['id'];
$end_trip_train_arrival_str = strtotime($end_trip_train_arrival);
if($end_trip_train_arrival_str > $end_now_time_str) {
array_push($end_trip_train_id_list,$end_trip_train_id);
}
array_push($end_trip_train_id_list_sp,$end_trip_train_id);
}
if (empty($end_trip_train_id_list)) {
$end_now_time = "06:00:00";
$end_now_date = date('Y-m-d', strtotime($start_date_time.'+1 day'));
}
if (!empty($end_trip_train_id_list)) {
$end_selected_train_id = $end_trip_train_id_list[0];
} else {
$end_selected_train_id = $end_trip_train_id_list_sp[0];
}
$sql26 = "SELECT * FROM train_times WHERE id = $end_selected_train_id ";
$result26 = mysqli_query($con,$sql26) or die(mysqli_error($con));
$row26 = mysqli_fetch_assoc($result26);
$end_train_name = $row26['trainname']; // Train name
$end_train_arrival = $row26['arrival'];
$end_train_dep = $row26['dep'];
$end_train_arrival = trim($end_train_arrival);
$end_train_dep = trim($end_train_dep);
if($date_count < 3){
$end_train_arrival_date_and_time = $end_now_date ." ".$end_train_arrival; // Train Arrival
$end_train_dep_date_and_time = $end_now_date ." ".$end_train_dep; // Train Depature
} else {
$sql27 = "SELECT * FROM user_details WHERE logUserid = $logUserid";
$result27 = mysqli_query($con,$sql27) or die(mysqli_error($con));
$row27 = mysqli_fetch_assoc($result27);
$end_date = $row27['end'];
$end_train_arrival_date_and_time = $end_date ." ".$end_train_arrival; // Train Arrival
$end_train_dep_date_and_time = $end_date ." ".$end_train_dep; // Train Depature
}
$end_next_railway_location_name = "Colombo Fort"; // next location name
$seat_plan_open_end = "train_".$end_selected_train_id."_".$c;
$train_id = $end_selected_train_id;
$train_name = $end_train_name;
$train_date = $end_now_date;
$train_arrival = $end_train_arrival;
$train_start_station = $c;
$logUserId = $logUserid;
$sql30 = "INSERT INTO `train_info`(`train_id`, `train_name`, `train_date`, `train_arrival`, `train_start_station`, `logUserId`) VALUES ('$train_id', '$train_name', '$train_date', '$train_arrival', '$train_start_station', '$logUserId')";
$result30 = mysqli_query($con,$sql30) or die(mysqli_error($con));
?>
<td align="center"> <?php echo $end_train_name ?><br><img class="animate__animated animate__slower animate__slideInRight animate__infinite infinite" src="images/red_train.png" style="width:40px;" alt=""> </td>
<td align="center"><button type="button" class="btn btn-primary" data-toggle="modal" data-target="#seat_<?php echo $train_id ?>_<?php echo $train_start_station ?>" onclick="createSeatDesign('<?php echo $logUserId ?>','<?php echo $train_id ?>','<?php echo $train_start_station ?>',1)">
<i style="font-size:20px;" class="material-icons">airline_seat_recline_extra</i>
</button></td>
<td align="center"> <?php echo str_replace(' ', '<br>', $end_train_arrival_date_and_time) ?> </td>
<td> <?php echo $end_next_railway_location_name ?> </td>
<td align="center"> <?php echo str_replace(' ', '<br>', $end_train_dep_date_and_time) ?> </td>
<?php
}
}else {
continue;
}
}
?>
</tbody>
</table>
</div>
<?php
?>
\ No newline at end of file
<?php
include "db_connect.php";
if(isset($_POST['logUserid'])){
$logUserid = $_POST['logUserid'];
} else {
header("Location: (index.php)");
}
?>
<!DOCTYPE html>
<html lang="zxx">
<!--[endif]-->
<!-- Mirrored from xdemos.space/xpedia/car_checkout.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 30 Jun 2021 08:26:21 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head>
<meta charset="utf-8" />
<title>User-Friendly Railway </title>
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<meta name="MobileOptimized" content="320" />
<!--Template style -->
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"
/>
<link rel="stylesheet" type="text/css" href="css/xpedia.css" />
<style type="text/css">
#myBtn {
display: none;
position: fixed;
bottom: 20px;
right: 30px;
z-index: 99;
font-size: 18px;
border: none;
outline: none;
background-color: #4f5dec;
color: white;
cursor: pointer;
padding: 15px;
border-radius: 10px;
}
#myBtnChat:hover {
background-color: #ffffff;
color: #4f5dec;
border: 1px solid #4f5dec;
}
#myBtnChat {
display: none;
position: fixed;
bottom: 90px;
right: 30px;
z-index: 99;
font-size: 18px;
border: none;
outline: none;
background-color: #4f5dec;
color: white;
cursor: pointer;
padding: 15px;
border-radius: 10px;
}
#myBtn:hover {
background-color: #ffffff;
color: #4f5dec;
border: 1px solid #4f5dec;
}
#myBtnPlan:hover {
background-color: #ffffff;
color: #4f5dec;
border: 1px solid #4f5dec;
}
#myBtnPlan {
display: none;
position: fixed;
bottom: 90px;
right: 30px;
z-index: 99;
font-size: 18px;
border: none;
outline: none;
background-color: #4f5dec;
color: white;
cursor: pointer;
padding: 15px;
border-radius: 10px;
}
</style>
<script>
function getXmlHttpRequestObject() {
if (window.XMLHttpRequest) {
return new XMLHttpRequest();
}
else if(window.ActiveXObject) {
return new ActiveXObject("Microsoft.XMLHTTP");
}else {
}
}
</script>
</head>
<body onload="loadFun(); createTripPlan();">
<div id="subform"></div>
<?php include('common_header.php'); ?>
<script>
function createTripPlan(){
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);
document.getElementById(`collapseOne`).innerHTML = req.responseText;
changeLineName();
deleteSeatDetails(logUserid);
}
}
}
req.open("POST", 'sub_trip_planned_create_trip_plan.php', true);
req.send(formData);
}
}
function deleteSeatDetails(logUserid) {
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);
}
}
}
req.open("POST", 'sub_delete_all_seat_details.php', true);
req.send(formData);
}
}
function changeLineName(){
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);
document.getElementById(`lineNameSec`).innerHTML = req.responseText;
}
}
}
req.open("POST", 'sub_change_line_name.php', true);
req.send(formData);
}
}
function createSeatDesign(logUserid, train_id, train_start_station, seat_design){
logUserid = logUserid;
train_id = train_id;
train_start_station = train_start_station;
seat_design = seat_design;
var formData = new FormData();
formData.append('logUserid', logUserid);
formData.append('train_id', train_id);
formData.append('train_start_station', train_start_station);
formData.append('seat_design', seat_design);
var req = getXmlHttpRequestObject();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {
document.getElementById(`seatPlanAdd`).innerHTML = req.responseText;
$(`#train_${train_id}_${train_start_station}`).modal('show');
highlightBest(logUserid, train_id, train_start_station);
}
}
}
req.open("POST", 'sub_design_seat.php', true);
req.send(formData);
}
}
function selectSeat(logUserid, train_id, train_start_station, row, seat, status) {
var formData = new FormData();
formData.append('logUserid', logUserid);
formData.append('train_id', train_id);
formData.append('train_start_station', train_start_station);
formData.append('row', row);
formData.append('seat', seat);
formData.append('status', status);
if(status == 'no') {
var req = getXmlHttpRequestObject();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {
document.getElementById(`div_${row}_${seat}`).innerHTML = req.responseText;
highlightBest(logUserid, train_id, train_start_station);
}
}
}
req.open("POST", 'sub_design_seat_add_to_temp.php', true);
req.send(formData);
}
} else if(status == 'yes') {
var req = getXmlHttpRequestObject();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {
// alert(req.responseText);
document.getElementById(`div_${row}_${seat}`).innerHTML = req.responseText;
highlightBest(logUserid, train_id, train_start_station);
}
}
}
req.open("POST", 'sub_design_seat_remove_from_temp.php', true);
req.send(formData);
}
}
}
function highlightBest(logUserid, train_id, train_start_station) {
var formData = new FormData();
formData.append('logUserid', logUserid);
formData.append('train_id', train_id);
formData.append('train_start_station', train_start_station);
var req = getXmlHttpRequestObject();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {
var bestButton = document.getElementById(req.responseText);
bestButton.classList.add('animate__animated', 'animate__heartBeat', 'animate__infinite', 'slow');
}
}
}
req.open("POST", 'sub_check_best_seat.php', true);
req.send(formData);
}
}
</script>
<!-- hs Navigation End -->
<!-- btc tittle Wrapper Start -->
<div class="btc_tittle_main_wrapper">
<div class="btc_tittle_img_overlay"></div>
<div class="container">
<div class="row">
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 col-12 full_width">
<div class="btc_tittle_left_heading">
<h1>Custom Trip Plan</h1>
</div>
</div>
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 col-12 full_width">
<div class="btc_tittle_right_heading">
<div class="btc_tittle_right_cont_wrapper">
<ul>
<li><a href="#">Home</a> <i class="fa fa-angle-right"></i>
</li>
<li>Custom Trip Plan</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- btc tittle Wrapper End -->
<!-- x tittle num Wrapper Start -->
<div class="x_title_num_mian_Wrapper float_left">
<div class="container">
<div class="x_title_inner_num_wrapper float_left">
<div class="x_title_num_heading">
<h3>Create Custom Trip Plan</h3>
<p>Complete Your Step</p>
</div>
<div class="x_title_num_heading_cont">
<div class="x_title_num_main_box_wrapper">
<div class="x_icon_num">
<p>1</p>
</div>
<h5>Fill Details</h5>
</div>
<div class="x_title_num_main_box_wrapper">
<div class="x_icon_num ">
<p>2</p>
</div>
<h5>Select Location</h5>
</div>
<div class="x_title_num_main_box_wrapper">
<div class="x_icon_num">
<p>3</p>
</div>
<h5>Create plan</h5>
</div>
<div class="x_title_num_main_box_wrapper">
<div class="x_icon_num">
<p>4</p>
</div>
<h5>customize Plan</h5>
</div>
<div class="x_title_num_main_box_wrapper x_title_num_main_box_wrapper3 x_title_num_main_box_wrapper_last">
<div class="x_icon_num">
<p>5</p>
</div>
<h5>done!</h5>
</div>
</div>
</div>
</div>
</div>
<!-- x tittle num Wrapper End -->
<!-- x car book sidebar section Wrapper Start -->
<div class="x_car_book_sider_main_Wrapper float_left">
<div class="container" >
<div class="row">
<div class="col-xl-3 col-lg-4 col-md-12 col-sm-12 col-12">
<div class="x_car_book_left_siderbar_wrapper float_left">
<div class="row">
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
<div class="x_slider_form_main_wrapper float_left x_slider_form_main_wrapper_ccb">
<div class="x_slider_form_heading_wrapper x_slider_form_heading_wrapper_carbooking float_left">
<h3>Let’s Create perfect Trip</h3>
</div>
<input type="text" value="<?php echo $logUserid ?>" id="logUserid" hidden>
<div class="row">
<div class="col-md-12">
<div class="x_slider_form_input_wrapper float_left">
<h3>Railway Line</h3>
<div class="x_slider_select" style="width: 100%; margin-top: 0px;">
<select class="myselect form-control" onchange="setToLine(this.value);">
<?php
$sql1 = "SELECT * FROM linelist WHERE logUserid = $logUserid ORDER BY `priority` ASC";
$result1 = mysqli_query($con,$sql1) or die(mysqli_error($con));
while($row1 = mysqli_fetch_array($result1)){
$slected_line_no = $row1['lineNo'];
$sql2 = "SELECT * FROM railway_line WHERE id = $slected_line_no";
$result2 = mysqli_query($con,$sql2) or die(mysqli_error($con));
$row2 = mysqli_fetch_assoc($result2)
?>
<option value="<?php echo $row2['id'] ?>"><?php echo $row2['line'] ?></option>
<?php
}
?>
</select>
</div>
</div>
</div>
<div class="col-md-12">
<div class="x_slider_form_input_wrapper float_left">
<h3>Location Category</h3>
<div class="x_slider_select" style="width: 100%; margin-top: 0px;">
<select class="myselect form-control" onchange="setToCat(this.value)">
<?php
$sql3 = "SELECT * FROM catlist WHERE logUserid = $logUserid ORDER BY `priority` ASC";
$result3 = mysqli_query($con,$sql3) or die(mysqli_error($con));
while($row3 = mysqli_fetch_array($result3)){
$selected_cat_id = $row3['catNo'];
$sql4 = "SELECT * FROM category WHERE id = '$selected_cat_id' ";
$result4 = mysqli_query($con,$sql4) or die(mysqli_error($con));
$row4 = mysqli_fetch_assoc($result4)
?>
<option value="<?php echo $row4['id'] ?>"><?php echo $row4['name'] ?></option>
<?php
}
?>
</select>
</div>
</div>
</div>
<div class="col-md-12">
<div class="form-sec-header">
<h3>Start Date</h3>
<?php
$sql5 = "SELECT * FROM user_details WHERE logUserid = $logUserid";
$result5 = mysqli_query($con,$sql5) or die(mysqli_error($con));
$row5 = mysqli_fetch_assoc($result5);
?>
<label class="cal-icon">
<input type="text" id="startTime" onchange="changeTime();" value="<?php echo $row5['start'] ?>" placeholder="Start Date" class="form-control datepicker" readonly>
</label>
</div>
</div>
<div class="col-md-12">
<div class="form-sec-header">
<h3>End Date</h3>
<label class="cal-icon">
<input type="text" id="endTime" onchange="changeTime();" value="<?php echo $row5['end'] ?>" placeholder="End Date" class="form-control datepicker" readonly>
</label>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
function changeTime() {
let logUserid = document.getElementById(`logUserid`).value;
let startTime = document.getElementById(`startTime`).value;
let endTime = document.getElementById(`endTime`).value;
var formData = new FormData();
formData.append('logUserid', logUserid);
formData.append('startTime', startTime);
formData.append('endTime', endTime);
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 == 1) {
createTripPlan();
}
// createTripPlan();
}
}
}
req.open("POST", 'sub_update_date.php', true);
req.send(formData);
}
}
function setToCat(value) {
let logUserid = document.getElementById(`logUserid`).value;
let catDropValue = value;
var formData = new FormData();
formData.append('logUserid', logUserid);
formData.append('catDropValue', catDropValue);
var req = getXmlHttpRequestObject();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {
// alert(req.responseText);
// console.log(req.responseText);
createTripPlan();
}
}
}
req.open("POST", 'sub_arrange_cat.php', true);
req.send(formData);
}
}
function setToLine(value){
let logUserid = document.getElementById(`logUserid`).value;
let lineDropValue = value;
var formData = new FormData();
formData.append('logUserid', logUserid);
formData.append('lineDropValue', lineDropValue);
var req = getXmlHttpRequestObject();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {
createTripPlan();
}
}
}
req.open("POST", 'sub_arrange_line.php', true);
req.send(formData);
}
}
</script>
<div class="col-xl-9 col-lg-8 col-md-12 col-sm-12 col-12">
<div class="x_carbooking_right_section_wrapper float_left">
<div class="row">
<div class="col-md-12">
<div class="x_car_checkout_right_main_box_wrapper float_left">
<div class="car-filter order-billing margin-top-0">
<div class="heading-block text-left margin-bottom-0">
<h4>Trip Details</h4>
</div>
<hr>
<!-- <form class="billing-form">
<ul class="list-unstyled row">
<li class="col-md-6">
<label>First Name *
<input type="text" placeholder="" class="form-control">
</label>
</li>
<li class="col-md-6">
<label>Last Name *
<input type="text" placeholder="" class="form-control">
</label>
</li>
<li class="col-md-6">
<label>NIC / Passport
<input type="text" placeholder="" class="form-control">
</label>
</li>
<li class="col-md-6">
<label>Passengers
<input type="text" placeholder="" class="form-control">
</label>
</li>
</form> -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<div class="accordion" id="accordionExample" style="width: 100%; ">
<div class="card">
<div class="card-header" id="headingOne" style="background-color: #4f5dec;">
<h2 class="mb-0" >
<button style="color: #ffffff;" class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
Best Trip Plan - <b> <span id="lineNameSec"> Main Line </span></b>
</button>
</h2>
</div>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordionExample">
<!-- Content Add -->
<!-- Content Add -->
<!-- Content Add -->
<!-- Content Add -->
<!-- Content Add -->
</div>
</div>
</div>
</div>
</div>
</div>
<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>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- x car book sidebar section Wrapper End -->
<!-- Button trigger modal -->
<div id="seatPlanAdd">
</div>
<style>
.btn-link:hover, .btn-link, .btn-link:focus{
text-decoration:none;
}
</style>
<?php include('common_footer.php'); ?>
<?php include('common_chatbot.php'); ?>
<script>
function MsgSend() {
var msg = document.getElementById("msg_value").value;
let logUserid = document.getElementById(`logUserid`).value;
var req = getXmlHttpRequestObject();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {
// alert(req.responseText);
if(req.responseText == 1){
document.getElementById("msg_value").value = "";
}
refreshChat(logUserid);
}
}
}
req.open("GET", 'chat.php?&msg='+msg+'&logUserid='+logUserid, true);
req.send();
}
}
function refreshChat(logUserid){
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);
document.getElementById(`messagebody`).innerHTML = req.responseText;
var msgbody = document.getElementById('messagebody');
msgbody.scrollTop = msgbody.scrollHeight - msgbody.clientHeight;
}
}
}
req.open("POST", 'sub_refresh_chat.php', true);
req.send(formData);
}
}
</script>
<script>
function minimizeChat() {
if(document.getElementById('messagebody').style.display == 'block' && document.getElementById('inputSec').style.display == 'block') {
document.getElementById('messagebody').style.display = 'none';
document.getElementById('inputSec').style.display = 'none';
} else {
document.getElementById('messagebody').style.display = 'block';
document.getElementById('inputSec').style.display = 'block';
}
}
function closeChat() {
$( "#chatbox" ).hide();
}
function showChat() {
$( "#chatbox" ).show();
}
function loadFun(){
document.getElementById('messagebody').style.display = 'none';
document.getElementById('inputSec').style.display = 'none';
}
</script>
<style>
.panel{
margin-bottom: 0px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}
.chat-window{
bottom:0;
right:5%;
position:fixed;
float:right;
}
.chat-window > div > .panel{
border-radius: 5px 5px 0 0;
}
.icon_minim{
padding:2px 10px;
}
.msg_container_base{
background: #e5e5e5;
margin: 0;
padding: 0 10px 10px;
max-height:300px;
overflow-x:hidden;
}
.top-bar {
background: #4f5dec;
color: white;
padding: 10px;
position: relative;
overflow: hidden;
}
.msg_receive{
padding-left:0;
margin-left:0;
}
.msg_sent{
padding-bottom:20px !important;
margin-right:0;
}
.messages {
background: white;
padding: 10px;
border-radius: 2px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
max-width:100%;
}
.messages > p {
font-size: 13px;
margin: 0 0 0.2rem 0;
}
.messages > time {
font-size: 11px;
color: #ccc;
}
.msg_container {
padding: 10px;
overflow: hidden;
display: flex;
}
.chatimg {
display: block;
width: 100%;
}
.avatar {
position: relative;
}
.base_receive > .avatar:after {
content: "";
position: absolute;
top: 0;
right: 0;
width: 0;
height: 0;
border: 5px solid #FFF;
border-left-color: rgba(0, 0, 0, 0);
border-bottom-color: rgba(0, 0, 0, 0);
}
.base_sent {
justify-content: flex-end;
align-items: flex-end;
}
.base_sent > .avatar:after {
content: "";
position: absolute;
bottom: 0;
left: 0;
width: 0;
height: 0;
border: 5px solid white;
border-right-color: transparent;
border-top-color: transparent;
box-shadow: 1px 1px 2px rgba(black, 0.2); // not quite perfect but close
}
.msg_sent > time{
float: right;
}
.msg_container_base::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
background-color: #F5F5F5;
}
.msg_container_base::-webkit-scrollbar
{
width: 12px;
background-color: #F5F5F5;
}
.msg_container_base::-webkit-scrollbar-thumb
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
background-color: #555;
}
.btn-group.dropup{
position:fixed;
left:0px;
bottom:0;
}
.panel-footer {
padding: 10px 15px;
background-color: #a5abf3;
border-top: 1px solid #ddd;
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px;
}
</style>
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/modernizr.js"></script>
<script src="js/select2.min.js"></script>
<script src="js/jquery.menu-aim.js"></script>
<script src="js/jquery-ui.js"></script>
<script src="js/jquery.nice-select.min.js"></script>
<script src="js/owl.carousel.js"></script>
<!-- <script src="js/own-menu.js"></script> -->
<script src="js/jquery.bxslider.min.js"></script>
<script src="js/jquery.magnific-popup.js"></script>
<script src="js/xpedia.js"></script>
<!-- custom js-->
<link href="https://cdn.jsdelivr.net/npm/lobibox@1.2.7/dist/css/lobibox.css" rel="stylesheet" />
<!-- <script src="https://cdn.jsdelivr.net/npm/lobibox@1.2.7/lib/jquery.1.11.js"></script> -->
<script src="https://cdn.jsdelivr.net/npm/lobibox@1.2.7/dist/js/lobibox.min.js"></script>
<script src='https://kit.fontawesome.com/a076d05399.js' crossorigin='anonymous'></script>
</body>
<script>
//Get the button
var mybutton = document.getElementById("myBtn");
var mybuttonchat = document.getElementById("myBtnChat");
// When the user scrolls down 20px from the top of the document, show the button
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
mybutton.style.display = "block";
mybuttonchat.style.display = "block";
} else {
mybutton.style.display = "none";
mybuttonchat.style.display = "none";
}
}
// When the user clicks on the button, scroll to the top of the document
function topFunction() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}
function naviFunction() {
window.location.href = "train_planned.html";
}
function naviHome() {
window.location.href = "index.php";
}
function naviFunction() {
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);
if(req.responseText == 1) {
var subform = document.getElementById('subform');
var form = document.createElement("form");
form.method = 'POST';
form.action = 'train_planned.php';
var input1 = document.createElement('input');
input1.type = "hidden";
input1.name = "logUserid";
input1.value = logUserid;
form.appendChild(input1);
subform.appendChild(form);
form.submit();
} else {
Lobibox.notify('error', {
size: 'normal',
sound: false,
title: 'Cannot access...',
icon: 'fa fa-times-circle',
msg: 'Please fill your details before create trip plan.'
});
}
}
}
}
req.open("POST", 'sub_check_user_submit_details.php', true);
req.send(formData);
}
}
</script>
<!-- Mirrored from xdemos.space/xpedia/car_checkout.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 30 Jun 2021 08:26:21 GMT -->
</html>
\ No newline at end of file
<?php
include "db_connect.php";
if(isset($_POST['logUserid'])){
$logUserid = $_POST['logUserid'];
} else {
header("Location: (index.php)");
}
?>
<!DOCTYPE html>
<html lang="zxx">
<!--[endif]-->
<!-- Mirrored from xdemos.space/xpedia/car_checkout.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 30 Jun 2021 08:26:21 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head>
<meta charset="utf-8" />
<title>User-Friendly Railway </title>
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<meta name="MobileOptimized" content="320" />
<!--Template style -->
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"
/>
<link rel="stylesheet" type="text/css" href="css/xpedia.css" />
<style type="text/css">
#myBtn {
display: none;
position: fixed;
bottom: 20px;
right: 30px;
z-index: 99;
font-size: 18px;
border: none;
outline: none;
background-color: #4f5dec;
color: white;
cursor: pointer;
padding: 15px;
border-radius: 10px;
}
#myBtnChat:hover {
background-color: #ffffff;
color: #4f5dec;
border: 1px solid #4f5dec;
}
#myBtnChat {
display: none;
position: fixed;
bottom: 90px;
right: 30px;
z-index: 99;
font-size: 18px;
border: none;
outline: none;
background-color: #4f5dec;
color: white;
cursor: pointer;
padding: 15px;
border-radius: 10px;
}
#myBtn:hover {
background-color: #ffffff;
color: #4f5dec;
border: 1px solid #4f5dec;
}
#myBtnPlan:hover {
background-color: #ffffff;
color: #4f5dec;
border: 1px solid #4f5dec;
}
#myBtnPlan {
display: none;
position: fixed;
bottom: 90px;
right: 30px;
z-index: 99;
font-size: 18px;
border: none;
outline: none;
background-color: #4f5dec;
color: white;
cursor: pointer;
padding: 15px;
border-radius: 10px;
}
</style>
<script>
function getXmlHttpRequestObject() {
if (window.XMLHttpRequest) {
return new XMLHttpRequest();
}
else if(window.ActiveXObject) {
return new ActiveXObject("Microsoft.XMLHTTP");
}else {
}
}
</script>
</head>
<body onload="loadFun(); createTripPlan();">
<div id="subform"></div>
<?php include('common_header.php'); ?>
<script>
function createTripPlan(){
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);
document.getElementById(`collapseOne`).innerHTML = req.responseText;
changeLineName();
deleteSeatDetails(logUserid);
}
}
}
req.open("POST", 'sub_trip_planned_create_trip_plan.php', true);
req.send(formData);
}
}
function deleteSeatDetails(logUserid) {
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);
}
}
}
req.open("POST", 'sub_delete_all_seat_details.php', true);
req.send(formData);
}
}
function changeLineName(){
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);
document.getElementById(`lineNameSec`).innerHTML = req.responseText;
}
}
}
req.open("POST", 'sub_change_line_name.php', true);
req.send(formData);
}
}
function createSeatDesign(logUserid, train_id, train_start_station, seat_design){
logUserid = logUserid;
train_id = train_id;
train_start_station = train_start_station;
seat_design = seat_design;
var formData = new FormData();
formData.append('logUserid', logUserid);
formData.append('train_id', train_id);
formData.append('train_start_station', train_start_station);
formData.append('seat_design', seat_design);
var req = getXmlHttpRequestObject();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {
document.getElementById(`seatPlanAdd`).innerHTML = req.responseText;
$(`#train_${train_id}_${train_start_station}`).modal('show');
highlightBest(logUserid, train_id, train_start_station);
}
}
}
req.open("POST", 'sub_design_seat.php', true);
req.send(formData);
}
}
function selectSeat(logUserid, train_id, train_start_station, row, seat, status) {
var formData = new FormData();
formData.append('logUserid', logUserid);
formData.append('train_id', train_id);
formData.append('train_start_station', train_start_station);
formData.append('row', row);
formData.append('seat', seat);
formData.append('status', status);
if(status == 'no') {
var req = getXmlHttpRequestObject();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {
document.getElementById(`div_${row}_${seat}`).innerHTML = req.responseText;
highlightBest(logUserid, train_id, train_start_station);
}
}
}
req.open("POST", 'sub_design_seat_add_to_temp.php', true);
req.send(formData);
}
} else if(status == 'yes') {
var req = getXmlHttpRequestObject();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {
// alert(req.responseText);
document.getElementById(`div_${row}_${seat}`).innerHTML = req.responseText;
highlightBest(logUserid, train_id, train_start_station);
}
}
}
req.open("POST", 'sub_design_seat_remove_from_temp.php', true);
req.send(formData);
}
}
}
function highlightBest(logUserid, train_id, train_start_station) {
var formData = new FormData();
formData.append('logUserid', logUserid);
formData.append('train_id', train_id);
formData.append('train_start_station', train_start_station);
var req = getXmlHttpRequestObject();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {
var bestButton = document.getElementById(req.responseText);
bestButton.classList.add('animate__animated', 'animate__heartBeat', 'animate__infinite', 'slow');
}
}
}
req.open("POST", 'sub_check_best_seat.php', true);
req.send(formData);
}
}
</script>
<!-- hs Navigation End -->
<!-- btc tittle Wrapper Start -->
<div class="btc_tittle_main_wrapper">
<div class="btc_tittle_img_overlay"></div>
<div class="container">
<div class="row">
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 col-12 full_width">
<div class="btc_tittle_left_heading">
<h1>Custom Trip Plan</h1>
</div>
</div>
<div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 col-12 full_width">
<div class="btc_tittle_right_heading">
<div class="btc_tittle_right_cont_wrapper">
<ul>
<li><a href="#">Home</a> <i class="fa fa-angle-right"></i>
</li>
<li>Custom Trip Plan</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- btc tittle Wrapper End -->
<!-- x tittle num Wrapper Start -->
<div class="x_title_num_mian_Wrapper float_left">
<div class="container">
<div class="x_title_inner_num_wrapper float_left">
<div class="x_title_num_heading">
<h3>Create Custom Trip Plan</h3>
<p>Complete Your Step</p>
</div>
<div class="x_title_num_heading_cont">
<div class="x_title_num_main_box_wrapper">
<div class="x_icon_num">
<p>1</p>
</div>
<h5>Fill Details</h5>
</div>
<div class="x_title_num_main_box_wrapper">
<div class="x_icon_num ">
<p>2</p>
</div>
<h5>Select Location</h5>
</div>
<div class="x_title_num_main_box_wrapper">
<div class="x_icon_num">
<p>3</p>
</div>
<h5>Create plan</h5>
</div>
<div class="x_title_num_main_box_wrapper">
<div class="x_icon_num">
<p>4</p>
</div>
<h5>customize Plan</h5>
</div>
<div class="x_title_num_main_box_wrapper x_title_num_main_box_wrapper3 x_title_num_main_box_wrapper_last">
<div class="x_icon_num">
<p>5</p>
</div>
<h5>done!</h5>
</div>
</div>
</div>
</div>
</div>
<!-- x tittle num Wrapper End -->
<!-- x car book sidebar section Wrapper Start -->
<div class="x_car_book_sider_main_Wrapper float_left">
<div class="container" >
<div class="row">
<div class="col-xl-3 col-lg-4 col-md-12 col-sm-12 col-12">
<div class="x_car_book_left_siderbar_wrapper float_left">
<div class="row">
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
<div class="x_slider_form_main_wrapper float_left x_slider_form_main_wrapper_ccb">
<div class="x_slider_form_heading_wrapper x_slider_form_heading_wrapper_carbooking float_left">
<h3>Let’s Create perfect Trip</h3>
</div>
<input type="text" value="<?php echo $logUserid ?>" id="logUserid" hidden>
<div class="row">
<div class="col-md-12">
<div class="x_slider_form_input_wrapper float_left">
<h3>Railway Line</h3>
<div class="x_slider_select" style="width: 100%; margin-top: 0px;">
<select class="myselect form-control" onchange="setToLine(this.value);">
<?php
$sql1 = "SELECT * FROM linelist WHERE logUserid = $logUserid ORDER BY `priority` ASC";
$result1 = mysqli_query($con,$sql1) or die(mysqli_error($con));
while($row1 = mysqli_fetch_array($result1)){
$slected_line_no = $row1['lineNo'];
$sql2 = "SELECT * FROM railway_line WHERE id = $slected_line_no";
$result2 = mysqli_query($con,$sql2) or die(mysqli_error($con));
$row2 = mysqli_fetch_assoc($result2)
?>
<option value="<?php echo $row2['id'] ?>"><?php echo $row2['line'] ?></option>
<?php
}
?>
</select>
</div>
</div>
</div>
<div class="col-md-12">
<div class="x_slider_form_input_wrapper float_left">
<h3>Location Category</h3>
<div class="x_slider_select" style="width: 100%; margin-top: 0px;">
<select class="myselect form-control" onchange="setToCat(this.value)">
<?php
$sql3 = "SELECT * FROM catlist WHERE logUserid = $logUserid ORDER BY `priority` ASC";
$result3 = mysqli_query($con,$sql3) or die(mysqli_error($con));
while($row3 = mysqli_fetch_array($result3)){
$selected_cat_id = $row3['catNo'];
$sql4 = "SELECT * FROM category WHERE id = '$selected_cat_id' ";
$result4 = mysqli_query($con,$sql4) or die(mysqli_error($con));
$row4 = mysqli_fetch_assoc($result4)
?>
<option value="<?php echo $row4['id'] ?>"><?php echo $row4['name'] ?></option>
<?php
}
?>
</select>
</div>
</div>
</div>
<div class="col-md-12">
<div class="form-sec-header">
<h3>Start Date</h3>
<?php
$sql5 = "SELECT * FROM user_details WHERE logUserid = $logUserid";
$result5 = mysqli_query($con,$sql5) or die(mysqli_error($con));
$row5 = mysqli_fetch_assoc($result5);
?>
<label class="cal-icon">
<input type="text" id="startTime" onchange="changeTime();" value="<?php echo $row5['start'] ?>" placeholder="Start Date" class="form-control datepicker" readonly>
</label>
</div>
</div>
<div class="col-md-12">
<div class="form-sec-header">
<h3>End Date</h3>
<label class="cal-icon">
<input type="text" id="endTime" onchange="changeTime();" value="<?php echo $row5['end'] ?>" placeholder="End Date" class="form-control datepicker" readonly>
</label>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
function changeTime() {
let logUserid = document.getElementById(`logUserid`).value;
let startTime = document.getElementById(`startTime`).value;
let endTime = document.getElementById(`endTime`).value;
var formData = new FormData();
formData.append('logUserid', logUserid);
formData.append('startTime', startTime);
formData.append('endTime', endTime);
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 == 1) {
createTripPlan();
}
// createTripPlan();
}
}
}
req.open("POST", 'sub_update_date.php', true);
req.send(formData);
}
}
function setToCat(value) {
let logUserid = document.getElementById(`logUserid`).value;
let catDropValue = value;
var formData = new FormData();
formData.append('logUserid', logUserid);
formData.append('catDropValue', catDropValue);
var req = getXmlHttpRequestObject();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {
// alert(req.responseText);
// console.log(req.responseText);
createTripPlan();
}
}
}
req.open("POST", 'sub_arrange_cat.php', true);
req.send(formData);
}
}
function setToLine(value){
let logUserid = document.getElementById(`logUserid`).value;
let lineDropValue = value;
var formData = new FormData();
formData.append('logUserid', logUserid);
formData.append('lineDropValue', lineDropValue);
var req = getXmlHttpRequestObject();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {
createTripPlan();
}
}
}
req.open("POST", 'sub_arrange_line.php', true);
req.send(formData);
}
}
</script>
<div class="col-xl-9 col-lg-8 col-md-12 col-sm-12 col-12">
<div class="x_carbooking_right_section_wrapper float_left">
<div class="row">
<div class="col-md-12">
<div class="x_car_checkout_right_main_box_wrapper float_left">
<div class="car-filter order-billing margin-top-0">
<div class="heading-block text-left margin-bottom-0">
<h4>Trip Details</h4>
</div>
<hr>
<!-- <form class="billing-form">
<ul class="list-unstyled row">
<li class="col-md-6">
<label>First Name *
<input type="text" placeholder="" class="form-control">
</label>
</li>
<li class="col-md-6">
<label>Last Name *
<input type="text" placeholder="" class="form-control">
</label>
</li>
<li class="col-md-6">
<label>NIC / Passport
<input type="text" placeholder="" class="form-control">
</label>
</li>
<li class="col-md-6">
<label>Passengers
<input type="text" placeholder="" class="form-control">
</label>
</li>
</form> -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<div class="accordion" id="accordionExample" style="width: 100%; ">
<div class="card">
<div class="card-header" id="headingOne" style="background-color: #4f5dec;">
<h2 class="mb-0" >
<button style="color: #ffffff;" class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
Best Trip Plan - <b> <span id="lineNameSec"> Main Line </span></b>
</button>
</h2>
</div>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordionExample">
<!-- Content Add -->
<!-- Content Add -->
<!-- Content Add -->
<!-- Content Add -->
<!-- Content Add -->
</div>
</div>
</div>
</div>
</div>
</div>
<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>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- x car book sidebar section Wrapper End -->
<!-- Button trigger modal -->
<div id="seatPlanAdd">
</div>
<style>
.btn-link:hover, .btn-link, .btn-link:focus{
text-decoration:none;
}
</style>
<?php include('common_footer.php'); ?>
<?php include('common_chatbot.php'); ?>
<script>
function MsgSend() {
var msg = document.getElementById("msg_value").value;
let logUserid = document.getElementById(`logUserid`).value;
var req = getXmlHttpRequestObject();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {
// alert(req.responseText);
if(req.responseText == 1){
document.getElementById("msg_value").value = "";
}
refreshChat(logUserid);
}
}
}
req.open("GET", 'chat.php?&msg='+msg+'&logUserid='+logUserid, true);
req.send();
}
}
function refreshChat(logUserid){
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);
document.getElementById(`messagebody`).innerHTML = req.responseText;
var msgbody = document.getElementById('messagebody');
msgbody.scrollTop = msgbody.scrollHeight - msgbody.clientHeight;
}
}
}
req.open("POST", 'sub_refresh_chat.php', true);
req.send(formData);
}
}
</script>
<script>
function minimizeChat() {
if(document.getElementById('messagebody').style.display == 'block' && document.getElementById('inputSec').style.display == 'block') {
document.getElementById('messagebody').style.display = 'none';
document.getElementById('inputSec').style.display = 'none';
} else {
document.getElementById('messagebody').style.display = 'block';
document.getElementById('inputSec').style.display = 'block';
}
}
function closeChat() {
$( "#chatbox" ).hide();
}
function showChat() {
$( "#chatbox" ).show();
}
function loadFun(){
document.getElementById('messagebody').style.display = 'none';
document.getElementById('inputSec').style.display = 'none';
}
</script>
<style>
.panel{
margin-bottom: 0px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}
.chat-window{
bottom:0;
right:5%;
position:fixed;
float:right;
}
.chat-window > div > .panel{
border-radius: 5px 5px 0 0;
}
.icon_minim{
padding:2px 10px;
}
.msg_container_base{
background: #e5e5e5;
margin: 0;
padding: 0 10px 10px;
max-height:300px;
overflow-x:hidden;
}
.top-bar {
background: #4f5dec;
color: white;
padding: 10px;
position: relative;
overflow: hidden;
}
.msg_receive{
padding-left:0;
margin-left:0;
}
.msg_sent{
padding-bottom:20px !important;
margin-right:0;
}
.messages {
background: white;
padding: 10px;
border-radius: 2px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
max-width:100%;
}
.messages > p {
font-size: 13px;
margin: 0 0 0.2rem 0;
}
.messages > time {
font-size: 11px;
color: #ccc;
}
.msg_container {
padding: 10px;
overflow: hidden;
display: flex;
}
.chatimg {
display: block;
width: 100%;
}
.avatar {
position: relative;
}
.base_receive > .avatar:after {
content: "";
position: absolute;
top: 0;
right: 0;
width: 0;
height: 0;
border: 5px solid #FFF;
border-left-color: rgba(0, 0, 0, 0);
border-bottom-color: rgba(0, 0, 0, 0);
}
.base_sent {
justify-content: flex-end;
align-items: flex-end;
}
.base_sent > .avatar:after {
content: "";
position: absolute;
bottom: 0;
left: 0;
width: 0;
height: 0;
border: 5px solid white;
border-right-color: transparent;
border-top-color: transparent;
box-shadow: 1px 1px 2px rgba(black, 0.2); // not quite perfect but close
}
.msg_sent > time{
float: right;
}
.msg_container_base::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
background-color: #F5F5F5;
}
.msg_container_base::-webkit-scrollbar
{
width: 12px;
background-color: #F5F5F5;
}
.msg_container_base::-webkit-scrollbar-thumb
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
background-color: #555;
}
.btn-group.dropup{
position:fixed;
left:0px;
bottom:0;
}
.panel-footer {
padding: 10px 15px;
background-color: #a5abf3;
border-top: 1px solid #ddd;
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px;
}
</style>
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/modernizr.js"></script>
<script src="js/select2.min.js"></script>
<script src="js/jquery.menu-aim.js"></script>
<script src="js/jquery-ui.js"></script>
<script src="js/jquery.nice-select.min.js"></script>
<script src="js/owl.carousel.js"></script>
<!-- <script src="js/own-menu.js"></script> -->
<script src="js/jquery.bxslider.min.js"></script>
<script src="js/jquery.magnific-popup.js"></script>
<script src="js/xpedia.js"></script>
<!-- custom js-->
<link href="https://cdn.jsdelivr.net/npm/lobibox@1.2.7/dist/css/lobibox.css" rel="stylesheet" />
<!-- <script src="https://cdn.jsdelivr.net/npm/lobibox@1.2.7/lib/jquery.1.11.js"></script> -->
<script src="https://cdn.jsdelivr.net/npm/lobibox@1.2.7/dist/js/lobibox.min.js"></script>
<script src='https://kit.fontawesome.com/a076d05399.js' crossorigin='anonymous'></script>
</body>
<script>
//Get the button
var mybutton = document.getElementById("myBtn");
var mybuttonchat = document.getElementById("myBtnChat");
// When the user scrolls down 20px from the top of the document, show the button
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
mybutton.style.display = "block";
mybuttonchat.style.display = "block";
} else {
mybutton.style.display = "none";
mybuttonchat.style.display = "none";
}
}
// When the user clicks on the button, scroll to the top of the document
function topFunction() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}
function naviFunction() {
window.location.href = "train_planned.html";
}
function naviHome() {
window.location.href = "index.php";
}
function naviFunction() {
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);
if(req.responseText == 1) {
var subform = document.getElementById('subform');
var form = document.createElement("form");
form.method = 'POST';
form.action = 'train_planned.php';
var input1 = document.createElement('input');
input1.type = "hidden";
input1.name = "logUserid";
input1.value = logUserid;
form.appendChild(input1);
subform.appendChild(form);
form.submit();
} else {
Lobibox.notify('error', {
size: 'normal',
sound: false,
title: 'Cannot access...',
icon: 'fa fa-times-circle',
msg: 'Please fill your details before create trip plan.'
});
}
}
}
}
req.open("POST", 'sub_check_user_submit_details.php', true);
req.send(formData);
}
}
</script>
<!-- Mirrored from xdemos.space/xpedia/car_checkout.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 30 Jun 2021 08:26:21 GMT -->
</html>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -4,6 +4,6 @@ ...@@ -4,6 +4,6 @@
<button onclick="showChat(); minimizeChat();" id="myBtnChat" title="Chatbot" > <i class="fa fa-envelope"></i> </button> <button onclick="showChat(); minimizeChat();" id="myBtnChat" title="Chatbot" > <i class="fa fa-envelope"></i> </button>
<div class="container"> <div class="container">
<p>Copyright © 2021 SLIIT (Research Project). All rights reserved.</p> <p>Copyright © 2021 SLIIT (Research Project). All rights reserved.</p>
<a href="edit_place.php">aa</a> <!-- <a href="edit_place.php">aa</a> -->
</div> </div>
</div> </div>
\ No newline at end of file
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<div class="col-md-10 col-xs-10" style="padding:0;"> <div class="col-md-10 col-xs-10" style="padding:0;">
<div class="messages msg_sent"> <div class="messages msg_sent">
<p><?php echo $row1['msg']; ?></p> <p><?php echo $row1['msg']; ?></p>
<time datetime="2009-11-13T20:00">User • <?php echo $row1['time']; ?></time> <time datetime="2009-11-13T20:00">User • Today <?php echo $row1['time']; ?></time>
</div> </div>
</div> </div>
<div class="col-md-2 col-xs-2 avatar" style="padding:0;"> <div class="col-md-2 col-xs-2 avatar" style="padding:0;">
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<div class="col-md-10 col-xs-10" style="padding:0;"> <div class="col-md-10 col-xs-10" style="padding:0;">
<div class="messages msg_receive"> <div class="messages msg_receive">
<p><?php echo $row1['msg']; ?></p> <p><?php echo $row1['msg']; ?></p>
<time datetime="2009-11-13T20:00">Railbot • <?php echo $row1['time']; ?></time> <time datetime="2009-11-13T20:00">Railbot • Today <?php echo $row1['time']; ?></time>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
// Date count // Date count
$date_count = (int) $days + 1; $date_count = (int) $days + 1;
$full_hours = $date_count * 10; $full_hours = $date_count * 11;
$line_no = array(); $line_no = array();
$sql2 = "SELECT * FROM linelist WHERE logUserid = '$logUserid' ORDER BY id "; $sql2 = "SELECT * FROM linelist WHERE logUserid = '$logUserid' ORDER BY id ";
...@@ -588,7 +588,7 @@ ...@@ -588,7 +588,7 @@
$end_train_arrival = trim($end_train_arrival); $end_train_arrival = trim($end_train_arrival);
$end_train_dep = trim($end_train_dep); $end_train_dep = trim($end_train_dep);
if($date_count < 6){ if($date_count < 3){
$end_train_arrival_date_and_time = $end_now_date ." ".$end_train_arrival; // Train Arrival $end_train_arrival_date_and_time = $end_now_date ." ".$end_train_arrival; // Train Arrival
$end_train_dep_date_and_time = $end_now_date ." ".$end_train_dep; // Train Depature $end_train_dep_date_and_time = $end_now_date ." ".$end_train_dep; // Train Depature
} else { } else {
......
...@@ -596,7 +596,7 @@ ...@@ -596,7 +596,7 @@
<div class="col-md-12"> <div class="col-md-12">
<div class="contect_btn contect_btn_contact"> <div class="contect_btn contect_btn_contact">
<ul> <ul>
<li><a href="#">Confirm Plan <i class="fa fa-arrow-right"></i></a> <li><a href="javascript:void(0)">Confirm Plan <i class="fa fa-arrow-right"></i></a>
</li> </li>
</ul> </ul>
</div> </div>
......
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