2020-04-27 23:27:39 +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">
|
|
|
|
<script src="resources/dist/main.js"></script>
|
2020-04-27 23:27:39 +02:00
|
|
|
</head>
|
|
|
|
<body>
|
2020-11-14 23:00:36 +01:00
|
|
|
{% if service.modalità == "edit" or service.modalità == "add" %}
|
|
|
|
<form method="post">
|
|
|
|
<div class="container">
|
|
|
|
<label><b>{{ 'Service day'|t }}</b></label>
|
|
|
|
<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">
|
|
|
|
<div class="input-group-addon">
|
2020-10-19 22:16:24 +02:00
|
|
|
<span class="glyphicon glyphicon-th"></span>
|
2020-11-14 23:00:36 +01:00
|
|
|
</div>
|
2020-10-19 22:16:24 +02:00
|
|
|
</div>
|
2020-11-14 23:00:36 +01:00
|
|
|
<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 for="timePicker1"><b>{{ 'Start time'|t }}</b></label>
|
|
|
|
<input id="timePicker1" type="time" name="uscita" required value="{{ values.uscita }}">
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<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="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 }}'>
|
|
|
|
<label class="form-check-label" for="capo-{{ user.id }}">
|
|
|
|
{{ username(user.id) }}
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
<script>
|
|
|
|
$('.capo').on('change', function () {
|
|
|
|
$('input[name="' + this.name + '"]').not(this).prop('checked', false);
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<br>
|
|
|
|
<label><b>{{ 'Drivers'|t }}</b></label>
|
|
|
|
<br>
|
|
|
|
{% for user in service.personale %}
|
|
|
|
{% if user.autista == 1 %}
|
|
|
|
<div {{ user.name == "test" ? "style='display: none'" : "" }} class="form-check">
|
|
|
|
<input aria-label="{{ username(user.id) }}" 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 %}
|
|
|
|
{% endfor %}
|
|
|
|
<br>
|
|
|
|
<label><b>{{ 'Others people'|t }}</b></label>
|
|
|
|
<br>
|
|
|
|
{% for user in service.personale %}
|
|
|
|
<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 }}'>
|
|
|
|
<label class="form-check-label" for="personale-{{ user.id }}">
|
|
|
|
{{ username(user.id) }}
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
<br>
|
|
|
|
{% if option('use_location_picker') %}
|
|
|
|
<label><b>{{ 'Service place'|t }}</b></label>
|
|
|
|
<div id="map"></div>
|
|
|
|
<div id="search">
|
|
|
|
<input type="text" name="addr" value="" id="addr" size="10" />
|
|
|
|
<button type="button" onclick="addr_search('{{ 'Search results'|t }}', '{{ 'No results found'|t }}');"
|
|
|
|
class="btn btn-primary">{{ 'Search'|t }}</button>
|
|
|
|
<div id="results"></div>
|
|
|
|
</div>
|
|
|
|
<input type="hidden" name="luogo" value="" />
|
|
|
|
<script src="resources/dist/maps.js" onload="load_map();"></script>
|
|
|
|
{% else %}
|
|
|
|
<label><b>{{ 'Service place'|t }}</b></label>
|
|
|
|
<input type="text" name="luogo" required value="{{ values.luogo }}">
|
|
|
|
{% endif %}
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<label><b>{{ 'Others notes (ex. others infos)'|t }}</b></label><br>
|
|
|
|
<textarea name='note' id='note'></textarea>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<label><b>{{ 'Service type'|t }}</b></label>
|
|
|
|
<br>
|
|
|
|
<select name='tipo' class="tipi">
|
|
|
|
{% for tipo in service.tipologie %}
|
|
|
|
<option value='{{ tipo.name }}'>{{ tipo.name }}</option>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
<br>
|
|
|
|
<input id="modalità" type="hidden" value="{{ service.modalità }}" name="mod"></input>
|
|
|
|
<input id="token" type="hidden" value="{{ service.token }}" name="token"></input>
|
|
|
|
<input id="id" type="hidden" value="{{ service.id }}" name="id"></input>
|
|
|
|
<button type="submit">{{ 'Submit'|t }}</button>
|
2020-10-19 22:16:24 +02:00
|
|
|
</div>
|
2020-11-14 23:00:36 +01:00
|
|
|
</form>
|
|
|
|
<script>
|
|
|
|
{% if service.modalità == "edit" %}
|
|
|
|
$.each('{{ values.capo }}'.split(','), function (index, value) {
|
|
|
|
$('.capo-' + value).prop('checked', true);
|
2020-04-27 23:27:39 +02:00
|
|
|
});
|
2020-11-14 23:00:36 +01:00
|
|
|
$.each('{{ values.autisti }}'.split(','), function (index, value) {
|
|
|
|
$('.autisti-' + value).prop('checked', true);
|
|
|
|
});
|
|
|
|
$.each('{{ values.personale }}'.split(','), function (index, value) {
|
|
|
|
$('.personale-' + value).prop('checked', true);
|
|
|
|
});
|
|
|
|
$(".tipi").val('{{ values.tipo }}');
|
|
|
|
$('#note').val('{{ values.note }}');
|
2020-11-13 15:22:26 +01:00
|
|
|
{% endif %}
|
2020-11-14 23:00:36 +01:00
|
|
|
$('form').submit(function () {
|
|
|
|
var progressivo_valido = /^[0-9/]{3,6}$/
|
|
|
|
var progressivo = $('#progressivo').val();
|
|
|
|
if (!progressivo_valido.test(progressivo)) {
|
|
|
|
var invia_progressivo = confirm(
|
|
|
|
"{{ 'The code has been detected as incorrect, do you want to add the service anyway?'|t }}");
|
|
|
|
} else {
|
|
|
|
var invia_progressivo = true;
|
|
|
|
}
|
|
|
|
return invia_progressivo;
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
{% endif %}
|
|
|
|
{% if service.modalità == "delete" %}
|
|
|
|
<div style="margin: 0 auto; text-align: center">
|
|
|
|
<p>{{ 'Are you sure you want to delete the service?'|t }}</p>
|
|
|
|
<form method="post">
|
|
|
|
<input id="modalità" type="hidden" value="delete" name="mod"></input>
|
|
|
|
<input id="token" type="hidden" value="{{ service.token }}" name="token"></input>
|
|
|
|
<input id="id" type="hidden" value="{{ service.id }}" name="id"></input>
|
|
|
|
<input id="increment" type="hidden" value="{{ increment }}" name="increment"></input>
|
|
|
|
<button id="add" type="submit">{{ 'Submit'|t }}</button>
|
|
|
|
</form>
|
|
|
|
<script>
|
|
|
|
$('form').submit(function () {
|
|
|
|
return confirm("{{ 'The action cannot be canceled. Are you sure you want to continue?'|t }}");
|
|
|
|
});
|
|
|
|
</script>
|
2020-04-27 23:27:39 +02:00
|
|
|
</div>
|
2020-11-14 23:00:36 +01:00
|
|
|
{% endif %}
|
2020-04-27 23:27:39 +02:00
|
|
|
</body>
|
|
|
|
</html>
|