diff --git a/modules/hotelreservationsystem/views/css/HotelReservationAdmin.css b/modules/hotelreservationsystem/views/css/HotelReservationAdmin.css index dd2dca771..a207087a6 100644 --- a/modules/hotelreservationsystem/views/css/HotelReservationAdmin.css +++ b/modules/hotelreservationsystem/views/css/HotelReservationAdmin.css @@ -635,22 +635,3 @@ body.adminhotelroomsbooking .ui-tooltip { .error-border { outline: rgb(210, 124, 130) solid 1px; border-radius: 2px;} -#hotel-images-files-list { - margin-top: 10px;} -#hotel-images-files-list .hotel-images-file-row { - display: flex; - align-items: center; - justify-content: space-between; - padding: 8px 10px; - border-bottom: 1px solid #eee;} -#hotel-images-files-list .hotel-images-file-row:last-child { - border-bottom: none;} -#hotel-images-files-list .hotel-images-file-row > span { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - padding-right: 10px;} -#hotel-images-files-list .hotel-images-file-row > button { - flex-shrink: 0;} -#hotel-images-heading #open-add-hotel-images-modal { - margin-top: 1.5px;} diff --git a/modules/hotelreservationsystem/views/js/hotelImage.js b/modules/hotelreservationsystem/views/js/hotelImage.js index 175e3092b..6a1d3e2af 100644 --- a/modules/hotelreservationsystem/views/js/hotelImage.js +++ b/modules/hotelreservationsystem/views/js/hotelImage.js @@ -43,12 +43,6 @@ $(document).ready(function () { }, 0); } - function updateBadge(delta) - { - var $badge = $('#hotel-images-heading .badge'); - $badge.text(Math.max(0, parseInt($badge.text(), 10) + delta)); - } - function getCheckedImageIds() { return $('.hotel-image-checkbox:checked').map(function () { @@ -68,7 +62,7 @@ $(document).ready(function () { if (fileInput) { fileInput.value = ''; } - renderHotelImagesFileList(null); + $('#hotel-images-file-name').val(''); openModalWithLoader('#addHotelImagesModal'); }); @@ -76,56 +70,17 @@ $(document).ready(function () { $('#hotel-images-file-input').trigger('click'); }); - $(document).on('change', '#hotel-images-file-input', function () { - renderHotelImagesFileList(this.files); + $('#hotel-images-file-name').on('click', function () { + $('#hotel-images-file-input').trigger('click'); }); - $(document).on('click', '.hotel-images-remove-file', function () { - var removeIdx = parseInt($(this).data('index'), 10); - var fileInput = document.getElementById('hotel-images-file-input'); - if (!fileInput || !fileInput.files) { - return; - } - try { - var dt = new DataTransfer(); - for (var i = 0; i < fileInput.files.length; i++) { - if (i !== removeIdx) { - dt.items.add(fileInput.files[i]); - } - } - fileInput.files = dt.files; - } catch (e) { - // ponytail: DataTransfer unsupported in this browser, list just won't reflect the removal - } - renderHotelImagesFileList(fileInput.files); + $('#hotel-images-file-input').on('change', function () { + var fileNames = Array.prototype.map.call(this.files, function (file) { + return file.name; + }); + $('#hotel-images-file-name').val(fileNames.join(', ')); }); - function renderHotelImagesFileList(files) - { - var $list = $('#hotel-images-files-list').empty(); - if (!files || !files.length) { - $list.hide(); - return; - } - $list.show(); - for (var i = 0; i < files.length; i++) { - (function (idx, file) { - var size = file.size < 1048576 - ? (file.size / 1024).toFixed(1) + ' KB' - : (file.size / 1048576).toFixed(1) + ' MB'; - $list.append( - $('
  • ') - .append($('').text(file.name + ' (' + size + ')')) - .append( - $(' -
    + +
    +
    +
    {include file="../../_partials/htl-images-list.tpl"}
    @@ -460,18 +459,25 @@