Added Babel, IE11 support and services fix
This commit is contained in:
parent
e23b3de224
commit
26ee25155a
|
@ -236,6 +236,8 @@ class database{
|
|||
$this->options = $this->exec("SELECT * FROM `%PREFIX%_options` WHERE `enabled` = 1", true);
|
||||
file_put_contents($this->options_cache_file, serialize( $this->options ));
|
||||
}
|
||||
} else {
|
||||
$this->options = $this->exec("SELECT * FROM `%PREFIX%_options` WHERE `enabled` = 1", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,7 +293,7 @@ class database{
|
|||
//return empty($option) ? "" : $option[0]["value"];
|
||||
foreach($this->options as $option){
|
||||
if($name == $option["name"]){
|
||||
return empty($option["value"]) ? "" : $option["value"];
|
||||
return empty($option["value"]) ? false : $option["value"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -342,6 +344,7 @@ class database{
|
|||
bdump($personale);
|
||||
$increment = implode(",", $increment);
|
||||
bdump($increment);
|
||||
$data = date('Y-m-d H:i:s', strtotime($data));
|
||||
$sql = "INSERT INTO `%PREFIX%_services` (`id`, `data`, `codice`, `uscita`, `rientro`, `capo`, `autisti`, `personale`, `luogo`, `note`, `tipo`, `increment`, `inserted_by`) VALUES (NULL, :data, :codice, :uscita, :rientro, :capo, :autisti, :personale, :luogo, :note, :tipo, :increment, :inserted_by);";
|
||||
$this->exec($sql, false, [":data" => $data, ":codice" => $codice, "uscita" => $uscita, ":rientro" => $rientro, ":capo" => $capo, ":autisti" => $autisti, ":personale" => $personale, ":luogo" => $luogo, ":note" => $note, ":tipo" => $tipo, ":increment" => $increment, ":inserted_by" => $inserted_by]);
|
||||
$this->increment($increment);
|
||||
|
@ -363,6 +366,7 @@ class database{
|
|||
bdump($personale);
|
||||
$increment = implode(",", $increment);
|
||||
bdump($increment);
|
||||
$data = date('Y-m-d H:i:s', strtotime($data));
|
||||
$sql = "INSERT INTO `%PREFIX%_trainings` (`id`, `data`, `name`, `inizio`, `fine`, `capo`, `personale`, `luogo`, `note`, `increment`, `inserted_by`) VALUES (NULL, :data, :name, :start_time, :end_time, :capo, :personale, :luogo, :note, :increment, :inserted_by);";
|
||||
$this->exec($sql, false, [":data" => $data, ":name" => $name, "start_time" => $start_time, ":end_time" => $end_time, ":capo" => $capo, ":personale" => $personale, ":luogo" => $luogo, ":note" => $note, ":increment" => $increment, ":inserted_by" => $inserted_by]);
|
||||
$this->increment_trainings($increment);
|
||||
|
|
|
@ -4,7 +4,7 @@ if($tools->validate_form_data('$post-mod', true, "add")) {
|
|||
if($tools->validate_form_data(['$post-data', '$post-codice', '$post-uscita', '$post-rientro', '$post-capo', '$post-luogo', '$post-note', '$post-tipo', '$post-token'])) {
|
||||
if($_POST["token"] == $_SESSION['token']){
|
||||
bdump("adding service");
|
||||
$database->add_service($_POST["data"], $_POST["codice"], $_POST["uscita"], $_POST["rientro"], $_POST["capo"], $tools->extract_unique($_POST["autisti"]), $tools->extract_unique($_POST["personale"]), $_POST["luogo"], $_POST["note"], $_POST["tipo"], $tools->extract_unique([$_POST["capo"],$_POST["autisti"],$_POST["personale"]]), $user->name());
|
||||
$database->add_service($_POST["data"], $_POST["codice"], $_POST["uscita"], $_POST["rientro"], $_POST["capo"][0], $tools->extract_unique($_POST["autisti"]), $tools->extract_unique($_POST["personale"]), $_POST["luogo"], $_POST["note"], $_POST["tipo"], $tools->extract_unique([$_POST["capo"],$_POST["autisti"],$_POST["personale"]]), $user->name());
|
||||
$tools->redirect("services.php");
|
||||
} else {
|
||||
$tools->redirect("accessdenied.php");
|
||||
|
@ -15,7 +15,7 @@ if($tools->validate_form_data('$post-mod', true, "add")) {
|
|||
if($_POST["token"] == $_SESSION['token']){
|
||||
bdump($_POST);
|
||||
bdump("editing service");
|
||||
$database->change_service($_POST["id"], $_POST["data"], $_POST["codice"], $_POST["uscita"], $_POST["rientro"], $_POST["capo"], $tools->extract_unique($_POST["autisti"]), $tools->extract_unique($_POST["personale"]), $_POST["luogo"], $_POST["note"], $_POST["tipo"], $tools->extract_unique([$_POST["capo"],$_POST["autisti"],$_POST["personale"]]), $user->name());
|
||||
$database->change_service($_POST["id"], $_POST["data"], $_POST["codice"], $_POST["uscita"], $_POST["rientro"], $_POST["capo"][0], $tools->extract_unique($_POST["autisti"]), $tools->extract_unique($_POST["personale"]), $_POST["luogo"], $_POST["note"], $_POST["tipo"], $tools->extract_unique([$_POST["capo"],$_POST["autisti"],$_POST["personale"]]), $user->name());
|
||||
$tools->redirect("services.php");
|
||||
} else {
|
||||
$tools->redirect("accessdenied.php");
|
||||
|
|
|
@ -455,7 +455,7 @@ function initOptions($name, $visible, $developer, $password, $report_email, $own
|
|||
if($developer){
|
||||
$auth->admin()->addRoleForUserById($userId, \Delight\Auth\Role::DEVELOPER);
|
||||
}
|
||||
$option_check_cf_ip = empty($_SERVER['HTTP_CF_CONNECTING_IP']) ? "INSERT INTO `".$prefix."_options` (`id`, `name`, `value`, `enabled`, `created_time`, `last_edit`, `user_id`) VALUES ('11', 'check_cf_ip', 1, '1', current_timestamp(), current_timestamp(), '1');" : "INSERT INTO `".$prefix."_options` (`id`, `name`, `value`, `enabled`, `created_time`, `last_edit`, `user_id`) VALUES ('10', 'check_cf_ip', 0, '1', current_timestamp(), current_timestamp(), '1');";
|
||||
$option_check_cf_ip = empty($_SERVER['HTTP_CF_CONNECTING_IP']) ? "INSERT INTO `".$prefix."_options` (`id`, `name`, `value`, `enabled`, `created_time`, `last_edit`, `user_id`) VALUES (NULL, 'check_cf_ip', 1, '1', current_timestamp(), current_timestamp(), '1');" : "INSERT INTO `".$prefix."_options` (`id`, `name`, `value`, `enabled`, `created_time`, `last_edit`, `user_id`) VALUES (NULL, 'check_cf_ip', 0, '1', current_timestamp(), current_timestamp(), '1');";
|
||||
$prep = $connection->prepare("
|
||||
INSERT INTO `".$prefix."_profiles` (`id`, `hidden`) VALUES (NULL, :hidden);
|
||||
INSERT INTO `".$prefix."_options` (`id`, `name`, `value`, `enabled`, `created_time`, `last_edit`, `user_id`) VALUES (NULL, 'report_email', :report_email, 1, current_timestamp(), current_timestamp(), '1');
|
||||
|
@ -470,6 +470,8 @@ INSERT INTO `".$prefix."_options` (`id`, `name`, `value`, `enabled`, `created_ti
|
|||
INSERT INTO `".$prefix."_options` (`id`, `name`, `value`, `enabled`, `created_time`, `last_edit`, `user_id`) VALUES (NULL, 'cron_job_code', :cron_job_code, 1, current_timestamp(), current_timestamp(), '1');
|
||||
INSERT INTO `".$prefix."_options` (`id`, `name`, `value`, `enabled`, `created_time`, `last_edit`, `user_id`) VALUES (NULL, 'cron_job_enabled', 1, 1, current_timestamp(), current_timestamp(), '1');
|
||||
INSERT INTO `".$prefix."_options` (`id`, `name`, `value`, `enabled`, `created_time`, `last_edit`, `user_id`) VALUES (NULL, 'cron_job_time', :cron_job_time, 1, current_timestamp(), current_timestamp(), '1');
|
||||
INSERT INTO `".$prefix."_options` (`id`, `name`, `value`, `enabled`, `created_time`, `last_edit`, `user_id`) VALUES (NULL, 'service_edit', 1, 1, current_timestamp(), current_timestamp(), '1');
|
||||
INSERT INTO `".$prefix."_options` (`id`, `name`, `value`, `enabled`, `created_time`, `last_edit`, `user_id`) VALUES (NULL, 'service_remove', 1, 1, current_timestamp(), current_timestamp(), '1');
|
||||
$option_check_cf_ip");
|
||||
mt_srand(10);
|
||||
$prep->bindValue(':hidden', ($visible ? 0 : 1), PDO::PARAM_INT);
|
||||
|
|
|
@ -26,7 +26,6 @@ foreach($risultato as $row){
|
|||
$editorName,
|
||||
$row['date']." ".$row['time']
|
||||
];
|
||||
$changedName . "</td><td>" . $editorName ."</td><td>" . $row['date'] . " - ore " . $row['time'] . "</tr>";
|
||||
}
|
||||
}
|
||||
header("Content-type: application/json");
|
||||
|
|
|
@ -3,55 +3,38 @@ include_once("../../core.php");
|
|||
init_class();
|
||||
$user->requirelogin(false);
|
||||
|
||||
$impostazioni['edit'] = true;
|
||||
$impostazioni['delete'] = true;
|
||||
$risultato = $database->exec("SELECT * FROM `%PREFIX%_services` ORDER BY data DESC, uscita DESC", true);
|
||||
|
||||
$risultato = $database->exec("SELECT * FROM `%PREFIX%_services` ORDER BY data DESC, uscita desc", true); // Pesco i dati della table e li ordino in base alla data
|
||||
?>
|
||||
<div style='margin: 20px 0;' class="mx-auto">
|
||||
<div style='margin: 2px auto' id="new-search-area"></div>
|
||||
<div class="table-responsive">
|
||||
<div style="overflow-x:auto;">
|
||||
<table id="services" cellspacing='0' class="display table table-striped table-bordered dt-responsive nowrap" style="width: 90%; text-align:center;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php t("Date"); ?></th>
|
||||
<th><?php t("Code"); ?></th>
|
||||
<th><?php t("Start time"); ?></th>
|
||||
<th><?php t("End time"); ?></th>
|
||||
<th><?php t("Chief"); ?></th>
|
||||
<th><?php t("Drivers"); ?></th>
|
||||
<th><?php t("People"); ?></th>
|
||||
<th><?php t("Place"); ?></th>
|
||||
<th><?php t("Notes"); ?></th>
|
||||
<th><?php t("Type"); ?></th>
|
||||
<?php if($impostazioni['edit']) { echo "<th>".t("Edit", false)."</th>"; } ?>
|
||||
<?php if($impostazioni['delete']) { echo "<th>".t("Remove", false)."</th>"; } ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$response = [];
|
||||
foreach($risultato as $row){
|
||||
$chief = $user->nameById($row["capo"]);
|
||||
$drivers = "";
|
||||
foreach(explode(",", $row['autisti']) as $key=>$name){
|
||||
$drivers = $drivers.$user->nameById($name).", ";
|
||||
}
|
||||
$others_people = "";
|
||||
foreach(explode(",", $row['personale']) as $key=>$name){
|
||||
$others_people = $others_people.$user->nameById($name).", ";
|
||||
}
|
||||
echo "<tr><td>" . $row['data'] . "</td><td>" . $row['codice'] . "</td><td>" . $row['uscita'] . "</td><td>" . $row['rientro'] . "</td><td>" . $chief . "</td><td>" . $drivers . "</td><td>" . $others_people . "</td><td>" . s($row['luogo'],false,true) . "</td><td>" . s($row['note'],false,true) . "</td><td>" . s($row['tipo'],false,true) . "</td>";
|
||||
if($impostazioni['edit']) {
|
||||
echo "<td><a href='edit_service.php?edit&id={$row['id']}'><i style='font-size: 40px' class='fa fa-edit'></i></a></td>";
|
||||
}
|
||||
if($impostazioni['delete']) {
|
||||
echo "<td><a href='edit_service.php?delete&id={$row['id']}&increment={$row['increment']}'><i style='font-size: 40px' class='fa fa-trash'></i></a></td></tr>";
|
||||
}
|
||||
$chief = $user->nameById($row["capo"]);
|
||||
|
||||
$drivers_array = explode(",", $row['autisti']);
|
||||
foreach($drivers_array as $key=>$name){
|
||||
$drivers_array[$key] = $user->nameById($name);
|
||||
}
|
||||
$drivers = implode(", ", $drivers_array);
|
||||
|
||||
$others_people_array = explode(",", $row['personale']);
|
||||
foreach($others_people_array as $key=>$name){
|
||||
$others_people_array[$key] = $user->nameById($name);
|
||||
}
|
||||
$others_people = implode(", ", $others_people_array);
|
||||
$response[] = [
|
||||
$row['data'],
|
||||
$row['codice'],
|
||||
$row['uscita'],
|
||||
$row['rientro'],
|
||||
$chief,
|
||||
$drivers,
|
||||
$others_people,
|
||||
s($row['luogo'],false,true),
|
||||
s($row['note'],false,true),
|
||||
s($row['tipo'],false,true),
|
||||
$database->getOption("service_edit") ? "<a href='edit_service.php?edit&id={$row['id']}'><i style='font-size: 40px' class='fa fa-edit'></i></a>" : null,
|
||||
$database->getOption("service_remove") ? "<a href='edit_service.php?delete&id={$row['id']}&increment={$row['increment']}'><i style='font-size: 40px' class='fa fa-trash'></i></a>" : null
|
||||
];
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
header("Content-type: application/json");
|
||||
print(json_encode($response));
|
||||
?>
|
File diff suppressed because it is too large
Load Diff
|
@ -11,8 +11,13 @@
|
|||
"license": "GPL3",
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-free": "^5.15.1",
|
||||
"@babel/core": "^7.12.3",
|
||||
"@babel/plugin-transform-runtime": "^7.12.1",
|
||||
"@babel/preset-env": "^7.12.1",
|
||||
"babel-loader": "^8.1.0",
|
||||
"bootstrap": "^4.5.2",
|
||||
"bootstrap-cookie-alert": "^1.2.1",
|
||||
"bootstrap-datepicker": "^1.9.0",
|
||||
"clean-webpack-plugin": "^3.0.0",
|
||||
"css-loader": "^4.3.0",
|
||||
"expose-loader": "^1.0.1",
|
||||
|
@ -22,11 +27,11 @@
|
|||
"jquery": "^3.5.1",
|
||||
"leaflet": "^1.7.1",
|
||||
"leaflet.locatecontrol": "^0.72.0",
|
||||
"pickadate": "^5.0.0-alpha.3",
|
||||
"popper.js": "^1.16.1",
|
||||
"sass": "^1.27.0",
|
||||
"sass-loader": "^10.0.3",
|
||||
"style-loader": "^1.3.0",
|
||||
"time-input-polyfill": "^1.0.9",
|
||||
"webpack": "^4.44.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,9 @@ import 'bootstrap';
|
|||
import 'bootstrap/dist/css/bootstrap.min.css';
|
||||
import './font-awesome.scss';
|
||||
import '../node_modules/bootstrap-cookie-alert/cookiealert.css'; // TODO: migrate to Bootstrap Italia
|
||||
import pickadate from 'pickadate'
|
||||
import 'bootstrap-datepicker';
|
||||
import '../node_modules/bootstrap-datepicker/dist/css/bootstrap-datepicker3.css';
|
||||
import 'time-input-polyfill/auto';
|
||||
|
||||
$( document ).ajaxError(function(event, xhr, settings, error) {
|
||||
console.error("Error requesting content: "+error+" - status code "+xhr.status);
|
||||
|
@ -73,9 +75,11 @@ function loadTable(table_page){
|
|||
$.each(data, function(num, item) {
|
||||
var row = document.createElement("tr");
|
||||
$.each(item, function(num, i) {
|
||||
var cell = document.createElement("td");
|
||||
cell.innerHTML = i;
|
||||
row.appendChild(cell);
|
||||
if(i !== null){
|
||||
var cell = document.createElement("td");
|
||||
cell.innerHTML = i;
|
||||
row.appendChild(cell);
|
||||
}
|
||||
});
|
||||
document.getElementById("table_body").appendChild(row);
|
||||
});
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
const path = require('path');
|
||||
var webpack = require('webpack');
|
||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
||||
//const workboxPlugin = require('workbox-webpack-plugin');
|
||||
|
||||
module.exports = {
|
||||
entry: {
|
||||
|
@ -16,8 +15,25 @@ module.exports = {
|
|||
path: path.resolve(__dirname, 'dist'),
|
||||
publicPath: '/resources/dist/',
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
// Force all modules to use the same jquery version.
|
||||
'jquery': path.join(__dirname, 'node_modules/jquery/src/jquery')
|
||||
}
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.m?js$/,
|
||||
exclude: /(node_modules|bower_components)/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: ['@babel/preset-env'],
|
||||
plugins: ['@babel/plugin-transform-runtime']
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.css$/i,
|
||||
use: ['style-loader', 'css-loader'],
|
||||
|
@ -33,13 +49,6 @@ module.exports = {
|
|||
exposes: ['$', 'jQuery'],
|
||||
},
|
||||
},
|
||||
{
|
||||
test: require.resolve('pickadate'),
|
||||
loader: 'expose-loader',
|
||||
options: {
|
||||
exposes: ['pickadate'],
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.(gif|png|jpg)(\?v=\d+\.\d+\.\d+)?$/,
|
||||
use: [
|
||||
|
|
|
@ -2,147 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<link href="favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pikaday/1.6.1/css/pikaday.min.css" integrity="sha256-QeBQ7yamXxr4+oYQSRzluL3bLLul8ZpZO4Q/AmI+rvM=" crossorigin="anonymous" />
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/pikaday/1.6.1/pikaday.min.js" integrity="sha256-nzvGziG948yQHPWFJCynD1AmNPBwYWY2nVZYaDCpq4E=" crossorigin="anonymous"></script>
|
||||
<script src="https://code.jquery.com/jquery-3.5.0.min.js" integrity="sha256-xNzN2a4ltkB44Mc/Jz3pT4iU1cmeR0FkXs4pru/JxaQ=" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/pikaday@1.7.0/plugins/pikaday.jquery.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js" integrity="sha256-CutOzxCRucUsn6C6TcEYsauvvYilEniTXldPa6/wu0k=" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/locale/it.js" integrity="sha256-D8y560ZGsKY1LoAajKkQCG7y0Vkye361MH4yFv2K5kk=" crossorigin="anonymous"></script>
|
||||
<style>
|
||||
/* https://stackoverflow.com/a/44280071 */
|
||||
.checkbox label:after {
|
||||
content: '';
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.checkbox .cr {
|
||||
position: relative;
|
||||
border: 1px solid #a9a9a9;
|
||||
border-radius: .25em;
|
||||
width: 1.3em;
|
||||
height: 1.3em;
|
||||
float: left;
|
||||
margin-right: .5em;
|
||||
}
|
||||
|
||||
.checkbox .cr .cr-icon {
|
||||
position: absolute;
|
||||
font-size: .8em;
|
||||
line-height: 0;
|
||||
top: 50%;
|
||||
left: 15%;
|
||||
}
|
||||
|
||||
.checkbox label input[type="checkbox"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.checkbox label input[type="checkbox"]+.cr>.cr-icon {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.checkbox label input[type="checkbox"]:checked+.cr>.cr-icon {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.checkbox label input[type="checkbox"]:disabled+.cr {
|
||||
opacity: .5;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
.switch {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 60px;
|
||||
height: 34px;
|
||||
}
|
||||
|
||||
.switch input {display:none;}
|
||||
|
||||
.slider {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #ccc;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
}
|
||||
|
||||
.slider:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
height: 26px;
|
||||
width: 26px;
|
||||
left: 4px;
|
||||
bottom: 4px;
|
||||
background-color: white;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
}
|
||||
|
||||
input:checked + .slider {
|
||||
background-color: #2196F3;
|
||||
}
|
||||
|
||||
input:focus + .slider {
|
||||
box-shadow: 0 0 1px #2196F3;
|
||||
}
|
||||
|
||||
input:checked + .slider:before {
|
||||
-webkit-transform: translateX(26px);
|
||||
-ms-transform: translateX(26px);
|
||||
transform: translateX(26px);
|
||||
}
|
||||
|
||||
/* Rounded sliders */
|
||||
.slider.round {
|
||||
border-radius: 34px;
|
||||
}
|
||||
|
||||
.slider.round:before {
|
||||
border-radius: 50%;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
function zeroes(number, length) {
|
||||
var my_string = '' + number;
|
||||
while (my_string.length < length) {
|
||||
my_string = '0' + my_string;
|
||||
}
|
||||
|
||||
return my_string;
|
||||
}
|
||||
|
||||
// activate datepickers for all elements with a class of `datepicker`
|
||||
$('.datepicker').pikaday({
|
||||
i18n: {
|
||||
months: ['Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre'],
|
||||
weekdays: ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'],
|
||||
weekdaysShort: ['Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab'],
|
||||
today: 'oggi',
|
||||
clear: 'cancella',
|
||||
},
|
||||
firstDay: 1 ,
|
||||
toString(date, format) {
|
||||
// you should do formatting based on the passed format,
|
||||
// but we will just return 'D/M/YYYY' for simplicity
|
||||
var day = zeroes(date.getDate(), 2);
|
||||
var month = zeroes(date.getMonth() + 1, 2);
|
||||
var year = date.getFullYear();
|
||||
var dat = year + '-' + month + '-' + day;
|
||||
return dat;
|
||||
}});
|
||||
|
||||
// chain a few methods for the first datepicker, jQuery style!
|
||||
$('.datepicker').eq(0).pikaday('show');
|
||||
});
|
||||
</script>
|
||||
<script src="resources/dist/main.js"></script>
|
||||
</head>
|
||||
<style>
|
||||
form {
|
||||
|
@ -208,34 +68,38 @@ textarea {
|
|||
<form method="post">
|
||||
<div class="container">
|
||||
<label><b>{{ 'Service day'|t }}</b></label>
|
||||
<input autocomplete="off" class="datepicker" name="data" placeholder="DD/MM/YYY" type="text" value="{{ values.data }}">
|
||||
<div class="input-group">
|
||||
<input placeholder="DD/MM/YYY" autocomplete="off" name="data" data-provide="datepicker" value="{{ values.data }}" type="text" class="form-control">
|
||||
<div class="input-group-addon">
|
||||
<span class="glyphicon glyphicon-th"></span>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
<label><b>{{ 'Code'|t }}</b></label>
|
||||
<input id="progressivo" type="text" name="codice" placeholder="1234/5" required value="{{ values.codice }}">
|
||||
<br>
|
||||
<br>
|
||||
<label><b>{{ 'Start time'|t }}</b></label>
|
||||
<input type="time" name="uscita" required value="{{ values.uscita }}">
|
||||
<label for="timePicker1"><b>{{ 'Start time'|t }}</b></label>
|
||||
<input id="timePicker1" type="time" name="uscita" required value="{{ values.uscita }}">
|
||||
<br>
|
||||
<br>
|
||||
<label><b>{{ 'End time'|t }}</b></label>
|
||||
<input type="time" name="rientro" required value="{{ values.rientro }}">
|
||||
<label for="timePicker2"><b>{{ 'End time'|t }}</b></label>
|
||||
<input id="timePicker2" type="time" name="rientro" required value="{{ values.rientro }}">
|
||||
<br>
|
||||
<br>
|
||||
<label><b>{{ 'Chief'|t }}</b></label>
|
||||
<br>
|
||||
{% for user in service.personale %}
|
||||
<div {{ user.name == "test" ? "style='display: none'" : "" }} class="checkbox">
|
||||
<label>
|
||||
<input class="capo capo-{{ user.id }}" type="checkbox" name='capo' value='{{ user.id }}'>
|
||||
<span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span>
|
||||
{{ user.name }}
|
||||
<div {{ user.name == "test" ? "style='display: none'" : "" }} class="form-check">
|
||||
<input class="form-check-input capo capo-{{ user.id }}" style="transform: scale(1.4); -webkit-transform: scale(1.4);" type="checkbox" name='capo[]' value='{{ user.id }}'>
|
||||
<label class="form-check-label" for="capo-{{ user.id }}">
|
||||
{{ username(user.id) }}
|
||||
</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<script>
|
||||
$('input[name="capo"]').on('change', function() {
|
||||
$('.capo').on('change', function() {
|
||||
$('input[name="' + this.name + '"]').not(this).prop('checked', false);
|
||||
});
|
||||
</script>
|
||||
|
@ -244,11 +108,10 @@ textarea {
|
|||
<br>
|
||||
{% for user in service.personale %}
|
||||
{% if user.autista == 1 %}
|
||||
<div {{ user.name == "test" ? "style='display: none'" : "" }} class="checkbox">
|
||||
<label>
|
||||
<input class="autisti autisti-{{ user.id }}" type="checkbox" name='autisti[]' value='{{ user.id }}'>
|
||||
<span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span>
|
||||
{{ user.name }}
|
||||
<div {{ user.name == "test" ? "style='display: none'" : "" }} class="form-check">
|
||||
<input class="form-check-input autisti autisti-{{ user.id }}" style="transform: scale(1.4); -webkit-transform: scale(1.4);" type="checkbox" name='autisti[]' value='{{ user.id }}'>
|
||||
<label class="form-check-label" for="autisti-{{ user.id }}">
|
||||
{{ username(user.id) }}
|
||||
</label>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@ -257,11 +120,10 @@ textarea {
|
|||
<label><b>{{ 'Others people'|t }}</b></label>
|
||||
<br>
|
||||
{% for user in service.personale %}
|
||||
<div {{ user.name == "test" ? "style='display: none'" : "" }} class="checkbox">
|
||||
<label>
|
||||
<input class="personale personale-{{ user.id }}" type="checkbox" name='personale[]' value='{{ user.id }}'>
|
||||
<span class="cr"><i class="cr-icon glyphicon glyphicon-ok"></i></span>
|
||||
{{ user.name }}
|
||||
<div {{ user.name == "test" ? "style='display: none'" : "" }} class="form-check">
|
||||
<input class="form-check-input personale personale-{{ user.id }}" style="transform: scale(1.4); -webkit-transform: scale(1.4);" type="checkbox" name='personale[]' value='{{ user.id }}'>
|
||||
<label class="form-check-label" for="personale-{{ user.id }}">
|
||||
{{ username(user.id) }}
|
||||
</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
@ -289,7 +151,7 @@ textarea {
|
|||
</div>
|
||||
</form>
|
||||
<script>
|
||||
//No js Visual Studio Code errors {% if service.modalità == "edit" %}
|
||||
{% if service.modalità == "edit" %}
|
||||
$.each('{{ values.capo }}'.split(','), function( index, value ) {
|
||||
$('.capo-'+value).prop('checked', true);
|
||||
});
|
||||
|
@ -301,7 +163,7 @@ $.each('{{ values.personale }}'.split(','), function( index, value ) {
|
|||
});
|
||||
$( ".tipi" ).val('{{ values.tipo }}');
|
||||
$('#note').val('{{ values.note }}');
|
||||
//{% endif %}
|
||||
{% endif %}
|
||||
$('form').submit(function () {
|
||||
var progressivo_valido = /^[0-9/]{3,6}$/
|
||||
var progressivo = $('#progressivo').val();
|
||||
|
|
|
@ -61,15 +61,40 @@
|
|||
<a id='add' href="edit_service.php?add">{{ 'Add service'|t }}</a>
|
||||
</p>
|
||||
<br>
|
||||
<div id="list"></div>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$( "#list" ).load("resources/ajax/ajax_services.php?"+Math.random());
|
||||
setInterval(function() {
|
||||
$( "#list" ).load("resources/ajax/ajax_services.php?"+Math.random());
|
||||
}, 10000);
|
||||
});
|
||||
</script>
|
||||
<div style="overflow-x:auto;">
|
||||
<table style="width: 90%; text-align:center;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ 'Date'|t }}</th>
|
||||
<th>{{ 'Code'|t }}</th>
|
||||
<th>{{ 'Start time'|t }}</th>
|
||||
<th>{{ 'End time'|t }}</th>
|
||||
<th>{{ 'Chief'|t }}</th>
|
||||
<th>{{ 'Drivers'|t }}</th>
|
||||
<th>{{ 'People'|t }}</th>
|
||||
<th>{{ 'Place'|t }}</th>
|
||||
<th>{{ 'Notes'|t }}</th>
|
||||
<th>{{ 'Type'|t }}</th>
|
||||
{% if option('service_edit') %}
|
||||
<th>{{ 'Edit'|t }}</th>
|
||||
{% endif %}
|
||||
{% if option('service_remove') %}
|
||||
<th>{{ 'Remove'|t }}</th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="table_body">
|
||||
</tbody>
|
||||
</table>
|
||||
<script>
|
||||
$( document ).ready(function() {
|
||||
window.loadTable("services");
|
||||
setInterval(function() {
|
||||
window.loadTable("services");
|
||||
}, 10000);
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
{% endblock %}
|
||||
|
|
|
@ -16,6 +16,16 @@ $twig = new \Twig\Environment($loader, [
|
|||
//'cache' => 'compilation'
|
||||
]);
|
||||
$twig->addFilter($filter);
|
||||
$function_option = new \Twig\TwigFunction('option', function ($option) {
|
||||
global $database;
|
||||
return $database->getOption($option);
|
||||
});
|
||||
$twig->addFunction($function_option);
|
||||
$username_option = new \Twig\TwigFunction('username', function ($id) {
|
||||
global $user;
|
||||
return $user->nameById($id);
|
||||
});
|
||||
$twig->addFunction($username_option);
|
||||
p_stop();
|
||||
|
||||
$template = NULL;
|
||||
|
|
Loading…
Reference in New Issue