From a6fb64dd0f230975fb54e7ffb43da39397ef23cc Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 16 Jan 2025 09:37:19 +0100 Subject: [PATCH] Bug 38149: Adjust tidy of some vue and js files after prettier upgrade Fix xt/js_tidy.t and xt/vue_tidy.t Signed-off-by: Jonathan Druart Signed-off-by: Katrin Fischer (cherry picked from commit 04aa82aa237d1b6768b8a6f25a74bea931d097d9) Signed-off-by: Baptiste Wojtkowski --- .../prog/js/modals/place_booking.js | 67 +++++++++++-------- .../ERM/EHoldingsEBSCOTitlePackagesList.vue | 36 +++++----- .../prog/js/vue/components/ERM/Main.vue | 12 ++-- .../ERM/UsageStatisticsReportBuilder.vue | 4 +- .../js/vue/components/Preservation/Main.vue | 4 +- 5 files changed, 72 insertions(+), 51 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js b/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js index 38f7b21a6c..a1c46401e9 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js +++ b/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js @@ -435,9 +435,8 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { f => f.name === "dateDisable" ); if (disableExists.length === 0) { - periodPicker.config.disable.push(function dateDisable( - date - ) { + periodPicker.config.disable.push( + function dateDisable(date) { // set local copy of selectedDates let selectedDates = periodPicker.selectedDates; @@ -579,7 +578,10 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { } // patron has not yet selected a start date (start date checks) - else if (date <= end_date && date >= start_date) { + else if ( + date <= end_date && + date >= start_date + ) { // same item, disable date if ( booking.item_id && @@ -607,7 +609,8 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { // level booking is the item you just booked out overlapping the end date. } } - }); + } + ); } // Setup listener for itemtype select2 @@ -727,7 +730,8 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { f => f.name === "periodChange" ); if (changeExists.length === 0) { - periodPicker.config.onChange.push(function periodChange( + periodPicker.config.onChange.push( + function periodChange( selectedDates, dateStr, instance @@ -748,7 +752,8 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { // Add subsequent dates based on renewalsAllowed and renewalLength for (let i = 0; i < renewalsAllowed; i++) { nextDate.setDate( - nextDate.getDate() + parseInt(renewalLength) + nextDate.getDate() + + parseInt(renewalLength) ); boldDates.push(new Date(nextDate)); } @@ -784,9 +789,8 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { ); // set available items in select2 - let booked_items = bookings.filter(function ( - booking - ) { + let booked_items = bookings.filter( + function (booking) { let start_date = flatpickr.parseDate( booking.start_date ); @@ -803,8 +807,10 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { } // This booking overlaps return true; - }); - $("#booking_item_id > option").each(function () { + } + ); + $("#booking_item_id > option").each( + function () { let option = $(this); if ( booking_item_id && @@ -812,13 +818,19 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { ) { option.prop("disabled", false); } else if ( - booked_items.some(function (booked_item) { + booked_items.some( + function (booked_item) { return ( - option.val() == booked_item.item_id + option.val() == + booked_item.item_id ); - }) + } + ) ) { - option.attr("data-available", false); + option.attr( + "data-available", + false + ); option.prop("disabled", true); } else { option.attr("data-available", true); @@ -826,22 +838,26 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { option.prop("disabled", false); } } - }); + } + ); $("#booking_item_id").trigger("change.select2"); } // Range not set, reset field options and flatPickr state else { boldDates = []; instance.set("maxDate", null); - $("#booking_item_id > option").each(function () { + $("#booking_item_id > option").each( + function () { let option = $(this); if (option.data("pickup")) { option.prop("disabled", false); } - }); + } + ); $("#booking_item_id").trigger("change.select2"); } - }); + } + ); } // Create a bookings store keyed on date @@ -877,12 +893,8 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { f => f.name === "dayCreate" ); if (dayCreateExists.length === 0) { - periodPicker.config.onDayCreate.push(function dayCreate( - dObj, - dStr, - instance, - dayElem - ) { + periodPicker.config.onDayCreate.push( + function dayCreate(dObj, dStr, instance, dayElem) { const currentDate = dayElem.dateObj; const dateString = currentDate .toISOString() @@ -906,7 +918,8 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { dots.appendChild(dot); }); } - }); + } + ); } // Add hints for days before the start range and after the end range diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOTitlePackagesList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOTitlePackagesList.vue index 752a528610..22329daec4 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOTitlePackagesList.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOTitlePackagesList.vue @@ -160,23 +160,25 @@ export default { ) }, initComplete: function () { - $.fn.dataTable.ext.search.push(function apply_filter( - settings, - data, - dataIndex, - row - ) { - return ( - row.package.name.match( - new RegExp(filters.package_name, "i") - ) && - (filters.selection_type == 0 || - (filters.selection_type == 1 && - row.is_selected) || - (filters.selection_type == 2 && - !row.is_selected)) - ) - }) + $.fn.dataTable.ext.search.push( + function apply_filter( + settings, + data, + dataIndex, + row + ) { + return ( + row.package.name.match( + new RegExp(filters.package_name, "i") + ) && + (filters.selection_type == 0 || + (filters.selection_type == 1 && + row.is_selected) || + (filters.selection_type == 2 && + !row.is_selected)) + ) + } + ) }, }, }) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue index f0b06d0ee1..66a934ad21 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue @@ -102,11 +102,11 @@ export default { av_item_reports_metrics: "ERM_ITEM_REPORTS_METRICS", } - let av_cat_array = Object.keys(authorised_values).map(function ( - av_cat - ) { + let av_cat_array = Object.keys(authorised_values).map( + function (av_cat) { return '"' + authorised_values[av_cat] + '"' - }) + } + ) promises.push( av_client.values @@ -184,7 +184,9 @@ form .v-select { } .v-select, -input:not([type="submit"]):not([type="search"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]), +input:not([type="submit"]):not([type="search"]):not([type="button"]):not( + [type="checkbox"] + ):not([type="radio"]), textarea { border-color: rgba(60, 60, 60, 0.26); border-width: 1px; diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsReportBuilder.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsReportBuilder.vue index a52b4ad484..ae20b0b60d 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsReportBuilder.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/UsageStatisticsReportBuilder.vue @@ -1047,7 +1047,9 @@ h2 { width: 100%; text-align: left; } -input:not([type="submit"]):not([type="search"]):not([type="button"]):not([type="checkbox"]) { +input:not([type="submit"]):not([type="search"]):not([type="button"]):not( + [type="checkbox"] + ) { min-width: 5%; } .month_selectors { diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Main.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Main.vue index 008c1393a7..8b4d01cc7a 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Main.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Preservation/Main.vue @@ -120,7 +120,9 @@ form .v-select { } .v-select, -input:not([type="submit"]):not([type="search"]):not([type="button"]):not([type="checkbox"]), +input:not([type="submit"]):not([type="search"]):not([type="button"]):not( + [type="checkbox"] + ), textarea { border-color: rgba(60, 60, 60, 0.26); border-width: 1px;