allerta-vvf/server/templates/edit_training.html

126 lines
5.1 KiB
HTML
Raw Normal View History

2020-07-01 21:00:53 +02:00
<!DOCTYPE html>
<html>
<head>
2020-11-14 23:00:36 +01:00
<link href="favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon">
2020-11-27 23:53:14 +01:00
<script src="{{ urlsoftware }}/resources/dist/{{ resource('main.js') }}"></script>
2021-03-04 09:52:11 +01:00
{% if enable_debug_bar %}{{ debug_bar_head|raw }}{% endif %}
2020-07-01 21:00:53 +02:00
</head>
<body>
2020-11-14 23:00:36 +01:00
{% if training.modalità == "edit" or training.modalità == "add" %}
<form method="post">
<div class="container">
<label><b>{{ 'Training day'|t }}</b></label>
<div class="input-group">
2020-11-25 11:29:19 +01:00
<input aria-label="Date picker" placeholder="DD/MM/YYY" autocomplete="off" name="date" data-provide="datepicker"
value="{{ values.date }}" type="text" class="form-control">
2020-11-14 23:00:36 +01:00
<div class="input-group-addon">
2020-10-19 23:34:49 +02:00
<span class="glyphicon glyphicon-th"></span>
2020-11-14 23:00:36 +01:00
</div>
2020-10-19 23:34:49 +02:00
</div>
2020-11-14 23:00:36 +01:00
<br>
<br>
<label><b>{{ 'Name'|t }}</b></label>
<input id="name" type="text" name="name" placeholder="1° training" required value="{{ values.name }}">
<br>
<br>
<label for="timePicker1"><b>{{ 'Start time'|t }}</b></label>
2020-11-25 11:29:19 +01:00
<input id="timePicker1" type="time" name="start_time" required value="{{ values.beginning }}">
2020-11-14 23:00:36 +01:00
<br>
<br>
<label for="timePicker2"><b>{{ 'End time'|t }}</b></label>
2020-11-25 11:29:19 +01:00
<input id="timePicker2" type="time" name="end_time" required value="{{ values.end }}">
2020-11-14 23:00:36 +01:00
<br>
<br>
<label><b>{{ 'Chief'|t }}</b></label>
<br>
2020-11-25 11:29:19 +01:00
{% for user in training.crew %}
2021-04-25 21:49:47 +02:00
{% if not user.hidden %}
<div class="form-check">
2020-11-25 11:29:19 +01:00
<input aria-label="{{ username(user.id) }}" class="form-check-input chief chief-{{ user.id }}"
style="transform: scale(1.4); -webkit-transform: scale(1.4);" type="checkbox" name='chief[]'
2020-11-14 23:00:36 +01:00
value='{{ user.id }}'>
2020-11-25 11:29:19 +01:00
<label class="form-check-label" for="chief-{{ user.id }}">
2020-11-14 23:00:36 +01:00
{{ username(user.id) }}
</label>
</div>
2021-04-25 21:49:47 +02:00
{% endif %}
2020-11-14 23:00:36 +01:00
{% endfor %}
<script>
2020-11-25 11:29:19 +01:00
$('.chief').on('change', function () {
2020-11-14 23:00:36 +01:00
$('input[name="' + this.name + '"]').not(this).prop('checked', false);
});
</script>
<br>
2020-11-25 11:29:19 +01:00
<label><b>{{ 'Crew'|t }}</b></label>
2020-11-14 23:00:36 +01:00
<br>
2020-11-25 11:29:19 +01:00
{% for user in training.crew %}
2021-04-25 21:49:47 +02:00
{% if not user.hidden %}
<div class="form-check">
2020-11-25 11:29:19 +01:00
<input aria-label="{{ username(user.id) }}" class="form-check-input crew crew-{{ user.id }}"
style="transform: scale(1.4); -webkit-transform: scale(1.4);" type="checkbox" name='crew[]'
2020-11-14 23:00:36 +01:00
value='{{ user.id }}'>
2020-11-25 11:29:19 +01:00
<label class="form-check-label" for="crew-{{ user.id }}">
2020-11-14 23:00:36 +01:00
{{ username(user.id) }}
</label>
</div>
2021-04-25 21:49:47 +02:00
{% endif %}
2020-11-14 23:00:36 +01:00
{% endfor %}
<br>
2021-03-23 19:52:44 +01:00
{% if option('use_location_picker') %}
<label><b>{{ 'Training place'|t }}</b></label>
<div id="map"></div>
<div id="search">
2021-04-24 00:08:27 +02:00
<input type="text" name="addr" value="" id="addr" size="50" />
2021-04-23 19:27:09 +02:00
<button type="button" onclick="allertaJS.maps.addrSearch('{{ 'Search results'|t }}', '{{ 'No results found'|t }}');"
2021-03-23 19:52:44 +01:00
class="btn btn-primary">{{ 'Search'|t }}</button>
<div id="results"></div>
</div>
<input type="hidden" name="place" value="" />
2021-04-23 19:27:09 +02:00
<script src="{{ urlsoftware }}/resources/dist/{{ resource('maps.js') }}" onload="allertaJS.maps.loadMap();"></script>
2021-03-23 19:52:44 +01:00
{% else %}
2020-11-14 23:00:36 +01:00
<label><b>{{ 'Training place'|t }}</b></label>
2020-11-25 11:29:19 +01:00
<input type="text" name="place" required value="{{ values.place }}">
2021-03-23 19:52:44 +01:00
{% endif %}
2020-11-14 23:00:36 +01:00
<br>
<br>
<label><b>{{ 'Others notes (ex. others infos)'|t }}</b></label><br>
2020-11-25 11:29:19 +01:00
<textarea name='notes'></textarea>
2020-11-14 23:00:36 +01:00
<br>
<br>
<input id="modalità" type="hidden" value="{{ training.modalità }}" name="mod"></input>
<input id="id" type="hidden" value="{{ training.id }}" name="id"></input>
<input id="token" type="hidden" value="{{ training.token }}" name="token"></input>
<button type="submit">{{ 'Submit'|t }}</button>
2020-10-19 23:34:49 +02:00
</div>
2020-11-14 23:00:36 +01:00
</form>
<script>
{% if training.modalità == "edit" %}
2020-11-25 11:29:19 +01:00
$.each('{{ values.chief|striptags|e("js") }}'.split(','), function (index, value) {
$('.chief-' + value).prop('checked', true);
2020-07-01 21:00:53 +02:00
});
2020-11-25 11:29:19 +01:00
$.each('{{ values.crew|striptags|e("js") }}'.split(','), function (index, value) {
$('.crew-' + value).prop('checked', true);
2020-11-14 23:00:36 +01:00
});
2020-11-25 11:29:19 +01:00
$('#notes').val('{{ values.notes|e("js") }}');
2020-11-14 23:00:36 +01:00
{% endif %}
</script>
{% endif %}
{% if training.modalità == "delete" %}
<div style="margin: 0 auto; text-align: center">
<p>{{ 'Are you sure you want to delete the training?'|t }}</p>
<form method="post">
<input id="modalità" type="hidden" value="delete" name="mod"></input>
<input id="token" type="hidden" value="{{ training.token }}" name="token"></input>
<input id="id" type="hidden" value="{{ training.id }}" name="id"></input>
2021-03-23 19:52:44 +01:00
<button id="remove" type="submit">{{ 'Submit'|t }}</button>
2020-11-14 23:00:36 +01:00
</form>
<script>
$('form').submit(function () {
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>
2020-11-14 23:00:36 +01:00
{% endif %}
2021-03-04 09:52:11 +01:00
{% if enable_debug_bar %}{{ debug_bar|raw }}{% endif %}
2020-07-01 21:00:53 +02:00
</body>
</html>