Skip to content
Snippets Groups Projects
Commit 863988da authored by Nur Latifah Ulfah's avatar Nur Latifah Ulfah
Browse files

fix hide

parent 979ec9c3
Branches
No related merge requests found
<?php
require_once 'dbconfig.php';
$sqlconn = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
if (!$sqlconn) {
die('mySQL connection failed');
}
$type = $_GET["type"];
$id = $_GET["id"];
if ($type == 0) {
$ishide=1;
$sqlquery = "UPDATE orderhistory SET ishide_cust=? WHERE order_id=?";
$stmt = mysqli_prepare($sqlconn, $sqlquery);
mysqli_stmt_bind_param($stmt, "ii", $ishide, $id);
mysqli_stmt_execute($stmt);
}else{
$ishide=1;
$sqlquery = "UPDATE orderhistory SET ishide_driver=? WHERE order_id=?";
$stmt = mysqli_prepare($sqlconn, $sqlquery);
mysqli_stmt_bind_param($stmt, "ii", $ishide, $id);
mysqli_stmt_execute($stmt);
}
?>
\ No newline at end of file
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
} }
//AMBIL DATA HISTORY ORDER //AMBIL DATA HISTORY ORDER
$query_order_history = 'SELECT order_id, date, u_driver, source, destination, rating_given, comment_given, img_name FROM orderhistory INNER JOIN userinfo ON orderhistory.u_customer=userinfo.username AND userinfo.username=?'; $query_order_history = 'SELECT order_id, date, u_customer, u_driver, source, destination, rating_given, comment_given, img_name, ishide_cust FROM orderhistory INNER JOIN userinfo ON orderhistory.u_customer=userinfo.username AND userinfo.username=?';
$order_history = mysqli_prepare($sqlconn, $query_order_history); $order_history = mysqli_prepare($sqlconn, $query_order_history);
// Bind variables // Bind variables
...@@ -34,11 +34,11 @@ ...@@ -34,11 +34,11 @@
// Simpan Hasil query // Simpan Hasil query
mysqli_stmt_store_result($order_history); mysqli_stmt_store_result($order_history);
// username exist // username exist
mysqli_stmt_bind_result($order_history, $id, $date, $u_driver, $source, $destination, $rating_given, $comment_given, $img_name); mysqli_stmt_bind_result($order_history, $id, $date, $u_customer, $u_driver, $source, $destination, $rating_given, $comment_given, $img_name, $ishide_cust);
} }
//AMBIL DATA DRIVER HISTORY //AMBIL DATA DRIVER HISTORY
$query_driver_history = 'SELECT order_id, date, u_customer, source, destination, rating_given, comment_given FROM orderhistory INNER JOIN userinfo ON orderhistory.u_driver=userinfo.username AND userinfo.username=?'; $query_driver_history = 'SELECT order_id, date, u_customer, u_driver, source, destination, rating_given, comment_given, img_name, ishide_driver FROM orderhistory INNER JOIN userinfo ON orderhistory.u_customer=userinfo.username AND orderhistory.u_driver=?';
$driver_history = mysqli_prepare($sqlconn, $query_driver_history); $driver_history = mysqli_prepare($sqlconn, $query_driver_history);
// Bind variables // Bind variables
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
// Simpan Hasil query // Simpan Hasil query
mysqli_stmt_store_result($driver_history); mysqli_stmt_store_result($driver_history);
// username exist // username exist
mysqli_stmt_bind_result($driver_history, $id, $date, $u_customer, $source, $destination, $rating_given, $comment_given); mysqli_stmt_bind_result($driver_history, $id, $date, $u_customer, $u_driver, $source, $destination, $rating_given, $comment_given, $img_name, $ishide_driver);
} }
?> ?>
<html> <html>
...@@ -100,48 +100,51 @@ ...@@ -100,48 +100,51 @@
<div id="order" class="tabcontent active"> <div id="order" class="tabcontent active">
<?php <?php
while (mysqli_stmt_fetch($order_history)) { while (mysqli_stmt_fetch($order_history)) {
switch ($rating_given) { if ($ishide_cust == 0){
case 1: switch ($rating_given) {
$rating='&#9734;'; case 1:
break; $rating='&#9734;';
case 2: break;
$rating='&#9734;&#9734;'; case 2:
break; $rating='&#9734;&#9734;';
case 3: break;
$rating='&#9734;&#9734;&#9734;'; case 3:
break; $rating='&#9734;&#9734;&#9734;';
case 4: break;
$rating='&#9734;&#9734;&#9734;&#9734;'; case 4:
break; $rating='&#9734;&#9734;&#9734;&#9734;';
case 4: break;
$rating='&#9734;&#9734;&#9734;&#9734;&#9734;'; case 4:
break; $rating='&#9734;&#9734;&#9734;&#9734;&#9734;';
default: break;
$rating=''; default:
} $rating='';
$date=strtotime($date); }
$id_hide="'order$id'"; $date=strtotime($date);
$listhistory = ' $id_hide="'order$id'";
<!-- Start List Item --> $listhistory = '
<div class="row mt40" id="order'.$id.'"> <!-- Start List Item -->
<div class="col-4 photo-container px15"> <div class="row mt40" id="order'.$id.'">
<img src="img/'.$img_name.'" class="border"> <div class="col-4 photo-container px15">
</div> <img src="img/'.$img_name.'" class="border">
<div class="col-8 relative"> </div>
<div class="date">'.date("l, F j",$date).'th '.date("Y",$date).'</div> <div class="col-8 relative">
<div class="driver-name">'.$u_driver.'</div> <div class="date">'.date("l, F j",$date).'th '.date("Y",$date).'</div>
<div class="destination mt10">'.$source.' &#8594; '.$destination.'</div> <div class="driver-name">'.$u_driver.'</div>
<div class="rating mt10">You rated: <span class="orange">'.$rating.'</span></div> <div class="destination mt10">'.$source.' &#8594; '.$destination.'</div>
<div class="comment">You commented: <div class="rating mt10">You rated: <span class="orange">'.$rating.'</span></div>
<p class="m0">'.$comment_given.'</p></div> <div class="comment">You commented:
<div class="hide-btn r0 t0"> <p class="m0">'.$comment_given.'</p></div>
<button class="uppercase btn red-bg" onclick="hide('.$id_hide.')">Hide</button> <div class="hide-btn r0 t0">
<button class="uppercase btn red-bg" onclick="hideCust('.$id_hide.','.$id.')">Hide</button>
</div>
</div> </div>
</div> </div>
</div>
<!-- End List Item -->';
echo $listhistory;
}
<!-- End List Item -->';
echo $listhistory;
} }
?> ?>
</div> </div>
...@@ -152,28 +155,30 @@ ...@@ -152,28 +155,30 @@
<?php <?php
while (mysqli_stmt_fetch($driver_history)) { while (mysqli_stmt_fetch($driver_history)) {
$date=strtotime($date); $date=strtotime($date);
$id_hide="'driver$id'"; if ($ishide_driver == 0){
$listhistory = ' $id_hide="'driver$id'";
<!-- Start List Item --> $listhistory = '
<div class="row mt40" id="driver'.$id.'"> <!-- Start List Item -->
<div class="col-4 photo-container px15"> <div class="row mt40" id="driver'.$id.'">
<img src="img/'.$img_name.'" class="border"> <div class="col-4 photo-container px15">
</div> <img src="img/'.$img_name.'" class="border">
<div class="col-8 relative"> </div>
<div class="date">'.date("l, F j",$date).'th '.date("Y",$date).'</div> <div class="col-8 relative">
<div class="driver-name">'.$u_customer.'</div> <div class="date">'.date("l, F j",$date).'th '.date("Y",$date).'</div>
<div class="destination mt5">'.$source.' &#8594; '.$destination.'</div> <div class="driver-name">'.$u_customer.'</div>
<div class="rating mt5">gave <span class="orange">'.$rating_given.'</span> stars for this order</div> <div class="destination mt5">'.$source.' &#8594; '.$destination.'</div>
<div class="comment mt5">and left comment: <div class="rating mt5">gave <span class="orange">'.$rating_given.'</span> stars for this order</div>
<p class="m0">'.$comment_given.'</p></div> <div class="comment mt5">and left comment:
<div class="hide-btn r0 t0"> <p class="m0">'.$comment_given.'</p></div>
<button class="uppercase btn red-bg" onclick="hide('.$id_hide.')">Hide</button> <div class="hide-btn r0 t0">
<button class="uppercase btn red-bg" onclick="hideDriver('.$id_hide.','.$id.')">Hide</button>
</div>
</div> </div>
</div> </div>
</div> <!-- End List Item -->';
<!-- End List Item -->';
echo $listhistory; echo $listhistory;
}
} }
?> ?>
</div> </div>
......
...@@ -22,33 +22,50 @@ function openTab(evt, tabName) { ...@@ -22,33 +22,50 @@ function openTab(evt, tabName) {
evt.currentTarget.className += " active"; evt.currentTarget.className += " active";
} }
function hide(id) { function hideCust(idhide, id){
document.getElementById(id).style.display = "none"; var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById(idhide).style.display = "none";
}
};
xmlhttp.open("GET", "hide.php?type=0&id="+id, true);
xmlhttp.send();
} }
function hideDriver(idhide, id){
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById(idhide).style.display = "none";
}
};
xmlhttp.open("GET", "hide.php?type=1&id="+id, true);
xmlhttp.send();
}
//INPUT FILE //INPUT FILE
'use strict'; // 'use strict';
;( function ( document, window, index ) // ;( function ( document, window, index )
{ // {
var inputs = document.querySelectorAll( '.inputfile' ); // var inputs = document.querySelectorAll( '.inputfile' );
Array.prototype.forEach.call( inputs, function( input ) // Array.prototype.forEach.call( inputs, function( input )
{ // {
var label = input.nextElementSibling, // var label = input.nextElementSibling,
labelVal = label.innerHTML; // labelVal = label.innerHTML;
input.addEventListener( 'change', function( e ) // input.addEventListener( 'change', function( e )
{ // {
if( fileName ) // if( fileName )
label.querySelector( 'span' ).innerHTML = fileName; // label.querySelector( 'span' ).innerHTML = fileName;
else // else
label.innerHTML = labelVal; // label.innerHTML = labelVal;
}); // });
// Firefox bug fix // // Firefox bug fix
input.addEventListener( 'focus', function(){ input.classList.add( 'has-focus' ); }); // input.addEventListener( 'focus', function(){ input.classList.add( 'has-focus' ); });
input.addEventListener( 'blur', function(){ input.classList.remove( 'has-focus' ); }); // input.addEventListener( 'blur', function(){ input.classList.remove( 'has-focus' ); });
}); // });
}( document, window, 0 )); // }( document, window, 0 ));
\ No newline at end of file \ No newline at end of file
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