allerta-vvf/server/templates/edit_training.html

175 lines
5.3 KiB
HTML
Raw Normal View History

2020-07-01 21:00:53 +02:00
<!DOCTYPE html>
<html>
<head>
<link href="favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon">
2020-10-19 23:34:49 +02:00
<script src="resources/dist/main.js"></script>
2020-07-01 21:00:53 +02:00
</head>
<style>
form {
border: 3px solid #f1f1f1;
}
input[type=text], input[type=password], input[type=email] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
button {
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
}
button:hover {
opacity: 0.8;
}
.container {
padding: 16px;
}
span.psw {
float: right;
padding-top: 16px;
}
/* Change styles for span and cancel button on extra small screens */
@media screen and (max-width: 300px) {
span.psw {
display: block;
float: none;
}
.cancelbtn {
width: 100%;
}
}
textarea {
width: 100%;
height: 150px;
padding: 12px 20px;
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
background-color: #f8f8f8;
resize: none;
}
</style>
<body>
2020-07-03 12:17:46 +02:00
{% if training.modalità == "edit" or training.modalità == "add" %}
2020-07-01 21:00:53 +02:00
<form method="post">
<div class="container">
2020-07-03 11:33:29 +02:00
<label><b>{{ 'Training day'|t }}</b></label>
2020-10-19 23:34:49 +02:00
<div class="input-group">
<input aria-label="Date picker" placeholder="DD/MM/YYY" autocomplete="off" name="data" data-provide="datepicker" value="{{ values.data }}" type="text" class="form-control">
2020-10-19 23:34:49 +02:00
<div class="input-group-addon">
<span class="glyphicon glyphicon-th"></span>
</div>
</div>
2020-07-01 21:00:53 +02:00
<br>
<br>
2020-07-03 11:33:29 +02:00
<label><b>{{ 'Name'|t }}</b></label>
2020-07-03 12:10:41 +02:00
<input id="name" type="text" name="name" placeholder="1° training" required value="{{ values.name }}">
2020-07-01 21:00:53 +02:00
<br>
<br>
2020-10-19 23:34:49 +02:00
<label for="timePicker1"><b>{{ 'Start time'|t }}</b></label>
<input id="timePicker1" type="time" name="start_time" required value="{{ values.inizio }}">
2020-07-01 21:00:53 +02:00
<br>
<br>
2020-10-19 23:34:49 +02:00
<label for="timePicker2"><b>{{ 'End time'|t }}</b></label>
<input id="timePicker2" type="time" name="end_time" required value="{{ values.fine }}">
2020-07-01 21:00:53 +02:00
<br>
<br>
2020-09-27 13:23:37 +02:00
<label><b>{{ 'Chief'|t }}</b></label>
2020-07-01 21:00:53 +02:00
<br>
2020-07-03 12:10:41 +02:00
{% for user in training.personale %}
2020-10-19 23:34:49 +02:00
<div {{ user.name == "test" ? "style='display: none'" : "" }} class="form-check">
<input aria-label="{{ username(user.id) }}" 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 }}'>
2020-10-19 23:34:49 +02:00
<label class="form-check-label" for="capo-{{ user.id }}">
{{ username(user.id) }}
2020-07-01 21:00:53 +02:00
</label>
</div>
{% endfor %}
<script>
2020-10-19 23:34:49 +02:00
$('.capo').on('change', function() {
2020-07-01 21:00:53 +02:00
$('input[name="' + this.name + '"]').not(this).prop('checked', false);
});
</script>
<br>
2020-07-03 11:33:29 +02:00
<label><b>{{ 'Others people'|t }}</b></label>
2020-07-01 21:00:53 +02:00
<br>
2020-07-03 12:10:41 +02:00
{% for user in training.personale %}
2020-10-19 23:34:49 +02:00
<div {{ user.name == "test" ? "style='display: none'" : "" }} class="form-check">
<input aria-label="{{ username(user.id) }}" 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 }}'>
2020-10-19 23:34:49 +02:00
<label class="form-check-label" for="personale-{{ user.id }}">
{{ username(user.id) }}
2020-07-01 21:00:53 +02:00
</label>
</div>
{% endfor %}
<br>
2020-07-03 11:33:29 +02:00
<label><b>{{ 'Training place'|t }}</b></label>
2020-07-01 21:00:53 +02:00
<input type="text" name="luogo" required value="{{ values.luogo }}">
<br>
<br>
2020-07-03 11:33:29 +02:00
<label><b>{{ 'Others notes (ex. others infos)'|t }}</b></label><br>
2020-07-01 21:00:53 +02:00
<textarea name='note'></textarea>
<br>
<br>
2020-10-19 23:34:49 +02:00
<input id="modalità" type="hidden" value="{{ training.modalità }}" name="mod"></input>
2020-07-03 12:10:41 +02:00
<input id="id" type="hidden" value="{{ training.id }}" name="id"></input>
<input id="token" type="hidden" value="{{ training.token }}" name="token"></input>
2020-07-03 11:33:29 +02:00
<button type="submit">{{ 'Submit'|t }}</button>
2020-07-01 21:00:53 +02:00
</div>
</form>
<script>
2020-10-19 23:34:49 +02:00
{% if training.modalità == "edit" %}
2020-07-01 21:00:53 +02:00
$.each('{{ values.capo|striptags|e("js") }}'.split(','), function( index, value ) {
$('.capo-'+value).prop('checked', true);
});
$.each('{{ values.personale|striptags|e("js") }}'.split(','), function( index, value ) {
$('.personale-'+value).prop('checked', true);
});
$('#note').val('{{ values.note|e("js") }}');
2020-10-19 23:34:49 +02:00
{% endif %}
2020-07-01 21:00:53 +02:00
</script>
{% endif %}
2020-07-03 12:17:46 +02:00
{% if training.modalità == "delete" %}
2020-07-01 21:00:53 +02:00
<style>
#add {
outline: none;
cursor: pointer;
text-align: center;
text-decoration: none;
font: bold 12px Arial, Helvetica, sans-serif;
color: #fff;
padding: 10px 20px;
border: solid 1px #0076a3;
background: #0095cd;
}
</style>
<div style="margin: 0 auto; text-align: center">
2020-07-03 11:33:29 +02:00
<p>{{ 'Are you sure you want to delete the training?'|t }}</p>
2020-07-01 21:00:53 +02:00
<form method="post">
2020-07-03 12:17:46 +02:00
<input id="modalità" type="hidden" value="delete" name="mod"></input>
2020-07-03 12:10:41 +02:00
<input id="token" type="hidden" value="{{ training.token }}" name="token"></input>
<input id="id" type="hidden" value="{{ training.id }}" name="id"></input>
2020-09-27 00:57:37 +02:00
<input id="increment" type="hidden" value="{{ increment }}" name="increment"></input>
2020-07-03 11:33:29 +02:00
<button id="add" type="submit">{{ 'Submit'|t }}</button>
2020-07-01 21:00:53 +02:00
</form>
<script>
$('form').submit(function () {
2020-07-03 11:33:29 +02:00
return confirm("{{ 'The action cannot be canceled. Are you sure you want to continue?'|t }}");
2020-07-01 21:00:53 +02:00
});
</script>
</div>
{% endif %}
</body>
</html>