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

Merge branch 'IT18500790' into 'master'

Custermized trip plan

See merge request !11
parents 029e49ed 44ea46fc
images/
\ No newline at end of file
...@@ -103,7 +103,7 @@ jQuery(document).ready(function($) { ...@@ -103,7 +103,7 @@ jQuery(document).ready(function($) {
/*----------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------*/
/* Date and Tiem Picker /* Date and Tiem Picker
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
$('.datepicker').datepicker({ dateFormat: 'y-m-d' }); $('.datepicker').datepicker({ dateFormat: 'yy-mm-dd', minDate: 0 });
$('.dateDisplay').datepicker({ dateFormat: 'yy-mm-dd', minDate: 0 }); $('.dateDisplay').datepicker({ dateFormat: 'yy-mm-dd', minDate: 0 });
$('.horizontal-datepicker').datepicker({ dateFormat: 'dd-mm-yy', minDate: 0 }); $('.horizontal-datepicker').datepicker({ dateFormat: 'dd-mm-yy', minDate: 0 });
......
<?php
session_start();
include "db_connect.php";
$logUserid = mysqli_real_escape_string($con,$_POST['logUserid']);
$sql1 = "SELECT * FROM linelist WHERE logUserid = $logUserid ORDER BY `priority` ASC ";
$result1 = mysqli_query($con,$sql1) or die(mysqli_error($con));
$line_list = array();
while($row1 = mysqli_fetch_array($result1)){
array_push($line_list, $row1['lineNo']);
}
$first_line_num = $line_list[0];
$sql2 = "SELECT * FROM railway_line WHERE id = '$first_line_num'";
$result2 = mysqli_query($con,$sql2) or die(mysqli_error($con));
$row2 = mysqli_fetch_assoc($result2);
echo $row2['line'];
<?php
session_start();
include "db_connect.php";
$logUserid = mysqli_real_escape_string($con,$_POST['logUserid']);
$startTime = mysqli_real_escape_string($con,$_POST['startTime']);
$endTime = mysqli_real_escape_string($con,$_POST['endTime']);
$sql1 = "UPDATE `user_details` SET `start`='$startTime',`end`='$endTime' WHERE `logUserid`='$logUserid'";
$result1 = mysqli_query($con,$sql1) or die(mysqli_error($con));
if($result1){
echo 1;
} else {
echo 0;
}
\ No newline at end of file
...@@ -126,6 +126,7 @@ ...@@ -126,6 +126,7 @@
// alert(req.responseText); // alert(req.responseText);
// console.log(req.responseText); // console.log(req.responseText);
document.getElementById(`collapseOne`).innerHTML = req.responseText; document.getElementById(`collapseOne`).innerHTML = req.responseText;
changeLineName();
} }
} }
} }
...@@ -134,6 +135,29 @@ ...@@ -134,6 +135,29 @@
req.send(formData); 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);
}
}
</script> </script>
<!-- hs Navigation End --> <!-- hs Navigation End -->
...@@ -278,16 +302,21 @@ ...@@ -278,16 +302,21 @@
<div class="col-md-12"> <div class="col-md-12">
<div class="form-sec-header"> <div class="form-sec-header">
<h3>Start Date</h3> <h3>Start Date</h3>
<label class="cal-icon">Pick-up Date <?php
<input type="text" placeholder="Tue 16 Jan 2018" class="form-control datepicker"> $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> </label>
</div> </div>
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
<div class="form-sec-header"> <div class="form-sec-header">
<h3>End Date</h3> <h3>End Date</h3>
<label class="cal-icon">Pick-up Date <label class="cal-icon">
<input type="text" placeholder="Tue 16 Jan 2018" class="form-control datepicker"> <input type="text" id="endTime" onchange="changeTime();" value="<?php echo $row5['end'] ?>" placeholder="End Date" class="form-control datepicker" readonly>
</label> </label>
</div> </div>
</div> </div>
...@@ -300,6 +329,37 @@ ...@@ -300,6 +329,37 @@
<script> <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) { function setToCat(value) {
let logUserid = document.getElementById(`logUserid`).value; let logUserid = document.getElementById(`logUserid`).value;
let catDropValue = value; let catDropValue = value;
...@@ -358,7 +418,7 @@ ...@@ -358,7 +418,7 @@
<h4>Trip Details</h4> <h4>Trip Details</h4>
</div> </div>
<hr> <hr>
<form class="billing-form"> <!-- <form class="billing-form">
<ul class="list-unstyled row"> <ul class="list-unstyled row">
<li class="col-md-6"> <li class="col-md-6">
<label>First Name * <label>First Name *
...@@ -380,7 +440,7 @@ ...@@ -380,7 +440,7 @@
<input type="text" placeholder="" class="form-control"> <input type="text" placeholder="" class="form-control">
</label> </label>
</li> </li>
</form> </form> -->
<div class="container-fluid" style="border: 1px solid rgb(223, 222, 222); border-radius: 10px; margin-bottom: 3%;"> <div class="container-fluid" style="border: 1px solid rgb(223, 222, 222); border-radius: 10px; margin-bottom: 3%;">
<div class="row" style="margin-bottom: 1%; margin-top: 3%;"> <div class="row" style="margin-bottom: 1%; margin-top: 3%;">
...@@ -566,7 +626,7 @@ ...@@ -566,7 +626,7 @@
<div class="card-header" id="headingOne" style="background-color: #4f5dec;"> <div class="card-header" id="headingOne" style="background-color: #4f5dec;">
<h2 class="mb-0" > <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"> <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> Main Line </b> Best Trip Plan - <b> <span id="lineNameSec"> Main Line </span></b>
</button> </button>
</h2> </h2>
</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