allerta-vvf/server/templates/edit_service.html

222 lines
7.1 KiB
HTML
Raw Normal View History

2020-04-27 23:27:39 +02:00
<!DOCTYPE html>
<html>
<head>
<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>
<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 service.modalità == "edit" or service.modalità == "add" %}
2020-04-27 23:27:39 +02:00
<form method="post">
<div class="container">
2020-07-03 11:33:29 +02:00
<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">
<span class="glyphicon glyphicon-th"></span>
</div>
</div>
2020-04-27 23:27:39 +02:00
<br>
<br>
2020-07-03 11:33:29 +02:00
<label><b>{{ 'Code'|t }}</b></label>
<input id="progressivo" type="text" name="codice" placeholder="1234/5" required value="{{ values.codice }}">
2020-04-27 23:27:39 +02:00
<br>
<br>
<label for="timePicker1"><b>{{ 'Start time'|t }}</b></label>
<input id="timePicker1" type="time" name="uscita" required value="{{ values.uscita }}">
2020-04-27 23:27:39 +02:00
<br>
<br>
<label for="timePicker2"><b>{{ 'End time'|t }}</b></label>
<input id="timePicker2" type="time" name="rientro" required value="{{ values.rientro }}">
2020-04-27 23:27:39 +02:00
<br>
<br>
2020-09-27 13:23:37 +02:00
<label><b>{{ 'Chief'|t }}</b></label>
2020-04-27 23:27:39 +02:00
<br>
2020-07-03 12:10:41 +02:00
{% 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) }}
2020-04-27 23:27:39 +02:00
</label>
</div>
{% endfor %}
<script>
$('.capo').on('change', function() {
2020-04-27 23:27:39 +02:00
$('input[name="' + this.name + '"]').not(this).prop('checked', false);
});
</script>
<br>
2020-07-03 11:33:29 +02:00
<label><b>{{ 'Drivers'|t }}</b></label>
2020-04-27 23:27:39 +02:00
<br>
2020-07-03 12:10:41 +02:00
{% for user in service.personale %}
2020-05-20 22:49:36 +02:00
{% 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) }}
2020-04-27 23:27:39 +02:00
</label>
</div>
{% endif %}
{% endfor %}
<br>
2020-07-03 11:33:29 +02:00
<label><b>{{ 'Others people'|t }}</b></label>
2020-04-27 23:27:39 +02:00
<br>
2020-07-03 12:10:41 +02:00
{% 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) }}
2020-04-27 23:27:39 +02:00
</label>
</div>
{% endfor %}
<br>
2020-11-13 15:22:26 +01:00
{% 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 %}
2020-07-03 11:33:29 +02:00
<label><b>{{ 'Service place'|t }}</b></label>
<input type="text" name="luogo" required value="{{ values.luogo }}">
2020-11-13 15:22:26 +01:00
{% endif %}
2020-04-27 23:27:39 +02:00
<br>
<br>
2020-07-03 11:33:29 +02:00
<label><b>{{ 'Others notes (ex. others infos)'|t }}</b></label><br>
<textarea name='note' id='note'></textarea>
2020-04-27 23:27:39 +02:00
<br>
<br>
2020-07-03 11:33:29 +02:00
<label><b>{{ 'Service type'|t }}</b></label>
2020-04-27 23:27:39 +02:00
<br>
<select name='tipo' class="tipi">
2020-07-03 12:10:41 +02:00
{% for tipo in service.tipologie %}
<option value='{{ tipo.name }}'>{{ tipo.name }}</option>
2020-04-27 23:27:39 +02:00
{% endfor %}
</select>
<br>
2020-07-03 12:10:41 +02:00
<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>
2020-07-03 11:33:29 +02:00
<button type="submit">{{ 'Submit'|t }}</button>
2020-04-27 23:27:39 +02:00
</div>
</form>
<script>
{% if service.modalità == "edit" %}
$.each('{{ values.capo }}'.split(','), function( index, value ) {
$('.capo-'+value).prop('checked', true);
});
$.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 }}');
{% endif %}
2020-04-27 23:27:39 +02:00
$('form').submit(function () {
var progressivo_valido = /^[0-9/]{3,6}$/
var progressivo = $('#progressivo').val();
if(!progressivo_valido.test(progressivo)){
2020-07-03 11:33:29 +02:00
var invia_progressivo = confirm("{{ 'The code has been detected as incorrect, do you want to add the service anyway?'|t }}");
2020-04-27 23:27:39 +02:00
} else {
var invia_progressivo = true;
}
return invia_progressivo;
});
</script>
{% endif %}
2020-07-03 12:17:46 +02:00
{% if service.modalità == "delete" %}
2020-04-27 23:27:39 +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 service?'|t }}</p>
2020-04-27 23:27:39 +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="{{ service.token }}" name="token"></input>
<input id="id" type="hidden" value="{{ service.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-04-27 23:27:39 +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-04-27 23:27:39 +02:00
});
</script>
</div>
{% endif %}
</body>
</html>