PageSourceSearch

https://www.virreyhotel.com/static/js/motor/app.js

js virreyhotel.com collected 2026-09-27 08:01:14 UTC 4,293 bytes, 122 lines download raw bytes

1import getValues from './get-values.js';
2import UpdateView from './update-view.js';
3import UpdateUrl from './update-url.js';
4import UpdateParams from './update-params.js';
5import { defaultValues } from "./config.js";
6import Utils from './utils.js';
7
8$(function() {
9    let keysAndValues = getValues(defaultValues.hotelsSelectId);
10    let updateView = new UpdateView(keysAndValues);
11    let updateParams = new UpdateParams(keysAndValues);
12
13    updateView.setDateIntoMobileInput();
14    updateView.addRoom(1);
15    updateView.updateAgeChildrenColumn()
16    updateView.updateBabiesColumn();
17    $('.js-total-guests').html(2);
18    $('#room-select').append(updateView.setRoomsSelectInput());
19    //Set start date into motor form
20    const formatToSpanish = (dateStr) => {
21      if (!dateStr) return null;
22      const [year, month, day] = dateStr.split("-");
23      return `${day}/${month}/${year}`;
24    };
25    updateParams.setStay();
26    const today = new Date();
27    today.setHours(0, 0, 0, 0);
28    if (defaultValues.startDate && new Date(defaultValues.startDate) > today) {
29        const minDateFormatted = formatToSpanish(defaultValues.startDate);
30        const endDateFormatted = formatToSpanish(defaultValues.endDate);
31
32        $("#fini_mobile").datepicker("option", "minDate", minDateFormatted);
33        $(".fini_mobile-start").datepicker("option", "minDate", minDateFormatted);
34
35        document.querySelector("#fout_mobile").value = endDateFormatted;
36
37        if (defaultValues.endDate) {
38          $("#fout_mobile").datepicker("option", "minDate", endDateFormatted);
39          $(".fout-mobile-date-end").datepicker(
40            "option",
41            "minDate",
42            endDateFormatted,
43          );
44        }
45    }
46    updateParams.setStay();
47
48    function updateUrlAndHandle() {
49        keysAndValues = getValues(defaultValues.hotelsSelectId);
50
51        // Asegurarse de que keysAndValues tenga todas las propiedades necesarias
52        if (!keysAndValues.startDate || !keysAndValues.endDate || !keysAndValues.numRooms) {
53            console.error("Missing necessary keyAndValues properties");
54            return;
55        }
56
57        let updateUrl = new UpdateUrl(keysAndValues, defaultValues.urlReservation, defaultValues.generalTicker, defaultValues.lang);
58        updateUrl.handle();
59    }
60
61    $(`#${defaultValues.hotelsSelectId}`).on('change', function() {
62        keysAndValues = getValues(defaultValues.hotelsSelectId);
63        updateView = new UpdateView(keysAndValues);
64        updateParams = new UpdateParams(keysAndValues);
65        updateView.handle();
66        updateUrlAndHandle();
67
68        $('#room-select').val(1).change();
69        $('.nino-select').val(0).change();
70        $('.js-total-guests').html(2);
71    });
72
73    $(`#fini_mobile`).on('change', function() {
74        updateParams.updateMobileDateOut();
75        updateUrlAndHandle();
76    });
77
78    $('#room-select').on('change', function() {
79        updateView.updateRoomsView();
80        updateUrlAndHandle();
81    });
82
83    $(document).on('change', '.nino-select', function() {
84        let room_id = $(this).attr('data-room');
85        updateUrlAndHandle();
86    });
87
88    $(`#${defaultValues.motorFormId}`).submit(function(e) {
89        updateParams = new UpdateParams(keysAndValues);
90        updateParams.setStay();
91        updateParams.handle();
92        updateUrlAndHandle();
93    });
94
95    $(document).on('click', '.js-remove-room', function() {
96        updateView.removeRoomElement($(this).data('room'));
97        updateUrlAndHandle();
98    });
99
100    $('.js-add-room').on('click', function() {
101        let room_number = parseInt($('#room-select').val()) + 1;
102        if (room_number <= defaultValues.max_rooms) {
103            $('#room-select').val(room_number).change();
104        }
105    });
106
107    $(document).on('click', '.js-open-room', function() {
108        var btn = $(this);
109        var idRoom = $(this).attr('data-room');
110        updateView.showResponsiveRoom(btn, idRoom);
111    });
112
113    $('.js-apply-guests').on('click', function() {
114        updateParams.setStay();
115        $('.js-total-guests').html(updateParams.getTotalGuest());
116        updateUrlAndHandle();
117
118        // CERRAR SUBBOX correctamente
119        $('.js-personas-subfields').removeClass('active');
120        $('.motor-subox-guests').removeClass('active');
121    });
122});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.