Skip to content
Snippets Groups Projects

Resolve "Enqueue Room image disappears"

Files

@@ -17,7 +17,9 @@
*/
$(function () {
$('select').on('change', function () {
updateRoomInfo(this.value);
// Get the room ID of the currently selected room.
const roomId = $("#inputRoom").find(":selected").attr("value");
updateRoomInfo(roomId);
});
});
@@ -26,19 +28,21 @@ function updateRoomInfo(roomId) {
method: 'get',
url: '/room/' + roomId,
success: function (response) {
if (response.path !== undefined) {
var image = $('<img class="img-fluid" alt="Room map">');
image.attr('src', '/' + response.path);
$('#image-holder').show().html(image);
$('#labelComment').html("Where are you located?");
$('#comment').show();
$('#inputLocation').prop("disabled", false);
} else {
$('#image-holder').hide();
$('#comment').hide();
$('#labelComment').html("Comment");
$('#inputLocation').prop("disabled", true);
if (response.path === undefined) {
this.error();
return;
}
const image = $('<img class="img-fluid" alt="Room map">');
image.attr('src', '/' + response.path);
$('#image-holder').show().html(image);
$('#comment').show();
$('#inputLocation').prop("disabled", false);
},
error: function() {
$('#image-holder').hide();
$('#comment').hide();
$('#inputLocation').prop("disabled", true);
}
});
}
Loading