* total cities label

* color and icon improvements
This commit is contained in:
lukas-heiligenbrunner 2019-12-13 14:57:59 +01:00
parent ab1ce79900
commit b1e7de952a
3 changed files with 49 additions and 73 deletions

View File

@ -156,59 +156,6 @@ public class DataRequest extends PostRequest {
sb.append("\"status\" : \"error\"");
}
sb.append(",\"query\":\"ok\"");
sb.append("}");
break;
case "getcollectionnumber": //todo maybe combine all three to one
sb.append("{");
try {
set = jdcb.executeQuery("select * from pickupdates");
set.last();
sb.append("\"collectionnumber\":\"" + set.getRow() + "\"");
} catch (SQLException e) {
Log.error("sql exception: " + e.getMessage());
sb.append("\"status\" : \"error\"");
}
sb.append(",\"query\":\"ok\"");
sb.append("}");
break;
case "getcollectioninfuture":
sb.append("{");
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date();
date = new Date(date.getTime()+1 * 24 * 60 * 60 * 1000);
String time = sdf.format(date);
set = jdcb.executeQuery("SELECT * FROM `pickupdates` WHERE `pickupdate` BETWEEN '"+time+"' AND '2222-12-27'");
set.last();
sb.append("\"collectionnumber\":\"" + set.getRow() + "\"");
} catch (SQLException e) {
Log.error("sql exception: " + e.getMessage());
sb.append("\"status\" : \"error\"");
}
sb.append(",\"query\":\"ok\"");
sb.append("}");
break;
case "getfinishedcollections":
sb.append("{");
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date();
String time = sdf.format(date);
set = jdcb.executeQuery("SELECT * FROM `pickupdates` WHERE `pickupdate` BETWEEN '0000-12-27' AND '"+time+"'");
set.last();
sb.append("\"collectionnumber\":\"" + set.getRow() + "\"");
} catch (SQLException e) {
Log.error("sql exception: " + e.getMessage());
sb.append("\"status\" : \"error\"");
}
sb.append(",\"query\":\"ok\"");
sb.append("}");
break;
@ -219,6 +166,41 @@ public class DataRequest extends PostRequest {
sb.append(",\"buildtime\" : \""+ Info.getBuilddate()+"\"");
sb.append(",\"query\":\"ok\"");
sb.append("}");
break;
case "getStartHeaderData":
sb.append("{");
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date();
String time = sdf.format(date);
set = jdcb.executeQuery("SELECT * FROM `pickupdates` WHERE `pickupdate` BETWEEN '0000-12-27' AND '"+time+"'");
set.last();
sb.append("\"finshedcollections\":\"" + set.getRow() + "\"");
sdf = new SimpleDateFormat("yyyy-MM-dd");
date = new Date();
date = new Date(date.getTime()+1 * 24 * 60 * 60 * 1000);
time = sdf.format(date);
set = jdcb.executeQuery("SELECT * FROM `pickupdates` WHERE `pickupdate` BETWEEN '"+time+"' AND '2222-12-27'");
set.last();
sb.append(",\"futurecollections\":\"" + set.getRow() + "\"");
set = jdcb.executeQuery("select * from pickupdates");
set.last();
sb.append(",\"collectionnumber\":\"" + set.getRow() + "\"");
set = jdcb.executeQuery("select * from `cities`");
set.last();
sb.append(",\"citynumber\":\"" + set.getRow() + "\"");
} catch (SQLException e) {
Log.error("sql exception: " + e.getMessage());
sb.append("\"status\" : \"error\"");
}
sb.append(",\"query\":\"ok\"");
sb.append("}");
break;

View File

@ -145,14 +145,14 @@
<!-- ./col -->
<div class="col-lg-3 col-6">
<!-- small box -->
<div class="small-box bg-success">
<div class="small-box bg-gray">
<div class="inner">
<h3>53<sup style="font-size: 20px">%</sup></h3>
<h3 id="total-city-number-label">42</h3>
<p>Verbundene Clients</p>
<p>total collect zones</p>
</div>
<div class="icon">
<i class="ion ion-stats-bars"></i>
<i class="ion ion-android-globe" style="color: lightgrey"></i>
</div>
<a href="#" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a>
</div>
@ -167,7 +167,7 @@
<p>Planned Collections</p>
</div>
<div class="icon">
<i class="ion ion-person-add"></i>
<i class="ion ion-calendar"></i>
</div>
<a href="#" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a>
</div>
@ -175,14 +175,14 @@
<!-- ./col -->
<div class="col-lg-3 col-6">
<!-- small box -->
<div class="small-box bg-danger">
<div class="small-box bg-success">
<div class="inner">
<h3 id="finished-collection-label">65</h3>
<p>Finished Collections</p>
</div>
<div class="icon">
<i class="ion ion-pie-graph"></i>
<i class="ion ion-android-checkmark-circle"></i>
</div>
<a href="#" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a>
</div>

View File

@ -13,21 +13,15 @@ $(document).ready(function () {
}, 'json');
//load total collections
$.post('/senddata/wastedata', 'action=getcollectionnumber', function (data) {
$.post('/senddata/wastedata', 'action=getStartHeaderData', function (data) {
console.log(data);
$("#total-connection-labels").html(data.collectionnumber);
}, 'json');
//load future collections
$.post('/senddata/wastedata', 'action=getcollectioninfuture', function (data) {
console.log(data);
$("#planed-collection-label").html(data.collectionnumber);
}, 'json');
$("#planed-collection-label").html(data.futurecollections);
//load future collections
$.post('/senddata/wastedata', 'action=getfinishedcollections', function (data) {
console.log(data);
$("#finished-collection-label").html(data.collectionnumber);
$("#finished-collection-label").html(data.finshedcollections);
$("#total-city-number-label").html(data.citynumber);
}, 'json');
//load version footer
@ -161,8 +155,8 @@ $(document).ready(function () {
}, "json");
});
}
citytable = $("#table-pickupdates").DataTable({
"order": [[ 3, "desc" ]]
datetable = $("#table-pickupdates").DataTable({
"order": [[ 3, "asc" ]]
} );
//todo picupdates-tablebody