fix checkbox #found behaviour

This commit is contained in:
koksnuss 2020-05-09 16:58:53 +02:00
parent c01e7998ac
commit f8024b747e
2 changed files with 28 additions and 7 deletions

View File

@ -64,6 +64,11 @@ $(document).ready(function() {
// Misc // Misc
// //
// checkbox #found
$('#found').change(function() {
render_found();
});
// checkbox #exists // checkbox #exists
$('input#exists').change(function() { $('input#exists').change(function() {
@ -106,14 +111,10 @@ $(document).ready(function() {
$(this).prop('disabled', ''); $(this).prop('disabled', '');
}); });
} // do post processing
}); render_found();
// datepicker TODO make it nicer }
$.datepicker.setDefaults( $.datepicker.regional['de'] );
$('input[name=found_on]').datepicker({
defaultDate: new Date(),
dateFormat: 'dd.mm.yy'
}); });
// select username on change // select username on change
@ -123,6 +124,13 @@ $(document).ready(function() {
render_login(this.value, color); render_login(this.value, color);
}); });
// datepicker TODO make it nicer
$.datepicker.setDefaults( $.datepicker.regional['de'] );
$('input[name=found_on]').datepicker({
defaultDate: new Date(),
dateFormat: 'dd.mm.yy'
});
// //
// Functions // Functions
@ -157,6 +165,18 @@ $(document).ready(function() {
} }
} }
function render_found() {
let checked = $('#found').prop('checked');
console.log(checked);
$('#found_by, #found_on').each(function() {
if (checked) {
$(this).prop('disabled', '');
} else {
$(this).prop('disabled', 'disabled');
}
});
}
// //
// Modals // Modals

View File

@ -65,6 +65,7 @@
<input type="text" name="user" id="text_user" class="form-control"> <input type="text" name="user" id="text_user" class="form-control">
</div> </div>
<div class="form-group"> <div class="form-group">
<!-- TODO add colorpicker -->
<label for="text_color">Farbe</label> <label for="text_color">Farbe</label>
<input type="text" name="color" id="text_color" class="form-control"> <input type="text" name="color" id="text_color" class="form-control">
</div> </div>