fixed date trans bugs and added live search

This commit is contained in:
2019-03-04 19:27:42 +01:00
parent 5a3f051e63
commit e18bde2a33

View File

@@ -22,16 +22,18 @@ for($i = 0; $i < 2; $i++) {
natsort($worklists);
$checkedLists = $_GET['worklist'];
$monthTrans = ['jan' => 'Jan', 'feb' => 'Feb', 'mrt' => 'Mar', 'apr' => 'Apr', 'mei' => 'May', 'jul' => 'Jul', 'aug' => 'Aug', 'sep' => 'Sep',
'okt' => 'Oct', 'nov' => 'Nov', 'dec' => 'Dec'];
$all_names = [];
$totalShifted = 0;
$total = 0;
$checkedLists = [];
foreach ($checkedLists as $site) {
if (isset($_GET['worklist'])) {
$checkedLists = $_GET['worklist'];
$monthTrans = ['jan' => 'Jan', 'feb' => 'Feb', 'mrt' => 'Mar', 'apr' => 'Apr', 'mei' => 'May', 'jun' => 'Jun', 'jul' => 'Jul', 'aug' => 'Aug', 'sep' => 'Sep',
'okt' => 'Oct', 'nov' => 'Nov', 'dec' => 'Dec'];
foreach ($checkedLists as $site) {
$site = 'https://old.wina.be/worklists/' . $site;
$data = file_get_contents($site);
@@ -64,6 +66,7 @@ foreach ($checkedLists as $site) {
}
}
}
}
}
$avg = $totalShifted / count($all_names);
@@ -73,9 +76,9 @@ $avg = $totalShifted / count($all_names);
<!doctype html>
<html lang="nl">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Wina shift counter</title>
<meta name="author" content="Arthur Bols">
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
@@ -90,7 +93,7 @@ $avg = $totalShifted / count($all_names);
<div class="text-center">
<h1>Wina shift counter</h1>
<form class="mb-2" method="get">
<select name="worklist[]" class="selectpicker" data-style="btn-primary" multiple>
<select name="worklist[]" class="selectpicker" data-style="btn-primary" data-live-search="true" multiple>
<?php
foreach($worklists as $key => $list) {
echo "<option " . (in_array($key, $checkedLists) ? "selected " : '') . "value='$key'>" . $list . "</option>";