diff options
| author | Moritz Strohm <strohm@data-quest.de> | 2026-01-14 10:29:35 +0000 |
|---|---|---|
| committer | Moritz Strohm <strohm@data-quest.de> | 2026-01-14 10:29:35 +0000 |
| commit | 78e46de33b3f205aae375d1ea6d4fe088e0e5124 (patch) | |
| tree | 4b305bf3f7b5d066ac28f011fe752e98901e714c /resources/assets/javascripts/bootstrap | |
| parent | f637e7ae2d086941a11297ccc29ac273ad6759b0 (diff) | |
allow booking separable rooms in courses, closes #639
Closes #639
Merge request studip/studip!4039
Diffstat (limited to 'resources/assets/javascripts/bootstrap')
| -rw-r--r-- | resources/assets/javascripts/bootstrap/raumzeit.js | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/resources/assets/javascripts/bootstrap/raumzeit.js b/resources/assets/javascripts/bootstrap/raumzeit.js index 76aec32..3a6414e 100644 --- a/resources/assets/javascripts/bootstrap/raumzeit.js +++ b/resources/assets/javascripts/bootstrap/raumzeit.js @@ -5,128 +5,6 @@ STUDIP.Dialog.handlers.header['X-Raumzeit-Update-Times'] = function(json) { $('.course-admin #course-' + info.course_id + ' .raumzeit').html(info.html); }; -STUDIP.ready(function () { - $('#block_appointments_days input').click(function() { - var clicked_id = parseInt(this.id.split('_').pop(), 10); - if (clicked_id === 0 || clicked_id === 1) { - $('#block_appointments_days input:checkbox').prop('checked', function(i) { - return i === clicked_id; - }); - } else { - $('#block_appointments_days_0').prop('checked', false); - $('#block_appointments_days_1').prop('checked', false); - } - }); -}); - -$(document).on('change', 'select[name=room_sd]', function() { - $('input[type=radio][name=room][value=room]').prop('checked', true); -}); - -$(document).on('focus', 'input[name=freeRoomText_sd]', function() { - $('input[type=radio][name=room][value=freetext]').prop('checked', true); -}); - -$(document).on('click', '.bookable_rooms_action', function(event) { - var select = $(this).prev('select')[0], - me = $(this); - if (select !== null && select !== undefined) { - if (me.data('state') === 'enabled') { - STUDIP.Raumzeit.disableBookableRooms(me); - } else { - if (me.data('options') === undefined) { - me.data( - 'options', - $(select) - .children('option') - .clone(true) - ); - } else { - $(select) - .empty() - .append(me.data('options').clone(true)); - } - - let singleDate; - if ($(this).parents('form').attr('action').split('saveDate/').length > 1) { - singleDate = $(this) - .parents('form') - .attr('action') - .split('saveDate/')[1] - .split('?')[0]; - } - - let checked_dates; - if ($("input[name='checked_dates']").length > 0) { - checked_dates = $("input[name='checked_dates']") - .val() - .split(','); - } else { - checked_dates = [singleDate]; - var startDate = $("input[name='date']").val(); - var start_time = $("input[name='start_time']") - .val() - .split(':'); - var end_time = $("input[name='end_time']") - .val() - .split(':'); - var date_obj = [ - { name: 'startDate', value: startDate }, - { name: 'start_stunde', value: start_time[0] }, - { name: 'start_minute', value: start_time[1] }, - { name: 'end_stunde', value: end_time[0] }, - { name: 'end_minute', value: end_time[1] } - ]; - } - - $.ajax({ - type: 'POST', - url: STUDIP.ABSOLUTE_URI_STUDIP + 'dispatch.php/resources/helpers/bookable_rooms', - data: { - rooms: _.map(select.options, 'value'), - selected_dates: checked_dates, - singleDateID: singleDate, - new_date: date_obj - }, - success: function(result) { - if ($.isArray(result)) { - if (result.length) { - var not_bookable_rooms = _.map(result, function(v) { - return $(select) - .children('option[value=' + v + ']') - .text() - .trim(); - }); - select.title = - $gettext('Nicht buchbare Räume:') + ' ' + not_bookable_rooms.join(', '); - } else { - select.title = ''; - } - _.each(result, function(v) { - $(select) - .children('option[value=' + v + ']') - .prop('disabled', true); - }); - } else { - select.title = ''; - } - me.attr('title', $gettext('Alle Räume anzeigen')); - me.data('state', 'enabled'); - } - }); - } - } - event.preventDefault(); -}); - -$(document).on('change', 'input[name="singledate[]"]', function() { - STUDIP.Raumzeit.disableBookableRooms($('.bookable_rooms_action')); -}); - -STUDIP.ready((event) => { - $('.bookable_rooms_action', event.target).show(); -}); - $(document).on('change', '.datesBulkActions', function() { var $button = $(this).next('button'); if ($(this).val() === 'delete') { |
